Blame include/ap_hooks.h

Packit 90a5c9
/* Licensed to the Apache Software Foundation (ASF) under one or more
Packit 90a5c9
 * contributor license agreements.  See the NOTICE file distributed with
Packit 90a5c9
 * this work for additional information regarding copyright ownership.
Packit 90a5c9
 * The ASF licenses this file to You under the Apache License, Version 2.0
Packit 90a5c9
 * (the "License"); you may not use this file except in compliance with
Packit 90a5c9
 * the License.  You may obtain a copy of the License at
Packit 90a5c9
 *
Packit 90a5c9
 *     http://www.apache.org/licenses/LICENSE-2.0
Packit 90a5c9
 *
Packit 90a5c9
 * Unless required by applicable law or agreed to in writing, software
Packit 90a5c9
 * distributed under the License is distributed on an "AS IS" BASIS,
Packit 90a5c9
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Packit 90a5c9
 * See the License for the specific language governing permissions and
Packit 90a5c9
 * limitations under the License.
Packit 90a5c9
 */
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * @file ap_hooks.h
Packit 90a5c9
 * @brief ap hook functions and macros
Packit 90a5c9
 */
Packit 90a5c9
Packit 90a5c9
#ifndef AP_HOOKS_H
Packit 90a5c9
#define AP_HOOKS_H
Packit 90a5c9
Packit 90a5c9
/* Although this file doesn't declare any hooks, declare the hook group here */
Packit 90a5c9
/**
Packit 90a5c9
 * @defgroup hooks Apache Hooks
Packit 90a5c9
 * @ingroup  APACHE_CORE
Packit 90a5c9
 */
Packit 90a5c9
Packit 90a5c9
#if defined(AP_HOOK_PROBES_ENABLED) && !defined(APR_HOOK_PROBES_ENABLED)
Packit 90a5c9
#define APR_HOOK_PROBES_ENABLED 1
Packit 90a5c9
#endif
Packit 90a5c9
Packit 90a5c9
#ifdef APR_HOOK_PROBES_ENABLED
Packit 90a5c9
#include "ap_hook_probes.h"
Packit 90a5c9
#endif
Packit 90a5c9
Packit 90a5c9
#include "apr.h"
Packit 90a5c9
#include "apr_hooks.h"
Packit 90a5c9
#include "apr_optional_hooks.h"
Packit 90a5c9
Packit 90a5c9
#ifdef DOXYGEN
Packit 90a5c9
/* define these just so doxygen documents them */
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * AP_DECLARE_STATIC is defined when including Apache's Core headers,
Packit 90a5c9
 * to provide static linkage when the dynamic library may be unavailable.
Packit 90a5c9
 *
Packit 90a5c9
 * @see AP_DECLARE_EXPORT
Packit 90a5c9
 *
Packit 90a5c9
 * AP_DECLARE_STATIC and AP_DECLARE_EXPORT are left undefined when
Packit 90a5c9
 * including Apache's Core headers, to import and link the symbols from the
Packit 90a5c9
 * dynamic Apache Core library and assure appropriate indirection and calling
Packit 90a5c9
 * conventions at compile time.
Packit 90a5c9
 */
Packit 90a5c9
# define AP_DECLARE_STATIC
Packit 90a5c9
/**
Packit 90a5c9
 * AP_DECLARE_EXPORT is defined when building the Apache Core dynamic
Packit 90a5c9
 * library, so that all public symbols are exported.
Packit 90a5c9
 *
Packit 90a5c9
 * @see AP_DECLARE_STATIC
Packit 90a5c9
 */
Packit 90a5c9
# define AP_DECLARE_EXPORT
Packit 90a5c9
Packit 90a5c9
#endif /* def DOXYGEN */
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * Declare a hook function
Packit 90a5c9
 * @param ret The return type of the hook
Packit 90a5c9
 * @param name The hook's name (as a literal)
Packit 90a5c9
 * @param args The arguments the hook function takes, in brackets.
Packit 90a5c9
 */
Packit 90a5c9
#define AP_DECLARE_HOOK(ret,name,args) \
Packit 90a5c9
        APR_DECLARE_EXTERNAL_HOOK(ap,AP,ret,name,args)
Packit 90a5c9
Packit 90a5c9
/** @internal */
Packit 90a5c9
#define AP_IMPLEMENT_HOOK_BASE(name) \
Packit 90a5c9
        APR_IMPLEMENT_EXTERNAL_HOOK_BASE(ap,AP,name)
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * Implement an Apache core hook that has no return code, and
Packit 90a5c9
 * therefore runs all of the registered functions. The implementation
Packit 90a5c9
 * is called ap_run_name.
Packit 90a5c9
 *
Packit 90a5c9
 * @param name The name of the hook
Packit 90a5c9
 * @param args_decl The declaration of the arguments for the hook, for example
Packit 90a5c9
 * "(int x,void *y)"
