Main Page | Modules | Data Structures | File List | Data Fields

/extra/work/state-dev/src/sul/sul_signals.h

00001 /* ----------------------------------------------------------------------------
00002  * $Id: sul_signals.h,v 1.3 2003/10/06 20:48:13 jlewalle Exp $
00003  *
00004  * --------------------------------------------------------------------------*/
00005 #if !defined(_INCLUDED_SUL_SIGNALS_H_HEADER__)
00006 #define _INCLUDED_SUL_SIGNALS_H_HEADER__
00007 
00019 typedef struct sul_signal_group_t sul_signal_group_t;
00020 
00024 typedef struct sul_signal_t sul_signal_t;
00025 
00029 typedef struct sul_signal_hook_t sul_signal_hook_t;
00030 
00034 typedef sul_error_t *(*sul_sigfn_t)(sul_signal_t *signal, sul_tuple_t *tuple);
00035 
00039 typedef struct sul_sigentries_t sul_sigentries_t;
00040 
00048 SUL_DECLARE(sul_error_t *)
00049 sul_signals_initialize(apr_pool_t *pool);
00050 
00058 SUL_DECLARE(sul_error_t *)
00059 sul_signals_create(const char *name, const char *f);
00060 
00068 SUL_DECLARE(sul_error_t *)
00069 sul_signals_destroy(const char *name);
00070 
00079 SUL_DECLARE(sul_error_t *)
00080 sul_signals_hook(const char *name, sul_sigfn_t fn);
00081 
00090 SUL_DECLARE(sul_error_t *)
00091 sul_signals_unhook(const char *name, sul_sigfn_t fn);
00092 
00100 SUL_DECLARE(sul_error_t *)
00101 sul_signals_get_signal(const char *name, sul_signal_t **signal);
00102 
00110 SUL_DECLARE(sul_error_t *)
00111 sul_signals_get_ring(const char *name, sul_sigentries_t **ring);
00112 
00118 SUL_DECLARE(sul_boolean_t)
00119 sul_signals_valid(const char *name);
00120 
00133 SUL_DECLARE(sul_error_t *)
00134 sul_signals_emit(apr_pool_t *pool, const char *name, ...);
00135 
00142 SUL_DECLARE(const char *)
00143 sul_signals_signal_name(sul_signal_t *signal);
00144 
00151 SUL_DECLARE(const char *)
00152 sul_signals_signal_type(sul_signal_t *signal);
00153 
00154 #if defined(LEGACY_EMIT)
00155 
00163 #define SUL_SIGNALS_EMIT(name, type, args...) \
00164   { sul_sigentries_t *__ring = NULL; \
00165     SUL_ERR(sul_signals_get_ring(name, &__ring)); \
00166     if (__ring != NULL) { \
00167       sul_sigentry_t *__iter = APR_RING_FIRST(__ring); \
00168       while (__iter != APR_RING_SENTINEL(__ring, sul_sigentry_t, link)) { \
00169         type __fn = (type)__iter->fn; \
00170         (*__fn)(args); \
00171         __iter = APR_RING_NEXT(__iter, link); \
00172       } \
00173   } }
00174 
00182 #define SUL_SIGNALS_EMIT_ERR(name, type, args...) \
00183   { sul_sigentries_t *__ring = NULL; \
00184     SUL_ERR(sul_signals_get_ring(name, &__ring)); \
00185     if (__ring != NULL) { \
00186       sul_sigentry_t *__iter = APR_RING_FIRST(__ring); \
00187       while (__iter != APR_RING_SENTINEL(__ring, sul_sigentry_t, link)) { \
00188         type __fn = (type)__iter->fn; \
00189         SUL_ERR((*__fn)(args)); \
00190         __iter = APR_RING_NEXT(__iter, link); \
00191       } \
00192   } }
00193 
00194 #endif
00195 
00198 #endif

Generated on Wed Apr 28 09:38:36 2004 for State by doxygen 1.3.5