]> granicus.if.org Git - apache/blob - include/ap_config.h
cleanup handle_set function
[apache] / include / ap_config.h
1 /* ====================================================================
2  * The Apache Software License, Version 1.1
3  *
4  * Copyright (c) 2000-2003 The Apache Software Foundation.  All rights
5  * reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  *
14  * 2. Redistributions in binary form must reproduce the above copyright
15  *    notice, this list of conditions and the following disclaimer in
16  *    the documentation and/or other materials provided with the
17  *    distribution.
18  *
19  * 3. The end-user documentation included with the redistribution,
20  *    if any, must include the following acknowledgment:
21  *       "This product includes software developed by the
22  *        Apache Software Foundation (http://www.apache.org/)."
23  *    Alternately, this acknowledgment may appear in the software itself,
24  *    if and wherever such third-party acknowledgments normally appear.
25  *
26  * 4. The names "Apache" and "Apache Software Foundation" must
27  *    not be used to endorse or promote products derived from this
28  *    software without prior written permission. For written
29  *    permission, please contact apache@apache.org.
30  *
31  * 5. Products derived from this software may not be called "Apache",
32  *    nor may "Apache" appear in their name, without prior written
33  *    permission of the Apache Software Foundation.
34  *
35  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
36  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
37  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
38  * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
39  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
40  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
41  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
42  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
43  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
44  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
45  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
46  * SUCH DAMAGE.
47  * ====================================================================
48  *
49  * This software consists of voluntary contributions made by many
50  * individuals on behalf of the Apache Software Foundation.  For more
51  * information on the Apache Software Foundation, please see
52  * <http://www.apache.org/>.
53  */
54
55 #ifndef AP_CONFIG_H
56 #define AP_CONFIG_H
57
58 #include "apr.h"
59 #include "apr_hooks.h"
60 #include "apr_optional_hooks.h"
61
62 /**
63  * @file ap_config.h
64  * @brief Symbol export macros and hook functions
65  */
66
67 /* Although this file doesn't declare any hooks, declare the hook group here */
68 /** @defgroup hooks Apache Hooks */
69
70 #ifdef DOXYGEN
71 /* define these just so doxygen documents them */
72
73 /**
74  * AP_DECLARE_STATIC is defined when including Apache's Core headers,
75  * to provide static linkage when the dynamic library may be unavailable.
76  *
77  * @see AP_DECLARE_EXPORT
78  *
79  * AP_DECLARE_STATIC and AP_DECLARE_EXPORT are left undefined when
80  * including Apache's Core headers, to import and link the symbols from the 
81  * dynamic Apache Core library and assure appropriate indirection and calling 
82  * conventions at compile time.
83  */
84 # define AP_DECLARE_STATIC
85 /**
86  * AP_DECLARE_EXPORT is defined when building the Apache Core dynamic
87  * library, so that all public symbols are exported.
88  *
89  * @see AP_DECLARE_STATIC
90  */
91 # define AP_DECLARE_EXPORT
92
93 #endif /* def DOXYGEN */
94
95 #if !defined(WIN32)
96 /**
97  * Apache Core dso functions are declared with AP_DECLARE(), so they may
98  * use the most appropriate calling convention.  Hook functions and other
99  * Core functions with variable arguments must use AP_DECLARE_NONSTD().
100  * @code
101  * AP_DECLARE(rettype) ap_func(args)
102  * @endcode
103  */
104 #define AP_DECLARE(type)            type
105
106 /**
107  * Apache Core dso variable argument and hook functions are declared with 
108  * AP_DECLARE_NONSTD(), as they must use the C language calling convention.
109  * @see AP_DECLARE
110  * @code
111  * AP_DECLARE_NONSTD(rettype) ap_func(args [...])
112  * @endcode
113  */
114 #define AP_DECLARE_NONSTD(type)     type
115
116 /**
117  * Apache Core dso variables are declared with AP_MODULE_DECLARE_DATA.
118  * This assures the appropriate indirection is invoked at compile time.
119  *
120  * @note AP_DECLARE_DATA extern type apr_variable; syntax is required for
121  * declarations within headers to properly import the variable.
122  * @code
123  * AP_DECLARE_DATA type apr_variable
124  * @endcode
125  */
126 #define AP_DECLARE_DATA
127
128 #elif defined(AP_DECLARE_STATIC)
129 #define AP_DECLARE(type)            type __stdcall
130 #define AP_DECLARE_NONSTD(type)     type
131 #define AP_DECLARE_DATA
132 #elif defined(AP_DECLARE_EXPORT)
133 #define AP_DECLARE(type)            __declspec(dllexport) type __stdcall
134 #define AP_DECLARE_NONSTD(type)     __declspec(dllexport) type
135 #define AP_DECLARE_DATA             __declspec(dllexport)
136 #else
137 #define AP_DECLARE(type)            __declspec(dllimport) type __stdcall
138 #define AP_DECLARE_NONSTD(type)     __declspec(dllimport) type
139 #define AP_DECLARE_DATA             __declspec(dllimport)
140 #endif
141
142 #if !defined(WIN32) || defined(AP_MODULE_DECLARE_STATIC)
143 /**
144  * Declare a dso module's exported module structure as AP_MODULE_DECLARE_DATA.
145  *
146  * Unless AP_MODULE_DECLARE_STATIC is defined at compile time, symbols 
147  * declared with AP_MODULE_DECLARE_DATA are always exported.
148  * @code
149  * module AP_MODULE_DECLARE_DATA mod_tag
150  * @endcode
151  */
152 #if defined(WIN32)
153 #define AP_MODULE_DECLARE(type)            type __stdcall
154 #else
155 #define AP_MODULE_DECLARE(type)            type
156 #endif
157 #define AP_MODULE_DECLARE_NONSTD(type)     type
158 #define AP_MODULE_DECLARE_DATA
159 #else
160 /**
161  * AP_MODULE_DECLARE_EXPORT is a no-op.  Unless contradicted by the
162  * AP_MODULE_DECLARE_STATIC compile-time symbol, it is assumed and defined.
163  *
164  * The old SHARED_MODULE compile-time symbol is now the default behavior, 
165  * so it is no longer referenced anywhere with Apache 2.0.
166  */
167 #define AP_MODULE_DECLARE_EXPORT
168 #define AP_MODULE_DECLARE(type)          __declspec(dllexport) type __stdcall
169 #define AP_MODULE_DECLARE_NONSTD(type)   __declspec(dllexport) type
170 #define AP_MODULE_DECLARE_DATA           __declspec(dllexport)
171 #endif
172
173 /**
174  * Declare a hook function
175  * @param ret The return type of the hook
176  * @param name The hook's name (as a literal)
177  * @param args The arguments the hook function takes, in brackets.
178  */
179 #define AP_DECLARE_HOOK(ret,name,args) \
180         APR_DECLARE_EXTERNAL_HOOK(ap,AP,ret,name,args)
181
182 /** @internal */
183 #define AP_IMPLEMENT_HOOK_BASE(name) \
184         APR_IMPLEMENT_EXTERNAL_HOOK_BASE(ap,AP,name)
185
186 /**
187  * Implement an Apache core hook that has no return code, and
188  * therefore runs all of the registered functions. The implementation
189  * is called ap_run_<i>name</i>.
190  *
191  * @param name The name of the hook
192  * @param args_decl The declaration of the arguments for the hook, for example
193  * "(int x,void *y)"
194  * @param args_use The arguments for the hook as used in a call, for example
195  * "(x,y)"
196  * @note If IMPLEMENTing a hook that is not linked into the Apache core,
197  * (e.g. within a dso) see APR_IMPLEMENT_EXTERNAL_HOOK_VOID.
198  */
199 #define AP_IMPLEMENT_HOOK_VOID(name,args_decl,args_use) \
200         APR_IMPLEMENT_EXTERNAL_HOOK_VOID(ap,AP,name,args_decl,args_use)
201
202 /**
203  * Implement an Apache core hook that runs until one of the functions
204  * returns something other than ok or decline. That return value is
205  * then returned from the hook runner. If the hooks run to completion,
206  * then ok is returned. Note that if no hook runs it would probably be
207  * more correct to return decline, but this currently does not do
208  * so. The implementation is called ap_run_<i>name</i>.
209  *
210  * @param ret The return type of the hook (and the hook runner)
211  * @param name The name of the hook
212  * @param args_decl The declaration of the arguments for the hook, for example
213  * "(int x,void *y)"
214  * @param args_use The arguments for the hook as used in a call, for example
215  * "(x,y)"
216  * @param ok The "ok" return value
217  * @param decline The "decline" return value
218  * @return ok, decline or an error.
219  * @note If IMPLEMENTing a hook that is not linked into the Apache core,
220  * (e.g. within a dso) see APR_IMPLEMENT_EXTERNAL_HOOK_RUN_ALL.
221  */
222 #define AP_IMPLEMENT_HOOK_RUN_ALL(ret,name,args_decl,args_use,ok,decline) \
223         APR_IMPLEMENT_EXTERNAL_HOOK_RUN_ALL(ap,AP,ret,name,args_decl, \
224                                             args_use,ok,decline)
225
226 /**
227  * Implement a hook that runs until a function returns something other than 
228  * decline. If all functions return decline, the hook runner returns decline. 
229  * The implementation is called ap_run_<i>name</i>.
230  *
231  * @param ret The return type of the hook (and the hook runner)
232  * @param name The name of the hook
233  * @param args_decl The declaration of the arguments for the hook, for example
234  * "(int x,void *y)"
235  * @param args_use The arguments for the hook as used in a call, for example
236  * "(x,y)"
237  * @param decline The "decline" return value
238  * @return decline or an error.
239  * @note If IMPLEMENTing a hook that is not linked into the Apache core
240  * (e.g. within a dso) see APR_IMPLEMENT_EXTERNAL_HOOK_RUN_FIRST.
241  */
242 #define AP_IMPLEMENT_HOOK_RUN_FIRST(ret,name,args_decl,args_use,decline) \
243         APR_IMPLEMENT_EXTERNAL_HOOK_RUN_FIRST(ap,AP,ret,name,args_decl, \
244                                               args_use,decline)
245
246 /* Note that the other optional hook implementations are straightforward but
247  * have not yet been needed
248  */
249
250 /**
251  * Implement an optional hook. This is exactly the same as a standard hook
252  * implementation, except the hook is optional.
253  * @see AP_IMPLEMENT_HOOK_RUN_ALL
254  */
255 #define AP_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(ret,name,args_decl,args_use,ok, \
256                                            decline) \
257         APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(ap,AP,ret,name,args_decl, \
258                                             args_use,ok,decline)
259
260 /**
261  * Hook an optional hook. Unlike static hooks, this uses a macro instead of a
262  * function.
263  */
264 #define AP_OPTIONAL_HOOK(name,fn,pre,succ,order) \
265         APR_OPTIONAL_HOOK(ap,name,fn,pre,succ,order)
266
267 #include "os.h"
268 #if !defined(WIN32) && !defined(NETWARE)
269 #include "ap_config_auto.h"
270 #include "ap_config_layout.h"
271 #endif
272
273 /* TODO - We need to put OS detection back to make all the following work */
274
275 #if defined(SUNOS4) || defined(IRIX) || defined(NEXT) || defined(AUX3) \
276     || defined (UW) || defined(LYNXOS) || defined(TPF)
277 /* These systems don't do well with any lingering close code; I don't know
278  * why -- manoj */
279 #define NO_LINGCLOSE
280 #endif
281
282 /* If APR has OTHER_CHILD logic, use reliable piped logs. */
283 #if APR_HAS_OTHER_CHILD
284 #define AP_HAVE_RELIABLE_PIPED_LOGS TRUE
285 #endif
286
287 #if APR_CHARSET_EBCDIC && !defined(APACHE_XLATE)
288 #define APACHE_XLATE
289 #endif
290
291 #endif /* AP_CONFIG_H */