Packit 90a5c9
 * @param args_use The arguments for the hook as used in a call, for example
Packit 90a5c9
 * "(x,y)"
Packit 90a5c9
 * @note If IMPLEMENTing a hook that is not linked into the Apache core,
Packit 90a5c9
 * (e.g. within a dso) see APR_IMPLEMENT_EXTERNAL_HOOK_VOID.
Packit 90a5c9
 */
Packit 90a5c9
#define AP_IMPLEMENT_HOOK_VOID(name,args_decl,args_use) \
Packit 90a5c9
        APR_IMPLEMENT_EXTERNAL_HOOK_VOID(ap,AP,name,args_decl,args_use)
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * Implement an Apache core hook that runs until one of the functions
Packit 90a5c9
 * returns something other than ok or decline. That return value is
Packit 90a5c9
 * then returned from the hook runner. If the hooks run to completion,
Packit 90a5c9
 * then ok is returned. Note that if no hook runs it would probably be
Packit 90a5c9
 * more correct to return decline, but this currently does not do
Packit 90a5c9
 * so. The implementation is called ap_run_name.
Packit 90a5c9
 *
Packit 90a5c9
 * @param ret The return type of the hook (and the hook runner)
Packit 90a5c9
 * @param name The name of the hook
Packit 90a5c9
 * @param args_decl The declaration of the arguments for the hook, for example
Packit 90a5c9
 * "(int x,void *y)"
Packit 90a5c9
 * @param args_use The arguments for the hook as used in a call, for example
Packit 90a5c9
 * "(x,y)"
Packit 90a5c9
 * @param ok The "ok" return value
Packit 90a5c9
 * @param decline The "decline" return value
Packit 90a5c9
 * @return ok, decline or an error.
Packit 90a5c9
 * @note If IMPLEMENTing a hook that is not linked into the Apache core,
Packit 90a5c9
 * (e.g. within a dso) see APR_IMPLEMENT_EXTERNAL_HOOK_RUN_ALL.
Packit 90a5c9
 */
Packit 90a5c9
#define AP_IMPLEMENT_HOOK_RUN_ALL(ret,name,args_decl,args_use,ok,decline) \
Packit 90a5c9
        APR_IMPLEMENT_EXTERNAL_HOOK_RUN_ALL(ap,AP,ret,name,args_decl, \
Packit 90a5c9
                                            args_use,ok,decline)
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * Implement a hook that runs until a function returns something other than
Packit 90a5c9
 * decline. If all functions return decline, the hook runner returns decline.
Packit 90a5c9
 * The implementation is called ap_run_name.
Packit 90a5c9
 *
Packit 90a5c9
 * @param ret The return type of the hook (and the hook runner)
Packit 90a5c9
 * @param name The name of the hook
Packit 90a5c9
 * @param args_decl The declaration of the arguments for the hook, for example
Packit 90a5c9
 * "(int x,void *y)"
Packit 90a5c9
 * @param args_use The arguments for the hook as used in a call, for example
Packit 90a5c9
 * "(x,y)"
Packit 90a5c9
 * @param decline The "decline" return value
Packit 90a5c9
 * @return decline or an error.
Packit 90a5c9
 * @note If IMPLEMENTing a hook that is not linked into the Apache core
Packit 90a5c9
 * (e.g. within a dso) see APR_IMPLEMENT_EXTERNAL_HOOK_RUN_FIRST.
Packit 90a5c9
 */
Packit 90a5c9
#define AP_IMPLEMENT_HOOK_RUN_FIRST(ret,name,args_decl,args_use,decline) \
Packit 90a5c9
        APR_IMPLEMENT_EXTERNAL_HOOK_RUN_FIRST(ap,AP,ret,name,args_decl, \
Packit 90a5c9
                                              args_use,decline)
Packit 90a5c9
Packit 90a5c9
/* Note that the other optional hook implementations are straightforward but
Packit 90a5c9
 * have not yet been needed
Packit 90a5c9
 */
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * Implement an optional hook. This is exactly the same as a standard hook
Packit 90a5c9
 * implementation, except the hook is optional.
Packit 90a5c9
 * @see AP_IMPLEMENT_HOOK_RUN_ALL
Packit 90a5c9
 */
Packit 90a5c9
#define AP_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(ret,name,args_decl,args_use,ok, \
Packit 90a5c9
                                           decline) \
Packit 90a5c9
        APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(ap,AP,ret,name,args_decl, \
Packit 90a5c9
                                            args_use,ok,decline)
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * Hook an optional hook. Unlike static hooks, this uses a macro instead of a
Packit 90a5c9
 * function.
Packit 90a5c9
 */
Packit 90a5c9
#define AP_OPTIONAL_HOOK(name,fn,pre,succ,order) \
Packit 90a5c9
        APR_OPTIONAL_HOOK(ap,name,fn,pre,succ,order)
Packit 90a5c9
Packit 90a5c9
#endif /* AP_HOOKS_H */