Initial Commit
This commit is contained in:
30
database/apache/include/ap_compat.h
Normal file
30
database/apache/include/ap_compat.h
Normal file
@@ -0,0 +1,30 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file ap_compat.h
|
||||
* @brief Redefine Apache 1.3 symbols
|
||||
*/
|
||||
|
||||
#ifndef AP_COMPAT_H
|
||||
#define AP_COMPAT_H
|
||||
|
||||
/* redefine 1.3.x symbols to the new symbol names */
|
||||
|
||||
#define MODULE_VAR_EXPORT AP_MODULE_DECLARE_DATA
|
||||
#define ap_send_http_header(r) ;
|
||||
|
||||
#endif /* AP_COMPAT_H */
|
||||
206
database/apache/include/ap_config.h
Normal file
206
database/apache/include/ap_config.h
Normal file
@@ -0,0 +1,206 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file ap_config.h
|
||||
* @brief Symbol export macros and hook functions
|
||||
*/
|
||||
|
||||
#ifndef AP_CONFIG_H
|
||||
#define AP_CONFIG_H
|
||||
|
||||
#include "ap_hooks.h"
|
||||
|
||||
/* Although this file doesn't declare any hooks, declare the exports group here */
|
||||
/**
|
||||
* @defgroup exports Apache exports
|
||||
* @ingroup APACHE_CORE
|
||||
*/
|
||||
|
||||
#ifdef DOXYGEN
|
||||
/* define these just so doxygen documents them */
|
||||
|
||||
/**
|
||||
* AP_DECLARE_STATIC is defined when including Apache's Core headers,
|
||||
* to provide static linkage when the dynamic library may be unavailable.
|
||||
*
|
||||
* @see AP_DECLARE_EXPORT
|
||||
*
|
||||
* AP_DECLARE_STATIC and AP_DECLARE_EXPORT are left undefined when
|
||||
* including Apache's Core headers, to import and link the symbols from the
|
||||
* dynamic Apache Core library and assure appropriate indirection and calling
|
||||
* conventions at compile time.
|
||||
*/
|
||||
# define AP_DECLARE_STATIC
|
||||
/**
|
||||
* AP_DECLARE_EXPORT is defined when building the Apache Core dynamic
|
||||
* library, so that all public symbols are exported.
|
||||
*
|
||||
* @see AP_DECLARE_STATIC
|
||||
*/
|
||||
# define AP_DECLARE_EXPORT
|
||||
|
||||
#endif /* def DOXYGEN */
|
||||
|
||||
#if !defined(WIN32)
|
||||
/**
|
||||
* Apache Core dso functions are declared with AP_DECLARE(), so they may
|
||||
* use the most appropriate calling convention. Hook functions and other
|
||||
* Core functions with variable arguments must use AP_DECLARE_NONSTD().
|
||||
* @code
|
||||
* AP_DECLARE(rettype) ap_func(args)
|
||||
* @endcode
|
||||
*/
|
||||
#define AP_DECLARE(type) type
|
||||
|
||||
/**
|
||||
* Apache Core dso variable argument and hook functions are declared with
|
||||
* AP_DECLARE_NONSTD(), as they must use the C language calling convention.
|
||||
* @see AP_DECLARE
|
||||
* @code
|
||||
* AP_DECLARE_NONSTD(rettype) ap_func(args [...])
|
||||
* @endcode
|
||||
*/
|
||||
#define AP_DECLARE_NONSTD(type) type
|
||||
|
||||
/**
|
||||
* Apache Core dso variables are declared with AP_MODULE_DECLARE_DATA.
|
||||
* This assures the appropriate indirection is invoked at compile time.
|
||||
*
|
||||
* @note AP_DECLARE_DATA extern type apr_variable; syntax is required for
|
||||
* declarations within headers to properly import the variable.
|
||||
* @code
|
||||
* AP_DECLARE_DATA type apr_variable
|
||||
* @endcode
|
||||
*/
|
||||
#define AP_DECLARE_DATA
|
||||
|
||||
#elif defined(AP_DECLARE_STATIC)
|
||||
#define AP_DECLARE(type) type __stdcall
|
||||
#define AP_DECLARE_NONSTD(type) type
|
||||
#define AP_DECLARE_DATA
|
||||
#elif defined(AP_DECLARE_EXPORT)
|
||||
#define AP_DECLARE(type) __declspec(dllexport) type __stdcall
|
||||
#define AP_DECLARE_NONSTD(type) __declspec(dllexport) type
|
||||
#define AP_DECLARE_DATA __declspec(dllexport)
|
||||
#else
|
||||
#define AP_DECLARE(type) __declspec(dllimport) type __stdcall
|
||||
#define AP_DECLARE_NONSTD(type) __declspec(dllimport) type
|
||||
#define AP_DECLARE_DATA __declspec(dllimport)
|
||||
#endif
|
||||
|
||||
#if !defined(WIN32) || defined(AP_MODULE_DECLARE_STATIC)
|
||||
/**
|
||||
* Declare a dso module's exported module structure as AP_MODULE_DECLARE_DATA.
|
||||
*
|
||||
* Unless AP_MODULE_DECLARE_STATIC is defined at compile time, symbols
|
||||
* declared with AP_MODULE_DECLARE_DATA are always exported.
|
||||
* @code
|
||||
* module AP_MODULE_DECLARE_DATA mod_tag
|
||||
* @endcode
|
||||
*/
|
||||
#if defined(WIN32)
|
||||
#define AP_MODULE_DECLARE(type) type __stdcall
|
||||
#else
|
||||
#define AP_MODULE_DECLARE(type) type
|
||||
#endif
|
||||
#define AP_MODULE_DECLARE_NONSTD(type) type
|
||||
#define AP_MODULE_DECLARE_DATA
|
||||
#else
|
||||
/**
|
||||
* AP_MODULE_DECLARE_EXPORT is a no-op. Unless contradicted by the
|
||||
* AP_MODULE_DECLARE_STATIC compile-time symbol, it is assumed and defined.
|
||||
*
|
||||
* The old SHARED_MODULE compile-time symbol is now the default behavior,
|
||||
* so it is no longer referenced anywhere with Apache 2.0.
|
||||
*/
|
||||
#define AP_MODULE_DECLARE_EXPORT
|
||||
#define AP_MODULE_DECLARE(type) __declspec(dllexport) type __stdcall
|
||||
#define AP_MODULE_DECLARE_NONSTD(type) __declspec(dllexport) type
|
||||
#define AP_MODULE_DECLARE_DATA __declspec(dllexport)
|
||||
#endif
|
||||
|
||||
#include "os.h"
|
||||
#if (!defined(WIN32) && !defined(NETWARE)) || defined(__MINGW32__)
|
||||
#include "ap_config_auto.h"
|
||||
#endif
|
||||
#include "ap_config_layout.h"
|
||||
|
||||
/* Where the main/parent process's pid is logged */
|
||||
#ifndef DEFAULT_PIDLOG
|
||||
#define DEFAULT_PIDLOG DEFAULT_REL_RUNTIMEDIR "/httpd.pid"
|
||||
#endif
|
||||
|
||||
#if defined(NETWARE)
|
||||
#define AP_NONBLOCK_WHEN_MULTI_LISTEN 1
|
||||
#endif
|
||||
|
||||
#if defined(AP_ENABLE_DTRACE) && HAVE_SYS_SDT_H
|
||||
#include <sys/sdt.h>
|
||||
#else
|
||||
#undef _DTRACE_VERSION
|
||||
#endif
|
||||
|
||||
#ifdef _DTRACE_VERSION
|
||||
#include "apache_probes.h"
|
||||
#else
|
||||
#include "apache_noprobes.h"
|
||||
#endif
|
||||
|
||||
/* If APR has OTHER_CHILD logic, use reliable piped logs. */
|
||||
#if APR_HAS_OTHER_CHILD
|
||||
#define AP_HAVE_RELIABLE_PIPED_LOGS TRUE
|
||||
#endif
|
||||
|
||||
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
||||
#define AP_HAVE_C99
|
||||
#endif
|
||||
|
||||
/* Presume that the compiler supports C99-style designated
|
||||
* initializers if using GCC (but not G++), or for any other compiler
|
||||
* which claims C99 support. */
|
||||
#if (defined(__GNUC__) && !defined(__cplusplus)) || defined(AP_HAVE_C99)
|
||||
#define AP_HAVE_DESIGNATED_INITIALIZER
|
||||
#endif
|
||||
|
||||
#ifndef __has_attribute /* check for supported attributes on clang */
|
||||
#define __has_attribute(x) 0
|
||||
#endif
|
||||
#if (defined(__GNUC__) && __GNUC__ >= 4) || __has_attribute(sentinel)
|
||||
#define AP_FN_ATTR_SENTINEL __attribute__((sentinel))
|
||||
#else
|
||||
#define AP_FN_ATTR_SENTINEL
|
||||
#endif
|
||||
|
||||
#if ( defined(__GNUC__) && \
|
||||
(__GNUC__ >= 4 || ( __GNUC__ == 3 && __GNUC_MINOR__ >= 4))) \
|
||||
|| __has_attribute(warn_unused_result)
|
||||
#define AP_FN_ATTR_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
|
||||
#else
|
||||
#define AP_FN_ATTR_WARN_UNUSED_RESULT
|
||||
#endif
|
||||
|
||||
#if ( defined(__GNUC__) && \
|
||||
(__GNUC__ >= 4 && __GNUC_MINOR__ >= 3)) \
|
||||
|| __has_attribute(alloc_size)
|
||||
#define AP_FN_ATTR_ALLOC_SIZE(x) __attribute__((alloc_size(x)))
|
||||
#define AP_FN_ATTR_ALLOC_SIZE2(x,y) __attribute__((alloc_size(x,y)))
|
||||
#else
|
||||
#define AP_FN_ATTR_ALLOC_SIZE(x)
|
||||
#define AP_FN_ATTR_ALLOC_SIZE2(x,y)
|
||||
#endif
|
||||
|
||||
#endif /* AP_CONFIG_H */
|
||||
31
database/apache/include/ap_config_layout.h
Normal file
31
database/apache/include/ap_config_layout.h
Normal file
@@ -0,0 +1,31 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file win32/win32_config_layout.h
|
||||
* @brief This provides layout definitions for non-autoconf-based Windows
|
||||
* builds, and is copied to include/ap_config_layout.h during the build.
|
||||
*/
|
||||
|
||||
#ifndef AP_CONFIG_LAYOUT_H
|
||||
#define AP_CONFIG_LAYOUT_H
|
||||
|
||||
/* Check for definition of DEFAULT_REL_RUNTIMEDIR */
|
||||
#ifndef DEFAULT_REL_RUNTIMEDIR
|
||||
#define DEFAULT_REL_RUNTIMEDIR "logs"
|
||||
#endif
|
||||
|
||||
#endif /* AP_CONFIG_LAYOUT_H */
|
||||
353
database/apache/include/ap_expr.h
Normal file
353
database/apache/include/ap_expr.h
Normal file
@@ -0,0 +1,353 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file ap_expr.h
|
||||
* @brief Expression parser
|
||||
*
|
||||
* @defgroup AP_EXPR Expression parser
|
||||
* @ingroup APACHE_CORE
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef AP_EXPR_H
|
||||
#define AP_EXPR_H
|
||||
|
||||
#include "httpd.h"
|
||||
#include "http_config.h"
|
||||
#include "ap_regex.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** A node in the expression parse tree */
|
||||
typedef struct ap_expr_node ap_expr_t;
|
||||
|
||||
/** Struct describing a parsed expression */
|
||||
typedef struct {
|
||||
/** The root of the actual expression parse tree */
|
||||
ap_expr_t *root_node;
|
||||
/** The filename where the expression has been defined (for logging).
|
||||
* May be NULL
|
||||
*/
|
||||
const char *filename;
|
||||
/** The line number where the expression has been defined (for logging). */
|
||||
unsigned int line_number;
|
||||
/** Flags relevant for the expression, see AP_EXPR_FLAG_* */
|
||||
unsigned int flags;
|
||||
/** The module that is used for loglevel configuration */
|
||||
int module_index;
|
||||
} ap_expr_info_t;
|
||||
|
||||
/** Use ssl_expr compatibility mode (changes the meaning of the comparison
|
||||
* operators)
|
||||
*/
|
||||
#define AP_EXPR_FLAG_SSL_EXPR_COMPAT 1
|
||||
/** Don't add significant request headers to the Vary response header */
|
||||
#define AP_EXPR_FLAG_DONT_VARY 2
|
||||
/** Don't allow functions/vars that bypass the current request's access
|
||||
* restrictions or would otherwise leak confidential information.
|
||||
* Used by e.g. mod_include.
|
||||
*/
|
||||
#define AP_EXPR_FLAG_RESTRICTED 4
|
||||
/** Expression evaluates to a string, not to a bool */
|
||||
#define AP_EXPR_FLAG_STRING_RESULT 8
|
||||
|
||||
|
||||
/**
|
||||
* Evaluate a parse tree, simple interface
|
||||
* @param r The current request
|
||||
* @param expr The expression to be evaluated
|
||||
* @param err Where an error message should be stored
|
||||
* @return > 0 if expression evaluates to true, == 0 if false, < 0 on error
|
||||
* @note err will be set to NULL on success, or to an error message on error
|
||||
* @note request headers used during evaluation will be added to the Vary:
|
||||
* response header, unless ::AP_EXPR_FLAG_DONT_VARY is set.
|
||||
*/
|
||||
AP_DECLARE(int) ap_expr_exec(request_rec *r, const ap_expr_info_t *expr,
|
||||
const char **err);
|
||||
|
||||
/**
|
||||
* Evaluate a parse tree, with access to regexp backreference
|
||||
* @param r The current request
|
||||
* @param expr The expression to be evaluated
|
||||
* @param nmatch size of the regex match vector pmatch
|
||||
* @param pmatch information about regex matches
|
||||
* @param source the string that pmatch applies to
|
||||
* @param err Where an error message should be stored
|
||||
* @return > 0 if expression evaluates to true, == 0 if false, < 0 on error
|
||||
* @note err will be set to NULL on success, or to an error message on error
|
||||
* @note nmatch/pmatch/source can be used both to make previous matches
|
||||
* available to ap_expr_exec_re and to use ap_expr_exec_re's matches
|
||||
* later on.
|
||||
* @note request headers used during evaluation will be added to the Vary:
|
||||
* response header, unless ::AP_EXPR_FLAG_DONT_VARY is set.
|
||||
*/
|
||||
AP_DECLARE(int) ap_expr_exec_re(request_rec *r, const ap_expr_info_t *expr,
|
||||
apr_size_t nmatch, ap_regmatch_t *pmatch,
|
||||
const char **source, const char **err);
|
||||
|
||||
/** Context used during evaluation of a parse tree, created by ap_expr_exec */
|
||||
typedef struct {
|
||||
/** the current request */
|
||||
request_rec *r;
|
||||
/** the current connection */
|
||||
conn_rec *c;
|
||||
/** the current virtual host */
|
||||
server_rec *s;
|
||||
/** the pool to use */
|
||||
apr_pool_t *p;
|
||||
/** where to store the error string */
|
||||
const char **err;
|
||||
/** ap_expr_info_t for the expression */
|
||||
const ap_expr_info_t *info;
|
||||
/** regex match information for back references */
|
||||
ap_regmatch_t *re_pmatch;
|
||||
/** size of the vector pointed to by re_pmatch */
|
||||
apr_size_t re_nmatch;
|
||||
/** the string corresponding to the re_pmatch */
|
||||
const char **re_source;
|
||||
/** A string where the comma separated names of headers are stored
|
||||
* to be later added to the Vary: header. If NULL, the caller is not
|
||||
* interested in this information.
|
||||
*/
|
||||
const char **vary_this;
|
||||
/** where to store the result string */
|
||||
const char **result_string;
|
||||
/** Arbitrary context data provided by the caller for custom functions */
|
||||
void *data;
|
||||
/** The current recursion level */
|
||||
int reclvl;
|
||||
} ap_expr_eval_ctx_t;
|
||||
|
||||
/**
|
||||
* Evaluate a parse tree, full featured version
|
||||
* @param ctx The evaluation context with all data filled in
|
||||
* @return > 0 if expression evaluates to true, == 0 if false, < 0 on error
|
||||
* @note *ctx->err will be set to NULL on success, or to an error message on
|
||||
* error
|
||||
* @note request headers used during evaluation will be added to the Vary:
|
||||
* response header if ctx->vary_this is set.
|
||||
*/
|
||||
AP_DECLARE(int) ap_expr_exec_ctx(ap_expr_eval_ctx_t *ctx);
|
||||
|
||||
/**
|
||||
* Evaluate a parse tree of a string valued expression
|
||||
* @param r The current request
|
||||
* @param expr The expression to be evaluated
|
||||
* @param err Where an error message should be stored
|
||||
* @return The result string, NULL on error
|
||||
* @note err will be set to NULL on success, or to an error message on error
|
||||
* @note request headers used during evaluation will be added to the Vary:
|
||||
* response header, unless ::AP_EXPR_FLAG_DONT_VARY is set.
|
||||
*/
|
||||
AP_DECLARE(const char *) ap_expr_str_exec(request_rec *r,
|
||||
const ap_expr_info_t *expr,
|
||||
const char **err);
|
||||
|
||||
/**
|
||||
* Evaluate a parse tree of a string valued expression
|
||||
* @param r The current request
|
||||
* @param expr The expression to be evaluated
|
||||
* @param nmatch size of the regex match vector pmatch
|
||||
* @param pmatch information about regex matches
|
||||
* @param source the string that pmatch applies to
|
||||
* @param err Where an error message should be stored
|
||||
* @return The result string, NULL on error
|
||||
* @note err will be set to NULL on success, or to an error message on error
|
||||
* @note nmatch/pmatch/source can be used both to make previous matches
|
||||
* available to ap_expr_exec_re and to use ap_expr_exec_re's matches
|
||||
* later on.
|
||||
* @note request headers used during evaluation will be added to the Vary:
|
||||
* response header, unless ::AP_EXPR_FLAG_DONT_VARY is set.
|
||||
*/
|
||||
AP_DECLARE(const char *) ap_expr_str_exec_re(request_rec *r,
|
||||
const ap_expr_info_t *expr,
|
||||
apr_size_t nmatch,
|
||||
ap_regmatch_t *pmatch,
|
||||
const char **source,
|
||||
const char **err);
|
||||
|
||||
|
||||
/**
|
||||
* The parser can be extended with variable lookup, functions, and
|
||||
* and operators.
|
||||
*
|
||||
* During parsing, the parser calls the lookup function to resolve a
|
||||
* name into a function pointer and an opaque context for the function.
|
||||
* If the argument to a function or operator is constant, the lookup function
|
||||
* may also parse that argument and store the parsed data in the context.
|
||||
*
|
||||
* The default lookup function is the hook ::ap_expr_lookup_default which just
|
||||
* calls ap_run_expr_lookup. Modules can use it to make functions and
|
||||
* variables generally available.
|
||||
*
|
||||
* An ap_expr consumer can also provide its own custom lookup function to
|
||||
* modify the set of variables and functions that are available. The custom
|
||||
* lookup function can in turn call 'ap_run_expr_lookup'.
|
||||
*/
|
||||
|
||||
/** Unary operator, takes one string argument and returns a bool value.
|
||||
* The name must have the form '-z' (one letter only).
|
||||
* @param ctx The evaluation context
|
||||
* @param data An opaque context provided by the lookup hook function
|
||||
* @param arg The (right) operand
|
||||
* @return 0 or 1
|
||||
*/
|
||||
typedef int ap_expr_op_unary_t(ap_expr_eval_ctx_t *ctx, const void *data,
|
||||
const char *arg);
|
||||
|
||||
/** Binary operator, takes two string arguments and returns a bool value.
|
||||
* The name must have the form '-cmp' (at least two letters).
|
||||
* @param ctx The evaluation context
|
||||
* @param data An opaque context provided by the lookup hook function
|
||||
* @param arg1 The left operand
|
||||
* @param arg2 The right operand
|
||||
* @return 0 or 1
|
||||
*/
|
||||
typedef int ap_expr_op_binary_t(ap_expr_eval_ctx_t *ctx, const void *data,
|
||||
const char *arg1, const char *arg2);
|
||||
|
||||
/** String valued function, takes a string argument and returns a string
|
||||
* @param ctx The evaluation context
|
||||
* @param data An opaque context provided by the lookup hook function
|
||||
* @param arg The argument
|
||||
* @return The functions result string, may be NULL for 'empty string'
|
||||
*/
|
||||
typedef const char *(ap_expr_string_func_t)(ap_expr_eval_ctx_t *ctx,
|
||||
const void *data,
|
||||
const char *arg);
|
||||
|
||||
/** List valued function, takes a string argument and returns a list of strings
|
||||
* Can currently only be called following the builtin '-in' operator.
|
||||
* @param ctx The evaluation context
|
||||
* @param data An opaque context provided by the lookup hook function
|
||||
* @param arg The argument
|
||||
* @return The functions result list of strings, may be NULL for 'empty array'
|
||||
*/
|
||||
typedef apr_array_header_t *(ap_expr_list_func_t)(ap_expr_eval_ctx_t *ctx,
|
||||
const void *data,
|
||||
const char *arg);
|
||||
|
||||
/** Variable lookup function, takes no argument and returns a string
|
||||
* @param ctx The evaluation context
|
||||
* @param data An opaque context provided by the lookup hook function
|
||||
* @return The expanded variable
|
||||
*/
|
||||
typedef const char *(ap_expr_var_func_t)(ap_expr_eval_ctx_t *ctx,
|
||||
const void *data);
|
||||
|
||||
/** parameter struct passed to the lookup hook functions */
|
||||
typedef struct {
|
||||
/** type of the looked up object */
|
||||
int type;
|
||||
#define AP_EXPR_FUNC_VAR 0
|
||||
#define AP_EXPR_FUNC_STRING 1
|
||||
#define AP_EXPR_FUNC_LIST 2
|
||||
#define AP_EXPR_FUNC_OP_UNARY 3
|
||||
#define AP_EXPR_FUNC_OP_BINARY 4
|
||||
/** name of the looked up object */
|
||||
const char *name;
|
||||
|
||||
int flags;
|
||||
|
||||
apr_pool_t *pool;
|
||||
apr_pool_t *ptemp;
|
||||
|
||||
/** where to store the function pointer */
|
||||
const void **func;
|
||||
/** where to store the function's context */
|
||||
const void **data;
|
||||
/** where to store the error message (if any) */
|
||||
const char **err;
|
||||
|
||||
/** arg for pre-parsing (only if a simple string).
|
||||
* For binary ops, this is the right argument. */
|
||||
const char *arg;
|
||||
} ap_expr_lookup_parms;
|
||||
|
||||
/** Function for looking up the provider function for a variable, operator
|
||||
* or function in an expression.
|
||||
* @param parms The parameter struct, also determines where the result is
|
||||
* stored.
|
||||
* @return OK on success,
|
||||
* !OK on failure,
|
||||
* DECLINED if the requested name is not handled by this function
|
||||
*/
|
||||
typedef int (ap_expr_lookup_fn_t)(ap_expr_lookup_parms *parms);
|
||||
|
||||
/** Default lookup function which just calls ap_run_expr_lookup().
|
||||
* ap_run_expr_lookup cannot be used directly because it has the wrong
|
||||
* calling convention under Windows.
|
||||
*/
|
||||
AP_DECLARE_NONSTD(int) ap_expr_lookup_default(ap_expr_lookup_parms *parms);
|
||||
|
||||
AP_DECLARE_HOOK(int, expr_lookup, (ap_expr_lookup_parms *parms))
|
||||
|
||||
/**
|
||||
* Parse an expression into a parse tree
|
||||
* @param pool Pool
|
||||
* @param ptemp temp pool
|
||||
* @param info The ap_expr_info_t struct (with values filled in)
|
||||
* @param expr The expression string to parse
|
||||
* @param lookup_fn The lookup function to use, NULL for default
|
||||
* @return NULL on success, error message on error.
|
||||
* A pointer to the resulting parse tree will be stored in
|
||||
* info->root_node.
|
||||
*/
|
||||
AP_DECLARE(const char *) ap_expr_parse(apr_pool_t *pool, apr_pool_t *ptemp,
|
||||
ap_expr_info_t *info, const char *expr,
|
||||
ap_expr_lookup_fn_t *lookup_fn);
|
||||
|
||||
/**
|
||||
* High level interface to ap_expr_parse that also creates ap_expr_info_t and
|
||||
* uses info from cmd_parms to fill in most of it.
|
||||
* @param cmd The cmd_parms struct
|
||||
* @param expr The expression string to parse
|
||||
* @param flags The flags to use, see AP_EXPR_FLAG_*
|
||||
* @param err Set to NULL on success, error message on error
|
||||
* @param lookup_fn The lookup function used to lookup vars, functions, and
|
||||
* operators
|
||||
* @param module_index The module_index to set for the expression
|
||||
* @return The parsed expression
|
||||
* @note Usually ap_expr_parse_cmd() should be used
|
||||
*/
|
||||
AP_DECLARE(ap_expr_info_t *) ap_expr_parse_cmd_mi(const cmd_parms *cmd,
|
||||
const char *expr,
|
||||
unsigned int flags,
|
||||
const char **err,
|
||||
ap_expr_lookup_fn_t *lookup_fn,
|
||||
int module_index);
|
||||
|
||||
/**
|
||||
* Convenience wrapper for ap_expr_parse_cmd_mi() that sets
|
||||
* module_index = APLOG_MODULE_INDEX
|
||||
*/
|
||||
#define ap_expr_parse_cmd(cmd, expr, flags, err, lookup_fn) \
|
||||
ap_expr_parse_cmd_mi(cmd, expr, flags, err, lookup_fn, APLOG_MODULE_INDEX)
|
||||
|
||||
/**
|
||||
* Internal initialisation of ap_expr (for httpd internal use)
|
||||
*/
|
||||
void ap_expr_init(apr_pool_t *pool);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* AP_EXPR_H */
|
||||
/** @} */
|
||||
162
database/apache/include/ap_hooks.h
Normal file
162
database/apache/include/ap_hooks.h
Normal file
@@ -0,0 +1,162 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file ap_hooks.h
|
||||
* @brief ap hook functions and macros
|
||||
*/
|
||||
|
||||
#ifndef AP_HOOKS_H
|
||||
#define AP_HOOKS_H
|
||||
|
||||
/* Although this file doesn't declare any hooks, declare the hook group here */
|
||||
/**
|
||||
* @defgroup hooks Apache Hooks
|
||||
* @ingroup APACHE_CORE
|
||||
*/
|
||||
|
||||
#if defined(AP_HOOK_PROBES_ENABLED) && !defined(APR_HOOK_PROBES_ENABLED)
|
||||
#define APR_HOOK_PROBES_ENABLED 1
|
||||
#endif
|
||||
|
||||
#ifdef APR_HOOK_PROBES_ENABLED
|
||||
#include "ap_hook_probes.h"
|
||||
#endif
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_hooks.h"
|
||||
#include "apr_optional_hooks.h"
|
||||
|
||||
#ifdef DOXYGEN
|
||||
/* define these just so doxygen documents them */
|
||||
|
||||
/**
|
||||
* AP_DECLARE_STATIC is defined when including Apache's Core headers,
|
||||
* to provide static linkage when the dynamic library may be unavailable.
|
||||
*
|
||||
* @see AP_DECLARE_EXPORT
|
||||
*
|
||||
* AP_DECLARE_STATIC and AP_DECLARE_EXPORT are left undefined when
|
||||
* including Apache's Core headers, to import and link the symbols from the
|
||||
* dynamic Apache Core library and assure appropriate indirection and calling
|
||||
* conventions at compile time.
|
||||
*/
|
||||
# define AP_DECLARE_STATIC
|
||||
/**
|
||||
* AP_DECLARE_EXPORT is defined when building the Apache Core dynamic
|
||||
* library, so that all public symbols are exported.
|
||||
*
|
||||
* @see AP_DECLARE_STATIC
|
||||
*/
|
||||
# define AP_DECLARE_EXPORT
|
||||
|
||||
#endif /* def DOXYGEN */
|
||||
|
||||
/**
|
||||
* Declare a hook function
|
||||
* @param ret The return type of the hook
|
||||
* @param name The hook's name (as a literal)
|
||||
* @param args The arguments the hook function takes, in brackets.
|
||||
*/
|
||||
#define AP_DECLARE_HOOK(ret,name,args) \
|
||||
APR_DECLARE_EXTERNAL_HOOK(ap,AP,ret,name,args)
|
||||
|
||||
/** @internal */
|
||||
#define AP_IMPLEMENT_HOOK_BASE(name) \
|
||||
APR_IMPLEMENT_EXTERNAL_HOOK_BASE(ap,AP,name)
|
||||
|
||||
/**
|
||||
* Implement an Apache core hook that has no return code, and
|
||||
* therefore runs all of the registered functions. The implementation
|
||||
* is called ap_run_<i>name</i>.
|
||||
*
|
||||
* @param name The name of the hook
|
||||
* @param args_decl The declaration of the arguments for the hook, for example
|
||||
* "(int x,void *y)"
|
||||
* @param args_use The arguments for the hook as used in a call, for example
|
||||
* "(x,y)"
|
||||
* @note If IMPLEMENTing a hook that is not linked into the Apache core,
|
||||
* (e.g. within a dso) see APR_IMPLEMENT_EXTERNAL_HOOK_VOID.
|
||||
*/
|
||||
#define AP_IMPLEMENT_HOOK_VOID(name,args_decl,args_use) \
|
||||
APR_IMPLEMENT_EXTERNAL_HOOK_VOID(ap,AP,name,args_decl,args_use)
|
||||
|
||||
/**
|
||||
* Implement an Apache core hook that runs until one of the functions
|
||||
* returns something other than ok or decline. That return value is
|
||||
* then returned from the hook runner. If the hooks run to completion,
|
||||
* then ok is returned. Note that if no hook runs it would probably be
|
||||
* more correct to return decline, but this currently does not do
|
||||
* so. The implementation is called ap_run_<i>name</i>.
|
||||
*
|
||||
* @param ret The return type of the hook (and the hook runner)
|
||||
* @param name The name of the hook
|
||||
* @param args_decl The declaration of the arguments for the hook, for example
|
||||
* "(int x,void *y)"
|
||||
* @param args_use The arguments for the hook as used in a call, for example
|
||||
* "(x,y)"
|
||||
* @param ok The "ok" return value
|
||||
* @param decline The "decline" return value
|
||||
* @return ok, decline or an error.
|
||||
* @note If IMPLEMENTing a hook that is not linked into the Apache core,
|
||||
* (e.g. within a dso) see APR_IMPLEMENT_EXTERNAL_HOOK_RUN_ALL.
|
||||
*/
|
||||
#define AP_IMPLEMENT_HOOK_RUN_ALL(ret,name,args_decl,args_use,ok,decline) \
|
||||
APR_IMPLEMENT_EXTERNAL_HOOK_RUN_ALL(ap,AP,ret,name,args_decl, \
|
||||
args_use,ok,decline)
|
||||
|
||||
/**
|
||||
* Implement a hook that runs until a function returns something other than
|
||||
* decline. If all functions return decline, the hook runner returns decline.
|
||||
* The implementation is called ap_run_<i>name</i>.
|
||||
*
|
||||
* @param ret The return type of the hook (and the hook runner)
|
||||
* @param name The name of the hook
|
||||
* @param args_decl The declaration of the arguments for the hook, for example
|
||||
* "(int x,void *y)"
|
||||
* @param args_use The arguments for the hook as used in a call, for example
|
||||
* "(x,y)"
|
||||
* @param decline The "decline" return value
|
||||
* @return decline or an error.
|
||||
* @note If IMPLEMENTing a hook that is not linked into the Apache core
|
||||
* (e.g. within a dso) see APR_IMPLEMENT_EXTERNAL_HOOK_RUN_FIRST.
|
||||
*/
|
||||
#define AP_IMPLEMENT_HOOK_RUN_FIRST(ret,name,args_decl,args_use,decline) \
|
||||
APR_IMPLEMENT_EXTERNAL_HOOK_RUN_FIRST(ap,AP,ret,name,args_decl, \
|
||||
args_use,decline)
|
||||
|
||||
/* Note that the other optional hook implementations are straightforward but
|
||||
* have not yet been needed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implement an optional hook. This is exactly the same as a standard hook
|
||||
* implementation, except the hook is optional.
|
||||
* @see AP_IMPLEMENT_HOOK_RUN_ALL
|
||||
*/
|
||||
#define AP_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(ret,name,args_decl,args_use,ok, \
|
||||
decline) \
|
||||
APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(ap,AP,ret,name,args_decl, \
|
||||
args_use,ok,decline)
|
||||
|
||||
/**
|
||||
* Hook an optional hook. Unlike static hooks, this uses a macro instead of a
|
||||
* function.
|
||||
*/
|
||||
#define AP_OPTIONAL_HOOK(name,fn,pre,succ,order) \
|
||||
APR_OPTIONAL_HOOK(ap,name,fn,pre,succ,order)
|
||||
|
||||
#endif /* AP_HOOKS_H */
|
||||
163
database/apache/include/ap_listen.h
Normal file
163
database/apache/include/ap_listen.h
Normal file
@@ -0,0 +1,163 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file ap_listen.h
|
||||
* @brief Apache Listeners Library
|
||||
*
|
||||
* @defgroup APACHE_CORE_LISTEN Apache Listeners Library
|
||||
* @ingroup APACHE_CORE
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef AP_LISTEN_H
|
||||
#define AP_LISTEN_H
|
||||
|
||||
#include "apr_network_io.h"
|
||||
#include "httpd.h"
|
||||
#include "http_config.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct ap_slave_t ap_slave_t;
|
||||
typedef struct ap_listen_rec ap_listen_rec;
|
||||
typedef apr_status_t (*accept_function)(void **csd, ap_listen_rec *lr, apr_pool_t *ptrans);
|
||||
|
||||
/**
|
||||
* @brief Apache's listeners record.
|
||||
*
|
||||
* These are used in the Multi-Processing Modules
|
||||
* to setup all of the sockets for the MPM to listen to and accept on.
|
||||
*/
|
||||
struct ap_listen_rec {
|
||||
/**
|
||||
* The next listener in the list
|
||||
*/
|
||||
ap_listen_rec *next;
|
||||
/**
|
||||
* The actual socket
|
||||
*/
|
||||
apr_socket_t *sd;
|
||||
/**
|
||||
* The sockaddr the socket should bind to
|
||||
*/
|
||||
apr_sockaddr_t *bind_addr;
|
||||
/**
|
||||
* The accept function for this socket
|
||||
*/
|
||||
accept_function accept_func;
|
||||
/**
|
||||
* Is this socket currently active
|
||||
*/
|
||||
int active;
|
||||
/**
|
||||
* The default protocol for this listening socket.
|
||||
*/
|
||||
const char* protocol;
|
||||
|
||||
ap_slave_t *slave;
|
||||
};
|
||||
|
||||
/**
|
||||
* The global list of ap_listen_rec structures
|
||||
*/
|
||||
AP_DECLARE_DATA extern ap_listen_rec *ap_listeners;
|
||||
AP_DECLARE_DATA extern int ap_num_listen_buckets;
|
||||
AP_DECLARE_DATA extern int ap_have_so_reuseport;
|
||||
|
||||
/**
|
||||
* Setup all of the defaults for the listener list
|
||||
*/
|
||||
AP_DECLARE(void) ap_listen_pre_config(void);
|
||||
|
||||
/**
|
||||
* Loop through the global ap_listen_rec list and create all of the required
|
||||
* sockets. This executes the listen and bind on the sockets.
|
||||
* @param s The global server_rec
|
||||
* @return The number of open sockets.
|
||||
*/
|
||||
AP_DECLARE(int) ap_setup_listeners(server_rec *s);
|
||||
|
||||
/**
|
||||
* This function duplicates ap_listeners into multiple buckets when configured
|
||||
* to (see ListenCoresBucketsRatio) and the platform supports it (eg. number of
|
||||
* online CPU cores and SO_REUSEPORT available).
|
||||
* @param p The config pool
|
||||
* @param s The global server_rec
|
||||
* @param buckets The array of listeners buckets.
|
||||
* @param num_buckets The total number of listeners buckets (array size).
|
||||
* @remark If the given *num_buckets is 0 (input), it will be computed
|
||||
* according to the platform capacities, otherwise (positive) it
|
||||
* will be preserved. The number of listeners duplicated will
|
||||
* always match *num_buckets, be it computed or given.
|
||||
*/
|
||||
AP_DECLARE(apr_status_t) ap_duplicate_listeners(apr_pool_t *p, server_rec *s,
|
||||
ap_listen_rec ***buckets,
|
||||
int *num_buckets);
|
||||
|
||||
/**
|
||||
* Loop through the global ap_listen_rec list and close each of the sockets.
|
||||
*/
|
||||
AP_DECLARE_NONSTD(void) ap_close_listeners(void);
|
||||
|
||||
/**
|
||||
* Loop through the given ap_listen_rec list and close each of the sockets.
|
||||
* @param listeners The listener to close.
|
||||
*/
|
||||
AP_DECLARE_NONSTD(void) ap_close_listeners_ex(ap_listen_rec *listeners);
|
||||
|
||||
/**
|
||||
* FIXMEDOC
|
||||
*/
|
||||
AP_DECLARE_NONSTD(int) ap_close_selected_listeners(ap_slave_t *);
|
||||
|
||||
/* Although these functions are exported from libmain, they are not really
|
||||
* public functions. These functions are actually called while parsing the
|
||||
* config file, when one of the LISTEN_COMMANDS directives is read. These
|
||||
* should not ever be called by external modules. ALL MPMs should include
|
||||
* LISTEN_COMMANDS in their command_rec table so that these functions are
|
||||
* called.
|
||||
*/
|
||||
AP_DECLARE_NONSTD(const char *) ap_set_listenbacklog(cmd_parms *cmd, void *dummy, const char *arg);
|
||||
AP_DECLARE_NONSTD(const char *) ap_set_listencbratio(cmd_parms *cmd, void *dummy, const char *arg);
|
||||
AP_DECLARE_NONSTD(const char *) ap_set_listener(cmd_parms *cmd, void *dummy,
|
||||
int argc, char *const argv[]);
|
||||
AP_DECLARE_NONSTD(const char *) ap_set_send_buffer_size(cmd_parms *cmd, void *dummy,
|
||||
const char *arg);
|
||||
AP_DECLARE_NONSTD(const char *) ap_set_receive_buffer_size(cmd_parms *cmd,
|
||||
void *dummy,
|
||||
const char *arg);
|
||||
|
||||
#define LISTEN_COMMANDS \
|
||||
AP_INIT_TAKE1("ListenBacklog", ap_set_listenbacklog, NULL, RSRC_CONF, \
|
||||
"Maximum length of the queue of pending connections, as used by listen(2)"), \
|
||||
AP_INIT_TAKE1("ListenCoresBucketsRatio", ap_set_listencbratio, NULL, RSRC_CONF, \
|
||||
"Ratio between the number of CPU cores (online) and the number of listeners buckets"), \
|
||||
AP_INIT_TAKE_ARGV("Listen", ap_set_listener, NULL, RSRC_CONF, \
|
||||
"A port number or a numeric IP address and a port number, and an optional protocol"), \
|
||||
AP_INIT_TAKE1("SendBufferSize", ap_set_send_buffer_size, NULL, RSRC_CONF, \
|
||||
"Send buffer size in bytes"), \
|
||||
AP_INIT_TAKE1("ReceiveBufferSize", ap_set_receive_buffer_size, NULL, \
|
||||
RSRC_CONF, "Receive buffer size in bytes")
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/** @} */
|
||||
639
database/apache/include/ap_mmn.h
Normal file
639
database/apache/include/ap_mmn.h
Normal file
@@ -0,0 +1,639 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file ap_mmn.h
|
||||
* @brief Module Magic Number
|
||||
*
|
||||
* @defgroup APACHE_CORE_MMN Module Magic Number
|
||||
* @ingroup APACHE_CORE
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef APACHE_AP_MMN_H
|
||||
#define APACHE_AP_MMN_H
|
||||
|
||||
/*
|
||||
* MODULE_MAGIC_NUMBER_MAJOR
|
||||
* Major API changes that could cause compatibility problems for older modules
|
||||
* such as structure size changes. No binary compatibility is possible across
|
||||
* a change in the major version.
|
||||
*
|
||||
* MODULE_MAGIC_NUMBER_MINOR
|
||||
* Minor API changes that do not cause binary compatibility problems.
|
||||
* Should be reset to 0 when upgrading MODULE_MAGIC_NUMBER_MAJOR.
|
||||
*
|
||||
* See the AP_MODULE_MAGIC_AT_LEAST macro below for an example.
|
||||
*/
|
||||
|
||||
/*
|
||||
* 20010224 (2.0.13-dev) MODULE_MAGIC_COOKIE reset to "AP20"
|
||||
* 20010523 (2.0.19-dev) bump for scoreboard structure reordering
|
||||
* 20010627 (2.0.19-dev) more API changes than I can count
|
||||
* 20010726 (2.0.22-dev) more big API changes
|
||||
* 20010808 (2.0.23-dev) dir d_is_absolute bit introduced, bucket changes, etc
|
||||
* 20010825 (2.0.25-dev) removed d_is_absolute, introduced map_to_storage hook
|
||||
* 20011002 (2.0.26-dev) removed 1.3-deprecated request_rec.content_language
|
||||
* 20011127 (2.0.29-dev) bump for postconfig hook change, and removal of
|
||||
* socket from connection record
|
||||
* 20011212 (2.0.30-dev) bump for new used_path_info member of request_rec
|
||||
* 20011218 (2.0.30-dev) bump for new sbh member of conn_rec, different
|
||||
* declarations for scoreboard, new parameter to
|
||||
* create_connection hook
|
||||
* 20020102 (2.0.30-dev) bump for changed type of limit_req_body in
|
||||
* core_dir_config
|
||||
* 20020109 (2.0.31-dev) bump for changed shm and scoreboard declarations
|
||||
* 20020111 (2.0.31-dev) bump for ETag fields added at end of cor_dir_config
|
||||
* 20020114 (2.0.31-dev) mod_dav changed how it asks its provider to fulfill
|
||||
* a GET request
|
||||
* 20020118 (2.0.31-dev) Input filtering split of blocking and mode
|
||||
* 20020127 (2.0.31-dev) bump for pre_mpm hook change
|
||||
* 20020128 (2.0.31-dev) bump for pre_config hook change
|
||||
* 20020218 (2.0.33-dev) bump for AddOutputFilterByType directive
|
||||
* 20020220 (2.0.33-dev) bump for scoreboard.h structure change
|
||||
* 20020302 (2.0.33-dev) bump for protocol_filter additions.
|
||||
* 20020306 (2.0.34-dev) bump for filter type renames.
|
||||
* 20020318 (2.0.34-dev) mod_dav's API for REPORT generation changed
|
||||
* 20020319 (2.0.34-dev) M_INVALID changed, plus new M_* methods for RFC 3253
|
||||
* 20020327 (2.0.35-dev) Add parameter to quick_handler hook
|
||||
* 20020329 (2.0.35-dev) bump for addition of freelists to bucket API
|
||||
* 20020329.1 (2.0.36) minor bump for new arg to opt fn ap_cgi_build_command
|
||||
* 20020506 (2.0.37-dev) Removed r->boundary in request_rec.
|
||||
* 20020529 (2.0.37-dev) Standardized the names of some apr_pool_*_set funcs
|
||||
* 20020602 (2.0.37-dev) Bucket API change (metadata buckets)
|
||||
* 20020612 (2.0.38-dev) Changed server_rec->[keep_alive_]timeout to apr time
|
||||
* 20020625 (2.0.40-dev) Changed conn_rec->keepalive to an enumeration
|
||||
* 20020628 (2.0.40-dev) Added filter_init to filter registration functions
|
||||
* 20020903 (2.0.41-dev) APR's error constants changed
|
||||
* 20020903.1 (2.1.0-dev) allow_encoded_slashes added to core_dir_config
|
||||
* 20020903.2 (2.0.46-dev) add ap_escape_logitem
|
||||
* 20030213.1 (2.1.0-dev) changed log_writer optional fn's to return previous
|
||||
* handler
|
||||
* 20030821 (2.1.0-dev) bumped mod_include's entire API
|
||||
* 20030821.1 (2.1.0-dev) added XHTML doctypes
|
||||
* 20030821.2 (2.1.0-dev) added ap_escape_errorlog_item
|
||||
* 20030821.3 (2.1.0-dev) added ap_get_server_revision / ap_version_t
|
||||
* 20040425 (2.1.0-dev) removed ap_add_named_module API
|
||||
* changed ap_add_module, ap_add_loaded_module,
|
||||
* ap_setup_prelinked_modules,
|
||||
* ap_process_resource_config
|
||||
* 20040425.1 (2.1.0-dev) Added ap_module_symbol_t and
|
||||
* ap_prelinked_module_symbols
|
||||
* 20050101.0 (2.1.2-dev) Axed misnamed http_method for http_scheme
|
||||
* (which it was!)
|
||||
* 20050127.0 (2.1.3-dev) renamed regex_t->ap_regex_t,
|
||||
* regmatch_t->ap_regmatch_t, REG_*->AP_REG_*,
|
||||
* removed reg* in place of ap_reg*; added ap_regex.h
|
||||
* 20050217.0 (2.1.3-dev) Axed find_child_by_pid, mpm_*_completion_context
|
||||
* (winnt mpm) symbols from the public sector, and
|
||||
* decorated real_exit_code with ap_ in the win32/os.h.
|
||||
* 20050305.0 (2.1.4-dev) added pid and generation fields to worker_score
|
||||
* 20050305.1 (2.1.5-dev) added ap_vhost_iterate_given_conn.
|
||||
* 20050305.2 (2.1.5-dev) added AP_INIT_TAKE_ARGV.
|
||||
* 20050305.3 (2.1.5-dev) added Protocol Framework.
|
||||
* 20050701.0 (2.1.7-dev) Bump MODULE_MAGIC_COOKIE to "AP21"!
|
||||
* 20050701.1 (2.1.7-dev) trace_enable member added to core server_config
|
||||
* 20050708.0 (2.1.7-dev) Bump MODULE_MAGIC_COOKIE to "AP22"!
|
||||
* 20050708.1 (2.1.7-dev) add proxy request_status hook (minor)
|
||||
* 20050919.0 (2.1.8-dev) mod_ssl ssl_ext_list optional function added
|
||||
* 20051005.0 (2.1.8-dev) NET_TIME filter eliminated
|
||||
* 20051005.0 (2.3.0-dev) Bump MODULE_MAGIC_COOKIE to "AP24"!
|
||||
* 20051115.0 (2.3.0-dev) Added use_canonical_phys_port to core_dir_config
|
||||
* 20060110.0 (2.3.0-dev) Conversion of Authz to be provider based
|
||||
* addition of <SatisfyAll><SatisfyOne>
|
||||
* removal of Satisfy, Allow, Deny, Order
|
||||
* 20060110.1 (2.3.0-dev) minex and minex_set members added to
|
||||
* cache_server_conf (minor)
|
||||
* 20060110.2 (2.3.0-dev) flush_packets and flush_wait members added to
|
||||
* proxy_server (minor)
|
||||
* 20060110.3 (2.3.0-dev) added inreslist member to proxy_conn_rec (minor)
|
||||
* 20060110.4 (2.3.0-dev) Added server_scheme member to server_rec (minor)
|
||||
* 20060905.0 (2.3.0-dev) Replaced ap_get_server_version() with
|
||||
* ap_get_server_banner() and ap_get_server_description()
|
||||
* 20060905.1 (2.3.0-dev) Enable retry=0 for the worker (minor)
|
||||
* 20060905.2 (2.3.0-dev) Added ap_all_available_mutexes_string,
|
||||
* ap_available_mutexes_string and
|
||||
* ap_parse_mutex()
|
||||
* 20060905.3 (2.3.0-dev) Added conn_rec::clogging_input_filters.
|
||||
* 20060905.4 (2.3.0-dev) Added proxy_balancer::sticky_path.
|
||||
* 20060905.5 (2.3.0-dev) Added ap_mpm_safe_kill()
|
||||
* 20070823.0 (2.3.0-dev) Removed ap_all_available_mutexes_string,
|
||||
* ap_available_mutexes_string for macros
|
||||
* 20070823.1 (2.3.0-dev) add ap_send_interim_response()
|
||||
* 20071023.0 (2.3.0-dev) add ap_get_scoreboard(sbh) split from the less
|
||||
* conventional ap_get_scoreboard(proc, thread)
|
||||
* 20071023.1 (2.3.0-dev) Add flags field to struct proxy_alias
|
||||
* 20071023.2 (2.3.0-dev) Add ap_mod_status_reqtail
|
||||
* 20071023.3 (2.3.0-dev) Declare ap_time_process_request() as part of the
|
||||
* public scoreboard API.
|
||||
* 20071108.1 (2.3.0-dev) Add the optional kept_body brigade to request_rec
|
||||
* 20071108.2 (2.3.0-dev) Add st and keep fields to struct util_ldap_connection_t
|
||||
* 20071108.3 (2.3.0-dev) Add API guarantee for adding connection filters
|
||||
* with non-NULL request_rec pointer (ap_add_*_filter*)
|
||||
* 20071108.4 (2.3.0-dev) Add ap_proxy_ssl_connection_cleanup
|
||||
* 20071108.5 (2.3.0-dev) Add *scpool to proxy_conn_rec structure
|
||||
* 20071108.6 (2.3.0-dev) Add *r and need_flush to proxy_conn_rec structure
|
||||
* 20071108.7 (2.3.0-dev) Add *ftp_directory_charset to proxy_dir_conf
|
||||
* 20071108.8 (2.3.0-dev) Add optional function ap_logio_add_bytes_in() to mog_logio
|
||||
* 20071108.9 (2.3.0-dev) Add chroot support to unixd_config
|
||||
* 20071108.10(2.3.0-dev) Introduce new ap_expr API
|
||||
* 20071108.11(2.3.0-dev) Revise/Expand new ap_expr API
|
||||
* 20071108.12(2.3.0-dev) Remove ap_expr_clone from the API (same day it was added)
|
||||
* 20080403.0 (2.3.0-dev) Add condition field to core dir config
|
||||
* 20080403.1 (2.3.0-dev) Add authn/z hook and provider registration wrappers.
|
||||
* 20080403.2 (2.3.0-dev) Add ap_escape_path_segment_buffer() and ap_unescape_all().
|
||||
* 20080407.0 (2.3.0-dev) Remove ap_graceful_stop_signalled.
|
||||
* 20080407.1 Deprecate ap_cache_cacheable_hdrs_out and add two
|
||||
* generalized ap_cache_cacheable_headers_(in|out).
|
||||
* 20080528.0 (2.3.0-dev) Switch order of ftp_directory_charset and
|
||||
* interpolate_env in proxy_dir_conf.
|
||||
* Rationale: see r661069.
|
||||
* 20080528.1 (2.3.0-dev) add has_realm_hash() to authn_provider struct
|
||||
* 20080722.0 (2.3.0-dev) remove has_realm_hash() from authn_provider struct
|
||||
* 20080722.1 (2.3.0-dev) Add conn_timeout and conn_timeout_set to
|
||||
* proxy_worker struct.
|
||||
* 20080722.2 (2.3.0-dev) Add scolonsep to proxy_balancer
|
||||
* 20080829.0 (2.3.0-dev) Add cookie attributes when removing cookies
|
||||
* 20080830.0 (2.3.0-dev) Cookies can be set on headers_out and err_headers_out
|
||||
* 20080920.0 (2.3.0-dev) Add ap_mpm_register_timed_callback.
|
||||
* 20080920.1 (2.3.0-dev) Export mod_rewrite.h in the public API.
|
||||
* 20080920.2 (2.3.0-dev) Added ap_timeout_parameter_parse to util.c / httpd.h
|
||||
* 20081101.0 (2.3.0-dev) Remove unused AUTHZ_GROUP_NOTE define.
|
||||
* 20081102.0 (2.3.0-dev) Remove authz_provider_list, authz_request_state,
|
||||
* and AUTHZ_ACCESS_PASSED_NOTE.
|
||||
* 20081104.0 (2.3.0-dev) Remove r and need_flush fields from proxy_conn_rec
|
||||
* as they are no longer used and add
|
||||
* ap_proxy_buckets_lifetime_transform to mod_proxy.h
|
||||
* 20081129.0 (2.3.0-dev) Move AP_FILTER_ERROR and AP_NOBODY_READ|WROTE
|
||||
* from util_filter.h to httpd.h and change their
|
||||
* numeric values so they do not overlap with other
|
||||
* potential status codes
|
||||
* 20081201.0 (2.3.0-dev) Rename several APIs to include ap_ prefix.
|
||||
* 20081201.1 (2.3.0-dev) Added ap_args_to_table and ap_body_to_table.
|
||||
* 20081212.0 (2.3.0-dev) Remove sb_type from process_score in scoreboard.h.
|
||||
* 20081231.0 (2.3.0-dev) Switch ap_escape_html API: add ap_escape_html2,
|
||||
* and make ap_escape_html a macro for it.
|
||||
* 20090130.0 (2.3.2-dev) Add ap_ prefix to unixd_setup_child().
|
||||
* 20090131.0 (2.3.2-dev) Remove ap_default_type(), disable DefaultType
|
||||
* 20090208.0 (2.3.2-dev) Add conn_rec::current_thread.
|
||||
* 20090208.1 (2.3.3-dev) Add ap_retained_data_create()/ap_retained_data_get()
|
||||
* 20090401.0 (2.3.3-dev) Remove ap_threads_per_child, ap_max_daemons_limit,
|
||||
* ap_my_generation, etc. ap_mpm_query() can't be called
|
||||
* until after the register-hooks phase.
|
||||
* 20090401.1 (2.3.3-dev) Protected log.c internals, http_log.h changes
|
||||
* 20090401.2 (2.3.3-dev) Added tmp_flush_bb to core_output_filter_ctx_t
|
||||
* 20090401.3 (2.3.3-dev) Added DAV options provider to mod_dav.h
|
||||
* 20090925.0 (2.3.3-dev) Added server_rec::context and added *server_rec
|
||||
* param to ap_wait_or_timeout()
|
||||
* 20090925.1 (2.3.3-dev) Add optional function ap_logio_get_last_bytes() to
|
||||
* mod_logio
|
||||
* 20091011.0 (2.3.3-dev) Move preserve_host{,_set} from proxy_server_conf to
|
||||
* proxy_dir_conf
|
||||
* 20091011.1 (2.3.3-dev) add debug_level to util_ldap_state_t
|
||||
* 20091031.0 (2.3.3-dev) remove public LDAP referral-related macros
|
||||
* 20091119.0 (2.3.4-dev) dav_error interface uses apr_status_t parm, not errno
|
||||
* 20091119.1 (2.3.4-dev) ap_mutex_register(), ap_{proc,global}_mutex_create()
|
||||
* 20091229.0 (2.3.5-dev) Move allowed_connect_ports from proxy_server_conf
|
||||
* to mod_proxy_connect
|
||||
* 20091230.0 (2.3.5-dev) Move ftp_directory_charset from proxy_dir_conf
|
||||
* to proxy_ftp_dir_conf(mod_proxy_ftp)
|
||||
* 20091230.1 (2.3.5-dev) add util_ldap_state_t.opTimeout
|
||||
* 20091230.2 (2.3.5-dev) add ap_get_server_name_for_url()
|
||||
* 20091230.3 (2.3.6-dev) add ap_parse_log_level()
|
||||
* 20091230.4 (2.3.6-dev) export ap_process_request_after_handler() for mod_serf
|
||||
* 20100208.0 (2.3.6-dev) ap_socache_provider_t API changes to store and iterate
|
||||
* 20100208.1 (2.3.6-dev) Added forward member to proxy_conn_rec
|
||||
* 20100208.2 (2.3.6-dev) Added ap_log_command_line().
|
||||
* 20100223.0 (2.3.6-dev) LDAP client_certs per-server moved to per-dir
|
||||
* 20100223.1 (2.3.6-dev) Added ap_process_fnmatch_configs().
|
||||
* 20100504.0 (2.3.6-dev) Added name arg to ap_{proc,global}_mutex_create().
|
||||
* 20100604.0 (2.3.6-dev) Remove unused core_dir_config::loglevel
|
||||
* 20100606.0 (2.3.6-dev) Make ap_log_*error macro wrappers around
|
||||
* ap_log_*error_ to save argument preparation and
|
||||
* function call overhead.
|
||||
* Introduce per-module loglevels, including new APIs
|
||||
* APLOG_USE_MODULE() and AP_DECLARE_MODULE().
|
||||
* 20100606.1 (2.3.6-dev) Added extended timestamp formatting via
|
||||
* ap_recent_ctime_ex().
|
||||
* 20100609.0 (2.3.6-dev) Dropped ap_body_to_table due to missing constraints.
|
||||
* 20100609.1 (2.3.7-dev) Introduce ap_log_cserror()
|
||||
* 20100609.2 (2.3.7-dev) Add deferred write pool to core_output_filter_ctx
|
||||
* 20100625.0 (2.3.7-dev) Add 'userctx' to socache iterator callback prototype
|
||||
* 20100630.0 (2.3.7-dev) make module_levels vector of char instead of int
|
||||
* 20100701.0 (2.3.7-dev) re-order struct members to improve alignment
|
||||
* 20100701.1 (2.3.7-dev) add note_auth_failure hook
|
||||
* 20100701.2 (2.3.7-dev) add ap_proxy_*_wid() functions
|
||||
* 20100714.0 (2.3.7-dev) add access_checker_ex hook, add AUTHZ_DENIED_NO_USER
|
||||
* to authz_status, call authz providers twice to allow
|
||||
* authz without authenticated user
|
||||
* 20100719.0 (2.3.7-dev) Add symbol name parameter to ap_add_module and
|
||||
* ap_add_loaded_module. Add ap_find_module_short_name
|
||||
* 20100723.0 (2.3.7-dev) Remove ct_output_filters from core rec
|
||||
* 20100723.1 (2.3.7-dev) Added ap_proxy_hashfunc() and hash elements to
|
||||
* proxy worker structs
|
||||
* 20100723.2 (2.3.7-dev) Add ap_request_has_body()
|
||||
* 20100723.3 (2.3.8-dev) Add ap_check_mpm()
|
||||
* 20100905.0 (2.3.9-dev) Add log_id to conn and req recs. Add error log
|
||||
* format handlers. Support AP_CTIME_OPTION_COMPACT in
|
||||
* ap_recent_ctime_ex().
|
||||
* 20100905.1 (2.3.9-dev) Add ap_cache_check_allowed()
|
||||
* 20100912.0 (2.3.9-dev) Add an additional "out" brigade parameter to the
|
||||
* mod_cache store_body() provider function.
|
||||
* 20100916.0 (2.3.9-dev) Add commit_entity() to the mod_cache provider
|
||||
* interface.
|
||||
* 20100918.0 (2.3.9-dev) Move the request_rec within mod_include to be
|
||||
* exposed within include_ctx_t.
|
||||
* 20100919.0 (2.3.9-dev) Authz providers: Add parsed_require_line parameter
|
||||
* to check_authorization() function. Add
|
||||
* parse_require_line() function.
|
||||
* 20100919.1 (2.3.9-dev) Introduce ap_rxplus util/API
|
||||
* 20100921.0 (2.3.9-dev) Add an apr_bucket_brigade to the create_entity
|
||||
* provider interface for mod_cache.h.
|
||||
* 20100922.0 (2.3.9-dev) Move cache_* functions from mod_cache.h to a
|
||||
* private header file.
|
||||
* 20100923.0 (2.3.9-dev) Remove MOD_CACHE_REQUEST_REC, remove deprecated
|
||||
* ap_cache_cacheable_hdrs_out, trim cache_object_t,
|
||||
* make ap_cache_accept_headers, ap_cache_accept_headers
|
||||
* ap_cache_try_lock, ap_cache_check_freshness,
|
||||
* cache_server_conf, cache_enable, cache_disable,
|
||||
* cache_request_rec and cache_provider_list private.
|
||||
* 20100923.1 (2.3.9-dev) Add cache_status hook.
|
||||
* 20100923.2 (2.3.9-dev) Add generate_log_id hook.
|
||||
* Make root parameter of ap_expr_eval() const.
|
||||
* 20100923.3 (2.3.9-dev) Add "last" member to ap_directive_t
|
||||
* 20101012.0 (2.3.9-dev) Add header to cache_status hook.
|
||||
* 20101016.0 (2.3.9-dev) Remove ap_cache_check_allowed().
|
||||
* 20101017.0 (2.3.9-dev) Make ap_cache_control() public, add cache_control_t
|
||||
* to mod_disk_cache format.
|
||||
* 20101106.0 (2.3.9-dev) Replace the ap_expr parser derived from
|
||||
* mod_include's parser with one derived from
|
||||
* mod_ssl's parser. Clean up ap_expr's public
|
||||
* interface.
|
||||
* 20101106.1 (2.3.9-dev) Add ap_pool_cleanup_set_null() generic cleanup
|
||||
* 20101106.2 (2.3.9-dev) Add suexec_disabled_reason field to ap_unixd_config
|
||||
* 20101113.0 (2.3.9-dev) Add source address to mod_proxy.h
|
||||
* 20101113.1 (2.3.9-dev) Add ap_set_flag_slot_char()
|
||||
* 20101113.2 (2.3.9-dev) Add ap_expr_exec_re()
|
||||
* 20101204.0 (2.3.10-dev) Add _t to ap_expr's typedef names
|
||||
* 20101223.0 (2.3.11-dev) Remove cleaned from proxy_conn_rec.
|
||||
* 20101223.1 (2.3.11-dev) Rework mod_proxy, et.al. Remove proxy_worker_stat
|
||||
* and replace w/ proxy_worker_shared; remove worker
|
||||
* info from scoreboard and use slotmem; Allow
|
||||
* dynamic growth of balancer members; Remove
|
||||
* BalancerNonce in favor of 'nonce' parameter.
|
||||
* 20110117.0 (2.3.11-dev) Merge <If> sections in separate step (ap_if_walk).
|
||||
* Add core_dir_config->sec_if. Add ap_add_if_conf().
|
||||
* Add pool argument to ap_add_file_conf().
|
||||
* 20110117.1 (2.3.11-dev) Add ap_pstr2_alnum() and ap_str2_alnum()
|
||||
* 20110203.0 (2.3.11-dev) Raise DYNAMIC_MODULE_LIMIT to 256
|
||||
* 20110203.1 (2.3.11-dev) Add ap_state_query()
|
||||
* 20110203.2 (2.3.11-dev) Add ap_run_pre_read_request() hook and
|
||||
* ap_parse_form_data() util
|
||||
* 20110312.0 (2.3.12-dev) remove uldap_connection_cleanup and add
|
||||
util_ldap_state_t.connectionPoolTTL,
|
||||
util_ldap_connection_t.freed, and
|
||||
util_ldap_connection_t.rebind_pool.
|
||||
* 20110312.1 (2.3.12-dev) Add core_dir_config.decode_encoded_slashes.
|
||||
* 20110328.0 (2.3.12-dev) change type and name of connectionPoolTTL in util_ldap_state_t
|
||||
connectionPoolTTL (connection_pool_ttl, int->apr_interval_t)
|
||||
* 20110329.0 (2.3.12-dev) Change single-bit signed fields to unsigned in
|
||||
* proxy and cache interfaces.
|
||||
* Change ap_configfile_t/ap_cfg_getline()/
|
||||
* ap_cfg_getc() API, add ap_pcfg_strerror()
|
||||
* Axe mpm_note_child_killed hook, change
|
||||
* ap_reclaim_child_process and ap_recover_child_process
|
||||
* interfaces.
|
||||
* 20110329.1 (2.3.12-dev) Add ap_reserve_module_slots()/ap_reserve_module_slots_directive()
|
||||
* change AP_CORE_DECLARE to AP_DECLARE: ap_create_request_config()
|
||||
* change AP_DECLARE to AP_CORE_DECLARE: ap_register_log_hooks()
|
||||
* 20110329.2 (2.3.12-dev) Add child_status and end_generation hooks.
|
||||
* 20110329.3 (2.3.12-dev) Add format field to ap_errorlog_info.
|
||||
* 20110329.4 (2.3.13-dev) bgrowth and max_balancers to proxy_server_conf.
|
||||
* 20110329.5 (2.3.13-dev) Add ap_regexec_len()
|
||||
* 20110329.6 (2.3.13-dev) Add AP_EXPR_FLAGS_RESTRICTED, ap_expr_eval_ctx_t->data,
|
||||
* ap_expr_exec_ctx()
|
||||
* 20110604.0 (2.3.13-dev) Make ap_rputs() inline
|
||||
* 20110605.0 (2.3.13-dev) add core_dir_config->condition_ifelse, change return
|
||||
* type of ap_add_if_conf().
|
||||
* Add members of core_request_config: document_root,
|
||||
* context_document_root, context_prefix.
|
||||
* Add ap_context_*(), ap_set_context_info(), ap_set_document_root()
|
||||
* 20110605.1 (2.3.13-dev) add ap_(get|set)_core_module_config()
|
||||
* 20110605.2 (2.3.13-dev) add ap_get_conn_socket()
|
||||
* 20110619.0 (2.3.13-dev) add async connection infos to process_score in scoreboard,
|
||||
* add ap_start_lingering_close(),
|
||||
* add conn_state_e:CONN_STATE_LINGER_NORMAL and CONN_STATE_LINGER_SHORT
|
||||
* 20110619.1 (2.3.13-dev) add ap_str_toupper()
|
||||
* 20110702.0 (2.3.14-dev) make ap_expr_parse_cmd() macro wrapper for new
|
||||
* ap_expr_parse_cmd_mi() function, add ap_expr_str_*() functions,
|
||||
* rename AP_EXPR_FLAGS_* -> AP_EXPR_FLAG_*
|
||||
* 20110702.1 (2.3.14-dev) Add ap_scan_script_header_err*_ex functions
|
||||
* 20110723.0 (2.3.14-dev) Revert addition of ap_ldap*
|
||||
* 20110724.0 (2.3.14-dev) Add override_list as parameter to ap_parse_htaccess
|
||||
* Add member override_list to cmd_parms_struct,
|
||||
* core_dir_config and htaccess_result
|
||||
* 20110724.1 (2.3.15-dev) add NOT_IN_HTACCESS
|
||||
* 20110724.2 (2.3.15-dev) retries and retry_delay in util_ldap_state_t
|
||||
* 20110724.3 (2.3.15-dev) add util_varbuf.h / ap_varbuf API
|
||||
* 20110724.4 (2.3.15-dev) add max_ranges to core_dir_config
|
||||
* 20110724.5 (2.3.15-dev) add ap_set_accept_ranges()
|
||||
* 20110724.6 (2.3.15-dev) add max_overlaps and max_reversals to core_dir_config
|
||||
* 20110724.7 (2.3.15-dev) add ap_random_insecure_bytes(), ap_random_pick()
|
||||
* 20110724.8 (2.3.15-dev) add ap_abort_on_oom(), ap_malloc(), ap_calloc(),
|
||||
* ap_realloc()
|
||||
* 20110724.9 (2.3.15-dev) add ap_varbuf_pdup() and ap_varbuf_regsub()
|
||||
* 20110724.10(2.3.15-dev) Export ap_max_mem_free
|
||||
* 20111009.0 (2.3.15-dev) Remove ap_proxy_removestr(),
|
||||
* add ap_unixd_config.group_name
|
||||
* 20111014.0 (2.3.15-dev) Remove cookie_path_str and cookie_domain_str from
|
||||
* proxy_dir_conf
|
||||
* 20111025.0 (2.3.15-dev) Add return value and maxlen to ap_varbuf_regsub(),
|
||||
* add ap_pregsub_ex()
|
||||
* 20111025.1 (2.3.15-dev) Add ap_escape_urlencoded(), ap_escape_urlencoded_buffer()
|
||||
* and ap_unescape_urlencoded().
|
||||
* 20111025.2 (2.3.15-dev) Add ap_lua_ssl_val to mod_lua
|
||||
* 20111025.3 (2.4.0-dev) Add reclvl to ap_expr_eval_ctx_t
|
||||
* 20111122.0 (2.4.0-dev) Remove parts of conn_state_t that are private to the MPM
|
||||
* 20111123.0 (2.4.0-dev) Pass ap_errorlog_info struct to error_log hook,
|
||||
* add pool to ap_errorlog_info.
|
||||
* 20111130.0 (2.4.0-dev) c->remote_ip becomes c->peer_ip and r->client_ip,
|
||||
* c->remote_addr becomes c->peer_addr and r->client_addr
|
||||
* 20111201.0 (2.4.0-dev) Add invalidate_entity() to the cache provider.
|
||||
* 20111202.0 (2.4.0-dev) Use apr_status_t across mod_session API.
|
||||
* 20111202.1 (2.4.0-dev) add APLOGNO()
|
||||
* 20111203.0 (2.4.0-dev) Optional ap_proxy_retry_worker(), remove
|
||||
* ap_proxy_string_read(), ap_cache_liststr(),
|
||||
* ap_proxy_buckets_lifetime_transform(),
|
||||
* ap_proxy_date_canon(), ap_proxy_is_ipaddr(),
|
||||
* ap_proxy_is_domainname(), ap_proxy_is_hostname(),
|
||||
* ap_proxy_is_word(), ap_proxy_hex2sec(),
|
||||
* ap_proxy_sec2hex(), ap_proxy_make_fake_req(),
|
||||
* ap_proxy_strmatch_path, ap_proxy_strmatch_domain,
|
||||
* ap_proxy_table_unmerge(), proxy_lb_workers.
|
||||
* 20120109.0 (2.4.1-dev) Changes sizeof(overrides_t) in core config.
|
||||
* 20120109.1 (2.4.1-dev) remove sb_type in global_score.
|
||||
* 20120109.2 (2.4.1-dev) Make core_output_filter_ctx_t and core_ctx_t
|
||||
* private;
|
||||
* move core_net rec definition to http_core.h;
|
||||
* add insert_network_bucket hook, AP_DECLINED
|
||||
* 20120211.0 (2.4.1-dev) Change re_nsub in ap_regex_t from apr_size_t to int.
|
||||
* 20120211.1 (2.4.2-dev) Add AP_HAVE_C99
|
||||
* 20120211.2 (2.4.2-dev) Add ap_runtime_dir_relative
|
||||
* 20120211.3 (2.4.2-dev) Add forcerecovery to proxy_balancer_shared struct
|
||||
* 20120211.4 (2.4.3-dev) Add ap_list_provider_groups()
|
||||
* 20120211.5 (2.4.3-dev) Add missing HTTP status codes registered with IANA.
|
||||
* 20120211.6 (2.4.3-dev) Add ap_proxy_checkproxyblock2.
|
||||
* 20120211.7 (2.4.3-dev) Add ap_get_loadavg()
|
||||
* 20120211.8 (2.4.3-dev) Add sticky_separator to proxy_balancer_shared struct.
|
||||
* 20120211.9 (2.4.4-dev) Add fgrab() to ap_slotmem_provider_t.
|
||||
* 20120211.10 (2.4.4-dev) Add in bal_persist field to proxy_server_conf
|
||||
* 20120211.11 (2.4.4-dev) Add ap_bin2hex()
|
||||
* 20120211.12 (2.4.5-dev) Add ap_remove_input|output_filter_byhandle()
|
||||
* 20120211.13 (2.4.5-dev) Add ap_get_exec_line
|
||||
* 20120211.14 (2.4.5-dev) Add ppinherit and inherit to proxy_server_conf
|
||||
* 20120211.15 (2.4.5-dev) Add dav_join_error()
|
||||
* 20120211.16 (2.4.5-dev) Add cache_control_t.invalidated
|
||||
* 20120211.17 (2.4.5-dev) Add ap_find_etag_weak(), ap_find_etag_strong()
|
||||
* 20120211.18 (2.4.5-dev) Add ap_condition_e, ap_condition_if_match(),
|
||||
* ap_condition_if_unmodified_since(),
|
||||
* ap_condition_if_none_match(),
|
||||
* ap_condition_if_modified_since(),
|
||||
* ap_condition_if_range()
|
||||
* 20120211.19 (2.4.5-dev) Add post_perdir_config hook.
|
||||
* 20120211.20 (2.4.5-dev) Add dirwalk_stat hook.
|
||||
* 20120211.21 (2.4.5-dev) Add in ap_proxy_create_hdrbrgd() and
|
||||
* ap_proxy_pass_brigade()
|
||||
* 20120211.22 (2.4.5-dev) No longer prevent usage of strtoul()
|
||||
* 20120211.23 (2.4.5-dev) Add ap_proxy_clear_connection()
|
||||
* 20120211.24 (2.4.7-dev) add open_htaccess hook.
|
||||
* 20120211.25 (2.4.7-dev) Add conn_sense_e
|
||||
* 20120211.26 (2.4.7-dev) Add util_fcgi.h, FastCGI protocol support
|
||||
* 20120211.27 (2.4.7-dev) Add ap_podx_restart_t and ap_mpm_podx_*
|
||||
* 20120211.28 (2.4.7-dev) Add ap_regname
|
||||
* 20120211.29 (2.4.7-dev) Add uds_path to proxy_conn_rec and proxy_worker_shared.
|
||||
* The change to proxy_worker_shared is an
|
||||
* unintended API break, especially for balancer
|
||||
* lbmethod modules.
|
||||
* 20120211.30 (2.4.7-dev) REWRITE_REDIRECT_HANDLER_NAME in mod_rewrite.h
|
||||
* 20120211.31 (2.4.7-dev) Add ap_proxy_port_of_scheme()
|
||||
* 20120211.32 (2.4.10-dev) Add SSL reusable SNI to mod_proxy.h's proxy_conn_rec
|
||||
* 20120211.33 (2.4.10-dev) Add suspend_connection and resume_connection hooks
|
||||
* 20120211.34 (2.4.10-dev) AP_DEFAULT_HANDLER_NAME/AP_IS_DEFAULT_HANDLER_NAME
|
||||
* 20120211.35 (2.4.10-dev) Add "r", "must_rebind", and last_backend_conn
|
||||
to util_ldap_connection_t
|
||||
* 20120211.36 (2.4.10-dev) Add ap_copy_scoreboard_worker()
|
||||
* 20120211.37 (2.4.11-dev) Add r->trailers_{in,out}
|
||||
* 20120211.38 (2.4.11-dev) Added ap_shutdown_conn().
|
||||
* 20120211.39 (2.4.11-dev) Add ap_proxy_connect_uds().
|
||||
* 20120211.40 (2.4.11-dev) Add ap_log_data(), ap_log_rdata(), etc.
|
||||
* 20120211.41 (2.4.11-dev) Add ap_proxy_de_socketfy to mod_proxy.h
|
||||
* 20120211.42 (2.4.13-dev) Add response_code_exprs to http_core.h
|
||||
* 20120211.43 (2.4.13-dev) Add keep_alive_timeout_set to server_rec
|
||||
* 20120211.44 (2.4.13-dev) Add cgi_pass_auth and AP_CGI_PASS_AUTH_* to
|
||||
* core_dir_config
|
||||
* 20120211.45 (2.4.13-dev) Add ap_proxy_connection_reusable()
|
||||
* 20120211.46 (2.4.13-dev) Add ap_map_http_request_error()
|
||||
* 20120211.47 (2.4.13-dev) Add ap_some_authn_required, ap_force_authn hook.
|
||||
* Deprecate broken ap_some_auth_required.
|
||||
* 20120211.48 (2.4.17-dev) Added ap_log_mpm_common().
|
||||
* 20120211.49 (2.4.17-dev) Add listener bucket in scoreboard.h's process_score.
|
||||
* 20120211.50 (2.4.17-dev) Add ap_set_listencbratio(), ap_close_listeners_ex(),
|
||||
* ap_duplicate_listeners(), ap_num_listen_buckets and
|
||||
* ap_have_so_reuseport to ap_listen.h.
|
||||
* 20120211.51 (2.4.17-dev) Add protocols and protocols_honor_order to
|
||||
* core_server_config. Add hooks protocol_propose
|
||||
* protocol_switch and protocol_get. Add
|
||||
* ap_select_protocol(), ap_switch_protocol(),
|
||||
* ap_get_protocol(). Add HTTP_MISDIRECTED_REQUEST.
|
||||
* Added ap_parse_token_list_strict() to httpd.h
|
||||
* 20120211.52 (2.4.17-dev) Add master conn_rec* member in conn_rec.
|
||||
* 20120211.53 (2.4.19-dev) Add expr_handler to core_dir_config.
|
||||
* 20120211.54 (2.4.19-dev) Add ap_proxy_buckets_lifetime_transform and
|
||||
* ap_proxy_transfer_between_connections to
|
||||
* mod_proxy.h
|
||||
* 20120211.55 (2.4.19-dev) Add new ap_update_child_status...() methods,
|
||||
* add protocol to worker_score in scoreboard.h,
|
||||
* Add pre_close connection hook and
|
||||
* ap_prep_lingering_close().
|
||||
* 20120211.56 (2.4.19-dev) Split useragent_host from the conn_rec into
|
||||
* the request_rec, with ap_get_useragent_host()
|
||||
* 20120211.57 (2.4.19-dev) Add mod_ssl_openssl.h and OpenSSL-specific hooks
|
||||
* 20120211.58 (2.4.21-dev) Add cgi_var_rules to core_dir_config.
|
||||
* 20120211.59 (2.4.21-dev) Add ap_getword_conf2[_nc](),
|
||||
* ap_proxy_is_socket_connected() and
|
||||
* extended proxy_worker_shared.
|
||||
* 20120211.60 (2.4.21-dev) Add dav_get_provider_name.
|
||||
* 20120211.61 (2.4.21-dev) Add ap_cstr_casecmp[n]() - placeholder of apr_ fns
|
||||
* 20120211.62 (2.4.24-dev) Add childtags to dav_error.
|
||||
* 20120211.63 (2.4.24-dev) Add dav_begin_multistatus, dav_send_one_response,
|
||||
* dav_finish_multistatus, dav_send_multistatus,
|
||||
* dav_handle_err, dav_failed_proppatch,
|
||||
* dav_success_proppatch.
|
||||
* 20120211.64 (2.4.24-dev) Add ap_proxy_check_backend(), and tmp_bb to struct
|
||||
* proxy_conn_rec.
|
||||
* 20120211.65 (2.4.24-dev) Add ap_check_pipeline().
|
||||
* 20120211.66 (2.4.24-dev) Rename ap_proxy_check_backend() to
|
||||
* ap_proxy_check_connection().
|
||||
* 20120211.67 (2.4.24-dev) Add http09_enable, http_conformance, and
|
||||
* http_methods to core_server_config
|
||||
* Add ap_scan_http_field_token(),
|
||||
* ap_scan_http_field_content(),
|
||||
* and ap_scan_vchar_obstext()
|
||||
* Replaced fold boolean with with multiple bit flags
|
||||
* to ap_[r]getline()
|
||||
* 20120211.68 (2.4.26-dev) Add ap_get_basic_auth_components() and deprecate
|
||||
* ap_get_basic_auth_pw()
|
||||
* 20120211.69 (2.4.30-dev) Add ap_update_sb_handle()
|
||||
* 20120211.70 (2.4.30-dev) Add flags field to module_struct and function
|
||||
* ap_get_module_flags()
|
||||
* 20120211.71 (2.4.30-dev) Add optional proxy_{hook,run}_section_post_config(),
|
||||
* ap_proxy_connection_create_ex() and section_config
|
||||
* to struct proxy_{worker,balancer} in mod_proxy.h,
|
||||
* and optional ssl_engine_set() to mod_ssl.h.
|
||||
* 20120211.72 (2.4.30-dev) Add NOT_IN_DIR_CONTEXT replacing NOT_IN_DIR_LOC_FILE
|
||||
* semantics
|
||||
* 20120211.73 (2.4.30-dev) Add failontimeout_set, growth_set and lbmethod_set
|
||||
* to proxy_balancer struct
|
||||
* 20120211.74 (2.4.30-dev) Add AP_REG_DOLLAR_ENDONLY, ap_regcomp_get_default_cflags
|
||||
* ap_regcomp_set_default_cflags and
|
||||
* ap_regcomp_default_cflag_by_name
|
||||
* 20120211.75 (2.4.30-dev) Add hostname_ex to proxy_worker_shared
|
||||
* 20120211.76 (2.4.30-dev) Add CONN_STATE_NUM to enum conn_state_e
|
||||
* 20120211.77 (2.4.34-dev) Add ap_exists_directive()
|
||||
* 20120211.78 (2.4.34-dev) Add response_field_size to proxy_worker_shared
|
||||
* 20120211.79 (2.4.34-dev) Add AP_GETLINE_NOSPC_EOL flag to http_protocol.h
|
||||
* 20120211.80 (2.4.35-dev) Add new ap_update_global_status() method and
|
||||
* times field in the global_score structure in
|
||||
* scoreboard.h.
|
||||
* 20120211.81 (2.4.35-dev) Add new duration field to worker_score struct in
|
||||
* scoreboard.h
|
||||
* 20120211.82 (2.4.35-dev) Add optional function declaration for
|
||||
* ap_proxy_balancer_get_best_worker to mod_proxy.h.
|
||||
* 20120211.83 (2.4.35-dev) Add client64 field to worker_score struct
|
||||
* 20120211.84 (2.4.35-dev) Add ap_no2slash_ex() and merge_slashes to
|
||||
* core_server_conf.
|
||||
* 20120211.85 (2.4.40-dev) add ap_set_conn_count().
|
||||
* 20120211.86 (2.4.40-dev) Add forward_100_continue{,_set} to proxy_dir_conf
|
||||
* 20120211.87 (2.4.40-dev) Add dav_popen_propdb
|
||||
* 20120211.88 (2.4.40-dev) Add ap_dir_nofnmatch() and ap_dir_fnmatch().
|
||||
* 20120211.89 (2.4.42-dev) Add add dns_pool to proxy_conn_pool and define
|
||||
* AP_VOLATILIZE_T.
|
||||
* 20120211.90 (2.4.42-dev) AP_REG_DEFAULT macro in ap_regex.h
|
||||
* 20120211.91 (2.4.42-dev) Add ap_is_chunked() in httpd.h
|
||||
* 20120211.92 (2.4.42-dev) AP_REG_NO_DEFAULT macro in ap_regex.h
|
||||
* 20120211.93 (2.4.44-dev) Add ap_parse_strict_length()
|
||||
* 20120211.94 (2.4.47-dev) Add ap_proxy_define_match_worker()
|
||||
* 20120211.95 (2.4.47-dev) Add proxy check_trans hook
|
||||
* 20120211.96 (2.4.47-dev) Add ap_get_status_line_ex()
|
||||
* 20120211.97 (2.4.47-dev) Add read_buf_size member to core_dir_config,
|
||||
* flush_max_threshold and flush_max_pipelined to
|
||||
* core_server_config, and ap_get_read_buf_size().
|
||||
* 20120211.98 (2.4.47-dev) Add ap_proxy_should_override to mod_proxy.h
|
||||
* 20120211.99 (2.4.47-dev) Add proxy_tunnel_rec, ap_proxy_tunnel_create()
|
||||
* and ap_proxy_tunnel_run() to proxy_util.
|
||||
* 20120211.99 (2.4.47-dev) Add ap_proxy_worker_can_upgrade()
|
||||
* 20120211.100 (2.4.47-dev) Add ap_proxy_prefetch_input(),
|
||||
* ap_proxy_spool_input() and
|
||||
* ap_proxy_read_input().
|
||||
* 20120211.101 (2.4.47-dev) ETAG_DIGEST in http_core.h. struct etag_rec,
|
||||
* ap_make_etag_ex() and ap_set_etag_fd() in
|
||||
* http_protocol.h. ap_request_bnotes_t,
|
||||
* AP_REQUEST_STRONG_ETAG, AP_REQUEST_GET_BNOTE,
|
||||
* AP_REQUEST_SET_BNOTE and AP_REQUEST_IS_STRONG_ETAG
|
||||
* in httpd.h.
|
||||
* 20120211.102 (2.4.47-dev) Add ap_ssl_conn_is_ssl()/ap_ssl_var_lookup() and hooks
|
||||
* 20120211.103 (2.4.47-dev) Add ap_ssl_add_cert_files, ap_ssl_add_fallback_cert_files
|
||||
* and ap_ssl_answer_challenge and hooks.
|
||||
* 20120211.104 (2.4.47-dev) Move ap_ssl_* into new http_ssl.h header file
|
||||
* 20120211.105 (2.4.47-dev) Add ap_ssl_ocsp* hooks and functions to http_ssl.h.
|
||||
* 20120211.106 (2.4.49-dev) Add ap_create_request().
|
||||
* 20120211.107 (2.4.49-dev) Add ap_parse_request_line() and
|
||||
* ap_check_request_header()
|
||||
* 20120211.108 (2.4.49-dev) Add ajp_handle_cping_cpong
|
||||
* 20120211.109 (2.4.49-dev) Add ap_normalize_path(),
|
||||
* pre_translate_name hook and
|
||||
* Add map_encoded_one and map_encoded_all bits to
|
||||
* proxy_server_conf.
|
||||
* 20120211.110 (2.4.49-dev) Add hook child_stopping to get informed that a child
|
||||
* is being shut down.
|
||||
* 20120211.111 (2.4.49-dev) Add dav_get_provider(), dav_open_lockdb(),
|
||||
* dav_close_lockdb() and dav_get_resource() to
|
||||
* mod_dav.h.
|
||||
* 20120211.112 (2.4.49-dev) Add deliver_report and gather_reports hooks.
|
||||
* 20120211.113 (2.4.49-dev) Add method_precondition hook.
|
||||
* 20120211.114 (2.4.49-dev) Add optional balancer_manage function.
|
||||
* 20120211.115 (2.4.49-dev) Add ap_proxy_get_worker_ex() and
|
||||
* ap_proxy_define_worker_ex() to mod_proxy.h
|
||||
* 20120211.116 (2.4.49-dev) add conn_rec->outgoing and ap_ssl_bind_outgoing()
|
||||
* 20120211.117 (2.4.50-dev) Add ap_pre_connection
|
||||
* 20120211.118 (2.4.51-dev) Add ap_unescape_url_ex() and deprecate
|
||||
* AP_NORMALIZE_DROP_PARAMETERS
|
||||
* 20120211.119 (2.4.51-dev) Add dav_validate_root_ns(), dav_find_child_ns(),
|
||||
* dav_find_next_ns(), dav_find_attr_ns() and
|
||||
* dav_find_attr().
|
||||
* 20120211.120 (2.4.51-dev) Add dav_liveprop_elem structure and
|
||||
* dav_get_liveprop_element().
|
||||
* 20120211.121 (2.4.51-dev) Add ap_post_read_request()
|
||||
* 20120211.122 (2.4.51-dev) Add ap_thread_create(), ap_thread_main_create()
|
||||
* and ap_thread_current()
|
||||
* 20120211.123 (2.4.51-dev) Added ap_pcre_version_string(), AP_REG_PCRE_COMPILED
|
||||
* and AP_REG_PCRE_LOADED to ap_regex.h.
|
||||
* 20120211.124 (2.4.51-dev) Add name_ex to struct proxy_worker_shared
|
||||
* 20120211.125 (2.4.55-dev) Export mod_http2.h as public header
|
||||
* 20120211.126 (2.4.55-dev) Add additional hcmethod_t enums and PROXY_WORKER_IS_ERROR
|
||||
* 20120211.127 (2.4.56-dev) Add ap_proxy_canonenc_ex
|
||||
* 20120211.128 (2.4.55-dev) Add AP_CTIME_OPTION_GMTOFF to util_time.h
|
||||
* 20120211.129 (2.4.58-dev) Add ap_get_pollfd_from_conn()
|
||||
*/
|
||||
|
||||
#define MODULE_MAGIC_COOKIE 0x41503234UL /* "AP24" */
|
||||
|
||||
#ifndef MODULE_MAGIC_NUMBER_MAJOR
|
||||
#define MODULE_MAGIC_NUMBER_MAJOR 20120211
|
||||
#endif
|
||||
#define MODULE_MAGIC_NUMBER_MINOR 129 /* 0...n */
|
||||
|
||||
/**
|
||||
* Determine if the server's current MODULE_MAGIC_NUMBER is at least a
|
||||
* specified value.
|
||||
*
|
||||
* Useful for testing for features.
|
||||
* For example, suppose you wish to use the apr_table_overlap
|
||||
* function. You can do this:
|
||||
*
|
||||
* \code
|
||||
* #if AP_MODULE_MAGIC_AT_LEAST(19980812,2)
|
||||
* ... use apr_table_overlap()
|
||||
* #else
|
||||
* ... alternative code which doesn't use apr_table_overlap()
|
||||
* #endif
|
||||
* \endcode
|
||||
*
|
||||
* @param major The major module magic number
|
||||
* @param minor The minor module magic number
|
||||
* @def AP_MODULE_MAGIC_AT_LEAST(int major, int minor)
|
||||
*/
|
||||
#define AP_MODULE_MAGIC_AT_LEAST(major,minor) \
|
||||
((major) < MODULE_MAGIC_NUMBER_MAJOR \
|
||||
|| ((major) == MODULE_MAGIC_NUMBER_MAJOR \
|
||||
&& (minor) <= MODULE_MAGIC_NUMBER_MINOR))
|
||||
|
||||
/** @deprecated present for backwards compatibility */
|
||||
#define MODULE_MAGIC_NUMBER MODULE_MAGIC_NUMBER_MAJOR
|
||||
#define MODULE_MAGIC_AT_LEAST old_broken_macro_we_hope_you_are_not_using
|
||||
|
||||
#endif /* !APACHE_AP_MMN_H */
|
||||
/** @} */
|
||||
280
database/apache/include/ap_mpm.h
Normal file
280
database/apache/include/ap_mpm.h
Normal file
@@ -0,0 +1,280 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file ap_mpm.h
|
||||
* @brief Apache Multi-Processing Module library
|
||||
*
|
||||
* @defgroup APACHE_CORE_MPM Multi-Processing Module library
|
||||
* @ingroup APACHE_CORE
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef AP_MPM_H
|
||||
#define AP_MPM_H
|
||||
|
||||
#include "apr_thread_proc.h"
|
||||
#include "httpd.h"
|
||||
#include "scoreboard.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
The MPM, "multi-processing model" provides an abstraction of the
|
||||
interface with the OS for distributing incoming connections to
|
||||
threads/process for processing. http_main invokes the MPM, and
|
||||
the MPM runs until a shutdown/restart has been indicated.
|
||||
The MPM calls out to the apache core via the ap_process_connection
|
||||
function when a connection arrives.
|
||||
|
||||
The MPM may or may not be multithreaded. In the event that it is
|
||||
multithreaded, at any instant it guarantees a 1:1 mapping of threads
|
||||
ap_process_connection invocations.
|
||||
|
||||
Note: In the future it will be possible for ap_process_connection
|
||||
to return to the MPM prior to finishing the entire connection; and
|
||||
the MPM will proceed with asynchronous handling for the connection;
|
||||
in the future the MPM may call ap_process_connection again -- but
|
||||
does not guarantee it will occur on the same thread as the first call.
|
||||
|
||||
The MPM further guarantees that no asynchronous behaviour such as
|
||||
longjmps and signals will interfere with the user code that is
|
||||
invoked through ap_process_connection. The MPM may reserve some
|
||||
signals for its use (i.e. SIGUSR1), but guarantees that these signals
|
||||
are ignored when executing outside the MPM code itself. (This
|
||||
allows broken user code that does not handle EINTR to function
|
||||
properly.)
|
||||
|
||||
The suggested server restart and stop behaviour will be "graceful".
|
||||
However the MPM may choose to terminate processes when the user
|
||||
requests a non-graceful restart/stop. When this occurs, the MPM kills
|
||||
all threads with extreme prejudice, and destroys the pchild pool.
|
||||
User cleanups registered in the pchild apr_pool_t will be invoked at
|
||||
this point. (This can pose some complications, the user cleanups
|
||||
are asynchronous behaviour not unlike longjmp/signal... but if the
|
||||
admin is asking for a non-graceful shutdown, how much effort should
|
||||
we put into doing it in a nice way?)
|
||||
|
||||
unix/posix notes:
|
||||
- The MPM does not set a SIGALRM handler, user code may use SIGALRM.
|
||||
But the preferred method of handling timeouts is to use the
|
||||
timeouts provided by the BUFF abstraction.
|
||||
- The proper setting for SIGPIPE is SIG_IGN, if user code changes it
|
||||
for any of their own processing, it must be restored to SIG_IGN
|
||||
prior to executing or returning to any apache code.
|
||||
TODO: add SIGPIPE debugging check somewhere to make sure it's SIG_IGN
|
||||
*/
|
||||
|
||||
/**
|
||||
* Pass control to the MPM for steady-state processing. It is responsible
|
||||
* for controlling the parent and child processes. It will run until a
|
||||
* restart/shutdown is indicated.
|
||||
* @param pconf the configuration pool, reset before the config file is read
|
||||
* @param plog the log pool, reset after the config file is read
|
||||
* @param server_conf the global server config.
|
||||
* @return DONE for shutdown OK otherwise.
|
||||
* @ingroup hooks
|
||||
*/
|
||||
AP_DECLARE_HOOK(int, mpm, (apr_pool_t *pconf, apr_pool_t *plog, server_rec *server_conf))
|
||||
|
||||
/**
|
||||
* Spawn a process with privileges that another module has requested
|
||||
* @param r The request_rec of the current request
|
||||
* @param newproc The resulting process handle.
|
||||
* @param progname The program to run
|
||||
* @param args the arguments to pass to the new program. The first
|
||||
* one should be the program name.
|
||||
* @param env The new environment apr_table_t for the new process. This
|
||||
* should be a list of NULL-terminated strings.
|
||||
* @param attr the procattr we should use to determine how to create the new
|
||||
* process
|
||||
* @param p The pool to use.
|
||||
*/
|
||||
AP_DECLARE(apr_status_t) ap_os_create_privileged_process(
|
||||
const request_rec *r,
|
||||
apr_proc_t *newproc,
|
||||
const char *progname,
|
||||
const char * const *args,
|
||||
const char * const *env,
|
||||
apr_procattr_t *attr,
|
||||
apr_pool_t *p);
|
||||
|
||||
/** @defgroup mpmq MPM query
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup thrdfrk Subtypes/Values returned for AP_MPMQ_IS_THREADED and AP_MPMQ_IS_FORKED
|
||||
* @ingroup mpmq
|
||||
* @{
|
||||
*/
|
||||
#define AP_MPMQ_NOT_SUPPORTED 0 /**< This value specifies that an
|
||||
* MPM is not capable of
|
||||
* threading or forking. */
|
||||
#define AP_MPMQ_STATIC 1 /**< This value specifies that
|
||||
* an MPM is using a static
|
||||
* number of threads or daemons */
|
||||
#define AP_MPMQ_DYNAMIC 2 /**< This value specifies that
|
||||
* an MPM is using a dynamic
|
||||
* number of threads or daemons */
|
||||
/** @} */
|
||||
|
||||
/** @defgroup qstate Values returned for AP_MPMQ_MPM_STATE
|
||||
* @ingroup mpmq
|
||||
* @{
|
||||
*/
|
||||
#define AP_MPMQ_STARTING 0
|
||||
#define AP_MPMQ_RUNNING 1
|
||||
#define AP_MPMQ_STOPPING 2
|
||||
/** @} */
|
||||
|
||||
/** @defgroup qcodes Query codes for ap_mpm_query()
|
||||
* @ingroup mpmq
|
||||
* @{
|
||||
*/
|
||||
/** Max # of daemons used so far */
|
||||
#define AP_MPMQ_MAX_DAEMON_USED 1
|
||||
/** MPM can do threading */
|
||||
#define AP_MPMQ_IS_THREADED 2
|
||||
/** MPM can do forking */
|
||||
#define AP_MPMQ_IS_FORKED 3
|
||||
/** The compiled max # daemons */
|
||||
#define AP_MPMQ_HARD_LIMIT_DAEMONS 4
|
||||
/** The compiled max # threads */
|
||||
#define AP_MPMQ_HARD_LIMIT_THREADS 5
|
||||
/** \# of threads/child by config */
|
||||
#define AP_MPMQ_MAX_THREADS 6
|
||||
/** Min # of spare daemons */
|
||||
#define AP_MPMQ_MIN_SPARE_DAEMONS 7
|
||||
/** Min # of spare threads */
|
||||
#define AP_MPMQ_MIN_SPARE_THREADS 8
|
||||
/** Max # of spare daemons */
|
||||
#define AP_MPMQ_MAX_SPARE_DAEMONS 9
|
||||
/** Max # of spare threads */
|
||||
#define AP_MPMQ_MAX_SPARE_THREADS 10
|
||||
/** Max # of requests per daemon */
|
||||
#define AP_MPMQ_MAX_REQUESTS_DAEMON 11
|
||||
/** Max # of daemons by config */
|
||||
#define AP_MPMQ_MAX_DAEMONS 12
|
||||
/** starting, running, stopping */
|
||||
#define AP_MPMQ_MPM_STATE 13
|
||||
/** MPM can process async connections */
|
||||
#define AP_MPMQ_IS_ASYNC 14
|
||||
/** MPM generation */
|
||||
#define AP_MPMQ_GENERATION 15
|
||||
/** MPM can drive serf internally */
|
||||
#define AP_MPMQ_HAS_SERF 16
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* Query a property of the current MPM.
|
||||
* @param query_code One of AP_MPMQ_*
|
||||
* @param result A location to place the result of the query
|
||||
* @return APR_EGENERAL if an mpm-query hook has not been registered;
|
||||
* APR_SUCCESS or APR_ENOTIMPL otherwise
|
||||
* @remark The MPM doesn't register the implementing hook until the
|
||||
* register_hooks hook is called, so modules cannot use ap_mpm_query()
|
||||
* until after that point.
|
||||
* @fn int ap_mpm_query(int query_code, int *result)
|
||||
*/
|
||||
AP_DECLARE(apr_status_t) ap_mpm_query(int query_code, int *result);
|
||||
|
||||
/** @} */
|
||||
|
||||
typedef void (ap_mpm_callback_fn_t)(void *baton);
|
||||
|
||||
/* only added support in the Event MPM.... check for APR_ENOTIMPL */
|
||||
AP_DECLARE(apr_status_t) ap_mpm_register_timed_callback(apr_time_t t,
|
||||
ap_mpm_callback_fn_t *cbfn,
|
||||
void *baton);
|
||||
|
||||
typedef enum mpm_child_status {
|
||||
MPM_CHILD_STARTED,
|
||||
MPM_CHILD_EXITED,
|
||||
MPM_CHILD_LOST_SLOT
|
||||
} mpm_child_status;
|
||||
|
||||
/**
|
||||
* Allow a module to remain aware of MPM child process state changes,
|
||||
* along with the generation and scoreboard slot of the process changing
|
||||
* state.
|
||||
*
|
||||
* With some MPMs (event and worker), an active MPM child process may lose
|
||||
* its scoreboard slot if the child process is exiting and the scoreboard
|
||||
* slot is needed by other processes. When this occurs, the hook will be
|
||||
* called with the MPM_CHILD_LOST_SLOT state.
|
||||
*
|
||||
* @param s The main server_rec.
|
||||
* @param pid The id of the MPM child process.
|
||||
* @param gen The server generation of that child process.
|
||||
* @param slot The scoreboard slot number, or -1. It will be -1 when an
|
||||
* MPM child process exits, and that child had previously lost its
|
||||
* scoreboard slot.
|
||||
* @param state One of the mpm_child_status values. Modules should ignore
|
||||
* unrecognized values.
|
||||
* @ingroup hooks
|
||||
*/
|
||||
AP_DECLARE_HOOK(void,child_status,(server_rec *s, pid_t pid, ap_generation_t gen,
|
||||
int slot, mpm_child_status state))
|
||||
|
||||
/**
|
||||
* Allow a module to be notified when the last child process of a generation
|
||||
* exits.
|
||||
*
|
||||
* @param s The main server_rec.
|
||||
* @param gen The server generation which is now completely finished.
|
||||
* @ingroup hooks
|
||||
*/
|
||||
AP_DECLARE_HOOK(void,end_generation,(server_rec *s, ap_generation_t gen))
|
||||
|
||||
/* Defining GPROF when compiling uses the moncontrol() function to
|
||||
* disable gprof profiling in the parent, and enable it only for
|
||||
* request processing in children (or in one_process mode). It's
|
||||
* absolutely required to get useful gprof results under linux
|
||||
* because the profile itimers and such are disabled across a
|
||||
* fork(). It's probably useful elsewhere as well.
|
||||
*/
|
||||
#ifdef GPROF
|
||||
extern void moncontrol(int);
|
||||
#define AP_MONCONTROL(x) moncontrol(x)
|
||||
#else
|
||||
#define AP_MONCONTROL(x)
|
||||
#endif
|
||||
|
||||
#ifdef AP_ENABLE_EXCEPTION_HOOK
|
||||
typedef struct ap_exception_info_t {
|
||||
int sig;
|
||||
pid_t pid;
|
||||
} ap_exception_info_t;
|
||||
|
||||
/**
|
||||
* Run the fatal_exception hook for each module; this hook is run
|
||||
* from some MPMs in the event of a child process crash, if the
|
||||
* server was built with --enable-exception-hook and the
|
||||
* EnableExceptionHook directive is On.
|
||||
* @param ei information about the exception
|
||||
* @ingroup hooks
|
||||
*/
|
||||
AP_DECLARE_HOOK(int,fatal_exception,(ap_exception_info_t *ei))
|
||||
#endif /*AP_ENABLE_EXCEPTION_HOOK*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/** @} */
|
||||
100
database/apache/include/ap_provider.h
Normal file
100
database/apache/include/ap_provider.h
Normal file
@@ -0,0 +1,100 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file ap_provider.h
|
||||
* @brief Apache Provider API
|
||||
*
|
||||
* @defgroup APACHE_CORE_PROVIDER Provider API
|
||||
* @ingroup APACHE_CORE
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef AP_PROVIDER_H
|
||||
#define AP_PROVIDER_H
|
||||
|
||||
#include "ap_config.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
const char *provider_name;
|
||||
} ap_list_provider_names_t;
|
||||
|
||||
typedef struct {
|
||||
const char *provider_group;
|
||||
const char *provider_version;
|
||||
} ap_list_provider_groups_t;
|
||||
|
||||
/**
|
||||
* This function is used to register a provider with the global
|
||||
* provider pool.
|
||||
* @param pool The pool to create any storage from
|
||||
* @param provider_group The group to store the provider in
|
||||
* @param provider_name The name for this provider
|
||||
* @param provider_version The version for this provider
|
||||
* @param provider Opaque structure for this provider
|
||||
* @return APR_SUCCESS if all went well
|
||||
*/
|
||||
AP_DECLARE(apr_status_t) ap_register_provider(apr_pool_t *pool,
|
||||
const char *provider_group,
|
||||
const char *provider_name,
|
||||
const char *provider_version,
|
||||
const void *provider);
|
||||
|
||||
/**
|
||||
* This function is used to retrieve a provider from the global
|
||||
* provider pool.
|
||||
* @param provider_group The group to look for this provider in
|
||||
* @param provider_name The name for the provider
|
||||
* @param provider_version The version for the provider
|
||||
* @return provider pointer to provider if found, NULL otherwise
|
||||
*/
|
||||
AP_DECLARE(void *) ap_lookup_provider(const char *provider_group,
|
||||
const char *provider_name,
|
||||
const char *provider_version);
|
||||
|
||||
/**
|
||||
* This function is used to retrieve a list (array) of provider
|
||||
* names from the specified group with the specified version.
|
||||
* @param pool The pool to create any storage from
|
||||
* @param provider_group The group to look for this provider in
|
||||
* @param provider_version The version for the provider
|
||||
* @return pointer to array of ap_list_provider_names_t of provider names (could be empty)
|
||||
*/
|
||||
|
||||
AP_DECLARE(apr_array_header_t *) ap_list_provider_names(apr_pool_t *pool,
|
||||
const char *provider_group,
|
||||
const char *provider_version);
|
||||
|
||||
/**
|
||||
* This function is used to retrieve a list (array) of provider groups and versions
|
||||
* @param pool The pool to create any storage from
|
||||
* @return pointer to array of ap_list_provider_groups_t of provider groups
|
||||
* and versions (could be empty)
|
||||
*/
|
||||
|
||||
AP_DECLARE(apr_array_header_t *) ap_list_provider_groups(apr_pool_t *pool);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/** @} */
|
||||
296
database/apache/include/ap_regex.h
Normal file
296
database/apache/include/ap_regex.h
Normal file
@@ -0,0 +1,296 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* This code is based on pcreposix.h from the PCRE Library distribution,
|
||||
* as originally written by Philip Hazel <ph10@cam.ac.uk>, and forked by
|
||||
* the Apache HTTP Server project to provide POSIX-style regex function
|
||||
* wrappers around underlying PCRE library functions for httpd.
|
||||
*
|
||||
* The original source file pcreposix.h is copyright and licensed as follows;
|
||||
|
||||
Copyright (c) 1997-2004 University of Cambridge
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of the University of Cambridge nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file ap_regex.h
|
||||
* @brief Apache Regex defines
|
||||
*/
|
||||
|
||||
#ifndef AP_REGEX_H
|
||||
#define AP_REGEX_H
|
||||
|
||||
#include "apr.h"
|
||||
|
||||
/* Allow for C++ users */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Options for ap_regcomp, ap_regexec, and ap_rxplus versions: */
|
||||
|
||||
#define AP_REG_ICASE 0x01 /** use a case-insensitive match */
|
||||
#define AP_REG_NEWLINE 0x02 /** don't match newlines against '.' etc */
|
||||
#define AP_REG_NOTBOL 0x04 /** ^ will not match against start-of-string */
|
||||
#define AP_REG_NOTEOL 0x08 /** $ will not match against end-of-string */
|
||||
|
||||
#define AP_REG_EXTENDED (0) /** unused */
|
||||
#define AP_REG_NOSUB (0) /** unused */
|
||||
|
||||
#define AP_REG_MULTI 0x10 /* perl's /g (needs fixing) */
|
||||
#define AP_REG_NOMEM 0x20 /* nomem in our code */
|
||||
#define AP_REG_DOTALL 0x40 /* perl's /s flag */
|
||||
|
||||
#define AP_REG_DOLLAR_ENDONLY 0x200 /* '$' matches at end of subject string only */
|
||||
|
||||
#define AP_REG_NO_DEFAULT 0x400 /**< Don't implicitely add AP_REG_DEFAULT options */
|
||||
|
||||
#define AP_REG_MATCH "MATCH_" /**< suggested prefix for ap_regname */
|
||||
|
||||
#define AP_REG_DEFAULT (AP_REG_DOTALL|AP_REG_DOLLAR_ENDONLY)
|
||||
|
||||
/* Arguments for ap_pcre_version_string */
|
||||
enum {
|
||||
AP_REG_PCRE_COMPILED = 0, /** PCRE version used during program compilation */
|
||||
AP_REG_PCRE_LOADED /** PCRE version loaded at runtime */
|
||||
};
|
||||
|
||||
/* Error values: */
|
||||
enum {
|
||||
AP_REG_ASSERT = 1, /** internal error ? */
|
||||
AP_REG_ESPACE, /** failed to get memory */
|
||||
AP_REG_INVARG, /** invalid argument */
|
||||
AP_REG_NOMATCH /** match failed */
|
||||
};
|
||||
|
||||
/* The structure representing a compiled regular expression. */
|
||||
typedef struct {
|
||||
void *re_pcre;
|
||||
int re_nsub;
|
||||
apr_size_t re_erroffset;
|
||||
} ap_regex_t;
|
||||
|
||||
/* The structure in which a captured offset is returned. */
|
||||
typedef struct {
|
||||
int rm_so;
|
||||
int rm_eo;
|
||||
} ap_regmatch_t;
|
||||
|
||||
/* The functions */
|
||||
|
||||
/**
|
||||
* Return PCRE version string.
|
||||
* @param which Either AP_REG_PCRE_COMPILED (PCRE version used
|
||||
* during program compilation) or AP_REG_PCRE_LOADED
|
||||
* (PCRE version used at runtime)
|
||||
* @return The PCRE version string
|
||||
*/
|
||||
AP_DECLARE(const char *) ap_pcre_version_string(int which);
|
||||
|
||||
/**
|
||||
* Get default compile flags
|
||||
* @return Bitwise OR of AP_REG_* flags
|
||||
*/
|
||||
AP_DECLARE(int) ap_regcomp_get_default_cflags(void);
|
||||
|
||||
/**
|
||||
* Set default compile flags
|
||||
* @param cflags Bitwise OR of AP_REG_* flags
|
||||
*/
|
||||
AP_DECLARE(void) ap_regcomp_set_default_cflags(int cflags);
|
||||
|
||||
/**
|
||||
* Get the AP_REG_* corresponding to the string.
|
||||
* @param name The name (i.e. AP_REG_<name>)
|
||||
* @return The AP_REG_*, or zero if the string is unknown
|
||||
*
|
||||
*/
|
||||
AP_DECLARE(int) ap_regcomp_default_cflag_by_name(const char *name);
|
||||
|
||||
/**
|
||||
* Compile a regular expression.
|
||||
* @param preg Returned compiled regex
|
||||
* @param regex The regular expression string
|
||||
* @param cflags Bitwise OR of AP_REG_* flags (ICASE and NEWLINE supported,
|
||||
* other flags are ignored)
|
||||
* @return Zero on success or non-zero on error
|
||||
*/
|
||||
AP_DECLARE(int) ap_regcomp(ap_regex_t *preg, const char *regex, int cflags);
|
||||
|
||||
/**
|
||||
* Match a NUL-terminated string against a pre-compiled regex.
|
||||
* @param preg The pre-compiled regex
|
||||
* @param string The string to match
|
||||
* @param nmatch Provide information regarding the location of any matches
|
||||
* @param pmatch Provide information regarding the location of any matches
|
||||
* @param eflags Bitwise OR of AP_REG_* flags (NOTBOL and NOTEOL supported,
|
||||
* other flags are ignored)
|
||||
* @return 0 for successful match, \p AP_REG_NOMATCH otherwise
|
||||
*/
|
||||
AP_DECLARE(int) ap_regexec(const ap_regex_t *preg, const char *string,
|
||||
apr_size_t nmatch, ap_regmatch_t *pmatch, int eflags);
|
||||
|
||||
/**
|
||||
* Match a string with given length against a pre-compiled regex. The string
|
||||
* does not need to be NUL-terminated.
|
||||
* @param preg The pre-compiled regex
|
||||
* @param buff The string to match
|
||||
* @param len Length of the string to match
|
||||
* @param nmatch Provide information regarding the location of any matches
|
||||
* @param pmatch Provide information regarding the location of any matches
|
||||
* @param eflags Bitwise OR of AP_REG_* flags (NOTBOL and NOTEOL supported,
|
||||
* other flags are ignored)
|
||||
* @return 0 for successful match, AP_REG_NOMATCH otherwise
|
||||
*/
|
||||
AP_DECLARE(int) ap_regexec_len(const ap_regex_t *preg, const char *buff,
|
||||
apr_size_t len, apr_size_t nmatch,
|
||||
ap_regmatch_t *pmatch, int eflags);
|
||||
|
||||
/**
|
||||
* Return the error code returned by regcomp or regexec into error messages
|
||||
* @param errcode the error code returned by regexec or regcomp
|
||||
* @param preg The precompiled regex
|
||||
* @param errbuf A buffer to store the error in
|
||||
* @param errbuf_size The size of the buffer
|
||||
*/
|
||||
AP_DECLARE(apr_size_t) ap_regerror(int errcode, const ap_regex_t *preg,
|
||||
char *errbuf, apr_size_t errbuf_size);
|
||||
|
||||
/**
|
||||
* Return an array of named regex backreferences
|
||||
* @param preg The precompiled regex
|
||||
* @param names The array to which the names will be added
|
||||
* @param prefix An optional prefix to add to the returned names. AP_REG_MATCH
|
||||
* is the recommended prefix.
|
||||
* @param upper If non zero, uppercase the names
|
||||
*/
|
||||
AP_DECLARE(int) ap_regname(const ap_regex_t *preg,
|
||||
apr_array_header_t *names, const char *prefix,
|
||||
int upper);
|
||||
|
||||
/** Destroy a pre-compiled regex.
|
||||
* @param preg The pre-compiled regex to free.
|
||||
*/
|
||||
AP_DECLARE(void) ap_regfree(ap_regex_t *preg);
|
||||
|
||||
/* ap_rxplus: higher-level regexps */
|
||||
|
||||
typedef struct {
|
||||
ap_regex_t rx;
|
||||
apr_uint32_t flags;
|
||||
const char *subs;
|
||||
const char *match;
|
||||
apr_size_t nmatch;
|
||||
ap_regmatch_t *pmatch;
|
||||
} ap_rxplus_t;
|
||||
|
||||
/**
|
||||
* Compile a pattern into a regexp.
|
||||
* supports perl-like formats
|
||||
* match-string
|
||||
* /match-string/flags
|
||||
* s/match-string/replacement-string/flags
|
||||
* Intended to support more perl-like stuff as and when round tuits happen
|
||||
* match-string is anything supported by ap_regcomp
|
||||
* replacement-string is a substitution string as supported in ap_pregsub
|
||||
* flags should correspond with perl syntax: treat failure to do so as a bug
|
||||
* (documentation TBD)
|
||||
* @param pool Pool to allocate from
|
||||
* @param pattern Pattern to compile
|
||||
* @return Compiled regexp, or NULL in case of compile/syntax error
|
||||
*/
|
||||
AP_DECLARE(ap_rxplus_t*) ap_rxplus_compile(apr_pool_t *pool, const char *pattern);
|
||||
/**
|
||||
* Apply a regexp operation to a string.
|
||||
* @param pool Pool to allocate from
|
||||
* @param rx The regex match to apply
|
||||
* @param pattern The string to apply it to
|
||||
* NOTE: This MUST be kept in scope to use regexp memory
|
||||
* @param newpattern The modified string (ignored if the operation doesn't
|
||||
* modify the string)
|
||||
* @return Number of times a match happens. Normally 0 (no match) or 1
|
||||
* (match found), but may be greater if a transforming pattern
|
||||
* is applied with the 'g' flag.
|
||||
*/
|
||||
AP_DECLARE(int) ap_rxplus_exec(apr_pool_t *pool, ap_rxplus_t *rx,
|
||||
const char *pattern, char **newpattern);
|
||||
#ifdef DOXYGEN
|
||||
/**
|
||||
* Number of matches in the regexp operation's memory
|
||||
* This may be 0 if no match is in memory, or up to nmatch from compilation
|
||||
* @param rx The regexp
|
||||
* @return Number of matches in memory
|
||||
*/
|
||||
AP_DECLARE(int) ap_rxplus_nmatch(ap_rxplus_t *rx);
|
||||
#else
|
||||
#define ap_rxplus_nmatch(rx) (((rx)->match != NULL) ? (rx)->nmatch : 0)
|
||||
#endif
|
||||
/**
|
||||
* Get a pointer to a match from regex memory
|
||||
* NOTE: this relies on the match pattern from the last call to
|
||||
* ap_rxplus_exec still being valid (i.e. not freed or out-of-scope)
|
||||
* @param rx The regexp
|
||||
* @param n The match number to retrieve (must be between 0 and nmatch)
|
||||
* @param len Returns the length of the match.
|
||||
* @param match Returns the match pattern
|
||||
*/
|
||||
AP_DECLARE(void) ap_rxplus_match(ap_rxplus_t *rx, int n, int *len,
|
||||
const char **match);
|
||||
/**
|
||||
* Get a match from regex memory in a string copy
|
||||
* NOTE: this relies on the match pattern from the last call to
|
||||
* ap_rxplus_exec still being valid (i.e. not freed or out-of-scope)
|
||||
* @param pool Pool to allocate from
|
||||
* @param rx The regexp
|
||||
* @param n The match number to retrieve (must be between 0 and nmatch)
|
||||
* @return The matched string
|
||||
*/
|
||||
AP_DECLARE(char*) ap_rxplus_pmatch(apr_pool_t *pool, ap_rxplus_t *rx, int n);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* AP_REGEX_T */
|
||||
|
||||
219
database/apache/include/ap_regkey.h
Normal file
219
database/apache/include/ap_regkey.h
Normal file
@@ -0,0 +1,219 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file ap_regkey.h
|
||||
* @brief APR-style Win32 Registry Manipulation
|
||||
*/
|
||||
|
||||
#ifndef AP_REGKEY_H
|
||||
#define AP_REGKEY_H
|
||||
|
||||
#if defined(WIN32) || defined(DOXYGEN)
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_pools.h"
|
||||
#include "ap_config.h" /* Just for AP_DECLARE */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct ap_regkey_t ap_regkey_t;
|
||||
|
||||
/* Used to recover AP_REGKEY_* constants
|
||||
*/
|
||||
AP_DECLARE(const ap_regkey_t *) ap_regkey_const(int i);
|
||||
|
||||
/**
|
||||
* Win32 Only: Constants for ap_regkey_open()
|
||||
*/
|
||||
#define AP_REGKEY_CLASSES_ROOT ap_regkey_const(0)
|
||||
#define AP_REGKEY_CURRENT_CONFIG ap_regkey_const(1)
|
||||
#define AP_REGKEY_CURRENT_USER ap_regkey_const(2)
|
||||
#define AP_REGKEY_LOCAL_MACHINE ap_regkey_const(3)
|
||||
#define AP_REGKEY_USERS ap_regkey_const(4)
|
||||
#define AP_REGKEY_PERFORMANCE_DATA ap_regkey_const(5)
|
||||
#define AP_REGKEY_DYN_DATA ap_regkey_const(6)
|
||||
|
||||
/**
|
||||
* Win32 Only: Flags for ap_regkey_value_set()
|
||||
*/
|
||||
#define AP_REGKEY_EXPAND 0x0001
|
||||
|
||||
/**
|
||||
* Win32 Only: Open the specified registry key.
|
||||
* @param newkey The opened registry key
|
||||
* @param parentkey The open registry key of the parent, or one of
|
||||
* <PRE>
|
||||
* AP_REGKEY_CLASSES_ROOT
|
||||
* AP_REGKEY_CURRENT_CONFIG
|
||||
* AP_REGKEY_CURRENT_USER
|
||||
* AP_REGKEY_LOCAL_MACHINE
|
||||
* AP_REGKEY_USERS
|
||||
* AP_REGKEY_PERFORMANCE_DATA
|
||||
* AP_REGKEY_DYN_DATA
|
||||
* </PRE>
|
||||
* @param keyname The path of the key relative to the parent key
|
||||
* @param flags Or'ed value of:
|
||||
* <PRE>
|
||||
* APR_READ open key for reading
|
||||
* APR_WRITE open key for writing
|
||||
* APR_CREATE create the key if it doesn't exist
|
||||
* APR_EXCL return error if APR_CREATE and key exists
|
||||
* </PRE>
|
||||
* @param pool The pool in which newkey is allocated
|
||||
*/
|
||||
AP_DECLARE(apr_status_t) ap_regkey_open(ap_regkey_t **newkey,
|
||||
const ap_regkey_t *parentkey,
|
||||
const char *keyname,
|
||||
apr_int32_t flags,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Win32 Only: Close the registry key opened or created by ap_regkey_open().
|
||||
* @param key The registry key to close
|
||||
*/
|
||||
AP_DECLARE(apr_status_t) ap_regkey_close(ap_regkey_t *key);
|
||||
|
||||
/**
|
||||
* Win32 Only: Remove the given registry key.
|
||||
* @param parent The open registry key of the parent, or one of
|
||||
* <PRE>
|
||||
* AP_REGKEY_CLASSES_ROOT
|
||||
* AP_REGKEY_CURRENT_CONFIG
|
||||
* AP_REGKEY_CURRENT_USER
|
||||
* AP_REGKEY_LOCAL_MACHINE
|
||||
* AP_REGKEY_USERS
|
||||
* AP_REGKEY_PERFORMANCE_DATA
|
||||
* AP_REGKEY_DYN_DATA
|
||||
* </PRE>
|
||||
* @param keyname The path of the key relative to the parent key
|
||||
* @param pool The pool used for temp allocations
|
||||
* @remark ap_regkey_remove() is not recursive, although it removes
|
||||
* all values within the given keyname, it will not remove a key
|
||||
* containing subkeys.
|
||||
*/
|
||||
AP_DECLARE(apr_status_t) ap_regkey_remove(const ap_regkey_t *parent,
|
||||
const char *keyname,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Win32 Only: Retrieve a registry value string from an open key.
|
||||
* @param result The string value retrieved
|
||||
* @param key The registry key to retrieve the value from
|
||||
* @param valuename The named value to retrieve (pass "" for the default)
|
||||
* @param pool The pool used to store the result
|
||||
* @remark There is no toggle to prevent environment variable expansion
|
||||
* if the registry value is set with AP_REG_EXPAND (REG_EXPAND_SZ), such
|
||||
* expansions are always performed.
|
||||
*/
|
||||
AP_DECLARE(apr_status_t) ap_regkey_value_get(char **result,
|
||||
ap_regkey_t *key,
|
||||
const char *valuename,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Win32 Only: Store a registry value string into an open key.
|
||||
* @param key The registry key to store the value into
|
||||
* @param valuename The named value to store (pass "" for the default)
|
||||
* @param value The string to store for the named value
|
||||
* @param flags The option AP_REGKEY_EXPAND or 0, where AP_REGKEY_EXPAND
|
||||
* values will find all %foo% variables expanded from the environment.
|
||||
* @param pool The pool used for temp allocations
|
||||
*/
|
||||
AP_DECLARE(apr_status_t) ap_regkey_value_set(ap_regkey_t *key,
|
||||
const char *valuename,
|
||||
const char *value,
|
||||
apr_int32_t flags,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Win32 Only: Retrieve a raw byte value from an open key.
|
||||
* @param result The raw bytes value retrieved
|
||||
* @param resultsize Pointer to a variable to store the number raw bytes retrieved
|
||||
* @param resulttype Pointer to a variable to store the registry type of the value retrieved
|
||||
* @param key The registry key to retrieve the value from
|
||||
* @param valuename The named value to retrieve (pass "" for the default)
|
||||
* @param pool The pool used to store the result
|
||||
*/
|
||||
AP_DECLARE(apr_status_t) ap_regkey_value_raw_get(void **result,
|
||||
apr_size_t *resultsize,
|
||||
apr_int32_t *resulttype,
|
||||
ap_regkey_t *key,
|
||||
const char *valuename,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Win32 Only: Store a raw bytes value into an open key.
|
||||
* @param key The registry key to store the value into
|
||||
* @param valuename The named value to store (pass "" for the default)
|
||||
* @param value The bytes to store for the named value
|
||||
* @param valuesize The number of bytes for value
|
||||
* @param valuetype The
|
||||
* values will find all %foo% variables expanded from the environment.
|
||||
* @param pool The pool used for temp allocations
|
||||
*/
|
||||
AP_DECLARE(apr_status_t) ap_regkey_value_raw_set(ap_regkey_t *key,
|
||||
const char *valuename,
|
||||
const void *value,
|
||||
apr_size_t valuesize,
|
||||
apr_int32_t valuetype,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Win32 Only: Retrieve a registry value string from an open key.
|
||||
* @param result The string elements retrieved from a REG_MULTI_SZ string array
|
||||
* @param key The registry key to retrieve the value from
|
||||
* @param valuename The named value to retrieve (pass "" for the default)
|
||||
* @param pool The pool used to store the result
|
||||
*/
|
||||
AP_DECLARE(apr_status_t) ap_regkey_value_array_get(apr_array_header_t **result,
|
||||
ap_regkey_t *key,
|
||||
const char *valuename,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Win32 Only: Store a registry value string array into an open key.
|
||||
* @param key The registry key to store the value into
|
||||
* @param valuename The named value to store (pass "" for the default)
|
||||
* @param nelts The string elements to store in a REG_MULTI_SZ string array
|
||||
* @param elts The number of elements in the elts string array
|
||||
* @param pool The pool used for temp allocations
|
||||
*/
|
||||
AP_DECLARE(apr_status_t) ap_regkey_value_array_set(ap_regkey_t *key,
|
||||
const char *valuename,
|
||||
int nelts,
|
||||
const char * const * elts,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Win32 Only: Remove a registry value from an open key.
|
||||
* @param key The registry key to remove the value from
|
||||
* @param valuename The named value to remove (pass "" for the default)
|
||||
* @param pool The pool used for temp allocations
|
||||
*/
|
||||
AP_DECLARE(apr_status_t) ap_regkey_value_remove(const ap_regkey_t *key,
|
||||
const char *valuename,
|
||||
apr_pool_t *pool);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* def WIN32 || def DOXYGEN */
|
||||
|
||||
#endif /* AP_REGKEY_H */
|
||||
83
database/apache/include/ap_release.h
Normal file
83
database/apache/include/ap_release.h
Normal file
@@ -0,0 +1,83 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file ap_release.h
|
||||
* @brief Version Release defines
|
||||
*/
|
||||
|
||||
#ifndef AP_RELEASE_H
|
||||
#define AP_RELEASE_H
|
||||
|
||||
#define AP_SERVER_COPYRIGHT \
|
||||
"Copyright 2021 The Apache Software Foundation."
|
||||
|
||||
/*
|
||||
* The below defines the base string of the Server: header. Additional
|
||||
* tokens can be added via the ap_add_version_component() API call.
|
||||
*
|
||||
* The tokens are listed in order of their significance for identifying the
|
||||
* application.
|
||||
*
|
||||
* "Product tokens should be short and to the point -- use of them for
|
||||
* advertizing or other non-essential information is explicitly forbidden."
|
||||
*
|
||||
* Example: "Apache/1.1.0 MrWidget/0.1-alpha"
|
||||
*/
|
||||
#define AP_SERVER_BASEVENDOR "Apache Software Foundation"
|
||||
#define AP_SERVER_BASEPROJECT "Apache HTTP Server"
|
||||
#define AP_SERVER_BASEPRODUCT "Apache"
|
||||
|
||||
#define AP_SERVER_MAJORVERSION_NUMBER 2
|
||||
#define AP_SERVER_MINORVERSION_NUMBER 4
|
||||
#define AP_SERVER_PATCHLEVEL_NUMBER 58
|
||||
#define AP_SERVER_DEVBUILD_BOOLEAN 0
|
||||
|
||||
/* Synchronize the above with docs/manual/style/version.ent */
|
||||
|
||||
#if !AP_SERVER_DEVBUILD_BOOLEAN
|
||||
#define AP_SERVER_ADD_STRING ""
|
||||
#else
|
||||
#ifndef AP_SERVER_ADD_STRING
|
||||
#define AP_SERVER_ADD_STRING "-dev"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* APR_STRINGIFY is defined here, and also in apr_general.h, so wrap it */
|
||||
#ifndef APR_STRINGIFY
|
||||
/** Properly quote a value as a string in the C preprocessor */
|
||||
#define APR_STRINGIFY(n) APR_STRINGIFY_HELPER(n)
|
||||
/** Helper macro for APR_STRINGIFY */
|
||||
#define APR_STRINGIFY_HELPER(n) #n
|
||||
#endif
|
||||
|
||||
/* keep old macros as well */
|
||||
#define AP_SERVER_MAJORVERSION APR_STRINGIFY(AP_SERVER_MAJORVERSION_NUMBER)
|
||||
#define AP_SERVER_MINORVERSION APR_STRINGIFY(AP_SERVER_MINORVERSION_NUMBER)
|
||||
#define AP_SERVER_PATCHLEVEL APR_STRINGIFY(AP_SERVER_PATCHLEVEL_NUMBER) \
|
||||
AP_SERVER_ADD_STRING
|
||||
|
||||
#define AP_SERVER_MINORREVISION AP_SERVER_MAJORVERSION "." AP_SERVER_MINORVERSION
|
||||
#define AP_SERVER_BASEREVISION AP_SERVER_MINORREVISION "." AP_SERVER_PATCHLEVEL
|
||||
#define AP_SERVER_BASEVERSION AP_SERVER_BASEPRODUCT "/" AP_SERVER_BASEREVISION
|
||||
#define AP_SERVER_VERSION AP_SERVER_BASEVERSION
|
||||
|
||||
/* macro for Win32 .rc files using numeric csv representation */
|
||||
#define AP_SERVER_PATCHLEVEL_CSV AP_SERVER_MAJORVERSION_NUMBER, \
|
||||
AP_SERVER_MINORVERSION_NUMBER, \
|
||||
AP_SERVER_PATCHLEVEL_NUMBER
|
||||
|
||||
#endif
|
||||
199
database/apache/include/ap_slotmem.h
Normal file
199
database/apache/include/ap_slotmem.h
Normal file
@@ -0,0 +1,199 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef SLOTMEM_H
|
||||
#define SLOTMEM_H
|
||||
|
||||
/* Memory handler for a shared memory divided in slot.
|
||||
*/
|
||||
/**
|
||||
* @file ap_slotmem.h
|
||||
* @brief Memory Slot Extension Storage Module for Apache
|
||||
*
|
||||
* @defgroup MEM mem
|
||||
* @ingroup APACHE_MODS
|
||||
* @{
|
||||
*/
|
||||
|
||||
#include "httpd.h"
|
||||
#include "http_config.h"
|
||||
#include "http_log.h"
|
||||
#include "ap_provider.h"
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_strings.h"
|
||||
#include "apr_pools.h"
|
||||
#include "apr_shm.h"
|
||||
#include "apr_global_mutex.h"
|
||||
#include "apr_file_io.h"
|
||||
#include "apr_md5.h"
|
||||
|
||||
#if APR_HAVE_UNISTD_H
|
||||
#include <unistd.h> /* for getpid() */
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define AP_SLOTMEM_PROVIDER_GROUP "slotmem"
|
||||
#define AP_SLOTMEM_PROVIDER_VERSION "0"
|
||||
|
||||
typedef unsigned int ap_slotmem_type_t;
|
||||
|
||||
/*
|
||||
* Values for ap_slotmem_type_t::
|
||||
*
|
||||
* AP_SLOTMEM_TYPE_PERSIST: For transitory providers, persist
|
||||
* the data on the file-system
|
||||
*
|
||||
* AP_SLOTMEM_TYPE_NOTMPSAFE:
|
||||
*
|
||||
* AP_SLOTMEM_TYPE_PREALLOC: Access to slots require they be grabbed 1st
|
||||
*
|
||||
* AP_SLOTMEM_TYPE_CLEARINUSE: If persisting, clear 'inuse' array before
|
||||
* storing
|
||||
*/
|
||||
#define AP_SLOTMEM_TYPE_PERSIST (1 << 0)
|
||||
#define AP_SLOTMEM_TYPE_NOTMPSAFE (1 << 1)
|
||||
#define AP_SLOTMEM_TYPE_PREGRAB (1 << 2)
|
||||
#define AP_SLOTMEM_TYPE_CLEARINUSE (1 << 3)
|
||||
|
||||
typedef struct ap_slotmem_instance_t ap_slotmem_instance_t;
|
||||
|
||||
/**
|
||||
* callback function used for slotmem doall.
|
||||
* @param mem is the memory associated with a worker.
|
||||
* @param data is what is passed to slotmem.
|
||||
* @param pool is pool used
|
||||
* @return APR_SUCCESS if all went well
|
||||
*/
|
||||
typedef apr_status_t ap_slotmem_callback_fn_t(void* mem, void *data, apr_pool_t *pool);
|
||||
|
||||
struct ap_slotmem_provider_t {
|
||||
/*
|
||||
* Name of the provider method
|
||||
*/
|
||||
const char *name;
|
||||
/**
|
||||
* call the callback on all worker slots
|
||||
* @param s ap_slotmem_instance_t to use.
|
||||
* @param funct callback function to call for each element.
|
||||
* @param data parameter for the callback function.
|
||||
* @param pool is pool used
|
||||
* @return APR_SUCCESS if all went well
|
||||
*/
|
||||
apr_status_t (* doall)(ap_slotmem_instance_t *s, ap_slotmem_callback_fn_t *func, void *data, apr_pool_t *pool);
|
||||
/**
|
||||
* create a new slotmem with each item size is item_size.
|
||||
* This would create shared memory, basically.
|
||||
* @param inst where to store pointer to slotmem
|
||||
* @param name a key used for debugging and in mod_status output or allow another process to share this space.
|
||||
* @param item_size size of each item
|
||||
* @param item_num number of item to create.
|
||||
* @param type type of slotmem.
|
||||
* @param pool is pool used
|
||||
* @return APR_SUCCESS if all went well
|
||||
*/
|
||||
apr_status_t (* create)(ap_slotmem_instance_t **inst, const char *name, apr_size_t item_size, unsigned int item_num, ap_slotmem_type_t type, apr_pool_t *pool);
|
||||
/**
|
||||
* attach to an existing slotmem.
|
||||
* This would attach to shared memory, basically.
|
||||
* @param inst where to store pointer to slotmem
|
||||
* @param name a key used for debugging and in mod_status output or allow another process to share this space.
|
||||
* @param item_size size of each item
|
||||
* @param item_num max number of item.
|
||||
* @param pool is pool to memory allocate.
|
||||
* @return APR_SUCCESS if all went well
|
||||
*/
|
||||
apr_status_t (* attach)(ap_slotmem_instance_t **inst, const char *name, apr_size_t *item_size, unsigned int *item_num, apr_pool_t *pool);
|
||||
/**
|
||||
* get the memory ptr associated with this worker slot.
|
||||
* @param s ap_slotmem_instance_t to use.
|
||||
* @param item_id item to return for 0 to item_num
|
||||
* @param mem address to store the pointer to the slot
|
||||
* @return APR_SUCCESS if all went well
|
||||
*/
|
||||
apr_status_t (* dptr)(ap_slotmem_instance_t *s, unsigned int item_id, void**mem);
|
||||
/**
|
||||
* get/read the data associated with this worker slot.
|
||||
* @param s ap_slotmem_instance_t to use.
|
||||
* @param item_id item to return for 0 to item_num
|
||||
* @param dest address to store the data
|
||||
* @param dest_len length of dataset to retrieve
|
||||
* @return APR_SUCCESS if all went well
|
||||
*/
|
||||
apr_status_t (* get)(ap_slotmem_instance_t *s, unsigned int item_id, unsigned char *dest, apr_size_t dest_len);
|
||||
/**
|
||||
* put/write the data associated with this worker slot.
|
||||
* @param s ap_slotmem_instance_t to use.
|
||||
* @param item_id item to return for 0 to item_num
|
||||
* @param src address of the data to store in the slot
|
||||
* @param src_len length of dataset to store in the slot
|
||||
* @return APR_SUCCESS if all went well
|
||||
*/
|
||||
apr_status_t (* put)(ap_slotmem_instance_t *slot, unsigned int item_id, unsigned char *src, apr_size_t src_len);
|
||||
/**
|
||||
* return number of slots allocated for this entry.
|
||||
* @param s ap_slotmem_instance_t to use.
|
||||
* @return number of slots
|
||||
*/
|
||||
unsigned int (* num_slots)(ap_slotmem_instance_t *s);
|
||||
/**
|
||||
* return number of free (not used) slots allocated for this entry.
|
||||
* Valid for slots which are AP_SLOTMEM_TYPE_PREGRAB as well as
|
||||
* any which use get/release.
|
||||
* @param s ap_slotmem_instance_t to use.
|
||||
* @return number of slots
|
||||
*/
|
||||
unsigned int (* num_free_slots)(ap_slotmem_instance_t *s);
|
||||
/**
|
||||
* return slot size allocated for this entry.
|
||||
* @param s ap_slotmem_instance_t to use.
|
||||
* @return size of slot
|
||||
*/
|
||||
apr_size_t (* slot_size)(ap_slotmem_instance_t *s);
|
||||
/**
|
||||
* grab (or alloc) a free slot
|
||||
* @param s ap_slotmem_instance_t to use.
|
||||
* @param item_id ptr to the available slot id and marked as in-use
|
||||
* @return APR_SUCCESS if all went well
|
||||
*/
|
||||
apr_status_t (* grab)(ap_slotmem_instance_t *s, unsigned int *item_id);
|
||||
/**
|
||||
* release (or free) the slot associated with this item_id
|
||||
* @param s ap_slotmem_instance_t to use.
|
||||
* @param item_id slot id to free and mark as no longer in-use
|
||||
* @return APR_SUCCESS if all went well
|
||||
*/
|
||||
apr_status_t (* release)(ap_slotmem_instance_t *s, unsigned int item_id);
|
||||
/**
|
||||
* forced grab (or alloc) a slot associated with this item_id
|
||||
* @param s ap_slotmem_instance_t to use.
|
||||
* @param item_id to the specified slot id and marked as in-use
|
||||
* @return APR_SUCCESS if all went well
|
||||
*/
|
||||
apr_status_t (* fgrab)(ap_slotmem_instance_t *s, unsigned int item_id);
|
||||
};
|
||||
|
||||
typedef struct ap_slotmem_provider_t ap_slotmem_provider_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/** @} */
|
||||
230
database/apache/include/ap_socache.h
Normal file
230
database/apache/include/ap_socache.h
Normal file
@@ -0,0 +1,230 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file ap_socache.h
|
||||
* @brief Small object cache provider interface.
|
||||
*
|
||||
* @defgroup AP_SOCACHE ap_socache
|
||||
* @ingroup APACHE_MODS
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef AP_SOCACHE_H
|
||||
#define AP_SOCACHE_H
|
||||
|
||||
#include "httpd.h"
|
||||
#include "ap_provider.h"
|
||||
#include "apr_pools.h"
|
||||
#include "apr_time.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** If this flag is set, the store/retrieve/remove/status interfaces
|
||||
* of the provider are NOT safe to be called concurrently from
|
||||
* multiple processes or threads, and an external global mutex must be
|
||||
* used to serialize access to the provider.
|
||||
*/
|
||||
/* XXX: Even if store/retrieve/remove is atomic, isn't it useful to note
|
||||
* independently that status and iterate may or may not be?
|
||||
*/
|
||||
#define AP_SOCACHE_FLAG_NOTMPSAFE (0x0001)
|
||||
|
||||
/** A cache instance. */
|
||||
typedef struct ap_socache_instance_t ap_socache_instance_t;
|
||||
|
||||
/** Hints which may be passed to the init function; providers may
|
||||
* ignore some or all of these hints. */
|
||||
struct ap_socache_hints {
|
||||
/** Approximate average length of IDs: */
|
||||
apr_size_t avg_id_len;
|
||||
/** Approximate average size of objects: */
|
||||
apr_size_t avg_obj_size;
|
||||
/** Suggested interval between expiry cleanup runs; */
|
||||
apr_interval_time_t expiry_interval;
|
||||
};
|
||||
|
||||
/**
|
||||
* Iterator callback prototype for the ap_socache_provider_t->iterate() method
|
||||
* @param instance The cache instance
|
||||
* @param s Associated server context (for logging)
|
||||
* @param userctx User defined pointer passed from the iterator call
|
||||
* @param id Unique ID for the object (binary blob)
|
||||
* with a trailing null char for convenience
|
||||
* @param idlen Length of id blob
|
||||
* @param data Output buffer to place retrieved data (binary blob)
|
||||
* with a trailing null char for convenience
|
||||
* @param datalen Length of data buffer
|
||||
* @param pool Pool for temporary allocations
|
||||
* @return APR status value; return APR_SUCCESS or the iteration will halt;
|
||||
* this value is returned to the ap_socache_provider_t->iterate() caller
|
||||
*/
|
||||
typedef apr_status_t (ap_socache_iterator_t)(ap_socache_instance_t *instance,
|
||||
server_rec *s,
|
||||
void *userctx,
|
||||
const unsigned char *id,
|
||||
unsigned int idlen,
|
||||
const unsigned char *data,
|
||||
unsigned int datalen,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/** A socache provider structure. socache providers are registered
|
||||
* with the ap_provider.h interface using the AP_SOCACHE_PROVIDER_*
|
||||
* constants. */
|
||||
typedef struct ap_socache_provider_t {
|
||||
/** Canonical provider name. */
|
||||
const char *name;
|
||||
|
||||
/** Bitmask of AP_SOCACHE_FLAG_* flags. */
|
||||
unsigned int flags;
|
||||
|
||||
/**
|
||||
* Create a session cache based on the given configuration string.
|
||||
* The instance pointer returned in the instance parameter will be
|
||||
* passed as the first argument to subsequent invocations.
|
||||
*
|
||||
* @param instance Output parameter to which instance object is written.
|
||||
* @param arg User-specified configuration string. May be NULL to
|
||||
* force use of defaults.
|
||||
* @param tmp Pool to be used for any temporary allocations
|
||||
* @param p Pool to be use for any allocations lasting as long as
|
||||
* the created instance
|
||||
* @return NULL on success, or an error string on failure.
|
||||
*/
|
||||
const char *(*create)(ap_socache_instance_t **instance, const char *arg,
|
||||
apr_pool_t *tmp, apr_pool_t *p);
|
||||
|
||||
/**
|
||||
* Initialize the cache. The cname must be of maximum length 16
|
||||
* characters, and uniquely identifies the consumer of the cache
|
||||
* within the server; using the module name is recommended, e.g.
|
||||
* "mod_ssl-sess". This string may be used within a filesystem
|
||||
* path so use of only alphanumeric [a-z0-9_-] characters is
|
||||
* recommended. If hints is non-NULL, it gives a set of hints for
|
||||
* the provider. Returns APR error code.
|
||||
*
|
||||
* @param instance The cache instance
|
||||
* @param cname A unique string identifying the consumer of this API
|
||||
* @param hints Optional hints argument describing expected cache use
|
||||
* @param s Server structure to which the cache is associated
|
||||
* @param pool Pool for long-lived allocations
|
||||
* @return APR status value indicating success.
|
||||
*/
|
||||
apr_status_t (*init)(ap_socache_instance_t *instance, const char *cname,
|
||||
const struct ap_socache_hints *hints,
|
||||
server_rec *s, apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Destroy a given cache instance object.
|
||||
* @param instance The cache instance to destroy.
|
||||
* @param s Associated server structure (for logging purposes)
|
||||
*/
|
||||
void (*destroy)(ap_socache_instance_t *instance, server_rec *s);
|
||||
|
||||
/**
|
||||
* Store an object in a cache instance.
|
||||
* @param instance The cache instance
|
||||
* @param s Associated server structure (for logging purposes)
|
||||
* @param id Unique ID for the object; binary blob
|
||||
* @param idlen Length of id blob
|
||||
* @param expiry Absolute time at which the object expires
|
||||
* @param data Data to store; binary blob
|
||||
* @param datalen Length of data blob
|
||||
* @param pool Pool for temporary allocations.
|
||||
* @return APR status value.
|
||||
*/
|
||||
apr_status_t (*store)(ap_socache_instance_t *instance, server_rec *s,
|
||||
const unsigned char *id, unsigned int idlen,
|
||||
apr_time_t expiry,
|
||||
unsigned char *data, unsigned int datalen,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Retrieve a cached object.
|
||||
*
|
||||
* @param instance The cache instance
|
||||
* @param s Associated server structure (for logging purposes)
|
||||
* @param id Unique ID for the object; binary blob
|
||||
* @param idlen Length of id blob
|
||||
* @param data Output buffer to place retrievd data (binary blob)
|
||||
* @param datalen On entry, length of data buffer; on exit, the
|
||||
* number of bytes written to the data buffer.
|
||||
* @param pool Pool for temporary allocations.
|
||||
* @return APR status value; APR_NOTFOUND if the object was not
|
||||
* found
|
||||
*/
|
||||
apr_status_t (*retrieve)(ap_socache_instance_t *instance, server_rec *s,
|
||||
const unsigned char *id, unsigned int idlen,
|
||||
unsigned char *data, unsigned int *datalen,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Remove an object from the cache
|
||||
*
|
||||
* @param instance The cache instance
|
||||
* @param s Associated server structure (for logging purposes)
|
||||
* @param id Unique ID for the object; binary blob
|
||||
* @param idlen Length of id blob
|
||||
* @param pool Pool for temporary allocations.
|
||||
*/
|
||||
apr_status_t (*remove)(ap_socache_instance_t *instance, server_rec *s,
|
||||
const unsigned char *id, unsigned int idlen,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Dump the status of a cache instance for mod_status. Will use
|
||||
* the ap_r* interfaces to produce appropriate status output.
|
||||
* XXX: ap_r* are deprecated, bad dogfood
|
||||
*
|
||||
* @param instance The cache instance
|
||||
* @param r The request structure
|
||||
* @param flags The AP_STATUS_* constants used (see mod_status.h)
|
||||
*/
|
||||
void (*status)(ap_socache_instance_t *instance, request_rec *r, int flags);
|
||||
|
||||
/**
|
||||
* Dump all cached objects through an iterator callback.
|
||||
* @param instance The cache instance
|
||||
* @param s Associated server context (for processing and logging)
|
||||
* @param userctx User defined pointer passed through to the iterator
|
||||
* @param iterator The user provided callback function which will receive
|
||||
* individual calls for each unexpired id/data pair
|
||||
* @param pool Pool for temporary allocations.
|
||||
* @return APR status value; APR_NOTFOUND if the object was not
|
||||
* found
|
||||
*/
|
||||
apr_status_t (*iterate)(ap_socache_instance_t *instance, server_rec *s,
|
||||
void *userctx, ap_socache_iterator_t *iterator,
|
||||
apr_pool_t *pool);
|
||||
|
||||
} ap_socache_provider_t;
|
||||
|
||||
/** The provider group used to register socache providers. */
|
||||
#define AP_SOCACHE_PROVIDER_GROUP "socache"
|
||||
/** The provider version used to register socache providers. */
|
||||
#define AP_SOCACHE_PROVIDER_VERSION "0"
|
||||
|
||||
/** Default provider name. */
|
||||
#define AP_SOCACHE_DEFAULT_PROVIDER "default"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* AP_SOCACHE_H */
|
||||
/** @} */
|
||||
344
database/apache/include/apache_noprobes.h
Normal file
344
database/apache/include/apache_noprobes.h
Normal file
@@ -0,0 +1,344 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef _APACHE_NOPROBES_H_
|
||||
#define _APACHE_NOPROBES_H_
|
||||
|
||||
#define AP_ACCESS_CHECKER_DISPATCH_COMPLETE(arg0, arg1)
|
||||
#define AP_ACCESS_CHECKER_DISPATCH_COMPLETE_ENABLED() (0)
|
||||
#define AP_ACCESS_CHECKER_DISPATCH_INVOKE(arg0)
|
||||
#define AP_ACCESS_CHECKER_DISPATCH_INVOKE_ENABLED() (0)
|
||||
#define AP_ACCESS_CHECKER_ENTRY()
|
||||
#define AP_ACCESS_CHECKER_ENTRY_ENABLED() (0)
|
||||
#define AP_ACCESS_CHECKER_RETURN(arg0)
|
||||
#define AP_ACCESS_CHECKER_RETURN_ENABLED() (0)
|
||||
#define AP_AUTH_CHECKER_DISPATCH_COMPLETE(arg0, arg1)
|
||||
#define AP_AUTH_CHECKER_DISPATCH_COMPLETE_ENABLED() (0)
|
||||
#define AP_AUTH_CHECKER_DISPATCH_INVOKE(arg0)
|
||||
#define AP_AUTH_CHECKER_DISPATCH_INVOKE_ENABLED() (0)
|
||||
#define AP_AUTH_CHECKER_ENTRY()
|
||||
#define AP_AUTH_CHECKER_ENTRY_ENABLED() (0)
|
||||
#define AP_AUTH_CHECKER_RETURN(arg0)
|
||||
#define AP_AUTH_CHECKER_RETURN_ENABLED() (0)
|
||||
#define AP_CANON_HANDLER_DISPATCH_COMPLETE(arg0, arg1)
|
||||
#define AP_CANON_HANDLER_DISPATCH_COMPLETE_ENABLED() (0)
|
||||
#define AP_CANON_HANDLER_DISPATCH_INVOKE(arg0)
|
||||
#define AP_CANON_HANDLER_DISPATCH_INVOKE_ENABLED() (0)
|
||||
#define AP_CANON_HANDLER_ENTRY()
|
||||
#define AP_CANON_HANDLER_ENTRY_ENABLED() (0)
|
||||
#define AP_CANON_HANDLER_RETURN(arg0)
|
||||
#define AP_CANON_HANDLER_RETURN_ENABLED() (0)
|
||||
#define AP_CHECK_USER_ID_DISPATCH_COMPLETE(arg0, arg1)
|
||||
#define AP_CHECK_USER_ID_DISPATCH_COMPLETE_ENABLED() (0)
|
||||
#define AP_CHECK_USER_ID_DISPATCH_INVOKE(arg0)
|
||||
#define AP_CHECK_USER_ID_DISPATCH_INVOKE_ENABLED() (0)
|
||||
#define AP_CHECK_USER_ID_ENTRY()
|
||||
#define AP_CHECK_USER_ID_ENTRY_ENABLED() (0)
|
||||
#define AP_CHECK_USER_ID_RETURN(arg0)
|
||||
#define AP_CHECK_USER_ID_RETURN_ENABLED() (0)
|
||||
#define AP_CHILD_INIT_DISPATCH_COMPLETE(arg0, arg1)
|
||||
#define AP_CHILD_INIT_DISPATCH_COMPLETE_ENABLED() (0)
|
||||
#define AP_CHILD_INIT_DISPATCH_INVOKE(arg0)
|
||||
#define AP_CHILD_INIT_DISPATCH_INVOKE_ENABLED() (0)
|
||||
#define AP_CHILD_INIT_ENTRY()
|
||||
#define AP_CHILD_INIT_ENTRY_ENABLED() (0)
|
||||
#define AP_CHILD_INIT_RETURN(arg0)
|
||||
#define AP_CHILD_INIT_RETURN_ENABLED() (0)
|
||||
#define AP_CREATE_CONNECTION_DISPATCH_COMPLETE(arg0, arg1)
|
||||
#define AP_CREATE_CONNECTION_DISPATCH_COMPLETE_ENABLED() (0)
|
||||
#define AP_CREATE_CONNECTION_DISPATCH_INVOKE(arg0)
|
||||
#define AP_CREATE_CONNECTION_DISPATCH_INVOKE_ENABLED() (0)
|
||||
#define AP_CREATE_CONNECTION_ENTRY()
|
||||
#define AP_CREATE_CONNECTION_ENTRY_ENABLED() (0)
|
||||
#define AP_CREATE_CONNECTION_RETURN(arg0)
|
||||
#define AP_CREATE_CONNECTION_RETURN_ENABLED() (0)
|
||||
#define AP_CREATE_REQUEST_DISPATCH_COMPLETE(arg0, arg1)
|
||||
#define AP_CREATE_REQUEST_DISPATCH_COMPLETE_ENABLED() (0)
|
||||
#define AP_CREATE_REQUEST_DISPATCH_INVOKE(arg0)
|
||||
#define AP_CREATE_REQUEST_DISPATCH_INVOKE_ENABLED() (0)
|
||||
#define AP_CREATE_REQUEST_ENTRY()
|
||||
#define AP_CREATE_REQUEST_ENTRY_ENABLED() (0)
|
||||
#define AP_CREATE_REQUEST_RETURN(arg0)
|
||||
#define AP_CREATE_REQUEST_RETURN_ENABLED() (0)
|
||||
#define AP_DEFAULT_PORT_DISPATCH_COMPLETE(arg0, arg1)
|
||||
#define AP_DEFAULT_PORT_DISPATCH_COMPLETE_ENABLED() (0)
|
||||
#define AP_DEFAULT_PORT_DISPATCH_INVOKE(arg0)
|
||||
#define AP_DEFAULT_PORT_DISPATCH_INVOKE_ENABLED() (0)
|
||||
#define AP_DEFAULT_PORT_ENTRY()
|
||||
#define AP_DEFAULT_PORT_ENTRY_ENABLED() (0)
|
||||
#define AP_DEFAULT_PORT_RETURN(arg0)
|
||||
#define AP_DEFAULT_PORT_RETURN_ENABLED() (0)
|
||||
#define AP_ERROR_LOG_DISPATCH_COMPLETE(arg0, arg1)
|
||||
#define AP_ERROR_LOG_DISPATCH_COMPLETE_ENABLED() (0)
|
||||
#define AP_ERROR_LOG_DISPATCH_INVOKE(arg0)
|
||||
#define AP_ERROR_LOG_DISPATCH_INVOKE_ENABLED() (0)
|
||||
#define AP_ERROR_LOG_ENTRY()
|
||||
#define AP_ERROR_LOG_ENTRY_ENABLED() (0)
|
||||
#define AP_ERROR_LOG_RETURN(arg0)
|
||||
#define AP_ERROR_LOG_RETURN_ENABLED() (0)
|
||||
#define AP_FIND_LIVEPROP_DISPATCH_COMPLETE(arg0, arg1)
|
||||
#define AP_FIND_LIVEPROP_DISPATCH_COMPLETE_ENABLED() (0)
|
||||
#define AP_FIND_LIVEPROP_DISPATCH_INVOKE(arg0)
|
||||
#define AP_FIND_LIVEPROP_DISPATCH_INVOKE_ENABLED() (0)
|
||||
#define AP_FIND_LIVEPROP_ENTRY()
|
||||
#define AP_FIND_LIVEPROP_ENTRY_ENABLED() (0)
|
||||
#define AP_FIND_LIVEPROP_RETURN(arg0)
|
||||
#define AP_FIND_LIVEPROP_RETURN_ENABLED() (0)
|
||||
#define AP_FIXUPS_DISPATCH_COMPLETE(arg0, arg1)
|
||||
#define AP_FIXUPS_DISPATCH_COMPLETE_ENABLED() (0)
|
||||
#define AP_FIXUPS_DISPATCH_INVOKE(arg0)
|
||||
#define AP_FIXUPS_DISPATCH_INVOKE_ENABLED() (0)
|
||||
#define AP_FIXUPS_ENTRY()
|
||||
#define AP_FIXUPS_ENTRY_ENABLED() (0)
|
||||
#define AP_FIXUPS_RETURN(arg0)
|
||||
#define AP_FIXUPS_RETURN_ENABLED() (0)
|
||||
#define AP_GATHER_PROPSETS_DISPATCH_COMPLETE(arg0, arg1)
|
||||
#define AP_GATHER_PROPSETS_DISPATCH_COMPLETE_ENABLED() (0)
|
||||
#define AP_GATHER_PROPSETS_DISPATCH_INVOKE(arg0)
|
||||
#define AP_GATHER_PROPSETS_DISPATCH_INVOKE_ENABLED() (0)
|
||||
#define AP_GATHER_PROPSETS_ENTRY()
|
||||
#define AP_GATHER_PROPSETS_ENTRY_ENABLED() (0)
|
||||
#define AP_GATHER_PROPSETS_RETURN(arg0)
|
||||
#define AP_GATHER_PROPSETS_RETURN_ENABLED() (0)
|
||||
#define AP_GET_MGMT_ITEMS_DISPATCH_COMPLETE(arg0, arg1)
|
||||
#define AP_GET_MGMT_ITEMS_DISPATCH_COMPLETE_ENABLED() (0)
|
||||
#define AP_GET_MGMT_ITEMS_DISPATCH_INVOKE(arg0)
|
||||
#define AP_GET_MGMT_ITEMS_DISPATCH_INVOKE_ENABLED() (0)
|
||||
#define AP_GET_MGMT_ITEMS_ENTRY()
|
||||
#define AP_GET_MGMT_ITEMS_ENTRY_ENABLED() (0)
|
||||
#define AP_GET_MGMT_ITEMS_RETURN(arg0)
|
||||
#define AP_GET_MGMT_ITEMS_RETURN_ENABLED() (0)
|
||||
#define AP_GET_SUEXEC_IDENTITY_DISPATCH_COMPLETE(arg0, arg1)
|
||||
#define AP_GET_SUEXEC_IDENTITY_DISPATCH_COMPLETE_ENABLED() (0)
|
||||
#define AP_GET_SUEXEC_IDENTITY_DISPATCH_INVOKE(arg0)
|
||||
#define AP_GET_SUEXEC_IDENTITY_DISPATCH_INVOKE_ENABLED() (0)
|
||||
#define AP_GET_SUEXEC_IDENTITY_ENTRY()
|
||||
#define AP_GET_SUEXEC_IDENTITY_ENTRY_ENABLED() (0)
|
||||
#define AP_GET_SUEXEC_IDENTITY_RETURN(arg0)
|
||||
#define AP_GET_SUEXEC_IDENTITY_RETURN_ENABLED() (0)
|
||||
#define AP_HANDLER_DISPATCH_COMPLETE(arg0, arg1)
|
||||
#define AP_HANDLER_DISPATCH_COMPLETE_ENABLED() (0)
|
||||
#define AP_HANDLER_DISPATCH_INVOKE(arg0)
|
||||
#define AP_HANDLER_DISPATCH_INVOKE_ENABLED() (0)
|
||||
#define AP_HANDLER_ENTRY()
|
||||
#define AP_HANDLER_ENTRY_ENABLED() (0)
|
||||
#define AP_HANDLER_RETURN(arg0)
|
||||
#define AP_HANDLER_RETURN_ENABLED() (0)
|
||||
#define AP_HEADER_PARSER_DISPATCH_COMPLETE(arg0, arg1)
|
||||
#define AP_HEADER_PARSER_DISPATCH_COMPLETE_ENABLED() (0)
|
||||
#define AP_HEADER_PARSER_DISPATCH_INVOKE(arg0)
|
||||
#define AP_HEADER_PARSER_DISPATCH_INVOKE_ENABLED() (0)
|
||||
#define AP_HEADER_PARSER_ENTRY()
|
||||
#define AP_HEADER_PARSER_ENTRY_ENABLED() (0)
|
||||
#define AP_HEADER_PARSER_RETURN(arg0)
|
||||
#define AP_HEADER_PARSER_RETURN_ENABLED() (0)
|
||||
#define AP_HTTP_SCHEME_DISPATCH_COMPLETE(arg0, arg1)
|
||||
#define AP_HTTP_SCHEME_DISPATCH_COMPLETE_ENABLED() (0)
|
||||
#define AP_HTTP_SCHEME_DISPATCH_INVOKE(arg0)
|
||||
#define AP_HTTP_SCHEME_DISPATCH_INVOKE_ENABLED() (0)
|
||||
#define AP_HTTP_SCHEME_ENTRY()
|
||||
#define AP_HTTP_SCHEME_ENTRY_ENABLED() (0)
|
||||
#define AP_HTTP_SCHEME_RETURN(arg0)
|
||||
#define AP_HTTP_SCHEME_RETURN_ENABLED() (0)
|
||||
#define AP_INSERT_ALL_LIVEPROPS_DISPATCH_COMPLETE(arg0, arg1)
|
||||
#define AP_INSERT_ALL_LIVEPROPS_DISPATCH_COMPLETE_ENABLED() (0)
|
||||
#define AP_INSERT_ALL_LIVEPROPS_DISPATCH_INVOKE(arg0)
|
||||
#define AP_INSERT_ALL_LIVEPROPS_DISPATCH_INVOKE_ENABLED() (0)
|
||||
#define AP_INSERT_ALL_LIVEPROPS_ENTRY()
|
||||
#define AP_INSERT_ALL_LIVEPROPS_ENTRY_ENABLED() (0)
|
||||
#define AP_INSERT_ALL_LIVEPROPS_RETURN(arg0)
|
||||
#define AP_INSERT_ALL_LIVEPROPS_RETURN_ENABLED() (0)
|
||||
#define AP_INSERT_ERROR_FILTER_DISPATCH_COMPLETE(arg0, arg1)
|
||||
#define AP_INSERT_ERROR_FILTER_DISPATCH_COMPLETE_ENABLED() (0)
|
||||
#define AP_INSERT_ERROR_FILTER_DISPATCH_INVOKE(arg0)
|
||||
#define AP_INSERT_ERROR_FILTER_DISPATCH_INVOKE_ENABLED() (0)
|
||||
#define AP_INSERT_ERROR_FILTER_ENTRY()
|
||||
#define AP_INSERT_ERROR_FILTER_ENTRY_ENABLED() (0)
|
||||
#define AP_INSERT_ERROR_FILTER_RETURN(arg0)
|
||||
#define AP_INSERT_ERROR_FILTER_RETURN_ENABLED() (0)
|
||||
#define AP_INSERT_FILTER_DISPATCH_COMPLETE(arg0, arg1)
|
||||
#define AP_INSERT_FILTER_DISPATCH_COMPLETE_ENABLED() (0)
|
||||
#define AP_INSERT_FILTER_DISPATCH_INVOKE(arg0)
|
||||
#define AP_INSERT_FILTER_DISPATCH_INVOKE_ENABLED() (0)
|
||||
#define AP_INSERT_FILTER_ENTRY()
|
||||
#define AP_INSERT_FILTER_ENTRY_ENABLED() (0)
|
||||
#define AP_INSERT_FILTER_RETURN(arg0)
|
||||
#define AP_INSERT_FILTER_RETURN_ENABLED() (0)
|
||||
#define AP_INTERNAL_REDIRECT(arg0, arg1)
|
||||
#define AP_INTERNAL_REDIRECT_ENABLED() (0)
|
||||
#define AP_LOG_TRANSACTION_DISPATCH_COMPLETE(arg0, arg1)
|
||||
#define AP_LOG_TRANSACTION_DISPATCH_COMPLETE_ENABLED() (0)
|
||||
#define AP_LOG_TRANSACTION_DISPATCH_INVOKE(arg0)
|
||||
#define AP_LOG_TRANSACTION_DISPATCH_INVOKE_ENABLED() (0)
|
||||
#define AP_LOG_TRANSACTION_ENTRY()
|
||||
#define AP_LOG_TRANSACTION_ENTRY_ENABLED() (0)
|
||||
#define AP_LOG_TRANSACTION_RETURN(arg0)
|
||||
#define AP_LOG_TRANSACTION_RETURN_ENABLED() (0)
|
||||
#define AP_MAP_TO_STORAGE_DISPATCH_COMPLETE(arg0, arg1)
|
||||
#define AP_MAP_TO_STORAGE_DISPATCH_COMPLETE_ENABLED() (0)
|
||||
#define AP_MAP_TO_STORAGE_DISPATCH_INVOKE(arg0)
|
||||
#define AP_MAP_TO_STORAGE_DISPATCH_INVOKE_ENABLED() (0)
|
||||
#define AP_MAP_TO_STORAGE_ENTRY()
|
||||
#define AP_MAP_TO_STORAGE_ENTRY_ENABLED() (0)
|
||||
#define AP_MAP_TO_STORAGE_RETURN(arg0)
|
||||
#define AP_MAP_TO_STORAGE_RETURN_ENABLED() (0)
|
||||
#define AP_MONITOR_DISPATCH_COMPLETE(arg0, arg1)
|
||||
#define AP_MONITOR_DISPATCH_COMPLETE_ENABLED() (0)
|
||||
#define AP_MONITOR_DISPATCH_INVOKE(arg0)
|
||||
#define AP_MONITOR_DISPATCH_INVOKE_ENABLED() (0)
|
||||
#define AP_MONITOR_ENTRY()
|
||||
#define AP_MONITOR_ENTRY_ENABLED() (0)
|
||||
#define AP_MONITOR_RETURN(arg0)
|
||||
#define AP_MONITOR_RETURN_ENABLED() (0)
|
||||
#define AP_OPEN_LOGS_DISPATCH_COMPLETE(arg0, arg1)
|
||||
#define AP_OPEN_LOGS_DISPATCH_COMPLETE_ENABLED() (0)
|
||||
#define AP_OPEN_LOGS_DISPATCH_INVOKE(arg0)
|
||||
#define AP_OPEN_LOGS_DISPATCH_INVOKE_ENABLED() (0)
|
||||
#define AP_OPEN_LOGS_ENTRY()
|
||||
#define AP_OPEN_LOGS_ENTRY_ENABLED() (0)
|
||||
#define AP_OPEN_LOGS_RETURN(arg0)
|
||||
#define AP_OPEN_LOGS_RETURN_ENABLED() (0)
|
||||
#define AP_OPTIONAL_FN_RETRIEVE_DISPATCH_COMPLETE(arg0, arg1)
|
||||
#define AP_OPTIONAL_FN_RETRIEVE_DISPATCH_COMPLETE_ENABLED() (0)
|
||||
#define AP_OPTIONAL_FN_RETRIEVE_DISPATCH_INVOKE(arg0)
|
||||
#define AP_OPTIONAL_FN_RETRIEVE_DISPATCH_INVOKE_ENABLED() (0)
|
||||
#define AP_OPTIONAL_FN_RETRIEVE_ENTRY()
|
||||
#define AP_OPTIONAL_FN_RETRIEVE_ENTRY_ENABLED() (0)
|
||||
#define AP_OPTIONAL_FN_RETRIEVE_RETURN(arg0)
|
||||
#define AP_OPTIONAL_FN_RETRIEVE_RETURN_ENABLED() (0)
|
||||
#define AP_POST_CONFIG_DISPATCH_COMPLETE(arg0, arg1)
|
||||
#define AP_POST_CONFIG_DISPATCH_COMPLETE_ENABLED() (0)
|
||||
#define AP_POST_CONFIG_DISPATCH_INVOKE(arg0)
|
||||
#define AP_POST_CONFIG_DISPATCH_INVOKE_ENABLED() (0)
|
||||
#define AP_POST_CONFIG_ENTRY()
|
||||
#define AP_POST_CONFIG_ENTRY_ENABLED() (0)
|
||||
#define AP_POST_CONFIG_RETURN(arg0)
|
||||
#define AP_POST_CONFIG_RETURN_ENABLED() (0)
|
||||
#define AP_POST_READ_REQUEST_DISPATCH_COMPLETE(arg0, arg1)
|
||||
#define AP_POST_READ_REQUEST_DISPATCH_COMPLETE_ENABLED() (0)
|
||||
#define AP_POST_READ_REQUEST_DISPATCH_INVOKE(arg0)
|
||||
#define AP_POST_READ_REQUEST_DISPATCH_INVOKE_ENABLED() (0)
|
||||
#define AP_POST_READ_REQUEST_ENTRY()
|
||||
#define AP_POST_READ_REQUEST_ENTRY_ENABLED() (0)
|
||||
#define AP_POST_READ_REQUEST_RETURN(arg0)
|
||||
#define AP_POST_READ_REQUEST_RETURN_ENABLED() (0)
|
||||
#define AP_POST_REQUEST_DISPATCH_COMPLETE(arg0, arg1)
|
||||
#define AP_POST_REQUEST_DISPATCH_COMPLETE_ENABLED() (0)
|
||||
#define AP_POST_REQUEST_DISPATCH_INVOKE(arg0)
|
||||
#define AP_POST_REQUEST_DISPATCH_INVOKE_ENABLED() (0)
|
||||
#define AP_POST_REQUEST_ENTRY()
|
||||
#define AP_POST_REQUEST_ENTRY_ENABLED() (0)
|
||||
#define AP_POST_REQUEST_RETURN(arg0)
|
||||
#define AP_POST_REQUEST_RETURN_ENABLED() (0)
|
||||
#define AP_PRE_CONFIG_DISPATCH_COMPLETE(arg0, arg1)
|
||||
#define AP_PRE_CONFIG_DISPATCH_COMPLETE_ENABLED() (0)
|
||||
#define AP_PRE_CONFIG_DISPATCH_INVOKE(arg0)
|
||||
#define AP_PRE_CONFIG_DISPATCH_INVOKE_ENABLED() (0)
|
||||
#define AP_PRE_CONFIG_ENTRY()
|
||||
#define AP_PRE_CONFIG_ENTRY_ENABLED() (0)
|
||||
#define AP_PRE_CONFIG_RETURN(arg0)
|
||||
#define AP_PRE_CONFIG_RETURN_ENABLED() (0)
|
||||
#define AP_PRE_CONNECTION_DISPATCH_COMPLETE(arg0, arg1)
|
||||
#define AP_PRE_CONNECTION_DISPATCH_COMPLETE_ENABLED() (0)
|
||||
#define AP_PRE_CONNECTION_DISPATCH_INVOKE(arg0)
|
||||
#define AP_PRE_CONNECTION_DISPATCH_INVOKE_ENABLED() (0)
|
||||
#define AP_PRE_CONNECTION_ENTRY()
|
||||
#define AP_PRE_CONNECTION_ENTRY_ENABLED() (0)
|
||||
#define AP_PRE_CONNECTION_RETURN(arg0)
|
||||
#define AP_PRE_CONNECTION_RETURN_ENABLED() (0)
|
||||
#define AP_PRE_MPM_DISPATCH_COMPLETE(arg0, arg1)
|
||||
#define AP_PRE_MPM_DISPATCH_COMPLETE_ENABLED() (0)
|
||||
#define AP_PRE_MPM_DISPATCH_INVOKE(arg0)
|
||||
#define AP_PRE_MPM_DISPATCH_INVOKE_ENABLED() (0)
|
||||
#define AP_PRE_MPM_ENTRY()
|
||||
#define AP_PRE_MPM_ENTRY_ENABLED() (0)
|
||||
#define AP_PRE_MPM_RETURN(arg0)
|
||||
#define AP_PRE_MPM_RETURN_ENABLED() (0)
|
||||
#define AP_PRE_REQUEST_DISPATCH_COMPLETE(arg0, arg1)
|
||||
#define AP_PRE_REQUEST_DISPATCH_COMPLETE_ENABLED() (0)
|
||||
#define AP_PRE_REQUEST_DISPATCH_INVOKE(arg0)
|
||||
#define AP_PRE_REQUEST_DISPATCH_INVOKE_ENABLED() (0)
|
||||
#define AP_PRE_REQUEST_ENTRY()
|
||||
#define AP_PRE_REQUEST_ENTRY_ENABLED() (0)
|
||||
#define AP_PRE_REQUEST_RETURN(arg0)
|
||||
#define AP_PRE_REQUEST_RETURN_ENABLED() (0)
|
||||
#define AP_PROCESS_REQUEST_ENTRY(arg0, arg1)
|
||||
#define AP_PROCESS_REQUEST_ENTRY_ENABLED() (0)
|
||||
#define AP_PROCESS_REQUEST_RETURN(arg0, arg1, arg2)
|
||||
#define AP_PROCESS_REQUEST_RETURN_ENABLED() (0)
|
||||
#define AP_PROCESS_CONNECTION_DISPATCH_COMPLETE(arg0, arg1)
|
||||
#define AP_PROCESS_CONNECTION_DISPATCH_COMPLETE_ENABLED() (0)
|
||||
#define AP_PROCESS_CONNECTION_DISPATCH_INVOKE(arg0)
|
||||
#define AP_PROCESS_CONNECTION_DISPATCH_INVOKE_ENABLED() (0)
|
||||
#define AP_PROCESS_CONNECTION_ENTRY()
|
||||
#define AP_PROCESS_CONNECTION_ENTRY_ENABLED() (0)
|
||||
#define AP_PROCESS_CONNECTION_RETURN(arg0)
|
||||
#define AP_PROCESS_CONNECTION_RETURN_ENABLED() (0)
|
||||
#define AP_PROXY_RUN(arg0, arg1, arg2, arg3, arg4)
|
||||
#define AP_PROXY_RUN_ENABLED() (0)
|
||||
#define AP_PROXY_RUN_FINISHED(arg0, arg1, arg2)
|
||||
#define AP_PROXY_RUN_FINISHED_ENABLED() (0)
|
||||
#define AP_QUICK_HANDLER_DISPATCH_COMPLETE(arg0, arg1)
|
||||
#define AP_QUICK_HANDLER_DISPATCH_COMPLETE_ENABLED() (0)
|
||||
#define AP_QUICK_HANDLER_DISPATCH_INVOKE(arg0)
|
||||
#define AP_QUICK_HANDLER_DISPATCH_INVOKE_ENABLED() (0)
|
||||
#define AP_QUICK_HANDLER_ENTRY()
|
||||
#define AP_QUICK_HANDLER_ENTRY_ENABLED() (0)
|
||||
#define AP_QUICK_HANDLER_RETURN(arg0)
|
||||
#define AP_QUICK_HANDLER_RETURN_ENABLED() (0)
|
||||
#define AP_READ_REQUEST_ENTRY(arg0, arg1)
|
||||
#define AP_READ_REQUEST_ENTRY_ENABLED() (0)
|
||||
#define AP_READ_REQUEST_FAILURE(arg0)
|
||||
#define AP_READ_REQUEST_FAILURE_ENABLED() (0)
|
||||
#define AP_READ_REQUEST_SUCCESS(arg0, arg1, arg2, arg3, arg4)
|
||||
#define AP_READ_REQUEST_SUCCESS_ENABLED() (0)
|
||||
#define AP_REWRITE_LOG(arg0, arg1, arg2, arg3, arg4)
|
||||
#define AP_REWRITE_LOG_ENABLED() (0)
|
||||
#define AP_SCHEME_HANDLER_DISPATCH_COMPLETE(arg0, arg1)
|
||||
#define AP_SCHEME_HANDLER_DISPATCH_COMPLETE_ENABLED() (0)
|
||||
#define AP_SCHEME_HANDLER_DISPATCH_INVOKE(arg0)
|
||||
#define AP_SCHEME_HANDLER_DISPATCH_INVOKE_ENABLED() (0)
|
||||
#define AP_SCHEME_HANDLER_ENTRY()
|
||||
#define AP_SCHEME_HANDLER_ENTRY_ENABLED() (0)
|
||||
#define AP_SCHEME_HANDLER_RETURN(arg0)
|
||||
#define AP_SCHEME_HANDLER_RETURN_ENABLED() (0)
|
||||
#define AP_TEST_CONFIG_DISPATCH_COMPLETE(arg0, arg1)
|
||||
#define AP_TEST_CONFIG_DISPATCH_COMPLETE_ENABLED() (0)
|
||||
#define AP_TEST_CONFIG_DISPATCH_INVOKE(arg0)
|
||||
#define AP_TEST_CONFIG_DISPATCH_INVOKE_ENABLED() (0)
|
||||
#define AP_TEST_CONFIG_ENTRY()
|
||||
#define AP_TEST_CONFIG_ENTRY_ENABLED() (0)
|
||||
#define AP_TEST_CONFIG_RETURN(arg0)
|
||||
#define AP_TEST_CONFIG_RETURN_ENABLED() (0)
|
||||
#define AP_TRANSLATE_NAME_DISPATCH_COMPLETE(arg0, arg1)
|
||||
#define AP_TRANSLATE_NAME_DISPATCH_COMPLETE_ENABLED() (0)
|
||||
#define AP_TRANSLATE_NAME_DISPATCH_INVOKE(arg0)
|
||||
#define AP_TRANSLATE_NAME_DISPATCH_INVOKE_ENABLED() (0)
|
||||
#define AP_TRANSLATE_NAME_ENTRY()
|
||||
#define AP_TRANSLATE_NAME_ENTRY_ENABLED() (0)
|
||||
#define AP_TRANSLATE_NAME_RETURN(arg0)
|
||||
#define AP_TRANSLATE_NAME_RETURN_ENABLED() (0)
|
||||
#define AP_TYPE_CHECKER_DISPATCH_COMPLETE(arg0, arg1)
|
||||
#define AP_TYPE_CHECKER_DISPATCH_COMPLETE_ENABLED() (0)
|
||||
#define AP_TYPE_CHECKER_DISPATCH_INVOKE(arg0)
|
||||
#define AP_TYPE_CHECKER_DISPATCH_INVOKE_ENABLED() (0)
|
||||
#define AP_TYPE_CHECKER_ENTRY()
|
||||
#define AP_TYPE_CHECKER_ENTRY_ENABLED() (0)
|
||||
#define AP_TYPE_CHECKER_RETURN(arg0)
|
||||
#define AP_TYPE_CHECKER_RETURN_ENABLED() (0)
|
||||
|
||||
#endif
|
||||
|
||||
667
database/apache/include/apr.h
Normal file
667
database/apache/include/apr.h
Normal file
@@ -0,0 +1,667 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef APR_H
|
||||
#define APR_H
|
||||
|
||||
/* GENERATED FILE WARNING! DO NOT EDIT apr.h
|
||||
*
|
||||
* You must modify apr.hw instead.
|
||||
*
|
||||
* And please, make an effort to stub apr.hnw and apr.h.in in the process.
|
||||
*
|
||||
* This is the Win32 specific version of apr.h. It is copied from
|
||||
* apr.hw by the apr.dsp and libapr.dsp projects.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file apr.h
|
||||
* @brief APR Platform Definitions
|
||||
* @remark This is a generated header generated from include/apr.h.in by
|
||||
* ./configure, or copied from include/apr.hw or include/apr.hnw
|
||||
* for Win32 or Netware by those build environments, respectively.
|
||||
*/
|
||||
|
||||
/* Make sure we have our platform identifier macro defined we ask for later.
|
||||
*/
|
||||
#if defined(_WIN32) && !defined(WIN32)
|
||||
#define WIN32 1
|
||||
#endif
|
||||
|
||||
#if defined(WIN32) || defined(DOXYGEN)
|
||||
|
||||
/* Ignore most warnings (back down to /W3) for poorly constructed headers
|
||||
*/
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1200
|
||||
#pragma warning(push, 3)
|
||||
#endif
|
||||
|
||||
/* disable or reduce the frequency of...
|
||||
* C4057: indirection to slightly different base types
|
||||
* C4075: slight indirection changes (unsigned short* vs short[])
|
||||
* C4100: unreferenced formal parameter
|
||||
* C4127: conditional expression is constant
|
||||
* C4163: '_rotl64' : not available as an intrinsic function
|
||||
* C4201: nonstandard extension nameless struct/unions
|
||||
* C4244: int to char/short - precision loss
|
||||
* C4514: unreferenced inline function removed
|
||||
*/
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(disable: 4100 4127 4163 4201 4514; once: 4057 4075 4244)
|
||||
#endif
|
||||
|
||||
/* Ignore Microsoft's interpretation of secure development
|
||||
* and the POSIX string handling API
|
||||
*/
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1400
|
||||
#ifndef _CRT_SECURE_NO_DEPRECATE
|
||||
#define _CRT_SECURE_NO_DEPRECATE
|
||||
#endif
|
||||
#pragma warning(disable: 4996)
|
||||
#endif
|
||||
|
||||
/* Has windows.h already been included? If so, our preferences don't matter,
|
||||
* but we will still need the winsock things no matter what was included.
|
||||
* If not, include a restricted set of windows headers to our tastes.
|
||||
*/
|
||||
#ifndef _WINDOWS_
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#ifndef _WIN32_WINNT
|
||||
|
||||
/* Restrict the server to a subset of Windows XP header files by default
|
||||
*/
|
||||
#define _WIN32_WINNT 0x0600
|
||||
#endif
|
||||
#ifndef NOUSER
|
||||
#define NOUSER
|
||||
#endif
|
||||
#ifndef NOMCX
|
||||
#define NOMCX
|
||||
#endif
|
||||
#ifndef NOIME
|
||||
#define NOIME
|
||||
#endif
|
||||
#include <windows.h>
|
||||
/*
|
||||
* Add a _very_few_ declarations missing from the restricted set of headers
|
||||
* (If this list becomes extensive, re-enable the required headers above!)
|
||||
* winsock headers were excluded by WIN32_LEAN_AND_MEAN, so include them now
|
||||
*/
|
||||
#define SW_HIDE 0
|
||||
#ifndef _WIN32_WCE
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
#include <mswsock.h>
|
||||
#else
|
||||
#include <winsock.h>
|
||||
#endif
|
||||
#endif /* !_WINDOWS_ */
|
||||
|
||||
/**
|
||||
* @defgroup APR Apache Portability Runtime library
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @defgroup apr_platform Platform Definitions
|
||||
* @{
|
||||
* @warning
|
||||
* <strong><em>The actual values of macros and typedefs on this page<br>
|
||||
* are platform specific and should NOT be relied upon!</em></strong>
|
||||
*/
|
||||
|
||||
#define APR_INLINE __inline
|
||||
#define APR_HAS_INLINE 1
|
||||
#if !defined(__GNUC__) && !defined(__attribute__)
|
||||
#define __attribute__(__x)
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32_WCE
|
||||
#define APR_HAVE_ARPA_INET_H 0
|
||||
#define APR_HAVE_CONIO_H 1
|
||||
#define APR_HAVE_CRYPT_H 0
|
||||
#define APR_HAVE_CTYPE_H 1
|
||||
#define APR_HAVE_DIRENT_H 0
|
||||
#define APR_HAVE_ERRNO_H 1
|
||||
#define APR_HAVE_FCNTL_H 1
|
||||
#define APR_HAVE_IO_H 1
|
||||
#define APR_HAVE_LIMITS_H 1
|
||||
#define APR_HAVE_NETDB_H 0
|
||||
#define APR_HAVE_NETINET_IN_H 0
|
||||
#define APR_HAVE_NETINET_SCTP_H 0
|
||||
#define APR_HAVE_NETINET_SCTP_UIO_H 0
|
||||
#define APR_HAVE_NETINET_TCP_H 0
|
||||
#define APR_HAVE_PTHREAD_H 0
|
||||
#define APR_HAVE_SEMAPHORE_H 0
|
||||
#define APR_HAVE_SIGNAL_H 1
|
||||
#define APR_HAVE_STDARG_H 1
|
||||
#define APR_HAVE_STDINT_H 0
|
||||
#define APR_HAVE_STDIO_H 1
|
||||
#define APR_HAVE_STDLIB_H 1
|
||||
#define APR_HAVE_STRING_H 1
|
||||
#define APR_HAVE_STRINGS_H 0
|
||||
#define APR_HAVE_SYS_IOCTL_H 0
|
||||
#define APR_HAVE_SYS_SENDFILE_H 0
|
||||
#define APR_HAVE_SYS_SIGNAL_H 0
|
||||
#define APR_HAVE_SYS_SOCKET_H 0
|
||||
#define APR_HAVE_SYS_SOCKIO_H 0
|
||||
#define APR_HAVE_SYS_SYSLIMITS_H 0
|
||||
#define APR_HAVE_SYS_TIME_H 0
|
||||
#define APR_HAVE_SYS_TYPES_H 1
|
||||
#define APR_HAVE_SYS_UIO_H 0
|
||||
#define APR_HAVE_SYS_UN_H 0
|
||||
#define APR_HAVE_SYS_WAIT_H 0
|
||||
#define APR_HAVE_TIME_H 1
|
||||
#define APR_HAVE_UNISTD_H 0
|
||||
#define APR_HAVE_STDDEF_H 1
|
||||
#define APR_HAVE_PROCESS_H 1
|
||||
#else
|
||||
#define APR_HAVE_ARPA_INET_H 0
|
||||
#define APR_HAVE_CONIO_H 0
|
||||
#define APR_HAVE_CRYPT_H 0
|
||||
#define APR_HAVE_CTYPE_H 0
|
||||
#define APR_HAVE_DIRENT_H 0
|
||||
#define APR_HAVE_ERRNO_H 0
|
||||
#define APR_HAVE_FCNTL_H 0
|
||||
#define APR_HAVE_IO_H 0
|
||||
#define APR_HAVE_LIMITS_H 0
|
||||
#define APR_HAVE_NETDB_H 0
|
||||
#define APR_HAVE_NETINET_IN_H 0
|
||||
#define APR_HAVE_NETINET_SCTP_H 0
|
||||
#define APR_HAVE_NETINET_SCTP_UIO_H 0
|
||||
#define APR_HAVE_NETINET_TCP_H 0
|
||||
#define APR_HAVE_PTHREAD_H 0
|
||||
#define APR_HAVE_SEMAPHORE_H 0
|
||||
#define APR_HAVE_SIGNAL_H 0
|
||||
#define APR_HAVE_STDARG_H 0
|
||||
#define APR_HAVE_STDINT_H 0
|
||||
#define APR_HAVE_STDIO_H 1
|
||||
#define APR_HAVE_STDLIB_H 1
|
||||
#define APR_HAVE_STRING_H 1
|
||||
#define APR_HAVE_STRINGS_H 0
|
||||
#define APR_HAVE_SYS_IOCTL_H 0
|
||||
#define APR_HAVE_SYS_SENDFILE_H 0
|
||||
#define APR_HAVE_SYS_SIGNAL_H 0
|
||||
#define APR_HAVE_SYS_SOCKET_H 0
|
||||
#define APR_HAVE_SYS_SOCKIO_H 0
|
||||
#define APR_HAVE_SYS_SYSLIMITS_H 0
|
||||
#define APR_HAVE_SYS_TIME_H 0
|
||||
#define APR_HAVE_SYS_TYPES_H 0
|
||||
#define APR_HAVE_SYS_UIO_H 0
|
||||
#define APR_HAVE_SYS_UN_H 0
|
||||
#define APR_HAVE_SYS_WAIT_H 0
|
||||
#define APR_HAVE_TIME_H 0
|
||||
#define APR_HAVE_UNISTD_H 0
|
||||
#define APR_HAVE_STDDEF_H 0
|
||||
#define APR_HAVE_PROCESS_H 0
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
/** @} */
|
||||
|
||||
/* We don't include our conditional headers within the doxyblocks
|
||||
* or the extern "C" namespace
|
||||
*/
|
||||
|
||||
#if APR_HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#if APR_HAVE_STDIO_H
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#if APR_HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#if APR_HAVE_STDDEF_H
|
||||
#include <stddef.h>
|
||||
#endif
|
||||
|
||||
#if APR_HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
|
||||
#if APR_HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
#if APR_HAVE_SYS_WAIT_H
|
||||
#include <sys/wait.h>
|
||||
#endif
|
||||
|
||||
#if APR_HAVE_TIME_H
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
#if APR_HAVE_PROCESS_H
|
||||
#include <process.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @addtogroup apr_platform
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define APR_HAVE_SHMEM_MMAP_TMP 0
|
||||
#define APR_HAVE_SHMEM_MMAP_SHM 0
|
||||
#define APR_HAVE_SHMEM_MMAP_ZERO 0
|
||||
#define APR_HAVE_SHMEM_SHMGET_ANON 0
|
||||
#define APR_HAVE_SHMEM_SHMGET 0
|
||||
#define APR_HAVE_SHMEM_MMAP_ANON 0
|
||||
#define APR_HAVE_SHMEM_BEOS 0
|
||||
|
||||
#define APR_USE_SHMEM_MMAP_TMP 0
|
||||
#define APR_USE_SHMEM_MMAP_SHM 0
|
||||
#define APR_USE_SHMEM_MMAP_ZERO 0
|
||||
#define APR_USE_SHMEM_SHMGET_ANON 0
|
||||
#define APR_USE_SHMEM_SHMGET 0
|
||||
#define APR_USE_SHMEM_MMAP_ANON 0
|
||||
#define APR_USE_SHMEM_BEOS 0
|
||||
|
||||
#define APR_USE_FLOCK_SERIALIZE 0
|
||||
#define APR_USE_POSIXSEM_SERIALIZE 0
|
||||
#define APR_USE_SYSVSEM_SERIALIZE 0
|
||||
#define APR_USE_FCNTL_SERIALIZE 0
|
||||
#define APR_USE_PROC_PTHREAD_SERIALIZE 0
|
||||
#define APR_USE_PTHREAD_SERIALIZE 0
|
||||
|
||||
#define APR_HAS_FLOCK_SERIALIZE 0
|
||||
#define APR_HAS_SYSVSEM_SERIALIZE 0
|
||||
#define APR_HAS_POSIXSEM_SERIALIZE 0
|
||||
#define APR_HAS_FCNTL_SERIALIZE 0
|
||||
#define APR_HAS_PROC_PTHREAD_SERIALIZE 0
|
||||
|
||||
#define APR_PROCESS_LOCK_IS_GLOBAL 0
|
||||
|
||||
#define APR_HAVE_CORKABLE_TCP 0
|
||||
#define APR_HAVE_GETRLIMIT 0
|
||||
#define APR_HAVE_ICONV 0
|
||||
#define APR_HAVE_IN_ADDR 1
|
||||
#define APR_HAVE_INET_ADDR 1
|
||||
#define APR_HAVE_INET_NETWORK 0
|
||||
#define APR_HAVE_IPV6 1
|
||||
#define APR_HAVE_SOCKADDR_UN 0
|
||||
#define APR_HAVE_MEMMOVE 1
|
||||
#define APR_HAVE_SETRLIMIT 0
|
||||
#define APR_HAVE_SIGACTION 0
|
||||
#define APR_HAVE_SIGSUSPEND 0
|
||||
#define APR_HAVE_SIGWAIT 0
|
||||
#define APR_HAVE_SA_STORAGE 0
|
||||
#define APR_HAVE_STRCASECMP 0
|
||||
#define APR_HAVE_STRDUP 1
|
||||
#define APR_HAVE_STRNCASECMP 0
|
||||
#define APR_HAVE_STRSTR 1
|
||||
#define APR_HAVE_MEMCHR 1
|
||||
#define APR_HAVE_STRUCT_RLIMIT 0
|
||||
#define APR_HAVE_UNION_SEMUN 0
|
||||
#define APR_HAVE_SCTP 0
|
||||
#define APR_HAVE_IOVEC 0
|
||||
|
||||
#ifndef _WIN32_WCE
|
||||
#define APR_HAVE_STRICMP 1
|
||||
#define APR_HAVE_STRNICMP 1
|
||||
#else
|
||||
#define APR_HAVE_STRICMP 0
|
||||
#define APR_HAVE_STRNICMP 0
|
||||
#endif
|
||||
|
||||
/* APR Feature Macros */
|
||||
#define APR_HAS_SHARED_MEMORY 1
|
||||
#define APR_HAS_THREADS 1
|
||||
#define APR_HAS_MMAP 1
|
||||
#define APR_HAS_FORK 0
|
||||
#define APR_HAS_RANDOM 1
|
||||
#define APR_HAS_OTHER_CHILD 1
|
||||
#define APR_HAS_DSO 1
|
||||
#define APR_HAS_SO_ACCEPTFILTER 0
|
||||
#define APR_HAS_UNICODE_FS 1
|
||||
#define APR_HAS_PROC_INVOKED 1
|
||||
#define APR_HAS_OS_UUID 1
|
||||
#define APR_HAS_TIMEDLOCKS 1
|
||||
|
||||
#ifndef _WIN32_WCE
|
||||
#define APR_HAS_SENDFILE 1
|
||||
#define APR_HAS_USER 1
|
||||
#define APR_HAS_LARGE_FILES 1
|
||||
#define APR_HAS_XTHREAD_FILES 1
|
||||
#define APR_PROCATTR_USER_SET_REQUIRES_PASSWORD 1
|
||||
#else
|
||||
#define APR_HAS_SENDFILE 0
|
||||
#define APR_HAS_USER 0
|
||||
#define APR_HAS_LARGE_FILES 0
|
||||
#define APR_HAS_XTHREAD_FILES 0
|
||||
#define APR_PROCATTR_USER_SET_REQUIRES_PASSWORD 0
|
||||
#endif
|
||||
|
||||
/* APR sets APR_FILES_AS_SOCKETS to 1 on systems where it is possible
|
||||
* to poll on files/pipes.
|
||||
*/
|
||||
#define APR_FILES_AS_SOCKETS 0
|
||||
|
||||
/* This macro indicates whether or not EBCDIC is the native character set.
|
||||
*/
|
||||
#define APR_CHARSET_EBCDIC 0
|
||||
|
||||
/* If we have a TCP implementation that can be "corked", what flag
|
||||
* do we use?
|
||||
*/
|
||||
#define APR_TCP_NOPUSH_FLAG 0
|
||||
|
||||
/* Is the TCP_NODELAY socket option inherited from listening sockets?
|
||||
*/
|
||||
#define APR_TCP_NODELAY_INHERITED 1
|
||||
|
||||
/* Is the O_NONBLOCK flag inherited from listening sockets?
|
||||
*/
|
||||
#define APR_O_NONBLOCK_INHERITED 1
|
||||
|
||||
/* Typedefs that APR needs. */
|
||||
|
||||
typedef unsigned char apr_byte_t;
|
||||
|
||||
typedef short apr_int16_t;
|
||||
typedef unsigned short apr_uint16_t;
|
||||
|
||||
typedef int apr_int32_t;
|
||||
typedef unsigned int apr_uint32_t;
|
||||
|
||||
typedef __int64 apr_int64_t;
|
||||
typedef unsigned __int64 apr_uint64_t;
|
||||
|
||||
typedef size_t apr_size_t;
|
||||
#if APR_HAVE_STDDEF_H
|
||||
typedef ptrdiff_t apr_ssize_t;
|
||||
#else
|
||||
typedef int apr_ssize_t;
|
||||
#endif
|
||||
#if APR_HAS_LARGE_FILES
|
||||
typedef __int64 apr_off_t;
|
||||
#else
|
||||
typedef int apr_off_t;
|
||||
#endif
|
||||
typedef int apr_socklen_t;
|
||||
typedef apr_uint64_t apr_ino_t;
|
||||
|
||||
#ifdef _WIN64
|
||||
#define APR_SIZEOF_VOIDP 8
|
||||
#else
|
||||
#define APR_SIZEOF_VOIDP 4
|
||||
#endif
|
||||
|
||||
#if APR_SIZEOF_VOIDP == 8
|
||||
typedef apr_uint64_t apr_uintptr_t;
|
||||
#else
|
||||
typedef apr_uint32_t apr_uintptr_t;
|
||||
#endif
|
||||
|
||||
/* Are we big endian? */
|
||||
/* XXX: Fatal assumption on Alpha platforms */
|
||||
#define APR_IS_BIGENDIAN 0
|
||||
|
||||
/* Mechanisms to properly type numeric literals */
|
||||
|
||||
#ifndef __GNUC__
|
||||
#define APR_INT64_C(val) (val##i64)
|
||||
#define APR_UINT64_C(val) (val##Ui64)
|
||||
#else
|
||||
#define APR_INT64_C(val) (val##LL)
|
||||
#define APR_UINT64_C(val) (val##ULL)
|
||||
#endif
|
||||
|
||||
#ifdef INT16_MIN
|
||||
#define APR_INT16_MIN INT16_MIN
|
||||
#else
|
||||
#define APR_INT16_MIN (-0x7fff - 1)
|
||||
#endif
|
||||
|
||||
#ifdef INT16_MAX
|
||||
#define APR_INT16_MAX INT16_MAX
|
||||
#else
|
||||
#define APR_INT16_MAX (0x7fff)
|
||||
#endif
|
||||
|
||||
#ifdef UINT16_MAX
|
||||
#define APR_UINT16_MAX UINT16_MAX
|
||||
#else
|
||||
#define APR_UINT16_MAX (0xffff)
|
||||
#endif
|
||||
|
||||
#ifdef INT32_MIN
|
||||
#define APR_INT32_MIN INT32_MIN
|
||||
#else
|
||||
#define APR_INT32_MIN (-0x7fffffff - 1)
|
||||
#endif
|
||||
|
||||
#ifdef INT32_MAX
|
||||
#define APR_INT32_MAX INT32_MAX
|
||||
#else
|
||||
#define APR_INT32_MAX 0x7fffffff
|
||||
#endif
|
||||
|
||||
#ifdef UINT32_MAX
|
||||
#define APR_UINT32_MAX UINT32_MAX
|
||||
#else
|
||||
#define APR_UINT32_MAX (0xffffffffU)
|
||||
#endif
|
||||
|
||||
#ifdef INT64_MIN
|
||||
#define APR_INT64_MIN INT64_MIN
|
||||
#else
|
||||
#define APR_INT64_MIN (APR_INT64_C(-0x7fffffffffffffff) - 1)
|
||||
#endif
|
||||
|
||||
#ifdef INT64_MAX
|
||||
#define APR_INT64_MAX INT64_MAX
|
||||
#else
|
||||
#define APR_INT64_MAX APR_INT64_C(0x7fffffffffffffff)
|
||||
#endif
|
||||
|
||||
#ifdef UINT64_MAX
|
||||
#define APR_UINT64_MAX UINT64_MAX
|
||||
#else
|
||||
#define APR_UINT64_MAX APR_UINT64_C(0xffffffffffffffff)
|
||||
#endif
|
||||
|
||||
#define APR_SIZE_MAX (~((apr_size_t)0))
|
||||
|
||||
/* Definitions that APR programs need to work properly. */
|
||||
|
||||
/**
|
||||
* APR public API wrap for C++ compilers.
|
||||
*/
|
||||
#ifdef __cplusplus
|
||||
#define APR_BEGIN_DECLS extern "C" {
|
||||
#define APR_END_DECLS }
|
||||
#else
|
||||
#define APR_BEGIN_DECLS
|
||||
#define APR_END_DECLS
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Thread callbacks from APR functions must be declared with APR_THREAD_FUNC,
|
||||
* so that they follow the platform's calling convention.
|
||||
* <PRE>
|
||||
*
|
||||
* void* APR_THREAD_FUNC my_thread_entry_fn(apr_thread_t *thd, void *data);
|
||||
*
|
||||
* </PRE>
|
||||
*/
|
||||
#define APR_THREAD_FUNC __stdcall
|
||||
|
||||
|
||||
#if defined(DOXYGEN) || !defined(WIN32)
|
||||
|
||||
/**
|
||||
* The public APR functions are declared with APR_DECLARE(), so they may
|
||||
* use the most appropriate calling convention. Public APR functions with
|
||||
* variable arguments must use APR_DECLARE_NONSTD().
|
||||
*
|
||||
* @remark Both the declaration and implementations must use the same macro.
|
||||
*
|
||||
* <PRE>
|
||||
* APR_DECLARE(rettype) apr_func(args)
|
||||
* </PRE>
|
||||
* @see APR_DECLARE_NONSTD @see APR_DECLARE_DATA
|
||||
* @remark Note that when APR compiles the library itself, it passes the
|
||||
* symbol -DAPR_DECLARE_EXPORT to the compiler on some platforms (e.g. Win32)
|
||||
* to export public symbols from the dynamic library build.\n
|
||||
* The user must define the APR_DECLARE_STATIC when compiling to target
|
||||
* the static APR library on some platforms (e.g. Win32.) The public symbols
|
||||
* are neither exported nor imported when APR_DECLARE_STATIC is defined.\n
|
||||
* By default, compiling an application and including the APR public
|
||||
* headers, without defining APR_DECLARE_STATIC, will prepare the code to be
|
||||
* linked to the dynamic library.
|
||||
*/
|
||||
#define APR_DECLARE(type) type
|
||||
|
||||
/**
|
||||
* The public APR functions using variable arguments are declared with
|
||||
* APR_DECLARE_NONSTD(), as they must follow the C language calling convention.
|
||||
* @see APR_DECLARE @see APR_DECLARE_DATA
|
||||
* @remark Both the declaration and implementations must use the same macro.
|
||||
* <PRE>
|
||||
*
|
||||
* APR_DECLARE_NONSTD(rettype) apr_func(args, ...);
|
||||
*
|
||||
* </PRE>
|
||||
*/
|
||||
#define APR_DECLARE_NONSTD(type) type
|
||||
|
||||
/**
|
||||
* The public APR variables are declared with AP_MODULE_DECLARE_DATA.
|
||||
* This assures the appropriate indirection is invoked at compile time.
|
||||
* @see APR_DECLARE @see APR_DECLARE_NONSTD
|
||||
* @remark Note that the declaration and implementations use different forms,
|
||||
* but both must include the macro.
|
||||
*
|
||||
* <PRE>
|
||||
*
|
||||
* extern APR_DECLARE_DATA type apr_variable;\n
|
||||
* APR_DECLARE_DATA type apr_variable = value;
|
||||
*
|
||||
* </PRE>
|
||||
*/
|
||||
#define APR_DECLARE_DATA
|
||||
|
||||
#elif defined(APR_DECLARE_STATIC)
|
||||
#define APR_DECLARE(type) type __stdcall
|
||||
#define APR_DECLARE_NONSTD(type) type __cdecl
|
||||
#define APR_DECLARE_DATA
|
||||
#elif defined(APR_DECLARE_EXPORT)
|
||||
#define APR_DECLARE(type) __declspec(dllexport) type __stdcall
|
||||
#define APR_DECLARE_NONSTD(type) __declspec(dllexport) type __cdecl
|
||||
#define APR_DECLARE_DATA __declspec(dllexport)
|
||||
#else
|
||||
#define APR_DECLARE(type) __declspec(dllimport) type __stdcall
|
||||
#define APR_DECLARE_NONSTD(type) __declspec(dllimport) type __cdecl
|
||||
#define APR_DECLARE_DATA __declspec(dllimport)
|
||||
#endif
|
||||
|
||||
#ifdef _WIN64
|
||||
#define APR_SSIZE_T_FMT "I64d"
|
||||
#define APR_SIZE_T_FMT "I64u"
|
||||
#else
|
||||
#define APR_SSIZE_T_FMT "d"
|
||||
#define APR_SIZE_T_FMT "u"
|
||||
#endif
|
||||
|
||||
#if APR_HAS_LARGE_FILES
|
||||
#define APR_OFF_T_FMT "I64d"
|
||||
#else
|
||||
#define APR_OFF_T_FMT "d"
|
||||
#endif
|
||||
|
||||
#define APR_PID_T_FMT "d"
|
||||
|
||||
#define APR_INT64_T_FMT "I64d"
|
||||
#define APR_UINT64_T_FMT "I64u"
|
||||
#define APR_UINT64_T_HEX_FMT "I64x"
|
||||
|
||||
/* No difference between PROC and GLOBAL mutex */
|
||||
#define APR_PROC_MUTEX_IS_GLOBAL 1
|
||||
|
||||
/* Local machine definition for console and log output. */
|
||||
#define APR_EOL_STR "\r\n"
|
||||
|
||||
typedef int apr_wait_t;
|
||||
|
||||
#if APR_HAS_UNICODE_FS
|
||||
/* An arbitrary size that is digestable. True max is a bit less than 32000 */
|
||||
#define APR_PATH_MAX 8192
|
||||
#else /* !APR_HAS_UNICODE_FS */
|
||||
#define APR_PATH_MAX MAX_PATH
|
||||
#endif
|
||||
|
||||
#define APR_DSOPATH "PATH"
|
||||
|
||||
/** @} */
|
||||
|
||||
/* Definitions that only Win32 programs need to compile properly. */
|
||||
|
||||
/* XXX These simply don't belong here, perhaps in apr_portable.h
|
||||
* based on some APR_HAVE_PID/GID/UID?
|
||||
*/
|
||||
#ifndef __GNUC__
|
||||
typedef int pid_t;
|
||||
#endif
|
||||
typedef int uid_t;
|
||||
typedef int gid_t;
|
||||
|
||||
/* Win32 .h ommissions we really need */
|
||||
#define STDIN_FILENO 0
|
||||
#define STDOUT_FILENO 1
|
||||
#define STDERR_FILENO 2
|
||||
|
||||
#if APR_HAVE_IPV6
|
||||
|
||||
/* Appears in later flavors, not the originals. */
|
||||
#ifndef in_addr6
|
||||
#define in6_addr in_addr6
|
||||
#endif
|
||||
|
||||
#ifndef WS2TCPIP_INLINE
|
||||
#define IN6_IS_ADDR_V4MAPPED(a) \
|
||||
( (*(const apr_uint64_t *)(const void *)(&(a)->s6_addr[0]) == 0) \
|
||||
&& (*(const apr_uint32_t *)(const void *)(&(a)->s6_addr[8]) == ntohl(0x0000ffff)))
|
||||
#endif
|
||||
|
||||
#endif /* APR_HAVE_IPV6 */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Done with badly written headers, leave 'deprecated CRT' undeprecated
|
||||
*/
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1200
|
||||
#pragma warning(pop)
|
||||
#if _MSC_VER >= 1400
|
||||
#pragma warning(disable: 4996)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* WIN32 */
|
||||
|
||||
#endif /* APR_H */
|
||||
179
database/apache/include/apr_allocator.h
Normal file
179
database/apache/include/apr_allocator.h
Normal file
@@ -0,0 +1,179 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_ALLOCATOR_H
|
||||
#define APR_ALLOCATOR_H
|
||||
|
||||
/**
|
||||
* @file apr_allocator.h
|
||||
* @brief APR Internal Memory Allocation
|
||||
*/
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_errno.h"
|
||||
#define APR_WANT_MEMFUNC /**< For no good reason? */
|
||||
#include "apr_want.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup apr_allocator Internal Memory Allocation
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** the allocator structure */
|
||||
typedef struct apr_allocator_t apr_allocator_t;
|
||||
/** the structure which holds information about the allocation */
|
||||
typedef struct apr_memnode_t apr_memnode_t;
|
||||
|
||||
/** basic memory node structure
|
||||
* @note The next, ref and first_avail fields are available for use by the
|
||||
* caller of apr_allocator_alloc(), the remaining fields are read-only.
|
||||
* The next field has to be used with caution and sensibly set when the
|
||||
* memnode is passed back to apr_allocator_free(). See apr_allocator_free()
|
||||
* for details.
|
||||
* The ref and first_avail fields will be properly restored by
|
||||
* apr_allocator_free().
|
||||
*/
|
||||
struct apr_memnode_t {
|
||||
apr_memnode_t *next; /**< next memnode */
|
||||
apr_memnode_t **ref; /**< reference to self */
|
||||
apr_uint32_t index; /**< size */
|
||||
apr_uint32_t free_index; /**< how much free */
|
||||
char *first_avail; /**< pointer to first free memory */
|
||||
char *endp; /**< pointer to end of free memory */
|
||||
};
|
||||
|
||||
/** The base size of a memory node - aligned. */
|
||||
#define APR_MEMNODE_T_SIZE APR_ALIGN_DEFAULT(sizeof(apr_memnode_t))
|
||||
|
||||
/** Symbolic constants */
|
||||
#define APR_ALLOCATOR_MAX_FREE_UNLIMITED 0
|
||||
|
||||
/**
|
||||
* Create a new allocator
|
||||
* @param allocator The allocator we have just created.
|
||||
*
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_allocator_create(apr_allocator_t **allocator)
|
||||
__attribute__((nonnull(1)));
|
||||
|
||||
/**
|
||||
* Destroy an allocator
|
||||
* @param allocator The allocator to be destroyed
|
||||
* @remark Any memnodes not given back to the allocator prior to destroying
|
||||
* will _not_ be free()d.
|
||||
*/
|
||||
APR_DECLARE(void) apr_allocator_destroy(apr_allocator_t *allocator)
|
||||
__attribute__((nonnull(1)));
|
||||
|
||||
/**
|
||||
* Allocate a block of mem from the allocator
|
||||
* @param allocator The allocator to allocate from
|
||||
* @param size The size of the mem to allocate (excluding the
|
||||
* memnode structure)
|
||||
*/
|
||||
APR_DECLARE(apr_memnode_t *) apr_allocator_alloc(apr_allocator_t *allocator,
|
||||
apr_size_t size)
|
||||
__attribute__((nonnull(1)));
|
||||
|
||||
/**
|
||||
* Free a list of blocks of mem, giving them back to the allocator.
|
||||
* The list is typically terminated by a memnode with its next field
|
||||
* set to NULL.
|
||||
* @param allocator The allocator to give the mem back to
|
||||
* @param memnode The memory node to return
|
||||
*/
|
||||
APR_DECLARE(void) apr_allocator_free(apr_allocator_t *allocator,
|
||||
apr_memnode_t *memnode)
|
||||
__attribute__((nonnull(1,2)));
|
||||
|
||||
/**
|
||||
* Get the true size that would be allocated for the given size (including
|
||||
* the header and alignment).
|
||||
* @param allocator The allocator from which to the memory would be allocated
|
||||
* @param size The size to align
|
||||
* @return The aligned size (or zero on apr_size_t overflow)
|
||||
*/
|
||||
APR_DECLARE(apr_size_t) apr_allocator_align(apr_allocator_t *allocator,
|
||||
apr_size_t size);
|
||||
|
||||
#include "apr_pools.h"
|
||||
|
||||
/**
|
||||
* Set the owner of the allocator
|
||||
* @param allocator The allocator to set the owner for
|
||||
* @param pool The pool that is to own the allocator
|
||||
* @remark Typically pool is the highest level pool using the allocator
|
||||
*/
|
||||
/*
|
||||
* XXX: see if we can come up with something a bit better. Currently
|
||||
* you can make a pool an owner, but if the pool doesn't use the allocator
|
||||
* the allocator will never be destroyed.
|
||||
*/
|
||||
APR_DECLARE(void) apr_allocator_owner_set(apr_allocator_t *allocator,
|
||||
apr_pool_t *pool)
|
||||
__attribute__((nonnull(1)));
|
||||
|
||||
/**
|
||||
* Get the current owner of the allocator
|
||||
* @param allocator The allocator to get the owner from
|
||||
*/
|
||||
APR_DECLARE(apr_pool_t *) apr_allocator_owner_get(apr_allocator_t *allocator)
|
||||
__attribute__((nonnull(1)));
|
||||
|
||||
/**
|
||||
* Set the current threshold at which the allocator should start
|
||||
* giving blocks back to the system.
|
||||
* @param allocator The allocator to set the threshold on
|
||||
* @param size The threshold. 0 == unlimited.
|
||||
*/
|
||||
APR_DECLARE(void) apr_allocator_max_free_set(apr_allocator_t *allocator,
|
||||
apr_size_t size)
|
||||
__attribute__((nonnull(1)));
|
||||
|
||||
#include "apr_thread_mutex.h"
|
||||
|
||||
#if APR_HAS_THREADS
|
||||
/**
|
||||
* Set a mutex for the allocator to use
|
||||
* @param allocator The allocator to set the mutex for
|
||||
* @param mutex The mutex
|
||||
*/
|
||||
APR_DECLARE(void) apr_allocator_mutex_set(apr_allocator_t *allocator,
|
||||
apr_thread_mutex_t *mutex)
|
||||
__attribute__((nonnull(1)));
|
||||
|
||||
/**
|
||||
* Get the mutex currently set for the allocator
|
||||
* @param allocator The allocator
|
||||
*/
|
||||
APR_DECLARE(apr_thread_mutex_t *) apr_allocator_mutex_get(
|
||||
apr_allocator_t *allocator)
|
||||
__attribute__((nonnull(1)));
|
||||
|
||||
#endif /* APR_HAS_THREADS */
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !APR_ALLOCATOR_H */
|
||||
128
database/apache/include/apr_anylock.h
Normal file
128
database/apache/include/apr_anylock.h
Normal file
@@ -0,0 +1,128 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file apr_anylock.h
|
||||
* @brief APR-Util transparent any lock flavor wrapper
|
||||
*/
|
||||
#ifndef APR_ANYLOCK_H
|
||||
#define APR_ANYLOCK_H
|
||||
|
||||
#include "apr_proc_mutex.h"
|
||||
#include "apr_thread_mutex.h"
|
||||
#include "apr_thread_rwlock.h"
|
||||
|
||||
/** Structure that may contain any APR lock type */
|
||||
typedef struct apr_anylock_t {
|
||||
/** Indicates what type of lock is in lock */
|
||||
enum tm_lock {
|
||||
apr_anylock_none, /**< None */
|
||||
apr_anylock_procmutex, /**< Process-based */
|
||||
apr_anylock_threadmutex, /**< Thread-based */
|
||||
apr_anylock_readlock, /**< Read lock */
|
||||
apr_anylock_writelock /**< Write lock */
|
||||
} type;
|
||||
/** Union of all possible APR locks */
|
||||
union apr_anylock_u_t {
|
||||
apr_proc_mutex_t *pm; /**< Process mutex */
|
||||
#if APR_HAS_THREADS
|
||||
apr_thread_mutex_t *tm; /**< Thread mutex */
|
||||
apr_thread_rwlock_t *rw; /**< Read-write lock */
|
||||
#endif
|
||||
} lock;
|
||||
} apr_anylock_t;
|
||||
|
||||
#if APR_HAS_THREADS
|
||||
|
||||
/** Lock an apr_anylock_t structure */
|
||||
#define APR_ANYLOCK_LOCK(lck) \
|
||||
(((lck)->type == apr_anylock_none) \
|
||||
? APR_SUCCESS \
|
||||
: (((lck)->type == apr_anylock_threadmutex) \
|
||||
? apr_thread_mutex_lock((lck)->lock.tm) \
|
||||
: (((lck)->type == apr_anylock_procmutex) \
|
||||
? apr_proc_mutex_lock((lck)->lock.pm) \
|
||||
: (((lck)->type == apr_anylock_readlock) \
|
||||
? apr_thread_rwlock_rdlock((lck)->lock.rw) \
|
||||
: (((lck)->type == apr_anylock_writelock) \
|
||||
? apr_thread_rwlock_wrlock((lck)->lock.rw) \
|
||||
: APR_EINVAL)))))
|
||||
|
||||
#else /* APR_HAS_THREADS */
|
||||
|
||||
#define APR_ANYLOCK_LOCK(lck) \
|
||||
(((lck)->type == apr_anylock_none) \
|
||||
? APR_SUCCESS \
|
||||
: (((lck)->type == apr_anylock_procmutex) \
|
||||
? apr_proc_mutex_lock((lck)->lock.pm) \
|
||||
: APR_EINVAL))
|
||||
|
||||
#endif /* APR_HAS_THREADS */
|
||||
|
||||
#if APR_HAS_THREADS
|
||||
|
||||
/** Try to lock an apr_anylock_t structure */
|
||||
#define APR_ANYLOCK_TRYLOCK(lck) \
|
||||
(((lck)->type == apr_anylock_none) \
|
||||
? APR_SUCCESS \
|
||||
: (((lck)->type == apr_anylock_threadmutex) \
|
||||
? apr_thread_mutex_trylock((lck)->lock.tm) \
|
||||
: (((lck)->type == apr_anylock_procmutex) \
|
||||
? apr_proc_mutex_trylock((lck)->lock.pm) \
|
||||
: (((lck)->type == apr_anylock_readlock) \
|
||||
? apr_thread_rwlock_tryrdlock((lck)->lock.rw) \
|
||||
: (((lck)->type == apr_anylock_writelock) \
|
||||
? apr_thread_rwlock_trywrlock((lck)->lock.rw) \
|
||||
: APR_EINVAL)))))
|
||||
|
||||
#else /* APR_HAS_THREADS */
|
||||
|
||||
#define APR_ANYLOCK_TRYLOCK(lck) \
|
||||
(((lck)->type == apr_anylock_none) \
|
||||
? APR_SUCCESS \
|
||||
: (((lck)->type == apr_anylock_procmutex) \
|
||||
? apr_proc_mutex_trylock((lck)->lock.pm) \
|
||||
: APR_EINVAL))
|
||||
|
||||
#endif /* APR_HAS_THREADS */
|
||||
|
||||
#if APR_HAS_THREADS
|
||||
|
||||
/** Unlock an apr_anylock_t structure */
|
||||
#define APR_ANYLOCK_UNLOCK(lck) \
|
||||
(((lck)->type == apr_anylock_none) \
|
||||
? APR_SUCCESS \
|
||||
: (((lck)->type == apr_anylock_threadmutex) \
|
||||
? apr_thread_mutex_unlock((lck)->lock.tm) \
|
||||
: (((lck)->type == apr_anylock_procmutex) \
|
||||
? apr_proc_mutex_unlock((lck)->lock.pm) \
|
||||
: ((((lck)->type == apr_anylock_readlock) || \
|
||||
((lck)->type == apr_anylock_writelock)) \
|
||||
? apr_thread_rwlock_unlock((lck)->lock.rw) \
|
||||
: APR_EINVAL))))
|
||||
|
||||
#else /* APR_HAS_THREADS */
|
||||
|
||||
#define APR_ANYLOCK_UNLOCK(lck) \
|
||||
(((lck)->type == apr_anylock_none) \
|
||||
? APR_SUCCESS \
|
||||
: (((lck)->type == apr_anylock_procmutex) \
|
||||
? apr_proc_mutex_unlock((lck)->lock.pm) \
|
||||
: APR_EINVAL))
|
||||
|
||||
#endif /* APR_HAS_THREADS */
|
||||
|
||||
#endif /* !APR_ANYLOCK_H */
|
||||
207
database/apache/include/apr_atomic.h
Normal file
207
database/apache/include/apr_atomic.h
Normal file
@@ -0,0 +1,207 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_ATOMIC_H
|
||||
#define APR_ATOMIC_H
|
||||
|
||||
/**
|
||||
* @file apr_atomic.h
|
||||
* @brief APR Atomic Operations
|
||||
*/
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_pools.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup apr_atomic Atomic Operations
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* this function is required on some platforms to initialize the
|
||||
* atomic operation's internal structures
|
||||
* @param p pool
|
||||
* @return APR_SUCCESS on successful completion
|
||||
* @remark Programs do NOT need to call this directly. APR will call this
|
||||
* automatically from apr_initialize().
|
||||
* @internal
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_atomic_init(apr_pool_t *p);
|
||||
|
||||
/*
|
||||
* Atomic operations on 32-bit values
|
||||
* Note: Each of these functions internally implements a memory barrier
|
||||
* on platforms that require it
|
||||
*/
|
||||
|
||||
/**
|
||||
* atomically read an apr_uint32_t from memory
|
||||
* @param mem the pointer
|
||||
*/
|
||||
APR_DECLARE(apr_uint32_t) apr_atomic_read32(volatile apr_uint32_t *mem);
|
||||
|
||||
/**
|
||||
* atomically set an apr_uint32_t in memory
|
||||
* @param mem pointer to the object
|
||||
* @param val value that the object will assume
|
||||
*/
|
||||
APR_DECLARE(void) apr_atomic_set32(volatile apr_uint32_t *mem, apr_uint32_t val);
|
||||
|
||||
/**
|
||||
* atomically add 'val' to an apr_uint32_t
|
||||
* @param mem pointer to the object
|
||||
* @param val amount to add
|
||||
* @return old value pointed to by mem
|
||||
*/
|
||||
APR_DECLARE(apr_uint32_t) apr_atomic_add32(volatile apr_uint32_t *mem, apr_uint32_t val);
|
||||
|
||||
/**
|
||||
* atomically subtract 'val' from an apr_uint32_t
|
||||
* @param mem pointer to the object
|
||||
* @param val amount to subtract
|
||||
*/
|
||||
APR_DECLARE(void) apr_atomic_sub32(volatile apr_uint32_t *mem, apr_uint32_t val);
|
||||
|
||||
/**
|
||||
* atomically increment an apr_uint32_t by 1
|
||||
* @param mem pointer to the object
|
||||
* @return old value pointed to by mem
|
||||
*/
|
||||
APR_DECLARE(apr_uint32_t) apr_atomic_inc32(volatile apr_uint32_t *mem);
|
||||
|
||||
/**
|
||||
* atomically decrement an apr_uint32_t by 1
|
||||
* @param mem pointer to the atomic value
|
||||
* @return zero if the value becomes zero on decrement, otherwise non-zero
|
||||
*/
|
||||
APR_DECLARE(int) apr_atomic_dec32(volatile apr_uint32_t *mem);
|
||||
|
||||
/**
|
||||
* compare an apr_uint32_t's value with 'cmp'.
|
||||
* If they are the same swap the value with 'with'
|
||||
* @param mem pointer to the value
|
||||
* @param with what to swap it with
|
||||
* @param cmp the value to compare it to
|
||||
* @return the old value of *mem
|
||||
*/
|
||||
APR_DECLARE(apr_uint32_t) apr_atomic_cas32(volatile apr_uint32_t *mem, apr_uint32_t with,
|
||||
apr_uint32_t cmp);
|
||||
|
||||
/**
|
||||
* exchange an apr_uint32_t's value with 'val'.
|
||||
* @param mem pointer to the value
|
||||
* @param val what to swap it with
|
||||
* @return the old value of *mem
|
||||
*/
|
||||
APR_DECLARE(apr_uint32_t) apr_atomic_xchg32(volatile apr_uint32_t *mem, apr_uint32_t val);
|
||||
|
||||
/*
|
||||
* Atomic operations on 64-bit values
|
||||
* Note: Each of these functions internally implements a memory barrier
|
||||
* on platforms that require it
|
||||
*/
|
||||
|
||||
/**
|
||||
* atomically read an apr_uint64_t from memory
|
||||
* @param mem the pointer
|
||||
*/
|
||||
APR_DECLARE(apr_uint64_t) apr_atomic_read64(volatile apr_uint64_t *mem);
|
||||
|
||||
/**
|
||||
* atomically set an apr_uint64_t in memory
|
||||
* @param mem pointer to the object
|
||||
* @param val value that the object will assume
|
||||
*/
|
||||
APR_DECLARE(void) apr_atomic_set64(volatile apr_uint64_t *mem, apr_uint64_t val);
|
||||
|
||||
/**
|
||||
* atomically add 'val' to an apr_uint64_t
|
||||
* @param mem pointer to the object
|
||||
* @param val amount to add
|
||||
* @return old value pointed to by mem
|
||||
*/
|
||||
APR_DECLARE(apr_uint64_t) apr_atomic_add64(volatile apr_uint64_t *mem, apr_uint64_t val);
|
||||
|
||||
/**
|
||||
* atomically subtract 'val' from an apr_uint64_t
|
||||
* @param mem pointer to the object
|
||||
* @param val amount to subtract
|
||||
*/
|
||||
APR_DECLARE(void) apr_atomic_sub64(volatile apr_uint64_t *mem, apr_uint64_t val);
|
||||
|
||||
/**
|
||||
* atomically increment an apr_uint64_t by 1
|
||||
* @param mem pointer to the object
|
||||
* @return old value pointed to by mem
|
||||
*/
|
||||
APR_DECLARE(apr_uint64_t) apr_atomic_inc64(volatile apr_uint64_t *mem);
|
||||
|
||||
/**
|
||||
* atomically decrement an apr_uint64_t by 1
|
||||
* @param mem pointer to the atomic value
|
||||
* @return zero if the value becomes zero on decrement, otherwise non-zero
|
||||
*/
|
||||
APR_DECLARE(int) apr_atomic_dec64(volatile apr_uint64_t *mem);
|
||||
|
||||
/**
|
||||
* compare an apr_uint64_t's value with 'cmp'.
|
||||
* If they are the same swap the value with 'with'
|
||||
* @param mem pointer to the value
|
||||
* @param with what to swap it with
|
||||
* @param cmp the value to compare it to
|
||||
* @return the old value of *mem
|
||||
*/
|
||||
APR_DECLARE(apr_uint64_t) apr_atomic_cas64(volatile apr_uint64_t *mem, apr_uint64_t with,
|
||||
apr_uint64_t cmp);
|
||||
|
||||
/**
|
||||
* exchange an apr_uint64_t's value with 'val'.
|
||||
* @param mem pointer to the value
|
||||
* @param val what to swap it with
|
||||
* @return the old value of *mem
|
||||
*/
|
||||
APR_DECLARE(apr_uint64_t) apr_atomic_xchg64(volatile apr_uint64_t *mem, apr_uint64_t val);
|
||||
|
||||
/**
|
||||
* compare the pointer's value with cmp.
|
||||
* If they are the same swap the value with 'with'
|
||||
* @param mem pointer to the pointer
|
||||
* @param with what to swap it with
|
||||
* @param cmp the value to compare it to
|
||||
* @return the old value of the pointer
|
||||
*/
|
||||
APR_DECLARE(void*) apr_atomic_casptr(volatile void **mem, void *with, const void *cmp);
|
||||
|
||||
/**
|
||||
* exchange a pair of pointer values
|
||||
* @param mem pointer to the pointer
|
||||
* @param with what to swap it with
|
||||
* @return the old value of the pointer
|
||||
*/
|
||||
APR_DECLARE(void*) apr_atomic_xchgptr(volatile void **mem, void *with);
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !APR_ATOMIC_H */
|
||||
113
database/apache/include/apr_base64.h
Normal file
113
database/apache/include/apr_base64.h
Normal file
@@ -0,0 +1,113 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* The apr_vsnprintf/apr_snprintf functions are based on, and used with the
|
||||
* permission of, the SIO stdio-replacement strx_* functions by Panos
|
||||
* Tsirigotis <panos@alumni.cs.colorado.edu> for xinetd.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file apr_base64.h
|
||||
* @brief APR-UTIL Base64 Encoding
|
||||
*/
|
||||
#ifndef APR_BASE64_H
|
||||
#define APR_BASE64_H
|
||||
|
||||
#include "apu.h"
|
||||
#include "apr_general.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup APR_Util_Base64 Base64 Encoding
|
||||
* @ingroup APR_Util
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Simple BASE64 encode/decode functions.
|
||||
*
|
||||
* As we might encode binary strings, hence we require the length of
|
||||
* the incoming plain source. And return the length of what we decoded.
|
||||
*
|
||||
* The decoding function takes any non valid char (i.e. whitespace, \0
|
||||
* or anything non A-Z,0-9 etc as terminal.
|
||||
*
|
||||
* plain strings/binary sequences are not assumed '\0' terminated. Encoded
|
||||
* strings are neither. But probably should.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Given the length of an un-encoded string, get the length of the
|
||||
* encoded string.
|
||||
* @param len the length of an unencoded string.
|
||||
* @return the length of the string after it is encoded, including the
|
||||
* trailing \0
|
||||
*/
|
||||
APU_DECLARE(int) apr_base64_encode_len(int len);
|
||||
|
||||
/**
|
||||
* Encode a text string using base64encoding.
|
||||
* @param coded_dst The destination string for the encoded string.
|
||||
* @param plain_src The original string in plain text
|
||||
* @param len_plain_src The length of the plain text string
|
||||
* @return the length of the encoded string
|
||||
*/
|
||||
APU_DECLARE(int) apr_base64_encode(char * coded_dst, const char *plain_src,
|
||||
int len_plain_src);
|
||||
|
||||
/**
|
||||
* Encode an EBCDIC string using base64encoding.
|
||||
* @param coded_dst The destination string for the encoded string.
|
||||
* @param plain_src The original string in plain text
|
||||
* @param len_plain_src The length of the plain text string
|
||||
* @return the length of the encoded string
|
||||
*/
|
||||
APU_DECLARE(int) apr_base64_encode_binary(char * coded_dst,
|
||||
const unsigned char *plain_src,
|
||||
int len_plain_src);
|
||||
|
||||
/**
|
||||
* Determine the maximum buffer length required to decode the plain text
|
||||
* string given the encoded string.
|
||||
* @param coded_src The encoded string
|
||||
* @return the maximum required buffer length for the plain text string
|
||||
*/
|
||||
APU_DECLARE(int) apr_base64_decode_len(const char * coded_src);
|
||||
|
||||
/**
|
||||
* Decode a string to plain text
|
||||
* @param plain_dst The destination string for the plain text
|
||||
* @param coded_src The encoded string
|
||||
* @return the length of the plain text string
|
||||
*/
|
||||
APU_DECLARE(int) apr_base64_decode(char * plain_dst, const char *coded_src);
|
||||
|
||||
/**
|
||||
* Decode an EBCDIC string to plain text
|
||||
* @param plain_dst The destination string for the plain text
|
||||
* @param coded_src The encoded string
|
||||
* @return the length of the plain text string
|
||||
*/
|
||||
APU_DECLARE(int) apr_base64_decode_binary(unsigned char * plain_dst,
|
||||
const char *coded_src);
|
||||
|
||||
/** @} */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !APR_BASE64_H */
|
||||
1600
database/apache/include/apr_buckets.h
Normal file
1600
database/apache/include/apr_buckets.h
Normal file
File diff suppressed because it is too large
Load Diff
507
database/apache/include/apr_crypto.h
Normal file
507
database/apache/include/apr_crypto.h
Normal file
@@ -0,0 +1,507 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_CRYPTO_H
|
||||
#define APR_CRYPTO_H
|
||||
|
||||
#include "apu.h"
|
||||
#include "apr_pools.h"
|
||||
#include "apr_tables.h"
|
||||
#include "apr_hash.h"
|
||||
#include "apu_errno.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @file apr_crypto.h
|
||||
* @brief APR-UTIL Crypto library
|
||||
*/
|
||||
/**
|
||||
* @defgroup APR_Util_Crypto Crypto routines
|
||||
* @ingroup APR_Util
|
||||
* @{
|
||||
*/
|
||||
|
||||
#if APU_HAVE_CRYPTO
|
||||
|
||||
#ifndef APU_CRYPTO_RECOMMENDED_DRIVER
|
||||
#if APU_HAVE_COMMONCRYPTO
|
||||
#define APU_CRYPTO_RECOMMENDED_DRIVER "commoncrypto"
|
||||
#else
|
||||
#if APU_HAVE_OPENSSL
|
||||
#define APU_CRYPTO_RECOMMENDED_DRIVER "openssl"
|
||||
#else
|
||||
#if APU_HAVE_NSS
|
||||
#define APU_CRYPTO_RECOMMENDED_DRIVER "nss"
|
||||
#else
|
||||
#if APU_HAVE_MSCNG
|
||||
#define APU_CRYPTO_RECOMMENDED_DRIVER "mscng"
|
||||
#else
|
||||
#if APU_HAVE_MSCAPI
|
||||
#define APU_CRYPTO_RECOMMENDED_DRIVER "mscapi"
|
||||
#else
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Symmetric Key types understood by the library.
|
||||
*
|
||||
* NOTE: It is expected that this list will grow over time.
|
||||
*
|
||||
* Interoperability Matrix:
|
||||
*
|
||||
* The matrix is based on the testcrypto.c unit test, which attempts to
|
||||
* test whether a simple encrypt/decrypt will succeed, as well as testing
|
||||
* whether an encrypted string by one library can be decrypted by the
|
||||
* others.
|
||||
*
|
||||
* Some libraries will successfully encrypt and decrypt their own data,
|
||||
* but won't decrypt data from another library. It is hoped that over
|
||||
* time these anomalies will be found and fixed, but until then it is
|
||||
* recommended that ciphers are chosen that interoperate across platform.
|
||||
*
|
||||
* An X below means the test passes, it does not necessarily mean that
|
||||
* encryption performed is correct or secure. Applications should stick
|
||||
* to ciphers that pass the interoperablity tests on the right hand side
|
||||
* of the table.
|
||||
*
|
||||
* Aligned data is data whose length is a multiple of the block size for
|
||||
* the chosen cipher. Padded data is data that is not aligned by block
|
||||
* size and must be padded by the crypto library.
|
||||
*
|
||||
* OpenSSL CommonCrypto NSS Interop
|
||||
* Align Pad Align Pad Align Pad Align Pad
|
||||
* 3DES_192/CBC X X X X X X X X
|
||||
* 3DES_192/ECB X X X X
|
||||
* AES_256/CBC X X X X X X X X
|
||||
* AES_256/ECB X X X X X X
|
||||
* AES_192/CBC X X X X X X
|
||||
* AES_192/ECB X X X X X
|
||||
* AES_128/CBC X X X X X X
|
||||
* AES_128/ECB X X X X X
|
||||
*
|
||||
* Conclusion: for padded data, use 3DES_192/CBC or AES_256/CBC. For
|
||||
* aligned data, use 3DES_192/CBC, AES_256/CBC or AES_256/ECB.
|
||||
*/
|
||||
|
||||
typedef enum
|
||||
{
|
||||
APR_KEY_NONE, APR_KEY_3DES_192, /** 192 bit (3-Key) 3DES */
|
||||
APR_KEY_AES_128, /** 128 bit AES */
|
||||
APR_KEY_AES_192, /** 192 bit AES */
|
||||
APR_KEY_AES_256
|
||||
/** 256 bit AES */
|
||||
} apr_crypto_block_key_type_e;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
APR_MODE_NONE, /** An error condition */
|
||||
APR_MODE_ECB, /** Electronic Code Book */
|
||||
APR_MODE_CBC
|
||||
/** Cipher Block Chaining */
|
||||
} apr_crypto_block_key_mode_e;
|
||||
|
||||
/* These are opaque structs. Instantiation is up to each backend */
|
||||
typedef struct apr_crypto_driver_t apr_crypto_driver_t;
|
||||
typedef struct apr_crypto_t apr_crypto_t;
|
||||
typedef struct apr_crypto_config_t apr_crypto_config_t;
|
||||
typedef struct apr_crypto_key_t apr_crypto_key_t;
|
||||
typedef struct apr_crypto_block_t apr_crypto_block_t;
|
||||
|
||||
typedef struct apr_crypto_block_key_type_t {
|
||||
apr_crypto_block_key_type_e type;
|
||||
int keysize;
|
||||
int blocksize;
|
||||
int ivsize;
|
||||
} apr_crypto_block_key_type_t;
|
||||
|
||||
typedef struct apr_crypto_block_key_mode_t {
|
||||
apr_crypto_block_key_mode_e mode;
|
||||
} apr_crypto_block_key_mode_t;
|
||||
|
||||
typedef struct apr_crypto_passphrase_t {
|
||||
const char *pass;
|
||||
apr_size_t passLen;
|
||||
const unsigned char * salt;
|
||||
apr_size_t saltLen;
|
||||
int iterations;
|
||||
} apr_crypto_passphrase_t;
|
||||
|
||||
typedef struct apr_crypto_secret_t {
|
||||
const unsigned char *secret;
|
||||
apr_size_t secretLen;
|
||||
} apr_crypto_secret_t;
|
||||
|
||||
typedef enum {
|
||||
/** Key is derived from a passphrase */
|
||||
APR_CRYPTO_KTYPE_PASSPHRASE = 1,
|
||||
/** Key is derived from a raw key */
|
||||
APR_CRYPTO_KTYPE_SECRET = 2,
|
||||
} apr_crypto_key_type;
|
||||
|
||||
typedef struct apr_crypto_key_rec_t {
|
||||
apr_crypto_key_type ktype;
|
||||
apr_crypto_block_key_type_e type;
|
||||
apr_crypto_block_key_mode_e mode;
|
||||
int pad;
|
||||
union {
|
||||
apr_crypto_passphrase_t passphrase;
|
||||
apr_crypto_secret_t secret;
|
||||
} k;
|
||||
} apr_crypto_key_rec_t;
|
||||
|
||||
/**
|
||||
* @brief Perform once-only initialisation. Call once only.
|
||||
*
|
||||
* @param pool - pool to register any shutdown cleanups, etc
|
||||
* @return APR_NOTIMPL in case of no crypto support.
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_crypto_init(apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* @brief Zero out the buffer provided when the pool is cleaned up.
|
||||
*
|
||||
* @param pool - pool to register the cleanup
|
||||
* @param buffer - buffer to zero out
|
||||
* @param size - size of the buffer to zero out
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_crypto_clear(apr_pool_t *pool, void *buffer,
|
||||
apr_size_t size);
|
||||
|
||||
/**
|
||||
* @brief Always zero out the buffer provided, without being optimized out by
|
||||
* the compiler.
|
||||
*
|
||||
* @param buffer - buffer to zero out
|
||||
* @param size - size of the buffer to zero out
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_crypto_memzero(void *buffer, apr_size_t size);
|
||||
|
||||
/**
|
||||
* @brief Timing attacks safe buffers comparison, where the executing time does
|
||||
* not depend on the bytes compared but solely on the number of bytes.
|
||||
*
|
||||
* @param buf1 - first buffer to compare
|
||||
* @param buf2 - second buffer to compare
|
||||
* @param size - size of the buffers to compare
|
||||
* @return 1 if the buffers are equals, 0 otherwise.
|
||||
*/
|
||||
APU_DECLARE(int) apr_crypto_equals(const void *buf1, const void *buf2,
|
||||
apr_size_t size);
|
||||
|
||||
/**
|
||||
* @brief Get the driver struct for a name
|
||||
*
|
||||
* @param driver - pointer to driver struct.
|
||||
* @param name - driver name
|
||||
* @param params - array of initialisation parameters
|
||||
* @param result - result and error message on failure
|
||||
* @param pool - (process) pool to register cleanup
|
||||
* @return APR_SUCCESS for success
|
||||
* @return APR_ENOTIMPL for no driver (when DSO not enabled)
|
||||
* @return APR_EDSOOPEN if DSO driver file can't be opened
|
||||
* @return APR_ESYMNOTFOUND if the driver file doesn't contain a driver
|
||||
* @remarks NSS: the params can have "dir", "key3", "cert7" and "secmod"
|
||||
* keys, each followed by an equal sign and a value. Such key/value pairs can
|
||||
* be delimited by space or tab. If the value contains a space, surround the
|
||||
* whole key value pair in quotes: "dir=My Directory".
|
||||
* @remarks OpenSSL: currently no params are supported.
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_crypto_get_driver(
|
||||
const apr_crypto_driver_t **driver,
|
||||
const char *name, const char *params, const apu_err_t **result,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* @brief Return the name of the driver.
|
||||
*
|
||||
* @param driver - The driver in use.
|
||||
* @return The name of the driver.
|
||||
*/
|
||||
APU_DECLARE(const char *) apr_crypto_driver_name(
|
||||
const apr_crypto_driver_t *driver);
|
||||
|
||||
/**
|
||||
* @brief Get the result of the last operation on a context. If the result
|
||||
* is NULL, the operation was successful.
|
||||
* @param result - the result structure
|
||||
* @param f - context pointer
|
||||
* @return APR_SUCCESS for success
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_crypto_error(const apu_err_t **result,
|
||||
const apr_crypto_t *f);
|
||||
|
||||
/**
|
||||
* @brief Create a context for supporting encryption. Keys, certificates,
|
||||
* algorithms and other parameters will be set per context. More than
|
||||
* one context can be created at one time. A cleanup will be automatically
|
||||
* registered with the given pool to guarantee a graceful shutdown.
|
||||
* @param f - context pointer will be written here
|
||||
* @param driver - driver to use
|
||||
* @param params - array of key parameters
|
||||
* @param pool - process pool
|
||||
* @return APR_ENOENGINE when the engine specified does not exist. APR_EINITENGINE
|
||||
* if the engine cannot be initialised.
|
||||
* @remarks NSS: currently no params are supported.
|
||||
* @remarks OpenSSL: the params can have "engine" as a key, followed by an equal
|
||||
* sign and a value.
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_crypto_make(apr_crypto_t **f,
|
||||
const apr_crypto_driver_t *driver, const char *params,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* @brief Get a hash table of key types, keyed by the name of the type against
|
||||
* a pointer to apr_crypto_block_key_type_t, which in turn begins with an
|
||||
* integer.
|
||||
*
|
||||
* @param types - hashtable of key types keyed to constants.
|
||||
* @param f - encryption context
|
||||
* @return APR_SUCCESS for success
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_crypto_get_block_key_types(apr_hash_t **types,
|
||||
const apr_crypto_t *f);
|
||||
|
||||
/**
|
||||
* @brief Get a hash table of key modes, keyed by the name of the mode against
|
||||
* a pointer to apr_crypto_block_key_mode_t, which in turn begins with an
|
||||
* integer.
|
||||
*
|
||||
* @param modes - hashtable of key modes keyed to constants.
|
||||
* @param f - encryption context
|
||||
* @return APR_SUCCESS for success
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_crypto_get_block_key_modes(apr_hash_t **modes,
|
||||
const apr_crypto_t *f);
|
||||
|
||||
/**
|
||||
* @brief Create a key from the provided secret or passphrase. The key is cleaned
|
||||
* up when the context is cleaned, and may be reused with multiple encryption
|
||||
* or decryption operations.
|
||||
* @note If *key is NULL, a apr_crypto_key_t will be created from a pool. If
|
||||
* *key is not NULL, *key must point at a previously created structure.
|
||||
* @param key The key returned, see note.
|
||||
* @param rec The key record, from which the key will be derived.
|
||||
* @param f The context to use.
|
||||
* @param p The pool to use.
|
||||
* @return Returns APR_ENOKEY if the pass phrase is missing or empty, or if a backend
|
||||
* error occurred while generating the key. APR_ENOCIPHER if the type or mode
|
||||
* is not supported by the particular backend. APR_EKEYTYPE if the key type is
|
||||
* not known. APR_EPADDING if padding was requested but is not supported.
|
||||
* APR_ENOTIMPL if not implemented.
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_crypto_key(apr_crypto_key_t **key,
|
||||
const apr_crypto_key_rec_t *rec, const apr_crypto_t *f, apr_pool_t *p);
|
||||
|
||||
/**
|
||||
* @brief Create a key from the given passphrase. By default, the PBKDF2
|
||||
* algorithm is used to generate the key from the passphrase. It is expected
|
||||
* that the same pass phrase will generate the same key, regardless of the
|
||||
* backend crypto platform used. The key is cleaned up when the context
|
||||
* is cleaned, and may be reused with multiple encryption or decryption
|
||||
* operations.
|
||||
* @note If *key is NULL, a apr_crypto_key_t will be created from a pool. If
|
||||
* *key is not NULL, *key must point at a previously created structure.
|
||||
* @param key The key returned, see note.
|
||||
* @param ivSize The size of the initialisation vector will be returned, based
|
||||
* on whether an IV is relevant for this type of crypto.
|
||||
* @param pass The passphrase to use.
|
||||
* @param passLen The passphrase length in bytes
|
||||
* @param salt The salt to use.
|
||||
* @param saltLen The salt length in bytes
|
||||
* @param type 3DES_192, AES_128, AES_192, AES_256.
|
||||
* @param mode Electronic Code Book / Cipher Block Chaining.
|
||||
* @param doPad Pad if necessary.
|
||||
* @param iterations Number of iterations to use in algorithm
|
||||
* @param f The context to use.
|
||||
* @param p The pool to use.
|
||||
* @return Returns APR_ENOKEY if the pass phrase is missing or empty, or if a backend
|
||||
* error occurred while generating the key. APR_ENOCIPHER if the type or mode
|
||||
* is not supported by the particular backend. APR_EKEYTYPE if the key type is
|
||||
* not known. APR_EPADDING if padding was requested but is not supported.
|
||||
* APR_ENOTIMPL if not implemented.
|
||||
* @deprecated Replaced by apr_crypto_key().
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_crypto_passphrase(apr_crypto_key_t **key,
|
||||
apr_size_t *ivSize, const char *pass, apr_size_t passLen,
|
||||
const unsigned char * salt, apr_size_t saltLen,
|
||||
const apr_crypto_block_key_type_e type,
|
||||
const apr_crypto_block_key_mode_e mode, const int doPad,
|
||||
const int iterations, const apr_crypto_t *f, apr_pool_t *p);
|
||||
|
||||
/**
|
||||
* @brief Initialise a context for encrypting arbitrary data using the given key.
|
||||
* @note If *ctx is NULL, a apr_crypto_block_t will be created from a pool. If
|
||||
* *ctx is not NULL, *ctx must point at a previously created structure.
|
||||
* @param ctx The block context returned, see note.
|
||||
* @param iv Optional initialisation vector. If the buffer pointed to is NULL,
|
||||
* an IV will be created at random, in space allocated from the pool.
|
||||
* If the buffer pointed to is not NULL, the IV in the buffer will be
|
||||
* used.
|
||||
* @param key The key structure to use.
|
||||
* @param blockSize The block size of the cipher.
|
||||
* @param p The pool to use.
|
||||
* @return Returns APR_ENOIV if an initialisation vector is required but not specified.
|
||||
* Returns APR_EINIT if the backend failed to initialise the context. Returns
|
||||
* APR_ENOTIMPL if not implemented.
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_crypto_block_encrypt_init(
|
||||
apr_crypto_block_t **ctx, const unsigned char **iv,
|
||||
const apr_crypto_key_t *key, apr_size_t *blockSize, apr_pool_t *p);
|
||||
|
||||
/**
|
||||
* @brief Encrypt data provided by in, write it to out.
|
||||
* @note The number of bytes written will be written to outlen. If
|
||||
* out is NULL, outlen will contain the maximum size of the
|
||||
* buffer needed to hold the data, including any data
|
||||
* generated by apr_crypto_block_encrypt_finish below. If *out points
|
||||
* to NULL, a buffer sufficiently large will be created from
|
||||
* the pool provided. If *out points to a not-NULL value, this
|
||||
* value will be used as a buffer instead.
|
||||
* @param out Address of a buffer to which data will be written,
|
||||
* see note.
|
||||
* @param outlen Length of the output will be written here.
|
||||
* @param in Address of the buffer to read.
|
||||
* @param inlen Length of the buffer to read.
|
||||
* @param ctx The block context to use.
|
||||
* @return APR_ECRYPT if an error occurred. Returns APR_ENOTIMPL if
|
||||
* not implemented.
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_crypto_block_encrypt(unsigned char **out,
|
||||
apr_size_t *outlen, const unsigned char *in, apr_size_t inlen,
|
||||
apr_crypto_block_t *ctx);
|
||||
|
||||
/**
|
||||
* @brief Encrypt final data block, write it to out.
|
||||
* @note If necessary the final block will be written out after being
|
||||
* padded. Typically the final block will be written to the
|
||||
* same buffer used by apr_crypto_block_encrypt, offset by the
|
||||
* number of bytes returned as actually written by the
|
||||
* apr_crypto_block_encrypt() call. After this call, the context
|
||||
* is cleaned and can be reused by apr_crypto_block_encrypt_init().
|
||||
* @param out Address of a buffer to which data will be written. This
|
||||
* buffer must already exist, and is usually the same
|
||||
* buffer used by apr_evp_crypt(). See note.
|
||||
* @param outlen Length of the output will be written here.
|
||||
* @param ctx The block context to use.
|
||||
* @return APR_ECRYPT if an error occurred.
|
||||
* @return APR_EPADDING if padding was enabled and the block was incorrectly
|
||||
* formatted.
|
||||
* @return APR_ENOTIMPL if not implemented.
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_crypto_block_encrypt_finish(unsigned char *out,
|
||||
apr_size_t *outlen, apr_crypto_block_t *ctx);
|
||||
|
||||
/**
|
||||
* @brief Initialise a context for decrypting arbitrary data using the given key.
|
||||
* @note If *ctx is NULL, a apr_crypto_block_t will be created from a pool. If
|
||||
* *ctx is not NULL, *ctx must point at a previously created structure.
|
||||
* @param ctx The block context returned, see note.
|
||||
* @param blockSize The block size of the cipher.
|
||||
* @param iv Optional initialisation vector.
|
||||
* @param key The key structure to use.
|
||||
* @param p The pool to use.
|
||||
* @return Returns APR_ENOIV if an initialisation vector is required but not specified.
|
||||
* Returns APR_EINIT if the backend failed to initialise the context. Returns
|
||||
* APR_ENOTIMPL if not implemented.
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_crypto_block_decrypt_init(
|
||||
apr_crypto_block_t **ctx, apr_size_t *blockSize,
|
||||
const unsigned char *iv, const apr_crypto_key_t *key, apr_pool_t *p);
|
||||
|
||||
/**
|
||||
* @brief Decrypt data provided by in, write it to out.
|
||||
* @note The number of bytes written will be written to outlen. If
|
||||
* out is NULL, outlen will contain the maximum size of the
|
||||
* buffer needed to hold the data, including any data
|
||||
* generated by apr_crypto_block_decrypt_finish below. If *out points
|
||||
* to NULL, a buffer sufficiently large will be created from
|
||||
* the pool provided. If *out points to a not-NULL value, this
|
||||
* value will be used as a buffer instead.
|
||||
* @param out Address of a buffer to which data will be written,
|
||||
* see note.
|
||||
* @param outlen Length of the output will be written here.
|
||||
* @param in Address of the buffer to read.
|
||||
* @param inlen Length of the buffer to read.
|
||||
* @param ctx The block context to use.
|
||||
* @return APR_ECRYPT if an error occurred. Returns APR_ENOTIMPL if
|
||||
* not implemented.
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_crypto_block_decrypt(unsigned char **out,
|
||||
apr_size_t *outlen, const unsigned char *in, apr_size_t inlen,
|
||||
apr_crypto_block_t *ctx);
|
||||
|
||||
/**
|
||||
* @brief Decrypt final data block, write it to out.
|
||||
* @note If necessary the final block will be written out after being
|
||||
* padded. Typically the final block will be written to the
|
||||
* same buffer used by apr_crypto_block_decrypt, offset by the
|
||||
* number of bytes returned as actually written by the
|
||||
* apr_crypto_block_decrypt() call. After this call, the context
|
||||
* is cleaned and can be reused by apr_crypto_block_decrypt_init().
|
||||
* @param out Address of a buffer to which data will be written. This
|
||||
* buffer must already exist, and is usually the same
|
||||
* buffer used by apr_evp_crypt(). See note.
|
||||
* @param outlen Length of the output will be written here.
|
||||
* @param ctx The block context to use.
|
||||
* @return APR_ECRYPT if an error occurred.
|
||||
* @return APR_EPADDING if padding was enabled and the block was incorrectly
|
||||
* formatted.
|
||||
* @return APR_ENOTIMPL if not implemented.
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_crypto_block_decrypt_finish(unsigned char *out,
|
||||
apr_size_t *outlen, apr_crypto_block_t *ctx);
|
||||
|
||||
/**
|
||||
* @brief Clean encryption / decryption context.
|
||||
* @note After cleanup, a context is free to be reused if necessary.
|
||||
* @param ctx The block context to use.
|
||||
* @return Returns APR_ENOTIMPL if not supported.
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_crypto_block_cleanup(apr_crypto_block_t *ctx);
|
||||
|
||||
/**
|
||||
* @brief Clean encryption / decryption context.
|
||||
* @note After cleanup, a context is free to be reused if necessary.
|
||||
* @param f The context to use.
|
||||
* @return Returns APR_ENOTIMPL if not supported.
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_crypto_cleanup(apr_crypto_t *f);
|
||||
|
||||
/**
|
||||
* @brief Shutdown the crypto library.
|
||||
* @note After shutdown, it is expected that the init function can be called again.
|
||||
* @param driver - driver to use
|
||||
* @return Returns APR_ENOTIMPL if not supported.
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_crypto_shutdown(
|
||||
const apr_crypto_driver_t *driver);
|
||||
|
||||
#endif /* APU_HAVE_CRYPTO */
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
292
database/apache/include/apr_cstr.h
Normal file
292
database/apache/include/apr_cstr.h
Normal file
@@ -0,0 +1,292 @@
|
||||
/* ====================================================================
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
* ====================================================================
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file apr_cstr.h
|
||||
* @brief C string goodies.
|
||||
*/
|
||||
|
||||
#ifndef APR_CSTR_H
|
||||
#define APR_CSTR_H
|
||||
|
||||
#include <apr.h> /* for apr_size_t */
|
||||
#include <apr_pools.h> /* for apr_pool_t */
|
||||
#include <apr_tables.h> /* for apr_array_header_t */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @defgroup apr_cstr C (POSIX) locale string functions
|
||||
* @ingroup apr_strings
|
||||
*
|
||||
* The apr_cstr_* functions provide traditional C char * string text handling,
|
||||
* and notabilty they treat all text in the C (a.k.a. POSIX) locale using the
|
||||
* minimal POSIX character set, represented in either ASCII or a corresponding
|
||||
* EBCDIC subset.
|
||||
*
|
||||
* Character values outside of that set are treated as opaque bytes, and all
|
||||
* multi-byte character sequences are handled as individual distinct octets.
|
||||
*
|
||||
* Multi-byte characters sequences whose octets fall in the ASCII range cause
|
||||
* unexpected results, such as in the ISO-2022-JP code page where ASCII octets
|
||||
* occur within both shift-state and multibyte sequences.
|
||||
*
|
||||
* In the case of the UTF-8 encoding, all multibyte characters all fall outside
|
||||
* of the C/POSIX range of characters, so these functions are generally safe
|
||||
* to use on UTF-8 strings. The programmer must be aware that each octet may
|
||||
* not represent a distinct printable character in such encodings.
|
||||
*
|
||||
* The standard C99/POSIX string functions, rather than apr_cstr, should be
|
||||
* used in all cases where the current locale and encoding of the text is
|
||||
* significant.
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/** Divide @a input into substrings, interpreting any char from @a sep
|
||||
* as a token separator.
|
||||
*
|
||||
* Return an array of copies of those substrings (plain const char*),
|
||||
* allocating both the array and the copies in @a pool.
|
||||
*
|
||||
* None of the elements added to the array contain any of the
|
||||
* characters in @a sep_chars, and none of the new elements are empty
|
||||
* (thus, it is possible that the returned array will have length
|
||||
* zero).
|
||||
*
|
||||
* If @a chop_whitespace is TRUE, then remove leading and trailing
|
||||
* whitespace from the returned strings.
|
||||
*
|
||||
* @since New in 1.6
|
||||
*/
|
||||
APR_DECLARE(apr_array_header_t *) apr_cstr_split(const char *input,
|
||||
const char *sep_chars,
|
||||
int chop_whitespace,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/** Like apr_cstr_split(), but append to existing @a array instead of
|
||||
* creating a new one. Allocate the copied substrings in @a pool
|
||||
* (i.e., caller decides whether or not to pass @a array->pool as @a pool).
|
||||
*
|
||||
* @since New in 1.6
|
||||
*/
|
||||
APR_DECLARE(void) apr_cstr_split_append(apr_array_header_t *array,
|
||||
const char *input,
|
||||
const char *sep_chars,
|
||||
int chop_whitespace,
|
||||
apr_pool_t *pool);
|
||||
|
||||
|
||||
/** Return @c TRUE iff @a str matches any of the elements of @a list, a list
|
||||
* of zero or more glob patterns.
|
||||
*
|
||||
* @since New in 1.6
|
||||
*/
|
||||
APR_DECLARE(int) apr_cstr_match_glob_list(const char *str,
|
||||
const apr_array_header_t *list);
|
||||
|
||||
/** Return @c TRUE iff @a str exactly matches any of the elements of @a list.
|
||||
*
|
||||
* @since New in 1.6
|
||||
*/
|
||||
APR_DECLARE(int) apr_cstr_match_list(const char *str,
|
||||
const apr_array_header_t *list);
|
||||
|
||||
/**
|
||||
* Get the next token from @a *str interpreting any char from @a sep as a
|
||||
* token separator. Separators at the beginning of @a str will be skipped.
|
||||
* Returns a pointer to the beginning of the first token in @a *str or NULL
|
||||
* if no token is left. Modifies @a str such that the next call will return
|
||||
* the next token.
|
||||
*
|
||||
* @note The content of @a *str may be modified by this function.
|
||||
*
|
||||
* @since New in 1.6.
|
||||
*/
|
||||
APR_DECLARE(char *) apr_cstr_tokenize(const char *sep, char **str);
|
||||
|
||||
/**
|
||||
* Return the number of line breaks in @a msg, allowing any kind of newline
|
||||
* termination (CR, LF, CRLF, or LFCR), even inconsistent.
|
||||
*
|
||||
* @since New in 1.6.
|
||||
*/
|
||||
APR_DECLARE(int) apr_cstr_count_newlines(const char *msg);
|
||||
|
||||
#if 0 /* XXX: stringbuf logic is not present in APR */
|
||||
/**
|
||||
* Return a cstring which is the concatenation of @a strings (an array
|
||||
* of char *) each followed by @a separator (that is, @a separator
|
||||
* will also end the resulting string). Allocate the result in @a pool.
|
||||
* If @a strings is empty, then return the empty string.
|
||||
*
|
||||
* @since New in 1.6.
|
||||
*/
|
||||
APR_DECLARE(char *) apr_cstr_join(const apr_array_header_t *strings,
|
||||
const char *separator,
|
||||
apr_pool_t *pool);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Perform a case-insensitive comparison of two strings @a atr1 and @a atr2,
|
||||
* treating upper and lower case values of the 26 standard C/POSIX alphabetic
|
||||
* characters as equivalent. Extended latin characters outside of this set
|
||||
* are treated as unique octets, irrespective of the current locale.
|
||||
*
|
||||
* Returns in integer greater than, equal to, or less than 0,
|
||||
* according to whether @a str1 is considered greater than, equal to,
|
||||
* or less than @a str2.
|
||||
*
|
||||
* @since New in 1.6.
|
||||
*/
|
||||
APR_DECLARE(int) apr_cstr_casecmp(const char *str1, const char *str2);
|
||||
|
||||
/**
|
||||
* Perform a case-insensitive comparison of two strings @a atr1 and @a atr2,
|
||||
* treating upper and lower case values of the 26 standard C/POSIX alphabetic
|
||||
* characters as equivalent. Extended latin characters outside of this set
|
||||
* are treated as unique octets, irrespective of the current locale.
|
||||
*
|
||||
* Returns in integer greater than, equal to, or less than 0,
|
||||
* according to whether @a str1 is considered greater than, equal to,
|
||||
* or less than @a str2.
|
||||
*
|
||||
* @since New in 1.6.
|
||||
*/
|
||||
APR_DECLARE(int) apr_cstr_casecmpn(const char *str1,
|
||||
const char *str2,
|
||||
apr_size_t n);
|
||||
|
||||
/**
|
||||
* Parse the C string @a str into a 64 bit number, and return it in @a *n.
|
||||
* Assume that the number is represented in base @a base.
|
||||
* Raise an error if conversion fails (e.g. due to overflow), or if the
|
||||
* converted number is smaller than @a minval or larger than @a maxval.
|
||||
*
|
||||
* Leading whitespace in @a str is skipped in a locale-dependent way.
|
||||
* After that, the string may contain an optional '+' (positive, default)
|
||||
* or '-' (negative) character, followed by an optional '0x' prefix if
|
||||
* @a base is 0 or 16, followed by numeric digits appropriate for the base.
|
||||
* If there are any more characters after the numeric digits, an error is
|
||||
* returned.
|
||||
*
|
||||
* If @a base is zero, then a leading '0x' or '0X' prefix means hexadecimal,
|
||||
* else a leading '0' means octal (implemented, though not documented, in
|
||||
* apr_strtoi64() in APR 0.9.0 through 1.5.0), else use base ten.
|
||||
*
|
||||
* @since New in 1.6.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_cstr_strtoi64(apr_int64_t *n, const char *str,
|
||||
apr_int64_t minval,
|
||||
apr_int64_t maxval,
|
||||
int base);
|
||||
|
||||
/**
|
||||
* Parse the C string @a str into a 64 bit number, and return it in @a *n.
|
||||
* Assume that the number is represented in base 10.
|
||||
* Raise an error if conversion fails (e.g. due to overflow).
|
||||
*
|
||||
* The behaviour otherwise is as described for apr_cstr_strtoi64().
|
||||
*
|
||||
* @since New in 1.6.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_cstr_atoi64(apr_int64_t *n, const char *str);
|
||||
|
||||
/**
|
||||
* Parse the C string @a str into a 32 bit number, and return it in @a *n.
|
||||
* Assume that the number is represented in base 10.
|
||||
* Raise an error if conversion fails (e.g. due to overflow).
|
||||
*
|
||||
* The behaviour otherwise is as described for apr_cstr_strtoi64().
|
||||
*
|
||||
* @since New in 1.6.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_cstr_atoi(int *n, const char *str);
|
||||
|
||||
/**
|
||||
* Parse the C string @a str into an unsigned 64 bit number, and return
|
||||
* it in @a *n. Assume that the number is represented in base @a base.
|
||||
* Raise an error if conversion fails (e.g. due to overflow), or if the
|
||||
* converted number is smaller than @a minval or larger than @a maxval.
|
||||
*
|
||||
* Leading whitespace in @a str is skipped in a locale-dependent way.
|
||||
* After that, the string may contain an optional '+' (positive, default)
|
||||
* or '-' (negative) character, followed by an optional '0x' prefix if
|
||||
* @a base is 0 or 16, followed by numeric digits appropriate for the base.
|
||||
* If there are any more characters after the numeric digits, an error is
|
||||
* returned.
|
||||
*
|
||||
* If @a base is zero, then a leading '0x' or '0X' prefix means hexadecimal,
|
||||
* else a leading '0' means octal (as implemented, though not documented, in
|
||||
* apr_strtoi64(), else use base ten.
|
||||
*
|
||||
* @warning The implementation returns APR_ERANGE if the parsed number
|
||||
* is greater than APR_INT64_MAX, even if it is not greater than @a maxval.
|
||||
*
|
||||
* @since New in 1.6.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_cstr_strtoui64(apr_uint64_t *n, const char *str,
|
||||
apr_uint64_t minval,
|
||||
apr_uint64_t maxval,
|
||||
int base);
|
||||
|
||||
/**
|
||||
* Parse the C string @a str into an unsigned 64 bit number, and return
|
||||
* it in @a *n. Assume that the number is represented in base 10.
|
||||
* Raise an error if conversion fails (e.g. due to overflow).
|
||||
*
|
||||
* The behaviour otherwise is as described for apr_cstr_strtoui64(),
|
||||
* including the upper limit of APR_INT64_MAX.
|
||||
*
|
||||
* @since New in 1.6.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_cstr_atoui64(apr_uint64_t *n, const char *str);
|
||||
|
||||
/**
|
||||
* Parse the C string @a str into an unsigned 32 bit number, and return
|
||||
* it in @a *n. Assume that the number is represented in base 10.
|
||||
* Raise an error if conversion fails (e.g. due to overflow).
|
||||
*
|
||||
* The behaviour otherwise is as described for apr_cstr_strtoui64(),
|
||||
* including the upper limit of APR_INT64_MAX.
|
||||
*
|
||||
* @since New in 1.6.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_cstr_atoui(unsigned int *n, const char *str);
|
||||
|
||||
/**
|
||||
* Skip the common prefix @a prefix from the C string @a str, and return
|
||||
* a pointer to the next character after the prefix.
|
||||
* Return @c NULL if @a str does not start with @a prefix.
|
||||
*
|
||||
* @since New in 1.6.
|
||||
*/
|
||||
APR_DECLARE(const char *) apr_cstr_skip_prefix(const char *str,
|
||||
const char *prefix);
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* SVN_STRING_H */
|
||||
106
database/apache/include/apr_date.h
Normal file
106
database/apache/include/apr_date.h
Normal file
@@ -0,0 +1,106 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_DATE_H
|
||||
#define APR_DATE_H
|
||||
|
||||
/**
|
||||
* @file apr_date.h
|
||||
* @brief APR-UTIL date routines
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup APR_Util_Date Date routines
|
||||
* @ingroup APR_Util
|
||||
* @{
|
||||
*/
|
||||
|
||||
/*
|
||||
* apr_date.h: prototypes for date parsing utility routines
|
||||
*/
|
||||
|
||||
#include "apu.h"
|
||||
#include "apr_time.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** A bad date. */
|
||||
#define APR_DATE_BAD ((apr_time_t)0)
|
||||
|
||||
/**
|
||||
* Compare a string to a mask
|
||||
* @param data The string to compare
|
||||
* @param mask Mask characters (arbitrary maximum is 256 characters):
|
||||
* <PRE>
|
||||
* '\@' - uppercase letter
|
||||
* '\$' - lowercase letter
|
||||
* '\&' - hex digit
|
||||
* '#' - digit
|
||||
* '~' - digit or space
|
||||
* '*' - swallow remaining characters
|
||||
* </PRE>
|
||||
* @remark The mask tests for an exact match for any other character
|
||||
* @return 1 if the string matches, 0 otherwise
|
||||
*/
|
||||
APU_DECLARE(int) apr_date_checkmask(const char *data, const char *mask);
|
||||
|
||||
/**
|
||||
* Parses an HTTP date in one of three standard forms:
|
||||
* <PRE>
|
||||
* Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123
|
||||
* Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036
|
||||
* Sun Nov 6 08:49:37 1994 ; ANSI C's asctime() format
|
||||
* </PRE>
|
||||
* @param date The date in one of the three formats above
|
||||
* @return the apr_time_t number of microseconds since 1 Jan 1970 GMT, or
|
||||
* 0 if this would be out of range or if the date is invalid.
|
||||
*/
|
||||
APU_DECLARE(apr_time_t) apr_date_parse_http(const char *date);
|
||||
|
||||
/**
|
||||
* Parses a string resembling an RFC 822 date. This is meant to be
|
||||
* leinent in its parsing of dates. Hence, this will parse a wider
|
||||
* range of dates than apr_date_parse_http.
|
||||
*
|
||||
* The prominent mailer (or poster, if mailer is unknown) that has
|
||||
* been seen in the wild is included for the unknown formats.
|
||||
* <PRE>
|
||||
* Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123
|
||||
* Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036
|
||||
* Sun Nov 6 08:49:37 1994 ; ANSI C's asctime() format
|
||||
* Sun, 6 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123
|
||||
* Sun, 06 Nov 94 08:49:37 GMT ; RFC 822
|
||||
* Sun, 6 Nov 94 08:49:37 GMT ; RFC 822
|
||||
* Sun, 06 Nov 94 08:49 GMT ; Unknown [drtr\@ast.cam.ac.uk]
|
||||
* Sun, 6 Nov 94 08:49 GMT ; Unknown [drtr\@ast.cam.ac.uk]
|
||||
* Sun, 06 Nov 94 8:49:37 GMT ; Unknown [Elm 70.85]
|
||||
* Sun, 6 Nov 94 8:49:37 GMT ; Unknown [Elm 70.85]
|
||||
* </PRE>
|
||||
*
|
||||
* @param date The date in one of the formats above
|
||||
* @return the apr_time_t number of microseconds since 1 Jan 1970 GMT, or
|
||||
* 0 if this would be out of range or if the date is invalid.
|
||||
*/
|
||||
APU_DECLARE(apr_time_t) apr_date_parse_rfc(const char *date);
|
||||
|
||||
/** @} */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !APR_DATE_H */
|
||||
549
database/apache/include/apr_dbd.h
Normal file
549
database/apache/include/apr_dbd.h
Normal file
@@ -0,0 +1,549 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* Overview of what this is and does:
|
||||
* http://www.apache.org/~niq/dbd.html
|
||||
*/
|
||||
|
||||
#ifndef APR_DBD_H
|
||||
#define APR_DBD_H
|
||||
|
||||
#include "apu.h"
|
||||
#include "apr_pools.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @file apr_dbd.h
|
||||
* @brief APR-UTIL DBD library
|
||||
*/
|
||||
/**
|
||||
* @defgroup APR_Util_DBD DBD routines
|
||||
* @ingroup APR_Util
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Mapping of C to SQL types, used for prepared statements.
|
||||
* @remarks
|
||||
* For apr_dbd_p[v]query/select functions, in and out parameters are always
|
||||
* const char * (i.e. regular nul terminated strings). LOB types are passed
|
||||
* with four (4) arguments: payload, length, table and column, all as const
|
||||
* char *, where table and column are reserved for future use by Oracle.
|
||||
* @remarks
|
||||
* For apr_dbd_p[v]bquery/select functions, in and out parameters are
|
||||
* described next to each enumeration constant and are generally native binary
|
||||
* types or some APR data type. LOB types are passed with four (4) arguments:
|
||||
* payload (char*), length (apr_size_t*), table (char*) and column (char*).
|
||||
* Table and column are reserved for future use by Oracle.
|
||||
*/
|
||||
typedef enum {
|
||||
APR_DBD_TYPE_NONE,
|
||||
APR_DBD_TYPE_TINY, /**< \%hhd : in, out: char* */
|
||||
APR_DBD_TYPE_UTINY, /**< \%hhu : in, out: unsigned char* */
|
||||
APR_DBD_TYPE_SHORT, /**< \%hd : in, out: short* */
|
||||
APR_DBD_TYPE_USHORT, /**< \%hu : in, out: unsigned short* */
|
||||
APR_DBD_TYPE_INT, /**< \%d : in, out: int* */
|
||||
APR_DBD_TYPE_UINT, /**< \%u : in, out: unsigned int* */
|
||||
APR_DBD_TYPE_LONG, /**< \%ld : in, out: long* */
|
||||
APR_DBD_TYPE_ULONG, /**< \%lu : in, out: unsigned long* */
|
||||
APR_DBD_TYPE_LONGLONG, /**< \%lld : in, out: apr_int64_t* */
|
||||
APR_DBD_TYPE_ULONGLONG, /**< \%llu : in, out: apr_uint64_t* */
|
||||
APR_DBD_TYPE_FLOAT, /**< \%f : in, out: float* */
|
||||
APR_DBD_TYPE_DOUBLE, /**< \%lf : in, out: double* */
|
||||
APR_DBD_TYPE_STRING, /**< \%s : in: char*, out: char** */
|
||||
APR_DBD_TYPE_TEXT, /**< \%pDt : in: char*, out: char** */
|
||||
APR_DBD_TYPE_TIME, /**< \%pDi : in: char*, out: char** */
|
||||
APR_DBD_TYPE_DATE, /**< \%pDd : in: char*, out: char** */
|
||||
APR_DBD_TYPE_DATETIME, /**< \%pDa : in: char*, out: char** */
|
||||
APR_DBD_TYPE_TIMESTAMP, /**< \%pDs : in: char*, out: char** */
|
||||
APR_DBD_TYPE_ZTIMESTAMP, /**< \%pDz : in: char*, out: char** */
|
||||
APR_DBD_TYPE_BLOB, /**< \%pDb : in: char* apr_size_t* char* char*, out: apr_bucket_brigade* */
|
||||
APR_DBD_TYPE_CLOB, /**< \%pDc : in: char* apr_size_t* char* char*, out: apr_bucket_brigade* */
|
||||
APR_DBD_TYPE_NULL /**< \%pDn : in: void*, out: void** */
|
||||
} apr_dbd_type_e;
|
||||
|
||||
/* These are opaque structs. Instantiation is up to each backend */
|
||||
typedef struct apr_dbd_driver_t apr_dbd_driver_t;
|
||||
typedef struct apr_dbd_t apr_dbd_t;
|
||||
typedef struct apr_dbd_transaction_t apr_dbd_transaction_t;
|
||||
typedef struct apr_dbd_results_t apr_dbd_results_t;
|
||||
typedef struct apr_dbd_row_t apr_dbd_row_t;
|
||||
typedef struct apr_dbd_prepared_t apr_dbd_prepared_t;
|
||||
|
||||
/** apr_dbd_init: perform once-only initialisation. Call once only.
|
||||
*
|
||||
* @param pool - pool to register any shutdown cleanups, etc
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_dbd_init(apr_pool_t *pool);
|
||||
|
||||
/** apr_dbd_get_driver: get the driver struct for a name
|
||||
*
|
||||
* @param pool - (process) pool to register cleanup
|
||||
* @param name - driver name
|
||||
* @param driver - pointer to driver struct.
|
||||
* @return APR_SUCCESS for success
|
||||
* @return APR_ENOTIMPL for no driver (when DSO not enabled)
|
||||
* @return APR_EDSOOPEN if DSO driver file can't be opened
|
||||
* @return APR_ESYMNOTFOUND if the driver file doesn't contain a driver
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_dbd_get_driver(apr_pool_t *pool, const char *name,
|
||||
const apr_dbd_driver_t **driver);
|
||||
|
||||
/** apr_dbd_open_ex: open a connection to a backend
|
||||
*
|
||||
* @param driver - driver struct.
|
||||
* @param pool - working pool
|
||||
* @param params - arguments to driver (implementation-dependent)
|
||||
* @param handle - pointer to handle to return
|
||||
* @param error - descriptive error.
|
||||
* @return APR_SUCCESS for success
|
||||
* @return APR_EGENERAL if driver exists but connection failed
|
||||
* @remarks PostgreSQL: the params is passed directly to the PQconnectdb()
|
||||
* function (check PostgreSQL documentation for more details on the syntax).
|
||||
* @remarks SQLite2: the params is split on a colon, with the first part used
|
||||
* as the filename and second part converted to an integer and used as file
|
||||
* mode.
|
||||
* @remarks SQLite3: the params is passed directly to the sqlite3_open()
|
||||
* function as a filename to be opened (check SQLite3 documentation for more
|
||||
* details).
|
||||
* @remarks Oracle: the params can have "user", "pass", "dbname" and "server"
|
||||
* keys, each followed by an equal sign and a value. Such key/value pairs can
|
||||
* be delimited by space, CR, LF, tab, semicolon, vertical bar or comma.
|
||||
* @remarks MySQL: the params can have "host", "port", "user", "pass",
|
||||
* "dbname", "sock", "flags" "fldsz", "group" and "reconnect" keys, each
|
||||
* followed by an equal sign and a value. Such key/value pairs can be
|
||||
* delimited by space, CR, LF, tab, semicolon, vertical bar or comma. For
|
||||
* now, "flags" can only recognise CLIENT_FOUND_ROWS (check MySQL manual for
|
||||
* details). The value associated with "fldsz" determines maximum amount of
|
||||
* memory (in bytes) for each of the fields in the result set of prepared
|
||||
* statements. By default, this value is 1 MB. The value associated with
|
||||
* "group" determines which group from configuration file to use (see
|
||||
* MYSQL_READ_DEFAULT_GROUP option of mysql_options() in MySQL manual).
|
||||
* Reconnect is set to 1 by default (i.e. true).
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_dbd_open_ex(const apr_dbd_driver_t *driver,
|
||||
apr_pool_t *pool, const char *params,
|
||||
apr_dbd_t **handle,
|
||||
const char **error);
|
||||
|
||||
/** apr_dbd_open: open a connection to a backend
|
||||
*
|
||||
* @param driver - driver struct.
|
||||
* @param pool - working pool
|
||||
* @param params - arguments to driver (implementation-dependent)
|
||||
* @param handle - pointer to handle to return
|
||||
* @return APR_SUCCESS for success
|
||||
* @return APR_EGENERAL if driver exists but connection failed
|
||||
* @see apr_dbd_open_ex
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_dbd_open(const apr_dbd_driver_t *driver,
|
||||
apr_pool_t *pool, const char *params,
|
||||
apr_dbd_t **handle);
|
||||
|
||||
/** apr_dbd_close: close a connection to a backend
|
||||
*
|
||||
* @param driver - driver struct.
|
||||
* @param handle - handle to close
|
||||
* @return APR_SUCCESS for success or error status
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_dbd_close(const apr_dbd_driver_t *driver,
|
||||
apr_dbd_t *handle);
|
||||
|
||||
/* apr-function-shaped versions of things */
|
||||
|
||||
/** apr_dbd_name: get the name of the driver
|
||||
*
|
||||
* @param driver - the driver
|
||||
* @return - name
|
||||
*/
|
||||
APU_DECLARE(const char*) apr_dbd_name(const apr_dbd_driver_t *driver);
|
||||
|
||||
/** apr_dbd_native_handle: get native database handle of the underlying db
|
||||
*
|
||||
* @param driver - the driver
|
||||
* @param handle - apr_dbd handle
|
||||
* @return - native handle
|
||||
*/
|
||||
APU_DECLARE(void*) apr_dbd_native_handle(const apr_dbd_driver_t *driver,
|
||||
apr_dbd_t *handle);
|
||||
|
||||
/** check_conn: check status of a database connection
|
||||
*
|
||||
* @param driver - the driver
|
||||
* @param pool - working pool
|
||||
* @param handle - the connection to check
|
||||
* @return APR_SUCCESS or error
|
||||
*/
|
||||
APU_DECLARE(int) apr_dbd_check_conn(const apr_dbd_driver_t *driver, apr_pool_t *pool,
|
||||
apr_dbd_t *handle);
|
||||
|
||||
/** apr_dbd_set_dbname: select database name. May be a no-op if not supported.
|
||||
*
|
||||
* @param driver - the driver
|
||||
* @param pool - working pool
|
||||
* @param handle - the connection
|
||||
* @param name - the database to select
|
||||
* @return 0 for success or error code
|
||||
*/
|
||||
APU_DECLARE(int) apr_dbd_set_dbname(const apr_dbd_driver_t *driver, apr_pool_t *pool,
|
||||
apr_dbd_t *handle, const char *name);
|
||||
|
||||
/** apr_dbd_transaction_start: start a transaction. May be a no-op.
|
||||
*
|
||||
* @param driver - the driver
|
||||
* @param pool - a pool to use for error messages (if any).
|
||||
* @param handle - the db connection
|
||||
* @param trans - ptr to a transaction. May be null on entry
|
||||
* @return 0 for success or error code
|
||||
* @remarks Note that transaction modes, set by calling
|
||||
* apr_dbd_transaction_mode_set(), will affect all query/select calls within
|
||||
* a transaction. By default, any error in query/select during a transaction
|
||||
* will cause the transaction to inherit the error code and any further
|
||||
* query/select calls will fail immediately. Put transaction in "ignore
|
||||
* errors" mode to avoid that. Use "rollback" mode to do explicit rollback.
|
||||
*/
|
||||
APU_DECLARE(int) apr_dbd_transaction_start(const apr_dbd_driver_t *driver,
|
||||
apr_pool_t *pool,
|
||||
apr_dbd_t *handle,
|
||||
apr_dbd_transaction_t **trans);
|
||||
|
||||
/** apr_dbd_transaction_end: end a transaction
|
||||
* (commit on success, rollback on error).
|
||||
* May be a no-op.
|
||||
*
|
||||
* @param driver - the driver
|
||||
* @param handle - the db connection
|
||||
* @param trans - the transaction.
|
||||
* @return 0 for success or error code
|
||||
*/
|
||||
APU_DECLARE(int) apr_dbd_transaction_end(const apr_dbd_driver_t *driver,
|
||||
apr_pool_t *pool,
|
||||
apr_dbd_transaction_t *trans);
|
||||
|
||||
#define APR_DBD_TRANSACTION_COMMIT 0x00 /**< commit the transaction */
|
||||
#define APR_DBD_TRANSACTION_ROLLBACK 0x01 /**< rollback the transaction */
|
||||
#define APR_DBD_TRANSACTION_IGNORE_ERRORS 0x02 /**< ignore transaction errors */
|
||||
|
||||
/** apr_dbd_transaction_mode_get: get the mode of transaction
|
||||
*
|
||||
* @param driver - the driver
|
||||
* @param trans - the transaction
|
||||
* @return mode of transaction
|
||||
*/
|
||||
APU_DECLARE(int) apr_dbd_transaction_mode_get(const apr_dbd_driver_t *driver,
|
||||
apr_dbd_transaction_t *trans);
|
||||
|
||||
/** apr_dbd_transaction_mode_set: set the mode of transaction
|
||||
*
|
||||
* @param driver - the driver
|
||||
* @param trans - the transaction
|
||||
* @param mode - new mode of the transaction
|
||||
* @return the mode of transaction in force after the call
|
||||
*/
|
||||
APU_DECLARE(int) apr_dbd_transaction_mode_set(const apr_dbd_driver_t *driver,
|
||||
apr_dbd_transaction_t *trans,
|
||||
int mode);
|
||||
|
||||
/** apr_dbd_query: execute an SQL query that doesn't return a result set
|
||||
*
|
||||
* @param driver - the driver
|
||||
* @param handle - the connection
|
||||
* @param nrows - number of rows affected.
|
||||
* @param statement - the SQL statement to execute
|
||||
* @return 0 for success or error code
|
||||
*/
|
||||
APU_DECLARE(int) apr_dbd_query(const apr_dbd_driver_t *driver, apr_dbd_t *handle,
|
||||
int *nrows, const char *statement);
|
||||
|
||||
/** apr_dbd_select: execute an SQL query that returns a result set
|
||||
*
|
||||
* @param driver - the driver
|
||||
* @param pool - pool to allocate the result set
|
||||
* @param handle - the connection
|
||||
* @param res - pointer to result set pointer. May point to NULL on entry
|
||||
* @param statement - the SQL statement to execute
|
||||
* @param random - 1 to support random access to results (seek any row);
|
||||
* 0 to support only looping through results in order
|
||||
* (async access - faster)
|
||||
* @return 0 for success or error code
|
||||
*/
|
||||
APU_DECLARE(int) apr_dbd_select(const apr_dbd_driver_t *driver, apr_pool_t *pool,
|
||||
apr_dbd_t *handle, apr_dbd_results_t **res,
|
||||
const char *statement, int random);
|
||||
|
||||
/** apr_dbd_num_cols: get the number of columns in a results set
|
||||
*
|
||||
* @param driver - the driver
|
||||
* @param res - result set.
|
||||
* @return number of columns
|
||||
*/
|
||||
APU_DECLARE(int) apr_dbd_num_cols(const apr_dbd_driver_t *driver,
|
||||
apr_dbd_results_t *res);
|
||||
|
||||
/** apr_dbd_num_tuples: get the number of rows in a results set
|
||||
* of a synchronous select
|
||||
*
|
||||
* @param driver - the driver
|
||||
* @param res - result set.
|
||||
* @return number of rows, or -1 if the results are asynchronous
|
||||
*/
|
||||
APU_DECLARE(int) apr_dbd_num_tuples(const apr_dbd_driver_t *driver,
|
||||
apr_dbd_results_t *res);
|
||||
|
||||
/** apr_dbd_get_row: get a row from a result set
|
||||
*
|
||||
* @param driver - the driver
|
||||
* @param pool - pool to allocate the row
|
||||
* @param res - result set pointer
|
||||
* @param row - pointer to row pointer. May point to NULL on entry
|
||||
* @param rownum - row number (counting from 1), or -1 for "next row".
|
||||
* Ignored if random access is not supported.
|
||||
* @return 0 for success, -1 for rownum out of range or data finished
|
||||
*/
|
||||
APU_DECLARE(int) apr_dbd_get_row(const apr_dbd_driver_t *driver, apr_pool_t *pool,
|
||||
apr_dbd_results_t *res, apr_dbd_row_t **row,
|
||||
int rownum);
|
||||
|
||||
/** apr_dbd_get_entry: get an entry from a row
|
||||
*
|
||||
* @param driver - the driver
|
||||
* @param row - row pointer
|
||||
* @param col - entry number
|
||||
* @return value from the row, or NULL if col is out of bounds.
|
||||
*/
|
||||
APU_DECLARE(const char*) apr_dbd_get_entry(const apr_dbd_driver_t *driver,
|
||||
apr_dbd_row_t *row, int col);
|
||||
|
||||
/** apr_dbd_get_name: get an entry name from a result set
|
||||
*
|
||||
* @param driver - the driver
|
||||
* @param res - result set pointer
|
||||
* @param col - entry number
|
||||
* @return name of the entry, or NULL if col is out of bounds.
|
||||
*/
|
||||
APU_DECLARE(const char*) apr_dbd_get_name(const apr_dbd_driver_t *driver,
|
||||
apr_dbd_results_t *res, int col);
|
||||
|
||||
|
||||
/** apr_dbd_error: get current error message (if any)
|
||||
*
|
||||
* @param driver - the driver
|
||||
* @param handle - the connection
|
||||
* @param errnum - error code from operation that returned an error
|
||||
* @return the database current error message, or message for errnum
|
||||
* (implementation-dependent whether errnum is ignored)
|
||||
*/
|
||||
APU_DECLARE(const char*) apr_dbd_error(const apr_dbd_driver_t *driver,
|
||||
apr_dbd_t *handle, int errnum);
|
||||
|
||||
/** apr_dbd_escape: escape a string so it is safe for use in query/select
|
||||
*
|
||||
* @param driver - the driver
|
||||
* @param pool - pool to alloc the result from
|
||||
* @param string - the string to escape
|
||||
* @param handle - the connection
|
||||
* @return the escaped, safe string
|
||||
*/
|
||||
APU_DECLARE(const char*) apr_dbd_escape(const apr_dbd_driver_t *driver,
|
||||
apr_pool_t *pool, const char *string,
|
||||
apr_dbd_t *handle);
|
||||
|
||||
/** apr_dbd_prepare: prepare a statement
|
||||
*
|
||||
* @param driver - the driver
|
||||
* @param pool - pool to alloc the result from
|
||||
* @param handle - the connection
|
||||
* @param query - the SQL query
|
||||
* @param label - A label for the prepared statement.
|
||||
* use NULL for temporary prepared statements
|
||||
* (eg within a Request in httpd)
|
||||
* @param statement - statement to prepare. May point to null on entry.
|
||||
* @return 0 for success or error code
|
||||
* @remarks To specify parameters of the prepared query, use \%s, \%d etc.
|
||||
* (see below for full list) in place of database specific parameter syntax
|
||||
* (e.g. for PostgreSQL, this would be $1, $2, for SQLite3 this would be ?
|
||||
* etc.). For instance: "SELECT name FROM customers WHERE name=%s" would be
|
||||
* a query that this function understands.
|
||||
* @remarks Here is the full list of format specifiers that this function
|
||||
* understands and what they map to in SQL: \%hhd (TINY INT), \%hhu (UNSIGNED
|
||||
* TINY INT), \%hd (SHORT), \%hu (UNSIGNED SHORT), \%d (INT), \%u (UNSIGNED
|
||||
* INT), \%ld (LONG), \%lu (UNSIGNED LONG), \%lld (LONG LONG), \%llu
|
||||
* (UNSIGNED LONG LONG), \%f (FLOAT, REAL), \%lf (DOUBLE PRECISION), \%s
|
||||
* (VARCHAR), \%pDt (TEXT), \%pDi (TIME), \%pDd (DATE), \%pDa (DATETIME),
|
||||
* \%pDs (TIMESTAMP), \%pDz (TIMESTAMP WITH TIME ZONE), \%pDb (BLOB), \%pDc
|
||||
* (CLOB) and \%pDn (NULL). Not all databases have support for all these
|
||||
* types, so the underlying driver will attempt the "best match" where
|
||||
* possible. A \% followed by any letter not in the above list will be
|
||||
* interpreted as VARCHAR (i.e. \%s).
|
||||
*/
|
||||
APU_DECLARE(int) apr_dbd_prepare(const apr_dbd_driver_t *driver, apr_pool_t *pool,
|
||||
apr_dbd_t *handle, const char *query,
|
||||
const char *label,
|
||||
apr_dbd_prepared_t **statement);
|
||||
|
||||
|
||||
/** apr_dbd_pquery: query using a prepared statement + args
|
||||
*
|
||||
* @param driver - the driver
|
||||
* @param pool - working pool
|
||||
* @param handle - the connection
|
||||
* @param nrows - number of rows affected.
|
||||
* @param statement - the prepared statement to execute
|
||||
* @param nargs - ignored (for backward compatibility only)
|
||||
* @param args - args to prepared statement
|
||||
* @return 0 for success or error code
|
||||
*/
|
||||
APU_DECLARE(int) apr_dbd_pquery(const apr_dbd_driver_t *driver, apr_pool_t *pool,
|
||||
apr_dbd_t *handle, int *nrows,
|
||||
apr_dbd_prepared_t *statement, int nargs,
|
||||
const char **args);
|
||||
|
||||
/** apr_dbd_pselect: select using a prepared statement + args
|
||||
*
|
||||
* @param driver - the driver
|
||||
* @param pool - working pool
|
||||
* @param handle - the connection
|
||||
* @param res - pointer to query results. May point to NULL on entry
|
||||
* @param statement - the prepared statement to execute
|
||||
* @param random - Whether to support random-access to results
|
||||
* @param nargs - ignored (for backward compatibility only)
|
||||
* @param args - args to prepared statement
|
||||
* @return 0 for success or error code
|
||||
*/
|
||||
APU_DECLARE(int) apr_dbd_pselect(const apr_dbd_driver_t *driver, apr_pool_t *pool,
|
||||
apr_dbd_t *handle, apr_dbd_results_t **res,
|
||||
apr_dbd_prepared_t *statement, int random,
|
||||
int nargs, const char **args);
|
||||
|
||||
/** apr_dbd_pvquery: query using a prepared statement + args
|
||||
*
|
||||
* @param driver - the driver
|
||||
* @param pool - working pool
|
||||
* @param handle - the connection
|
||||
* @param nrows - number of rows affected.
|
||||
* @param statement - the prepared statement to execute
|
||||
* @param ... - varargs list
|
||||
* @return 0 for success or error code
|
||||
*/
|
||||
APU_DECLARE_NONSTD(int) apr_dbd_pvquery(const apr_dbd_driver_t *driver,
|
||||
apr_pool_t *pool,
|
||||
apr_dbd_t *handle, int *nrows,
|
||||
apr_dbd_prepared_t *statement, ...);
|
||||
|
||||
/** apr_dbd_pvselect: select using a prepared statement + args
|
||||
*
|
||||
* @param driver - the driver
|
||||
* @param pool - working pool
|
||||
* @param handle - the connection
|
||||
* @param res - pointer to query results. May point to NULL on entry
|
||||
* @param statement - the prepared statement to execute
|
||||
* @param random - Whether to support random-access to results
|
||||
* @param ... - varargs list
|
||||
* @return 0 for success or error code
|
||||
*/
|
||||
APU_DECLARE_NONSTD(int) apr_dbd_pvselect(const apr_dbd_driver_t *driver,
|
||||
apr_pool_t *pool, apr_dbd_t *handle,
|
||||
apr_dbd_results_t **res,
|
||||
apr_dbd_prepared_t *statement,
|
||||
int random, ...);
|
||||
|
||||
/** apr_dbd_pbquery: query using a prepared statement + binary args
|
||||
*
|
||||
* @param driver - the driver
|
||||
* @param pool - working pool
|
||||
* @param handle - the connection
|
||||
* @param nrows - number of rows affected.
|
||||
* @param statement - the prepared statement to execute
|
||||
* @param args - binary args to prepared statement
|
||||
* @return 0 for success or error code
|
||||
*/
|
||||
APU_DECLARE(int) apr_dbd_pbquery(const apr_dbd_driver_t *driver,
|
||||
apr_pool_t *pool, apr_dbd_t *handle,
|
||||
int *nrows, apr_dbd_prepared_t *statement,
|
||||
const void **args);
|
||||
|
||||
/** apr_dbd_pbselect: select using a prepared statement + binary args
|
||||
*
|
||||
* @param driver - the driver
|
||||
* @param pool - working pool
|
||||
* @param handle - the connection
|
||||
* @param res - pointer to query results. May point to NULL on entry
|
||||
* @param statement - the prepared statement to execute
|
||||
* @param random - Whether to support random-access to results
|
||||
* @param args - binary args to prepared statement
|
||||
* @return 0 for success or error code
|
||||
*/
|
||||
APU_DECLARE(int) apr_dbd_pbselect(const apr_dbd_driver_t *driver,
|
||||
apr_pool_t *pool,
|
||||
apr_dbd_t *handle, apr_dbd_results_t **res,
|
||||
apr_dbd_prepared_t *statement, int random,
|
||||
const void **args);
|
||||
|
||||
/** apr_dbd_pvbquery: query using a prepared statement + binary args
|
||||
*
|
||||
* @param driver - the driver
|
||||
* @param pool - working pool
|
||||
* @param handle - the connection
|
||||
* @param nrows - number of rows affected.
|
||||
* @param statement - the prepared statement to execute
|
||||
* @param ... - varargs list of binary args
|
||||
* @return 0 for success or error code
|
||||
*/
|
||||
APU_DECLARE_NONSTD(int) apr_dbd_pvbquery(const apr_dbd_driver_t *driver,
|
||||
apr_pool_t *pool,
|
||||
apr_dbd_t *handle, int *nrows,
|
||||
apr_dbd_prepared_t *statement, ...);
|
||||
|
||||
/** apr_dbd_pvbselect: select using a prepared statement + binary args
|
||||
*
|
||||
* @param driver - the driver
|
||||
* @param pool - working pool
|
||||
* @param handle - the connection
|
||||
* @param res - pointer to query results. May point to NULL on entry
|
||||
* @param statement - the prepared statement to execute
|
||||
* @param random - Whether to support random-access to results
|
||||
* @param ... - varargs list of binary args
|
||||
* @return 0 for success or error code
|
||||
*/
|
||||
APU_DECLARE_NONSTD(int) apr_dbd_pvbselect(const apr_dbd_driver_t *driver,
|
||||
apr_pool_t *pool, apr_dbd_t *handle,
|
||||
apr_dbd_results_t **res,
|
||||
apr_dbd_prepared_t *statement,
|
||||
int random, ...);
|
||||
|
||||
/** apr_dbd_datum_get: get a binary entry from a row
|
||||
*
|
||||
* @param driver - the driver
|
||||
* @param row - row pointer
|
||||
* @param col - entry number
|
||||
* @param type - type of data to get
|
||||
* @param data - pointer to data, allocated by the caller
|
||||
* @return APR_SUCCESS on success, APR_ENOENT if data is NULL or APR_EGENERAL
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_dbd_datum_get(const apr_dbd_driver_t *driver,
|
||||
apr_dbd_row_t *row, int col,
|
||||
apr_dbd_type_e type, void *data);
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
227
database/apache/include/apr_dbm.h
Normal file
227
database/apache/include/apr_dbm.h
Normal file
@@ -0,0 +1,227 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_DBM_H
|
||||
#define APR_DBM_H
|
||||
|
||||
#include "apu.h"
|
||||
#include "apr.h"
|
||||
#include "apr_errno.h"
|
||||
#include "apr_pools.h"
|
||||
#include "apr_file_info.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @file apr_dbm.h
|
||||
* @brief APR-UTIL DBM library
|
||||
*/
|
||||
/**
|
||||
* @defgroup APR_Util_DBM DBM routines
|
||||
* @ingroup APR_Util
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* Structure for referencing a dbm
|
||||
*/
|
||||
typedef struct apr_dbm_t apr_dbm_t;
|
||||
|
||||
/**
|
||||
* Structure for referencing the datum record within a dbm
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
/** pointer to the 'data' to retrieve/store in the DBM */
|
||||
char *dptr;
|
||||
/** size of the 'data' to retrieve/store in the DBM */
|
||||
apr_size_t dsize;
|
||||
} apr_datum_t;
|
||||
|
||||
/* modes to open the DB */
|
||||
#define APR_DBM_READONLY 1 /**< open for read-only access */
|
||||
#define APR_DBM_READWRITE 2 /**< open for read-write access */
|
||||
#define APR_DBM_RWCREATE 3 /**< open for r/w, create if needed */
|
||||
#define APR_DBM_RWTRUNC 4 /**< open for r/w, truncating an existing
|
||||
DB if present */
|
||||
/**
|
||||
* Open a dbm file by file name and type of DBM
|
||||
* @param dbm The newly opened database
|
||||
* @param type The type of the DBM (not all may be available at run time)
|
||||
* <pre>
|
||||
* db for Berkeley DB files
|
||||
* gdbm for GDBM files
|
||||
* ndbm for NDBM files
|
||||
* sdbm for SDBM files (always available)
|
||||
* default for the default DBM type
|
||||
* </pre>
|
||||
* @param name The dbm file name to open
|
||||
* @param mode The flag value
|
||||
* <PRE>
|
||||
* APR_DBM_READONLY open for read-only access
|
||||
* APR_DBM_READWRITE open for read-write access
|
||||
* APR_DBM_RWCREATE open for r/w, create if needed
|
||||
* APR_DBM_RWTRUNC open for r/w, truncate if already there
|
||||
* </PRE>
|
||||
* @param perm Permissions to apply to if created
|
||||
* @param cntxt The pool to use when creating the dbm
|
||||
* @remark The dbm name may not be a true file name, as many dbm packages
|
||||
* append suffixes for seperate data and index files.
|
||||
* @bug In apr-util 0.9 and 1.x, the type arg was case insensitive. This
|
||||
* was highly inefficient, and as of 2.x the dbm name must be provided in
|
||||
* the correct case (lower case for all bundled providers)
|
||||
*/
|
||||
|
||||
APU_DECLARE(apr_status_t) apr_dbm_open_ex(apr_dbm_t **dbm, const char* type,
|
||||
const char *name,
|
||||
apr_int32_t mode, apr_fileperms_t perm,
|
||||
apr_pool_t *cntxt);
|
||||
|
||||
|
||||
/**
|
||||
* Open a dbm file by file name
|
||||
* @param dbm The newly opened database
|
||||
* @param name The dbm file name to open
|
||||
* @param mode The flag value
|
||||
* <PRE>
|
||||
* APR_DBM_READONLY open for read-only access
|
||||
* APR_DBM_READWRITE open for read-write access
|
||||
* APR_DBM_RWCREATE open for r/w, create if needed
|
||||
* APR_DBM_RWTRUNC open for r/w, truncate if already there
|
||||
* </PRE>
|
||||
* @param perm Permissions to apply to if created
|
||||
* @param cntxt The pool to use when creating the dbm
|
||||
* @remark The dbm name may not be a true file name, as many dbm packages
|
||||
* append suffixes for seperate data and index files.
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_dbm_open(apr_dbm_t **dbm, const char *name,
|
||||
apr_int32_t mode, apr_fileperms_t perm,
|
||||
apr_pool_t *cntxt);
|
||||
|
||||
/**
|
||||
* Close a dbm file previously opened by apr_dbm_open
|
||||
* @param dbm The database to close
|
||||
*/
|
||||
APU_DECLARE(void) apr_dbm_close(apr_dbm_t *dbm);
|
||||
|
||||
/**
|
||||
* Fetch a dbm record value by key
|
||||
* @param dbm The database
|
||||
* @param key The key datum to find this record
|
||||
* @param pvalue The value datum retrieved for this record
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_dbm_fetch(apr_dbm_t *dbm, apr_datum_t key,
|
||||
apr_datum_t *pvalue);
|
||||
/**
|
||||
* Store a dbm record value by key
|
||||
* @param dbm The database
|
||||
* @param key The key datum to store this record by
|
||||
* @param value The value datum to store in this record
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_dbm_store(apr_dbm_t *dbm, apr_datum_t key,
|
||||
apr_datum_t value);
|
||||
|
||||
/**
|
||||
* Delete a dbm record value by key
|
||||
* @param dbm The database
|
||||
* @param key The key datum of the record to delete
|
||||
* @remark It is not an error to delete a non-existent record.
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_dbm_delete(apr_dbm_t *dbm, apr_datum_t key);
|
||||
|
||||
/**
|
||||
* Search for a key within the dbm
|
||||
* @param dbm The database
|
||||
* @param key The datum describing a key to test
|
||||
*/
|
||||
APU_DECLARE(int) apr_dbm_exists(apr_dbm_t *dbm, apr_datum_t key);
|
||||
|
||||
/**
|
||||
* Retrieve the first record key from a dbm
|
||||
* @param dbm The database
|
||||
* @param pkey The key datum of the first record
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_dbm_firstkey(apr_dbm_t *dbm, apr_datum_t *pkey);
|
||||
|
||||
/**
|
||||
* Retrieve the next record key from a dbm
|
||||
* @param dbm The database
|
||||
* @param pkey The key datum of the next record
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_dbm_nextkey(apr_dbm_t *dbm, apr_datum_t *pkey);
|
||||
|
||||
/**
|
||||
* Proactively toss any memory associated with the apr_datum_t.
|
||||
* @param dbm The database
|
||||
* @param data The datum to free.
|
||||
*/
|
||||
APU_DECLARE(void) apr_dbm_freedatum(apr_dbm_t *dbm, apr_datum_t data);
|
||||
|
||||
/**
|
||||
* Report more information when an apr_dbm function fails.
|
||||
* @param dbm The database
|
||||
* @param errcode A DBM-specific value for the error (for logging). If this
|
||||
* isn't needed, it may be NULL.
|
||||
* @param errbuf Location to store the error text
|
||||
* @param errbufsize The size of the provided buffer
|
||||
* @return The errbuf parameter, for convenience.
|
||||
*/
|
||||
APU_DECLARE(char *) apr_dbm_geterror(apr_dbm_t *dbm, int *errcode,
|
||||
char *errbuf, apr_size_t errbufsize);
|
||||
/**
|
||||
* If the specified file/path were passed to apr_dbm_open(), return the
|
||||
* actual file/path names which would be (created and) used. At most, two
|
||||
* files may be used; used2 may be NULL if only one file is used.
|
||||
* @param pool The pool for allocating used1 and used2.
|
||||
* @param type The type of DBM you require info on @see apr_dbm_open_ex
|
||||
* @param pathname The path name to generate used-names from.
|
||||
* @param used1 The first pathname used by the apr_dbm implementation.
|
||||
* @param used2 The second pathname used by apr_dbm. If only one file is
|
||||
* used by the specific implementation, this will be set to NULL.
|
||||
* @return An error if the specified type is invalid.
|
||||
* @remark The dbm file(s) don't need to exist. This function only manipulates
|
||||
* the pathnames.
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_dbm_get_usednames_ex(apr_pool_t *pool,
|
||||
const char *type,
|
||||
const char *pathname,
|
||||
const char **used1,
|
||||
const char **used2);
|
||||
|
||||
/**
|
||||
* If the specified file/path were passed to apr_dbm_open(), return the
|
||||
* actual file/path names which would be (created and) used. At most, two
|
||||
* files may be used; used2 may be NULL if only one file is used.
|
||||
* @param pool The pool for allocating used1 and used2.
|
||||
* @param pathname The path name to generate used-names from.
|
||||
* @param used1 The first pathname used by the apr_dbm implementation.
|
||||
* @param used2 The second pathname used by apr_dbm. If only one file is
|
||||
* used by the specific implementation, this will be set to NULL.
|
||||
* @remark The dbm file(s) don't need to exist. This function only manipulates
|
||||
* the pathnames.
|
||||
*/
|
||||
APU_DECLARE(void) apr_dbm_get_usednames(apr_pool_t *pool,
|
||||
const char *pathname,
|
||||
const char **used1,
|
||||
const char **used2);
|
||||
|
||||
/** @} */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !APR_DBM_H */
|
||||
94
database/apache/include/apr_dso.h
Normal file
94
database/apache/include/apr_dso.h
Normal file
@@ -0,0 +1,94 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_DSO_DOT_H
|
||||
#define APR_DSO_DOT_H
|
||||
|
||||
/**
|
||||
* @file apr_dso.h
|
||||
* @brief APR Dynamic Object Handling Routines
|
||||
*/
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_pools.h"
|
||||
#include "apr_errno.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup apr_dso Dynamic Object Handling
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
#if APR_HAS_DSO || defined(DOXYGEN)
|
||||
|
||||
/**
|
||||
* Structure for referencing dynamic objects
|
||||
*/
|
||||
typedef struct apr_dso_handle_t apr_dso_handle_t;
|
||||
|
||||
/**
|
||||
* Structure for referencing symbols from dynamic objects
|
||||
*/
|
||||
typedef void * apr_dso_handle_sym_t;
|
||||
|
||||
/**
|
||||
* Load a DSO library.
|
||||
* @param res_handle Location to store new handle for the DSO.
|
||||
* @param path Path to the DSO library
|
||||
* @param ctx Pool to use.
|
||||
* @bug We aught to provide an alternative to RTLD_GLOBAL, which
|
||||
* is the only supported method of loading DSOs today.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_dso_load(apr_dso_handle_t **res_handle,
|
||||
const char *path, apr_pool_t *ctx);
|
||||
|
||||
/**
|
||||
* Close a DSO library.
|
||||
* @param handle handle to close.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_dso_unload(apr_dso_handle_t *handle);
|
||||
|
||||
/**
|
||||
* Load a symbol from a DSO handle.
|
||||
* @param ressym Location to store the loaded symbol
|
||||
* @param handle handle to load the symbol from.
|
||||
* @param symname Name of the symbol to load.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_dso_sym(apr_dso_handle_sym_t *ressym,
|
||||
apr_dso_handle_t *handle,
|
||||
const char *symname);
|
||||
|
||||
/**
|
||||
* Report more information when a DSO function fails.
|
||||
* @param dso The dso handle that has been opened
|
||||
* @param buf Location to store the dso error
|
||||
* @param bufsize The size of the provided buffer
|
||||
*/
|
||||
APR_DECLARE(const char *) apr_dso_error(apr_dso_handle_t *dso, char *buf, apr_size_t bufsize);
|
||||
|
||||
#endif /* APR_HAS_DSO */
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
650
database/apache/include/apr_encode.h
Normal file
650
database/apache/include/apr_encode.h
Normal file
@@ -0,0 +1,650 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file apr_encode.h
|
||||
* @brief APR-UTIL Encoding
|
||||
*/
|
||||
#ifndef APR_ENCODE_H
|
||||
#define APR_ENCODE_H
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_general.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup APR_Util_Encode Base64/Base64Url/Base32/Base32Hex/Base16 Encoding
|
||||
* @ingroup APR_Util
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* RFC4648 and RFC7515 compliant BASE64, BASE64URL, BASE32, BASE32HEX
|
||||
* and BASE16 encode/decode functions.
|
||||
*
|
||||
* The following encodings are supported:
|
||||
*
|
||||
* - Base 64 Encoding
|
||||
*
|
||||
* o Use flag APR_ENCODE_NONE
|
||||
* o https://tools.ietf.org/html/rfc4648#section-4
|
||||
*
|
||||
* - Base 64 Encoding with URL and Filename Safe Alphabet
|
||||
*
|
||||
* o Use flag APR_ENCODE_URL
|
||||
* o https://tools.ietf.org/html/rfc4648#section-5
|
||||
*
|
||||
* - Base 64 URL Encoding without Padding
|
||||
*
|
||||
* o Use flag APR_ENCODE_BASE64URL
|
||||
* o https://tools.ietf.org/html/rfc7515#appendix-C
|
||||
*
|
||||
* - Base 32 Encoding
|
||||
*
|
||||
* o Use flag APR_ENCODE_NONE
|
||||
* o https://tools.ietf.org/html/rfc4648#section-6
|
||||
*
|
||||
* - Base 32 Encoding with Extended Hex Alphabet
|
||||
*
|
||||
* o Use flag APR_ENCODE_BASE32HEX
|
||||
* o https://tools.ietf.org/html/rfc4648#section-7
|
||||
*
|
||||
* - Base 16 Encoding
|
||||
*
|
||||
* o Use flags APR_ENCODE_NONE/APR_ENCODE_COLON
|
||||
* o https://tools.ietf.org/html/rfc4648#section-8
|
||||
*
|
||||
* If a non valid character of any kind including whitespace is passed to any
|
||||
* of the decoder functions, APR_BADCH will be returned. In this case decoding
|
||||
* will still take place, but the results can not be trusted.
|
||||
*
|
||||
* If APR_ENCODE_RELAXED is passed to the decoder functions, decoding will be
|
||||
* attempted up until the first non valid character. If this results in an
|
||||
* invalid state in the decoder, such as but not limited to an odd number of
|
||||
* base16 characters, APR_BADCH will still be returned.
|
||||
*
|
||||
* If APR_ENCODE_RELAXED is not passed to a decoder function, the decoding will
|
||||
* be done in constant time regardless of whether the result returns APR_SUCCESS
|
||||
* or APR_BADCH.
|
||||
*
|
||||
* If the dest parameter is NULL, the maximum theoretical buffer size is
|
||||
* returned in the len field, including space for a terminating zero character
|
||||
* if the destination is a string. This value can be used to allocate buffers
|
||||
* of a suitable safe size.
|
||||
*
|
||||
* If the dest parameter is provided, the encoding or decoding will take place,
|
||||
* and the actual number of characters written is returned in the len field,
|
||||
* ignoring any terminating zero.
|
||||
*
|
||||
* Plain strings are not assumed '\0' terminated unless APR_ENCODE_STRING is
|
||||
* provided.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* When passing a string to one of the encode functions, this value can be
|
||||
* passed to indicate a string-valued key, and have the length computed
|
||||
* automatically.
|
||||
*/
|
||||
#define APR_ENCODE_STRING (-1)
|
||||
|
||||
/**
|
||||
* Generate RFC4648 base16/base32/base64.
|
||||
*/
|
||||
#define APR_ENCODE_NONE 0
|
||||
|
||||
/**
|
||||
* If relaxed, decode up until the first non base16/base32/base64 character.
|
||||
*/
|
||||
#define APR_ENCODE_RELAXED 1
|
||||
|
||||
/**
|
||||
* Omit the padding character (=) while encoding.
|
||||
*/
|
||||
#define APR_ENCODE_NOPADDING 2
|
||||
|
||||
/**
|
||||
* Generate RFC4648 Base 64 Encoding with URL and Filename Safe Alphabet
|
||||
*/
|
||||
#define APR_ENCODE_URL 4
|
||||
|
||||
/**
|
||||
* Generate RFC7515 BASE64URL
|
||||
*/
|
||||
#define APR_ENCODE_BASE64URL (APR_ENCODE_NOPADDING | APR_ENCODE_URL)
|
||||
|
||||
/**
|
||||
* Generate base32hex encoding instead of base32 encoding
|
||||
*/
|
||||
#define APR_ENCODE_BASE32HEX 8
|
||||
|
||||
/**
|
||||
* Generate base16 with colons between each token.
|
||||
*/
|
||||
#define APR_ENCODE_COLON 16
|
||||
|
||||
/**
|
||||
* Generate base16 with lower case characters.
|
||||
*/
|
||||
#define APR_ENCODE_LOWER 32
|
||||
|
||||
/**
|
||||
* Convert text data to base64.
|
||||
* @param dest The destination string, can be NULL to output in \c len the
|
||||
* needed buffer length for encoding.
|
||||
* @param src The original string, can be NULL if \c dest is NULL and \c slen
|
||||
* is positive or nul.
|
||||
* @param slen The length of the original string, or APR_ENCODE_STRING if
|
||||
* the actual length should be computed based on NUL termination.
|
||||
* @param flags If APR_ENCODE_NONE, emit RFC4648 Base 64 Encoding. If
|
||||
* APR_ENCODE_NOPADDING, omit the = padding character. If APR_ENCODE_URL,
|
||||
* use RFC4648 Base 64 Encoding with URL and Filename Safe Alphabet.
|
||||
* If APR_ENCODE_BASE64URL, use RFC7515 base64url Encoding.
|
||||
* @param len If not NULL, outputs the length of the buffer needed for encoding
|
||||
* (including the trailing NUL) if \c dest is NULL, or the actual length of
|
||||
* the encoding (excluding the trailing NUL) if \c dest is not NULL.
|
||||
* @return APR_SUCCESS, or APR_EINVAL if \c slen is not APR_ENCODE_STRING and
|
||||
* negative, or APR_NOTFOUND if \c dest is not NULL and \c src is NULL, or
|
||||
* APR_ENOSPC if \c dest is NULL and the source length (based on \c slen or
|
||||
* APR_ENCODE_STRING) is too big to encode.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_encode_base64(char *dest, const char *src,
|
||||
apr_ssize_t slen, int flags, apr_size_t * len);
|
||||
|
||||
/**
|
||||
* Convert binary data to base64.
|
||||
* @param dest The destination string, can be NULL to output in \c len the
|
||||
* needed buffer length for encoding.
|
||||
* @param src The original buffer, can be NULL if \c dest is NULL.
|
||||
* @param slen The length of the original buffer.
|
||||
* @param flags If APR_ENCODE_NONE, emit RFC4648 Base 64 Encoding. If
|
||||
* APR_ENCODE_NOPADDING, omit the = padding character. If APR_ENCODE_URL,
|
||||
* use RFC4648 Base 64 Encoding with URL and Filename Safe Alphabet.
|
||||
* If APR_ENCODE_BASE64URL, use RFC7515 base64url Encoding.
|
||||
* @param len If not NULL, outputs the length of the buffer needed for encoding
|
||||
* (including the trailing NUL) if \c dest is NULL, or the actual length of
|
||||
* the encoding (excluding the trailing NUL) if \c dest is not NULL.
|
||||
* @return APR_SUCCESS, or APR_EINVAL if \c slen is negative, or APR_NOTFOUND
|
||||
* if \c dest is not NULL and \c src is NULL, or APR_ENOSPC if \c dest is NULL
|
||||
* and the source length (based on \c slen or APR_ENCODE_STRING) is too big to
|
||||
* encode.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_encode_base64_binary(char *dest, const unsigned char *src,
|
||||
apr_ssize_t slen, int flags, apr_size_t * len);
|
||||
|
||||
/**
|
||||
* Convert text data to base64, and return the results from a pool.
|
||||
* @param p Pool to allocate from.
|
||||
* @param src The original string.
|
||||
* @param slen The length of the original string, or APR_ENCODE_STRING if
|
||||
* the actual length should be computed based on NUL termination.
|
||||
* @param flags If APR_ENCODE_NONE, emit RFC4648 Base 64 Encoding. If
|
||||
* APR_ENCODE_NOPADDING, omit the = padding character. If APR_ENCODE_URL,
|
||||
* use RFC4648 Base 64 Encoding with URL and Filename Safe Alphabet.
|
||||
* If APR_ENCODE_BASE64URL, use RFC7515 base64url Encoding.
|
||||
* @param len If not NULL, outputs the length of the encoding (excluding the
|
||||
* trailing NUL).
|
||||
* @return A NUL terminated string allocated from the pool on success,
|
||||
* or NULL if src is NULL or allocation failed or the encoding is not
|
||||
* possible (see apr_encode_base64 errors).
|
||||
*/
|
||||
APR_DECLARE(const char *)apr_pencode_base64(apr_pool_t * p, const char *src,
|
||||
apr_ssize_t slen, int flags, apr_size_t * len)__attribute__((nonnull(1)));
|
||||
|
||||
/**
|
||||
* Convert binary data to base64, and return the results from a pool.
|
||||
* @param p Pool to allocate from.
|
||||
* @param src The original buffer.
|
||||
* @param slen The length of the original buffer.
|
||||
* @param flags If APR_ENCODE_NONE, emit RFC4648 Base 64 Encoding. If
|
||||
* APR_ENCODE_NOPADDING, omit the = padding character. If APR_ENCODE_URL,
|
||||
* use RFC4648 Base 64 Encoding with URL and Filename Safe Alphabet.
|
||||
* If APR_ENCODE_BASE64URL, use RFC7515 base64url Encoding.
|
||||
* @param len If not NULL, outputs the length of the encoding (excluding the
|
||||
* trailing NUL).
|
||||
* @return A NUL terminated string allocated from the pool on success,
|
||||
* or NULL if src is NULL or allocation failed or the encoding is not
|
||||
* possible (see apr_encode_base64_binary errors).
|
||||
*/
|
||||
APR_DECLARE(const char *)apr_pencode_base64_binary(apr_pool_t * p, const unsigned char *src,
|
||||
apr_ssize_t slen, int flags, apr_size_t * len)__attribute__((nonnull(1)));
|
||||
|
||||
/**
|
||||
* Convert base64 or base64url with or without padding to text data.
|
||||
* @param dest The destination string, can be NULL to output in \c len the
|
||||
* needed buffer length for decoding.
|
||||
* @param src The base64 string, can be NULL if \c dest is NULL and \c slen
|
||||
* is positive or nul.
|
||||
* @param slen The length of the base64 string, or APR_ENCODE_STRING if
|
||||
* the actual length should be computed based on NUL termination.
|
||||
* @param flags If APR_ENCODE_NONE, attempt to decode the full base64 string,
|
||||
* and return NULL if any bad character is detected. If APR_ENCODE_RELAXED,
|
||||
* decode until the first non base64/base64url character.
|
||||
* @param len If not NULL, outputs the length of the buffer needed for decoding
|
||||
* (including the trailing NUL) if \c dest is NULL, or the actual length of
|
||||
* the decoding (excluding the trailing NUL) if \c dest is not NULL.
|
||||
* @return APR_SUCCESS, or APR_EINVAL if \c slen is not APR_ENCODE_STRING and
|
||||
* negative, or APR_NOTFOUND if \c dest is not NULL and \c src is NULL, or
|
||||
* APR_ENOSPC if \c dest is NULL and the source length (based on \c slen or
|
||||
* APR_ENCODE_STRING) is too big to decode, or APR_EINCOMPLETE if the source
|
||||
* length (based on \c slen or APR_ENCODE_STRING) is invalid for a base64
|
||||
* encoding, or APR_BADCH if a non base64 character is present and
|
||||
* APR_ENCODE_RELAXED is not specified.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_decode_base64(char *dest, const char *src,
|
||||
apr_ssize_t slen, int flags, apr_size_t * len);
|
||||
|
||||
/**
|
||||
* Convert base64 or base64url with or without padding to binary data.
|
||||
* @param dest The destination string, can be NULL to output in \c len the
|
||||
* needed buffer length for decoding.
|
||||
* @param src The base64 string, can be NULL if \c dest is NULL and \c slen
|
||||
* is positive or nul.
|
||||
* @param slen The length of the base64 string, or APR_ENCODE_STRING if
|
||||
* the actual length should be computed based on NUL termination.
|
||||
* @param flags If APR_ENCODE_NONE, attempt to decode the full base64 string,
|
||||
* and return NULL if any bad character is detected. If APR_ENCODE_RELAXED,
|
||||
* decode until the first non base64/base64url character.
|
||||
* @param len If not NULL, outputs the length of the buffer needed for decoding
|
||||
* (including the trailing NUL) if \c dest is NULL, or the actual length of
|
||||
* the decoding (excluding the trailing NUL) if \c dest is not NULL.
|
||||
* @return APR_SUCCESS, or APR_EINVAL if \c slen is not APR_ENCODE_STRING and
|
||||
* negative, or APR_NOTFOUND if \c dest is not NULL and \c src is NULL, or
|
||||
* APR_ENOSPC if \c dest is NULL and the source length (based on \c slen or
|
||||
* APR_ENCODE_STRING) is too big to decode, or APR_EINCOMPLETE if the source
|
||||
* length (based on \c slen or APR_ENCODE_STRING) is invalid for a base64
|
||||
* encoding, or APR_BADCH if a non base64 character is present and
|
||||
* APR_ENCODE_RELAXED is not specified.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_decode_base64_binary(unsigned char *dest,
|
||||
const char *src, apr_ssize_t slen, int flags, apr_size_t * len);
|
||||
|
||||
/**
|
||||
* Convert base64 or base64url with or without padding to text data, and
|
||||
* return the results from a pool.
|
||||
* @param p Pool to allocate from.
|
||||
* @param src The base64 string to decode.
|
||||
* @param slen The length of the original string, or APR_ENCODE_STRING if
|
||||
* the actual length should be computed based on NUL termination.
|
||||
* @param flags If APR_ENCODE_NONE, attempt to decode the full original buffer,
|
||||
* and return NULL if any bad character is detected. If APR_ENCODE_RELAXED,
|
||||
* decode until the first non base64/base64url character.
|
||||
* @param len If not NULL, outputs the length of the decoding (excluding the
|
||||
* trailing NUL).
|
||||
* @return A NUL terminated string allocated from the pool on success,
|
||||
* or NULL if src is NULL or allocation failed or the decoding is not
|
||||
* possible (see apr_decode_base64_binary errors).
|
||||
*/
|
||||
APR_DECLARE(const char *)apr_pdecode_base64(apr_pool_t * p, const char *src,
|
||||
apr_ssize_t slen, int flags, apr_size_t * len)
|
||||
__attribute__((nonnull(1)));
|
||||
|
||||
/**
|
||||
* Convert base64 or base64url with or without padding to binary data, and
|
||||
* return the results from a pool.
|
||||
* @param p Pool to allocate from.
|
||||
* @param src The base64 string to decode.
|
||||
* @param slen The length of the original string, or APR_ENCODE_STRING if
|
||||
* the actual length should be computed based on NUL termination.
|
||||
* @param flags If APR_ENCODE_NONE, attempt to decode the full original buffer,
|
||||
* and return NULL if any bad character is detected. If APR_ENCODE_RELAXED,
|
||||
* decode until the first non base64/base64url character.
|
||||
* @param len If not NULL, outputs the length of the decoding (excluding the
|
||||
* trailing NUL).
|
||||
* @return A NUL terminated string allocated from the pool on success,
|
||||
* or NULL if src is NULL or allocation failed or the decoding is not
|
||||
* possible (see apr_decode_base64_binary errors).
|
||||
*/
|
||||
APR_DECLARE(const unsigned char *)apr_pdecode_base64_binary(apr_pool_t * p,
|
||||
const char *src, apr_ssize_t slen, int flags, apr_size_t * len)
|
||||
__attribute__((nonnull(1)));
|
||||
|
||||
/**
|
||||
* Convert text data to base32.
|
||||
* @param dest The destination string, can be NULL to output in \c len the
|
||||
* needed buffer length for encoding.
|
||||
* @param src The original string, can be NULL if \c dest is NULL and \c slen
|
||||
* is positive or nul.
|
||||
* @param slen The length of the original string, or APR_ENCODE_STRING if
|
||||
* the actual length should be computed based on NUL termination.
|
||||
* @param flags If APR_ENCODE_NONE, emit RFC4648 Base 32 Encoding. If
|
||||
* APR_ENCODE_NOPADDING, omit the = padding character. If APR_ENCODE_BASE32HEX,
|
||||
* use RFC4648 base32hex Encoding.
|
||||
* @param len If not NULL, outputs the length of the buffer needed for encoding
|
||||
* (including the trailing NUL) if \c dest is NULL, or the actual length of
|
||||
* the encoding (excluding the trailing NUL) if \c dest is not NULL.
|
||||
* @return APR_SUCCESS, or APR_EINVAL if \c slen is not APR_ENCODE_STRING and
|
||||
* negative, or APR_NOTFOUND if \c dest is not NULL and \c src is NULL, or
|
||||
* APR_ENOSPC if \c dest is NULL and the source length (based on \c slen or
|
||||
* APR_ENCODE_STRING) is too big to encode.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_encode_base32(char *dest, const char *src,
|
||||
apr_ssize_t slen, int flags, apr_size_t * len);
|
||||
|
||||
/**
|
||||
* Convert binary data to base32.
|
||||
* @param dest The destination string, can be NULL to output in \c len the
|
||||
* needed buffer length for encoding.
|
||||
* @param src The original buffer, can be NULL if \c dest is NULL.
|
||||
* @param slen The length of the original buffer.
|
||||
* @param flags If APR_ENCODE_NONE, emit RFC4648 Base 32 Encoding. If
|
||||
* APR_ENCODE_NOPADDING, omit the = padding character. If APR_ENCODE_BASE32HEX,
|
||||
* use RFC4648 base32hex Encoding.
|
||||
* @param len If not NULL, outputs the length of the buffer needed for encoding
|
||||
* (including the trailing NUL) if \c dest is NULL, or the actual length of
|
||||
* the encoding (excluding the trailing NUL) if \c dest is not NULL.
|
||||
* @return APR_SUCCESS, or APR_EINVAL if \c slen is negative, or APR_NOTFOUND
|
||||
* if \c dest is not NULL and \c src is NULL, or APR_ENOSPC if \c dest is NULL
|
||||
* and the source length (based on \c slen or APR_ENCODE_STRING) is too big to
|
||||
* encode.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_encode_base32_binary(char *dest, const unsigned char *src,
|
||||
apr_ssize_t slen, int flags, apr_size_t * len);
|
||||
|
||||
/**
|
||||
* Convert text data to base32, and return the results from a pool.
|
||||
* @param p Pool to allocate from.
|
||||
* @param src The original string.
|
||||
* @param slen The length of the original string, or APR_ENCODE_STRING if
|
||||
* the actual length should be computed based on NUL termination.
|
||||
* @param flags If APR_ENCODE_NONE, emit RFC4648 Base 32 Encoding. If
|
||||
* APR_ENCODE_NOPADDING, omit the = padding character. If APR_ENCODE_BASE32HEX,
|
||||
* use RFC4648 base32hex Encoding.
|
||||
* @param len If not NULL, outputs the length of the encoding (excluding the
|
||||
* trailing NUL).
|
||||
* @return A NUL terminated string allocated from the pool on success,
|
||||
* or NULL if src is NULL or allocation failed or the encoding is not
|
||||
* possible (see apr_encode_base32 errors).
|
||||
*/
|
||||
APR_DECLARE(const char *)apr_pencode_base32(apr_pool_t * p, const char *src,
|
||||
apr_ssize_t slen, int flags, apr_size_t * len)
|
||||
__attribute__((nonnull(1)));
|
||||
|
||||
/**
|
||||
* Convert binary data to base32, and return the results from a pool.
|
||||
* @param p Pool to allocate from.
|
||||
* @param src The original buffer.
|
||||
* @param slen The length of the original buffer.
|
||||
* @param flags If APR_ENCODE_NONE, emit RFC4648 Base 32 Encoding. If
|
||||
* APR_ENCODE_NOPADDING, omit the = padding character. If APR_ENCODE_BASE32HEX,
|
||||
* use RFC4648 base32hex Encoding.
|
||||
* @param len If not NULL, outputs the length of the encoding (excluding the
|
||||
* trailing NUL).
|
||||
* @return A NUL terminated string allocated from the pool on success,
|
||||
* or NULL if src is NULL or allocation failed or the encoding is not
|
||||
* possible (see apr_encode_base32_binary errors).
|
||||
*/
|
||||
APR_DECLARE(const char *)apr_pencode_base32_binary(apr_pool_t * p, const unsigned char *src,
|
||||
apr_ssize_t slen, int flags, apr_size_t * len)
|
||||
__attribute__((nonnull(1)));
|
||||
|
||||
/**
|
||||
* Convert base32 or base32hex with or without padding to text data.
|
||||
* @param dest The destination string, can be NULL to output in \c len the
|
||||
* needed buffer length for decoding.
|
||||
* @param src The base32 string, can be NULL if \c dest is NULL and \c slen
|
||||
* is positive or nul.
|
||||
* @param slen The length of the base32 string, or APR_ENCODE_STRING if
|
||||
* the actual length should be computed based on NUL termination.
|
||||
* @param flags If APR_ENCODE_NONE, parse RFC4648 Base 32 Encoding. If
|
||||
* APR_ENCODE_BASE32HEX, use RFC4648 base32hex Encoding.
|
||||
* @param len If not NULL, outputs the length of the buffer needed for decoding
|
||||
* (including the trailing NUL) if \c dest is NULL, or the actual length of
|
||||
* the decoding (excluding the trailing NUL) if \c dest is not NULL.
|
||||
* @return APR_SUCCESS, or APR_EINVAL if \c slen is not APR_ENCODE_STRING and
|
||||
* negative, or APR_NOTFOUND if \c dest is not NULL and \c src is NULL, or
|
||||
* APR_ENOSPC if \c dest is NULL and the source length (based on \c slen or
|
||||
* APR_ENCODE_STRING) is too big to decode, or APR_EINCOMPLETE if the source
|
||||
* length (based on \c slen or APR_ENCODE_STRING) is invalid for a base32
|
||||
* encoding, or APR_BADCH if a non base32 character is present and
|
||||
* APR_ENCODE_RELAXED is not specified.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_decode_base32(char *dest, const char *src,
|
||||
apr_ssize_t slen, int flags, apr_size_t * len);
|
||||
|
||||
/**
|
||||
* Convert base32 or base32hex with or without padding to binary data.
|
||||
* @param dest The destination string, can be NULL to output in \c len the
|
||||
* needed buffer length for decoding.
|
||||
* @param src The base32 string, can be NULL if \c dest is NULL and \c slen
|
||||
* is positive or nul.
|
||||
* @param slen The length of the base32 string, or APR_ENCODE_STRING if
|
||||
* the actual length should be computed based on NUL termination.
|
||||
* @param flags If APR_ENCODE_NONE, parse RFC4648 Base 32 Encoding. If
|
||||
* APR_ENCODE_BASE32HEX, use RFC4648 base32hex Encoding.
|
||||
* @param len If not NULL, outputs the length of the buffer needed for decoding
|
||||
* (including the trailing NUL) if \c dest is NULL, or the actual length of
|
||||
* the decoding (excluding the trailing NUL) if \c dest is not NULL.
|
||||
* @return APR_SUCCESS, or APR_EINVAL if \c slen is not APR_ENCODE_STRING and
|
||||
* negative, or APR_NOTFOUND if \c dest is not NULL and \c src is NULL, or
|
||||
* APR_ENOSPC if \c dest is NULL and the source length (based on \c slen or
|
||||
* APR_ENCODE_STRING) is too big to decode, or APR_EINCOMPLETE if the source
|
||||
* length (based on \c slen or APR_ENCODE_STRING) is invalid for a base32
|
||||
* encoding, or APR_BADCH if a non base32 character is present and
|
||||
* APR_ENCODE_RELAXED is not specified.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_decode_base32_binary(unsigned char *dest,
|
||||
const char *src, apr_ssize_t slen, int flags, apr_size_t * len);
|
||||
|
||||
/**
|
||||
* Convert base32 or base32hex with or without padding to text data, and
|
||||
* return the results from a pool.
|
||||
* @param p Pool to allocate from.
|
||||
* @param src The base32 string to decode.
|
||||
* @param slen The length of the original string, or APR_ENCODE_STRING if
|
||||
* the actual length should be computed based on NUL termination.
|
||||
* @param flags If APR_ENCODE_NONE, parse RFC4648 Base 32 Encoding. If
|
||||
* APR_ENCODE_BASE32HEX, use RFC4648 base32hex Encoding.
|
||||
* @param len If not NULL, outputs the length of the encoding (excluding the
|
||||
* trailing NUL).
|
||||
* @return A NUL terminated string allocated from the pool on success,
|
||||
* or NULL if src is NULL or allocation failed or the decoding is not
|
||||
* possible (see apr_decode_base32 errors).
|
||||
*/
|
||||
APR_DECLARE(const char *)apr_pdecode_base32(apr_pool_t * p, const char *src,
|
||||
apr_ssize_t slen, int flags, apr_size_t * len)
|
||||
__attribute__((nonnull(1)));
|
||||
|
||||
/**
|
||||
* Convert base32 or base32hex with or without padding to binary data, and
|
||||
* return the results from a pool.
|
||||
* @param p Pool to allocate from.
|
||||
* @param src The base32 string to decode.
|
||||
* @param slen The length of the original string, or APR_ENCODE_STRING if
|
||||
* the actual length should be computed based on NUL termination.
|
||||
* @param flags If APR_ENCODE_NONE, parse RFC4648 Base 32 Encoding. If
|
||||
* APR_ENCODE_BASE32HEX, use RFC4648 base32hex Encoding.
|
||||
* @param len If not NULL, outputs the length of the encoding (excluding the
|
||||
* trailing NUL).
|
||||
* @return A NUL terminated string allocated from the pool on success,
|
||||
* or NULL if src is NULL or allocation failed or the decoding is not
|
||||
* possible (see apr_decode_base32_binary errors).
|
||||
*/
|
||||
APR_DECLARE(const unsigned char *)apr_pdecode_base32_binary(apr_pool_t * p,
|
||||
const char *src, apr_ssize_t slen, int flags, apr_size_t * len)
|
||||
__attribute__((nonnull(1)));
|
||||
|
||||
/**
|
||||
* Convert text data to base16 (hex).
|
||||
* @param dest The destination string, can be NULL to output in \c len the
|
||||
* needed buffer length for encoding.
|
||||
* @param src The original string, can be NULL if \c dest is NULL and \c slen
|
||||
* is positive or nul.
|
||||
* @param slen The length of the original string, or APR_ENCODE_STRING if
|
||||
* the actual length should be computed based on NUL termination.
|
||||
* @param flags If APR_ENCODE_NONE, emit RFC4648 Base 16 Encoding. If
|
||||
* APR_ENCODE_COLON, separate each token with a colon.
|
||||
* @param len If not NULL, outputs the length of the buffer needed for encoding
|
||||
* (including the trailing NUL) if \c dest is NULL, or the actual length of
|
||||
* the encoding (excluding the trailing NUL) if \c dest is not NULL.
|
||||
* @return APR_SUCCESS, or APR_EINVAL if \c slen is not APR_ENCODE_STRING and
|
||||
* negative, or APR_NOTFOUND if \c dest is not NULL and \c src is NULL, or
|
||||
* APR_ENOSPC if \c dest is NULL and the source length (based on \c slen or
|
||||
* APR_ENCODE_STRING) is too big to encode.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_encode_base16(char *dest, const char *src,
|
||||
apr_ssize_t slen, int flags, apr_size_t * len);
|
||||
|
||||
/**
|
||||
* Convert binary data to base16 (hex).
|
||||
* @param dest The destination string, can be NULL to output in \c len the
|
||||
* needed buffer length for encoding.
|
||||
* @param src The original buffer, can be NULL if \c dest is NULL.
|
||||
* @param slen The length of the original buffer.
|
||||
* @param flags If APR_ENCODE_NONE, emit RFC4648 Base 16 Encoding. If
|
||||
* APR_ENCODE_COLON, separate each token with a colon.
|
||||
* @param len If not NULL, outputs the length of the buffer needed for encoding
|
||||
* (including the trailing NUL) if \c dest is NULL, or the actual length of
|
||||
* the encoding (excluding the trailing NUL) if \c dest is not NULL.
|
||||
* @return APR_SUCCESS, or APR_EINVAL if \c slen is negative, or APR_NOTFOUND
|
||||
* if \c dest is not NULL and \c src is NULL, or APR_ENOSPC if \c dest is NULL
|
||||
* and the source length (based on \c slen or APR_ENCODE_STRING) is too big to
|
||||
* encode.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_encode_base16_binary(char *dest,
|
||||
const unsigned char *src, apr_ssize_t slen, int flags,
|
||||
apr_size_t * len);
|
||||
|
||||
/**
|
||||
* Convert text data to base16 (hex), and return the results from a
|
||||
* pool.
|
||||
* @param p Pool to allocate from.
|
||||
* @param src The original string.
|
||||
* @param slen The length of the original string, or APR_ENCODE_STRING if
|
||||
* the actual length should be computed based on NUL termination.
|
||||
* @param flags If APR_ENCODE_NONE, emit RFC4648 Base 16 Encoding. If
|
||||
* APR_ENCODE_COLON, separate each token with a colon.
|
||||
* @param len If not NULL, outputs the length of the encoding (excluding the
|
||||
* trailing NUL).
|
||||
* @return A NUL terminated string allocated from the pool on success,
|
||||
* or NULL if src is NULL or allocation failed or the encoding is not
|
||||
* possible (see apr_encode_base16 errors).
|
||||
*/
|
||||
APR_DECLARE(const char *)apr_pencode_base16(apr_pool_t * p, const char *src,
|
||||
apr_ssize_t slen, int flags, apr_size_t * len)
|
||||
__attribute__((nonnull(1)));
|
||||
|
||||
/**
|
||||
* Convert binary data to base16 (hex), and return the results from a
|
||||
* pool.
|
||||
* @param p Pool to allocate from.
|
||||
* @param src The original buffer.
|
||||
* @param slen The length of the original buffer.
|
||||
* @param flags If APR_ENCODE_NONE, emit RFC4648 Base 16 Encoding. If
|
||||
* APR_ENCODE_COLON, separate each token with a colon.
|
||||
* @param len If not NULL, outputs the length of the encoding (excluding the
|
||||
* trailing NUL).
|
||||
* @return A NUL terminated string allocated from the pool on success,
|
||||
* or NULL if src is NULL or allocation failed or the encoding is not
|
||||
* possible (see apr_encode_base16_binary errors).
|
||||
*/
|
||||
APR_DECLARE(const char *)apr_pencode_base16_binary(apr_pool_t * p,
|
||||
const unsigned char *src, apr_ssize_t slen,
|
||||
int flags, apr_size_t * len)__attribute__((nonnull(1)));
|
||||
|
||||
/**
|
||||
* Convert base16 (hex) to text data.
|
||||
* @param dest The destination string, can be NULL to output in \c len the
|
||||
* needed buffer length for decoding.
|
||||
* @param src The base16 string, can be NULL if \c dest is NULL and \c slen
|
||||
* is positive or nul.
|
||||
* @param slen The length of the base16 string, or APR_ENCODE_STRING if
|
||||
* the actual length should be computed based on NUL termination.
|
||||
* @param flags If APR_ENCODE_NONE, parse RFC4648 Base 16 Encoding. If
|
||||
* APR_ENCODE_COLON, allow tokens to be separated with a colon.
|
||||
* @param len If not NULL, outputs the length of the buffer needed for decoding
|
||||
* (including the trailing NUL) if \c dest is NULL, or the actual length of
|
||||
* the decoding (excluding the trailing NUL) if \c dest is not NULL.
|
||||
* @return APR_SUCCESS, or APR_EINVAL if \c slen is not APR_ENCODE_STRING and
|
||||
* negative, or APR_NOTFOUND if \c dest is not NULL and \c src is NULL, or
|
||||
* APR_ENOSPC if \c dest is NULL and the source length (based on \c slen or
|
||||
* APR_ENCODE_STRING) is too big to decode, or APR_EINCOMPLETE if the source
|
||||
* length (based on \c slen or APR_ENCODE_STRING) is invalid for a base16
|
||||
* encoding, or APR_BADCH if a non base16 character is present and
|
||||
* APR_ENCODE_RELAXED is not specified.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_decode_base16(char *dest, const char *src,
|
||||
apr_ssize_t slen, int flags, apr_size_t * len);
|
||||
|
||||
/**
|
||||
* Convert base16 (hex) to binary data.
|
||||
* @param dest The destination string, can be NULL to output in \c len the
|
||||
* needed buffer length for decoding.
|
||||
* @param src The base16 string, can be NULL if \c dest is NULL and \c slen
|
||||
* is positive or nul.
|
||||
* @param slen The length of the base16 string, or APR_ENCODE_STRING if
|
||||
* the actual length should be computed based on NUL termination.
|
||||
* @param flags If APR_ENCODE_NONE, parse RFC4648 Base 16 Encoding. If
|
||||
* APR_ENCODE_COLON, allow tokens to be separated with a colon.
|
||||
* @param len If not NULL, outputs the length of the buffer needed for decoding
|
||||
* (including the trailing NUL) if \c dest is NULL, or the actual length of
|
||||
* the decoding (excluding the trailing NUL) if \c dest is not NULL.
|
||||
* @return APR_SUCCESS, or APR_EINVAL if \c slen is not APR_ENCODE_STRING and
|
||||
* negative, or APR_NOTFOUND if \c dest is not NULL and \c src is NULL, or
|
||||
* APR_ENOSPC if \c dest is NULL and the source length (based on \c slen or
|
||||
* APR_ENCODE_STRING) is too big to decode, or APR_EINCOMPLETE if the source
|
||||
* length (based on \c slen or APR_ENCODE_STRING) is invalid for a base16
|
||||
* encoding, or APR_BADCH if a non base16 character is present and
|
||||
* APR_ENCODE_RELAXED is not specified.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_decode_base16_binary(unsigned char *dest,
|
||||
const char *src, apr_ssize_t slen, int flags, apr_size_t * len);
|
||||
|
||||
/**
|
||||
* Convert base16 (hex) and return the results from a pool.
|
||||
* @param p Pool to allocate from.
|
||||
* @param src The base16 string to decode.
|
||||
* @param slen The length of the original string, or APR_ENCODE_STRING if
|
||||
* the actual length should be computed based on NUL termination.
|
||||
* @param flags If APR_ENCODE_NONE, parse RFC4648 Base 16 Encoding. If
|
||||
* APR_ENCODE_COLON, allow tokens to be separated with a colon.
|
||||
* @param len If not NULL, outputs the length of the encoding (excluding the
|
||||
* trailing NUL).
|
||||
* @return A NUL terminated string allocated from the pool on success,
|
||||
* or NULL if src is NULL or allocation failed or the decoding is not
|
||||
* possible (see apr_decode_base16 errors).
|
||||
*/
|
||||
APR_DECLARE(const char *)apr_pdecode_base16(apr_pool_t * p, const char *src,
|
||||
apr_ssize_t slen, int flags, apr_size_t * len)
|
||||
__attribute__((nonnull(1)));
|
||||
|
||||
/**
|
||||
* Convert base16 (hex) to binary data, and return the results from a pool.
|
||||
* @param p Pool to allocate from.
|
||||
* @param src The base16 string to decode.
|
||||
* @param slen The length of the original string, or APR_ENCODE_STRING if
|
||||
* the actual length should be computed based on NUL termination.
|
||||
* @param flags If APR_ENCODE_NONE, parse RFC4648 Base 16 Encoding. If
|
||||
* APR_ENCODE_COLON, allow tokens to be separated with a colon.
|
||||
* @param len If not NULL, outputs the length of the encoding (excluding the
|
||||
* trailing NUL).
|
||||
* @return A NUL terminated string allocated from the pool on success,
|
||||
* or NULL if src is NULL or allocation failed or the decoding is not
|
||||
* possible (see apr_decode_base16_binary errors).
|
||||
*/
|
||||
APR_DECLARE(const unsigned char *)apr_pdecode_base16_binary(apr_pool_t * p,
|
||||
const char *src, apr_ssize_t slen, int flags, apr_size_t * len)
|
||||
__attribute__((nonnull(1)));
|
||||
|
||||
/** @} */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !APR_ENCODE_H */
|
||||
67
database/apache/include/apr_env.h
Normal file
67
database/apache/include/apr_env.h
Normal file
@@ -0,0 +1,67 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_ENV_H
|
||||
#define APR_ENV_H
|
||||
/**
|
||||
* @file apr_env.h
|
||||
* @brief APR Environment functions
|
||||
*/
|
||||
#include "apr_errno.h"
|
||||
#include "apr_pools.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @defgroup apr_env Functions for manipulating the environment
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Get the value of an environment variable
|
||||
* @param value the returned value, allocated from @a pool
|
||||
* @param envvar the name of the environment variable
|
||||
* @param pool where to allocate @a value and any temporary storage from
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_env_get(char **value, const char *envvar,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Set the value of an environment variable
|
||||
* @param envvar the name of the environment variable
|
||||
* @param value the value to set
|
||||
* @param pool where to allocate temporary storage from
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_env_set(const char *envvar, const char *value,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Delete a variable from the environment
|
||||
* @param envvar the name of the environment variable
|
||||
* @param pool where to allocate temporary storage from
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_env_delete(const char *envvar, apr_pool_t *pool);
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ! APR_ENV_H */
|
||||
1342
database/apache/include/apr_errno.h
Normal file
1342
database/apache/include/apr_errno.h
Normal file
File diff suppressed because it is too large
Load Diff
431
database/apache/include/apr_escape.h
Normal file
431
database/apache/include/apr_escape.h
Normal file
@@ -0,0 +1,431 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/**
|
||||
* @file apr_escape.h
|
||||
* @brief APR-UTIL Escaping
|
||||
*/
|
||||
#ifndef APR_ESCAPE_H
|
||||
#define APR_ESCAPE_H
|
||||
#include "apr.h"
|
||||
#include "apr_general.h"
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup APR_Util_Escaping Escape functions
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Simple escape/unescape functions.
|
||||
*
|
||||
* The design goal of these functions are:
|
||||
*
|
||||
* - Avoid unnecessary work.
|
||||
*
|
||||
* In most cases the strings passed in do not need to be escaped at all. In
|
||||
* these cases the original string will be returned.
|
||||
*
|
||||
* - Lowest possible memory footprint.
|
||||
*
|
||||
* The amount of memory allocated for a given encoding is calculated based
|
||||
* on the exact amount of memory needed, and not the theoretical worst case
|
||||
* scenario.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* When passing a string to one of the escape functions, this value can be
|
||||
* passed to indicate a string-valued key, and have the length computed
|
||||
* automatically.
|
||||
*/
|
||||
#define APR_ESCAPE_STRING (-1)
|
||||
|
||||
/**
|
||||
* Apply LDAP distinguished name escaping as per RFC4514.
|
||||
*/
|
||||
#define APR_ESCAPE_LDAP_DN (0x01)
|
||||
|
||||
/**
|
||||
* Apply LDAP filter escaping as per RFC4515.
|
||||
*/
|
||||
#define APR_ESCAPE_LDAP_FILTER (0x02)
|
||||
|
||||
/**
|
||||
* Apply both RFC4514 and RFC4515 LDAP escaping.
|
||||
*/
|
||||
#define APR_ESCAPE_LDAP_ALL (0x03)
|
||||
|
||||
/**
|
||||
* Perform shell escaping on the provided string.
|
||||
*
|
||||
* Shell escaping causes characters to be prefixed with a '\' character.
|
||||
* @param escaped Optional buffer to write the encoded string, can be
|
||||
* NULL
|
||||
* @param str The original string
|
||||
* @param slen The length of the original string, or APR_ESCAPE_STRING
|
||||
* @param len If present, returns the length of the string
|
||||
* @return APR_SUCCESS, or APR_NOTFOUND if no changes to the string were
|
||||
* detected or the string was NULL
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_escape_shell(char *escaped, const char *str,
|
||||
apr_ssize_t slen, apr_size_t *len);
|
||||
|
||||
/**
|
||||
* Perform shell escaping on the provided string, returning the result
|
||||
* from the pool.
|
||||
*
|
||||
* Shell escaping causes characters to be prefixed with a '\' character.
|
||||
*
|
||||
* If no characters were escaped, the original string is returned.
|
||||
* @param p Pool to allocate from
|
||||
* @param str The original string
|
||||
* @return the encoded string, allocated from the pool, or the original
|
||||
* string if no escaping took place or the string was NULL.
|
||||
*/
|
||||
APR_DECLARE(const char *) apr_pescape_shell(apr_pool_t *p, const char *str)
|
||||
__attribute__((nonnull(1)));
|
||||
|
||||
/**
|
||||
* Unescapes a URL, leaving reserved characters intact.
|
||||
* @param escaped Optional buffer to write the encoded string, can be
|
||||
* NULL
|
||||
* @param url String to be unescaped
|
||||
* @param slen The length of the original url, or APR_ESCAPE_STRING
|
||||
* @param forbid Optional list of forbidden characters, in addition to
|
||||
* 0x00
|
||||
* @param reserved Optional list of reserved characters that will be
|
||||
* left unescaped
|
||||
* @param plus If non zero, '+' is converted to ' ' as per
|
||||
* application/x-www-form-urlencoded encoding
|
||||
* @param len If set, the length of the escaped string will be returned
|
||||
* @return APR_SUCCESS on success, APR_NOTFOUND if no characters are
|
||||
* decoded or the string is NULL, APR_EINVAL if a bad escape sequence is
|
||||
* found, APR_BADCH if a character on the forbid list is found.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_unescape_url(char *escaped, const char *url,
|
||||
apr_ssize_t slen, const char *forbid, const char *reserved, int plus,
|
||||
apr_size_t *len);
|
||||
|
||||
/**
|
||||
* Unescapes a URL, leaving reserved characters intact, returning the
|
||||
* result from a pool.
|
||||
* @param p Pool to allocate from
|
||||
* @param url String to be unescaped in place
|
||||
* @param forbid Optional list of forbidden characters, in addition to
|
||||
* 0x00
|
||||
* @param reserved Optional list of reserved characters that will be
|
||||
* left unescaped
|
||||
* @param plus If non zero, '+' is converted to ' ' as per
|
||||
* application/x-www-form-urlencoded encoding
|
||||
* @return A string allocated from the pool on success, the original string
|
||||
* if no characters are decoded, or NULL if a bad escape sequence is found
|
||||
* or if a character on the forbid list is found, or if the original string
|
||||
* was NULL.
|
||||
*/
|
||||
APR_DECLARE(const char *) apr_punescape_url(apr_pool_t *p, const char *url,
|
||||
const char *forbid, const char *reserved, int plus)
|
||||
__attribute__((nonnull(1)));
|
||||
|
||||
/**
|
||||
* Escape a path segment, as defined in RFC1808.
|
||||
* @param escaped Optional buffer to write the encoded string, can be
|
||||
* NULL
|
||||
* @param str The original string
|
||||
* @param slen The length of the original string, or APR_ESCAPE_STRING
|
||||
* @param len If present, returns the length of the string
|
||||
* @return APR_SUCCESS, or APR_NOTFOUND if no changes to the string were
|
||||
* detected or the string was NULL
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_escape_path_segment(char *escaped,
|
||||
const char *str, apr_ssize_t slen, apr_size_t *len);
|
||||
|
||||
/**
|
||||
* Escape a path segment, as defined in RFC1808, returning the result from a
|
||||
* pool.
|
||||
* @param p Pool to allocate from
|
||||
* @param str String to be escaped
|
||||
* @return A string allocated from the pool on success, the original string
|
||||
* if no characters are encoded or the string is NULL.
|
||||
*/
|
||||
APR_DECLARE(const char *) apr_pescape_path_segment(apr_pool_t *p,
|
||||
const char *str) __attribute__((nonnull(1)));
|
||||
|
||||
/**
|
||||
* Converts an OS path to a URL, in an OS dependent way, as defined in RFC1808.
|
||||
* In all cases if a ':' occurs before the first '/' in the URL, the URL should
|
||||
* be prefixed with "./" (or the ':' escaped). In the case of Unix, this means
|
||||
* leaving '/' alone, but otherwise doing what escape_path_segment() does. For
|
||||
* efficiency reasons, we don't use escape_path_segment(), which is provided for
|
||||
* reference. Again, RFC 1808 is where this stuff is defined.
|
||||
*
|
||||
* If partial is set, os_escape_path() assumes that the path will be appended to
|
||||
* something with a '/' in it (and thus does not prefix "./").
|
||||
* @param escaped Optional buffer to write the encoded string, can be
|
||||
* NULL
|
||||
* @param path The original string
|
||||
* @param slen The length of the original string, or APR_ESCAPE_STRING
|
||||
* @param partial If non zero, suppresses the prepending of "./"
|
||||
* @param len If present, returns the length of the string
|
||||
* @return APR_SUCCESS, or APR_NOTFOUND if no changes to the string were
|
||||
* detected or if the string was NULL
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_escape_path(char *escaped, const char *path,
|
||||
apr_ssize_t slen, int partial, apr_size_t *len);
|
||||
|
||||
/**
|
||||
* Converts an OS path to a URL, in an OS dependent way, as defined in RFC1808,
|
||||
* returning the result from a pool.
|
||||
*
|
||||
* In all cases if a ':' occurs before the first '/' in the URL, the URL should
|
||||
* be prefixed with "./" (or the ':' escaped). In the case of Unix, this means
|
||||
* leaving '/' alone, but otherwise doing what escape_path_segment() does. For
|
||||
* efficiency reasons, we don't use escape_path_segment(), which is provided for
|
||||
* reference. Again, RFC 1808 is where this stuff is defined.
|
||||
*
|
||||
* If partial is set, os_escape_path() assumes that the path will be appended to
|
||||
* something with a '/' in it (and thus does not prefix "./").
|
||||
* @param p Pool to allocate from
|
||||
* @param str The original string
|
||||
* @param partial If non zero, suppresses the prepending of "./"
|
||||
* @return A string allocated from the pool on success, the original string
|
||||
* if no characters are encoded or if the string was NULL.
|
||||
*/
|
||||
APR_DECLARE(const char *) apr_pescape_path(apr_pool_t *p, const char *str,
|
||||
int partial) __attribute__((nonnull(1)));
|
||||
|
||||
/**
|
||||
* Urlencode a string, as defined in
|
||||
* http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.1.
|
||||
* @param escaped Optional buffer to write the encoded string, can be
|
||||
* NULL
|
||||
* @param str The original string
|
||||
* @param slen The length of the original string, or APR_ESCAPE_STRING
|
||||
* @param len If present, returns the length of the string
|
||||
* @return APR_SUCCESS, or APR_NOTFOUND if no changes to the string were
|
||||
* detected or if the stirng was NULL
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_escape_urlencoded(char *escaped, const char *str,
|
||||
apr_ssize_t slen, apr_size_t *len);
|
||||
|
||||
/**
|
||||
* Urlencode a string, as defined in
|
||||
* http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.1, returning
|
||||
* the result from a pool.
|
||||
* @param p Pool to allocate from
|
||||
* @param str String to be escaped
|
||||
* @return A string allocated from the pool on success, the original string
|
||||
* if no characters are encoded or if the string was NULL.
|
||||
*/
|
||||
APR_DECLARE(const char *) apr_pescape_urlencoded(apr_pool_t *p,
|
||||
const char *str) __attribute__((nonnull(1)));
|
||||
|
||||
/**
|
||||
* Apply entity encoding to a string. Characters are replaced as follows:
|
||||
* '<' becomes '\<', '>' becomes '\>', '&' becomes '\&', the
|
||||
* double quote becomes '\"" and the single quote becomes '\''.
|
||||
*
|
||||
* If toasc is not zero, any non ascii character will be encoded as
|
||||
* '%\#ddd;', where ddd is the decimal code of the character.
|
||||
* @param escaped Optional buffer to write the encoded string, can be
|
||||
* NULL
|
||||
* @param str The original string
|
||||
* @param slen The length of the original string, or APR_ESCAPE_STRING
|
||||
* @param toasc If non zero, encode non ascii characters
|
||||
* @param len If present, returns the length of the string
|
||||
* @return APR_SUCCESS, or APR_NOTFOUND if no changes to the string were
|
||||
* detected or the string was NULL
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_escape_entity(char *escaped, const char *str,
|
||||
apr_ssize_t slen, int toasc, apr_size_t *len);
|
||||
|
||||
/**
|
||||
* Apply entity encoding to a string, returning the result from a pool.
|
||||
* Characters are replaced as follows: '<' becomes '\<', '>' becomes
|
||||
* '\>', '&' becomes '\&', the double quote becomes '\"" and the
|
||||
* single quote becomes '\''.
|
||||
* @param p Pool to allocate from
|
||||
* @param str The original string
|
||||
* @param toasc If non zero, encode non ascii characters
|
||||
* @return A string allocated from the pool on success, the original string
|
||||
* if no characters are encoded or the string is NULL.
|
||||
*/
|
||||
APR_DECLARE(const char *) apr_pescape_entity(apr_pool_t *p, const char *str,
|
||||
int toasc) __attribute__((nonnull(1)));
|
||||
|
||||
/**
|
||||
* Decodes html entities or numeric character references in a string. If
|
||||
* the string to be unescaped is syntactically incorrect, then the
|
||||
* following fixups will be made:
|
||||
* unknown entities will be left undecoded;
|
||||
* references to unused numeric characters will be deleted.
|
||||
* In particular, � will not be decoded, but will be deleted.
|
||||
* @param unescaped Optional buffer to write the encoded string, can be
|
||||
* NULL
|
||||
* @param str The original string
|
||||
* @param slen The length of the original string, or APR_ESCAPE_STRING
|
||||
* @param len If present, returns the length of the string
|
||||
* @return APR_SUCCESS, or APR_NOTFOUND if no changes to the string were
|
||||
* detected or the string was NULL
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_unescape_entity(char *unescaped, const char *str,
|
||||
apr_ssize_t slen, apr_size_t *len);
|
||||
|
||||
/**
|
||||
* Decodes html entities or numeric character references in a string. If
|
||||
* the string to be unescaped is syntactically incorrect, then the
|
||||
* following fixups will be made:
|
||||
* unknown entities will be left undecoded;
|
||||
* references to unused numeric characters will be deleted.
|
||||
* In particular, � will not be decoded, but will be deleted.
|
||||
* @param p Pool to allocate from
|
||||
* @param str The original string
|
||||
* @return A string allocated from the pool on success, the original string
|
||||
* if no characters are encoded or the string is NULL.
|
||||
*/
|
||||
APR_DECLARE(const char *) apr_punescape_entity(apr_pool_t *p, const char *str)
|
||||
__attribute__((nonnull(1)));
|
||||
|
||||
/**
|
||||
* Escape control characters in a string, as performed by the shell's
|
||||
* 'echo' command. Characters are replaced as follows:
|
||||
* \\a alert (bell), \\b backspace, \\f form feed, \\n new line, \\r carriage
|
||||
* return, \\t horizontal tab, \\v vertical tab, \\ backslash.
|
||||
*
|
||||
* Any non ascii character will be encoded as '\\xHH', where HH is the hex
|
||||
* code of the character.
|
||||
*
|
||||
* If quote is not zero, the double quote character will also be escaped.
|
||||
* @param escaped Optional buffer to write the encoded string, can be
|
||||
* NULL
|
||||
* @param str The original string
|
||||
* @param slen The length of the original string, or APR_ESCAPE_STRING
|
||||
* @param quote If non zero, encode double quotes
|
||||
* @param len If present, returns the length of the string
|
||||
* @return APR_SUCCESS, or APR_NOTFOUND if no changes to the string were
|
||||
* detected or the string was NULL
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_escape_echo(char *escaped, const char *str,
|
||||
apr_ssize_t slen, int quote, apr_size_t *len);
|
||||
|
||||
/**
|
||||
* Escape control characters in a string, as performed by the shell's
|
||||
* 'echo' command, and return the results from a pool. Characters are
|
||||
* replaced as follows: \\a alert (bell), \\b backspace, \\f form feed,
|
||||
* \\n new line, \\r carriage return, \\t horizontal tab, \\v vertical tab,
|
||||
* \\ backslash.
|
||||
*
|
||||
* Any non ascii character will be encoded as '\\xHH', where HH is the hex
|
||||
* code of the character.
|
||||
*
|
||||
* If quote is not zero, the double quote character will also be escaped.
|
||||
* @param p Pool to allocate from
|
||||
* @param str The original string
|
||||
* @param quote If non zero, encode double quotes
|
||||
* @return A string allocated from the pool on success, the original string
|
||||
* if no characters are encoded or the string is NULL.
|
||||
*/
|
||||
APR_DECLARE(const char *) apr_pescape_echo(apr_pool_t *p, const char *str,
|
||||
int quote);
|
||||
|
||||
/**
|
||||
* Convert binary data to a hex encoding.
|
||||
* @param dest The destination buffer, can be NULL
|
||||
* @param src The original buffer
|
||||
* @param srclen The length of the original buffer
|
||||
* @param colon If not zero, insert colon characters between hex digits.
|
||||
* @param len If present, returns the length of the string
|
||||
* @return APR_SUCCESS, or APR_NOTFOUND if the string was NULL
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_escape_hex(char *dest, const void *src,
|
||||
apr_size_t srclen, int colon, apr_size_t *len);
|
||||
|
||||
/**
|
||||
* Convert binary data to a hex encoding, and return the results from a
|
||||
* pool.
|
||||
* @param p Pool to allocate from
|
||||
* @param src The original buffer
|
||||
* @param slen The length of the original buffer
|
||||
* @param colon If not zero, insert colon characters between hex digits.
|
||||
* @return A zero padded buffer allocated from the pool on success, or
|
||||
* NULL if src was NULL.
|
||||
*/
|
||||
APR_DECLARE(const char *) apr_pescape_hex(apr_pool_t *p, const void *src,
|
||||
apr_size_t slen, int colon) __attribute__((nonnull(1)));
|
||||
|
||||
/**
|
||||
* Convert hex encoded string to binary data.
|
||||
* @param dest The destination buffer, can be NULL
|
||||
* @param str The original buffer
|
||||
* @param slen The length of the original buffer
|
||||
* @param colon If not zero, ignore colon characters between hex digits.
|
||||
* @param len If present, returns the length of the string
|
||||
* @return APR_SUCCESS, or APR_NOTFOUND if the string was NULL, or APR_BADCH
|
||||
* if a non hex character is present.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_unescape_hex(void *dest, const char *str,
|
||||
apr_ssize_t slen, int colon, apr_size_t *len);
|
||||
|
||||
/**
|
||||
* Convert hex encoding to binary data, and return the results from a pool.
|
||||
* If the colon character appears between pairs of hex digits, it will be
|
||||
* ignored.
|
||||
* @param p Pool to allocate from
|
||||
* @param str The original string
|
||||
* @param colon If not zero, ignore colon characters between hex digits.
|
||||
* @param len If present, returns the length of the final buffer
|
||||
* @return A buffer allocated from the pool on success, or NULL if src was
|
||||
* NULL, or a bad character was present.
|
||||
*/
|
||||
APR_DECLARE(const void *) apr_punescape_hex(apr_pool_t *p, const char *str,
|
||||
int colon, apr_size_t *len);
|
||||
|
||||
/**
|
||||
* Apply LDAP escaping to binary data. Characters from RFC4514 and RFC4515
|
||||
* are escaped with their hex equivalents.
|
||||
* @param dest The destination buffer, can be NULL
|
||||
* @param src The original buffer
|
||||
* @param srclen The length of the original buffer
|
||||
* @param flags APR_ESCAPE_LDAP_DN for RFC4514, APR_ESCAPE_LDAP_FILTER for
|
||||
* RFC4515, APR_ESCAPE_LDAP_ALL for both
|
||||
* @param len If present, returns the length of the string
|
||||
* @return APR_SUCCESS, or APR_NOTFOUND if the string was NULL
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_escape_ldap(char *dest, const void *src,
|
||||
apr_ssize_t srclen, int flags, apr_size_t *len);
|
||||
|
||||
/**
|
||||
* Apply LDAP escaping to binary data, and return the results from a
|
||||
* pool. Characters from RFC4514 and RFC4515 are escaped with their hex
|
||||
* equivalents.
|
||||
* @param p Pool to allocate from
|
||||
* @param src The original buffer
|
||||
* @param slen The length of the original buffer
|
||||
* @param flags APR_ESCAPE_LDAP_DN for RFC4514, APR_ESCAPE_LDAP_FILTER for
|
||||
* RFC4515, APR_ESCAPE_LDAP_ALL for both
|
||||
* @return A zero padded buffer allocated from the pool on success, or
|
||||
* NULL if src was NULL.
|
||||
*/
|
||||
APR_DECLARE(const char *) apr_pescape_ldap(apr_pool_t *p, const void *src,
|
||||
apr_ssize_t slen, int flags) __attribute__((nonnull(1)));
|
||||
|
||||
/** @} */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !APR_ESCAPE_H */
|
||||
25
database/apache/include/apr_escape_test_char.h
Normal file
25
database/apache/include/apr_escape_test_char.h
Normal file
@@ -0,0 +1,25 @@
|
||||
/* this file is automatically generated by gen_test_char, do not edit. "make include/private/apr_escape_test_char.h" to regenerate. */
|
||||
#define T_ESCAPE_SHELL_CMD (1)
|
||||
#define T_ESCAPE_PATH_SEGMENT (2)
|
||||
#define T_OS_ESCAPE_PATH (4)
|
||||
#define T_ESCAPE_ECHO (8)
|
||||
#define T_ESCAPE_URLENCODED (16)
|
||||
#define T_ESCAPE_XML (32)
|
||||
#define T_ESCAPE_LDAP_DN (64)
|
||||
#define T_ESCAPE_LDAP_FILTER (128)
|
||||
|
||||
static const unsigned char test_char_table[256] = {
|
||||
224,222,222,222,222,222,222,222,222,222,223,222,222,223,222,222,222,222,222,222,
|
||||
222,222,222,222,222,222,222,222,222,222,222,222,6,16,127,22,17,23,49,17,
|
||||
145,145,129,80,80,0,0,18,0,0,0,0,0,0,0,0,0,0,16,87,
|
||||
119,16,119,23,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,23,223,23,23,0,23,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,23,23,23,17,222,222,222,222,222,222,222,222,222,222,222,222,222,
|
||||
222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,
|
||||
222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,
|
||||
222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,
|
||||
222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,
|
||||
222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,
|
||||
222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222
|
||||
};
|
||||
428
database/apache/include/apr_file_info.h
Normal file
428
database/apache/include/apr_file_info.h
Normal file
@@ -0,0 +1,428 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_FILE_INFO_H
|
||||
#define APR_FILE_INFO_H
|
||||
|
||||
/**
|
||||
* @file apr_file_info.h
|
||||
* @brief APR File Information
|
||||
*/
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_user.h"
|
||||
#include "apr_pools.h"
|
||||
#include "apr_tables.h"
|
||||
#include "apr_time.h"
|
||||
#include "apr_errno.h"
|
||||
|
||||
#if APR_HAVE_SYS_UIO_H
|
||||
#include <sys/uio.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @defgroup apr_file_info File Information
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Many applications use the type member to determine the
|
||||
* existance of a file or initialization of the file info,
|
||||
* so the APR_NOFILE value must be distinct from APR_UNKFILE.
|
||||
*/
|
||||
|
||||
/** apr_filetype_e values for the filetype member of the
|
||||
* apr_file_info_t structure
|
||||
* @warning Not all of the filetypes below can be determined.
|
||||
* For example, a given platform might not correctly report
|
||||
* a socket descriptor as APR_SOCK if that type isn't
|
||||
* well-identified on that platform. In such cases where
|
||||
* a filetype exists but cannot be described by the recognized
|
||||
* flags below, the filetype will be APR_UNKFILE. If the
|
||||
* filetype member is not determined, the type will be APR_NOFILE.
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
APR_NOFILE = 0, /**< no file type determined */
|
||||
APR_REG, /**< a regular file */
|
||||
APR_DIR, /**< a directory */
|
||||
APR_CHR, /**< a character device */
|
||||
APR_BLK, /**< a block device */
|
||||
APR_PIPE, /**< a FIFO / pipe */
|
||||
APR_LNK, /**< a symbolic link */
|
||||
APR_SOCK, /**< a [unix domain] socket */
|
||||
APR_UNKFILE = 127 /**< a file of some other unknown type */
|
||||
} apr_filetype_e;
|
||||
|
||||
/**
|
||||
* @defgroup apr_file_permissions File Permissions flags
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define APR_FPROT_USETID 0x8000 /**< Set user id */
|
||||
#define APR_FPROT_UREAD 0x0400 /**< Read by user */
|
||||
#define APR_FPROT_UWRITE 0x0200 /**< Write by user */
|
||||
#define APR_FPROT_UEXECUTE 0x0100 /**< Execute by user */
|
||||
|
||||
#define APR_FPROT_GSETID 0x4000 /**< Set group id */
|
||||
#define APR_FPROT_GREAD 0x0040 /**< Read by group */
|
||||
#define APR_FPROT_GWRITE 0x0020 /**< Write by group */
|
||||
#define APR_FPROT_GEXECUTE 0x0010 /**< Execute by group */
|
||||
|
||||
#define APR_FPROT_WSTICKY 0x2000 /**< Sticky bit */
|
||||
#define APR_FPROT_WREAD 0x0004 /**< Read by others */
|
||||
#define APR_FPROT_WWRITE 0x0002 /**< Write by others */
|
||||
#define APR_FPROT_WEXECUTE 0x0001 /**< Execute by others */
|
||||
|
||||
#define APR_FPROT_OS_DEFAULT 0x0FFF /**< use OS's default permissions */
|
||||
|
||||
/* additional permission flags for apr_file_copy and apr_file_append */
|
||||
#define APR_FPROT_FILE_SOURCE_PERMS 0x1000 /**< Copy source file's permissions */
|
||||
|
||||
/* backcompat */
|
||||
#define APR_USETID APR_FPROT_USETID /**< @deprecated @see APR_FPROT_USETID */
|
||||
#define APR_UREAD APR_FPROT_UREAD /**< @deprecated @see APR_FPROT_UREAD */
|
||||
#define APR_UWRITE APR_FPROT_UWRITE /**< @deprecated @see APR_FPROT_UWRITE */
|
||||
#define APR_UEXECUTE APR_FPROT_UEXECUTE /**< @deprecated @see APR_FPROT_UEXECUTE */
|
||||
#define APR_GSETID APR_FPROT_GSETID /**< @deprecated @see APR_FPROT_GSETID */
|
||||
#define APR_GREAD APR_FPROT_GREAD /**< @deprecated @see APR_FPROT_GREAD */
|
||||
#define APR_GWRITE APR_FPROT_GWRITE /**< @deprecated @see APR_FPROT_GWRITE */
|
||||
#define APR_GEXECUTE APR_FPROT_GEXECUTE /**< @deprecated @see APR_FPROT_GEXECUTE */
|
||||
#define APR_WSTICKY APR_FPROT_WSTICKY /**< @deprecated @see APR_FPROT_WSTICKY */
|
||||
#define APR_WREAD APR_FPROT_WREAD /**< @deprecated @see APR_FPROT_WREAD */
|
||||
#define APR_WWRITE APR_FPROT_WWRITE /**< @deprecated @see APR_FPROT_WWRITE */
|
||||
#define APR_WEXECUTE APR_FPROT_WEXECUTE /**< @deprecated @see APR_FPROT_WEXECUTE */
|
||||
#define APR_OS_DEFAULT APR_FPROT_OS_DEFAULT /**< @deprecated @see APR_FPROT_OS_DEFAULT */
|
||||
#define APR_FILE_SOURCE_PERMS APR_FPROT_FILE_SOURCE_PERMS /**< @deprecated @see APR_FPROT_FILE_SOURCE_PERMS */
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
/**
|
||||
* Structure for referencing directories.
|
||||
*/
|
||||
typedef struct apr_dir_t apr_dir_t;
|
||||
/**
|
||||
* Structure for determining file permissions.
|
||||
*/
|
||||
typedef apr_int32_t apr_fileperms_t;
|
||||
#if (defined WIN32) || (defined NETWARE)
|
||||
/**
|
||||
* Structure for determining the device the file is on.
|
||||
*/
|
||||
typedef apr_uint32_t apr_dev_t;
|
||||
#else
|
||||
/**
|
||||
* Structure for determining the device the file is on.
|
||||
*/
|
||||
typedef dev_t apr_dev_t;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup apr_file_stat Stat Functions
|
||||
* @{
|
||||
*/
|
||||
/** file info structure */
|
||||
typedef struct apr_finfo_t apr_finfo_t;
|
||||
|
||||
#define APR_FINFO_LINK 0x00000001 /**< Stat the link not the file itself if it is a link */
|
||||
#define APR_FINFO_MTIME 0x00000010 /**< Modification Time */
|
||||
#define APR_FINFO_CTIME 0x00000020 /**< Creation or inode-changed time */
|
||||
#define APR_FINFO_ATIME 0x00000040 /**< Access Time */
|
||||
#define APR_FINFO_SIZE 0x00000100 /**< Size of the file */
|
||||
#define APR_FINFO_CSIZE 0x00000200 /**< Storage size consumed by the file */
|
||||
#define APR_FINFO_DEV 0x00001000 /**< Device */
|
||||
#define APR_FINFO_INODE 0x00002000 /**< Inode */
|
||||
#define APR_FINFO_NLINK 0x00004000 /**< Number of links */
|
||||
#define APR_FINFO_TYPE 0x00008000 /**< Type */
|
||||
#define APR_FINFO_USER 0x00010000 /**< User */
|
||||
#define APR_FINFO_GROUP 0x00020000 /**< Group */
|
||||
#define APR_FINFO_UPROT 0x00100000 /**< User protection bits */
|
||||
#define APR_FINFO_GPROT 0x00200000 /**< Group protection bits */
|
||||
#define APR_FINFO_WPROT 0x00400000 /**< World protection bits */
|
||||
#define APR_FINFO_ICASE 0x01000000 /**< if dev is case insensitive */
|
||||
#define APR_FINFO_NAME 0x02000000 /**< ->name in proper case */
|
||||
|
||||
#define APR_FINFO_MIN 0x00008170 /**< type, mtime, ctime, atime, size */
|
||||
#define APR_FINFO_IDENT 0x00003000 /**< dev and inode */
|
||||
#define APR_FINFO_OWNER 0x00030000 /**< user and group */
|
||||
#define APR_FINFO_PROT 0x00700000 /**< all protections */
|
||||
#define APR_FINFO_NORM 0x0073b170 /**< an atomic unix apr_stat() */
|
||||
#define APR_FINFO_DIRENT 0x02000000 /**< an atomic unix apr_dir_read() */
|
||||
|
||||
/**
|
||||
* The file information structure. This is analogous to the POSIX
|
||||
* stat structure.
|
||||
*/
|
||||
struct apr_finfo_t {
|
||||
/** Allocates memory and closes lingering handles in the specified pool */
|
||||
apr_pool_t *pool;
|
||||
/** The bitmask describing valid fields of this apr_finfo_t structure
|
||||
* including all available 'wanted' fields and potentially more */
|
||||
apr_int32_t valid;
|
||||
/** The access permissions of the file. Mimics Unix access rights. */
|
||||
apr_fileperms_t protection;
|
||||
/** The type of file. One of APR_REG, APR_DIR, APR_CHR, APR_BLK, APR_PIPE,
|
||||
* APR_LNK or APR_SOCK. If the type is undetermined, the value is APR_NOFILE.
|
||||
* If the type cannot be determined, the value is APR_UNKFILE.
|
||||
*/
|
||||
apr_filetype_e filetype;
|
||||
/** The user id that owns the file */
|
||||
apr_uid_t user;
|
||||
/** The group id that owns the file */
|
||||
apr_gid_t group;
|
||||
/** The inode of the file. */
|
||||
apr_ino_t inode;
|
||||
/** The id of the device the file is on. */
|
||||
apr_dev_t device;
|
||||
/** The number of hard links to the file. */
|
||||
apr_int32_t nlink;
|
||||
/** The size of the file */
|
||||
apr_off_t size;
|
||||
/** The storage size consumed by the file */
|
||||
apr_off_t csize;
|
||||
/** The time the file was last accessed */
|
||||
apr_time_t atime;
|
||||
/** The time the file was last modified */
|
||||
apr_time_t mtime;
|
||||
/** The time the file was created, or the inode was last changed */
|
||||
apr_time_t ctime;
|
||||
/** The pathname of the file (possibly unrooted) */
|
||||
const char *fname;
|
||||
/** The file's name (no path) in filesystem case */
|
||||
const char *name;
|
||||
/** Unused */
|
||||
struct apr_file_t *filehand;
|
||||
};
|
||||
|
||||
/**
|
||||
* get the specified file's stats. The file is specified by filename,
|
||||
* instead of using a pre-opened file.
|
||||
* @param finfo Where to store the information about the file, which is
|
||||
* never touched if the call fails.
|
||||
* @param fname The name of the file to stat.
|
||||
* @param wanted The desired apr_finfo_t fields, as a bit flag of APR_FINFO_
|
||||
values
|
||||
* @param pool the pool to use to allocate the new file.
|
||||
*
|
||||
* @note If @c APR_INCOMPLETE is returned all the fields in @a finfo may
|
||||
* not be filled in, and you need to check the @c finfo->valid bitmask
|
||||
* to verify that what you're looking for is there.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_stat(apr_finfo_t *finfo, const char *fname,
|
||||
apr_int32_t wanted, apr_pool_t *pool);
|
||||
|
||||
/** @} */
|
||||
/**
|
||||
* @defgroup apr_dir Directory Manipulation Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Open the specified directory.
|
||||
* @param new_dir The opened directory descriptor.
|
||||
* @param dirname The full path to the directory (use / on all systems)
|
||||
* @param pool The pool to use.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_dir_open(apr_dir_t **new_dir,
|
||||
const char *dirname,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* close the specified directory.
|
||||
* @param thedir the directory descriptor to close.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_dir_close(apr_dir_t *thedir);
|
||||
|
||||
/**
|
||||
* Read the next entry from the specified directory.
|
||||
* @param finfo the file info structure and filled in by apr_dir_read
|
||||
* @param wanted The desired apr_finfo_t fields, as a bit flag of APR_FINFO_
|
||||
values
|
||||
* @param thedir the directory descriptor returned from apr_dir_open
|
||||
* @remark No ordering is guaranteed for the entries read.
|
||||
*
|
||||
* @note If @c APR_INCOMPLETE is returned all the fields in @a finfo may
|
||||
* not be filled in, and you need to check the @c finfo->valid bitmask
|
||||
* to verify that what you're looking for is there. When no more
|
||||
* entries are available, APR_ENOENT is returned.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_dir_read(apr_finfo_t *finfo, apr_int32_t wanted,
|
||||
apr_dir_t *thedir);
|
||||
|
||||
/**
|
||||
* Rewind the directory to the first entry.
|
||||
* @param thedir the directory descriptor to rewind.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_dir_rewind(apr_dir_t *thedir);
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @defgroup apr_filepath Filepath Manipulation Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** Cause apr_filepath_merge to fail if addpath is above rootpath
|
||||
* @bug in APR 0.9 and 1.x, this flag's behavior is undefined
|
||||
* if the rootpath is NULL or empty. In APR 2.0 this should be
|
||||
* changed to imply NOTABSOLUTE if the rootpath is NULL or empty.
|
||||
*/
|
||||
#define APR_FILEPATH_NOTABOVEROOT 0x01
|
||||
|
||||
/** internal: Only meaningful with APR_FILEPATH_NOTABOVEROOT */
|
||||
#define APR_FILEPATH_SECUREROOTTEST 0x02
|
||||
|
||||
/** Cause apr_filepath_merge to fail if addpath is above rootpath,
|
||||
* even given a rootpath /foo/bar and an addpath ../bar/bash
|
||||
*/
|
||||
#define APR_FILEPATH_SECUREROOT 0x03
|
||||
|
||||
/** Fail apr_filepath_merge if the merged path is relative */
|
||||
#define APR_FILEPATH_NOTRELATIVE 0x04
|
||||
|
||||
/** Fail apr_filepath_merge if the merged path is absolute */
|
||||
#define APR_FILEPATH_NOTABSOLUTE 0x08
|
||||
|
||||
/** Return the file system's native path format (e.g. path delimiters
|
||||
* of ':' on MacOS9, '\' on Win32, etc.) */
|
||||
#define APR_FILEPATH_NATIVE 0x10
|
||||
|
||||
/** Resolve the true case of existing directories and file elements
|
||||
* of addpath, (resolving any aliases on Win32) and append a proper
|
||||
* trailing slash if a directory
|
||||
*/
|
||||
#define APR_FILEPATH_TRUENAME 0x20
|
||||
|
||||
/**
|
||||
* Extract the rootpath from the given filepath
|
||||
* @param rootpath the root file path returned with APR_SUCCESS or APR_EINCOMPLETE
|
||||
* @param filepath the pathname to parse for its root component
|
||||
* @param flags the desired rules to apply, from
|
||||
* <PRE>
|
||||
* APR_FILEPATH_NATIVE Use native path separators (e.g. '\' on Win32)
|
||||
* APR_FILEPATH_TRUENAME Tests that the root exists, and makes it proper
|
||||
* </PRE>
|
||||
* @param p the pool to allocate the new path string from
|
||||
* @remark on return, filepath points to the first non-root character in the
|
||||
* given filepath. In the simplest example, given a filepath of "/foo",
|
||||
* returns the rootpath of "/" and filepath points at "foo". This is far
|
||||
* more complex on other platforms, which will canonicalize the root form
|
||||
* to a consistant format, given the APR_FILEPATH_TRUENAME flag, and also
|
||||
* test for the validity of that root (e.g., that a drive d:/ or network
|
||||
* share //machine/foovol/).
|
||||
* The function returns APR_ERELATIVE if filepath isn't rooted (an
|
||||
* error), APR_EINCOMPLETE if the root path is ambiguous (but potentially
|
||||
* legitimate, e.g. "/" on Windows is incomplete because it doesn't specify
|
||||
* the drive letter), or APR_EBADPATH if the root is simply invalid.
|
||||
* APR_SUCCESS is returned if filepath is an absolute path.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_filepath_root(const char **rootpath,
|
||||
const char **filepath,
|
||||
apr_int32_t flags,
|
||||
apr_pool_t *p);
|
||||
|
||||
/**
|
||||
* Merge additional file path onto the previously processed rootpath
|
||||
* @param newpath the merged paths returned
|
||||
* @param rootpath the root file path (NULL uses the current working path)
|
||||
* @param addpath the path to add to the root path
|
||||
* @param flags the desired APR_FILEPATH_ rules to apply when merging
|
||||
* @param p the pool to allocate the new path string from
|
||||
* @remark if the flag APR_FILEPATH_TRUENAME is given, and the addpath
|
||||
* contains wildcard characters ('*', '?') on platforms that don't support
|
||||
* such characters within filenames, the paths will be merged, but the
|
||||
* result code will be APR_EPATHWILD, and all further segments will not
|
||||
* reflect the true filenames including the wildcard and following segments.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_filepath_merge(char **newpath,
|
||||
const char *rootpath,
|
||||
const char *addpath,
|
||||
apr_int32_t flags,
|
||||
apr_pool_t *p);
|
||||
|
||||
/**
|
||||
* Split a search path into separate components
|
||||
* @param pathelts the returned components of the search path
|
||||
* @param liststr the search path (e.g., <tt>getenv("PATH")</tt>)
|
||||
* @param p the pool to allocate the array and path components from
|
||||
* @remark empty path components do not become part of @a pathelts.
|
||||
* @remark the path separator in @a liststr is system specific;
|
||||
* e.g., ':' on Unix, ';' on Windows, etc.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_filepath_list_split(apr_array_header_t **pathelts,
|
||||
const char *liststr,
|
||||
apr_pool_t *p);
|
||||
|
||||
/**
|
||||
* Merge a list of search path components into a single search path
|
||||
* @param liststr the returned search path; may be NULL if @a pathelts is empty
|
||||
* @param pathelts the components of the search path
|
||||
* @param p the pool to allocate the search path from
|
||||
* @remark emtpy strings in the source array are ignored.
|
||||
* @remark the path separator in @a liststr is system specific;
|
||||
* e.g., ':' on Unix, ';' on Windows, etc.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_filepath_list_merge(char **liststr,
|
||||
apr_array_header_t *pathelts,
|
||||
apr_pool_t *p);
|
||||
|
||||
/**
|
||||
* Return the default file path (for relative file names)
|
||||
* @param path the default path string returned
|
||||
* @param flags optional flag APR_FILEPATH_NATIVE to retrieve the
|
||||
* default file path in os-native format.
|
||||
* @param p the pool to allocate the default path string from
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_filepath_get(char **path, apr_int32_t flags,
|
||||
apr_pool_t *p);
|
||||
|
||||
/**
|
||||
* Set the default file path (for relative file names)
|
||||
* @param path the default path returned
|
||||
* @param p the pool to allocate any working storage
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_filepath_set(const char *path, apr_pool_t *p);
|
||||
|
||||
/** The FilePath character encoding is unknown */
|
||||
#define APR_FILEPATH_ENCODING_UNKNOWN 0
|
||||
|
||||
/** The FilePath character encoding is locale-dependent */
|
||||
#define APR_FILEPATH_ENCODING_LOCALE 1
|
||||
|
||||
/** The FilePath character encoding is UTF-8 */
|
||||
#define APR_FILEPATH_ENCODING_UTF8 2
|
||||
|
||||
/**
|
||||
* Determine the encoding used internally by the FilePath functions
|
||||
* @param style points to a variable which receives the encoding style flag
|
||||
* @param p the pool to allocate any working storage
|
||||
* @remark Use apr_os_locale_encoding() and/or apr_os_default_encoding()
|
||||
* to get the name of the path encoding if it's not UTF-8.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_filepath_encoding(int *style, apr_pool_t *p);
|
||||
/** @} */
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ! APR_FILE_INFO_H */
|
||||
1005
database/apache/include/apr_file_io.h
Normal file
1005
database/apache/include/apr_file_io.h
Normal file
File diff suppressed because it is too large
Load Diff
153
database/apache/include/apr_fnmatch.h
Normal file
153
database/apache/include/apr_fnmatch.h
Normal file
@@ -0,0 +1,153 @@
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)fnmatch.h 8.1 (Berkeley) 6/2/93
|
||||
*/
|
||||
|
||||
/* This file has been modified by the Apache Software Foundation. */
|
||||
#ifndef _APR_FNMATCH_H_
|
||||
#define _APR_FNMATCH_H_
|
||||
|
||||
/**
|
||||
* @file apr_fnmatch.h
|
||||
* @brief APR FNMatch Functions
|
||||
*/
|
||||
|
||||
#include "apr_errno.h"
|
||||
#include "apr_tables.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup apr_fnmatch Filename Matching Functions
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define APR_FNM_NOMATCH 1 /**< Match failed. */
|
||||
|
||||
#define APR_FNM_NOESCAPE 0x01 /**< Disable backslash escaping. */
|
||||
#define APR_FNM_PATHNAME 0x02 /**< Slash must be matched by slash. */
|
||||
#define APR_FNM_PERIOD 0x04 /**< Period must be matched by period. */
|
||||
#define APR_FNM_CASE_BLIND 0x08 /**< Compare characters case-insensitively. */
|
||||
|
||||
/**
|
||||
* Try to match the string to the given pattern, return APR_SUCCESS if
|
||||
* match, else return APR_FNM_NOMATCH. Note that there is no such thing as
|
||||
* an illegal pattern.
|
||||
*
|
||||
* With all flags unset, a pattern is interpreted as such:
|
||||
*
|
||||
* PATTERN: Backslash followed by any character, including another
|
||||
* backslash.<br/>
|
||||
* MATCHES: That character exactly.
|
||||
*
|
||||
* <p>
|
||||
* PATTERN: ?<br/>
|
||||
* MATCHES: Any single character.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* PATTERN: *<br/>
|
||||
* MATCHES: Any sequence of zero or more characters. (Note that multiple
|
||||
* *s in a row are equivalent to one.)
|
||||
*
|
||||
* PATTERN: Any character other than \?*[ or a \ at the end of the pattern<br/>
|
||||
* MATCHES: That character exactly. (Case sensitive.)
|
||||
*
|
||||
* PATTERN: [ followed by a class description followed by ]<br/>
|
||||
* MATCHES: A single character described by the class description.
|
||||
* (Never matches, if the class description reaches until the
|
||||
* end of the string without a ].) If the first character of
|
||||
* the class description is ^ or !, the sense of the description
|
||||
* is reversed. The rest of the class description is a list of
|
||||
* single characters or pairs of characters separated by -. Any
|
||||
* of those characters can have a backslash in front of them,
|
||||
* which is ignored; this lets you use the characters ] and -
|
||||
* in the character class, as well as ^ and ! at the
|
||||
* beginning. The pattern matches a single character if it
|
||||
* is one of the listed characters or falls into one of the
|
||||
* listed ranges (inclusive, case sensitive). Ranges with
|
||||
* the first character larger than the second are legal but
|
||||
* never match. Edge cases: [] never matches, and [^] and [!]
|
||||
* always match without consuming a character.
|
||||
*
|
||||
* Note that these patterns attempt to match the entire string, not
|
||||
* just find a substring matching the pattern.
|
||||
*
|
||||
* @param pattern The pattern to match to
|
||||
* @param strings The string we are trying to match
|
||||
* @param flags flags to use in the match. Bitwise OR of:
|
||||
* <pre>
|
||||
* APR_FNM_NOESCAPE Disable backslash escaping
|
||||
* APR_FNM_PATHNAME Slash must be matched by slash
|
||||
* APR_FNM_PERIOD Period must be matched by period
|
||||
* APR_FNM_CASE_BLIND Compare characters case-insensitively.
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_fnmatch(const char *pattern,
|
||||
const char *strings, int flags);
|
||||
|
||||
/**
|
||||
* Determine if the given pattern is a regular expression.
|
||||
* @param pattern The pattern to search for glob characters.
|
||||
* @return non-zero if pattern has any glob characters in it
|
||||
*/
|
||||
APR_DECLARE(int) apr_fnmatch_test(const char *pattern);
|
||||
|
||||
/**
|
||||
* Find all files that match a specified pattern in a directory.
|
||||
* @param dir_pattern The pattern to use for finding files, appended
|
||||
* to the search directory. The pattern is anything following the
|
||||
* final forward or backward slash in the parameter. If no slash
|
||||
* is found, the current directory is searched.
|
||||
* @param result Array to use when storing the results
|
||||
* @param p The pool to use.
|
||||
* @return APR_SUCCESS if no processing errors occurred, APR error
|
||||
* code otherwise
|
||||
* @remark The returned array may be empty even if APR_SUCCESS was
|
||||
* returned.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_match_glob(const char *dir_pattern,
|
||||
apr_array_header_t **result,
|
||||
apr_pool_t *p);
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_APR_FNMATCH_H_ */
|
||||
244
database/apache/include/apr_general.h
Normal file
244
database/apache/include/apr_general.h
Normal file
@@ -0,0 +1,244 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_GENERAL_H
|
||||
#define APR_GENERAL_H
|
||||
|
||||
/**
|
||||
* @file apr_general.h
|
||||
* This is collection of oddballs that didn't fit anywhere else,
|
||||
* and might move to more appropriate headers with the release
|
||||
* of APR 1.0.
|
||||
* @brief APR Miscellaneous library routines
|
||||
*/
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_pools.h"
|
||||
#include "apr_errno.h"
|
||||
|
||||
#if APR_HAVE_SIGNAL_H
|
||||
#include <signal.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @defgroup apr_general Miscellaneous library routines
|
||||
* @ingroup APR
|
||||
* This is collection of oddballs that didn't fit anywhere else,
|
||||
* and might move to more appropriate headers with the release
|
||||
* of APR 1.0.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** FALSE */
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif
|
||||
/** TRUE */
|
||||
#ifndef TRUE
|
||||
#define TRUE (!FALSE)
|
||||
#endif
|
||||
|
||||
/** a space */
|
||||
#define APR_ASCII_BLANK '\040'
|
||||
/** a carrige return */
|
||||
#define APR_ASCII_CR '\015'
|
||||
/** a line feed */
|
||||
#define APR_ASCII_LF '\012'
|
||||
/** a tab */
|
||||
#define APR_ASCII_TAB '\011'
|
||||
|
||||
/** signal numbers typedef */
|
||||
typedef int apr_signum_t;
|
||||
|
||||
/**
|
||||
* Finding offsets of elements within structures.
|
||||
* Taken from the X code... they've sweated portability of this stuff
|
||||
* so we don't have to. Sigh...
|
||||
* @param p_type pointer type name
|
||||
* @param field data field within the structure pointed to
|
||||
* @return offset
|
||||
*/
|
||||
|
||||
#if defined(CRAY) || (defined(__arm) && !(defined(LINUX) || defined(__FreeBSD__)))
|
||||
#ifdef __STDC__
|
||||
#define APR_OFFSET(p_type,field) _Offsetof(p_type,field)
|
||||
#else
|
||||
#ifdef CRAY2
|
||||
#define APR_OFFSET(p_type,field) \
|
||||
(sizeof(int)*((unsigned int)&(((p_type)NULL)->field)))
|
||||
|
||||
#else /* !CRAY2 */
|
||||
|
||||
#define APR_OFFSET(p_type,field) ((unsigned int)&(((p_type)NULL)->field))
|
||||
|
||||
#endif /* !CRAY2 */
|
||||
#endif /* __STDC__ */
|
||||
#else /* ! (CRAY || __arm) */
|
||||
|
||||
#define APR_OFFSET(p_type,field) \
|
||||
((long) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL)))
|
||||
|
||||
#endif /* !CRAY */
|
||||
|
||||
/**
|
||||
* Finding offsets of elements within structures.
|
||||
* @param s_type structure type name
|
||||
* @param field data field within the structure
|
||||
* @return offset
|
||||
*/
|
||||
#if defined(offsetof) && !defined(__cplusplus)
|
||||
#define APR_OFFSETOF(s_type,field) offsetof(s_type,field)
|
||||
#else
|
||||
#define APR_OFFSETOF(s_type,field) APR_OFFSET(s_type*,field)
|
||||
#endif
|
||||
|
||||
#ifndef DOXYGEN
|
||||
|
||||
/* A couple of prototypes for functions in case some platform doesn't
|
||||
* have it
|
||||
*/
|
||||
#if (!APR_HAVE_STRCASECMP) && (APR_HAVE_STRICMP)
|
||||
#define strcasecmp(s1, s2) stricmp(s1, s2)
|
||||
#elif (!APR_HAVE_STRCASECMP)
|
||||
int strcasecmp(const char *a, const char *b);
|
||||
#endif
|
||||
|
||||
#if (!APR_HAVE_STRNCASECMP) && (APR_HAVE_STRNICMP)
|
||||
#define strncasecmp(s1, s2, n) strnicmp(s1, s2, n)
|
||||
#elif (!APR_HAVE_STRNCASECMP)
|
||||
int strncasecmp(const char *a, const char *b, size_t n);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Alignment macros
|
||||
*/
|
||||
|
||||
/* APR_ALIGN() is only to be used to align on a power of 2 boundary */
|
||||
#define APR_ALIGN(size, boundary) \
|
||||
(((size) + ((boundary) - 1)) & ~((boundary) - 1))
|
||||
|
||||
/** Default alignment */
|
||||
#define APR_ALIGN_DEFAULT(size) APR_ALIGN(size, 8)
|
||||
|
||||
|
||||
/**
|
||||
* String and memory functions
|
||||
*/
|
||||
|
||||
/* APR_STRINGIFY is defined here, and also in apr_release.h, so wrap it */
|
||||
#ifndef APR_STRINGIFY
|
||||
/** Properly quote a value as a string in the C preprocessor */
|
||||
#define APR_STRINGIFY(n) APR_STRINGIFY_HELPER(n)
|
||||
/** Helper macro for APR_STRINGIFY */
|
||||
#define APR_STRINGIFY_HELPER(n) #n
|
||||
#endif
|
||||
|
||||
#if (!APR_HAVE_MEMMOVE)
|
||||
#define memmove(a,b,c) bcopy(b,a,c)
|
||||
#endif
|
||||
|
||||
#if (!APR_HAVE_MEMCHR)
|
||||
void *memchr(const void *s, int c, size_t n);
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @defgroup apr_library Library initialization and termination
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Setup any APR internal data structures. This MUST be the first function
|
||||
* called for any APR library. It is safe to call apr_initialize several
|
||||
* times as long as apr_terminate() is called the same number of times.
|
||||
* @remark See apr_app_initialize() if this is an application, rather than
|
||||
* a library consumer of apr.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_initialize(void);
|
||||
|
||||
/**
|
||||
* Set up an application with normalized argc, argv (and optionally env) in
|
||||
* order to deal with platform-specific oddities, such as Win32 services,
|
||||
* code pages and signals. This must be the first function called for any
|
||||
* APR program.
|
||||
* @param argc Pointer to the argc that may be corrected
|
||||
* @param argv Pointer to the argv that may be corrected
|
||||
* @param env Pointer to the env that may be corrected, may be NULL
|
||||
* @remark See apr_initialize() if this is a library consumer of apr.
|
||||
* Otherwise, this call is identical to apr_initialize(), and must be closed
|
||||
* with a call to apr_terminate() at the end of program execution.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_app_initialize(int *argc,
|
||||
char const * const * *argv,
|
||||
char const * const * *env);
|
||||
|
||||
/**
|
||||
* Tear down any APR internal data structures which aren't torn down
|
||||
* automatically. apr_terminate must be called once for every call to
|
||||
* apr_initialize() or apr_app_initialize().
|
||||
* @remark An APR program must call this function at termination once it
|
||||
* has stopped using APR services. The APR developers suggest using
|
||||
* @c atexit(apr_terminate) to ensure this is called. When using APR
|
||||
* from a language other than C that has problems with the calling
|
||||
* convention, use apr_terminate2() instead.
|
||||
* @see apr_terminate2
|
||||
*/
|
||||
APR_DECLARE_NONSTD(void) apr_terminate(void);
|
||||
|
||||
/**
|
||||
* Tear down any APR internal data structures which aren't torn down
|
||||
* automatically, same as apr_terminate()
|
||||
* @remark An APR program must call either the apr_terminate() or apr_terminate2
|
||||
* function once it it has finished using APR services. The APR
|
||||
* developers suggest using @c atexit(apr_terminate) to ensure this is done.
|
||||
* apr_terminate2 exists to allow non-c language apps to tear down apr,
|
||||
* while apr_terminate() is recommended from c language applications.
|
||||
*/
|
||||
APR_DECLARE(void) apr_terminate2(void);
|
||||
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @defgroup apr_random Random Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
#if APR_HAS_RANDOM || defined(DOXYGEN)
|
||||
|
||||
/* TODO: I'm not sure this is the best place to put this prototype...*/
|
||||
/**
|
||||
* Generate random bytes.
|
||||
* @param buf Buffer to fill with random bytes
|
||||
* @param length Length of buffer in bytes
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_generate_random_bytes(unsigned char * buf,
|
||||
apr_size_t length);
|
||||
|
||||
#endif
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ! APR_GENERAL_H */
|
||||
160
database/apache/include/apr_getopt.h
Normal file
160
database/apache/include/apr_getopt.h
Normal file
@@ -0,0 +1,160 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_GETOPT_H
|
||||
#define APR_GETOPT_H
|
||||
|
||||
/**
|
||||
* @file apr_getopt.h
|
||||
* @brief APR Command Arguments (getopt)
|
||||
*/
|
||||
|
||||
#include "apr_pools.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @defgroup apr_getopt Command Argument Parsing
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* An @c apr_getopt_t error callback function.
|
||||
*
|
||||
* @a arg is this @c apr_getopt_t's @c errarg member.
|
||||
*/
|
||||
typedef void (apr_getopt_err_fn_t)(void *arg, const char *err, ...);
|
||||
|
||||
/** @see apr_getopt_t */
|
||||
typedef struct apr_getopt_t apr_getopt_t;
|
||||
|
||||
/**
|
||||
* Structure to store command line argument information.
|
||||
*/
|
||||
struct apr_getopt_t {
|
||||
/** context for processing */
|
||||
apr_pool_t *cont;
|
||||
/** function to print error message (NULL == no messages) */
|
||||
apr_getopt_err_fn_t *errfn;
|
||||
/** user defined first arg to pass to error message */
|
||||
void *errarg;
|
||||
/** index into parent argv vector */
|
||||
int ind;
|
||||
/** character checked for validity */
|
||||
int opt;
|
||||
/** reset getopt */
|
||||
int reset;
|
||||
/** count of arguments */
|
||||
int argc;
|
||||
/** array of pointers to arguments */
|
||||
const char **argv;
|
||||
/** argument associated with option */
|
||||
char const* place;
|
||||
/** set to nonzero to support interleaving options with regular args */
|
||||
int interleave;
|
||||
/** start of non-option arguments skipped for interleaving */
|
||||
int skip_start;
|
||||
/** end of non-option arguments skipped for interleaving */
|
||||
int skip_end;
|
||||
};
|
||||
|
||||
/** @see apr_getopt_option_t */
|
||||
typedef struct apr_getopt_option_t apr_getopt_option_t;
|
||||
|
||||
/**
|
||||
* Structure used to describe options that getopt should search for.
|
||||
*/
|
||||
struct apr_getopt_option_t {
|
||||
/** long option name, or NULL if option has no long name */
|
||||
const char *name;
|
||||
/** option letter, or a value greater than 255 if option has no letter */
|
||||
int optch;
|
||||
/** nonzero if option takes an argument */
|
||||
int has_arg;
|
||||
/** a description of the option */
|
||||
const char *description;
|
||||
};
|
||||
|
||||
/**
|
||||
* Initialize the arguments for parsing by apr_getopt().
|
||||
* @param os The options structure created for apr_getopt()
|
||||
* @param cont The pool to operate on
|
||||
* @param argc The number of arguments to parse
|
||||
* @param argv The array of arguments to parse
|
||||
* @remark Arguments 3 and 4 are most commonly argc and argv from main(argc, argv)
|
||||
* The (*os)->errfn is initialized to fprintf(stderr... but may be overridden.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_getopt_init(apr_getopt_t **os, apr_pool_t *cont,
|
||||
int argc, const char * const *argv);
|
||||
|
||||
/**
|
||||
* Parse the options initialized by apr_getopt_init().
|
||||
* @param os The apr_opt_t structure returned by apr_getopt_init()
|
||||
* @param opts A string of characters that are acceptable options to the
|
||||
* program. Characters followed by ":" are required to have an
|
||||
* option associated
|
||||
* @param option_ch The next option character parsed
|
||||
* @param option_arg The argument following the option character:
|
||||
* @return There are four potential status values on exit. They are:
|
||||
* <PRE>
|
||||
* APR_EOF -- No more options to parse
|
||||
* APR_BADCH -- Found a bad option character
|
||||
* APR_BADARG -- No argument followed the option flag
|
||||
* APR_SUCCESS -- The next option was found.
|
||||
* </PRE>
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_getopt(apr_getopt_t *os, const char *opts,
|
||||
char *option_ch, const char **option_arg);
|
||||
|
||||
/**
|
||||
* Parse the options initialized by apr_getopt_init(), accepting long
|
||||
* options beginning with "--" in addition to single-character
|
||||
* options beginning with "-".
|
||||
* @param os The apr_getopt_t structure created by apr_getopt_init()
|
||||
* @param opts A pointer to a list of apr_getopt_option_t structures, which
|
||||
* can be initialized with { "name", optch, has_args }. has_args
|
||||
* is nonzero if the option requires an argument. A structure
|
||||
* with an optch value of 0 terminates the list.
|
||||
* @param option_ch Receives the value of "optch" from the apr_getopt_option_t
|
||||
* structure corresponding to the next option matched.
|
||||
* @param option_arg Receives the argument following the option, if any.
|
||||
* @return There are four potential status values on exit. They are:
|
||||
* <PRE>
|
||||
* APR_EOF -- No more options to parse
|
||||
* APR_BADCH -- Found a bad option character
|
||||
* APR_BADARG -- No argument followed the option flag
|
||||
* APR_SUCCESS -- The next option was found.
|
||||
* </PRE>
|
||||
* When APR_SUCCESS is returned, os->ind gives the index of the first
|
||||
* non-option argument. On error, a message will be printed to stdout unless
|
||||
* os->err is set to 0. If os->interleave is set to nonzero, options can come
|
||||
* after arguments, and os->argv will be permuted to leave non-option arguments
|
||||
* at the end (the original argv is unaffected).
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_getopt_long(apr_getopt_t *os,
|
||||
const apr_getopt_option_t *opts,
|
||||
int *option_ch,
|
||||
const char **option_arg);
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ! APR_GETOPT_H */
|
||||
195
database/apache/include/apr_global_mutex.h
Normal file
195
database/apache/include/apr_global_mutex.h
Normal file
@@ -0,0 +1,195 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_GLOBAL_MUTEX_H
|
||||
#define APR_GLOBAL_MUTEX_H
|
||||
|
||||
/**
|
||||
* @file apr_global_mutex.h
|
||||
* @brief APR Global Locking Routines
|
||||
*/
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_proc_mutex.h" /* only for apr_lockmech_e */
|
||||
#include "apr_pools.h"
|
||||
#include "apr_errno.h"
|
||||
#if APR_PROC_MUTEX_IS_GLOBAL
|
||||
#include "apr_proc_mutex.h"
|
||||
#endif
|
||||
#include "apr_time.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @defgroup APR_GlobalMutex Global Locking Routines
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
#if !APR_PROC_MUTEX_IS_GLOBAL || defined(DOXYGEN)
|
||||
|
||||
/** Opaque global mutex structure. */
|
||||
typedef struct apr_global_mutex_t apr_global_mutex_t;
|
||||
|
||||
/* Function definitions */
|
||||
|
||||
/**
|
||||
* Create and initialize a mutex that can be used to synchronize both
|
||||
* processes and threads. Note: There is considerable overhead in using
|
||||
* this API if only cross-process or cross-thread mutual exclusion is
|
||||
* required. See apr_proc_mutex.h and apr_thread_mutex.h for more
|
||||
* specialized lock routines.
|
||||
* @param mutex the memory address where the newly created mutex will be
|
||||
* stored.
|
||||
* @param fname A file name to use if the lock mechanism requires one. This
|
||||
* argument should always be provided. The lock code itself will
|
||||
* determine if it should be used.
|
||||
* @param mech The mechanism to use for the interprocess lock, if any; one of
|
||||
* <PRE>
|
||||
* APR_LOCK_FCNTL
|
||||
* APR_LOCK_FLOCK
|
||||
* APR_LOCK_SYSVSEM
|
||||
* APR_LOCK_POSIXSEM
|
||||
* APR_LOCK_PROC_PTHREAD
|
||||
* APR_LOCK_DEFAULT pick the default mechanism for the platform
|
||||
* APR_LOCK_DEFAULT_TIMED pick the default timed mechanism
|
||||
* </PRE>
|
||||
* @param pool the pool from which to allocate the mutex.
|
||||
* @warning Check APR_HAS_foo_SERIALIZE defines to see if the platform supports
|
||||
* APR_LOCK_foo. Only APR_LOCK_DEFAULT is portable.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_global_mutex_create(apr_global_mutex_t **mutex,
|
||||
const char *fname,
|
||||
apr_lockmech_e mech,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Re-open a mutex in a child process.
|
||||
* @param mutex The newly re-opened mutex structure.
|
||||
* @param fname A file name to use if the mutex mechanism requires one. This
|
||||
* argument should always be provided. The mutex code itself will
|
||||
* determine if it should be used. This filename should be the
|
||||
* same one that was passed to apr_global_mutex_create().
|
||||
* @param pool The pool to operate on.
|
||||
* @remark This function must be called to maintain portability, even
|
||||
* if the underlying lock mechanism does not require it.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_global_mutex_child_init(
|
||||
apr_global_mutex_t **mutex,
|
||||
const char *fname,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Acquire the lock for the given mutex. If the mutex is already locked,
|
||||
* the current thread will be put to sleep until the lock becomes available.
|
||||
* @param mutex the mutex on which to acquire the lock.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_global_mutex_lock(apr_global_mutex_t *mutex);
|
||||
|
||||
/**
|
||||
* Attempt to acquire the lock for the given mutex. If the mutex has already
|
||||
* been acquired, the call returns immediately with APR_EBUSY. Note: it
|
||||
* is important that the APR_STATUS_IS_EBUSY(s) macro be used to determine
|
||||
* if the return value was APR_EBUSY, for portability reasons.
|
||||
* @param mutex the mutex on which to attempt the lock acquiring.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_global_mutex_trylock(apr_global_mutex_t *mutex);
|
||||
|
||||
/**
|
||||
* Attempt to acquire the lock for the given mutex until timeout expires.
|
||||
* If the acquisition time outs, the call returns with APR_TIMEUP.
|
||||
* @param mutex the mutex on which to attempt the lock acquiring.
|
||||
* @param timeout the relative timeout (microseconds).
|
||||
* @note A negative or nul timeout means immediate attempt, returning
|
||||
* APR_TIMEUP without blocking if it the lock is already acquired.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_global_mutex_timedlock(apr_global_mutex_t *mutex,
|
||||
apr_interval_time_t timeout);
|
||||
|
||||
/**
|
||||
* Release the lock for the given mutex.
|
||||
* @param mutex the mutex from which to release the lock.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_global_mutex_unlock(apr_global_mutex_t *mutex);
|
||||
|
||||
/**
|
||||
* Destroy the mutex and free the memory associated with the lock.
|
||||
* @param mutex the mutex to destroy.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_global_mutex_destroy(apr_global_mutex_t *mutex);
|
||||
|
||||
/**
|
||||
* Return the name of the lockfile for the mutex, or NULL
|
||||
* if the mutex doesn't use a lock file
|
||||
*/
|
||||
APR_DECLARE(const char *) apr_global_mutex_lockfile(apr_global_mutex_t *mutex);
|
||||
|
||||
/**
|
||||
* Get the mechanism of the mutex, as it relates to the actual method
|
||||
* used for the underlying apr_proc_mutex_t.
|
||||
* @param mutex the mutex to get the mechanism from.
|
||||
*/
|
||||
APR_DECLARE(apr_lockmech_e) apr_global_mutex_mech(apr_global_mutex_t *mutex);
|
||||
|
||||
/**
|
||||
* Get the mechanism's name of the mutex, as it relates to the actual method
|
||||
* used for the underlying apr_proc_mutex_t.
|
||||
* @param mutex the mutex to get the mechanism's name from.
|
||||
*/
|
||||
APR_DECLARE(const char *) apr_global_mutex_name(apr_global_mutex_t *mutex);
|
||||
|
||||
/**
|
||||
* Set mutex permissions.
|
||||
*/
|
||||
APR_PERMS_SET_IMPLEMENT(global_mutex);
|
||||
|
||||
/**
|
||||
* Get the pool used by this global_mutex.
|
||||
* @return apr_pool_t the pool
|
||||
*/
|
||||
APR_POOL_DECLARE_ACCESSOR(global_mutex);
|
||||
|
||||
#else /* APR_PROC_MUTEX_IS_GLOBAL */
|
||||
|
||||
/* Some platforms [e.g. Win32] have cross process locks that are truly
|
||||
* global locks, since there isn't the concept of cross-process locks.
|
||||
* Define these platforms in terms of an apr_proc_mutex_t.
|
||||
*/
|
||||
|
||||
#define apr_global_mutex_t apr_proc_mutex_t
|
||||
#define apr_global_mutex_create apr_proc_mutex_create
|
||||
#define apr_global_mutex_child_init apr_proc_mutex_child_init
|
||||
#define apr_global_mutex_lock apr_proc_mutex_lock
|
||||
#define apr_global_mutex_trylock apr_proc_mutex_trylock
|
||||
#define apr_global_mutex_unlock apr_proc_mutex_unlock
|
||||
#define apr_global_mutex_destroy apr_proc_mutex_destroy
|
||||
#define apr_global_mutex_lockfile apr_proc_mutex_lockfile
|
||||
#define apr_global_mutex_mech apr_proc_mutex_mech
|
||||
#define apr_global_mutex_name apr_proc_mutex_name
|
||||
#define apr_global_mutex_perms_set apr_proc_mutex_perms_set
|
||||
#define apr_global_mutex_pool_get apr_proc_mutex_pool_get
|
||||
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ndef APR_GLOBAL_MUTEX_H */
|
||||
283
database/apache/include/apr_hash.h
Normal file
283
database/apache/include/apr_hash.h
Normal file
@@ -0,0 +1,283 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_HASH_H
|
||||
#define APR_HASH_H
|
||||
|
||||
/**
|
||||
* @file apr_hash.h
|
||||
* @brief APR Hash Tables
|
||||
*/
|
||||
|
||||
#include "apr_pools.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup apr_hash Hash Tables
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* When passing a key to apr_hash_set or apr_hash_get, this value can be
|
||||
* passed to indicate a string-valued key, and have apr_hash compute the
|
||||
* length automatically.
|
||||
*
|
||||
* @remark apr_hash will use strlen(key) for the length. The NUL terminator
|
||||
* is not included in the hash value (why throw a constant in?).
|
||||
* Since the hash table merely references the provided key (rather
|
||||
* than copying it), apr_hash_this() will return the NUL-term'd key.
|
||||
*/
|
||||
#define APR_HASH_KEY_STRING (-1)
|
||||
|
||||
/**
|
||||
* Abstract type for hash tables.
|
||||
*/
|
||||
typedef struct apr_hash_t apr_hash_t;
|
||||
|
||||
/**
|
||||
* Abstract type for scanning hash tables.
|
||||
*/
|
||||
typedef struct apr_hash_index_t apr_hash_index_t;
|
||||
|
||||
/**
|
||||
* Callback functions for calculating hash values.
|
||||
* @param key The key.
|
||||
* @param klen The length of the key, or APR_HASH_KEY_STRING to use the string
|
||||
* length. If APR_HASH_KEY_STRING then returns the actual key length.
|
||||
*/
|
||||
typedef unsigned int (*apr_hashfunc_t)(const char *key, apr_ssize_t *klen);
|
||||
|
||||
/**
|
||||
* The default hash function.
|
||||
*/
|
||||
APR_DECLARE_NONSTD(unsigned int) apr_hashfunc_default(const char *key,
|
||||
apr_ssize_t *klen);
|
||||
|
||||
/**
|
||||
* Create a hash table.
|
||||
* @param pool The pool to allocate the hash table out of
|
||||
* @return The hash table just created
|
||||
*/
|
||||
APR_DECLARE(apr_hash_t *) apr_hash_make(apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Create a hash table with a custom hash function
|
||||
* @param pool The pool to allocate the hash table out of
|
||||
* @param hash_func A custom hash function.
|
||||
* @return The hash table just created
|
||||
*/
|
||||
APR_DECLARE(apr_hash_t *) apr_hash_make_custom(apr_pool_t *pool,
|
||||
apr_hashfunc_t hash_func);
|
||||
|
||||
/**
|
||||
* Make a copy of a hash table
|
||||
* @param pool The pool from which to allocate the new hash table
|
||||
* @param h The hash table to clone
|
||||
* @return The hash table just created
|
||||
* @remark Makes a shallow copy
|
||||
*/
|
||||
APR_DECLARE(apr_hash_t *) apr_hash_copy(apr_pool_t *pool,
|
||||
const apr_hash_t *h);
|
||||
|
||||
/**
|
||||
* Associate a value with a key in a hash table.
|
||||
* @param ht The hash table
|
||||
* @param key Pointer to the key
|
||||
* @param klen Length of the key. Can be APR_HASH_KEY_STRING to use the string length.
|
||||
* @param val Value to associate with the key
|
||||
* @remark If the value is NULL the hash entry is deleted. The key is stored as is,
|
||||
* and so must have a lifetime at least as long as the hash table's pool.
|
||||
*/
|
||||
APR_DECLARE(void) apr_hash_set(apr_hash_t *ht, const void *key,
|
||||
apr_ssize_t klen, const void *val);
|
||||
|
||||
/**
|
||||
* Look up the value associated with a key in a hash table.
|
||||
* @param ht The hash table
|
||||
* @param key Pointer to the key
|
||||
* @param klen Length of the key. Can be APR_HASH_KEY_STRING to use the string length.
|
||||
* @return Returns NULL if the key is not present.
|
||||
*/
|
||||
APR_DECLARE(void *) apr_hash_get(apr_hash_t *ht, const void *key,
|
||||
apr_ssize_t klen);
|
||||
|
||||
/**
|
||||
* Start iterating over the entries in a hash table.
|
||||
* @param p The pool to allocate the apr_hash_index_t iterator. If this
|
||||
* pool is NULL, then an internal, non-thread-safe iterator is used.
|
||||
* @param ht The hash table
|
||||
* @return The iteration state
|
||||
* @remark There is no restriction on adding or deleting hash entries during
|
||||
* an iteration (although the results may be unpredictable unless all you do
|
||||
* is delete the current entry) and multiple iterations can be in
|
||||
* progress at the same time.
|
||||
*
|
||||
* @par Example:
|
||||
*
|
||||
* @code
|
||||
* int sum_values(apr_pool_t *p, apr_hash_t *ht)
|
||||
* {
|
||||
* apr_hash_index_t *hi;
|
||||
* void *val;
|
||||
* int sum = 0;
|
||||
* for (hi = apr_hash_first(p, ht); hi; hi = apr_hash_next(hi)) {
|
||||
* apr_hash_this(hi, NULL, NULL, &val);
|
||||
* sum += *(int *)val;
|
||||
* }
|
||||
* return sum;
|
||||
* }
|
||||
* @endcode
|
||||
*/
|
||||
APR_DECLARE(apr_hash_index_t *) apr_hash_first(apr_pool_t *p, apr_hash_t *ht);
|
||||
|
||||
/**
|
||||
* Continue iterating over the entries in a hash table.
|
||||
* @param hi The iteration state
|
||||
* @return a pointer to the updated iteration state. NULL if there are no more
|
||||
* entries.
|
||||
*/
|
||||
APR_DECLARE(apr_hash_index_t *) apr_hash_next(apr_hash_index_t *hi);
|
||||
|
||||
/**
|
||||
* Get the current entry's details from the iteration state.
|
||||
* @param hi The iteration state
|
||||
* @param key Return pointer for the pointer to the key.
|
||||
* @param klen Return pointer for the key length.
|
||||
* @param val Return pointer for the associated value.
|
||||
* @remark The return pointers should point to a variable that will be set to the
|
||||
* corresponding data, or they may be NULL if the data isn't interesting.
|
||||
*/
|
||||
APR_DECLARE(void) apr_hash_this(apr_hash_index_t *hi, const void **key,
|
||||
apr_ssize_t *klen, void **val);
|
||||
|
||||
/**
|
||||
* Get the current entry's key from the iteration state.
|
||||
* @param hi The iteration state
|
||||
* @return The pointer to the key
|
||||
*/
|
||||
APR_DECLARE(const void*) apr_hash_this_key(apr_hash_index_t *hi);
|
||||
|
||||
/**
|
||||
* Get the current entry's key length from the iteration state.
|
||||
* @param hi The iteration state
|
||||
* @return The key length
|
||||
*/
|
||||
APR_DECLARE(apr_ssize_t) apr_hash_this_key_len(apr_hash_index_t *hi);
|
||||
|
||||
/**
|
||||
* Get the current entry's value from the iteration state.
|
||||
* @param hi The iteration state
|
||||
* @return The pointer to the value
|
||||
*/
|
||||
APR_DECLARE(void*) apr_hash_this_val(apr_hash_index_t *hi);
|
||||
|
||||
/**
|
||||
* Get the number of key/value pairs in the hash table.
|
||||
* @param ht The hash table
|
||||
* @return The number of key/value pairs in the hash table.
|
||||
*/
|
||||
APR_DECLARE(unsigned int) apr_hash_count(apr_hash_t *ht);
|
||||
|
||||
/**
|
||||
* Clear any key/value pairs in the hash table.
|
||||
* @param ht The hash table
|
||||
*/
|
||||
APR_DECLARE(void) apr_hash_clear(apr_hash_t *ht);
|
||||
|
||||
/**
|
||||
* Merge two hash tables into one new hash table. The values of the overlay
|
||||
* hash override the values of the base if both have the same key. Both
|
||||
* hash tables must use the same hash function.
|
||||
* @param p The pool to use for the new hash table
|
||||
* @param overlay The table to add to the initial table
|
||||
* @param base The table that represents the initial values of the new table
|
||||
* @return A new hash table containing all of the data from the two passed in
|
||||
*/
|
||||
APR_DECLARE(apr_hash_t *) apr_hash_overlay(apr_pool_t *p,
|
||||
const apr_hash_t *overlay,
|
||||
const apr_hash_t *base);
|
||||
|
||||
/**
|
||||
* Merge two hash tables into one new hash table. If the same key
|
||||
* is present in both tables, call the supplied merge function to
|
||||
* produce a merged value for the key in the new table. Both
|
||||
* hash tables must use the same hash function.
|
||||
* @param p The pool to use for the new hash table
|
||||
* @param h1 The first of the tables to merge
|
||||
* @param h2 The second of the tables to merge
|
||||
* @param merger A callback function to merge values, or NULL to
|
||||
* make values from h1 override values from h2 (same semantics as
|
||||
* apr_hash_overlay())
|
||||
* @param data Client data to pass to the merger function
|
||||
* @return A new hash table containing all of the data from the two passed in
|
||||
*/
|
||||
APR_DECLARE(apr_hash_t *) apr_hash_merge(apr_pool_t *p,
|
||||
const apr_hash_t *h1,
|
||||
const apr_hash_t *h2,
|
||||
void * (*merger)(apr_pool_t *p,
|
||||
const void *key,
|
||||
apr_ssize_t klen,
|
||||
const void *h1_val,
|
||||
const void *h2_val,
|
||||
const void *data),
|
||||
const void *data);
|
||||
|
||||
/**
|
||||
* Declaration prototype for the iterator callback function of apr_hash_do().
|
||||
*
|
||||
* @param rec The data passed as the first argument to apr_hash_[v]do()
|
||||
* @param key The key from this iteration of the hash table
|
||||
* @param klen The key length from this iteration of the hash table
|
||||
* @param value The value from this iteration of the hash table
|
||||
* @remark Iteration continues while this callback function returns non-zero.
|
||||
* To export the callback function for apr_hash_do() it must be declared
|
||||
* in the _NONSTD convention.
|
||||
*/
|
||||
typedef int (apr_hash_do_callback_fn_t)(void *rec, const void *key,
|
||||
apr_ssize_t klen,
|
||||
const void *value);
|
||||
|
||||
/**
|
||||
* Iterate over a hash table running the provided function once for every
|
||||
* element in the hash table. The @p comp function will be invoked for
|
||||
* every element in the hash table.
|
||||
*
|
||||
* @param comp The function to run
|
||||
* @param rec The data to pass as the first argument to the function
|
||||
* @param ht The hash table to iterate over
|
||||
* @return FALSE if one of the comp() iterations returned zero; TRUE if all
|
||||
* iterations returned non-zero
|
||||
* @see apr_hash_do_callback_fn_t
|
||||
*/
|
||||
APR_DECLARE(int) apr_hash_do(apr_hash_do_callback_fn_t *comp,
|
||||
void *rec, const apr_hash_t *ht);
|
||||
|
||||
/**
|
||||
* Get a pointer to the pool which the hash table was created in
|
||||
*/
|
||||
APR_POOL_DECLARE_ACCESSOR(hash);
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !APR_HASH_H */
|
||||
358
database/apache/include/apr_hooks.h
Normal file
358
database/apache/include/apr_hooks.h
Normal file
@@ -0,0 +1,358 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_HOOKS_H
|
||||
#define APR_HOOKS_H
|
||||
|
||||
#include "apu.h"
|
||||
/* For apr_array_header_t */
|
||||
#include "apr_tables.h"
|
||||
|
||||
/**
|
||||
* @file apr_hooks.h
|
||||
* @brief Apache hook functions
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/**
|
||||
* @defgroup APR_Util_Hook Hook Functions
|
||||
* @ingroup APR_Util
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup apr_hook_probes Hook probe capability
|
||||
* APR hooks provide a trace probe capability for capturing
|
||||
* the flow of control and return values with hooks.
|
||||
*
|
||||
* In order to use this facility, the application must define
|
||||
* the symbol APR_HOOK_PROBES_ENABLED and the four APR_HOOK_PROBE_
|
||||
* macros described below before including apr_hooks.h in files
|
||||
* that use the APR_IMPLEMENT_EXTERNAL_HOOK_* macros.
|
||||
*
|
||||
* This probe facility is not provided for APR optional hooks.
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifdef APR_HOOK_PROBES_ENABLED
|
||||
#define APR_HOOK_INT_DCL_UD void *ud = NULL
|
||||
#else
|
||||
/** internal implementation detail to avoid the ud declaration when
|
||||
* hook probes are not used
|
||||
*/
|
||||
#define APR_HOOK_INT_DCL_UD
|
||||
/**
|
||||
* User-defined hook probe macro that is invoked when the hook
|
||||
* is run, before calling any hook functions.
|
||||
* @param ud A void * user data field that should be filled in by
|
||||
* this macro, and will be provided to the other hook probe macros.
|
||||
* @param ns The namespace prefix of the hook functions
|
||||
* @param name The name of the hook
|
||||
* @param args The argument list to the hook functions, with enclosing
|
||||
* parens.
|
||||
*/
|
||||
#define APR_HOOK_PROBE_ENTRY(ud,ns,name,args)
|
||||
/**
|
||||
* User-defined hook probe macro that is invoked after the hook
|
||||
* has run.
|
||||
* @param ud A void * user data field that was filled in by the user-
|
||||
* provided APR_HOOK_PROBE_ENTRY().
|
||||
* @param ns The namespace prefix of the hook functions
|
||||
* @param name The name of the hook
|
||||
* @param rv The return value of the hook, or 0 if the hook is void.
|
||||
* @param args The argument list to the hook functions, with enclosing
|
||||
* parens.
|
||||
*/
|
||||
#define APR_HOOK_PROBE_RETURN(ud,ns,name,rv,args)
|
||||
/**
|
||||
* User-defined hook probe macro that is invoked before calling a
|
||||
* hook function.
|
||||
* @param ud A void * user data field that was filled in by the user-
|
||||
* provided APR_HOOK_PROBE_ENTRY().
|
||||
* @param ns The namespace prefix of the hook functions
|
||||
* @param name The name of the hook
|
||||
* @param src The value of apr_hook_debug_current at the time the function
|
||||
* was hooked (usually the source file implementing the hook function).
|
||||
* @param args The argument list to the hook functions, with enclosing
|
||||
* parens.
|
||||
*/
|
||||
#define APR_HOOK_PROBE_INVOKE(ud,ns,name,src,args)
|
||||
/**
|
||||
* User-defined hook probe macro that is invoked after calling a
|
||||
* hook function.
|
||||
* @param ud A void * user data field that was filled in by the user-
|
||||
* provided APR_HOOK_PROBE_ENTRY().
|
||||
* @param ns The namespace prefix of the hook functions
|
||||
* @param name The name of the hook
|
||||
* @param src The value of apr_hook_debug_current at the time the function
|
||||
* was hooked (usually the source file implementing the hook function).
|
||||
* @param rv The return value of the hook function, or 0 if the hook is void.
|
||||
* @param args The argument list to the hook functions, with enclosing
|
||||
* parens.
|
||||
*/
|
||||
#define APR_HOOK_PROBE_COMPLETE(ud,ns,name,src,rv,args)
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
/** macro to return the prototype of the hook function */
|
||||
#define APR_IMPLEMENT_HOOK_GET_PROTO(ns,link,name) \
|
||||
link##_DECLARE(apr_array_header_t *) ns##_hook_get_##name(void)
|
||||
|
||||
/** macro to declare the hook correctly */
|
||||
#define APR_DECLARE_EXTERNAL_HOOK(ns,link,ret,name,args) \
|
||||
typedef ret ns##_HOOK_##name##_t args; \
|
||||
link##_DECLARE(void) ns##_hook_##name(ns##_HOOK_##name##_t *pf, \
|
||||
const char * const *aszPre, \
|
||||
const char * const *aszSucc, int nOrder); \
|
||||
link##_DECLARE(ret) ns##_run_##name args; \
|
||||
APR_IMPLEMENT_HOOK_GET_PROTO(ns,link,name); \
|
||||
typedef struct ns##_LINK_##name##_t \
|
||||
{ \
|
||||
ns##_HOOK_##name##_t *pFunc; \
|
||||
const char *szName; \
|
||||
const char * const *aszPredecessors; \
|
||||
const char * const *aszSuccessors; \
|
||||
int nOrder; \
|
||||
} ns##_LINK_##name##_t;
|
||||
|
||||
/** macro to declare the hook structure */
|
||||
#define APR_HOOK_STRUCT(members) \
|
||||
static struct { members } _hooks;
|
||||
|
||||
/** macro to link the hook structure */
|
||||
#define APR_HOOK_LINK(name) \
|
||||
apr_array_header_t *link_##name;
|
||||
|
||||
/** macro to implement the hook */
|
||||
#define APR_IMPLEMENT_EXTERNAL_HOOK_BASE(ns,link,name) \
|
||||
link##_DECLARE(void) ns##_hook_##name(ns##_HOOK_##name##_t *pf,const char * const *aszPre, \
|
||||
const char * const *aszSucc,int nOrder) \
|
||||
{ \
|
||||
ns##_LINK_##name##_t *pHook; \
|
||||
if(!_hooks.link_##name) \
|
||||
{ \
|
||||
_hooks.link_##name=apr_array_make(apr_hook_global_pool,1,sizeof(ns##_LINK_##name##_t)); \
|
||||
apr_hook_sort_register(#name,&_hooks.link_##name); \
|
||||
} \
|
||||
pHook=apr_array_push(_hooks.link_##name); \
|
||||
pHook->pFunc=pf; \
|
||||
pHook->aszPredecessors=aszPre; \
|
||||
pHook->aszSuccessors=aszSucc; \
|
||||
pHook->nOrder=nOrder; \
|
||||
pHook->szName=apr_hook_debug_current; \
|
||||
if(apr_hook_debug_enabled) \
|
||||
apr_hook_debug_show(#name,aszPre,aszSucc); \
|
||||
} \
|
||||
APR_IMPLEMENT_HOOK_GET_PROTO(ns,link,name) \
|
||||
{ \
|
||||
return _hooks.link_##name; \
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement a hook that has no return code, and therefore runs all of the
|
||||
* registered functions
|
||||
* @param ns The namespace prefix of the hook functions
|
||||
* @param link The linkage declaration prefix of the hook
|
||||
* @param name The name of the hook
|
||||
* @param args_decl The declaration of the arguments for the hook
|
||||
* @param args_use The names for the arguments for the hook
|
||||
* @note The link prefix FOO corresponds to FOO_DECLARE() macros, which
|
||||
* provide export linkage from the module that IMPLEMENTs the hook, and
|
||||
* import linkage from external modules that link to the hook's module.
|
||||
*/
|
||||
#define APR_IMPLEMENT_EXTERNAL_HOOK_VOID(ns,link,name,args_decl,args_use) \
|
||||
APR_IMPLEMENT_EXTERNAL_HOOK_BASE(ns,link,name) \
|
||||
link##_DECLARE(void) ns##_run_##name args_decl \
|
||||
{ \
|
||||
ns##_LINK_##name##_t *pHook; \
|
||||
int n; \
|
||||
APR_HOOK_INT_DCL_UD; \
|
||||
\
|
||||
APR_HOOK_PROBE_ENTRY(ud, ns, name, args_use); \
|
||||
\
|
||||
if(_hooks.link_##name) \
|
||||
{ \
|
||||
pHook=(ns##_LINK_##name##_t *)_hooks.link_##name->elts; \
|
||||
for(n=0 ; n < _hooks.link_##name->nelts ; ++n) \
|
||||
{ \
|
||||
APR_HOOK_PROBE_INVOKE(ud, ns, name, (char *)pHook[n].szName, args_use); \
|
||||
pHook[n].pFunc args_use; \
|
||||
APR_HOOK_PROBE_COMPLETE(ud, ns, name, (char *)pHook[n].szName, 0, args_use); \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
APR_HOOK_PROBE_RETURN(ud, ns, name, 0, args_use); \
|
||||
\
|
||||
}
|
||||
|
||||
/* FIXME: note that this returns ok when nothing is run. I suspect it should
|
||||
really return decline, but that breaks Apache currently - Ben
|
||||
*/
|
||||
/**
|
||||
* Implement a hook that runs until one of the functions returns something
|
||||
* other than OK or DECLINE
|
||||
* @param ns The namespace prefix of the hook functions
|
||||
* @param link The linkage declaration prefix of the hook
|
||||
* @param ret Type to return
|
||||
* @param name The name of the hook
|
||||
* @param args_decl The declaration of the arguments for the hook
|
||||
* @param args_use The names for the arguments for the hook
|
||||
* @param ok Success value
|
||||
* @param decline Decline value
|
||||
* @note The link prefix FOO corresponds to FOO_DECLARE() macros, which
|
||||
* provide export linkage from the module that IMPLEMENTs the hook, and
|
||||
* import linkage from external modules that link to the hook's module.
|
||||
*/
|
||||
#define APR_IMPLEMENT_EXTERNAL_HOOK_RUN_ALL(ns,link,ret,name,args_decl,args_use,ok,decline) \
|
||||
APR_IMPLEMENT_EXTERNAL_HOOK_BASE(ns,link,name) \
|
||||
link##_DECLARE(ret) ns##_run_##name args_decl \
|
||||
{ \
|
||||
ns##_LINK_##name##_t *pHook; \
|
||||
int n; \
|
||||
ret rv = ok; \
|
||||
APR_HOOK_INT_DCL_UD; \
|
||||
\
|
||||
APR_HOOK_PROBE_ENTRY(ud, ns, name, args_use); \
|
||||
\
|
||||
if(_hooks.link_##name) \
|
||||
{ \
|
||||
pHook=(ns##_LINK_##name##_t *)_hooks.link_##name->elts; \
|
||||
for(n=0 ; n < _hooks.link_##name->nelts ; ++n) \
|
||||
{ \
|
||||
APR_HOOK_PROBE_INVOKE(ud, ns, name, (char *)pHook[n].szName, args_use); \
|
||||
rv=pHook[n].pFunc args_use; \
|
||||
APR_HOOK_PROBE_COMPLETE(ud, ns, name, (char *)pHook[n].szName, rv, args_use); \
|
||||
if(rv != ok && rv != decline) \
|
||||
break; \
|
||||
rv = ok; \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
APR_HOOK_PROBE_RETURN(ud, ns, name, rv, args_use); \
|
||||
\
|
||||
return rv; \
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Implement a hook that runs until the first function returns something
|
||||
* other than the value of decline
|
||||
* @param ns The namespace prefix of the hook functions
|
||||
* @param link The linkage declaration prefix of the hook
|
||||
* @param name The name of the hook
|
||||
* @param ret Type to return
|
||||
* @param args_decl The declaration of the arguments for the hook
|
||||
* @param args_use The names for the arguments for the hook
|
||||
* @param decline Decline value
|
||||
* @note The link prefix FOO corresponds to FOO_DECLARE() macros, which
|
||||
* provide export linkage from the module that IMPLEMENTs the hook, and
|
||||
* import linkage from external modules that link to the hook's module.
|
||||
*/
|
||||
#define APR_IMPLEMENT_EXTERNAL_HOOK_RUN_FIRST(ns,link,ret,name,args_decl,args_use,decline) \
|
||||
APR_IMPLEMENT_EXTERNAL_HOOK_BASE(ns,link,name) \
|
||||
link##_DECLARE(ret) ns##_run_##name args_decl \
|
||||
{ \
|
||||
ns##_LINK_##name##_t *pHook; \
|
||||
int n; \
|
||||
ret rv = decline; \
|
||||
APR_HOOK_INT_DCL_UD; \
|
||||
\
|
||||
APR_HOOK_PROBE_ENTRY(ud, ns, name, args_use); \
|
||||
\
|
||||
if(_hooks.link_##name) \
|
||||
{ \
|
||||
pHook=(ns##_LINK_##name##_t *)_hooks.link_##name->elts; \
|
||||
for(n=0 ; n < _hooks.link_##name->nelts ; ++n) \
|
||||
{ \
|
||||
APR_HOOK_PROBE_INVOKE(ud, ns, name, (char *)pHook[n].szName, args_use); \
|
||||
rv=pHook[n].pFunc args_use; \
|
||||
APR_HOOK_PROBE_COMPLETE(ud, ns, name, (char *)pHook[n].szName, rv, args_use); \
|
||||
\
|
||||
if(rv != decline) \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
APR_HOOK_PROBE_RETURN(ud, ns, name, rv, args_use); \
|
||||
\
|
||||
return rv; \
|
||||
}
|
||||
|
||||
/* Hook orderings */
|
||||
/** run this hook first, before ANYTHING */
|
||||
#define APR_HOOK_REALLY_FIRST (-10)
|
||||
/** run this hook first */
|
||||
#define APR_HOOK_FIRST 0
|
||||
/** run this hook somewhere */
|
||||
#define APR_HOOK_MIDDLE 10
|
||||
/** run this hook after every other hook which is defined*/
|
||||
#define APR_HOOK_LAST 20
|
||||
/** run this hook last, after EVERYTHING */
|
||||
#define APR_HOOK_REALLY_LAST 30
|
||||
|
||||
/**
|
||||
* The global pool used to allocate any memory needed by the hooks.
|
||||
*/
|
||||
APU_DECLARE_DATA extern apr_pool_t *apr_hook_global_pool;
|
||||
|
||||
/**
|
||||
* A global variable to determine if debugging information about the
|
||||
* hooks functions should be printed.
|
||||
*/
|
||||
APU_DECLARE_DATA extern int apr_hook_debug_enabled;
|
||||
|
||||
/**
|
||||
* The name of the module that is currently registering a function.
|
||||
*/
|
||||
APU_DECLARE_DATA extern const char *apr_hook_debug_current;
|
||||
|
||||
/**
|
||||
* Register a hook function to be sorted.
|
||||
* @param szHookName The name of the Hook the function is registered for
|
||||
* @param aHooks The array which stores all of the functions for this hook
|
||||
*/
|
||||
APU_DECLARE(void) apr_hook_sort_register(const char *szHookName,
|
||||
apr_array_header_t **aHooks);
|
||||
/**
|
||||
* Sort all of the registered functions for a given hook.
|
||||
*/
|
||||
APU_DECLARE(void) apr_hook_sort_all(void);
|
||||
|
||||
/**
|
||||
* Print all of the information about the current hook. This is used for
|
||||
* debugging purposes.
|
||||
* @param szName The name of the hook
|
||||
* @param aszPre All of the functions in the predecessor array
|
||||
* @param aszSucc All of the functions in the successor array
|
||||
*/
|
||||
APU_DECLARE(void) apr_hook_debug_show(const char *szName,
|
||||
const char * const *aszPre,
|
||||
const char * const *aszSucc);
|
||||
|
||||
/**
|
||||
* Remove all currently registered functions.
|
||||
*/
|
||||
APU_DECLARE(void) apr_hook_deregister_all(void);
|
||||
|
||||
/** @} */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* APR_HOOKS_H */
|
||||
51
database/apache/include/apr_inherit.h
Normal file
51
database/apache/include/apr_inherit.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_INHERIT_H
|
||||
#define APR_INHERIT_H
|
||||
|
||||
/**
|
||||
* @file apr_inherit.h
|
||||
* @brief APR File Handle Inheritance Helpers
|
||||
* @remark This internal header includes internal declaration helpers
|
||||
* for other headers to declare apr_foo_inherit_[un]set functions.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Prototype for type-specific declarations of apr_foo_inherit_set
|
||||
* functions.
|
||||
* @remark Doxygen unwraps this macro (via doxygen.conf) to provide
|
||||
* actual help for each specific occurrence of apr_foo_inherit_set.
|
||||
* @remark the linkage is specified for APR. It would be possible to expand
|
||||
* the macros to support other linkages.
|
||||
*/
|
||||
#define APR_DECLARE_INHERIT_SET(type) \
|
||||
APR_DECLARE(apr_status_t) apr_##type##_inherit_set( \
|
||||
apr_##type##_t *the##type)
|
||||
|
||||
/**
|
||||
* Prototype for type-specific declarations of apr_foo_inherit_unset
|
||||
* functions.
|
||||
* @remark Doxygen unwraps this macro (via doxygen.conf) to provide
|
||||
* actual help for each specific occurrence of apr_foo_inherit_unset.
|
||||
* @remark the linkage is specified for APR. It would be possible to expand
|
||||
* the macros to support other linkages.
|
||||
*/
|
||||
#define APR_DECLARE_INHERIT_UNSET(type) \
|
||||
APR_DECLARE(apr_status_t) apr_##type##_inherit_unset( \
|
||||
apr_##type##_t *the##type)
|
||||
|
||||
#endif /* ! APR_INHERIT_H */
|
||||
197
database/apache/include/apr_ldap.h
Normal file
197
database/apache/include/apr_ldap.h
Normal file
@@ -0,0 +1,197 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* apr_ldap.h is generated from apr_ldap.h.in by configure -- do not edit apr_ldap.h
|
||||
*/
|
||||
/**
|
||||
* @file apr_ldap.h
|
||||
* @brief APR-UTIL LDAP
|
||||
*/
|
||||
#ifndef APU_LDAP_H
|
||||
#define APU_LDAP_H
|
||||
|
||||
/**
|
||||
* @defgroup APR_Util_LDAP LDAP
|
||||
* @ingroup APR_Util
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* this will be defined if LDAP support was compiled into apr-util */
|
||||
#define APR_HAS_LDAP 1
|
||||
|
||||
/* identify the LDAP toolkit used */
|
||||
#define APR_HAS_NETSCAPE_LDAPSDK 0
|
||||
#define APR_HAS_SOLARIS_LDAPSDK 0
|
||||
#define APR_HAS_NOVELL_LDAPSDK 0
|
||||
#define APR_HAS_MOZILLA_LDAPSDK 0
|
||||
#define APR_HAS_OPENLDAP_LDAPSDK 0
|
||||
#define APR_HAS_MICROSOFT_LDAPSDK 1
|
||||
#define APR_HAS_TIVOLI_LDAPSDK 0
|
||||
#define APR_HAS_ZOS_LDAPSDK 0
|
||||
#define APR_HAS_OTHER_LDAPSDK 0
|
||||
|
||||
|
||||
/*
|
||||
* Handle the case when LDAP is enabled
|
||||
*/
|
||||
#if APR_HAS_LDAP
|
||||
|
||||
/*
|
||||
* The following #defines are DEPRECATED and should not be used for
|
||||
* anything. They remain to maintain binary compatibility.
|
||||
* The original code defined the OPENLDAP SDK as present regardless
|
||||
* of what really was there, which was way bogus. In addition, the
|
||||
* apr_ldap_url_parse*() functions have been rewritten specifically for
|
||||
* APR, so the APR_HAS_LDAP_URL_PARSE macro is forced to zero.
|
||||
*/
|
||||
#if APR_HAS_TIVOLI_LDAPSDK
|
||||
#define APR_HAS_LDAP_SSL 0
|
||||
#else
|
||||
#define APR_HAS_LDAP_SSL 1
|
||||
#endif
|
||||
#define APR_HAS_LDAP_URL_PARSE 0
|
||||
|
||||
#if APR_HAS_OPENLDAP_LDAPSDK && !defined(LDAP_DEPRECATED)
|
||||
/* Ensure that the "deprecated" interfaces are still exposed
|
||||
* with OpenLDAP >= 2.3; these were exposed by default in earlier
|
||||
* releases. */
|
||||
#define LDAP_DEPRECATED 1
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Include the standard LDAP header files.
|
||||
*/
|
||||
|
||||
#include <winldap.h>
|
||||
|
||||
|
||||
/*
|
||||
* Detected standard functions
|
||||
*/
|
||||
#define APR_HAS_LDAPSSL_CLIENT_INIT 0
|
||||
#define APR_HAS_LDAPSSL_CLIENT_DEINIT 0
|
||||
#define APR_HAS_LDAPSSL_ADD_TRUSTED_CERT 0
|
||||
#define APR_HAS_LDAP_START_TLS_S 0
|
||||
#define APR_HAS_LDAP_SSLINIT 1
|
||||
#define APR_HAS_LDAPSSL_INIT 0
|
||||
#define APR_HAS_LDAPSSL_INSTALL_ROUTINES 0
|
||||
|
||||
|
||||
/*
|
||||
* Make sure the secure LDAP port is defined
|
||||
*/
|
||||
#ifndef LDAPS_PORT
|
||||
#define LDAPS_PORT 636 /* ldaps:/// default LDAP over TLS port */
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* For ldap function calls that input a size limit on the number of returned elements
|
||||
* Some SDKs do not have the define for LDAP_DEFAULT_LIMIT (-1) or LDAP_NO_LIMIT (0)
|
||||
* LDAP_DEFAULT_LIMIT is preferred as it allows inheritance from whatever the SDK
|
||||
* or process is configured for.
|
||||
*/
|
||||
#ifdef LDAP_DEFAULT_LIMIT
|
||||
#define APR_LDAP_SIZELIMIT LDAP_DEFAULT_LIMIT
|
||||
#else
|
||||
#ifdef LDAP_NO_LIMIT
|
||||
#define APR_LDAP_SIZELIMIT LDAP_NO_LIMIT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef APR_LDAP_SIZELIMIT
|
||||
#define APR_LDAP_SIZELIMIT 0 /* equivalent to LDAP_NO_LIMIT, and what goes on the wire */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* z/OS is missing some defines
|
||||
*/
|
||||
#ifndef LDAP_VERSION_MAX
|
||||
#define LDAP_VERSION_MAX LDAP_VERSION
|
||||
#endif
|
||||
#if APR_HAS_ZOS_LDAPSDK
|
||||
#define LDAP_VENDOR_NAME "IBM z/OS"
|
||||
#endif
|
||||
|
||||
/* Note: Macros defining const casting has been removed in APR v1.0,
|
||||
* pending real support for LDAP v2.0 toolkits.
|
||||
*
|
||||
* In the mean time, please use an LDAP v3.0 toolkit.
|
||||
*/
|
||||
#if LDAP_VERSION_MAX <= 2
|
||||
#error Support for LDAP v2.0 toolkits has been removed from apr-util. Please use an LDAP v3.0 toolkit.
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* This structure allows the C LDAP API error codes to be returned
|
||||
* along with plain text error messages that explain to us mere mortals
|
||||
* what really happened.
|
||||
*/
|
||||
typedef struct apr_ldap_err_t {
|
||||
const char *reason;
|
||||
const char *msg;
|
||||
int rc;
|
||||
} apr_ldap_err_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/* The MS SDK returns LDAP_UNAVAILABLE when the backend has closed the connection
|
||||
* between LDAP calls. Protect with APR_HAS_MICROSOFT_LDAPSDK in case someone
|
||||
* manually chooses another SDK on Windows
|
||||
*/
|
||||
#if APR_HAS_MICROSOFT_LDAPSDK
|
||||
#define APR_LDAP_IS_SERVER_DOWN(s) ((s) == LDAP_SERVER_DOWN \
|
||||
|| (s) == LDAP_UNAVAILABLE)
|
||||
#else
|
||||
#define APR_LDAP_IS_SERVER_DOWN(s) ((s) == LDAP_SERVER_DOWN)
|
||||
#endif
|
||||
|
||||
/* These symbols are not actually exported in a DSO build, but mapped into
|
||||
* a private exported function array for apr_ldap_stub to bind dynamically.
|
||||
* Rename them appropriately to protect the global namespace.
|
||||
*/
|
||||
#ifdef APU_DSO_LDAP_BUILD
|
||||
|
||||
#define apr_ldap_info apr__ldap_info
|
||||
#define apr_ldap_init apr__ldap_init
|
||||
#define apr_ldap_ssl_init apr__ldap_ssl_init
|
||||
#define apr_ldap_ssl_deinit apr__ldap_ssl_deinit
|
||||
#define apr_ldap_get_option apr__ldap_get_option
|
||||
#define apr_ldap_set_option apr__ldap_set_option
|
||||
#define apr_ldap_rebind_init apr__ldap_rebind_init
|
||||
#define apr_ldap_rebind_add apr__ldap_rebind_add
|
||||
#define apr_ldap_rebind_remove apr__ldap_rebind_remove
|
||||
|
||||
#define APU_DECLARE_LDAP(type) type
|
||||
#else
|
||||
#define APU_DECLARE_LDAP(type) APU_DECLARE(type)
|
||||
#endif
|
||||
|
||||
#include "apr_ldap_url.h"
|
||||
#include "apr_ldap_init.h"
|
||||
#include "apr_ldap_option.h"
|
||||
#include "apr_ldap_rebind.h"
|
||||
|
||||
/** @} */
|
||||
#endif /* APR_HAS_LDAP */
|
||||
#endif /* APU_LDAP_H */
|
||||
165
database/apache/include/apr_ldap_init.h
Normal file
165
database/apache/include/apr_ldap_init.h
Normal file
@@ -0,0 +1,165 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file apr_ldap_init.h
|
||||
* @brief APR-UTIL LDAP ldap_init() functions
|
||||
*/
|
||||
#ifndef APR_LDAP_INIT_H
|
||||
#define APR_LDAP_INIT_H
|
||||
|
||||
/**
|
||||
* @addtogroup APR_Util_LDAP
|
||||
* @{
|
||||
*/
|
||||
|
||||
#include "apr_ldap.h"
|
||||
|
||||
#if APR_HAS_LDAP
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
/**
|
||||
* Macro to detect security related return values.
|
||||
*/
|
||||
#if defined(LDAP_INSUFFICIENT_ACCESS)
|
||||
#define APU_LDAP_INSUFFICIENT_ACCESS LDAP_INSUFFICIENT_ACCESS
|
||||
#elif defined(LDAP_INSUFFICIENT_RIGHTS)
|
||||
#define APU_LDAP_INSUFFICIENT_ACCESS LDAP_INSUFFICIENT_RIGHTS
|
||||
#elif defined(APR_HAS_MICROSOFT_LDAPSDK)
|
||||
/* The macros above fail to contemplate that LDAP_RETCODE values
|
||||
* may be represented by an enum. autoconf tests would be much
|
||||
* more robust.
|
||||
*/
|
||||
#define APU_LDAP_INSUFFICIENT_ACCESS LDAP_INSUFFICIENT_RIGHTS
|
||||
#else
|
||||
#error The security return codes must be added to support this LDAP toolkit.
|
||||
#endif
|
||||
|
||||
#if defined(LDAP_SECURITY_ERROR)
|
||||
#define APU_LDAP_SECURITY_ERROR LDAP_SECURITY_ERROR
|
||||
#else
|
||||
#define APU_LDAP_SECURITY_ERROR(n) \
|
||||
(LDAP_INAPPROPRIATE_AUTH == n) ? 1 \
|
||||
: (LDAP_INVALID_CREDENTIALS == n) ? 1 \
|
||||
: (APU_LDAP_INSUFFICIENT_ACCESS == n) ? 1 \
|
||||
: 0
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* APR LDAP SSL Initialise function
|
||||
*
|
||||
* This function initialises SSL on the underlying LDAP toolkit
|
||||
* if this is necessary.
|
||||
*
|
||||
* If a CA certificate is provided, this is set, however the setting
|
||||
* of certificates via this method has been deprecated and will be removed in
|
||||
* APR v2.0.
|
||||
*
|
||||
* The apr_ldap_set_option() function with the APR_LDAP_OPT_TLS_CERT option
|
||||
* should be used instead to set certificates.
|
||||
*
|
||||
* If SSL support is not available on this platform, or a problem
|
||||
* was encountered while trying to set the certificate, the function
|
||||
* will return APR_EGENERAL. Further LDAP specific error information
|
||||
* can be found in result_err.
|
||||
* @param pool The pool to use
|
||||
* @param cert_auth_file The name of the certificate to use, can be NULL
|
||||
* @param cert_file_type The type of certificate specified. See the
|
||||
* apr_ldap_set_option() APR_LDAP_OPT_TLS_CERT option for details.
|
||||
* @param result_err The returned result
|
||||
*/
|
||||
APU_DECLARE_LDAP(int) apr_ldap_ssl_init(apr_pool_t *pool,
|
||||
const char *cert_auth_file,
|
||||
int cert_file_type,
|
||||
apr_ldap_err_t **result_err);
|
||||
|
||||
/**
|
||||
* APR LDAP SSL De-Initialise function
|
||||
*
|
||||
* This function tears down any SSL certificate setup previously
|
||||
* set using apr_ldap_ssl_init(). It should be called to clean
|
||||
* up if a graceful restart of a service is attempted.
|
||||
* @todo currently we do not check whether apr_ldap_ssl_init()
|
||||
* has been called first - we probably should.
|
||||
*/
|
||||
APU_DECLARE_LDAP(int) apr_ldap_ssl_deinit(void);
|
||||
|
||||
/**
|
||||
* APR LDAP initialise function
|
||||
*
|
||||
* This function is responsible for initialising an LDAP
|
||||
* connection in a toolkit independant way. It does the
|
||||
* job of ldap_init() from the C api.
|
||||
*
|
||||
* It handles both the SSL and non-SSL case, and attempts
|
||||
* to hide the complexity setup from the user. This function
|
||||
* assumes that any certificate setup necessary has already
|
||||
* been done.
|
||||
*
|
||||
* If SSL or STARTTLS needs to be enabled, and the underlying
|
||||
* toolkit supports it, the following values are accepted for
|
||||
* secure:
|
||||
*
|
||||
* APR_LDAP_NONE: No encryption
|
||||
* APR_LDAP_SSL: SSL encryption (ldaps://)
|
||||
* APR_LDAP_STARTTLS: Force STARTTLS on ldap://
|
||||
* @remark The Novell toolkit is only able to set the SSL mode via this
|
||||
* function. To work around this limitation, set the SSL mode here if no
|
||||
* per connection client certificates are present, otherwise set secure
|
||||
* APR_LDAP_NONE here, then set the per connection client certificates,
|
||||
* followed by setting the SSL mode via apr_ldap_set_option(). As Novell
|
||||
* does not support per connection client certificates, this problem is
|
||||
* worked around while still being compatible with other LDAP toolkits.
|
||||
* @param pool The pool to use
|
||||
* @param ldap The LDAP handle
|
||||
* @param hostname The name of the host to connect to. This can be either a
|
||||
* DNS name, or an IP address.
|
||||
* @param portno The port to connect to
|
||||
* @param secure The security mode to set
|
||||
* @param result_err The returned result
|
||||
*/
|
||||
APU_DECLARE_LDAP(int) apr_ldap_init(apr_pool_t *pool,
|
||||
LDAP **ldap,
|
||||
const char *hostname,
|
||||
int portno,
|
||||
int secure,
|
||||
apr_ldap_err_t **result_err);
|
||||
|
||||
/**
|
||||
* APR LDAP info function
|
||||
*
|
||||
* This function returns a string describing the LDAP toolkit
|
||||
* currently in use. The string is placed inside result_err->reason.
|
||||
* @param pool The pool to use
|
||||
* @param result_err The returned result
|
||||
*/
|
||||
APU_DECLARE_LDAP(int) apr_ldap_info(apr_pool_t *pool,
|
||||
apr_ldap_err_t **result_err);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* APR_HAS_LDAP */
|
||||
|
||||
/** @} */
|
||||
|
||||
#endif /* APR_LDAP_URL_H */
|
||||
254
database/apache/include/apr_ldap_option.h
Normal file
254
database/apache/include/apr_ldap_option.h
Normal file
@@ -0,0 +1,254 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file apr_ldap_option.h
|
||||
* @brief APR-UTIL LDAP ldap_*_option() functions
|
||||
*/
|
||||
#ifndef APR_LDAP_OPTION_H
|
||||
#define APR_LDAP_OPTION_H
|
||||
|
||||
/**
|
||||
* @addtogroup APR_Util_LDAP
|
||||
* @{
|
||||
*/
|
||||
|
||||
#include "apr_ldap.h"
|
||||
|
||||
#if APR_HAS_LDAP
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*
|
||||
* The following defines handle the different TLS certificate
|
||||
* options available. If these options are missing, APR will try and
|
||||
* emulate support for this using the deprecated ldap_start_tls_s()
|
||||
* function.
|
||||
*/
|
||||
/**
|
||||
* Set SSL mode to one of APR_LDAP_NONE, APR_LDAP_SSL, APR_LDAP_STARTTLS
|
||||
* or APR_LDAP_STOPTLS.
|
||||
*/
|
||||
#define APR_LDAP_OPT_TLS 0x6fff
|
||||
/**
|
||||
* Set zero or more CA certificates, client certificates or private
|
||||
* keys globally, or per connection (where supported).
|
||||
*/
|
||||
#define APR_LDAP_OPT_TLS_CERT 0x6ffe
|
||||
/**
|
||||
* Set the LDAP library to no verify the server certificate. This means
|
||||
* all servers are considered trusted.
|
||||
*/
|
||||
#define APR_LDAP_OPT_VERIFY_CERT 0x6ffd
|
||||
/**
|
||||
* Set the LDAP library to indicate if referrals should be chased during
|
||||
* LDAP searches.
|
||||
*/
|
||||
#define APR_LDAP_OPT_REFERRALS 0x6ffc
|
||||
/**
|
||||
* Set the LDAP library to indicate a maximum number of referral hops to
|
||||
* chase before giving up on the search.
|
||||
*/
|
||||
#define APR_LDAP_OPT_REFHOPLIMIT 0x6ffb
|
||||
|
||||
/**
|
||||
* Structures for the apr_set_option() cases
|
||||
*/
|
||||
|
||||
/**
|
||||
* APR_LDAP_OPT_TLS_CERT
|
||||
*
|
||||
* This structure includes possible options to set certificates on
|
||||
* system initialisation. Different SDKs have different certificate
|
||||
* requirements, and to achieve this multiple certificates must be
|
||||
* specified at once passed as an (apr_array_header_t *).
|
||||
*
|
||||
* Netscape:
|
||||
* Needs the CA cert database (cert7.db), the client cert database (key3.db)
|
||||
* and the security module file (secmod.db) set at the system initialisation
|
||||
* time. Three types are supported: APR_LDAP_CERT7_DB, APR_LDAP_KEY3_DB and
|
||||
* APR_LDAP_SECMOD.
|
||||
*
|
||||
* To specify a client cert connection, a certificate nickname needs to be
|
||||
* provided with a type of APR_LDAP_CERT.
|
||||
* int ldapssl_enable_clientauth( LDAP *ld, char *keynickname,
|
||||
* char *keypasswd, char *certnickname );
|
||||
* keynickname is currently not used, and should be set to ""
|
||||
*
|
||||
* Novell:
|
||||
* Needs CA certificates and client certificates set at system initialisation
|
||||
* time. Three types are supported: APR_LDAP_CA*, APR_LDAP_CERT* and
|
||||
* APR_LDAP_KEY*.
|
||||
*
|
||||
* Certificates cannot be specified per connection.
|
||||
*
|
||||
* The functions used are:
|
||||
* ldapssl_add_trusted_cert(serverTrustedRoot, serverTrustedRootEncoding);
|
||||
* Clients certs and keys are set at system initialisation time with
|
||||
* int ldapssl_set_client_cert (
|
||||
* void *cert,
|
||||
* int type
|
||||
* void *password);
|
||||
* type can be LDAPSSL_CERT_FILETYPE_B64 or LDAPSSL_CERT_FILETYPE_DER
|
||||
* ldapssl_set_client_private_key(clientPrivateKey,
|
||||
* clientPrivateKeyEncoding,
|
||||
* clientPrivateKeyPassword);
|
||||
*
|
||||
* OpenSSL:
|
||||
* Needs one or more CA certificates to be set at system initialisation time
|
||||
* with a type of APR_LDAP_CA*.
|
||||
*
|
||||
* May have one or more client certificates set per connection with a type of
|
||||
* APR_LDAP_CERT*, and keys with APR_LDAP_KEY*.
|
||||
*/
|
||||
/** CA certificate type unknown */
|
||||
#define APR_LDAP_CA_TYPE_UNKNOWN 0
|
||||
/** binary DER encoded CA certificate */
|
||||
#define APR_LDAP_CA_TYPE_DER 1
|
||||
/** PEM encoded CA certificate */
|
||||
#define APR_LDAP_CA_TYPE_BASE64 2
|
||||
/** Netscape/Mozilla cert7.db CA certificate database */
|
||||
#define APR_LDAP_CA_TYPE_CERT7_DB 3
|
||||
/** Netscape/Mozilla secmod file */
|
||||
#define APR_LDAP_CA_TYPE_SECMOD 4
|
||||
/** Client certificate type unknown */
|
||||
#define APR_LDAP_CERT_TYPE_UNKNOWN 5
|
||||
/** binary DER encoded client certificate */
|
||||
#define APR_LDAP_CERT_TYPE_DER 6
|
||||
/** PEM encoded client certificate */
|
||||
#define APR_LDAP_CERT_TYPE_BASE64 7
|
||||
/** Netscape/Mozilla key3.db client certificate database */
|
||||
#define APR_LDAP_CERT_TYPE_KEY3_DB 8
|
||||
/** Netscape/Mozilla client certificate nickname */
|
||||
#define APR_LDAP_CERT_TYPE_NICKNAME 9
|
||||
/** Private key type unknown */
|
||||
#define APR_LDAP_KEY_TYPE_UNKNOWN 10
|
||||
/** binary DER encoded private key */
|
||||
#define APR_LDAP_KEY_TYPE_DER 11
|
||||
/** PEM encoded private key */
|
||||
#define APR_LDAP_KEY_TYPE_BASE64 12
|
||||
/** PKCS#12 encoded client certificate */
|
||||
#define APR_LDAP_CERT_TYPE_PFX 13
|
||||
/** PKCS#12 encoded private key */
|
||||
#define APR_LDAP_KEY_TYPE_PFX 14
|
||||
/** Openldap directory full of base64-encoded cert
|
||||
* authorities with hashes in corresponding .0 directory
|
||||
*/
|
||||
#define APR_LDAP_CA_TYPE_CACERTDIR_BASE64 15
|
||||
|
||||
|
||||
/**
|
||||
* Certificate structure.
|
||||
*
|
||||
* This structure is used to store certificate details. An array of
|
||||
* these structures is passed to apr_ldap_set_option() to set CA
|
||||
* and client certificates.
|
||||
* @param type Type of certificate APR_LDAP_*_TYPE_*
|
||||
* @param path Path, file or nickname of the certificate
|
||||
* @param password Optional password, can be NULL
|
||||
*/
|
||||
typedef struct apr_ldap_opt_tls_cert_t apr_ldap_opt_tls_cert_t;
|
||||
struct apr_ldap_opt_tls_cert_t {
|
||||
int type;
|
||||
const char *path;
|
||||
const char *password;
|
||||
};
|
||||
|
||||
/**
|
||||
* APR_LDAP_OPT_TLS
|
||||
*
|
||||
* This sets the SSL level on the LDAP handle.
|
||||
*
|
||||
* Netscape/Mozilla:
|
||||
* Supports SSL, but not STARTTLS
|
||||
* SSL is enabled by calling ldapssl_install_routines().
|
||||
*
|
||||
* Novell:
|
||||
* Supports SSL and STARTTLS.
|
||||
* SSL is enabled by calling ldapssl_install_routines(). Note that calling
|
||||
* other ldap functions before ldapssl_install_routines() may cause this
|
||||
* function to fail.
|
||||
* STARTTLS is enabled by calling ldapssl_start_tls_s() after calling
|
||||
* ldapssl_install_routines() (check this).
|
||||
*
|
||||
* OpenLDAP:
|
||||
* Supports SSL and supports STARTTLS, but none of this is documented:
|
||||
* http://www.openldap.org/lists/openldap-software/200409/msg00618.html
|
||||
* Documentation for both SSL support and STARTTLS has been deleted from
|
||||
* the OpenLDAP documentation and website.
|
||||
*/
|
||||
|
||||
/** No encryption */
|
||||
#define APR_LDAP_NONE 0
|
||||
/** SSL encryption (ldaps://) */
|
||||
#define APR_LDAP_SSL 1
|
||||
/** TLS encryption (STARTTLS) */
|
||||
#define APR_LDAP_STARTTLS 2
|
||||
/** end TLS encryption (STOPTLS) */
|
||||
#define APR_LDAP_STOPTLS 3
|
||||
|
||||
/**
|
||||
* APR LDAP get option function
|
||||
*
|
||||
* This function gets option values from a given LDAP session if
|
||||
* one was specified. It maps to the native ldap_get_option() function.
|
||||
* @param pool The pool to use
|
||||
* @param ldap The LDAP handle
|
||||
* @param option The LDAP_OPT_* option to return
|
||||
* @param outvalue The value returned (if any)
|
||||
* @param result_err The apr_ldap_err_t structure contained detailed results
|
||||
* of the operation.
|
||||
*/
|
||||
APU_DECLARE_LDAP(int) apr_ldap_get_option(apr_pool_t *pool,
|
||||
LDAP *ldap,
|
||||
int option,
|
||||
void *outvalue,
|
||||
apr_ldap_err_t **result_err);
|
||||
|
||||
/**
|
||||
* APR LDAP set option function
|
||||
*
|
||||
* This function sets option values to a given LDAP session if
|
||||
* one was specified. It maps to the native ldap_set_option() function.
|
||||
*
|
||||
* Where an option is not supported by an LDAP toolkit, this function
|
||||
* will try and apply legacy functions to achieve the same effect,
|
||||
* depending on the platform.
|
||||
* @param pool The pool to use
|
||||
* @param ldap The LDAP handle
|
||||
* @param option The LDAP_OPT_* option to set
|
||||
* @param invalue The value to set
|
||||
* @param result_err The apr_ldap_err_t structure contained detailed results
|
||||
* of the operation.
|
||||
*/
|
||||
APU_DECLARE_LDAP(int) apr_ldap_set_option(apr_pool_t *pool,
|
||||
LDAP *ldap,
|
||||
int option,
|
||||
const void *invalue,
|
||||
apr_ldap_err_t **result_err);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* APR_HAS_LDAP */
|
||||
|
||||
/** @} */
|
||||
|
||||
#endif /* APR_LDAP_OPTION_H */
|
||||
|
||||
98
database/apache/include/apr_ldap_rebind.h
Normal file
98
database/apache/include/apr_ldap_rebind.h
Normal file
@@ -0,0 +1,98 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* The APR LDAP rebind functions provide an implementation of
|
||||
* a rebind procedure that can be used to allow clients to chase referrals,
|
||||
* using the same credentials used to log in originally.
|
||||
*
|
||||
* Use of this implementation is optional.
|
||||
*
|
||||
* @file apr_ldap_rebind.h
|
||||
* @brief Apache LDAP library
|
||||
*/
|
||||
|
||||
#ifndef APU_LDAP_REBIND_H
|
||||
#define APU_LDAP_REBIND_H
|
||||
|
||||
/**
|
||||
* @addtogroup APR_Util_LDAP
|
||||
* @{
|
||||
**/
|
||||
|
||||
#if defined(DOXYGEN)
|
||||
#include "apr_ldap.h"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Handle the case when LDAP is enabled
|
||||
*/
|
||||
#if APR_HAS_LDAP
|
||||
|
||||
/**
|
||||
* APR LDAP initialize rebind lock
|
||||
*
|
||||
* This function creates the lock for controlling access to the xref list..
|
||||
* @param pool Pool to use when creating the xref_lock.
|
||||
*/
|
||||
APU_DECLARE_LDAP(apr_status_t) apr_ldap_rebind_init(apr_pool_t *pool);
|
||||
|
||||
|
||||
/**
|
||||
* APR LDAP rebind_add function
|
||||
*
|
||||
* This function creates a cross reference entry for the specified ldap
|
||||
* connection. The rebind callback function will look up this ldap
|
||||
* connection so it can retrieve the bindDN and bindPW for use in any
|
||||
* binds while referrals are being chased.
|
||||
*
|
||||
* This function will add the callback to the LDAP handle passed in.
|
||||
*
|
||||
* A cleanup is registered within the pool provided to remove this
|
||||
* entry when the pool is removed. Alternatively apr_ldap_rebind_remove()
|
||||
* can be called to explicitly remove the entry at will.
|
||||
*
|
||||
* @param pool The pool to use
|
||||
* @param ld The LDAP connectionhandle
|
||||
* @param bindDN The bind DN to be used for any binds while chasing
|
||||
* referrals on this ldap connection.
|
||||
* @param bindPW The bind Password to be used for any binds while
|
||||
* chasing referrals on this ldap connection.
|
||||
*/
|
||||
APU_DECLARE_LDAP(apr_status_t) apr_ldap_rebind_add(apr_pool_t *pool,
|
||||
LDAP *ld,
|
||||
const char *bindDN,
|
||||
const char *bindPW);
|
||||
|
||||
/**
|
||||
* APR LDAP rebind_remove function
|
||||
*
|
||||
* This function removes the rebind cross reference entry for the
|
||||
* specified ldap connection.
|
||||
*
|
||||
* If not explicitly removed, this function will be called automatically
|
||||
* when the pool is cleaned up.
|
||||
*
|
||||
* @param ld The LDAP connectionhandle
|
||||
*/
|
||||
APU_DECLARE_LDAP(apr_status_t) apr_ldap_rebind_remove(LDAP *ld);
|
||||
|
||||
#endif /* APR_HAS_LDAP */
|
||||
|
||||
/** @} */
|
||||
|
||||
#endif /* APU_LDAP_REBIND_H */
|
||||
|
||||
120
database/apache/include/apr_ldap_url.h
Normal file
120
database/apache/include/apr_ldap_url.h
Normal file
@@ -0,0 +1,120 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file apr_ldap_url.h
|
||||
* @brief APR-UTIL LDAP ldap_init() functions
|
||||
*/
|
||||
#ifndef APR_LDAP_URL_H
|
||||
#define APR_LDAP_URL_H
|
||||
|
||||
/**
|
||||
* @addtogroup APR_Util_LDAP
|
||||
* @{
|
||||
*/
|
||||
|
||||
#if defined(DOXYGEN)
|
||||
#include "apr_ldap.h"
|
||||
#endif
|
||||
|
||||
#if APR_HAS_LDAP
|
||||
|
||||
#include "apu.h"
|
||||
#include "apr_pools.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/** Structure to access an exploded LDAP URL */
|
||||
typedef struct apr_ldap_url_desc_t {
|
||||
struct apr_ldap_url_desc_t *lud_next;
|
||||
char *lud_scheme;
|
||||
char *lud_host;
|
||||
int lud_port;
|
||||
char *lud_dn;
|
||||
char **lud_attrs;
|
||||
int lud_scope;
|
||||
char *lud_filter;
|
||||
char **lud_exts;
|
||||
int lud_crit_exts;
|
||||
} apr_ldap_url_desc_t;
|
||||
|
||||
#ifndef APR_LDAP_URL_SUCCESS
|
||||
#define APR_LDAP_URL_SUCCESS 0x00 /* Success */
|
||||
#define APR_LDAP_URL_ERR_MEM 0x01 /* can't allocate memory space */
|
||||
#define APR_LDAP_URL_ERR_PARAM 0x02 /* parameter is bad */
|
||||
#define APR_LDAP_URL_ERR_BADSCHEME 0x03 /* URL doesn't begin with "ldap[si]://" */
|
||||
#define APR_LDAP_URL_ERR_BADENCLOSURE 0x04 /* URL is missing trailing ">" */
|
||||
#define APR_LDAP_URL_ERR_BADURL 0x05 /* URL is bad */
|
||||
#define APR_LDAP_URL_ERR_BADHOST 0x06 /* host port is bad */
|
||||
#define APR_LDAP_URL_ERR_BADATTRS 0x07 /* bad (or missing) attributes */
|
||||
#define APR_LDAP_URL_ERR_BADSCOPE 0x08 /* scope string is invalid (or missing) */
|
||||
#define APR_LDAP_URL_ERR_BADFILTER 0x09 /* bad or missing filter */
|
||||
#define APR_LDAP_URL_ERR_BADEXTS 0x0a /* bad or missing extensions */
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Is this URL an ldap url? ldap://
|
||||
* @param url The url to test
|
||||
*/
|
||||
APU_DECLARE(int) apr_ldap_is_ldap_url(const char *url);
|
||||
|
||||
/**
|
||||
* Is this URL an SSL ldap url? ldaps://
|
||||
* @param url The url to test
|
||||
*/
|
||||
APU_DECLARE(int) apr_ldap_is_ldaps_url(const char *url);
|
||||
|
||||
/**
|
||||
* Is this URL an ldap socket url? ldapi://
|
||||
* @param url The url to test
|
||||
*/
|
||||
APU_DECLARE(int) apr_ldap_is_ldapi_url(const char *url);
|
||||
|
||||
/**
|
||||
* Parse an LDAP URL.
|
||||
* @param pool The pool to use
|
||||
* @param url_in The URL to parse
|
||||
* @param ludpp The structure to return the exploded URL
|
||||
* @param result_err The result structure of the operation
|
||||
*/
|
||||
APU_DECLARE(int) apr_ldap_url_parse_ext(apr_pool_t *pool,
|
||||
const char *url_in,
|
||||
apr_ldap_url_desc_t **ludpp,
|
||||
apr_ldap_err_t **result_err);
|
||||
|
||||
/**
|
||||
* Parse an LDAP URL.
|
||||
* @param pool The pool to use
|
||||
* @param url_in The URL to parse
|
||||
* @param ludpp The structure to return the exploded URL
|
||||
* @param result_err The result structure of the operation
|
||||
*/
|
||||
APU_DECLARE(int) apr_ldap_url_parse(apr_pool_t *pool,
|
||||
const char *url_in,
|
||||
apr_ldap_url_desc_t **ludpp,
|
||||
apr_ldap_err_t **result_err);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* APR_HAS_LDAP */
|
||||
|
||||
/** @} */
|
||||
|
||||
#endif /* APR_LDAP_URL_H */
|
||||
241
database/apache/include/apr_lib.h
Normal file
241
database/apache/include/apr_lib.h
Normal file
@@ -0,0 +1,241 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_LIB_H
|
||||
#define APR_LIB_H
|
||||
|
||||
/**
|
||||
* @file apr_lib.h
|
||||
* This is collection of oddballs that didn't fit anywhere else,
|
||||
* and might move to more appropriate headers with the release
|
||||
* of APR 1.0.
|
||||
* @brief APR general purpose library routines
|
||||
*/
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_errno.h"
|
||||
|
||||
#if APR_HAVE_CTYPE_H
|
||||
#include <ctype.h>
|
||||
#endif
|
||||
#if APR_HAVE_STDARG_H
|
||||
#include <stdarg.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @defgroup apr_lib General Purpose Library Routines
|
||||
* @ingroup APR
|
||||
* This is collection of oddballs that didn't fit anywhere else,
|
||||
* and might move to more appropriate headers with the release
|
||||
* of APR 1.0.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** A constant representing a 'large' string. */
|
||||
#define HUGE_STRING_LEN 8192
|
||||
|
||||
/*
|
||||
* Define the structures used by the APR general-purpose library.
|
||||
*/
|
||||
|
||||
/** @see apr_vformatter_buff_t */
|
||||
typedef struct apr_vformatter_buff_t apr_vformatter_buff_t;
|
||||
|
||||
/**
|
||||
* Structure used by the variable-formatter routines.
|
||||
*/
|
||||
struct apr_vformatter_buff_t {
|
||||
/** The current position */
|
||||
char *curpos;
|
||||
/** The end position of the format string */
|
||||
char *endpos;
|
||||
};
|
||||
|
||||
/**
|
||||
* return the final element of the pathname
|
||||
* @param pathname The path to get the final element of
|
||||
* @return the final element of the path
|
||||
* @remark
|
||||
* <PRE>
|
||||
* For example:
|
||||
* "/foo/bar/gum" -> "gum"
|
||||
* "/foo/bar/gum/" -> ""
|
||||
* "gum" -> "gum"
|
||||
* "bs\\path\\stuff" -> "stuff"
|
||||
* </PRE>
|
||||
*/
|
||||
APR_DECLARE(const char *) apr_filepath_name_get(const char *pathname);
|
||||
|
||||
/**
|
||||
* apr_killpg
|
||||
* Small utility macros to make things easier to read. Not usually a
|
||||
* goal, to be sure..
|
||||
*/
|
||||
|
||||
#ifdef WIN32
|
||||
#define apr_killpg(x, y)
|
||||
#else /* WIN32 */
|
||||
#ifdef NO_KILLPG
|
||||
#define apr_killpg(x, y) (kill (-(x), (y)))
|
||||
#else /* NO_KILLPG */
|
||||
#define apr_killpg(x, y) (killpg ((x), (y)))
|
||||
#endif /* NO_KILLPG */
|
||||
#endif /* WIN32 */
|
||||
|
||||
/**
|
||||
* apr_vformatter() is a generic printf-style formatting routine
|
||||
* with some extensions.
|
||||
* @param flush_func The function to call when the buffer is full
|
||||
* @param c The buffer to write to
|
||||
* @param fmt The format string
|
||||
* @param ap The arguments to use to fill out the format string.
|
||||
*
|
||||
* @remark
|
||||
* <PRE>
|
||||
* The extensions are:
|
||||
*
|
||||
* - %%pA takes a struct in_addr *, and prints it as a.b.c.d
|
||||
* - %%pI takes an apr_sockaddr_t * and prints it as a.b.c.d:port or
|
||||
* \[ipv6-address\]:port
|
||||
* - %%pT takes an apr_os_thread_t * and prints it in decimal
|
||||
* ('0' is printed if !APR_HAS_THREADS)
|
||||
* - %%pt takes an apr_os_thread_t * and prints it in hexadecimal
|
||||
* ('0' is printed if !APR_HAS_THREADS)
|
||||
* - %%pm takes an apr_status_t * and prints the appropriate error
|
||||
* string (from apr_strerror) corresponding to that error code.
|
||||
* - %%pp takes a void * and outputs it in hex
|
||||
* - %%pB takes a apr_uint32_t * as bytes and outputs it's apr_strfsize
|
||||
* - %%pF same as above, but takes a apr_off_t *
|
||||
* - %%pS same as above, but takes a apr_size_t *
|
||||
*
|
||||
* %%pA, %%pI, %%pT, %%pp are available from APR 1.0.0 onwards (and in 0.9.x).
|
||||
* %%pt is only available from APR 1.2.0 onwards.
|
||||
* %%pm, %%pB, %%pF and %%pS are only available from APR 1.3.0 onwards.
|
||||
*
|
||||
* The %%p hacks are to force gcc's printf warning code to skip
|
||||
* over a pointer argument without complaining. This does
|
||||
* mean that the ANSI-style %%p (output a void * in hex format) won't
|
||||
* work as expected at all, but that seems to be a fair trade-off
|
||||
* for the increased robustness of having printf-warnings work.
|
||||
*
|
||||
* Additionally, apr_vformatter allows for arbitrary output methods
|
||||
* using the apr_vformatter_buff and flush_func.
|
||||
*
|
||||
* The apr_vformatter_buff has two elements curpos and endpos.
|
||||
* curpos is where apr_vformatter will write the next byte of output.
|
||||
* It proceeds writing output to curpos, and updating curpos, until
|
||||
* either the end of output is reached, or curpos == endpos (i.e. the
|
||||
* buffer is full).
|
||||
*
|
||||
* If the end of output is reached, apr_vformatter returns the
|
||||
* number of bytes written.
|
||||
*
|
||||
* When the buffer is full, the flush_func is called. The flush_func
|
||||
* can return -1 to indicate that no further output should be attempted,
|
||||
* and apr_vformatter will return immediately with -1. Otherwise
|
||||
* the flush_func should flush the buffer in whatever manner is
|
||||
* appropriate, re apr_pool_t nitialize curpos and endpos, and return 0.
|
||||
*
|
||||
* Note that flush_func is only invoked as a result of attempting to
|
||||
* write another byte at curpos when curpos >= endpos. So for
|
||||
* example, it's possible when the output exactly matches the buffer
|
||||
* space available that curpos == endpos will be true when
|
||||
* apr_vformatter returns.
|
||||
*
|
||||
* apr_vformatter does not call out to any other code, it is entirely
|
||||
* self-contained. This allows the callers to do things which are
|
||||
* otherwise "unsafe". For example, apr_psprintf uses the "scratch"
|
||||
* space at the unallocated end of a block, and doesn't actually
|
||||
* complete the allocation until apr_vformatter returns. apr_psprintf
|
||||
* would be completely broken if apr_vformatter were to call anything
|
||||
* that used this same pool. Similarly http_bprintf() uses the "scratch"
|
||||
* space at the end of its output buffer, and doesn't actually note
|
||||
* that the space is in use until it either has to flush the buffer
|
||||
* or until apr_vformatter returns.
|
||||
* </PRE>
|
||||
*/
|
||||
APR_DECLARE(int) apr_vformatter(int (*flush_func)(apr_vformatter_buff_t *b),
|
||||
apr_vformatter_buff_t *c, const char *fmt,
|
||||
va_list ap);
|
||||
|
||||
/**
|
||||
* Display a prompt and read in the password from stdin.
|
||||
* @param prompt The prompt to display
|
||||
* @param pwbuf Buffer to store the password
|
||||
* @param bufsize The length of the password buffer.
|
||||
* @remark If the password entered must be truncated to fit in
|
||||
* the provided buffer, APR_ENAMETOOLONG will be returned.
|
||||
* Note that the bufsize paramater is passed by reference for no
|
||||
* reason; its value will never be modified by the apr_password_get()
|
||||
* function.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_password_get(const char *prompt, char *pwbuf,
|
||||
apr_size_t *bufsize);
|
||||
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @defgroup apr_ctype ctype functions
|
||||
* These macros allow correct support of 8-bit characters on systems which
|
||||
* support 8-bit characters. Pretty dumb how the cast is required, but
|
||||
* that's legacy libc for ya. These new macros do not support EOF like
|
||||
* the standard macros do. Tough.
|
||||
* @{
|
||||
*/
|
||||
/** @see isalnum */
|
||||
#define apr_isalnum(c) (isalnum(((unsigned char)(c))))
|
||||
/** @see isalpha */
|
||||
#define apr_isalpha(c) (isalpha(((unsigned char)(c))))
|
||||
/** @see iscntrl */
|
||||
#define apr_iscntrl(c) (iscntrl(((unsigned char)(c))))
|
||||
/** @see isdigit */
|
||||
#define apr_isdigit(c) (isdigit(((unsigned char)(c))))
|
||||
/** @see isgraph */
|
||||
#define apr_isgraph(c) (isgraph(((unsigned char)(c))))
|
||||
/** @see islower*/
|
||||
#define apr_islower(c) (islower(((unsigned char)(c))))
|
||||
/** @see isascii */
|
||||
#ifdef isascii
|
||||
#define apr_isascii(c) (isascii(((unsigned char)(c))))
|
||||
#else
|
||||
#define apr_isascii(c) (((c) & ~0x7f)==0)
|
||||
#endif
|
||||
/** @see isprint */
|
||||
#define apr_isprint(c) (isprint(((unsigned char)(c))))
|
||||
/** @see ispunct */
|
||||
#define apr_ispunct(c) (ispunct(((unsigned char)(c))))
|
||||
/** @see isspace */
|
||||
#define apr_isspace(c) (isspace(((unsigned char)(c))))
|
||||
/** @see isupper */
|
||||
#define apr_isupper(c) (isupper(((unsigned char)(c))))
|
||||
/** @see isxdigit */
|
||||
#define apr_isxdigit(c) (isxdigit(((unsigned char)(c))))
|
||||
/** @see tolower */
|
||||
#define apr_tolower(c) (tolower(((unsigned char)(c))))
|
||||
/** @see toupper */
|
||||
#define apr_toupper(c) (toupper(((unsigned char)(c))))
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ! APR_LIB_H */
|
||||
135
database/apache/include/apr_md4.h
Normal file
135
database/apache/include/apr_md4.h
Normal file
@@ -0,0 +1,135 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/* This is derived from material copyright RSA Data Security, Inc.
|
||||
* Their notice is reproduced below in its entirety.
|
||||
*
|
||||
* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
|
||||
* rights reserved.
|
||||
*
|
||||
* License to copy and use this software is granted provided that it
|
||||
* is identified as the "RSA Data Security, Inc. MD4 Message-Digest
|
||||
* Algorithm" in all material mentioning or referencing this software
|
||||
* or this function.
|
||||
*
|
||||
* License is also granted to make and use derivative works provided
|
||||
* that such works are identified as "derived from the RSA Data
|
||||
* Security, Inc. MD4 Message-Digest Algorithm" in all material
|
||||
* mentioning or referencing the derived work.
|
||||
*
|
||||
* RSA Data Security, Inc. makes no representations concerning either
|
||||
* the merchantability of this software or the suitability of this
|
||||
* software for any particular purpose. It is provided "as is"
|
||||
* without express or implied warranty of any kind.
|
||||
*
|
||||
* These notices must be retained in any copies of any part of this
|
||||
* documentation and/or software.
|
||||
*/
|
||||
|
||||
#ifndef APR_MD4_H
|
||||
#define APR_MD4_H
|
||||
|
||||
#include "apu.h"
|
||||
#include "apr_xlate.h"
|
||||
/**
|
||||
* @file apr_md4.h
|
||||
* @brief APR-UTIL MD4 Library
|
||||
*/
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup APR_Util_MD4 MD4 Library
|
||||
* @ingroup APR_Util
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** The digestsize for MD4 */
|
||||
#define APR_MD4_DIGESTSIZE 16
|
||||
|
||||
/** @see apr_md4_ctx_t */
|
||||
typedef struct apr_md4_ctx_t apr_md4_ctx_t;
|
||||
|
||||
/** MD4 context. */
|
||||
struct apr_md4_ctx_t {
|
||||
/** state (ABCD) */
|
||||
apr_uint32_t state[4];
|
||||
/** number of bits, modulo 2^64 (lsb first) */
|
||||
apr_uint32_t count[2];
|
||||
/** input buffer */
|
||||
unsigned char buffer[64];
|
||||
#if APR_HAS_XLATE
|
||||
/** translation handle */
|
||||
apr_xlate_t *xlate;
|
||||
#endif
|
||||
};
|
||||
|
||||
/**
|
||||
* MD4 Initialize. Begins an MD4 operation, writing a new context.
|
||||
* @param context The MD4 context to initialize.
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_md4_init(apr_md4_ctx_t *context);
|
||||
|
||||
#if APR_HAS_XLATE
|
||||
/**
|
||||
* MDr4 translation setup. Provides the APR translation handle to be used
|
||||
* for translating the content before calculating the digest.
|
||||
* @param context The MD4 content to set the translation for.
|
||||
* @param xlate The translation handle to use for this MD4 context
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_md4_set_xlate(apr_md4_ctx_t *context,
|
||||
apr_xlate_t *xlate);
|
||||
#else
|
||||
#define apr_md4_set_xlate(context, xlate) APR_ENOTIMPL
|
||||
#endif
|
||||
|
||||
/**
|
||||
* MD4 block update operation. Continue an MD4 message-digest operation,
|
||||
* processing another message block, and updating the context.
|
||||
* @param context The MD4 content to update.
|
||||
* @param input next message block to update
|
||||
* @param inputLen The length of the next message block
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_md4_update(apr_md4_ctx_t *context,
|
||||
const unsigned char *input,
|
||||
apr_size_t inputLen);
|
||||
|
||||
/**
|
||||
* MD4 finalization. Ends an MD4 message-digest operation, writing the
|
||||
* message digest and zeroing the context
|
||||
* @param digest The final MD4 digest
|
||||
* @param context The MD4 content we are finalizing.
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_md4_final(
|
||||
unsigned char digest[APR_MD4_DIGESTSIZE],
|
||||
apr_md4_ctx_t *context);
|
||||
|
||||
/**
|
||||
* MD4 digest computation
|
||||
* @param digest The MD4 digest
|
||||
* @param input message block to use
|
||||
* @param inputLen The length of the message block
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_md4(unsigned char digest[APR_MD4_DIGESTSIZE],
|
||||
const unsigned char *input,
|
||||
apr_size_t inputLen);
|
||||
|
||||
/** @} */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !APR_MD4_H */
|
||||
176
database/apache/include/apr_md5.h
Normal file
176
database/apache/include/apr_md5.h
Normal file
@@ -0,0 +1,176 @@
|
||||
/*
|
||||
* This is work is derived from material Copyright RSA Data Security, Inc.
|
||||
*
|
||||
* The RSA copyright statement and Licence for that original material is
|
||||
* included below. This is followed by the Apache copyright statement and
|
||||
* licence for the modifications made to that material.
|
||||
*/
|
||||
|
||||
/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
|
||||
rights reserved.
|
||||
|
||||
License to copy and use this software is granted provided that it
|
||||
is identified as the "RSA Data Security, Inc. MD5 Message-Digest
|
||||
Algorithm" in all material mentioning or referencing this software
|
||||
or this function.
|
||||
|
||||
License is also granted to make and use derivative works provided
|
||||
that such works are identified as "derived from the RSA Data
|
||||
Security, Inc. MD5 Message-Digest Algorithm" in all material
|
||||
mentioning or referencing the derived work.
|
||||
|
||||
RSA Data Security, Inc. makes no representations concerning either
|
||||
the merchantability of this software or the suitability of this
|
||||
software for any particular purpose. It is provided "as is"
|
||||
without express or implied warranty of any kind.
|
||||
|
||||
These notices must be retained in any copies of any part of this
|
||||
documentation and/or software.
|
||||
*/
|
||||
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_MD5_H
|
||||
#define APR_MD5_H
|
||||
|
||||
#include "apu.h"
|
||||
#include "apr_xlate.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/**
|
||||
* @file apr_md5.h
|
||||
* @brief APR MD5 Routines
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup APR_MD5 MD5 Routines
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** The MD5 digest size */
|
||||
#define APR_MD5_DIGESTSIZE 16
|
||||
|
||||
/** @see apr_md5_ctx_t */
|
||||
typedef struct apr_md5_ctx_t apr_md5_ctx_t;
|
||||
|
||||
/** MD5 context. */
|
||||
struct apr_md5_ctx_t {
|
||||
/** state (ABCD) */
|
||||
apr_uint32_t state[4];
|
||||
/** number of bits, modulo 2^64 (lsb first) */
|
||||
apr_uint32_t count[2];
|
||||
/** input buffer */
|
||||
unsigned char buffer[64];
|
||||
/** translation handle
|
||||
* ignored if xlate is unsupported
|
||||
*/
|
||||
apr_xlate_t *xlate;
|
||||
};
|
||||
|
||||
/**
|
||||
* MD5 Initialize. Begins an MD5 operation, writing a new context.
|
||||
* @param context The MD5 context to initialize.
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_md5_init(apr_md5_ctx_t *context);
|
||||
|
||||
/**
|
||||
* MD5 translation setup. Provides the APR translation handle to be used
|
||||
* for translating the content before calculating the digest.
|
||||
* @param context The MD5 content to set the translation for.
|
||||
* @param xlate The translation handle to use for this MD5 context
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_md5_set_xlate(apr_md5_ctx_t *context,
|
||||
apr_xlate_t *xlate);
|
||||
|
||||
/**
|
||||
* MD5 block update operation. Continue an MD5 message-digest operation,
|
||||
* processing another message block, and updating the context.
|
||||
* @param context The MD5 content to update.
|
||||
* @param input next message block to update
|
||||
* @param inputLen The length of the next message block
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_md5_update(apr_md5_ctx_t *context,
|
||||
const void *input,
|
||||
apr_size_t inputLen);
|
||||
|
||||
/**
|
||||
* MD5 finalization. Ends an MD5 message-digest operation, writing the
|
||||
* message digest and zeroing the context
|
||||
* @param digest The final MD5 digest
|
||||
* @param context The MD5 content we are finalizing.
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_md5_final(unsigned char digest[APR_MD5_DIGESTSIZE],
|
||||
apr_md5_ctx_t *context);
|
||||
|
||||
/**
|
||||
* MD5 in one step
|
||||
* @param digest The final MD5 digest
|
||||
* @param input The message block to use
|
||||
* @param inputLen The length of the message block
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_md5(unsigned char digest[APR_MD5_DIGESTSIZE],
|
||||
const void *input,
|
||||
apr_size_t inputLen);
|
||||
|
||||
/**
|
||||
* Encode a password using an MD5 algorithm
|
||||
* @param password The password to encode
|
||||
* @param salt The salt string to use for the encoding
|
||||
* @param result The string to store the encoded password in
|
||||
* @param nbytes The size of the result buffer
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_md5_encode(const char *password, const char *salt,
|
||||
char *result, apr_size_t nbytes);
|
||||
|
||||
/**
|
||||
* Encode a password using the bcrypt algorithm
|
||||
* @param password The password to encode
|
||||
* @param count The cost of the encoding, possible values are 4 to 31
|
||||
* @param salt Pointer to binary data to be used as salt for the encoding
|
||||
* @param salt_len The size of the salt data (must be >= 16)
|
||||
* @param out The string to store the encoded password in
|
||||
* @param out_len The size of the result buffer (must be >= 61)
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_bcrypt_encode(const char *pw,
|
||||
unsigned int count,
|
||||
const unsigned char *salt,
|
||||
apr_size_t salt_len,
|
||||
char *out, apr_size_t out_len);
|
||||
|
||||
/**
|
||||
* Validate hashes created by APR-supported algorithms: md5, bcrypt, and sha1.
|
||||
* hashes created by crypt are supported only on platforms that provide
|
||||
* crypt(3), so don't rely on that function unless you know that your
|
||||
* application will be run only on platforms that support it. On platforms
|
||||
* that don't support crypt(3), this falls back to a clear text string
|
||||
* comparison.
|
||||
* @param passwd The password to validate
|
||||
* @param hash The password to validate against
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_password_validate(const char *passwd,
|
||||
const char *hash);
|
||||
|
||||
|
||||
/** @} */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !APR_MD5_H */
|
||||
444
database/apache/include/apr_memcache.h
Normal file
444
database/apache/include/apr_memcache.h
Normal file
@@ -0,0 +1,444 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_MEMCACHE_H
|
||||
#define APR_MEMCACHE_H
|
||||
|
||||
/**
|
||||
* @file apr_memcache.h
|
||||
* @brief Client interface for memcached
|
||||
* @remark To use this interface you must have a separate memcached
|
||||
* server running. See the memcached website at http://www.danga.com/memcached/
|
||||
* for more information.
|
||||
*/
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_pools.h"
|
||||
#include "apr_time.h"
|
||||
#include "apr_strings.h"
|
||||
#include "apr_network_io.h"
|
||||
#include "apr_ring.h"
|
||||
#include "apr_buckets.h"
|
||||
#include "apr_reslist.h"
|
||||
#include "apr_hash.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @defgroup APR_Util_MC Memcached Client Routines
|
||||
* @ingroup APR_Util
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** Specifies the status of a memcached server */
|
||||
typedef enum
|
||||
{
|
||||
APR_MC_SERVER_LIVE, /**< Server is alive and responding to requests */
|
||||
APR_MC_SERVER_DEAD /**< Server is not responding to requests */
|
||||
} apr_memcache_server_status_t;
|
||||
|
||||
/** Opaque memcache client connection object */
|
||||
typedef struct apr_memcache_conn_t apr_memcache_conn_t;
|
||||
|
||||
/** Memcache Server Info Object */
|
||||
typedef struct apr_memcache_server_t apr_memcache_server_t;
|
||||
struct apr_memcache_server_t
|
||||
{
|
||||
const char *host; /**< Hostname of this Server */
|
||||
apr_port_t port; /**< Port of this Server */
|
||||
apr_memcache_server_status_t status; /**< @see apr_memcache_server_status_t */
|
||||
#if APR_HAS_THREADS || defined(DOXYGEN)
|
||||
apr_reslist_t *conns; /**< Resource list of actual client connections */
|
||||
#else
|
||||
apr_memcache_conn_t *conn;
|
||||
#endif
|
||||
apr_pool_t *p; /** Pool to use for private allocations */
|
||||
#if APR_HAS_THREADS
|
||||
apr_thread_mutex_t *lock;
|
||||
#endif
|
||||
apr_time_t btime;
|
||||
};
|
||||
|
||||
/* Custom hash callback function prototype, user for server selection.
|
||||
* @param baton user selected baton
|
||||
* @param data data to hash
|
||||
* @param data_len length of data
|
||||
*/
|
||||
typedef apr_uint32_t (*apr_memcache_hash_func)(void *baton,
|
||||
const char *data,
|
||||
const apr_size_t data_len);
|
||||
|
||||
typedef struct apr_memcache_t apr_memcache_t;
|
||||
|
||||
/* Custom Server Select callback function prototype.
|
||||
* @param baton user selected baton
|
||||
* @param mc memcache instance, use mc->live_servers to select a node
|
||||
* @param hash hash of the selected key.
|
||||
*/
|
||||
typedef apr_memcache_server_t* (*apr_memcache_server_func)(void *baton,
|
||||
apr_memcache_t *mc,
|
||||
const apr_uint32_t hash);
|
||||
|
||||
/** Container for a set of memcached servers */
|
||||
struct apr_memcache_t
|
||||
{
|
||||
apr_uint32_t flags; /**< Flags, Not currently used */
|
||||
apr_uint16_t nalloc; /**< Number of Servers Allocated */
|
||||
apr_uint16_t ntotal; /**< Number of Servers Added */
|
||||
apr_memcache_server_t **live_servers; /**< Array of Servers */
|
||||
apr_pool_t *p; /** Pool to use for allocations */
|
||||
void *hash_baton;
|
||||
apr_memcache_hash_func hash_func;
|
||||
void *server_baton;
|
||||
apr_memcache_server_func server_func;
|
||||
};
|
||||
|
||||
/** Returned Data from a multiple get */
|
||||
typedef struct
|
||||
{
|
||||
apr_status_t status;
|
||||
const char* key;
|
||||
apr_size_t len;
|
||||
char *data;
|
||||
apr_uint16_t flags;
|
||||
} apr_memcache_value_t;
|
||||
|
||||
/**
|
||||
* Creates a crc32 hash used to split keys between servers
|
||||
* @param mc The memcache client object to use
|
||||
* @param data Data to be hashed
|
||||
* @param data_len Length of the data to use
|
||||
* @return crc32 hash of data
|
||||
* @remark The crc32 hash is not compatible with old memcached clients.
|
||||
*/
|
||||
APU_DECLARE(apr_uint32_t) apr_memcache_hash(apr_memcache_t *mc,
|
||||
const char *data,
|
||||
const apr_size_t data_len);
|
||||
|
||||
/**
|
||||
* Pure CRC32 Hash. Used by some clients.
|
||||
*/
|
||||
APU_DECLARE(apr_uint32_t) apr_memcache_hash_crc32(void *baton,
|
||||
const char *data,
|
||||
const apr_size_t data_len);
|
||||
|
||||
/**
|
||||
* hash compatible with the standard Perl Client.
|
||||
*/
|
||||
APU_DECLARE(apr_uint32_t) apr_memcache_hash_default(void *baton,
|
||||
const char *data,
|
||||
const apr_size_t data_len);
|
||||
|
||||
/**
|
||||
* Picks a server based on a hash
|
||||
* @param mc The memcache client object to use
|
||||
* @param hash Hashed value of a Key
|
||||
* @return server that controls specified hash
|
||||
* @see apr_memcache_hash
|
||||
*/
|
||||
APU_DECLARE(apr_memcache_server_t *) apr_memcache_find_server_hash(apr_memcache_t *mc,
|
||||
const apr_uint32_t hash);
|
||||
|
||||
/**
|
||||
* server selection compatible with the standard Perl Client.
|
||||
*/
|
||||
APU_DECLARE(apr_memcache_server_t *) apr_memcache_find_server_hash_default(void *baton,
|
||||
apr_memcache_t *mc,
|
||||
const apr_uint32_t hash);
|
||||
|
||||
/**
|
||||
* Adds a server to a client object
|
||||
* @param mc The memcache client object to use
|
||||
* @param server Server to add
|
||||
* @remark Adding servers is not thread safe, and should be done once at startup.
|
||||
* @warning Changing servers after startup may cause keys to go to
|
||||
* different servers.
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_memcache_add_server(apr_memcache_t *mc,
|
||||
apr_memcache_server_t *server);
|
||||
|
||||
|
||||
/**
|
||||
* Finds a Server object based on a hostname/port pair
|
||||
* @param mc The memcache client object to use
|
||||
* @param host Hostname of the server
|
||||
* @param port Port of the server
|
||||
* @return Server with matching Hostname and Port, or NULL if none was found.
|
||||
*/
|
||||
APU_DECLARE(apr_memcache_server_t *) apr_memcache_find_server(apr_memcache_t *mc,
|
||||
const char *host,
|
||||
apr_port_t port);
|
||||
|
||||
/**
|
||||
* Enables a Server for use again
|
||||
* @param mc The memcache client object to use
|
||||
* @param ms Server to Activate
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_memcache_enable_server(apr_memcache_t *mc,
|
||||
apr_memcache_server_t *ms);
|
||||
|
||||
|
||||
/**
|
||||
* Disable a Server
|
||||
* @param mc The memcache client object to use
|
||||
* @param ms Server to Disable
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_memcache_disable_server(apr_memcache_t *mc,
|
||||
apr_memcache_server_t *ms);
|
||||
|
||||
/**
|
||||
* Creates a new Server Object
|
||||
* @param p Pool to use
|
||||
* @param host hostname of the server
|
||||
* @param port port of the server
|
||||
* @param min minimum number of client sockets to open
|
||||
* @param smax soft maximum number of client connections to open
|
||||
* @param max hard maximum number of client connections
|
||||
* @param ttl time to live in microseconds of a client connection
|
||||
* @param ns location of the new server object
|
||||
* @see apr_reslist_create
|
||||
* @remark min, smax, and max are only used when APR_HAS_THREADS
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_memcache_server_create(apr_pool_t *p,
|
||||
const char *host,
|
||||
apr_port_t port,
|
||||
apr_uint32_t min,
|
||||
apr_uint32_t smax,
|
||||
apr_uint32_t max,
|
||||
apr_uint32_t ttl,
|
||||
apr_memcache_server_t **ns);
|
||||
/**
|
||||
* Creates a new memcached client object
|
||||
* @param p Pool to use
|
||||
* @param max_servers maximum number of servers
|
||||
* @param flags Not currently used
|
||||
* @param mc location of the new memcache client object
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_memcache_create(apr_pool_t *p,
|
||||
apr_uint16_t max_servers,
|
||||
apr_uint32_t flags,
|
||||
apr_memcache_t **mc);
|
||||
|
||||
/**
|
||||
* Gets a value from the server, allocating the value out of p
|
||||
* @param mc client to use
|
||||
* @param p Pool to use
|
||||
* @param key null terminated string containing the key
|
||||
* @param baton location of the allocated value
|
||||
* @param len length of data at baton
|
||||
* @param flags any flags set by the client for this key
|
||||
* @return
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_memcache_getp(apr_memcache_t *mc,
|
||||
apr_pool_t *p,
|
||||
const char* key,
|
||||
char **baton,
|
||||
apr_size_t *len,
|
||||
apr_uint16_t *flags);
|
||||
|
||||
|
||||
/**
|
||||
* Add a key to a hash for a multiget query
|
||||
* if the hash (*value) is NULL it will be created
|
||||
* @param data_pool pool from where the hash and their items are created from
|
||||
* @param key null terminated string containing the key
|
||||
* @param values hash of keys and values that this key will be added to
|
||||
* @return
|
||||
*/
|
||||
APU_DECLARE(void) apr_memcache_add_multget_key(apr_pool_t *data_pool,
|
||||
const char* key,
|
||||
apr_hash_t **values);
|
||||
|
||||
/**
|
||||
* Gets multiple values from the server, allocating the values out of p
|
||||
* @param mc client to use
|
||||
* @param temp_pool Pool used for temporary allocations. May be cleared inside this
|
||||
* call.
|
||||
* @param data_pool Pool used to allocate data for the returned values.
|
||||
* @param values hash of apr_memcache_value_t keyed by strings, contains the
|
||||
* result of the multiget call.
|
||||
* @return
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_memcache_multgetp(apr_memcache_t *mc,
|
||||
apr_pool_t *temp_pool,
|
||||
apr_pool_t *data_pool,
|
||||
apr_hash_t *values);
|
||||
|
||||
/**
|
||||
* Sets a value by key on the server
|
||||
* @param mc client to use
|
||||
* @param key null terminated string containing the key
|
||||
* @param baton data to store on the server
|
||||
* @param data_size length of data at baton
|
||||
* @param timeout time in seconds for the data to live on the server
|
||||
* @param flags any flags set by the client for this key
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_memcache_set(apr_memcache_t *mc,
|
||||
const char *key,
|
||||
char *baton,
|
||||
const apr_size_t data_size,
|
||||
apr_uint32_t timeout,
|
||||
apr_uint16_t flags);
|
||||
|
||||
/**
|
||||
* Adds value by key on the server
|
||||
* @param mc client to use
|
||||
* @param key null terminated string containing the key
|
||||
* @param baton data to store on the server
|
||||
* @param data_size length of data at baton
|
||||
* @param timeout time for the data to live on the server
|
||||
* @param flags any flags set by the client for this key
|
||||
* @return APR_SUCCESS if the key was added, APR_EEXIST if the key
|
||||
* already exists on the server.
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_memcache_add(apr_memcache_t *mc,
|
||||
const char *key,
|
||||
char *baton,
|
||||
const apr_size_t data_size,
|
||||
apr_uint32_t timeout,
|
||||
apr_uint16_t flags);
|
||||
|
||||
/**
|
||||
* Replaces value by key on the server
|
||||
* @param mc client to use
|
||||
* @param key null terminated string containing the key
|
||||
* @param baton data to store on the server
|
||||
* @param data_size length of data at baton
|
||||
* @param timeout time for the data to live on the server
|
||||
* @param flags any flags set by the client for this key
|
||||
* @return APR_SUCCESS if the key was added, APR_EEXIST if the key
|
||||
* did not exist on the server.
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_memcache_replace(apr_memcache_t *mc,
|
||||
const char *key,
|
||||
char *baton,
|
||||
const apr_size_t data_size,
|
||||
apr_uint32_t timeout,
|
||||
apr_uint16_t flags);
|
||||
/**
|
||||
* Deletes a key from a server
|
||||
* @param mc client to use
|
||||
* @param key null terminated string containing the key
|
||||
* @param timeout time for the delete to stop other clients from adding
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_memcache_delete(apr_memcache_t *mc,
|
||||
const char *key,
|
||||
apr_uint32_t timeout);
|
||||
|
||||
/**
|
||||
* Increments a value
|
||||
* @param mc client to use
|
||||
* @param key null terminated string containing the key
|
||||
* @param n number to increment by
|
||||
* @param nv new value after incrementing
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_memcache_incr(apr_memcache_t *mc,
|
||||
const char *key,
|
||||
apr_int32_t n,
|
||||
apr_uint32_t *nv);
|
||||
|
||||
/**
|
||||
* Decrements a value
|
||||
* @param mc client to use
|
||||
* @param key null terminated string containing the key
|
||||
* @param n number to decrement by
|
||||
* @param new_value new value after decrementing
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_memcache_decr(apr_memcache_t *mc,
|
||||
const char *key,
|
||||
apr_int32_t n,
|
||||
apr_uint32_t *new_value);
|
||||
|
||||
/**
|
||||
* Query a server's version
|
||||
* @param ms server to query
|
||||
* @param p Pool to allocate answer from
|
||||
* @param baton location to store server version string
|
||||
* @param len length of the server version string
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_memcache_version(apr_memcache_server_t *ms,
|
||||
apr_pool_t *p,
|
||||
char **baton);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/** Version string of this server */
|
||||
const char *version;
|
||||
/** Process id of this server process */
|
||||
apr_uint32_t pid;
|
||||
/** Number of seconds this server has been running */
|
||||
apr_uint32_t uptime;
|
||||
/** current UNIX time according to the server */
|
||||
apr_time_t time;
|
||||
/** The size of a pointer on the current machine */
|
||||
apr_uint32_t pointer_size;
|
||||
/** Accumulated user time for this process */
|
||||
apr_time_t rusage_user;
|
||||
/** Accumulated system time for this process */
|
||||
apr_time_t rusage_system;
|
||||
/** Current number of items stored by the server */
|
||||
apr_uint32_t curr_items;
|
||||
/** Total number of items stored by this server */
|
||||
apr_uint32_t total_items;
|
||||
/** Current number of bytes used by this server to store items */
|
||||
apr_uint64_t bytes;
|
||||
/** Number of open connections */
|
||||
apr_uint32_t curr_connections;
|
||||
/** Total number of connections opened since the server started running */
|
||||
apr_uint32_t total_connections;
|
||||
/** Number of connection structures allocated by the server */
|
||||
apr_uint32_t connection_structures;
|
||||
/** Cumulative number of retrieval requests */
|
||||
apr_uint32_t cmd_get;
|
||||
/** Cumulative number of storage requests */
|
||||
apr_uint32_t cmd_set;
|
||||
/** Number of keys that have been requested and found present */
|
||||
apr_uint32_t get_hits;
|
||||
/** Number of items that have been requested and not found */
|
||||
apr_uint32_t get_misses;
|
||||
/** Number of items removed from cache because they passed their
|
||||
expiration time */
|
||||
apr_uint64_t evictions;
|
||||
/** Total number of bytes read by this server */
|
||||
apr_uint64_t bytes_read;
|
||||
/** Total number of bytes sent by this server */
|
||||
apr_uint64_t bytes_written;
|
||||
/** Number of bytes this server is allowed to use for storage. */
|
||||
apr_uint32_t limit_maxbytes;
|
||||
/** Number of threads the server is running (if built with threading) */
|
||||
apr_uint32_t threads;
|
||||
} apr_memcache_stats_t;
|
||||
|
||||
/**
|
||||
* Query a server for statistics
|
||||
* @param ms server to query
|
||||
* @param p Pool to allocate answer from
|
||||
* @param stats location of the new statistics structure
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_memcache_stats(apr_memcache_server_t *ms,
|
||||
apr_pool_t *p,
|
||||
apr_memcache_stats_t **stats);
|
||||
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* APR_MEMCACHE_H */
|
||||
171
database/apache/include/apr_mmap.h
Normal file
171
database/apache/include/apr_mmap.h
Normal file
@@ -0,0 +1,171 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_MMAP_H
|
||||
#define APR_MMAP_H
|
||||
|
||||
/**
|
||||
* @file apr_mmap.h
|
||||
* @brief APR MMAP routines
|
||||
*/
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_pools.h"
|
||||
#include "apr_errno.h"
|
||||
#include "apr_ring.h"
|
||||
#include "apr_file_io.h" /* for apr_file_t */
|
||||
|
||||
#ifdef BEOS
|
||||
#include <kernel/OS.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @defgroup apr_mmap MMAP (Memory Map) Routines
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** MMap opened for reading */
|
||||
#define APR_MMAP_READ 1
|
||||
/** MMap opened for writing */
|
||||
#define APR_MMAP_WRITE 2
|
||||
|
||||
/** @see apr_mmap_t */
|
||||
typedef struct apr_mmap_t apr_mmap_t;
|
||||
|
||||
/**
|
||||
* @remark
|
||||
* As far as I can tell the only really sane way to store an MMAP is as a
|
||||
* void * and a length. BeOS requires this area_id, but that's just a little
|
||||
* something extra. I am exposing this type, because it doesn't make much
|
||||
* sense to keep it private, and opening it up makes some stuff easier in
|
||||
* Apache.
|
||||
*/
|
||||
/** The MMAP structure */
|
||||
struct apr_mmap_t {
|
||||
/** The pool the mmap structure was allocated out of. */
|
||||
apr_pool_t *cntxt;
|
||||
#ifdef BEOS
|
||||
/** An area ID. Only valid on BeOS */
|
||||
area_id area;
|
||||
#endif
|
||||
#ifdef WIN32
|
||||
/** The handle of the file mapping */
|
||||
HANDLE mhandle;
|
||||
/** The start of the real memory page area (mapped view) */
|
||||
void *mv;
|
||||
/** The physical start, size and offset */
|
||||
apr_off_t pstart;
|
||||
apr_size_t psize;
|
||||
apr_off_t poffset;
|
||||
#endif
|
||||
/** The start of the memory mapped area */
|
||||
void *mm;
|
||||
/** The amount of data in the mmap */
|
||||
apr_size_t size;
|
||||
/** ring of apr_mmap_t's that reference the same
|
||||
* mmap'ed region; acts in place of a reference count */
|
||||
APR_RING_ENTRY(apr_mmap_t) link;
|
||||
};
|
||||
|
||||
#if APR_HAS_MMAP || defined(DOXYGEN)
|
||||
|
||||
/** @def APR_MMAP_THRESHOLD
|
||||
* Files have to be at least this big before they're mmap()d. This is to deal
|
||||
* with systems where the expense of doing an mmap() and an munmap() outweighs
|
||||
* the benefit for small files. It shouldn't be set lower than 1.
|
||||
*/
|
||||
#ifdef MMAP_THRESHOLD
|
||||
# define APR_MMAP_THRESHOLD MMAP_THRESHOLD
|
||||
#else
|
||||
# ifdef SUNOS4
|
||||
# define APR_MMAP_THRESHOLD (8*1024)
|
||||
# else
|
||||
# define APR_MMAP_THRESHOLD 1
|
||||
# endif /* SUNOS4 */
|
||||
#endif /* MMAP_THRESHOLD */
|
||||
|
||||
/** @def APR_MMAP_LIMIT
|
||||
* Maximum size of MMap region
|
||||
*/
|
||||
#ifdef MMAP_LIMIT
|
||||
# define APR_MMAP_LIMIT MMAP_LIMIT
|
||||
#else
|
||||
# define APR_MMAP_LIMIT (4*1024*1024)
|
||||
#endif /* MMAP_LIMIT */
|
||||
|
||||
/** Can this file be MMaped */
|
||||
#define APR_MMAP_CANDIDATE(filelength) \
|
||||
((filelength >= APR_MMAP_THRESHOLD) && (filelength < APR_MMAP_LIMIT))
|
||||
|
||||
/* Function definitions */
|
||||
|
||||
/**
|
||||
* Create a new mmap'ed file out of an existing APR file.
|
||||
* @param newmmap The newly created mmap'ed file.
|
||||
* @param file The file to turn into an mmap.
|
||||
* @param offset The offset into the file to start the data pointer at.
|
||||
* @param size The size of the file
|
||||
* @param flag bit-wise or of:
|
||||
* <PRE>
|
||||
* APR_MMAP_READ MMap opened for reading
|
||||
* APR_MMAP_WRITE MMap opened for writing
|
||||
* </PRE>
|
||||
* @param cntxt The pool to use when creating the mmap.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_mmap_create(apr_mmap_t **newmmap,
|
||||
apr_file_t *file, apr_off_t offset,
|
||||
apr_size_t size, apr_int32_t flag,
|
||||
apr_pool_t *cntxt);
|
||||
|
||||
/**
|
||||
* Duplicate the specified MMAP.
|
||||
* @param new_mmap The structure to duplicate into.
|
||||
* @param old_mmap The mmap to duplicate.
|
||||
* @param p The pool to use for new_mmap.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_mmap_dup(apr_mmap_t **new_mmap,
|
||||
apr_mmap_t *old_mmap,
|
||||
apr_pool_t *p);
|
||||
|
||||
/**
|
||||
* Remove a mmap'ed.
|
||||
* @param mm The mmap'ed file.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_mmap_delete(apr_mmap_t *mm);
|
||||
|
||||
/**
|
||||
* Move the pointer into the mmap'ed file to the specified offset.
|
||||
* @param addr The pointer to the offset specified.
|
||||
* @param mm The mmap'ed file.
|
||||
* @param offset The offset to move to.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_mmap_offset(void **addr, apr_mmap_t *mm,
|
||||
apr_off_t offset);
|
||||
|
||||
#endif /* APR_HAS_MMAP */
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ! APR_MMAP_H */
|
||||
953
database/apache/include/apr_network_io.h
Normal file
953
database/apache/include/apr_network_io.h
Normal file
@@ -0,0 +1,953 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_NETWORK_IO_H
|
||||
#define APR_NETWORK_IO_H
|
||||
/**
|
||||
* @file apr_network_io.h
|
||||
* @brief APR Network library
|
||||
*/
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_pools.h"
|
||||
#include "apr_file_io.h"
|
||||
#include "apr_errno.h"
|
||||
#include "apr_inherit.h"
|
||||
#include "apr_perms_set.h"
|
||||
|
||||
#if APR_HAVE_NETINET_IN_H
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
#if APR_HAVE_SYS_UN_H
|
||||
#include <sys/un.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @defgroup apr_network_io Network Routines
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef APR_MAX_SECS_TO_LINGER
|
||||
/** Maximum seconds to linger */
|
||||
#define APR_MAX_SECS_TO_LINGER 30
|
||||
#endif
|
||||
|
||||
#ifndef APRMAXHOSTLEN
|
||||
/** Maximum hostname length */
|
||||
#define APRMAXHOSTLEN 256
|
||||
#endif
|
||||
|
||||
#ifndef APR_ANYADDR
|
||||
/** Default 'any' address */
|
||||
#define APR_ANYADDR "0.0.0.0"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup apr_sockopt Socket option definitions
|
||||
* @{
|
||||
*/
|
||||
#define APR_SO_LINGER 1 /**< Linger */
|
||||
#define APR_SO_KEEPALIVE 2 /**< Keepalive */
|
||||
#define APR_SO_DEBUG 4 /**< Debug */
|
||||
#define APR_SO_NONBLOCK 8 /**< Non-blocking IO */
|
||||
#define APR_SO_REUSEADDR 16 /**< Reuse addresses */
|
||||
#define APR_SO_SNDBUF 64 /**< Send buffer */
|
||||
#define APR_SO_RCVBUF 128 /**< Receive buffer */
|
||||
#define APR_SO_DISCONNECTED 256 /**< Disconnected */
|
||||
#define APR_TCP_NODELAY 512 /**< For SCTP sockets, this is mapped
|
||||
* to STCP_NODELAY internally.
|
||||
*/
|
||||
#define APR_TCP_NOPUSH 1024 /**< No push */
|
||||
#define APR_RESET_NODELAY 2048 /**< This flag is ONLY set internally
|
||||
* when we set APR_TCP_NOPUSH with
|
||||
* APR_TCP_NODELAY set to tell us that
|
||||
* APR_TCP_NODELAY should be turned on
|
||||
* again when NOPUSH is turned off
|
||||
*/
|
||||
#define APR_INCOMPLETE_READ 4096 /**< Set on non-blocking sockets
|
||||
* (timeout != 0) on which the
|
||||
* previous read() did not fill a buffer
|
||||
* completely. the next apr_socket_recv()
|
||||
* will first call select()/poll() rather than
|
||||
* going straight into read(). (Can also
|
||||
* be set by an application to force a
|
||||
* select()/poll() call before the next
|
||||
* read, in cases where the app expects
|
||||
* that an immediate read would fail.)
|
||||
*/
|
||||
#define APR_INCOMPLETE_WRITE 8192 /**< like APR_INCOMPLETE_READ, but for write
|
||||
* @see APR_INCOMPLETE_READ
|
||||
*/
|
||||
#define APR_IPV6_V6ONLY 16384 /**< Don't accept IPv4 connections on an
|
||||
* IPv6 listening socket.
|
||||
*/
|
||||
#define APR_TCP_DEFER_ACCEPT 32768 /**< Delay accepting of new connections
|
||||
* until data is available.
|
||||
* @see apr_socket_accept_filter
|
||||
*/
|
||||
#define APR_SO_BROADCAST 65536 /**< Allow broadcast
|
||||
*/
|
||||
#define APR_SO_FREEBIND 131072 /**< Allow binding to addresses not owned
|
||||
* by any interface
|
||||
*/
|
||||
|
||||
/** @} */
|
||||
|
||||
/** Define what type of socket shutdown should occur. */
|
||||
typedef enum {
|
||||
APR_SHUTDOWN_READ, /**< no longer allow read request */
|
||||
APR_SHUTDOWN_WRITE, /**< no longer allow write requests */
|
||||
APR_SHUTDOWN_READWRITE /**< no longer allow read or write requests */
|
||||
} apr_shutdown_how_e;
|
||||
|
||||
#define APR_IPV4_ADDR_OK 0x01 /**< @see apr_sockaddr_info_get() */
|
||||
#define APR_IPV6_ADDR_OK 0x02 /**< @see apr_sockaddr_info_get() */
|
||||
|
||||
#if (!APR_HAVE_IN_ADDR)
|
||||
/**
|
||||
* We need to make sure we always have an in_addr type, so APR will just
|
||||
* define it ourselves, if the platform doesn't provide it.
|
||||
*/
|
||||
struct in_addr {
|
||||
apr_uint32_t s_addr; /**< storage to hold the IP# */
|
||||
};
|
||||
#endif
|
||||
|
||||
/** @def APR_INADDR_NONE
|
||||
* Not all platforms have a real INADDR_NONE. This macro replaces
|
||||
* INADDR_NONE on all platforms.
|
||||
*/
|
||||
#ifdef INADDR_NONE
|
||||
#define APR_INADDR_NONE INADDR_NONE
|
||||
#else
|
||||
#define APR_INADDR_NONE ((unsigned int) 0xffffffff)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def APR_INET
|
||||
* Not all platforms have these defined, so we'll define them here
|
||||
* The default values come from FreeBSD 4.1.1
|
||||
*/
|
||||
#define APR_INET AF_INET
|
||||
/** @def APR_UNSPEC
|
||||
* Let the system decide which address family to use
|
||||
*/
|
||||
#ifdef AF_UNSPEC
|
||||
#define APR_UNSPEC AF_UNSPEC
|
||||
#else
|
||||
#define APR_UNSPEC 0
|
||||
#endif
|
||||
#if APR_HAVE_IPV6
|
||||
/** @def APR_INET6
|
||||
* IPv6 Address Family. Not all platforms may have this defined.
|
||||
*/
|
||||
|
||||
#define APR_INET6 AF_INET6
|
||||
#endif
|
||||
|
||||
#if APR_HAVE_SOCKADDR_UN
|
||||
#if defined (AF_UNIX)
|
||||
#define APR_UNIX AF_UNIX
|
||||
#elif defined(AF_LOCAL)
|
||||
#define APR_UNIX AF_LOCAL
|
||||
#else
|
||||
#error "Neither AF_UNIX nor AF_LOCAL is defined"
|
||||
#endif
|
||||
#else /* !APR_HAVE_SOCKADDR_UN */
|
||||
#if defined (AF_UNIX)
|
||||
#define APR_UNIX AF_UNIX
|
||||
#elif defined(AF_LOCAL)
|
||||
#define APR_UNIX AF_LOCAL
|
||||
#else
|
||||
/* TODO: Use a smarter way to detect unique APR_UNIX value */
|
||||
#define APR_UNIX 1234
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup IP_Proto IP Protocol Definitions for use when creating sockets
|
||||
* @{
|
||||
*/
|
||||
#define APR_PROTO_TCP 6 /**< TCP */
|
||||
#define APR_PROTO_UDP 17 /**< UDP */
|
||||
#define APR_PROTO_SCTP 132 /**< SCTP */
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* Enum used to denote either the local and remote endpoint of a
|
||||
* connection.
|
||||
*/
|
||||
typedef enum {
|
||||
APR_LOCAL, /**< Socket information for local end of connection */
|
||||
APR_REMOTE /**< Socket information for remote end of connection */
|
||||
} apr_interface_e;
|
||||
|
||||
/**
|
||||
* The specific declaration of inet_addr's ... some platforms fall back
|
||||
* inet_network (this is not good, but necessary)
|
||||
*/
|
||||
|
||||
#if APR_HAVE_INET_ADDR
|
||||
#define apr_inet_addr inet_addr
|
||||
#elif APR_HAVE_INET_NETWORK /* only DGUX, as far as I know */
|
||||
/**
|
||||
* @warning
|
||||
* not generally safe... inet_network() and inet_addr() perform
|
||||
* different functions */
|
||||
#define apr_inet_addr inet_network
|
||||
#endif
|
||||
|
||||
/** A structure to represent sockets */
|
||||
typedef struct apr_socket_t apr_socket_t;
|
||||
/**
|
||||
* A structure to encapsulate headers and trailers for apr_socket_sendfile
|
||||
*/
|
||||
typedef struct apr_hdtr_t apr_hdtr_t;
|
||||
/** A structure to represent in_addr */
|
||||
typedef struct in_addr apr_in_addr_t;
|
||||
/** A structure to represent an IP subnet */
|
||||
typedef struct apr_ipsubnet_t apr_ipsubnet_t;
|
||||
|
||||
/** @remark use apr_uint16_t just in case some system has a short that isn't 16 bits... */
|
||||
typedef apr_uint16_t apr_port_t;
|
||||
|
||||
/** @remark It's defined here as I think it should all be platform safe...
|
||||
* @see apr_sockaddr_t
|
||||
*/
|
||||
typedef struct apr_sockaddr_t apr_sockaddr_t;
|
||||
/**
|
||||
* APRs socket address type, used to ensure protocol independence
|
||||
*/
|
||||
struct apr_sockaddr_t {
|
||||
/** The pool to use... */
|
||||
apr_pool_t *pool;
|
||||
/** The hostname */
|
||||
char *hostname;
|
||||
/** Either a string of the port number or the service name for the port */
|
||||
char *servname;
|
||||
/** The numeric port */
|
||||
apr_port_t port;
|
||||
/** The family */
|
||||
apr_int32_t family;
|
||||
/** How big is the sockaddr we're using? */
|
||||
apr_socklen_t salen;
|
||||
/** How big is the ip address structure we're using? */
|
||||
int ipaddr_len;
|
||||
/** How big should the address buffer be? 16 for v4 or 46 for v6
|
||||
* used in inet_ntop... */
|
||||
int addr_str_len;
|
||||
/** This points to the IP address structure within the appropriate
|
||||
* sockaddr structure. */
|
||||
void *ipaddr_ptr;
|
||||
/** If multiple addresses were found by apr_sockaddr_info_get(), this
|
||||
* points to a representation of the next address. */
|
||||
apr_sockaddr_t *next;
|
||||
/** Union of either IPv4 or IPv6 sockaddr. */
|
||||
union {
|
||||
/** IPv4 sockaddr structure */
|
||||
struct sockaddr_in sin;
|
||||
#if APR_HAVE_IPV6
|
||||
/** IPv6 sockaddr structure */
|
||||
struct sockaddr_in6 sin6;
|
||||
#endif
|
||||
#if APR_HAVE_SA_STORAGE
|
||||
/** Placeholder to ensure that the size of this union is not
|
||||
* dependent on whether APR_HAVE_IPV6 is defined. */
|
||||
struct sockaddr_storage sas;
|
||||
#endif
|
||||
#if APR_HAVE_SOCKADDR_UN
|
||||
/** Unix domain socket sockaddr structure */
|
||||
struct sockaddr_un unx;
|
||||
#endif
|
||||
} sa;
|
||||
};
|
||||
|
||||
#if APR_HAS_SENDFILE
|
||||
/**
|
||||
* Support reusing the socket on platforms which support it (from disconnect,
|
||||
* specifically Win32.
|
||||
* @remark Optional flag passed into apr_socket_sendfile()
|
||||
*/
|
||||
#define APR_SENDFILE_DISCONNECT_SOCKET 1
|
||||
#endif
|
||||
|
||||
/** A structure to encapsulate headers and trailers for apr_socket_sendfile */
|
||||
struct apr_hdtr_t {
|
||||
/** An iovec to store the headers sent before the file. */
|
||||
struct iovec* headers;
|
||||
/** number of headers in the iovec */
|
||||
int numheaders;
|
||||
/** An iovec to store the trailers sent after the file. */
|
||||
struct iovec* trailers;
|
||||
/** number of trailers in the iovec */
|
||||
int numtrailers;
|
||||
};
|
||||
|
||||
/* function definitions */
|
||||
|
||||
/**
|
||||
* Create a socket.
|
||||
* @param new_sock The new socket that has been set up.
|
||||
* @param family The address family of the socket (e.g., APR_INET).
|
||||
* @param type The type of the socket (e.g., SOCK_STREAM).
|
||||
* @param protocol The protocol of the socket (e.g., APR_PROTO_TCP).
|
||||
* @param cont The pool for the apr_socket_t and associated storage.
|
||||
* @note The pool will be used by various functions that operate on the
|
||||
* socket. The caller must ensure that it is not used by other threads
|
||||
* at the same time.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_socket_create(apr_socket_t **new_sock,
|
||||
int family, int type,
|
||||
int protocol,
|
||||
apr_pool_t *cont);
|
||||
|
||||
/**
|
||||
* Shutdown either reading, writing, or both sides of a socket.
|
||||
* @param thesocket The socket to close
|
||||
* @param how How to shutdown the socket. One of:
|
||||
* <PRE>
|
||||
* APR_SHUTDOWN_READ no longer allow read requests
|
||||
* APR_SHUTDOWN_WRITE no longer allow write requests
|
||||
* APR_SHUTDOWN_READWRITE no longer allow read or write requests
|
||||
* </PRE>
|
||||
* @see apr_shutdown_how_e
|
||||
* @remark This does not actually close the socket descriptor, it just
|
||||
* controls which calls are still valid on the socket.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_socket_shutdown(apr_socket_t *thesocket,
|
||||
apr_shutdown_how_e how);
|
||||
|
||||
/**
|
||||
* Close a socket.
|
||||
* @param thesocket The socket to close
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_socket_close(apr_socket_t *thesocket);
|
||||
|
||||
/**
|
||||
* Bind the socket to its associated port
|
||||
* @param sock The socket to bind
|
||||
* @param sa The socket address to bind to
|
||||
* @remark This may be where we will find out if there is any other process
|
||||
* using the selected port.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_socket_bind(apr_socket_t *sock,
|
||||
apr_sockaddr_t *sa);
|
||||
|
||||
/**
|
||||
* Listen to a bound socket for connections.
|
||||
* @param sock The socket to listen on
|
||||
* @param backlog The number of outstanding connections allowed in the sockets
|
||||
* listen queue. If this value is less than zero, the listen
|
||||
* queue size is set to zero.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_socket_listen(apr_socket_t *sock,
|
||||
apr_int32_t backlog);
|
||||
|
||||
/**
|
||||
* Accept a new connection request
|
||||
* @param new_sock A copy of the socket that is connected to the socket that
|
||||
* made the connection request. This is the socket which should
|
||||
* be used for all future communication.
|
||||
* @param sock The socket we are listening on.
|
||||
* @param connection_pool The pool for the new socket.
|
||||
* @note The pool will be used by various functions that operate on the
|
||||
* socket. The caller must ensure that it is not used by other threads
|
||||
* at the same time.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_socket_accept(apr_socket_t **new_sock,
|
||||
apr_socket_t *sock,
|
||||
apr_pool_t *connection_pool);
|
||||
|
||||
/**
|
||||
* Issue a connection request to a socket either on the same machine
|
||||
* or a different one.
|
||||
* @param sock The socket we wish to use for our side of the connection
|
||||
* @param sa The address of the machine we wish to connect to.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_socket_connect(apr_socket_t *sock,
|
||||
apr_sockaddr_t *sa);
|
||||
|
||||
/**
|
||||
* Determine whether the receive part of the socket has been closed by
|
||||
* the peer (such that a subsequent call to apr_socket_read would
|
||||
* return APR_EOF), if the socket's receive buffer is empty. This
|
||||
* function does not block waiting for I/O.
|
||||
*
|
||||
* @param sock The socket to check
|
||||
* @param atreadeof If APR_SUCCESS is returned, *atreadeof is set to
|
||||
* non-zero if a subsequent read would return APR_EOF
|
||||
* @return an error is returned if it was not possible to determine the
|
||||
* status, in which case *atreadeof is not changed.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_socket_atreadeof(apr_socket_t *sock,
|
||||
int *atreadeof);
|
||||
|
||||
/**
|
||||
* Create apr_sockaddr_t from hostname, address family, and port.
|
||||
* @param sa The new apr_sockaddr_t.
|
||||
* @param hostname The hostname or numeric address string to resolve/parse, or
|
||||
* NULL to build an address that corresponds to 0.0.0.0 or ::
|
||||
* or in case of APR_UNIX family it is absolute socket filename.
|
||||
* @param family The address family to use, or APR_UNSPEC if the system should
|
||||
* decide.
|
||||
* @param port The port number.
|
||||
* @param flags Special processing flags:
|
||||
* <PRE>
|
||||
* APR_IPV4_ADDR_OK first query for IPv4 addresses; only look
|
||||
* for IPv6 addresses if the first query failed;
|
||||
* only valid if family is APR_UNSPEC and hostname
|
||||
* isn't NULL; mutually exclusive with
|
||||
* APR_IPV6_ADDR_OK
|
||||
* APR_IPV6_ADDR_OK first query for IPv6 addresses; only look
|
||||
* for IPv4 addresses if the first query failed;
|
||||
* only valid if family is APR_UNSPEC and hostname
|
||||
* isn't NULL and APR_HAVE_IPV6; mutually exclusive
|
||||
* with APR_IPV4_ADDR_OK
|
||||
* </PRE>
|
||||
* @param p The pool for the apr_sockaddr_t and associated storage.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_sockaddr_info_get(apr_sockaddr_t **sa,
|
||||
const char *hostname,
|
||||
apr_int32_t family,
|
||||
apr_port_t port,
|
||||
apr_int32_t flags,
|
||||
apr_pool_t *p);
|
||||
|
||||
/**
|
||||
* Copy apr_sockaddr_t src to dst on pool p.
|
||||
* @param dst The destination apr_sockaddr_t.
|
||||
* @param src The source apr_sockaddr_t.
|
||||
* @param p The pool for the apr_sockaddr_t and associated storage.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_sockaddr_info_copy(apr_sockaddr_t **dst,
|
||||
const apr_sockaddr_t *src,
|
||||
apr_pool_t *p);
|
||||
|
||||
/**
|
||||
* Set the zone of an IPv6 link-local address object.
|
||||
* @param sa Socket address object
|
||||
* @param zone_id Zone ID (textual "eth0" or numeric "3").
|
||||
* @return Returns APR_EBADIP for non-IPv6 socket or an IPv6 address
|
||||
* which isn't link-local.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_sockaddr_zone_set(apr_sockaddr_t *sa,
|
||||
const char *zone_id);
|
||||
|
||||
|
||||
/**
|
||||
* Retrieve the zone of an IPv6 link-local address object.
|
||||
* @param sa Socket address object
|
||||
* @param name If non-NULL, set to the textual representation of the zone id
|
||||
* @param id If non-NULL, set to the integer zone id
|
||||
* @param p Pool from which *name is allocated if used.
|
||||
* @return Returns APR_EBADIP for non-IPv6 socket or socket without any zone id
|
||||
* set, or other error if the interface could not be mapped to a name.
|
||||
* @remark Both name and id may be NULL, neither are modified if
|
||||
* non-NULL in error cases.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_sockaddr_zone_get(const apr_sockaddr_t *sa,
|
||||
const char **name,
|
||||
apr_uint32_t *id,
|
||||
apr_pool_t *p);
|
||||
|
||||
/**
|
||||
* Look up the host name from an apr_sockaddr_t.
|
||||
* @param hostname The hostname.
|
||||
* @param sa The apr_sockaddr_t.
|
||||
* @param flags Special processing flags.
|
||||
* @remark Results can vary significantly between platforms
|
||||
* when processing wildcard socket addresses.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_getnameinfo(char **hostname,
|
||||
apr_sockaddr_t *sa,
|
||||
apr_int32_t flags);
|
||||
|
||||
/**
|
||||
* Parse hostname/IP address with scope id and port.
|
||||
*
|
||||
* Any of the following strings are accepted:
|
||||
* 8080 (just the port number)
|
||||
* www.apache.org (just the hostname)
|
||||
* www.apache.org:8080 (hostname and port number)
|
||||
* [fe80::1]:80 (IPv6 numeric address string only)
|
||||
* [fe80::1%eth0] (IPv6 numeric address string and scope id)
|
||||
*
|
||||
* Invalid strings:
|
||||
* (empty string)
|
||||
* [abc] (not valid IPv6 numeric address string)
|
||||
* abc:65536 (invalid port number)
|
||||
*
|
||||
* @param addr The new buffer containing just the hostname. On output, *addr
|
||||
* will be NULL if no hostname/IP address was specfied.
|
||||
* @param scope_id The new buffer containing just the scope id. On output,
|
||||
* *scope_id will be NULL if no scope id was specified.
|
||||
* @param port The port number. On output, *port will be 0 if no port was
|
||||
* specified.
|
||||
* ### FIXME: 0 is a legal port (per RFC 1700). this should
|
||||
* ### return something besides zero if the port is missing.
|
||||
* @param str The input string to be parsed.
|
||||
* @param p The pool from which *addr and *scope_id are allocated.
|
||||
* @remark If scope id shouldn't be allowed, check for scope_id != NULL in
|
||||
* addition to checking the return code. If addr/hostname should be
|
||||
* required, check for addr == NULL in addition to checking the
|
||||
* return code.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_parse_addr_port(char **addr,
|
||||
char **scope_id,
|
||||
apr_port_t *port,
|
||||
const char *str,
|
||||
apr_pool_t *p);
|
||||
|
||||
/**
|
||||
* Get name of the current machine
|
||||
* @param buf A buffer to store the hostname in.
|
||||
* @param len The maximum length of the hostname that can be stored in the
|
||||
* buffer provided. The suggested length is APRMAXHOSTLEN + 1.
|
||||
* @param cont The pool to use.
|
||||
* @remark If the buffer was not large enough, an error will be returned.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_gethostname(char *buf, int len, apr_pool_t *cont);
|
||||
|
||||
/**
|
||||
* Return the data associated with the current socket
|
||||
* @param data The user data associated with the socket.
|
||||
* @param key The key to associate with the user data.
|
||||
* @param sock The currently open socket.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_socket_data_get(void **data, const char *key,
|
||||
apr_socket_t *sock);
|
||||
|
||||
/**
|
||||
* Set the data associated with the current socket.
|
||||
* @param sock The currently open socket.
|
||||
* @param data The user data to associate with the socket.
|
||||
* @param key The key to associate with the data.
|
||||
* @param cleanup The cleanup to call when the socket is destroyed.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_socket_data_set(apr_socket_t *sock, void *data,
|
||||
const char *key,
|
||||
apr_status_t (*cleanup)(void*));
|
||||
|
||||
/**
|
||||
* Send data over a network.
|
||||
* @param sock The socket to send the data over.
|
||||
* @param buf The buffer which contains the data to be sent.
|
||||
* @param len On entry, the number of bytes to send; on exit, the number
|
||||
* of bytes sent.
|
||||
* @remark
|
||||
* <PRE>
|
||||
* This functions acts like a blocking write by default. To change
|
||||
* this behavior, use apr_socket_timeout_set() or the APR_SO_NONBLOCK
|
||||
* socket option.
|
||||
*
|
||||
* It is possible for both bytes to be sent and an error to be returned.
|
||||
*
|
||||
* APR_EINTR is never returned.
|
||||
* </PRE>
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_socket_send(apr_socket_t *sock, const char *buf,
|
||||
apr_size_t *len);
|
||||
|
||||
/**
|
||||
* Send multiple buffers over a network.
|
||||
* @param sock The socket to send the data over.
|
||||
* @param vec The array of iovec structs containing the data to send
|
||||
* @param nvec The number of iovec structs in the array
|
||||
* @param len Receives the number of bytes actually written
|
||||
* @remark
|
||||
* <PRE>
|
||||
* This functions acts like a blocking write by default. To change
|
||||
* this behavior, use apr_socket_timeout_set() or the APR_SO_NONBLOCK
|
||||
* socket option.
|
||||
* The number of bytes actually sent is stored in argument 4.
|
||||
*
|
||||
* It is possible for both bytes to be sent and an error to be returned.
|
||||
*
|
||||
* APR_EINTR is never returned.
|
||||
* </PRE>
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_socket_sendv(apr_socket_t *sock,
|
||||
const struct iovec *vec,
|
||||
apr_int32_t nvec, apr_size_t *len);
|
||||
|
||||
/**
|
||||
* @param sock The socket to send from
|
||||
* @param where The apr_sockaddr_t describing where to send the data
|
||||
* @param flags The flags to use
|
||||
* @param buf The data to send
|
||||
* @param len The length of the data to send
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_socket_sendto(apr_socket_t *sock,
|
||||
apr_sockaddr_t *where,
|
||||
apr_int32_t flags, const char *buf,
|
||||
apr_size_t *len);
|
||||
|
||||
/**
|
||||
* Read data from a socket. On success, the address of the peer from
|
||||
* which the data was sent is copied into the @a from parameter, and the
|
||||
* @a len parameter is updated to give the number of bytes written to
|
||||
* @a buf.
|
||||
*
|
||||
* @param from Updated with the address from which the data was received
|
||||
* @param sock The socket to use
|
||||
* @param flags The flags to use
|
||||
* @param buf The buffer to use
|
||||
* @param len The length of the available buffer
|
||||
*/
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_socket_recvfrom(apr_sockaddr_t *from,
|
||||
apr_socket_t *sock,
|
||||
apr_int32_t flags, char *buf,
|
||||
apr_size_t *len);
|
||||
|
||||
#if APR_HAS_SENDFILE || defined(DOXYGEN)
|
||||
|
||||
/**
|
||||
* Send a file from an open file descriptor to a socket, along with
|
||||
* optional headers and trailers
|
||||
* @param sock The socket to which we're writing
|
||||
* @param file The open file from which to read
|
||||
* @param hdtr A structure containing the headers and trailers to send
|
||||
* @param offset Offset into the file where we should begin writing
|
||||
* @param len (input) - Number of bytes to send from the file
|
||||
* (output) - Number of bytes actually sent,
|
||||
* including headers, file, and trailers
|
||||
* @param flags APR flags that are mapped to OS specific flags
|
||||
* @remark This functions acts like a blocking write by default. To change
|
||||
* this behavior, use apr_socket_timeout_set() or the
|
||||
* APR_SO_NONBLOCK socket option.
|
||||
* The number of bytes actually sent is stored in the len parameter.
|
||||
* The offset parameter is passed by reference for no reason; its
|
||||
* value will never be modified by the apr_socket_sendfile() function.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_socket_sendfile(apr_socket_t *sock,
|
||||
apr_file_t *file,
|
||||
apr_hdtr_t *hdtr,
|
||||
apr_off_t *offset,
|
||||
apr_size_t *len,
|
||||
apr_int32_t flags);
|
||||
|
||||
#endif /* APR_HAS_SENDFILE */
|
||||
|
||||
/**
|
||||
* Read data from a network.
|
||||
* @param sock The socket to read the data from.
|
||||
* @param buf The buffer to store the data in.
|
||||
* @param len On entry, the number of bytes to receive; on exit, the number
|
||||
* of bytes received.
|
||||
* @remark
|
||||
* <PRE>
|
||||
* This functions acts like a blocking read by default. To change
|
||||
* this behavior, use apr_socket_timeout_set() or the APR_SO_NONBLOCK
|
||||
* socket option.
|
||||
* The number of bytes actually received is stored in argument 3.
|
||||
*
|
||||
* It is possible for both bytes to be received and an APR_EOF or
|
||||
* other error to be returned.
|
||||
*
|
||||
* APR_EINTR is never returned.
|
||||
* </PRE>
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_socket_recv(apr_socket_t *sock,
|
||||
char *buf, apr_size_t *len);
|
||||
|
||||
/**
|
||||
* Setup socket options for the specified socket
|
||||
* @param sock The socket to set up.
|
||||
* @param opt The option we would like to configure. One of:
|
||||
* <PRE>
|
||||
* APR_SO_DEBUG -- turn on debugging information
|
||||
* APR_SO_KEEPALIVE -- keep connections active
|
||||
* APR_SO_LINGER -- lingers on close if data is present
|
||||
* APR_SO_NONBLOCK -- Turns blocking on/off for socket
|
||||
* When this option is enabled, use
|
||||
* the APR_STATUS_IS_EAGAIN() macro to
|
||||
* see if a send or receive function
|
||||
* could not transfer data without
|
||||
* blocking.
|
||||
* APR_SO_REUSEADDR -- The rules used in validating addresses
|
||||
* supplied to bind should allow reuse
|
||||
* of local addresses.
|
||||
* APR_SO_SNDBUF -- Set the SendBufferSize
|
||||
* APR_SO_RCVBUF -- Set the ReceiveBufferSize
|
||||
* APR_SO_FREEBIND -- Allow binding to non-local IP address.
|
||||
* </PRE>
|
||||
* @param on Value for the option.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_socket_opt_set(apr_socket_t *sock,
|
||||
apr_int32_t opt, apr_int32_t on);
|
||||
|
||||
/**
|
||||
* Setup socket timeout for the specified socket
|
||||
* @param sock The socket to set up.
|
||||
* @param t Value for the timeout.
|
||||
* <PRE>
|
||||
* t > 0 -- read and write calls return APR_TIMEUP if specified time
|
||||
* elapsess with no data read or written
|
||||
* t == 0 -- read and write calls never block
|
||||
* t < 0 -- read and write calls block
|
||||
* </PRE>
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_socket_timeout_set(apr_socket_t *sock,
|
||||
apr_interval_time_t t);
|
||||
|
||||
/**
|
||||
* Query socket options for the specified socket
|
||||
* @param sock The socket to query
|
||||
* @param opt The option we would like to query. One of:
|
||||
* <PRE>
|
||||
* APR_SO_DEBUG -- turn on debugging information
|
||||
* APR_SO_KEEPALIVE -- keep connections active
|
||||
* APR_SO_LINGER -- lingers on close if data is present
|
||||
* APR_SO_NONBLOCK -- Turns blocking on/off for socket
|
||||
* APR_SO_REUSEADDR -- The rules used in validating addresses
|
||||
* supplied to bind should allow reuse
|
||||
* of local addresses.
|
||||
* APR_SO_SNDBUF -- Set the SendBufferSize
|
||||
* APR_SO_RCVBUF -- Set the ReceiveBufferSize
|
||||
* APR_SO_DISCONNECTED -- Query the disconnected state of the socket.
|
||||
* (Currently only used on Windows)
|
||||
* </PRE>
|
||||
* @param on Socket option returned on the call.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_socket_opt_get(apr_socket_t *sock,
|
||||
apr_int32_t opt, apr_int32_t *on);
|
||||
|
||||
/**
|
||||
* Query socket timeout for the specified socket
|
||||
* @param sock The socket to query
|
||||
* @param t Socket timeout returned from the query.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_socket_timeout_get(apr_socket_t *sock,
|
||||
apr_interval_time_t *t);
|
||||
|
||||
/**
|
||||
* Query the specified socket if at the OOB/Urgent data mark
|
||||
* @param sock The socket to query
|
||||
* @param atmark Is set to true if socket is at the OOB/urgent mark,
|
||||
* otherwise is set to false.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_socket_atmark(apr_socket_t *sock,
|
||||
int *atmark);
|
||||
|
||||
/**
|
||||
* Return an address associated with a socket; either the address to
|
||||
* which the socket is bound locally or the address of the peer
|
||||
* to which the socket is connected.
|
||||
* @param sa The returned apr_sockaddr_t.
|
||||
* @param which Whether to retrieve the local or remote address
|
||||
* @param sock The socket to use
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_socket_addr_get(apr_sockaddr_t **sa,
|
||||
apr_interface_e which,
|
||||
apr_socket_t *sock);
|
||||
|
||||
/**
|
||||
* Return the IP address (in numeric address string format) in
|
||||
* an APR socket address. APR will allocate storage for the IP address
|
||||
* string from the pool of the apr_sockaddr_t.
|
||||
* @param addr The IP address.
|
||||
* @param sockaddr The socket address to reference.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_sockaddr_ip_get(char **addr,
|
||||
apr_sockaddr_t *sockaddr);
|
||||
|
||||
/**
|
||||
* Write the IP address (in numeric address string format) of the APR
|
||||
* socket address @a sockaddr into the buffer @a buf (of size @a buflen).
|
||||
* @param sockaddr The socket address to reference.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_sockaddr_ip_getbuf(char *buf, apr_size_t buflen,
|
||||
apr_sockaddr_t *sockaddr);
|
||||
|
||||
/**
|
||||
* See if the IP addresses in two APR socket addresses are
|
||||
* equivalent. Appropriate logic is present for comparing
|
||||
* IPv4-mapped IPv6 addresses with IPv4 addresses.
|
||||
*
|
||||
* @param addr1 One of the APR socket addresses.
|
||||
* @param addr2 The other APR socket address.
|
||||
* @remark The return value will be non-zero if the addresses
|
||||
* are equivalent.
|
||||
*/
|
||||
APR_DECLARE(int) apr_sockaddr_equal(const apr_sockaddr_t *addr1,
|
||||
const apr_sockaddr_t *addr2);
|
||||
|
||||
/**
|
||||
* See if the IP address in an APR socket address refers to the wildcard
|
||||
* address for the protocol family (e.g., INADDR_ANY for IPv4).
|
||||
*
|
||||
* @param addr The APR socket address to examine.
|
||||
* @remark The return value will be non-zero if the address is
|
||||
* initialized and is the wildcard address.
|
||||
*/
|
||||
APR_DECLARE(int) apr_sockaddr_is_wildcard(const apr_sockaddr_t *addr);
|
||||
|
||||
/**
|
||||
* Return the type of the socket.
|
||||
* @param sock The socket to query.
|
||||
* @param type The returned type (e.g., SOCK_STREAM).
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_socket_type_get(apr_socket_t *sock,
|
||||
int *type);
|
||||
|
||||
/**
|
||||
* Given an apr_sockaddr_t and a service name, set the port for the service
|
||||
* @param sockaddr The apr_sockaddr_t that will have its port set
|
||||
* @param servname The name of the service you wish to use
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_getservbyname(apr_sockaddr_t *sockaddr,
|
||||
const char *servname);
|
||||
/**
|
||||
* Build an ip-subnet representation from an IP address and optional netmask or
|
||||
* number-of-bits.
|
||||
* @param ipsub The new ip-subnet representation
|
||||
* @param ipstr The input IP address string
|
||||
* @param mask_or_numbits The input netmask or number-of-bits string, or NULL
|
||||
* @param p The pool to allocate from
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_ipsubnet_create(apr_ipsubnet_t **ipsub,
|
||||
const char *ipstr,
|
||||
const char *mask_or_numbits,
|
||||
apr_pool_t *p);
|
||||
|
||||
/**
|
||||
* Test the IP address in an apr_sockaddr_t against a pre-built ip-subnet
|
||||
* representation.
|
||||
* @param ipsub The ip-subnet representation
|
||||
* @param sa The socket address to test
|
||||
* @return non-zero if the socket address is within the subnet, 0 otherwise
|
||||
*/
|
||||
APR_DECLARE(int) apr_ipsubnet_test(apr_ipsubnet_t *ipsub, apr_sockaddr_t *sa);
|
||||
|
||||
#if APR_HAS_SO_ACCEPTFILTER || defined(DOXYGEN)
|
||||
/**
|
||||
* Set an OS level accept filter.
|
||||
* @param sock The socket to put the accept filter on.
|
||||
* @param name The accept filter
|
||||
* @param args Any extra args to the accept filter. Passing NULL here removes
|
||||
* the accept filter.
|
||||
* @bug name and args should have been declared as const char *, as they are in
|
||||
* APR 2.0
|
||||
*/
|
||||
apr_status_t apr_socket_accept_filter(apr_socket_t *sock, char *name,
|
||||
char *args);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Return the protocol of the socket.
|
||||
* @param sock The socket to query.
|
||||
* @param protocol The returned protocol (e.g., APR_PROTO_TCP).
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_socket_protocol_get(apr_socket_t *sock,
|
||||
int *protocol);
|
||||
|
||||
/**
|
||||
* Get the pool used by the socket.
|
||||
*/
|
||||
APR_POOL_DECLARE_ACCESSOR(socket);
|
||||
|
||||
/**
|
||||
* Set a socket to be inherited by child processes.
|
||||
*/
|
||||
APR_DECLARE_INHERIT_SET(socket);
|
||||
|
||||
/**
|
||||
* Unset a socket from being inherited by child processes.
|
||||
*/
|
||||
APR_DECLARE_INHERIT_UNSET(socket);
|
||||
|
||||
/**
|
||||
* Set socket permissions.
|
||||
*/
|
||||
APR_PERMS_SET_IMPLEMENT(socket);
|
||||
|
||||
/**
|
||||
* @defgroup apr_mcast IP Multicast
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Join a Multicast Group
|
||||
* @param sock The socket to join a multicast group
|
||||
* @param join The address of the multicast group to join
|
||||
* @param iface Address of the interface to use. If NULL is passed, the
|
||||
* default multicast interface will be used. (OS Dependent)
|
||||
* @param source Source Address to accept transmissions from (non-NULL
|
||||
* implies Source-Specific Multicast)
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_mcast_join(apr_socket_t *sock,
|
||||
apr_sockaddr_t *join,
|
||||
apr_sockaddr_t *iface,
|
||||
apr_sockaddr_t *source);
|
||||
|
||||
/**
|
||||
* Leave a Multicast Group. All arguments must be the same as
|
||||
* apr_mcast_join.
|
||||
* @param sock The socket to leave a multicast group
|
||||
* @param addr The address of the multicast group to leave
|
||||
* @param iface Address of the interface to use. If NULL is passed, the
|
||||
* default multicast interface will be used. (OS Dependent)
|
||||
* @param source Source Address to accept transmissions from (non-NULL
|
||||
* implies Source-Specific Multicast)
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_mcast_leave(apr_socket_t *sock,
|
||||
apr_sockaddr_t *addr,
|
||||
apr_sockaddr_t *iface,
|
||||
apr_sockaddr_t *source);
|
||||
|
||||
/**
|
||||
* Set the Multicast Time to Live (ttl) for a multicast transmission.
|
||||
* @param sock The socket to set the multicast ttl
|
||||
* @param ttl Time to live to Assign. 0-255, default=1
|
||||
* @remark If the TTL is 0, packets will only be seen by sockets on
|
||||
* the local machine, and only when multicast loopback is enabled.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_mcast_hops(apr_socket_t *sock,
|
||||
apr_byte_t ttl);
|
||||
|
||||
/**
|
||||
* Toggle IP Multicast Loopback
|
||||
* @param sock The socket to set multicast loopback
|
||||
* @param opt 0=disable, 1=enable
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_mcast_loopback(apr_socket_t *sock,
|
||||
apr_byte_t opt);
|
||||
|
||||
|
||||
/**
|
||||
* Set the Interface to be used for outgoing Multicast Transmissions.
|
||||
* @param sock The socket to set the multicast interface on
|
||||
* @param iface Address of the interface to use for Multicast
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_mcast_interface(apr_socket_t *sock,
|
||||
apr_sockaddr_t *iface);
|
||||
|
||||
/** @} */
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ! APR_NETWORK_IO_H */
|
||||
|
||||
92
database/apache/include/apr_optional.h
Normal file
92
database/apache/include/apr_optional.h
Normal file
@@ -0,0 +1,92 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_OPTIONAL_H
|
||||
#define APR_OPTIONAL_H
|
||||
|
||||
#include "apu.h"
|
||||
/**
|
||||
* @file apr_optional.h
|
||||
* @brief APR-UTIL registration of functions exported by modules
|
||||
*/
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup APR_Util_Opt Optional Functions
|
||||
* @ingroup APR_Util
|
||||
*
|
||||
* Typesafe registration and retrieval of functions that may not be present
|
||||
* (i.e. functions exported by optional modules)
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* The type of an optional function.
|
||||
* @param name The name of the function
|
||||
*/
|
||||
#define APR_OPTIONAL_FN_TYPE(name) apr_OFN_##name##_t
|
||||
|
||||
/**
|
||||
* Declare an optional function.
|
||||
* @param ret The return type of the function
|
||||
* @param name The name of the function
|
||||
* @param args The function arguments (including brackets)
|
||||
*/
|
||||
#define APR_DECLARE_OPTIONAL_FN(ret,name,args) \
|
||||
typedef ret (APR_OPTIONAL_FN_TYPE(name)) args
|
||||
|
||||
/**
|
||||
* XXX: This doesn't belong here, then!
|
||||
* Private function! DO NOT USE!
|
||||
* @internal
|
||||
*/
|
||||
|
||||
typedef void (apr_opt_fn_t)(void);
|
||||
/** @internal */
|
||||
APU_DECLARE_NONSTD(void) apr_dynamic_fn_register(const char *szName,
|
||||
apr_opt_fn_t *pfn);
|
||||
|
||||
/**
|
||||
* Register an optional function. This can be later retrieved, type-safely, by
|
||||
* name. Like all global functions, the name must be unique. Note that,
|
||||
* confusingly but correctly, the function itself can be static!
|
||||
* @param name The name of the function
|
||||
*/
|
||||
#define APR_REGISTER_OPTIONAL_FN(name) do { \
|
||||
APR_OPTIONAL_FN_TYPE(name) *apu__opt = name; \
|
||||
apr_dynamic_fn_register(#name,(apr_opt_fn_t *)apu__opt); \
|
||||
} while (0)
|
||||
|
||||
/** @internal
|
||||
* Private function! DO NOT USE!
|
||||
*/
|
||||
APU_DECLARE(apr_opt_fn_t *) apr_dynamic_fn_retrieve(const char *szName);
|
||||
|
||||
/**
|
||||
* Retrieve an optional function. Returns NULL if the function is not present.
|
||||
* @param name The name of the function
|
||||
*/
|
||||
#define APR_RETRIEVE_OPTIONAL_FN(name) \
|
||||
(APR_OPTIONAL_FN_TYPE(name) *)apr_dynamic_fn_retrieve(#name)
|
||||
|
||||
/** @} */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* APR_OPTIONAL_H */
|
||||
117
database/apache/include/apr_optional_hooks.h
Normal file
117
database/apache/include/apr_optional_hooks.h
Normal file
@@ -0,0 +1,117 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/**
|
||||
* @file apr_optional_hooks.h
|
||||
* @brief Apache optional hook functions
|
||||
*/
|
||||
|
||||
|
||||
#ifndef APR_OPTIONAL_HOOK_H
|
||||
#define APR_OPTIONAL_HOOK_H
|
||||
|
||||
#include "apr_tables.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/**
|
||||
* @defgroup APR_Util_OPT_HOOK Optional Hook Functions
|
||||
* @ingroup APR_Util_Hook
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* Function to implement the APR_OPTIONAL_HOOK Macro
|
||||
* @internal
|
||||
* @see APR_OPTIONAL_HOOK
|
||||
*
|
||||
* @param szName The name of the hook
|
||||
* @param pfn A pointer to a function that will be called
|
||||
* @param aszPre a NULL-terminated array of strings that name modules whose hooks should precede this one
|
||||
* @param aszSucc a NULL-terminated array of strings that name modules whose hooks should succeed this one
|
||||
* @param nOrder an integer determining order before honouring aszPre and aszSucc (for example HOOK_MIDDLE)
|
||||
*/
|
||||
|
||||
|
||||
APU_DECLARE(void) apr_optional_hook_add(const char *szName,void (*pfn)(void),
|
||||
const char * const *aszPre,
|
||||
const char * const *aszSucc,
|
||||
int nOrder);
|
||||
|
||||
/**
|
||||
* Hook to an optional hook.
|
||||
*
|
||||
* @param ns The namespace prefix of the hook functions
|
||||
* @param name The name of the hook
|
||||
* @param pfn A pointer to a function that will be called
|
||||
* @param aszPre a NULL-terminated array of strings that name modules whose hooks should precede this one
|
||||
* @param aszSucc a NULL-terminated array of strings that name modules whose hooks should succeed this one
|
||||
* @param nOrder an integer determining order before honouring aszPre and aszSucc (for example HOOK_MIDDLE)
|
||||
*/
|
||||
|
||||
#define APR_OPTIONAL_HOOK(ns,name,pfn,aszPre,aszSucc,nOrder) do { \
|
||||
ns##_HOOK_##name##_t *apu__hook = pfn; \
|
||||
apr_optional_hook_add(#name,(void (*)(void))apu__hook,aszPre, aszSucc, nOrder); \
|
||||
} while (0)
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @param szName - the name of the function
|
||||
* @return the hook structure for a given hook
|
||||
*/
|
||||
APU_DECLARE(apr_array_header_t *) apr_optional_hook_get(const char *szName);
|
||||
|
||||
/**
|
||||
* Implement an optional hook that runs until one of the functions
|
||||
* returns something other than OK or DECLINE.
|
||||
*
|
||||
* @param ns The namespace prefix of the hook functions
|
||||
* @param link The linkage declaration prefix of the hook
|
||||
* @param ret The type of the return value of the hook
|
||||
* @param ret The type of the return value of the hook
|
||||
* @param name The name of the hook
|
||||
* @param args_decl The declaration of the arguments for the hook
|
||||
* @param args_use The names for the arguments for the hook
|
||||
* @param ok Success value
|
||||
* @param decline Decline value
|
||||
*/
|
||||
#define APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(ns,link,ret,name,args_decl,args_use,ok,decline) \
|
||||
link##_DECLARE(ret) ns##_run_##name args_decl \
|
||||
{ \
|
||||
ns##_LINK_##name##_t *pHook; \
|
||||
int n; \
|
||||
ret rv; \
|
||||
apr_array_header_t *pHookArray=apr_optional_hook_get(#name); \
|
||||
\
|
||||
if(!pHookArray) \
|
||||
return ok; \
|
||||
\
|
||||
pHook=(ns##_LINK_##name##_t *)pHookArray->elts; \
|
||||
for(n=0 ; n < pHookArray->nelts ; ++n) \
|
||||
{ \
|
||||
rv=(pHook[n].pFunc)args_use; \
|
||||
\
|
||||
if(rv != ok && rv != decline) \
|
||||
return rv; \
|
||||
} \
|
||||
return ok; \
|
||||
}
|
||||
|
||||
/** @} */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* APR_OPTIONAL_HOOK_H */
|
||||
65
database/apache/include/apr_perms_set.h
Normal file
65
database/apache/include/apr_perms_set.h
Normal file
@@ -0,0 +1,65 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_PERMS_SET_H
|
||||
#define APR_PERMS_SET_H
|
||||
|
||||
/**
|
||||
* @file apr_perms_set.h
|
||||
* @brief APR Process Locking Routines
|
||||
*/
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_pools.h"
|
||||
#include "apr_errno.h"
|
||||
#include "apr_user.h"
|
||||
#include "apr_file_info.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @defgroup apr_perms_set Object permission set functions
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** Permission set callback function. */
|
||||
typedef apr_status_t (apr_perms_setfn_t)(void *object, apr_fileperms_t perms,
|
||||
apr_uid_t uid, apr_gid_t gid);
|
||||
|
||||
#define APR_PERMS_SET_IMPLEMENT(type) \
|
||||
APR_DECLARE(apr_status_t) apr_##type##_perms_set \
|
||||
(void *the##type, apr_fileperms_t perms, \
|
||||
apr_uid_t uid, apr_gid_t gid)
|
||||
|
||||
#define APR_PERMS_SET_ENOTIMPL(type) \
|
||||
APR_DECLARE(apr_status_t) apr_##type##_perms_set \
|
||||
(void *the##type, apr_fileperms_t perms, \
|
||||
apr_uid_t uid, apr_gid_t gid) \
|
||||
{ return APR_ENOTIMPL ; }
|
||||
|
||||
#define APR_PERMS_SET_FN(type) apr_##type##_perms_set
|
||||
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ! APR_PERMS_SET */
|
||||
446
database/apache/include/apr_poll.h
Normal file
446
database/apache/include/apr_poll.h
Normal file
@@ -0,0 +1,446 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_POLL_H
|
||||
#define APR_POLL_H
|
||||
/**
|
||||
* @file apr_poll.h
|
||||
* @brief APR Poll interface
|
||||
*/
|
||||
#include "apr.h"
|
||||
#include "apr_pools.h"
|
||||
#include "apr_errno.h"
|
||||
#include "apr_inherit.h"
|
||||
#include "apr_file_io.h"
|
||||
#include "apr_network_io.h"
|
||||
|
||||
#if APR_HAVE_NETINET_IN_H
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @defgroup apr_poll Poll Routines
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup pollopts Poll options
|
||||
* @ingroup apr_poll
|
||||
* @{
|
||||
*/
|
||||
#define APR_POLLIN 0x001 /**< Can read without blocking */
|
||||
#define APR_POLLPRI 0x002 /**< Priority data available */
|
||||
#define APR_POLLOUT 0x004 /**< Can write without blocking */
|
||||
#define APR_POLLERR 0x010 /**< Pending error */
|
||||
#define APR_POLLHUP 0x020 /**< Hangup occurred */
|
||||
#define APR_POLLNVAL 0x040 /**< Descriptor invalid */
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @defgroup pollflags Pollset Flags
|
||||
* @ingroup apr_poll
|
||||
* @{
|
||||
*/
|
||||
#define APR_POLLSET_THREADSAFE 0x001 /**< Adding or removing a descriptor is
|
||||
* thread-safe
|
||||
*/
|
||||
#define APR_POLLSET_NOCOPY 0x002 /**< Descriptors passed to apr_pollset_add()
|
||||
* are not copied
|
||||
*/
|
||||
#define APR_POLLSET_WAKEABLE 0x004 /**< Poll operations are interruptable by
|
||||
* apr_pollset_wakeup() or apr_pollcb_wakeup()
|
||||
*/
|
||||
#define APR_POLLSET_NODEFAULT 0x010 /**< Do not try to use the default method if
|
||||
* the specified non-default method cannot be
|
||||
* used
|
||||
*/
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* Pollset Methods
|
||||
*/
|
||||
typedef enum {
|
||||
APR_POLLSET_DEFAULT, /**< Platform default poll method */
|
||||
APR_POLLSET_SELECT, /**< Poll uses select method */
|
||||
APR_POLLSET_KQUEUE, /**< Poll uses kqueue method */
|
||||
APR_POLLSET_PORT, /**< Poll uses Solaris event port method */
|
||||
APR_POLLSET_EPOLL, /**< Poll uses epoll method */
|
||||
APR_POLLSET_POLL, /**< Poll uses poll method */
|
||||
APR_POLLSET_AIO_MSGQ /**< Poll uses z/OS asio method */
|
||||
} apr_pollset_method_e;
|
||||
|
||||
/** Used in apr_pollfd_t to determine what the apr_descriptor is */
|
||||
typedef enum {
|
||||
APR_NO_DESC, /**< nothing here */
|
||||
APR_POLL_SOCKET, /**< descriptor refers to a socket */
|
||||
APR_POLL_FILE, /**< descriptor refers to a file */
|
||||
APR_POLL_LASTDESC /**< @deprecated descriptor is the last one in the list */
|
||||
} apr_datatype_e ;
|
||||
|
||||
/** Union of either an APR file or socket. */
|
||||
typedef union {
|
||||
apr_file_t *f; /**< file */
|
||||
apr_socket_t *s; /**< socket */
|
||||
} apr_descriptor;
|
||||
|
||||
/** @see apr_pollfd_t */
|
||||
typedef struct apr_pollfd_t apr_pollfd_t;
|
||||
|
||||
/** Poll descriptor set. */
|
||||
struct apr_pollfd_t {
|
||||
apr_pool_t *p; /**< associated pool */
|
||||
apr_datatype_e desc_type; /**< descriptor type */
|
||||
apr_int16_t reqevents; /**< requested events */
|
||||
apr_int16_t rtnevents; /**< returned events */
|
||||
apr_descriptor desc; /**< @see apr_descriptor */
|
||||
void *client_data; /**< allows app to associate context */
|
||||
};
|
||||
|
||||
|
||||
/* General-purpose poll API for arbitrarily large numbers of
|
||||
* file descriptors
|
||||
*/
|
||||
|
||||
/** Opaque structure used for pollset API */
|
||||
typedef struct apr_pollset_t apr_pollset_t;
|
||||
|
||||
/**
|
||||
* Set up a pollset object
|
||||
* @param pollset The pointer in which to return the newly created object
|
||||
* @param size The maximum number of descriptors that this pollset can hold
|
||||
* @param p The pool from which to allocate the pollset
|
||||
* @param flags Optional flags to modify the operation of the pollset.
|
||||
*
|
||||
* @remark If flags contains APR_POLLSET_THREADSAFE, then a pollset is
|
||||
* created on which it is safe to make concurrent calls to
|
||||
* apr_pollset_add(), apr_pollset_remove() and apr_pollset_poll()
|
||||
* from separate threads. This feature is only supported on some
|
||||
* platforms; the apr_pollset_create() call will fail with
|
||||
* APR_ENOTIMPL on platforms where it is not supported.
|
||||
* @remark If flags contains APR_POLLSET_WAKEABLE, then a pollset is
|
||||
* created with an additional internal pipe object used for the
|
||||
* apr_pollset_wakeup() call. The actual size of pollset is
|
||||
* in that case @a size + 1. This feature is only supported on some
|
||||
* platforms; the apr_pollset_create() call will fail with
|
||||
* APR_ENOTIMPL on platforms where it is not supported.
|
||||
* @remark If flags contains APR_POLLSET_NOCOPY, then the apr_pollfd_t
|
||||
* structures passed to apr_pollset_add() are not copied and
|
||||
* must have a lifetime at least as long as the pollset.
|
||||
* @remark Some poll methods (including APR_POLLSET_KQUEUE,
|
||||
* APR_POLLSET_PORT, and APR_POLLSET_EPOLL) do not have a
|
||||
* fixed limit on the size of the pollset. For these methods,
|
||||
* the size parameter controls the maximum number of
|
||||
* descriptors that will be returned by a single call to
|
||||
* apr_pollset_poll().
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_pollset_create(apr_pollset_t **pollset,
|
||||
apr_uint32_t size,
|
||||
apr_pool_t *p,
|
||||
apr_uint32_t flags);
|
||||
|
||||
/**
|
||||
* Set up a pollset object
|
||||
* @param pollset The pointer in which to return the newly created object
|
||||
* @param size The maximum number of descriptors that this pollset can hold
|
||||
* @param p The pool from which to allocate the pollset
|
||||
* @param flags Optional flags to modify the operation of the pollset.
|
||||
* @param method Poll method to use. See #apr_pollset_method_e. If this
|
||||
* method cannot be used, the default method will be used unless the
|
||||
* APR_POLLSET_NODEFAULT flag has been specified.
|
||||
*
|
||||
* @remark If flags contains APR_POLLSET_THREADSAFE, then a pollset is
|
||||
* created on which it is safe to make concurrent calls to
|
||||
* apr_pollset_add(), apr_pollset_remove() and apr_pollset_poll()
|
||||
* from separate threads. This feature is only supported on some
|
||||
* platforms; the apr_pollset_create_ex() call will fail with
|
||||
* APR_ENOTIMPL on platforms where it is not supported.
|
||||
* @remark If flags contains APR_POLLSET_WAKEABLE, then a pollset is
|
||||
* created with additional internal pipe object used for the
|
||||
* apr_pollset_wakeup() call. The actual size of pollset is
|
||||
* in that case size + 1. This feature is only supported on some
|
||||
* platforms; the apr_pollset_create_ex() call will fail with
|
||||
* APR_ENOTIMPL on platforms where it is not supported.
|
||||
* @remark If flags contains APR_POLLSET_NOCOPY, then the apr_pollfd_t
|
||||
* structures passed to apr_pollset_add() are not copied and
|
||||
* must have a lifetime at least as long as the pollset.
|
||||
* @remark Some poll methods (including APR_POLLSET_KQUEUE,
|
||||
* APR_POLLSET_PORT, and APR_POLLSET_EPOLL) do not have a
|
||||
* fixed limit on the size of the pollset. For these methods,
|
||||
* the size parameter controls the maximum number of
|
||||
* descriptors that will be returned by a single call to
|
||||
* apr_pollset_poll().
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_pollset_create_ex(apr_pollset_t **pollset,
|
||||
apr_uint32_t size,
|
||||
apr_pool_t *p,
|
||||
apr_uint32_t flags,
|
||||
apr_pollset_method_e method);
|
||||
|
||||
/**
|
||||
* Destroy a pollset object
|
||||
* @param pollset The pollset to destroy
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_pollset_destroy(apr_pollset_t *pollset);
|
||||
|
||||
/**
|
||||
* Add a socket or file descriptor to a pollset
|
||||
* @param pollset The pollset to which to add the descriptor
|
||||
* @param descriptor The descriptor to add
|
||||
* @remark If you set client_data in the descriptor, that value
|
||||
* will be returned in the client_data field whenever this
|
||||
* descriptor is signalled in apr_pollset_poll().
|
||||
* @remark If the pollset has been created with APR_POLLSET_THREADSAFE
|
||||
* and thread T1 is blocked in a call to apr_pollset_poll() for
|
||||
* this same pollset that is being modified via apr_pollset_add()
|
||||
* in thread T2, the currently executing apr_pollset_poll() call in
|
||||
* T1 will either: (1) automatically include the newly added descriptor
|
||||
* in the set of descriptors it is watching or (2) return immediately
|
||||
* with APR_EINTR. Option (1) is recommended, but option (2) is
|
||||
* allowed for implementations where option (1) is impossible
|
||||
* or impractical.
|
||||
* @remark If the pollset has been created with APR_POLLSET_NOCOPY, the
|
||||
* apr_pollfd_t structure referenced by descriptor will not be copied
|
||||
* and must have a lifetime at least as long as the pollset.
|
||||
* @remark Do not add the same socket or file descriptor to the same pollset
|
||||
* multiple times, even if the requested events differ for the
|
||||
* different calls to apr_pollset_add(). If the events of interest
|
||||
* for a descriptor change, you must first remove the descriptor
|
||||
* from the pollset with apr_pollset_remove(), then add it again
|
||||
* specifying all requested events.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_pollset_add(apr_pollset_t *pollset,
|
||||
const apr_pollfd_t *descriptor);
|
||||
|
||||
/**
|
||||
* Remove a descriptor from a pollset
|
||||
* @param pollset The pollset from which to remove the descriptor
|
||||
* @param descriptor The descriptor to remove
|
||||
* @remark If the descriptor is not found, APR_NOTFOUND is returned.
|
||||
* @remark If the pollset has been created with APR_POLLSET_THREADSAFE
|
||||
* and thread T1 is blocked in a call to apr_pollset_poll() for
|
||||
* this same pollset that is being modified via apr_pollset_remove()
|
||||
* in thread T2, the currently executing apr_pollset_poll() call in
|
||||
* T1 will either: (1) automatically exclude the newly added descriptor
|
||||
* in the set of descriptors it is watching or (2) return immediately
|
||||
* with APR_EINTR. Option (1) is recommended, but option (2) is
|
||||
* allowed for implementations where option (1) is impossible
|
||||
* or impractical.
|
||||
* @remark apr_pollset_remove() cannot be used to remove a subset of requested
|
||||
* events for a descriptor. The reqevents field in the apr_pollfd_t
|
||||
* parameter must contain the same value when removing as when adding.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_pollset_remove(apr_pollset_t *pollset,
|
||||
const apr_pollfd_t *descriptor);
|
||||
|
||||
/**
|
||||
* Block for activity on the descriptor(s) in a pollset
|
||||
* @param pollset The pollset to use
|
||||
* @param timeout The amount of time in microseconds to wait. This is a
|
||||
* maximum, not a minimum. If a descriptor is signalled, the
|
||||
* function will return before this time. If timeout is
|
||||
* negative, the function will block until a descriptor is
|
||||
* signalled or until apr_pollset_wakeup() has been called.
|
||||
* @param num Number of signalled descriptors (output parameter)
|
||||
* @param descriptors Array of signalled descriptors (output parameter)
|
||||
* @remark APR_EINTR will be returned if the pollset has been created with
|
||||
* APR_POLLSET_WAKEABLE, apr_pollset_wakeup() has been called while
|
||||
* waiting for activity, and there were no signalled descriptors at the
|
||||
* time of the wakeup call.
|
||||
* @remark Multiple signalled conditions for the same descriptor may be reported
|
||||
* in one or more returned apr_pollfd_t structures, depending on the
|
||||
* implementation.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_pollset_poll(apr_pollset_t *pollset,
|
||||
apr_interval_time_t timeout,
|
||||
apr_int32_t *num,
|
||||
const apr_pollfd_t **descriptors);
|
||||
|
||||
/**
|
||||
* Interrupt the blocked apr_pollset_poll() call.
|
||||
* @param pollset The pollset to use
|
||||
* @remark If the pollset was not created with APR_POLLSET_WAKEABLE the
|
||||
* return value is APR_EINIT.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_pollset_wakeup(apr_pollset_t *pollset);
|
||||
|
||||
/**
|
||||
* Poll the descriptors in the poll structure
|
||||
* @param aprset The poll structure we will be using.
|
||||
* @param numsock The number of descriptors we are polling
|
||||
* @param nsds The number of descriptors signalled (output parameter)
|
||||
* @param timeout The amount of time in microseconds to wait. This is a
|
||||
* maximum, not a minimum. If a descriptor is signalled, the
|
||||
* function will return before this time. If timeout is
|
||||
* negative, the function will block until a descriptor is
|
||||
* signalled or until apr_pollset_wakeup() has been called.
|
||||
* @remark The number of descriptors signalled is returned in the third argument.
|
||||
* This is a blocking call, and it will not return until either a
|
||||
* descriptor has been signalled or the timeout has expired.
|
||||
* @remark The rtnevents field in the apr_pollfd_t array will only be filled-
|
||||
* in if the return value is APR_SUCCESS.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_poll(apr_pollfd_t *aprset, apr_int32_t numsock,
|
||||
apr_int32_t *nsds,
|
||||
apr_interval_time_t timeout);
|
||||
|
||||
/**
|
||||
* Return a printable representation of the pollset method.
|
||||
* @param pollset The pollset to use
|
||||
*/
|
||||
APR_DECLARE(const char *) apr_pollset_method_name(apr_pollset_t *pollset);
|
||||
|
||||
/**
|
||||
* Return a printable representation of the default pollset method
|
||||
* (APR_POLLSET_DEFAULT).
|
||||
*/
|
||||
APR_DECLARE(const char *) apr_poll_method_defname(void);
|
||||
|
||||
/** Opaque structure used for pollcb API */
|
||||
typedef struct apr_pollcb_t apr_pollcb_t;
|
||||
|
||||
/**
|
||||
* Set up a pollcb object
|
||||
* @param pollcb The pointer in which to return the newly created object
|
||||
* @param size The maximum number of descriptors that a single _poll can return.
|
||||
* @param p The pool from which to allocate the pollcb
|
||||
* @param flags Optional flags to modify the operation of the pollcb.
|
||||
*
|
||||
* @remark If flags contains APR_POLLSET_WAKEABLE, then a pollcb is
|
||||
* created with an additional internal pipe object used for the
|
||||
* apr_pollcb_wakeup() call. The actual size of pollcb is
|
||||
* in that case @a size + 1.
|
||||
* @remark Pollcb is only supported on some platforms; the apr_pollcb_create()
|
||||
* call will fail with APR_ENOTIMPL on platforms where it is not supported.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_pollcb_create(apr_pollcb_t **pollcb,
|
||||
apr_uint32_t size,
|
||||
apr_pool_t *p,
|
||||
apr_uint32_t flags);
|
||||
|
||||
/**
|
||||
* Set up a pollcb object
|
||||
* @param pollcb The pointer in which to return the newly created object
|
||||
* @param size The maximum number of descriptors that a single _poll can return.
|
||||
* @param p The pool from which to allocate the pollcb
|
||||
* @param flags Optional flags to modify the operation of the pollcb.
|
||||
* @param method Poll method to use. See #apr_pollset_method_e. If this
|
||||
* method cannot be used, the default method will be used unless the
|
||||
* APR_POLLSET_NODEFAULT flag has been specified.
|
||||
*
|
||||
* @remark If flags contains APR_POLLSET_WAKEABLE, then a pollcb is
|
||||
* created with an additional internal pipe object used for the
|
||||
* apr_pollcb_wakeup() call. The actual size of pollcb is
|
||||
* in that case @a size + 1.
|
||||
* @remark Pollcb is only supported on some platforms; the apr_pollcb_create_ex()
|
||||
* call will fail with APR_ENOTIMPL on platforms where it is not supported.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_pollcb_create_ex(apr_pollcb_t **pollcb,
|
||||
apr_uint32_t size,
|
||||
apr_pool_t *p,
|
||||
apr_uint32_t flags,
|
||||
apr_pollset_method_e method);
|
||||
|
||||
/**
|
||||
* Add a socket or file descriptor to a pollcb
|
||||
* @param pollcb The pollcb to which to add the descriptor
|
||||
* @param descriptor The descriptor to add
|
||||
* @remark If you set client_data in the descriptor, that value will be
|
||||
* returned in the client_data field whenever this descriptor is
|
||||
* signalled in apr_pollcb_poll().
|
||||
* @remark Unlike the apr_pollset API, the descriptor is not copied, and users
|
||||
* must retain the memory used by descriptor, as the same pointer will
|
||||
* be returned to them from apr_pollcb_poll.
|
||||
* @remark Do not add the same socket or file descriptor to the same pollcb
|
||||
* multiple times, even if the requested events differ for the
|
||||
* different calls to apr_pollcb_add(). If the events of interest
|
||||
* for a descriptor change, you must first remove the descriptor
|
||||
* from the pollcb with apr_pollcb_remove(), then add it again
|
||||
* specifying all requested events.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_pollcb_add(apr_pollcb_t *pollcb,
|
||||
apr_pollfd_t *descriptor);
|
||||
/**
|
||||
* Remove a descriptor from a pollcb
|
||||
* @param pollcb The pollcb from which to remove the descriptor
|
||||
* @param descriptor The descriptor to remove
|
||||
* @remark If the descriptor is not found, APR_NOTFOUND is returned.
|
||||
* @remark apr_pollcb_remove() cannot be used to remove a subset of requested
|
||||
* events for a descriptor. The reqevents field in the apr_pollfd_t
|
||||
* parameter must contain the same value when removing as when adding.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_pollcb_remove(apr_pollcb_t *pollcb,
|
||||
apr_pollfd_t *descriptor);
|
||||
|
||||
/**
|
||||
* Function prototype for pollcb handlers
|
||||
* @param baton Opaque baton passed into apr_pollcb_poll()
|
||||
* @param descriptor Contains the notification for an active descriptor.
|
||||
* The @a rtnevents member describes which events were triggered
|
||||
* for this descriptor.
|
||||
* @remark If the pollcb handler does not return APR_SUCCESS, the apr_pollcb_poll()
|
||||
* call returns with the handler's return value.
|
||||
*/
|
||||
typedef apr_status_t (*apr_pollcb_cb_t)(void *baton, apr_pollfd_t *descriptor);
|
||||
|
||||
/**
|
||||
* Block for activity on the descriptor(s) in a pollcb
|
||||
* @param pollcb The pollcb to use
|
||||
* @param timeout The amount of time in microseconds to wait. This is a
|
||||
* maximum, not a minimum. If a descriptor is signalled, the
|
||||
* function will return before this time. If timeout is
|
||||
* negative, the function will block until a descriptor is
|
||||
* signalled or until apr_pollcb_wakeup() has been called.
|
||||
* @param func Callback function to call for each active descriptor.
|
||||
* @param baton Opaque baton passed to the callback function.
|
||||
* @remark Multiple signalled conditions for the same descriptor may be reported
|
||||
* in one or more calls to the callback function, depending on the
|
||||
* implementation.
|
||||
* @remark APR_EINTR will be returned if the pollset has been created with
|
||||
* APR_POLLSET_WAKEABLE and apr_pollcb_wakeup() has been called while
|
||||
* waiting for activity.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_pollcb_poll(apr_pollcb_t *pollcb,
|
||||
apr_interval_time_t timeout,
|
||||
apr_pollcb_cb_t func,
|
||||
void *baton);
|
||||
|
||||
/**
|
||||
* Interrupt the blocked apr_pollcb_poll() call.
|
||||
* @param pollcb The pollcb to use
|
||||
* @remark If the pollcb was not created with APR_POLLSET_WAKEABLE the
|
||||
* return value is APR_EINIT.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_pollcb_wakeup(apr_pollcb_t *pollcb);
|
||||
|
||||
/**
|
||||
* Return a printable representation of the pollcb method.
|
||||
* @param pollcb The pollcb to use
|
||||
*/
|
||||
APR_DECLARE(const char *) apr_pollcb_method_name(apr_pollcb_t *pollcb);
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ! APR_POLL_H */
|
||||
|
||||
815
database/apache/include/apr_pools.h
Normal file
815
database/apache/include/apr_pools.h
Normal file
@@ -0,0 +1,815 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_POOLS_H
|
||||
#define APR_POOLS_H
|
||||
|
||||
/**
|
||||
* @file apr_pools.h
|
||||
* @brief APR memory allocation
|
||||
*
|
||||
* Resource allocation routines...
|
||||
*
|
||||
* designed so that we don't have to keep track of EVERYTHING so that
|
||||
* it can be explicitly freed later (a fundamentally unsound strategy ---
|
||||
* particularly in the presence of die()).
|
||||
*
|
||||
* Instead, we maintain pools, and allocate items (both memory and I/O
|
||||
* handlers) from the pools --- currently there are two, one for
|
||||
* per-transaction info, and one for config info. When a transaction is
|
||||
* over, we can delete everything in the per-transaction apr_pool_t without
|
||||
* fear, and without thinking too hard about it either.
|
||||
*
|
||||
* Note that most operations on pools are not thread-safe: a single pool
|
||||
* should only be accessed by a single thread at any given time. The one
|
||||
* exception to this rule is creating a subpool of a given pool: one or more
|
||||
* threads can safely create subpools at the same time that another thread
|
||||
* accesses the parent pool.
|
||||
*/
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_errno.h"
|
||||
#include "apr_general.h" /* for APR_STRINGIFY */
|
||||
#define APR_WANT_MEMFUNC /**< for no good reason? */
|
||||
#include "apr_want.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup apr_pools Memory Pool Functions
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** The fundamental pool type */
|
||||
typedef struct apr_pool_t apr_pool_t;
|
||||
|
||||
|
||||
/**
|
||||
* Declaration helper macro to construct apr_foo_pool_get()s.
|
||||
*
|
||||
* This standardized macro is used by opaque (APR) data types to return
|
||||
* the apr_pool_t that is associated with the data type.
|
||||
*
|
||||
* APR_POOL_DECLARE_ACCESSOR() is used in a header file to declare the
|
||||
* accessor function. A typical usage and result would be:
|
||||
* <pre>
|
||||
* APR_POOL_DECLARE_ACCESSOR(file);
|
||||
* becomes:
|
||||
* APR_DECLARE(apr_pool_t *) apr_file_pool_get(const apr_file_t *thefile);
|
||||
* </pre>
|
||||
* @remark Doxygen unwraps this macro (via doxygen.conf) to provide
|
||||
* actual help for each specific occurrence of apr_foo_pool_get.
|
||||
* @remark the linkage is specified for APR. It would be possible to expand
|
||||
* the macros to support other linkages.
|
||||
*/
|
||||
#define APR_POOL_DECLARE_ACCESSOR(type) \
|
||||
APR_DECLARE(apr_pool_t *) apr_##type##_pool_get \
|
||||
(const apr_##type##_t *the##type)
|
||||
|
||||
/**
|
||||
* Implementation helper macro to provide apr_foo_pool_get()s.
|
||||
*
|
||||
* In the implementation, the APR_POOL_IMPLEMENT_ACCESSOR() is used to
|
||||
* actually define the function. It assumes the field is named "pool".
|
||||
*/
|
||||
#define APR_POOL_IMPLEMENT_ACCESSOR(type) \
|
||||
APR_DECLARE(apr_pool_t *) apr_##type##_pool_get \
|
||||
(const apr_##type##_t *the##type) \
|
||||
{ return the##type->pool; }
|
||||
|
||||
|
||||
/**
|
||||
* Pool debug levels
|
||||
*
|
||||
* <pre>
|
||||
* | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|
||||
* ---------------------------------
|
||||
* | | | | | | | | x | General debug code enabled (useful in
|
||||
* combination with --with-efence).
|
||||
*
|
||||
* | | | | | | | x | | Verbose output on stderr (report
|
||||
* CREATE, CLEAR, DESTROY).
|
||||
*
|
||||
* | | | | x | | | | | Verbose output on stderr (report
|
||||
* PALLOC, PCALLOC).
|
||||
*
|
||||
* | | | | | | x | | | Lifetime checking. On each use of a
|
||||
* pool, check its lifetime. If the pool
|
||||
* is out of scope, abort().
|
||||
* In combination with the verbose flag
|
||||
* above, it will output LIFE in such an
|
||||
* event prior to aborting.
|
||||
*
|
||||
* | | | | | x | | | | Pool owner checking. On each use of a
|
||||
* pool, check if the current thread is the
|
||||
* pool's owner. If not, abort(). In
|
||||
* combination with the verbose flag above,
|
||||
* it will output OWNER in such an event
|
||||
* prior to aborting. Use the debug
|
||||
* function apr_pool_owner_set() to switch
|
||||
* a pool's ownership.
|
||||
*
|
||||
* When no debug level was specified, assume general debug mode.
|
||||
* If level 0 was specified, debugging is switched off.
|
||||
* </pre>
|
||||
*/
|
||||
#if defined(APR_POOL_DEBUG)
|
||||
/* If APR_POOL_DEBUG is blank, we get 1; if it is a number, we get -1. */
|
||||
#if (APR_POOL_DEBUG - APR_POOL_DEBUG -1 == 1)
|
||||
#undef APR_POOL_DEBUG
|
||||
#define APR_POOL_DEBUG 1
|
||||
#endif
|
||||
#else
|
||||
#define APR_POOL_DEBUG 0
|
||||
#endif
|
||||
|
||||
/** the place in the code where the particular function was called */
|
||||
#define APR_POOL__FILE_LINE__ __FILE__ ":" APR_STRINGIFY(__LINE__)
|
||||
|
||||
|
||||
|
||||
/** A function that is called when allocation fails. */
|
||||
typedef int (*apr_abortfunc_t)(int retcode);
|
||||
|
||||
/*
|
||||
* APR memory structure manipulators (pools, tables, and arrays).
|
||||
*/
|
||||
|
||||
/*
|
||||
* Initialization
|
||||
*/
|
||||
|
||||
/**
|
||||
* Setup all of the internal structures required to use pools
|
||||
* @remark Programs do NOT need to call this directly. APR will call this
|
||||
* automatically from apr_initialize.
|
||||
* @internal
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_pool_initialize(void);
|
||||
|
||||
/**
|
||||
* Tear down all of the internal structures required to use pools
|
||||
* @remark Programs do NOT need to call this directly. APR will call this
|
||||
* automatically from apr_terminate.
|
||||
* @internal
|
||||
*/
|
||||
APR_DECLARE(void) apr_pool_terminate(void);
|
||||
|
||||
|
||||
/*
|
||||
* Pool creation/destruction
|
||||
*/
|
||||
|
||||
#include "apr_allocator.h"
|
||||
|
||||
/**
|
||||
* Create a new pool.
|
||||
* @param newpool The pool we have just created.
|
||||
* @param parent The parent pool. If this is NULL, the new pool is a root
|
||||
* pool. If it is non-NULL, the new pool will inherit all
|
||||
* of its parent pool's attributes, except the apr_pool_t will
|
||||
* be a sub-pool.
|
||||
* @param abort_fn A function to use if the pool cannot allocate more memory.
|
||||
* @param allocator The allocator to use with the new pool. If NULL the
|
||||
* allocator of the parent pool will be used.
|
||||
* @remark This function is thread-safe, in the sense that multiple threads
|
||||
* can safely create subpools of the same parent pool concurrently.
|
||||
* Similarly, a subpool can be created by one thread at the same
|
||||
* time that another thread accesses the parent pool.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_pool_create_ex(apr_pool_t **newpool,
|
||||
apr_pool_t *parent,
|
||||
apr_abortfunc_t abort_fn,
|
||||
apr_allocator_t *allocator)
|
||||
__attribute__((nonnull(1)));
|
||||
|
||||
/**
|
||||
* Create a new pool.
|
||||
* @deprecated @see apr_pool_create_unmanaged_ex.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_pool_create_core_ex(apr_pool_t **newpool,
|
||||
apr_abortfunc_t abort_fn,
|
||||
apr_allocator_t *allocator);
|
||||
|
||||
/**
|
||||
* Create a new unmanaged pool.
|
||||
* @param newpool The pool we have just created.
|
||||
* @param abort_fn A function to use if the pool cannot allocate more memory.
|
||||
* @param allocator The allocator to use with the new pool. If NULL a
|
||||
* new allocator will be created with the new pool as owner.
|
||||
* @remark An unmanaged pool is a special pool without a parent; it will
|
||||
* NOT be destroyed upon apr_terminate. It must be explicitly
|
||||
* destroyed by calling apr_pool_destroy, to prevent memory leaks.
|
||||
* Use of this function is discouraged, think twice about whether
|
||||
* you really really need it.
|
||||
* @warning Any child cleanups registered against the new pool, or
|
||||
* against sub-pools thereof, will not be executed during an
|
||||
* invocation of apr_proc_create(), so resources created in an
|
||||
* "unmanaged" pool hierarchy will leak to child processes.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_pool_create_unmanaged_ex(apr_pool_t **newpool,
|
||||
apr_abortfunc_t abort_fn,
|
||||
apr_allocator_t *allocator)
|
||||
__attribute__((nonnull(1)));
|
||||
|
||||
/**
|
||||
* Debug version of apr_pool_create_ex.
|
||||
* @param newpool @see apr_pool_create.
|
||||
* @param parent @see apr_pool_create.
|
||||
* @param abort_fn @see apr_pool_create.
|
||||
* @param allocator @see apr_pool_create.
|
||||
* @param file_line Where the function is called from.
|
||||
* This is usually APR_POOL__FILE_LINE__.
|
||||
* @remark Only available when APR_POOL_DEBUG is defined.
|
||||
* Call this directly if you have your apr_pool_create_ex
|
||||
* calls in a wrapper function and wish to override
|
||||
* the file_line argument to reflect the caller of
|
||||
* your wrapper function. If you do not have
|
||||
* apr_pool_create_ex in a wrapper, trust the macro
|
||||
* and don't call apr_pool_create_ex_debug directly.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_pool_create_ex_debug(apr_pool_t **newpool,
|
||||
apr_pool_t *parent,
|
||||
apr_abortfunc_t abort_fn,
|
||||
apr_allocator_t *allocator,
|
||||
const char *file_line)
|
||||
__attribute__((nonnull(1)));
|
||||
|
||||
#if APR_POOL_DEBUG
|
||||
#define apr_pool_create_ex(newpool, parent, abort_fn, allocator) \
|
||||
apr_pool_create_ex_debug(newpool, parent, abort_fn, allocator, \
|
||||
APR_POOL__FILE_LINE__)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Debug version of apr_pool_create_core_ex.
|
||||
* @deprecated @see apr_pool_create_unmanaged_ex_debug.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_pool_create_core_ex_debug(apr_pool_t **newpool,
|
||||
apr_abortfunc_t abort_fn,
|
||||
apr_allocator_t *allocator,
|
||||
const char *file_line);
|
||||
|
||||
/**
|
||||
* Debug version of apr_pool_create_unmanaged_ex.
|
||||
* @param newpool @see apr_pool_create_unmanaged.
|
||||
* @param abort_fn @see apr_pool_create_unmanaged.
|
||||
* @param allocator @see apr_pool_create_unmanaged.
|
||||
* @param file_line Where the function is called from.
|
||||
* This is usually APR_POOL__FILE_LINE__.
|
||||
* @remark Only available when APR_POOL_DEBUG is defined.
|
||||
* Call this directly if you have your apr_pool_create_unmanaged_ex
|
||||
* calls in a wrapper function and wish to override
|
||||
* the file_line argument to reflect the caller of
|
||||
* your wrapper function. If you do not have
|
||||
* apr_pool_create_core_ex in a wrapper, trust the macro
|
||||
* and don't call apr_pool_create_core_ex_debug directly.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_pool_create_unmanaged_ex_debug(apr_pool_t **newpool,
|
||||
apr_abortfunc_t abort_fn,
|
||||
apr_allocator_t *allocator,
|
||||
const char *file_line)
|
||||
__attribute__((nonnull(1)));
|
||||
|
||||
#if APR_POOL_DEBUG
|
||||
#define apr_pool_create_core_ex(newpool, abort_fn, allocator) \
|
||||
apr_pool_create_unmanaged_ex_debug(newpool, abort_fn, allocator, \
|
||||
APR_POOL__FILE_LINE__)
|
||||
|
||||
#define apr_pool_create_unmanaged_ex(newpool, abort_fn, allocator) \
|
||||
apr_pool_create_unmanaged_ex_debug(newpool, abort_fn, allocator, \
|
||||
APR_POOL__FILE_LINE__)
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Create a new pool.
|
||||
* @param newpool The pool we have just created.
|
||||
* @param parent The parent pool. If this is NULL, the new pool is a root
|
||||
* pool. If it is non-NULL, the new pool will inherit all
|
||||
* of its parent pool's attributes, except the apr_pool_t will
|
||||
* be a sub-pool.
|
||||
* @remark This function is thread-safe, in the sense that multiple threads
|
||||
* can safely create subpools of the same parent pool concurrently.
|
||||
* Similarly, a subpool can be created by one thread at the same
|
||||
* time that another thread accesses the parent pool.
|
||||
*/
|
||||
#if defined(DOXYGEN)
|
||||
APR_DECLARE(apr_status_t) apr_pool_create(apr_pool_t **newpool,
|
||||
apr_pool_t *parent);
|
||||
#else
|
||||
#if APR_POOL_DEBUG
|
||||
#define apr_pool_create(newpool, parent) \
|
||||
apr_pool_create_ex_debug(newpool, parent, NULL, NULL, \
|
||||
APR_POOL__FILE_LINE__)
|
||||
#else
|
||||
#define apr_pool_create(newpool, parent) \
|
||||
apr_pool_create_ex(newpool, parent, NULL, NULL)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Create a new unmanaged pool.
|
||||
* @param newpool The pool we have just created.
|
||||
*/
|
||||
#if defined(DOXYGEN)
|
||||
APR_DECLARE(apr_status_t) apr_pool_create_core(apr_pool_t **newpool);
|
||||
APR_DECLARE(apr_status_t) apr_pool_create_unmanaged(apr_pool_t **newpool);
|
||||
#else
|
||||
#if APR_POOL_DEBUG
|
||||
#define apr_pool_create_core(newpool) \
|
||||
apr_pool_create_unmanaged_ex_debug(newpool, NULL, NULL, \
|
||||
APR_POOL__FILE_LINE__)
|
||||
#define apr_pool_create_unmanaged(newpool) \
|
||||
apr_pool_create_unmanaged_ex_debug(newpool, NULL, NULL, \
|
||||
APR_POOL__FILE_LINE__)
|
||||
#else
|
||||
#define apr_pool_create_core(newpool) \
|
||||
apr_pool_create_unmanaged_ex(newpool, NULL, NULL)
|
||||
#define apr_pool_create_unmanaged(newpool) \
|
||||
apr_pool_create_unmanaged_ex(newpool, NULL, NULL)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Find the pool's allocator
|
||||
* @param pool The pool to get the allocator from.
|
||||
*/
|
||||
APR_DECLARE(apr_allocator_t *) apr_pool_allocator_get(apr_pool_t *pool)
|
||||
__attribute__((nonnull(1)));
|
||||
|
||||
/**
|
||||
* Clear all memory in the pool and run all the cleanups. This also destroys all
|
||||
* subpools.
|
||||
* @param p The pool to clear
|
||||
* @remark This does not actually free the memory, it just allows the pool
|
||||
* to re-use this memory for the next allocation.
|
||||
* @see apr_pool_destroy()
|
||||
*/
|
||||
APR_DECLARE(void) apr_pool_clear(apr_pool_t *p) __attribute__((nonnull(1)));
|
||||
|
||||
/**
|
||||
* Debug version of apr_pool_clear.
|
||||
* @param p See: apr_pool_clear.
|
||||
* @param file_line Where the function is called from.
|
||||
* This is usually APR_POOL__FILE_LINE__.
|
||||
* @remark Only available when APR_POOL_DEBUG is defined.
|
||||
* Call this directly if you have your apr_pool_clear
|
||||
* calls in a wrapper function and wish to override
|
||||
* the file_line argument to reflect the caller of
|
||||
* your wrapper function. If you do not have
|
||||
* apr_pool_clear in a wrapper, trust the macro
|
||||
* and don't call apr_pool_destroy_clear directly.
|
||||
*/
|
||||
APR_DECLARE(void) apr_pool_clear_debug(apr_pool_t *p,
|
||||
const char *file_line)
|
||||
__attribute__((nonnull(1)));
|
||||
|
||||
#if APR_POOL_DEBUG
|
||||
#define apr_pool_clear(p) \
|
||||
apr_pool_clear_debug(p, APR_POOL__FILE_LINE__)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Destroy the pool. This takes similar action as apr_pool_clear() and then
|
||||
* frees all the memory.
|
||||
* @param p The pool to destroy
|
||||
* @remark This will actually free the memory
|
||||
*/
|
||||
APR_DECLARE(void) apr_pool_destroy(apr_pool_t *p) __attribute__((nonnull(1)));
|
||||
|
||||
/**
|
||||
* Debug version of apr_pool_destroy.
|
||||
* @param p See: apr_pool_destroy.
|
||||
* @param file_line Where the function is called from.
|
||||
* This is usually APR_POOL__FILE_LINE__.
|
||||
* @remark Only available when APR_POOL_DEBUG is defined.
|
||||
* Call this directly if you have your apr_pool_destroy
|
||||
* calls in a wrapper function and wish to override
|
||||
* the file_line argument to reflect the caller of
|
||||
* your wrapper function. If you do not have
|
||||
* apr_pool_destroy in a wrapper, trust the macro
|
||||
* and don't call apr_pool_destroy_debug directly.
|
||||
*/
|
||||
APR_DECLARE(void) apr_pool_destroy_debug(apr_pool_t *p,
|
||||
const char *file_line)
|
||||
__attribute__((nonnull(1)));
|
||||
|
||||
#if APR_POOL_DEBUG
|
||||
#define apr_pool_destroy(p) \
|
||||
apr_pool_destroy_debug(p, APR_POOL__FILE_LINE__)
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Memory allocation
|
||||
*/
|
||||
|
||||
/**
|
||||
* Allocate a block of memory from a pool
|
||||
* @param p The pool to allocate from
|
||||
* @param size The amount of memory to allocate
|
||||
* @return The allocated memory
|
||||
*/
|
||||
APR_DECLARE(void *) apr_palloc(apr_pool_t *p, apr_size_t size)
|
||||
#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
|
||||
__attribute__((alloc_size(2)))
|
||||
#endif
|
||||
__attribute__((nonnull(1)));
|
||||
|
||||
/**
|
||||
* Debug version of apr_palloc
|
||||
* @param p See: apr_palloc
|
||||
* @param size See: apr_palloc
|
||||
* @param file_line Where the function is called from.
|
||||
* This is usually APR_POOL__FILE_LINE__.
|
||||
* @return See: apr_palloc
|
||||
*/
|
||||
APR_DECLARE(void *) apr_palloc_debug(apr_pool_t *p, apr_size_t size,
|
||||
const char *file_line)
|
||||
#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
|
||||
__attribute__((alloc_size(2)))
|
||||
#endif
|
||||
__attribute__((nonnull(1)));
|
||||
|
||||
#if APR_POOL_DEBUG
|
||||
#define apr_palloc(p, size) \
|
||||
apr_palloc_debug(p, size, APR_POOL__FILE_LINE__)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Allocate a block of memory from a pool and set all of the memory to 0
|
||||
* @param p The pool to allocate from
|
||||
* @param size The amount of memory to allocate
|
||||
* @return The allocated memory
|
||||
*/
|
||||
#if defined(DOXYGEN)
|
||||
APR_DECLARE(void *) apr_pcalloc(apr_pool_t *p, apr_size_t size);
|
||||
#elif !APR_POOL_DEBUG
|
||||
#define apr_pcalloc(p, size) memset(apr_palloc(p, size), 0, size)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Debug version of apr_pcalloc
|
||||
* @param p See: apr_pcalloc
|
||||
* @param size See: apr_pcalloc
|
||||
* @param file_line Where the function is called from.
|
||||
* This is usually APR_POOL__FILE_LINE__.
|
||||
* @return See: apr_pcalloc
|
||||
*/
|
||||
APR_DECLARE(void *) apr_pcalloc_debug(apr_pool_t *p, apr_size_t size,
|
||||
const char *file_line)
|
||||
__attribute__((nonnull(1)));
|
||||
|
||||
#if APR_POOL_DEBUG
|
||||
#define apr_pcalloc(p, size) \
|
||||
apr_pcalloc_debug(p, size, APR_POOL__FILE_LINE__)
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Pool Properties
|
||||
*/
|
||||
|
||||
/**
|
||||
* Set the function to be called when an allocation failure occurs.
|
||||
* @remark If the program wants APR to exit on a memory allocation error,
|
||||
* then this function can be called to set the callback to use (for
|
||||
* performing cleanup and then exiting). If this function is not called,
|
||||
* then APR will return an error and expect the calling program to
|
||||
* deal with the error accordingly.
|
||||
*/
|
||||
APR_DECLARE(void) apr_pool_abort_set(apr_abortfunc_t abortfunc,
|
||||
apr_pool_t *pool)
|
||||
__attribute__((nonnull(2)));
|
||||
|
||||
/**
|
||||
* Get the abort function associated with the specified pool.
|
||||
* @param pool The pool for retrieving the abort function.
|
||||
* @return The abort function for the given pool.
|
||||
*/
|
||||
APR_DECLARE(apr_abortfunc_t) apr_pool_abort_get(apr_pool_t *pool)
|
||||
__attribute__((nonnull(1)));
|
||||
|
||||
/**
|
||||
* Get the parent pool of the specified pool.
|
||||
* @param pool The pool for retrieving the parent pool.
|
||||
* @return The parent of the given pool.
|
||||
*/
|
||||
APR_DECLARE(apr_pool_t *) apr_pool_parent_get(apr_pool_t *pool)
|
||||
__attribute__((nonnull(1)));
|
||||
|
||||
/**
|
||||
* Determine if pool a is an ancestor of pool b.
|
||||
* @param a The pool to search
|
||||
* @param b The pool to search for
|
||||
* @return True if a is an ancestor of b, NULL is considered an ancestor
|
||||
* of all pools.
|
||||
* @remark if compiled with APR_POOL_DEBUG, this function will also
|
||||
* return true if A is a pool which has been guaranteed by the caller
|
||||
* (using apr_pool_join) to have a lifetime at least as long as some
|
||||
* ancestor of pool B.
|
||||
*/
|
||||
APR_DECLARE(int) apr_pool_is_ancestor(apr_pool_t *a, apr_pool_t *b);
|
||||
|
||||
/**
|
||||
* Tag a pool (give it a name)
|
||||
* @param pool The pool to tag
|
||||
* @param tag The tag
|
||||
*/
|
||||
APR_DECLARE(void) apr_pool_tag(apr_pool_t *pool, const char *tag)
|
||||
__attribute__((nonnull(1)));
|
||||
|
||||
|
||||
/*
|
||||
* User data management
|
||||
*/
|
||||
|
||||
/**
|
||||
* Set the data associated with the current pool
|
||||
* @param data The user data associated with the pool.
|
||||
* @param key The key to use for association
|
||||
* @param cleanup The cleanup program to use to cleanup the data (NULL if none)
|
||||
* @param pool The current pool
|
||||
* @warning The data to be attached to the pool should have a life span
|
||||
* at least as long as the pool it is being attached to.
|
||||
*
|
||||
* Users of APR must take EXTREME care when choosing a key to
|
||||
* use for their data. It is possible to accidentally overwrite
|
||||
* data by choosing a key that another part of the program is using.
|
||||
* Therefore it is advised that steps are taken to ensure that unique
|
||||
* keys are used for all of the userdata objects in a particular pool
|
||||
* (the same key in two different pools or a pool and one of its
|
||||
* subpools is okay) at all times. Careful namespace prefixing of
|
||||
* key names is a typical way to help ensure this uniqueness.
|
||||
*
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_pool_userdata_set(const void *data,
|
||||
const char *key,
|
||||
apr_status_t (*cleanup)(void *),
|
||||
apr_pool_t *pool)
|
||||
__attribute__((nonnull(2,4)));
|
||||
|
||||
/**
|
||||
* Set the data associated with the current pool
|
||||
* @param data The user data associated with the pool.
|
||||
* @param key The key to use for association
|
||||
* @param cleanup The cleanup program to use to cleanup the data (NULL if none)
|
||||
* @param pool The current pool
|
||||
* @note same as apr_pool_userdata_set(), except that this version doesn't
|
||||
* make a copy of the key (this function is useful, for example, when
|
||||
* the key is a string literal)
|
||||
* @warning This should NOT be used if the key could change addresses by
|
||||
* any means between the apr_pool_userdata_setn() call and a
|
||||
* subsequent apr_pool_userdata_get() on that key, such as if a
|
||||
* static string is used as a userdata key in a DSO and the DSO could
|
||||
* be unloaded and reloaded between the _setn() and the _get(). You
|
||||
* MUST use apr_pool_userdata_set() in such cases.
|
||||
* @warning More generally, the key and the data to be attached to the
|
||||
* pool should have a life span at least as long as the pool itself.
|
||||
*
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_pool_userdata_setn(
|
||||
const void *data, const char *key,
|
||||
apr_status_t (*cleanup)(void *),
|
||||
apr_pool_t *pool)
|
||||
__attribute__((nonnull(2,4)));
|
||||
|
||||
/**
|
||||
* Return the data associated with the current pool.
|
||||
* @param data The user data associated with the pool.
|
||||
* @param key The key for the data to retrieve
|
||||
* @param pool The current pool.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_pool_userdata_get(void **data, const char *key,
|
||||
apr_pool_t *pool)
|
||||
__attribute__((nonnull(1,2,3)));
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup PoolCleanup Pool Cleanup Functions
|
||||
*
|
||||
* Cleanups are performed in the reverse order they were registered. That is:
|
||||
* Last In, First Out. A cleanup function can safely allocate memory from
|
||||
* the pool that is being cleaned up. It can also safely register additional
|
||||
* cleanups which will be run LIFO, directly after the current cleanup
|
||||
* terminates. Cleanups have to take caution in calling functions that
|
||||
* create subpools. Subpools, created during cleanup will NOT automatically
|
||||
* be cleaned up. In other words, cleanups are to clean up after themselves.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Register a function to be called when a pool is cleared or destroyed
|
||||
* @param p The pool to register the cleanup with
|
||||
* @param data The data to pass to the cleanup function.
|
||||
* @param plain_cleanup The function to call when the pool is cleared
|
||||
* or destroyed
|
||||
* @param child_cleanup The function to call when a child process is about
|
||||
* to exec - this function is called in the child, obviously!
|
||||
*/
|
||||
APR_DECLARE(void) apr_pool_cleanup_register(
|
||||
apr_pool_t *p, const void *data,
|
||||
apr_status_t (*plain_cleanup)(void *),
|
||||
apr_status_t (*child_cleanup)(void *))
|
||||
__attribute__((nonnull(3,4)));
|
||||
|
||||
/**
|
||||
* Register a function to be called when a pool is cleared or destroyed.
|
||||
*
|
||||
* Unlike apr_pool_cleanup_register which registers a cleanup
|
||||
* that is called AFTER all subpools are destroyed, this function registers
|
||||
* a function that will be called before any of the subpools are destroyed.
|
||||
*
|
||||
* @param p The pool to register the cleanup with
|
||||
* @param data The data to pass to the cleanup function.
|
||||
* @param plain_cleanup The function to call when the pool is cleared
|
||||
* or destroyed
|
||||
*/
|
||||
APR_DECLARE(void) apr_pool_pre_cleanup_register(
|
||||
apr_pool_t *p, const void *data,
|
||||
apr_status_t (*plain_cleanup)(void *))
|
||||
__attribute__((nonnull(3)));
|
||||
|
||||
/**
|
||||
* Remove a previously registered cleanup function.
|
||||
*
|
||||
* The cleanup most recently registered with @a p having the same values of
|
||||
* @a data and @a cleanup will be removed.
|
||||
*
|
||||
* @param p The pool to remove the cleanup from
|
||||
* @param data The data of the registered cleanup
|
||||
* @param cleanup The function to remove from cleanup
|
||||
* @remarks For some strange reason only the plain_cleanup is handled by this
|
||||
* function
|
||||
*/
|
||||
APR_DECLARE(void) apr_pool_cleanup_kill(apr_pool_t *p, const void *data,
|
||||
apr_status_t (*cleanup)(void *))
|
||||
__attribute__((nonnull(3)));
|
||||
|
||||
/**
|
||||
* Replace the child cleanup function of a previously registered cleanup.
|
||||
*
|
||||
* The cleanup most recently registered with @a p having the same values of
|
||||
* @a data and @a plain_cleanup will have the registered child cleanup
|
||||
* function replaced with @a child_cleanup.
|
||||
*
|
||||
* @param p The pool of the registered cleanup
|
||||
* @param data The data of the registered cleanup
|
||||
* @param plain_cleanup The plain cleanup function of the registered cleanup
|
||||
* @param child_cleanup The function to register as the child cleanup
|
||||
*/
|
||||
APR_DECLARE(void) apr_pool_child_cleanup_set(
|
||||
apr_pool_t *p, const void *data,
|
||||
apr_status_t (*plain_cleanup)(void *),
|
||||
apr_status_t (*child_cleanup)(void *))
|
||||
__attribute__((nonnull(3,4)));
|
||||
|
||||
/**
|
||||
* Run the specified cleanup function immediately and unregister it.
|
||||
*
|
||||
* The cleanup most recently registered with @a p having the same values of
|
||||
* @a data and @a cleanup will be removed and @a cleanup will be called
|
||||
* with @a data as the argument.
|
||||
*
|
||||
* @param p The pool to remove the cleanup from
|
||||
* @param data The data to remove from cleanup
|
||||
* @param cleanup The function to remove from cleanup
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_pool_cleanup_run(apr_pool_t *p, void *data,
|
||||
apr_status_t (*cleanup)(void *))
|
||||
__attribute__((nonnull(3)));
|
||||
|
||||
/**
|
||||
* An empty cleanup function.
|
||||
*
|
||||
* Passed to apr_pool_cleanup_register() when no cleanup is required.
|
||||
*
|
||||
* @param data The data to cleanup, will not be used by this function.
|
||||
*/
|
||||
APR_DECLARE_NONSTD(apr_status_t) apr_pool_cleanup_null(void *data);
|
||||
|
||||
/**
|
||||
* Run all registered child cleanups, in preparation for an exec()
|
||||
* call in a forked child -- close files, etc., but *don't* flush I/O
|
||||
* buffers, *don't* wait for subprocesses, and *don't* free any
|
||||
* memory.
|
||||
*/
|
||||
APR_DECLARE(void) apr_pool_cleanup_for_exec(void);
|
||||
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @defgroup PoolDebug Pool Debugging functions
|
||||
*
|
||||
* pools have nested lifetimes -- sub_pools are destroyed when the
|
||||
* parent pool is cleared. We allow certain liberties with operations
|
||||
* on things such as tables (and on other structures in a more general
|
||||
* sense) where we allow the caller to insert values into a table which
|
||||
* were not allocated from the table's pool. The table's data will
|
||||
* remain valid as long as all the pools from which its values are
|
||||
* allocated remain valid.
|
||||
*
|
||||
* For example, if B is a sub pool of A, and you build a table T in
|
||||
* pool B, then it's safe to insert data allocated in A or B into T
|
||||
* (because B lives at most as long as A does, and T is destroyed when
|
||||
* B is cleared/destroyed). On the other hand, if S is a table in
|
||||
* pool A, it is safe to insert data allocated in A into S, but it
|
||||
* is *not safe* to insert data allocated from B into S... because
|
||||
* B can be cleared/destroyed before A is (which would leave dangling
|
||||
* pointers in T's data structures).
|
||||
*
|
||||
* In general we say that it is safe to insert data into a table T
|
||||
* if the data is allocated in any ancestor of T's pool. This is the
|
||||
* basis on which the APR_POOL_DEBUG code works -- it tests these ancestor
|
||||
* relationships for all data inserted into tables. APR_POOL_DEBUG also
|
||||
* provides tools (apr_pool_find, and apr_pool_is_ancestor) for other
|
||||
* folks to implement similar restrictions for their own data
|
||||
* structures.
|
||||
*
|
||||
* However, sometimes this ancestor requirement is inconvenient --
|
||||
* sometimes it's necessary to create a sub pool where the sub pool is
|
||||
* guaranteed to have the same lifetime as the parent pool. This is a
|
||||
* guarantee implemented by the *caller*, not by the pool code. That
|
||||
* is, the caller guarantees they won't destroy the sub pool
|
||||
* individually prior to destroying the parent pool.
|
||||
*
|
||||
* In this case the caller must call apr_pool_join() to indicate this
|
||||
* guarantee to the APR_POOL_DEBUG code.
|
||||
*
|
||||
* These functions are only implemented when #APR_POOL_DEBUG is set.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
#if APR_POOL_DEBUG || defined(DOXYGEN)
|
||||
/**
|
||||
* Guarantee that a subpool has the same lifetime as the parent.
|
||||
* @param p The parent pool
|
||||
* @param sub The subpool
|
||||
*/
|
||||
APR_DECLARE(void) apr_pool_join(apr_pool_t *p, apr_pool_t *sub)
|
||||
__attribute__((nonnull(2)));
|
||||
|
||||
/**
|
||||
* Find a pool from something allocated in it.
|
||||
* @param mem The thing allocated in the pool
|
||||
* @return The pool it is allocated in
|
||||
*/
|
||||
APR_DECLARE(apr_pool_t *) apr_pool_find(const void *mem);
|
||||
|
||||
/**
|
||||
* Report the number of bytes currently in the pool
|
||||
* @param p The pool to inspect
|
||||
* @param recurse Recurse/include the subpools' sizes
|
||||
* @return The number of bytes
|
||||
*/
|
||||
APR_DECLARE(apr_size_t) apr_pool_num_bytes(apr_pool_t *p, int recurse)
|
||||
__attribute__((nonnull(1)));
|
||||
|
||||
/**
|
||||
* Lock a pool
|
||||
* @param pool The pool to lock
|
||||
* @param flag The flag
|
||||
*/
|
||||
APR_DECLARE(void) apr_pool_lock(apr_pool_t *pool, int flag);
|
||||
|
||||
/** @} */
|
||||
|
||||
#else /* APR_POOL_DEBUG or DOXYGEN */
|
||||
|
||||
#ifdef apr_pool_join
|
||||
#undef apr_pool_join
|
||||
#endif
|
||||
#define apr_pool_join(a,b)
|
||||
|
||||
#ifdef apr_pool_lock
|
||||
#undef apr_pool_lock
|
||||
#endif
|
||||
#define apr_pool_lock(pool, lock)
|
||||
|
||||
#endif /* APR_POOL_DEBUG or DOXYGEN */
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !APR_POOLS_H */
|
||||
549
database/apache/include/apr_portable.h
Normal file
549
database/apache/include/apr_portable.h
Normal file
@@ -0,0 +1,549 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* This header file is where you should put ANY platform specific information.
|
||||
* This should be the only header file that programs need to include that
|
||||
* actually has platform dependent code which refers to the .
|
||||
*/
|
||||
#ifndef APR_PORTABLE_H
|
||||
#define APR_PORTABLE_H
|
||||
/**
|
||||
* @file apr_portable.h
|
||||
* @brief APR Portability Routines
|
||||
*/
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_pools.h"
|
||||
#include "apr_thread_proc.h"
|
||||
#include "apr_file_io.h"
|
||||
#include "apr_network_io.h"
|
||||
#include "apr_errno.h"
|
||||
#include "apr_global_mutex.h"
|
||||
#include "apr_proc_mutex.h"
|
||||
#include "apr_time.h"
|
||||
#include "apr_dso.h"
|
||||
#include "apr_shm.h"
|
||||
|
||||
#if APR_HAVE_DIRENT_H
|
||||
#include <dirent.h>
|
||||
#endif
|
||||
#if APR_HAVE_FCNTL_H
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
#if APR_HAVE_PTHREAD_H
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
#if APR_HAVE_SEMAPHORE_H
|
||||
#include <semaphore.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @defgroup apr_portabile Portability Routines
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifdef WIN32
|
||||
/* The primitives for Windows types */
|
||||
typedef HANDLE apr_os_file_t;
|
||||
typedef HANDLE apr_os_dir_t;
|
||||
typedef SOCKET apr_os_sock_t;
|
||||
typedef HANDLE apr_os_proc_mutex_t;
|
||||
typedef HANDLE apr_os_thread_t;
|
||||
typedef HANDLE apr_os_proc_t;
|
||||
typedef DWORD apr_os_threadkey_t;
|
||||
typedef FILETIME apr_os_imp_time_t;
|
||||
typedef SYSTEMTIME apr_os_exp_time_t;
|
||||
typedef HANDLE apr_os_dso_handle_t;
|
||||
typedef HANDLE apr_os_shm_t;
|
||||
|
||||
#elif defined(OS2)
|
||||
typedef HFILE apr_os_file_t;
|
||||
typedef HDIR apr_os_dir_t;
|
||||
typedef int apr_os_sock_t;
|
||||
typedef HMTX apr_os_proc_mutex_t;
|
||||
typedef TID apr_os_thread_t;
|
||||
typedef PID apr_os_proc_t;
|
||||
typedef PULONG apr_os_threadkey_t;
|
||||
typedef struct timeval apr_os_imp_time_t;
|
||||
typedef struct tm apr_os_exp_time_t;
|
||||
typedef HMODULE apr_os_dso_handle_t;
|
||||
typedef void* apr_os_shm_t;
|
||||
|
||||
#elif defined(__BEOS__)
|
||||
#include <kernel/OS.h>
|
||||
#include <kernel/image.h>
|
||||
|
||||
struct apr_os_proc_mutex_t {
|
||||
sem_id sem;
|
||||
int32 ben;
|
||||
};
|
||||
|
||||
typedef int apr_os_file_t;
|
||||
typedef DIR apr_os_dir_t;
|
||||
typedef int apr_os_sock_t;
|
||||
typedef struct apr_os_proc_mutex_t apr_os_proc_mutex_t;
|
||||
typedef thread_id apr_os_thread_t;
|
||||
typedef thread_id apr_os_proc_t;
|
||||
typedef int apr_os_threadkey_t;
|
||||
typedef struct timeval apr_os_imp_time_t;
|
||||
typedef struct tm apr_os_exp_time_t;
|
||||
typedef image_id apr_os_dso_handle_t;
|
||||
typedef void* apr_os_shm_t;
|
||||
|
||||
#elif defined(NETWARE)
|
||||
typedef int apr_os_file_t;
|
||||
typedef DIR apr_os_dir_t;
|
||||
typedef int apr_os_sock_t;
|
||||
typedef NXMutex_t apr_os_proc_mutex_t;
|
||||
typedef NXThreadId_t apr_os_thread_t;
|
||||
typedef long apr_os_proc_t;
|
||||
typedef NXKey_t apr_os_threadkey_t;
|
||||
typedef struct timeval apr_os_imp_time_t;
|
||||
typedef struct tm apr_os_exp_time_t;
|
||||
typedef void * apr_os_dso_handle_t;
|
||||
typedef void* apr_os_shm_t;
|
||||
|
||||
#else
|
||||
/* Any other OS should go above this one. This is the lowest common
|
||||
* denominator typedefs for all UNIX-like systems. :)
|
||||
*/
|
||||
|
||||
/** Basic OS process mutex structure. */
|
||||
struct apr_os_proc_mutex_t {
|
||||
#if APR_HAS_SYSVSEM_SERIALIZE || APR_HAS_FCNTL_SERIALIZE || APR_HAS_FLOCK_SERIALIZE
|
||||
/** Value used for SYS V Semaphore, FCNTL and FLOCK serialization */
|
||||
int crossproc;
|
||||
#endif
|
||||
#if APR_HAS_PROC_PTHREAD_SERIALIZE
|
||||
/** Value used for PTHREAD serialization */
|
||||
pthread_mutex_t *pthread_interproc;
|
||||
#endif
|
||||
#if APR_HAS_THREADS
|
||||
/* If no threads, no need for thread locks */
|
||||
#if APR_USE_PTHREAD_SERIALIZE
|
||||
/** This value is currently unused within APR and Apache */
|
||||
pthread_mutex_t *intraproc;
|
||||
#endif
|
||||
#endif
|
||||
#if APR_HAS_POSIXSEM_SERIALIZE
|
||||
/** Value used for POSIX semaphores serialization */
|
||||
sem_t *psem_interproc;
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef int apr_os_file_t; /**< native file */
|
||||
typedef DIR apr_os_dir_t; /**< native dir */
|
||||
typedef int apr_os_sock_t; /**< native dir */
|
||||
typedef struct apr_os_proc_mutex_t apr_os_proc_mutex_t; /**< native process
|
||||
* mutex
|
||||
*/
|
||||
#if APR_HAS_THREADS && APR_HAVE_PTHREAD_H
|
||||
typedef pthread_t apr_os_thread_t; /**< native thread */
|
||||
typedef pthread_key_t apr_os_threadkey_t; /**< native thread address
|
||||
* space */
|
||||
#endif
|
||||
typedef pid_t apr_os_proc_t; /**< native pid */
|
||||
typedef struct timeval apr_os_imp_time_t; /**< native timeval */
|
||||
typedef struct tm apr_os_exp_time_t; /**< native tm */
|
||||
/** @var apr_os_dso_handle_t
|
||||
* native dso types
|
||||
*/
|
||||
#if defined(HPUX) || defined(HPUX10) || defined(HPUX11)
|
||||
#include <dl.h>
|
||||
typedef shl_t apr_os_dso_handle_t;
|
||||
#elif defined(DARWIN)
|
||||
#include <mach-o/dyld.h>
|
||||
typedef NSModule apr_os_dso_handle_t;
|
||||
#else
|
||||
typedef void * apr_os_dso_handle_t;
|
||||
#endif
|
||||
typedef void* apr_os_shm_t; /**< native SHM */
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @typedef apr_os_sock_info_t
|
||||
* @brief alias for local OS socket
|
||||
*/
|
||||
/**
|
||||
* everything APR needs to know about an active socket to construct
|
||||
* an APR socket from it; currently, this is platform-independent
|
||||
*/
|
||||
struct apr_os_sock_info_t {
|
||||
apr_os_sock_t *os_sock; /**< always required */
|
||||
struct sockaddr *local; /**< NULL if not yet bound */
|
||||
struct sockaddr *remote; /**< NULL if not connected */
|
||||
int family; /**< always required (APR_INET, APR_INET6, etc.) */
|
||||
int type; /**< always required (SOCK_STREAM, SOCK_DGRAM, etc.) */
|
||||
int protocol; /**< 0 or actual protocol (APR_PROTO_SCTP, APR_PROTO_TCP, etc.) */
|
||||
};
|
||||
|
||||
typedef struct apr_os_sock_info_t apr_os_sock_info_t;
|
||||
|
||||
#if APR_PROC_MUTEX_IS_GLOBAL || defined(DOXYGEN)
|
||||
/** Opaque global mutex type */
|
||||
#define apr_os_global_mutex_t apr_os_proc_mutex_t
|
||||
/** @return apr_os_global_mutex */
|
||||
#define apr_os_global_mutex_get apr_os_proc_mutex_get
|
||||
#else
|
||||
/** Thread and process mutex for those platforms where process mutexes
|
||||
* are not held in threads.
|
||||
*/
|
||||
struct apr_os_global_mutex_t {
|
||||
apr_pool_t *pool;
|
||||
apr_proc_mutex_t *proc_mutex;
|
||||
#if APR_HAS_THREADS
|
||||
apr_thread_mutex_t *thread_mutex;
|
||||
#endif /* APR_HAS_THREADS */
|
||||
};
|
||||
typedef struct apr_os_global_mutex_t apr_os_global_mutex_t;
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_os_global_mutex_get(apr_os_global_mutex_t *ospmutex,
|
||||
apr_global_mutex_t *pmutex);
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* convert the file from apr type to os specific type.
|
||||
* @param thefile The os specific file we are converting to
|
||||
* @param file The apr file to convert.
|
||||
* @remark On Unix, it is only possible to get a file descriptor from
|
||||
* an apr file type.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_os_file_get(apr_os_file_t *thefile,
|
||||
apr_file_t *file);
|
||||
|
||||
/**
|
||||
* convert the dir from apr type to os specific type.
|
||||
* @param thedir The os specific dir we are converting to
|
||||
* @param dir The apr dir to convert.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_os_dir_get(apr_os_dir_t **thedir,
|
||||
apr_dir_t *dir);
|
||||
|
||||
/**
|
||||
* Convert the socket from an apr type to an OS specific socket
|
||||
* @param thesock The socket to convert.
|
||||
* @param sock The os specific equivalent of the apr socket..
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_os_sock_get(apr_os_sock_t *thesock,
|
||||
apr_socket_t *sock);
|
||||
|
||||
/**
|
||||
* Convert the proc mutex from apr type to os specific type
|
||||
* @param ospmutex The os specific proc mutex we are converting to.
|
||||
* @param pmutex The apr proc mutex to convert.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_os_proc_mutex_get(apr_os_proc_mutex_t *ospmutex,
|
||||
apr_proc_mutex_t *pmutex);
|
||||
|
||||
/**
|
||||
* Convert the proc mutex from apr type to os specific type, also
|
||||
* providing the mechanism used by the apr mutex.
|
||||
* @param ospmutex The os specific proc mutex we are converting to.
|
||||
* @param pmutex The apr proc mutex to convert.
|
||||
* @param mech The mechanism used by the apr proc mutex (if not NULL).
|
||||
* @remark Allows for disambiguation for platforms with multiple mechanisms
|
||||
* available.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_os_proc_mutex_get_ex(apr_os_proc_mutex_t *ospmutex,
|
||||
apr_proc_mutex_t *pmutex,
|
||||
apr_lockmech_e *mech);
|
||||
|
||||
/**
|
||||
* Get the exploded time in the platforms native format.
|
||||
* @param ostime the native time format
|
||||
* @param aprtime the time to convert
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_os_exp_time_get(apr_os_exp_time_t **ostime,
|
||||
apr_time_exp_t *aprtime);
|
||||
|
||||
/**
|
||||
* Get the imploded time in the platforms native format.
|
||||
* @param ostime the native time format
|
||||
* @param aprtime the time to convert
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_os_imp_time_get(apr_os_imp_time_t **ostime,
|
||||
apr_time_t *aprtime);
|
||||
|
||||
/**
|
||||
* convert the shm from apr type to os specific type.
|
||||
* @param osshm The os specific shm representation
|
||||
* @param shm The apr shm to convert.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_os_shm_get(apr_os_shm_t *osshm,
|
||||
apr_shm_t *shm);
|
||||
|
||||
#if APR_HAS_THREADS || defined(DOXYGEN)
|
||||
/**
|
||||
* @defgroup apr_os_thread Thread portability Routines
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* convert the thread to os specific type from apr type.
|
||||
* @param thethd The apr thread to convert
|
||||
* @param thd The os specific thread we are converting to
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_os_thread_get(apr_os_thread_t **thethd,
|
||||
apr_thread_t *thd);
|
||||
|
||||
/**
|
||||
* convert the thread private memory key to os specific type from an apr type.
|
||||
* @param thekey The apr handle we are converting from.
|
||||
* @param key The os specific handle we are converting to.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_os_threadkey_get(apr_os_threadkey_t *thekey,
|
||||
apr_threadkey_t *key);
|
||||
|
||||
/**
|
||||
* convert the thread from os specific type to apr type.
|
||||
* @param thd The apr thread we are converting to.
|
||||
* @param thethd The os specific thread to convert
|
||||
* @param cont The pool to use if it is needed.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_os_thread_put(apr_thread_t **thd,
|
||||
apr_os_thread_t *thethd,
|
||||
apr_pool_t *cont);
|
||||
|
||||
/**
|
||||
* convert the thread private memory key from os specific type to apr type.
|
||||
* @param key The apr handle we are converting to.
|
||||
* @param thekey The os specific handle to convert
|
||||
* @param cont The pool to use if it is needed.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_os_threadkey_put(apr_threadkey_t **key,
|
||||
apr_os_threadkey_t *thekey,
|
||||
apr_pool_t *cont);
|
||||
/**
|
||||
* Get the thread ID
|
||||
*/
|
||||
APR_DECLARE(apr_os_thread_t) apr_os_thread_current(void);
|
||||
|
||||
/**
|
||||
* Compare two thread id's
|
||||
* @param tid1 1st Thread ID to compare
|
||||
* @param tid2 2nd Thread ID to compare
|
||||
* @return non-zero if the two threads are equal, zero otherwise
|
||||
*/
|
||||
APR_DECLARE(int) apr_os_thread_equal(apr_os_thread_t tid1,
|
||||
apr_os_thread_t tid2);
|
||||
|
||||
/** @} */
|
||||
#endif /* APR_HAS_THREADS */
|
||||
|
||||
/**
|
||||
* convert the file from os specific type to apr type.
|
||||
* @param file The apr file we are converting to.
|
||||
* @param thefile The os specific file to convert
|
||||
* @param flags The flags that were used to open this file.
|
||||
* @param cont The pool to use if it is needed.
|
||||
* @remark On Unix, it is only possible to put a file descriptor into
|
||||
* an apr file type.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_os_file_put(apr_file_t **file,
|
||||
apr_os_file_t *thefile,
|
||||
apr_int32_t flags, apr_pool_t *cont);
|
||||
|
||||
/**
|
||||
* convert the file from os specific type to apr type.
|
||||
* @param file The apr file we are converting to.
|
||||
* @param thefile The os specific pipe to convert
|
||||
* @param cont The pool to use if it is needed.
|
||||
* @remark On Unix, it is only possible to put a file descriptor into
|
||||
* an apr file type.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_os_pipe_put(apr_file_t **file,
|
||||
apr_os_file_t *thefile,
|
||||
apr_pool_t *cont);
|
||||
|
||||
/**
|
||||
* convert the file from os specific type to apr type.
|
||||
* @param file The apr file we are converting to.
|
||||
* @param thefile The os specific pipe to convert
|
||||
* @param register_cleanup A cleanup will be registered on the apr_file_t
|
||||
* to issue apr_file_close().
|
||||
* @param cont The pool to use if it is needed.
|
||||
* @remark On Unix, it is only possible to put a file descriptor into
|
||||
* an apr file type.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_os_pipe_put_ex(apr_file_t **file,
|
||||
apr_os_file_t *thefile,
|
||||
int register_cleanup,
|
||||
apr_pool_t *cont);
|
||||
|
||||
/**
|
||||
* convert the dir from os specific type to apr type.
|
||||
* @param dir The apr dir we are converting to.
|
||||
* @param thedir The os specific dir to convert
|
||||
* @param cont The pool to use when creating to apr directory.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_os_dir_put(apr_dir_t **dir,
|
||||
apr_os_dir_t *thedir,
|
||||
apr_pool_t *cont);
|
||||
|
||||
/**
|
||||
* Convert a socket from the os specific type to the APR type. If
|
||||
* sock points to NULL, a socket will be created from the pool
|
||||
* provided. If **sock does not point to NULL, the structure pointed
|
||||
* to by sock will be reused and updated with the given socket.
|
||||
* @param sock The pool to use.
|
||||
* @param thesock The socket to convert to.
|
||||
* @param cont The socket we are converting to an apr type.
|
||||
* @remark If it is a true socket, it is best to call apr_os_sock_make()
|
||||
* and provide APR with more information about the socket.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_os_sock_put(apr_socket_t **sock,
|
||||
apr_os_sock_t *thesock,
|
||||
apr_pool_t *cont);
|
||||
|
||||
/**
|
||||
* Create a socket from an existing descriptor and local and remote
|
||||
* socket addresses.
|
||||
* @param apr_sock The new socket that has been set up
|
||||
* @param os_sock_info The os representation of the socket handle and
|
||||
* other characteristics of the socket
|
||||
* @param cont The pool to use
|
||||
* @remark If you only know the descriptor/handle or if it isn't really
|
||||
* a true socket, use apr_os_sock_put() instead.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_os_sock_make(apr_socket_t **apr_sock,
|
||||
apr_os_sock_info_t *os_sock_info,
|
||||
apr_pool_t *cont);
|
||||
|
||||
/**
|
||||
* Convert the proc mutex from os specific type to apr type
|
||||
* @param pmutex The apr proc mutex we are converting to.
|
||||
* @param ospmutex The os specific proc mutex to convert.
|
||||
* @param cont The pool to use if it is needed.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_os_proc_mutex_put(apr_proc_mutex_t **pmutex,
|
||||
apr_os_proc_mutex_t *ospmutex,
|
||||
apr_pool_t *cont);
|
||||
|
||||
/**
|
||||
* Convert the proc mutex from os specific type to apr type, using the
|
||||
* specified mechanism.
|
||||
* @param pmutex The apr proc mutex we are converting to.
|
||||
* @param ospmutex The os specific proc mutex to convert.
|
||||
* @param mech The apr mutex locking mechanism
|
||||
* @param register_cleanup Whether to destroy the os mutex with the apr
|
||||
* one (either on explicit destroy or pool cleanup).
|
||||
* @param cont The pool to use if it is needed.
|
||||
* @remark Allows for disambiguation for platforms with multiple mechanisms
|
||||
* available.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_os_proc_mutex_put_ex(apr_proc_mutex_t **pmutex,
|
||||
apr_os_proc_mutex_t *ospmutex,
|
||||
apr_lockmech_e mech,
|
||||
int register_cleanup,
|
||||
apr_pool_t *cont);
|
||||
|
||||
/**
|
||||
* Put the imploded time in the APR format.
|
||||
* @param aprtime the APR time format
|
||||
* @param ostime the time to convert
|
||||
* @param cont the pool to use if necessary
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_os_imp_time_put(apr_time_t *aprtime,
|
||||
apr_os_imp_time_t **ostime,
|
||||
apr_pool_t *cont);
|
||||
|
||||
/**
|
||||
* Put the exploded time in the APR format.
|
||||
* @param aprtime the APR time format
|
||||
* @param ostime the time to convert
|
||||
* @param cont the pool to use if necessary
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_os_exp_time_put(apr_time_exp_t *aprtime,
|
||||
apr_os_exp_time_t **ostime,
|
||||
apr_pool_t *cont);
|
||||
|
||||
/**
|
||||
* convert the shared memory from os specific type to apr type.
|
||||
* @param shm The apr shm representation of osshm
|
||||
* @param osshm The os specific shm identity
|
||||
* @param cont The pool to use if it is needed.
|
||||
* @remark On fork()ed architectures, this is typically nothing more than
|
||||
* the memory block mapped. On non-fork architectures, this is typically
|
||||
* some internal handle to pass the mapping from process to process.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_os_shm_put(apr_shm_t **shm,
|
||||
apr_os_shm_t *osshm,
|
||||
apr_pool_t *cont);
|
||||
|
||||
|
||||
#if APR_HAS_DSO || defined(DOXYGEN)
|
||||
/**
|
||||
* @defgroup apr_os_dso DSO (Dynamic Loading) Portability Routines
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* convert the dso handle from os specific to apr
|
||||
* @param dso The apr handle we are converting to
|
||||
* @param thedso the os specific handle to convert
|
||||
* @param pool the pool to use if it is needed
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_os_dso_handle_put(apr_dso_handle_t **dso,
|
||||
apr_os_dso_handle_t thedso,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* convert the apr dso handle into an os specific one
|
||||
* @param aprdso The apr dso handle to convert
|
||||
* @param dso The os specific dso to return
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_os_dso_handle_get(apr_os_dso_handle_t *dso,
|
||||
apr_dso_handle_t *aprdso);
|
||||
|
||||
/** @} */
|
||||
#endif /* APR_HAS_DSO */
|
||||
|
||||
|
||||
#if APR_HAS_OS_UUID
|
||||
/**
|
||||
* Private: apr-util's apr_uuid module when supported by the platform
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_os_uuid_get(unsigned char *uuid_data);
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* Get the name of the system default character set.
|
||||
* @param pool the pool to allocate the name from, if needed
|
||||
*/
|
||||
APR_DECLARE(const char*) apr_os_default_encoding(apr_pool_t *pool);
|
||||
|
||||
|
||||
/**
|
||||
* Get the name of the current locale character set.
|
||||
* @param pool the pool to allocate the name from, if needed
|
||||
* @remark Defers to apr_os_default_encoding() if the current locale's
|
||||
* data can't be retrieved on this system.
|
||||
*/
|
||||
APR_DECLARE(const char*) apr_os_locale_encoding(apr_pool_t *pool);
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ! APR_PORTABLE_H */
|
||||
192
database/apache/include/apr_proc_mutex.h
Normal file
192
database/apache/include/apr_proc_mutex.h
Normal file
@@ -0,0 +1,192 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_PROC_MUTEX_H
|
||||
#define APR_PROC_MUTEX_H
|
||||
|
||||
/**
|
||||
* @file apr_proc_mutex.h
|
||||
* @brief APR Process Locking Routines
|
||||
*/
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_pools.h"
|
||||
#include "apr_errno.h"
|
||||
#include "apr_perms_set.h"
|
||||
#include "apr_time.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @defgroup apr_proc_mutex Process Locking Routines
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Enumerated potential types for APR process locking methods
|
||||
* @warning Check APR_HAS_foo_SERIALIZE defines to see if the platform supports
|
||||
* APR_LOCK_foo. Only APR_LOCK_DEFAULT is portable.
|
||||
*/
|
||||
typedef enum {
|
||||
APR_LOCK_FCNTL, /**< fcntl() */
|
||||
APR_LOCK_FLOCK, /**< flock() */
|
||||
APR_LOCK_SYSVSEM, /**< System V Semaphores */
|
||||
APR_LOCK_PROC_PTHREAD, /**< POSIX pthread process-based locking */
|
||||
APR_LOCK_POSIXSEM, /**< POSIX semaphore process-based locking */
|
||||
APR_LOCK_DEFAULT, /**< Use the default process lock */
|
||||
APR_LOCK_DEFAULT_TIMED /**< Use the default process timed lock */
|
||||
} apr_lockmech_e;
|
||||
|
||||
/** Opaque structure representing a process mutex. */
|
||||
typedef struct apr_proc_mutex_t apr_proc_mutex_t;
|
||||
|
||||
/* Function definitions */
|
||||
|
||||
/**
|
||||
* Create and initialize a mutex that can be used to synchronize processes.
|
||||
* @param mutex the memory address where the newly created mutex will be
|
||||
* stored.
|
||||
* @param fname A file name to use if the lock mechanism requires one. This
|
||||
* argument should always be provided. The lock code itself will
|
||||
* determine if it should be used.
|
||||
* @param mech The mechanism to use for the interprocess lock, if any; one of
|
||||
* <PRE>
|
||||
* APR_LOCK_FCNTL
|
||||
* APR_LOCK_FLOCK
|
||||
* APR_LOCK_SYSVSEM
|
||||
* APR_LOCK_POSIXSEM
|
||||
* APR_LOCK_PROC_PTHREAD
|
||||
* APR_LOCK_DEFAULT pick the default mechanism for the platform
|
||||
* </PRE>
|
||||
* @param pool the pool from which to allocate the mutex.
|
||||
* @see apr_lockmech_e
|
||||
* @warning Check APR_HAS_foo_SERIALIZE defines to see if the platform supports
|
||||
* APR_LOCK_foo. Only APR_LOCK_DEFAULT is portable.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_proc_mutex_create(apr_proc_mutex_t **mutex,
|
||||
const char *fname,
|
||||
apr_lockmech_e mech,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Re-open a mutex in a child process.
|
||||
* @param mutex The newly re-opened mutex structure.
|
||||
* @param fname A file name to use if the mutex mechanism requires one. This
|
||||
* argument should always be provided. The mutex code itself will
|
||||
* determine if it should be used. This filename should be the
|
||||
* same one that was passed to apr_proc_mutex_create().
|
||||
* @param pool The pool to operate on.
|
||||
* @remark This function must be called to maintain portability, even
|
||||
* if the underlying lock mechanism does not require it.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_proc_mutex_child_init(apr_proc_mutex_t **mutex,
|
||||
const char *fname,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Acquire the lock for the given mutex. If the mutex is already locked,
|
||||
* the current thread will be put to sleep until the lock becomes available.
|
||||
* @param mutex the mutex on which to acquire the lock.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_proc_mutex_lock(apr_proc_mutex_t *mutex);
|
||||
|
||||
/**
|
||||
* Attempt to acquire the lock for the given mutex. If the mutex has already
|
||||
* been acquired, the call returns immediately with APR_EBUSY. Note: it
|
||||
* is important that the APR_STATUS_IS_EBUSY(s) macro be used to determine
|
||||
* if the return value was APR_EBUSY, for portability reasons.
|
||||
* @param mutex the mutex on which to attempt the lock acquiring.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_proc_mutex_trylock(apr_proc_mutex_t *mutex);
|
||||
|
||||
/**
|
||||
* Attempt to acquire the lock for the given mutex until timeout expires.
|
||||
* If the acquisition time outs, the call returns with APR_TIMEUP.
|
||||
* @param mutex the mutex on which to attempt the lock acquiring.
|
||||
* @param timeout the relative timeout (microseconds).
|
||||
* @note A negative or nul timeout means immediate attempt, returning
|
||||
* APR_TIMEUP without blocking if it the lock is already acquired.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_proc_mutex_timedlock(apr_proc_mutex_t *mutex,
|
||||
apr_interval_time_t timeout);
|
||||
|
||||
/**
|
||||
* Release the lock for the given mutex.
|
||||
* @param mutex the mutex from which to release the lock.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_proc_mutex_unlock(apr_proc_mutex_t *mutex);
|
||||
|
||||
/**
|
||||
* Destroy the mutex and free the memory associated with the lock.
|
||||
* @param mutex the mutex to destroy.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_proc_mutex_destroy(apr_proc_mutex_t *mutex);
|
||||
|
||||
/**
|
||||
* Destroy the mutex and free the memory associated with the lock.
|
||||
* @param mutex the mutex to destroy.
|
||||
* @note This function is generally used to kill a cleanup on an already
|
||||
* created mutex
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_proc_mutex_cleanup(void *mutex);
|
||||
|
||||
/**
|
||||
* Return the name of the lockfile for the mutex, or NULL
|
||||
* if the mutex doesn't use a lock file
|
||||
*/
|
||||
|
||||
APR_DECLARE(const char *) apr_proc_mutex_lockfile(apr_proc_mutex_t *mutex);
|
||||
|
||||
/**
|
||||
* Get the mechanism of the mutex, as it relates to the actual method
|
||||
* used for the underlying apr_proc_mutex_t.
|
||||
* @param mutex the mutex to get the mechanism from.
|
||||
*/
|
||||
APR_DECLARE(apr_lockmech_e) apr_proc_mutex_mech(apr_proc_mutex_t *mutex);
|
||||
|
||||
/**
|
||||
* Get the mechanism's name of the mutex, as it relates to the actual method
|
||||
* used for the underlying apr_proc_mutex_t.
|
||||
* @param mutex the mutex to get the mechanism's name from.
|
||||
*/
|
||||
APR_DECLARE(const char *) apr_proc_mutex_name(apr_proc_mutex_t *mutex);
|
||||
|
||||
/**
|
||||
* Display the name of the default mutex: APR_LOCK_DEFAULT
|
||||
*/
|
||||
APR_DECLARE(const char *) apr_proc_mutex_defname(void);
|
||||
|
||||
/**
|
||||
* Set mutex permissions.
|
||||
*/
|
||||
APR_PERMS_SET_IMPLEMENT(proc_mutex);
|
||||
|
||||
/**
|
||||
* Get the pool used by this proc_mutex.
|
||||
* @return apr_pool_t the pool
|
||||
*/
|
||||
APR_POOL_DECLARE_ACCESSOR(proc_mutex);
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ! APR_PROC_MUTEX_H */
|
||||
138
database/apache/include/apr_queue.h
Normal file
138
database/apache/include/apr_queue.h
Normal file
@@ -0,0 +1,138 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_QUEUE_H
|
||||
#define APR_QUEUE_H
|
||||
|
||||
/**
|
||||
* @file apr_queue.h
|
||||
* @brief Thread Safe FIFO bounded queue
|
||||
* @note Since most implementations of the queue are backed by a condition
|
||||
* variable implementation, it isn't available on systems without threads.
|
||||
* Although condition variables are sometimes available without threads.
|
||||
*/
|
||||
|
||||
#include "apu.h"
|
||||
#include "apr_errno.h"
|
||||
#include "apr_pools.h"
|
||||
|
||||
#if APR_HAS_THREADS
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @defgroup APR_Util_FIFO Thread Safe FIFO bounded queue
|
||||
* @ingroup APR_Util
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* opaque structure
|
||||
*/
|
||||
typedef struct apr_queue_t apr_queue_t;
|
||||
|
||||
/**
|
||||
* create a FIFO queue
|
||||
* @param queue The new queue
|
||||
* @param queue_capacity maximum size of the queue
|
||||
* @param a pool to allocate queue from
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_queue_create(apr_queue_t **queue,
|
||||
unsigned int queue_capacity,
|
||||
apr_pool_t *a);
|
||||
|
||||
/**
|
||||
* push/add an object to the queue, blocking if the queue is already full
|
||||
*
|
||||
* @param queue the queue
|
||||
* @param data the data
|
||||
* @returns APR_EINTR the blocking was interrupted (try again)
|
||||
* @returns APR_EOF the queue has been terminated
|
||||
* @returns APR_SUCCESS on a successful push
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_queue_push(apr_queue_t *queue, void *data);
|
||||
|
||||
/**
|
||||
* pop/get an object from the queue, blocking if the queue is already empty
|
||||
*
|
||||
* @param queue the queue
|
||||
* @param data the data
|
||||
* @returns APR_EINTR the blocking was interrupted (try again)
|
||||
* @returns APR_EOF if the queue has been terminated
|
||||
* @returns APR_SUCCESS on a successful pop
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_queue_pop(apr_queue_t *queue, void **data);
|
||||
|
||||
/**
|
||||
* push/add an object to the queue, returning immediately if the queue is full
|
||||
*
|
||||
* @param queue the queue
|
||||
* @param data the data
|
||||
* @returns APR_EINTR the blocking operation was interrupted (try again)
|
||||
* @returns APR_EAGAIN the queue is full
|
||||
* @returns APR_EOF the queue has been terminated
|
||||
* @returns APR_SUCCESS on a successful push
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_queue_trypush(apr_queue_t *queue, void *data);
|
||||
|
||||
/**
|
||||
* pop/get an object to the queue, returning immediately if the queue is empty
|
||||
*
|
||||
* @param queue the queue
|
||||
* @param data the data
|
||||
* @returns APR_EINTR the blocking operation was interrupted (try again)
|
||||
* @returns APR_EAGAIN the queue is empty
|
||||
* @returns APR_EOF the queue has been terminated
|
||||
* @returns APR_SUCCESS on a successful pop
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_queue_trypop(apr_queue_t *queue, void **data);
|
||||
|
||||
/**
|
||||
* returns the size of the queue.
|
||||
*
|
||||
* @warning this is not threadsafe, and is intended for reporting/monitoring
|
||||
* of the queue.
|
||||
* @param queue the queue
|
||||
* @returns the size of the queue
|
||||
*/
|
||||
APU_DECLARE(unsigned int) apr_queue_size(apr_queue_t *queue);
|
||||
|
||||
/**
|
||||
* interrupt all the threads blocking on this queue.
|
||||
*
|
||||
* @param queue the queue
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_queue_interrupt_all(apr_queue_t *queue);
|
||||
|
||||
/**
|
||||
* terminate the queue, sending an interrupt to all the
|
||||
* blocking threads
|
||||
*
|
||||
* @param queue the queue
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_queue_term(apr_queue_t *queue);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
#endif /* APR_HAS_THREADS */
|
||||
|
||||
#endif /* APRQUEUE_H */
|
||||
153
database/apache/include/apr_random.h
Normal file
153
database/apache/include/apr_random.h
Normal file
@@ -0,0 +1,153 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_RANDOM_H
|
||||
#define APR_RANDOM_H
|
||||
|
||||
/**
|
||||
* @file apr_random.h
|
||||
* @brief APR PRNG routines
|
||||
*/
|
||||
|
||||
#include "apr_pools.h"
|
||||
#include "apr_thread_proc.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @defgroup apr_random PRNG Routines
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
typedef struct apr_crypto_hash_t apr_crypto_hash_t;
|
||||
|
||||
typedef void apr_crypto_hash_init_t(apr_crypto_hash_t *hash);
|
||||
typedef void apr_crypto_hash_add_t(apr_crypto_hash_t *hash, const void *data,
|
||||
apr_size_t bytes);
|
||||
typedef void apr_crypto_hash_finish_t(apr_crypto_hash_t *hash,
|
||||
unsigned char *result);
|
||||
|
||||
|
||||
/* FIXME: make this opaque */
|
||||
struct apr_crypto_hash_t {
|
||||
apr_crypto_hash_init_t *init;
|
||||
apr_crypto_hash_add_t *add;
|
||||
apr_crypto_hash_finish_t *finish;
|
||||
apr_size_t size;
|
||||
void *data;
|
||||
};
|
||||
|
||||
/**
|
||||
* Allocate and initialize the SHA-256 context
|
||||
* @param p The pool to allocate from
|
||||
*/
|
||||
APR_DECLARE(apr_crypto_hash_t *) apr_crypto_sha256_new(apr_pool_t *p);
|
||||
|
||||
/** Opaque PRNG structure. */
|
||||
typedef struct apr_random_t apr_random_t;
|
||||
|
||||
/**
|
||||
* Initialize a PRNG state
|
||||
* @param g The PRNG state
|
||||
* @param p The pool to allocate from
|
||||
* @param pool_hash Pool hash functions
|
||||
* @param key_hash Key hash functions
|
||||
* @param prng_hash PRNG hash functions
|
||||
*/
|
||||
APR_DECLARE(void) apr_random_init(apr_random_t *g, apr_pool_t *p,
|
||||
apr_crypto_hash_t *pool_hash,
|
||||
apr_crypto_hash_t *key_hash,
|
||||
apr_crypto_hash_t *prng_hash);
|
||||
/**
|
||||
* Allocate and initialize (apr_crypto_sha256_new) a new PRNG state.
|
||||
* @param p The pool to allocate from
|
||||
*/
|
||||
APR_DECLARE(apr_random_t *) apr_random_standard_new(apr_pool_t *p);
|
||||
|
||||
/**
|
||||
* Mix the randomness pools.
|
||||
* @param g The PRNG state
|
||||
* @param entropy_ Entropy buffer
|
||||
* @param bytes Length of entropy_ in bytes
|
||||
*/
|
||||
APR_DECLARE(void) apr_random_add_entropy(apr_random_t *g,
|
||||
const void *entropy_,
|
||||
apr_size_t bytes);
|
||||
/**
|
||||
* Generate cryptographically insecure random bytes.
|
||||
* @param g The RNG state
|
||||
* @param random Buffer to fill with random bytes
|
||||
* @param bytes Length of buffer in bytes
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_random_insecure_bytes(apr_random_t *g,
|
||||
void *random,
|
||||
apr_size_t bytes);
|
||||
|
||||
/**
|
||||
* Generate cryptographically secure random bytes.
|
||||
* @param g The RNG state
|
||||
* @param random Buffer to fill with random bytes
|
||||
* @param bytes Length of buffer in bytes
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_random_secure_bytes(apr_random_t *g,
|
||||
void *random,
|
||||
apr_size_t bytes);
|
||||
/**
|
||||
* Ensures that E bits of conditional entropy are mixed into the PRNG
|
||||
* before any further randomness is extracted.
|
||||
* @param g The RNG state
|
||||
*/
|
||||
APR_DECLARE(void) apr_random_barrier(apr_random_t *g);
|
||||
|
||||
/**
|
||||
* Return APR_SUCCESS if the cryptographic PRNG has been seeded with
|
||||
* enough data, APR_ENOTENOUGHENTROPY otherwise.
|
||||
* @param r The RNG state
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_random_secure_ready(apr_random_t *r);
|
||||
|
||||
/**
|
||||
* Return APR_SUCCESS if the PRNG has been seeded with enough data,
|
||||
* APR_ENOTENOUGHENTROPY otherwise.
|
||||
* @param r The PRNG state
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_random_insecure_ready(apr_random_t *r);
|
||||
|
||||
/**
|
||||
* Mix the randomness pools after forking.
|
||||
* @param proc The resulting process handle from apr_proc_fork()
|
||||
* @remark Call this in the child after forking to mix the randomness
|
||||
* pools. Note that its generally a bad idea to fork a process with a
|
||||
* real PRNG in it - better to have the PRNG externally and get the
|
||||
* randomness from there. However, if you really must do it, then you
|
||||
* should supply all your entropy to all the PRNGs - don't worry, they
|
||||
* won't produce the same output.
|
||||
* @remark Note that apr_proc_fork() calls this for you, so only weird
|
||||
* applications need ever call it themselves.
|
||||
* @internal
|
||||
*/
|
||||
APR_DECLARE(void) apr_random_after_fork(apr_proc_t *proc);
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !APR_RANDOM_H */
|
||||
459
database/apache/include/apr_redis.h
Normal file
459
database/apache/include/apr_redis.h
Normal file
@@ -0,0 +1,459 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file apr_redis.h
|
||||
* @brief Client interface for redis
|
||||
* @remark To use this interface you must have a separate redis
|
||||
* for more information.
|
||||
*/
|
||||
|
||||
#ifndef APR_REDIS_H
|
||||
#define APR_REDIS_H
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_pools.h"
|
||||
#include "apr_time.h"
|
||||
#include "apr_strings.h"
|
||||
#include "apr_network_io.h"
|
||||
#include "apr_ring.h"
|
||||
#include "apr_buckets.h"
|
||||
#include "apr_reslist.h"
|
||||
#include "apr_hash.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#ifndef RC_DEFAULT_SERVER_PORT
|
||||
#define RC_DEFAULT_SERVER_PORT 6379
|
||||
#endif
|
||||
|
||||
#ifndef RC_DEFAULT_SERVER_MIN
|
||||
#define RC_DEFAULT_SERVER_MIN 0
|
||||
#endif
|
||||
|
||||
#ifndef RC_DEFAULT_SERVER_SMAX
|
||||
#define RC_DEFAULT_SERVER_SMAX 1
|
||||
#endif
|
||||
|
||||
#ifndef RC_DEFAULT_SERVER_TTL
|
||||
#define RC_DEFAULT_SERVER_TTL 600
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup APR_Util_RC Redis Client Routines
|
||||
* @ingroup APR_Util
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** Specifies the status of a redis server */
|
||||
typedef enum
|
||||
{
|
||||
APR_RC_SERVER_LIVE, /**< Server is alive and responding to requests */
|
||||
APR_RC_SERVER_DEAD /**< Server is not responding to requests */
|
||||
} apr_redis_server_status_t;
|
||||
|
||||
/** Opaque redis client connection object */
|
||||
typedef struct apr_redis_conn_t apr_redis_conn_t;
|
||||
|
||||
/** Redis Server Info Object */
|
||||
typedef struct apr_redis_server_t apr_redis_server_t;
|
||||
struct apr_redis_server_t
|
||||
{
|
||||
const char *host; /**< Hostname of this Server */
|
||||
apr_port_t port; /**< Port of this Server */
|
||||
apr_redis_server_status_t status; /**< @see apr_redis_server_status_t */
|
||||
#if APR_HAS_THREADS || defined(DOXYGEN)
|
||||
apr_reslist_t *conns; /**< Resource list of actual client connections */
|
||||
#else
|
||||
apr_redis_conn_t *conn;
|
||||
#endif
|
||||
apr_pool_t *p; /** Pool to use for private allocations */
|
||||
#if APR_HAS_THREADS
|
||||
apr_thread_mutex_t *lock;
|
||||
#endif
|
||||
apr_time_t btime;
|
||||
apr_uint32_t rwto;
|
||||
struct
|
||||
{
|
||||
int major;
|
||||
int minor;
|
||||
int patch;
|
||||
char *number;
|
||||
} version;
|
||||
};
|
||||
|
||||
typedef struct apr_redis_t apr_redis_t;
|
||||
|
||||
/* Custom hash callback function prototype, user for server selection.
|
||||
* @param baton user selected baton
|
||||
* @param data data to hash
|
||||
* @param data_len length of data
|
||||
*/
|
||||
typedef apr_uint32_t (*apr_redis_hash_func)(void *baton,
|
||||
const char *data,
|
||||
const apr_size_t data_len);
|
||||
/* Custom Server Select callback function prototype.
|
||||
* @param baton user selected baton
|
||||
* @param rc redis instance, use rc->live_servers to select a node
|
||||
* @param hash hash of the selected key.
|
||||
*/
|
||||
typedef apr_redis_server_t* (*apr_redis_server_func)(void *baton,
|
||||
apr_redis_t *rc,
|
||||
const apr_uint32_t hash);
|
||||
|
||||
/** Container for a set of redis servers */
|
||||
struct apr_redis_t
|
||||
{
|
||||
apr_uint32_t flags; /**< Flags, Not currently used */
|
||||
apr_uint16_t nalloc; /**< Number of Servers Allocated */
|
||||
apr_uint16_t ntotal; /**< Number of Servers Added */
|
||||
apr_redis_server_t **live_servers; /**< Array of Servers */
|
||||
apr_pool_t *p; /** Pool to use for allocations */
|
||||
void *hash_baton;
|
||||
apr_redis_hash_func hash_func;
|
||||
void *server_baton;
|
||||
apr_redis_server_func server_func;
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a crc32 hash used to split keys between servers
|
||||
* @param rc The redis client object to use
|
||||
* @param data Data to be hashed
|
||||
* @param data_len Length of the data to use
|
||||
* @return crc32 hash of data
|
||||
* @remark The crc32 hash is not compatible with old redisd clients.
|
||||
*/
|
||||
APU_DECLARE(apr_uint32_t) apr_redis_hash(apr_redis_t *rc,
|
||||
const char *data,
|
||||
const apr_size_t data_len);
|
||||
|
||||
/**
|
||||
* Pure CRC32 Hash. Used by some clients.
|
||||
*/
|
||||
APU_DECLARE(apr_uint32_t) apr_redis_hash_crc32(void *baton,
|
||||
const char *data,
|
||||
const apr_size_t data_len);
|
||||
|
||||
/**
|
||||
* hash compatible with the standard Perl Client.
|
||||
*/
|
||||
APU_DECLARE(apr_uint32_t) apr_redis_hash_default(void *baton,
|
||||
const char *data,
|
||||
const apr_size_t data_len);
|
||||
|
||||
/**
|
||||
* Picks a server based on a hash
|
||||
* @param rc The redis client object to use
|
||||
* @param hash Hashed value of a Key
|
||||
* @return server that controls specified hash
|
||||
* @see apr_redis_hash
|
||||
*/
|
||||
APU_DECLARE(apr_redis_server_t *) apr_redis_find_server_hash(apr_redis_t *rc,
|
||||
const apr_uint32_t hash);
|
||||
|
||||
/**
|
||||
* server selection compatible with the standard Perl Client.
|
||||
*/
|
||||
APU_DECLARE(apr_redis_server_t *) apr_redis_find_server_hash_default(void *baton,
|
||||
apr_redis_t *rc,
|
||||
const apr_uint32_t hash);
|
||||
|
||||
/**
|
||||
* Adds a server to a client object
|
||||
* @param rc The redis client object to use
|
||||
* @param server Server to add
|
||||
* @remark Adding servers is not thread safe, and should be done once at startup.
|
||||
* @warning Changing servers after startup may cause keys to go to
|
||||
* different servers.
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_redis_add_server(apr_redis_t *rc,
|
||||
apr_redis_server_t *server);
|
||||
|
||||
|
||||
/**
|
||||
* Finds a Server object based on a hostname/port pair
|
||||
* @param rc The redis client object to use
|
||||
* @param host Hostname of the server
|
||||
* @param port Port of the server
|
||||
* @return Server with matching Hostname and Port, or NULL if none was found.
|
||||
*/
|
||||
APU_DECLARE(apr_redis_server_t *) apr_redis_find_server(apr_redis_t *rc,
|
||||
const char *host,
|
||||
apr_port_t port);
|
||||
|
||||
/**
|
||||
* Enables a Server for use again
|
||||
* @param rc The redis client object to use
|
||||
* @param rs Server to Activate
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_redis_enable_server(apr_redis_t *rc,
|
||||
apr_redis_server_t *rs);
|
||||
|
||||
|
||||
/**
|
||||
* Disable a Server
|
||||
* @param rc The redis client object to use
|
||||
* @param rs Server to Disable
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_redis_disable_server(apr_redis_t *rc,
|
||||
apr_redis_server_t *rs);
|
||||
|
||||
/**
|
||||
* Creates a new Server Object
|
||||
* @param p Pool to use
|
||||
* @param host hostname of the server
|
||||
* @param port port of the server
|
||||
* @param min minimum number of client sockets to open
|
||||
* @param smax soft maximum number of client connections to open
|
||||
* @param max hard maximum number of client connections
|
||||
* @param ttl time to live in microseconds of a client connection
|
||||
* @param rwto r/w timeout value in seconds of a client connection
|
||||
* @param ns location of the new server object
|
||||
* @see apr_reslist_create
|
||||
* @remark min, smax, and max are only used when APR_HAS_THREADS
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_redis_server_create(apr_pool_t *p,
|
||||
const char *host,
|
||||
apr_port_t port,
|
||||
apr_uint32_t min,
|
||||
apr_uint32_t smax,
|
||||
apr_uint32_t max,
|
||||
apr_uint32_t ttl,
|
||||
apr_uint32_t rwto,
|
||||
apr_redis_server_t **ns);
|
||||
/**
|
||||
* Creates a new redisd client object
|
||||
* @param p Pool to use
|
||||
* @param max_servers maximum number of servers
|
||||
* @param flags Not currently used
|
||||
* @param rc location of the new redis client object
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_redis_create(apr_pool_t *p,
|
||||
apr_uint16_t max_servers,
|
||||
apr_uint32_t flags,
|
||||
apr_redis_t **rc);
|
||||
|
||||
/**
|
||||
* Gets a value from the server, allocating the value out of p
|
||||
* @param rc client to use
|
||||
* @param p Pool to use
|
||||
* @param key null terminated string containing the key
|
||||
* @param baton location of the allocated value
|
||||
* @param len length of data at baton
|
||||
* @param flags any flags set by the client for this key
|
||||
* @return
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_redis_getp(apr_redis_t *rc,
|
||||
apr_pool_t *p,
|
||||
const char* key,
|
||||
char **baton,
|
||||
apr_size_t *len,
|
||||
apr_uint16_t *flags);
|
||||
|
||||
/**
|
||||
* Sets a value by key on the server
|
||||
* @param rc client to use
|
||||
* @param key null terminated string containing the key
|
||||
* @param baton data to store on the server
|
||||
* @param data_size length of data at baton
|
||||
* @param flags any flags set by the client for this key
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_redis_set(apr_redis_t *rc,
|
||||
const char *key,
|
||||
char *baton,
|
||||
const apr_size_t data_size,
|
||||
apr_uint16_t flags);
|
||||
|
||||
/**
|
||||
* Sets a value by key on the server
|
||||
* @param rc client to use
|
||||
* @param key null terminated string containing the key
|
||||
* @param baton data to store on the server
|
||||
* @param data_size length of data at baton
|
||||
* @param timeout time in seconds for the data to live on the server
|
||||
* @param flags any flags set by the client for this key
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_redis_setex(apr_redis_t *rc,
|
||||
const char *key,
|
||||
char *baton,
|
||||
const apr_size_t data_size,
|
||||
apr_uint32_t timeout,
|
||||
apr_uint16_t flags);
|
||||
|
||||
/**
|
||||
* Deletes a key from a server
|
||||
* @param rc client to use
|
||||
* @param key null terminated string containing the key
|
||||
* @param timeout time for the delete to stop other clients from adding
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_redis_delete(apr_redis_t *rc,
|
||||
const char *key,
|
||||
apr_uint32_t timeout);
|
||||
|
||||
/**
|
||||
* Query a server's version
|
||||
* @param rs server to query
|
||||
* @param p Pool to allocate answer from
|
||||
* @param baton location to store server version string
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_redis_version(apr_redis_server_t *rs,
|
||||
apr_pool_t *p,
|
||||
char **baton);
|
||||
|
||||
/**
|
||||
* Query a server's INFO
|
||||
* @param rs server to query
|
||||
* @param p Pool to allocate answer from
|
||||
* @param baton location to store server INFO response string
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_redis_info(apr_redis_server_t *rs,
|
||||
apr_pool_t *p,
|
||||
char **baton);
|
||||
|
||||
/**
|
||||
* Increments a value
|
||||
* @param rc client to use
|
||||
* @param key null terminated string containing the key
|
||||
* @param inc number to increment by
|
||||
* @param new_value new value after incrementing
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_redis_incr(apr_redis_t *rc,
|
||||
const char *key,
|
||||
apr_int32_t inc,
|
||||
apr_uint32_t *new_value);
|
||||
/**
|
||||
* Decrements a value
|
||||
* @param rc client to use
|
||||
* @param key null terminated string containing the key
|
||||
* @param inc number to decrement by
|
||||
* @param new_value new value after decrementing
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_redis_decr(apr_redis_t *rc,
|
||||
const char *key,
|
||||
apr_int32_t inc,
|
||||
apr_uint32_t *new_value);
|
||||
|
||||
|
||||
/**
|
||||
* Pings the server
|
||||
* @param rs Server to ping
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_redis_ping(apr_redis_server_t *rs);
|
||||
|
||||
/**
|
||||
* Gets multiple values from the server, allocating the values out of p
|
||||
* @param rc client to use
|
||||
* @param temp_pool Pool used for temporary allocations. May be cleared inside this
|
||||
* call.
|
||||
* @param data_pool Pool used to allocate data for the returned values.
|
||||
* @param values hash of apr_redis_value_t keyed by strings, contains the
|
||||
* result of the multiget call.
|
||||
* @return
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_redis_multgetp(apr_redis_t *rc,
|
||||
apr_pool_t *temp_pool,
|
||||
apr_pool_t *data_pool,
|
||||
apr_hash_t *values);
|
||||
|
||||
typedef enum
|
||||
{
|
||||
APR_RS_SERVER_MASTER, /**< Server is a master */
|
||||
APR_RS_SERVER_SLAVE, /**< Server is a slave */
|
||||
APR_RS_SERVER_UNKNOWN /**< Server role is unknown */
|
||||
} apr_redis_server_role_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/* # Server */
|
||||
/** Major version number of this server */
|
||||
apr_uint32_t major;
|
||||
/** Minor version number of this server */
|
||||
apr_uint32_t minor;
|
||||
/** Patch version number of this server */
|
||||
apr_uint32_t patch;
|
||||
/** Process id of this server process */
|
||||
apr_uint32_t process_id;
|
||||
/** Number of seconds this server has been running */
|
||||
apr_uint32_t uptime_in_seconds;
|
||||
/** Bitsize of the arch on the current machine */
|
||||
apr_uint32_t arch_bits;
|
||||
|
||||
/* # Clients */
|
||||
/** Number of connected clients */
|
||||
apr_uint32_t connected_clients;
|
||||
/** Number of blocked clients */
|
||||
apr_uint32_t blocked_clients;
|
||||
|
||||
/* # Memory */
|
||||
/** Max memory of this server */
|
||||
apr_uint64_t maxmemory;
|
||||
/** Amount of used memory */
|
||||
apr_uint64_t used_memory;
|
||||
/** Total memory available on this server */
|
||||
apr_uint64_t total_system_memory;
|
||||
|
||||
/* # Stats */
|
||||
/** Total connections received */
|
||||
apr_uint64_t total_connections_received;
|
||||
/** Total commands processed */
|
||||
apr_uint64_t total_commands_processed;
|
||||
/** Total commands rejected */
|
||||
apr_uint64_t rejected_connections;
|
||||
/** Total net input bytes */
|
||||
apr_uint64_t total_net_input_bytes;
|
||||
/** Total net output bytes */
|
||||
apr_uint64_t total_net_output_bytes;
|
||||
/** Keyspace hits */
|
||||
apr_uint64_t keyspace_hits;
|
||||
/** Keyspace misses */
|
||||
apr_uint64_t keyspace_misses;
|
||||
|
||||
/* # Replication */
|
||||
/** Role */
|
||||
apr_redis_server_role_t role;
|
||||
/** Number of connected slave */
|
||||
apr_uint32_t connected_slaves;
|
||||
|
||||
/* # CPU */
|
||||
/** Accumulated CPU user time for this process */
|
||||
apr_uint32_t used_cpu_sys;
|
||||
/** Accumulated CPU system time for this process */
|
||||
apr_uint32_t used_cpu_user;
|
||||
|
||||
/* # Cluster */
|
||||
/** Is cluster enabled */
|
||||
apr_uint32_t cluster_enabled;
|
||||
} apr_redis_stats_t;
|
||||
|
||||
/**
|
||||
* Query a server for statistics
|
||||
* @param rs server to query
|
||||
* @param p Pool to allocate answer from
|
||||
* @param stats location of the new statistics structure
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_redis_stats(apr_redis_server_t *rs,
|
||||
apr_pool_t *p,
|
||||
apr_redis_stats_t **stats);
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* APR_REDIS_H */
|
||||
183
database/apache/include/apr_reslist.h
Normal file
183
database/apache/include/apr_reslist.h
Normal file
@@ -0,0 +1,183 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_RESLIST_H
|
||||
#define APR_RESLIST_H
|
||||
|
||||
/**
|
||||
* @file apr_reslist.h
|
||||
* @brief APR-UTIL Resource List Routines
|
||||
*/
|
||||
|
||||
#include "apr.h"
|
||||
#include "apu.h"
|
||||
#include "apr_pools.h"
|
||||
#include "apr_errno.h"
|
||||
#include "apr_time.h"
|
||||
|
||||
/**
|
||||
* @defgroup APR_Util_RL Resource List Routines
|
||||
* @ingroup APR_Util
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/** Opaque resource list object */
|
||||
typedef struct apr_reslist_t apr_reslist_t;
|
||||
|
||||
/* Generic constructor called by resource list when it needs to create a
|
||||
* resource.
|
||||
* @param resource opaque resource
|
||||
* @param params flags
|
||||
* @param pool Pool
|
||||
*/
|
||||
typedef apr_status_t (*apr_reslist_constructor)(void **resource, void *params,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/* Generic destructor called by resource list when it needs to destroy a
|
||||
* resource.
|
||||
* @param resource opaque resource
|
||||
* @param params flags
|
||||
* @param pool Pool
|
||||
*/
|
||||
typedef apr_status_t (*apr_reslist_destructor)(void *resource, void *params,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/* Cleanup order modes */
|
||||
#define APR_RESLIST_CLEANUP_DEFAULT 0 /**< default pool cleanup */
|
||||
#define APR_RESLIST_CLEANUP_FIRST 1 /**< use pool pre cleanup */
|
||||
|
||||
/**
|
||||
* Create a new resource list with the following parameters:
|
||||
* @param reslist An address where the pointer to the new resource
|
||||
* list will be stored.
|
||||
* @param min Allowed minimum number of available resources. Zero
|
||||
* creates new resources only when needed.
|
||||
* @param smax Resources will be destroyed during reslist maintenance to
|
||||
* meet this maximum restriction as they expire (reach their ttl).
|
||||
* @param hmax Absolute maximum limit on the number of total resources.
|
||||
* @param ttl If non-zero, sets the maximum amount of time in microseconds an
|
||||
* unused resource is valid. Any resource which has exceeded this
|
||||
* time will be destroyed, either when encountered by
|
||||
* apr_reslist_acquire() or during reslist maintenance.
|
||||
* @param con Constructor routine that is called to create a new resource.
|
||||
* @param de Destructor routine that is called to destroy an expired resource.
|
||||
* @param params Passed to constructor and deconstructor
|
||||
* @param pool The pool from which to create this resource list. Also the
|
||||
* same pool that is passed to the constructor and destructor
|
||||
* routines.
|
||||
* @remark If APR has been compiled without thread support, hmax will be
|
||||
* automatically set to 1 and values of min and smax will be forced to
|
||||
* 1 for any non-zero value.
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_reslist_create(apr_reslist_t **reslist,
|
||||
int min, int smax, int hmax,
|
||||
apr_interval_time_t ttl,
|
||||
apr_reslist_constructor con,
|
||||
apr_reslist_destructor de,
|
||||
void *params,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Destroy the given resource list and all resources controlled by
|
||||
* this list.
|
||||
* FIXME: Should this block until all resources become available,
|
||||
* or maybe just destroy all the free ones, or maybe destroy
|
||||
* them even though they might be in use by something else?
|
||||
* Currently it will abort if there are resources that haven't
|
||||
* been released, so there is an assumption that all resources
|
||||
* have been released to the list before calling this function.
|
||||
* @param reslist The reslist to destroy
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_reslist_destroy(apr_reslist_t *reslist);
|
||||
|
||||
/**
|
||||
* Retrieve a resource from the list, creating a new one if necessary.
|
||||
* If we have met our maximum number of resources, we will block
|
||||
* until one becomes available.
|
||||
* @param reslist The resource list.
|
||||
* @param resource An address where the pointer to the resource
|
||||
* will be stored.
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_reslist_acquire(apr_reslist_t *reslist,
|
||||
void **resource);
|
||||
|
||||
/**
|
||||
* Return a resource back to the list of available resources.
|
||||
* @param reslist The resource list.
|
||||
* @param resource The resource to return to the list.
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_reslist_release(apr_reslist_t *reslist,
|
||||
void *resource);
|
||||
|
||||
/**
|
||||
* Set the timeout the acquire will wait for a free resource
|
||||
* when the maximum number of resources is exceeded.
|
||||
* @param reslist The resource list.
|
||||
* @param timeout Timeout to wait. The zero waits forever.
|
||||
*/
|
||||
APU_DECLARE(void) apr_reslist_timeout_set(apr_reslist_t *reslist,
|
||||
apr_interval_time_t timeout);
|
||||
|
||||
/**
|
||||
* Return the number of outstanding resources.
|
||||
* @param reslist The resource list.
|
||||
*/
|
||||
APU_DECLARE(apr_uint32_t) apr_reslist_acquired_count(apr_reslist_t *reslist);
|
||||
|
||||
/**
|
||||
* Invalidate a resource in the pool - e.g. a database connection
|
||||
* that returns a "lost connection" error and can't be restored.
|
||||
* Use this instead of apr_reslist_release if the resource is bad.
|
||||
* @param reslist The resource list.
|
||||
* @param resource The resource to invalidate.
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_reslist_invalidate(apr_reslist_t *reslist,
|
||||
void *resource);
|
||||
|
||||
/**
|
||||
* Perform routine maintenance on the resource list. This call
|
||||
* may instantiate new resources or expire old resources.
|
||||
* @param reslist The resource list.
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_reslist_maintain(apr_reslist_t *reslist);
|
||||
|
||||
/**
|
||||
* Set reslist cleanup order.
|
||||
* @param reslist The resource list.
|
||||
* @param mode Cleanup order mode
|
||||
* <PRE>
|
||||
* APR_RESLIST_CLEANUP_DEFAULT default pool cleanup order
|
||||
* APR_RESLIST_CLEANUP_FIRST use pool pre cleanup
|
||||
* </PRE>
|
||||
* @remark If APR_RESLIST_CLEANUP_FIRST is used the destructors will
|
||||
* be called before child pools of the pool used to create the reslist
|
||||
* are destroyed. This allows to explicitly destroy the child pools
|
||||
* inside reslist destructors.
|
||||
*/
|
||||
APU_DECLARE(void) apr_reslist_cleanup_order_set(apr_reslist_t *reslist,
|
||||
apr_uint32_t mode);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
#endif /* ! APR_RESLIST_H */
|
||||
517
database/apache/include/apr_ring.h
Normal file
517
database/apache/include/apr_ring.h
Normal file
@@ -0,0 +1,517 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This code draws heavily from the 4.4BSD <sys/queue.h> macros
|
||||
* and Dean Gaudet's "splim/ring.h".
|
||||
* <http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/sys/queue.h>
|
||||
* <http://www.arctic.org/~dean/splim/>
|
||||
*
|
||||
* We'd use Dean's code directly if we could guarantee the
|
||||
* availability of inline functions.
|
||||
*/
|
||||
|
||||
#ifndef APR_RING_H
|
||||
#define APR_RING_H
|
||||
|
||||
/**
|
||||
* @file apr_ring.h
|
||||
* @brief APR Rings
|
||||
*/
|
||||
|
||||
/*
|
||||
* for offsetof()
|
||||
*/
|
||||
#include "apr_general.h"
|
||||
|
||||
/**
|
||||
* @defgroup apr_ring Ring Macro Implementations
|
||||
* @ingroup APR
|
||||
* A ring is a kind of doubly-linked list that can be manipulated
|
||||
* without knowing where its head is.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* The Ring Element
|
||||
*
|
||||
* A ring element struct is linked to the other elements in the ring
|
||||
* through its ring entry field, e.g.
|
||||
* <pre>
|
||||
* struct my_element_t {
|
||||
* APR_RING_ENTRY(my_element_t) link;
|
||||
* int foo;
|
||||
* char *bar;
|
||||
* };
|
||||
* </pre>
|
||||
*
|
||||
* An element struct may be put on more than one ring if it has more
|
||||
* than one APR_RING_ENTRY field. Each APR_RING_ENTRY has a corresponding
|
||||
* APR_RING_HEAD declaration.
|
||||
*
|
||||
* @warning For strict C standards compliance you should put the APR_RING_ENTRY
|
||||
* first in the element struct unless the head is always part of a larger
|
||||
* object with enough earlier fields to accommodate the offsetof() used
|
||||
* to compute the ring sentinel below. You can usually ignore this caveat.
|
||||
*/
|
||||
#define APR_RING_ENTRY(elem) \
|
||||
struct { \
|
||||
struct elem * volatile next; \
|
||||
struct elem * volatile prev; \
|
||||
}
|
||||
|
||||
/**
|
||||
* The Ring Head
|
||||
*
|
||||
* Each ring is managed via its head, which is a struct declared like this:
|
||||
* <pre>
|
||||
* APR_RING_HEAD(my_ring_t, my_element_t);
|
||||
* struct my_ring_t ring, *ringp;
|
||||
* </pre>
|
||||
*
|
||||
* This struct looks just like the element link struct so that we can
|
||||
* be sure that the typecasting games will work as expected.
|
||||
*
|
||||
* The first element in the ring is next after the head, and the last
|
||||
* element is just before the head.
|
||||
*/
|
||||
#define APR_RING_HEAD(head, elem) \
|
||||
struct head { \
|
||||
struct elem * volatile next; \
|
||||
struct elem * volatile prev; \
|
||||
}
|
||||
|
||||
/**
|
||||
* The Ring Sentinel
|
||||
*
|
||||
* This is the magic pointer value that occurs before the first and
|
||||
* after the last elements in the ring, computed from the address of
|
||||
* the ring's head. The head itself isn't an element, but in order to
|
||||
* get rid of all the special cases when dealing with the ends of the
|
||||
* ring, we play typecasting games to make it look like one.
|
||||
*
|
||||
* Here is a diagram to illustrate the arrangements of the next and
|
||||
* prev pointers of each element in a single ring. Note that they point
|
||||
* to the start of each element, not to the APR_RING_ENTRY structure.
|
||||
*
|
||||
* <pre>
|
||||
* +->+------+<-+ +->+------+<-+ +->+------+<-+
|
||||
* | |struct| | | |struct| | | |struct| |
|
||||
* / | elem | \/ | elem | \/ | elem | \
|
||||
* ... | | /\ | | /\ | | ...
|
||||
* +------+ | | +------+ | | +------+
|
||||
* ...--|prev | | +--|ring | | +--|prev |
|
||||
* | next|--+ | entry|--+ | next|--...
|
||||
* +------+ +------+ +------+
|
||||
* | etc. | | etc. | | etc. |
|
||||
* : : : : : :
|
||||
* </pre>
|
||||
*
|
||||
* The APR_RING_HEAD is nothing but a bare APR_RING_ENTRY. The prev
|
||||
* and next pointers in the first and last elements don't actually
|
||||
* point to the head, they point to a phantom place called the
|
||||
* sentinel. Its value is such that last->next->next == first because
|
||||
* the offset from the sentinel to the head's next pointer is the same
|
||||
* as the offset from the start of an element to its next pointer.
|
||||
* This also works in the opposite direction.
|
||||
*
|
||||
* <pre>
|
||||
* last first
|
||||
* +->+------+<-+ +->sentinel<-+ +->+------+<-+
|
||||
* | |struct| | | | | |struct| |
|
||||
* / | elem | \/ \/ | elem | \
|
||||
* ... | | /\ /\ | | ...
|
||||
* +------+ | | +------+ | | +------+
|
||||
* ...--|prev | | +--|ring | | +--|prev |
|
||||
* | next|--+ | head|--+ | next|--...
|
||||
* +------+ +------+ +------+
|
||||
* | etc. | | etc. |
|
||||
* : : : :
|
||||
* </pre>
|
||||
*
|
||||
* Note that the offset mentioned above is different for each kind of
|
||||
* ring that the element may be on, and each kind of ring has a unique
|
||||
* name for its APR_RING_ENTRY in each element, and has its own type
|
||||
* for its APR_RING_HEAD.
|
||||
*
|
||||
* Note also that if the offset is non-zero (which is required if an
|
||||
* element has more than one APR_RING_ENTRY), the unreality of the
|
||||
* sentinel may have bad implications on very perverse implementations
|
||||
* of C -- see the warning in APR_RING_ENTRY.
|
||||
*
|
||||
* @param hp The head of the ring
|
||||
* @param elem The name of the element struct
|
||||
* @param link The name of the APR_RING_ENTRY in the element struct
|
||||
*/
|
||||
#define APR_RING_SENTINEL(hp, elem, link) \
|
||||
(struct elem *)((char *)(&(hp)->next) - APR_OFFSETOF(struct elem, link))
|
||||
|
||||
/**
|
||||
* The first element of the ring
|
||||
* @param hp The head of the ring
|
||||
*/
|
||||
#define APR_RING_FIRST(hp) (hp)->next
|
||||
/**
|
||||
* The last element of the ring
|
||||
* @param hp The head of the ring
|
||||
*/
|
||||
#define APR_RING_LAST(hp) (hp)->prev
|
||||
/**
|
||||
* The next element in the ring
|
||||
* @param ep The current element
|
||||
* @param link The name of the APR_RING_ENTRY in the element struct
|
||||
*/
|
||||
#define APR_RING_NEXT(ep, link) (ep)->link.next
|
||||
/**
|
||||
* The previous element in the ring
|
||||
* @param ep The current element
|
||||
* @param link The name of the APR_RING_ENTRY in the element struct
|
||||
*/
|
||||
#define APR_RING_PREV(ep, link) (ep)->link.prev
|
||||
|
||||
|
||||
/**
|
||||
* Initialize a ring
|
||||
* @param hp The head of the ring
|
||||
* @param elem The name of the element struct
|
||||
* @param link The name of the APR_RING_ENTRY in the element struct
|
||||
*/
|
||||
#define APR_RING_INIT(hp, elem, link) do { \
|
||||
APR_RING_FIRST((hp)) = APR_RING_SENTINEL((hp), elem, link); \
|
||||
APR_RING_LAST((hp)) = APR_RING_SENTINEL((hp), elem, link); \
|
||||
} while (0)
|
||||
|
||||
/**
|
||||
* Determine if a ring is empty
|
||||
* @param hp The head of the ring
|
||||
* @param elem The name of the element struct
|
||||
* @param link The name of the APR_RING_ENTRY in the element struct
|
||||
* @return true or false
|
||||
*/
|
||||
#define APR_RING_EMPTY(hp, elem, link) \
|
||||
(APR_RING_FIRST((hp)) == APR_RING_SENTINEL((hp), elem, link))
|
||||
|
||||
/**
|
||||
* Initialize a singleton element
|
||||
* @param ep The element
|
||||
* @param link The name of the APR_RING_ENTRY in the element struct
|
||||
*/
|
||||
#define APR_RING_ELEM_INIT(ep, link) do { \
|
||||
APR_RING_NEXT((ep), link) = (ep); \
|
||||
APR_RING_PREV((ep), link) = (ep); \
|
||||
} while (0)
|
||||
|
||||
|
||||
/**
|
||||
* Splice the sequence ep1..epN into the ring before element lep
|
||||
* (..lep.. becomes ..ep1..epN..lep..)
|
||||
* @warning This doesn't work for splicing before the first element or on
|
||||
* empty rings... see APR_RING_SPLICE_HEAD for one that does
|
||||
* @param lep Element in the ring to splice before
|
||||
* @param ep1 First element in the sequence to splice in
|
||||
* @param epN Last element in the sequence to splice in
|
||||
* @param link The name of the APR_RING_ENTRY in the element struct
|
||||
*/
|
||||
#define APR_RING_SPLICE_BEFORE(lep, ep1, epN, link) do { \
|
||||
APR_RING_NEXT((epN), link) = (lep); \
|
||||
APR_RING_PREV((ep1), link) = APR_RING_PREV((lep), link); \
|
||||
APR_RING_NEXT(APR_RING_PREV((lep), link), link) = (ep1); \
|
||||
APR_RING_PREV((lep), link) = (epN); \
|
||||
} while (0)
|
||||
|
||||
/**
|
||||
* Splice the sequence ep1..epN into the ring after element lep
|
||||
* (..lep.. becomes ..lep..ep1..epN..)
|
||||
* @warning This doesn't work for splicing after the last element or on
|
||||
* empty rings... see APR_RING_SPLICE_TAIL for one that does
|
||||
* @param lep Element in the ring to splice after
|
||||
* @param ep1 First element in the sequence to splice in
|
||||
* @param epN Last element in the sequence to splice in
|
||||
* @param link The name of the APR_RING_ENTRY in the element struct
|
||||
*/
|
||||
#define APR_RING_SPLICE_AFTER(lep, ep1, epN, link) do { \
|
||||
APR_RING_PREV((ep1), link) = (lep); \
|
||||
APR_RING_NEXT((epN), link) = APR_RING_NEXT((lep), link); \
|
||||
APR_RING_PREV(APR_RING_NEXT((lep), link), link) = (epN); \
|
||||
APR_RING_NEXT((lep), link) = (ep1); \
|
||||
} while (0)
|
||||
|
||||
/**
|
||||
* Insert the element nep into the ring before element lep
|
||||
* (..lep.. becomes ..nep..lep..)
|
||||
* @warning This doesn't work for inserting before the first element or on
|
||||
* empty rings... see APR_RING_INSERT_HEAD for one that does
|
||||
* @param lep Element in the ring to insert before
|
||||
* @param nep Element to insert
|
||||
* @param link The name of the APR_RING_ENTRY in the element struct
|
||||
*/
|
||||
#define APR_RING_INSERT_BEFORE(lep, nep, link) \
|
||||
APR_RING_SPLICE_BEFORE((lep), (nep), (nep), link)
|
||||
|
||||
/**
|
||||
* Insert the element nep into the ring after element lep
|
||||
* (..lep.. becomes ..lep..nep..)
|
||||
* @warning This doesn't work for inserting after the last element or on
|
||||
* empty rings... see APR_RING_INSERT_TAIL for one that does
|
||||
* @param lep Element in the ring to insert after
|
||||
* @param nep Element to insert
|
||||
* @param link The name of the APR_RING_ENTRY in the element struct
|
||||
*/
|
||||
#define APR_RING_INSERT_AFTER(lep, nep, link) \
|
||||
APR_RING_SPLICE_AFTER((lep), (nep), (nep), link)
|
||||
|
||||
|
||||
/**
|
||||
* Splice the sequence ep1..epN into the ring before the first element
|
||||
* (..hp.. becomes ..hp..ep1..epN..)
|
||||
* @param hp Head of the ring
|
||||
* @param ep1 First element in the sequence to splice in
|
||||
* @param epN Last element in the sequence to splice in
|
||||
* @param elem The name of the element struct
|
||||
* @param link The name of the APR_RING_ENTRY in the element struct
|
||||
*/
|
||||
#define APR_RING_SPLICE_HEAD(hp, ep1, epN, elem, link) do { \
|
||||
APR_RING_PREV((ep1), link) = APR_RING_SENTINEL((hp), elem, link);\
|
||||
APR_RING_NEXT((epN), link) = APR_RING_FIRST((hp)); \
|
||||
APR_RING_PREV(APR_RING_FIRST((hp)), link) = (epN); \
|
||||
APR_RING_FIRST((hp)) = (ep1); \
|
||||
} while (0)
|
||||
|
||||
/**
|
||||
* Splice the sequence ep1..epN into the ring after the last element
|
||||
* (..hp.. becomes ..ep1..epN..hp..)
|
||||
* @param hp Head of the ring
|
||||
* @param ep1 First element in the sequence to splice in
|
||||
* @param epN Last element in the sequence to splice in
|
||||
* @param elem The name of the element struct
|
||||
* @param link The name of the APR_RING_ENTRY in the element struct
|
||||
*/
|
||||
#define APR_RING_SPLICE_TAIL(hp, ep1, epN, elem, link) do { \
|
||||
APR_RING_NEXT((epN), link) = APR_RING_SENTINEL((hp), elem, link);\
|
||||
APR_RING_PREV((ep1), link) = APR_RING_LAST((hp)); \
|
||||
APR_RING_NEXT(APR_RING_LAST((hp)), link) = (ep1); \
|
||||
APR_RING_LAST((hp)) = (epN); \
|
||||
} while (0)
|
||||
|
||||
/**
|
||||
* Insert the element nep into the ring before the first element
|
||||
* (..hp.. becomes ..hp..nep..)
|
||||
* @param hp Head of the ring
|
||||
* @param nep Element to insert
|
||||
* @param elem The name of the element struct
|
||||
* @param link The name of the APR_RING_ENTRY in the element struct
|
||||
*/
|
||||
#define APR_RING_INSERT_HEAD(hp, nep, elem, link) \
|
||||
APR_RING_SPLICE_HEAD((hp), (nep), (nep), elem, link)
|
||||
|
||||
/**
|
||||
* Insert the element nep into the ring after the last element
|
||||
* (..hp.. becomes ..nep..hp..)
|
||||
* @param hp Head of the ring
|
||||
* @param nep Element to insert
|
||||
* @param elem The name of the element struct
|
||||
* @param link The name of the APR_RING_ENTRY in the element struct
|
||||
*/
|
||||
#define APR_RING_INSERT_TAIL(hp, nep, elem, link) \
|
||||
APR_RING_SPLICE_TAIL((hp), (nep), (nep), elem, link)
|
||||
|
||||
/**
|
||||
* Concatenate ring h2 onto the end of ring h1, leaving h2 empty.
|
||||
* @param h1 Head of the ring to concatenate onto
|
||||
* @param h2 Head of the ring to concatenate
|
||||
* @param elem The name of the element struct
|
||||
* @param link The name of the APR_RING_ENTRY in the element struct
|
||||
*/
|
||||
#define APR_RING_CONCAT(h1, h2, elem, link) do { \
|
||||
if (!APR_RING_EMPTY((h2), elem, link)) { \
|
||||
APR_RING_SPLICE_TAIL((h1), APR_RING_FIRST((h2)), \
|
||||
APR_RING_LAST((h2)), elem, link); \
|
||||
APR_RING_INIT((h2), elem, link); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/**
|
||||
* Prepend ring h2 onto the beginning of ring h1, leaving h2 empty.
|
||||
* @param h1 Head of the ring to prepend onto
|
||||
* @param h2 Head of the ring to prepend
|
||||
* @param elem The name of the element struct
|
||||
* @param link The name of the APR_RING_ENTRY in the element struct
|
||||
*/
|
||||
#define APR_RING_PREPEND(h1, h2, elem, link) do { \
|
||||
if (!APR_RING_EMPTY((h2), elem, link)) { \
|
||||
APR_RING_SPLICE_HEAD((h1), APR_RING_FIRST((h2)), \
|
||||
APR_RING_LAST((h2)), elem, link); \
|
||||
APR_RING_INIT((h2), elem, link); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/**
|
||||
* Unsplice a sequence of elements from a ring
|
||||
* @warning The unspliced sequence is left with dangling pointers at either end
|
||||
* @param ep1 First element in the sequence to unsplice
|
||||
* @param epN Last element in the sequence to unsplice
|
||||
* @param link The name of the APR_RING_ENTRY in the element struct
|
||||
*/
|
||||
#define APR_RING_UNSPLICE(ep1, epN, link) do { \
|
||||
APR_RING_NEXT(APR_RING_PREV((ep1), link), link) = \
|
||||
APR_RING_NEXT((epN), link); \
|
||||
APR_RING_PREV(APR_RING_NEXT((epN), link), link) = \
|
||||
APR_RING_PREV((ep1), link); \
|
||||
} while (0)
|
||||
|
||||
/**
|
||||
* Remove a single element from a ring
|
||||
* @warning The unspliced element is left with dangling pointers at either end
|
||||
* @param ep Element to remove
|
||||
* @param link The name of the APR_RING_ENTRY in the element struct
|
||||
*/
|
||||
#define APR_RING_REMOVE(ep, link) \
|
||||
APR_RING_UNSPLICE((ep), (ep), link)
|
||||
|
||||
/**
|
||||
* Iterate over a ring
|
||||
* @param ep The current element
|
||||
* @param head The head of the ring
|
||||
* @param elem The name of the element struct
|
||||
* @param link The name of the APR_RING_ENTRY in the element struct
|
||||
*/
|
||||
#define APR_RING_FOREACH(ep, head, elem, link) \
|
||||
for (ep = APR_RING_FIRST(head); \
|
||||
ep != APR_RING_SENTINEL(head, elem, link); \
|
||||
ep = APR_RING_NEXT(ep, link))
|
||||
|
||||
/**
|
||||
* Iterate over a ring safe against removal of the current element
|
||||
* @param ep1 The current element
|
||||
* @param ep2 Iteration cursor
|
||||
* @param head The head of the ring
|
||||
* @param elem The name of the element struct
|
||||
* @param link The name of the APR_RING_ENTRY in the element struct
|
||||
*/
|
||||
#define APR_RING_FOREACH_SAFE(ep1, ep2, head, elem, link) \
|
||||
for (ep1 = APR_RING_FIRST(head), ep2 = APR_RING_NEXT(ep1, link); \
|
||||
ep1 != APR_RING_SENTINEL(head, elem, link); \
|
||||
ep1 = ep2, ep2 = APR_RING_NEXT(ep1, link))
|
||||
|
||||
/* Debugging tools: */
|
||||
|
||||
#ifdef APR_RING_DEBUG
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
|
||||
#define APR_RING_CHECK_ONE(msg, ptr) \
|
||||
fprintf(stderr, "*** %s %p\n", msg, ptr)
|
||||
|
||||
#define APR_RING_CHECK(hp, elem, link, msg) \
|
||||
APR_RING_CHECK_ELEM(APR_RING_SENTINEL(hp, elem, link), elem, link, msg)
|
||||
|
||||
#define APR_RING_CHECK_ELEM(ep, elem, link, msg) do { \
|
||||
struct elem *start = (ep); \
|
||||
struct elem *here = start; \
|
||||
fprintf(stderr, "*** ring check start -- %s\n", msg); \
|
||||
do { \
|
||||
fprintf(stderr, "\telem %p\n", here); \
|
||||
fprintf(stderr, "\telem->next %p\n", \
|
||||
APR_RING_NEXT(here, link)); \
|
||||
fprintf(stderr, "\telem->prev %p\n", \
|
||||
APR_RING_PREV(here, link)); \
|
||||
fprintf(stderr, "\telem->next->prev %p\n", \
|
||||
APR_RING_PREV(APR_RING_NEXT(here, link), link)); \
|
||||
fprintf(stderr, "\telem->prev->next %p\n", \
|
||||
APR_RING_NEXT(APR_RING_PREV(here, link), link)); \
|
||||
if (APR_RING_PREV(APR_RING_NEXT(here, link), link) != here) { \
|
||||
fprintf(stderr, "\t*** elem->next->prev != elem\n"); \
|
||||
break; \
|
||||
} \
|
||||
if (APR_RING_NEXT(APR_RING_PREV(here, link), link) != here) { \
|
||||
fprintf(stderr, "\t*** elem->prev->next != elem\n"); \
|
||||
break; \
|
||||
} \
|
||||
here = APR_RING_NEXT(here, link); \
|
||||
} while (here != start); \
|
||||
fprintf(stderr, "*** ring check end\n"); \
|
||||
} while (0)
|
||||
|
||||
#define APR_RING_CHECK_CONSISTENCY(hp, elem, link) \
|
||||
APR_RING_CHECK_ELEM_CONSISTENCY(APR_RING_SENTINEL(hp, elem, link),\
|
||||
elem, link)
|
||||
|
||||
#define APR_RING_CHECK_ELEM_CONSISTENCY(ep, elem, link) do { \
|
||||
struct elem *start = (ep); \
|
||||
struct elem *here = start; \
|
||||
do { \
|
||||
assert(APR_RING_PREV(APR_RING_NEXT(here, link), link) == here); \
|
||||
assert(APR_RING_NEXT(APR_RING_PREV(here, link), link) == here); \
|
||||
here = APR_RING_NEXT(here, link); \
|
||||
} while (here != start); \
|
||||
} while (0)
|
||||
|
||||
#else
|
||||
/**
|
||||
* Print a single pointer value to STDERR
|
||||
* (This is a no-op unless APR_RING_DEBUG is defined.)
|
||||
* @param msg Descriptive message
|
||||
* @param ptr Pointer value to print
|
||||
*/
|
||||
#define APR_RING_CHECK_ONE(msg, ptr)
|
||||
/**
|
||||
* Dump all ring pointers to STDERR, starting with the head and looping all
|
||||
* the way around the ring back to the head. Aborts if an inconsistency
|
||||
* is found.
|
||||
* (This is a no-op unless APR_RING_DEBUG is defined.)
|
||||
* @param hp Head of the ring
|
||||
* @param elem The name of the element struct
|
||||
* @param link The name of the APR_RING_ENTRY in the element struct
|
||||
* @param msg Descriptive message
|
||||
*/
|
||||
#define APR_RING_CHECK(hp, elem, link, msg)
|
||||
/**
|
||||
* Loops around a ring and checks all the pointers for consistency. Pops
|
||||
* an assertion if any inconsistency is found. Same idea as APR_RING_CHECK()
|
||||
* except that it's silent if all is well.
|
||||
* (This is a no-op unless APR_RING_DEBUG is defined.)
|
||||
* @param hp Head of the ring
|
||||
* @param elem The name of the element struct
|
||||
* @param link The name of the APR_RING_ENTRY in the element struct
|
||||
*/
|
||||
#define APR_RING_CHECK_CONSISTENCY(hp, elem, link)
|
||||
/**
|
||||
* Dump all ring pointers to STDERR, starting with the given element and
|
||||
* looping all the way around the ring back to that element. Aborts if
|
||||
* an inconsistency is found.
|
||||
* (This is a no-op unless APR_RING_DEBUG is defined.)
|
||||
* @param ep The element
|
||||
* @param elem The name of the element struct
|
||||
* @param link The name of the APR_RING_ENTRY in the element struct
|
||||
* @param msg Descriptive message
|
||||
*/
|
||||
#define APR_RING_CHECK_ELEM(ep, elem, link, msg)
|
||||
/**
|
||||
* Loops around a ring, starting with the given element, and checks all
|
||||
* the pointers for consistency. Pops an assertion if any inconsistency
|
||||
* is found. Same idea as APR_RING_CHECK_ELEM() except that it's silent
|
||||
* if all is well.
|
||||
* (This is a no-op unless APR_RING_DEBUG is defined.)
|
||||
* @param ep The element
|
||||
* @param elem The name of the element struct
|
||||
* @param link The name of the APR_RING_ENTRY in the element struct
|
||||
*/
|
||||
#define APR_RING_CHECK_ELEM_CONSISTENCY(ep, elem, link)
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
#endif /* !APR_RING_H */
|
||||
137
database/apache/include/apr_rmm.h
Normal file
137
database/apache/include/apr_rmm.h
Normal file
@@ -0,0 +1,137 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_RMM_H
|
||||
#define APR_RMM_H
|
||||
/**
|
||||
* @file apr_rmm.h
|
||||
* @brief APR-UTIL Relocatable Memory Management Routines
|
||||
*/
|
||||
/**
|
||||
* @defgroup APR_Util_RMM Relocatable Memory Management Routines
|
||||
* @ingroup APR_Util
|
||||
* @{
|
||||
*/
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_pools.h"
|
||||
#include "apr_errno.h"
|
||||
#include "apu.h"
|
||||
#include "apr_anylock.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/** Structure to access Relocatable, Managed Memory */
|
||||
typedef struct apr_rmm_t apr_rmm_t;
|
||||
|
||||
/** Fundamental allocation unit, within a specific apr_rmm_t */
|
||||
typedef apr_size_t apr_rmm_off_t;
|
||||
|
||||
/**
|
||||
* Initialize a relocatable memory block to be managed by the apr_rmm API.
|
||||
* @param rmm The relocatable memory block
|
||||
* @param lock An apr_anylock_t of the appropriate type of lock, or NULL
|
||||
* if no locking is required.
|
||||
* @param membuf The block of relocatable memory to be managed
|
||||
* @param memsize The size of relocatable memory block to be managed
|
||||
* @param cont The pool to use for local storage and management
|
||||
* @remark Both @param membuf and @param memsize must be aligned
|
||||
* (for instance using APR_ALIGN_DEFAULT).
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_rmm_init(apr_rmm_t **rmm, apr_anylock_t *lock,
|
||||
void *membuf, apr_size_t memsize,
|
||||
apr_pool_t *cont);
|
||||
|
||||
/**
|
||||
* Destroy a managed memory block.
|
||||
* @param rmm The relocatable memory block to destroy
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_rmm_destroy(apr_rmm_t *rmm);
|
||||
|
||||
/**
|
||||
* Attach to a relocatable memory block already managed by the apr_rmm API.
|
||||
* @param rmm The relocatable memory block
|
||||
* @param lock An apr_anylock_t of the appropriate type of lock
|
||||
* @param membuf The block of relocatable memory already under management
|
||||
* @param cont The pool to use for local storage and management
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_rmm_attach(apr_rmm_t **rmm, apr_anylock_t *lock,
|
||||
void *membuf, apr_pool_t *cont);
|
||||
|
||||
/**
|
||||
* Detach from the managed block of memory.
|
||||
* @param rmm The relocatable memory block to detach from
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_rmm_detach(apr_rmm_t *rmm);
|
||||
|
||||
/**
|
||||
* Allocate memory from the block of relocatable memory.
|
||||
* @param rmm The relocatable memory block
|
||||
* @param reqsize How much memory to allocate
|
||||
*/
|
||||
APU_DECLARE(apr_rmm_off_t) apr_rmm_malloc(apr_rmm_t *rmm, apr_size_t reqsize);
|
||||
|
||||
/**
|
||||
* Realloc memory from the block of relocatable memory.
|
||||
* @param rmm The relocatable memory block
|
||||
* @param entity The memory allocation to realloc
|
||||
* @param reqsize The new size
|
||||
*/
|
||||
APU_DECLARE(apr_rmm_off_t) apr_rmm_realloc(apr_rmm_t *rmm, void *entity, apr_size_t reqsize);
|
||||
|
||||
/**
|
||||
* Allocate memory from the block of relocatable memory and initialize it to zero.
|
||||
* @param rmm The relocatable memory block
|
||||
* @param reqsize How much memory to allocate
|
||||
*/
|
||||
APU_DECLARE(apr_rmm_off_t) apr_rmm_calloc(apr_rmm_t *rmm, apr_size_t reqsize);
|
||||
|
||||
/**
|
||||
* Free allocation returned by apr_rmm_malloc or apr_rmm_calloc.
|
||||
* @param rmm The relocatable memory block
|
||||
* @param entity The memory allocation to free
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_rmm_free(apr_rmm_t *rmm, apr_rmm_off_t entity);
|
||||
|
||||
/**
|
||||
* Retrieve the physical address of a relocatable allocation of memory
|
||||
* @param rmm The relocatable memory block
|
||||
* @param entity The memory allocation to free
|
||||
* @return address The address, aligned with APR_ALIGN_DEFAULT.
|
||||
*/
|
||||
APU_DECLARE(void *) apr_rmm_addr_get(apr_rmm_t *rmm, apr_rmm_off_t entity);
|
||||
|
||||
/**
|
||||
* Compute the offset of a relocatable allocation of memory
|
||||
* @param rmm The relocatable memory block
|
||||
* @param entity The physical address to convert to an offset
|
||||
*/
|
||||
APU_DECLARE(apr_rmm_off_t) apr_rmm_offset_get(apr_rmm_t *rmm, void *entity);
|
||||
|
||||
/**
|
||||
* Compute the required overallocation of memory needed to fit n allocs
|
||||
* @param n The number of alloc/calloc regions desired
|
||||
*/
|
||||
APU_DECLARE(apr_size_t) apr_rmm_overhead_get(int n);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
/** @} */
|
||||
#endif /* ! APR_RMM_H */
|
||||
|
||||
176
database/apache/include/apr_sdbm.h
Normal file
176
database/apache/include/apr_sdbm.h
Normal file
@@ -0,0 +1,176 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* sdbm - ndbm work-alike hashed database library
|
||||
* based on Per-Ake Larson's Dynamic Hashing algorithms. BIT 18 (1978).
|
||||
* author: oz@nexus.yorku.ca
|
||||
* status: ex-public domain
|
||||
*/
|
||||
|
||||
#ifndef APR_SDBM_H
|
||||
#define APR_SDBM_H
|
||||
|
||||
#include "apu.h"
|
||||
#include "apr_errno.h"
|
||||
#include "apr_file_io.h" /* for apr_fileperms_t */
|
||||
|
||||
/**
|
||||
* @file apr_sdbm.h
|
||||
* @brief apr-util SDBM library
|
||||
*/
|
||||
/**
|
||||
* @defgroup APR_Util_DBM_SDBM SDBM library
|
||||
* @ingroup APR_Util_DBM
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Structure for referencing an sdbm
|
||||
*/
|
||||
typedef struct apr_sdbm_t apr_sdbm_t;
|
||||
|
||||
/**
|
||||
* Structure for referencing the datum record within an sdbm
|
||||
*/
|
||||
typedef struct {
|
||||
/** pointer to the data stored/retrieved */
|
||||
char *dptr;
|
||||
/** size of data */
|
||||
/* apr_ssize_t for release 2.0??? */
|
||||
int dsize;
|
||||
} apr_sdbm_datum_t;
|
||||
|
||||
/* The extensions used for the database files */
|
||||
/** SDBM Directory file extension */
|
||||
#define APR_SDBM_DIRFEXT ".dir"
|
||||
/** SDBM page file extension */
|
||||
#define APR_SDBM_PAGFEXT ".pag"
|
||||
|
||||
/* flags to sdbm_store */
|
||||
#define APR_SDBM_INSERT 0 /**< Insert */
|
||||
#define APR_SDBM_REPLACE 1 /**< Replace */
|
||||
#define APR_SDBM_INSERTDUP 2 /**< Insert with duplicates */
|
||||
|
||||
/**
|
||||
* Open an sdbm database by file name
|
||||
* @param db The newly opened database
|
||||
* @param name The sdbm file to open
|
||||
* @param mode The flag values (APR_READ and APR_BINARY flags are implicit)
|
||||
* <PRE>
|
||||
* APR_WRITE open for read-write access
|
||||
* APR_CREATE create the sdbm if it does not exist
|
||||
* APR_TRUNCATE empty the contents of the sdbm
|
||||
* APR_EXCL fail for APR_CREATE if the file exists
|
||||
* APR_DELONCLOSE delete the sdbm when closed
|
||||
* APR_SHARELOCK support locking across process/machines
|
||||
* </PRE>
|
||||
* @param perms Permissions to apply to if created
|
||||
* @param p The pool to use when creating the sdbm
|
||||
* @remark The sdbm name is not a true file name, as sdbm appends suffixes
|
||||
* for seperate data and index files.
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_sdbm_open(apr_sdbm_t **db, const char *name,
|
||||
apr_int32_t mode,
|
||||
apr_fileperms_t perms, apr_pool_t *p);
|
||||
|
||||
/**
|
||||
* Close an sdbm file previously opened by apr_sdbm_open
|
||||
* @param db The database to close
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_sdbm_close(apr_sdbm_t *db);
|
||||
|
||||
/**
|
||||
* Lock an sdbm database for concurency of multiple operations
|
||||
* @param db The database to lock
|
||||
* @param type The lock type
|
||||
* <PRE>
|
||||
* APR_FLOCK_SHARED
|
||||
* APR_FLOCK_EXCLUSIVE
|
||||
* </PRE>
|
||||
* @remark Calls to apr_sdbm_lock may be nested. All apr_sdbm functions
|
||||
* perform implicit locking. Since an APR_FLOCK_SHARED lock cannot be
|
||||
* portably promoted to an APR_FLOCK_EXCLUSIVE lock, apr_sdbm_store and
|
||||
* apr_sdbm_delete calls will fail if an APR_FLOCK_SHARED lock is held.
|
||||
* The apr_sdbm_lock call requires the database to be opened with the
|
||||
* APR_SHARELOCK mode value.
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_sdbm_lock(apr_sdbm_t *db, int type);
|
||||
|
||||
/**
|
||||
* Release an sdbm lock previously aquired by apr_sdbm_lock
|
||||
* @param db The database to unlock
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_sdbm_unlock(apr_sdbm_t *db);
|
||||
|
||||
/**
|
||||
* Fetch an sdbm record value by key
|
||||
* @param db The database
|
||||
* @param value The value datum retrieved for this record
|
||||
* @param key The key datum to find this record
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_sdbm_fetch(apr_sdbm_t *db,
|
||||
apr_sdbm_datum_t *value,
|
||||
apr_sdbm_datum_t key);
|
||||
|
||||
/**
|
||||
* Store an sdbm record value by key
|
||||
* @param db The database
|
||||
* @param key The key datum to store this record by
|
||||
* @param value The value datum to store in this record
|
||||
* @param opt The method used to store the record
|
||||
* <PRE>
|
||||
* APR_SDBM_INSERT return an error if the record exists
|
||||
* APR_SDBM_REPLACE overwrite any existing record for key
|
||||
* </PRE>
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_sdbm_store(apr_sdbm_t *db, apr_sdbm_datum_t key,
|
||||
apr_sdbm_datum_t value, int opt);
|
||||
|
||||
/**
|
||||
* Delete an sdbm record value by key
|
||||
* @param db The database
|
||||
* @param key The key datum of the record to delete
|
||||
* @remark It is not an error to delete a non-existent record.
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_sdbm_delete(apr_sdbm_t *db,
|
||||
const apr_sdbm_datum_t key);
|
||||
|
||||
/**
|
||||
* Retrieve the first record key from a dbm
|
||||
* @param db The database
|
||||
* @param key The key datum of the first record
|
||||
* @remark The keys returned are not ordered. To traverse the list of keys
|
||||
* for an sdbm opened with APR_SHARELOCK, the caller must use apr_sdbm_lock
|
||||
* prior to retrieving the first record, and hold the lock until after the
|
||||
* last call to apr_sdbm_nextkey.
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_sdbm_firstkey(apr_sdbm_t *db, apr_sdbm_datum_t *key);
|
||||
|
||||
/**
|
||||
* Retrieve the next record key from an sdbm
|
||||
* @param db The database
|
||||
* @param key The key datum of the next record
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_sdbm_nextkey(apr_sdbm_t *db, apr_sdbm_datum_t *key);
|
||||
|
||||
/**
|
||||
* Returns true if the sdbm database opened for read-only access
|
||||
* @param db The database to test
|
||||
*/
|
||||
APU_DECLARE(int) apr_sdbm_rdonly(apr_sdbm_t *db);
|
||||
/** @} */
|
||||
#endif /* APR_SDBM_H */
|
||||
121
database/apache/include/apr_sha1.h
Normal file
121
database/apache/include/apr_sha1.h
Normal file
@@ -0,0 +1,121 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/* NIST Secure Hash Algorithm
|
||||
* heavily modified by Uwe Hollerbach uh@alumni.caltech edu
|
||||
* from Peter C. Gutmann's implementation as found in
|
||||
* Applied Cryptography by Bruce Schneier
|
||||
* This code is hereby placed in the public domain
|
||||
*/
|
||||
|
||||
#ifndef APR_SHA1_H
|
||||
#define APR_SHA1_H
|
||||
|
||||
#include "apu.h"
|
||||
#include "apr_general.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @file apr_sha1.h
|
||||
* @brief APR-UTIL SHA1 library
|
||||
*/
|
||||
|
||||
/** size of the SHA1 DIGEST */
|
||||
#define APR_SHA1_DIGESTSIZE 20
|
||||
|
||||
/**
|
||||
* Define the Magic String prefix that identifies a password as being
|
||||
* hashed using our algorithm.
|
||||
*/
|
||||
#define APR_SHA1PW_ID "{SHA}"
|
||||
|
||||
/** length of the SHA Password */
|
||||
#define APR_SHA1PW_IDLEN 5
|
||||
|
||||
/** @see apr_sha1_ctx_t */
|
||||
typedef struct apr_sha1_ctx_t apr_sha1_ctx_t;
|
||||
|
||||
/**
|
||||
* SHA1 context structure
|
||||
*/
|
||||
struct apr_sha1_ctx_t {
|
||||
/** message digest */
|
||||
apr_uint32_t digest[5];
|
||||
/** 64-bit bit counts */
|
||||
apr_uint32_t count_lo, count_hi;
|
||||
/** SHA data buffer */
|
||||
apr_uint32_t data[16];
|
||||
/** unprocessed amount in data */
|
||||
int local;
|
||||
};
|
||||
|
||||
/**
|
||||
* Provide a means to SHA1 crypt/encode a plaintext password in a way which
|
||||
* makes password file compatible with those commonly use in netscape web
|
||||
* and ldap installations.
|
||||
* @param clear The plaintext password
|
||||
* @param len The length of the plaintext password
|
||||
* @param out The encrypted/encoded password
|
||||
* @note SHA1 support is useful for migration purposes, but is less
|
||||
* secure than Apache's password format, since Apache's (MD5)
|
||||
* password format uses a random eight character salt to generate
|
||||
* one of many possible hashes for the same password. Netscape
|
||||
* uses plain SHA1 without a salt, so the same password
|
||||
* will always generate the same hash, making it easier
|
||||
* to break since the search space is smaller.
|
||||
*/
|
||||
APU_DECLARE(void) apr_sha1_base64(const char *clear, int len, char *out);
|
||||
|
||||
/**
|
||||
* Initialize the SHA digest
|
||||
* @param context The SHA context to initialize
|
||||
*/
|
||||
APU_DECLARE(void) apr_sha1_init(apr_sha1_ctx_t *context);
|
||||
|
||||
/**
|
||||
* Update the SHA digest
|
||||
* @param context The SHA1 context to update
|
||||
* @param input The buffer to add to the SHA digest
|
||||
* @param inputLen The length of the input buffer
|
||||
*/
|
||||
APU_DECLARE(void) apr_sha1_update(apr_sha1_ctx_t *context, const char *input,
|
||||
unsigned int inputLen);
|
||||
|
||||
/**
|
||||
* Update the SHA digest with binary data
|
||||
* @param context The SHA1 context to update
|
||||
* @param input The buffer to add to the SHA digest
|
||||
* @param inputLen The length of the input buffer
|
||||
*/
|
||||
APU_DECLARE(void) apr_sha1_update_binary(apr_sha1_ctx_t *context,
|
||||
const unsigned char *input,
|
||||
unsigned int inputLen);
|
||||
|
||||
/**
|
||||
* Finish computing the SHA digest
|
||||
* @param digest the output buffer in which to store the digest
|
||||
* @param context The context to finalize
|
||||
*/
|
||||
APU_DECLARE(void) apr_sha1_final(unsigned char digest[APR_SHA1_DIGESTSIZE],
|
||||
apr_sha1_ctx_t *context);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* APR_SHA1_H */
|
||||
229
database/apache/include/apr_shm.h
Normal file
229
database/apache/include/apr_shm.h
Normal file
@@ -0,0 +1,229 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_SHM_H
|
||||
#define APR_SHM_H
|
||||
|
||||
/**
|
||||
* @file apr_shm.h
|
||||
* @brief APR Shared Memory Routines
|
||||
*/
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_pools.h"
|
||||
#include "apr_errno.h"
|
||||
#include "apr_perms_set.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @defgroup apr_shm Shared Memory Routines
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Private, platform-specific data struture representing a shared memory
|
||||
* segment.
|
||||
*/
|
||||
typedef struct apr_shm_t apr_shm_t;
|
||||
|
||||
/**
|
||||
* Create and make accessible a shared memory segment with default
|
||||
* properties.
|
||||
* @param m The shared memory structure to create.
|
||||
* @param reqsize The desired size of the segment.
|
||||
* @param filename The file to use for shared memory on platforms that
|
||||
* require it.
|
||||
* @param pool the pool from which to allocate the shared memory
|
||||
* structure.
|
||||
* @remark A note about Anonymous vs. Named shared memory segments:
|
||||
* Not all plaforms support anonymous shared memory segments, but in
|
||||
* some cases it is prefered over other types of shared memory
|
||||
* implementations. Passing a NULL 'file' parameter to this function
|
||||
* will cause the subsystem to use anonymous shared memory segments.
|
||||
* If such a system is not available, APR_ENOTIMPL is returned.
|
||||
* @remark A note about allocation sizes:
|
||||
* On some platforms it is necessary to store some metainformation
|
||||
* about the segment within the actual segment. In order to supply
|
||||
* the caller with the requested size it may be necessary for the
|
||||
* implementation to request a slightly greater segment length
|
||||
* from the subsystem. In all cases, the apr_shm_baseaddr_get()
|
||||
* function will return the first usable byte of memory.
|
||||
*
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_shm_create(apr_shm_t **m,
|
||||
apr_size_t reqsize,
|
||||
const char *filename,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Special processing flags for apr_shm_create_ex() and apr_shm_attach_ex().
|
||||
*/
|
||||
#define APR_SHM_NS_LOCAL 1 /* Create or attach to named shared memory
|
||||
* segment in the "Local" namespace on
|
||||
* Windows. (Ignored on other platforms.)
|
||||
* By default, the "Global" namespace is
|
||||
* used for privileged processes and the
|
||||
* "Local" namespace is used otherwise.
|
||||
*/
|
||||
#define APR_SHM_NS_GLOBAL 2 /* Create or attach to named shared memory
|
||||
* segment in the "Global" namespace on
|
||||
* Windows. (Ignored on other platforms.)
|
||||
*/
|
||||
|
||||
/**
|
||||
* Create and make accessible a shared memory segment with platform-
|
||||
* specific processing.
|
||||
* @param m The shared memory structure to create.
|
||||
* @param reqsize The desired size of the segment.
|
||||
* @param filename The file to use for shared memory on platforms that
|
||||
* require it.
|
||||
* @param pool the pool from which to allocate the shared memory
|
||||
* structure.
|
||||
* @param flags mask of APR_SHM_* (defined above)
|
||||
* @remark A note about Anonymous vs. Named shared memory segments:
|
||||
* Not all plaforms support anonymous shared memory segments, but in
|
||||
* some cases it is prefered over other types of shared memory
|
||||
* implementations. Passing a NULL 'file' parameter to this function
|
||||
* will cause the subsystem to use anonymous shared memory segments.
|
||||
* If such a system is not available, APR_ENOTIMPL is returned.
|
||||
* @remark A note about allocation sizes:
|
||||
* On some platforms it is necessary to store some metainformation
|
||||
* about the segment within the actual segment. In order to supply
|
||||
* the caller with the requested size it may be necessary for the
|
||||
* implementation to request a slightly greater segment length
|
||||
* from the subsystem. In all cases, the apr_shm_baseaddr_get()
|
||||
* function will return the first usable byte of memory.
|
||||
*
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_shm_create_ex(apr_shm_t **m,
|
||||
apr_size_t reqsize,
|
||||
const char *filename,
|
||||
apr_pool_t *pool,
|
||||
apr_int32_t flags);
|
||||
|
||||
/**
|
||||
* Remove named resource associated with a shared memory segment,
|
||||
* preventing attachments to the resource, but not destroying it.
|
||||
* @param filename The filename associated with shared-memory segment which
|
||||
* needs to be removed
|
||||
* @param pool The pool used for file operations
|
||||
* @remark This function is only supported on platforms which support
|
||||
* name-based shared memory segments, and will return APR_ENOTIMPL on
|
||||
* platforms without such support. Removing the file while the shm
|
||||
* is in use is not entirely portable, caller may use this to enhance
|
||||
* obscurity of the resource, but be prepared for the call to fail,
|
||||
* and for concurrent attempts to create a resource of the same name
|
||||
* to also fail. The pool cleanup of apr_shm_create (apr_shm_destroy)
|
||||
* also removes the named resource.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_shm_remove(const char *filename,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Delete named resource associated with a shared memory segment,
|
||||
* preventing attachments to the resource.
|
||||
* @param m The shared memory segment structure to delete.
|
||||
* @remark This function is only supported on platforms which support
|
||||
* name-based shared memory segments, and will return APR_ENOTIMPL on
|
||||
* platforms without such support. Removing the file while the shm
|
||||
* is in use is not entirely portable, caller may use this to enhance
|
||||
* obscurity of the resource, but be prepared for the call to fail,
|
||||
* and for concurrent attempts to create a resource of the same name
|
||||
* to also fail. The pool cleanup of apr_shm_create (apr_shm_destroy)
|
||||
* also removes the named resource.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_shm_delete(apr_shm_t *m);
|
||||
|
||||
/**
|
||||
* Destroy a shared memory segment and associated memory.
|
||||
* @param m The shared memory segment structure to destroy.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_shm_destroy(apr_shm_t *m);
|
||||
|
||||
/**
|
||||
* Attach to a shared memory segment that was created
|
||||
* by another process.
|
||||
* @param m The shared memory structure to create.
|
||||
* @param filename The file used to create the original segment.
|
||||
* (This MUST match the original filename.)
|
||||
* @param pool the pool from which to allocate the shared memory
|
||||
* structure for this process.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_shm_attach(apr_shm_t **m,
|
||||
const char *filename,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Attach to a shared memory segment that was created
|
||||
* by another process, with platform-specific processing.
|
||||
* @param m The shared memory structure to create.
|
||||
* @param filename The file used to create the original segment.
|
||||
* (This MUST match the original filename.)
|
||||
* @param pool the pool from which to allocate the shared memory
|
||||
* structure for this process.
|
||||
* @param flags mask of APR_SHM_* (defined above)
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_shm_attach_ex(apr_shm_t **m,
|
||||
const char *filename,
|
||||
apr_pool_t *pool,
|
||||
apr_int32_t flags);
|
||||
|
||||
/**
|
||||
* Detach from a shared memory segment without destroying it.
|
||||
* @param m The shared memory structure representing the segment
|
||||
* to detach from.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_shm_detach(apr_shm_t *m);
|
||||
|
||||
/**
|
||||
* Retrieve the base address of the shared memory segment.
|
||||
* NOTE: This address is only usable within the callers address
|
||||
* space, since this API does not guarantee that other attaching
|
||||
* processes will maintain the same address mapping.
|
||||
* @param m The shared memory segment from which to retrieve
|
||||
* the base address.
|
||||
* @return address, aligned by APR_ALIGN_DEFAULT.
|
||||
*/
|
||||
APR_DECLARE(void *) apr_shm_baseaddr_get(const apr_shm_t *m);
|
||||
|
||||
/**
|
||||
* Retrieve the length of a shared memory segment in bytes.
|
||||
* @param m The shared memory segment from which to retrieve
|
||||
* the segment length.
|
||||
*/
|
||||
APR_DECLARE(apr_size_t) apr_shm_size_get(const apr_shm_t *m);
|
||||
|
||||
/**
|
||||
* Set shared memory permissions.
|
||||
*/
|
||||
APR_PERMS_SET_IMPLEMENT(shm);
|
||||
|
||||
/**
|
||||
* Get the pool used by this shared memory segment.
|
||||
*/
|
||||
APR_POOL_DECLARE_ACCESSOR(shm);
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* APR_SHM_T */
|
||||
109
database/apache/include/apr_signal.h
Normal file
109
database/apache/include/apr_signal.h
Normal file
@@ -0,0 +1,109 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_SIGNAL_H
|
||||
#define APR_SIGNAL_H
|
||||
|
||||
/**
|
||||
* @file apr_signal.h
|
||||
* @brief APR Signal Handling
|
||||
*/
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_pools.h"
|
||||
|
||||
#if APR_HAVE_SIGNAL_H
|
||||
#include <signal.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @defgroup apr_signal Signal Handling
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
#if APR_HAVE_SIGACTION || defined(DOXYGEN)
|
||||
|
||||
#if defined(DARWIN) && !defined(__cplusplus) && !defined(_ANSI_SOURCE)
|
||||
/* work around Darwin header file bugs
|
||||
* http://www.opensource.apple.com/bugs/X/BSD%20Kernel/2657228.html
|
||||
*/
|
||||
#undef SIG_DFL
|
||||
#undef SIG_IGN
|
||||
#undef SIG_ERR
|
||||
#define SIG_DFL (void (*)(int))0
|
||||
#define SIG_IGN (void (*)(int))1
|
||||
#define SIG_ERR (void (*)(int))-1
|
||||
#endif
|
||||
|
||||
/** Function prototype for signal handlers */
|
||||
typedef void apr_sigfunc_t(int);
|
||||
|
||||
/**
|
||||
* Set the signal handler function for a given signal
|
||||
* @param signo The signal (eg... SIGWINCH)
|
||||
* @param func the function to get called
|
||||
*/
|
||||
APR_DECLARE(apr_sigfunc_t *) apr_signal(int signo, apr_sigfunc_t * func);
|
||||
|
||||
#if defined(SIG_IGN) && !defined(SIG_ERR)
|
||||
#define SIG_ERR ((apr_sigfunc_t *) -1)
|
||||
#endif
|
||||
|
||||
#else /* !APR_HAVE_SIGACTION */
|
||||
#define apr_signal(a, b) signal(a, b)
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* Get the description for a specific signal number
|
||||
* @param signum The signal number
|
||||
* @return The description of the signal
|
||||
*/
|
||||
APR_DECLARE(const char *) apr_signal_description_get(int signum);
|
||||
|
||||
/**
|
||||
* APR-private function for initializing the signal package
|
||||
* @internal
|
||||
* @param pglobal The internal, global pool
|
||||
*/
|
||||
void apr_signal_init(apr_pool_t *pglobal);
|
||||
|
||||
/**
|
||||
* Block the delivery of a particular signal
|
||||
* @param signum The signal number
|
||||
* @return status
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_signal_block(int signum);
|
||||
|
||||
/**
|
||||
* Enable the delivery of a particular signal
|
||||
* @param signum The signal number
|
||||
* @return status
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_signal_unblock(int signum);
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* APR_SIGNAL_H */
|
||||
148
database/apache/include/apr_siphash.h
Normal file
148
database/apache/include/apr_siphash.h
Normal file
@@ -0,0 +1,148 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
SipHash reference C implementation
|
||||
Copyright (c) 2012-2014 Jean-Philippe Aumasson
|
||||
<jeanphilippe.aumasson@gmail.com>
|
||||
Copyright (c) 2012-2014 Daniel J. Bernstein <djb@cr.yp.to>
|
||||
To the extent possible under law, the author(s) have dedicated all copyright
|
||||
and related and neighboring rights to this software to the public domain
|
||||
worldwide. This software is distributed without any warranty.
|
||||
You should have received a copy of the CC0 Public Domain Dedication along
|
||||
with this software. If not, see
|
||||
<http://creativecommons.org/publicdomain/zero/1.0/>.
|
||||
*/
|
||||
|
||||
#ifndef APR_SIPHASH_H
|
||||
#define APR_SIPHASH_H
|
||||
|
||||
#include "apr.h"
|
||||
#include "apu.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @file apr_siphash.h
|
||||
* @brief APR-UTIL siphash library
|
||||
* "SipHash-c-d is a family of pseudorandom functions (a.k.a. keyed
|
||||
* hash functions) optimized for speed on short messages", designed by
|
||||
* Jean-Philippe Aumasson and Daniel J. Bernstein. It generates a 64bit
|
||||
* hash (or MAC) from the message and a 128bit key.
|
||||
* See http://cr.yp.to/siphash/siphash-20120620.pdf for the details,
|
||||
* c is the number of compression rounds, d the number of finalization
|
||||
* rounds; we also define fast implementations for c = 2 with d = 4 (aka
|
||||
* siphash-2-4), and c = 4 with d = 8 (aka siphash-4-8), as recommended
|
||||
* parameters per the authors.
|
||||
*/
|
||||
|
||||
/** size of the siphash digest */
|
||||
#define APR_SIPHASH_DSIZE 8
|
||||
|
||||
/** size of the siphash key */
|
||||
#define APR_SIPHASH_KSIZE 16
|
||||
|
||||
|
||||
/**
|
||||
* @brief Computes SipHash-c-d, producing a 64bit (APR_SIPHASH_DSIZE) hash
|
||||
* from a message and a 128bit (APR_SIPHASH_KSIZE) secret key.
|
||||
* @param src The message
|
||||
* @param len The length of the message
|
||||
* @param key The secret key
|
||||
* @param c The number of compression rounds
|
||||
* @param d The number of finalization rounds
|
||||
* @return The hash value as a 64bit unsigned integer
|
||||
*/
|
||||
APU_DECLARE(apr_uint64_t) apr_siphash(const void *src, apr_size_t len,
|
||||
const unsigned char key[APR_SIPHASH_KSIZE],
|
||||
unsigned int c, unsigned int d);
|
||||
|
||||
/**
|
||||
* @brief Computes SipHash-c-d, producing a 64bit (APR_SIPHASH_DSIZE) hash
|
||||
* from a message and a 128bit (APR_SIPHASH_KSIZE) secret key, into a possibly
|
||||
* unaligned buffer (using the little endian representation as defined by the
|
||||
* authors for interoperabilty) usable as a MAC.
|
||||
* @param out The output buffer (or MAC)
|
||||
* @param src The message
|
||||
* @param len The length of the message
|
||||
* @param key The secret key
|
||||
* @param c The number of compression rounds
|
||||
* @param d The number of finalization rounds
|
||||
* @return The hash value as a 64bit unsigned integer
|
||||
*/
|
||||
APU_DECLARE(void) apr_siphash_auth(unsigned char out[APR_SIPHASH_DSIZE],
|
||||
const void *src, apr_size_t len,
|
||||
const unsigned char key[APR_SIPHASH_KSIZE],
|
||||
unsigned int c, unsigned int d);
|
||||
|
||||
/**
|
||||
* @brief Computes SipHash-2-4, producing a 64bit (APR_SIPHASH_DSIZE) hash
|
||||
* from a message and a 128bit (APR_SIPHASH_KSIZE) secret key.
|
||||
* @param src The message to hash
|
||||
* @param len The length of the message
|
||||
* @param key The secret key
|
||||
* @return The hash value as a 64bit unsigned integer
|
||||
*/
|
||||
APU_DECLARE(apr_uint64_t) apr_siphash24(const void *src, apr_size_t len,
|
||||
const unsigned char key[APR_SIPHASH_KSIZE]);
|
||||
|
||||
/**
|
||||
* @brief Computes SipHash-2-4, producing a 64bit (APR_SIPHASH_DSIZE) hash
|
||||
* from a message and a 128bit (APR_SIPHASH_KSIZE) secret key, into a possibly
|
||||
* unaligned buffer (using the little endian representation as defined by the
|
||||
* authors for interoperabilty) usable as a MAC.
|
||||
* @param out The output buffer (or MAC)
|
||||
* @param src The message
|
||||
* @param len The length of the message
|
||||
* @param key The secret key
|
||||
* @return The hash value as a 64bit unsigned integer
|
||||
*/
|
||||
APU_DECLARE(void) apr_siphash24_auth(unsigned char out[APR_SIPHASH_DSIZE],
|
||||
const void *src, apr_size_t len,
|
||||
const unsigned char key[APR_SIPHASH_KSIZE]);
|
||||
|
||||
/**
|
||||
* @brief Computes SipHash-4-8, producing a 64bit (APR_SIPHASH_DSIZE) hash
|
||||
* from a message and a 128bit (APR_SIPHASH_KSIZE) secret key.
|
||||
* @param src The message
|
||||
* @param len The length of the message
|
||||
* @param key The secret key
|
||||
* @return The hash value as a 64bit unsigned integer
|
||||
*/
|
||||
APU_DECLARE(apr_uint64_t) apr_siphash48(const void *src, apr_size_t len,
|
||||
const unsigned char key[APR_SIPHASH_KSIZE]);
|
||||
|
||||
/**
|
||||
* @brief Computes SipHash-4-8, producing a 64bit (APR_SIPHASH_DSIZE) hash
|
||||
* from a message and a 128bit (APR_SIPHASH_KSIZE) secret key, into a possibly
|
||||
* unaligned buffer (using the little endian representation as defined by the
|
||||
* authors for interoperabilty) usable as a MAC.
|
||||
* @param out The output buffer (or MAC)
|
||||
* @param src The message
|
||||
* @param len The length of the message
|
||||
* @param key The secret key
|
||||
* @return The hash value as a 64bit unsigned integer
|
||||
*/
|
||||
APU_DECLARE(void) apr_siphash48_auth(unsigned char out[APR_SIPHASH_DSIZE],
|
||||
const void *src, apr_size_t len,
|
||||
const unsigned char key[APR_SIPHASH_KSIZE]);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* APR_SIPHASH_H */
|
||||
381
database/apache/include/apr_skiplist.h
Normal file
381
database/apache/include/apr_skiplist.h
Normal file
@@ -0,0 +1,381 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_SKIPLIST_H
|
||||
#define APR_SKIPLIST_H
|
||||
/**
|
||||
* @file apr_skiplist.h
|
||||
* @brief APR skip list implementation
|
||||
*/
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_portable.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @defgroup apr_skiplist Skip list implementation
|
||||
* Refer to http://en.wikipedia.org/wiki/Skip_list for information
|
||||
* about the purpose of and ideas behind skip lists.
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* apr_skiplist_compare is the function type that must be implemented
|
||||
* per object type that is used in a skip list for comparisons to maintain
|
||||
* order
|
||||
* */
|
||||
typedef int (*apr_skiplist_compare) (void *, void *);
|
||||
|
||||
/**
|
||||
* apr_skiplist_freefunc is the function type that must be implemented
|
||||
* to handle elements as they are removed from a skip list.
|
||||
*/
|
||||
typedef void (*apr_skiplist_freefunc) (void *);
|
||||
|
||||
/** Opaque structure used to represent the skip list */
|
||||
struct apr_skiplist;
|
||||
/** Opaque structure used to represent the skip list */
|
||||
typedef struct apr_skiplist apr_skiplist;
|
||||
|
||||
/**
|
||||
* Opaque structure used to represent abstract nodes in the skip list
|
||||
* (an abstraction above the raw elements which are collected in the
|
||||
* skip list).
|
||||
*/
|
||||
struct apr_skiplistnode;
|
||||
/** Opaque structure */
|
||||
typedef struct apr_skiplistnode apr_skiplistnode;
|
||||
|
||||
/**
|
||||
* Allocate memory using the same mechanism as the skip list.
|
||||
* @param sl The skip list
|
||||
* @param size The amount to allocate
|
||||
* @remark If a pool was provided to apr_skiplist_init(), memory will
|
||||
* be allocated from the pool or from a free list maintained with
|
||||
* the skip list. Otherwise, memory will be allocated using the
|
||||
* C standard library heap functions.
|
||||
*/
|
||||
APR_DECLARE(void *) apr_skiplist_alloc(apr_skiplist *sl, size_t size);
|
||||
|
||||
/**
|
||||
* Free memory using the same mechanism as the skip list.
|
||||
* @param sl The skip list
|
||||
* @param mem The object to free
|
||||
* @remark If a pool was provided to apr_skiplist_init(), memory will
|
||||
* be added to a free list maintained with the skip list and be available
|
||||
* to operations on the skip list or to other calls to apr_skiplist_alloc().
|
||||
* Otherwise, memory will be freed using the C standard library heap
|
||||
* functions.
|
||||
*/
|
||||
APR_DECLARE(void) apr_skiplist_free(apr_skiplist *sl, void *mem);
|
||||
|
||||
/**
|
||||
* Allocate a new skip list
|
||||
* @param sl The pointer in which to return the newly created skip list
|
||||
* @param p The pool from which to allocate the skip list (optional).
|
||||
* @remark Unlike most APR functions, a pool is optional. If no pool
|
||||
* is provided, the C standard library heap functions will be used instead.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_skiplist_init(apr_skiplist **sl, apr_pool_t *p);
|
||||
|
||||
/**
|
||||
* Set the comparison functions to be used for searching the skip list.
|
||||
* @param sl The skip list
|
||||
* @param XXX1 FIXME
|
||||
* @param XXX2 FIXME
|
||||
*
|
||||
* @remark If existing comparison functions are being replaced, the index
|
||||
* will be replaced during this call. That is a potentially expensive
|
||||
* operation.
|
||||
*/
|
||||
APR_DECLARE(void) apr_skiplist_set_compare(apr_skiplist *sl, apr_skiplist_compare XXX1,
|
||||
apr_skiplist_compare XXX2);
|
||||
|
||||
/**
|
||||
* Set the indexing functions to the specified comparison functions and
|
||||
* rebuild the index.
|
||||
* @param sl The skip list
|
||||
* @param XXX1 FIXME
|
||||
* @param XXX2 FIXME
|
||||
*
|
||||
* @remark If an index already exists, it will not be replaced and the
|
||||
* comparison functions will not be changed.
|
||||
*/
|
||||
APR_DECLARE(void) apr_skiplist_add_index(apr_skiplist *sl, apr_skiplist_compare XXX1,
|
||||
apr_skiplist_compare XXX2);
|
||||
|
||||
/**
|
||||
* Return the list maintained by the skip list abstraction.
|
||||
* @param sl The skip list
|
||||
*/
|
||||
APR_DECLARE(apr_skiplistnode *) apr_skiplist_getlist(apr_skiplist *sl);
|
||||
|
||||
/**
|
||||
* Return the next matching element in the skip list using the specified
|
||||
* comparison function.
|
||||
* @param sl The skip list
|
||||
* @param data The value to search for
|
||||
* @param iter A pointer to the returned skip list node representing the element
|
||||
* found
|
||||
* @param func The comparison function to use
|
||||
*/
|
||||
APR_DECLARE(void *) apr_skiplist_find_compare(apr_skiplist *sl,
|
||||
void *data,
|
||||
apr_skiplistnode **iter,
|
||||
apr_skiplist_compare func);
|
||||
|
||||
/**
|
||||
* Return the next matching element in the skip list using the current comparison
|
||||
* function.
|
||||
* @param sl The skip list
|
||||
* @param data The value to search for
|
||||
* @param iter A pointer to the returned skip list node representing the element
|
||||
* found
|
||||
*/
|
||||
APR_DECLARE(void *) apr_skiplist_find(apr_skiplist *sl, void *data, apr_skiplistnode **iter);
|
||||
|
||||
/**
|
||||
* Return the last matching element in the skip list using the specified
|
||||
* comparison function.
|
||||
* @param sl The skip list
|
||||
* @param data The value to search for
|
||||
* @param iter A pointer to the returned skip list node representing the element
|
||||
* found
|
||||
* @param comp The comparison function to use
|
||||
*/
|
||||
APR_DECLARE(void *) apr_skiplist_last_compare(apr_skiplist *sl, void *data,
|
||||
apr_skiplistnode **iter,
|
||||
apr_skiplist_compare comp);
|
||||
|
||||
/**
|
||||
* Return the last matching element in the skip list using the current comparison
|
||||
* function.
|
||||
* @param sl The skip list
|
||||
* @param data The value to search for
|
||||
* @param iter A pointer to the returned skip list node representing the element
|
||||
* found
|
||||
*/
|
||||
APR_DECLARE(void *) apr_skiplist_last(apr_skiplist *sl, void *data,
|
||||
apr_skiplistnode **iter);
|
||||
|
||||
/**
|
||||
* Return the next element in the skip list.
|
||||
* @param sl The skip list
|
||||
* @param iter On entry, a pointer to the skip list node to start with; on return,
|
||||
* a pointer to the skip list node representing the element returned
|
||||
* @remark If iter points to a NULL value on entry, NULL will be returned.
|
||||
*/
|
||||
APR_DECLARE(void *) apr_skiplist_next(apr_skiplist *sl, apr_skiplistnode **iter);
|
||||
|
||||
/**
|
||||
* Return the previous element in the skip list.
|
||||
* @param sl The skip list
|
||||
* @param iter On entry, a pointer to the skip list node to start with; on return,
|
||||
* a pointer to the skip list node representing the element returned
|
||||
* @remark If iter points to a NULL value on entry, NULL will be returned.
|
||||
*/
|
||||
APR_DECLARE(void *) apr_skiplist_previous(apr_skiplist *sl, apr_skiplistnode **iter);
|
||||
|
||||
/**
|
||||
* Return the element of the skip list node
|
||||
* @param iter The skip list node
|
||||
*/
|
||||
APR_DECLARE(void *) apr_skiplist_element(apr_skiplistnode *iter);
|
||||
|
||||
/**
|
||||
* Insert an element into the skip list using the specified comparison function
|
||||
* if it does not already exist.
|
||||
* @param sl The skip list
|
||||
* @param data The element to insert
|
||||
* @param comp The comparison function to use for placement into the skip list
|
||||
*/
|
||||
APR_DECLARE(apr_skiplistnode *) apr_skiplist_insert_compare(apr_skiplist *sl,
|
||||
void *data, apr_skiplist_compare comp);
|
||||
|
||||
/**
|
||||
* Insert an element into the skip list using the existing comparison function
|
||||
* if it does not already exist.
|
||||
* @param sl The skip list
|
||||
* @param data The element to insert
|
||||
* @remark If no comparison function has been set for the skip list, the element
|
||||
* will not be inserted and NULL will be returned.
|
||||
*/
|
||||
APR_DECLARE(apr_skiplistnode *) apr_skiplist_insert(apr_skiplist* sl, void *data);
|
||||
|
||||
/**
|
||||
* Add an element into the skip list using the specified comparison function
|
||||
* allowing for duplicates.
|
||||
* @param sl The skip list
|
||||
* @param data The element to add
|
||||
* @param comp The comparison function to use for placement into the skip list
|
||||
*/
|
||||
APR_DECLARE(apr_skiplistnode *) apr_skiplist_add_compare(apr_skiplist *sl,
|
||||
void *data, apr_skiplist_compare comp);
|
||||
|
||||
/**
|
||||
* Add an element into the skip list using the existing comparison function
|
||||
* allowing for duplicates.
|
||||
* @param sl The skip list
|
||||
* @param data The element to insert
|
||||
* @remark If no comparison function has been set for the skip list, the element
|
||||
* will not be inserted and NULL will be returned.
|
||||
*/
|
||||
APR_DECLARE(apr_skiplistnode *) apr_skiplist_add(apr_skiplist* sl, void *data);
|
||||
|
||||
/**
|
||||
* Add an element into the skip list using the specified comparison function
|
||||
* removing the existing duplicates.
|
||||
* @param sl The skip list
|
||||
* @param data The element to insert
|
||||
* @param comp The comparison function to use for placement into the skip list
|
||||
* @param myfree A function to be called for each removed duplicate
|
||||
* @remark If no comparison function has been set for the skip list, the element
|
||||
* will not be inserted, none will be replaced, and NULL will be returned.
|
||||
*/
|
||||
APR_DECLARE(apr_skiplistnode *) apr_skiplist_replace_compare(apr_skiplist *sl,
|
||||
void *data, apr_skiplist_freefunc myfree,
|
||||
apr_skiplist_compare comp);
|
||||
|
||||
/**
|
||||
* Add an element into the skip list using the existing comparison function
|
||||
* removing the existing duplicates.
|
||||
* @param sl The skip list
|
||||
* @param data The element to insert
|
||||
* @param myfree A function to be called for each removed duplicate
|
||||
* @remark If no comparison function has been set for the skip list, the element
|
||||
* will not be inserted, none will be replaced, and NULL will be returned.
|
||||
*/
|
||||
APR_DECLARE(apr_skiplistnode *) apr_skiplist_replace(apr_skiplist *sl,
|
||||
void *data, apr_skiplist_freefunc myfree);
|
||||
|
||||
/**
|
||||
* Remove a node from the skip list.
|
||||
* @param sl The skip list
|
||||
* @param iter The skip list node to remove
|
||||
* @param myfree A function to be called for the removed element
|
||||
*/
|
||||
APR_DECLARE(int) apr_skiplist_remove_node(apr_skiplist *sl,
|
||||
apr_skiplistnode *iter,
|
||||
apr_skiplist_freefunc myfree);
|
||||
|
||||
/**
|
||||
* Remove an element from the skip list using the specified comparison function for
|
||||
* locating the element. In the case of duplicates, the 1st entry will be removed.
|
||||
* @param sl The skip list
|
||||
* @param data The element to remove
|
||||
* @param myfree A function to be called for each removed element
|
||||
* @param comp The comparison function to use for placement into the skip list
|
||||
* @remark If the element is not found, 0 will be returned. Otherwise, the heightXXX
|
||||
* will be returned.
|
||||
*/
|
||||
APR_DECLARE(int) apr_skiplist_remove_compare(apr_skiplist *sl, void *data,
|
||||
apr_skiplist_freefunc myfree, apr_skiplist_compare comp);
|
||||
|
||||
/**
|
||||
* Remove an element from the skip list using the existing comparison function for
|
||||
* locating the element. In the case of duplicates, the 1st entry will be removed.
|
||||
* @param sl The skip list
|
||||
* @param data The element to remove
|
||||
* @param myfree A function to be called for each removed element
|
||||
* @remark If the element is not found, 0 will be returned. Otherwise, the heightXXX
|
||||
* will be returned.
|
||||
* @remark If no comparison function has been set for the skip list, the element
|
||||
* will not be removed and 0 will be returned.
|
||||
*/
|
||||
APR_DECLARE(int) apr_skiplist_remove(apr_skiplist *sl, void *data, apr_skiplist_freefunc myfree);
|
||||
|
||||
/**
|
||||
* Remove all elements from the skip list.
|
||||
* @param sl The skip list
|
||||
* @param myfree A function to be called for each removed element
|
||||
*/
|
||||
APR_DECLARE(void) apr_skiplist_remove_all(apr_skiplist *sl, apr_skiplist_freefunc myfree);
|
||||
|
||||
/**
|
||||
* Remove each element from the skip list.
|
||||
* @param sl The skip list
|
||||
* @param myfree A function to be called for each removed element
|
||||
*/
|
||||
APR_DECLARE(void) apr_skiplist_destroy(apr_skiplist *sl, apr_skiplist_freefunc myfree);
|
||||
|
||||
/**
|
||||
* Return the first element in the skip list, removing the element from the skip list.
|
||||
* @param sl The skip list
|
||||
* @param myfree A function to be called for the removed element
|
||||
* @remark NULL will be returned if there are no elements
|
||||
*/
|
||||
APR_DECLARE(void *) apr_skiplist_pop(apr_skiplist *sl, apr_skiplist_freefunc myfree);
|
||||
|
||||
/**
|
||||
* Return the first element in the skip list, leaving the element in the skip list.
|
||||
* @param sl The skip list
|
||||
* @remark NULL will be returned if there are no elements
|
||||
*/
|
||||
APR_DECLARE(void *) apr_skiplist_peek(apr_skiplist *sl);
|
||||
|
||||
/**
|
||||
* Return the size of the list (number of elements), in O(1).
|
||||
* @param sl The skip list
|
||||
*/
|
||||
APR_DECLARE(size_t) apr_skiplist_size(const apr_skiplist *sl);
|
||||
|
||||
/**
|
||||
* Return the height of the list (number of skip paths), in O(1).
|
||||
* @param sl The skip list
|
||||
*/
|
||||
APR_DECLARE(int) apr_skiplist_height(const apr_skiplist *sl);
|
||||
|
||||
/**
|
||||
* Return the predefined maximum height of the skip list.
|
||||
* @param sl The skip list
|
||||
*/
|
||||
APR_DECLARE(int) apr_skiplist_preheight(const apr_skiplist *sl);
|
||||
|
||||
/**
|
||||
* Set a predefined maximum height for the skip list.
|
||||
* @param sl The skip list
|
||||
* @param to The preheight to set, or a nul/negative value to disable.
|
||||
* @remark When a preheight is used, the height of each inserted element is
|
||||
* computed randomly up to this preheight instead of the current skip list's
|
||||
* height plus one used by the default implementation. Using a preheight can
|
||||
* probably ensure more fairness with long living elements (since with an
|
||||
* adaptative height, former elements may have been created with a low height,
|
||||
* hence a longest path to reach them while the skip list grows). On the other
|
||||
* hand, the default behaviour (preheight <= 0) with a growing and decreasing
|
||||
* maximum height is more adaptative/suitable for short living values.
|
||||
* @note Should be called before any insertion/add.
|
||||
*/
|
||||
APR_DECLARE(void) apr_skiplist_set_preheight(apr_skiplist *sl, int to);
|
||||
|
||||
/**
|
||||
* Merge two skip lists. XXX SEMANTICS
|
||||
* @param sl1 One of two skip lists to be merged
|
||||
* @param sl2 The other of two skip lists to be merged
|
||||
*/
|
||||
APR_DECLARE(apr_skiplist *) apr_skiplist_merge(apr_skiplist *sl1, apr_skiplist *sl2);
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ! APR_SKIPLIST_H */
|
||||
380
database/apache/include/apr_strings.h
Normal file
380
database/apache/include/apr_strings.h
Normal file
@@ -0,0 +1,380 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* Portions of this file are covered by */
|
||||
/* -*- mode: c; c-file-style: "k&r" -*-
|
||||
|
||||
strnatcmp.c -- Perform 'natural order' comparisons of strings in C.
|
||||
Copyright (C) 2000 by Martin Pool <mbp@humbug.org.au>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef APR_STRINGS_H
|
||||
#define APR_STRINGS_H
|
||||
|
||||
/**
|
||||
* @file apr_strings.h
|
||||
* @brief APR Strings library
|
||||
*/
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_errno.h"
|
||||
#include "apr_pools.h"
|
||||
#define APR_WANT_IOVEC
|
||||
#include "apr_want.h"
|
||||
|
||||
#if APR_HAVE_STDARG_H
|
||||
#include <stdarg.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @defgroup apr_strings String routines
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Do a natural order comparison of two strings.
|
||||
* @param a The first string to compare
|
||||
* @param b The second string to compare
|
||||
* @return Either <0, 0, or >0. If the first string is less than the second
|
||||
* this returns <0, if they are equivalent it returns 0, and if the
|
||||
* first string is greater than second string it retuns >0.
|
||||
*/
|
||||
APR_DECLARE(int) apr_strnatcmp(char const *a, char const *b);
|
||||
|
||||
/**
|
||||
* Do a natural order comparison of two strings ignoring the case of the
|
||||
* strings.
|
||||
* @param a The first string to compare
|
||||
* @param b The second string to compare
|
||||
* @return Either <0, 0, or >0. If the first string is less than the second
|
||||
* this returns <0, if they are equivalent it returns 0, and if the
|
||||
* first string is greater than second string it retuns >0.
|
||||
*/
|
||||
APR_DECLARE(int) apr_strnatcasecmp(char const *a, char const *b);
|
||||
|
||||
/**
|
||||
* duplicate a string into memory allocated out of a pool
|
||||
* @param p The pool to allocate out of
|
||||
* @param s The string to duplicate
|
||||
* @return The new string or NULL if s == NULL
|
||||
*/
|
||||
APR_DECLARE(char *) apr_pstrdup(apr_pool_t *p, const char *s);
|
||||
|
||||
/**
|
||||
* Create a null-terminated string by making a copy of a sequence
|
||||
* of characters and appending a null byte
|
||||
* @param p The pool to allocate out of
|
||||
* @param s The block of characters to duplicate
|
||||
* @param n The number of characters to duplicate
|
||||
* @return The new string or NULL if s == NULL
|
||||
* @remark This is a faster alternative to apr_pstrndup(), for use
|
||||
* when you know that the string being duplicated really
|
||||
* has 'n' or more characters. If the string might contain
|
||||
* fewer characters, use apr_pstrndup().
|
||||
*/
|
||||
APR_DECLARE(char *) apr_pstrmemdup(apr_pool_t *p, const char *s, apr_size_t n)
|
||||
#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
|
||||
__attribute__((alloc_size(3)))
|
||||
#endif
|
||||
;
|
||||
|
||||
/**
|
||||
* Duplicate at most n characters of a string into memory allocated
|
||||
* out of a pool; the new string will be NUL-terminated
|
||||
* @param p The pool to allocate out of
|
||||
* @param s The string to duplicate
|
||||
* @param n The maximum number of characters to duplicate
|
||||
* @return The new string or NULL if s == NULL
|
||||
* @remark The amount of memory allocated from the pool is the length
|
||||
* of the returned string including the NUL terminator
|
||||
*/
|
||||
APR_DECLARE(char *) apr_pstrndup(apr_pool_t *p, const char *s, apr_size_t n);
|
||||
|
||||
/**
|
||||
* Duplicate a block of memory.
|
||||
*
|
||||
* @param p The pool to allocate from
|
||||
* @param m The memory to duplicate
|
||||
* @param n The number of bytes to duplicate
|
||||
* @return The new block of memory or NULL if m == NULL
|
||||
*/
|
||||
APR_DECLARE(void *) apr_pmemdup(apr_pool_t *p, const void *m, apr_size_t n)
|
||||
#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
|
||||
__attribute__((alloc_size(3)))
|
||||
#endif
|
||||
;
|
||||
|
||||
/**
|
||||
* Concatenate multiple strings, allocating memory out a pool
|
||||
* @param p The pool to allocate out of
|
||||
* @param ... The strings to concatenate. The final string must be NULL
|
||||
* @return The new string
|
||||
*/
|
||||
APR_DECLARE_NONSTD(char *) apr_pstrcat(apr_pool_t *p, ...)
|
||||
#if defined(__GNUC__) && __GNUC__ >= 4
|
||||
__attribute__((sentinel))
|
||||
#endif
|
||||
;
|
||||
|
||||
/**
|
||||
* Concatenate multiple strings specified in a writev-style vector
|
||||
* @param p The pool from which to allocate
|
||||
* @param vec The strings to concatenate
|
||||
* @param nvec The number of strings to concatenate
|
||||
* @param nbytes (output) strlen of new string (pass in NULL to omit)
|
||||
* @return The new string
|
||||
*/
|
||||
APR_DECLARE(char *) apr_pstrcatv(apr_pool_t *p, const struct iovec *vec,
|
||||
apr_size_t nvec, apr_size_t *nbytes);
|
||||
|
||||
/**
|
||||
* printf-style style printing routine. The data is output to a string
|
||||
* allocated from a pool
|
||||
* @param p The pool to allocate out of
|
||||
* @param fmt The format of the string
|
||||
* @param ap The arguments to use while printing the data
|
||||
* @return The new string
|
||||
*/
|
||||
APR_DECLARE(char *) apr_pvsprintf(apr_pool_t *p, const char *fmt, va_list ap);
|
||||
|
||||
/**
|
||||
* printf-style style printing routine. The data is output to a string
|
||||
* allocated from a pool
|
||||
* @param p The pool to allocate out of
|
||||
* @param fmt The format of the string
|
||||
* @param ... The arguments to use while printing the data
|
||||
* @return The new string
|
||||
*/
|
||||
APR_DECLARE_NONSTD(char *) apr_psprintf(apr_pool_t *p, const char *fmt, ...)
|
||||
__attribute__((format(printf,2,3)));
|
||||
|
||||
/**
|
||||
* Copy up to dst_size characters from src to dst; does not copy
|
||||
* past a NUL terminator in src, but always terminates dst with a NUL
|
||||
* regardless.
|
||||
* @param dst The destination string
|
||||
* @param src The source string
|
||||
* @param dst_size The space available in dst; dst always receives
|
||||
* NUL termination, so if src is longer than
|
||||
* dst_size, the actual number of characters copied is
|
||||
* dst_size - 1.
|
||||
* @return Pointer to the NUL terminator of the destination string, dst
|
||||
* @remark
|
||||
* <PRE>
|
||||
* Note the differences between this function and strncpy():
|
||||
* 1) strncpy() doesn't always NUL terminate; apr_cpystrn() does.
|
||||
* 2) strncpy() pads the destination string with NULs, which is often
|
||||
* unnecessary; apr_cpystrn() does not.
|
||||
* 3) strncpy() returns a pointer to the beginning of the dst string;
|
||||
* apr_cpystrn() returns a pointer to the NUL terminator of dst,
|
||||
* to allow a check for truncation.
|
||||
* </PRE>
|
||||
*/
|
||||
APR_DECLARE(char *) apr_cpystrn(char *dst, const char *src,
|
||||
apr_size_t dst_size);
|
||||
|
||||
/**
|
||||
* Remove all whitespace from a string
|
||||
* @param dest The destination string. It is okay to modify the string
|
||||
* in place. Namely dest == src
|
||||
* @param src The string to rid the spaces from.
|
||||
* @return A pointer to the destination string's null terminator.
|
||||
*/
|
||||
APR_DECLARE(char *) apr_collapse_spaces(char *dest, const char *src);
|
||||
|
||||
/**
|
||||
* Convert the arguments to a program from one string to an array of
|
||||
* strings terminated by a NULL pointer
|
||||
* @param arg_str The arguments to convert
|
||||
* @param argv_out Output location. This is a pointer to an array of strings.
|
||||
* @param token_context Pool to use.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_tokenize_to_argv(const char *arg_str,
|
||||
char ***argv_out,
|
||||
apr_pool_t *token_context);
|
||||
|
||||
/**
|
||||
* Split a string into separate null-terminated tokens. The tokens are
|
||||
* delimited in the string by one or more characters from the sep
|
||||
* argument.
|
||||
* @param str The string to separate; this should be specified on the
|
||||
* first call to apr_strtok() for a given string, and NULL
|
||||
* on subsequent calls.
|
||||
* @param sep The set of delimiters
|
||||
* @param last State saved by apr_strtok() between calls.
|
||||
* @return The next token from the string
|
||||
* @note the 'last' state points to the trailing NUL char of the final
|
||||
* token, otherwise it points to the character following the current
|
||||
* token (all successive or empty occurances of sep are skiped on the
|
||||
* subsequent call to apr_strtok). Therefore it is possible to avoid
|
||||
* a strlen() determination, with the following logic;
|
||||
* toklen = last - retval; if (*last) --toklen;
|
||||
*/
|
||||
APR_DECLARE(char *) apr_strtok(char *str, const char *sep, char **last);
|
||||
|
||||
/**
|
||||
* @defgroup APR_Strings_Snprintf snprintf implementations
|
||||
* @warning
|
||||
* These are snprintf implementations based on apr_vformatter().
|
||||
*
|
||||
* Note that various standards and implementations disagree on the return
|
||||
* value of snprintf, and side-effects due to %n in the formatting string.
|
||||
* apr_snprintf (and apr_vsnprintf) behaves as follows:
|
||||
*
|
||||
* Process the format string until the entire string is exhausted, or
|
||||
* the buffer fills. If the buffer fills then stop processing immediately
|
||||
* (so no further %n arguments are processed), and return the buffer
|
||||
* length. In all cases the buffer is NUL terminated. It will return the
|
||||
* number of characters inserted into the buffer, not including the
|
||||
* terminating NUL. As a special case, if len is 0, apr_snprintf will
|
||||
* return the number of characters that would have been inserted if
|
||||
* the buffer had been infinite (in this case, *buffer can be NULL)
|
||||
*
|
||||
* In no event does apr_snprintf return a negative number.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* snprintf routine based on apr_vformatter. This means it understands the
|
||||
* same extensions.
|
||||
* @param buf The buffer to write to
|
||||
* @param len The size of the buffer
|
||||
* @param format The format string
|
||||
* @param ... The arguments to use to fill out the format string.
|
||||
*/
|
||||
APR_DECLARE_NONSTD(int) apr_snprintf(char *buf, apr_size_t len,
|
||||
const char *format, ...)
|
||||
__attribute__((format(printf,3,4)));
|
||||
|
||||
/**
|
||||
* vsnprintf routine based on apr_vformatter. This means it understands the
|
||||
* same extensions.
|
||||
* @param buf The buffer to write to
|
||||
* @param len The size of the buffer
|
||||
* @param format The format string
|
||||
* @param ap The arguments to use to fill out the format string.
|
||||
*/
|
||||
APR_DECLARE(int) apr_vsnprintf(char *buf, apr_size_t len, const char *format,
|
||||
va_list ap);
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* create a string representation of an int, allocated from a pool
|
||||
* @param p The pool from which to allocate
|
||||
* @param n The number to format
|
||||
* @return The string representation of the number
|
||||
*/
|
||||
APR_DECLARE(char *) apr_itoa(apr_pool_t *p, int n);
|
||||
|
||||
/**
|
||||
* create a string representation of a long, allocated from a pool
|
||||
* @param p The pool from which to allocate
|
||||
* @param n The number to format
|
||||
* @return The string representation of the number
|
||||
*/
|
||||
APR_DECLARE(char *) apr_ltoa(apr_pool_t *p, long n);
|
||||
|
||||
/**
|
||||
* create a string representation of an apr_off_t, allocated from a pool
|
||||
* @param p The pool from which to allocate
|
||||
* @param n The number to format
|
||||
* @return The string representation of the number
|
||||
*/
|
||||
APR_DECLARE(char *) apr_off_t_toa(apr_pool_t *p, apr_off_t n);
|
||||
|
||||
/**
|
||||
* Convert a numeric string into an apr_off_t numeric value.
|
||||
* @param offset The value of the parsed string.
|
||||
* @param buf The string to parse. It may contain optional whitespace,
|
||||
* followed by an optional '+' (positive, default) or '-' (negative)
|
||||
* character, followed by an optional '0x' prefix if base is 0 or 16,
|
||||
* followed by numeric digits appropriate for base.
|
||||
* @param end A pointer to the end of the valid character in buf. If
|
||||
* not NULL, it is set to the first invalid character in buf.
|
||||
* @param base A numeric base in the range between 2 and 36 inclusive,
|
||||
* or 0. If base is zero, buf will be treated as base ten unless its
|
||||
* digits are prefixed with '0x', in which case it will be treated as
|
||||
* base 16.
|
||||
* @bug *end breaks type safety; where *buf is const, *end needs to be
|
||||
* declared as const in APR 2.0
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_strtoff(apr_off_t *offset, const char *buf,
|
||||
char **end, int base);
|
||||
|
||||
/**
|
||||
* parse a numeric string into a 64-bit numeric value
|
||||
* @param buf The string to parse. It may contain optional whitespace,
|
||||
* followed by an optional '+' (positive, default) or '-' (negative)
|
||||
* character, followed by an optional '0x' prefix if base is 0 or 16,
|
||||
* followed by numeric digits appropriate for base.
|
||||
* @param end A pointer to the end of the valid character in buf. If
|
||||
* not NULL, it is set to the first invalid character in buf.
|
||||
* @param base A numeric base in the range between 2 and 36 inclusive,
|
||||
* or 0. If base is zero, buf will be treated as base ten unless its
|
||||
* digits are prefixed with '0x', in which case it will be treated as
|
||||
* base 16.
|
||||
* @return The numeric value of the string. On overflow, errno is set
|
||||
* to ERANGE. On success, errno is set to 0.
|
||||
*/
|
||||
APR_DECLARE(apr_int64_t) apr_strtoi64(const char *buf, char **end, int base);
|
||||
|
||||
/**
|
||||
* parse a base-10 numeric string into a 64-bit numeric value.
|
||||
* Equivalent to apr_strtoi64(buf, (char**)NULL, 10).
|
||||
* @param buf The string to parse
|
||||
* @return The numeric value of the string. On overflow, errno is set
|
||||
* to ERANGE. On success, errno is set to 0.
|
||||
*/
|
||||
APR_DECLARE(apr_int64_t) apr_atoi64(const char *buf);
|
||||
|
||||
/**
|
||||
* Format a binary size (magnitiudes are 2^10 rather than 10^3) from an apr_off_t,
|
||||
* as bytes, K, M, T, etc, to a four character compacted human readable string.
|
||||
* @param size The size to format
|
||||
* @param buf The 5 byte text buffer (counting the trailing null)
|
||||
* @return The buf passed to apr_strfsize()
|
||||
* @remark All negative sizes report ' - ', apr_strfsize only formats positive values.
|
||||
*/
|
||||
APR_DECLARE(char *) apr_strfsize(apr_off_t size, char *buf);
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !APR_STRINGS_H */
|
||||
81
database/apache/include/apr_strmatch.h
Normal file
81
database/apache/include/apr_strmatch.h
Normal file
@@ -0,0 +1,81 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_STRMATCH_H
|
||||
#define APR_STRMATCH_H
|
||||
/**
|
||||
* @file apr_strmatch.h
|
||||
* @brief APR-UTIL string matching routines
|
||||
*/
|
||||
|
||||
#include "apu.h"
|
||||
#include "apr_pools.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup APR_Util_StrMatch String matching routines
|
||||
* @ingroup APR_Util
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @see apr_strmatch_pattern */
|
||||
typedef struct apr_strmatch_pattern apr_strmatch_pattern;
|
||||
|
||||
/**
|
||||
* Precompiled search pattern
|
||||
*/
|
||||
struct apr_strmatch_pattern {
|
||||
/** Function called to compare */
|
||||
const char *(*compare)(const apr_strmatch_pattern *this_pattern,
|
||||
const char *s, apr_size_t slen);
|
||||
const char *pattern; /**< Current pattern */
|
||||
apr_size_t length; /**< Current length */
|
||||
void *context; /**< hook to add precomputed metadata */
|
||||
};
|
||||
|
||||
#if defined(DOXYGEN)
|
||||
/**
|
||||
* Search for a precompiled pattern within a string
|
||||
* @param pattern The pattern
|
||||
* @param s The string in which to search for the pattern
|
||||
* @param slen The length of s (excluding null terminator)
|
||||
* @return A pointer to the first instance of the pattern in s, or
|
||||
* NULL if not found
|
||||
*/
|
||||
APU_DECLARE(const char *) apr_strmatch(const apr_strmatch_pattern *pattern,
|
||||
const char *s, apr_size_t slen);
|
||||
#else
|
||||
#define apr_strmatch(pattern, s, slen) (*((pattern)->compare))((pattern), (s), (slen))
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Precompile a pattern for matching using the Boyer-Moore-Horspool algorithm
|
||||
* @param p The pool from which to allocate the pattern
|
||||
* @param s The pattern string
|
||||
* @param case_sensitive Whether the matching should be case-sensitive
|
||||
* @return a pointer to the compiled pattern, or NULL if compilation fails
|
||||
*/
|
||||
APU_DECLARE(const apr_strmatch_pattern *) apr_strmatch_precompile(apr_pool_t *p, const char *s, int case_sensitive);
|
||||
|
||||
/** @} */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !APR_STRMATCH_H */
|
||||
57
database/apache/include/apr_support.h
Normal file
57
database/apache/include/apr_support.h
Normal file
@@ -0,0 +1,57 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_SUPPORT_H
|
||||
#define APR_SUPPORT_H
|
||||
|
||||
/**
|
||||
* @file apr_support.h
|
||||
* @brief APR Support functions
|
||||
*/
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_network_io.h"
|
||||
#include "apr_file_io.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @defgroup apr_support Internal APR support functions
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Wait for IO to occur or timeout.
|
||||
*
|
||||
* @param f The file to wait on.
|
||||
* @param s The socket to wait on if @a f is @c NULL.
|
||||
* @param for_read If non-zero wait for data to be available to read,
|
||||
* otherwise wait for data to be able to be written.
|
||||
* @return APR_TIMEUP if we run out of time.
|
||||
*/
|
||||
apr_status_t apr_wait_for_io_or_timeout(apr_file_t *f, apr_socket_t *s,
|
||||
int for_read);
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ! APR_SUPPORT_H */
|
||||
507
database/apache/include/apr_tables.h
Normal file
507
database/apache/include/apr_tables.h
Normal file
@@ -0,0 +1,507 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_TABLES_H
|
||||
#define APR_TABLES_H
|
||||
|
||||
/**
|
||||
* @file apr_tables.h
|
||||
* @brief APR Table library
|
||||
*/
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_pools.h"
|
||||
|
||||
#if APR_HAVE_STDARG_H
|
||||
#include <stdarg.h> /* for va_list */
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @defgroup apr_tables Table and Array Functions
|
||||
* @ingroup APR
|
||||
* Arrays are used to store data which is referenced sequentially or
|
||||
* as a stack. Functions are provided to push and pop individual
|
||||
* elements as well as to operate on the entire array.
|
||||
*
|
||||
* Tables are used to store data which can be referenced by key.
|
||||
* Limited capabilities are provided for tables with multiple elements
|
||||
* which share a key; while key lookup will return only a single
|
||||
* element, iteration is available. Additionally, a table can be
|
||||
* compressed to resolve duplicates.
|
||||
*
|
||||
* Both arrays and tables may store string or binary data; some features,
|
||||
* such as concatenation or merging of elements, work only for string
|
||||
* data.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** the table abstract data type */
|
||||
typedef struct apr_table_t apr_table_t;
|
||||
|
||||
/** @see apr_array_header_t */
|
||||
typedef struct apr_array_header_t apr_array_header_t;
|
||||
|
||||
/** An opaque array type */
|
||||
struct apr_array_header_t {
|
||||
/** The pool the array is allocated out of */
|
||||
apr_pool_t *pool;
|
||||
/** The amount of memory allocated for each element of the array */
|
||||
int elt_size;
|
||||
/** The number of active elements in the array */
|
||||
int nelts;
|
||||
/** The number of elements allocated in the array */
|
||||
int nalloc;
|
||||
/** The elements in the array */
|
||||
char *elts;
|
||||
};
|
||||
|
||||
/**
|
||||
* The (opaque) structure for string-content tables.
|
||||
*/
|
||||
typedef struct apr_table_entry_t apr_table_entry_t;
|
||||
|
||||
/** The type for each entry in a string-content table */
|
||||
struct apr_table_entry_t {
|
||||
/** The key for the current table entry */
|
||||
char *key; /* maybe NULL in future;
|
||||
* check when iterating thru table_elts
|
||||
*/
|
||||
/** The value for the current table entry */
|
||||
char *val;
|
||||
|
||||
/** A checksum for the key, for use by the apr_table internals */
|
||||
apr_uint32_t key_checksum;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the elements from a table.
|
||||
* @param t The table
|
||||
* @return An array containing the contents of the table
|
||||
*/
|
||||
APR_DECLARE(const apr_array_header_t *) apr_table_elts(const apr_table_t *t);
|
||||
|
||||
/**
|
||||
* Determine if the table is empty (either NULL or having no elements).
|
||||
* @param t The table to check
|
||||
* @return True if empty, False otherwise
|
||||
*/
|
||||
APR_DECLARE(int) apr_is_empty_table(const apr_table_t *t);
|
||||
|
||||
/**
|
||||
* Determine if the array is empty (either NULL or having no elements).
|
||||
* @param a The array to check
|
||||
* @return True if empty, False otherwise
|
||||
*/
|
||||
APR_DECLARE(int) apr_is_empty_array(const apr_array_header_t *a);
|
||||
|
||||
/**
|
||||
* Create an array.
|
||||
* @param p The pool to allocate the memory out of
|
||||
* @param nelts the number of elements in the initial array
|
||||
* @param elt_size The size of each element in the array.
|
||||
* @return The new array
|
||||
*/
|
||||
APR_DECLARE(apr_array_header_t *) apr_array_make(apr_pool_t *p,
|
||||
int nelts, int elt_size);
|
||||
|
||||
/**
|
||||
* Add a new element to an array (as a first-in, last-out stack).
|
||||
* @param arr The array to add an element to.
|
||||
* @return Location for the new element in the array.
|
||||
* @remark If there are no free spots in the array, then this function will
|
||||
* allocate new space for the new element.
|
||||
*/
|
||||
APR_DECLARE(void *) apr_array_push(apr_array_header_t *arr);
|
||||
|
||||
/** A helper macro for accessing a member of an APR array.
|
||||
*
|
||||
* @param ary the array
|
||||
* @param i the index into the array to return
|
||||
* @param type the type of the objects stored in the array
|
||||
*
|
||||
* @return the item at index i
|
||||
*/
|
||||
#define APR_ARRAY_IDX(ary,i,type) (((type *)(ary)->elts)[i])
|
||||
|
||||
/** A helper macro for pushing elements into an APR array.
|
||||
*
|
||||
* @param ary the array
|
||||
* @param type the type of the objects stored in the array
|
||||
*
|
||||
* @return the location where the new object should be placed
|
||||
*/
|
||||
#define APR_ARRAY_PUSH(ary,type) (*((type *)apr_array_push(ary)))
|
||||
|
||||
/**
|
||||
* Remove an element from an array (as a first-in, last-out stack).
|
||||
* @param arr The array to remove an element from.
|
||||
* @return Location of the element in the array.
|
||||
* @remark If there are no elements in the array, NULL is returned.
|
||||
*/
|
||||
APR_DECLARE(void *) apr_array_pop(apr_array_header_t *arr);
|
||||
|
||||
/**
|
||||
* Remove all elements from an array.
|
||||
* @param arr The array to remove all elements from.
|
||||
* @remark As the underlying storage is allocated from a pool, no
|
||||
* memory is freed by this operation, but is available for reuse.
|
||||
*/
|
||||
APR_DECLARE(void) apr_array_clear(apr_array_header_t *arr);
|
||||
|
||||
/**
|
||||
* Concatenate two arrays together.
|
||||
* @param dst The destination array, and the one to go first in the combined
|
||||
* array
|
||||
* @param src The source array to add to the destination array
|
||||
*/
|
||||
APR_DECLARE(void) apr_array_cat(apr_array_header_t *dst,
|
||||
const apr_array_header_t *src);
|
||||
|
||||
/**
|
||||
* Copy the entire array.
|
||||
* @param p The pool to allocate the copy of the array out of
|
||||
* @param arr The array to copy
|
||||
* @return An exact copy of the array passed in
|
||||
* @remark The alternate apr_array_copy_hdr() copies only the header, and arranges
|
||||
* for the elements to be copied if (and only if) the code subsequently
|
||||
* does a push or arraycat.
|
||||
*/
|
||||
APR_DECLARE(apr_array_header_t *) apr_array_copy(apr_pool_t *p,
|
||||
const apr_array_header_t *arr);
|
||||
/**
|
||||
* Copy the headers of the array, and arrange for the elements to be copied if
|
||||
* and only if the code subsequently does a push or arraycat.
|
||||
* @param p The pool to allocate the copy of the array out of
|
||||
* @param arr The array to copy
|
||||
* @return An exact copy of the array passed in
|
||||
* @remark The alternate apr_array_copy() copies the *entire* array.
|
||||
*/
|
||||
APR_DECLARE(apr_array_header_t *) apr_array_copy_hdr(apr_pool_t *p,
|
||||
const apr_array_header_t *arr);
|
||||
|
||||
/**
|
||||
* Append one array to the end of another, creating a new array in the process.
|
||||
* @param p The pool to allocate the new array out of
|
||||
* @param first The array to put first in the new array.
|
||||
* @param second The array to put second in the new array.
|
||||
* @return A new array containing the data from the two arrays passed in.
|
||||
*/
|
||||
APR_DECLARE(apr_array_header_t *) apr_array_append(apr_pool_t *p,
|
||||
const apr_array_header_t *first,
|
||||
const apr_array_header_t *second);
|
||||
|
||||
/**
|
||||
* Generate a new string from the apr_pool_t containing the concatenated
|
||||
* sequence of substrings referenced as elements within the array. The string
|
||||
* will be empty if all substrings are empty or null, or if there are no
|
||||
* elements in the array. If sep is non-NUL, it will be inserted between
|
||||
* elements as a separator.
|
||||
* @param p The pool to allocate the string out of
|
||||
* @param arr The array to generate the string from
|
||||
* @param sep The separator to use
|
||||
* @return A string containing all of the data in the array.
|
||||
*/
|
||||
APR_DECLARE(char *) apr_array_pstrcat(apr_pool_t *p,
|
||||
const apr_array_header_t *arr,
|
||||
const char sep);
|
||||
|
||||
/**
|
||||
* Make a new table.
|
||||
* @param p The pool to allocate the pool out of
|
||||
* @param nelts The number of elements in the initial table.
|
||||
* @return The new table.
|
||||
* @warning This table can only store text data
|
||||
*/
|
||||
APR_DECLARE(apr_table_t *) apr_table_make(apr_pool_t *p, int nelts);
|
||||
|
||||
/**
|
||||
* Create a new table and copy another table into it.
|
||||
* @param p The pool to allocate the new table out of
|
||||
* @param t The table to copy
|
||||
* @return A copy of the table passed in
|
||||
* @warning The table keys and respective values are not copied
|
||||
*/
|
||||
APR_DECLARE(apr_table_t *) apr_table_copy(apr_pool_t *p,
|
||||
const apr_table_t *t);
|
||||
|
||||
/**
|
||||
* Create a new table whose contents are deep copied from the given
|
||||
* table. A deep copy operation copies all fields, and makes copies
|
||||
* of dynamically allocated memory pointed to by the fields.
|
||||
* @param p The pool to allocate the new table out of
|
||||
* @param t The table to clone
|
||||
* @return A deep copy of the table passed in
|
||||
*/
|
||||
APR_DECLARE(apr_table_t *) apr_table_clone(apr_pool_t *p,
|
||||
const apr_table_t *t);
|
||||
|
||||
/**
|
||||
* Delete all of the elements from a table.
|
||||
* @param t The table to clear
|
||||
*/
|
||||
APR_DECLARE(void) apr_table_clear(apr_table_t *t);
|
||||
|
||||
/**
|
||||
* Get the value associated with a given key from the table. After this call,
|
||||
* the data is still in the table.
|
||||
* @param t The table to search for the key
|
||||
* @param key The key to search for (case does not matter)
|
||||
* @return The value associated with the key, or NULL if the key does not exist.
|
||||
*/
|
||||
APR_DECLARE(const char *) apr_table_get(const apr_table_t *t, const char *key);
|
||||
|
||||
/**
|
||||
* Get values associated with a given key from the table. If more than one
|
||||
* value exists, return a comma separated list of values. After this call, the
|
||||
* data is still in the table.
|
||||
* @param p The pool to allocate the combined value from, if necessary
|
||||
* @param t The table to search for the key
|
||||
* @param key The key to search for (case does not matter)
|
||||
* @return The value associated with the key, or NULL if the key does not exist.
|
||||
*/
|
||||
APR_DECLARE(const char *) apr_table_getm(apr_pool_t *p, const apr_table_t *t,
|
||||
const char *key);
|
||||
|
||||
/**
|
||||
* Add a key/value pair to a table. If another element already exists with the
|
||||
* same key, this will overwrite the old data.
|
||||
* @param t The table to add the data to.
|
||||
* @param key The key to use (case does not matter)
|
||||
* @param val The value to add
|
||||
* @remark When adding data, this function makes a copy of both the key and the
|
||||
* value.
|
||||
*/
|
||||
APR_DECLARE(void) apr_table_set(apr_table_t *t, const char *key,
|
||||
const char *val);
|
||||
|
||||
/**
|
||||
* Add a key/value pair to a table. If another element already exists with the
|
||||
* same key, this will overwrite the old data.
|
||||
* @param t The table to add the data to.
|
||||
* @param key The key to use (case does not matter)
|
||||
* @param val The value to add
|
||||
* @warning When adding data, this function does not make a copy of the key or
|
||||
* the value, so care should be taken to ensure that the values will
|
||||
* not change after they have been added..
|
||||
*/
|
||||
APR_DECLARE(void) apr_table_setn(apr_table_t *t, const char *key,
|
||||
const char *val);
|
||||
|
||||
/**
|
||||
* Remove data from the table.
|
||||
* @param t The table to remove data from
|
||||
* @param key The key of the data being removed (case does not matter)
|
||||
*/
|
||||
APR_DECLARE(void) apr_table_unset(apr_table_t *t, const char *key);
|
||||
|
||||
/**
|
||||
* Add data to a table by merging the value with data that has already been
|
||||
* stored. The merging is done by concatenating the two values, separated
|
||||
* by the string ", ".
|
||||
* @param t The table to search for the data
|
||||
* @param key The key to merge data for (case does not matter)
|
||||
* @param val The data to add
|
||||
* @remark If the key is not found, then this function acts like apr_table_add()
|
||||
*/
|
||||
APR_DECLARE(void) apr_table_merge(apr_table_t *t, const char *key,
|
||||
const char *val);
|
||||
|
||||
/**
|
||||
* Add data to a table by merging the value with data that has already been
|
||||
* stored. The merging is done by concatenating the two values, separated
|
||||
* by the string ", ".
|
||||
* @param t The table to search for the data
|
||||
* @param key The key to merge data for (case does not matter)
|
||||
* @param val The data to add
|
||||
* @remark If the key is not found, then this function acts like apr_table_addn()
|
||||
*/
|
||||
APR_DECLARE(void) apr_table_mergen(apr_table_t *t, const char *key,
|
||||
const char *val);
|
||||
|
||||
/**
|
||||
* Add data to a table, regardless of whether there is another element with the
|
||||
* same key.
|
||||
* @param t The table to add to
|
||||
* @param key The key to use
|
||||
* @param val The value to add.
|
||||
* @remark When adding data, this function makes a copy of both the key and the
|
||||
* value.
|
||||
*/
|
||||
APR_DECLARE(void) apr_table_add(apr_table_t *t, const char *key,
|
||||
const char *val);
|
||||
|
||||
/**
|
||||
* Add data to a table, regardless of whether there is another element with the
|
||||
* same key.
|
||||
* @param t The table to add to
|
||||
* @param key The key to use
|
||||
* @param val The value to add.
|
||||
* @remark When adding data, this function does not make a copy of the key or the
|
||||
* value, so care should be taken to ensure that the values will not
|
||||
* change after they have been added.
|
||||
*/
|
||||
APR_DECLARE(void) apr_table_addn(apr_table_t *t, const char *key,
|
||||
const char *val);
|
||||
|
||||
/**
|
||||
* Merge two tables into one new table.
|
||||
* @param p The pool to use for the new table
|
||||
* @param overlay The first table to put in the new table
|
||||
* @param base The table to add at the end of the new table
|
||||
* @return A new table containing all of the data from the two passed in
|
||||
*/
|
||||
APR_DECLARE(apr_table_t *) apr_table_overlay(apr_pool_t *p,
|
||||
const apr_table_t *overlay,
|
||||
const apr_table_t *base);
|
||||
|
||||
/**
|
||||
* Declaration prototype for the iterator callback function of apr_table_do()
|
||||
* and apr_table_vdo().
|
||||
* @param rec The data passed as the first argument to apr_table_[v]do()
|
||||
* @param key The key from this iteration of the table
|
||||
* @param value The value from this iteration of the table
|
||||
* @remark Iteration continues while this callback function returns non-zero.
|
||||
* To export the callback function for apr_table_[v]do() it must be declared
|
||||
* in the _NONSTD convention.
|
||||
* @see apr_table_do @see apr_table_vdo
|
||||
*/
|
||||
typedef int (apr_table_do_callback_fn_t)(void *rec, const char *key,
|
||||
const char *value);
|
||||
|
||||
/**
|
||||
* Iterate over a table running the provided function once for every
|
||||
* element in the table. The varargs array must be a list of zero or
|
||||
* more (char *) keys followed by a NULL pointer. If zero keys are
|
||||
* given, the @p comp function will be invoked for every element
|
||||
* in the table. Otherwise, the function is invoked only for those
|
||||
* elements matching the keys specified.
|
||||
*
|
||||
* If an invocation of the @p comp function returns zero,
|
||||
* iteration will continue using the next specified key, if any.
|
||||
*
|
||||
* @param comp The function to run
|
||||
* @param rec The data to pass as the first argument to the function
|
||||
* @param t The table to iterate over
|
||||
* @param ... A varargs array of zero or more (char *) keys followed by NULL
|
||||
* @return FALSE if one of the comp() iterations returned zero; TRUE if all
|
||||
* iterations returned non-zero
|
||||
* @see apr_table_do_callback_fn_t @see apr_table_vdo
|
||||
*/
|
||||
APR_DECLARE_NONSTD(int) apr_table_do(apr_table_do_callback_fn_t *comp,
|
||||
void *rec, const apr_table_t *t, ...)
|
||||
#if defined(__GNUC__) && __GNUC__ >= 4
|
||||
__attribute__((sentinel))
|
||||
#endif
|
||||
;
|
||||
|
||||
/**
|
||||
* Iterate over a table running the provided function once for every
|
||||
* element in the table. The @p vp varargs parameter must be a
|
||||
* list of zero or more (char *) keys followed by a NULL pointer. If
|
||||
* zero keys are given, the @p comp function will be invoked for
|
||||
* every element in the table. Otherwise, the function is invoked
|
||||
* only for those elements matching the keys specified.
|
||||
*
|
||||
* If an invocation of the @p comp function returns zero,
|
||||
* iteration will continue using the next specified key, if any.
|
||||
*
|
||||
* @param comp The function to run
|
||||
* @param rec The data to pass as the first argument to the function
|
||||
* @param t The table to iterate over
|
||||
* @param vp List of zero or more (char *) keys followed by NULL
|
||||
* @return FALSE if one of the comp() iterations returned zero; TRUE if all
|
||||
* iterations returned non-zero
|
||||
* @see apr_table_do_callback_fn_t @see apr_table_do
|
||||
*/
|
||||
APR_DECLARE(int) apr_table_vdo(apr_table_do_callback_fn_t *comp,
|
||||
void *rec, const apr_table_t *t, va_list vp);
|
||||
|
||||
/** flag for overlap to use apr_table_setn */
|
||||
#define APR_OVERLAP_TABLES_SET (0)
|
||||
/** flag for overlap to use apr_table_mergen */
|
||||
#define APR_OVERLAP_TABLES_MERGE (1)
|
||||
/** flag for overlap to use apr_table_addn */
|
||||
#define APR_OVERLAP_TABLES_ADD (2)
|
||||
/**
|
||||
* For each element in table b, either use setn or mergen to add the data
|
||||
* to table a. Which method is used is determined by the flags passed in.
|
||||
* @param a The table to add the data to.
|
||||
* @param b The table to iterate over, adding its data to table a
|
||||
* @param flags How to add the table to table a. One of:
|
||||
* APR_OVERLAP_TABLES_SET Use apr_table_setn
|
||||
* APR_OVERLAP_TABLES_MERGE Use apr_table_mergen
|
||||
* APR_OVERLAP_TABLES_ADD Use apr_table_addn
|
||||
* @remark When merging duplicates, the two values are concatenated,
|
||||
* separated by the string ", ".
|
||||
* @remark This function is highly optimized, and uses less memory and CPU cycles
|
||||
* than a function that just loops through table b calling other functions.
|
||||
*/
|
||||
/**
|
||||
* Conceptually, apr_table_overlap does this:
|
||||
*
|
||||
* <pre>
|
||||
* apr_array_header_t *barr = apr_table_elts(b);
|
||||
* apr_table_entry_t *belt = (apr_table_entry_t *)barr->elts;
|
||||
* int i;
|
||||
*
|
||||
* for (i = 0; i < barr->nelts; ++i) {
|
||||
* if (flags & APR_OVERLAP_TABLES_MERGE) {
|
||||
* apr_table_mergen(a, belt[i].key, belt[i].val);
|
||||
* }
|
||||
* else if (flags & APR_OVERLAP_TABLES_ADD) {
|
||||
* apr_table_addn(a, belt[i].key, belt[i].val);
|
||||
* }
|
||||
* else {
|
||||
* apr_table_setn(a, belt[i].key, belt[i].val);
|
||||
* }
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* Except that it is more efficient (less space and cpu-time) especially
|
||||
* when b has many elements.
|
||||
*
|
||||
* Notice the assumptions on the keys and values in b -- they must be
|
||||
* in an ancestor of a's pool. In practice b and a are usually from
|
||||
* the same pool.
|
||||
*/
|
||||
|
||||
APR_DECLARE(void) apr_table_overlap(apr_table_t *a, const apr_table_t *b,
|
||||
unsigned flags);
|
||||
|
||||
/**
|
||||
* Eliminate redundant entries in a table by either overwriting
|
||||
* or merging duplicates.
|
||||
*
|
||||
* @param t Table.
|
||||
* @param flags APR_OVERLAP_TABLES_MERGE to merge, or
|
||||
* APR_OVERLAP_TABLES_SET to overwrite, or
|
||||
* APR_OVERLAP_TABLES_ADD to add
|
||||
* @remark When merging duplicates, the two values are concatenated,
|
||||
* separated by the string ", ".
|
||||
*/
|
||||
APR_DECLARE(void) apr_table_compress(apr_table_t *t, unsigned flags);
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ! APR_TABLES_H */
|
||||
139
database/apache/include/apr_thread_cond.h
Normal file
139
database/apache/include/apr_thread_cond.h
Normal file
@@ -0,0 +1,139 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_THREAD_COND_H
|
||||
#define APR_THREAD_COND_H
|
||||
|
||||
/**
|
||||
* @file apr_thread_cond.h
|
||||
* @brief APR Condition Variable Routines
|
||||
*/
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_pools.h"
|
||||
#include "apr_errno.h"
|
||||
#include "apr_time.h"
|
||||
#include "apr_thread_mutex.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#if APR_HAS_THREADS || defined(DOXYGEN)
|
||||
|
||||
/**
|
||||
* @defgroup apr_thread_cond Condition Variable Routines
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** Opaque structure for thread condition variables */
|
||||
typedef struct apr_thread_cond_t apr_thread_cond_t;
|
||||
|
||||
/**
|
||||
* Note: destroying a condition variable (or likewise, destroying or
|
||||
* clearing the pool from which a condition variable was allocated) if
|
||||
* any threads are blocked waiting on it gives undefined results.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Create and initialize a condition variable that can be used to signal
|
||||
* and schedule threads in a single process.
|
||||
* @param cond the memory address where the newly created condition variable
|
||||
* will be stored.
|
||||
* @param pool the pool from which to allocate the condition.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_thread_cond_create(apr_thread_cond_t **cond,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Put the active calling thread to sleep until signaled to wake up. Each
|
||||
* condition variable must be associated with a mutex, and that mutex must
|
||||
* be locked before calling this function, or the behavior will be
|
||||
* undefined. As the calling thread is put to sleep, the given mutex
|
||||
* will be simultaneously released; and as this thread wakes up the lock
|
||||
* is again simultaneously acquired.
|
||||
* @param cond the condition variable on which to block.
|
||||
* @param mutex the mutex that must be locked upon entering this function,
|
||||
* is released while the thread is asleep, and is again acquired before
|
||||
* returning from this function.
|
||||
* @remark Spurious wakeups may occur. Before and after every call to wait on
|
||||
* a condition variable, the caller should test whether the condition is already
|
||||
* met.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_thread_cond_wait(apr_thread_cond_t *cond,
|
||||
apr_thread_mutex_t *mutex);
|
||||
|
||||
/**
|
||||
* Put the active calling thread to sleep until signaled to wake up or
|
||||
* the timeout is reached. Each condition variable must be associated
|
||||
* with a mutex, and that mutex must be locked before calling this
|
||||
* function, or the behavior will be undefined. As the calling thread
|
||||
* is put to sleep, the given mutex will be simultaneously released;
|
||||
* and as this thread wakes up the lock is again simultaneously acquired.
|
||||
* @param cond the condition variable on which to block.
|
||||
* @param mutex the mutex that must be locked upon entering this function,
|
||||
* is released while the thread is asleep, and is again acquired before
|
||||
* returning from this function.
|
||||
* @param timeout The amount of time in microseconds to wait. This is
|
||||
* a maximum, not a minimum. If the condition is signaled, we
|
||||
* will wake up before this time, otherwise the error APR_TIMEUP
|
||||
* is returned.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_thread_cond_timedwait(apr_thread_cond_t *cond,
|
||||
apr_thread_mutex_t *mutex,
|
||||
apr_interval_time_t timeout);
|
||||
|
||||
/**
|
||||
* Signals a single thread, if one exists, that is blocking on the given
|
||||
* condition variable. That thread is then scheduled to wake up and acquire
|
||||
* the associated mutex. Although it is not required, if predictable scheduling
|
||||
* is desired, that mutex must be locked while calling this function.
|
||||
* @param cond the condition variable on which to produce the signal.
|
||||
* @remark If no threads are waiting on the condition variable, nothing happens.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_thread_cond_signal(apr_thread_cond_t *cond);
|
||||
|
||||
/**
|
||||
* Signals all threads blocking on the given condition variable.
|
||||
* Each thread that was signaled is then scheduled to wake up and acquire
|
||||
* the associated mutex. This will happen in a serialized manner.
|
||||
* @param cond the condition variable on which to produce the broadcast.
|
||||
* @remark If no threads are waiting on the condition variable, nothing happens.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_thread_cond_broadcast(apr_thread_cond_t *cond);
|
||||
|
||||
/**
|
||||
* Destroy the condition variable and free the associated memory.
|
||||
* @param cond the condition variable to destroy.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_thread_cond_destroy(apr_thread_cond_t *cond);
|
||||
|
||||
/**
|
||||
* Get the pool used by this thread_cond.
|
||||
* @return apr_pool_t the pool
|
||||
*/
|
||||
APR_POOL_DECLARE_ACCESSOR(thread_cond);
|
||||
|
||||
#endif /* APR_HAS_THREADS */
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ! APR_THREAD_COND_H */
|
||||
123
database/apache/include/apr_thread_mutex.h
Normal file
123
database/apache/include/apr_thread_mutex.h
Normal file
@@ -0,0 +1,123 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_THREAD_MUTEX_H
|
||||
#define APR_THREAD_MUTEX_H
|
||||
|
||||
/**
|
||||
* @file apr_thread_mutex.h
|
||||
* @brief APR Thread Mutex Routines
|
||||
*/
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_errno.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#if APR_HAS_THREADS || defined(DOXYGEN)
|
||||
|
||||
/**
|
||||
* @defgroup apr_thread_mutex Thread Mutex Routines
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** Opaque thread-local mutex structure */
|
||||
typedef struct apr_thread_mutex_t apr_thread_mutex_t;
|
||||
|
||||
#define APR_THREAD_MUTEX_DEFAULT 0x0 /**< platform-optimal lock behavior */
|
||||
#define APR_THREAD_MUTEX_NESTED 0x1 /**< enable nested (recursive) locks */
|
||||
#define APR_THREAD_MUTEX_UNNESTED 0x2 /**< disable nested locks */
|
||||
#define APR_THREAD_MUTEX_TIMED 0x4 /**< enable timed locks */
|
||||
|
||||
/* Delayed the include to avoid a circular reference */
|
||||
#include "apr_pools.h"
|
||||
#include "apr_time.h"
|
||||
|
||||
/**
|
||||
* Create and initialize a mutex that can be used to synchronize threads.
|
||||
* @param mutex the memory address where the newly created mutex will be
|
||||
* stored.
|
||||
* @param flags Or'ed value of:
|
||||
* <PRE>
|
||||
* APR_THREAD_MUTEX_DEFAULT platform-optimal lock behavior.
|
||||
* APR_THREAD_MUTEX_NESTED enable nested (recursive) locks.
|
||||
* APR_THREAD_MUTEX_UNNESTED disable nested locks (non-recursive).
|
||||
* </PRE>
|
||||
* @param pool the pool from which to allocate the mutex.
|
||||
* @warning Be cautious in using APR_THREAD_MUTEX_DEFAULT. While this is the
|
||||
* most optimal mutex based on a given platform's performance characteristics,
|
||||
* it will behave as either a nested or an unnested lock.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_thread_mutex_create(apr_thread_mutex_t **mutex,
|
||||
unsigned int flags,
|
||||
apr_pool_t *pool);
|
||||
/**
|
||||
* Acquire the lock for the given mutex. If the mutex is already locked,
|
||||
* the current thread will be put to sleep until the lock becomes available.
|
||||
* @param mutex the mutex on which to acquire the lock.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_thread_mutex_lock(apr_thread_mutex_t *mutex);
|
||||
|
||||
/**
|
||||
* Attempt to acquire the lock for the given mutex. If the mutex has already
|
||||
* been acquired, the call returns immediately with APR_EBUSY. Note: it
|
||||
* is important that the APR_STATUS_IS_EBUSY(s) macro be used to determine
|
||||
* if the return value was APR_EBUSY, for portability reasons.
|
||||
* @param mutex the mutex on which to attempt the lock acquiring.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_thread_mutex_trylock(apr_thread_mutex_t *mutex);
|
||||
|
||||
/**
|
||||
* Attempt to acquire the lock for the given mutex until timeout expires.
|
||||
* If the acquisition time outs, the call returns with APR_TIMEUP.
|
||||
* @param mutex the mutex on which to attempt the lock acquiring.
|
||||
* @param timeout the relative timeout (microseconds).
|
||||
* @note A timeout negative or nul means immediate attempt, returning
|
||||
* APR_TIMEUP without blocking if it the lock is already acquired.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_thread_mutex_timedlock(apr_thread_mutex_t *mutex,
|
||||
apr_interval_time_t timeout);
|
||||
|
||||
/**
|
||||
* Release the lock for the given mutex.
|
||||
* @param mutex the mutex from which to release the lock.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_thread_mutex_unlock(apr_thread_mutex_t *mutex);
|
||||
|
||||
/**
|
||||
* Destroy the mutex and free the memory associated with the lock.
|
||||
* @param mutex the mutex to destroy.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_thread_mutex_destroy(apr_thread_mutex_t *mutex);
|
||||
|
||||
/**
|
||||
* Get the pool used by this thread_mutex.
|
||||
* @return apr_pool_t the pool
|
||||
*/
|
||||
APR_POOL_DECLARE_ACCESSOR(thread_mutex);
|
||||
|
||||
#endif /* APR_HAS_THREADS */
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ! APR_THREAD_MUTEX_H */
|
||||
299
database/apache/include/apr_thread_pool.h
Normal file
299
database/apache/include/apr_thread_pool.h
Normal file
@@ -0,0 +1,299 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APU_THREAD_POOL_H
|
||||
#define APU_THREAD_POOL_H
|
||||
|
||||
#include "apu.h"
|
||||
#include "apr_thread_proc.h"
|
||||
|
||||
/**
|
||||
* @file apr_thread_pool.h
|
||||
* @brief APR Thread Pool Library
|
||||
|
||||
* @remarks This library implements a thread pool using apr_thread_t. A thread
|
||||
* pool is a set of threads that can be created in advance or on demand until a
|
||||
* maximum number. When a task is scheduled, the thread pool will find an idle
|
||||
* thread to handle the task. In case all existing threads are busy and the
|
||||
* number of tasks in the queue is higher than the adjustable threshold, the
|
||||
* pool will try to create a new thread to serve the task if the maximum number
|
||||
* has not been reached. Otherwise, the task will be put into a queue based on
|
||||
* priority, which can be valued from 0 to 255, with higher values being served
|
||||
* first. If there are tasks with the same priority, the new task might be put at
|
||||
* the top or at the bottom - it depends on which function is used to put the task.
|
||||
*
|
||||
* @remarks There may be the case where the thread pool can use up to the maximum
|
||||
* number of threads at peak load, but having those threads idle afterwards. A
|
||||
* maximum number of idle threads can be set so that the extra idling threads will
|
||||
* be terminated to save system resources.
|
||||
*/
|
||||
#if APR_HAS_THREADS
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @defgroup APR_Util_TP Thread Pool routines
|
||||
* @ingroup APR_Util
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** Opaque Thread Pool structure. */
|
||||
typedef struct apr_thread_pool apr_thread_pool_t;
|
||||
|
||||
#define APR_THREAD_TASK_PRIORITY_LOWEST 0
|
||||
#define APR_THREAD_TASK_PRIORITY_LOW 63
|
||||
#define APR_THREAD_TASK_PRIORITY_NORMAL 127
|
||||
#define APR_THREAD_TASK_PRIORITY_HIGH 191
|
||||
#define APR_THREAD_TASK_PRIORITY_HIGHEST 255
|
||||
|
||||
/**
|
||||
* Create a thread pool
|
||||
* @param me The pointer in which to return the newly created apr_thread_pool
|
||||
* object, or NULL if thread pool creation fails.
|
||||
* @param init_threads The number of threads to be created initially, this number
|
||||
* will also be used as the initial value for the maximum number of idle threads.
|
||||
* @param max_threads The maximum number of threads that can be created
|
||||
* @param pool The pool to use
|
||||
* @return APR_SUCCESS if the thread pool was created successfully. Otherwise,
|
||||
* the error code.
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_thread_pool_create(apr_thread_pool_t **me,
|
||||
apr_size_t init_threads,
|
||||
apr_size_t max_threads,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Destroy the thread pool and stop all the threads
|
||||
* @return APR_SUCCESS if all threads are stopped.
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_thread_pool_destroy(apr_thread_pool_t *me);
|
||||
|
||||
/**
|
||||
* Schedule a task to the bottom of the tasks of same priority.
|
||||
* @param me The thread pool
|
||||
* @param func The task function
|
||||
* @param param The parameter for the task function
|
||||
* @param priority The priority of the task.
|
||||
* @param owner Owner of this task.
|
||||
* @return APR_SUCCESS if the task had been scheduled successfully
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_thread_pool_push(apr_thread_pool_t *me,
|
||||
apr_thread_start_t func,
|
||||
void *param,
|
||||
apr_byte_t priority,
|
||||
void *owner);
|
||||
/**
|
||||
* Schedule a task to be run after a delay
|
||||
* @param me The thread pool
|
||||
* @param func The task function
|
||||
* @param param The parameter for the task function
|
||||
* @param time Time in microseconds
|
||||
* @param owner Owner of this task.
|
||||
* @return APR_SUCCESS if the task had been scheduled successfully
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_thread_pool_schedule(apr_thread_pool_t *me,
|
||||
apr_thread_start_t func,
|
||||
void *param,
|
||||
apr_interval_time_t time,
|
||||
void *owner);
|
||||
|
||||
/**
|
||||
* Schedule a task to the top of the tasks of same priority.
|
||||
* @param me The thread pool
|
||||
* @param func The task function
|
||||
* @param param The parameter for the task function
|
||||
* @param priority The priority of the task.
|
||||
* @param owner Owner of this task.
|
||||
* @return APR_SUCCESS if the task had been scheduled successfully
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_thread_pool_top(apr_thread_pool_t *me,
|
||||
apr_thread_start_t func,
|
||||
void *param,
|
||||
apr_byte_t priority,
|
||||
void *owner);
|
||||
|
||||
/**
|
||||
* Cancel tasks submitted by the owner. If there is any task from the owner that
|
||||
* is currently running, the function will spin until the task finished.
|
||||
* @param me The thread pool
|
||||
* @param owner Owner of the task
|
||||
* @return APR_SUCCESS if the task has been cancelled successfully
|
||||
* @note The task function should not be calling cancel, otherwise the function
|
||||
* may get stuck forever. The function assert if it detect such a case.
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_thread_pool_tasks_cancel(apr_thread_pool_t *me,
|
||||
void *owner);
|
||||
|
||||
/**
|
||||
* Get the current number of tasks waiting in the queue
|
||||
* @param me The thread pool
|
||||
* @return Number of tasks in the queue
|
||||
*/
|
||||
APU_DECLARE(apr_size_t) apr_thread_pool_tasks_count(apr_thread_pool_t *me);
|
||||
|
||||
/**
|
||||
* Get the current number of scheduled tasks waiting in the queue
|
||||
* @param me The thread pool
|
||||
* @return Number of scheduled tasks in the queue
|
||||
*/
|
||||
APU_DECLARE(apr_size_t) apr_thread_pool_scheduled_tasks_count(apr_thread_pool_t *me);
|
||||
|
||||
/**
|
||||
* Get the current number of threads
|
||||
* @param me The thread pool
|
||||
* @return Total number of threads
|
||||
*/
|
||||
APU_DECLARE(apr_size_t) apr_thread_pool_threads_count(apr_thread_pool_t *me);
|
||||
|
||||
/**
|
||||
* Get the current number of busy threads
|
||||
* @param me The thread pool
|
||||
* @return Number of busy threads
|
||||
*/
|
||||
APU_DECLARE(apr_size_t) apr_thread_pool_busy_count(apr_thread_pool_t *me);
|
||||
|
||||
/**
|
||||
* Get the current number of idle threads
|
||||
* @param me The thread pool
|
||||
* @return Number of idle threads
|
||||
*/
|
||||
APU_DECLARE(apr_size_t) apr_thread_pool_idle_count(apr_thread_pool_t *me);
|
||||
|
||||
/**
|
||||
* Access function for the maximum number of idle threads. Number of current
|
||||
* idle threads will be reduced to the new limit.
|
||||
* @param me The thread pool
|
||||
* @param cnt The number
|
||||
* @return The number of threads that were stopped.
|
||||
*/
|
||||
APU_DECLARE(apr_size_t) apr_thread_pool_idle_max_set(apr_thread_pool_t *me,
|
||||
apr_size_t cnt);
|
||||
|
||||
/**
|
||||
* Get number of tasks that have run
|
||||
* @param me The thread pool
|
||||
* @return Number of tasks that have run
|
||||
*/
|
||||
APU_DECLARE(apr_size_t)
|
||||
apr_thread_pool_tasks_run_count(apr_thread_pool_t * me);
|
||||
|
||||
/**
|
||||
* Get high water mark of the number of tasks waiting to run
|
||||
* @param me The thread pool
|
||||
* @return High water mark of tasks waiting to run
|
||||
*/
|
||||
APU_DECLARE(apr_size_t)
|
||||
apr_thread_pool_tasks_high_count(apr_thread_pool_t * me);
|
||||
|
||||
/**
|
||||
* Get high water mark of the number of threads
|
||||
* @param me The thread pool
|
||||
* @return High water mark of threads in thread pool
|
||||
*/
|
||||
APU_DECLARE(apr_size_t)
|
||||
apr_thread_pool_threads_high_count(apr_thread_pool_t * me);
|
||||
|
||||
/**
|
||||
* Get the number of idle threads that were destroyed after timing out
|
||||
* @param me The thread pool
|
||||
* @return Number of idle threads that timed out
|
||||
*/
|
||||
APU_DECLARE(apr_size_t)
|
||||
apr_thread_pool_threads_idle_timeout_count(apr_thread_pool_t * me);
|
||||
|
||||
/**
|
||||
* Access function for the maximum number of idle threads
|
||||
* @param me The thread pool
|
||||
* @return The current maximum number
|
||||
*/
|
||||
APU_DECLARE(apr_size_t) apr_thread_pool_idle_max_get(apr_thread_pool_t *me);
|
||||
|
||||
/**
|
||||
* Access function for the maximum number of threads.
|
||||
* @param me The thread pool
|
||||
* @param cnt Number of threads
|
||||
* @return The original maximum number of threads
|
||||
*/
|
||||
APU_DECLARE(apr_size_t) apr_thread_pool_thread_max_set(apr_thread_pool_t *me,
|
||||
apr_size_t cnt);
|
||||
|
||||
/**
|
||||
* Access function for the maximum wait time (in microseconds) of an
|
||||
* idling thread that exceeds the maximum number of idling threads.
|
||||
* A non-zero value allows for the reaping of idling threads to shrink
|
||||
* over time. Which helps reduce thrashing.
|
||||
* @param me The thread pool
|
||||
* @param timeout The number of microseconds an idle thread should wait
|
||||
* till it reaps itself
|
||||
* @return The original maximum wait time
|
||||
*/
|
||||
APU_DECLARE(apr_interval_time_t)
|
||||
apr_thread_pool_idle_wait_set(apr_thread_pool_t * me,
|
||||
apr_interval_time_t timeout);
|
||||
|
||||
/**
|
||||
* Access function for the maximum wait time (in microseconds) of an
|
||||
* idling thread that exceeds the maximum number of idling threads
|
||||
* @param me The thread pool
|
||||
* @return The current maximum wait time
|
||||
*/
|
||||
APU_DECLARE(apr_interval_time_t)
|
||||
apr_thread_pool_idle_wait_get(apr_thread_pool_t * me);
|
||||
|
||||
/**
|
||||
* Access function for the maximum number of threads
|
||||
* @param me The thread pool
|
||||
* @return The current maximum number
|
||||
*/
|
||||
APU_DECLARE(apr_size_t) apr_thread_pool_thread_max_get(apr_thread_pool_t *me);
|
||||
|
||||
/**
|
||||
* Access function for the threshold of tasks in queue to trigger a new thread.
|
||||
* @param me The thread pool
|
||||
* @param cnt The new threshold
|
||||
* @return The original threshold
|
||||
*/
|
||||
APU_DECLARE(apr_size_t) apr_thread_pool_threshold_set(apr_thread_pool_t *me,
|
||||
apr_size_t val);
|
||||
|
||||
/**
|
||||
* Access function for the threshold of tasks in queue to trigger a new thread.
|
||||
* @param me The thread pool
|
||||
* @return The current threshold
|
||||
*/
|
||||
APU_DECLARE(apr_size_t) apr_thread_pool_threshold_get(apr_thread_pool_t * me);
|
||||
|
||||
/**
|
||||
* Get owner of the task currently been executed by the thread.
|
||||
* @param thd The thread is executing a task
|
||||
* @param owner Pointer to receive owner of the task.
|
||||
* @return APR_SUCCESS if the owner is retrieved successfully
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_thread_pool_task_owner_get(apr_thread_t *thd,
|
||||
void **owner);
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* APR_HAS_THREADS */
|
||||
#endif /* !APR_THREAD_POOL_H */
|
||||
846
database/apache/include/apr_thread_proc.h
Normal file
846
database/apache/include/apr_thread_proc.h
Normal file
@@ -0,0 +1,846 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_THREAD_PROC_H
|
||||
#define APR_THREAD_PROC_H
|
||||
|
||||
/**
|
||||
* @file apr_thread_proc.h
|
||||
* @brief APR Thread and Process Library
|
||||
*/
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_file_io.h"
|
||||
#include "apr_pools.h"
|
||||
#include "apr_errno.h"
|
||||
#include "apr_perms_set.h"
|
||||
|
||||
#if APR_HAVE_STRUCT_RLIMIT
|
||||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @defgroup apr_thread_proc Threads and Process Functions
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
APR_SHELLCMD, /**< use the shell to invoke the program */
|
||||
APR_PROGRAM, /**< invoke the program directly, no copied env */
|
||||
APR_PROGRAM_ENV, /**< invoke the program, replicating our environment */
|
||||
APR_PROGRAM_PATH, /**< find program on PATH, use our environment */
|
||||
APR_SHELLCMD_ENV /**< use the shell to invoke the program,
|
||||
* replicating our environment
|
||||
*/
|
||||
} apr_cmdtype_e;
|
||||
|
||||
typedef enum {
|
||||
APR_WAIT, /**< wait for the specified process to finish */
|
||||
APR_NOWAIT /**< do not wait -- just see if it has finished */
|
||||
} apr_wait_how_e;
|
||||
|
||||
/* I am specifically calling out the values so that the macros below make
|
||||
* more sense. Yes, I know I don't need to, but I am hoping this makes what
|
||||
* I am doing more clear. If you want to add more reasons to exit, continue
|
||||
* to use bitmasks.
|
||||
*/
|
||||
typedef enum {
|
||||
APR_PROC_EXIT = 1, /**< process exited normally */
|
||||
APR_PROC_SIGNAL = 2, /**< process exited due to a signal */
|
||||
APR_PROC_SIGNAL_CORE = 4 /**< process exited and dumped a core file */
|
||||
} apr_exit_why_e;
|
||||
|
||||
/** did we exit the process */
|
||||
#define APR_PROC_CHECK_EXIT(x) (x & APR_PROC_EXIT)
|
||||
/** did we get a signal */
|
||||
#define APR_PROC_CHECK_SIGNALED(x) (x & APR_PROC_SIGNAL)
|
||||
/** did we get core */
|
||||
#define APR_PROC_CHECK_CORE_DUMP(x) (x & APR_PROC_SIGNAL_CORE)
|
||||
|
||||
/** @see apr_procattr_io_set */
|
||||
#define APR_NO_PIPE 0
|
||||
/** @see apr_procattr_io_set and apr_file_pipe_create_ex */
|
||||
#define APR_FULL_BLOCK 1
|
||||
/** @see apr_procattr_io_set and apr_file_pipe_create_ex */
|
||||
#define APR_FULL_NONBLOCK 2
|
||||
/** @see apr_procattr_io_set */
|
||||
#define APR_PARENT_BLOCK 3
|
||||
/** @see apr_procattr_io_set */
|
||||
#define APR_CHILD_BLOCK 4
|
||||
/** @see apr_procattr_io_set */
|
||||
#define APR_NO_FILE 8
|
||||
|
||||
/** @see apr_file_pipe_create_ex */
|
||||
#define APR_READ_BLOCK 3
|
||||
/** @see apr_file_pipe_create_ex */
|
||||
#define APR_WRITE_BLOCK 4
|
||||
|
||||
/** @see apr_procattr_io_set
|
||||
* @note Win32 only effective with version 1.2.12, portably introduced in 1.3.0
|
||||
*/
|
||||
#define APR_NO_FILE 8
|
||||
|
||||
/** @see apr_procattr_limit_set */
|
||||
#define APR_LIMIT_CPU 0
|
||||
/** @see apr_procattr_limit_set */
|
||||
#define APR_LIMIT_MEM 1
|
||||
/** @see apr_procattr_limit_set */
|
||||
#define APR_LIMIT_NPROC 2
|
||||
/** @see apr_procattr_limit_set */
|
||||
#define APR_LIMIT_NOFILE 3
|
||||
|
||||
/**
|
||||
* @defgroup APR_OC Other Child Flags
|
||||
* @{
|
||||
*/
|
||||
#define APR_OC_REASON_DEATH 0 /**< child has died, caller must call
|
||||
* unregister still */
|
||||
#define APR_OC_REASON_UNWRITABLE 1 /**< write_fd is unwritable */
|
||||
#define APR_OC_REASON_RESTART 2 /**< a restart is occurring, perform
|
||||
* any necessary cleanup (including
|
||||
* sending a special signal to child)
|
||||
*/
|
||||
#define APR_OC_REASON_UNREGISTER 3 /**< unregister has been called, do
|
||||
* whatever is necessary (including
|
||||
* kill the child) */
|
||||
#define APR_OC_REASON_LOST 4 /**< somehow the child exited without
|
||||
* us knowing ... buggy os? */
|
||||
#define APR_OC_REASON_RUNNING 5 /**< a health check is occurring,
|
||||
* for most maintainence functions
|
||||
* this is a no-op.
|
||||
*/
|
||||
/** @} */
|
||||
|
||||
/** The APR process type */
|
||||
typedef struct apr_proc_t {
|
||||
/** The process ID */
|
||||
pid_t pid;
|
||||
/** Parent's side of pipe to child's stdin */
|
||||
apr_file_t *in;
|
||||
/** Parent's side of pipe to child's stdout */
|
||||
apr_file_t *out;
|
||||
/** Parent's side of pipe to child's stdouterr */
|
||||
apr_file_t *err;
|
||||
#if APR_HAS_PROC_INVOKED || defined(DOXYGEN)
|
||||
/** Diagnositics/debugging string of the command invoked for
|
||||
* this process [only present if APR_HAS_PROC_INVOKED is true]
|
||||
* @remark Only enabled on Win32 by default.
|
||||
* @bug This should either always or never be present in release
|
||||
* builds - since it breaks binary compatibility. We may enable
|
||||
* it always in APR 1.0 yet leave it undefined in most cases.
|
||||
*/
|
||||
char *invoked;
|
||||
#endif
|
||||
#if defined(WIN32) || defined(DOXYGEN)
|
||||
/** (Win32 only) Creator's handle granting access to the process
|
||||
* @remark This handle is closed and reset to NULL in every case
|
||||
* corresponding to a waitpid() on Unix which returns the exit status.
|
||||
* Therefore Win32 correspond's to Unix's zombie reaping characteristics
|
||||
* and avoids potential handle leaks.
|
||||
*/
|
||||
HANDLE hproc;
|
||||
#endif
|
||||
} apr_proc_t;
|
||||
|
||||
/**
|
||||
* The prototype for APR child errfn functions. (See the description
|
||||
* of apr_procattr_child_errfn_set() for more information.)
|
||||
* It is passed the following parameters:
|
||||
* @param pool Pool associated with the apr_proc_t. If your child
|
||||
* error function needs user data, associate it with this
|
||||
* pool.
|
||||
* @param err APR error code describing the error
|
||||
* @param description Text description of type of processing which failed
|
||||
*/
|
||||
typedef void (apr_child_errfn_t)(apr_pool_t *proc, apr_status_t err,
|
||||
const char *description);
|
||||
|
||||
/** Opaque Thread structure. */
|
||||
typedef struct apr_thread_t apr_thread_t;
|
||||
|
||||
/** Opaque Thread attributes structure. */
|
||||
typedef struct apr_threadattr_t apr_threadattr_t;
|
||||
|
||||
/** Opaque Process attributes structure. */
|
||||
typedef struct apr_procattr_t apr_procattr_t;
|
||||
|
||||
/** Opaque control variable for one-time atomic variables. */
|
||||
typedef struct apr_thread_once_t apr_thread_once_t;
|
||||
|
||||
/** Opaque thread private address space. */
|
||||
typedef struct apr_threadkey_t apr_threadkey_t;
|
||||
|
||||
/** Opaque record of child process. */
|
||||
typedef struct apr_other_child_rec_t apr_other_child_rec_t;
|
||||
|
||||
/**
|
||||
* The prototype for any APR thread worker functions.
|
||||
*/
|
||||
typedef void *(APR_THREAD_FUNC *apr_thread_start_t)(apr_thread_t*, void*);
|
||||
|
||||
typedef enum {
|
||||
APR_KILL_NEVER, /**< process is never killed (i.e., never sent
|
||||
* any signals), but it will be reaped if it exits
|
||||
* before the pool is cleaned up */
|
||||
APR_KILL_ALWAYS, /**< process is sent SIGKILL on apr_pool_t cleanup */
|
||||
APR_KILL_AFTER_TIMEOUT, /**< SIGTERM, wait 3 seconds, SIGKILL */
|
||||
APR_JUST_WAIT, /**< wait forever for the process to complete */
|
||||
APR_KILL_ONLY_ONCE /**< send SIGTERM and then wait */
|
||||
} apr_kill_conditions_e;
|
||||
|
||||
/* Thread Function definitions */
|
||||
|
||||
#if APR_HAS_THREADS
|
||||
|
||||
/**
|
||||
* Create and initialize a new threadattr variable
|
||||
* @param new_attr The newly created threadattr.
|
||||
* @param cont The pool to use
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_threadattr_create(apr_threadattr_t **new_attr,
|
||||
apr_pool_t *cont);
|
||||
|
||||
/**
|
||||
* Set if newly created threads should be created in detached state.
|
||||
* @param attr The threadattr to affect
|
||||
* @param on Non-zero if detached threads should be created.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_threadattr_detach_set(apr_threadattr_t *attr,
|
||||
apr_int32_t on);
|
||||
|
||||
/**
|
||||
* Get the detach state for this threadattr.
|
||||
* @param attr The threadattr to reference
|
||||
* @return APR_DETACH if threads are to be detached, or APR_NOTDETACH
|
||||
* if threads are to be joinable.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_threadattr_detach_get(apr_threadattr_t *attr);
|
||||
|
||||
/**
|
||||
* Set the stack size of newly created threads.
|
||||
* @param attr The threadattr to affect
|
||||
* @param stacksize The stack size in bytes
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_threadattr_stacksize_set(apr_threadattr_t *attr,
|
||||
apr_size_t stacksize);
|
||||
|
||||
/**
|
||||
* Set the stack guard area size of newly created threads.
|
||||
* @param attr The threadattr to affect
|
||||
* @param guardsize The stack guard area size in bytes
|
||||
* @note Thread library implementations commonly use a "guard area"
|
||||
* after each thread's stack which is not readable or writable such that
|
||||
* stack overflows cause a segfault; this consumes e.g. 4K of memory
|
||||
* and increases memory management overhead. Setting the guard area
|
||||
* size to zero hence trades off reliable behaviour on stack overflow
|
||||
* for performance. */
|
||||
APR_DECLARE(apr_status_t) apr_threadattr_guardsize_set(apr_threadattr_t *attr,
|
||||
apr_size_t guardsize);
|
||||
|
||||
/**
|
||||
* Create a new thread of execution
|
||||
* @param new_thread The newly created thread handle.
|
||||
* @param attr The threadattr to use to determine how to create the thread
|
||||
* @param func The function to start the new thread in
|
||||
* @param data Any data to be passed to the starting function
|
||||
* @param cont The pool to use
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_thread_create(apr_thread_t **new_thread,
|
||||
apr_threadattr_t *attr,
|
||||
apr_thread_start_t func,
|
||||
void *data, apr_pool_t *cont);
|
||||
|
||||
/**
|
||||
* stop the current thread
|
||||
* @param thd The thread to stop
|
||||
* @param retval The return value to pass back to any thread that cares
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_thread_exit(apr_thread_t *thd,
|
||||
apr_status_t retval);
|
||||
|
||||
/**
|
||||
* block until the desired thread stops executing.
|
||||
* @param retval The return value from the dead thread.
|
||||
* @param thd The thread to join
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_thread_join(apr_status_t *retval,
|
||||
apr_thread_t *thd);
|
||||
|
||||
/**
|
||||
* force the current thread to yield the processor
|
||||
*/
|
||||
APR_DECLARE(void) apr_thread_yield(void);
|
||||
|
||||
/**
|
||||
* Initialize the control variable for apr_thread_once. If this isn't
|
||||
* called, apr_initialize won't work.
|
||||
* @param control The control variable to initialize
|
||||
* @param p The pool to allocate data from.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_thread_once_init(apr_thread_once_t **control,
|
||||
apr_pool_t *p);
|
||||
|
||||
/**
|
||||
* Run the specified function one time, regardless of how many threads
|
||||
* call it.
|
||||
* @param control The control variable. The same variable should
|
||||
* be passed in each time the function is tried to be
|
||||
* called. This is how the underlying functions determine
|
||||
* if the function has ever been called before.
|
||||
* @param func The function to call.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_thread_once(apr_thread_once_t *control,
|
||||
void (*func)(void));
|
||||
|
||||
/**
|
||||
* detach a thread
|
||||
* @param thd The thread to detach
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_thread_detach(apr_thread_t *thd);
|
||||
|
||||
/**
|
||||
* Return user data associated with the current thread.
|
||||
* @param data The user data associated with the thread.
|
||||
* @param key The key to associate with the data
|
||||
* @param thread The currently open thread.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_thread_data_get(void **data, const char *key,
|
||||
apr_thread_t *thread);
|
||||
|
||||
/**
|
||||
* Set user data associated with the current thread.
|
||||
* @param data The user data to associate with the thread.
|
||||
* @param key The key to use for associating the data with the thread
|
||||
* @param cleanup The cleanup routine to use when the thread is destroyed.
|
||||
* @param thread The currently open thread.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_thread_data_set(void *data, const char *key,
|
||||
apr_status_t (*cleanup) (void *),
|
||||
apr_thread_t *thread);
|
||||
|
||||
/**
|
||||
* Create and initialize a new thread private address space
|
||||
* @param key The thread private handle.
|
||||
* @param dest The destructor to use when freeing the private memory.
|
||||
* @param cont The pool to use
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_threadkey_private_create(apr_threadkey_t **key,
|
||||
void (*dest)(void *),
|
||||
apr_pool_t *cont);
|
||||
|
||||
/**
|
||||
* Get a pointer to the thread private memory
|
||||
* @param new_mem The data stored in private memory
|
||||
* @param key The handle for the desired thread private memory
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_threadkey_private_get(void **new_mem,
|
||||
apr_threadkey_t *key);
|
||||
|
||||
/**
|
||||
* Set the data to be stored in thread private memory
|
||||
* @param priv The data to be stored in private memory
|
||||
* @param key The handle for the desired thread private memory
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_threadkey_private_set(void *priv,
|
||||
apr_threadkey_t *key);
|
||||
|
||||
/**
|
||||
* Free the thread private memory
|
||||
* @param key The handle for the desired thread private memory
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_threadkey_private_delete(apr_threadkey_t *key);
|
||||
|
||||
/**
|
||||
* Return the pool associated with the current threadkey.
|
||||
* @param data The user data associated with the threadkey.
|
||||
* @param key The key associated with the data
|
||||
* @param threadkey The currently open threadkey.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_threadkey_data_get(void **data, const char *key,
|
||||
apr_threadkey_t *threadkey);
|
||||
|
||||
/**
|
||||
* Return the pool associated with the current threadkey.
|
||||
* @param data The data to set.
|
||||
* @param key The key to associate with the data.
|
||||
* @param cleanup The cleanup routine to use when the file is destroyed.
|
||||
* @param threadkey The currently open threadkey.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_threadkey_data_set(void *data, const char *key,
|
||||
apr_status_t (*cleanup) (void *),
|
||||
apr_threadkey_t *threadkey);
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Create and initialize a new procattr variable
|
||||
* @param new_attr The newly created procattr.
|
||||
* @param cont The pool to use
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_procattr_create(apr_procattr_t **new_attr,
|
||||
apr_pool_t *cont);
|
||||
|
||||
/**
|
||||
* Determine if any of stdin, stdout, or stderr should be linked to pipes
|
||||
* when starting a child process.
|
||||
* @param attr The procattr we care about.
|
||||
* @param in Should stdin be a pipe back to the parent?
|
||||
* @param out Should stdout be a pipe back to the parent?
|
||||
* @param err Should stderr be a pipe back to the parent?
|
||||
* @note If APR_NO_PIPE, there will be no special channel, the child
|
||||
* inherits the parent's corresponding stdio stream. If APR_NO_FILE is
|
||||
* specified, that corresponding stream is closed in the child (and will
|
||||
* be INVALID_HANDLE_VALUE when inspected on Win32). This can have ugly
|
||||
* side effects, as the next file opened in the child on Unix will fall
|
||||
* into the stdio stream fd slot!
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_procattr_io_set(apr_procattr_t *attr,
|
||||
apr_int32_t in, apr_int32_t out,
|
||||
apr_int32_t err);
|
||||
|
||||
/**
|
||||
* Set the child_in and/or parent_in values to existing apr_file_t values.
|
||||
* @param attr The procattr we care about.
|
||||
* @param child_in apr_file_t value to use as child_in. Must be a valid file.
|
||||
* @param parent_in apr_file_t value to use as parent_in. Must be a valid file.
|
||||
* @remark This is NOT a required initializer function. This is
|
||||
* useful if you have already opened a pipe (or multiple files)
|
||||
* that you wish to use, perhaps persistently across multiple
|
||||
* process invocations - such as a log file. You can save some
|
||||
* extra function calls by not creating your own pipe since this
|
||||
* creates one in the process space for you.
|
||||
* @bug Note that calling this function with two NULL files on some platforms
|
||||
* creates an APR_FULL_BLOCK pipe, but this behavior is neither portable nor
|
||||
* is it supported. @see apr_procattr_io_set instead for simple pipes.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_procattr_child_in_set(struct apr_procattr_t *attr,
|
||||
apr_file_t *child_in,
|
||||
apr_file_t *parent_in);
|
||||
|
||||
/**
|
||||
* Set the child_out and parent_out values to existing apr_file_t values.
|
||||
* @param attr The procattr we care about.
|
||||
* @param child_out apr_file_t value to use as child_out. Must be a valid file.
|
||||
* @param parent_out apr_file_t value to use as parent_out. Must be a valid file.
|
||||
* @remark This is NOT a required initializer function. This is
|
||||
* useful if you have already opened a pipe (or multiple files)
|
||||
* that you wish to use, perhaps persistently across multiple
|
||||
* process invocations - such as a log file.
|
||||
* @bug Note that calling this function with two NULL files on some platforms
|
||||
* creates an APR_FULL_BLOCK pipe, but this behavior is neither portable nor
|
||||
* is it supported. @see apr_procattr_io_set instead for simple pipes.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_procattr_child_out_set(struct apr_procattr_t *attr,
|
||||
apr_file_t *child_out,
|
||||
apr_file_t *parent_out);
|
||||
|
||||
/**
|
||||
* Set the child_err and parent_err values to existing apr_file_t values.
|
||||
* @param attr The procattr we care about.
|
||||
* @param child_err apr_file_t value to use as child_err. Must be a valid file.
|
||||
* @param parent_err apr_file_t value to use as parent_err. Must be a valid file.
|
||||
* @remark This is NOT a required initializer function. This is
|
||||
* useful if you have already opened a pipe (or multiple files)
|
||||
* that you wish to use, perhaps persistently across multiple
|
||||
* process invocations - such as a log file.
|
||||
* @bug Note that calling this function with two NULL files on some platforms
|
||||
* creates an APR_FULL_BLOCK pipe, but this behavior is neither portable nor
|
||||
* is it supported. @see apr_procattr_io_set instead for simple pipes.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_procattr_child_err_set(struct apr_procattr_t *attr,
|
||||
apr_file_t *child_err,
|
||||
apr_file_t *parent_err);
|
||||
|
||||
/**
|
||||
* Set which directory the child process should start executing in.
|
||||
* @param attr The procattr we care about.
|
||||
* @param dir Which dir to start in. By default, this is the same dir as
|
||||
* the parent currently resides in, when the createprocess call
|
||||
* is made.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_procattr_dir_set(apr_procattr_t *attr,
|
||||
const char *dir);
|
||||
|
||||
/**
|
||||
* Set what type of command the child process will call.
|
||||
* @param attr The procattr we care about.
|
||||
* @param cmd The type of command. One of:
|
||||
* <PRE>
|
||||
* APR_SHELLCMD -- Anything that the shell can handle
|
||||
* APR_PROGRAM -- Executable program (default)
|
||||
* APR_PROGRAM_ENV -- Executable program, copy environment
|
||||
* APR_PROGRAM_PATH -- Executable program on PATH, copy env
|
||||
* </PRE>
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_procattr_cmdtype_set(apr_procattr_t *attr,
|
||||
apr_cmdtype_e cmd);
|
||||
|
||||
/**
|
||||
* Determine if the child should start in detached state.
|
||||
* @param attr The procattr we care about.
|
||||
* @param detach Should the child start in detached state? Default is no.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_procattr_detach_set(apr_procattr_t *attr,
|
||||
apr_int32_t detach);
|
||||
|
||||
#if APR_HAVE_STRUCT_RLIMIT
|
||||
/**
|
||||
* Set the Resource Utilization limits when starting a new process.
|
||||
* @param attr The procattr we care about.
|
||||
* @param what Which limit to set, one of:
|
||||
* <PRE>
|
||||
* APR_LIMIT_CPU
|
||||
* APR_LIMIT_MEM
|
||||
* APR_LIMIT_NPROC
|
||||
* APR_LIMIT_NOFILE
|
||||
* </PRE>
|
||||
* @param limit Value to set the limit to.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_procattr_limit_set(apr_procattr_t *attr,
|
||||
apr_int32_t what,
|
||||
struct rlimit *limit);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Specify an error function to be called in the child process if APR
|
||||
* encounters an error in the child prior to running the specified program.
|
||||
* @param attr The procattr describing the child process to be created.
|
||||
* @param errfn The function to call in the child process.
|
||||
* @remark At the present time, it will only be called from apr_proc_create()
|
||||
* on platforms where fork() is used. It will never be called on other
|
||||
* platforms, on those platforms apr_proc_create() will return the error
|
||||
* in the parent process rather than invoke the callback in the now-forked
|
||||
* child process.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_procattr_child_errfn_set(apr_procattr_t *attr,
|
||||
apr_child_errfn_t *errfn);
|
||||
|
||||
/**
|
||||
* Specify that apr_proc_create() should do whatever it can to report
|
||||
* failures to the caller of apr_proc_create(), rather than find out in
|
||||
* the child.
|
||||
* @param attr The procattr describing the child process to be created.
|
||||
* @param chk Flag to indicate whether or not extra work should be done
|
||||
* to try to report failures to the caller.
|
||||
* @remark This flag only affects apr_proc_create() on platforms where
|
||||
* fork() is used. This leads to extra overhead in the calling
|
||||
* process, but that may help the application handle such
|
||||
* errors more gracefully.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_procattr_error_check_set(apr_procattr_t *attr,
|
||||
apr_int32_t chk);
|
||||
|
||||
/**
|
||||
* Determine if the child should start in its own address space or using the
|
||||
* current one from its parent
|
||||
* @param attr The procattr we care about.
|
||||
* @param addrspace Should the child start in its own address space? Default
|
||||
* is no on NetWare and yes on other platforms.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_procattr_addrspace_set(apr_procattr_t *attr,
|
||||
apr_int32_t addrspace);
|
||||
|
||||
/**
|
||||
* Set the username used for running process
|
||||
* @param attr The procattr we care about.
|
||||
* @param username The username used
|
||||
* @param password User password if needed. Password is needed on WIN32
|
||||
* or any other platform having
|
||||
* APR_PROCATTR_USER_SET_REQUIRES_PASSWORD set.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_procattr_user_set(apr_procattr_t *attr,
|
||||
const char *username,
|
||||
const char *password);
|
||||
|
||||
/**
|
||||
* Set the group used for running process
|
||||
* @param attr The procattr we care about.
|
||||
* @param groupname The group name used
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_procattr_group_set(apr_procattr_t *attr,
|
||||
const char *groupname);
|
||||
|
||||
|
||||
/**
|
||||
* Register permission set function
|
||||
* @param attr The procattr we care about.
|
||||
* @param perms_set_fn Permission set callback
|
||||
* @param data Data to pass to permission callback function
|
||||
* @param perms Permissions to set
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_procattr_perms_set_register(apr_procattr_t *attr,
|
||||
apr_perms_setfn_t *perms_set_fn,
|
||||
void *data,
|
||||
apr_fileperms_t perms);
|
||||
|
||||
#if APR_HAS_FORK
|
||||
/**
|
||||
* This is currently the only non-portable call in APR. This executes
|
||||
* a standard unix fork.
|
||||
* @param proc The resulting process handle.
|
||||
* @param cont The pool to use.
|
||||
* @remark returns APR_INCHILD for the child, and APR_INPARENT for the parent
|
||||
* or an error.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_proc_fork(apr_proc_t *proc, apr_pool_t *cont);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Create a new process and execute a new program within that process.
|
||||
* @param new_proc The resulting process handle.
|
||||
* @param progname The program to run
|
||||
* @param args the arguments to pass to the new program. The first
|
||||
* one should be the program name.
|
||||
* @param env The new environment table for the new process. This
|
||||
* should be a list of NULL-terminated strings. This argument
|
||||
* is ignored for APR_PROGRAM_ENV, APR_PROGRAM_PATH, and
|
||||
* APR_SHELLCMD_ENV types of commands.
|
||||
* @param attr the procattr we should use to determine how to create the new
|
||||
* process
|
||||
* @param pool The pool to use.
|
||||
* @note This function returns without waiting for the new process to terminate;
|
||||
* use apr_proc_wait for that.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new_proc,
|
||||
const char *progname,
|
||||
const char * const *args,
|
||||
const char * const *env,
|
||||
apr_procattr_t *attr,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Wait for a child process to die
|
||||
* @param proc The process handle that corresponds to the desired child process
|
||||
* @param exitcode The returned exit status of the child, if a child process
|
||||
* dies, or the signal that caused the child to die.
|
||||
* On platforms that don't support obtaining this information,
|
||||
* the status parameter will be returned as APR_ENOTIMPL.
|
||||
* @param exitwhy Why the child died, the bitwise or of:
|
||||
* <PRE>
|
||||
* APR_PROC_EXIT -- process terminated normally
|
||||
* APR_PROC_SIGNAL -- process was killed by a signal
|
||||
* APR_PROC_SIGNAL_CORE -- process was killed by a signal, and
|
||||
* generated a core dump.
|
||||
* </PRE>
|
||||
* @param waithow How should we wait. One of:
|
||||
* <PRE>
|
||||
* APR_WAIT -- block until the child process dies.
|
||||
* APR_NOWAIT -- return immediately regardless of if the
|
||||
* child is dead or not.
|
||||
* </PRE>
|
||||
* @remark The child's status is in the return code to this process. It is one of:
|
||||
* <PRE>
|
||||
* APR_CHILD_DONE -- child is no longer running.
|
||||
* APR_CHILD_NOTDONE -- child is still running.
|
||||
* </PRE>
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_proc_wait(apr_proc_t *proc,
|
||||
int *exitcode, apr_exit_why_e *exitwhy,
|
||||
apr_wait_how_e waithow);
|
||||
|
||||
/**
|
||||
* Wait for any current child process to die and return information
|
||||
* about that child.
|
||||
* @param proc Pointer to NULL on entry, will be filled out with child's
|
||||
* information
|
||||
* @param exitcode The returned exit status of the child, if a child process
|
||||
* dies, or the signal that caused the child to die.
|
||||
* On platforms that don't support obtaining this information,
|
||||
* the status parameter will be returned as APR_ENOTIMPL.
|
||||
* @param exitwhy Why the child died, the bitwise or of:
|
||||
* <PRE>
|
||||
* APR_PROC_EXIT -- process terminated normally
|
||||
* APR_PROC_SIGNAL -- process was killed by a signal
|
||||
* APR_PROC_SIGNAL_CORE -- process was killed by a signal, and
|
||||
* generated a core dump.
|
||||
* </PRE>
|
||||
* @param waithow How should we wait. One of:
|
||||
* <PRE>
|
||||
* APR_WAIT -- block until the child process dies.
|
||||
* APR_NOWAIT -- return immediately regardless of if the
|
||||
* child is dead or not.
|
||||
* </PRE>
|
||||
* @param p Pool to allocate child information out of.
|
||||
* @bug Passing proc as a *proc rather than **proc was an odd choice
|
||||
* for some platforms... this should be revisited in 1.0
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_proc_wait_all_procs(apr_proc_t *proc,
|
||||
int *exitcode,
|
||||
apr_exit_why_e *exitwhy,
|
||||
apr_wait_how_e waithow,
|
||||
apr_pool_t *p);
|
||||
|
||||
#define APR_PROC_DETACH_FOREGROUND 0 /**< Do not detach */
|
||||
#define APR_PROC_DETACH_DAEMONIZE 1 /**< Detach */
|
||||
|
||||
/**
|
||||
* Detach the process from the controlling terminal.
|
||||
* @param daemonize set to non-zero if the process should daemonize
|
||||
* and become a background process, else it will
|
||||
* stay in the foreground.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_proc_detach(int daemonize);
|
||||
|
||||
/**
|
||||
* Register an other_child -- a child associated to its registered
|
||||
* maintence callback. This callback is invoked when the process
|
||||
* dies, is disconnected or disappears.
|
||||
* @param proc The child process to register.
|
||||
* @param maintenance maintenance is a function that is invoked with a
|
||||
* reason and the data pointer passed here.
|
||||
* @param data Opaque context data passed to the maintenance function.
|
||||
* @param write_fd An fd that is probed for writing. If it is ever unwritable
|
||||
* then the maintenance is invoked with reason
|
||||
* OC_REASON_UNWRITABLE.
|
||||
* @param p The pool to use for allocating memory.
|
||||
* @bug write_fd duplicates the proc->out stream, it's really redundant
|
||||
* and should be replaced in the APR 1.0 API with a bitflag of which
|
||||
* proc->in/out/err handles should be health checked.
|
||||
* @bug no platform currently tests the pipes health.
|
||||
*/
|
||||
APR_DECLARE(void) apr_proc_other_child_register(apr_proc_t *proc,
|
||||
void (*maintenance) (int reason,
|
||||
void *,
|
||||
int status),
|
||||
void *data, apr_file_t *write_fd,
|
||||
apr_pool_t *p);
|
||||
|
||||
/**
|
||||
* Stop watching the specified other child.
|
||||
* @param data The data to pass to the maintenance function. This is
|
||||
* used to find the process to unregister.
|
||||
* @warning Since this can be called by a maintenance function while we're
|
||||
* scanning the other_children list, all scanners should protect
|
||||
* themself by loading ocr->next before calling any maintenance
|
||||
* function.
|
||||
*/
|
||||
APR_DECLARE(void) apr_proc_other_child_unregister(void *data);
|
||||
|
||||
/**
|
||||
* Notify the maintenance callback of a registered other child process
|
||||
* that application has detected an event, such as death.
|
||||
* @param proc The process to check
|
||||
* @param reason The reason code to pass to the maintenance function
|
||||
* @param status The status to pass to the maintenance function
|
||||
* @remark An example of code using this behavior;
|
||||
* <pre>
|
||||
* rv = apr_proc_wait_all_procs(&proc, &exitcode, &status, APR_WAIT, p);
|
||||
* if (APR_STATUS_IS_CHILD_DONE(rv)) {
|
||||
* \#if APR_HAS_OTHER_CHILD
|
||||
* if (apr_proc_other_child_alert(&proc, APR_OC_REASON_DEATH, status)
|
||||
* == APR_SUCCESS) {
|
||||
* ; (already handled)
|
||||
* }
|
||||
* else
|
||||
* \#endif
|
||||
* [... handling non-otherchild processes death ...]
|
||||
* </pre>
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_proc_other_child_alert(apr_proc_t *proc,
|
||||
int reason,
|
||||
int status);
|
||||
|
||||
/**
|
||||
* Test one specific other child processes and invoke the maintenance callback
|
||||
* with the appropriate reason code, if still running, or the appropriate reason
|
||||
* code if the process is no longer healthy.
|
||||
* @param ocr The registered other child
|
||||
* @param reason The reason code (e.g. APR_OC_REASON_RESTART) if still running
|
||||
*/
|
||||
APR_DECLARE(void) apr_proc_other_child_refresh(apr_other_child_rec_t *ocr,
|
||||
int reason);
|
||||
|
||||
/**
|
||||
* Test all registered other child processes and invoke the maintenance callback
|
||||
* with the appropriate reason code, if still running, or the appropriate reason
|
||||
* code if the process is no longer healthy.
|
||||
* @param reason The reason code (e.g. APR_OC_REASON_RESTART) to running processes
|
||||
*/
|
||||
APR_DECLARE(void) apr_proc_other_child_refresh_all(int reason);
|
||||
|
||||
/**
|
||||
* Terminate a process.
|
||||
* @param proc The process to terminate.
|
||||
* @param sig How to kill the process.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_proc_kill(apr_proc_t *proc, int sig);
|
||||
|
||||
/**
|
||||
* Register a process to be killed when a pool dies.
|
||||
* @param a The pool to use to define the processes lifetime
|
||||
* @param proc The process to register
|
||||
* @param how How to kill the process, one of:
|
||||
* <PRE>
|
||||
* APR_KILL_NEVER -- process is never sent any signals
|
||||
* APR_KILL_ALWAYS -- process is sent SIGKILL on apr_pool_t cleanup
|
||||
* APR_KILL_AFTER_TIMEOUT -- SIGTERM, wait 3 seconds, SIGKILL
|
||||
* APR_JUST_WAIT -- wait forever for the process to complete
|
||||
* APR_KILL_ONLY_ONCE -- send SIGTERM and then wait
|
||||
* </PRE>
|
||||
*/
|
||||
APR_DECLARE(void) apr_pool_note_subprocess(apr_pool_t *a, apr_proc_t *proc,
|
||||
apr_kill_conditions_e how);
|
||||
|
||||
#if APR_HAS_THREADS
|
||||
|
||||
#if (APR_HAVE_SIGWAIT || APR_HAVE_SIGSUSPEND) && !defined(OS2)
|
||||
|
||||
/**
|
||||
* Setup the process for a single thread to be used for all signal handling.
|
||||
* @warning This must be called before any threads are created
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_setup_signal_thread(void);
|
||||
|
||||
/**
|
||||
* Make the current thread listen for signals. This thread will loop
|
||||
* forever, calling a provided function whenever it receives a signal. That
|
||||
* functions should return 1 if the signal has been handled, 0 otherwise.
|
||||
* @param signal_handler The function to call when a signal is received
|
||||
* apr_status_t apr_signal_thread((int)(*signal_handler)(int signum))
|
||||
* @note Synchronous signals like SIGABRT/SIGSEGV/SIGBUS/... are ignored by
|
||||
* apr_signal_thread() and thus can't be waited by this function (they remain
|
||||
* handled by the operating system or its native signals interface).
|
||||
* @remark In APR version 1.6 and ealier, SIGUSR2 was part of these ignored
|
||||
* signals and thus was never passed in to the signal_handler. From APR 1.7
|
||||
* this is no more the case so SIGUSR2 can be handled in signal_handler and
|
||||
* acted upon like the other asynchronous signals.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_signal_thread(int(*signal_handler)(int signum));
|
||||
|
||||
#endif /* (APR_HAVE_SIGWAIT || APR_HAVE_SIGSUSPEND) && !defined(OS2) */
|
||||
|
||||
/**
|
||||
* Get the child-pool used by the thread from the thread info.
|
||||
* @return apr_pool_t the pool
|
||||
*/
|
||||
APR_POOL_DECLARE_ACCESSOR(thread);
|
||||
|
||||
#endif /* APR_HAS_THREADS */
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ! APR_THREAD_PROC_H */
|
||||
|
||||
129
database/apache/include/apr_thread_rwlock.h
Normal file
129
database/apache/include/apr_thread_rwlock.h
Normal file
@@ -0,0 +1,129 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_THREAD_RWLOCK_H
|
||||
#define APR_THREAD_RWLOCK_H
|
||||
|
||||
/**
|
||||
* @file apr_thread_rwlock.h
|
||||
* @brief APR Reader/Writer Lock Routines
|
||||
*/
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_pools.h"
|
||||
#include "apr_errno.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#if APR_HAS_THREADS
|
||||
|
||||
/**
|
||||
* @defgroup apr_thread_rwlock Reader/Writer Lock Routines
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** Opaque read-write thread-safe lock. */
|
||||
typedef struct apr_thread_rwlock_t apr_thread_rwlock_t;
|
||||
|
||||
/**
|
||||
* Note: The following operations have undefined results: unlocking a
|
||||
* read-write lock which is not locked in the calling thread; write
|
||||
* locking a read-write lock which is already locked by the calling
|
||||
* thread; destroying a read-write lock more than once; clearing or
|
||||
* destroying the pool from which a <b>locked</b> read-write lock is
|
||||
* allocated.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Create and initialize a read-write lock that can be used to synchronize
|
||||
* threads.
|
||||
* @param rwlock the memory address where the newly created readwrite lock
|
||||
* will be stored.
|
||||
* @param pool the pool from which to allocate the mutex.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_thread_rwlock_create(apr_thread_rwlock_t **rwlock,
|
||||
apr_pool_t *pool);
|
||||
/**
|
||||
* Acquire a shared-read lock on the given read-write lock. This will allow
|
||||
* multiple threads to enter the same critical section while they have acquired
|
||||
* the read lock.
|
||||
* @param rwlock the read-write lock on which to acquire the shared read.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_thread_rwlock_rdlock(apr_thread_rwlock_t *rwlock);
|
||||
|
||||
/**
|
||||
* Attempt to acquire the shared-read lock on the given read-write lock. This
|
||||
* is the same as apr_thread_rwlock_rdlock(), only that the function fails
|
||||
* if there is another thread holding the write lock, or if there are any
|
||||
* write threads blocking on the lock. If the function fails for this case,
|
||||
* APR_EBUSY will be returned. Note: it is important that the
|
||||
* APR_STATUS_IS_EBUSY(s) macro be used to determine if the return value was
|
||||
* APR_EBUSY, for portability reasons.
|
||||
* @param rwlock the rwlock on which to attempt the shared read.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_thread_rwlock_tryrdlock(apr_thread_rwlock_t *rwlock);
|
||||
|
||||
/**
|
||||
* Acquire an exclusive-write lock on the given read-write lock. This will
|
||||
* allow only one single thread to enter the critical sections. If there
|
||||
* are any threads currently holding the read-lock, this thread is put to
|
||||
* sleep until it can have exclusive access to the lock.
|
||||
* @param rwlock the read-write lock on which to acquire the exclusive write.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_thread_rwlock_wrlock(apr_thread_rwlock_t *rwlock);
|
||||
|
||||
/**
|
||||
* Attempt to acquire the exclusive-write lock on the given read-write lock.
|
||||
* This is the same as apr_thread_rwlock_wrlock(), only that the function fails
|
||||
* if there is any other thread holding the lock (for reading or writing),
|
||||
* in which case the function will return APR_EBUSY. Note: it is important
|
||||
* that the APR_STATUS_IS_EBUSY(s) macro be used to determine if the return
|
||||
* value was APR_EBUSY, for portability reasons.
|
||||
* @param rwlock the rwlock on which to attempt the exclusive write.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_thread_rwlock_trywrlock(apr_thread_rwlock_t *rwlock);
|
||||
|
||||
/**
|
||||
* Release either the read or write lock currently held by the calling thread
|
||||
* associated with the given read-write lock.
|
||||
* @param rwlock the read-write lock to be released (unlocked).
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_thread_rwlock_unlock(apr_thread_rwlock_t *rwlock);
|
||||
|
||||
/**
|
||||
* Destroy the read-write lock and free the associated memory.
|
||||
* @param rwlock the rwlock to destroy.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_thread_rwlock_destroy(apr_thread_rwlock_t *rwlock);
|
||||
|
||||
/**
|
||||
* Get the pool used by this thread_rwlock.
|
||||
* @return apr_pool_t the pool
|
||||
*/
|
||||
APR_POOL_DECLARE_ACCESSOR(thread_rwlock);
|
||||
|
||||
#endif /* APR_HAS_THREADS */
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ! APR_THREAD_RWLOCK_H */
|
||||
237
database/apache/include/apr_time.h
Normal file
237
database/apache/include/apr_time.h
Normal file
@@ -0,0 +1,237 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_TIME_H
|
||||
#define APR_TIME_H
|
||||
|
||||
/**
|
||||
* @file apr_time.h
|
||||
* @brief APR Time Library
|
||||
*/
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_errno.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @defgroup apr_time Time Routines
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** month names */
|
||||
APR_DECLARE_DATA extern const char apr_month_snames[12][4];
|
||||
/** day names */
|
||||
APR_DECLARE_DATA extern const char apr_day_snames[7][4];
|
||||
|
||||
|
||||
/** number of microseconds since 00:00:00 January 1, 1970 UTC */
|
||||
typedef apr_int64_t apr_time_t;
|
||||
|
||||
|
||||
/** mechanism to properly type apr_time_t literals */
|
||||
#define APR_TIME_C(val) APR_INT64_C(val)
|
||||
|
||||
/** mechanism to properly print apr_time_t values */
|
||||
#define APR_TIME_T_FMT APR_INT64_T_FMT
|
||||
|
||||
/** intervals for I/O timeouts, in microseconds */
|
||||
typedef apr_int64_t apr_interval_time_t;
|
||||
/** short interval for I/O timeouts, in microseconds */
|
||||
typedef apr_int32_t apr_short_interval_time_t;
|
||||
|
||||
/** number of microseconds per second */
|
||||
#define APR_USEC_PER_SEC APR_TIME_C(1000000)
|
||||
|
||||
/** @return apr_time_t as a second */
|
||||
#define apr_time_sec(time) ((time) / APR_USEC_PER_SEC)
|
||||
|
||||
/** @return apr_time_t as a usec */
|
||||
#define apr_time_usec(time) ((time) % APR_USEC_PER_SEC)
|
||||
|
||||
/** @return apr_time_t as a msec */
|
||||
#define apr_time_msec(time) (((time) / 1000) % 1000)
|
||||
|
||||
/** @return apr_time_t as a msec */
|
||||
#define apr_time_as_msec(time) ((time) / 1000)
|
||||
|
||||
/** @return milliseconds as an apr_time_t */
|
||||
#define apr_time_from_msec(msec) ((apr_time_t)(msec) * 1000)
|
||||
|
||||
/** @return seconds as an apr_time_t */
|
||||
#define apr_time_from_sec(sec) ((apr_time_t)(sec) * APR_USEC_PER_SEC)
|
||||
|
||||
/** @return a second and usec combination as an apr_time_t */
|
||||
#define apr_time_make(sec, usec) ((apr_time_t)(sec) * APR_USEC_PER_SEC \
|
||||
+ (apr_time_t)(usec))
|
||||
|
||||
/**
|
||||
* @return the current time
|
||||
*/
|
||||
APR_DECLARE(apr_time_t) apr_time_now(void);
|
||||
|
||||
/** @see apr_time_exp_t */
|
||||
typedef struct apr_time_exp_t apr_time_exp_t;
|
||||
|
||||
/**
|
||||
* a structure similar to ANSI struct tm with the following differences:
|
||||
* - tm_usec isn't an ANSI field
|
||||
* - tm_gmtoff isn't an ANSI field (it's a BSDism)
|
||||
*/
|
||||
struct apr_time_exp_t {
|
||||
/** microseconds past tm_sec */
|
||||
apr_int32_t tm_usec;
|
||||
/** (0-61) seconds past tm_min */
|
||||
apr_int32_t tm_sec;
|
||||
/** (0-59) minutes past tm_hour */
|
||||
apr_int32_t tm_min;
|
||||
/** (0-23) hours past midnight */
|
||||
apr_int32_t tm_hour;
|
||||
/** (1-31) day of the month */
|
||||
apr_int32_t tm_mday;
|
||||
/** (0-11) month of the year */
|
||||
apr_int32_t tm_mon;
|
||||
/** year since 1900 */
|
||||
apr_int32_t tm_year;
|
||||
/** (0-6) days since Sunday */
|
||||
apr_int32_t tm_wday;
|
||||
/** (0-365) days since January 1 */
|
||||
apr_int32_t tm_yday;
|
||||
/** daylight saving time */
|
||||
apr_int32_t tm_isdst;
|
||||
/** seconds east of UTC */
|
||||
apr_int32_t tm_gmtoff;
|
||||
};
|
||||
|
||||
/* Delayed the include to avoid a circular reference */
|
||||
#include "apr_pools.h"
|
||||
|
||||
/**
|
||||
* Convert an ansi time_t to an apr_time_t
|
||||
* @param result the resulting apr_time_t
|
||||
* @param input the time_t to convert
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_time_ansi_put(apr_time_t *result,
|
||||
time_t input);
|
||||
|
||||
/**
|
||||
* Convert a time to its human readable components using an offset
|
||||
* from GMT.
|
||||
* @param result the exploded time
|
||||
* @param input the time to explode
|
||||
* @param offs the number of seconds offset to apply
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_time_exp_tz(apr_time_exp_t *result,
|
||||
apr_time_t input,
|
||||
apr_int32_t offs);
|
||||
|
||||
/**
|
||||
* Convert a time to its human readable components (GMT).
|
||||
* @param result the exploded time
|
||||
* @param input the time to explode
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_time_exp_gmt(apr_time_exp_t *result,
|
||||
apr_time_t input);
|
||||
|
||||
/**
|
||||
* Convert a time to its human readable components in the local timezone.
|
||||
* @param result the exploded time
|
||||
* @param input the time to explode
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_time_exp_lt(apr_time_exp_t *result,
|
||||
apr_time_t input);
|
||||
|
||||
/**
|
||||
* Convert time value from human readable format to a numeric apr_time_t
|
||||
* (elapsed microseconds since the epoch).
|
||||
* @param result the resulting imploded time
|
||||
* @param input the input exploded time
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_time_exp_get(apr_time_t *result,
|
||||
apr_time_exp_t *input);
|
||||
|
||||
/**
|
||||
* Convert time value from human readable format to a numeric apr_time_t that
|
||||
* always represents GMT.
|
||||
* @param result the resulting imploded time
|
||||
* @param input the input exploded time
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_time_exp_gmt_get(apr_time_t *result,
|
||||
apr_time_exp_t *input);
|
||||
|
||||
/**
|
||||
* Sleep for the specified number of micro-seconds.
|
||||
* @param t desired amount of time to sleep.
|
||||
* @warning May sleep for longer than the specified time.
|
||||
*/
|
||||
APR_DECLARE(void) apr_sleep(apr_interval_time_t t);
|
||||
|
||||
/** length of a RFC822 Date */
|
||||
#define APR_RFC822_DATE_LEN (30)
|
||||
/**
|
||||
* apr_rfc822_date formats dates in the RFC822
|
||||
* format in an efficient manner. It is a fixed length
|
||||
* format which requires APR_RFC822_DATA_LEN bytes of storage,
|
||||
* including the trailing NUL terminator.
|
||||
* @param date_str String to write to.
|
||||
* @param t the time to convert
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_rfc822_date(char *date_str, apr_time_t t);
|
||||
|
||||
/** length of a CTIME date */
|
||||
#define APR_CTIME_LEN (25)
|
||||
/**
|
||||
* apr_ctime formats dates in the ctime() format
|
||||
* in an efficient manner. It is a fixed length format
|
||||
* and requires APR_CTIME_LEN bytes of storage including
|
||||
* the trailing NUL terminator.
|
||||
* Unlike ANSI/ISO C ctime(), apr_ctime() does not include
|
||||
* a \\n at the end of the string.
|
||||
* @param date_str String to write to.
|
||||
* @param t the time to convert
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_ctime(char *date_str, apr_time_t t);
|
||||
|
||||
/**
|
||||
* Formats the exploded time according to the format specified
|
||||
* @param s string to write to
|
||||
* @param retsize The length of the returned string
|
||||
* @param max The maximum length of the string
|
||||
* @param format The format for the time string
|
||||
* @param tm The time to convert
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_strftime(char *s, apr_size_t *retsize,
|
||||
apr_size_t max, const char *format,
|
||||
apr_time_exp_t *tm);
|
||||
|
||||
/**
|
||||
* Improve the clock resolution for the lifetime of the given pool.
|
||||
* Generally this is only desirable on benchmarking and other very
|
||||
* time-sensitive applications, and has no impact on most platforms.
|
||||
* @param p The pool to associate the finer clock resolution
|
||||
*/
|
||||
APR_DECLARE(void) apr_time_clock_hires(apr_pool_t *p);
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ! APR_TIME_H */
|
||||
178
database/apache/include/apr_uri.h
Normal file
178
database/apache/include/apr_uri.h
Normal file
@@ -0,0 +1,178 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* apr_uri.h: External Interface of apr_uri.c
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file apr_uri.h
|
||||
* @brief APR-UTIL URI Routines
|
||||
*/
|
||||
|
||||
#ifndef APR_URI_H
|
||||
#define APR_URI_H
|
||||
|
||||
#include "apu.h"
|
||||
|
||||
#include "apr_network_io.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup APR_Util_URI URI
|
||||
* @ingroup APR_Util
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define APR_URI_FTP_DEFAULT_PORT 21 /**< default FTP port */
|
||||
#define APR_URI_SSH_DEFAULT_PORT 22 /**< default SSH port */
|
||||
#define APR_URI_TELNET_DEFAULT_PORT 23 /**< default telnet port */
|
||||
#define APR_URI_GOPHER_DEFAULT_PORT 70 /**< default Gopher port */
|
||||
#define APR_URI_HTTP_DEFAULT_PORT 80 /**< default HTTP port */
|
||||
#define APR_URI_POP_DEFAULT_PORT 110 /**< default POP port */
|
||||
#define APR_URI_NNTP_DEFAULT_PORT 119 /**< default NNTP port */
|
||||
#define APR_URI_IMAP_DEFAULT_PORT 143 /**< default IMAP port */
|
||||
#define APR_URI_PROSPERO_DEFAULT_PORT 191 /**< default Prospero port */
|
||||
#define APR_URI_WAIS_DEFAULT_PORT 210 /**< default WAIS port */
|
||||
#define APR_URI_LDAP_DEFAULT_PORT 389 /**< default LDAP port */
|
||||
#define APR_URI_HTTPS_DEFAULT_PORT 443 /**< default HTTPS port */
|
||||
#define APR_URI_RTSP_DEFAULT_PORT 554 /**< default RTSP port */
|
||||
#define APR_URI_SNEWS_DEFAULT_PORT 563 /**< default SNEWS port */
|
||||
#define APR_URI_ACAP_DEFAULT_PORT 674 /**< default ACAP port */
|
||||
#define APR_URI_NFS_DEFAULT_PORT 2049 /**< default NFS port */
|
||||
#define APR_URI_TIP_DEFAULT_PORT 3372 /**< default TIP port */
|
||||
#define APR_URI_SIP_DEFAULT_PORT 5060 /**< default SIP port */
|
||||
|
||||
/** Flags passed to unparse_uri_components(): */
|
||||
/** suppress "scheme://user\@site:port" */
|
||||
#define APR_URI_UNP_OMITSITEPART (1U<<0)
|
||||
/** Just omit user */
|
||||
#define APR_URI_UNP_OMITUSER (1U<<1)
|
||||
/** Just omit password */
|
||||
#define APR_URI_UNP_OMITPASSWORD (1U<<2)
|
||||
/** omit "user:password\@" part */
|
||||
#define APR_URI_UNP_OMITUSERINFO (APR_URI_UNP_OMITUSER | \
|
||||
APR_URI_UNP_OMITPASSWORD)
|
||||
/** Show plain text password (default: show XXXXXXXX) */
|
||||
#define APR_URI_UNP_REVEALPASSWORD (1U<<3)
|
||||
/** Show "scheme://user\@site:port" only */
|
||||
#define APR_URI_UNP_OMITPATHINFO (1U<<4)
|
||||
/** Omit the "?queryarg" from the path */
|
||||
#define APR_URI_UNP_OMITQUERY (1U<<5)
|
||||
|
||||
/** @see apr_uri_t */
|
||||
typedef struct apr_uri_t apr_uri_t;
|
||||
|
||||
/**
|
||||
* A structure to encompass all of the fields in a uri
|
||||
*/
|
||||
struct apr_uri_t {
|
||||
/** scheme ("http"/"ftp"/...) */
|
||||
char *scheme;
|
||||
/** combined [user[:password]\@]host[:port] */
|
||||
char *hostinfo;
|
||||
/** user name, as in http://user:passwd\@host:port/ */
|
||||
char *user;
|
||||
/** password, as in http://user:passwd\@host:port/ */
|
||||
char *password;
|
||||
/** hostname from URI (or from Host: header) */
|
||||
char *hostname;
|
||||
/** port string (integer representation is in "port") */
|
||||
char *port_str;
|
||||
/** the request path (or NULL if only scheme://host was given) */
|
||||
char *path;
|
||||
/** Everything after a '?' in the path, if present */
|
||||
char *query;
|
||||
/** Trailing "#fragment" string, if present */
|
||||
char *fragment;
|
||||
|
||||
/** structure returned from gethostbyname() */
|
||||
struct hostent *hostent;
|
||||
|
||||
/** The port number, numeric, valid only if port_str != NULL */
|
||||
apr_port_t port;
|
||||
|
||||
/** has the structure been initialized */
|
||||
unsigned is_initialized:1;
|
||||
|
||||
/** has the DNS been looked up yet */
|
||||
unsigned dns_looked_up:1;
|
||||
/** has the dns been resolved yet */
|
||||
unsigned dns_resolved:1;
|
||||
};
|
||||
|
||||
/* apr_uri.c */
|
||||
/**
|
||||
* Return the default port for a given scheme. The schemes recognized are
|
||||
* http, ftp, https, gopher, wais, nntp, snews, and prospero
|
||||
* @param scheme_str The string that contains the current scheme
|
||||
* @return The default port for this scheme
|
||||
*/
|
||||
APU_DECLARE(apr_port_t) apr_uri_port_of_scheme(const char *scheme_str);
|
||||
|
||||
/**
|
||||
* Unparse a apr_uri_t structure to an URI string. Optionally
|
||||
* suppress the password for security reasons.
|
||||
* @param p The pool to allocate out of
|
||||
* @param uptr All of the parts of the uri
|
||||
* @param flags How to unparse the uri. One of:
|
||||
* <PRE>
|
||||
* APR_URI_UNP_OMITSITEPART Suppress "scheme://user\@site:port"
|
||||
* APR_URI_UNP_OMITUSER Just omit user
|
||||
* APR_URI_UNP_OMITPASSWORD Just omit password
|
||||
* APR_URI_UNP_OMITUSERINFO Omit "user:password\@" part
|
||||
* APR_URI_UNP_REVEALPASSWORD Show plain text password (default: show XXXXXXXX)
|
||||
* APR_URI_UNP_OMITPATHINFO Show "scheme://user\@site:port" only
|
||||
* APR_URI_UNP_OMITQUERY Omit "?queryarg" or "#fragment"
|
||||
* </PRE>
|
||||
* @return The uri as a string
|
||||
*/
|
||||
APU_DECLARE(char *) apr_uri_unparse(apr_pool_t *p,
|
||||
const apr_uri_t *uptr,
|
||||
unsigned flags);
|
||||
|
||||
/**
|
||||
* Parse a given URI, fill in all supplied fields of a apr_uri_t
|
||||
* structure. This eliminates the necessity of extracting host, port,
|
||||
* path, query info repeatedly in the modules.
|
||||
* @param p The pool to allocate out of
|
||||
* @param uri The uri to parse
|
||||
* @param uptr The apr_uri_t to fill out
|
||||
* @return APR_SUCCESS for success or error code
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_uri_parse(apr_pool_t *p, const char *uri,
|
||||
apr_uri_t *uptr);
|
||||
|
||||
/**
|
||||
* Special case for CONNECT parsing: it comes with the hostinfo part only
|
||||
* @param p The pool to allocate out of
|
||||
* @param hostinfo The hostinfo string to parse
|
||||
* @param uptr The apr_uri_t to fill out
|
||||
* @return APR_SUCCESS for success or error code
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_uri_parse_hostinfo(apr_pool_t *p,
|
||||
const char *hostinfo,
|
||||
apr_uri_t *uptr);
|
||||
|
||||
/** @} */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* APR_URI_H */
|
||||
158
database/apache/include/apr_user.h
Normal file
158
database/apache/include/apr_user.h
Normal file
@@ -0,0 +1,158 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_USER_H
|
||||
#define APR_USER_H
|
||||
|
||||
/**
|
||||
* @file apr_user.h
|
||||
* @brief APR User ID Services
|
||||
*/
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_errno.h"
|
||||
#include "apr_pools.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @defgroup apr_user User and Group ID Services
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Structure for determining user ownership.
|
||||
*/
|
||||
#ifdef WIN32
|
||||
typedef PSID apr_uid_t;
|
||||
#else
|
||||
typedef uid_t apr_uid_t;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Structure for determining group ownership.
|
||||
*/
|
||||
#ifdef WIN32
|
||||
typedef PSID apr_gid_t;
|
||||
#else
|
||||
typedef gid_t apr_gid_t;
|
||||
#endif
|
||||
|
||||
#if APR_HAS_USER
|
||||
|
||||
/**
|
||||
* Get the userid (and groupid) of the calling process
|
||||
* @param userid Returns the user id
|
||||
* @param groupid Returns the user's group id
|
||||
* @param p The pool from which to allocate working space
|
||||
* @remark This function is available only if APR_HAS_USER is defined.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_uid_current(apr_uid_t *userid,
|
||||
apr_gid_t *groupid,
|
||||
apr_pool_t *p);
|
||||
|
||||
/**
|
||||
* Get the user name for a specified userid
|
||||
* @param username Pointer to new string containing user name (on output)
|
||||
* @param userid The userid
|
||||
* @param p The pool from which to allocate the string
|
||||
* @remark This function is available only if APR_HAS_USER is defined.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_uid_name_get(char **username, apr_uid_t userid,
|
||||
apr_pool_t *p);
|
||||
|
||||
/**
|
||||
* Get the userid (and groupid) for the specified username
|
||||
* @param userid Returns the user id
|
||||
* @param groupid Returns the user's group id
|
||||
* @param username The username to look up
|
||||
* @param p The pool from which to allocate working space
|
||||
* @remark This function is available only if APR_HAS_USER is defined.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_uid_get(apr_uid_t *userid, apr_gid_t *groupid,
|
||||
const char *username, apr_pool_t *p);
|
||||
|
||||
/**
|
||||
* Get the home directory for the named user
|
||||
* @param dirname Pointer to new string containing directory name (on output)
|
||||
* @param username The named user
|
||||
* @param p The pool from which to allocate the string
|
||||
* @remark This function is available only if APR_HAS_USER is defined.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_uid_homepath_get(char **dirname,
|
||||
const char *username,
|
||||
apr_pool_t *p);
|
||||
|
||||
/**
|
||||
* Compare two user identifiers for equality.
|
||||
* @param left One uid to test
|
||||
* @param right Another uid to test
|
||||
* @return APR_SUCCESS if the apr_uid_t structures identify the same user,
|
||||
* APR_EMISMATCH if not, APR_BADARG if an apr_uid_t is invalid.
|
||||
* @remark This function is available only if APR_HAS_USER is defined.
|
||||
*/
|
||||
#if defined(WIN32)
|
||||
APR_DECLARE(apr_status_t) apr_uid_compare(apr_uid_t left, apr_uid_t right);
|
||||
#else
|
||||
#define apr_uid_compare(left,right) (((left) == (right)) ? APR_SUCCESS : APR_EMISMATCH)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Get the group name for a specified groupid
|
||||
* @param groupname Pointer to new string containing group name (on output)
|
||||
* @param groupid The groupid
|
||||
* @param p The pool from which to allocate the string
|
||||
* @remark This function is available only if APR_HAS_USER is defined.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_gid_name_get(char **groupname,
|
||||
apr_gid_t groupid, apr_pool_t *p);
|
||||
|
||||
/**
|
||||
* Get the groupid for a specified group name
|
||||
* @param groupid Pointer to the group id (on output)
|
||||
* @param groupname The group name to look up
|
||||
* @param p The pool from which to allocate the string
|
||||
* @remark This function is available only if APR_HAS_USER is defined.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_gid_get(apr_gid_t *groupid,
|
||||
const char *groupname, apr_pool_t *p);
|
||||
|
||||
/**
|
||||
* Compare two group identifiers for equality.
|
||||
* @param left One gid to test
|
||||
* @param right Another gid to test
|
||||
* @return APR_SUCCESS if the apr_gid_t structures identify the same group,
|
||||
* APR_EMISMATCH if not, APR_BADARG if an apr_gid_t is invalid.
|
||||
* @remark This function is available only if APR_HAS_USER is defined.
|
||||
*/
|
||||
#if defined(WIN32)
|
||||
APR_DECLARE(apr_status_t) apr_gid_compare(apr_gid_t left, apr_gid_t right);
|
||||
#else
|
||||
#define apr_gid_compare(left,right) (((left) == (right)) ? APR_SUCCESS : APR_EMISMATCH)
|
||||
#endif
|
||||
|
||||
#endif /* ! APR_HAS_USER */
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ! APR_USER_H */
|
||||
76
database/apache/include/apr_uuid.h
Normal file
76
database/apache/include/apr_uuid.h
Normal file
@@ -0,0 +1,76 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file apr_uuid.h
|
||||
* @brief APR UUID library
|
||||
*/
|
||||
#ifndef APR_UUID_H
|
||||
#define APR_UUID_H
|
||||
|
||||
#include "apu.h"
|
||||
#include "apr_errno.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @defgroup APR_UUID UUID Handling
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* we represent a UUID as a block of 16 bytes.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
unsigned char data[16]; /**< the actual UUID */
|
||||
} apr_uuid_t;
|
||||
|
||||
/** UUIDs are formatted as: 00112233-4455-6677-8899-AABBCCDDEEFF */
|
||||
#define APR_UUID_FORMATTED_LENGTH 36
|
||||
|
||||
|
||||
/**
|
||||
* Generate and return a (new) UUID
|
||||
* @param uuid The resulting UUID
|
||||
*/
|
||||
APU_DECLARE(void) apr_uuid_get(apr_uuid_t *uuid);
|
||||
|
||||
/**
|
||||
* Format a UUID into a string, following the standard format
|
||||
* @param buffer The buffer to place the formatted UUID string into. It must
|
||||
* be at least APR_UUID_FORMATTED_LENGTH + 1 bytes long to hold
|
||||
* the formatted UUID and a null terminator
|
||||
* @param uuid The UUID to format
|
||||
*/
|
||||
APU_DECLARE(void) apr_uuid_format(char *buffer, const apr_uuid_t *uuid);
|
||||
|
||||
/**
|
||||
* Parse a standard-format string into a UUID
|
||||
* @param uuid The resulting UUID
|
||||
* @param uuid_str The formatted UUID
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_uuid_parse(apr_uuid_t *uuid, const char *uuid_str);
|
||||
|
||||
/** @} */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* APR_UUID_H */
|
||||
164
database/apache/include/apr_version.h
Normal file
164
database/apache/include/apr_version.h
Normal file
@@ -0,0 +1,164 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_VERSION_H
|
||||
#define APR_VERSION_H
|
||||
|
||||
/**
|
||||
* @file apr_version.h
|
||||
* @brief APR Versioning Interface
|
||||
*
|
||||
* APR's Version
|
||||
*
|
||||
* There are several different mechanisms for accessing the version. There
|
||||
* is a string form, and a set of numbers; in addition, there are constants
|
||||
* which can be compiled into your application, and you can query the library
|
||||
* being used for its actual version.
|
||||
*
|
||||
* Note that it is possible for an application to detect that it has been
|
||||
* compiled against a different version of APR by use of the compile-time
|
||||
* constants and the use of the run-time query function.
|
||||
*
|
||||
* APR version numbering follows the guidelines specified in:
|
||||
*
|
||||
* http://apr.apache.org/versioning.html
|
||||
*/
|
||||
|
||||
|
||||
#define APR_COPYRIGHT "Copyright (c) 2000-2023 The Apache Software " \
|
||||
"Foundation or its licensors, as applicable."
|
||||
|
||||
/* The numeric compile-time version constants. These constants are the
|
||||
* authoritative version numbers for APR.
|
||||
*/
|
||||
|
||||
/** major version
|
||||
* Major API changes that could cause compatibility problems for older
|
||||
* programs such as structure size changes. No binary compatibility is
|
||||
* possible across a change in the major version.
|
||||
*/
|
||||
#define APR_MAJOR_VERSION 1
|
||||
|
||||
/** minor version
|
||||
* Minor API changes that do not cause binary compatibility problems.
|
||||
* Reset to 0 when upgrading APR_MAJOR_VERSION
|
||||
*/
|
||||
#define APR_MINOR_VERSION 7
|
||||
|
||||
/** patch level
|
||||
* The Patch Level never includes API changes, simply bug fixes.
|
||||
* Reset to 0 when upgrading APR_MINOR_VERSION
|
||||
*/
|
||||
#define APR_PATCH_VERSION 4
|
||||
|
||||
/**
|
||||
* The symbol APR_IS_DEV_VERSION is only defined for internal,
|
||||
* "development" copies of APR. It is undefined for released versions
|
||||
* of APR.
|
||||
*/
|
||||
/* #undef APR_IS_DEV_VERSION */
|
||||
|
||||
/**
|
||||
* Check at compile time if the APR version is at least a certain
|
||||
* level.
|
||||
* @param major The major version component of the version checked
|
||||
* for (e.g., the "1" of "1.3.0").
|
||||
* @param minor The minor version component of the version checked
|
||||
* for (e.g., the "3" of "1.3.0").
|
||||
* @param patch The patch level component of the version checked
|
||||
* for (e.g., the "0" of "1.3.0").
|
||||
* @remark This macro is available with APR versions starting with
|
||||
* 1.3.0.
|
||||
*/
|
||||
#define APR_VERSION_AT_LEAST(major,minor,patch) \
|
||||
(((major) < APR_MAJOR_VERSION) \
|
||||
|| ((major) == APR_MAJOR_VERSION && (minor) < APR_MINOR_VERSION) \
|
||||
|| ((major) == APR_MAJOR_VERSION && (minor) == APR_MINOR_VERSION && (patch) <= APR_PATCH_VERSION))
|
||||
|
||||
#if defined(APR_IS_DEV_VERSION) || defined(DOXYGEN)
|
||||
/** Internal: string form of the "is dev" flag */
|
||||
#ifndef APR_IS_DEV_STRING
|
||||
#define APR_IS_DEV_STRING "-dev"
|
||||
#endif
|
||||
#else
|
||||
#define APR_IS_DEV_STRING ""
|
||||
#endif
|
||||
|
||||
/* APR_STRINGIFY is defined here, and also in apr_general.h, so wrap it */
|
||||
#ifndef APR_STRINGIFY
|
||||
/** Properly quote a value as a string in the C preprocessor */
|
||||
#define APR_STRINGIFY(n) APR_STRINGIFY_HELPER(n)
|
||||
/** Helper macro for APR_STRINGIFY */
|
||||
#define APR_STRINGIFY_HELPER(n) #n
|
||||
#endif
|
||||
|
||||
/** The formatted string of APR's version */
|
||||
#define APR_VERSION_STRING \
|
||||
APR_STRINGIFY(APR_MAJOR_VERSION) "." \
|
||||
APR_STRINGIFY(APR_MINOR_VERSION) "." \
|
||||
APR_STRINGIFY(APR_PATCH_VERSION) \
|
||||
APR_IS_DEV_STRING
|
||||
|
||||
/** An alternative formatted string of APR's version */
|
||||
/* macro for Win32 .rc files using numeric csv representation */
|
||||
#define APR_VERSION_STRING_CSV APR_MAJOR_VERSION ##, \
|
||||
##APR_MINOR_VERSION ##, \
|
||||
##APR_PATCH_VERSION
|
||||
|
||||
|
||||
#ifndef APR_VERSION_ONLY
|
||||
|
||||
/* The C language API to access the version at run time,
|
||||
* as opposed to compile time. APR_VERSION_ONLY may be defined
|
||||
* externally when preprocessing apr_version.h to obtain strictly
|
||||
* the C Preprocessor macro declarations.
|
||||
*/
|
||||
|
||||
#include "apr.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* The numeric version information is broken out into fields within this
|
||||
* structure.
|
||||
*/
|
||||
typedef struct {
|
||||
int major; /**< major number */
|
||||
int minor; /**< minor number */
|
||||
int patch; /**< patch number */
|
||||
int is_dev; /**< is development (1 or 0) */
|
||||
} apr_version_t;
|
||||
|
||||
/**
|
||||
* Return APR's version information information in a numeric form.
|
||||
*
|
||||
* @param pvsn Pointer to a version structure for returning the version
|
||||
* information.
|
||||
*/
|
||||
APR_DECLARE(void) apr_version(apr_version_t *pvsn);
|
||||
|
||||
/** Return APR's version information as a string. */
|
||||
APR_DECLARE(const char *) apr_version_string(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ndef APR_VERSION_ONLY */
|
||||
|
||||
#endif /* ndef APR_VERSION_H */
|
||||
124
database/apache/include/apr_want.h
Normal file
124
database/apache/include/apr_want.h
Normal file
@@ -0,0 +1,124 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "apr.h" /* configuration data */
|
||||
/**
|
||||
* @file apr_want.h
|
||||
* @brief APR Standard Headers Support
|
||||
*
|
||||
* <PRE>
|
||||
* Features:
|
||||
*
|
||||
* APR_WANT_STRFUNC: strcmp, strcat, strcpy, etc
|
||||
* APR_WANT_MEMFUNC: memcmp, memcpy, etc
|
||||
* APR_WANT_STDIO: <stdio.h> and related bits
|
||||
* APR_WANT_IOVEC: struct iovec
|
||||
* APR_WANT_BYTEFUNC: htons, htonl, ntohl, ntohs
|
||||
*
|
||||
* Typical usage:
|
||||
*
|
||||
* \#define APR_WANT_STRFUNC
|
||||
* \#define APR_WANT_MEMFUNC
|
||||
* \#include "apr_want.h"
|
||||
*
|
||||
* The appropriate headers will be included.
|
||||
*
|
||||
* Note: it is safe to use this in a header (it won't interfere with other
|
||||
* headers' or source files' use of apr_want.h)
|
||||
* </PRE>
|
||||
*/
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
#ifdef APR_WANT_STRFUNC
|
||||
|
||||
#if APR_HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
#if APR_HAVE_STRINGS_H
|
||||
#include <strings.h>
|
||||
#endif
|
||||
|
||||
#undef APR_WANT_STRFUNC
|
||||
#endif
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
#ifdef APR_WANT_MEMFUNC
|
||||
|
||||
#if APR_HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#undef APR_WANT_MEMFUNC
|
||||
#endif
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
#ifdef APR_WANT_STDIO
|
||||
|
||||
#if APR_HAVE_STDIO_H
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#undef APR_WANT_STDIO
|
||||
#endif
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
#ifdef APR_WANT_IOVEC
|
||||
|
||||
#if APR_HAVE_IOVEC
|
||||
|
||||
#if APR_HAVE_SYS_UIO_H
|
||||
#include <sys/uio.h>
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#ifndef APR_IOVEC_DEFINED
|
||||
#define APR_IOVEC_DEFINED
|
||||
struct iovec
|
||||
{
|
||||
void *iov_base;
|
||||
size_t iov_len;
|
||||
};
|
||||
#endif /* !APR_IOVEC_DEFINED */
|
||||
|
||||
#endif /* APR_HAVE_IOVEC */
|
||||
|
||||
#undef APR_WANT_IOVEC
|
||||
#endif
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
#ifdef APR_WANT_BYTEFUNC
|
||||
|
||||
/* Single Unix says they are in arpa/inet.h. Linux has them in
|
||||
* netinet/in.h. FreeBSD has them in arpa/inet.h but requires that
|
||||
* netinet/in.h be included first.
|
||||
*/
|
||||
#if APR_HAVE_NETINET_IN_H
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
#if APR_HAVE_ARPA_INET_H
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
#undef APR_WANT_BYTEFUNC
|
||||
#endif
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
163
database/apache/include/apr_xlate.h
Normal file
163
database/apache/include/apr_xlate.h
Normal file
@@ -0,0 +1,163 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_XLATE_H
|
||||
#define APR_XLATE_H
|
||||
|
||||
#include "apu.h"
|
||||
#include "apr_pools.h"
|
||||
#include "apr_errno.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @file apr_xlate.h
|
||||
* @brief APR I18N translation library
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup APR_XLATE I18N translation library
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
/** Opaque translation buffer */
|
||||
typedef struct apr_xlate_t apr_xlate_t;
|
||||
|
||||
/**
|
||||
* Set up for converting text from one charset to another.
|
||||
* @param convset The handle to be filled in by this function
|
||||
* @param topage The name of the target charset
|
||||
* @param frompage The name of the source charset
|
||||
* @param pool The pool to use
|
||||
* @remark
|
||||
* Specify APR_DEFAULT_CHARSET for one of the charset
|
||||
* names to indicate the charset of the source code at
|
||||
* compile time. This is useful if there are literal
|
||||
* strings in the source code which must be translated
|
||||
* according to the charset of the source code.
|
||||
* APR_DEFAULT_CHARSET is not useful if the source code
|
||||
* of the caller was not encoded in the same charset as
|
||||
* APR at compile time.
|
||||
*
|
||||
* @remark
|
||||
* Specify APR_LOCALE_CHARSET for one of the charset
|
||||
* names to indicate the charset of the current locale.
|
||||
*
|
||||
* @remark
|
||||
* Return APR_EINVAL if unable to procure a convset, or APR_ENOTIMPL
|
||||
* if charset transcoding is not available in this instance of
|
||||
* apr-util at all (i.e., APR_HAS_XLATE is undefined).
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_xlate_open(apr_xlate_t **convset,
|
||||
const char *topage,
|
||||
const char *frompage,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* This is to indicate the charset of the sourcecode at compile time
|
||||
* names to indicate the charset of the source code at
|
||||
* compile time. This is useful if there are literal
|
||||
* strings in the source code which must be translated
|
||||
* according to the charset of the source code.
|
||||
*/
|
||||
#define APR_DEFAULT_CHARSET (const char *)0
|
||||
/**
|
||||
* To indicate charset names of the current locale
|
||||
*/
|
||||
#define APR_LOCALE_CHARSET (const char *)1
|
||||
|
||||
/**
|
||||
* Find out whether or not the specified conversion is single-byte-only.
|
||||
* @param convset The handle allocated by apr_xlate_open, specifying the
|
||||
* parameters of conversion
|
||||
* @param onoff Output: whether or not the conversion is single-byte-only
|
||||
* @remark
|
||||
* Return APR_ENOTIMPL if charset transcoding is not available
|
||||
* in this instance of apr-util (i.e., APR_HAS_XLATE is undefined).
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_xlate_sb_get(apr_xlate_t *convset, int *onoff);
|
||||
|
||||
/**
|
||||
* Convert a buffer of text from one codepage to another.
|
||||
* @param convset The handle allocated by apr_xlate_open, specifying
|
||||
* the parameters of conversion
|
||||
* @param inbuf The address of the source buffer
|
||||
* @param inbytes_left Input: the amount of input data to be translated
|
||||
* Output: the amount of input data not yet translated
|
||||
* @param outbuf The address of the destination buffer
|
||||
* @param outbytes_left Input: the size of the output buffer
|
||||
* Output: the amount of the output buffer not yet used
|
||||
* @remark
|
||||
* Returns APR_ENOTIMPL if charset transcoding is not available
|
||||
* in this instance of apr-util (i.e., APR_HAS_XLATE is undefined).
|
||||
* Returns APR_INCOMPLETE if the input buffer ends in an incomplete
|
||||
* multi-byte character.
|
||||
*
|
||||
* To correctly terminate the output buffer for some multi-byte
|
||||
* character set encodings, a final call must be made to this function
|
||||
* after the complete input string has been converted, passing
|
||||
* the inbuf and inbytes_left parameters as NULL. (Note that this
|
||||
* mode only works from version 1.1.0 onwards)
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_xlate_conv_buffer(apr_xlate_t *convset,
|
||||
const char *inbuf,
|
||||
apr_size_t *inbytes_left,
|
||||
char *outbuf,
|
||||
apr_size_t *outbytes_left);
|
||||
|
||||
/* @see apr_file_io.h the comment in apr_file_io.h about this hack */
|
||||
#ifdef APR_NOT_DONE_YET
|
||||
/**
|
||||
* The purpose of apr_xlate_conv_char is to translate one character
|
||||
* at a time. This needs to be written carefully so that it works
|
||||
* with double-byte character sets.
|
||||
* @param convset The handle allocated by apr_xlate_open, specifying the
|
||||
* parameters of conversion
|
||||
* @param inchar The character to convert
|
||||
* @param outchar The converted character
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_xlate_conv_char(apr_xlate_t *convset,
|
||||
char inchar, char outchar);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Convert a single-byte character from one charset to another.
|
||||
* @param convset The handle allocated by apr_xlate_open, specifying the
|
||||
* parameters of conversion
|
||||
* @param inchar The single-byte character to convert.
|
||||
* @warning This only works when converting between single-byte character sets.
|
||||
* -1 will be returned if the conversion can't be performed.
|
||||
*/
|
||||
APU_DECLARE(apr_int32_t) apr_xlate_conv_byte(apr_xlate_t *convset,
|
||||
unsigned char inchar);
|
||||
|
||||
/**
|
||||
* Close a codepage translation handle.
|
||||
* @param convset The codepage translation handle to close
|
||||
* @remark
|
||||
* Return APR_ENOTIMPL if charset transcoding is not available
|
||||
* in this instance of apr-util (i.e., APR_HAS_XLATE is undefined).
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_xlate_close(apr_xlate_t *convset);
|
||||
|
||||
/** @} */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ! APR_XLATE_H */
|
||||
358
database/apache/include/apr_xml.h
Normal file
358
database/apache/include/apr_xml.h
Normal file
@@ -0,0 +1,358 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/**
|
||||
* @file apr_xml.h
|
||||
* @brief APR-UTIL XML Library
|
||||
*/
|
||||
#ifndef APR_XML_H
|
||||
#define APR_XML_H
|
||||
|
||||
/**
|
||||
* @defgroup APR_Util_XML XML
|
||||
* @ingroup APR_Util
|
||||
* @{
|
||||
*/
|
||||
#include "apr_pools.h"
|
||||
#include "apr_tables.h"
|
||||
#include "apr_file_io.h"
|
||||
|
||||
#include "apu.h"
|
||||
#if APR_CHARSET_EBCDIC
|
||||
#include "apr_xlate.h"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @package Apache XML library
|
||||
*/
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
/* ### these will need to move at some point to a more logical spot */
|
||||
|
||||
/** @see apr_text */
|
||||
typedef struct apr_text apr_text;
|
||||
|
||||
/** Structure to keep a linked list of pieces of text */
|
||||
struct apr_text {
|
||||
/** The current piece of text */
|
||||
const char *text;
|
||||
/** a pointer to the next piece of text */
|
||||
struct apr_text *next;
|
||||
};
|
||||
|
||||
/** @see apr_text_header */
|
||||
typedef struct apr_text_header apr_text_header;
|
||||
|
||||
/** A list of pieces of text */
|
||||
struct apr_text_header {
|
||||
/** The first piece of text in the list */
|
||||
apr_text *first;
|
||||
/** The last piece of text in the list */
|
||||
apr_text *last;
|
||||
};
|
||||
|
||||
/**
|
||||
* Append a piece of text to the end of a list
|
||||
* @param p The pool to allocate out of
|
||||
* @param hdr The text header to append to
|
||||
* @param text The new text to append
|
||||
*/
|
||||
APU_DECLARE(void) apr_text_append(apr_pool_t *p, apr_text_header *hdr,
|
||||
const char *text);
|
||||
|
||||
|
||||
/* --------------------------------------------------------------------
|
||||
**
|
||||
** XML PARSING
|
||||
*/
|
||||
|
||||
/*
|
||||
** Qualified namespace values
|
||||
**
|
||||
** APR_XML_NS_DAV_ID
|
||||
** We always insert the "DAV:" namespace URI at the head of the
|
||||
** namespace array. This means that it will always be at ID==0,
|
||||
** making it much easier to test for.
|
||||
**
|
||||
** APR_XML_NS_NONE
|
||||
** This special ID is used for two situations:
|
||||
**
|
||||
** 1) The namespace prefix begins with "xml" (and we do not know
|
||||
** what it means). Namespace prefixes with "xml" (any case) as
|
||||
** their first three characters are reserved by the XML Namespaces
|
||||
** specification for future use. mod_dav will pass these through
|
||||
** unchanged. When this identifier is used, the prefix is LEFT in
|
||||
** the element/attribute name. Downstream processing should not
|
||||
** prepend another prefix.
|
||||
**
|
||||
** 2) The element/attribute does not have a namespace.
|
||||
**
|
||||
** a) No prefix was used, and a default namespace has not been
|
||||
** defined.
|
||||
** b) No prefix was used, and the default namespace was specified
|
||||
** to mean "no namespace". This is done with a namespace
|
||||
** declaration of: xmlns=""
|
||||
** (this declaration is typically used to override a previous
|
||||
** specification for the default namespace)
|
||||
**
|
||||
** In these cases, we need to record that the elem/attr has no
|
||||
** namespace so that we will not attempt to prepend a prefix.
|
||||
** All namespaces that are used will have a prefix assigned to
|
||||
** them -- mod_dav will never set or use the default namespace
|
||||
** when generating XML. This means that "no prefix" will always
|
||||
** mean "no namespace".
|
||||
**
|
||||
** In both cases, the XML generation will avoid prepending a prefix.
|
||||
** For the first case, this means the original prefix/name will be
|
||||
** inserted into the output stream. For the latter case, it means
|
||||
** the name will have no prefix, and since we never define a default
|
||||
** namespace, this means it will have no namespace.
|
||||
**
|
||||
** Note: currently, mod_dav understands the "xmlns" prefix and the
|
||||
** "xml:lang" attribute. These are handled specially (they aren't
|
||||
** left within the XML tree), so the APR_XML_NS_NONE value won't ever
|
||||
** really apply to these values.
|
||||
*/
|
||||
#define APR_XML_NS_DAV_ID 0 /**< namespace ID for "DAV:" */
|
||||
#define APR_XML_NS_NONE -10 /**< no namespace for this elem/attr */
|
||||
|
||||
#define APR_XML_NS_ERROR_BASE -100 /**< used only during processing */
|
||||
/** Is this namespace an error? */
|
||||
#define APR_XML_NS_IS_ERROR(e) ((e) <= APR_XML_NS_ERROR_BASE)
|
||||
|
||||
/** @see apr_xml_attr */
|
||||
typedef struct apr_xml_attr apr_xml_attr;
|
||||
/** @see apr_xml_elem */
|
||||
typedef struct apr_xml_elem apr_xml_elem;
|
||||
/** @see apr_xml_doc */
|
||||
typedef struct apr_xml_doc apr_xml_doc;
|
||||
|
||||
/** apr_xml_attr: holds a parsed XML attribute */
|
||||
struct apr_xml_attr {
|
||||
/** attribute name */
|
||||
const char *name;
|
||||
/** index into namespace array */
|
||||
int ns;
|
||||
|
||||
/** attribute value */
|
||||
const char *value;
|
||||
|
||||
/** next attribute */
|
||||
struct apr_xml_attr *next;
|
||||
};
|
||||
|
||||
/** apr_xml_elem: holds a parsed XML element */
|
||||
struct apr_xml_elem {
|
||||
/** element name */
|
||||
const char *name;
|
||||
/** index into namespace array */
|
||||
int ns;
|
||||
/** xml:lang for attrs/contents */
|
||||
const char *lang;
|
||||
|
||||
/** cdata right after start tag */
|
||||
apr_text_header first_cdata;
|
||||
/** cdata after MY end tag */
|
||||
apr_text_header following_cdata;
|
||||
|
||||
/** parent element */
|
||||
struct apr_xml_elem *parent;
|
||||
/** next (sibling) element */
|
||||
struct apr_xml_elem *next;
|
||||
/** first child element */
|
||||
struct apr_xml_elem *first_child;
|
||||
/** first attribute */
|
||||
struct apr_xml_attr *attr;
|
||||
|
||||
/* used only during parsing */
|
||||
/** last child element */
|
||||
struct apr_xml_elem *last_child;
|
||||
/** namespaces scoped by this elem */
|
||||
struct apr_xml_ns_scope *ns_scope;
|
||||
|
||||
/* used by modules during request processing */
|
||||
/** Place for modules to store private data */
|
||||
void *priv;
|
||||
};
|
||||
|
||||
/** Is this XML element empty? */
|
||||
#define APR_XML_ELEM_IS_EMPTY(e) ((e)->first_child == NULL && \
|
||||
(e)->first_cdata.first == NULL)
|
||||
|
||||
/** apr_xml_doc: holds a parsed XML document */
|
||||
struct apr_xml_doc {
|
||||
/** root element */
|
||||
apr_xml_elem *root;
|
||||
/** array of namespaces used */
|
||||
apr_array_header_t *namespaces;
|
||||
};
|
||||
|
||||
/** Opaque XML parser structure */
|
||||
typedef struct apr_xml_parser apr_xml_parser;
|
||||
|
||||
/**
|
||||
* Create an XML parser
|
||||
* @param pool The pool for allocating the parser and the parse results.
|
||||
* @return The new parser.
|
||||
*/
|
||||
APU_DECLARE(apr_xml_parser *) apr_xml_parser_create(apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Parse a File, producing a xml_doc
|
||||
* @param p The pool for allocating the parse results.
|
||||
* @param parser A pointer to *parser (needed so calling function can get
|
||||
* errors), will be set to NULL on successful completion.
|
||||
* @param ppdoc A pointer to *apr_xml_doc (which has the parsed results in it)
|
||||
* @param xmlfd A file to read from.
|
||||
* @param buffer_length Buffer length which would be suitable
|
||||
* @return Any errors found during parsing.
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_xml_parse_file(apr_pool_t *p,
|
||||
apr_xml_parser **parser,
|
||||
apr_xml_doc **ppdoc,
|
||||
apr_file_t *xmlfd,
|
||||
apr_size_t buffer_length);
|
||||
|
||||
|
||||
/**
|
||||
* Feed input into the parser
|
||||
* @param parser The XML parser for parsing this data.
|
||||
* @param data The data to parse.
|
||||
* @param len The length of the data.
|
||||
* @return Any errors found during parsing.
|
||||
* @remark Use apr_xml_parser_geterror() to get more error information.
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_xml_parser_feed(apr_xml_parser *parser,
|
||||
const char *data,
|
||||
apr_size_t len);
|
||||
|
||||
/**
|
||||
* Terminate the parsing and return the result
|
||||
* @param parser The XML parser for parsing this data.
|
||||
* @param pdoc The resulting parse information. May be NULL to simply
|
||||
* terminate the parsing without fetching the info.
|
||||
* @return Any errors found during the final stage of parsing.
|
||||
* @remark Use apr_xml_parser_geterror() to get more error information.
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_xml_parser_done(apr_xml_parser *parser,
|
||||
apr_xml_doc **pdoc);
|
||||
|
||||
/**
|
||||
* Fetch additional error information from the parser.
|
||||
* @param parser The XML parser to query for errors.
|
||||
* @param errbuf A buffer for storing error text.
|
||||
* @param errbufsize The length of the error text buffer.
|
||||
* @return The error buffer
|
||||
*/
|
||||
APU_DECLARE(char *) apr_xml_parser_geterror(apr_xml_parser *parser,
|
||||
char *errbuf,
|
||||
apr_size_t errbufsize);
|
||||
|
||||
|
||||
/**
|
||||
* Converts an XML element tree to flat text
|
||||
* @param p The pool to allocate out of
|
||||
* @param elem The XML element to convert
|
||||
* @param style How to covert the XML. One of:
|
||||
* <PRE>
|
||||
* APR_XML_X2T_FULL start tag, contents, end tag
|
||||
* APR_XML_X2T_INNER contents only
|
||||
* APR_XML_X2T_LANG_INNER xml:lang + inner contents
|
||||
* APR_XML_X2T_FULL_NS_LANG FULL + ns defns + xml:lang
|
||||
* APR_XML_X2T_PARSED original prefixes
|
||||
* </PRE>
|
||||
* @param namespaces The namespace of the current XML element
|
||||
* @param ns_map Namespace mapping
|
||||
* @param pbuf Buffer to put the converted text into
|
||||
* @param psize Size of the converted text
|
||||
*/
|
||||
APU_DECLARE(void) apr_xml_to_text(apr_pool_t *p, const apr_xml_elem *elem,
|
||||
int style, apr_array_header_t *namespaces,
|
||||
int *ns_map, const char **pbuf,
|
||||
apr_size_t *psize);
|
||||
|
||||
/* style argument values: */
|
||||
#define APR_XML_X2T_FULL 0 /**< start tag, contents, end tag */
|
||||
#define APR_XML_X2T_INNER 1 /**< contents only */
|
||||
#define APR_XML_X2T_LANG_INNER 2 /**< xml:lang + inner contents */
|
||||
#define APR_XML_X2T_FULL_NS_LANG 3 /**< FULL + ns defns + xml:lang */
|
||||
#define APR_XML_X2T_PARSED 4 /**< original prefixes */
|
||||
|
||||
/**
|
||||
* empty XML element
|
||||
* @param p The pool to allocate out of
|
||||
* @param elem The XML element to empty
|
||||
* @return the string that was stored in the XML element
|
||||
*/
|
||||
APU_DECLARE(const char *) apr_xml_empty_elem(apr_pool_t *p,
|
||||
const apr_xml_elem *elem);
|
||||
|
||||
/**
|
||||
* quote an XML string
|
||||
* Replace '\<', '\>', and '\&' with '\<', '\>', and '\&'.
|
||||
* @param p The pool to allocate out of
|
||||
* @param s The string to quote
|
||||
* @param quotes If quotes is true, then replace '"' with '\"'.
|
||||
* @return The quoted string
|
||||
* @note If the string does not contain special characters, it is not
|
||||
* duplicated into the pool and the original string is returned.
|
||||
*/
|
||||
APU_DECLARE(const char *) apr_xml_quote_string(apr_pool_t *p, const char *s,
|
||||
int quotes);
|
||||
|
||||
/**
|
||||
* Quote an XML element
|
||||
* @param p The pool to allocate out of
|
||||
* @param elem The element to quote
|
||||
*/
|
||||
APU_DECLARE(void) apr_xml_quote_elem(apr_pool_t *p, apr_xml_elem *elem);
|
||||
|
||||
/* manage an array of unique URIs: apr_xml_insert_uri() and APR_XML_URI_ITEM() */
|
||||
|
||||
/**
|
||||
* return the URI's (existing) index, or insert it and return a new index
|
||||
* @param uri_array array to insert into
|
||||
* @param uri The uri to insert
|
||||
* @return int The uri's index
|
||||
*/
|
||||
APU_DECLARE(int) apr_xml_insert_uri(apr_array_header_t *uri_array,
|
||||
const char *uri);
|
||||
|
||||
/** Get the URI item for this XML element */
|
||||
#define APR_XML_GET_URI_ITEM(ary, i) (((const char * const *)(ary)->elts)[i])
|
||||
|
||||
#if APR_CHARSET_EBCDIC
|
||||
/**
|
||||
* Convert parsed tree in EBCDIC
|
||||
* @param p The pool to allocate out of
|
||||
* @param pdoc The apr_xml_doc to convert.
|
||||
* @param xlate The translation handle to use.
|
||||
* @return Any errors found during conversion.
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_xml_parser_convert_doc(apr_pool_t *p,
|
||||
apr_xml_doc *pdoc,
|
||||
apr_xlate_t *convset);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
/** @} */
|
||||
#endif /* APR_XML_H */
|
||||
146
database/apache/include/apu.h
Normal file
146
database/apache/include/apu.h
Normal file
@@ -0,0 +1,146 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* apu.h is duplicated from apu.hw at build time -- do not edit apu.h
|
||||
*/
|
||||
/* @file apu.h
|
||||
* @brief APR-Utility main file
|
||||
*/
|
||||
/**
|
||||
* @defgroup APR_Util APR Utility Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
#ifndef APU_H
|
||||
#define APU_H
|
||||
|
||||
/**
|
||||
* APU_DECLARE_EXPORT is defined when building the APR-UTIL dynamic library,
|
||||
* so that all public symbols are exported.
|
||||
*
|
||||
* APU_DECLARE_STATIC is defined when including the APR-UTIL public headers,
|
||||
* to provide static linkage when the dynamic library may be unavailable.
|
||||
*
|
||||
* APU_DECLARE_STATIC and APU_DECLARE_EXPORT are left undefined when
|
||||
* including the APR-UTIL public headers, to import and link the symbols from
|
||||
* the dynamic APR-UTIL library and assure appropriate indirection and calling
|
||||
* conventions at compile time.
|
||||
*/
|
||||
|
||||
/* Make sure we have our platform identifier macro defined we ask for later.
|
||||
*/
|
||||
#if defined(_WIN32) && !defined(WIN32)
|
||||
#define WIN32 1
|
||||
#endif
|
||||
|
||||
#if defined(DOXYGEN) || !defined(WIN32)
|
||||
/**
|
||||
* The public APR-UTIL functions are declared with APU_DECLARE(), so they may
|
||||
* use the most appropriate calling convention. Public APR functions with
|
||||
* variable arguments must use APU_DECLARE_NONSTD().
|
||||
*
|
||||
* @fn APU_DECLARE(rettype) apr_func(args);
|
||||
*/
|
||||
#define APU_DECLARE(type) type
|
||||
/**
|
||||
* The public APR-UTIL functions using variable arguments are declared with
|
||||
* APU_DECLARE_NONSTD(), as they must use the C language calling convention.
|
||||
*
|
||||
* @fn APU_DECLARE_NONSTD(rettype) apr_func(args, ...);
|
||||
*/
|
||||
#define APU_DECLARE_NONSTD(type) type
|
||||
/**
|
||||
* The public APR-UTIL variables are declared with APU_DECLARE_DATA.
|
||||
* This assures the appropriate indirection is invoked at compile time.
|
||||
*
|
||||
* @fn APU_DECLARE_DATA type apr_variable;
|
||||
* @note extern APU_DECLARE_DATA type apr_variable; syntax is required for
|
||||
* declarations within headers to properly import the variable.
|
||||
*/
|
||||
#define APU_DECLARE_DATA
|
||||
#elif defined(APU_DECLARE_STATIC)
|
||||
#define APU_DECLARE(type) type __stdcall
|
||||
#define APU_DECLARE_NONSTD(type) type __cdecl
|
||||
#define APU_DECLARE_DATA
|
||||
#elif defined(APU_DECLARE_EXPORT)
|
||||
#define APU_DECLARE(type) __declspec(dllexport) type __stdcall
|
||||
#define APU_DECLARE_NONSTD(type) __declspec(dllexport) type __cdecl
|
||||
#define APU_DECLARE_DATA __declspec(dllexport)
|
||||
#else
|
||||
#define APU_DECLARE(type) __declspec(dllimport) type __stdcall
|
||||
#define APU_DECLARE_NONSTD(type) __declspec(dllimport) type __cdecl
|
||||
#define APU_DECLARE_DATA __declspec(dllimport)
|
||||
#endif
|
||||
|
||||
#if !defined(WIN32) || defined(APU_MODULE_DECLARE_STATIC)
|
||||
/**
|
||||
* Declare a dso module's exported module structure as APU_MODULE_DECLARE_DATA.
|
||||
*
|
||||
* Unless APU_MODULE_DECLARE_STATIC is defined at compile time, symbols
|
||||
* declared with APU_MODULE_DECLARE_DATA are always exported.
|
||||
* @code
|
||||
* module APU_MODULE_DECLARE_DATA mod_tag
|
||||
* @endcode
|
||||
*/
|
||||
#define APU_MODULE_DECLARE_DATA
|
||||
#else
|
||||
#define APU_MODULE_DECLARE_DATA __declspec(dllexport)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* we always have SDBM (it's in our codebase)
|
||||
*/
|
||||
#define APU_HAVE_SDBM 1
|
||||
|
||||
#ifndef APU_DSO_MODULE_BUILD
|
||||
#define APU_HAVE_GDBM 0
|
||||
#define APU_HAVE_NDBM 0
|
||||
#define APU_HAVE_DB 0
|
||||
|
||||
#if APU_HAVE_DB
|
||||
#define APU_HAVE_DB_VERSION 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* we always enable dynamic driver loads within apr_dbd
|
||||
* Win32 always has odbc (it's always installed)
|
||||
*/
|
||||
#ifndef APU_DSO_MODULE_BUILD
|
||||
#define APU_HAVE_PGSQL 0
|
||||
#define APU_HAVE_MYSQL 0
|
||||
#define APU_HAVE_SQLITE3 0
|
||||
#define APU_HAVE_SQLITE2 0
|
||||
#define APU_HAVE_ORACLE 0
|
||||
#define APU_HAVE_ODBC 1
|
||||
#endif
|
||||
|
||||
#define APU_HAVE_CRYPTO 1
|
||||
|
||||
#ifndef APU_DSO_MODULE_BUILD
|
||||
#define APU_HAVE_OPENSSL 1
|
||||
#define APU_HAVE_NSS 0
|
||||
#define APU_HAVE_COMMONCRYPTO 0
|
||||
#endif
|
||||
|
||||
#define APU_HAVE_APR_ICONV 1
|
||||
#define APU_HAVE_ICONV 0
|
||||
#define APR_HAS_XLATE (APU_HAVE_APR_ICONV || APU_HAVE_ICONV)
|
||||
|
||||
#endif /* APU_H */
|
||||
/** @} */
|
||||
173
database/apache/include/apu_errno.h
Normal file
173
database/apache/include/apu_errno.h
Normal file
@@ -0,0 +1,173 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APU_ERRNO_H
|
||||
#define APU_ERRNO_H
|
||||
|
||||
/**
|
||||
* @file apu_errno.h
|
||||
* @brief APR-Util Error Codes
|
||||
*/
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_errno.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @defgroup apu_errno Error Codes
|
||||
* @ingroup APR_Util
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup APR_Util_Error APR_Util Error Values
|
||||
* <PRE>
|
||||
* <b>APU ERROR VALUES</b>
|
||||
* APR_ENOKEY The key provided was empty or NULL
|
||||
* APR_ENOIV The initialisation vector provided was NULL
|
||||
* APR_EKEYTYPE The key type was not recognised
|
||||
* APR_ENOSPACE The buffer supplied was not big enough
|
||||
* APR_ECRYPT An error occurred while encrypting or decrypting
|
||||
* APR_EPADDING Padding was not supported
|
||||
* APR_EKEYLENGTH The key length was incorrect
|
||||
* APR_ENOCIPHER The cipher provided was not recognised
|
||||
* APR_ENODIGEST The digest provided was not recognised
|
||||
* APR_ENOENGINE The engine provided was not recognised
|
||||
* APR_EINITENGINE The engine could not be initialised
|
||||
* APR_EREINIT Underlying crypto has already been initialised
|
||||
* </PRE>
|
||||
*
|
||||
* <PRE>
|
||||
* <b>APR STATUS VALUES</b>
|
||||
* APR_INCHILD Program is currently executing in the child
|
||||
* </PRE>
|
||||
* @{
|
||||
*/
|
||||
/** @see APR_STATUS_IS_ENOKEY */
|
||||
#define APR_ENOKEY (APR_UTIL_START_STATUS + 1)
|
||||
/** @see APR_STATUS_IS_ENOIV */
|
||||
#define APR_ENOIV (APR_UTIL_START_STATUS + 2)
|
||||
/** @see APR_STATUS_IS_EKEYTYPE */
|
||||
#define APR_EKEYTYPE (APR_UTIL_START_STATUS + 3)
|
||||
/** @see APR_STATUS_IS_ENOSPACE */
|
||||
#define APR_ENOSPACE (APR_UTIL_START_STATUS + 4)
|
||||
/** @see APR_STATUS_IS_ECRYPT */
|
||||
#define APR_ECRYPT (APR_UTIL_START_STATUS + 5)
|
||||
/** @see APR_STATUS_IS_EPADDING */
|
||||
#define APR_EPADDING (APR_UTIL_START_STATUS + 6)
|
||||
/** @see APR_STATUS_IS_EKEYLENGTH */
|
||||
#define APR_EKEYLENGTH (APR_UTIL_START_STATUS + 7)
|
||||
/** @see APR_STATUS_IS_ENOCIPHER */
|
||||
#define APR_ENOCIPHER (APR_UTIL_START_STATUS + 8)
|
||||
/** @see APR_STATUS_IS_ENODIGEST */
|
||||
#define APR_ENODIGEST (APR_UTIL_START_STATUS + 9)
|
||||
/** @see APR_STATUS_IS_ENOENGINE */
|
||||
#define APR_ENOENGINE (APR_UTIL_START_STATUS + 10)
|
||||
/** @see APR_STATUS_IS_EINITENGINE */
|
||||
#define APR_EINITENGINE (APR_UTIL_START_STATUS + 11)
|
||||
/** @see APR_STATUS_IS_EREINIT */
|
||||
#define APR_EREINIT (APR_UTIL_START_STATUS + 12)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @defgroup APU_STATUS_IS Status Value Tests
|
||||
* @warning For any particular error condition, more than one of these tests
|
||||
* may match. This is because platform-specific error codes may not
|
||||
* always match the semantics of the POSIX codes these tests (and the
|
||||
* corresponding APR error codes) are named after. A notable example
|
||||
* are the APR_STATUS_IS_ENOENT and APR_STATUS_IS_ENOTDIR tests on
|
||||
* Win32 platforms. The programmer should always be aware of this and
|
||||
* adjust the order of the tests accordingly.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @addtogroup APR_Util_Error
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* The key was empty or not provided
|
||||
*/
|
||||
#define APR_STATUS_IS_ENOKEY(s) ((s) == APR_ENOKEY)
|
||||
/**
|
||||
* The initialisation vector was not provided
|
||||
*/
|
||||
#define APR_STATUS_IS_ENOIV(s) ((s) == APR_ENOIV)
|
||||
/**
|
||||
* The key type was not recognised
|
||||
*/
|
||||
#define APR_STATUS_IS_EKEYTYPE(s) ((s) == APR_EKEYTYPE)
|
||||
/**
|
||||
* The buffer provided was not big enough
|
||||
*/
|
||||
#define APR_STATUS_IS_ENOSPACE(s) ((s) == APR_ENOSPACE)
|
||||
/**
|
||||
* An error occurred while encrypting or decrypting
|
||||
*/
|
||||
#define APR_STATUS_IS_ECRYPT(s) ((s) == APR_ECRYPT)
|
||||
/**
|
||||
* An error occurred while padding
|
||||
*/
|
||||
#define APR_STATUS_IS_EPADDING(s) ((s) == APR_EPADDING)
|
||||
/**
|
||||
* An error occurred with the key length
|
||||
*/
|
||||
#define APR_STATUS_IS_EKEYLENGTH(s) ((s) == APR_EKEYLENGTH)
|
||||
/**
|
||||
* The cipher provided was not recognised
|
||||
*/
|
||||
#define APR_STATUS_IS_ENOCIPHER(s) ((s) == APR_ENOCIPHER)
|
||||
/**
|
||||
* The digest provided was not recognised
|
||||
*/
|
||||
#define APR_STATUS_IS_ENODIGEST(s) ((s) == APR_ENODIGEST)
|
||||
/**
|
||||
* The engine provided was not recognised
|
||||
*/
|
||||
#define APR_STATUS_IS_ENOENGINE(s) ((s) == APR_ENOENGINE)
|
||||
/**
|
||||
* The engine could not be initialised
|
||||
*/
|
||||
#define APR_STATUS_IS_EINITENGINE(s) ((s) == APR_EINITENGINE)
|
||||
/**
|
||||
* Crypto has already been initialised
|
||||
*/
|
||||
#define APR_STATUS_IS_EREINIT(s) ((s) == APR_EREINIT)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* This structure allows the underlying API error codes to be returned
|
||||
* along with plain text error messages that explain to us mere mortals
|
||||
* what really happened.
|
||||
*/
|
||||
typedef struct apu_err_t {
|
||||
const char *reason;
|
||||
const char *msg;
|
||||
int rc;
|
||||
} apu_err_t;
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ! APU_ERRNO_H */
|
||||
139
database/apache/include/apu_version.h
Normal file
139
database/apache/include/apu_version.h
Normal file
@@ -0,0 +1,139 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APU_VERSION_H
|
||||
#define APU_VERSION_H
|
||||
|
||||
/**
|
||||
* @file apu_version.h
|
||||
* @brief APR-util Versioning Interface
|
||||
*
|
||||
* APR-util's Version
|
||||
*
|
||||
* There are several different mechanisms for accessing the version. There
|
||||
* is a string form, and a set of numbers; in addition, there are constants
|
||||
* which can be compiled into your application, and you can query the library
|
||||
* being used for its actual version.
|
||||
*
|
||||
* Note that it is possible for an application to detect that it has been
|
||||
* compiled against a different version of APU by use of the compile-time
|
||||
* constants and the use of the run-time query function.
|
||||
*
|
||||
* APU version numbering follows the guidelines specified in:
|
||||
*
|
||||
* http://apr.apache.org/versioning.html
|
||||
*/
|
||||
|
||||
|
||||
#define APU_COPYRIGHT "Copyright (c) 2000-2023 The Apache Software " \
|
||||
"Foundation or its licensors, as applicable."
|
||||
|
||||
/* The numeric compile-time version constants. These constants are the
|
||||
* authoritative version numbers for APU.
|
||||
*/
|
||||
|
||||
/** major version
|
||||
* Major API changes that could cause compatibility problems for older
|
||||
* programs such as structure size changes. No binary compatibility is
|
||||
* possible across a change in the major version.
|
||||
*/
|
||||
#define APU_MAJOR_VERSION 1
|
||||
|
||||
/** minor version
|
||||
* Minor API changes that do not cause binary compatibility problems.
|
||||
* Reset to 0 when upgrading APU_MAJOR_VERSION
|
||||
*/
|
||||
#define APU_MINOR_VERSION 6
|
||||
|
||||
/** patch level
|
||||
* The Patch Level never includes API changes, simply bug fixes.
|
||||
* Reset to 0 when upgrading APR_MINOR_VERSION
|
||||
*/
|
||||
#define APU_PATCH_VERSION 3
|
||||
|
||||
/**
|
||||
* The symbol APU_IS_DEV_VERSION is only defined for internal,
|
||||
* "development" copies of APU. It is undefined for released versions
|
||||
* of APU.
|
||||
*/
|
||||
/* #undef APU_IS_DEV_VERSION */
|
||||
|
||||
|
||||
#if defined(APU_IS_DEV_VERSION) || defined(DOXYGEN)
|
||||
/** Internal: string form of the "is dev" flag */
|
||||
#ifndef APU_IS_DEV_STRING
|
||||
#define APU_IS_DEV_STRING "-dev"
|
||||
#endif
|
||||
#else
|
||||
#define APU_IS_DEV_STRING ""
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef APU_STRINGIFY
|
||||
/** Properly quote a value as a string in the C preprocessor */
|
||||
#define APU_STRINGIFY(n) APU_STRINGIFY_HELPER(n)
|
||||
/** Helper macro for APU_STRINGIFY */
|
||||
#define APU_STRINGIFY_HELPER(n) #n
|
||||
#endif
|
||||
|
||||
/** The formatted string of APU's version */
|
||||
#define APU_VERSION_STRING \
|
||||
APU_STRINGIFY(APU_MAJOR_VERSION) "." \
|
||||
APU_STRINGIFY(APU_MINOR_VERSION) "." \
|
||||
APU_STRINGIFY(APU_PATCH_VERSION) \
|
||||
APU_IS_DEV_STRING
|
||||
|
||||
/** An alternative formatted string of APR's version */
|
||||
/* macro for Win32 .rc files using numeric csv representation */
|
||||
#define APU_VERSION_STRING_CSV APU_MAJOR_VERSION ##, \
|
||||
##APU_MINOR_VERSION ##, \
|
||||
##APU_PATCH_VERSION
|
||||
|
||||
|
||||
#ifndef APU_VERSION_ONLY
|
||||
|
||||
/* The C language API to access the version at run time,
|
||||
* as opposed to compile time. APU_VERSION_ONLY may be defined
|
||||
* externally when preprocessing apr_version.h to obtain strictly
|
||||
* the C Preprocessor macro declarations.
|
||||
*/
|
||||
|
||||
#include "apr_version.h"
|
||||
|
||||
#include "apu.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Return APR-util's version information information in a numeric form.
|
||||
*
|
||||
* @param pvsn Pointer to a version structure for returning the version
|
||||
* information.
|
||||
*/
|
||||
APU_DECLARE(void) apu_version(apr_version_t *pvsn);
|
||||
|
||||
/** Return APU's version information as a string. */
|
||||
APU_DECLARE(const char *) apu_version_string(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ndef APU_VERSION_ONLY */
|
||||
|
||||
#endif /* ndef APU_VERSION_H */
|
||||
52
database/apache/include/apu_want.h
Normal file
52
database/apache/include/apu_want.h
Normal file
@@ -0,0 +1,52 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "apu.h" /* configuration data */
|
||||
|
||||
/**
|
||||
* @file apu_want.h
|
||||
* @brief APR Standard Headers Support
|
||||
*
|
||||
* <PRE>
|
||||
* Features:
|
||||
*
|
||||
* APU_WANT_DB: <db.h>
|
||||
*
|
||||
* Typical usage:
|
||||
*
|
||||
* #define APU_WANT_DB
|
||||
* #include "apu_want.h"
|
||||
*
|
||||
* The appropriate headers will be included.
|
||||
*
|
||||
* Note: it is safe to use this in a header (it won't interfere with other
|
||||
* headers' or source files' use of apu_want.h)
|
||||
* </PRE>
|
||||
*/
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
#ifdef APU_WANT_DB
|
||||
|
||||
#if APU_HAVE_DB
|
||||
/* win32 note.. you will need to change this for db1 */
|
||||
#include <db.h>
|
||||
#endif
|
||||
|
||||
#undef APU_WANT_DB
|
||||
#endif
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
56
database/apache/include/cache_common.h
Normal file
56
database/apache/include/cache_common.h
Normal file
@@ -0,0 +1,56 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file cache_common.h
|
||||
* @brief Common Cache structs
|
||||
*
|
||||
* @defgroup Cache_cache Cache Functions
|
||||
* @ingroup MOD_CACHE
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef CACHE_COMMON_H
|
||||
#define CACHE_COMMON_H
|
||||
|
||||
/* a cache control header breakdown */
|
||||
typedef struct cache_control {
|
||||
unsigned int parsed:1;
|
||||
unsigned int cache_control:1;
|
||||
unsigned int pragma:1;
|
||||
unsigned int no_cache:1;
|
||||
unsigned int no_cache_header:1; /* no cache by header match */
|
||||
unsigned int no_store:1;
|
||||
unsigned int max_age:1;
|
||||
unsigned int max_stale:1;
|
||||
unsigned int min_fresh:1;
|
||||
unsigned int no_transform:1;
|
||||
unsigned int only_if_cached:1;
|
||||
unsigned int public:1;
|
||||
unsigned int private:1;
|
||||
unsigned int private_header:1; /* private by header match */
|
||||
unsigned int must_revalidate:1;
|
||||
unsigned int proxy_revalidate:1;
|
||||
unsigned int s_maxage:1;
|
||||
unsigned int invalidated:1; /* has this entity been invalidated? */
|
||||
apr_int64_t max_age_value; /* if positive, then set */
|
||||
apr_int64_t max_stale_value; /* if positive, then set */
|
||||
apr_int64_t min_fresh_value; /* if positive, then set */
|
||||
apr_int64_t s_maxage_value; /* if positive, then set */
|
||||
} cache_control_t;
|
||||
|
||||
#endif /* CACHE_COMMON_H */
|
||||
/** @} */
|
||||
1064
database/apache/include/expat.h
Normal file
1064
database/apache/include/expat.h
Normal file
File diff suppressed because it is too large
Load Diff
60
database/apache/include/heartbeat.h
Normal file
60
database/apache/include/heartbeat.h
Normal file
@@ -0,0 +1,60 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file heartbeat.h
|
||||
* @brief commun structures for mod_heartmonitor.c and mod_lbmethod_heartbeat.c
|
||||
*
|
||||
* @defgroup HEARTBEAT heartbeat
|
||||
* @ingroup APACHE_MODS
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef HEARTBEAT_H
|
||||
#define HEARTBEAT_H
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_time.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Worse Case: IPv4-Mapped IPv6 Address
|
||||
* 0000:0000:0000:0000:0000:FFFF:255.255.255.255
|
||||
*/
|
||||
#define MAXIPSIZE 46
|
||||
typedef struct hm_slot_server_t
|
||||
{
|
||||
char ip[MAXIPSIZE];
|
||||
int busy;
|
||||
int ready;
|
||||
apr_time_t seen;
|
||||
int id;
|
||||
} hm_slot_server_t;
|
||||
|
||||
/* default name of heartbeat data file, created in the configured
|
||||
* runtime directory when mod_slotmem_shm is not available
|
||||
*/
|
||||
#define DEFAULT_HEARTBEAT_STORAGE "hb.dat"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* HEARTBEAT_H */
|
||||
/** @} */
|
||||
1451
database/apache/include/http_config.h
Normal file
1451
database/apache/include/http_config.h
Normal file
File diff suppressed because it is too large
Load Diff
183
database/apache/include/http_connection.h
Normal file
183
database/apache/include/http_connection.h
Normal file
@@ -0,0 +1,183 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file http_connection.h
|
||||
* @brief Apache connection library
|
||||
*
|
||||
* @defgroup APACHE_CORE_CONNECTION Connection Library
|
||||
* @ingroup APACHE_CORE
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef APACHE_HTTP_CONNECTION_H
|
||||
#define APACHE_HTTP_CONNECTION_H
|
||||
|
||||
#include "apr_network_io.h"
|
||||
#include "apr_buckets.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* This is the protocol module driver. This calls all of the
|
||||
* pre-connection and connection hooks for all protocol modules.
|
||||
* @param c The connection on which the request is read
|
||||
* @param csd The mechanism on which this connection is to be read.
|
||||
* Most times this will be a socket, but it is up to the module
|
||||
* that accepts the request to determine the exact type.
|
||||
*/
|
||||
AP_CORE_DECLARE(void) ap_process_connection(conn_rec *c, void *csd);
|
||||
|
||||
/**
|
||||
* Shutdown the connection for writing.
|
||||
* @param c The connection to shutdown
|
||||
* @param flush Whether or not to flush pending data before
|
||||
* @return APR_SUCCESS or the underlying error
|
||||
*/
|
||||
AP_CORE_DECLARE(apr_status_t) ap_shutdown_conn(conn_rec *c, int flush);
|
||||
|
||||
/**
|
||||
* Flushes all remain data in the client send buffer
|
||||
* @param c The connection to flush
|
||||
* @remark calls ap_shutdown_conn(c, 1)
|
||||
*/
|
||||
AP_CORE_DECLARE(void) ap_flush_conn(conn_rec *c);
|
||||
|
||||
/**
|
||||
* This function is responsible for the following cases:
|
||||
* <pre>
|
||||
* we now proceed to read from the client until we get EOF, or until
|
||||
* MAX_SECS_TO_LINGER has passed. The reasons for doing this are
|
||||
* documented in a draft:
|
||||
*
|
||||
* http://tools.ietf.org/html/draft-ietf-http-connection-00.txt
|
||||
*
|
||||
* in a nutshell -- if we don't make this effort we risk causing
|
||||
* TCP RST packets to be sent which can tear down a connection before
|
||||
* all the response data has been sent to the client.
|
||||
* </pre>
|
||||
* @param c The connection we are closing
|
||||
*/
|
||||
AP_DECLARE(void) ap_lingering_close(conn_rec *c);
|
||||
|
||||
AP_DECLARE(int) ap_prep_lingering_close(conn_rec *c);
|
||||
|
||||
AP_DECLARE(int) ap_start_lingering_close(conn_rec *c);
|
||||
|
||||
/* Hooks */
|
||||
/**
|
||||
* create_connection is a RUN_FIRST hook which allows modules to create
|
||||
* connections. In general, you should not install filters with the
|
||||
* create_connection hook. If you require vhost configuration information
|
||||
* to make filter installation decisions, you must use the pre_connection
|
||||
* or install_network_transport hook. This hook should close the connection
|
||||
* if it encounters a fatal error condition.
|
||||
*
|
||||
* @param p The pool from which to allocate the connection record
|
||||
* @param server The server record to create the connection too.
|
||||
* @param csd The socket that has been accepted
|
||||
* @param conn_id A unique identifier for this connection. The ID only
|
||||
* needs to be unique at that time, not forever.
|
||||
* @param sbh A handle to scoreboard information for this connection.
|
||||
* @param alloc The bucket allocator to use for all bucket/brigade creations
|
||||
* @return An allocated connection record or NULL.
|
||||
*/
|
||||
AP_DECLARE_HOOK(conn_rec *, create_connection,
|
||||
(apr_pool_t *p, server_rec *server, apr_socket_t *csd,
|
||||
long conn_id, void *sbh, apr_bucket_alloc_t *alloc))
|
||||
|
||||
/**
|
||||
* This hook gives protocol modules an opportunity to set everything up
|
||||
* before calling the protocol handler. All pre-connection hooks are
|
||||
* run until one returns something other than ok or decline
|
||||
* @param c The connection on which the request has been received.
|
||||
* @param csd The mechanism on which this connection is to be read.
|
||||
* Most times this will be a socket, but it is up to the module
|
||||
* that accepts the request to determine the exact type.
|
||||
* @return OK or DECLINED
|
||||
*/
|
||||
AP_DECLARE_HOOK(int,pre_connection,(conn_rec *c, void *csd))
|
||||
|
||||
/**
|
||||
* This hook implements different protocols. After a connection has been
|
||||
* established, the protocol module must read and serve the request. This
|
||||
* function does that for each protocol module. The first protocol module
|
||||
* to handle the request is the last module run.
|
||||
* @param c The connection on which the request has been received.
|
||||
* @return OK or DECLINED
|
||||
*/
|
||||
AP_DECLARE_HOOK(int,process_connection,(conn_rec *c))
|
||||
|
||||
/**
|
||||
* This hook implements different protocols. Before a connection is closed,
|
||||
* protocols might have to perform some housekeeping actions, such as
|
||||
* sending one last goodbye packet. The connection is, unless some other
|
||||
* error already happened before, still open and operational.
|
||||
* All pre-close-connection hooks are run until one returns something
|
||||
* other than ok or decline
|
||||
* @param c The connection on which the request has been received.
|
||||
* @return OK or DECLINED
|
||||
*/
|
||||
AP_DECLARE_HOOK(int,pre_close_connection,(conn_rec *c))
|
||||
|
||||
/**
|
||||
* This is a wrapper around ap_run_pre_connection. In case that
|
||||
* ap_run_pre_connection returns an error it marks the connection as
|
||||
* aborted and ensures that the basic connection setup normally done
|
||||
* by the core module is done in case it was not done so far.
|
||||
* @param c The connection on which the request has been received.
|
||||
* Same as for the pre_connection hook.
|
||||
* @param csd The mechanism on which this connection is to be read.
|
||||
* Most times this will be a socket, but it is up to the module
|
||||
* that accepts the request to determine the exact type.
|
||||
* Same as for the pre_connection hook.
|
||||
* @return The result of ap_run_pre_connection
|
||||
*/
|
||||
AP_DECLARE(int) ap_pre_connection(conn_rec *c, void *csd);
|
||||
|
||||
/** End Of Connection (EOC) bucket */
|
||||
AP_DECLARE_DATA extern const apr_bucket_type_t ap_bucket_type_eoc;
|
||||
|
||||
/**
|
||||
* Determine if a bucket is an End Of Connection (EOC) bucket
|
||||
* @param e The bucket to inspect
|
||||
* @return true or false
|
||||
*/
|
||||
#define AP_BUCKET_IS_EOC(e) (e->type == &ap_bucket_type_eoc)
|
||||
|
||||
/**
|
||||
* Make the bucket passed in an End Of Connection (EOC) bucket
|
||||
* @param b The bucket to make into an EOC bucket
|
||||
* @return The new bucket, or NULL if allocation failed
|
||||
*/
|
||||
AP_DECLARE(apr_bucket *) ap_bucket_eoc_make(apr_bucket *b);
|
||||
|
||||
/**
|
||||
* Create a bucket referring to an End Of Connection (EOC). This indicates
|
||||
* that the connection will be closed.
|
||||
* @param list The freelist from which this bucket should be allocated
|
||||
* @return The new bucket, or NULL if allocation failed
|
||||
*/
|
||||
AP_DECLARE(apr_bucket *) ap_bucket_eoc_create(apr_bucket_alloc_t *list);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !APACHE_HTTP_CONNECTION_H */
|
||||
/** @} */
|
||||
1094
database/apache/include/http_core.h
Normal file
1094
database/apache/include/http_core.h
Normal file
File diff suppressed because it is too large
Load Diff
836
database/apache/include/http_log.h
Normal file
836
database/apache/include/http_log.h
Normal file
@@ -0,0 +1,836 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file http_log.h
|
||||
* @brief Apache Logging library
|
||||
*
|
||||
* @defgroup APACHE_CORE_LOG Logging library
|
||||
* @ingroup APACHE_CORE
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef APACHE_HTTP_LOG_H
|
||||
#define APACHE_HTTP_LOG_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "apr_thread_proc.h"
|
||||
#include "http_config.h"
|
||||
|
||||
#ifdef HAVE_SYSLOG
|
||||
#include <syslog.h>
|
||||
|
||||
#ifndef LOG_PRIMASK
|
||||
#define LOG_PRIMASK 7
|
||||
#endif
|
||||
|
||||
#define APLOG_EMERG LOG_EMERG /* system is unusable */
|
||||
#define APLOG_ALERT LOG_ALERT /* action must be taken immediately */
|
||||
#define APLOG_CRIT LOG_CRIT /* critical conditions */
|
||||
#define APLOG_ERR LOG_ERR /* error conditions */
|
||||
#define APLOG_WARNING LOG_WARNING /* warning conditions */
|
||||
#define APLOG_NOTICE LOG_NOTICE /* normal but significant condition */
|
||||
#define APLOG_INFO LOG_INFO /* informational */
|
||||
#define APLOG_DEBUG LOG_DEBUG /* debug-level messages */
|
||||
#define APLOG_TRACE1 (LOG_DEBUG + 1) /* trace-level 1 messages */
|
||||
#define APLOG_TRACE2 (LOG_DEBUG + 2) /* trace-level 2 messages */
|
||||
#define APLOG_TRACE3 (LOG_DEBUG + 3) /* trace-level 3 messages */
|
||||
#define APLOG_TRACE4 (LOG_DEBUG + 4) /* trace-level 4 messages */
|
||||
#define APLOG_TRACE5 (LOG_DEBUG + 5) /* trace-level 5 messages */
|
||||
#define APLOG_TRACE6 (LOG_DEBUG + 6) /* trace-level 6 messages */
|
||||
#define APLOG_TRACE7 (LOG_DEBUG + 7) /* trace-level 7 messages */
|
||||
#define APLOG_TRACE8 (LOG_DEBUG + 8) /* trace-level 8 messages */
|
||||
|
||||
#define APLOG_LEVELMASK 15 /* mask off the level value */
|
||||
|
||||
#else
|
||||
|
||||
#define APLOG_EMERG 0 /* system is unusable */
|
||||
#define APLOG_ALERT 1 /* action must be taken immediately */
|
||||
#define APLOG_CRIT 2 /* critical conditions */
|
||||
#define APLOG_ERR 3 /* error conditions */
|
||||
#define APLOG_WARNING 4 /* warning conditions */
|
||||
#define APLOG_NOTICE 5 /* normal but significant condition */
|
||||
#define APLOG_INFO 6 /* informational */
|
||||
#define APLOG_DEBUG 7 /* debug-level messages */
|
||||
#define APLOG_TRACE1 8 /* trace-level 1 messages */
|
||||
#define APLOG_TRACE2 9 /* trace-level 2 messages */
|
||||
#define APLOG_TRACE3 10 /* trace-level 3 messages */
|
||||
#define APLOG_TRACE4 11 /* trace-level 4 messages */
|
||||
#define APLOG_TRACE5 12 /* trace-level 5 messages */
|
||||
#define APLOG_TRACE6 13 /* trace-level 6 messages */
|
||||
#define APLOG_TRACE7 14 /* trace-level 7 messages */
|
||||
#define APLOG_TRACE8 15 /* trace-level 8 messages */
|
||||
|
||||
#define APLOG_LEVELMASK 15 /* mask off the level value */
|
||||
|
||||
#endif
|
||||
|
||||
/* APLOG_NOERRNO is ignored and should not be used. It will be
|
||||
* removed in a future release of Apache.
|
||||
*/
|
||||
#define APLOG_NOERRNO (APLOG_LEVELMASK + 1)
|
||||
|
||||
/** Use APLOG_TOCLIENT on ap_log_rerror() to give content
|
||||
* handlers the option of including the error text in the
|
||||
* ErrorDocument sent back to the client. Setting APLOG_TOCLIENT
|
||||
* will cause the error text to be saved in the request_rec->notes
|
||||
* table, keyed to the string "error-notes", if and only if:
|
||||
* - the severity level of the message is APLOG_WARNING or greater
|
||||
* - there are no other "error-notes" set in request_rec->notes
|
||||
* Once error-notes is set, it is up to the content handler to
|
||||
* determine whether this text should be sent back to the client.
|
||||
* Note: Client generated text streams sent back to the client MUST
|
||||
* be escaped to prevent CSS attacks.
|
||||
*/
|
||||
#define APLOG_TOCLIENT ((APLOG_LEVELMASK + 1) * 2)
|
||||
|
||||
/* normal but significant condition on startup, usually printed to stderr */
|
||||
#define APLOG_STARTUP ((APLOG_LEVELMASK + 1) * 4)
|
||||
|
||||
#ifndef DEFAULT_LOGLEVEL
|
||||
#define DEFAULT_LOGLEVEL APLOG_WARNING
|
||||
#endif
|
||||
|
||||
/**
|
||||
* APLOGNO() should be used at the start of the format string passed
|
||||
* to ap_log_error() and friends. The argument must be a 5 digit decimal
|
||||
* number. It creates a tag of the form "AH02182: "
|
||||
* See docs/log-message-tags/README for details.
|
||||
*/
|
||||
#define APLOGNO(n) "AH" #n ": "
|
||||
|
||||
/**
|
||||
* APLOG_NO_MODULE may be passed as module_index to ap_log_error() and related
|
||||
* functions if the module causing the log message is not known. Normally this
|
||||
* should not be used directly. Use ::APLOG_MARK or ::APLOG_MODULE_INDEX
|
||||
* instead.
|
||||
*
|
||||
* @see APLOG_MARK
|
||||
* @see APLOG_MODULE_INDEX
|
||||
* @see ap_log_error
|
||||
*/
|
||||
#define APLOG_NO_MODULE -1
|
||||
|
||||
#ifdef __cplusplus
|
||||
/**
|
||||
* C++ modules must invoke ::APLOG_USE_MODULE or ::AP_DECLARE_MODULE in
|
||||
* every file which uses ap_log_* before the first use of ::APLOG_MARK
|
||||
* or ::APLOG_MODULE_INDEX.
|
||||
* (C modules *should* do that as well, to enable module-specific log
|
||||
* levels. C modules need not obey the ordering, though).
|
||||
*/
|
||||
#else /* __cplusplus */
|
||||
/**
|
||||
* Constant to store module_index for the current file.
|
||||
* Objects with static storage duration are set to NULL if not
|
||||
* initialized explicitly. This means that if aplog_module_index
|
||||
* is not initialized using the ::APLOG_USE_MODULE or the
|
||||
* ::AP_DECLARE_MODULE macro, we can safely fall back to
|
||||
* use ::APLOG_NO_MODULE. This variable will usually be optimized away.
|
||||
*/
|
||||
static int * const aplog_module_index;
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* APLOG_MODULE_INDEX contains the module_index of the current module if
|
||||
* it has been set via the ::APLOG_USE_MODULE or ::AP_DECLARE_MODULE macro.
|
||||
* Otherwise it contains ::APLOG_NO_MODULE (for example in unmodified httpd
|
||||
* 2.2 modules).
|
||||
*
|
||||
* If ::APLOG_MARK is used in ap_log_error() and related functions,
|
||||
* ::APLOG_MODULE_INDEX will be passed as module_index. In cases where
|
||||
* ::APLOG_MARK cannot be used, ::APLOG_MODULE_INDEX should normally be passed
|
||||
* as module_index.
|
||||
*
|
||||
* @see APLOG_MARK
|
||||
* @see ap_log_error
|
||||
*/
|
||||
#ifdef __cplusplus
|
||||
#define APLOG_MODULE_INDEX (*aplog_module_index)
|
||||
#else /* __cplusplus */
|
||||
#define APLOG_MODULE_INDEX \
|
||||
(aplog_module_index ? *aplog_module_index : APLOG_NO_MODULE)
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* APLOG_MAX_LOGLEVEL can be defined to remove logging above some
|
||||
* specified level at compile time.
|
||||
*
|
||||
* This requires a C99 compiler.
|
||||
*/
|
||||
#ifdef DOXYGEN
|
||||
#define APLOG_MAX_LOGLEVEL
|
||||
#endif
|
||||
#ifndef APLOG_MAX_LOGLEVEL
|
||||
#define APLOG_MODULE_IS_LEVEL(s,module_index,level) \
|
||||
( (((level)&APLOG_LEVELMASK) <= APLOG_NOTICE) || \
|
||||
(s == NULL) || \
|
||||
(ap_get_server_module_loglevel(s, module_index) \
|
||||
>= ((level)&APLOG_LEVELMASK) ) )
|
||||
#define APLOG_C_MODULE_IS_LEVEL(c,module_index,level) \
|
||||
( (((level)&APLOG_LEVELMASK) <= APLOG_NOTICE) || \
|
||||
(ap_get_conn_module_loglevel(c, module_index) \
|
||||
>= ((level)&APLOG_LEVELMASK) ) )
|
||||
#define APLOG_CS_MODULE_IS_LEVEL(c,s,module_index,level) \
|
||||
( (((level)&APLOG_LEVELMASK) <= APLOG_NOTICE) || \
|
||||
(ap_get_conn_server_module_loglevel(c, s, module_index) \
|
||||
>= ((level)&APLOG_LEVELMASK) ) )
|
||||
#define APLOG_R_MODULE_IS_LEVEL(r,module_index,level) \
|
||||
( (((level)&APLOG_LEVELMASK) <= APLOG_NOTICE) || \
|
||||
(ap_get_request_module_loglevel(r, module_index) \
|
||||
>= ((level)&APLOG_LEVELMASK) ) )
|
||||
#else
|
||||
#define APLOG_MODULE_IS_LEVEL(s,module_index,level) \
|
||||
( (((level)&APLOG_LEVELMASK) <= APLOG_MAX_LOGLEVEL) && \
|
||||
( (((level)&APLOG_LEVELMASK) <= APLOG_NOTICE) || \
|
||||
(s == NULL) || \
|
||||
(ap_get_server_module_loglevel(s, module_index) \
|
||||
>= ((level)&APLOG_LEVELMASK) ) ) )
|
||||
#define APLOG_CS_MODULE_IS_LEVEL(c,s,module_index,level) \
|
||||
( (((level)&APLOG_LEVELMASK) <= APLOG_MAX_LOGLEVEL) && \
|
||||
( (((level)&APLOG_LEVELMASK) <= APLOG_NOTICE) || \
|
||||
(ap_get_conn_server_module_loglevel(c, s, module_index) \
|
||||
>= ((level)&APLOG_LEVELMASK) ) ) )
|
||||
#define APLOG_C_MODULE_IS_LEVEL(c,module_index,level) \
|
||||
( (((level)&APLOG_LEVELMASK) <= APLOG_MAX_LOGLEVEL) && \
|
||||
( (((level)&APLOG_LEVELMASK) <= APLOG_NOTICE) || \
|
||||
(ap_get_conn_module_loglevel(c, module_index) \
|
||||
>= ((level)&APLOG_LEVELMASK) ) ) )
|
||||
#define APLOG_R_MODULE_IS_LEVEL(r,module_index,level) \
|
||||
( (((level)&APLOG_LEVELMASK) <= APLOG_MAX_LOGLEVEL) && \
|
||||
( (((level)&APLOG_LEVELMASK) <= APLOG_NOTICE) || \
|
||||
(ap_get_request_module_loglevel(r, module_index) \
|
||||
>= ((level)&APLOG_LEVELMASK) ) ) )
|
||||
#endif
|
||||
|
||||
#define APLOG_IS_LEVEL(s,level) \
|
||||
APLOG_MODULE_IS_LEVEL(s,APLOG_MODULE_INDEX,level)
|
||||
#define APLOG_C_IS_LEVEL(c,level) \
|
||||
APLOG_C_MODULE_IS_LEVEL(c,APLOG_MODULE_INDEX,level)
|
||||
#define APLOG_CS_IS_LEVEL(c,s,level) \
|
||||
APLOG_CS_MODULE_IS_LEVEL(c,s,APLOG_MODULE_INDEX,level)
|
||||
#define APLOG_R_IS_LEVEL(r,level) \
|
||||
APLOG_R_MODULE_IS_LEVEL(r,APLOG_MODULE_INDEX,level)
|
||||
|
||||
|
||||
#define APLOGinfo(s) APLOG_IS_LEVEL(s,APLOG_INFO)
|
||||
#define APLOGdebug(s) APLOG_IS_LEVEL(s,APLOG_DEBUG)
|
||||
#define APLOGtrace1(s) APLOG_IS_LEVEL(s,APLOG_TRACE1)
|
||||
#define APLOGtrace2(s) APLOG_IS_LEVEL(s,APLOG_TRACE2)
|
||||
#define APLOGtrace3(s) APLOG_IS_LEVEL(s,APLOG_TRACE3)
|
||||
#define APLOGtrace4(s) APLOG_IS_LEVEL(s,APLOG_TRACE4)
|
||||
#define APLOGtrace5(s) APLOG_IS_LEVEL(s,APLOG_TRACE5)
|
||||
#define APLOGtrace6(s) APLOG_IS_LEVEL(s,APLOG_TRACE6)
|
||||
#define APLOGtrace7(s) APLOG_IS_LEVEL(s,APLOG_TRACE7)
|
||||
#define APLOGtrace8(s) APLOG_IS_LEVEL(s,APLOG_TRACE8)
|
||||
|
||||
#define APLOGrinfo(r) APLOG_R_IS_LEVEL(r,APLOG_INFO)
|
||||
#define APLOGrdebug(r) APLOG_R_IS_LEVEL(r,APLOG_DEBUG)
|
||||
#define APLOGrtrace1(r) APLOG_R_IS_LEVEL(r,APLOG_TRACE1)
|
||||
#define APLOGrtrace2(r) APLOG_R_IS_LEVEL(r,APLOG_TRACE2)
|
||||
#define APLOGrtrace3(r) APLOG_R_IS_LEVEL(r,APLOG_TRACE3)
|
||||
#define APLOGrtrace4(r) APLOG_R_IS_LEVEL(r,APLOG_TRACE4)
|
||||
#define APLOGrtrace5(r) APLOG_R_IS_LEVEL(r,APLOG_TRACE5)
|
||||
#define APLOGrtrace6(r) APLOG_R_IS_LEVEL(r,APLOG_TRACE6)
|
||||
#define APLOGrtrace7(r) APLOG_R_IS_LEVEL(r,APLOG_TRACE7)
|
||||
#define APLOGrtrace8(r) APLOG_R_IS_LEVEL(r,APLOG_TRACE8)
|
||||
|
||||
#define APLOGcinfo(c) APLOG_C_IS_LEVEL(c,APLOG_INFO)
|
||||
#define APLOGcdebug(c) APLOG_C_IS_LEVEL(c,APLOG_DEBUG)
|
||||
#define APLOGctrace1(c) APLOG_C_IS_LEVEL(c,APLOG_TRACE1)
|
||||
#define APLOGctrace2(c) APLOG_C_IS_LEVEL(c,APLOG_TRACE2)
|
||||
#define APLOGctrace3(c) APLOG_C_IS_LEVEL(c,APLOG_TRACE3)
|
||||
#define APLOGctrace4(c) APLOG_C_IS_LEVEL(c,APLOG_TRACE4)
|
||||
#define APLOGctrace5(c) APLOG_C_IS_LEVEL(c,APLOG_TRACE5)
|
||||
#define APLOGctrace6(c) APLOG_C_IS_LEVEL(c,APLOG_TRACE6)
|
||||
#define APLOGctrace7(c) APLOG_C_IS_LEVEL(c,APLOG_TRACE7)
|
||||
#define APLOGctrace8(c) APLOG_C_IS_LEVEL(c,APLOG_TRACE8)
|
||||
|
||||
AP_DECLARE_DATA extern int ap_default_loglevel;
|
||||
|
||||
/**
|
||||
* APLOG_MARK is a convenience macro for use as the first three parameters in
|
||||
* ap_log_error() and related functions, i.e. file, line, and module_index.
|
||||
*
|
||||
* The module_index parameter was introduced in version 2.3.6. Before that
|
||||
* version, APLOG_MARK only replaced the file and line parameters.
|
||||
* This means that APLOG_MARK can be used with ap_log_*error in all versions
|
||||
* of Apache httpd.
|
||||
*
|
||||
* @see APLOG_MODULE_INDEX
|
||||
* @see ap_log_error
|
||||
* @see ap_log_cerror
|
||||
* @see ap_log_rerror
|
||||
* @see ap_log_cserror
|
||||
*/
|
||||
#define APLOG_MARK __FILE__,__LINE__,APLOG_MODULE_INDEX
|
||||
|
||||
/**
|
||||
* Set up for logging to stderr.
|
||||
* @param p The pool to allocate out of
|
||||
*/
|
||||
AP_DECLARE(void) ap_open_stderr_log(apr_pool_t *p);
|
||||
|
||||
/**
|
||||
* Replace logging to stderr with logging to the given file.
|
||||
* @param p The pool to allocate out of
|
||||
* @param file Name of the file to log stderr output
|
||||
*/
|
||||
AP_DECLARE(apr_status_t) ap_replace_stderr_log(apr_pool_t *p,
|
||||
const char *file);
|
||||
|
||||
/**
|
||||
* Open the error log and replace stderr with it.
|
||||
* @param pconf Not used
|
||||
* @param plog The pool to allocate the logs from
|
||||
* @param ptemp Pool used for temporary allocations
|
||||
* @param s_main The main server
|
||||
* @note ap_open_logs isn't expected to be used by modules, it is
|
||||
* an internal core function
|
||||
*/
|
||||
int ap_open_logs(apr_pool_t *pconf, apr_pool_t *plog,
|
||||
apr_pool_t *ptemp, server_rec *s_main);
|
||||
|
||||
/**
|
||||
* Perform special processing for piped loggers in MPM child
|
||||
* processes.
|
||||
* @param p Not used
|
||||
* @param s Not used
|
||||
* @note ap_logs_child_init is not for use by modules; it is an
|
||||
* internal core function
|
||||
*/
|
||||
void ap_logs_child_init(apr_pool_t *p, server_rec *s);
|
||||
|
||||
/*
|
||||
* The primary logging functions, ap_log_error, ap_log_rerror, ap_log_cerror,
|
||||
* and ap_log_perror use a printf style format string to build the log message.
|
||||
* It is VERY IMPORTANT that you not include any raw data from the network,
|
||||
* such as the request-URI or request header fields, within the format
|
||||
* string. Doing so makes the server vulnerable to a denial-of-service
|
||||
* attack and other messy behavior. Instead, use a simple format string
|
||||
* like "%s", followed by the string containing the untrusted data.
|
||||
*/
|
||||
|
||||
/**
|
||||
* ap_log_error() - log messages which are not related to a particular
|
||||
* request or connection. This uses a printf-like format to log messages
|
||||
* to the error_log.
|
||||
* @param file The file in which this function is called
|
||||
* @param line The line number on which this function is called
|
||||
* @param module_index The module_index of the module generating this message
|
||||
* @param level The level of this error message
|
||||
* @param status The status code from the previous command
|
||||
* @param s The server on which we are logging
|
||||
* @param fmt The format string
|
||||
* @param ... The arguments to use to fill out fmt.
|
||||
* @note ap_log_error is implemented as a macro
|
||||
* @note Use APLOG_MARK to fill out file and line
|
||||
* @note If a request_rec is available, use that with ap_log_rerror()
|
||||
* in preference to calling this function. Otherwise, if a conn_rec is
|
||||
* available, use that with ap_log_cerror() in preference to calling
|
||||
* this function.
|
||||
* @warning It is VERY IMPORTANT that you not include any raw data from
|
||||
* the network, such as the request-URI or request header fields, within
|
||||
* the format string. Doing so makes the server vulnerable to a
|
||||
* denial-of-service attack and other messy behavior. Instead, use a
|
||||
* simple format string like "%s", followed by the string containing the
|
||||
* untrusted data.
|
||||
*/
|
||||
#ifdef DOXYGEN
|
||||
AP_DECLARE(void) ap_log_error(const char *file, int line, int module_index,
|
||||
int level, apr_status_t status,
|
||||
const server_rec *s, const char *fmt, ...);
|
||||
#else
|
||||
#ifdef AP_HAVE_C99
|
||||
/* need additional step to expand APLOG_MARK first */
|
||||
#define ap_log_error(...) ap_log_error__(__VA_ARGS__)
|
||||
/* need server_rec *sr = ... for the case if s is verbatim NULL */
|
||||
#define ap_log_error__(file, line, mi, level, status, s, ...) \
|
||||
do { const server_rec *sr__ = s; if (APLOG_MODULE_IS_LEVEL(sr__, mi, level)) \
|
||||
ap_log_error_(file, line, mi, level, status, sr__, __VA_ARGS__); \
|
||||
} while(0)
|
||||
#else
|
||||
#define ap_log_error ap_log_error_
|
||||
#endif
|
||||
AP_DECLARE(void) ap_log_error_(const char *file, int line, int module_index,
|
||||
int level, apr_status_t status,
|
||||
const server_rec *s, const char *fmt, ...)
|
||||
__attribute__((format(printf,7,8)));
|
||||
#endif
|
||||
|
||||
/**
|
||||
* ap_log_perror() - log messages which are not related to a particular
|
||||
* request, connection, or virtual server. This uses a printf-like
|
||||
* format to log messages to the error_log.
|
||||
* @param file The file in which this function is called
|
||||
* @param line The line number on which this function is called
|
||||
* @param module_index ignored dummy value for use by APLOG_MARK
|
||||
* @param level The level of this error message
|
||||
* @param status The status code from the previous command
|
||||
* @param p The pool which we are logging for
|
||||
* @param fmt The format string
|
||||
* @param ... The arguments to use to fill out fmt.
|
||||
* @note ap_log_perror is implemented as a macro
|
||||
* @note Use APLOG_MARK to fill out file, line, and module_index
|
||||
* @warning It is VERY IMPORTANT that you not include any raw data from
|
||||
* the network, such as the request-URI or request header fields, within
|
||||
* the format string. Doing so makes the server vulnerable to a
|
||||
* denial-of-service attack and other messy behavior. Instead, use a
|
||||
* simple format string like "%s", followed by the string containing the
|
||||
* untrusted data.
|
||||
*/
|
||||
#ifdef DOXYGEN
|
||||
AP_DECLARE(void) ap_log_perror(const char *file, int line, int module_index,
|
||||
int level, apr_status_t status, apr_pool_t *p,
|
||||
const char *fmt, ...);
|
||||
#else
|
||||
#if defined(AP_HAVE_C99) && defined(APLOG_MAX_LOGLEVEL)
|
||||
/* need additional step to expand APLOG_MARK first */
|
||||
#define ap_log_perror(...) ap_log_perror__(__VA_ARGS__)
|
||||
#define ap_log_perror__(file, line, mi, level, status, p, ...) \
|
||||
do { if ((level) <= APLOG_MAX_LOGLEVEL ) \
|
||||
ap_log_perror_(file, line, mi, level, status, p, \
|
||||
__VA_ARGS__); } while(0)
|
||||
#else
|
||||
#define ap_log_perror ap_log_perror_
|
||||
#endif
|
||||
AP_DECLARE(void) ap_log_perror_(const char *file, int line, int module_index,
|
||||
int level, apr_status_t status, apr_pool_t *p,
|
||||
const char *fmt, ...)
|
||||
__attribute__((format(printf,7,8)));
|
||||
#endif
|
||||
|
||||
/**
|
||||
* ap_log_rerror() - log messages which are related to a particular
|
||||
* request. This uses a printf-like format to log messages to the
|
||||
* error_log.
|
||||
* @param file The file in which this function is called
|
||||
* @param line The line number on which this function is called
|
||||
* @param module_index The module_index of the module generating this message
|
||||
* @param level The level of this error message
|
||||
* @param status The status code from the previous command
|
||||
* @param r The request which we are logging for
|
||||
* @param fmt The format string
|
||||
* @param ... The arguments to use to fill out fmt.
|
||||
* @note ap_log_rerror is implemented as a macro
|
||||
* @note Use APLOG_MARK to fill out file, line, and module_index
|
||||
* @warning It is VERY IMPORTANT that you not include any raw data from
|
||||
* the network, such as the request-URI or request header fields, within
|
||||
* the format string. Doing so makes the server vulnerable to a
|
||||
* denial-of-service attack and other messy behavior. Instead, use a
|
||||
* simple format string like "%s", followed by the string containing the
|
||||
* untrusted data.
|
||||
*/
|
||||
#ifdef DOXYGEN
|
||||
AP_DECLARE(void) ap_log_rerror(const char *file, int line, int module_index,
|
||||
int level, apr_status_t status,
|
||||
const request_rec *r, const char *fmt, ...);
|
||||
#else
|
||||
#ifdef AP_HAVE_C99
|
||||
/* need additional step to expand APLOG_MARK first */
|
||||
#define ap_log_rerror(...) ap_log_rerror__(__VA_ARGS__)
|
||||
#define ap_log_rerror__(file, line, mi, level, status, r, ...) \
|
||||
do { if (APLOG_R_MODULE_IS_LEVEL(r, mi, level)) \
|
||||
ap_log_rerror_(file, line, mi, level, status, r, __VA_ARGS__); \
|
||||
} while(0)
|
||||
#else
|
||||
#define ap_log_rerror ap_log_rerror_
|
||||
#endif
|
||||
AP_DECLARE(void) ap_log_rerror_(const char *file, int line, int module_index,
|
||||
int level, apr_status_t status,
|
||||
const request_rec *r, const char *fmt, ...)
|
||||
__attribute__((format(printf,7,8)));
|
||||
#endif
|
||||
|
||||
/**
|
||||
* ap_log_cerror() - log messages which are related to a particular
|
||||
* connection. This uses a printf-like format to log messages to the
|
||||
* error_log.
|
||||
* @param file The file in which this function is called
|
||||
* @param line The line number on which this function is called
|
||||
* @param level The level of this error message
|
||||
* @param module_index The module_index of the module generating this message
|
||||
* @param status The status code from the previous command
|
||||
* @param c The connection which we are logging for
|
||||
* @param fmt The format string
|
||||
* @param ... The arguments to use to fill out fmt.
|
||||
* @note ap_log_cerror is implemented as a macro
|
||||
* @note Use APLOG_MARK to fill out file, line, and module_index
|
||||
* @note If a request_rec is available, use that with ap_log_rerror()
|
||||
* in preference to calling this function.
|
||||
* @warning It is VERY IMPORTANT that you not include any raw data from
|
||||
* the network, such as the request-URI or request header fields, within
|
||||
* the format string. Doing so makes the server vulnerable to a
|
||||
* denial-of-service attack and other messy behavior. Instead, use a
|
||||
* simple format string like "%s", followed by the string containing the
|
||||
* untrusted data.
|
||||
*/
|
||||
#ifdef DOXYGEN
|
||||
AP_DECLARE(void) ap_log_cerror(const char *file, int line, int module_index,
|
||||
int level, apr_status_t status,
|
||||
const conn_rec *c, const char *fmt, ...);
|
||||
#else
|
||||
#ifdef AP_HAVE_C99
|
||||
/* need additional step to expand APLOG_MARK first */
|
||||
#define ap_log_cerror(...) ap_log_cerror__(__VA_ARGS__)
|
||||
#define ap_log_cerror__(file, line, mi, level, status, c, ...) \
|
||||
do { if (APLOG_C_MODULE_IS_LEVEL(c, mi, level)) \
|
||||
ap_log_cerror_(file, line, mi, level, status, c, __VA_ARGS__); \
|
||||
} while(0)
|
||||
#else
|
||||
#define ap_log_cerror ap_log_cerror_
|
||||
#endif
|
||||
AP_DECLARE(void) ap_log_cerror_(const char *file, int line, int module_index,
|
||||
int level, apr_status_t status,
|
||||
const conn_rec *c, const char *fmt, ...)
|
||||
__attribute__((format(printf,7,8)));
|
||||
#endif
|
||||
|
||||
/**
|
||||
* ap_log_cserror() - log messages which are related to a particular
|
||||
* connection and to a vhost other than c->base_server. This uses a
|
||||
* printf-like format to log messages to the error_log.
|
||||
* @param file The file in which this function is called
|
||||
* @param line The line number on which this function is called
|
||||
* @param level The level of this error message
|
||||
* @param module_index The module_index of the module generating this message
|
||||
* @param status The status code from the previous command
|
||||
* @param c The connection which we are logging for
|
||||
* @param s The server which we are logging for
|
||||
* @param fmt The format string
|
||||
* @param ... The arguments to use to fill out fmt.
|
||||
* @note ap_log_cserror is implemented as a macro
|
||||
* @note Use APLOG_MARK to fill out file, line, and module_index
|
||||
* @note If a request_rec is available, use that with ap_log_rerror()
|
||||
* in preference to calling this function. This function is mainly useful for
|
||||
* modules like mod_ssl to use before the request_rec is created.
|
||||
* @warning It is VERY IMPORTANT that you not include any raw data from
|
||||
* the network, such as the request-URI or request header fields, within
|
||||
* the format string. Doing so makes the server vulnerable to a
|
||||
* denial-of-service attack and other messy behavior. Instead, use a
|
||||
* simple format string like "%s", followed by the string containing the
|
||||
* untrusted data.
|
||||
*/
|
||||
#ifdef DOXYGEN
|
||||
AP_DECLARE(void) ap_log_cserror(const char *file, int line, int module_index,
|
||||
int level, apr_status_t status,
|
||||
const conn_rec *c, const server_rec *s,
|
||||
const char *fmt, ...);
|
||||
#else
|
||||
#ifdef AP_HAVE_C99
|
||||
/* need additional step to expand APLOG_MARK first */
|
||||
#define ap_log_cserror(...) ap_log_cserror__(__VA_ARGS__)
|
||||
#define ap_log_cserror__(file, line, mi, level, status, c, s, ...) \
|
||||
do { if (APLOG_CS_MODULE_IS_LEVEL(c, s, mi, level)) \
|
||||
ap_log_cserror_(file, line, mi, level, status, c, s, \
|
||||
__VA_ARGS__); \
|
||||
} while(0)
|
||||
#else
|
||||
#define ap_log_cserror ap_log_cserror_
|
||||
#endif
|
||||
AP_DECLARE(void) ap_log_cserror_(const char *file, int line, int module_index,
|
||||
int level, apr_status_t status,
|
||||
const conn_rec *c, const server_rec *s,
|
||||
const char *fmt, ...)
|
||||
__attribute__((format(printf,8,9)));
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The buffer logging functions, ap_log_data, ap_log_rdata, ap_log_cdata,
|
||||
* and ap_log_csdata log a buffer in printable and hex format. The exact
|
||||
* format is controlled by processing flags, described next.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Processing flags for ap_log_data() et al
|
||||
*
|
||||
* AP_LOG_DATA_DEFAULT - default formatting, with printable chars and hex
|
||||
* AP_LOG_DATA_SHOW_OFFSET - prefix each line with hex offset from the start
|
||||
* of the buffer
|
||||
*/
|
||||
#define AP_LOG_DATA_DEFAULT 0
|
||||
#define AP_LOG_DATA_SHOW_OFFSET 1
|
||||
|
||||
/**
|
||||
* ap_log_data() - log buffers which are not related to a particular request
|
||||
* or connection.
|
||||
* @param file The file in which this function is called
|
||||
* @param line The line number on which this function is called
|
||||
* @param module_index The module_index of the module logging this buffer
|
||||
* @param level The log level
|
||||
* @param s The server on which we are logging
|
||||
* @param label A label for the buffer, to be logged preceding the buffer
|
||||
* @param data The buffer to be logged
|
||||
* @param len The length of the buffer
|
||||
* @param flags Special processing flags like AP_LOG_DATA_SHOW_OFFSET
|
||||
* @note ap_log_data is implemented as a macro.
|
||||
* @note Use APLOG_MARK to fill out file, line, and module_index
|
||||
* @note If a request_rec is available, use that with ap_log_rdata()
|
||||
* in preference to calling this function. Otherwise, if a conn_rec is
|
||||
* available, use that with ap_log_cdata() in preference to calling
|
||||
* this function.
|
||||
*/
|
||||
#ifdef DOXYGEN
|
||||
AP_DECLARE(void) ap_log_data(const char *file, int line, int module_index,
|
||||
int level, const server_rec *s, const char *label,
|
||||
const void *data, apr_size_t len, unsigned int flags);
|
||||
#else
|
||||
#ifdef AP_HAVE_C99
|
||||
/* need additional step to expand APLOG_MARK first */
|
||||
#define ap_log_data(...) ap_log_data__(__VA_ARGS__)
|
||||
/* need server_rec *sr = ... for the case if s is verbatim NULL */
|
||||
#define ap_log_data__(file, line, mi, level, s, ...) \
|
||||
do { const server_rec *sr__ = s; if (APLOG_MODULE_IS_LEVEL(sr__, mi, level)) \
|
||||
ap_log_data_(file, line, mi, level, sr__, __VA_ARGS__); \
|
||||
} while(0)
|
||||
#else
|
||||
#define ap_log_data ap_log_data_
|
||||
#endif
|
||||
AP_DECLARE(void) ap_log_data_(const char *file, int line, int module_index,
|
||||
int level, const server_rec *s, const char *label,
|
||||
const void *data, apr_size_t len, unsigned int flags);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* ap_log_rdata() - log buffers which are related to a particular request.
|
||||
* @param file The file in which this function is called
|
||||
* @param line The line number on which this function is called
|
||||
* @param module_index The module_index of the module logging this buffer
|
||||
* @param level The log level
|
||||
* @param r The request which we are logging for
|
||||
* @param label A label for the buffer, to be logged preceding the buffer
|
||||
* @param data The buffer to be logged
|
||||
* @param len The length of the buffer
|
||||
* @param flags Special processing flags like AP_LOG_DATA_SHOW_OFFSET
|
||||
* @note ap_log_rdata is implemented as a macro.
|
||||
* @note Use APLOG_MARK to fill out file, line, and module_index
|
||||
* @note If a request_rec is available, use that with ap_log_rerror()
|
||||
* in preference to calling this function. Otherwise, if a conn_rec is
|
||||
* available, use that with ap_log_cerror() in preference to calling
|
||||
* this function.
|
||||
*/
|
||||
#ifdef DOXYGEN
|
||||
AP_DECLARE(void) ap_log_rdata(const char *file, int line, int module_index,
|
||||
int level, const request_rec *r, const char *label,
|
||||
const void *data, apr_size_t len, unsigned int flags);
|
||||
#else
|
||||
#ifdef AP_HAVE_C99
|
||||
/* need additional step to expand APLOG_MARK first */
|
||||
#define ap_log_rdata(...) ap_log_rdata__(__VA_ARGS__)
|
||||
#define ap_log_rdata__(file, line, mi, level, r, ...) \
|
||||
do { if (APLOG_R_MODULE_IS_LEVEL(r, mi, level)) \
|
||||
ap_log_rdata_(file, line, mi, level, r, __VA_ARGS__); \
|
||||
} while(0)
|
||||
#else
|
||||
#define ap_log_rdata ap_log_rdata_
|
||||
#endif
|
||||
AP_DECLARE(void) ap_log_rdata_(const char *file, int line, int module_index,
|
||||
int level, const request_rec *r, const char *label,
|
||||
const void *data, apr_size_t len, unsigned int flags);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* ap_log_cdata() - log buffers which are related to a particular connection.
|
||||
* @param file The file in which this function is called
|
||||
* @param line The line number on which this function is called
|
||||
* @param module_index The module_index of the module logging this buffer
|
||||
* @param level The log level
|
||||
* @param c The connection which we are logging for
|
||||
* @param label A label for the buffer, to be logged preceding the buffer
|
||||
* @param data The buffer to be logged
|
||||
* @param len The length of the buffer
|
||||
* @param flags Special processing flags like AP_LOG_DATA_SHOW_OFFSET
|
||||
* @note ap_log_cdata is implemented as a macro
|
||||
* @note Use APLOG_MARK to fill out file, line, and module_index
|
||||
* @note If a request_rec is available, use that with ap_log_rerror()
|
||||
* in preference to calling this function. Otherwise, if a conn_rec is
|
||||
* available, use that with ap_log_cerror() in preference to calling
|
||||
* this function.
|
||||
*/
|
||||
#ifdef DOXYGEN
|
||||
AP_DECLARE(void) ap_log_cdata(const char *file, int line, int module_index,
|
||||
int level, const conn_rec *c, const char *label,
|
||||
const void *data, apr_size_t len, unsigned int flags);
|
||||
#else
|
||||
#ifdef AP_HAVE_C99
|
||||
/* need additional step to expand APLOG_MARK first */
|
||||
#define ap_log_cdata(...) ap_log_cdata__(__VA_ARGS__)
|
||||
#define ap_log_cdata__(file, line, mi, level, c, ...) \
|
||||
do { if (APLOG_C_MODULE_IS_LEVEL(c, mi, level)) \
|
||||
ap_log_cdata_(file, line, mi, level, c, __VA_ARGS__); \
|
||||
} while(0)
|
||||
#else
|
||||
#define ap_log_cdata ap_log_cdata_
|
||||
#endif
|
||||
AP_DECLARE(void) ap_log_cdata_(const char *file, int line, int module_index,
|
||||
int level, const conn_rec *c, const char *label,
|
||||
const void *data, apr_size_t len, unsigned int flags);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* ap_log_csdata() - log buffers which are related to a particular connection
|
||||
* and to a vhost other than c->base_server.
|
||||
* @param file The file in which this function is called
|
||||
* @param line The line number on which this function is called
|
||||
* @param module_index The module_index of the module logging this buffer
|
||||
* @param level The log level
|
||||
* @param c The connection which we are logging for
|
||||
* @param s The server which we are logging for
|
||||
* @param label A label for the buffer, to be logged preceding the buffer
|
||||
* @param data The buffer to be logged
|
||||
* @param len The length of the buffer
|
||||
* @param flags Special processing flags like AP_LOG_DATA_SHOW_OFFSET
|
||||
* @note ap_log_csdata is implemented as a macro
|
||||
* @note Use APLOG_MARK to fill out file, line, and module_index
|
||||
* @note If a request_rec is available, use that with ap_log_rerror()
|
||||
* in preference to calling this function. Otherwise, if a conn_rec is
|
||||
* available, use that with ap_log_cerror() in preference to calling
|
||||
* this function.
|
||||
*/
|
||||
#ifdef DOXYGEN
|
||||
AP_DECLARE(void) ap_log_csdata(const char *file, int line, int module_index,
|
||||
int level, const conn_rec *c, const server_rec *s,
|
||||
const char *label, const void *data,
|
||||
apr_size_t len, unsigned int flags);
|
||||
#else
|
||||
#ifdef AP_HAVE_C99
|
||||
/* need additional step to expand APLOG_MARK first */
|
||||
#define ap_log_csdata(...) ap_log_csdata__(__VA_ARGS__)
|
||||
#define ap_log_csdata__(file, line, mi, level, c, s, ...) \
|
||||
do { if (APLOG_CS_MODULE_IS_LEVEL(c, s, mi, level)) \
|
||||
ap_log_csdata_(file, line, mi, level, c, s, __VA_ARGS__); \
|
||||
} while(0)
|
||||
#else
|
||||
#define ap_log_cdata ap_log_cdata_
|
||||
#endif
|
||||
AP_DECLARE(void) ap_log_csdata_(const char *file, int line, int module_index,
|
||||
int level, const conn_rec *c, const server_rec *s,
|
||||
const char *label, const void *data,
|
||||
apr_size_t len, unsigned int flags);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Convert stderr to the error log
|
||||
* @param s The current server
|
||||
*/
|
||||
AP_DECLARE(void) ap_error_log2stderr(server_rec *s);
|
||||
|
||||
/**
|
||||
* Log the command line used to start the server.
|
||||
* @param p The pool to use for logging
|
||||
* @param s The server_rec whose process's command line we want to log.
|
||||
* The command line is logged to that server's error log.
|
||||
*/
|
||||
AP_DECLARE(void) ap_log_command_line(apr_pool_t *p, server_rec *s);
|
||||
|
||||
/**
|
||||
* Log common (various) MPM shared data at startup.
|
||||
* @param s The server_rec of the error log we want to log to.
|
||||
* Misc commonly logged data is logged to that server's error log.
|
||||
*/
|
||||
AP_DECLARE(void) ap_log_mpm_common(server_rec *s);
|
||||
|
||||
/**
|
||||
* Log the current pid of the parent process
|
||||
* @param p The pool to use for processing
|
||||
* @param fname The name of the file to log to. If the filename is not
|
||||
* absolute then it is assumed to be relative to ServerRoot.
|
||||
*/
|
||||
AP_DECLARE(void) ap_log_pid(apr_pool_t *p, const char *fname);
|
||||
|
||||
/**
|
||||
* Remove the pidfile.
|
||||
* @param p The pool to use for processing
|
||||
* @param fname The name of the pid file to remove. If the filename is not
|
||||
* absolute then it is assumed to be relative to ServerRoot.
|
||||
*/
|
||||
AP_DECLARE(void) ap_remove_pid(apr_pool_t *p, const char *fname);
|
||||
|
||||
/**
|
||||
* Retrieve the pid from a pidfile.
|
||||
* @param p The pool to use for processing
|
||||
* @param filename The name of the file containing the pid. If the filename is not
|
||||
* absolute then it is assumed to be relative to ServerRoot.
|
||||
* @param mypid Pointer to pid_t (valid only if return APR_SUCCESS)
|
||||
*/
|
||||
AP_DECLARE(apr_status_t) ap_read_pid(apr_pool_t *p, const char *filename, pid_t *mypid);
|
||||
|
||||
/** @see piped_log */
|
||||
typedef struct piped_log piped_log;
|
||||
|
||||
/**
|
||||
* Open the piped log process
|
||||
* @param p The pool to allocate out of
|
||||
* @param program The program to run in the logging process
|
||||
* @return The piped log structure
|
||||
* @note The log program is invoked as @p APR_PROGRAM_ENV,
|
||||
* @see ap_open_piped_log_ex to modify this behavior
|
||||
*/
|
||||
AP_DECLARE(piped_log *) ap_open_piped_log(apr_pool_t *p, const char *program);
|
||||
|
||||
/**
|
||||
* Open the piped log process specifying the execution choice for program
|
||||
* @param p The pool to allocate out of
|
||||
* @param program The program to run in the logging process
|
||||
* @param cmdtype How to invoke program, e.g. APR_PROGRAM, APR_SHELLCMD_ENV, etc
|
||||
* @return The piped log structure
|
||||
*/
|
||||
AP_DECLARE(piped_log *) ap_open_piped_log_ex(apr_pool_t *p,
|
||||
const char *program,
|
||||
apr_cmdtype_e cmdtype);
|
||||
|
||||
/**
|
||||
* Close the piped log and kill the logging process
|
||||
* @param pl The piped log structure
|
||||
*/
|
||||
AP_DECLARE(void) ap_close_piped_log(piped_log *pl);
|
||||
|
||||
/**
|
||||
* A function to return the read side of the piped log pipe
|
||||
* @param pl The piped log structure
|
||||
* @return The native file descriptor
|
||||
*/
|
||||
AP_DECLARE(apr_file_t *) ap_piped_log_read_fd(piped_log *pl);
|
||||
|
||||
/**
|
||||
* A function to return the write side of the piped log pipe
|
||||
* @param pl The piped log structure
|
||||
* @return The native file descriptor
|
||||
*/
|
||||
AP_DECLARE(apr_file_t *) ap_piped_log_write_fd(piped_log *pl);
|
||||
|
||||
/**
|
||||
* hook method to generate unique id for connection or request
|
||||
* @ingroup hooks
|
||||
* @param c the conn_rec of the connections
|
||||
* @param r the request_req (may be NULL)
|
||||
* @param id the place where to store the unique id
|
||||
* @return OK or DECLINE
|
||||
*/
|
||||
AP_DECLARE_HOOK(int, generate_log_id,
|
||||
(const conn_rec *c, const request_rec *r, const char **id))
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !APACHE_HTTP_LOG_H */
|
||||
/** @} */
|
||||
88
database/apache/include/http_main.h
Normal file
88
database/apache/include/http_main.h
Normal file
@@ -0,0 +1,88 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file http_main.h
|
||||
* @brief Command line options
|
||||
*
|
||||
* @defgroup APACHE_CORE_MAIN Command line options
|
||||
* @ingroup APACHE_CORE
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef APACHE_HTTP_MAIN_H
|
||||
#define APACHE_HTTP_MAIN_H
|
||||
|
||||
#include "httpd.h"
|
||||
#include "apr_optional.h"
|
||||
|
||||
/** AP_SERVER_BASEARGS is the command argument list parsed by http_main.c
|
||||
* in apr_getopt() format. Use this for default'ing args that the MPM
|
||||
* can safely ignore and pass on from its rewrite_args() handler.
|
||||
*/
|
||||
#define AP_SERVER_BASEARGS "C:c:D:d:E:e:f:vVlLtTSMh?X"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** The name of the Apache executable */
|
||||
AP_DECLARE_DATA extern const char *ap_server_argv0;
|
||||
/** The global server's ServerRoot */
|
||||
AP_DECLARE_DATA extern const char *ap_server_root;
|
||||
/** The global server's DefaultRuntimeDir
|
||||
* This is not usable directly in the general case; use
|
||||
* ap_runtime_dir_relative() instead.
|
||||
*/
|
||||
AP_DECLARE_DATA extern const char *ap_runtime_dir;
|
||||
/** The global server's server_rec */
|
||||
AP_DECLARE_DATA extern server_rec *ap_server_conf;
|
||||
/** global pool, for access prior to creation of server_rec */
|
||||
AP_DECLARE_DATA extern apr_pool_t *ap_pglobal;
|
||||
/** state of the server (startup, exiting, ...) */
|
||||
AP_DECLARE_DATA extern int ap_main_state;
|
||||
/** run mode (normal, config test, config dump, ...) */
|
||||
AP_DECLARE_DATA extern int ap_run_mode;
|
||||
/** run mode (normal, config test, config dump, ...) */
|
||||
AP_DECLARE_DATA extern int ap_config_generation;
|
||||
|
||||
/* for -C, -c and -D switches */
|
||||
/** An array of all -C directives. These are processed before the server's
|
||||
* config file */
|
||||
AP_DECLARE_DATA extern apr_array_header_t *ap_server_pre_read_config;
|
||||
/** An array of all -c directives. These are processed after the server's
|
||||
* config file */
|
||||
AP_DECLARE_DATA extern apr_array_header_t *ap_server_post_read_config;
|
||||
/** An array of all -D defines on the command line. This allows people to
|
||||
* effect the server based on command line options */
|
||||
AP_DECLARE_DATA extern apr_array_header_t *ap_server_config_defines;
|
||||
/** Available integer for using the -T switch */
|
||||
AP_DECLARE_DATA extern int ap_document_root_check;
|
||||
|
||||
/**
|
||||
* An optional function to send signal to server on presence of '-k'
|
||||
* command line argument.
|
||||
* @param status The exit status after sending signal
|
||||
* @param pool Memory pool to allocate from
|
||||
*/
|
||||
APR_DECLARE_OPTIONAL_FN(int, ap_signal_server, (int *status, apr_pool_t *pool));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !APACHE_HTTP_MAIN_H */
|
||||
/** @} */
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user