Apache2
apr_optional_hooks.h
Go to the documentation of this file.
1
/* Licensed to the Apache Software Foundation (ASF) under one or more
2
* contributor license agreements. See the NOTICE file distributed with
3
* this work for additional information regarding copyright ownership.
4
* The ASF licenses this file to You under the Apache License, Version 2.0
5
* (the "License"); you may not use this file except in compliance with
6
* the License. You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*/
22
#ifndef APR_OPTIONAL_HOOK_H
23
#define APR_OPTIONAL_HOOK_H
24
25
#include "
apr_tables.h
"
26
27
#ifdef __cplusplus
28
extern
"C"
{
29
#endif
48
APR_DECLARE
(
void
)
apr_optional_hook_add
(
const
char
*szName,
void
(*pfn)(
void
),
49
const
char
*
const
*aszPre,
50
const
char
*
const
*aszSucc,
51
int
nOrder);
52
64
#define APR_OPTIONAL_HOOK(ns,name,pfn,aszPre,aszSucc,nOrder) do { \
65
ns##_HOOK_##name##_t *apu__hook = pfn; \
66
apr_optional_hook_add(#name,(void (*)(void))apu__hook,aszPre, aszSucc, nOrder); \
67
} while (0)
68
74
APR_DECLARE
(
apr_array_header_t
*)
apr_optional_hook_get
(
const
char
*szName);
75
89
#define APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(ns,link,ret,name,args_decl,args_use,ok,decline) \
90
link##_DECLARE(ret) ns##_run_##name args_decl \
91
{ \
92
ns##_LINK_##name##_t *pHook; \
93
int n; \
94
ret rv; \
95
apr_array_header_t *pHookArray=apr_optional_hook_get(#name); \
96
\
97
if(!pHookArray) \
98
return ok; \
99
\
100
pHook=(ns##_LINK_##name##_t *)pHookArray->elts; \
101
for(n=0 ; n < pHookArray->nelts ; ++n) \
102
{ \
103
rv=(pHook[n].pFunc)args_use; \
104
\
105
if(rv != ok && rv != decline) \
106
return rv; \
107
} \
108
return ok; \
109
}
110
112
#ifdef __cplusplus
113
}
114
#endif
115
116
#endif
/* APR_OPTIONAL_HOOK_H */
apr_tables.h
APR Table library.
apr_optional_hook_get
apr_array_header_t * apr_optional_hook_get(const char *szName)
apr_optional_hook_add
void apr_optional_hook_add(const char *szName, void(*pfn)(void), const char *const *aszPre, const char *const *aszSucc, int nOrder)
APR_DECLARE
#define APR_DECLARE(x)
Definition:
macros.h:6
apr_array_header_t
Definition:
apr_tables.h:62
srclib
apr
include
apr_optional_hooks.h
Generated by
1.9.1