00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00021
#ifndef APR_OPTIONAL_HOOK_H
00022
#define APR_OPTIONAL_HOOK_H
00023
00024
#include "apr_tables.h"
00025
00026
#ifdef __cplusplus
00027
extern "C" {
00028
#endif
00029
00047
APU_DECLARE(
void) apr_optional_hook_add(const
char *szName,
void (*pfn)(
void),
00048 const
char * const *aszPre,
00049 const
char * const *aszSucc,
00050
int nOrder);
00051
00063 #define APR_OPTIONAL_HOOK(ns,name,pfn,aszPre,aszSucc,nOrder) do { \
00064 ns##_HOOK_##name##_t *apu__hook = pfn; \
00065
apr_optional_hook_add(#name,(
void (*)(
void))apu__hook,aszPre, aszSucc, nOrder); \
00066 }
while (0)
00067
00073
APU_DECLARE(apr_array_header_t *) apr_optional_hook_get(const
char *szName);
00074
00089 #define APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(ns,link,ret,name,args_decl,args_use,ok,decline) \
00090 link##_DECLARE(ret) ns##_run_##name args_decl \
00091 { \
00092 ns##_LINK_##name##_t *pHook; \
00093
int n; \
00094 ret rv; \
00095 apr_array_header_t *pHookArray=apr_optional_hook_get(#name); \
00096 \
00097
if(!pHookArray) \
00098
return ok; \
00099 \
00100 pHook=(ns##_LINK_##name##_t *)pHookArray->elts; \
00101
for(n=0 ; n < pHookArray->nelts ; ++n) \
00102 { \
00103 rv=(pHook[n].pFunc)args_use; \
00104 \
00105
if(rv != ok && rv != decline) \
00106
return rv; \
00107 } \
00108
return ok; \
00109 }
00110
00112
#ifdef __cplusplus
00113
}
00114
#endif
00115
00116
#endif