| Current File : /home/mmdealscpanel/yummmdeals.com/ea-apr16.zip |
PK a��Z'Y��
�
include/apr-1/apr_dso.hnu �[��� /* 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
PK a��Z
��'K K include/apr-1/apr_ring.hnu �[��� /* 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 */
PK a��Z>�>�! �! include/apr-1/apr_ldap_option.hnu �[��� /* 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 */
PK a��Z�S��I I include/apr-1/apr_allocator.hnu �[��� /* 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 */
PK a��Z�G��P P include/apr-1/apr_portable.hnu �[��� /* 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 */
PK a��ZW,�HC HC include/apr-1/apr_memcache.hnu �[��� /* 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 */
PK a��Z�I#� � include/apr-1/apu_want.hnu �[��� /* 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
#include <db.h>
#endif
#undef APU_WANT_DB
#endif
/* --------------------------------------------------------------------- */
PK a��ZFJ�� � include/apr-1/apu_version.hnu �[��� /* 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 */
PK a��Z��i�� � include/apr-1/apr_queue.hnu �[��� /* 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 */
PK a��Z��Ժ�D �D include/apr-1/apr_escape.hnu �[��� /* 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 */
PK a��Zu6��� � ! include/apr-1/apr_thread_rwlock.hnu �[��� /* 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 */
PK a��Z�z=� � include/apr-1/apr_version.hnu �[��� /* 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 2025 The Apache Software Foundation."
/* 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 6
/**
* 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 */
PK a��Z�g0�, , include/apr-1/apr_atomic.hnu �[��� /* 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 */
PK a��Z@v9�, , include/apr-1/apr_sha1.hnu �[��� /* 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 */
PK a��Z&D�>�, �, include/apr-1/apr_cstr.hnu �[��� /* ====================================================================
* 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 */
PK a��Z�j_�b b include/apr-1/apr_support.hnu �[��� /* 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 */
PK a��Z�e0
�8 �8 include/apr-1/apr_skiplist.hnu �[��� /* 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 */
PK a��Z3涅� � include/apr-1/apr_ldap_init.hnu �[��� /* 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 */
PK a��Z��O�kR kR include/apr-1/apr_poll.hnu �[��� /* 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 */
PK a��Zl��
include/apr-1/apr_mmap.hnu �[��� /* 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 */
PK a��Z�)9�� �� include/apr-1/apr_buckets.hnu �[��� /* 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_buckets.h
* @brief APR-UTIL Buckets/Bucket Brigades
*/
#ifndef APR_BUCKETS_H
#define APR_BUCKETS_H
#if defined(APR_BUCKET_DEBUG) && !defined(APR_RING_DEBUG)
#define APR_RING_DEBUG
#endif
#include "apu.h"
#include "apr_network_io.h"
#include "apr_file_io.h"
#include "apr_general.h"
#include "apr_mmap.h"
#include "apr_errno.h"
#include "apr_ring.h"
#include "apr.h"
#if APR_HAVE_SYS_UIO_H
#include <sys/uio.h> /* for struct iovec */
#endif
#if APR_HAVE_STDARG_H
#include <stdarg.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
/**
* @defgroup APR_Util_Bucket_Brigades Bucket Brigades
* @ingroup APR_Util
* @{
*/
/** default bucket buffer size - 8KB minus room for memory allocator headers */
#define APR_BUCKET_BUFF_SIZE 8000
/** Determines how a bucket or brigade should be read */
typedef enum {
APR_BLOCK_READ, /**< block until data becomes available */
APR_NONBLOCK_READ /**< return immediately if no data is available */
} apr_read_type_e;
/**
* The one-sentence buzzword-laden overview: Bucket brigades represent
* a complex data stream that can be passed through a layered IO
* system without unnecessary copying. A longer overview follows...
*
* A bucket brigade is a doubly linked list (ring) of buckets, so we
* aren't limited to inserting at the front and removing at the end.
* Buckets are only passed around as members of a brigade, although
* singleton buckets can occur for short periods of time.
*
* Buckets are data stores of various types. They can refer to data in
* memory, or part of a file or mmap area, or the output of a process,
* etc. Buckets also have some type-dependent accessor functions:
* read, split, copy, setaside, and destroy.
*
* read returns the address and size of the data in the bucket. If the
* data isn't in memory then it is read in and the bucket changes type
* so that it can refer to the new location of the data. If all the
* data doesn't fit in the bucket then a new bucket is inserted into
* the brigade to hold the rest of it.
*
* split divides the data in a bucket into two regions. After a split
* the original bucket refers to the first part of the data and a new
* bucket inserted into the brigade after the original bucket refers
* to the second part of the data. Reference counts are maintained as
* necessary.
*
* setaside ensures that the data in the bucket has a long enough
* lifetime. Sometimes it is convenient to create a bucket referring
* to data on the stack in the expectation that it will be consumed
* (output to the network) before the stack is unwound. If that
* expectation turns out not to be valid, the setaside function is
* called to move the data somewhere safer.
*
* copy makes a duplicate of the bucket structure as long as it's
* possible to have multiple references to a single copy of the
* data itself. Not all bucket types can be copied.
*
* destroy maintains the reference counts on the resources used by a
* bucket and frees them if necessary.
*
* Note: all of the above functions have wrapper macros (apr_bucket_read(),
* apr_bucket_destroy(), etc), and those macros should be used rather
* than using the function pointers directly.
*
* To write a bucket brigade, they are first made into an iovec, so that we
* don't write too little data at one time. Currently we ignore compacting the
* buckets into as few buckets as possible, but if we really want good
* performance, then we need to compact the buckets before we convert to an
* iovec, or possibly while we are converting to an iovec.
*/
/*
* Forward declaration of the main types.
*/
/** @see apr_bucket_brigade */
typedef struct apr_bucket_brigade apr_bucket_brigade;
/** @see apr_bucket */
typedef struct apr_bucket apr_bucket;
/** @see apr_bucket_alloc_t */
typedef struct apr_bucket_alloc_t apr_bucket_alloc_t;
/** @see apr_bucket_type_t */
typedef struct apr_bucket_type_t apr_bucket_type_t;
/**
* Basic bucket type
*/
struct apr_bucket_type_t {
/**
* The name of the bucket type
*/
const char *name;
/**
* The number of functions this bucket understands. Can not be less than
* five.
*/
int num_func;
/**
* Whether the bucket contains metadata (ie, information that
* describes the regular contents of the brigade). The metadata
* is not returned by apr_bucket_read() and is not indicated by
* the ->length of the apr_bucket itself. In other words, an
* empty bucket is safe to arbitrarily remove if and only if it
* contains no metadata. In this sense, "data" is just raw bytes
* that are the "content" of the brigade and "metadata" describes
* that data but is not a proper part of it.
*/
enum {
/** This bucket type represents actual data to send to the client. */
APR_BUCKET_DATA = 0,
/** This bucket type represents metadata. */
APR_BUCKET_METADATA = 1
} is_metadata;
/**
* Free the private data and any resources used by the bucket (if they
* aren't shared with another bucket). This function is required to be
* implemented for all bucket types, though it might be a no-op on some
* of them (namely ones that never allocate any private data structures).
* @param data The private data pointer from the bucket to be destroyed
*/
void (*destroy)(void *data);
/**
* Read the data from the bucket. This is required to be implemented
* for all bucket types.
* @param b The bucket to read from
* @param str A place to store the data read. Allocation should only be
* done if absolutely necessary.
* @param len The amount of data read.
* @param block Should this read function block if there is more data that
* cannot be read immediately.
*/
apr_status_t (*read)(apr_bucket *b, const char **str, apr_size_t *len,
apr_read_type_e block);
/**
* Make it possible to set aside the data for at least as long as the
* given pool. Buckets containing data that could potentially die before
* this pool (e.g. the data resides on the stack, in a child pool of
* the given pool, or in a disjoint pool) must somehow copy, shift, or
* transform the data to have the proper lifetime.
* @param e The bucket to convert
* @remark Some bucket types contain data that will always outlive the
* bucket itself. For example no data (EOS and FLUSH), or the data
* resides in global, constant memory (IMMORTAL), or the data is on
* the heap (HEAP). For these buckets, apr_bucket_setaside_noop can
* be used.
*/
apr_status_t (*setaside)(apr_bucket *e, apr_pool_t *pool);
/**
* Split one bucket in two at the specified position by duplicating
* the bucket structure (not the data) and modifying any necessary
* start/end/offset information. If it's not possible to do this
* for the bucket type (perhaps the length of the data is indeterminate,
* as with pipe and socket buckets), then APR_ENOTIMPL is returned.
* @param e The bucket to split
* @param point The offset of the first byte in the new bucket
*/
apr_status_t (*split)(apr_bucket *e, apr_size_t point);
/**
* Copy the bucket structure (not the data), assuming that this is
* possible for the bucket type. If it's not, APR_ENOTIMPL is returned.
* @param e The bucket to copy
* @param c Returns a pointer to the new bucket
*/
apr_status_t (*copy)(apr_bucket *e, apr_bucket **c);
};
/**
* apr_bucket structures are allocated on the malloc() heap and
* their lifetime is controlled by the parent apr_bucket_brigade
* structure. Buckets can move from one brigade to another e.g. by
* calling APR_BRIGADE_CONCAT(). In general the data in a bucket has
* the same lifetime as the bucket and is freed when the bucket is
* destroyed; if the data is shared by more than one bucket (e.g.
* after a split) the data is freed when the last bucket goes away.
*/
struct apr_bucket {
/** Links to the rest of the brigade */
APR_RING_ENTRY(apr_bucket) link;
/** The type of bucket. */
const apr_bucket_type_t *type;
/** The length of the data in the bucket. This could have been implemented
* with a function, but this is an optimization, because the most
* common thing to do will be to get the length. If the length is unknown,
* the value of this field will be (apr_size_t)(-1).
*/
apr_size_t length;
/** The start of the data in the bucket relative to the private base
* pointer. The vast majority of bucket types allow a fixed block of
* data to be referenced by multiple buckets, each bucket pointing to
* a different segment of the data. That segment starts at base+start
* and ends at base+start+length.
* If the length == (apr_size_t)(-1), then start == -1.
*/
apr_off_t start;
/** type-dependent data hangs off this pointer */
void *data;
/**
* Pointer to function used to free the bucket. This function should
* always be defined and it should be consistent with the memory
* function used to allocate the bucket. For example, if malloc() is
* used to allocate the bucket, this pointer should point to free().
* @param e Pointer to the bucket being freed
*/
void (*free)(void *e);
/** The freelist from which this bucket was allocated */
apr_bucket_alloc_t *list;
};
/** A list of buckets */
struct apr_bucket_brigade {
/** The pool to associate the brigade with. The data is not allocated out
* of the pool, but a cleanup is registered with this pool. If the
* brigade is destroyed by some mechanism other than pool destruction,
* the destroying function is responsible for killing the cleanup.
*/
apr_pool_t *p;
/** The buckets in the brigade are on this list. */
/*
* The apr_bucket_list structure doesn't actually need a name tag
* because it has no existence independent of struct apr_bucket_brigade;
* the ring macros are designed so that you can leave the name tag
* argument empty in this situation but apparently the Windows compiler
* doesn't like that.
*/
APR_RING_HEAD(apr_bucket_list, apr_bucket) list;
/** The freelist from which this bucket was allocated */
apr_bucket_alloc_t *bucket_alloc;
};
/**
* Function called when a brigade should be flushed
*/
typedef apr_status_t (*apr_brigade_flush)(apr_bucket_brigade *bb, void *ctx);
/*
* define APR_BUCKET_DEBUG if you want your brigades to be checked for
* validity at every possible instant. this will slow your code down
* substantially but is a very useful debugging tool.
*/
#ifdef APR_BUCKET_DEBUG
#define APR_BRIGADE_CHECK_CONSISTENCY(b) \
APR_RING_CHECK_CONSISTENCY(&(b)->list, apr_bucket, link)
#define APR_BUCKET_CHECK_CONSISTENCY(e) \
APR_RING_CHECK_ELEM_CONSISTENCY((e), apr_bucket, link)
#else
/**
* checks the ring pointers in a bucket brigade for consistency. an
* abort() will be triggered if any inconsistencies are found.
* note: this is a no-op unless APR_BUCKET_DEBUG is defined.
* @param b The brigade
*/
#define APR_BRIGADE_CHECK_CONSISTENCY(b)
/**
* checks the brigade a bucket is in for ring consistency. an
* abort() will be triggered if any inconsistencies are found.
* note: this is a no-op unless APR_BUCKET_DEBUG is defined.
* @param e The bucket
*/
#define APR_BUCKET_CHECK_CONSISTENCY(e)
#endif
/**
* Wrappers around the RING macros to reduce the verbosity of the code
* that handles bucket brigades.
*/
/**
* The magic pointer value that indicates the head of the brigade
* @remark This is used to find the beginning and end of the brigade, eg:
* <pre>
* while (e != APR_BRIGADE_SENTINEL(b)) {
* ...
* e = APR_BUCKET_NEXT(e);
* }
* </pre>
* @param b The brigade
* @return The magic pointer value
*/
#define APR_BRIGADE_SENTINEL(b) APR_RING_SENTINEL(&(b)->list, apr_bucket, link)
/**
* Determine if the bucket brigade is empty
* @param b The brigade to check
* @return true or false
*/
#define APR_BRIGADE_EMPTY(b) APR_RING_EMPTY(&(b)->list, apr_bucket, link)
/**
* Return the first bucket in a brigade
* @param b The brigade to query
* @return The first bucket in the brigade
*/
#define APR_BRIGADE_FIRST(b) APR_RING_FIRST(&(b)->list)
/**
* Return the last bucket in a brigade
* @param b The brigade to query
* @return The last bucket in the brigade
*/
#define APR_BRIGADE_LAST(b) APR_RING_LAST(&(b)->list)
/**
* Insert a single bucket at the front of a brigade
* @param b The brigade to add to
* @param e The bucket to insert
*/
#define APR_BRIGADE_INSERT_HEAD(b, e) do { \
apr_bucket *ap__b = (e); \
APR_RING_INSERT_HEAD(&(b)->list, ap__b, apr_bucket, link); \
APR_BRIGADE_CHECK_CONSISTENCY((b)); \
} while (0)
/**
* Insert a single bucket at the end of a brigade
* @param b The brigade to add to
* @param e The bucket to insert
*/
#define APR_BRIGADE_INSERT_TAIL(b, e) do { \
apr_bucket *ap__b = (e); \
APR_RING_INSERT_TAIL(&(b)->list, ap__b, apr_bucket, link); \
APR_BRIGADE_CHECK_CONSISTENCY((b)); \
} while (0)
/**
* Concatenate brigade b onto the end of brigade a, leaving brigade b empty
* @param a The first brigade
* @param b The second brigade
*/
#define APR_BRIGADE_CONCAT(a, b) do { \
APR_RING_CONCAT(&(a)->list, &(b)->list, apr_bucket, link); \
APR_BRIGADE_CHECK_CONSISTENCY((a)); \
} while (0)
/**
* Prepend brigade b onto the beginning of brigade a, leaving brigade b empty
* @param a The first brigade
* @param b The second brigade
*/
#define APR_BRIGADE_PREPEND(a, b) do { \
APR_RING_PREPEND(&(a)->list, &(b)->list, apr_bucket, link); \
APR_BRIGADE_CHECK_CONSISTENCY((a)); \
} while (0)
/**
* Insert a single bucket before a specified bucket
* @param a The bucket to insert before
* @param b The bucket to insert
*/
#define APR_BUCKET_INSERT_BEFORE(a, b) do { \
apr_bucket *ap__a = (a), *ap__b = (b); \
APR_RING_INSERT_BEFORE(ap__a, ap__b, link); \
APR_BUCKET_CHECK_CONSISTENCY(ap__a); \
} while (0)
/**
* Insert a single bucket after a specified bucket
* @param a The bucket to insert after
* @param b The bucket to insert
*/
#define APR_BUCKET_INSERT_AFTER(a, b) do { \
apr_bucket *ap__a = (a), *ap__b = (b); \
APR_RING_INSERT_AFTER(ap__a, ap__b, link); \
APR_BUCKET_CHECK_CONSISTENCY(ap__a); \
} while (0)
/**
* Get the next bucket in the list
* @param e The current bucket
* @return The next bucket
*/
#define APR_BUCKET_NEXT(e) APR_RING_NEXT((e), link)
/**
* Get the previous bucket in the list
* @param e The current bucket
* @return The previous bucket
*/
#define APR_BUCKET_PREV(e) APR_RING_PREV((e), link)
/**
* Remove a bucket from its bucket brigade
* @param e The bucket to remove
*/
#define APR_BUCKET_REMOVE(e) APR_RING_REMOVE((e), link)
/**
* Initialize a new bucket's prev/next pointers
* @param e The bucket to initialize
*/
#define APR_BUCKET_INIT(e) APR_RING_ELEM_INIT((e), link)
/**
* Determine if a bucket contains metadata. An empty bucket is
* safe to arbitrarily remove if and only if this is false.
* @param e The bucket to inspect
* @return true or false
*/
#define APR_BUCKET_IS_METADATA(e) ((e)->type->is_metadata)
/**
* Determine if a bucket is a FLUSH bucket
* @param e The bucket to inspect
* @return true or false
*/
#define APR_BUCKET_IS_FLUSH(e) ((e)->type == &apr_bucket_type_flush)
/**
* Determine if a bucket is an EOS bucket
* @param e The bucket to inspect
* @return true or false
*/
#define APR_BUCKET_IS_EOS(e) ((e)->type == &apr_bucket_type_eos)
/**
* Determine if a bucket is a FILE bucket
* @param e The bucket to inspect
* @return true or false
*/
#define APR_BUCKET_IS_FILE(e) ((e)->type == &apr_bucket_type_file)
/**
* Determine if a bucket is a PIPE bucket
* @param e The bucket to inspect
* @return true or false
*/
#define APR_BUCKET_IS_PIPE(e) ((e)->type == &apr_bucket_type_pipe)
/**
* Determine if a bucket is a SOCKET bucket
* @param e The bucket to inspect
* @return true or false
*/
#define APR_BUCKET_IS_SOCKET(e) ((e)->type == &apr_bucket_type_socket)
/**
* Determine if a bucket is a HEAP bucket
* @param e The bucket to inspect
* @return true or false
*/
#define APR_BUCKET_IS_HEAP(e) ((e)->type == &apr_bucket_type_heap)
/**
* Determine if a bucket is a TRANSIENT bucket
* @param e The bucket to inspect
* @return true or false
*/
#define APR_BUCKET_IS_TRANSIENT(e) ((e)->type == &apr_bucket_type_transient)
/**
* Determine if a bucket is a IMMORTAL bucket
* @param e The bucket to inspect
* @return true or false
*/
#define APR_BUCKET_IS_IMMORTAL(e) ((e)->type == &apr_bucket_type_immortal)
#if APR_HAS_MMAP
/**
* Determine if a bucket is a MMAP bucket
* @param e The bucket to inspect
* @return true or false
*/
#define APR_BUCKET_IS_MMAP(e) ((e)->type == &apr_bucket_type_mmap)
#endif
/**
* Determine if a bucket is a POOL bucket
* @param e The bucket to inspect
* @return true or false
*/
#define APR_BUCKET_IS_POOL(e) ((e)->type == &apr_bucket_type_pool)
/*
* General-purpose reference counting for the various bucket types.
*
* Any bucket type that keeps track of the resources it uses (i.e.
* most of them except for IMMORTAL, TRANSIENT, and EOS) needs to
* attach a reference count to the resource so that it can be freed
* when the last bucket that uses it goes away. Resource-sharing may
* occur because of bucket splits or buckets that refer to globally
* cached data. */
/** @see apr_bucket_refcount */
typedef struct apr_bucket_refcount apr_bucket_refcount;
/**
* The structure used to manage the shared resource must start with an
* apr_bucket_refcount which is updated by the general-purpose refcount
* code. A pointer to the bucket-type-dependent private data structure
* can be cast to a pointer to an apr_bucket_refcount and vice versa.
*/
struct apr_bucket_refcount {
/** The number of references to this bucket */
int refcount;
};
/* ***** Reference-counted bucket types ***** */
/** @see apr_bucket_heap */
typedef struct apr_bucket_heap apr_bucket_heap;
/**
* A bucket referring to data allocated off the heap.
*/
struct apr_bucket_heap {
/** Number of buckets using this memory */
apr_bucket_refcount refcount;
/** The start of the data actually allocated. This should never be
* modified, it is only used to free the bucket.
*/
char *base;
/** how much memory was allocated */
apr_size_t alloc_len;
/** function to use to delete the data */
void (*free_func)(void *data);
};
/** @see apr_bucket_pool */
typedef struct apr_bucket_pool apr_bucket_pool;
/**
* A bucket referring to data allocated from a pool
*/
struct apr_bucket_pool {
/** The pool bucket must be able to be easily morphed to a heap
* bucket if the pool gets cleaned up before all references are
* destroyed. This apr_bucket_heap structure is populated automatically
* when the pool gets cleaned up, and subsequent calls to pool_read()
* will result in the apr_bucket in question being morphed into a
* regular heap bucket. (To avoid having to do many extra refcount
* manipulations and b->data manipulations, the apr_bucket_pool
* struct actually *contains* the apr_bucket_heap struct that it
* will become as its first element; the two share their
* apr_bucket_refcount members.)
*/
apr_bucket_heap heap;
/** The block of data actually allocated from the pool.
* Segments of this block are referenced by adjusting
* the start and length of the apr_bucket accordingly.
* This will be NULL after the pool gets cleaned up.
*/
const char *base;
/** The pool the data was allocated from. When the pool
* is cleaned up, this gets set to NULL as an indicator
* to pool_read() that the data is now on the heap and
* so it should morph the bucket into a regular heap
* bucket before continuing.
*/
apr_pool_t *pool;
/** The freelist this structure was allocated from, which is
* needed in the cleanup phase in order to allocate space on the heap
*/
apr_bucket_alloc_t *list;
};
#if APR_HAS_MMAP
/** @see apr_bucket_mmap */
typedef struct apr_bucket_mmap apr_bucket_mmap;
/**
* A bucket referring to an mmap()ed file
*/
struct apr_bucket_mmap {
/** Number of buckets using this memory */
apr_bucket_refcount refcount;
/** The mmap this sub_bucket refers to */
apr_mmap_t *mmap;
};
#endif
/** @see apr_bucket_file */
typedef struct apr_bucket_file apr_bucket_file;
/**
* A bucket referring to an file
*/
struct apr_bucket_file {
/** Number of buckets using this memory */
apr_bucket_refcount refcount;
/** The file this bucket refers to */
apr_file_t *fd;
/** The pool into which any needed structures should
* be created while reading from this file bucket */
apr_pool_t *readpool;
#if APR_HAS_MMAP
/** Whether this bucket should be memory-mapped if
* a caller tries to read from it */
int can_mmap;
#endif /* APR_HAS_MMAP */
/** File read block size */
apr_size_t read_size;
};
/** @see apr_bucket_structs */
typedef union apr_bucket_structs apr_bucket_structs;
/**
* A union of all bucket structures so we know what
* the max size is.
*/
union apr_bucket_structs {
apr_bucket b; /**< Bucket */
apr_bucket_heap heap; /**< Heap */
apr_bucket_pool pool; /**< Pool */
#if APR_HAS_MMAP
apr_bucket_mmap mmap; /**< MMap */
#endif
apr_bucket_file file; /**< File */
};
/**
* The amount that apr_bucket_alloc() should allocate in the common case.
* Note: this is twice as big as apr_bucket_structs to allow breathing
* room for third-party bucket types.
*/
#define APR_BUCKET_ALLOC_SIZE APR_ALIGN_DEFAULT(2*sizeof(apr_bucket_structs))
/* ***** Bucket Brigade Functions ***** */
/**
* Create a new bucket brigade. The bucket brigade is originally empty.
* @param p The pool to associate with the brigade. Data is not allocated out
* of the pool, but a cleanup is registered.
* @param list The bucket allocator to use
* @return The empty bucket brigade
*/
APU_DECLARE(apr_bucket_brigade *) apr_brigade_create(apr_pool_t *p,
apr_bucket_alloc_t *list);
/**
* destroy an entire bucket brigade. This includes destroying all of the
* buckets within the bucket brigade's bucket list.
* @param b The bucket brigade to destroy
*/
APU_DECLARE(apr_status_t) apr_brigade_destroy(apr_bucket_brigade *b);
/**
* empty out an entire bucket brigade. This includes destroying all of the
* buckets within the bucket brigade's bucket list. This is similar to
* apr_brigade_destroy(), except that it does not deregister the brigade's
* pool cleanup function.
* @param data The bucket brigade to clean up
* @remark Generally, you should use apr_brigade_destroy(). This function
* can be useful in situations where you have a single brigade that
* you wish to reuse many times by destroying all of the buckets in
* the brigade and putting new buckets into it later.
*/
APU_DECLARE(apr_status_t) apr_brigade_cleanup(void *data);
/**
* Move the buckets from the tail end of the existing brigade @a b into
* the brigade @a a. If @a a is NULL a new brigade is created. Buckets
* from @a e to the last bucket (inclusively) of brigade @a b are moved
* from @a b to the returned brigade @a a.
*
* @param b The brigade to split
* @param e The first bucket to move
* @param a The brigade which should be used for the result or NULL if
* a new brigade should be created. The brigade @a a will be
* cleared if it is not empty.
* @return The brigade supplied in @a a or a new one if @a a was NULL.
* @warning Note that this function allocates a new brigade if @a a is
* NULL so memory consumption should be carefully considered.
*/
APU_DECLARE(apr_bucket_brigade *) apr_brigade_split_ex(apr_bucket_brigade *b,
apr_bucket *e,
apr_bucket_brigade *a);
/**
* Create a new bucket brigade and move the buckets from the tail end
* of an existing brigade into the new brigade. Buckets from
* @a e to the last bucket (inclusively) of brigade @a b
* are moved from @a b to the returned brigade.
* @param b The brigade to split
* @param e The first bucket to move
* @return The new brigade
* @warning Note that this function always allocates a new brigade
* so memory consumption should be carefully considered.
*/
APU_DECLARE(apr_bucket_brigade *) apr_brigade_split(apr_bucket_brigade *b,
apr_bucket *e);
/**
* Partition a bucket brigade at a given offset (in bytes from the start of
* the brigade). This is useful whenever a filter wants to use known ranges
* of bytes from the brigade; the ranges can even overlap.
* @param b The brigade to partition
* @param point The offset at which to partition the brigade
* @param after_point Returns a pointer to the first bucket after the partition
* @return APR_SUCCESS on success, APR_INCOMPLETE if the contents of the
* brigade were shorter than @a point, or an error code.
* @remark if APR_INCOMPLETE is returned, @a after_point will be set to
* the brigade sentinel.
*/
APU_DECLARE(apr_status_t) apr_brigade_partition(apr_bucket_brigade *b,
apr_off_t point,
apr_bucket **after_point);
/**
* Return the total length of the brigade.
* @param bb The brigade to compute the length of
* @param read_all Read unknown-length buckets to force a size
* @param length Returns the length of the brigade (up to the end, or up
* to a bucket read error), or -1 if the brigade has buckets
* of indeterminate length and read_all is 0.
*/
APU_DECLARE(apr_status_t) apr_brigade_length(apr_bucket_brigade *bb,
int read_all,
apr_off_t *length);
/**
* Take a bucket brigade and store the data in a flat char*
* @param bb The bucket brigade to create the char* from
* @param c The char* to write into
* @param len The maximum length of the char array. On return, it is the
* actual length of the char array.
*/
APU_DECLARE(apr_status_t) apr_brigade_flatten(apr_bucket_brigade *bb,
char *c,
apr_size_t *len);
/**
* Creates a pool-allocated string representing a flat bucket brigade
* @param bb The bucket brigade to create the char array from
* @param c On return, the allocated char array
* @param len On return, the length of the char array.
* @param pool The pool to allocate the string from.
*/
APU_DECLARE(apr_status_t) apr_brigade_pflatten(apr_bucket_brigade *bb,
char **c,
apr_size_t *len,
apr_pool_t *pool);
/**
* Split a brigade to represent one LF line.
* @param bbOut The bucket brigade that will have the LF line appended to.
* @param bbIn The input bucket brigade to search for a LF-line.
* @param block The blocking mode to be used to split the line.
* @param maxbytes The maximum bytes to read. If this many bytes are seen
* without a LF, the brigade will contain a partial line.
*/
APU_DECLARE(apr_status_t) apr_brigade_split_line(apr_bucket_brigade *bbOut,
apr_bucket_brigade *bbIn,
apr_read_type_e block,
apr_off_t maxbytes);
/**
* Create an iovec of the elements in a bucket_brigade... return number
* of elements used. This is useful for writing to a file or to the
* network efficiently.
* @param b The bucket brigade to create the iovec from
* @param vec The iovec to create
* @param nvec The number of elements in the iovec. On return, it is the
* number of iovec elements actually filled out.
*/
APU_DECLARE(apr_status_t) apr_brigade_to_iovec(apr_bucket_brigade *b,
struct iovec *vec, int *nvec);
/**
* This function writes a list of strings into a bucket brigade.
* @param b The bucket brigade to add to
* @param flush The flush function to use if the brigade is full
* @param ctx The structure to pass to the flush function
* @param va A list of strings to add
* @return APR_SUCCESS or error code.
*/
APU_DECLARE(apr_status_t) apr_brigade_vputstrs(apr_bucket_brigade *b,
apr_brigade_flush flush,
void *ctx,
va_list va);
/**
* This function writes a string into a bucket brigade.
*
* The apr_brigade_write function attempts to be efficient with the
* handling of heap buckets. Regardless of the amount of data stored
* inside a heap bucket, heap buckets are a fixed size to promote their
* reuse.
*
* If an attempt is made to write a string to a brigade that already
* ends with a heap bucket, this function will attempt to pack the
* string into the remaining space in the previous heap bucket, before
* allocating a new heap bucket.
*
* This function always returns APR_SUCCESS, unless a flush function is
* passed, in which case the return value of the flush function will be
* returned if used.
* @param b The bucket brigade to add to
* @param flush The flush function to use if the brigade is full
* @param ctx The structure to pass to the flush function
* @param str The string to add
* @param nbyte The number of bytes to write
* @return APR_SUCCESS or error code
*/
APU_DECLARE(apr_status_t) apr_brigade_write(apr_bucket_brigade *b,
apr_brigade_flush flush, void *ctx,
const char *str, apr_size_t nbyte);
/**
* This function writes multiple strings into a bucket brigade.
* @param b The bucket brigade to add to
* @param flush The flush function to use if the brigade is full
* @param ctx The structure to pass to the flush function
* @param vec The strings to add (address plus length for each)
* @param nvec The number of entries in iovec
* @return APR_SUCCESS or error code
*/
APU_DECLARE(apr_status_t) apr_brigade_writev(apr_bucket_brigade *b,
apr_brigade_flush flush,
void *ctx,
const struct iovec *vec,
apr_size_t nvec);
/**
* This function writes a string into a bucket brigade.
* @param bb The bucket brigade to add to
* @param flush The flush function to use if the brigade is full
* @param ctx The structure to pass to the flush function
* @param str The string to add
* @return APR_SUCCESS or error code
*/
APU_DECLARE(apr_status_t) apr_brigade_puts(apr_bucket_brigade *bb,
apr_brigade_flush flush, void *ctx,
const char *str);
/**
* This function writes a character into a bucket brigade.
* @param b The bucket brigade to add to
* @param flush The flush function to use if the brigade is full
* @param ctx The structure to pass to the flush function
* @param c The character to add
* @return APR_SUCCESS or error code
*/
APU_DECLARE(apr_status_t) apr_brigade_putc(apr_bucket_brigade *b,
apr_brigade_flush flush, void *ctx,
const char c);
/**
* This function writes an unspecified number of strings into a bucket brigade.
* @param b The bucket brigade to add to
* @param flush The flush function to use if the brigade is full
* @param ctx The structure to pass to the flush function
* @param ... The strings to add
* @return APR_SUCCESS or error code
*/
APU_DECLARE_NONSTD(apr_status_t) apr_brigade_putstrs(apr_bucket_brigade *b,
apr_brigade_flush flush,
void *ctx, ...);
/**
* Evaluate a printf and put the resulting string at the end
* of the bucket brigade.
* @param b The brigade to write to
* @param flush The flush function to use if the brigade is full
* @param ctx The structure to pass to the flush function
* @param fmt The format of the string to write
* @param ... The arguments to fill out the format
* @return APR_SUCCESS or error code
*/
APU_DECLARE_NONSTD(apr_status_t) apr_brigade_printf(apr_bucket_brigade *b,
apr_brigade_flush flush,
void *ctx,
const char *fmt, ...)
__attribute__((format(printf,4,5)));
/**
* Evaluate a printf and put the resulting string at the end
* of the bucket brigade.
* @param b The brigade to write to
* @param flush The flush function to use if the brigade is full
* @param ctx The structure to pass to the flush function
* @param fmt The format of the string to write
* @param va The arguments to fill out the format
* @return APR_SUCCESS or error code
*/
APU_DECLARE(apr_status_t) apr_brigade_vprintf(apr_bucket_brigade *b,
apr_brigade_flush flush,
void *ctx,
const char *fmt, va_list va);
/**
* Utility function to insert a file (or a segment of a file) onto the
* end of the brigade. The file is split into multiple buckets if it
* is larger than the maximum size which can be represented by a
* single bucket.
* @param bb the brigade to insert into
* @param f the file to insert
* @param start the offset of the start of the segment
* @param len the length of the segment of the file to insert
* @param p pool from which file buckets are allocated
* @return the last bucket inserted
*/
APU_DECLARE(apr_bucket *) apr_brigade_insert_file(apr_bucket_brigade *bb,
apr_file_t *f,
apr_off_t start,
apr_off_t len,
apr_pool_t *p);
/* ***** Bucket freelist functions ***** */
/**
* Create a bucket allocator.
* @param p This pool's underlying apr_allocator_t is used to allocate memory
* for the bucket allocator. When the pool is destroyed, the bucket
* allocator's cleanup routine will free all memory that has been
* allocated from it.
* @remark The reason the allocator gets its memory from the pool's
* apr_allocator_t rather than from the pool itself is because
* the bucket allocator will free large memory blocks back to the
* allocator when it's done with them, thereby preventing memory
* footprint growth that would occur if we allocated from the pool.
* @warning The allocator must never be used by more than one thread at a time.
*/
APU_DECLARE_NONSTD(apr_bucket_alloc_t *) apr_bucket_alloc_create(apr_pool_t *p);
/**
* Create a bucket allocator.
* @param allocator This apr_allocator_t is used to allocate both the bucket
* allocator and all memory handed out by the bucket allocator. The
* caller is responsible for destroying the bucket allocator and the
* apr_allocator_t -- no automatic cleanups will happen.
* @warning The allocator must never be used by more than one thread at a time.
*/
APU_DECLARE_NONSTD(apr_bucket_alloc_t *) apr_bucket_alloc_create_ex(apr_allocator_t *allocator);
/**
* Destroy a bucket allocator.
* @param list The allocator to be destroyed
*/
APU_DECLARE_NONSTD(void) apr_bucket_alloc_destroy(apr_bucket_alloc_t *list);
/**
* Get the aligned size corresponding to the requested size, but minus the
* allocator(s) overhead such that the allocation would remain in the
* same boundary.
* @param list The allocator from which to the memory would be allocated.
* @param size The requested size.
* @return The corresponding aligned/floored size.
*/
APU_DECLARE_NONSTD(apr_size_t) apr_bucket_alloc_aligned_floor(apr_bucket_alloc_t *list,
apr_size_t size)
__attribute__((nonnull(1)));
/**
* Allocate memory for use by the buckets.
* @param size The amount to allocate.
* @param list The allocator from which to allocate the memory.
*/
APU_DECLARE_NONSTD(void *) apr_bucket_alloc(apr_size_t size, apr_bucket_alloc_t *list);
/**
* Free memory previously allocated with apr_bucket_alloc().
* @param block The block of memory to be freed.
*/
APU_DECLARE_NONSTD(void) apr_bucket_free(void *block);
/* ***** Bucket Functions ***** */
/**
* Free the resources used by a bucket. If multiple buckets refer to
* the same resource it is freed when the last one goes away.
* @see apr_bucket_delete()
* @param e The bucket to destroy
*/
#define apr_bucket_destroy(e) do { \
apr_bucket *apr__d = (e); \
apr__d->type->destroy(apr__d->data); \
apr__d->free(apr__d); \
} while (0)
/**
* Delete a bucket by removing it from its brigade (if any) and then
* destroying it.
* @remark This mainly acts as an aid in avoiding code verbosity. It is
* the preferred exact equivalent to:
* <pre>
* APR_BUCKET_REMOVE(e);
* apr_bucket_destroy(e);
* </pre>
* @param e The bucket to delete
*/
#define apr_bucket_delete(e) do { \
apr_bucket *apr__b = (e); \
APR_BUCKET_REMOVE(apr__b); \
apr_bucket_destroy(apr__b); \
} while (0)
/**
* Read some data from the bucket.
*
* The apr_bucket_read function returns a convenient amount of data
* from the bucket provided, writing the address and length of the
* data to the pointers provided by the caller. The function tries
* as hard as possible to avoid a memory copy.
*
* Buckets are expected to be a member of a brigade at the time they
* are read.
*
* In typical application code, buckets are read in a loop, and after
* each bucket is read and processed, it is moved or deleted from the
* brigade and the next bucket read.
*
* The definition of "convenient" depends on the type of bucket that
* is being read, and is decided by APR. In the case of memory based
* buckets such as heap and immortal buckets, a pointer will be
* returned to the location of the buffer containing the complete
* contents of the bucket.
*
* Some buckets, such as the socket bucket, might have no concept
* of length. If an attempt is made to read such a bucket, the
* apr_bucket_read function will read a convenient amount of data
* from the socket. The socket bucket is magically morphed into a
* heap bucket containing the just-read data, and a new socket bucket
* is inserted just after this heap bucket.
*
* To understand why apr_bucket_read might do this, consider the loop
* described above to read and process buckets. The current bucket
* is magically morphed into a heap bucket and returned to the caller.
* The caller processes the data, and deletes the heap bucket, moving
* onto the next bucket, the new socket bucket. This process repeats,
* giving the illusion of a bucket brigade that contains potentially
* infinite amounts of data. It is up to the caller to decide at what
* point to stop reading buckets.
*
* Some buckets, such as the file bucket, might have a fixed size,
* but be significantly larger than is practical to store in RAM in
* one go. As with the socket bucket, if an attempt is made to read
* from a file bucket, the file bucket is magically morphed into a
* heap bucket containing a convenient amount of data read from the
* current offset in the file. During the read, the offset will be
* moved forward on the file, and a new file bucket will be inserted
* directly after the current bucket representing the remainder of the
* file. If the heap bucket was large enough to store the whole
* remainder of the file, no more file buckets are inserted, and the
* file bucket will disappear completely.
*
* The pattern for reading buckets described above does create the
* illusion that the code is willing to swallow buckets that might be
* too large for the system to handle in one go. This however is just
* an illusion: APR will always ensure that large (file) or infinite
* (socket) buckets are broken into convenient bite sized heap buckets
* before data is returned to the caller.
*
* There is a potential gotcha to watch for: if buckets are read in a
* loop, and aren't deleted after being processed, the potentially large
* bucket will slowly be converted into RAM resident heap buckets. If
* the file is larger than available RAM, an out of memory condition
* could be caused if the application is not careful to manage this.
*
* @param e The bucket to read from
* @param str The location to store a pointer to the data in
* @param len The location to store the amount of data read
* @param block Whether the read function blocks
*/
#define apr_bucket_read(e,str,len,block) (e)->type->read(e, str, len, block)
/**
* Setaside data so that stack data is not destroyed on returning from
* the function
* @param e The bucket to setaside
* @param p The pool to setaside into
*/
#define apr_bucket_setaside(e,p) (e)->type->setaside(e,p)
/**
* Split one bucket in two at the point provided.
*
* Once split, the original bucket becomes the first of the two new buckets.
*
* (It is assumed that the bucket is a member of a brigade when this
* function is called).
* @param e The bucket to split
* @param point The offset to split the bucket at
*/
#define apr_bucket_split(e,point) (e)->type->split(e, point)
/**
* Copy a bucket.
* @param e The bucket to copy
* @param c Returns a pointer to the new bucket
*/
#define apr_bucket_copy(e,c) (e)->type->copy(e, c)
/* Bucket type handling */
/**
* This function simply returns APR_SUCCESS to denote that the bucket does
* not require anything to happen for its setaside() function. This is
* appropriate for buckets that have "immortal" data -- the data will live
* at least as long as the bucket.
* @param data The bucket to setaside
* @param pool The pool defining the desired lifetime of the bucket data
* @return APR_SUCCESS
*/
APU_DECLARE_NONSTD(apr_status_t) apr_bucket_setaside_noop(apr_bucket *data,
apr_pool_t *pool);
/**
* A place holder function that signifies that the setaside function was not
* implemented for this bucket
* @param data The bucket to setaside
* @param pool The pool defining the desired lifetime of the bucket data
* @return APR_ENOTIMPL
*/
APU_DECLARE_NONSTD(apr_status_t) apr_bucket_setaside_notimpl(apr_bucket *data,
apr_pool_t *pool);
/**
* A place holder function that signifies that the split function was not
* implemented for this bucket
* @param data The bucket to split
* @param point The location to split the bucket
* @return APR_ENOTIMPL
*/
APU_DECLARE_NONSTD(apr_status_t) apr_bucket_split_notimpl(apr_bucket *data,
apr_size_t point);
/**
* A place holder function that signifies that the copy function was not
* implemented for this bucket
* @param e The bucket to copy
* @param c Returns a pointer to the new bucket
* @return APR_ENOTIMPL
*/
APU_DECLARE_NONSTD(apr_status_t) apr_bucket_copy_notimpl(apr_bucket *e,
apr_bucket **c);
/**
* A place holder function that signifies that this bucket does not need
* to do anything special to be destroyed. That's only the case for buckets
* that either have no data (metadata buckets) or buckets whose data pointer
* points to something that's not a bucket-type-specific structure, as with
* simple buckets where data points to a string and pipe buckets where data
* points directly to the apr_file_t.
* @param data The bucket data to destroy
*/
APU_DECLARE_NONSTD(void) apr_bucket_destroy_noop(void *data);
/**
* There is no apr_bucket_destroy_notimpl, because destruction is required
* to be implemented (it could be a noop, but only if that makes sense for
* the bucket type)
*/
/* There is no apr_bucket_read_notimpl, because it is a required function
*/
/* All of the bucket types implemented by the core */
/**
* The flush bucket type. This signifies that all data should be flushed to
* the next filter. The flush bucket should be sent with the other buckets.
*/
APU_DECLARE_DATA extern const apr_bucket_type_t apr_bucket_type_flush;
/**
* The EOS bucket type. This signifies that there will be no more data, ever.
* All filters MUST send all data to the next filter when they receive a
* bucket of this type
*/
APU_DECLARE_DATA extern const apr_bucket_type_t apr_bucket_type_eos;
/**
* The FILE bucket type. This bucket represents a file on disk
*/
APU_DECLARE_DATA extern const apr_bucket_type_t apr_bucket_type_file;
/**
* The HEAP bucket type. This bucket represents a data allocated from the
* heap.
*/
APU_DECLARE_DATA extern const apr_bucket_type_t apr_bucket_type_heap;
#if APR_HAS_MMAP
/**
* The MMAP bucket type. This bucket represents an MMAP'ed file
*/
APU_DECLARE_DATA extern const apr_bucket_type_t apr_bucket_type_mmap;
#endif
/**
* The POOL bucket type. This bucket represents a data that was allocated
* from a pool. IF this bucket is still available when the pool is cleared,
* the data is copied on to the heap.
*/
APU_DECLARE_DATA extern const apr_bucket_type_t apr_bucket_type_pool;
/**
* The PIPE bucket type. This bucket represents a pipe to another program.
*/
APU_DECLARE_DATA extern const apr_bucket_type_t apr_bucket_type_pipe;
/**
* The IMMORTAL bucket type. This bucket represents a segment of data that
* the creator is willing to take responsibility for. The core will do
* nothing with the data in an immortal bucket
*/
APU_DECLARE_DATA extern const apr_bucket_type_t apr_bucket_type_immortal;
/**
* The TRANSIENT bucket type. This bucket represents a data allocated off
* the stack. When the setaside function is called, this data is copied on
* to the heap
*/
APU_DECLARE_DATA extern const apr_bucket_type_t apr_bucket_type_transient;
/**
* The SOCKET bucket type. This bucket represents a socket to another machine
*/
APU_DECLARE_DATA extern const apr_bucket_type_t apr_bucket_type_socket;
/* ***** Simple buckets ***** */
/**
* Split a simple bucket into two at the given point. Most non-reference
* counting buckets that allow multiple references to the same block of
* data (eg transient and immortal) will use this as their split function
* without any additional type-specific handling.
* @param b The bucket to be split
* @param point The offset of the first byte in the new bucket
* @return APR_EINVAL if the point is not within the bucket;
* APR_ENOMEM if allocation failed;
* or APR_SUCCESS
*/
APU_DECLARE_NONSTD(apr_status_t) apr_bucket_simple_split(apr_bucket *b,
apr_size_t point);
/**
* Copy a simple bucket. Most non-reference-counting buckets that allow
* multiple references to the same block of data (eg transient and immortal)
* will use this as their copy function without any additional type-specific
* handling.
* @param a The bucket to copy
* @param b Returns a pointer to the new bucket
* @return APR_ENOMEM if allocation failed;
* or APR_SUCCESS
*/
APU_DECLARE_NONSTD(apr_status_t) apr_bucket_simple_copy(apr_bucket *a,
apr_bucket **b);
/* ***** Shared, reference-counted buckets ***** */
/**
* Initialize a bucket containing reference-counted data that may be
* shared. The caller must allocate the bucket if necessary and
* initialize its type-dependent fields, and allocate and initialize
* its own private data structure. This function should only be called
* by type-specific bucket creation functions.
* @param b The bucket to initialize
* @param data A pointer to the private data structure
* with the reference count at the start
* @param start The start of the data in the bucket
* relative to the private base pointer
* @param length The length of the data in the bucket
* @return The new bucket, or NULL if allocation failed
*/
APU_DECLARE(apr_bucket *) apr_bucket_shared_make(apr_bucket *b, void *data,
apr_off_t start,
apr_size_t length);
/**
* Decrement the refcount of the data in the bucket. This function
* should only be called by type-specific bucket destruction functions.
* @param data The private data pointer from the bucket to be destroyed
* @return TRUE or FALSE; TRUE if the reference count is now
* zero, indicating that the shared resource itself can
* be destroyed by the caller.
*/
APU_DECLARE(int) apr_bucket_shared_destroy(void *data);
/**
* Split a bucket into two at the given point, and adjust the refcount
* to the underlying data. Most reference-counting bucket types will
* be able to use this function as their split function without any
* additional type-specific handling.
* @param b The bucket to be split
* @param point The offset of the first byte in the new bucket
* @return APR_EINVAL if the point is not within the bucket;
* APR_ENOMEM if allocation failed;
* or APR_SUCCESS
*/
APU_DECLARE_NONSTD(apr_status_t) apr_bucket_shared_split(apr_bucket *b,
apr_size_t point);
/**
* Copy a refcounted bucket, incrementing the reference count. Most
* reference-counting bucket types will be able to use this function
* as their copy function without any additional type-specific handling.
* @param a The bucket to copy
* @param b Returns a pointer to the new bucket
* @return APR_ENOMEM if allocation failed;
or APR_SUCCESS
*/
APU_DECLARE_NONSTD(apr_status_t) apr_bucket_shared_copy(apr_bucket *a,
apr_bucket **b);
/* ***** Functions to Create Buckets of varying types ***** */
/*
* Each bucket type foo has two initialization functions:
* apr_bucket_foo_make which sets up some already-allocated memory as a
* bucket of type foo; and apr_bucket_foo_create which allocates memory
* for the bucket, calls apr_bucket_make_foo, and initializes the
* bucket's list pointers. The apr_bucket_foo_make functions are used
* inside the bucket code to change the type of buckets in place;
* other code should call apr_bucket_foo_create. All the initialization
* functions change nothing if they fail.
*/
/**
* Create an End of Stream bucket. This indicates that there is no more data
* coming from down the filter stack. All filters should flush at this point.
* @param list The freelist from which this bucket should be allocated
* @return The new bucket, or NULL if allocation failed
*/
APU_DECLARE(apr_bucket *) apr_bucket_eos_create(apr_bucket_alloc_t *list);
/**
* Make the bucket passed in an EOS bucket. This indicates that there is no
* more data coming from down the filter stack. All filters should flush at
* this point.
* @param b The bucket to make into an EOS bucket
* @return The new bucket, or NULL if allocation failed
*/
APU_DECLARE(apr_bucket *) apr_bucket_eos_make(apr_bucket *b);
/**
* Create a flush bucket. This indicates that filters should flush their
* data. There is no guarantee that they will flush it, but this is the
* best we can do.
* @param list The freelist from which this bucket should be allocated
* @return The new bucket, or NULL if allocation failed
*/
APU_DECLARE(apr_bucket *) apr_bucket_flush_create(apr_bucket_alloc_t *list);
/**
* Make the bucket passed in a FLUSH bucket. This indicates that filters
* should flush their data. There is no guarantee that they will flush it,
* but this is the best we can do.
* @param b The bucket to make into a FLUSH bucket
* @return The new bucket, or NULL if allocation failed
*/
APU_DECLARE(apr_bucket *) apr_bucket_flush_make(apr_bucket *b);
/**
* Create a bucket referring to long-lived data.
* @param buf The data to insert into the bucket
* @param nbyte The size of the data to insert.
* @param list The freelist from which this bucket should be allocated
* @return The new bucket, or NULL if allocation failed
*/
APU_DECLARE(apr_bucket *) apr_bucket_immortal_create(const char *buf,
apr_size_t nbyte,
apr_bucket_alloc_t *list);
/**
* Make the bucket passed in a bucket refer to long-lived data
* @param b The bucket to make into a IMMORTAL bucket
* @param buf The data to insert into the bucket
* @param nbyte The size of the data to insert.
* @return The new bucket, or NULL if allocation failed
*/
APU_DECLARE(apr_bucket *) apr_bucket_immortal_make(apr_bucket *b,
const char *buf,
apr_size_t nbyte);
/**
* Create a bucket referring to data on the stack.
* @param buf The data to insert into the bucket
* @param nbyte The size of the data to insert.
* @param list The freelist from which this bucket should be allocated
* @return The new bucket, or NULL if allocation failed
*/
APU_DECLARE(apr_bucket *) apr_bucket_transient_create(const char *buf,
apr_size_t nbyte,
apr_bucket_alloc_t *list);
/**
* Make the bucket passed in a bucket refer to stack data
* @param b The bucket to make into a TRANSIENT bucket
* @param buf The data to insert into the bucket
* @param nbyte The size of the data to insert.
* @return The new bucket, or NULL if allocation failed
*/
APU_DECLARE(apr_bucket *) apr_bucket_transient_make(apr_bucket *b,
const char *buf,
apr_size_t nbyte);
/**
* Create a bucket referring to memory on the heap. If the caller asks
* for the data to be copied, this function always allocates 4K of
* memory so that more data can be added to the bucket without
* requiring another allocation. Therefore not all the data may be put
* into the bucket. If copying is not requested then the bucket takes
* over responsibility for free()ing the memory.
* @param buf The buffer to insert into the bucket
* @param nbyte The size of the buffer to insert.
* @param free_func Function to use to free the data; NULL indicates that the
* bucket should make a copy of the data
* @param list The freelist from which this bucket should be allocated
* @return The new bucket, or NULL if allocation failed
*/
APU_DECLARE(apr_bucket *) apr_bucket_heap_create(const char *buf,
apr_size_t nbyte,
void (*free_func)(void *data),
apr_bucket_alloc_t *list);
/**
* Make the bucket passed in a bucket refer to heap data
* @param b The bucket to make into a HEAP bucket
* @param buf The buffer to insert into the bucket
* @param nbyte The size of the buffer to insert.
* @param free_func Function to use to free the data; NULL indicates that the
* bucket should make a copy of the data
* @return The new bucket, or NULL if allocation failed
*/
APU_DECLARE(apr_bucket *) apr_bucket_heap_make(apr_bucket *b, const char *buf,
apr_size_t nbyte,
void (*free_func)(void *data));
/**
* Create a bucket referring to memory allocated from a pool.
*
* @param buf The buffer to insert into the bucket
* @param length The number of bytes referred to by this bucket
* @param pool The pool the memory was allocated from
* @param list The freelist from which this bucket should be allocated
* @return The new bucket, or NULL if allocation failed
*/
APU_DECLARE(apr_bucket *) apr_bucket_pool_create(const char *buf,
apr_size_t length,
apr_pool_t *pool,
apr_bucket_alloc_t *list);
/**
* Make the bucket passed in a bucket refer to pool data
* @param b The bucket to make into a pool bucket
* @param buf The buffer to insert into the bucket
* @param length The number of bytes referred to by this bucket
* @param pool The pool the memory was allocated from
* @return The new bucket, or NULL if allocation failed
*/
APU_DECLARE(apr_bucket *) apr_bucket_pool_make(apr_bucket *b, const char *buf,
apr_size_t length,
apr_pool_t *pool);
#if APR_HAS_MMAP
/**
* Create a bucket referring to mmap()ed memory.
* @param mm The mmap to insert into the bucket
* @param start The offset of the first byte in the mmap
* that this bucket refers to
* @param length The number of bytes referred to by this bucket
* @param list The freelist from which this bucket should be allocated
* @return The new bucket, or NULL if allocation failed
*/
APU_DECLARE(apr_bucket *) apr_bucket_mmap_create(apr_mmap_t *mm,
apr_off_t start,
apr_size_t length,
apr_bucket_alloc_t *list);
/**
* Make the bucket passed in a bucket refer to an MMAP'ed file
* @param b The bucket to make into a MMAP bucket
* @param mm The mmap to insert into the bucket
* @param start The offset of the first byte in the mmap
* that this bucket refers to
* @param length The number of bytes referred to by this bucket
* @return The new bucket, or NULL if allocation failed
*/
APU_DECLARE(apr_bucket *) apr_bucket_mmap_make(apr_bucket *b, apr_mmap_t *mm,
apr_off_t start,
apr_size_t length);
#endif
/**
* Create a bucket referring to a socket.
* @param thissock The socket to put in the bucket
* @param list The freelist from which this bucket should be allocated
* @return The new bucket, or NULL if allocation failed
*/
APU_DECLARE(apr_bucket *) apr_bucket_socket_create(apr_socket_t *thissock,
apr_bucket_alloc_t *list);
/**
* Make the bucket passed in a bucket refer to a socket
* @param b The bucket to make into a SOCKET bucket
* @param thissock The socket to put in the bucket
* @return The new bucket, or NULL if allocation failed
*/
APU_DECLARE(apr_bucket *) apr_bucket_socket_make(apr_bucket *b,
apr_socket_t *thissock);
/**
* Create a bucket referring to a pipe.
* @param thispipe The pipe to put in the bucket
* @param list The freelist from which this bucket should be allocated
* @return The new bucket, or NULL if allocation failed
*/
APU_DECLARE(apr_bucket *) apr_bucket_pipe_create(apr_file_t *thispipe,
apr_bucket_alloc_t *list);
/**
* Make the bucket passed in a bucket refer to a pipe
* @param b The bucket to make into a PIPE bucket
* @param thispipe The pipe to put in the bucket
* @return The new bucket, or NULL if allocation failed
*/
APU_DECLARE(apr_bucket *) apr_bucket_pipe_make(apr_bucket *b,
apr_file_t *thispipe);
/**
* Create a bucket referring to a file.
* @param fd The file to put in the bucket
* @param offset The offset where the data of interest begins in the file
* @param len The amount of data in the file we are interested in
* @param p The pool into which any needed structures should be created
* while reading from this file bucket
* @param list The freelist from which this bucket should be allocated
* @return The new bucket, or NULL if allocation failed
* @remark If the file is truncated such that the segment of the file
* referenced by the bucket no longer exists, an attempt to read
* from the bucket will fail with APR_EOF.
* @remark apr_brigade_insert_file() should generally be used to
* insert files into brigades, since that function can correctly
* handle large file issues.
*/
APU_DECLARE(apr_bucket *) apr_bucket_file_create(apr_file_t *fd,
apr_off_t offset,
apr_size_t len,
apr_pool_t *p,
apr_bucket_alloc_t *list);
/**
* Make the bucket passed in a bucket refer to a file
* @param b The bucket to make into a FILE bucket
* @param fd The file to put in the bucket
* @param offset The offset where the data of interest begins in the file
* @param len The amount of data in the file we are interested in
* @param p The pool into which any needed structures should be created
* while reading from this file bucket
* @return The new bucket, or NULL if allocation failed
*/
APU_DECLARE(apr_bucket *) apr_bucket_file_make(apr_bucket *b, apr_file_t *fd,
apr_off_t offset,
apr_size_t len, apr_pool_t *p);
/**
* Enable or disable memory-mapping for a FILE bucket (default is enabled)
* @param b The bucket
* @param enabled Whether memory-mapping should be enabled
* @return APR_SUCCESS normally, or an error code if the operation fails
*/
APU_DECLARE(apr_status_t) apr_bucket_file_enable_mmap(apr_bucket *b,
int enabled);
/**
* Set the size of the read buffer allocated by a FILE bucket (default
* is @a APR_BUCKET_BUFF_SIZE)
* memory-mapping is disabled only)
* @param b The bucket
* @param size Size of the allocated buffers
* @return APR_SUCCESS normally, or an error code if the operation fails
* @remark Relevant/used only when memory-mapping is disabled (@see
* apr_bucket_file_enable_mmap)
*/
APU_DECLARE(apr_status_t) apr_bucket_file_set_buf_size(apr_bucket *b,
apr_size_t size);
/** @} */
#ifdef __cplusplus
}
#endif
#endif /* !APR_BUCKETS_H */
PK a��Z�Nz�| | include/apr-1/apr.hnu �[��� /* This file is here to prevent a file conflict on multiarch systems. A
* conflict will occur because apr.h has arch-specific definitions.
*
* DO NOT INCLUDE THE NEW FILE DIRECTLY -- ALWAYS INCLUDE THIS ONE INSTEAD. */
#if defined(__i386__)
#include "apr-i386.h"
#elif defined(__ia64__)
#include "apr-ia64.h"
#elif defined(__powerpc64__)
#include "apr-ppc64.h"
#elif defined(__powerpc__)
#include "apr-ppc.h"
#elif defined(__s390x__)
#include "apr-s390x.h"
#elif defined(__s390__)
#include "apr-s390.h"
#elif defined(__x86_64__)
#include "apr-x86_64.h"
#else
#error "This apr-devel package does not work your architecture?"
#endif
PK a��Z0��R( R( include/apr-1/apr_hash.hnu �[��� /* 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 */
PK a��Z�RښK �K include/apr-1/apr_tables.hnu �[��� /* 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 */
PK a��Z����� � include/apr-1/apr_anylock.hnu �[��� /* 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 */
PK a��Z�~��� � include/apr-1/apr_md4.hnu �[��� /* 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 */
PK a��Z���� � include/apr-1/apr_global_mutex.hnu �[��� /* 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 */
PK a��Z��J*� � include/apr-1/apr_want.hnu �[��� /* 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
/* --------------------------------------------------------------------- */
PK a��Z�S�% % include/apr-1/apr_shm.hnu �[��� /* 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 */
PK a��Z2�J� include/apr-1/apr_base64.hnu �[��� /* 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 */
PK a��Z�_aO�� �� include/apr-1/apr_file_io.hnu �[��� /* 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_IO_H
#define APR_FILE_IO_H
/**
* @file apr_file_io.h
* @brief APR File I/O Handling
*/
#include "apr.h"
#include "apr_pools.h"
#include "apr_time.h"
#include "apr_errno.h"
#include "apr_file_info.h"
#include "apr_inherit.h"
#define APR_WANT_STDIO /**< for SEEK_* */
#define APR_WANT_IOVEC /**< for apr_file_writev */
#include "apr_want.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/**
* @defgroup apr_file_io File I/O Handling Functions
* @ingroup APR
* @{
*/
/**
* @defgroup apr_file_open_flags File Open Flags/Routines
* @{
*/
/* Note to implementors: Values in the range 0x00100000--0x80000000
are reserved for platform-specific values. */
#define APR_FOPEN_READ 0x00001 /**< Open the file for reading */
#define APR_FOPEN_WRITE 0x00002 /**< Open the file for writing */
#define APR_FOPEN_CREATE 0x00004 /**< Create the file if not there */
#define APR_FOPEN_APPEND 0x00008 /**< Append to the end of the file */
#define APR_FOPEN_TRUNCATE 0x00010 /**< Open the file and truncate
to 0 length */
#define APR_FOPEN_BINARY 0x00020 /**< Open the file in binary mode
(This flag is ignored on UNIX
because it has no meaning)*/
#define APR_FOPEN_EXCL 0x00040 /**< Open should fail if #APR_FOPEN_CREATE
and file exists. */
#define APR_FOPEN_BUFFERED 0x00080 /**< Open the file for buffered I/O */
#define APR_FOPEN_DELONCLOSE 0x00100 /**< Delete the file after close */
#define APR_FOPEN_XTHREAD 0x00200 /**< Platform dependent tag to open
the file for use across multiple
threads */
#define APR_FOPEN_SHARELOCK 0x00400 /**< Platform dependent support for
higher level locked read/write
access to support writes across
process/machines */
#define APR_FOPEN_NOCLEANUP 0x00800 /**< Do not register a cleanup
when the file is opened. The
apr_os_file_t handle in apr_file_t
will not be closed when the pool
is destroyed. */
#define APR_FOPEN_SENDFILE_ENABLED 0x01000 /**< Advisory flag that this
file should support
apr_socket_sendfile operation */
#define APR_FOPEN_LARGEFILE 0x04000 /**< Platform dependent flag to enable
* large file support, see WARNING below
*/
#define APR_FOPEN_SPARSE 0x08000 /**< Platform dependent flag to enable
* sparse file support, see WARNING below
*/
#define APR_FOPEN_NONBLOCK 0x40000 /**< Platform dependent flag to enable
* non blocking file io */
/* backcompat */
#define APR_READ APR_FOPEN_READ /**< @deprecated @see APR_FOPEN_READ */
#define APR_WRITE APR_FOPEN_WRITE /**< @deprecated @see APR_FOPEN_WRITE */
#define APR_CREATE APR_FOPEN_CREATE /**< @deprecated @see APR_FOPEN_CREATE */
#define APR_APPEND APR_FOPEN_APPEND /**< @deprecated @see APR_FOPEN_APPEND */
#define APR_TRUNCATE APR_FOPEN_TRUNCATE /**< @deprecated @see APR_FOPEN_TRUNCATE */
#define APR_BINARY APR_FOPEN_BINARY /**< @deprecated @see APR_FOPEN_BINARY */
#define APR_EXCL APR_FOPEN_EXCL /**< @deprecated @see APR_FOPEN_EXCL */
#define APR_BUFFERED APR_FOPEN_BUFFERED /**< @deprecated @see APR_FOPEN_BUFFERED */
#define APR_DELONCLOSE APR_FOPEN_DELONCLOSE /**< @deprecated @see APR_FOPEN_DELONCLOSE */
#define APR_XTHREAD APR_FOPEN_XTHREAD /**< @deprecated @see APR_FOPEN_XTHREAD */
#define APR_SHARELOCK APR_FOPEN_SHARELOCK /**< @deprecated @see APR_FOPEN_SHARELOCK */
#define APR_FILE_NOCLEANUP APR_FOPEN_NOCLEANUP /**< @deprecated @see APR_FOPEN_NOCLEANUP */
#define APR_SENDFILE_ENABLED APR_FOPEN_SENDFILE_ENABLED /**< @deprecated @see APR_FOPEN_SENDFILE_ENABLED */
#define APR_LARGEFILE APR_FOPEN_LARGEFILE /**< @deprecated @see APR_FOPEN_LARGEFILE */
/** @def APR_FOPEN_LARGEFILE
* @warning APR_FOPEN_LARGEFILE flag only has effect on some
* platforms where sizeof(apr_off_t) == 4. Where implemented, it
* allows opening and writing to a file which exceeds the size which
* can be represented by apr_off_t (2 gigabytes). When a file's size
* does exceed 2Gb, apr_file_info_get() will fail with an error on the
* descriptor, likewise apr_stat()/apr_lstat() will fail on the
* filename. apr_dir_read() will fail with #APR_INCOMPLETE on a
* directory entry for a large file depending on the particular
* APR_FINFO_* flags. Generally, it is not recommended to use this
* flag.
*
* @def APR_FOPEN_SPARSE
* @warning APR_FOPEN_SPARSE may, depending on platform, convert a
* normal file to a sparse file. Some applications may be unable
* to decipher a sparse file, so it's critical that the sparse file
* flag should only be used for files accessed only by APR or other
* applications known to be able to decipher them. APR does not
* guarantee that it will compress the file into sparse segments
* if it was previously created and written without the sparse flag.
* On platforms which do not understand, or on file systems which
* cannot handle sparse files, the flag is ignored by apr_file_open().
*
* @def APR_FOPEN_NONBLOCK
* @warning APR_FOPEN_NONBLOCK is not implemented on all platforms.
* Callers should be prepared for it to fail with #APR_ENOTIMPL.
*/
/** @} */
/**
* @defgroup apr_file_seek_flags File Seek Flags
* @{
*/
/* flags for apr_file_seek */
/** Set the file position */
#define APR_SET SEEK_SET
/** Current */
#define APR_CUR SEEK_CUR
/** Go to end of file */
#define APR_END SEEK_END
/** @} */
/**
* @defgroup apr_file_attrs_set_flags File Attribute Flags
* @{
*/
/* flags for apr_file_attrs_set */
#define APR_FILE_ATTR_READONLY 0x01 /**< File is read-only */
#define APR_FILE_ATTR_EXECUTABLE 0x02 /**< File is executable */
#define APR_FILE_ATTR_HIDDEN 0x04 /**< File is hidden */
/** @} */
/**
* @defgroup apr_file_writev{_full} max iovec size
* @{
*/
#if defined(DOXYGEN)
#define APR_MAX_IOVEC_SIZE 1024 /**< System dependent maximum
size of an iovec array */
#elif defined(IOV_MAX)
#define APR_MAX_IOVEC_SIZE IOV_MAX
#elif defined(MAX_IOVEC)
#define APR_MAX_IOVEC_SIZE MAX_IOVEC
#else
#define APR_MAX_IOVEC_SIZE 1024
#endif
/** @} */
/** File attributes */
typedef apr_uint32_t apr_fileattrs_t;
/** Type to pass as whence argument to apr_file_seek. */
typedef int apr_seek_where_t;
/**
* Structure for referencing files.
*/
typedef struct apr_file_t apr_file_t;
/* File lock types/flags */
/**
* @defgroup apr_file_lock_types File Lock Types
* @{
*/
#define APR_FLOCK_SHARED 1 /**< Shared lock. More than one process
or thread can hold a shared lock
at any given time. Essentially,
this is a "read lock", preventing
writers from establishing an
exclusive lock. */
#define APR_FLOCK_EXCLUSIVE 2 /**< Exclusive lock. Only one process
may hold an exclusive lock at any
given time. This is analogous to
a "write lock". */
#define APR_FLOCK_TYPEMASK 0x000F /**< mask to extract lock type */
#define APR_FLOCK_NONBLOCK 0x0010 /**< do not block while acquiring the
file lock */
/** @} */
/**
* Open the specified file.
* @param newf The opened file descriptor.
* @param fname The full path to the file (using / on all systems)
* @param flag Or'ed value of:
* @li #APR_FOPEN_READ open for reading
* @li #APR_FOPEN_WRITE open for writing
* @li #APR_FOPEN_CREATE create the file if not there
* @li #APR_FOPEN_APPEND file ptr is set to end prior to all writes
* @li #APR_FOPEN_TRUNCATE set length to zero if file exists
* @li #APR_FOPEN_BINARY not a text file
* @li #APR_FOPEN_BUFFERED buffer the data. Default is non-buffered
* @li #APR_FOPEN_EXCL return error if #APR_FOPEN_CREATE and file exists
* @li #APR_FOPEN_DELONCLOSE delete the file after closing
* @li #APR_FOPEN_XTHREAD Platform dependent tag to open the file
* for use across multiple threads
* @li #APR_FOPEN_SHARELOCK Platform dependent support for higher
* level locked read/write access to support
* writes across process/machines
* @li #APR_FOPEN_NOCLEANUP Do not register a cleanup with the pool
* passed in on the @a pool argument (see below)
* @li #APR_FOPEN_SENDFILE_ENABLED Open with appropriate platform semantics
* for sendfile operations. Advisory only,
* apr_socket_sendfile does not check this flag
* @li #APR_FOPEN_LARGEFILE Platform dependent flag to enable large file
* support, see WARNING below
* @li #APR_FOPEN_SPARSE Platform dependent flag to enable sparse file
* support, see WARNING below
* @li #APR_FOPEN_NONBLOCK Platform dependent flag to enable
* non blocking file io
* @param perm Access permissions for file.
* @param pool The pool to use.
* @remark If perm is #APR_FPROT_OS_DEFAULT and the file is being created,
* appropriate default permissions will be used.
* @remark By default, the returned file descriptor will not be
* inherited by child processes created by apr_proc_create(). This
* can be changed using apr_file_inherit_set().
*/
APR_DECLARE(apr_status_t) apr_file_open(apr_file_t **newf, const char *fname,
apr_int32_t flag, apr_fileperms_t perm,
apr_pool_t *pool);
/**
* Close the specified file.
* @param file The file descriptor to close.
*/
APR_DECLARE(apr_status_t) apr_file_close(apr_file_t *file);
/**
* Delete the specified file.
* @param path The full path to the file (using / on all systems)
* @param pool The pool to use.
* @remark If the file is open, it won't be removed until all
* instances are closed.
*/
APR_DECLARE(apr_status_t) apr_file_remove(const char *path, apr_pool_t *pool);
/**
* Rename the specified file.
* @param from_path The full path to the original file (using / on all systems)
* @param to_path The full path to the new file (using / on all systems)
* @param pool The pool to use.
* @warning If a file exists at the new location, then it will be
* overwritten. Moving files or directories across devices may not be
* possible.
*/
APR_DECLARE(apr_status_t) apr_file_rename(const char *from_path,
const char *to_path,
apr_pool_t *pool);
/**
* Create a hard link to the specified file.
* @param from_path The full path to the original file (using / on all systems)
* @param to_path The full path to the new file (using / on all systems)
* @remark Both files must reside on the same device.
*/
APR_DECLARE(apr_status_t) apr_file_link(const char *from_path,
const char *to_path);
/**
* Copy the specified file to another file.
* @param from_path The full path to the original file (using / on all systems)
* @param to_path The full path to the new file (using / on all systems)
* @param perms Access permissions for the new file if it is created.
* In place of the usual or'd combination of file permissions, the
* value #APR_FPROT_FILE_SOURCE_PERMS may be given, in which case the source
* file's permissions are copied.
* @param pool The pool to use.
* @remark The new file does not need to exist, it will be created if required.
* @warning If the new file already exists, its contents will be overwritten.
*/
APR_DECLARE(apr_status_t) apr_file_copy(const char *from_path,
const char *to_path,
apr_fileperms_t perms,
apr_pool_t *pool);
/**
* Append the specified file to another file.
* @param from_path The full path to the source file (use / on all systems)
* @param to_path The full path to the destination file (use / on all systems)
* @param perms Access permissions for the destination file if it is created.
* In place of the usual or'd combination of file permissions, the
* value #APR_FPROT_FILE_SOURCE_PERMS may be given, in which case the source
* file's permissions are copied.
* @param pool The pool to use.
* @remark The new file does not need to exist, it will be created if required.
* @remark Note that advanced filesystem permissions such as ACLs are not
* duplicated by this API. The target permissions (including duplicating the
* source file permissions) are assigned only when the target file does not yet
* exist.
*/
APR_DECLARE(apr_status_t) apr_file_append(const char *from_path,
const char *to_path,
apr_fileperms_t perms,
apr_pool_t *pool);
/**
* Are we at the end of the file
* @param fptr The apr file we are testing.
* @remark Returns #APR_EOF if we are at the end of file, #APR_SUCCESS otherwise.
*/
APR_DECLARE(apr_status_t) apr_file_eof(apr_file_t *fptr);
/**
* Open standard error as an apr file pointer.
* @param thefile The apr file to use as stderr.
* @param pool The pool to allocate the file out of.
*
* @remark The only reason that the apr_file_open_std* functions exist
* is that you may not always have a stderr/out/in on Windows. This
* is generally a problem with newer versions of Windows and services.
*
* @remark The other problem is that the C library functions generally work
* differently on Windows and Unix. So, by using apr_file_open_std*
* functions, you can get a handle to an APR struct that works with
* the APR functions which are supposed to work identically on all
* platforms.
*/
APR_DECLARE(apr_status_t) apr_file_open_stderr(apr_file_t **thefile,
apr_pool_t *pool);
/**
* open standard output as an apr file pointer.
* @param thefile The apr file to use as stdout.
* @param pool The pool to allocate the file out of.
*
* @remark See remarks for apr_file_open_stderr().
*/
APR_DECLARE(apr_status_t) apr_file_open_stdout(apr_file_t **thefile,
apr_pool_t *pool);
/**
* open standard input as an apr file pointer.
* @param thefile The apr file to use as stdin.
* @param pool The pool to allocate the file out of.
*
* @remark See remarks for apr_file_open_stderr().
*/
APR_DECLARE(apr_status_t) apr_file_open_stdin(apr_file_t **thefile,
apr_pool_t *pool);
/**
* open standard error as an apr file pointer, with flags.
* @param thefile The apr file to use as stderr.
* @param flags The flags to open the file with. Only the
* @li #APR_FOPEN_EXCL
* @li #APR_FOPEN_BUFFERED
* @li #APR_FOPEN_XTHREAD
* @li #APR_FOPEN_SHARELOCK
* @li #APR_FOPEN_SENDFILE_ENABLED
* @li #APR_FOPEN_LARGEFILE
*
* flags should be used. The #APR_FOPEN_WRITE flag will
* be set unconditionally.
* @param pool The pool to allocate the file out of.
*
* @remark See remarks for apr_file_open_stderr().
*/
APR_DECLARE(apr_status_t) apr_file_open_flags_stderr(apr_file_t **thefile,
apr_int32_t flags,
apr_pool_t *pool);
/**
* open standard output as an apr file pointer, with flags.
* @param thefile The apr file to use as stdout.
* @param flags The flags to open the file with. Only the
* @li #APR_FOPEN_EXCL
* @li #APR_FOPEN_BUFFERED
* @li #APR_FOPEN_XTHREAD
* @li #APR_FOPEN_SHARELOCK
* @li #APR_FOPEN_SENDFILE_ENABLED
* @li #APR_FOPEN_LARGEFILE
*
* flags should be used. The #APR_FOPEN_WRITE flag will
* be set unconditionally.
* @param pool The pool to allocate the file out of.
*
* @remark See remarks for apr_file_open_stderr().
*/
APR_DECLARE(apr_status_t) apr_file_open_flags_stdout(apr_file_t **thefile,
apr_int32_t flags,
apr_pool_t *pool);
/**
* open standard input as an apr file pointer, with flags.
* @param thefile The apr file to use as stdin.
* @param flags The flags to open the file with. Only the
* @li #APR_FOPEN_EXCL
* @li #APR_FOPEN_BUFFERED
* @li #APR_FOPEN_XTHREAD
* @li #APR_FOPEN_SHARELOCK
* @li #APR_FOPEN_SENDFILE_ENABLED
* @li #APR_FOPEN_LARGEFILE
*
* flags should be used. The #APR_FOPEN_WRITE flag will
* be set unconditionally.
* @param pool The pool to allocate the file out of.
*
* @remark See remarks for apr_file_open_stderr().
*/
APR_DECLARE(apr_status_t) apr_file_open_flags_stdin(apr_file_t **thefile,
apr_int32_t flags,
apr_pool_t *pool);
/**
* Read data from the specified file.
* @param thefile The file descriptor to read from.
* @param buf The buffer to store the data to.
* @param nbytes On entry, the number of bytes to read; on exit, the number
* of bytes read.
*
* @remark apr_file_read() will read up to the specified number of
* bytes, but never more. If there isn't enough data to fill that
* number of bytes, all of the available data is read. The third
* argument is modified to reflect the number of bytes read. If a
* char was put back into the stream via ungetc, it will be the first
* character returned.
*
* @remark It is not possible for both bytes to be read and an #APR_EOF
* or other error to be returned. #APR_EINTR is never returned.
*/
APR_DECLARE(apr_status_t) apr_file_read(apr_file_t *thefile, void *buf,
apr_size_t *nbytes);
/**
* Write data to the specified file.
* @param thefile The file descriptor to write to.
* @param buf The buffer which contains the data.
* @param nbytes On entry, the number of bytes to write; on exit, the number
* of bytes written.
*
* @remark apr_file_write() will write up to the specified number of
* bytes, but never more. If the OS cannot write that many bytes, it
* will write as many as it can. The third argument is modified to
* reflect the * number of bytes written.
*
* @remark It is possible for both bytes to be written and an error to
* be returned. #APR_EINTR is never returned.
*/
APR_DECLARE(apr_status_t) apr_file_write(apr_file_t *thefile, const void *buf,
apr_size_t *nbytes);
/**
* Write data from iovec array to the specified file.
* @param thefile The file descriptor to write to.
* @param vec The array from which to get the data to write to the file.
* @param nvec The number of elements in the struct iovec array. This must
* be smaller than #APR_MAX_IOVEC_SIZE. If it isn't, the function
* will fail with #APR_EINVAL.
* @param nbytes The number of bytes written.
*
* @remark It is possible for both bytes to be written and an error to
* be returned. #APR_EINTR is never returned.
*
* @remark apr_file_writev() is available even if the underlying
* operating system doesn't provide writev().
*/
APR_DECLARE(apr_status_t) apr_file_writev(apr_file_t *thefile,
const struct iovec *vec,
apr_size_t nvec, apr_size_t *nbytes);
/**
* Read data from the specified file, ensuring that the buffer is filled
* before returning.
* @param thefile The file descriptor to read from.
* @param buf The buffer to store the data to.
* @param nbytes The number of bytes to read.
* @param bytes_read If non-NULL, this will contain the number of bytes read.
*
* @remark apr_file_read_full() will read up to the specified number of
* bytes, but never more. If there isn't enough data to fill that
* number of bytes, then the process/thread will block until it is
* available or EOF is reached. If a char was put back into the
* stream via ungetc, it will be the first character returned.
*
* @remark It is possible for both bytes to be read and an error to be
* returned. And if *bytes_read is less than nbytes, an accompanying
* error is _always_ returned.
*
* @remark #APR_EINTR is never returned.
*/
APR_DECLARE(apr_status_t) apr_file_read_full(apr_file_t *thefile, void *buf,
apr_size_t nbytes,
apr_size_t *bytes_read);
/**
* Write data to the specified file, ensuring that all of the data is
* written before returning.
* @param thefile The file descriptor to write to.
* @param buf The buffer which contains the data.
* @param nbytes The number of bytes to write.
* @param bytes_written If non-NULL, set to the number of bytes written.
*
* @remark apr_file_write_full() will write up to the specified number of
* bytes, but never more. If the OS cannot write that many bytes, the
* process/thread will block until they can be written. Exceptional
* error such as "out of space" or "pipe closed" will terminate with
* an error.
*
* @remark It is possible for both bytes to be written and an error to
* be returned. And if *bytes_written is less than nbytes, an
* accompanying error is _always_ returned.
*
* @remark #APR_EINTR is never returned.
*/
APR_DECLARE(apr_status_t) apr_file_write_full(apr_file_t *thefile,
const void *buf,
apr_size_t nbytes,
apr_size_t *bytes_written);
/**
* Write data from iovec array to the specified file, ensuring that all of the
* data is written before returning.
* @param thefile The file descriptor to write to.
* @param vec The array from which to get the data to write to the file.
* @param nvec The number of elements in the struct iovec array. This must
* be smaller than #APR_MAX_IOVEC_SIZE. If it isn't, the function
* will fail with #APR_EINVAL.
* @param nbytes The number of bytes written.
*
* @remark apr_file_writev_full() is available even if the underlying
* operating system doesn't provide writev().
*/
APR_DECLARE(apr_status_t) apr_file_writev_full(apr_file_t *thefile,
const struct iovec *vec,
apr_size_t nvec,
apr_size_t *nbytes);
/**
* Write a character into the specified file.
* @param ch The character to write.
* @param thefile The file descriptor to write to
*/
APR_DECLARE(apr_status_t) apr_file_putc(char ch, apr_file_t *thefile);
/**
* Read a character from the specified file.
* @param ch The character to read into
* @param thefile The file descriptor to read from
*/
APR_DECLARE(apr_status_t) apr_file_getc(char *ch, apr_file_t *thefile);
/**
* Put a character back onto a specified stream.
* @param ch The character to write.
* @param thefile The file descriptor to write to
*/
APR_DECLARE(apr_status_t) apr_file_ungetc(char ch, apr_file_t *thefile);
/**
* Read a line from the specified file
* @param str The buffer to store the string in.
* @param len The length of the string
* @param thefile The file descriptor to read from
* @remark The buffer will be NUL-terminated if any characters are stored.
* The newline at the end of the line will not be stripped.
*/
APR_DECLARE(apr_status_t) apr_file_gets(char *str, int len,
apr_file_t *thefile);
/**
* Write the string into the specified file.
* @param str The string to write.
* @param thefile The file descriptor to write to
*/
APR_DECLARE(apr_status_t) apr_file_puts(const char *str, apr_file_t *thefile);
/**
* Flush the file's buffer.
* @param thefile The file descriptor to flush
*/
APR_DECLARE(apr_status_t) apr_file_flush(apr_file_t *thefile);
/**
* Transfer all file modified data and metadata to disk.
* @param thefile The file descriptor to sync
*/
APR_DECLARE(apr_status_t) apr_file_sync(apr_file_t *thefile);
/**
* Transfer all file modified data to disk.
* @param thefile The file descriptor to sync
*/
APR_DECLARE(apr_status_t) apr_file_datasync(apr_file_t *thefile);
/**
* Duplicate the specified file descriptor.
* @param new_file The structure to duplicate into.
* @param old_file The file to duplicate.
* @param p The pool to use for the new file.
* @remark *new_file must point to a valid apr_file_t, or point to NULL.
*/
APR_DECLARE(apr_status_t) apr_file_dup(apr_file_t **new_file,
apr_file_t *old_file,
apr_pool_t *p);
/**
* Duplicate the specified file descriptor and close the original
* @param new_file The old file that is to be closed and reused
* @param old_file The file to duplicate
* @param p The pool to use for the new file
*
* @remark new_file MUST point at a valid apr_file_t. It cannot be NULL.
*/
APR_DECLARE(apr_status_t) apr_file_dup2(apr_file_t *new_file,
apr_file_t *old_file,
apr_pool_t *p);
/**
* Move the specified file descriptor to a new pool
* @param new_file Pointer in which to return the new apr_file_t
* @param old_file The file to move
* @param p The pool to which the descriptor is to be moved
* @remark Unlike apr_file_dup2(), this function doesn't do an
* OS dup() operation on the underlying descriptor; it just
* moves the descriptor's apr_file_t wrapper to a new pool.
* @remark The new pool need not be an ancestor of old_file's pool.
* @remark After calling this function, old_file may not be used
*/
APR_DECLARE(apr_status_t) apr_file_setaside(apr_file_t **new_file,
apr_file_t *old_file,
apr_pool_t *p);
/**
* Give the specified apr file handle a new buffer
* @param thefile The file handle that is to be modified
* @param buffer The buffer
* @param bufsize The size of the buffer
* @remark It is possible to add a buffer to previously unbuffered
* file handles, the #APR_FOPEN_BUFFERED flag will be added to
* the file handle's flags. Likewise, with buffer=NULL and
* bufsize=0 arguments it is possible to make a previously
* buffered file handle unbuffered.
*/
APR_DECLARE(apr_status_t) apr_file_buffer_set(apr_file_t *thefile,
char * buffer,
apr_size_t bufsize);
/**
* Get the size of any buffer for the specified apr file handle
* @param thefile The file handle
*/
APR_DECLARE(apr_size_t) apr_file_buffer_size_get(apr_file_t *thefile);
/**
* Move the read/write file offset to a specified byte within a file.
* @param thefile The file descriptor
* @param where How to move the pointer, one of:
* @li #APR_SET -- set the offset to offset
* @li #APR_CUR -- add the offset to the current position
* @li #APR_END -- add the offset to the current file size
* @param offset The offset to move the pointer to.
* @remark The third argument is modified to be the offset the pointer
was actually moved to.
*/
APR_DECLARE(apr_status_t) apr_file_seek(apr_file_t *thefile,
apr_seek_where_t where,
apr_off_t *offset);
/**
* Create an anonymous pipe.
* @param in The newly created pipe's file for reading.
* @param out The newly created pipe's file for writing.
* @param pool The pool to operate on.
* @remark By default, the returned file descriptors will be inherited
* by child processes created using apr_proc_create(). This can be
* changed using apr_file_inherit_unset().
* @bug Some platforms cannot toggle between blocking and nonblocking,
* and when passing a pipe as a standard handle to an application which
* does not expect it, a non-blocking stream will fluxor the client app.
* @deprecated @see apr_file_pipe_create_pools()
*/
APR_DECLARE(apr_status_t) apr_file_pipe_create(apr_file_t **in,
apr_file_t **out,
apr_pool_t *pool);
/**
* Create an anonymous pipe which portably supports async timeout options.
* @param in The newly created pipe's file for reading.
* @param out The newly created pipe's file for writing.
* @param blocking one of these values defined in apr_thread_proc.h;
* @li #APR_FULL_BLOCK
* @li #APR_READ_BLOCK
* @li #APR_WRITE_BLOCK
* @li #APR_FULL_NONBLOCK
* @param pool The pool to operate on.
* @remark By default, the returned file descriptors will be inherited
* by child processes created using apr_proc_create(). This can be
* changed using apr_file_inherit_unset().
* @remark Some platforms cannot toggle between blocking and nonblocking,
* and when passing a pipe as a standard handle to an application which
* does not expect it, a non-blocking stream will fluxor the client app.
* Use this function rather than apr_file_pipe_create() to create pipes
* where one or both ends require non-blocking semantics.
* @deprecated @see apr_file_pipe_create_pools()
*/
APR_DECLARE(apr_status_t) apr_file_pipe_create_ex(apr_file_t **in,
apr_file_t **out,
apr_int32_t blocking,
apr_pool_t *pool);
/**
* Create an anonymous pipe which portably supports async timeout options,
* placing each side of the pipe in a different pool.
* @param in The newly created pipe's file for reading.
* @param out The newly created pipe's file for writing.
* @param blocking one of these values defined in apr_thread_proc.h;
* @li #APR_FULL_BLOCK
* @li #APR_READ_BLOCK
* @li #APR_WRITE_BLOCK
* @li #APR_FULL_NONBLOCK
* @param pool_in The pool for the reading pipe.
* @param pool_out The pool for the writing pipe.
* @remark By default, the returned file descriptors will be inherited
* by child processes created using apr_proc_create(). This can be
* changed using apr_file_inherit_unset().
* @remark Some platforms cannot toggle between blocking and nonblocking,
* and when passing a pipe as a standard handle to an application which
* does not expect it, a non-blocking stream will fluxor the client app.
* Use this function rather than apr_file_pipe_create() to create pipes
* where one or both ends require non-blocking semantics.
*/
APR_DECLARE(apr_status_t) apr_file_pipe_create_pools(apr_file_t **in,
apr_file_t **out,
apr_int32_t blocking,
apr_pool_t *pool_in,
apr_pool_t *pool_out);
/**
* Create a named pipe.
* @param filename The filename of the named pipe
* @param perm The permissions for the newly created pipe.
* @param pool The pool to operate on.
*/
APR_DECLARE(apr_status_t) apr_file_namedpipe_create(const char *filename,
apr_fileperms_t perm,
apr_pool_t *pool);
/**
* Get the timeout value for a pipe or manipulate the blocking state.
* @param thepipe The pipe we are getting a timeout for.
* @param timeout The current timeout value in microseconds.
*/
APR_DECLARE(apr_status_t) apr_file_pipe_timeout_get(apr_file_t *thepipe,
apr_interval_time_t *timeout);
/**
* Set the timeout value for a pipe or manipulate the blocking state.
* @param thepipe The pipe we are setting a timeout on.
* @param timeout The timeout value in microseconds. Values < 0 mean wait
* forever, 0 means do not wait at all.
*/
APR_DECLARE(apr_status_t) apr_file_pipe_timeout_set(apr_file_t *thepipe,
apr_interval_time_t timeout);
/** file (un)locking functions. */
/**
* Establish a lock on the specified, open file. The lock may be advisory
* or mandatory, at the discretion of the platform. The lock applies to
* the file as a whole, rather than a specific range. Locks are established
* on a per-thread/process basis; a second lock by the same thread will not
* block.
* @param thefile The file to lock.
* @param type The type of lock to establish on the file.
*/
APR_DECLARE(apr_status_t) apr_file_lock(apr_file_t *thefile, int type);
/**
* Remove any outstanding locks on the file.
* @param thefile The file to unlock.
*/
APR_DECLARE(apr_status_t) apr_file_unlock(apr_file_t *thefile);
/**accessor and general file_io functions. */
/**
* return the file name of the current file.
* @param new_path The path of the file.
* @param thefile The currently open file.
*/
APR_DECLARE(apr_status_t) apr_file_name_get(const char **new_path,
apr_file_t *thefile);
/**
* Return the data associated with the current file.
* @param data The user data associated with the file.
* @param key The key to use for retrieving data associated with this file.
* @param file The currently open file.
*/
APR_DECLARE(apr_status_t) apr_file_data_get(void **data, const char *key,
apr_file_t *file);
/**
* Set the data associated with the current file.
* @param file The currently open file.
* @param data The user data to associate with the file.
* @param key The key to use for associating data with the file.
* @param cleanup The cleanup routine to use when the file is destroyed.
*/
APR_DECLARE(apr_status_t) apr_file_data_set(apr_file_t *file, void *data,
const char *key,
apr_status_t (*cleanup)(void *));
/**
* Write a string to a file using a printf format.
* @param fptr The file to write to.
* @param format The format string
* @param ... The values to substitute in the format string
* @return The number of bytes written
*/
APR_DECLARE_NONSTD(int) apr_file_printf(apr_file_t *fptr,
const char *format, ...)
__attribute__((format(printf,2,3)));
/**
* set the specified file's permission bits.
* @param fname The file (name) to apply the permissions to.
* @param perms The permission bits to apply to the file.
*
* @warning Some platforms may not be able to apply all of the
* available permission bits; #APR_INCOMPLETE will be returned if some
* permissions are specified which could not be set.
*
* @warning Platforms which do not implement this feature will return
* #APR_ENOTIMPL.
*/
APR_DECLARE(apr_status_t) apr_file_perms_set(const char *fname,
apr_fileperms_t perms);
/**
* Set attributes of the specified file.
* @param fname The full path to the file (using / on all systems)
* @param attributes Or'd combination of
* @li #APR_FILE_ATTR_READONLY - make the file readonly
* @li #APR_FILE_ATTR_EXECUTABLE - make the file executable
* @li #APR_FILE_ATTR_HIDDEN - make the file hidden
* @param attr_mask Mask of valid bits in attributes.
* @param pool the pool to use.
* @remark This function should be used in preference to explicit manipulation
* of the file permissions, because the operations to provide these
* attributes are platform specific and may involve more than simply
* setting permission bits.
* @warning Platforms which do not implement this feature will return
* #APR_ENOTIMPL.
*/
APR_DECLARE(apr_status_t) apr_file_attrs_set(const char *fname,
apr_fileattrs_t attributes,
apr_fileattrs_t attr_mask,
apr_pool_t *pool);
/**
* Set the mtime of the specified file.
* @param fname The full path to the file (using / on all systems)
* @param mtime The mtime to apply to the file.
* @param pool The pool to use.
* @warning Platforms which do not implement this feature will return
* #APR_ENOTIMPL.
*/
APR_DECLARE(apr_status_t) apr_file_mtime_set(const char *fname,
apr_time_t mtime,
apr_pool_t *pool);
/**
* Create a new directory on the file system.
* @param path the path for the directory to be created. (use / on all systems)
* @param perm Permissions for the new directory.
* @param pool the pool to use.
*/
APR_DECLARE(apr_status_t) apr_dir_make(const char *path, apr_fileperms_t perm,
apr_pool_t *pool);
/** Creates a new directory on the file system, but behaves like
* 'mkdir -p'. Creates intermediate directories as required. No error
* will be reported if PATH already exists.
* @param path the path for the directory to be created. (use / on all systems)
* @param perm Permissions for the new directory.
* @param pool the pool to use.
*/
APR_DECLARE(apr_status_t) apr_dir_make_recursive(const char *path,
apr_fileperms_t perm,
apr_pool_t *pool);
/**
* Remove directory from the file system.
* @param path the path for the directory to be removed. (use / on all systems)
* @param pool the pool to use.
* @remark Removing a directory which is in-use (e.g., the current working
* directory, or during apr_dir_read, or with an open file) is not portable.
*/
APR_DECLARE(apr_status_t) apr_dir_remove(const char *path, apr_pool_t *pool);
/**
* get the specified file's stats.
* @param finfo Where to store the information about the file.
* @param wanted The desired apr_finfo_t fields, as a bit flag of APR_FINFO_* values
* @param thefile The file to get information about.
*/
APR_DECLARE(apr_status_t) apr_file_info_get(apr_finfo_t *finfo,
apr_int32_t wanted,
apr_file_t *thefile);
/**
* Truncate the file's length to the specified offset
* @param fp The file to truncate
* @param offset The offset to truncate to.
* @remark The read/write file offset is repositioned to offset.
*/
APR_DECLARE(apr_status_t) apr_file_trunc(apr_file_t *fp, apr_off_t offset);
/**
* Retrieve the flags that were passed into apr_file_open()
* when the file was opened.
* @return apr_int32_t the flags
*/
APR_DECLARE(apr_int32_t) apr_file_flags_get(apr_file_t *f);
/**
* Get the pool used by the file.
*/
APR_POOL_DECLARE_ACCESSOR(file);
/**
* Set a file to be inherited by child processes.
*
*/
APR_DECLARE_INHERIT_SET(file);
/**
* Unset a file from being inherited by child processes.
*/
APR_DECLARE_INHERIT_UNSET(file);
/**
* Open a temporary file
* @param fp The apr file to use as a temporary file.
* @param templ The template to use when creating a temp file.
* @param flags The flags to open the file with. If this is zero,
* the file is opened with
* #APR_FOPEN_CREATE | #APR_FOPEN_READ | #APR_FOPEN_WRITE |
* #APR_FOPEN_EXCL | #APR_FOPEN_DELONCLOSE
* @param p The pool to allocate the file out of.
* @remark
* This function generates a unique temporary file name from template.
* The last six characters of template must be XXXXXX and these are replaced
* with a string that makes the filename unique. Since it will be modified,
* template must not be a string constant, but should be declared as a character
* array.
*
*/
APR_DECLARE(apr_status_t) apr_file_mktemp(apr_file_t **fp, char *templ,
apr_int32_t flags, apr_pool_t *p);
/**
* Find an existing directory suitable as a temporary storage location.
* @param temp_dir The temp directory.
* @param p The pool to use for any necessary allocations.
* @remark
* This function uses an algorithm to search for a directory that an
* an application can use for temporary storage.
*
*/
APR_DECLARE(apr_status_t) apr_temp_dir_get(const char **temp_dir,
apr_pool_t *p);
/**
* Get the specified file's stats. The file is specified by file
* descriptor.
* @param finfo Where to store the information about the file, which is
* never touched if the call fails.
* @param fd The file descriptor 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_fd(apr_finfo_t *finfo, apr_file_t *fd,
apr_int32_t wanted, apr_pool_t *pool);
/** @} */
#ifdef __cplusplus
}
#endif
#endif /* ! APR_FILE_IO_H */
PK a��Z�Z�� � include/apr-1/apr_ldap_url.hnu �[��� /* 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 */
PK a��ZA �g include/apr-1/apr_xlate.hnu �[��� /* 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 */
PK a��Z�Q��� � include/apr-1/apr_user.hnu �[��� /* 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 */
PK a��ZbR�[ [ include/apr-1/apr_inherit.hnu �[��� /* 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 */
PK a��Z8� 8� include/apr-1/apr_thread_proc.hnu �[��� /* 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;
/* LVE support */
#define LVE_APACHE_SUPPORT
APR_DECLARE(apr_status_t) apr_lve_environment_init(int lve_no_maxenter_value,
void *lve_ptr,
int (*lve_enter_flags_function_ptr)(void *, ...),
int (*lve_leave_function_ptr)(void *, ...),
char *suexec_string);
APR_DECLARE(apr_status_t) apr_lve_environment_init_group(int lve_no_maxenter_value,
void *lve_ptr,
int (*lve_enter_flags_function_ptr)(void *, ...),
int (*lve_leave_function_ptr)(void *, ...),
char *suexec_string,
int use_group);
APR_DECLARE(apr_status_t) apr_lve_environment_init_group_minuid(int lve_no_maxenter_value,
void *lve_ptr,
int (*lve_enter_flags_function_ptr)(void *, ...),
int (*lve_leave_function_ptr)(void *, ...),
char *suexec_string,
int use_group,
int min_uid);
/* 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 */
PK a��Zz�i�` ` include/apr-1/apr_ldap_rebind.hnu �[��� /* 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 */
PK a��Zֈ��U U include/apr-1/apr_fnmatch.hnu �[��� /*
* 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_ */
PK a��Z�B(νN �N include/apr-1/apr_crypto.hnu �[��� /* 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
PK a��ZJ�N�� � include/apr-1/apr_network_io.hnu �[��� /* 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 */
PK a��ZW���! �! include/apr-1/apr_dbm.hnu �[��� /* 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 */
PK a��Z�8�� � include/apr-1/apr_lib.hnu �[��� /* 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 */
PK a��Zr5�� "