Main Page | Modules | Namespace List | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages | Examples

Optional Hook Functions
[Hook Functions]

Collaboration diagram for Optional Hook Functions:


Defines

#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

 APU_DECLARE (void) apr_optional_hook_add(const char *szName
 APU_DECLARE (apr_array_header_t *) apr_optional_hook_get(const char *szName)

Variables

void(* pfn )(void)
void(*) const char *const aszPre )
void(*) const char *const
const char *const 
aszSucc )
void(*) const char *const
const char *const in 
nOrder )

Define 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:
ns The namespace prefix of the hook functions
link The linkage declaration prefix of the hook
ret The type of the return value of the hook
ret The type of the return value of the hook
name The name of the hook
args_decl The declaration of the arguments for the hook
args_use The names for the arguments for the hook
ok Success value
decline Decline value

Definition at line 90 of file apr_optional_hooks.h.

#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)
Hook to an optional hook.

Parameters:
ns The namespace prefix of the hook functions
name The name of the hook
pfn A pointer to a function that will be called
aszPre a NULL-terminated array of strings that name modules whose hooks should precede this one
aszSucc a NULL-terminated array of strings that name modules whose hooks should succeed this one
nOrder an integer determining order before honouring aszPre and aszSucc (for example HOOK_MIDDLE)

Definition at line 64 of file apr_optional_hooks.h.

Referenced by register_hooks().


Function Documentation

APU_DECLARE apr_array_header_t  )  const
 

APU_DECLARE void   )  const
 

Function to implemnt the APR_OPTIONAL_HOOK Macro


Variable Documentation

void(*) const char* const aszPre)
 

Definition at line 49 of file apr_optional_hooks.h.

void(*) const char* const const char* const aszSucc)
 

Definition at line 49 of file apr_optional_hooks.h.

void(*) const char* const const char* const in nOrder)
 

Definition at line 49 of file apr_optional_hooks.h.

void(* pfn)(void)