Apache Portable Runtime
Macros | Functions

Macros

#define APR_OPTIONAL_HOOK(ns, name, pfn, aszPre, aszSucc, nOrder)
 
#define APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(ns, link, ret, name, args_decl, args_use, ok, decline)
 

Functions

void apr_optional_hook_add (const char *szName, void(*pfn)(void), const char *const *aszPre, const char *const *aszSucc, int nOrder)
 
apr_array_header_tapr_optional_hook_get (const char *szName)
 

Detailed Description

Macro Definition Documentation

#define APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL (   ns,
  link,
  ret,
  name,
  args_decl,
  args_use,
  ok,
  decline 
)
Value:
link##_DECLARE(ret) ns##_run_##name args_decl \
{ \
ns##_LINK_##name##_t *pHook; \
int n; \
ret rv; \
apr_array_header_t *pHookArray=apr_optional_hook_get(#name); \
\
if(!pHookArray) \
return ok; \
\
pHook=(ns##_LINK_##name##_t *)pHookArray->elts; \
for(n=0 ; n < pHookArray->nelts ; ++n) \
{ \
rv=(pHook[n].pFunc)args_use; \
\
if(rv != ok && rv != decline) \
return rv; \
} \
return ok; \
}

Implement an optional hook that runs until one of the functions returns something other than OK or DECLINE.

Parameters
nsThe namespace prefix of the hook functions
linkThe linkage declaration prefix of the hook
retThe type of the return value of the hook
retThe type of the return value of the hook
nameThe name of the hook
args_declThe declaration of the arguments for the hook
args_useThe names for the arguments for the hook
okSuccess value
declineDecline value
#define APR_OPTIONAL_HOOK (   ns,
  name,
  pfn,
  aszPre,
  aszSucc,
  nOrder 
)
Value:
do { \
ns##_HOOK_##name##_t *apu__hook = pfn; \
apr_optional_hook_add(#name,(void (*)(void))apu__hook,aszPre, aszSucc, nOrder); \
} while (0)
void apr_optional_hook_add(const char *szName, void(*pfn)(void), const char *const *aszPre, const char *const *aszSucc, int nOrder)

Hook to an optional hook.

Parameters
nsThe namespace prefix of the hook functions
nameThe name of the hook
pfnA pointer to a function that will be called
aszPrea NULL-terminated array of strings that name modules whose hooks should precede this one
aszSucca NULL-terminated array of strings that name modules whose hooks should succeed this one
nOrderan integer determining order before honouring aszPre and aszSucc (for example HOOK_MIDDLE)

Function Documentation

void apr_optional_hook_add ( const char *  szName,
void(*)(void)  pfn,
const char *const *  aszPre,
const char *const *  aszSucc,
int  nOrder 
)

Function to implement the APR_OPTIONAL_HOOK Macro