github.com/krum110487/go-htaccess@v0.0.0-20240316004156-60641c8e7598/tests/data/apache_2_2_34/include/ap_config.h (about)

     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   */
    16  
    17  /**
    18   * @file ap_config.h
    19   * @brief Symbol export macros and hook functions
    20   */
    21  
    22  #ifndef AP_CONFIG_H
    23  #define AP_CONFIG_H
    24  
    25  #include "apr.h"
    26  #include "apr_hooks.h"
    27  #include "apr_optional_hooks.h"
    28  
    29  /* Although this file doesn't declare any hooks, declare the hook group here */
    30  /** 
    31   * @defgroup hooks Apache Hooks 
    32   * @ingroup  APACHE_CORE
    33   */
    34  
    35  #ifdef DOXYGEN
    36  /* define these just so doxygen documents them */
    37  
    38  /**
    39   * AP_DECLARE_STATIC is defined when including Apache's Core headers,
    40   * to provide static linkage when the dynamic library may be unavailable.
    41   *
    42   * @see AP_DECLARE_EXPORT
    43   *
    44   * AP_DECLARE_STATIC and AP_DECLARE_EXPORT are left undefined when
    45   * including Apache's Core headers, to import and link the symbols from the 
    46   * dynamic Apache Core library and assure appropriate indirection and calling 
    47   * conventions at compile time.
    48   */
    49  # define AP_DECLARE_STATIC
    50  /**
    51   * AP_DECLARE_EXPORT is defined when building the Apache Core dynamic
    52   * library, so that all public symbols are exported.
    53   *
    54   * @see AP_DECLARE_STATIC
    55   */
    56  # define AP_DECLARE_EXPORT
    57  
    58  #endif /* def DOXYGEN */
    59  
    60  #if !defined(WIN32)
    61  /**
    62   * Apache Core dso functions are declared with AP_DECLARE(), so they may
    63   * use the most appropriate calling convention.  Hook functions and other
    64   * Core functions with variable arguments must use AP_DECLARE_NONSTD().
    65   * @code
    66   * AP_DECLARE(rettype) ap_func(args)
    67   * @endcode
    68   */
    69  #define AP_DECLARE(type)            type
    70  
    71  /**
    72   * Apache Core dso variable argument and hook functions are declared with 
    73   * AP_DECLARE_NONSTD(), as they must use the C language calling convention.
    74   * @see AP_DECLARE
    75   * @code
    76   * AP_DECLARE_NONSTD(rettype) ap_func(args [...])
    77   * @endcode
    78   */
    79  #define AP_DECLARE_NONSTD(type)     type
    80  
    81  /**
    82   * Apache Core dso variables are declared with AP_MODULE_DECLARE_DATA.
    83   * This assures the appropriate indirection is invoked at compile time.
    84   *
    85   * @note AP_DECLARE_DATA extern type apr_variable; syntax is required for
    86   * declarations within headers to properly import the variable.
    87   * @code
    88   * AP_DECLARE_DATA type apr_variable
    89   * @endcode
    90   */
    91  #define AP_DECLARE_DATA
    92  
    93  #elif defined(AP_DECLARE_STATIC)
    94  #define AP_DECLARE(type)            type __stdcall
    95  #define AP_DECLARE_NONSTD(type)     type
    96  #define AP_DECLARE_DATA
    97  #elif defined(AP_DECLARE_EXPORT)
    98  #define AP_DECLARE(type)            __declspec(dllexport) type __stdcall
    99  #define AP_DECLARE_NONSTD(type)     __declspec(dllexport) type
   100  #define AP_DECLARE_DATA             __declspec(dllexport)
   101  #else
   102  #define AP_DECLARE(type)            __declspec(dllimport) type __stdcall
   103  #define AP_DECLARE_NONSTD(type)     __declspec(dllimport) type
   104  #define AP_DECLARE_DATA             __declspec(dllimport)
   105  #endif
   106  
   107  #if !defined(WIN32) || defined(AP_MODULE_DECLARE_STATIC)
   108  /**
   109   * Declare a dso module's exported module structure as AP_MODULE_DECLARE_DATA.
   110   *
   111   * Unless AP_MODULE_DECLARE_STATIC is defined at compile time, symbols 
   112   * declared with AP_MODULE_DECLARE_DATA are always exported.
   113   * @code
   114   * module AP_MODULE_DECLARE_DATA mod_tag
   115   * @endcode
   116   */
   117  #if defined(WIN32)
   118  #define AP_MODULE_DECLARE(type)            type __stdcall
   119  #else
   120  #define AP_MODULE_DECLARE(type)            type
   121  #endif
   122  #define AP_MODULE_DECLARE_NONSTD(type)     type
   123  #define AP_MODULE_DECLARE_DATA
   124  #else
   125  /**
   126   * AP_MODULE_DECLARE_EXPORT is a no-op.  Unless contradicted by the
   127   * AP_MODULE_DECLARE_STATIC compile-time symbol, it is assumed and defined.
   128   *
   129   * The old SHARED_MODULE compile-time symbol is now the default behavior, 
   130   * so it is no longer referenced anywhere with Apache 2.0.
   131   */
   132  #define AP_MODULE_DECLARE_EXPORT
   133  #define AP_MODULE_DECLARE(type)          __declspec(dllexport) type __stdcall
   134  #define AP_MODULE_DECLARE_NONSTD(type)   __declspec(dllexport) type
   135  #define AP_MODULE_DECLARE_DATA           __declspec(dllexport)
   136  #endif
   137  
   138  /**
   139   * Declare a hook function
   140   * @param ret The return type of the hook
   141   * @param name The hook's name (as a literal)
   142   * @param args The arguments the hook function takes, in brackets.
   143   */
   144  #define AP_DECLARE_HOOK(ret,name,args) \
   145  	APR_DECLARE_EXTERNAL_HOOK(ap,AP,ret,name,args)
   146  
   147  /** @internal */
   148  #define AP_IMPLEMENT_HOOK_BASE(name) \
   149  	APR_IMPLEMENT_EXTERNAL_HOOK_BASE(ap,AP,name)
   150  
   151  /**
   152   * Implement an Apache core hook that has no return code, and
   153   * therefore runs all of the registered functions. The implementation
   154   * is called ap_run_<i>name</i>.
   155   *
   156   * @param name The name of the hook
   157   * @param args_decl The declaration of the arguments for the hook, for example
   158   * "(int x,void *y)"
   159   * @param args_use The arguments for the hook as used in a call, for example
   160   * "(x,y)"
   161   * @note If IMPLEMENTing a hook that is not linked into the Apache core,
   162   * (e.g. within a dso) see APR_IMPLEMENT_EXTERNAL_HOOK_VOID.
   163   */
   164  #define AP_IMPLEMENT_HOOK_VOID(name,args_decl,args_use) \
   165  	APR_IMPLEMENT_EXTERNAL_HOOK_VOID(ap,AP,name,args_decl,args_use)
   166  
   167  /**
   168   * Implement an Apache core hook that runs until one of the functions
   169   * returns something other than ok or decline. That return value is
   170   * then returned from the hook runner. If the hooks run to completion,
   171   * then ok is returned. Note that if no hook runs it would probably be
   172   * more correct to return decline, but this currently does not do
   173   * so. The implementation is called ap_run_<i>name</i>.
   174   *
   175   * @param ret The return type of the hook (and the hook runner)
   176   * @param name The name of the hook
   177   * @param args_decl The declaration of the arguments for the hook, for example
   178   * "(int x,void *y)"
   179   * @param args_use The arguments for the hook as used in a call, for example
   180   * "(x,y)"
   181   * @param ok The "ok" return value
   182   * @param decline The "decline" return value
   183   * @return ok, decline or an error.
   184   * @note If IMPLEMENTing a hook that is not linked into the Apache core,
   185   * (e.g. within a dso) see APR_IMPLEMENT_EXTERNAL_HOOK_RUN_ALL.
   186   */
   187  #define AP_IMPLEMENT_HOOK_RUN_ALL(ret,name,args_decl,args_use,ok,decline) \
   188  	APR_IMPLEMENT_EXTERNAL_HOOK_RUN_ALL(ap,AP,ret,name,args_decl, \
   189                                              args_use,ok,decline)
   190  
   191  /**
   192   * Implement a hook that runs until a function returns something other than 
   193   * decline. If all functions return decline, the hook runner returns decline. 
   194   * The implementation is called ap_run_<i>name</i>.
   195   *
   196   * @param ret The return type of the hook (and the hook runner)
   197   * @param name The name of the hook
   198   * @param args_decl The declaration of the arguments for the hook, for example
   199   * "(int x,void *y)"
   200   * @param args_use The arguments for the hook as used in a call, for example
   201   * "(x,y)"
   202   * @param decline The "decline" return value
   203   * @return decline or an error.
   204   * @note If IMPLEMENTing a hook that is not linked into the Apache core
   205   * (e.g. within a dso) see APR_IMPLEMENT_EXTERNAL_HOOK_RUN_FIRST.
   206   */
   207  #define AP_IMPLEMENT_HOOK_RUN_FIRST(ret,name,args_decl,args_use,decline) \
   208  	APR_IMPLEMENT_EXTERNAL_HOOK_RUN_FIRST(ap,AP,ret,name,args_decl, \
   209                                                args_use,decline)
   210  
   211  /* Note that the other optional hook implementations are straightforward but
   212   * have not yet been needed
   213   */
   214  
   215  /**
   216   * Implement an optional hook. This is exactly the same as a standard hook
   217   * implementation, except the hook is optional.
   218   * @see AP_IMPLEMENT_HOOK_RUN_ALL
   219   */
   220  #define AP_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(ret,name,args_decl,args_use,ok, \
   221  					   decline) \
   222  	APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(ap,AP,ret,name,args_decl, \
   223                                              args_use,ok,decline)
   224  
   225  /**
   226   * Hook an optional hook. Unlike static hooks, this uses a macro instead of a
   227   * function.
   228   */
   229  #define AP_OPTIONAL_HOOK(name,fn,pre,succ,order) \
   230          APR_OPTIONAL_HOOK(ap,name,fn,pre,succ,order)
   231  
   232  #include "os.h"
   233  #if (!defined(WIN32) && !defined(NETWARE)) || defined(__MINGW32__)
   234  #include "ap_config_auto.h"
   235  #include "ap_config_layout.h"
   236  #endif
   237  #if defined(NETWARE)
   238  #define AP_NONBLOCK_WHEN_MULTI_LISTEN 1
   239  #endif
   240  
   241  /* TODO - We need to put OS detection back to make all the following work */
   242  
   243  #if defined(SUNOS4) || defined(IRIX) || defined(NEXT) || defined(AUX3) \
   244      || defined (UW) || defined(LYNXOS) || defined(TPF)
   245  /* These systems don't do well with any lingering close code; I don't know
   246   * why -- manoj */
   247  #define NO_LINGCLOSE
   248  #endif
   249  
   250  /* If APR has OTHER_CHILD logic, use reliable piped logs. */
   251  #if APR_HAS_OTHER_CHILD
   252  #define AP_HAVE_RELIABLE_PIPED_LOGS TRUE
   253  #endif
   254  
   255  /* Presume that the compiler supports C99-style designated
   256   * initializers if using GCC (but not G++), or for any other compiler
   257   * which claims C99 support. */
   258  #if (defined(__GNUC__) && !defined(__cplusplus))                \
   259       || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L)
   260  #define AP_HAVE_DESIGNATED_INITIALIZER
   261  #endif
   262  
   263  #endif /* AP_CONFIG_H */