ap_config.h revision 497c60d05c62d2e4a37b0a0c002f62cd5824b4e3
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes/* Copyright 1999-2004 Apache Software Foundation
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * Licensed under the Apache License, Version 2.0 (the "License");
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * you may not use this file except in compliance with the License.
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * You may obtain a copy of the License at
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * Unless required by applicable law or agreed to in writing, software
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * distributed under the License is distributed on an "AS IS" BASIS,
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * See the License for the specific language governing permissions and
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * limitations under the License.
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * @brief Symbol export macros and hook functions
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes/* Although this file doesn't declare any hooks, declare the hook group here */
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes/** @defgroup hooks Apache Hooks */
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes/* define these just so doxygen documents them */
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * AP_DECLARE_STATIC is defined when including Apache's Core headers,
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * to provide static linkage when the dynamic library may be unavailable.
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * @see AP_DECLARE_EXPORT
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * AP_DECLARE_STATIC and AP_DECLARE_EXPORT are left undefined when
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * including Apache's Core headers, to import and link the symbols from the
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * dynamic Apache Core library and assure appropriate indirection and calling
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * conventions at compile time.
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * AP_DECLARE_EXPORT is defined when building the Apache Core dynamic
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * library, so that all public symbols are exported.
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * @see AP_DECLARE_STATIC
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes#endif /* def DOXYGEN */
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes#if !defined(WIN32)
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * Apache Core dso functions are declared with AP_DECLARE(), so they may
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * use the most appropriate calling convention. Hook functions and other
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * Core functions with variable arguments must use AP_DECLARE_NONSTD().
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * AP_DECLARE(rettype) ap_func(args)
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * Apache Core dso variable argument and hook functions are declared with
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * AP_DECLARE_NONSTD(), as they must use the C language calling convention.
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * @see AP_DECLARE
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * AP_DECLARE_NONSTD(rettype) ap_func(args [...])
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * Apache Core dso variables are declared with AP_MODULE_DECLARE_DATA.
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * This assures the appropriate indirection is invoked at compile time.
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * @note AP_DECLARE_DATA extern type apr_variable; syntax is required for
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * declarations within headers to properly import the variable.
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * AP_DECLARE_DATA type apr_variable
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes#define AP_DECLARE(type) __declspec(dllexport) type __stdcall
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes#define AP_DECLARE_NONSTD(type) __declspec(dllexport) type
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes#define AP_DECLARE(type) __declspec(dllimport) type __stdcall
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes#define AP_DECLARE_NONSTD(type) __declspec(dllimport) type
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes#if !defined(WIN32) || defined(AP_MODULE_DECLARE_STATIC)
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * Declare a dso module's exported module structure as AP_MODULE_DECLARE_DATA.
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * Unless AP_MODULE_DECLARE_STATIC is defined at compile time, symbols
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * declared with AP_MODULE_DECLARE_DATA are always exported.
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * module AP_MODULE_DECLARE_DATA mod_tag
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * AP_MODULE_DECLARE_EXPORT is a no-op. Unless contradicted by the
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * AP_MODULE_DECLARE_STATIC compile-time symbol, it is assumed and defined.
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * The old SHARED_MODULE compile-time symbol is now the default behavior,
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * so it is no longer referenced anywhere with Apache 2.0.
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes#define AP_MODULE_DECLARE(type) __declspec(dllexport) type __stdcall
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes#define AP_MODULE_DECLARE_NONSTD(type) __declspec(dllexport) type
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes#define AP_MODULE_DECLARE_DATA __declspec(dllexport)
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * Declare a hook function
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * @param ret The return type of the hook
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * @param name The hook's name (as a literal)
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * @param args The arguments the hook function takes, in brackets.
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes/** @internal */
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * Implement an Apache core hook that has no return code, and
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * therefore runs all of the registered functions. The implementation
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * is called ap_run_<i>name</i>.
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * @param name The name of the hook
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * @param args_decl The declaration of the arguments for the hook, for example
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * "(int x,void *y)"
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * @param args_use The arguments for the hook as used in a call, for example
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * @note If IMPLEMENTing a hook that is not linked into the Apache core,
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * (e.g. within a dso) see APR_IMPLEMENT_EXTERNAL_HOOK_VOID.
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes#define AP_IMPLEMENT_HOOK_VOID(name,args_decl,args_use) \
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes APR_IMPLEMENT_EXTERNAL_HOOK_VOID(ap,AP,name,args_decl,args_use)
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * Implement an Apache core hook that runs until one of the functions
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * returns something other than ok or decline. That return value is
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * then returned from the hook runner. If the hooks run to completion,
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * then ok is returned. Note that if no hook runs it would probably be
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * more correct to return decline, but this currently does not do
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * so. The implementation is called ap_run_<i>name</i>.
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * @param ret The return type of the hook (and the hook runner)
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * @param name The name of the hook
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * @param args_decl The declaration of the arguments for the hook, for example
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * "(int x,void *y)"
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * @param args_use The arguments for the hook as used in a call, for example
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * @param ok The "ok" return value
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * @param decline The "decline" return value
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * @return ok, decline or an error.
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * @note If IMPLEMENTing a hook that is not linked into the Apache core,
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * (e.g. within a dso) see APR_IMPLEMENT_EXTERNAL_HOOK_RUN_ALL.
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes#define AP_IMPLEMENT_HOOK_RUN_ALL(ret,name,args_decl,args_use,ok,decline) \
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes APR_IMPLEMENT_EXTERNAL_HOOK_RUN_ALL(ap,AP,ret,name,args_decl, \
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * Implement a hook that runs until a function returns something other than
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * decline. If all functions return decline, the hook runner returns decline.
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * The implementation is called ap_run_<i>name</i>.
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * @param ret The return type of the hook (and the hook runner)
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * @param name The name of the hook
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * @param args_decl The declaration of the arguments for the hook, for example
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * "(int x,void *y)"
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * @param args_use The arguments for the hook as used in a call, for example
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * @param decline The "decline" return value
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * @return decline or an error.
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * @note If IMPLEMENTing a hook that is not linked into the Apache core
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * (e.g. within a dso) see APR_IMPLEMENT_EXTERNAL_HOOK_RUN_FIRST.
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes#define AP_IMPLEMENT_HOOK_RUN_FIRST(ret,name,args_decl,args_use,decline) \
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes APR_IMPLEMENT_EXTERNAL_HOOK_RUN_FIRST(ap,AP,ret,name,args_decl, \
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes/* Note that the other optional hook implementations are straightforward but
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * have not yet been needed
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * Implement an optional hook. This is exactly the same as a standard hook
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * implementation, except the hook is optional.
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * @see AP_IMPLEMENT_HOOK_RUN_ALL
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes#define AP_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(ret,name,args_decl,args_use,ok, \
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(ap,AP,ret,name,args_decl, \
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * Hook an optional hook. Unlike static hooks, this uses a macro instead of a
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes/* TODO - We need to put OS detection back to make all the following work */
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes#if defined(SUNOS4) || defined(IRIX) || defined(NEXT) || defined(AUX3) \
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes || defined (UW) || defined(LYNXOS) || defined(TPF)
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes/* These systems don't do well with any lingering close code; I don't know
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes * why -- manoj */
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes/* If APR has OTHER_CHILD logic, use reliable piped logs. */
d5b12fe8ae917e654a33247fd4e59dc9e75170aebnicholes#endif /* AP_CONFIG_H */