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