summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author(no author) <(no author)@13f79535-47bb-0310-9956-ffa450edef68>2000-12-12 17:55:29 +0000
committer(no author) <(no author)@13f79535-47bb-0310-9956-ffa450edef68>2000-12-12 17:55:29 +0000
commit31d53166201348a2c33e9973c644f52b7b146e02 (patch)
tree04d903797f190a907ae10af851b2421dacb5ae09
parentc199f38387b8226735d0c7839c56aa145fccec79 (diff)
downloadlibapr-util-APACHE_2_0_ALPHA_9.tar.gz
This commit was manufactured by cvs2svn to create tagAPACHE_2_0_ALPHA_9
'APACHE_2_0_ALPHA_9'. git-svn-id: http://svn.apache.org/repos/asf/apr/apr-util/tags/APACHE_2_0_ALPHA_9@57994 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--buckets/.cvsignore4
-rw-r--r--buckets/Makefile.in8
-rw-r--r--buckets/ap_buckets.c295
-rw-r--r--buckets/ap_buckets_eos.c94
-rw-r--r--buckets/ap_buckets_file.c196
-rw-r--r--buckets/ap_buckets_flush.c94
-rw-r--r--buckets/ap_buckets_heap.c150
-rw-r--r--buckets/ap_buckets_mmap.c125
-rw-r--r--buckets/ap_buckets_pipe.c149
-rw-r--r--buckets/ap_buckets_pool.c142
-rw-r--r--buckets/ap_buckets_refcount.c153
-rw-r--r--buckets/ap_buckets_simple.c209
-rw-r--r--buckets/ap_buckets_socket.c144
-rw-r--r--buckets/apr_buckets.c295
-rw-r--r--buckets/apr_buckets_eos.c94
-rw-r--r--buckets/apr_buckets_file.c196
-rw-r--r--buckets/apr_buckets_flush.c94
-rw-r--r--buckets/apr_buckets_heap.c150
-rw-r--r--buckets/apr_buckets_mmap.c125
-rw-r--r--buckets/apr_buckets_pipe.c149
-rw-r--r--buckets/apr_buckets_pool.c142
-rw-r--r--buckets/apr_buckets_refcount.c153
-rw-r--r--buckets/apr_buckets_simple.c209
-rw-r--r--buckets/apr_buckets_socket.c144
-rw-r--r--crypto/.cvsignore4
-rw-r--r--crypto/Makefile.in5
-rw-r--r--crypto/ap_sha1.c412
-rw-r--r--crypto/apr_sha1.c412
-rw-r--r--dbm/.cvsignore4
-rw-r--r--dbm/Makefile.in6
-rw-r--r--dbm/apr_dbm.c333
-rw-r--r--dbm/sdbm/.cvsignore4
-rw-r--r--dbm/sdbm/Makefile.in5
-rw-r--r--dbm/sdbm/sdbm.c613
-rw-r--r--dbm/sdbm/sdbm_hash.c100
-rw-r--r--dbm/sdbm/sdbm_lock.c76
-rw-r--r--dbm/sdbm/sdbm_pair.c359
-rw-r--r--dbm/sdbm/sdbm_pair.h80
-rw-r--r--dbm/sdbm/sdbm_private.h107
-rw-r--r--dbm/sdbm/sdbm_tune.h88
-rw-r--r--encoding/.cvsignore4
-rw-r--r--encoding/Makefile.in5
-rw-r--r--encoding/ap_base64.c310
-rw-r--r--encoding/apr_base64.c310
-rw-r--r--hooks/.cvsignore4
-rw-r--r--hooks/Makefile.in5
-rw-r--r--hooks/ap_hooks.c297
-rw-r--r--hooks/apr_hooks.c297
-rw-r--r--include/apr_base64.h144
-rw-r--r--include/apr_buckets.h1117
-rw-r--r--include/apr_dbm.h168
-rw-r--r--include/apr_hooks.h261
-rw-r--r--include/apr_ring.h274
-rw-r--r--include/apr_sha1.h159
-rw-r--r--libaprutil.def63
-rw-r--r--libaprutil.dsp100
-rw-r--r--misc/win32/libaprutil.c7
-rw-r--r--src/misc/win32/libaprutil.c7
-rw-r--r--uri/.cvsignore4
-rw-r--r--uri/Makefile.in3
-rw-r--r--xml/.cvsignore4
-rw-r--r--xml/Makefile.in3
62 files changed, 0 insertions, 9668 deletions
diff --git a/buckets/.cvsignore b/buckets/.cvsignore
deleted file mode 100644
index 2c9b9300..00000000
--- a/buckets/.cvsignore
+++ /dev/null
@@ -1,4 +0,0 @@
-Makefile
-*.lo
-*.la
-.libs
diff --git a/buckets/Makefile.in b/buckets/Makefile.in
deleted file mode 100644
index 941e7eba..00000000
--- a/buckets/Makefile.in
+++ /dev/null
@@ -1,8 +0,0 @@
-
-TARGETS = ap_buckets_file.lo ap_buckets_pool.lo ap_buckets_flush.lo \
-ap_buckets_refcount.lo ap_buckets_heap.lo ap_buckets_simple.lo ap_buckets.lo \
-ap_buckets_mmap.lo ap_buckets_socket.lo ap_buckets_eos.lo ap_buckets_pipe.lo \
-ap_buckets.lo
-
-top_builddir = @top_builddir@
-include $(top_builddir)/build/rules.mk
diff --git a/buckets/ap_buckets.c b/buckets/ap_buckets.c
deleted file mode 100644
index 34fba9c4..00000000
--- a/buckets/ap_buckets.c
+++ /dev/null
@@ -1,295 +0,0 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation. 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. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 APACHE SOFTWARE FOUNDATION OR
- * ITS 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.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-#include "apr.h"
-#include "apr_lib.h"
-#include "apr_pools.h"
-#include "apr_tables.h"
-#include "apr_errno.h"
-
-#include <stdlib.h>
-#if APR_HAVE_SYS_UIO_H
-#include <sys/uio.h>
-#endif
-
-#include "ap_buckets.h"
-
-static apr_array_header_t *bucket_types;
-
-static apr_status_t ap_brigade_cleanup(void *data)
-{
- ap_bucket_brigade *b = data;
- ap_bucket *e;
-
- /*
- * Bah! We can't use AP_RING_FOREACH here because this bucket has
- * gone away when we dig inside it to get the next one.
- */
- while (!AP_BRIGADE_EMPTY(b)) {
- e = AP_BRIGADE_FIRST(b);
- AP_BUCKET_REMOVE(e);
- ap_bucket_destroy(e);
- }
- /*
- * We don't need to free(bb) because it's allocated from a pool.
- */
- return APR_SUCCESS;
-}
-APR_DECLARE(apr_status_t) ap_brigade_destroy(ap_bucket_brigade *b)
-{
- apr_kill_cleanup(b->p, b, ap_brigade_cleanup);
- return ap_brigade_cleanup(b);
-}
-
-APR_DECLARE(ap_bucket_brigade *) ap_brigade_create(apr_pool_t *p)
-{
- ap_bucket_brigade *b;
-
- b = apr_palloc(p, sizeof(*b));
- b->p = p;
- AP_RING_INIT(&b->list, ap_bucket, link);
-
- apr_register_cleanup(b->p, b, ap_brigade_cleanup, ap_brigade_cleanup);
- return b;
-}
-
-APR_DECLARE(ap_bucket_brigade *) ap_brigade_split(ap_bucket_brigade *b,
- ap_bucket *e)
-{
- ap_bucket_brigade *a;
- ap_bucket *f;
-
- a = ap_brigade_create(b->p);
- /* Return an empty brigade if there is nothing left in
- * the first brigade to split off
- */
- if (e != AP_BRIGADE_SENTINEL(b)) {
- f = AP_RING_LAST(&b->list);
- AP_RING_UNSPLICE(e, f, link);
- AP_RING_SPLICE_HEAD(&a->list, e, f, ap_bucket, link);
- }
- return a;
-}
-
-APR_DECLARE(ap_bucket *) ap_brigade_partition(ap_bucket_brigade *b, apr_off_t point)
-{
- ap_bucket *e;
- const char *s;
- apr_size_t len;
-
- if (point < 0)
- return NULL;
-
- AP_BRIGADE_FOREACH(e, b) {
- /* bucket is of a known length */
- if ((point > e->length) && (e->length != -1)) {
- if (AP_BUCKET_IS_EOS(e))
- return NULL;
- point -= e->length;
- }
- else if (point == e->length) {
- return AP_BUCKET_NEXT(e);
- }
- else {
- /* try to split the bucket natively */
- if (ap_bucket_split(e, point) != APR_ENOTIMPL)
- return AP_BUCKET_NEXT(e);
-
- /* if the bucket cannot be split, we must read from it,
- * changing its type to one that can be split */
- if (ap_bucket_read(e, &s, &len, AP_BLOCK_READ) != APR_SUCCESS)
- return NULL;
-
- if (point < len) {
- if (ap_bucket_split(e, point) == APR_SUCCESS)
- return AP_BUCKET_NEXT(e);
- else
- return NULL;
- }
- else if (point == len)
- return AP_BUCKET_NEXT(e);
- else
- point -= len;
- }
- }
- return NULL;
-}
-
-APR_DECLARE(int) ap_brigade_to_iovec(ap_bucket_brigade *b,
- struct iovec *vec, int nvec)
-{
- ap_bucket *e;
- struct iovec *orig;
- apr_size_t iov_len;
-
- orig = vec;
- AP_BRIGADE_FOREACH(e, b) {
- if (nvec-- == 0)
- break;
- ap_bucket_read(e, (const char **)&vec->iov_base, &iov_len, AP_NONBLOCK_READ);
- vec->iov_len = iov_len; /* set indirectly in case size differs */
- ++vec;
- }
- return vec - orig;
-}
-
-APR_DECLARE(int) ap_brigade_vputstrs(ap_bucket_brigade *b, va_list va)
-{
- ap_bucket *r;
- const char *x;
- int j, k;
- apr_size_t i;
-
- for (k = 0;;) {
- x = va_arg(va, const char *);
- if (x == NULL)
- break;
- j = strlen(x);
-
- /* XXX: copy or not? let the caller decide? */
- r = ap_bucket_create_heap(x, j, 1, &i);
- if (i != j) {
- /* Do we need better error reporting? */
- return -1;
- }
- k += i;
-
- AP_BRIGADE_INSERT_TAIL(b, r);
- }
-
- return k;
-}
-
-APR_DECLARE_NONSTD(int) ap_brigade_putstrs(ap_bucket_brigade *b, ...)
-{
- va_list va;
- int written;
-
- va_start(va, b);
- written = ap_brigade_vputstrs(b, va);
- va_end(va);
- return written;
-}
-
-APR_DECLARE_NONSTD(int) ap_brigade_printf(ap_bucket_brigade *b, const char *fmt, ...)
-{
- va_list ap;
- int res;
-
- va_start(ap, fmt);
- res = ap_brigade_vprintf(b, fmt, ap);
- va_end(ap);
- return res;
-}
-
-APR_DECLARE(int) ap_brigade_vprintf(ap_bucket_brigade *b, const char *fmt, va_list va)
-{
- /* XXX: This needs to be replaced with a function to printf
- * directly into a bucket. I'm being lazy right now. RBB
- */
- char buf[4096];
- ap_bucket *r;
- int res;
-
- res = apr_vsnprintf(buf, 4096, fmt, va);
-
- r = ap_bucket_create_heap(buf, strlen(buf), 1, NULL);
- AP_BRIGADE_INSERT_TAIL(b, r);
-
- return res;
-}
-
-void ap_init_bucket_types(apr_pool_t *p)
-{
- bucket_types = apr_make_array(p, 8, sizeof(ap_bucket_type));
-
- ap_insert_bucket_type(&ap_eos_type);
- ap_insert_bucket_type(&ap_file_type);
- ap_insert_bucket_type(&ap_heap_type);
-#ifdef AP_USE_MMAP_FILES
- ap_insert_bucket_type(&ap_mmap_type);
-#endif
- ap_insert_bucket_type(&ap_pipe_type);
- ap_insert_bucket_type(&ap_immortal_type);
- ap_insert_bucket_type(&ap_transient_type);
- ap_insert_bucket_type(&ap_socket_type);
-}
-
-int ap_insert_bucket_type(const ap_bucket_type *type)
-{
- const ap_bucket_type **newone;
-
- newone = (const ap_bucket_type **)apr_push_array(bucket_types);
- newone = &type;
-
- return bucket_types->nelts - 1;
-}
-
-APR_DECLARE_NONSTD(apr_status_t) ap_bucket_setaside_notimpl(ap_bucket *data)
-{
- return APR_ENOTIMPL;
-}
-
-APR_DECLARE_NONSTD(apr_status_t) ap_bucket_split_notimpl(ap_bucket *data, apr_off_t point)
-{
- return APR_ENOTIMPL;
-}
-APR_DECLARE_NONSTD(apr_status_t) ap_bucket_copy_notimpl(ap_bucket *e, ap_bucket **c)
-{
- return APR_ENOTIMPL;
-}
-APR_DECLARE_NONSTD(void) ap_bucket_destroy_notimpl(void *data)
-{
- return;
-}
diff --git a/buckets/ap_buckets_eos.c b/buckets/ap_buckets_eos.c
deleted file mode 100644
index d7d20198..00000000
--- a/buckets/ap_buckets_eos.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation. 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. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 APACHE SOFTWARE FOUNDATION OR
- * ITS 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.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-#include "ap_buckets.h"
-#include <stdlib.h>
-
-static apr_status_t eos_read(ap_bucket *b, const char **str,
- apr_size_t *len, ap_read_type block)
-{
- *str = NULL;
- *len = 0;
- return APR_SUCCESS;
-}
-
-static apr_status_t eos_copy(ap_bucket *e, ap_bucket **c)
-{
- *c = ap_bucket_create_eos();
- return APR_SUCCESS;
-}
-
-APR_DECLARE(ap_bucket *) ap_bucket_make_eos(ap_bucket *b)
-{
- b->length = 0;
- b->data = NULL;
-
- b->type = &ap_eos_type;
-
- return b;
-}
-
-APR_DECLARE(ap_bucket *) ap_bucket_create_eos(void)
-{
- ap_bucket_do_create(ap_bucket_make_eos(b));
-}
-
-APR_DECLARE_DATA const ap_bucket_type ap_eos_type = {
- "EOS", 5,
- ap_bucket_destroy_notimpl,
- eos_read,
- ap_bucket_setaside_notimpl,
- ap_bucket_split_notimpl,
- eos_copy
-};
diff --git a/buckets/ap_buckets_file.c b/buckets/ap_buckets_file.c
deleted file mode 100644
index dc3922db..00000000
--- a/buckets/ap_buckets_file.c
+++ /dev/null
@@ -1,196 +0,0 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation. 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. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 APACHE SOFTWARE FOUNDATION OR
- * ITS 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.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-#include "apr_lib.h"
-#include "apr_file_io.h"
-#include "ap_buckets.h"
-#include <stdlib.h>
-
-/* Allow Apache to use ap_mmap */
-#ifdef AP_USE_MMAP_FILES
-#include "apr_mmap.h"
-
-/* mmap support for static files based on ideas from John Heidemann's
- * patch against 1.0.5. See
- * <http://www.isi.edu/~johnh/SOFTWARE/APACHE/index.html>.
- */
-
-/* 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.
- */
-#ifndef MMAP_THRESHOLD
-# ifdef SUNOS4
-# define MMAP_THRESHOLD (8*1024)
-# else
-# define MMAP_THRESHOLD 1
-# endif /* SUNOS4 */
-#endif /* MMAP_THRESHOLD */
-#ifndef MMAP_LIMIT
-#define MMAP_LIMIT (4*1024*1024)
-#endif
-#endif /* AP_USE_MMAP_FILES */
-
-
-/* XXX: We should obey the block flag */
-static apr_status_t file_read(ap_bucket *e, const char **str,
- apr_size_t *len, ap_read_type block)
-{
- ap_bucket_file *a = (ap_bucket_file *)e->data;
- apr_file_t *f = (apr_file_t *) a->fd;
- ap_bucket *b = NULL;
- char *buf;
- apr_status_t rv;
-#ifdef AP_USE_MMAP_FILES
- apr_mmap_t *mm = NULL;
-#endif
-
-#ifdef AP_USE_MMAP_FILES
- if ((e->length >= MMAP_THRESHOLD)
- && (e->length < MMAP_LIMIT)) {
- /* we need to protect ourselves in case we die while we've got the
- * file mmapped */
- apr_status_t status;
- if ((status = apr_mmap_create(&mm, f, a->offset, e->length,
- APR_MMAP_READ, NULL)) != APR_SUCCESS) {
- mm = NULL;
- }
- }
- else {
- mm = NULL;
- }
- if (mm) {
- ap_bucket_make_mmap(e, mm, 0, e->length); /*XXX: check for failure? */
- return ap_bucket_read(e, str, len, block);
- }
- else {
-#endif
-
- buf = malloc(HUGE_STRING_LEN);
- *str = buf;
-
- if (e->length > HUGE_STRING_LEN) {
- *len = HUGE_STRING_LEN;
- }
- else {
- *len = e->length;
- }
-
- /* Handle offset ... */
- if (a->offset) {
- rv = apr_seek(f, APR_SET, &a->offset);
- if (rv != APR_SUCCESS) {
- free(buf);
- return rv;
- }
- /* Only need to do seek the first time through */
- a->offset = 0;
- }
- rv = apr_read(f, buf, len);
- if (rv != APR_SUCCESS && rv != APR_EOF) {
- free(buf);
- return rv;
- }
-
- /*
- * Change the current bucket to refer to what we read,
- * even if we read nothing because we hit EOF.
- */
- ap_bucket_make_heap(e, buf, *len, 0, NULL); /*XXX: check for failure? */
-
- /* If we have more to read from the file, then create another bucket */
- if (*len > 0) {
- b = ap_bucket_create_file(f, 0, e->length);
- AP_BUCKET_INSERT_AFTER(e, b);
- }
-#ifdef AP_USE_MMAP_FILES
- }
-#endif
- return APR_SUCCESS;
-}
-
-APR_DECLARE(ap_bucket *) ap_bucket_make_file(ap_bucket *b, apr_file_t *fd,
- apr_off_t offset, apr_size_t len)
-{
- ap_bucket_file *f;
-
- f = malloc(sizeof(*f));
- if (f == NULL) {
- return NULL;
- }
-
- f->fd = fd;
- f->offset = offset;
-
- b->type = &ap_file_type;
- b->data = f;
- b->length = len;
-
- return b;
-}
-
-APR_DECLARE(ap_bucket *) ap_bucket_create_file(apr_file_t *fd,
- apr_off_t offset, apr_size_t len)
-{
- ap_bucket_do_create(ap_bucket_make_file(b, fd, offset, len));
-}
-
-APR_DECLARE_DATA const ap_bucket_type ap_file_type = {
- "FILE", 5,
- ap_bucket_destroy_notimpl,
- file_read,
- ap_bucket_setaside_notimpl,
- ap_bucket_split_notimpl,
- ap_bucket_copy_notimpl
-};
diff --git a/buckets/ap_buckets_flush.c b/buckets/ap_buckets_flush.c
deleted file mode 100644
index 357299e2..00000000
--- a/buckets/ap_buckets_flush.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation. 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. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 APACHE SOFTWARE FOUNDATION OR
- * ITS 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.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-#include "ap_buckets.h"
-#include <stdlib.h>
-
-static apr_status_t flush_read(ap_bucket *b, const char **str,
- apr_size_t *len, ap_read_type block)
-{
- *str = NULL;
- *len = 0;
- return APR_SUCCESS;
-}
-
-static apr_status_t flush_copy(ap_bucket *e, ap_bucket **c)
-{
- *c = ap_bucket_create_flush();
- return APR_SUCCESS;
-}
-
-APR_DECLARE(ap_bucket *) ap_bucket_make_flush(ap_bucket *b)
-{
- b->length = 0;
- b->data = NULL;
-
- b->type = &ap_flush_type;
-
- return b;
-}
-
-APR_DECLARE(ap_bucket *) ap_bucket_create_flush(void)
-{
- ap_bucket_do_create(ap_bucket_make_flush(b));
-}
-
-APR_DECLARE_DATA const ap_bucket_type ap_flush_type = {
- "FLUSH", 5,
- ap_bucket_destroy_notimpl,
- flush_read,
- ap_bucket_setaside_notimpl,
- ap_bucket_split_notimpl,
- flush_copy
-};
diff --git a/buckets/ap_buckets_heap.c b/buckets/ap_buckets_heap.c
deleted file mode 100644
index f8fdf2d3..00000000
--- a/buckets/ap_buckets_heap.c
+++ /dev/null
@@ -1,150 +0,0 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation. 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. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 APACHE SOFTWARE FOUNDATION OR
- * ITS 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.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-#include "ap_buckets.h"
-#include <stdlib.h>
-
-/*
- * The size of heap bucket memory allocations.
- * XXX: This is currently a guess and should be adjusted to an
- * empirically good value.
- */
-#ifndef DEFAULT_BUCKET_SIZE
-#define DEFAULT_BUCKET_SIZE (4096)
-#endif
-
-static apr_status_t heap_read(ap_bucket *b, const char **str,
- apr_size_t *len, ap_read_type block)
-{
- ap_bucket_shared *s = b->data;
- ap_bucket_heap *h = s->data;
-
- *str = h->base + s->start;
- *len = s->end - s->start;
- return APR_SUCCESS;
-}
-
-static void heap_destroy(void *data)
-{
- ap_bucket_heap *h;
-
- h = ap_bucket_destroy_shared(data);
- if (h == NULL) {
- return;
- }
- free(h->base);
- free(h);
-}
-
-APR_DECLARE(ap_bucket *) ap_bucket_make_heap(ap_bucket *b,
- const char *buf, apr_size_t length, int copy, apr_size_t *w)
-{
- ap_bucket_heap *h;
-
- h = malloc(sizeof(*h));
- if (h == NULL) {
- return NULL;
- }
-
- if (copy) {
- h->base = malloc(DEFAULT_BUCKET_SIZE);
- if (h->base == NULL) {
- free(h);
- return NULL;
- }
- h->alloc_len = DEFAULT_BUCKET_SIZE;
- if (length > DEFAULT_BUCKET_SIZE) {
- length = DEFAULT_BUCKET_SIZE;
- }
- memcpy(h->base, buf, length);
- }
- else {
- /* XXX: we lose the const qualifier here which indicates
- * there's something screwy with the API...
- */
- h->base = (char *) buf;
- h->alloc_len = length;
- }
-
- b = ap_bucket_make_shared(b, h, 0, length);
- if (b == NULL) {
- if (copy) {
- free(h->base);
- }
- free(h);
- return NULL;
- }
-
- b->type = &ap_heap_type;
-
- if (w)
- *w = length;
-
- return b;
-}
-
-APR_DECLARE(ap_bucket *) ap_bucket_create_heap(
- const char *buf, apr_size_t length, int copy, apr_size_t *w)
-{
- ap_bucket_do_create(ap_bucket_make_heap(b, buf, length, copy, w));
-}
-
-APR_DECLARE_DATA const ap_bucket_type ap_heap_type = {
- "HEAP", 5,
- heap_destroy,
- heap_read,
- ap_bucket_setaside_notimpl,
- ap_bucket_split_shared,
- ap_bucket_copy_shared
-};
diff --git a/buckets/ap_buckets_mmap.c b/buckets/ap_buckets_mmap.c
deleted file mode 100644
index 81f426c4..00000000
--- a/buckets/ap_buckets_mmap.c
+++ /dev/null
@@ -1,125 +0,0 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation. 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. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 APACHE SOFTWARE FOUNDATION OR
- * ITS 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.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-#include "ap_buckets.h"
-#include <stdlib.h>
-
-static apr_status_t mmap_read(ap_bucket *b, const char **str,
- apr_size_t *length, ap_read_type block)
-{
- ap_bucket_shared *s = b->data;
- ap_bucket_mmap *m = s->data;
- apr_status_t ok;
- void *addr;
-
- ok = apr_mmap_offset(&addr, m->mmap, s->start);
- if (ok != APR_SUCCESS) {
- return ok;
- }
- *str = addr;
- *length = s->end - s->start;
- return APR_SUCCESS;
-}
-
-static void mmap_destroy(void *data)
-{
- ap_bucket_mmap *m;
-
- m = ap_bucket_destroy_shared(data);
- if (m == NULL) {
- return;
- }
- free(m);
-}
-
-/*
- * XXX: are the start and length arguments useful?
- */
-APR_DECLARE(ap_bucket *) ap_bucket_make_mmap(ap_bucket *b,
- apr_mmap_t *mm, apr_off_t start, apr_size_t length)
-{
- ap_bucket_mmap *m;
-
- m = malloc(sizeof(*m));
- if (m == NULL) {
- return NULL;
- }
- m->mmap = mm;
-
- b = ap_bucket_make_shared(b, m, start, start+length);
- if (b == NULL) {
- free(m);
- return NULL;
- }
-
- b->type = &ap_mmap_type;
-
- return b;
-}
-
-
-APR_DECLARE(ap_bucket *) ap_bucket_create_mmap(
- apr_mmap_t *mm, apr_off_t start, apr_size_t length)
-{
- ap_bucket_do_create(ap_bucket_make_mmap(b, mm, start, length));
-}
-
-APR_DECLARE_DATA const ap_bucket_type ap_mmap_type = {
- "MMAP", 5,
- mmap_destroy,
- mmap_read,
- ap_bucket_setaside_notimpl,
- ap_bucket_split_shared,
- ap_bucket_copy_shared
-};
diff --git a/buckets/ap_buckets_pipe.c b/buckets/ap_buckets_pipe.c
deleted file mode 100644
index 327d93d5..00000000
--- a/buckets/ap_buckets_pipe.c
+++ /dev/null
@@ -1,149 +0,0 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation. 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. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 APACHE SOFTWARE FOUNDATION OR
- * ITS 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.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-#include "apr_lib.h"
-#include "ap_buckets.h"
-#include <stdlib.h>
-
-/* XXX: We should obey the block flag */
-static apr_status_t pipe_read(ap_bucket *a, const char **str,
- apr_size_t *len, ap_read_type block)
-{
- apr_file_t *p = a->data;
- ap_bucket *b;
- char *buf;
- apr_status_t rv;
- apr_interval_time_t timeout;
-
- if (block == AP_NONBLOCK_READ) {
- apr_get_pipe_timeout(p, &timeout);
- apr_set_pipe_timeout(p, 0);
- }
-
- buf = malloc(HUGE_STRING_LEN); /* XXX: check for failure? */
- *str = buf;
- *len = HUGE_STRING_LEN;
- rv = apr_read(p, buf, len);
-
- if (block == AP_NONBLOCK_READ) {
- apr_set_pipe_timeout(p, timeout);
- }
-
- if (rv != APR_SUCCESS && rv != APR_EOF) {
- *str = NULL;
- free(buf);
- return rv;
- }
- /*
- * Change the current bucket to refer to what we read,
- * even if we read nothing because we hit EOF.
- */
- ap_bucket_make_heap(a, buf, *len, 0, NULL); /* XXX: check for failure? */
- /*
- * If there's more to read we have to keep the rest of the pipe
- * for later. Otherwise, we'll close the pipe.
- * XXX: Note that more complicated bucket types that
- * refer to data not in memory and must therefore have a read()
- * function similar to this one should be wary of copying this
- * code because if they have a destroy function they probably
- * want to migrate the bucket's subordinate structure from the
- * old bucket to a raw new one and adjust it as appropriate,
- * rather than destroying the old one and creating a completely
- * new bucket.
- */
- if (*len > 0) {
- b = ap_bucket_create_pipe(p);
- AP_BUCKET_INSERT_AFTER(a, b);
- }
- else {
- apr_close(p);
- }
- return APR_SUCCESS;
-}
-
-APR_DECLARE(ap_bucket *) ap_bucket_make_pipe(ap_bucket *b, apr_file_t *p)
-{
- /*
- * A pipe is closed when the end is reached in pipe_read(). If the
- * pipe isn't read to the end (e.g., error path), the pipe will be
- * closed when its pool goes away.
- *
- * Note that typically the pipe is allocated from the request pool
- * so it will disappear when the request is finished. However the
- * core filter may decide to set aside the tail end of a CGI
- * response if the connection is pipelined. This turns out not to
- * be a problem because the core will have read to the end of the
- * stream so the bucket(s) that it sets aside will be the heap
- * buckets created by pipe_read() above.
- */
- b->type = &ap_pipe_type;
- b->length = -1;
- b->data = p;
-
- return b;
-}
-
-APR_DECLARE(ap_bucket *) ap_bucket_create_pipe(apr_file_t *p)
-{
- ap_bucket_do_create(ap_bucket_make_pipe(b, p));
-}
-
-APR_DECLARE_DATA const ap_bucket_type ap_pipe_type = {
- "PIPE", 5,
- ap_bucket_destroy_notimpl,
- pipe_read,
- ap_bucket_setaside_notimpl,
- ap_bucket_split_notimpl,
- ap_bucket_copy_notimpl
-};
diff --git a/buckets/ap_buckets_pool.c b/buckets/ap_buckets_pool.c
deleted file mode 100644
index 6c9b2654..00000000
--- a/buckets/ap_buckets_pool.c
+++ /dev/null
@@ -1,142 +0,0 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation. 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. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 APACHE SOFTWARE FOUNDATION OR
- * ITS 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.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-#include "ap_buckets.h"
-#include <stdlib.h>
-
-static apr_status_t pool_bucket_cleanup(void *data)
-{
- ap_bucket_shared *s = data;
- ap_bucket_shared *new;
- ap_bucket_pool *h = s->data;
- ap_bucket *b = h->b;
- apr_size_t w;
-
- ap_bucket_make_heap(b, h->base, b->length, 1, &w);
- new = b->data;
-
- new->start = s->start;
- new->end = s->end;
-
- ap_bucket_destroy_shared(s);
- return APR_SUCCESS;
-}
-
-static apr_status_t pool_read(ap_bucket *b, const char **str,
- apr_size_t *len, ap_read_type block)
-{
- ap_bucket_shared *s = b->data;
- ap_bucket_pool *h = s->data;
-
- *str = h->base + s->start;
- *len = s->end - s->start;
- return APR_SUCCESS;
-}
-
-static void pool_destroy(void *data)
-{
- ap_bucket_shared *s = data;
- ap_bucket_pool *h = s->data;
-
- apr_kill_cleanup(h->p, data, pool_bucket_cleanup);
- h = ap_bucket_destroy_shared(data);
- if (h == NULL) {
- return;
- }
- free(h);
-}
-
-APR_DECLARE(ap_bucket *) ap_bucket_make_pool(ap_bucket *b,
- const char *buf, apr_size_t length, apr_pool_t *p)
-{
- ap_bucket_pool *h;
-
- h = malloc(sizeof(*h));
- if (h == NULL) {
- return NULL;
- }
-
- /* XXX: we lose the const qualifier here which indicates
- * there's something screwy with the API...
- */
- h->base = (char *) buf;
- h->p = p;
-
- b = ap_bucket_make_shared(b, h, 0, length);
- if (b == NULL) {
- free(h);
- return NULL;
- }
-
- b->type = &ap_pool_type;
- h->b = b;
-
- apr_register_cleanup(h->p, b->data, pool_bucket_cleanup, apr_null_cleanup);
- return b;
-}
-
-APR_DECLARE(ap_bucket *) ap_bucket_create_pool(
- const char *buf, apr_size_t length, apr_pool_t *p)
-{
- ap_bucket_do_create(ap_bucket_make_pool(b, buf, length, p));
-}
-
-APR_DECLARE_DATA const ap_bucket_type ap_pool_type = {
- "POOL", 5,
- pool_destroy,
- pool_read,
- ap_bucket_setaside_notimpl,
- ap_bucket_split_shared,
- ap_bucket_copy_shared
-};
diff --git a/buckets/ap_buckets_refcount.c b/buckets/ap_buckets_refcount.c
deleted file mode 100644
index e15f0455..00000000
--- a/buckets/ap_buckets_refcount.c
+++ /dev/null
@@ -1,153 +0,0 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation. 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. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 APACHE SOFTWARE FOUNDATION OR
- * ITS 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.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-#include <stdlib.h>
-
-#include "apr_errno.h"
-
-#include "ap_buckets.h"
-
-APR_DECLARE_NONSTD(apr_status_t) ap_bucket_split_shared(ap_bucket *a, apr_off_t point)
-{
- ap_bucket *b;
- ap_bucket_shared *ad, *bd;
- apr_status_t rv;
-
- if (point < 0 || point > a->length) {
- return APR_EINVAL;
- }
-
- rv = ap_bucket_copy_shared(a, &b);
- if (rv != APR_SUCCESS) {
- return rv;
- }
-
- ad = a->data;
- bd = b->data;
-
- a->length = point;
- ad->end = ad->start + point;
- b->length -= point;
- bd->start += point;
-
- AP_BUCKET_INSERT_AFTER(a, b);
-
- return APR_SUCCESS;
-}
-
-APR_DECLARE_NONSTD(apr_status_t) ap_bucket_copy_shared(ap_bucket *a, ap_bucket **c)
-{
- ap_bucket *b;
- ap_bucket_shared *ad, *bd;
- ap_bucket_refcount *r;
-
- b = malloc(sizeof(*b));
- if (b == NULL) {
- return APR_ENOMEM;
- }
- bd = malloc(sizeof(*bd));
- if (bd == NULL) {
- free(b);
- return APR_ENOMEM;
- }
- *b = *a;
- ad = a->data;
- b->data = bd;
- *bd = *ad;
-
- r = ad->data;
- r->refcount += 1;
-
- *c = b;
-
- return APR_SUCCESS;
-}
-
-APR_DECLARE(void *) ap_bucket_destroy_shared(void *data)
-{
- ap_bucket_shared *s = data;
- ap_bucket_refcount *r = s->data;
-
- free(s);
- r->refcount -= 1;
- if (r->refcount == 0) {
- return r;
- }
- else {
- return NULL;
- }
-}
-
-APR_DECLARE(ap_bucket *) ap_bucket_make_shared(ap_bucket *b, void *data,
- apr_off_t start, apr_off_t end)
-{
- ap_bucket_shared *s;
- ap_bucket_refcount *r = data;
-
- s = malloc(sizeof(*s));
- if (s == NULL) {
- return NULL;
- }
-
- b->data = s;
- b->length = end - start;
- /* caller initializes the type field and function pointers */
- s->start = start;
- s->end = end;
- s->data = r;
- r->refcount = 1;
- /* caller initializes the rest of r */
-
- return b;
-}
diff --git a/buckets/ap_buckets_simple.c b/buckets/ap_buckets_simple.c
deleted file mode 100644
index 8f27aad8..00000000
--- a/buckets/ap_buckets_simple.c
+++ /dev/null
@@ -1,209 +0,0 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation. 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. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 APACHE SOFTWARE FOUNDATION OR
- * ITS 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.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-#include "ap_buckets.h"
-#include <stdlib.h>
-
-/*
- * We can't simplify this function by using an ap_bucket_make function
- * because we aren't sure of the exact type of this bucket.
- */
-static apr_status_t simple_copy(ap_bucket *a, ap_bucket **c)
-{
- ap_bucket *b;
- ap_bucket_simple *ad, *bd;
-
- b = malloc(sizeof(*b));
- if (b == NULL) {
- return APR_ENOMEM;
- }
- bd = malloc(sizeof(*bd));
- if (bd == NULL) {
- free(b);
- return APR_ENOMEM;
- }
- *b = *a;
- ad = a->data;
- b->data = bd;
- *bd = *ad;
-
- *c = b;
-
- return APR_SUCCESS;
-}
-
-static apr_status_t simple_split(ap_bucket *a, apr_off_t point)
-{
- ap_bucket *b;
- ap_bucket_simple *ad, *bd;
- apr_status_t rv;
-
- if (point < 0 || point > a->length) {
- return APR_EINVAL;
- }
-
- rv = simple_copy(a, &b);
- if (rv != APR_SUCCESS) {
- return rv;
- }
-
- ad = a->data;
- bd = b->data;
-
- a->length = point;
- ad->end = ad->start + point;
- b->length -= point;
- bd->start += point;
-
- AP_BUCKET_INSERT_AFTER(a, b);
-
- return APR_SUCCESS;
-}
-
-static apr_status_t simple_read(ap_bucket *b, const char **str,
- apr_size_t *len, ap_read_type block)
-{
- ap_bucket_simple *bd = b->data;
- *str = bd->start;
- *len = bd->end - bd->start;
- return APR_SUCCESS;
-}
-
-APR_DECLARE(ap_bucket *) ap_bucket_make_immortal(ap_bucket *b,
- const char *buf, apr_size_t length)
-{
- ap_bucket_simple *bd;
-
- bd = malloc(sizeof(*bd));
- if (bd == NULL) {
- return NULL;
- }
-
- bd->start = buf;
- bd->end = buf+length;
-
- b->type = &ap_immortal_type;
- b->length = length;
- b->data = bd;
-
- return b;
-}
-
-APR_DECLARE(ap_bucket *) ap_bucket_create_immortal(
- const char *buf, apr_size_t length)
-{
- ap_bucket_do_create(ap_bucket_make_immortal(b, buf, length));
-}
-
-/*
- * XXX: This function could do with some tweaking to reduce memory
- * usage in various cases, e.g. share buffers in the heap between all
- * the buckets that are set aside, or even spool set-aside data to
- * disk if it gets too voluminous (but if it does then that's probably
- * a bug elsewhere). There should probably be a ap_brigade_setaside()
- * function that co-ordinates the action of all the bucket setaside
- * functions to improve memory efficiency.
- */
-static apr_status_t transient_setaside(ap_bucket *b)
-{
- ap_bucket_simple *bd;
- const char *start, *end;
- apr_size_t w;
-
- bd = b->data;
- start = bd->start;
- end = bd->end;
- /* XXX: handle small heap buckets */
- b = ap_bucket_make_heap(b, start, end-start, 1, &w);
- if (b == NULL || w != end-start) {
- return APR_ENOMEM;
- }
- free(bd);
- return APR_SUCCESS;
-}
-
-APR_DECLARE(ap_bucket *) ap_bucket_make_transient(ap_bucket *b,
- const char *buf, apr_size_t length)
-{
- b = ap_bucket_make_immortal(b, buf, length);
- if (b == NULL) {
- return NULL;
- }
- b->type = &ap_transient_type;
- return b;
-}
-
-APR_DECLARE(ap_bucket *) ap_bucket_create_transient(
- const char *buf, apr_size_t length)
-{
- ap_bucket_do_create(ap_bucket_make_transient(b, buf, length));
-}
-
-const ap_bucket_type ap_immortal_type = {
- "IMMORTAL", 5,
- free,
- simple_read,
- ap_bucket_setaside_notimpl,
- simple_split,
- simple_copy
-};
-
-APR_DECLARE_DATA const ap_bucket_type ap_transient_type = {
- "TRANSIENT", 5,
- ap_bucket_destroy_notimpl,
- simple_read,
- transient_setaside,
- simple_split,
- simple_copy
-};
diff --git a/buckets/ap_buckets_socket.c b/buckets/ap_buckets_socket.c
deleted file mode 100644
index 996227b0..00000000
--- a/buckets/ap_buckets_socket.c
+++ /dev/null
@@ -1,144 +0,0 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation. 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. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 APACHE SOFTWARE FOUNDATION OR
- * ITS 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.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-#include "apr_lib.h"
-#include "ap_buckets.h"
-#include <stdlib.h>
-
-/* XXX: We should obey the block flag */
-static apr_status_t socket_read(ap_bucket *a, const char **str,
- apr_size_t *len, ap_read_type block)
-{
- apr_socket_t *p = a->data;
- ap_bucket *b;
- char *buf;
- apr_status_t rv;
- apr_int32_t timeout;
-
- if (block == AP_NONBLOCK_READ) {
- apr_getsocketopt(p, APR_SO_TIMEOUT, &timeout);
- apr_setsocketopt(p, APR_SO_TIMEOUT, 0);
- }
-
- buf = malloc(HUGE_STRING_LEN); /* XXX: check for failure? */
- *str = buf;
- *len = HUGE_STRING_LEN;
- rv = apr_recv(p, buf, len);
-
- if (block == AP_NONBLOCK_READ) {
- apr_setsocketopt(p, APR_SO_TIMEOUT, timeout);
- }
-
- if (rv != APR_SUCCESS && rv != APR_EOF) {
- *str = NULL;
- free(buf);
- return rv;
- }
- /*
- * Change the current bucket to refer to what we read,
- * even if we read nothing because we hit EOF.
- */
- ap_bucket_make_heap(a, buf, *len, 0, NULL); /* XXX: check for failure? */
- /*
- * If there's more to read we have to keep the rest of the socket
- * for later. XXX: Note that more complicated bucket types that
- * refer to data not in memory and must therefore have a read()
- * function similar to this one should be wary of copying this
- * code because if they have a destroy function they probably
- * want to migrate the bucket's subordinate structure from the
- * old bucket to a raw new one and adjust it as appropriate,
- * rather than destroying the old one and creating a completely
- * new bucket.
- *
- * Even if there is nothing more to read, don't close the socket here
- * as we have to use it to send any response :) We could shut it
- * down for reading, but there is no benefit to doing so.
- */
- if (*len > 0) {
- b = ap_bucket_create_socket(p);
- AP_BUCKET_INSERT_AFTER(a, b);
- }
- return APR_SUCCESS;
-}
-
-APR_DECLARE(ap_bucket *) ap_bucket_make_socket(ap_bucket *b, apr_socket_t *p)
-{
- /*
- * XXX: We rely on a cleanup on some pool or other to actually
- * destroy the socket. We should probably explicitly call apr to
- * destroy it instead.
- *
- * Note that typically the socket is allocated from the connection pool
- * so it will disappear when the connection is finished.
- */
- b->type = &ap_socket_type;
- b->length = -1;
- b->data = p;
-
- return b;
-}
-
-APR_DECLARE(ap_bucket *) ap_bucket_create_socket(apr_socket_t *p)
-{
- ap_bucket_do_create(ap_bucket_make_socket(b, p));
-}
-
-APR_DECLARE_DATA const ap_bucket_type ap_socket_type = {
- "SOCKET", 5,
- ap_bucket_destroy_notimpl,
- socket_read,
- ap_bucket_setaside_notimpl,
- ap_bucket_split_notimpl,
- ap_bucket_copy_notimpl
-};
diff --git a/buckets/apr_buckets.c b/buckets/apr_buckets.c
deleted file mode 100644
index 34fba9c4..00000000
--- a/buckets/apr_buckets.c
+++ /dev/null
@@ -1,295 +0,0 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation. 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. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 APACHE SOFTWARE FOUNDATION OR
- * ITS 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.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-#include "apr.h"
-#include "apr_lib.h"
-#include "apr_pools.h"
-#include "apr_tables.h"
-#include "apr_errno.h"
-
-#include <stdlib.h>
-#if APR_HAVE_SYS_UIO_H
-#include <sys/uio.h>
-#endif
-
-#include "ap_buckets.h"
-
-static apr_array_header_t *bucket_types;
-
-static apr_status_t ap_brigade_cleanup(void *data)
-{
- ap_bucket_brigade *b = data;
- ap_bucket *e;
-
- /*
- * Bah! We can't use AP_RING_FOREACH here because this bucket has
- * gone away when we dig inside it to get the next one.
- */
- while (!AP_BRIGADE_EMPTY(b)) {
- e = AP_BRIGADE_FIRST(b);
- AP_BUCKET_REMOVE(e);
- ap_bucket_destroy(e);
- }
- /*
- * We don't need to free(bb) because it's allocated from a pool.
- */
- return APR_SUCCESS;
-}
-APR_DECLARE(apr_status_t) ap_brigade_destroy(ap_bucket_brigade *b)
-{
- apr_kill_cleanup(b->p, b, ap_brigade_cleanup);
- return ap_brigade_cleanup(b);
-}
-
-APR_DECLARE(ap_bucket_brigade *) ap_brigade_create(apr_pool_t *p)
-{
- ap_bucket_brigade *b;
-
- b = apr_palloc(p, sizeof(*b));
- b->p = p;
- AP_RING_INIT(&b->list, ap_bucket, link);
-
- apr_register_cleanup(b->p, b, ap_brigade_cleanup, ap_brigade_cleanup);
- return b;
-}
-
-APR_DECLARE(ap_bucket_brigade *) ap_brigade_split(ap_bucket_brigade *b,
- ap_bucket *e)
-{
- ap_bucket_brigade *a;
- ap_bucket *f;
-
- a = ap_brigade_create(b->p);
- /* Return an empty brigade if there is nothing left in
- * the first brigade to split off
- */
- if (e != AP_BRIGADE_SENTINEL(b)) {
- f = AP_RING_LAST(&b->list);
- AP_RING_UNSPLICE(e, f, link);
- AP_RING_SPLICE_HEAD(&a->list, e, f, ap_bucket, link);
- }
- return a;
-}
-
-APR_DECLARE(ap_bucket *) ap_brigade_partition(ap_bucket_brigade *b, apr_off_t point)
-{
- ap_bucket *e;
- const char *s;
- apr_size_t len;
-
- if (point < 0)
- return NULL;
-
- AP_BRIGADE_FOREACH(e, b) {
- /* bucket is of a known length */
- if ((point > e->length) && (e->length != -1)) {
- if (AP_BUCKET_IS_EOS(e))
- return NULL;
- point -= e->length;
- }
- else if (point == e->length) {
- return AP_BUCKET_NEXT(e);
- }
- else {
- /* try to split the bucket natively */
- if (ap_bucket_split(e, point) != APR_ENOTIMPL)
- return AP_BUCKET_NEXT(e);
-
- /* if the bucket cannot be split, we must read from it,
- * changing its type to one that can be split */
- if (ap_bucket_read(e, &s, &len, AP_BLOCK_READ) != APR_SUCCESS)
- return NULL;
-
- if (point < len) {
- if (ap_bucket_split(e, point) == APR_SUCCESS)
- return AP_BUCKET_NEXT(e);
- else
- return NULL;
- }
- else if (point == len)
- return AP_BUCKET_NEXT(e);
- else
- point -= len;
- }
- }
- return NULL;
-}
-
-APR_DECLARE(int) ap_brigade_to_iovec(ap_bucket_brigade *b,
- struct iovec *vec, int nvec)
-{
- ap_bucket *e;
- struct iovec *orig;
- apr_size_t iov_len;
-
- orig = vec;
- AP_BRIGADE_FOREACH(e, b) {
- if (nvec-- == 0)
- break;
- ap_bucket_read(e, (const char **)&vec->iov_base, &iov_len, AP_NONBLOCK_READ);
- vec->iov_len = iov_len; /* set indirectly in case size differs */
- ++vec;
- }
- return vec - orig;
-}
-
-APR_DECLARE(int) ap_brigade_vputstrs(ap_bucket_brigade *b, va_list va)
-{
- ap_bucket *r;
- const char *x;
- int j, k;
- apr_size_t i;
-
- for (k = 0;;) {
- x = va_arg(va, const char *);
- if (x == NULL)
- break;
- j = strlen(x);
-
- /* XXX: copy or not? let the caller decide? */
- r = ap_bucket_create_heap(x, j, 1, &i);
- if (i != j) {
- /* Do we need better error reporting? */
- return -1;
- }
- k += i;
-
- AP_BRIGADE_INSERT_TAIL(b, r);
- }
-
- return k;
-}
-
-APR_DECLARE_NONSTD(int) ap_brigade_putstrs(ap_bucket_brigade *b, ...)
-{
- va_list va;
- int written;
-
- va_start(va, b);
- written = ap_brigade_vputstrs(b, va);
- va_end(va);
- return written;
-}
-
-APR_DECLARE_NONSTD(int) ap_brigade_printf(ap_bucket_brigade *b, const char *fmt, ...)
-{
- va_list ap;
- int res;
-
- va_start(ap, fmt);
- res = ap_brigade_vprintf(b, fmt, ap);
- va_end(ap);
- return res;
-}
-
-APR_DECLARE(int) ap_brigade_vprintf(ap_bucket_brigade *b, const char *fmt, va_list va)
-{
- /* XXX: This needs to be replaced with a function to printf
- * directly into a bucket. I'm being lazy right now. RBB
- */
- char buf[4096];
- ap_bucket *r;
- int res;
-
- res = apr_vsnprintf(buf, 4096, fmt, va);
-
- r = ap_bucket_create_heap(buf, strlen(buf), 1, NULL);
- AP_BRIGADE_INSERT_TAIL(b, r);
-
- return res;
-}
-
-void ap_init_bucket_types(apr_pool_t *p)
-{
- bucket_types = apr_make_array(p, 8, sizeof(ap_bucket_type));
-
- ap_insert_bucket_type(&ap_eos_type);
- ap_insert_bucket_type(&ap_file_type);
- ap_insert_bucket_type(&ap_heap_type);
-#ifdef AP_USE_MMAP_FILES
- ap_insert_bucket_type(&ap_mmap_type);
-#endif
- ap_insert_bucket_type(&ap_pipe_type);
- ap_insert_bucket_type(&ap_immortal_type);
- ap_insert_bucket_type(&ap_transient_type);
- ap_insert_bucket_type(&ap_socket_type);
-}
-
-int ap_insert_bucket_type(const ap_bucket_type *type)
-{
- const ap_bucket_type **newone;
-
- newone = (const ap_bucket_type **)apr_push_array(bucket_types);
- newone = &type;
-
- return bucket_types->nelts - 1;
-}
-
-APR_DECLARE_NONSTD(apr_status_t) ap_bucket_setaside_notimpl(ap_bucket *data)
-{
- return APR_ENOTIMPL;
-}
-
-APR_DECLARE_NONSTD(apr_status_t) ap_bucket_split_notimpl(ap_bucket *data, apr_off_t point)
-{
- return APR_ENOTIMPL;
-}
-APR_DECLARE_NONSTD(apr_status_t) ap_bucket_copy_notimpl(ap_bucket *e, ap_bucket **c)
-{
- return APR_ENOTIMPL;
-}
-APR_DECLARE_NONSTD(void) ap_bucket_destroy_notimpl(void *data)
-{
- return;
-}
diff --git a/buckets/apr_buckets_eos.c b/buckets/apr_buckets_eos.c
deleted file mode 100644
index d7d20198..00000000
--- a/buckets/apr_buckets_eos.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation. 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. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 APACHE SOFTWARE FOUNDATION OR
- * ITS 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.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-#include "ap_buckets.h"
-#include <stdlib.h>
-
-static apr_status_t eos_read(ap_bucket *b, const char **str,
- apr_size_t *len, ap_read_type block)
-{
- *str = NULL;
- *len = 0;
- return APR_SUCCESS;
-}
-
-static apr_status_t eos_copy(ap_bucket *e, ap_bucket **c)
-{
- *c = ap_bucket_create_eos();
- return APR_SUCCESS;
-}
-
-APR_DECLARE(ap_bucket *) ap_bucket_make_eos(ap_bucket *b)
-{
- b->length = 0;
- b->data = NULL;
-
- b->type = &ap_eos_type;
-
- return b;
-}
-
-APR_DECLARE(ap_bucket *) ap_bucket_create_eos(void)
-{
- ap_bucket_do_create(ap_bucket_make_eos(b));
-}
-
-APR_DECLARE_DATA const ap_bucket_type ap_eos_type = {
- "EOS", 5,
- ap_bucket_destroy_notimpl,
- eos_read,
- ap_bucket_setaside_notimpl,
- ap_bucket_split_notimpl,
- eos_copy
-};
diff --git a/buckets/apr_buckets_file.c b/buckets/apr_buckets_file.c
deleted file mode 100644
index dc3922db..00000000
--- a/buckets/apr_buckets_file.c
+++ /dev/null
@@ -1,196 +0,0 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation. 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. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 APACHE SOFTWARE FOUNDATION OR
- * ITS 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.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-#include "apr_lib.h"
-#include "apr_file_io.h"
-#include "ap_buckets.h"
-#include <stdlib.h>
-
-/* Allow Apache to use ap_mmap */
-#ifdef AP_USE_MMAP_FILES
-#include "apr_mmap.h"
-
-/* mmap support for static files based on ideas from John Heidemann's
- * patch against 1.0.5. See
- * <http://www.isi.edu/~johnh/SOFTWARE/APACHE/index.html>.
- */
-
-/* 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.
- */
-#ifndef MMAP_THRESHOLD
-# ifdef SUNOS4
-# define MMAP_THRESHOLD (8*1024)
-# else
-# define MMAP_THRESHOLD 1
-# endif /* SUNOS4 */
-#endif /* MMAP_THRESHOLD */
-#ifndef MMAP_LIMIT
-#define MMAP_LIMIT (4*1024*1024)
-#endif
-#endif /* AP_USE_MMAP_FILES */
-
-
-/* XXX: We should obey the block flag */
-static apr_status_t file_read(ap_bucket *e, const char **str,
- apr_size_t *len, ap_read_type block)
-{
- ap_bucket_file *a = (ap_bucket_file *)e->data;
- apr_file_t *f = (apr_file_t *) a->fd;
- ap_bucket *b = NULL;
- char *buf;
- apr_status_t rv;
-#ifdef AP_USE_MMAP_FILES
- apr_mmap_t *mm = NULL;
-#endif
-
-#ifdef AP_USE_MMAP_FILES
- if ((e->length >= MMAP_THRESHOLD)
- && (e->length < MMAP_LIMIT)) {
- /* we need to protect ourselves in case we die while we've got the
- * file mmapped */
- apr_status_t status;
- if ((status = apr_mmap_create(&mm, f, a->offset, e->length,
- APR_MMAP_READ, NULL)) != APR_SUCCESS) {
- mm = NULL;
- }
- }
- else {
- mm = NULL;
- }
- if (mm) {
- ap_bucket_make_mmap(e, mm, 0, e->length); /*XXX: check for failure? */
- return ap_bucket_read(e, str, len, block);
- }
- else {
-#endif
-
- buf = malloc(HUGE_STRING_LEN);
- *str = buf;
-
- if (e->length > HUGE_STRING_LEN) {
- *len = HUGE_STRING_LEN;
- }
- else {
- *len = e->length;
- }
-
- /* Handle offset ... */
- if (a->offset) {
- rv = apr_seek(f, APR_SET, &a->offset);
- if (rv != APR_SUCCESS) {
- free(buf);
- return rv;
- }
- /* Only need to do seek the first time through */
- a->offset = 0;
- }
- rv = apr_read(f, buf, len);
- if (rv != APR_SUCCESS && rv != APR_EOF) {
- free(buf);
- return rv;
- }
-
- /*
- * Change the current bucket to refer to what we read,
- * even if we read nothing because we hit EOF.
- */
- ap_bucket_make_heap(e, buf, *len, 0, NULL); /*XXX: check for failure? */
-
- /* If we have more to read from the file, then create another bucket */
- if (*len > 0) {
- b = ap_bucket_create_file(f, 0, e->length);
- AP_BUCKET_INSERT_AFTER(e, b);
- }
-#ifdef AP_USE_MMAP_FILES
- }
-#endif
- return APR_SUCCESS;
-}
-
-APR_DECLARE(ap_bucket *) ap_bucket_make_file(ap_bucket *b, apr_file_t *fd,
- apr_off_t offset, apr_size_t len)
-{
- ap_bucket_file *f;
-
- f = malloc(sizeof(*f));
- if (f == NULL) {
- return NULL;
- }
-
- f->fd = fd;
- f->offset = offset;
-
- b->type = &ap_file_type;
- b->data = f;
- b->length = len;
-
- return b;
-}
-
-APR_DECLARE(ap_bucket *) ap_bucket_create_file(apr_file_t *fd,
- apr_off_t offset, apr_size_t len)
-{
- ap_bucket_do_create(ap_bucket_make_file(b, fd, offset, len));
-}
-
-APR_DECLARE_DATA const ap_bucket_type ap_file_type = {
- "FILE", 5,
- ap_bucket_destroy_notimpl,
- file_read,
- ap_bucket_setaside_notimpl,
- ap_bucket_split_notimpl,
- ap_bucket_copy_notimpl
-};
diff --git a/buckets/apr_buckets_flush.c b/buckets/apr_buckets_flush.c
deleted file mode 100644
index 357299e2..00000000
--- a/buckets/apr_buckets_flush.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation. 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. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 APACHE SOFTWARE FOUNDATION OR
- * ITS 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.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-#include "ap_buckets.h"
-#include <stdlib.h>
-
-static apr_status_t flush_read(ap_bucket *b, const char **str,
- apr_size_t *len, ap_read_type block)
-{
- *str = NULL;
- *len = 0;
- return APR_SUCCESS;
-}
-
-static apr_status_t flush_copy(ap_bucket *e, ap_bucket **c)
-{
- *c = ap_bucket_create_flush();
- return APR_SUCCESS;
-}
-
-APR_DECLARE(ap_bucket *) ap_bucket_make_flush(ap_bucket *b)
-{
- b->length = 0;
- b->data = NULL;
-
- b->type = &ap_flush_type;
-
- return b;
-}
-
-APR_DECLARE(ap_bucket *) ap_bucket_create_flush(void)
-{
- ap_bucket_do_create(ap_bucket_make_flush(b));
-}
-
-APR_DECLARE_DATA const ap_bucket_type ap_flush_type = {
- "FLUSH", 5,
- ap_bucket_destroy_notimpl,
- flush_read,
- ap_bucket_setaside_notimpl,
- ap_bucket_split_notimpl,
- flush_copy
-};
diff --git a/buckets/apr_buckets_heap.c b/buckets/apr_buckets_heap.c
deleted file mode 100644
index f8fdf2d3..00000000
--- a/buckets/apr_buckets_heap.c
+++ /dev/null
@@ -1,150 +0,0 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation. 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. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 APACHE SOFTWARE FOUNDATION OR
- * ITS 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.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-#include "ap_buckets.h"
-#include <stdlib.h>
-
-/*
- * The size of heap bucket memory allocations.
- * XXX: This is currently a guess and should be adjusted to an
- * empirically good value.
- */
-#ifndef DEFAULT_BUCKET_SIZE
-#define DEFAULT_BUCKET_SIZE (4096)
-#endif
-
-static apr_status_t heap_read(ap_bucket *b, const char **str,
- apr_size_t *len, ap_read_type block)
-{
- ap_bucket_shared *s = b->data;
- ap_bucket_heap *h = s->data;
-
- *str = h->base + s->start;
- *len = s->end - s->start;
- return APR_SUCCESS;
-}
-
-static void heap_destroy(void *data)
-{
- ap_bucket_heap *h;
-
- h = ap_bucket_destroy_shared(data);
- if (h == NULL) {
- return;
- }
- free(h->base);
- free(h);
-}
-
-APR_DECLARE(ap_bucket *) ap_bucket_make_heap(ap_bucket *b,
- const char *buf, apr_size_t length, int copy, apr_size_t *w)
-{
- ap_bucket_heap *h;
-
- h = malloc(sizeof(*h));
- if (h == NULL) {
- return NULL;
- }
-
- if (copy) {
- h->base = malloc(DEFAULT_BUCKET_SIZE);
- if (h->base == NULL) {
- free(h);
- return NULL;
- }
- h->alloc_len = DEFAULT_BUCKET_SIZE;
- if (length > DEFAULT_BUCKET_SIZE) {
- length = DEFAULT_BUCKET_SIZE;
- }
- memcpy(h->base, buf, length);
- }
- else {
- /* XXX: we lose the const qualifier here which indicates
- * there's something screwy with the API...
- */
- h->base = (char *) buf;
- h->alloc_len = length;
- }
-
- b = ap_bucket_make_shared(b, h, 0, length);
- if (b == NULL) {
- if (copy) {
- free(h->base);
- }
- free(h);
- return NULL;
- }
-
- b->type = &ap_heap_type;
-
- if (w)
- *w = length;
-
- return b;
-}
-
-APR_DECLARE(ap_bucket *) ap_bucket_create_heap(
- const char *buf, apr_size_t length, int copy, apr_size_t *w)
-{
- ap_bucket_do_create(ap_bucket_make_heap(b, buf, length, copy, w));
-}
-
-APR_DECLARE_DATA const ap_bucket_type ap_heap_type = {
- "HEAP", 5,
- heap_destroy,
- heap_read,
- ap_bucket_setaside_notimpl,
- ap_bucket_split_shared,
- ap_bucket_copy_shared
-};
diff --git a/buckets/apr_buckets_mmap.c b/buckets/apr_buckets_mmap.c
deleted file mode 100644
index 81f426c4..00000000
--- a/buckets/apr_buckets_mmap.c
+++ /dev/null
@@ -1,125 +0,0 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation. 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. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 APACHE SOFTWARE FOUNDATION OR
- * ITS 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.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-#include "ap_buckets.h"
-#include <stdlib.h>
-
-static apr_status_t mmap_read(ap_bucket *b, const char **str,
- apr_size_t *length, ap_read_type block)
-{
- ap_bucket_shared *s = b->data;
- ap_bucket_mmap *m = s->data;
- apr_status_t ok;
- void *addr;
-
- ok = apr_mmap_offset(&addr, m->mmap, s->start);
- if (ok != APR_SUCCESS) {
- return ok;
- }
- *str = addr;
- *length = s->end - s->start;
- return APR_SUCCESS;
-}
-
-static void mmap_destroy(void *data)
-{
- ap_bucket_mmap *m;
-
- m = ap_bucket_destroy_shared(data);
- if (m == NULL) {
- return;
- }
- free(m);
-}
-
-/*
- * XXX: are the start and length arguments useful?
- */
-APR_DECLARE(ap_bucket *) ap_bucket_make_mmap(ap_bucket *b,
- apr_mmap_t *mm, apr_off_t start, apr_size_t length)
-{
- ap_bucket_mmap *m;
-
- m = malloc(sizeof(*m));
- if (m == NULL) {
- return NULL;
- }
- m->mmap = mm;
-
- b = ap_bucket_make_shared(b, m, start, start+length);
- if (b == NULL) {
- free(m);
- return NULL;
- }
-
- b->type = &ap_mmap_type;
-
- return b;
-}
-
-
-APR_DECLARE(ap_bucket *) ap_bucket_create_mmap(
- apr_mmap_t *mm, apr_off_t start, apr_size_t length)
-{
- ap_bucket_do_create(ap_bucket_make_mmap(b, mm, start, length));
-}
-
-APR_DECLARE_DATA const ap_bucket_type ap_mmap_type = {
- "MMAP", 5,
- mmap_destroy,
- mmap_read,
- ap_bucket_setaside_notimpl,
- ap_bucket_split_shared,
- ap_bucket_copy_shared
-};
diff --git a/buckets/apr_buckets_pipe.c b/buckets/apr_buckets_pipe.c
deleted file mode 100644
index 327d93d5..00000000
--- a/buckets/apr_buckets_pipe.c
+++ /dev/null
@@ -1,149 +0,0 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation. 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. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 APACHE SOFTWARE FOUNDATION OR
- * ITS 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.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-#include "apr_lib.h"
-#include "ap_buckets.h"
-#include <stdlib.h>
-
-/* XXX: We should obey the block flag */
-static apr_status_t pipe_read(ap_bucket *a, const char **str,
- apr_size_t *len, ap_read_type block)
-{
- apr_file_t *p = a->data;
- ap_bucket *b;
- char *buf;
- apr_status_t rv;
- apr_interval_time_t timeout;
-
- if (block == AP_NONBLOCK_READ) {
- apr_get_pipe_timeout(p, &timeout);
- apr_set_pipe_timeout(p, 0);
- }
-
- buf = malloc(HUGE_STRING_LEN); /* XXX: check for failure? */
- *str = buf;
- *len = HUGE_STRING_LEN;
- rv = apr_read(p, buf, len);
-
- if (block == AP_NONBLOCK_READ) {
- apr_set_pipe_timeout(p, timeout);
- }
-
- if (rv != APR_SUCCESS && rv != APR_EOF) {
- *str = NULL;
- free(buf);
- return rv;
- }
- /*
- * Change the current bucket to refer to what we read,
- * even if we read nothing because we hit EOF.
- */
- ap_bucket_make_heap(a, buf, *len, 0, NULL); /* XXX: check for failure? */
- /*
- * If there's more to read we have to keep the rest of the pipe
- * for later. Otherwise, we'll close the pipe.
- * XXX: Note that more complicated bucket types that
- * refer to data not in memory and must therefore have a read()
- * function similar to this one should be wary of copying this
- * code because if they have a destroy function they probably
- * want to migrate the bucket's subordinate structure from the
- * old bucket to a raw new one and adjust it as appropriate,
- * rather than destroying the old one and creating a completely
- * new bucket.
- */
- if (*len > 0) {
- b = ap_bucket_create_pipe(p);
- AP_BUCKET_INSERT_AFTER(a, b);
- }
- else {
- apr_close(p);
- }
- return APR_SUCCESS;
-}
-
-APR_DECLARE(ap_bucket *) ap_bucket_make_pipe(ap_bucket *b, apr_file_t *p)
-{
- /*
- * A pipe is closed when the end is reached in pipe_read(). If the
- * pipe isn't read to the end (e.g., error path), the pipe will be
- * closed when its pool goes away.
- *
- * Note that typically the pipe is allocated from the request pool
- * so it will disappear when the request is finished. However the
- * core filter may decide to set aside the tail end of a CGI
- * response if the connection is pipelined. This turns out not to
- * be a problem because the core will have read to the end of the
- * stream so the bucket(s) that it sets aside will be the heap
- * buckets created by pipe_read() above.
- */
- b->type = &ap_pipe_type;
- b->length = -1;
- b->data = p;
-
- return b;
-}
-
-APR_DECLARE(ap_bucket *) ap_bucket_create_pipe(apr_file_t *p)
-{
- ap_bucket_do_create(ap_bucket_make_pipe(b, p));
-}
-
-APR_DECLARE_DATA const ap_bucket_type ap_pipe_type = {
- "PIPE", 5,
- ap_bucket_destroy_notimpl,
- pipe_read,
- ap_bucket_setaside_notimpl,
- ap_bucket_split_notimpl,
- ap_bucket_copy_notimpl
-};
diff --git a/buckets/apr_buckets_pool.c b/buckets/apr_buckets_pool.c
deleted file mode 100644
index 6c9b2654..00000000
--- a/buckets/apr_buckets_pool.c
+++ /dev/null
@@ -1,142 +0,0 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation. 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. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 APACHE SOFTWARE FOUNDATION OR
- * ITS 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.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-#include "ap_buckets.h"
-#include <stdlib.h>
-
-static apr_status_t pool_bucket_cleanup(void *data)
-{
- ap_bucket_shared *s = data;
- ap_bucket_shared *new;
- ap_bucket_pool *h = s->data;
- ap_bucket *b = h->b;
- apr_size_t w;
-
- ap_bucket_make_heap(b, h->base, b->length, 1, &w);
- new = b->data;
-
- new->start = s->start;
- new->end = s->end;
-
- ap_bucket_destroy_shared(s);
- return APR_SUCCESS;
-}
-
-static apr_status_t pool_read(ap_bucket *b, const char **str,
- apr_size_t *len, ap_read_type block)
-{
- ap_bucket_shared *s = b->data;
- ap_bucket_pool *h = s->data;
-
- *str = h->base + s->start;
- *len = s->end - s->start;
- return APR_SUCCESS;
-}
-
-static void pool_destroy(void *data)
-{
- ap_bucket_shared *s = data;
- ap_bucket_pool *h = s->data;
-
- apr_kill_cleanup(h->p, data, pool_bucket_cleanup);
- h = ap_bucket_destroy_shared(data);
- if (h == NULL) {
- return;
- }
- free(h);
-}
-
-APR_DECLARE(ap_bucket *) ap_bucket_make_pool(ap_bucket *b,
- const char *buf, apr_size_t length, apr_pool_t *p)
-{
- ap_bucket_pool *h;
-
- h = malloc(sizeof(*h));
- if (h == NULL) {
- return NULL;
- }
-
- /* XXX: we lose the const qualifier here which indicates
- * there's something screwy with the API...
- */
- h->base = (char *) buf;
- h->p = p;
-
- b = ap_bucket_make_shared(b, h, 0, length);
- if (b == NULL) {
- free(h);
- return NULL;
- }
-
- b->type = &ap_pool_type;
- h->b = b;
-
- apr_register_cleanup(h->p, b->data, pool_bucket_cleanup, apr_null_cleanup);
- return b;
-}
-
-APR_DECLARE(ap_bucket *) ap_bucket_create_pool(
- const char *buf, apr_size_t length, apr_pool_t *p)
-{
- ap_bucket_do_create(ap_bucket_make_pool(b, buf, length, p));
-}
-
-APR_DECLARE_DATA const ap_bucket_type ap_pool_type = {
- "POOL", 5,
- pool_destroy,
- pool_read,
- ap_bucket_setaside_notimpl,
- ap_bucket_split_shared,
- ap_bucket_copy_shared
-};
diff --git a/buckets/apr_buckets_refcount.c b/buckets/apr_buckets_refcount.c
deleted file mode 100644
index e15f0455..00000000
--- a/buckets/apr_buckets_refcount.c
+++ /dev/null
@@ -1,153 +0,0 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation. 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. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 APACHE SOFTWARE FOUNDATION OR
- * ITS 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.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-#include <stdlib.h>
-
-#include "apr_errno.h"
-
-#include "ap_buckets.h"
-
-APR_DECLARE_NONSTD(apr_status_t) ap_bucket_split_shared(ap_bucket *a, apr_off_t point)
-{
- ap_bucket *b;
- ap_bucket_shared *ad, *bd;
- apr_status_t rv;
-
- if (point < 0 || point > a->length) {
- return APR_EINVAL;
- }
-
- rv = ap_bucket_copy_shared(a, &b);
- if (rv != APR_SUCCESS) {
- return rv;
- }
-
- ad = a->data;
- bd = b->data;
-
- a->length = point;
- ad->end = ad->start + point;
- b->length -= point;
- bd->start += point;
-
- AP_BUCKET_INSERT_AFTER(a, b);
-
- return APR_SUCCESS;
-}
-
-APR_DECLARE_NONSTD(apr_status_t) ap_bucket_copy_shared(ap_bucket *a, ap_bucket **c)
-{
- ap_bucket *b;
- ap_bucket_shared *ad, *bd;
- ap_bucket_refcount *r;
-
- b = malloc(sizeof(*b));
- if (b == NULL) {
- return APR_ENOMEM;
- }
- bd = malloc(sizeof(*bd));
- if (bd == NULL) {
- free(b);
- return APR_ENOMEM;
- }
- *b = *a;
- ad = a->data;
- b->data = bd;
- *bd = *ad;
-
- r = ad->data;
- r->refcount += 1;
-
- *c = b;
-
- return APR_SUCCESS;
-}
-
-APR_DECLARE(void *) ap_bucket_destroy_shared(void *data)
-{
- ap_bucket_shared *s = data;
- ap_bucket_refcount *r = s->data;
-
- free(s);
- r->refcount -= 1;
- if (r->refcount == 0) {
- return r;
- }
- else {
- return NULL;
- }
-}
-
-APR_DECLARE(ap_bucket *) ap_bucket_make_shared(ap_bucket *b, void *data,
- apr_off_t start, apr_off_t end)
-{
- ap_bucket_shared *s;
- ap_bucket_refcount *r = data;
-
- s = malloc(sizeof(*s));
- if (s == NULL) {
- return NULL;
- }
-
- b->data = s;
- b->length = end - start;
- /* caller initializes the type field and function pointers */
- s->start = start;
- s->end = end;
- s->data = r;
- r->refcount = 1;
- /* caller initializes the rest of r */
-
- return b;
-}
diff --git a/buckets/apr_buckets_simple.c b/buckets/apr_buckets_simple.c
deleted file mode 100644
index 8f27aad8..00000000
--- a/buckets/apr_buckets_simple.c
+++ /dev/null
@@ -1,209 +0,0 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation. 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. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 APACHE SOFTWARE FOUNDATION OR
- * ITS 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.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-#include "ap_buckets.h"
-#include <stdlib.h>
-
-/*
- * We can't simplify this function by using an ap_bucket_make function
- * because we aren't sure of the exact type of this bucket.
- */
-static apr_status_t simple_copy(ap_bucket *a, ap_bucket **c)
-{
- ap_bucket *b;
- ap_bucket_simple *ad, *bd;
-
- b = malloc(sizeof(*b));
- if (b == NULL) {
- return APR_ENOMEM;
- }
- bd = malloc(sizeof(*bd));
- if (bd == NULL) {
- free(b);
- return APR_ENOMEM;
- }
- *b = *a;
- ad = a->data;
- b->data = bd;
- *bd = *ad;
-
- *c = b;
-
- return APR_SUCCESS;
-}
-
-static apr_status_t simple_split(ap_bucket *a, apr_off_t point)
-{
- ap_bucket *b;
- ap_bucket_simple *ad, *bd;
- apr_status_t rv;
-
- if (point < 0 || point > a->length) {
- return APR_EINVAL;
- }
-
- rv = simple_copy(a, &b);
- if (rv != APR_SUCCESS) {
- return rv;
- }
-
- ad = a->data;
- bd = b->data;
-
- a->length = point;
- ad->end = ad->start + point;
- b->length -= point;
- bd->start += point;
-
- AP_BUCKET_INSERT_AFTER(a, b);
-
- return APR_SUCCESS;
-}
-
-static apr_status_t simple_read(ap_bucket *b, const char **str,
- apr_size_t *len, ap_read_type block)
-{
- ap_bucket_simple *bd = b->data;
- *str = bd->start;
- *len = bd->end - bd->start;
- return APR_SUCCESS;
-}
-
-APR_DECLARE(ap_bucket *) ap_bucket_make_immortal(ap_bucket *b,
- const char *buf, apr_size_t length)
-{
- ap_bucket_simple *bd;
-
- bd = malloc(sizeof(*bd));
- if (bd == NULL) {
- return NULL;
- }
-
- bd->start = buf;
- bd->end = buf+length;
-
- b->type = &ap_immortal_type;
- b->length = length;
- b->data = bd;
-
- return b;
-}
-
-APR_DECLARE(ap_bucket *) ap_bucket_create_immortal(
- const char *buf, apr_size_t length)
-{
- ap_bucket_do_create(ap_bucket_make_immortal(b, buf, length));
-}
-
-/*
- * XXX: This function could do with some tweaking to reduce memory
- * usage in various cases, e.g. share buffers in the heap between all
- * the buckets that are set aside, or even spool set-aside data to
- * disk if it gets too voluminous (but if it does then that's probably
- * a bug elsewhere). There should probably be a ap_brigade_setaside()
- * function that co-ordinates the action of all the bucket setaside
- * functions to improve memory efficiency.
- */
-static apr_status_t transient_setaside(ap_bucket *b)
-{
- ap_bucket_simple *bd;
- const char *start, *end;
- apr_size_t w;
-
- bd = b->data;
- start = bd->start;
- end = bd->end;
- /* XXX: handle small heap buckets */
- b = ap_bucket_make_heap(b, start, end-start, 1, &w);
- if (b == NULL || w != end-start) {
- return APR_ENOMEM;
- }
- free(bd);
- return APR_SUCCESS;
-}
-
-APR_DECLARE(ap_bucket *) ap_bucket_make_transient(ap_bucket *b,
- const char *buf, apr_size_t length)
-{
- b = ap_bucket_make_immortal(b, buf, length);
- if (b == NULL) {
- return NULL;
- }
- b->type = &ap_transient_type;
- return b;
-}
-
-APR_DECLARE(ap_bucket *) ap_bucket_create_transient(
- const char *buf, apr_size_t length)
-{
- ap_bucket_do_create(ap_bucket_make_transient(b, buf, length));
-}
-
-const ap_bucket_type ap_immortal_type = {
- "IMMORTAL", 5,
- free,
- simple_read,
- ap_bucket_setaside_notimpl,
- simple_split,
- simple_copy
-};
-
-APR_DECLARE_DATA const ap_bucket_type ap_transient_type = {
- "TRANSIENT", 5,
- ap_bucket_destroy_notimpl,
- simple_read,
- transient_setaside,
- simple_split,
- simple_copy
-};
diff --git a/buckets/apr_buckets_socket.c b/buckets/apr_buckets_socket.c
deleted file mode 100644
index 996227b0..00000000
--- a/buckets/apr_buckets_socket.c
+++ /dev/null
@@ -1,144 +0,0 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation. 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. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 APACHE SOFTWARE FOUNDATION OR
- * ITS 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.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-#include "apr_lib.h"
-#include "ap_buckets.h"
-#include <stdlib.h>
-
-/* XXX: We should obey the block flag */
-static apr_status_t socket_read(ap_bucket *a, const char **str,
- apr_size_t *len, ap_read_type block)
-{
- apr_socket_t *p = a->data;
- ap_bucket *b;
- char *buf;
- apr_status_t rv;
- apr_int32_t timeout;
-
- if (block == AP_NONBLOCK_READ) {
- apr_getsocketopt(p, APR_SO_TIMEOUT, &timeout);
- apr_setsocketopt(p, APR_SO_TIMEOUT, 0);
- }
-
- buf = malloc(HUGE_STRING_LEN); /* XXX: check for failure? */
- *str = buf;
- *len = HUGE_STRING_LEN;
- rv = apr_recv(p, buf, len);
-
- if (block == AP_NONBLOCK_READ) {
- apr_setsocketopt(p, APR_SO_TIMEOUT, timeout);
- }
-
- if (rv != APR_SUCCESS && rv != APR_EOF) {
- *str = NULL;
- free(buf);
- return rv;
- }
- /*
- * Change the current bucket to refer to what we read,
- * even if we read nothing because we hit EOF.
- */
- ap_bucket_make_heap(a, buf, *len, 0, NULL); /* XXX: check for failure? */
- /*
- * If there's more to read we have to keep the rest of the socket
- * for later. XXX: Note that more complicated bucket types that
- * refer to data not in memory and must therefore have a read()
- * function similar to this one should be wary of copying this
- * code because if they have a destroy function they probably
- * want to migrate the bucket's subordinate structure from the
- * old bucket to a raw new one and adjust it as appropriate,
- * rather than destroying the old one and creating a completely
- * new bucket.
- *
- * Even if there is nothing more to read, don't close the socket here
- * as we have to use it to send any response :) We could shut it
- * down for reading, but there is no benefit to doing so.
- */
- if (*len > 0) {
- b = ap_bucket_create_socket(p);
- AP_BUCKET_INSERT_AFTER(a, b);
- }
- return APR_SUCCESS;
-}
-
-APR_DECLARE(ap_bucket *) ap_bucket_make_socket(ap_bucket *b, apr_socket_t *p)
-{
- /*
- * XXX: We rely on a cleanup on some pool or other to actually
- * destroy the socket. We should probably explicitly call apr to
- * destroy it instead.
- *
- * Note that typically the socket is allocated from the connection pool
- * so it will disappear when the connection is finished.
- */
- b->type = &ap_socket_type;
- b->length = -1;
- b->data = p;
-
- return b;
-}
-
-APR_DECLARE(ap_bucket *) ap_bucket_create_socket(apr_socket_t *p)
-{
- ap_bucket_do_create(ap_bucket_make_socket(b, p));
-}
-
-APR_DECLARE_DATA const ap_bucket_type ap_socket_type = {
- "SOCKET", 5,
- ap_bucket_destroy_notimpl,
- socket_read,
- ap_bucket_setaside_notimpl,
- ap_bucket_split_notimpl,
- ap_bucket_copy_notimpl
-};
diff --git a/crypto/.cvsignore b/crypto/.cvsignore
deleted file mode 100644
index 2c9b9300..00000000
--- a/crypto/.cvsignore
+++ /dev/null
@@ -1,4 +0,0 @@
-Makefile
-*.lo
-*.la
-.libs
diff --git a/crypto/Makefile.in b/crypto/Makefile.in
deleted file mode 100644
index 9fdbbd7f..00000000
--- a/crypto/Makefile.in
+++ /dev/null
@@ -1,5 +0,0 @@
-
-TARGETS = ap_sha1.lo
-
-top_builddir = @top_builddir@
-include $(top_builddir)/build/rules.mk
diff --git a/crypto/ap_sha1.c b/crypto/ap_sha1.c
deleted file mode 100644
index db25b54f..00000000
--- a/crypto/ap_sha1.c
+++ /dev/null
@@ -1,412 +0,0 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation. 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. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 APACHE SOFTWARE FOUNDATION OR
- * ITS 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.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-/*
- * The exported function:
- *
- * ap_sha1_base64(const char *clear, int len, char *out);
- *
- * provides a means to SHA1 crypt/encode a plaintext password in
- * a way which makes password files compatible with those commonly
- * used in netscape web and ldap installations. It was put together
- * by Clinton Wong <clintdw@netcom.com>, who also notes that:
- *
- * 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.
- *
- * See also the documentation in support/SHA1 as to hints on how to
- * migrate an existing netscape installation and other supplied utitlites.
- *
- * This software also makes use of the following component:
- *
- * 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
- */
-
-#include "ap_sha1.h"
-#include "ap_base64.h"
-#include "apr_strings.h"
-#include "apr_lib.h"
-#ifdef CHARSET_EBCDIC
-#include "apr_xlate.h"
-#endif /*CHARSET_EBCDIC*/
-#include <string.h>
-
-/* a bit faster & bigger, if defined */
-#define UNROLL_LOOPS
-
-/* NIST's proposed modification to SHA, 7/11/94 */
-#define USE_MODIFIED_SHA
-
-/* SHA f()-functions */
-#define f1(x,y,z) ((x & y) | (~x & z))
-#define f2(x,y,z) (x ^ y ^ z)
-#define f3(x,y,z) ((x & y) | (x & z) | (y & z))
-#define f4(x,y,z) (x ^ y ^ z)
-
-/* SHA constants */
-#define CONST1 0x5a827999L
-#define CONST2 0x6ed9eba1L
-#define CONST3 0x8f1bbcdcL
-#define CONST4 0xca62c1d6L
-
-/* 32-bit rotate */
-
-#define ROT32(x,n) ((x << n) | (x >> (32 - n)))
-
-#define FUNC(n,i) \
- temp = ROT32(A,5) + f##n(B,C,D) + E + W[i] + CONST##n; \
- E = D; D = C; C = ROT32(B,30); B = A; A = temp
-
-#define SHA_BLOCKSIZE 64
-
-#ifdef CHARSET_EBCDIC
-static apr_xlate_t *ebcdic2ascii_xlate;
-
-APR_DECLARE(apr_status_t) ap_SHA1InitEBCDIC(apr_xlate_t *x)
-{
- apr_status_t rv;
- int onoff;
-
- /* Only single-byte conversion is supported.
- */
- rv = apr_xlate_get_sb(x, &onoff);
- if (rv) {
- return rv;
- }
- if (!onoff) { /* If conversion is not single-byte-only */
- return APR_EINVAL;
- }
- ebcdic2ascii_xlate = x;
- return APR_SUCCESS;
-}
-#endif
-
-typedef unsigned char AP_BYTE;
-
-/* do SHA transformation */
-static void sha_transform(AP_SHA1_CTX *sha_info)
-{
- int i;
- apr_uint32_t temp, A, B, C, D, E, W[80];
-
- for (i = 0; i < 16; ++i) {
- W[i] = sha_info->data[i];
- }
- for (i = 16; i < 80; ++i) {
- W[i] = W[i-3] ^ W[i-8] ^ W[i-14] ^ W[i-16];
-#ifdef USE_MODIFIED_SHA
- W[i] = ROT32(W[i], 1);
-#endif /* USE_MODIFIED_SHA */
- }
- A = sha_info->digest[0];
- B = sha_info->digest[1];
- C = sha_info->digest[2];
- D = sha_info->digest[3];
- E = sha_info->digest[4];
-#ifdef UNROLL_LOOPS
- FUNC(1, 0); FUNC(1, 1); FUNC(1, 2); FUNC(1, 3); FUNC(1, 4);
- FUNC(1, 5); FUNC(1, 6); FUNC(1, 7); FUNC(1, 8); FUNC(1, 9);
- FUNC(1,10); FUNC(1,11); FUNC(1,12); FUNC(1,13); FUNC(1,14);
- FUNC(1,15); FUNC(1,16); FUNC(1,17); FUNC(1,18); FUNC(1,19);
-
- FUNC(2,20); FUNC(2,21); FUNC(2,22); FUNC(2,23); FUNC(2,24);
- FUNC(2,25); FUNC(2,26); FUNC(2,27); FUNC(2,28); FUNC(2,29);
- FUNC(2,30); FUNC(2,31); FUNC(2,32); FUNC(2,33); FUNC(2,34);
- FUNC(2,35); FUNC(2,36); FUNC(2,37); FUNC(2,38); FUNC(2,39);
-
- FUNC(3,40); FUNC(3,41); FUNC(3,42); FUNC(3,43); FUNC(3,44);
- FUNC(3,45); FUNC(3,46); FUNC(3,47); FUNC(3,48); FUNC(3,49);
- FUNC(3,50); FUNC(3,51); FUNC(3,52); FUNC(3,53); FUNC(3,54);
- FUNC(3,55); FUNC(3,56); FUNC(3,57); FUNC(3,58); FUNC(3,59);
-
- FUNC(4,60); FUNC(4,61); FUNC(4,62); FUNC(4,63); FUNC(4,64);
- FUNC(4,65); FUNC(4,66); FUNC(4,67); FUNC(4,68); FUNC(4,69);
- FUNC(4,70); FUNC(4,71); FUNC(4,72); FUNC(4,73); FUNC(4,74);
- FUNC(4,75); FUNC(4,76); FUNC(4,77); FUNC(4,78); FUNC(4,79);
-#else /* !UNROLL_LOOPS */
- for (i = 0; i < 20; ++i) {
- FUNC(1,i);
- }
- for (i = 20; i < 40; ++i) {
- FUNC(2,i);
- }
- for (i = 40; i < 60; ++i) {
- FUNC(3,i);
- }
- for (i = 60; i < 80; ++i) {
- FUNC(4,i);
- }
-#endif /* !UNROLL_LOOPS */
- sha_info->digest[0] += A;
- sha_info->digest[1] += B;
- sha_info->digest[2] += C;
- sha_info->digest[3] += D;
- sha_info->digest[4] += E;
-}
-
-union endianTest {
- long Long;
- char Char[sizeof(long)];
-};
-
-static char isLittleEndian(void)
-{
- static union endianTest u;
- u.Long = 1;
- return (u.Char[0] == 1);
-}
-
-/* change endianness of data */
-
-/* count is the number of bytes to do an endian flip */
-static void maybe_byte_reverse(apr_uint32_t *buffer, int count)
-{
- int i;
- AP_BYTE ct[4], *cp;
-
- if (isLittleEndian()) { /* do the swap only if it is little endian */
- count /= sizeof(apr_uint32_t);
- cp = (AP_BYTE *) buffer;
- for (i = 0; i < count; ++i) {
- ct[0] = cp[0];
- ct[1] = cp[1];
- ct[2] = cp[2];
- ct[3] = cp[3];
- cp[0] = ct[3];
- cp[1] = ct[2];
- cp[2] = ct[1];
- cp[3] = ct[0];
- cp += sizeof(apr_uint32_t);
- }
- }
-}
-
-/* initialize the SHA digest */
-
-APR_DECLARE(void) ap_SHA1Init(AP_SHA1_CTX *sha_info)
-{
- sha_info->digest[0] = 0x67452301L;
- sha_info->digest[1] = 0xefcdab89L;
- sha_info->digest[2] = 0x98badcfeL;
- sha_info->digest[3] = 0x10325476L;
- sha_info->digest[4] = 0xc3d2e1f0L;
- sha_info->count_lo = 0L;
- sha_info->count_hi = 0L;
- sha_info->local = 0;
-}
-
-/* update the SHA digest */
-
-APR_DECLARE(void) ap_SHA1Update_binary(AP_SHA1_CTX *sha_info,
- const unsigned char *buffer,
- unsigned int count)
-{
- unsigned int i;
-
- if ((sha_info->count_lo + ((apr_uint32_t) count << 3)) < sha_info->count_lo) {
- ++sha_info->count_hi;
- }
- sha_info->count_lo += (apr_uint32_t) count << 3;
- sha_info->count_hi += (apr_uint32_t) count >> 29;
- if (sha_info->local) {
- i = SHA_BLOCKSIZE - sha_info->local;
- if (i > count) {
- i = count;
- }
- memcpy(((AP_BYTE *) sha_info->data) + sha_info->local, buffer, i);
- count -= i;
- buffer += i;
- sha_info->local += i;
- if (sha_info->local == SHA_BLOCKSIZE) {
- maybe_byte_reverse(sha_info->data, SHA_BLOCKSIZE);
- sha_transform(sha_info);
- }
- else {
- return;
- }
- }
- while (count >= SHA_BLOCKSIZE) {
- memcpy(sha_info->data, buffer, SHA_BLOCKSIZE);
- buffer += SHA_BLOCKSIZE;
- count -= SHA_BLOCKSIZE;
- maybe_byte_reverse(sha_info->data, SHA_BLOCKSIZE);
- sha_transform(sha_info);
- }
- memcpy(sha_info->data, buffer, count);
- sha_info->local = count;
-}
-
-APR_DECLARE(void) ap_SHA1Update(AP_SHA1_CTX *sha_info, const char *buf,
- unsigned int count)
-{
-#ifdef CHARSET_EBCDIC
- int i;
- const AP_BYTE *buffer = (const AP_BYTE *) buf;
- apr_size_t inbytes_left, outbytes_left;
-
- if ((sha_info->count_lo + ((apr_uint32_t) count << 3)) < sha_info->count_lo) {
- ++sha_info->count_hi;
- }
- sha_info->count_lo += (apr_uint32_t) count << 3;
- sha_info->count_hi += (apr_uint32_t) count >> 29;
- /* Is there a remainder of the previous Update operation? */
- if (sha_info->local) {
- i = SHA_BLOCKSIZE - sha_info->local;
- if (i > count) {
- i = count;
- }
- inbytes_left = outbytes_left = i;
- apr_xlate_conv_buffer(ebcdic2ascii_xlate, buffer, &inbytes_left,
- ((AP_BYTE *) sha_info->data) + sha_info->local,
- &outbytes_left);
- count -= i;
- buffer += i;
- sha_info->local += i;
- if (sha_info->local == SHA_BLOCKSIZE) {
- maybe_byte_reverse(sha_info->data, SHA_BLOCKSIZE);
- sha_transform(sha_info);
- }
- else {
- return;
- }
- }
- while (count >= SHA_BLOCKSIZE) {
- inbytes_left = outbytes_left = SHA_BLOCKSIZE;
- apr_xlate_conv_buffer(ebcdic2ascii_xlate, buffer, &inbytes_left,
- (AP_BYTE *) sha_info->data, &outbytes_left);
- buffer += SHA_BLOCKSIZE;
- count -= SHA_BLOCKSIZE;
- maybe_byte_reverse(sha_info->data, SHA_BLOCKSIZE);
- sha_transform(sha_info);
- }
- inbytes_left = outbytes_left = count;
- apr_xlate_conv_buffer(ebcdic2ascii_xlate, buffer, &inbytes_left,
- (AP_BYTE *) sha_info->data, &outbytes_left);
- sha_info->local = count;
-#else
- ap_SHA1Update_binary(sha_info, (const unsigned char *) buf, count);
-#endif
-}
-
-/* finish computing the SHA digest */
-
-APR_DECLARE(void) ap_SHA1Final(unsigned char digest[SHA_DIGESTSIZE],
- AP_SHA1_CTX *sha_info)
-{
- int count, i, j;
- apr_uint32_t lo_bit_count, hi_bit_count, k;
-
- lo_bit_count = sha_info->count_lo;
- hi_bit_count = sha_info->count_hi;
- count = (int) ((lo_bit_count >> 3) & 0x3f);
- ((AP_BYTE *) sha_info->data)[count++] = 0x80;
- if (count > SHA_BLOCKSIZE - 8) {
- memset(((AP_BYTE *) sha_info->data) + count, 0, SHA_BLOCKSIZE - count);
- maybe_byte_reverse(sha_info->data, SHA_BLOCKSIZE);
- sha_transform(sha_info);
- memset((AP_BYTE *) sha_info->data, 0, SHA_BLOCKSIZE - 8);
- }
- else {
- memset(((AP_BYTE *) sha_info->data) + count, 0,
- SHA_BLOCKSIZE - 8 - count);
- }
- maybe_byte_reverse(sha_info->data, SHA_BLOCKSIZE);
- sha_info->data[14] = hi_bit_count;
- sha_info->data[15] = lo_bit_count;
- sha_transform(sha_info);
-
- for (i = 0, j = 0; j < SHA_DIGESTSIZE; i++) {
- k = sha_info->digest[i];
- digest[j++] = (unsigned char) ((k >> 24) & 0xff);
- digest[j++] = (unsigned char) ((k >> 16) & 0xff);
- digest[j++] = (unsigned char) ((k >> 8) & 0xff);
- digest[j++] = (unsigned char) (k & 0xff);
- }
-}
-
-
-APR_DECLARE(void) ap_sha1_base64(const char *clear, int len, char *out)
-{
- int l;
- AP_SHA1_CTX context;
- AP_BYTE digest[SHA_DIGESTSIZE];
-
- if (strncmp(clear, AP_SHA1PW_ID, AP_SHA1PW_IDLEN) == 0) {
- clear += AP_SHA1PW_IDLEN;
- }
-
- ap_SHA1Init(&context);
- ap_SHA1Update(&context, clear, len);
- ap_SHA1Final(digest, &context);
-
- /* private marker. */
- apr_cpystrn(out, AP_SHA1PW_ID, AP_SHA1PW_IDLEN + 1);
-
- /* SHA1 hash is always 20 chars */
- l = ap_base64encode_binary(out + AP_SHA1PW_IDLEN, digest, sizeof(digest));
- out[l + AP_SHA1PW_IDLEN] = '\0';
-
- /*
- * output of base64 encoded SHA1 is always 28 chars + AP_SHA1PW_IDLEN
- */
-}
diff --git a/crypto/apr_sha1.c b/crypto/apr_sha1.c
deleted file mode 100644
index db25b54f..00000000
--- a/crypto/apr_sha1.c
+++ /dev/null
@@ -1,412 +0,0 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation. 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. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 APACHE SOFTWARE FOUNDATION OR
- * ITS 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.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-/*
- * The exported function:
- *
- * ap_sha1_base64(const char *clear, int len, char *out);
- *
- * provides a means to SHA1 crypt/encode a plaintext password in
- * a way which makes password files compatible with those commonly
- * used in netscape web and ldap installations. It was put together
- * by Clinton Wong <clintdw@netcom.com>, who also notes that:
- *
- * 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.
- *
- * See also the documentation in support/SHA1 as to hints on how to
- * migrate an existing netscape installation and other supplied utitlites.
- *
- * This software also makes use of the following component:
- *
- * 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
- */
-
-#include "ap_sha1.h"
-#include "ap_base64.h"
-#include "apr_strings.h"
-#include "apr_lib.h"
-#ifdef CHARSET_EBCDIC
-#include "apr_xlate.h"
-#endif /*CHARSET_EBCDIC*/
-#include <string.h>
-
-/* a bit faster & bigger, if defined */
-#define UNROLL_LOOPS
-
-/* NIST's proposed modification to SHA, 7/11/94 */
-#define USE_MODIFIED_SHA
-
-/* SHA f()-functions */
-#define f1(x,y,z) ((x & y) | (~x & z))
-#define f2(x,y,z) (x ^ y ^ z)
-#define f3(x,y,z) ((x & y) | (x & z) | (y & z))
-#define f4(x,y,z) (x ^ y ^ z)
-
-/* SHA constants */
-#define CONST1 0x5a827999L
-#define CONST2 0x6ed9eba1L
-#define CONST3 0x8f1bbcdcL
-#define CONST4 0xca62c1d6L
-
-/* 32-bit rotate */
-
-#define ROT32(x,n) ((x << n) | (x >> (32 - n)))
-
-#define FUNC(n,i) \
- temp = ROT32(A,5) + f##n(B,C,D) + E + W[i] + CONST##n; \
- E = D; D = C; C = ROT32(B,30); B = A; A = temp
-
-#define SHA_BLOCKSIZE 64
-
-#ifdef CHARSET_EBCDIC
-static apr_xlate_t *ebcdic2ascii_xlate;
-
-APR_DECLARE(apr_status_t) ap_SHA1InitEBCDIC(apr_xlate_t *x)
-{
- apr_status_t rv;
- int onoff;
-
- /* Only single-byte conversion is supported.
- */
- rv = apr_xlate_get_sb(x, &onoff);
- if (rv) {
- return rv;
- }
- if (!onoff) { /* If conversion is not single-byte-only */
- return APR_EINVAL;
- }
- ebcdic2ascii_xlate = x;
- return APR_SUCCESS;
-}
-#endif
-
-typedef unsigned char AP_BYTE;
-
-/* do SHA transformation */
-static void sha_transform(AP_SHA1_CTX *sha_info)
-{
- int i;
- apr_uint32_t temp, A, B, C, D, E, W[80];
-
- for (i = 0; i < 16; ++i) {
- W[i] = sha_info->data[i];
- }
- for (i = 16; i < 80; ++i) {
- W[i] = W[i-3] ^ W[i-8] ^ W[i-14] ^ W[i-16];
-#ifdef USE_MODIFIED_SHA
- W[i] = ROT32(W[i], 1);
-#endif /* USE_MODIFIED_SHA */
- }
- A = sha_info->digest[0];
- B = sha_info->digest[1];
- C = sha_info->digest[2];
- D = sha_info->digest[3];
- E = sha_info->digest[4];
-#ifdef UNROLL_LOOPS
- FUNC(1, 0); FUNC(1, 1); FUNC(1, 2); FUNC(1, 3); FUNC(1, 4);
- FUNC(1, 5); FUNC(1, 6); FUNC(1, 7); FUNC(1, 8); FUNC(1, 9);
- FUNC(1,10); FUNC(1,11); FUNC(1,12); FUNC(1,13); FUNC(1,14);
- FUNC(1,15); FUNC(1,16); FUNC(1,17); FUNC(1,18); FUNC(1,19);
-
- FUNC(2,20); FUNC(2,21); FUNC(2,22); FUNC(2,23); FUNC(2,24);
- FUNC(2,25); FUNC(2,26); FUNC(2,27); FUNC(2,28); FUNC(2,29);
- FUNC(2,30); FUNC(2,31); FUNC(2,32); FUNC(2,33); FUNC(2,34);
- FUNC(2,35); FUNC(2,36); FUNC(2,37); FUNC(2,38); FUNC(2,39);
-
- FUNC(3,40); FUNC(3,41); FUNC(3,42); FUNC(3,43); FUNC(3,44);
- FUNC(3,45); FUNC(3,46); FUNC(3,47); FUNC(3,48); FUNC(3,49);
- FUNC(3,50); FUNC(3,51); FUNC(3,52); FUNC(3,53); FUNC(3,54);
- FUNC(3,55); FUNC(3,56); FUNC(3,57); FUNC(3,58); FUNC(3,59);
-
- FUNC(4,60); FUNC(4,61); FUNC(4,62); FUNC(4,63); FUNC(4,64);
- FUNC(4,65); FUNC(4,66); FUNC(4,67); FUNC(4,68); FUNC(4,69);
- FUNC(4,70); FUNC(4,71); FUNC(4,72); FUNC(4,73); FUNC(4,74);
- FUNC(4,75); FUNC(4,76); FUNC(4,77); FUNC(4,78); FUNC(4,79);
-#else /* !UNROLL_LOOPS */
- for (i = 0; i < 20; ++i) {
- FUNC(1,i);
- }
- for (i = 20; i < 40; ++i) {
- FUNC(2,i);
- }
- for (i = 40; i < 60; ++i) {
- FUNC(3,i);
- }
- for (i = 60; i < 80; ++i) {
- FUNC(4,i);
- }
-#endif /* !UNROLL_LOOPS */
- sha_info->digest[0] += A;
- sha_info->digest[1] += B;
- sha_info->digest[2] += C;
- sha_info->digest[3] += D;
- sha_info->digest[4] += E;
-}
-
-union endianTest {
- long Long;
- char Char[sizeof(long)];
-};
-
-static char isLittleEndian(void)
-{
- static union endianTest u;
- u.Long = 1;
- return (u.Char[0] == 1);
-}
-
-/* change endianness of data */
-
-/* count is the number of bytes to do an endian flip */
-static void maybe_byte_reverse(apr_uint32_t *buffer, int count)
-{
- int i;
- AP_BYTE ct[4], *cp;
-
- if (isLittleEndian()) { /* do the swap only if it is little endian */
- count /= sizeof(apr_uint32_t);
- cp = (AP_BYTE *) buffer;
- for (i = 0; i < count; ++i) {
- ct[0] = cp[0];
- ct[1] = cp[1];
- ct[2] = cp[2];
- ct[3] = cp[3];
- cp[0] = ct[3];
- cp[1] = ct[2];
- cp[2] = ct[1];
- cp[3] = ct[0];
- cp += sizeof(apr_uint32_t);
- }
- }
-}
-
-/* initialize the SHA digest */
-
-APR_DECLARE(void) ap_SHA1Init(AP_SHA1_CTX *sha_info)
-{
- sha_info->digest[0] = 0x67452301L;
- sha_info->digest[1] = 0xefcdab89L;
- sha_info->digest[2] = 0x98badcfeL;
- sha_info->digest[3] = 0x10325476L;
- sha_info->digest[4] = 0xc3d2e1f0L;
- sha_info->count_lo = 0L;
- sha_info->count_hi = 0L;
- sha_info->local = 0;
-}
-
-/* update the SHA digest */
-
-APR_DECLARE(void) ap_SHA1Update_binary(AP_SHA1_CTX *sha_info,
- const unsigned char *buffer,
- unsigned int count)
-{
- unsigned int i;
-
- if ((sha_info->count_lo + ((apr_uint32_t) count << 3)) < sha_info->count_lo) {
- ++sha_info->count_hi;
- }
- sha_info->count_lo += (apr_uint32_t) count << 3;
- sha_info->count_hi += (apr_uint32_t) count >> 29;
- if (sha_info->local) {
- i = SHA_BLOCKSIZE - sha_info->local;
- if (i > count) {
- i = count;
- }
- memcpy(((AP_BYTE *) sha_info->data) + sha_info->local, buffer, i);
- count -= i;
- buffer += i;
- sha_info->local += i;
- if (sha_info->local == SHA_BLOCKSIZE) {
- maybe_byte_reverse(sha_info->data, SHA_BLOCKSIZE);
- sha_transform(sha_info);
- }
- else {
- return;
- }
- }
- while (count >= SHA_BLOCKSIZE) {
- memcpy(sha_info->data, buffer, SHA_BLOCKSIZE);
- buffer += SHA_BLOCKSIZE;
- count -= SHA_BLOCKSIZE;
- maybe_byte_reverse(sha_info->data, SHA_BLOCKSIZE);
- sha_transform(sha_info);
- }
- memcpy(sha_info->data, buffer, count);
- sha_info->local = count;
-}
-
-APR_DECLARE(void) ap_SHA1Update(AP_SHA1_CTX *sha_info, const char *buf,
- unsigned int count)
-{
-#ifdef CHARSET_EBCDIC
- int i;
- const AP_BYTE *buffer = (const AP_BYTE *) buf;
- apr_size_t inbytes_left, outbytes_left;
-
- if ((sha_info->count_lo + ((apr_uint32_t) count << 3)) < sha_info->count_lo) {
- ++sha_info->count_hi;
- }
- sha_info->count_lo += (apr_uint32_t) count << 3;
- sha_info->count_hi += (apr_uint32_t) count >> 29;
- /* Is there a remainder of the previous Update operation? */
- if (sha_info->local) {
- i = SHA_BLOCKSIZE - sha_info->local;
- if (i > count) {
- i = count;
- }
- inbytes_left = outbytes_left = i;
- apr_xlate_conv_buffer(ebcdic2ascii_xlate, buffer, &inbytes_left,
- ((AP_BYTE *) sha_info->data) + sha_info->local,
- &outbytes_left);
- count -= i;
- buffer += i;
- sha_info->local += i;
- if (sha_info->local == SHA_BLOCKSIZE) {
- maybe_byte_reverse(sha_info->data, SHA_BLOCKSIZE);
- sha_transform(sha_info);
- }
- else {
- return;
- }
- }
- while (count >= SHA_BLOCKSIZE) {
- inbytes_left = outbytes_left = SHA_BLOCKSIZE;
- apr_xlate_conv_buffer(ebcdic2ascii_xlate, buffer, &inbytes_left,
- (AP_BYTE *) sha_info->data, &outbytes_left);
- buffer += SHA_BLOCKSIZE;
- count -= SHA_BLOCKSIZE;
- maybe_byte_reverse(sha_info->data, SHA_BLOCKSIZE);
- sha_transform(sha_info);
- }
- inbytes_left = outbytes_left = count;
- apr_xlate_conv_buffer(ebcdic2ascii_xlate, buffer, &inbytes_left,
- (AP_BYTE *) sha_info->data, &outbytes_left);
- sha_info->local = count;
-#else
- ap_SHA1Update_binary(sha_info, (const unsigned char *) buf, count);
-#endif
-}
-
-/* finish computing the SHA digest */
-
-APR_DECLARE(void) ap_SHA1Final(unsigned char digest[SHA_DIGESTSIZE],
- AP_SHA1_CTX *sha_info)
-{
- int count, i, j;
- apr_uint32_t lo_bit_count, hi_bit_count, k;
-
- lo_bit_count = sha_info->count_lo;
- hi_bit_count = sha_info->count_hi;
- count = (int) ((lo_bit_count >> 3) & 0x3f);
- ((AP_BYTE *) sha_info->data)[count++] = 0x80;
- if (count > SHA_BLOCKSIZE - 8) {
- memset(((AP_BYTE *) sha_info->data) + count, 0, SHA_BLOCKSIZE - count);
- maybe_byte_reverse(sha_info->data, SHA_BLOCKSIZE);
- sha_transform(sha_info);
- memset((AP_BYTE *) sha_info->data, 0, SHA_BLOCKSIZE - 8);
- }
- else {
- memset(((AP_BYTE *) sha_info->data) + count, 0,
- SHA_BLOCKSIZE - 8 - count);
- }
- maybe_byte_reverse(sha_info->data, SHA_BLOCKSIZE);
- sha_info->data[14] = hi_bit_count;
- sha_info->data[15] = lo_bit_count;
- sha_transform(sha_info);
-
- for (i = 0, j = 0; j < SHA_DIGESTSIZE; i++) {
- k = sha_info->digest[i];
- digest[j++] = (unsigned char) ((k >> 24) & 0xff);
- digest[j++] = (unsigned char) ((k >> 16) & 0xff);
- digest[j++] = (unsigned char) ((k >> 8) & 0xff);
- digest[j++] = (unsigned char) (k & 0xff);
- }
-}
-
-
-APR_DECLARE(void) ap_sha1_base64(const char *clear, int len, char *out)
-{
- int l;
- AP_SHA1_CTX context;
- AP_BYTE digest[SHA_DIGESTSIZE];
-
- if (strncmp(clear, AP_SHA1PW_ID, AP_SHA1PW_IDLEN) == 0) {
- clear += AP_SHA1PW_IDLEN;
- }
-
- ap_SHA1Init(&context);
- ap_SHA1Update(&context, clear, len);
- ap_SHA1Final(digest, &context);
-
- /* private marker. */
- apr_cpystrn(out, AP_SHA1PW_ID, AP_SHA1PW_IDLEN + 1);
-
- /* SHA1 hash is always 20 chars */
- l = ap_base64encode_binary(out + AP_SHA1PW_IDLEN, digest, sizeof(digest));
- out[l + AP_SHA1PW_IDLEN] = '\0';
-
- /*
- * output of base64 encoded SHA1 is always 28 chars + AP_SHA1PW_IDLEN
- */
-}
diff --git a/dbm/.cvsignore b/dbm/.cvsignore
deleted file mode 100644
index 2c9b9300..00000000
--- a/dbm/.cvsignore
+++ /dev/null
@@ -1,4 +0,0 @@
-Makefile
-*.lo
-*.la
-.libs
diff --git a/dbm/Makefile.in b/dbm/Makefile.in
deleted file mode 100644
index e8ef8a26..00000000
--- a/dbm/Makefile.in
+++ /dev/null
@@ -1,6 +0,0 @@
-TARGETS = apr_dbm.lo
-
-top_builddir = @top_builddir@
-include $(top_builddir)/build/rules.mk
-
-SUBDIRS = sdbm .
diff --git a/dbm/apr_dbm.c b/dbm/apr_dbm.c
deleted file mode 100644
index 1e6eb30e..00000000
--- a/dbm/apr_dbm.c
+++ /dev/null
@@ -1,333 +0,0 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation. 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. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 APACHE SOFTWARE FOUNDATION OR
- * ITS 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.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-#include "apr.h"
-#include "apr_errno.h"
-#include "apr_pools.h"
-
-#include "apu_private.h"
-#include "apr_dbm.h"
-
-#if APU_USE_SDBM
-#include "apr_sdbm.h"
-
-typedef SDBM *real_file_t;
-typedef sdbm_datum real_datum_t;
-
-#define APR_DBM_CLOSE(f) sdbm_close(f)
-#define APR_DBM_FETCH(f, k) sdbm_fetch((f), (k))
-#define APR_DBM_STORE(f, k, v) sdbm_store((f), (k), (v), SDBM_REPLACE)
-#define APR_DBM_DELETE(f, k) sdbm_delete((f), (k))
-#define APR_DBM_FIRSTKEY(f) sdbm_firstkey(f)
-#define APR_DBM_NEXTKEY(f, k) sdbm_nextkey(f)
-#define APR_DBM_FREEDPTR(dptr) if (0) ; else /* stop "no effect" warning */
-
-#define APR_DBM_DBMODE_RO APR_READ
-#define APR_DBM_DBMODE_RW (APR_READ | APR_WRITE)
-#define APR_DBM_DBMODE_RWCREATE (APR_READ | APR_WRITE | APR_CREATE)
-
-#elif APU_USE_GDBM
-#include <gdbm.h>
-#include <stdlib.h> /* for free() */
-
-typedef GDBM_FILE real_file_t;
-typedef datum real_datum_t;
-
-#define APR_DBM_CLOSE(f) gdbm_close(f)
-#define APR_DBM_FETCH(f, k) gdbm_fetch((f), (k))
-#define APR_DBM_STORE(f, k, v) g2s(gdbm_store((f), (k), (v), GDBM_REPLACE))
-#define APR_DBM_DELETE(f, k) g2s(gdbm_delete((f), (k)))
-#define APR_DBM_FIRSTKEY(f) gdbm_firstkey(f)
-#define APR_DBM_NEXTKEY(f, k) gdbm_nextkey((f), (k))
-#define APR_DBM_FREEDPTR(dptr) ((dptr) ? free(dptr) : 0)
-
-#define NEEDS_CLEANUP
-
-#define APR_DBM_DBMODE_RO GDBM_READER
-#define APR_DBM_DBMODE_RW GDBM_WRITER
-#define APR_DBM_DBMODE_RWCREATE GDBM_WRCREAT
-
-/* map a GDBM error to an apr_status_t */
-static apr_status_t g2s(int gerr)
-{
- if (gerr == -1) {
- /* ### need to fix this */
- return APR_EINVAL;
- }
-
- return APR_SUCCESS;
-}
-
-#else
-#error a DBM implementation was not specified
-#endif
-
-
-struct apr_dbm_t
-{
- apr_pool_t *pool;
- real_file_t file;
-
- int errcode;
- const char *errmsg;
-};
-
-/* apr_datum <=> real_datum casting/conversions */
-#define A2R_DATUM(d) (*(real_datum_t *)&(d))
-#define R2A_DATUM(d) (*(apr_datum_t *)&(d))
-
-
-#ifdef NEEDS_CLEANUP
-
-static apr_status_t datum_cleanup(void *dptr)
-{
- APR_DBM_FREEDPTR(dptr);
- return APR_SUCCESS;
-}
-
-#define REG_CLEANUP(db, pdatum) \
- if ((pdatum)->dptr) \
- apr_register_cleanup((db)->pool, (pdatum)->dptr, \
- datum_cleanup, apr_null_cleanup); \
- else
-
-#else /* NEEDS_CLEANUP */
-
-#define REG_CLEANUP(db, pdatum) if (0) ; else /* stop "no effect" warning */
-
-#endif /* NEEDS_CLEANUP */
-
-static apr_status_t set_error(apr_dbm_t *db)
-{
- apr_status_t rv = APR_SUCCESS;
-
-#if APU_USE_SDBM
-
- if ((db->errcode = sdbm_error(db->file)) == 0) {
- db->errmsg = NULL;
- }
- else {
- db->errmsg = "I/O error occurred.";
- rv = APR_EINVAL; /* ### need something better */
- }
-
- /* captured it. clear it now. */
- sdbm_clearerr(db->file);
-
-#elif APU_USE_GDBM
-
- if ((db->errcode = gdbm_errno) == GDBM_NO_ERROR) {
- db->errmsg = NULL;
- }
- else {
- db->errmsg = gdbm_strerror(gdbm_errno);
- rv = APR_EINVAL; /* ### need something better */
- }
-
- /* captured it. clear it now. */
- gdbm_errno = GDBM_NO_ERROR;
-
-#endif
-
- return rv;
-}
-
-apr_status_t apr_dbm_open(apr_dbm_t **pdb, const char *pathname, int mode,
- apr_pool_t *pool)
-{
- real_file_t file;
- int dbmode;
-
- *pdb = NULL;
-
- switch (mode) {
- case APR_DBM_READONLY:
- dbmode = APR_DBM_DBMODE_RO;
- break;
- case APR_DBM_READWRITE:
- dbmode = APR_DBM_DBMODE_RW;
- break;
- case APR_DBM_RWCREATE:
- dbmode = APR_DBM_DBMODE_RWCREATE;
- break;
- default:
- return APR_EINVAL;
- }
-
-#if APU_USE_SDBM
- {
- apr_status_t rv;
-
- rv = sdbm_open(&file, pathname, dbmode, APR_OS_DEFAULT, pool);
- if (rv != APR_SUCCESS)
- return rv;
- }
-#elif APU_USE_GDBM
- {
- /* Note: stupid cast to get rid of "const" on the pathname */
- file = gdbm_open((char *) pathname, 0, dbmode, 0660, NULL);
- if (file == NULL)
- return APR_EINVAL; /* ### need a better error */
- }
-#endif
-
- /* we have an open database... return it */
- *pdb = apr_pcalloc(pool, sizeof(**pdb));
- (*pdb)->pool = pool;
- (*pdb)->file = file;
-
- return APR_SUCCESS;
-}
-
-void apr_dbm_close(apr_dbm_t *db)
-{
- APR_DBM_CLOSE(db->file);
-}
-
-apr_status_t apr_dbm_fetch(apr_dbm_t *db, apr_datum_t key, apr_datum_t *pvalue)
-{
- *(real_datum_t *) pvalue = APR_DBM_FETCH(db->file, A2R_DATUM(key));
-
- REG_CLEANUP(db, pvalue);
-
- /* store the error info into DB, and return a status code. Also, note
- that *pvalue should have been cleared on error. */
- return set_error(db);
-}
-
-apr_status_t apr_dbm_store(apr_dbm_t *db, apr_datum_t key, apr_datum_t value)
-{
- apr_status_t rv;
-
- rv = APR_DBM_STORE(db->file, A2R_DATUM(key), A2R_DATUM(value));
-
- /* ### is this the right handling of set_error() and rv? */
-
- /* store the error info into DB, and return a status code. Also, note
- that *pvalue should have been cleared on error. */
- (void) set_error(db);
-
- return rv;
-}
-
-apr_status_t apr_dbm_delete(apr_dbm_t *db, apr_datum_t key)
-{
- apr_status_t rv;
-
- rv = APR_DBM_DELETE(db->file, A2R_DATUM(key));
-
- /* ### is this the right handling of set_error() and rv? */
-
- /* store the error info into DB, and return a status code. Also, note
- that *pvalue should have been cleared on error. */
- (void) set_error(db);
-
- return rv;
-}
-
-int apr_dbm_exists(apr_dbm_t *db, apr_datum_t key)
-{
- int exists;
-
-#if APU_USE_SDBM
- {
- sdbm_datum value = sdbm_fetch(db->file, A2R_DATUM(key));
- sdbm_clearerr(db->file); /* don't need the error */
- exists = value.dptr != NULL;
- }
-#elif APU_USE_GDBM
- exists = gdbm_exists(db->file, A2R_DATUM(key)) != 0;
-#endif
- return exists;
-}
-
-apr_status_t apr_dbm_firstkey(apr_dbm_t *db, apr_datum_t *pkey)
-{
- *(real_datum_t *) pkey = APR_DBM_FIRSTKEY(db->file);
-
- REG_CLEANUP(db, pkey);
-
- /* store the error info into DB, and return a status code. Also, note
- that *pvalue should have been cleared on error. */
- return set_error(db);
-}
-
-apr_status_t apr_dbm_nextkey(apr_dbm_t *db, apr_datum_t *pkey)
-{
- *(real_datum_t *) pkey = APR_DBM_NEXTKEY(db->file, A2R_DATUM(*pkey));
-
- REG_CLEANUP(db, pkey);
-
- /* store the error info into DB, and return a status code. Also, note
- that *pvalue should have been cleared on error. */
- return set_error(db);
-}
-
-void apr_dbm_freedatum(apr_dbm_t *db, apr_datum_t data)
-{
-#ifdef NEEDS_CLEANUP
- (void) apr_run_cleanup(db->pool, data.dptr, datum_cleanup);
-#else
- APR_DBM_FREEDPTR(data.dptr);
-#endif
-}
-
-/* XXX: This is wrong... need to return a canonical errcode as part
- * of this package, and follow the apr_dso_error prototype.
- */
-void apr_dbm_geterror(apr_dbm_t *db, int *errcode, const char **errmsg)
-{
- *errcode = db->errcode;
- *errmsg = db->errmsg;
-}
diff --git a/dbm/sdbm/.cvsignore b/dbm/sdbm/.cvsignore
deleted file mode 100644
index 2c9b9300..00000000
--- a/dbm/sdbm/.cvsignore
+++ /dev/null
@@ -1,4 +0,0 @@
-Makefile
-*.lo
-*.la
-.libs
diff --git a/dbm/sdbm/Makefile.in b/dbm/sdbm/Makefile.in
deleted file mode 100644
index 88b1557f..00000000
--- a/dbm/sdbm/Makefile.in
+++ /dev/null
@@ -1,5 +0,0 @@
-
-TARGETS = sdbm.lo sdbm_hash.lo sdbm_lock.lo sdbm_pair.lo
-
-top_builddir = @top_builddir@
-include $(top_builddir)/build/rules.mk
diff --git a/dbm/sdbm/sdbm.c b/dbm/sdbm/sdbm.c
deleted file mode 100644
index d7659992..00000000
--- a/dbm/sdbm/sdbm.c
+++ /dev/null
@@ -1,613 +0,0 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation. 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. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 APACHE SOFTWARE FOUNDATION OR
- * ITS 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.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-/*
- * sdbm - ndbm work-alike hashed database library
- * based on Per-Aake Larson's Dynamic Hashing algorithms. BIT 18 (1978).
- * author: oz@nexus.yorku.ca
- * ex-public domain, ported to APR for Apache 2
- * core routines
- */
-
-#include "apr.h"
-#include "apr_file_io.h"
-#include "apr_strings.h"
-#include "apr_errno.h"
-#include "apr_sdbm.h"
-
-#include "sdbm_tune.h"
-#include "sdbm_pair.h"
-#include "sdbm_private.h"
-
-#include <string.h> /* for memset() */
-#include <stdlib.h> /* for malloc() and free() */
-
-/*
- * forward
- */
-static int getdbit (SDBM *, long);
-static apr_status_t setdbit(SDBM *, long);
-static apr_status_t getpage(SDBM *db, long);
-static sdbm_datum getnext(SDBM *db);
-static apr_status_t makroom(SDBM *, long, int);
-
-/*
- * useful macros
- */
-#define SDBM_IOERR 0x2 /* data base I/O error */
-
-#define bad(x) ((x).dptr == NULL || (x).dsize <= 0)
-#define exhash(item) sdbm_hash((item).dptr, (item).dsize)
-#define ioerr(db) ((db)->flags |= SDBM_IOERR)
-
-/* ### Does anything need these externally? */
-#define sdbm_dirfno(db) ((db)->dirf)
-#define sdbm_pagfno(db) ((db)->pagf)
-
-#define OFF_PAG(off) (apr_off_t) (off) * PBLKSIZ
-#define OFF_DIR(off) (apr_off_t) (off) * DBLKSIZ
-
-static long masks[] = {
- 000000000000, 000000000001, 000000000003, 000000000007,
- 000000000017, 000000000037, 000000000077, 000000000177,
- 000000000377, 000000000777, 000000001777, 000000003777,
- 000000007777, 000000017777, 000000037777, 000000077777,
- 000000177777, 000000377777, 000000777777, 000001777777,
- 000003777777, 000007777777, 000017777777, 000037777777,
- 000077777777, 000177777777, 000377777777, 000777777777,
- 001777777777, 003777777777, 007777777777, 017777777777
-};
-
-const sdbm_datum sdbm_nullitem = { NULL, 0 };
-
-static apr_status_t database_cleanup(void *data)
-{
- SDBM *db = data;
-
- (void) apr_close(db->dirf);
- (void) sdbm_unlock(db);
- (void) apr_close(db->pagf);
- free(db);
-
- return APR_SUCCESS;
-}
-
-apr_status_t
-sdbm_open(SDBM **db, const char *file, apr_int32_t flags, apr_fileperms_t perms, apr_pool_t *p)
-{
- char *dirname = apr_pstrcat(p, file, SDBM_DIRFEXT, NULL);
- char *pagname = apr_pstrcat(p, file, SDBM_PAGFEXT, NULL);
-
- return sdbm_prep(db, dirname, pagname, flags, perms, p);
-}
-
-apr_status_t
-sdbm_prep(SDBM **pdb, const char *dirname, const char *pagname,
- apr_int32_t flags, apr_fileperms_t perms, apr_pool_t *p)
-{
- SDBM *db;
- apr_finfo_t finfo;
- apr_status_t status;
-
- *pdb = NULL;
-
- db = malloc(sizeof(*db));
- memset(db, 0, sizeof(*db));
-
- db->pool = p;
-
- /*
- * adjust user flags so that WRONLY becomes RDWR,
- * as required by this package. Also set our internal
- * flag for RDONLY if needed.
- */
- if (!(flags & APR_WRITE)) {
- db->flags = SDBM_RDONLY;
- }
-
- flags |= APR_BINARY | APR_READ;
-
- /*
- * open the files in sequence, and stat the dirfile.
- * If we fail anywhere, undo everything, return NULL.
- */
-
- if ((status = apr_open(&db->pagf, pagname, flags, perms, p))
- != APR_SUCCESS)
- goto error;
-
- if ((status = sdbm_lock(db)) != APR_SUCCESS)
- goto error;
-
- if ((status = apr_open(&db->dirf, dirname, flags, perms, p))
- != APR_SUCCESS)
- goto error;
-
- /*
- * need the dirfile size to establish max bit number.
- */
- if ((status = apr_getfileinfo(&finfo, db->dirf)) != APR_SUCCESS)
- goto error;
-
- /*
- * zero size: either a fresh database, or one with a single,
- * unsplit data page: dirpage is all zeros.
- */
- db->dirbno = (!finfo.size) ? 0 : -1;
- db->pagbno = -1;
- db->maxbno = finfo.size * BYTESIZ;
-
- /* (apr_pcalloc zeroed the buffers) */
-
- /* make sure that we close the database at some point */
- apr_register_cleanup(p, db, database_cleanup, apr_null_cleanup);
-
- /* Done! */
- *pdb = db;
- return APR_SUCCESS;
-
- error:
- if (db->dirf != NULL)
- (void) apr_close(db->dirf);
- if (db->pagf != NULL) {
- (void) sdbm_unlock(db);
- (void) apr_close(db->pagf);
- }
- free(db);
- return status;
-}
-
-void
-sdbm_close(SDBM *db)
-{
- (void) apr_run_cleanup(db->pool, db, database_cleanup);
-}
-
-sdbm_datum
-sdbm_fetch(SDBM *db, sdbm_datum key)
-{
- if (db == NULL || bad(key))
- return sdbm_nullitem;
-
- if (getpage(db, exhash(key)) == APR_SUCCESS)
- return getpair(db->pagbuf, key);
-
- ioerr(db);
- return sdbm_nullitem;
-}
-
-static apr_status_t write_page(SDBM *db, const char *buf, long pagno)
-{
- apr_status_t status;
- apr_off_t off = OFF_PAG(pagno);
-
- if ((status = apr_seek(db->pagf, APR_SET, &off)) != APR_SUCCESS ||
- (status = apr_full_write(db->pagf, buf, PBLKSIZ, NULL)) != APR_SUCCESS) {
- ioerr(db);
- return status;
- }
-
- return APR_SUCCESS;
-}
-
-apr_status_t
-sdbm_delete(SDBM *db, const sdbm_datum key)
-{
- apr_status_t status;
-
- if (db == NULL || bad(key))
- return APR_EINVAL;
- if (sdbm_rdonly(db))
- return APR_EINVAL;
-
- if (getpage(db, exhash(key)) == APR_SUCCESS) {
- if (!delpair(db->pagbuf, key))
- return -1;
-/*
- * update the page file
- */
- if ((status = write_page(db, db->pagbuf, db->pagbno)) != APR_SUCCESS)
- return status;
-
-
- return APR_SUCCESS;
- }
-
- ioerr(db);
- return APR_EACCES;
-}
-
-apr_status_t sdbm_store(SDBM *db, sdbm_datum key, sdbm_datum val, int flags)
-{
- int need;
- register long hash;
- apr_status_t status;
-
- if (db == NULL || bad(key))
- return APR_EINVAL;
- if (sdbm_rdonly(db))
- return APR_EINVAL;
-
- need = key.dsize + val.dsize;
-/*
- * is the pair too big (or too small) for this database ??
- */
- if (need < 0 || need > PAIRMAX)
- return APR_EINVAL;
-
- if ((status = getpage(db, (hash = exhash(key)))) == APR_SUCCESS) {
-
-/*
- * if we need to replace, delete the key/data pair
- * first. If it is not there, ignore.
- */
- if (flags == SDBM_REPLACE)
- (void) delpair(db->pagbuf, key);
-#ifdef SEEDUPS
- else if (duppair(db->pagbuf, key))
- return APR_EEXIST;
-#endif
-/*
- * if we do not have enough room, we have to split.
- */
- if (!fitpair(db->pagbuf, need))
- if ((status = makroom(db, hash, need)) != APR_SUCCESS)
- return status;
-/*
- * we have enough room or split is successful. insert the key,
- * and update the page file.
- */
- (void) putpair(db->pagbuf, key, val);
-
- if ((status = write_page(db, db->pagbuf, db->pagbno)) != APR_SUCCESS)
- return status;
-
- /*
- * success
- */
- return APR_SUCCESS;
- }
-
- ioerr(db);
- return status;
-}
-
-/*
- * makroom - make room by splitting the overfull page
- * this routine will attempt to make room for SPLTMAX times before
- * giving up.
- */
-static apr_status_t
-makroom(SDBM *db, long hash, int need)
-{
- long newp;
- char twin[PBLKSIZ];
- char *pag = db->pagbuf;
- char *new = twin;
- register int smax = SPLTMAX;
- apr_status_t status;
-
- do {
-/*
- * split the current page
- */
- (void) splpage(pag, new, db->hmask + 1);
-/*
- * address of the new page
- */
- newp = (hash & db->hmask) | (db->hmask + 1);
-
-/*
- * write delay, read avoidence/cache shuffle:
- * select the page for incoming pair: if key is to go to the new page,
- * write out the previous one, and copy the new one over, thus making
- * it the current page. If not, simply write the new page, and we are
- * still looking at the page of interest. current page is not updated
- * here, as sdbm_store will do so, after it inserts the incoming pair.
- */
- if (hash & (db->hmask + 1)) {
- if ((status = write_page(db, db->pagbuf, db->pagbno)) != APR_SUCCESS)
- return status;
-
- db->pagbno = newp;
- (void) memcpy(pag, new, PBLKSIZ);
- }
- else {
- if ((status = write_page(db, new, newp)) != APR_SUCCESS)
- return status;
- }
-
- if ((status = setdbit(db, db->curbit)) != APR_SUCCESS)
- return status;
-/*
- * see if we have enough room now
- */
- if (fitpair(pag, need))
- return APR_SUCCESS;
-/*
- * try again... update curbit and hmask as getpage would have
- * done. because of our update of the current page, we do not
- * need to read in anything. BUT we have to write the current
- * [deferred] page out, as the window of failure is too great.
- */
- db->curbit = 2 * db->curbit +
- ((hash & (db->hmask + 1)) ? 2 : 1);
- db->hmask |= db->hmask + 1;
-
- if ((status = write_page(db, db->pagbuf, db->pagbno))
- != APR_SUCCESS)
- return status;
-
- } while (--smax);
-/*
- * if we are here, this is real bad news. After SPLTMAX splits,
- * we still cannot fit the key. say goodnight.
- */
-#if 0
- (void) write(2, "sdbm: cannot insert after SPLTMAX attempts.\n", 44);
-#endif
- /* ### ENOSPC not really appropriate but better than nothing */
- return APR_ENOSPC;
-
-}
-
-/* Reads 'len' bytes from file 'f' at offset 'off' into buf.
- * 'off' is given relative to the start of the file.
- * If EOF is returned while reading, this is taken as success.
- */
-static apr_status_t read_from(apr_file_t *f, void *buf,
- apr_off_t off, apr_size_t len)
-{
- apr_status_t status;
-
- if ((status = apr_seek(f, APR_SET, &off)) != APR_SUCCESS ||
- ((status = apr_full_read(f, buf, len, NULL)) != APR_SUCCESS)) {
- /* if EOF is reached, pretend we read all zero's */
- if (status == APR_EOF) {
- memset(buf, 0, len);
- status = APR_SUCCESS;
- }
- return status;
- }
-
- return APR_SUCCESS;
-}
-
-/*
- * the following two routines will break if
- * deletions aren't taken into account. (ndbm bug)
- */
-sdbm_datum
-sdbm_firstkey(SDBM *db)
-{
-/*
- * start at page 0
- */
- if (read_from(db->pagf, db->pagbuf, OFF_PAG(0), PBLKSIZ) != APR_SUCCESS) {
- ioerr(db);
- return sdbm_nullitem;
- }
-
- db->pagbno = 0;
- db->blkptr = 0;
- db->keyptr = 0;
-
- return getnext(db);
-}
-
-sdbm_datum
-sdbm_nextkey(SDBM *db)
-{
- return getnext(db);
-}
-
-/*
- * all important binary tree traversal
- */
-static apr_status_t
-getpage(SDBM *db, long hash)
-{
- register int hbit;
- register long dbit;
- register long pagb;
- apr_status_t status;
-
- dbit = 0;
- hbit = 0;
- while (dbit < db->maxbno && getdbit(db, dbit))
- dbit = 2 * dbit + ((hash & (1 << hbit++)) ? 2 : 1);
-
- debug(("dbit: %d...", dbit));
-
- db->curbit = dbit;
- db->hmask = masks[hbit];
-
- pagb = hash & db->hmask;
-/*
- * see if the block we need is already in memory.
- * note: this lookaside cache has about 10% hit rate.
- */
- if (pagb != db->pagbno) {
-/*
- * note: here, we assume a "hole" is read as 0s.
- * if not, must zero pagbuf first.
- * ### joe: this assumption was surely never correct? but
- * ### we make it so in read_from anyway.
- */
- if ((status = read_from(db->pagf, db->pagbuf, OFF_PAG(pagb), PBLKSIZ))
- != APR_SUCCESS) {
- ioerr(db);
- return status;
- }
-
- if (!chkpage(db->pagbuf))
- return APR_ENOSPC; /* ### better error? */
- db->pagbno = pagb;
-
- debug(("pag read: %d\n", pagb));
- }
- return APR_SUCCESS;
-}
-
-static int
-getdbit(SDBM *db, long dbit)
-{
- register long c;
- register long dirb;
-
- c = dbit / BYTESIZ;
- dirb = c / DBLKSIZ;
-
- if (dirb != db->dirbno) {
- if (read_from(db->dirf, db->dirbuf, OFF_DIR(dirb), DBLKSIZ)
- != APR_SUCCESS)
- return 0;
-
- db->dirbno = dirb;
-
- debug(("dir read: %d\n", dirb));
- }
-
- return db->dirbuf[c % DBLKSIZ] & (1 << dbit % BYTESIZ);
-}
-
-static apr_status_t
-setdbit(SDBM *db, long dbit)
-{
- register long c;
- register long dirb;
- apr_status_t status;
- apr_off_t off;
-
- c = dbit / BYTESIZ;
- dirb = c / DBLKSIZ;
-
- if (dirb != db->dirbno) {
- if ((status = read_from(db->dirf, db->dirbuf, OFF_DIR(dirb), DBLKSIZ))
- != APR_SUCCESS)
- return status;
-
- db->dirbno = dirb;
-
- debug(("dir read: %d\n", dirb));
- }
-
- db->dirbuf[c % DBLKSIZ] |= (1 << dbit % BYTESIZ);
-
- if (dbit >= db->maxbno)
- db->maxbno += DBLKSIZ * BYTESIZ;
-
- off = OFF_DIR(dirb);
- if (((status = apr_seek(db->dirf, APR_SET, &off)) != APR_SUCCESS)
- || (status = apr_full_write(db->dirf, db->dirbuf, DBLKSIZ,
- NULL)) != APR_SUCCESS) {
- return status;
- }
-
- return APR_SUCCESS;
-}
-
-/*
- * getnext - get the next key in the page, and if done with
- * the page, try the next page in sequence
- */
-static sdbm_datum
-getnext(SDBM *db)
-{
- sdbm_datum key;
-
- for (;;) {
- db->keyptr++;
- key = getnkey(db->pagbuf, db->keyptr);
- if (key.dptr != NULL)
- return key;
-/*
- * we either run out, or there is nothing on this page..
- * try the next one... If we lost our position on the
- * file, we will have to seek.
- */
- db->keyptr = 0;
- if (db->pagbno != db->blkptr++) {
- apr_off_t off = OFF_PAG(db->blkptr);
- if (apr_seek(db->pagf, APR_SET, &off) != APR_SUCCESS)
- break;
- }
-
- db->pagbno = db->blkptr;
- /* ### EOF acceptable here too? */
- if (apr_full_read(db->pagf, db->pagbuf, PBLKSIZ, NULL) != APR_SUCCESS)
- break;
- if (!chkpage(db->pagbuf))
- break;
- }
-
- ioerr(db);
- return sdbm_nullitem;
-}
-
-
-int sdbm_rdonly(SDBM *db)
-{
- return ((db)->flags & SDBM_RDONLY);
-}
-
-int sdbm_error(SDBM *db)
-{
- return ((db)->flags & SDBM_IOERR);
-}
-
-int sdbm_clearerr(SDBM *db)
-{
- return ((db)->flags &= ~SDBM_IOERR); /* ouch */
-}
diff --git a/dbm/sdbm/sdbm_hash.c b/dbm/sdbm/sdbm_hash.c
deleted file mode 100644
index f7da717b..00000000
--- a/dbm/sdbm/sdbm_hash.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation. 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. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 APACHE SOFTWARE FOUNDATION OR
- * ITS 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.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-/*
- * sdbm - ndbm work-alike hashed database library
- * based on Per-Aake Larson's Dynamic Hashing algorithms. BIT 18 (1978).
- * author: oz@nexus.yorku.ca
- * status: ex-public domain. keep it that way.
- *
- * hashing routine
- */
-
-#include "apr_sdbm.h"
-
-/*
- * polynomial conversion ignoring overflows
- * [this seems to work remarkably well, in fact better
- * then the ndbm hash function. Replace at your own risk]
- * use: 65599 nice.
- * 65587 even better.
- */
-long sdbm_hash(const char *str, int len)
-{
- register unsigned long n = 0;
-
-#define DUFF /* go ahead and use the loop-unrolled version */
-#ifdef DUFF
-
-#define HASHC n = *str++ + 65599 * n
-
- if (len > 0) {
- register int loop = (len + 8 - 1) >> 3;
-
- switch(len & (8 - 1)) {
- case 0: do {
- HASHC; case 7: HASHC;
- case 6: HASHC; case 5: HASHC;
- case 4: HASHC; case 3: HASHC;
- case 2: HASHC; case 1: HASHC;
- } while (--loop);
- }
-
- }
-#else
- while (len--)
- n = *str++ + 65599 * n;
-#endif
- return n;
-}
diff --git a/dbm/sdbm/sdbm_lock.c b/dbm/sdbm/sdbm_lock.c
deleted file mode 100644
index 9af6e054..00000000
--- a/dbm/sdbm/sdbm_lock.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation. 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. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 APACHE SOFTWARE FOUNDATION OR
- * ITS 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.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-#include "apr_file_io.h"
-#include "apr_sdbm.h"
-
-#include "sdbm_private.h"
-
-/* NOTE: this function blocks until it acquires the lock */
-apr_status_t sdbm_lock(SDBM *db)
-{
- int type;
-
- if ((db->flags & SDBM_RDONLY) == 0)
- type = APR_FLOCK_EXCLUSIVE;
- else
- type = APR_FLOCK_SHARED;
-
- return apr_lock_file(db->pagf, type);
-}
-
-apr_status_t sdbm_unlock(SDBM *db)
-{
- return apr_unlock_file(db->pagf);
-}
diff --git a/dbm/sdbm/sdbm_pair.c b/dbm/sdbm/sdbm_pair.c
deleted file mode 100644
index b9a6d305..00000000
--- a/dbm/sdbm/sdbm_pair.c
+++ /dev/null
@@ -1,359 +0,0 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation. 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. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 APACHE SOFTWARE FOUNDATION OR
- * ITS 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.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-/*
- * sdbm - ndbm work-alike hashed database library
- * based on Per-Aake Larson's Dynamic Hashing algorithms. BIT 18 (1978).
- * author: oz@nexus.yorku.ca
- * status: ex-public domain.
- *
- * page-level routines
- */
-
-#include "apr_sdbm.h"
-
-#include "sdbm_tune.h"
-#include "sdbm_pair.h"
-#include "sdbm_private.h"
-
-#include <string.h> /* for memset() */
-
-
-#define exhash(item) sdbm_hash((item).dptr, (item).dsize)
-
-/*
- * forward
- */
-static int seepair(char *, int, char *, int);
-
-/*
- * page format:
- * +------------------------------+
- * ino | n | keyoff | datoff | keyoff |
- * +------------+--------+--------+
- * | datoff | - - - ----> |
- * +--------+---------------------+
- * | F R E E A R E A |
- * +--------------+---------------+
- * | <---- - - - | data |
- * +--------+-----+----+----------+
- * | key | data | key |
- * +--------+----------+----------+
- *
- * calculating the offsets for free area: if the number
- * of entries (ino[0]) is zero, the offset to the END of
- * the free area is the block size. Otherwise, it is the
- * nth (ino[ino[0]]) entry's offset.
- */
-
-int
-fitpair(pag, need)
-char *pag;
-int need;
-{
- register int n;
- register int off;
- register int avail;
- register short *ino = (short *) pag;
-
- off = ((n = ino[0]) > 0) ? ino[n] : PBLKSIZ;
- avail = off - (n + 1) * sizeof(short);
- need += 2 * sizeof(short);
-
- debug(("avail %d need %d\n", avail, need));
-
- return need <= avail;
-}
-
-void
-putpair(pag, key, val)
-char *pag;
-sdbm_datum key;
-sdbm_datum val;
-{
- register int n;
- register int off;
- register short *ino = (short *) pag;
-
- off = ((n = ino[0]) > 0) ? ino[n] : PBLKSIZ;
-/*
- * enter the key first
- */
- off -= key.dsize;
- (void) memcpy(pag + off, key.dptr, key.dsize);
- ino[n + 1] = off;
-/*
- * now the data
- */
- off -= val.dsize;
- (void) memcpy(pag + off, val.dptr, val.dsize);
- ino[n + 2] = off;
-/*
- * adjust item count
- */
- ino[0] += 2;
-}
-
-sdbm_datum
-getpair(pag, key)
-char *pag;
-sdbm_datum key;
-{
- register int i;
- register int n;
- sdbm_datum val;
- register short *ino = (short *) pag;
-
- if ((n = ino[0]) == 0)
- return sdbm_nullitem;
-
- if ((i = seepair(pag, n, key.dptr, key.dsize)) == 0)
- return sdbm_nullitem;
-
- val.dptr = pag + ino[i + 1];
- val.dsize = ino[i] - ino[i + 1];
- return val;
-}
-
-#ifdef SEEDUPS
-int
-duppair(pag, key)
-char *pag;
-sdbm_datum key;
-{
- register short *ino = (short *) pag;
- return ino[0] > 0 && seepair(pag, ino[0], key.dptr, key.dsize) > 0;
-}
-#endif
-
-sdbm_datum
-getnkey(pag, num)
-char *pag;
-int num;
-{
- sdbm_datum key;
- register int off;
- register short *ino = (short *) pag;
-
- num = num * 2 - 1;
- if (ino[0] == 0 || num > ino[0])
- return sdbm_nullitem;
-
- off = (num > 1) ? ino[num - 1] : PBLKSIZ;
-
- key.dptr = pag + ino[num];
- key.dsize = off - ino[num];
-
- return key;
-}
-
-int
-delpair(pag, key)
-char *pag;
-sdbm_datum key;
-{
- register int n;
- register int i;
- register short *ino = (short *) pag;
-
- if ((n = ino[0]) == 0)
- return 0;
-
- if ((i = seepair(pag, n, key.dptr, key.dsize)) == 0)
- return 0;
-/*
- * found the key. if it is the last entry
- * [i.e. i == n - 1] we just adjust the entry count.
- * hard case: move all data down onto the deleted pair,
- * shift offsets onto deleted offsets, and adjust them.
- * [note: 0 < i < n]
- */
- if (i < n - 1) {
- register int m;
- register char *dst = pag + (i == 1 ? PBLKSIZ : ino[i - 1]);
- register char *src = pag + ino[i + 1];
- register int zoo = dst - src;
-
- debug(("free-up %d ", zoo));
-/*
- * shift data/keys down
- */
- m = ino[i + 1] - ino[n];
-
-#undef DUFF /* just use memmove. it should be plenty fast. */
-#ifdef DUFF
-#define MOVB *--dst = *--src
-
- if (m > 0) {
- register int loop = (m + 8 - 1) >> 3;
-
- switch (m & (8 - 1)) {
- case 0: do {
- MOVB; case 7: MOVB;
- case 6: MOVB; case 5: MOVB;
- case 4: MOVB; case 3: MOVB;
- case 2: MOVB; case 1: MOVB;
- } while (--loop);
- }
- }
-#else
- dst -= m;
- src -= m;
- memmove(dst, src, m);
-#endif
-
-/*
- * adjust offset index up
- */
- while (i < n - 1) {
- ino[i] = ino[i + 2] + zoo;
- i++;
- }
- }
- ino[0] -= 2;
- return 1;
-}
-
-/*
- * search for the key in the page.
- * return offset index in the range 0 < i < n.
- * return 0 if not found.
- */
-static int
-seepair(pag, n, key, siz)
-char *pag;
-register int n;
-register char *key;
-register int siz;
-{
- register int i;
- register int off = PBLKSIZ;
- register short *ino = (short *) pag;
-
- for (i = 1; i < n; i += 2) {
- if (siz == off - ino[i] &&
- memcmp(key, pag + ino[i], siz) == 0)
- return i;
- off = ino[i + 1];
- }
- return 0;
-}
-
-void
-splpage(pag, new, sbit)
-char *pag;
-char *new;
-long sbit;
-{
- sdbm_datum key;
- sdbm_datum val;
-
- register int n;
- register int off = PBLKSIZ;
- char cur[PBLKSIZ];
- register short *ino = (short *) cur;
-
- (void) memcpy(cur, pag, PBLKSIZ);
- (void) memset(pag, 0, PBLKSIZ);
- (void) memset(new, 0, PBLKSIZ);
-
- n = ino[0];
- for (ino++; n > 0; ino += 2) {
- key.dptr = cur + ino[0];
- key.dsize = off - ino[0];
- val.dptr = cur + ino[1];
- val.dsize = ino[0] - ino[1];
-/*
- * select the page pointer (by looking at sbit) and insert
- */
- (void) putpair((exhash(key) & sbit) ? new : pag, key, val);
-
- off = ino[1];
- n -= 2;
- }
-
- debug(("%d split %d/%d\n", ((short *) cur)[0] / 2,
- ((short *) new)[0] / 2,
- ((short *) pag)[0] / 2));
-}
-
-/*
- * check page sanity:
- * number of entries should be something
- * reasonable, and all offsets in the index should be in order.
- * this could be made more rigorous.
- */
-int
-chkpage(pag)
-char *pag;
-{
- register int n;
- register int off;
- register short *ino = (short *) pag;
-
- if ((n = ino[0]) < 0 || n > PBLKSIZ / sizeof(short))
- return 0;
-
- if (n > 0) {
- off = PBLKSIZ;
- for (ino++; n > 0; ino += 2) {
- if (ino[0] > off || ino[1] > off ||
- ino[1] > ino[0])
- return 0;
- off = ino[1];
- n -= 2;
- }
- }
- return 1;
-}
diff --git a/dbm/sdbm/sdbm_pair.h b/dbm/sdbm/sdbm_pair.h
deleted file mode 100644
index bd369f9a..00000000
--- a/dbm/sdbm/sdbm_pair.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation. 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. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 APACHE SOFTWARE FOUNDATION OR
- * ITS 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.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-#ifndef SDBM_PAIR_H
-#define SDBM_PAIR_H
-
-/* Mini EMBED (pair.c) */
-#define chkpage sdbm__chkpage
-#define delpair sdbm__delpair
-#define duppair sdbm__duppair
-#define fitpair sdbm__fitpair
-#define getnkey sdbm__getnkey
-#define getpair sdbm__getpair
-#define putpair sdbm__putpair
-#define splpage sdbm__splpage
-
-int fitpair(char *, int);
-void putpair(char *, sdbm_datum, sdbm_datum);
-sdbm_datum getpair(char *, sdbm_datum);
-int delpair(char *, sdbm_datum);
-int chkpage (char *);
-sdbm_datum getnkey(char *, int);
-void splpage(char *, char *, long);
-#ifdef SEEDUPS
-int duppair(char *, sdbm_datum);
-#endif
-
-#endif /* SDBM_PAIR_H */
-
diff --git a/dbm/sdbm/sdbm_private.h b/dbm/sdbm/sdbm_private.h
deleted file mode 100644
index 52227b21..00000000
--- a/dbm/sdbm/sdbm_private.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation. 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. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 APACHE SOFTWARE FOUNDATION OR
- * ITS 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.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-/*
- * sdbm - ndbm work-alike hashed database library
- * based on Per-Ake Larson's Dynamic Hashing algorithms. BIT 18 (1978).
- * author: oz@nexus.yorku.ca
- */
-
-#ifndef SDBM_PRIVATE_H
-#define SDBM_PRIVATE_H
-
-#include "apr.h"
-#include "apr_pools.h"
-#include "apr_file_io.h"
-#include "apr_errno.h" /* for apr_status_t */
-
-/* increase the block/page size and what can be inserted */
-
-#if 1
-#define DBLKSIZ 16384
-#define PBLKSIZ 8192
-#define PAIRMAX 8008 /* arbitrary on PBLKSIZ-N */
-#else
-#define DBLKSIZ 4096
-#define PBLKSIZ 1024
-#define PAIRMAX 1008 /* arbitrary on PBLKSIZ-N */
-#endif
-#define SPLTMAX 10 /* maximum allowed splits */
-
-/* for SDBM.flags */
-#define SDBM_RDONLY 0x1 /* data base open read-only */
- /* for a single insertion */
-struct SDBM {
- apr_pool_t *pool;
- apr_file_t *dirf; /* directory file descriptor */
- apr_file_t *pagf; /* page file descriptor */
- apr_int32_t flags; /* status/error flags, see below */
- long maxbno; /* size of dirfile in bits */
- long curbit; /* current bit number */
- long hmask; /* current hash mask */
- long blkptr; /* current block for nextkey */
- int keyptr; /* current key for nextkey */
- long blkno; /* current page to read/write */
- long pagbno; /* current page in pagbuf */
- char pagbuf[PBLKSIZ]; /* page file block buffer */
- long dirbno; /* current block in dirbuf */
- char dirbuf[DBLKSIZ]; /* directory file block buffer */
-};
-
-apr_status_t sdbm_lock(SDBM *db);
-apr_status_t sdbm_unlock(SDBM *db);
-
-extern const sdbm_datum sdbm_nullitem;
-
-#endif /* SDBM_PRIVATE_H */
diff --git a/dbm/sdbm/sdbm_tune.h b/dbm/sdbm/sdbm_tune.h
deleted file mode 100644
index 38fea10e..00000000
--- a/dbm/sdbm/sdbm_tune.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation. 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. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 APACHE SOFTWARE FOUNDATION OR
- * ITS 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.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-/*
- * sdbm - ndbm work-alike hashed database library
- * tuning and portability constructs [not nearly enough]
- * author: oz@nexus.yorku.ca
- */
-
-#ifndef SDBM_TUNE_H
-#define SDBM_TUNE_H
-
-#include "apr_errno.h"
-
-/* ### this might be better off as sizeof(char *) */
-#define BYTESIZ 8
-
-/*
- * important tuning parms (hah)
- */
-
-#define SEEDUPS /* always detect duplicates */
-#define BADMESS /* generate a message for worst case:
- cannot make room after SPLTMAX splits */
-/*
- * misc
- */
-#ifdef DEBUG
-#define debug(x) printf x
-#else
-#define debug(x)
-#endif
-
-apr_status_t sdbm_fd_lock(int fd, int readonly);
-apr_status_t sdbm_fd_unlock(int fd);
-
-#endif /* SDBM_TUNE_H */
diff --git a/encoding/.cvsignore b/encoding/.cvsignore
deleted file mode 100644
index 2c9b9300..00000000
--- a/encoding/.cvsignore
+++ /dev/null
@@ -1,4 +0,0 @@
-Makefile
-*.lo
-*.la
-.libs
diff --git a/encoding/Makefile.in b/encoding/Makefile.in
deleted file mode 100644
index 182137d1..00000000
--- a/encoding/Makefile.in
+++ /dev/null
@@ -1,5 +0,0 @@
-
-TARGETS = ap_base64.lo
-
-top_builddir = @top_builddir@
-include $(top_builddir)/build/rules.mk
diff --git a/encoding/ap_base64.c b/encoding/ap_base64.c
deleted file mode 100644
index 15bcba60..00000000
--- a/encoding/ap_base64.c
+++ /dev/null
@@ -1,310 +0,0 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation. 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. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 APACHE SOFTWARE FOUNDATION OR
- * ITS 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.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- * Portions of this software are based upon public domain software
- * originally written at the National Center for Supercomputing Applications,
- * University of Illinois, Urbana-Champaign.
- */
-
-/* base64 encoder/decoder. Originally part of main/util.c
- * but moved here so that support/ab and ap_sha1.c could
- * use it. This meant removing the apr_palloc()s and adding
- * ugly 'len' functions, which is quite a nasty cost.
- */
-
-#include "ap_base64.h"
-#ifdef CHARSET_EBCDIC
-#include "apr_xlate.h"
-#endif /* CHARSET_EBCDIC */
-
-/* aaaack but it's fast and const should make it shared text page. */
-static const unsigned char pr2six[256] =
-{
-#ifndef CHARSET_EBCDIC
- /* ASCII table */
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 62, 64, 64, 64, 63,
- 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 64, 64, 64, 64, 64, 64,
- 64, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
- 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 64, 64, 64, 64, 64,
- 64, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
- 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64
-#else /*CHARSET_EBCDIC*/
- /* EBCDIC table */
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 62, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 26, 27, 28, 29, 30, 31, 32, 33, 34, 64, 64, 64, 64, 64, 64,
- 64, 35, 36, 37, 38, 39, 40, 41, 42, 43, 64, 64, 64, 64, 64, 64,
- 64, 64, 44, 45, 46, 47, 48, 49, 50, 51, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 0, 1, 2, 3, 4, 5, 6, 7, 8, 64, 64, 64, 64, 64, 64,
- 64, 9, 10, 11, 12, 13, 14, 15, 16, 17, 64, 64, 64, 64, 64, 64,
- 64, 64, 18, 19, 20, 21, 22, 23, 24, 25, 64, 64, 64, 64, 64, 64,
- 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 64, 64, 64, 64, 64, 64
-#endif /*CHARSET_EBCDIC*/
-};
-
-#ifdef CHARSET_EBCDIC
-static apr_xlate_t *xlate_to_ebcdic;
-static unsigned char os_toascii[256];
-
-APR_DECLARE(apr_status_t) ap_base64init_ebcdic(apr_xlate_t *to_ascii,
- apr_xlate_t *to_ebcdic)
-{
- int i;
- apr_size_t inbytes_left, outbytes_left;
- apr_status_t rv;
- int onoff;
-
- /* Only single-byte conversion is supported.
- */
- rv = apr_xlate_get_sb(to_ascii, &onoff);
- if (rv) {
- return rv;
- }
- if (!onoff) { /* If conversion is not single-byte-only */
- return APR_EINVAL;
- }
- rv = apr_xlate_get_sb(to_ebcdic, &onoff);
- if (rv) {
- return rv;
- }
- if (!onoff) { /* If conversion is not single-byte-only */
- return APR_EINVAL;
- }
- xlate_to_ebcdic = to_ebcdic;
- for (i = 0; i < sizeof(os_toascii); i++) {
- os_toascii[i] = i;
- }
- inbytes_left = outbytes_left = sizeof(os_toascii);
- apr_xlate_conv_buffer(to_ascii, os_toascii, &inbytes_left,
- os_toascii, &outbytes_left);
-
- return APR_SUCCESS;
-}
-#endif /*CHARSET_EBCDIC*/
-
-APR_DECLARE(int) ap_base64decode_len(const char *bufcoded)
-{
- int nbytesdecoded;
- register const unsigned char *bufin;
- register int nprbytes;
-
- bufin = (const unsigned char *) bufcoded;
- while (pr2six[*(bufin++)] <= 63);
-
- nprbytes = (bufin - (const unsigned char *) bufcoded) - 1;
- nbytesdecoded = ((nprbytes + 3) / 4) * 3;
-
- return nbytesdecoded + 1;
-}
-
-APR_DECLARE(int) ap_base64decode(char *bufplain, const char *bufcoded)
-{
-#ifdef CHARSET_EBCDIC
- apr_size_t inbytes_left, outbytes_left;
-#endif /* CHARSET_EBCDIC */
- int len;
-
- len = ap_base64decode_binary((unsigned char *) bufplain, bufcoded);
-#ifdef CHARSET_EBCDIC
- inbytes_left = outbytes_left = len;
- apr_xlate_conv_buffer(xlate_to_ebcdic, bufplain, &inbytes_left,
- bufplain, &outbytes_left);
-#endif /* CHARSET_EBCDIC */
- bufplain[len] = '\0';
- return len;
-}
-
-/* This is the same as ap_base64decode() except on EBCDIC machines, where
- * the conversion of the output to ebcdic is left out.
- */
-APR_DECLARE(int) ap_base64decode_binary(unsigned char *bufplain,
- const char *bufcoded)
-{
- int nbytesdecoded;
- register const unsigned char *bufin;
- register unsigned char *bufout;
- register int nprbytes;
-
- bufin = (const unsigned char *) bufcoded;
- while (pr2six[*(bufin++)] <= 63);
- nprbytes = (bufin - (const unsigned char *) bufcoded) - 1;
- nbytesdecoded = ((nprbytes + 3) / 4) * 3;
-
- bufout = (unsigned char *) bufplain;
- bufin = (const unsigned char *) bufcoded;
-
- while (nprbytes > 4) {
- *(bufout++) =
- (unsigned char) (pr2six[*bufin] << 2 | pr2six[bufin[1]] >> 4);
- *(bufout++) =
- (unsigned char) (pr2six[bufin[1]] << 4 | pr2six[bufin[2]] >> 2);
- *(bufout++) =
- (unsigned char) (pr2six[bufin[2]] << 6 | pr2six[bufin[3]]);
- bufin += 4;
- nprbytes -= 4;
- }
-
- /* Note: (nprbytes == 1) would be an error, so just ingore that case */
- if (nprbytes > 1) {
- *(bufout++) =
- (unsigned char) (pr2six[*bufin] << 2 | pr2six[bufin[1]] >> 4);
- }
- if (nprbytes > 2) {
- *(bufout++) =
- (unsigned char) (pr2six[bufin[1]] << 4 | pr2six[bufin[2]] >> 2);
- }
- if (nprbytes > 3) {
- *(bufout++) =
- (unsigned char) (pr2six[bufin[2]] << 6 | pr2six[bufin[3]]);
- }
-
- nbytesdecoded -= (4 - nprbytes) & 3;
- return nbytesdecoded;
-}
-
-static const char basis_64[] =
- "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-
-APR_DECLARE(int) ap_base64encode_len(int len)
-{
- return ((len + 2) / 3 * 4) + 1;
-}
-
-APR_DECLARE(int) ap_base64encode(char *encoded, const char *string, int len)
-{
-#ifndef CHARSET_EBCDIC
- return ap_base64encode_binary(encoded, (const unsigned char *) string, len);
-#else /* CHARSET_EBCDIC */
- int i;
- char *p;
-
- p = encoded;
- for (i = 0; i < len - 2; i += 3) {
- *p++ = basis_64[(os_toascii[string[i]] >> 2) & 0x3F];
- *p++ = basis_64[((os_toascii[string[i]] & 0x3) << 4) |
- ((int) (os_toascii[string[i + 1]] & 0xF0) >> 4)];
- *p++ = basis_64[((os_toascii[string[i + 1]] & 0xF) << 2) |
- ((int) (os_toascii[string[i + 2]] & 0xC0) >> 6)];
- *p++ = basis_64[os_toascii[string[i + 2]] & 0x3F];
- }
- if (i < len) {
- *p++ = basis_64[(os_toascii[string[i]] >> 2) & 0x3F];
- if (i == (len - 1)) {
- *p++ = basis_64[((os_toascii[string[i]] & 0x3) << 4)];
- *p++ = '=';
- }
- else {
- *p++ = basis_64[((os_toascii[string[i]] & 0x3) << 4) |
- ((int) (os_toascii[string[i + 1]] & 0xF0) >> 4)];
- *p++ = basis_64[((os_toascii[string[i + 1]] & 0xF) << 2)];
- }
- *p++ = '=';
- }
-
- *p++ = '\0';
- return p - encoded;
-#endif /* CHARSET_EBCDIC */
-}
-
-/* This is the same as ap_base64encode() except on EBCDIC machines, where
- * the conversion of the input to ascii is left out.
- */
-APR_DECLARE(int) ap_base64encode_binary(char *encoded,
- const unsigned char *string, int len)
-{
- int i;
- char *p;
-
- p = encoded;
- for (i = 0; i < len - 2; i += 3) {
- *p++ = basis_64[(string[i] >> 2) & 0x3F];
- *p++ = basis_64[((string[i] & 0x3) << 4) |
- ((int) (string[i + 1] & 0xF0) >> 4)];
- *p++ = basis_64[((string[i + 1] & 0xF) << 2) |
- ((int) (string[i + 2] & 0xC0) >> 6)];
- *p++ = basis_64[string[i + 2] & 0x3F];
- }
- if (i < len) {
- *p++ = basis_64[(string[i] >> 2) & 0x3F];
- if (i == (len - 1)) {
- *p++ = basis_64[((string[i] & 0x3) << 4)];
- *p++ = '=';
- }
- else {
- *p++ = basis_64[((string[i] & 0x3) << 4) |
- ((int) (string[i + 1] & 0xF0) >> 4)];
- *p++ = basis_64[((string[i + 1] & 0xF) << 2)];
- }
- *p++ = '=';
- }
-
- *p++ = '\0';
- return p - encoded;
-}
diff --git a/encoding/apr_base64.c b/encoding/apr_base64.c
deleted file mode 100644
index 15bcba60..00000000
--- a/encoding/apr_base64.c
+++ /dev/null
@@ -1,310 +0,0 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation. 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. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 APACHE SOFTWARE FOUNDATION OR
- * ITS 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.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- * Portions of this software are based upon public domain software
- * originally written at the National Center for Supercomputing Applications,
- * University of Illinois, Urbana-Champaign.
- */
-
-/* base64 encoder/decoder. Originally part of main/util.c
- * but moved here so that support/ab and ap_sha1.c could
- * use it. This meant removing the apr_palloc()s and adding
- * ugly 'len' functions, which is quite a nasty cost.
- */
-
-#include "ap_base64.h"
-#ifdef CHARSET_EBCDIC
-#include "apr_xlate.h"
-#endif /* CHARSET_EBCDIC */
-
-/* aaaack but it's fast and const should make it shared text page. */
-static const unsigned char pr2six[256] =
-{
-#ifndef CHARSET_EBCDIC
- /* ASCII table */
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 62, 64, 64, 64, 63,
- 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 64, 64, 64, 64, 64, 64,
- 64, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
- 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 64, 64, 64, 64, 64,
- 64, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
- 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64
-#else /*CHARSET_EBCDIC*/
- /* EBCDIC table */
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 62, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 26, 27, 28, 29, 30, 31, 32, 33, 34, 64, 64, 64, 64, 64, 64,
- 64, 35, 36, 37, 38, 39, 40, 41, 42, 43, 64, 64, 64, 64, 64, 64,
- 64, 64, 44, 45, 46, 47, 48, 49, 50, 51, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 0, 1, 2, 3, 4, 5, 6, 7, 8, 64, 64, 64, 64, 64, 64,
- 64, 9, 10, 11, 12, 13, 14, 15, 16, 17, 64, 64, 64, 64, 64, 64,
- 64, 64, 18, 19, 20, 21, 22, 23, 24, 25, 64, 64, 64, 64, 64, 64,
- 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 64, 64, 64, 64, 64, 64
-#endif /*CHARSET_EBCDIC*/
-};
-
-#ifdef CHARSET_EBCDIC
-static apr_xlate_t *xlate_to_ebcdic;
-static unsigned char os_toascii[256];
-
-APR_DECLARE(apr_status_t) ap_base64init_ebcdic(apr_xlate_t *to_ascii,
- apr_xlate_t *to_ebcdic)
-{
- int i;
- apr_size_t inbytes_left, outbytes_left;
- apr_status_t rv;
- int onoff;
-
- /* Only single-byte conversion is supported.
- */
- rv = apr_xlate_get_sb(to_ascii, &onoff);
- if (rv) {
- return rv;
- }
- if (!onoff) { /* If conversion is not single-byte-only */
- return APR_EINVAL;
- }
- rv = apr_xlate_get_sb(to_ebcdic, &onoff);
- if (rv) {
- return rv;
- }
- if (!onoff) { /* If conversion is not single-byte-only */
- return APR_EINVAL;
- }
- xlate_to_ebcdic = to_ebcdic;
- for (i = 0; i < sizeof(os_toascii); i++) {
- os_toascii[i] = i;
- }
- inbytes_left = outbytes_left = sizeof(os_toascii);
- apr_xlate_conv_buffer(to_ascii, os_toascii, &inbytes_left,
- os_toascii, &outbytes_left);
-
- return APR_SUCCESS;
-}
-#endif /*CHARSET_EBCDIC*/
-
-APR_DECLARE(int) ap_base64decode_len(const char *bufcoded)
-{
- int nbytesdecoded;
- register const unsigned char *bufin;
- register int nprbytes;
-
- bufin = (const unsigned char *) bufcoded;
- while (pr2six[*(bufin++)] <= 63);
-
- nprbytes = (bufin - (const unsigned char *) bufcoded) - 1;
- nbytesdecoded = ((nprbytes + 3) / 4) * 3;
-
- return nbytesdecoded + 1;
-}
-
-APR_DECLARE(int) ap_base64decode(char *bufplain, const char *bufcoded)
-{
-#ifdef CHARSET_EBCDIC
- apr_size_t inbytes_left, outbytes_left;
-#endif /* CHARSET_EBCDIC */
- int len;
-
- len = ap_base64decode_binary((unsigned char *) bufplain, bufcoded);
-#ifdef CHARSET_EBCDIC
- inbytes_left = outbytes_left = len;
- apr_xlate_conv_buffer(xlate_to_ebcdic, bufplain, &inbytes_left,
- bufplain, &outbytes_left);
-#endif /* CHARSET_EBCDIC */
- bufplain[len] = '\0';
- return len;
-}
-
-/* This is the same as ap_base64decode() except on EBCDIC machines, where
- * the conversion of the output to ebcdic is left out.
- */
-APR_DECLARE(int) ap_base64decode_binary(unsigned char *bufplain,
- const char *bufcoded)
-{
- int nbytesdecoded;
- register const unsigned char *bufin;
- register unsigned char *bufout;
- register int nprbytes;
-
- bufin = (const unsigned char *) bufcoded;
- while (pr2six[*(bufin++)] <= 63);
- nprbytes = (bufin - (const unsigned char *) bufcoded) - 1;
- nbytesdecoded = ((nprbytes + 3) / 4) * 3;
-
- bufout = (unsigned char *) bufplain;
- bufin = (const unsigned char *) bufcoded;
-
- while (nprbytes > 4) {
- *(bufout++) =
- (unsigned char) (pr2six[*bufin] << 2 | pr2six[bufin[1]] >> 4);
- *(bufout++) =
- (unsigned char) (pr2six[bufin[1]] << 4 | pr2six[bufin[2]] >> 2);
- *(bufout++) =
- (unsigned char) (pr2six[bufin[2]] << 6 | pr2six[bufin[3]]);
- bufin += 4;
- nprbytes -= 4;
- }
-
- /* Note: (nprbytes == 1) would be an error, so just ingore that case */
- if (nprbytes > 1) {
- *(bufout++) =
- (unsigned char) (pr2six[*bufin] << 2 | pr2six[bufin[1]] >> 4);
- }
- if (nprbytes > 2) {
- *(bufout++) =
- (unsigned char) (pr2six[bufin[1]] << 4 | pr2six[bufin[2]] >> 2);
- }
- if (nprbytes > 3) {
- *(bufout++) =
- (unsigned char) (pr2six[bufin[2]] << 6 | pr2six[bufin[3]]);
- }
-
- nbytesdecoded -= (4 - nprbytes) & 3;
- return nbytesdecoded;
-}
-
-static const char basis_64[] =
- "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-
-APR_DECLARE(int) ap_base64encode_len(int len)
-{
- return ((len + 2) / 3 * 4) + 1;
-}
-
-APR_DECLARE(int) ap_base64encode(char *encoded, const char *string, int len)
-{
-#ifndef CHARSET_EBCDIC
- return ap_base64encode_binary(encoded, (const unsigned char *) string, len);
-#else /* CHARSET_EBCDIC */
- int i;
- char *p;
-
- p = encoded;
- for (i = 0; i < len - 2; i += 3) {
- *p++ = basis_64[(os_toascii[string[i]] >> 2) & 0x3F];
- *p++ = basis_64[((os_toascii[string[i]] & 0x3) << 4) |
- ((int) (os_toascii[string[i + 1]] & 0xF0) >> 4)];
- *p++ = basis_64[((os_toascii[string[i + 1]] & 0xF) << 2) |
- ((int) (os_toascii[string[i + 2]] & 0xC0) >> 6)];
- *p++ = basis_64[os_toascii[string[i + 2]] & 0x3F];
- }
- if (i < len) {
- *p++ = basis_64[(os_toascii[string[i]] >> 2) & 0x3F];
- if (i == (len - 1)) {
- *p++ = basis_64[((os_toascii[string[i]] & 0x3) << 4)];
- *p++ = '=';
- }
- else {
- *p++ = basis_64[((os_toascii[string[i]] & 0x3) << 4) |
- ((int) (os_toascii[string[i + 1]] & 0xF0) >> 4)];
- *p++ = basis_64[((os_toascii[string[i + 1]] & 0xF) << 2)];
- }
- *p++ = '=';
- }
-
- *p++ = '\0';
- return p - encoded;
-#endif /* CHARSET_EBCDIC */
-}
-
-/* This is the same as ap_base64encode() except on EBCDIC machines, where
- * the conversion of the input to ascii is left out.
- */
-APR_DECLARE(int) ap_base64encode_binary(char *encoded,
- const unsigned char *string, int len)
-{
- int i;
- char *p;
-
- p = encoded;
- for (i = 0; i < len - 2; i += 3) {
- *p++ = basis_64[(string[i] >> 2) & 0x3F];
- *p++ = basis_64[((string[i] & 0x3) << 4) |
- ((int) (string[i + 1] & 0xF0) >> 4)];
- *p++ = basis_64[((string[i + 1] & 0xF) << 2) |
- ((int) (string[i + 2] & 0xC0) >> 6)];
- *p++ = basis_64[string[i + 2] & 0x3F];
- }
- if (i < len) {
- *p++ = basis_64[(string[i] >> 2) & 0x3F];
- if (i == (len - 1)) {
- *p++ = basis_64[((string[i] & 0x3) << 4)];
- *p++ = '=';
- }
- else {
- *p++ = basis_64[((string[i] & 0x3) << 4) |
- ((int) (string[i + 1] & 0xF0) >> 4)];
- *p++ = basis_64[((string[i + 1] & 0xF) << 2)];
- }
- *p++ = '=';
- }
-
- *p++ = '\0';
- return p - encoded;
-}
diff --git a/hooks/.cvsignore b/hooks/.cvsignore
deleted file mode 100644
index 2c9b9300..00000000
--- a/hooks/.cvsignore
+++ /dev/null
@@ -1,4 +0,0 @@
-Makefile
-*.lo
-*.la
-.libs
diff --git a/hooks/Makefile.in b/hooks/Makefile.in
deleted file mode 100644
index 247f7bcd..00000000
--- a/hooks/Makefile.in
+++ /dev/null
@@ -1,5 +0,0 @@
-
-TARGETS = ap_hooks.lo
-
-top_builddir = @top_builddir@
-include $(top_builddir)/build/rules.mk
diff --git a/hooks/ap_hooks.c b/hooks/ap_hooks.c
deleted file mode 100644
index 5044cdca..00000000
--- a/hooks/ap_hooks.c
+++ /dev/null
@@ -1,297 +0,0 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation. 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. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 APACHE SOFTWARE FOUNDATION OR
- * ITS 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.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "apr_pools.h"
-#include "apr_tables.h"
-#include "apr.h"
-#include "ap_hooks.h"
-
-
-#if 0
-#define apr_palloc(pool,size) malloc(size)
-#endif
-
-APR_DECLARE_DATA apr_pool_t *ap_global_hook_pool = NULL;
-APR_DECLARE_DATA int ap_debug_module_hooks = 0;
-APR_DECLARE_DATA const char *ap_debug_module_name = NULL;
-
-/* NB: This must echo the LINK_##name structure */
-typedef struct
-{
- void (*dummy)(void *);
- const char *szName;
- const char * const *aszPredecessors;
- const char * const *aszSuccessors;
- int nOrder;
-} TSortData;
-
-typedef struct tsort_
-{
- void *pData;
- int nPredecessors;
- struct tsort_ **ppPredecessors;
- struct tsort_ *pNext;
-} TSort;
-
-static int crude_order(const void *a_,const void *b_)
-{
- const TSortData *a=a_;
- const TSortData *b=b_;
-
- return a->nOrder-b->nOrder;
-}
-
-static TSort *prepare(apr_pool_t *p,TSortData *pItems,int nItems)
-{
- TSort *pData=apr_palloc(p,nItems*sizeof *pData);
- int n;
-
- qsort(pItems,nItems,sizeof *pItems,crude_order);
- for(n=0 ; n < nItems ; ++n) {
- pData[n].nPredecessors=0;
- pData[n].ppPredecessors=apr_pcalloc(p,nItems*sizeof *pData[n].ppPredecessors);
- pData[n].pNext=NULL;
- pData[n].pData=&pItems[n];
- }
-
- for(n=0 ; n < nItems ; ++n) {
- int i,k;
-
- for(i=0 ; pItems[n].aszPredecessors && pItems[n].aszPredecessors[i] ; ++i)
- for(k=0 ; k < nItems ; ++k)
- if(!strcmp(pItems[k].szName,pItems[n].aszPredecessors[i])) {
- int l;
-
- for(l=0 ; l < pData[n].nPredecessors ; ++l)
- if(pData[n].ppPredecessors[l] == &pData[k])
- goto got_it;
- pData[n].ppPredecessors[pData[n].nPredecessors]=&pData[k];
- ++pData[n].nPredecessors;
- got_it:
- break;
- }
- for(i=0 ; pItems[n].aszSuccessors && pItems[n].aszSuccessors[i] ; ++i)
- for(k=0 ; k < nItems ; ++k)
- if(!strcmp(pItems[k].szName,pItems[n].aszSuccessors[i])) {
- int l;
-
- for(l=0 ; l < pData[k].nPredecessors ; ++l)
- if(pData[k].ppPredecessors[l] == &pData[n])
- goto got_it2;
- pData[k].ppPredecessors[pData[k].nPredecessors]=&pData[n];
- ++pData[k].nPredecessors;
- got_it2:
- break;
- }
- }
-
- return pData;
-}
-
-static TSort *tsort(TSort *pData,int nItems)
-{
- int nTotal;
- TSort *pHead=NULL;
- TSort *pTail=NULL;
-
- for(nTotal=0 ; nTotal < nItems ; ++nTotal) {
- int n,i,k;
-
- for(n=0 ; ; ++n) {
- if(n == nItems)
- assert(0); /* // we have a loop... */
- if(!pData[n].pNext && !pData[n].nPredecessors)
- break;
- }
- if(pTail)
- pTail->pNext=&pData[n];
- else
- pHead=&pData[n];
- pTail=&pData[n];
- pTail->pNext=pTail; /* // fudge it so it looks linked */
- for(i=0 ; i < nItems ; ++i)
- for(k=0 ; pData[i].ppPredecessors[k] ; ++k)
- if(pData[i].ppPredecessors[k] == &pData[n]) {
- --pData[i].nPredecessors;
- break;
- }
- }
- pTail->pNext=NULL; /* // unfudge the tail */
- return pHead;
-}
-
-static apr_array_header_t *sort_hook(apr_array_header_t *pHooks,const char *szName)
-{
- apr_pool_t *p;
- TSort *pSort;
- apr_array_header_t *pNew;
- int n;
-
- apr_create_pool(&p, ap_global_hook_pool);
- pSort=prepare(p,(TSortData *)pHooks->elts,pHooks->nelts);
- pSort=tsort(pSort,pHooks->nelts);
- pNew=apr_make_array(ap_global_hook_pool,pHooks->nelts,sizeof(TSortData));
- if(ap_debug_module_hooks)
- printf("Sorting %s:",szName);
- for(n=0 ; pSort ; pSort=pSort->pNext,++n) {
- TSortData *pHook;
- assert(n < pHooks->nelts);
- pHook=apr_push_array(pNew);
- memcpy(pHook,pSort->pData,sizeof *pHook);
- if(ap_debug_module_hooks)
- printf(" %s",pHook->szName);
- }
- if(ap_debug_module_hooks)
- fputc('\n',stdout);
- return pNew;
-}
-
-static apr_array_header_t *s_aHooksToSort;
-typedef struct
-{
- const char *szHookName;
- apr_array_header_t **paHooks;
-} HookSortEntry;
-
-APR_DECLARE(void) ap_hook_sort_register(const char *szHookName,
- apr_array_header_t **paHooks)
-{
- HookSortEntry *pEntry;
-
- if(!s_aHooksToSort)
- s_aHooksToSort=apr_make_array(ap_global_hook_pool,1,sizeof(HookSortEntry));
- pEntry=apr_push_array(s_aHooksToSort);
- pEntry->szHookName=szHookName;
- pEntry->paHooks=paHooks;
-}
-
-APR_DECLARE(void) ap_sort_hooks()
-{
- int n;
-
- for(n=0 ; n < s_aHooksToSort->nelts ; ++n) {
- HookSortEntry *pEntry=&((HookSortEntry *)s_aHooksToSort->elts)[n];
- *pEntry->paHooks=sort_hook(*pEntry->paHooks,pEntry->szHookName);
- }
-}
-
-APR_DECLARE(void) ap_hook_deregister_all(void)
-{
- int n;
-
- for(n=0 ; n < s_aHooksToSort->nelts ; ++n) {
- HookSortEntry *pEntry=&((HookSortEntry *)s_aHooksToSort->elts)[n];
- *pEntry->paHooks=NULL;
- }
- s_aHooksToSort=NULL;
-}
-
-APR_DECLARE(void) ap_show_hook(const char *szName,const char * const *aszPre,
- const char * const *aszSucc)
-{
- int nFirst;
-
- printf(" Hooked %s",szName);
- if(aszPre) {
- fputs(" pre(",stdout);
- nFirst=1;
- while(*aszPre) {
- if(!nFirst)
- fputc(',',stdout);
- nFirst=0;
- fputs(*aszPre,stdout);
- ++aszPre;
- }
- fputc(')',stdout);
- }
- if(aszSucc) {
- fputs(" succ(",stdout);
- nFirst=1;
- while(*aszSucc) {
- if(!nFirst)
- fputc(',',stdout);
- nFirst=0;
- fputs(*aszSucc,stdout);
- ++aszSucc;
- }
- fputc(')',stdout);
- }
- fputc('\n',stdout);
-}
-
-#if 0
-void main()
-{
- const char *aszAPre[]={"b","c",NULL};
- const char *aszBPost[]={"a",NULL};
- const char *aszCPost[]={"b",NULL};
- TSortData t1[]=
- {
- { "a",aszAPre,NULL },
- { "b",NULL,aszBPost },
- { "c",NULL,aszCPost }
- };
- TSort *pResult;
-
- pResult=prepare(t1,3);
- pResult=tsort(pResult,3);
-
- for( ; pResult ; pResult=pResult->pNext)
- printf("%s\n",pResult->pData->szName);
-}
-#endif
diff --git a/hooks/apr_hooks.c b/hooks/apr_hooks.c
deleted file mode 100644
index 5044cdca..00000000
--- a/hooks/apr_hooks.c
+++ /dev/null
@@ -1,297 +0,0 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation. 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. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 APACHE SOFTWARE FOUNDATION OR
- * ITS 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.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "apr_pools.h"
-#include "apr_tables.h"
-#include "apr.h"
-#include "ap_hooks.h"
-
-
-#if 0
-#define apr_palloc(pool,size) malloc(size)
-#endif
-
-APR_DECLARE_DATA apr_pool_t *ap_global_hook_pool = NULL;
-APR_DECLARE_DATA int ap_debug_module_hooks = 0;
-APR_DECLARE_DATA const char *ap_debug_module_name = NULL;
-
-/* NB: This must echo the LINK_##name structure */
-typedef struct
-{
- void (*dummy)(void *);
- const char *szName;
- const char * const *aszPredecessors;
- const char * const *aszSuccessors;
- int nOrder;
-} TSortData;
-
-typedef struct tsort_
-{
- void *pData;
- int nPredecessors;
- struct tsort_ **ppPredecessors;
- struct tsort_ *pNext;
-} TSort;
-
-static int crude_order(const void *a_,const void *b_)
-{
- const TSortData *a=a_;
- const TSortData *b=b_;
-
- return a->nOrder-b->nOrder;
-}
-
-static TSort *prepare(apr_pool_t *p,TSortData *pItems,int nItems)
-{
- TSort *pData=apr_palloc(p,nItems*sizeof *pData);
- int n;
-
- qsort(pItems,nItems,sizeof *pItems,crude_order);
- for(n=0 ; n < nItems ; ++n) {
- pData[n].nPredecessors=0;
- pData[n].ppPredecessors=apr_pcalloc(p,nItems*sizeof *pData[n].ppPredecessors);
- pData[n].pNext=NULL;
- pData[n].pData=&pItems[n];
- }
-
- for(n=0 ; n < nItems ; ++n) {
- int i,k;
-
- for(i=0 ; pItems[n].aszPredecessors && pItems[n].aszPredecessors[i] ; ++i)
- for(k=0 ; k < nItems ; ++k)
- if(!strcmp(pItems[k].szName,pItems[n].aszPredecessors[i])) {
- int l;
-
- for(l=0 ; l < pData[n].nPredecessors ; ++l)
- if(pData[n].ppPredecessors[l] == &pData[k])
- goto got_it;
- pData[n].ppPredecessors[pData[n].nPredecessors]=&pData[k];
- ++pData[n].nPredecessors;
- got_it:
- break;
- }
- for(i=0 ; pItems[n].aszSuccessors && pItems[n].aszSuccessors[i] ; ++i)
- for(k=0 ; k < nItems ; ++k)
- if(!strcmp(pItems[k].szName,pItems[n].aszSuccessors[i])) {
- int l;
-
- for(l=0 ; l < pData[k].nPredecessors ; ++l)
- if(pData[k].ppPredecessors[l] == &pData[n])
- goto got_it2;
- pData[k].ppPredecessors[pData[k].nPredecessors]=&pData[n];
- ++pData[k].nPredecessors;
- got_it2:
- break;
- }
- }
-
- return pData;
-}
-
-static TSort *tsort(TSort *pData,int nItems)
-{
- int nTotal;
- TSort *pHead=NULL;
- TSort *pTail=NULL;
-
- for(nTotal=0 ; nTotal < nItems ; ++nTotal) {
- int n,i,k;
-
- for(n=0 ; ; ++n) {
- if(n == nItems)
- assert(0); /* // we have a loop... */
- if(!pData[n].pNext && !pData[n].nPredecessors)
- break;
- }
- if(pTail)
- pTail->pNext=&pData[n];
- else
- pHead=&pData[n];
- pTail=&pData[n];
- pTail->pNext=pTail; /* // fudge it so it looks linked */
- for(i=0 ; i < nItems ; ++i)
- for(k=0 ; pData[i].ppPredecessors[k] ; ++k)
- if(pData[i].ppPredecessors[k] == &pData[n]) {
- --pData[i].nPredecessors;
- break;
- }
- }
- pTail->pNext=NULL; /* // unfudge the tail */
- return pHead;
-}
-
-static apr_array_header_t *sort_hook(apr_array_header_t *pHooks,const char *szName)
-{
- apr_pool_t *p;
- TSort *pSort;
- apr_array_header_t *pNew;
- int n;
-
- apr_create_pool(&p, ap_global_hook_pool);
- pSort=prepare(p,(TSortData *)pHooks->elts,pHooks->nelts);
- pSort=tsort(pSort,pHooks->nelts);
- pNew=apr_make_array(ap_global_hook_pool,pHooks->nelts,sizeof(TSortData));
- if(ap_debug_module_hooks)
- printf("Sorting %s:",szName);
- for(n=0 ; pSort ; pSort=pSort->pNext,++n) {
- TSortData *pHook;
- assert(n < pHooks->nelts);
- pHook=apr_push_array(pNew);
- memcpy(pHook,pSort->pData,sizeof *pHook);
- if(ap_debug_module_hooks)
- printf(" %s",pHook->szName);
- }
- if(ap_debug_module_hooks)
- fputc('\n',stdout);
- return pNew;
-}
-
-static apr_array_header_t *s_aHooksToSort;
-typedef struct
-{
- const char *szHookName;
- apr_array_header_t **paHooks;
-} HookSortEntry;
-
-APR_DECLARE(void) ap_hook_sort_register(const char *szHookName,
- apr_array_header_t **paHooks)
-{
- HookSortEntry *pEntry;
-
- if(!s_aHooksToSort)
- s_aHooksToSort=apr_make_array(ap_global_hook_pool,1,sizeof(HookSortEntry));
- pEntry=apr_push_array(s_aHooksToSort);
- pEntry->szHookName=szHookName;
- pEntry->paHooks=paHooks;
-}
-
-APR_DECLARE(void) ap_sort_hooks()
-{
- int n;
-
- for(n=0 ; n < s_aHooksToSort->nelts ; ++n) {
- HookSortEntry *pEntry=&((HookSortEntry *)s_aHooksToSort->elts)[n];
- *pEntry->paHooks=sort_hook(*pEntry->paHooks,pEntry->szHookName);
- }
-}
-
-APR_DECLARE(void) ap_hook_deregister_all(void)
-{
- int n;
-
- for(n=0 ; n < s_aHooksToSort->nelts ; ++n) {
- HookSortEntry *pEntry=&((HookSortEntry *)s_aHooksToSort->elts)[n];
- *pEntry->paHooks=NULL;
- }
- s_aHooksToSort=NULL;
-}
-
-APR_DECLARE(void) ap_show_hook(const char *szName,const char * const *aszPre,
- const char * const *aszSucc)
-{
- int nFirst;
-
- printf(" Hooked %s",szName);
- if(aszPre) {
- fputs(" pre(",stdout);
- nFirst=1;
- while(*aszPre) {
- if(!nFirst)
- fputc(',',stdout);
- nFirst=0;
- fputs(*aszPre,stdout);
- ++aszPre;
- }
- fputc(')',stdout);
- }
- if(aszSucc) {
- fputs(" succ(",stdout);
- nFirst=1;
- while(*aszSucc) {
- if(!nFirst)
- fputc(',',stdout);
- nFirst=0;
- fputs(*aszSucc,stdout);
- ++aszSucc;
- }
- fputc(')',stdout);
- }
- fputc('\n',stdout);
-}
-
-#if 0
-void main()
-{
- const char *aszAPre[]={"b","c",NULL};
- const char *aszBPost[]={"a",NULL};
- const char *aszCPost[]={"b",NULL};
- TSortData t1[]=
- {
- { "a",aszAPre,NULL },
- { "b",NULL,aszBPost },
- { "c",NULL,aszCPost }
- };
- TSort *pResult;
-
- pResult=prepare(t1,3);
- pResult=tsort(pResult,3);
-
- for( ; pResult ; pResult=pResult->pNext)
- printf("%s\n",pResult->pData->szName);
-}
-#endif
diff --git a/include/apr_base64.h b/include/apr_base64.h
deleted file mode 100644
index 56050f7c..00000000
--- a/include/apr_base64.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation. 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. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 APACHE SOFTWARE FOUNDATION OR
- * ITS 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.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- * 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.
- */
-
-#ifndef APACHE_BASE64_H
-#define APACHE_BASE64_H
-
-#include "apr_general.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @package Base64 Encoding
- */
-
-/* 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-encrypted string, get the length of the
- * encrypted string.
- * @param len the length of an unencrypted string.
- * @return the length of the string after it is encrypted
- * @deffunc int ap_base64encode_len(int len)
- */
-APR_DECLARE(int) ap_base64encode_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
- * @deffunc int ap_base64encode(char *coded_dst, const char *plain_src, int len_plain_src)
- */
-APR_DECLARE(int) ap_base64encode(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
- * @deffunc int ap_base64encode_binary(char *coded_dst, const char *plain_src, int len_plain_src)
- */
-APR_DECLARE(int) ap_base64encode_binary(char * coded_dst, const unsigned char *plain_src,int len_plain_src);
-
-/**
- * Determine the length of a plain text string given the encoded version
- * @param coded_src The encoded string
- * @return the length of the plain text string
- * @deffunc int ap_base64decode_len(const char *coded_src)
- */
-APR_DECLARE(int) ap_base64decode_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
- * @deffunc int ap_base64decode(char *plain_dst, const char *coded_src)
- */
-APR_DECLARE(int) ap_base64decode(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
- * @deffunc int ap_base64decode_binary(char *plain_dst, const char *coded_src)
- */
-APR_DECLARE(int) ap_base64decode_binary(unsigned char * plain_dst, const char *coded_src);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* !APACHE_BASE64_H */
diff --git a/include/apr_buckets.h b/include/apr_buckets.h
deleted file mode 100644
index b37faefe..00000000
--- a/include/apr_buckets.h
+++ /dev/null
@@ -1,1117 +0,0 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation. 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. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 APACHE SOFTWARE FOUNDATION OR
- * ITS 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.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-#ifndef AP_BUCKETS_H
-#define AP_BUCKETS_H
-
-#include "apr_network_io.h"
-#include "apr_file_io.h"
-#include "apr_general.h"
-#include "apr_mmap.h"
-#include "apr_errno.h"
-#include "ap_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
-
-/**
- * @package Bucket Brigades
- */
-
-typedef enum {AP_BLOCK_READ, AP_NONBLOCK_READ} ap_read_type;
-
-/*
- * 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 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 varous 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 (ap_bucket_read(),
- * ap_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.
- */
-
-typedef struct ap_bucket_brigade ap_bucket_brigade;
-
-typedef struct ap_bucket ap_bucket;
-
-typedef struct ap_bucket_type ap_bucket_type;
-struct ap_bucket_type {
- /**
- * 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;
- /**
- * Free the private data and any resources used by the bucket
- * (if they aren't shared with another bucket).
- * @param data The private data pointer from the bucket to be destroyed
- */
- void (*destroy)(void *data);
-
- /**
- * Read the data from the bucket. This is guaranteed 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.
- * @deffunc apr_status_t read(ap_bucket *b, const char **str, apr_size_t *len, ap_read_type block)
- */
- apr_status_t (*read)(ap_bucket *b, const char **str, apr_size_t *len, ap_read_type block);
-
- /**
- * Make it possible to set aside the data. Buckets containing data that
- * dies when the stack is un-wound must convert the bucket into a heap
- * bucket. For most bucket types, though, this is a no-op and this
- * function will return APR_ENOTIMPL.
- * @param e The bucket to convert
- * @deffunc apr_status_t setaside(ap_bucket *e)
- */
- apr_status_t (*setaside)(ap_bucket *e);
-
- /**
- * 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.
- * @see ap_bucket_split_any().
- * @param e The bucket to split
- * @param point The offset of the first byte in the new bucket
- * @deffunc apr_status_t split(ap_bucket *e, apr_off_t point)
- */
- apr_status_t (*split)(ap_bucket *e, apr_off_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
- * @deffunc apr_status_t copy
- */
- apr_status_t (*copy)(ap_bucket *e, ap_bucket **c);
-
-};
-
-/**
- * ap_bucket_t structures are allocated on the malloc() heap and
- * their lifetime is controlled by the parent ap_bucket_brigade
- * structure. Buckets can move from one brigade to another e.g. by
- * calling ap_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 ap_bucket {
- /** Links to the rest of the brigade */
- AP_RING_ENTRY(ap_bucket) link;
- /** The type of bucket. */
- const ap_bucket_type *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 -1.
- */
- apr_off_t length;
- /** type-dependent data hangs off this pointer */
- void *data;
-};
-
-/** A list of buckets */
-struct ap_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. */
- /*
- * XXX: the ap_bucket_list structure doesn't actually need a name tag
- * because it has no existence independent of struct ap_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.
- */
- AP_RING_HEAD(ap_bucket_list, ap_bucket) list;
-};
-
-/**
- * Wrappers around the RING macros to reduce the verbosity of the code
- * that handles bucket brigades.
- */
-/**
- * Determine if this bucket is the start of the list
- * @param b The bucket to test
- * @return true or false
- * @deffunc int AP_BRIGADE_SENTINEL(ap_bucket *b)
- */
-#define AP_BRIGADE_SENTINEL(b) AP_RING_SENTINEL(&(b)->list, ap_bucket, link)
-
-/**
- * Determine if the bucket brigade is empty
- * @param b The brigade to check
- * @return true or false
- * @deffunc AP_BRIGADE_EMPTY(ap_bucket_brigade *b)
- */
-#define AP_BRIGADE_EMPTY(b) AP_RING_EMPTY(&(b)->list, ap_bucket, link)
-
-/**
- * Return the first bucket in a brigade
- * @param b The brigade to query
- * @return The first bucket in the brigade
- * @deffunc ap_bucket *AP_BUCKET_FIRST(ap_bucket_brigade *b)
- */
-#define AP_BRIGADE_FIRST(b) AP_RING_FIRST(&(b)->list)
-/**
- * Return the last bucket in a brigade
- * @param b The brigade to query
- * @return The last bucket in the brigade
- * @deffunc ap_bucket *AP_BUCKET_LAST(ap_bucket_brigade *b)
- */
-#define AP_BRIGADE_LAST(b) AP_RING_LAST(&(b)->list)
-
-/**
- * Iterate through a bucket brigade
- * @param e The current bucket
- * @param b The brigade to iterate over
- * @tip This is the same as either:
- * <pre>
- * e = AP_BUCKET_FIRST(b);
- * while (!AP_BUCKET_SENTINEL(e)) {
- * ...
- * e = AP_BUCKET_NEXT(e);
- * }
- * OR
- * for (e = AP_BUCKET_FIRST(b); !AP_BUCKET_SENTINEL(e); e = AP_BUCKET_NEXT(e)) {
- * ...
- * }
- * @deffunc void AP_BRIGADE_FOREACH(ap_bucket *e, ap_bucket_brigade *b)
- */
-#define AP_BRIGADE_FOREACH(e, b) \
- AP_RING_FOREACH((e), &(b)->list, ap_bucket, link)
-
-/**
- * Insert a list of buckets at the front of a brigade
- * @param b The brigade to add to
- * @param e The first bucket in a list of buckets to insert
- * @deffunc void AP_BRIGADE_INSERT_HEAD(ap_bucket_brigade *b, ap_bucket *e)
- */
-#define AP_BRIGADE_INSERT_HEAD(b, e) \
- AP_RING_INSERT_HEAD(&(b)->list, (e), ap_bucket, link)
-/**
- * Insert a list of buckets at the end of a brigade
- * @param b The brigade to add to
- * @param e The first bucket in a list of buckets to insert
- * @deffunc void AP_BRIGADE_INSERT_HEAD(ap_bucket_brigade *b, ap_bucket *e)
- */
-#define AP_BRIGADE_INSERT_TAIL(b, e) \
- AP_RING_INSERT_TAIL(&(b)->list, (e), ap_bucket, link)
-
-/**
- * Concatenate two brigades together
- * @param a The first brigade
- * @param b The second brigade
- * @deffunc void AP_BRIGADE_CONCAT(ap_bucket_brigade *a, ap_bucket_brigade *b)
- */
-#define AP_BRIGADE_CONCAT(a, b) \
- AP_RING_CONCAT(&(a)->list, &(b)->list, ap_bucket, link)
-
-/**
- * Insert a list of buckets before a specified bucket
- * @param a The buckets to insert
- * @param b The bucket to insert before
- * @deffunc void AP_BUCKET_INSERT_BEFORE(ap_bucket *a, ap_bucket *b)
- */
-#define AP_BUCKET_INSERT_BEFORE(a, b) \
- AP_RING_INSERT_BEFORE((a), (b), link)
-/**
- * Insert a list of buckets after a specified bucket
- * @param a The buckets to insert
- * @param b The bucket to insert after
- * @deffunc void AP_BUCKET_INSERT_AFTER(ap_bucket *a, ap_bucket *b)
- */
-#define AP_BUCKET_INSERT_AFTER(a, b) \
- AP_RING_INSERT_AFTER((a), (b), link)
-
-/**
- * Get the next bucket in the list
- * @param e The current bucket
- * @return The next bucket
- * @deffunc ap_bucket *AP_BUCKET_NEXT(ap_bucket *e)
- */
-#define AP_BUCKET_NEXT(e) AP_RING_NEXT((e), link)
-/**
- * Get the previous bucket in the list
- * @param e The current bucket
- * @return The previous bucket
- * @deffunc ap_bucket *AP_BUCKET_PREV(ap_bucket *e)
- */
-#define AP_BUCKET_PREV(e) AP_RING_PREV((e), link)
-
-/**
- * Remove a bucket from its bucket brigade
- * @param e The bucket to remove
- * @deffunc void AP_BUCKET_REMOVE(ap_bucket *e)
- */
-#define AP_BUCKET_REMOVE(e) AP_RING_REMOVE((e), link)
-
-/**
- * Determine if a bucket is a FLUSH bucket
- * @param e The bucket to inspect
- * @return true or false
- * @deffunc int AP_BUCKET_IS_FLUSH(ap_bucket *e)
- */
-#define AP_BUCKET_IS_FLUSH(e) (e->type == &ap_flush_type)
-/**
- * Determine if a bucket is an EOS bucket
- * @param e The bucket to inspect
- * @return true or false
- * @deffunc int AP_BUCKET_IS_EOS(ap_bucket *e)
- */
-#define AP_BUCKET_IS_EOS(e) (e->type == &ap_eos_type)
-/**
- * Determine if a bucket is a FILE bucket
- * @param e The bucket to inspect
- * @return true or false
- * @deffunc int AP_BUCKET_IS_FILE(ap_bucket *e)
- */
-#define AP_BUCKET_IS_FILE(e) (e->type == &ap_file_type)
-/**
- * Determine if a bucket is a PIPE bucket
- * @param e The bucket to inspect
- * @return true or false
- * @deffunc int AP_BUCKET_IS_PIPE(ap_bucket *e)
- */
-#define AP_BUCKET_IS_PIPE(e) (e->type == &ap_pipe_type)
-/**
- * Determine if a bucket is a SOCKET bucket
- * @param e The bucket to inspect
- * @return true or false
- * @deffunc int AP_BUCKET_IS_SOCKET(ap_bucket *e)
- */
-#define AP_BUCKET_IS_SOCKET(e) (e->type == &ap_socket_type)
-/**
- * Determine if a bucket is a HEAP bucket
- * @param e The bucket to inspect
- * @return true or false
- * @deffunc int AP_BUCKET_IS_HEAP(ap_bucket *e)
- */
-#define AP_BUCKET_IS_HEAP(e) (e->type == &ap_heap_type)
-/**
- * Determine if a bucket is a TRANSIENT bucket
- * @param e The bucket to inspect
- * @return true or false
- * @deffunc int AP_BUCKET_IS_TRANSIENT(ap_bucket *e)
- */
-#define AP_BUCKET_IS_TRANSIENT(e) (e->type == &ap_transient_type)
-/**
- * Determine if a bucket is a IMMORTAL bucket
- * @param e The bucket to inspect
- * @return true or false
- * @deffunc int AP_BUCKET_IS_IMMORTAL(ap_bucket *e)
- */
-#define AP_BUCKET_IS_IMMORTAL(e) (e->type == &ap_immortal_type)
-/**
- * Determine if a bucket is a MMAP bucket
- * @param e The bucket to inspect
- * @return true or false
- * @deffunc int AP_BUCKET_IS_MMAP(ap_bucket *e)
- */
-#define AP_BUCKET_IS_MMAP(e) (e->type == &ap_mmap_type)
-/**
- * Determine if a bucket is a POOL bucket
- * @param e The bucket to inspect
- * @return true or false
- * @deffunc int AP_BUCKET_IS_POOL(ap_bucket *e)
- */
-#define AP_BUCKET_IS_POOL(e) (e->type == &ap_pool_type)
-
-/*
- * General-purpose reference counting for the varous 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. */
-
-typedef struct ap_bucket_refcount ap_bucket_refcount;
-/**
- * The structure used to manage the shared resource must start with an
- * ap_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 ap_bucket_refcount and vice versa.
- */
-struct ap_bucket_refcount {
- /** The number of references to this bucket */
- int refcount;
-};
-
-typedef struct ap_bucket_shared ap_bucket_shared;
-/**
- * The data pointer of a refcounted bucket points to an
- * ap_bucket_shared structure which describes the region of the shared
- * object that this bucket refers to. The ap_bucket_shared isn't a
- * fully-fledged bucket type: it is a utility type that proper bucket
- * types are based on.
- */
-struct ap_bucket_shared {
- /** start of the data in the bucket relative to the private base pointer */
- apr_off_t start;
- /** end of the data in the bucket relative to the private base pointer */
- apr_off_t end;
- /** pointer to the real private data of the bucket,
- * which starts with an ap_bucket_refcount */
- void *data;
-};
-
-/* ***** Non-reference-counted bucket types ***** */
-
-
-typedef struct ap_bucket_simple ap_bucket_simple;
-/**
- * TRANSIENT and IMMORTAL buckets don't have much to do with looking
- * after the memory that they refer to so they share a lot of their
- * implementation.
- */
-struct ap_bucket_simple {
- /** The start of the data in the bucket */
- const char *start;
- /** The end of the data in the bucket */
- const char *end;
-};
-
-typedef struct ap_bucket_pool ap_bucket_pool;
-/**
- * A bucket referring to data allocated out of a pool
- */
-struct ap_bucket_pool {
- /** Number of buckets using this memory */
- ap_bucket_refcount refcount;
- /** The start of the data actually allocated. This should never be
- * modified, it is only used to free the bucket.
- */
- const char *base;
- /** The pool the data was allocated out of */
- apr_pool_t *p;
- /** This is a hack, because we call ap_destroy_bucket with the ->data
- * pointer, so the pool cleanup needs to be registered with that pointer,
- * but the whole point of the cleanup is to convert the bucket to another
- * type. To do that conversion, we need a pointer to the bucket itself.
- * This gives us a pointer to the original bucket.
- */
- ap_bucket *b;
-};
-
-/* ***** Reference-counted bucket types ***** */
-
-
-typedef struct ap_bucket_heap ap_bucket_heap;
-/**
- * A bucket referring to data allocated off the heap.
- */
-struct ap_bucket_heap {
- /** Number of buckets using this memory */
- ap_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. This may not be necessary */
- size_t alloc_len;
-};
-
-typedef struct ap_bucket_mmap ap_bucket_mmap;
-/**
- * A bucket referring to an mmap()ed file
- */
-struct ap_bucket_mmap {
- /** Number of buckets using this memory */
- ap_bucket_refcount refcount;
- /** The mmap this sub_bucket refers to */
- apr_mmap_t *mmap;
-};
-
-typedef struct ap_bucket_file ap_bucket_file;
-/**
- * A bucket referring to an file
- */
-struct ap_bucket_file {
- /** The file this bucket refers to */
- apr_file_t *fd;
- /** The offset into the file */
- apr_off_t offset;
-};
-
-/* ***** Bucket Brigade Functions ***** */
-/**
- * Create a new bucket brigade. The bucket brigade is originally empty.
- * @param The pool to associate with the brigade. Data is not allocated out
- * of the pool, but a cleanup is registered.
- * @return The empty bucket brigade
- * @deffunc ap_bucket_brigade *ap_brigade_create(apr_pool_t *p)
- */
-APR_DECLARE(ap_bucket_brigade *) ap_brigade_create(apr_pool_t *p);
-
-/**
- * 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
- * @deffunc apr_status_t ap_brigade_destroy(ap_bucket_brigade *b)
- */
-APR_DECLARE(apr_status_t) ap_brigade_destroy(ap_bucket_brigade *b);
-
-/**
- * Split a bucket brigade into two, such that the given bucket is the
- * first in the new bucket brigade. This function is useful when a
- * filter wants to pass only the initial part of a brigade to the next
- * filter.
- * @param b The brigade to split
- * @param e The first element of the new brigade
- * @return The new brigade
- * @deffunc ap_bucket_brigade *ap_brigade_split(ap_bucket_brigade *b, ap_bucket *e)
- */
-APR_DECLARE(ap_bucket_brigade *) ap_brigade_split(ap_bucket_brigade *b,
- ap_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
- * @return A pointer to the first bucket after the partition;
- * or NULL in any error condition (including partition past the end)
- * @deffunc ap_bucket *ap_brigade_partition(ap_bucket_brigade *b, apr_off_t point)
- */
-APR_DECLARE(ap_bucket *) ap_brigade_partition(ap_bucket_brigade *b, apr_off_t point);
-
-#if APR_NOT_DONE_YET
-/**
- * consume nbytes from beginning of b -- call ap_bucket_destroy as
- * appropriate, and/or modify start on last element
- * @param b The brigade to consume data from
- * @param nbytes The number of bytes to consume
- * @deffunc void ap_brigade_consume(ap_bucket_brigade *b, int nbytes)
- */
-APR_DECLARE(void) ap_brigade_consume(ap_bucket_brigade *b, int nbytes);
-#endif
-
-/**
- * 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 The bucket brigade to create the iovec out of
- * @param The iovec to create
- * @param The number of elements in the iovec
- * @return The number of iovec elements actually filled out.
- * @deffunc int ap_brigade_to_iovec(ap_bucket_brigade *b, struct iovec *vec, int nvec);
- */
-APR_DECLARE(int) ap_brigade_to_iovec(ap_bucket_brigade *b,
- struct iovec *vec, int nvec);
-
-/**
- * This function writes a list of strings into a bucket brigade. We just
- * allocate a new heap bucket for each string.
- * @param b The bucket brigade to add to
- * @param va A list of strings to add
- * @return The number of bytes added to the brigade
- * @deffunc int ap_brigade_vputstrs(ap_bucket_brigade *b, va_list va)
- */
-APR_DECLARE(int) ap_brigade_vputstrs(ap_bucket_brigade *b, va_list va);
-
-/**
- * This function writes an unspecified number of strings into a bucket brigade.
- * We just allocate a new heap bucket for each string.
- * @param b The bucket brigade to add to
- * @param ... The strings to add
- * @return The number of bytes added to the brigade
- * @deffunc int ap_brigade_putstrs(ap_bucket_brigade *b, ...)
- */
-APR_DECLARE_NONSTD(int) ap_brigade_putstrs(ap_bucket_brigade *b, ...);
-
-/**
- * Evaluate a printf and put the resulting string into a bucket at the end
- * of the bucket brigade.
- * @param b The brigade to write to
- * @param fmt The format of the string to write
- * @param ... The arguments to fill out the format
- * @return The number of bytes added to the brigade
- * @deffunc int ap_brigade_printf(ap_bucket_brigade *b, const char *fmt, ...)
- */
-APR_DECLARE_NONSTD(int) ap_brigade_printf(ap_bucket_brigade *b, const char *fmt, ...);
-
-/**
- * Evaluate a printf and put the resulting string into a bucket at the end
- * of the bucket brigade.
- * @param b The brigade to write to
- * @param fmt The format of the string to write
- * @param va The arguments to fill out the format
- * @return The number of bytes added to the brigade
- * @deffunc int ap_brigade_vprintf(ap_bucket_brigade *b, const char *fmt, va_list va)
- */
-APR_DECLARE(int) ap_brigade_vprintf(ap_bucket_brigade *b, const char *fmt, va_list va);
-
-
-/* ***** Bucket Functions ***** */
-/**
- * Initialize the core implemented bucket types. Once this is done,
- * it is possible to add new bucket types to the server
- * @param p The pool to allocate the array out of.
- * @deffunc void ap_init_bucket_types(apr_pool_t *p)
- */
-void ap_init_bucket_types(apr_pool_t *p);
-
-/**
- * free the resources used by a bucket. If multiple buckets refer to
- * the same resource it is freed when the last one goes away.
- * @param e The bucket to destroy
- * @deffunc void ap_bucket_destroy(ap_bucket *e)
- */
-#define ap_bucket_destroy(e) \
- { \
- e->type->destroy(e->data); \
- free(e); \
- }
-
-/**
- * read the data from the bucket
- * @param e The bucket to read from
- * @param str The location to store the data in
- * @param len The amount of data read
- * @param block Whether the read function blocks
- * @deffunc apr_status_t ap_bucket_read(ap_bucket *e, const char **str, apr_size_t *len, ap_read_type block)
- */
-#define ap_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
- * @deffunc apr_status_t ap_bucket_setaside(ap_bucket *e)
- */
-#define ap_bucket_setaside(e) e->type->setaside(e)
-
-/**
- * Split one bucket in two.
- * @param e The bucket to split
- * @param point The offset to split the bucket at
- * @deffunc apr_status_t ap_bucket_split(ap_bucket *e, apr_off_t point)
- */
-#define ap_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
- * @deffunc apr_status_t ap_bucket_copy(ap_bucket *e, ap_bucket **c)
- */
-#define ap_bucket_copy(e,c) e->type->copy(e, c)
-
-/* Bucket type handling */
-
-/**
- * A place holder function that signifies that the setaside function was not
- * implemented for this bucket
- * @param data The bucket to setaside
- * @return APR_ENOTIMPL
- * @deffunc apr_status_t ap_bucket_setaside_notimpl(ap_bucket *data)
- */
-APR_DECLARE_NONSTD(apr_status_t) ap_bucket_setaside_notimpl(ap_bucket *data);
-/**
- * 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
- * @deffunc apr_status_t ap_bucket_split_notimpl(ap_bucket *data)
- */
-APR_DECLARE_NONSTD(apr_status_t) ap_bucket_split_notimpl(ap_bucket *data,
- apr_off_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
- * @deffunc apr_status_t ap_bucket_copy_notimpl(ap_bucket *e, ap_bucket **c)
- */
-APR_DECLARE_NONSTD(apr_status_t) ap_bucket_copy_notimpl(ap_bucket *e,
- ap_bucket **c);
-/**
- * A place holder function that signifies that the destroy function was not
- * implemented for this bucket
- * @param data The bucket to destroy
- * @deffunc void ap_bucket_destroy(ap_bucket *data)
- */
-APR_DECLARE_NONSTD(void) ap_bucket_destroy_notimpl(void *data);
-/* There is no ap_bucket_read_notimpl, because it is a required function
- */
-
-/**
- * Register a new bucket type
- * @param type The new bucket type to register
- * @return The offset into the array in which the bucket types are stored
- */
-int ap_insert_bucket_type(const ap_bucket_type *type);
-
-/* 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.
- */
-APR_DECLARE_DATA extern const ap_bucket_type ap_flush_type;
-/**
- * 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
- */
-APR_DECLARE_DATA extern const ap_bucket_type ap_eos_type;
-/**
- * The FILE bucket type. This bucket represents a file on disk
- */
-APR_DECLARE_DATA extern const ap_bucket_type ap_file_type;
-/**
- * The HEAP bucket type. This bucket represents a data allocated out of the
- * heap.
- */
-APR_DECLARE_DATA extern const ap_bucket_type ap_heap_type;
-/**
- * The MMAP bucket type. This bucket represents an MMAP'ed file
- */
-APR_DECLARE_DATA extern const ap_bucket_type ap_mmap_type;
-/**
- * The POOL bucket type. This bucket represents a data that was allocated
- * out of a pool. IF this bucket is still available when the pool is cleared,
- * the data is copied on to the heap.
- */
-APR_DECLARE_DATA extern const ap_bucket_type ap_pool_type;
-/**
- * The PIPE bucket type. This bucket represents a pipe to another program.
- */
-APR_DECLARE_DATA extern const ap_bucket_type ap_pipe_type;
-/**
- * The IMMORTAL bucket type. This bucket represents a segment of data that
- * the creator is willing to take responsability for. The core will do
- * nothing with the data in an immortal bucket
- */
-APR_DECLARE_DATA extern const ap_bucket_type ap_immortal_type;
-/**
- * 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
- */
-APR_DECLARE_DATA extern const ap_bucket_type ap_transient_type;
-/**
- * The SOCKET bucket type. This bucket represents a socket to another machine
- */
-APR_DECLARE_DATA extern const ap_bucket_type ap_socket_type;
-
-
-/* ***** 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,
- * or NULL if a new one should be allocated
- * @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 end The end of the data in the bucket
- * relative to the private base pointer
- * @return The new bucket, or NULL if allocation failed
- * @deffunc ap_bucket *ap_bucket_make_shared(ap_bucket_refcount *r, apr_off_t start, apr_off_t end)
- */
-APR_DECLARE(ap_bucket *) ap_bucket_make_shared(ap_bucket *b, void *data,
- apr_off_t start, apr_off_t end);
-
-/**
- * Decrement the refcount of the data in the bucket and free the
- * ap_bucket_shared structure. 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 NULL if nothing needs to be done,
- * otherwise a pointer to the private data structure which
- * must be destroyed because its reference count is zero
- * @deffunc void *ap_bucket_destroy_shared(ap_bucket *b)
- */
-APR_DECLARE(void *) ap_bucket_destroy_shared(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
- * @deffunc apr_status_t ap_bucket_split_shared(ap_bucket *b, apr_off_t point)
- */
-APR_DECLARE_NONSTD(apr_status_t) ap_bucket_split_shared(ap_bucket *b, apr_off_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 c Returns a pointer to the new bucket
- * @return APR_ENOMEM if allocation failed;
- or APR_SUCCESS
- * @deffunc apr_status_t ap_bucket_copy_shared(ap_bucket *a, ap_bucket **c)
- */
-APR_DECLARE_NONSTD(apr_status_t) ap_bucket_copy_shared(ap_bucket *a, ap_bucket **c);
-
-
-/* ***** Functions to Create Buckets of varying type ***** */
-/*
- * Each bucket type foo has two initialization functions:
- * ap_bucket_make_foo which sets up some already-allocated memory as a
- * bucket of type foo; and ap_bucket_create_foo which allocates memory
- * for the bucket, calls ap_bucket_make_foo, and initializes the
- * bucket's list pointers. The ap_bucket_make_foo functions are used
- * inside the bucket code to change the type of buckets in place;
- * other code should call ap_bucket_create_foo. All the initialization
- * functions change nothing if they fail.
- */
-
-/*
- * This macro implements the guts of ap_bucket_create_foo
- */
-#define ap_bucket_do_create(do_make) \
- do { \
- ap_bucket *b, *ap__b; \
- b = calloc(1, sizeof(*b)); \
- if (b == NULL) { \
- return NULL; \
- } \
- ap__b = do_make; \
- if (ap__b == NULL) { \
- free(b); \
- return NULL; \
- } \
- AP_RING_ELEM_INIT(ap__b, link); \
- return ap__b; \
- } while(0)
-
-
-/**
- * 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.
- * @return The new bucket, or NULL if allocation failed
- * @deffunc ap_bucket *ap_bucket_create_eos(void)
- */
-APR_DECLARE(ap_bucket *) ap_bucket_create_eos(void);
-/**
- * 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
- * @deffunc ap_bucket *ap_bucket_make_eos(ap_bucket *b)
- */
-APR_DECLARE(ap_bucket *) ap_bucket_make_eos(ap_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.
- * @return The new bucket, or NULL if allocation failed
- * @deffunc ap_bucket *ap_bucket_create_flush(void)
- */
-APR_DECLARE(ap_bucket *) ap_bucket_create_flush(void);
-/**
- * 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
- * @deffunc ap_bucket *ap_bucket_make_flush(ap_bucket *b)
- */
-APR_DECLARE(ap_bucket *) ap_bucket_make_flush(ap_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.
- * @return The new bucket, or NULL if allocation failed
- * @deffunc ap_bucket *ap_bucket_create_transient(const char *buf, apr_size_t nbyte, apr_size_t *w)
- */
-APR_DECLARE(ap_bucket *) ap_bucket_create_immortal(
- const char *buf, apr_size_t nbyte);
-/**
- * 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.
- * @param w The number of bytes added to the bucket
- * @return The new bucket, or NULL if allocation failed
- * @deffunc ap_bucket *ap_bucket_make_immortal(ap_bucket *b, const char *buf, apr_size_t nbyte, apr_size_t *w)
- */
-APR_DECLARE(ap_bucket *) ap_bucket_make_immortal(ap_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.
- * @return The new bucket, or NULL if allocation failed
- * @deffunc ap_bucket *ap_bucket_create_transient(const char *buf, apr_size_t nbyte, apr_size_t *w)
- */
-APR_DECLARE(ap_bucket *) ap_bucket_create_transient(
- const char *buf, apr_size_t nbyte);
-/**
- * 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
- * @deffunc ap_bucket *ap_bucket_make_transient(ap_bucket *b, const char *buf, apr_size_t nbyte)
- */
-APR_DECLARE(ap_bucket *) ap_bucket_make_transient(ap_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 copy Whether to copy the data into newly-allocated memory or not
- * @param w The number of bytes actually copied into the bucket.
- * If copy is zero then this return value can be ignored by passing a NULL pointer.
- * @return The new bucket, or NULL if allocation failed
- * @deffunc ap_bucket *ap_bucket_create_heap(const char *buf, apr_size_t nbyte, int copy, apr_size_t *w)
- */
-APR_DECLARE(ap_bucket *) ap_bucket_create_heap(
- const char *buf, apr_size_t nbyte, int copy, apr_size_t *w);
-/**
- * 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 copy Whether to copy the data into newly-allocated memory or not
- * @param w The number of bytes actually copied into the bucket.
- * If copy is zero then this return value can be ignored by passing a NULL pointer.
- * @return The new bucket, or NULL if allocation failed
- * @deffunc ap_bucket *ap_bucket_make_heap(ap_bucket *b, const char *buf, apr_size_t nbyte, int copy, apr_size_t *w)
- */
-APR_DECLARE(ap_bucket *) ap_bucket_make_heap(ap_bucket *b,
- const char *buf, apr_size_t nbyte, int copy, apr_size_t *w);
-
-/**
- * Create a bucket referring to memory allocated out of a pool.
- * @param buf The buffer to insert into the bucket
- * @param p The pool the memory was allocated out of
- * @return The new bucket, or NULL if allocation failed
- * @deffunc ap_bucket *ap_bucket_create_pool(const char *buf, apr_size_t *length, apr_pool_t *p)
- */
-APR_DECLARE(ap_bucket *) ap_bucket_create_pool(const char *buf,
- apr_size_t length, apr_pool_t *p);
-/**
- * Make the bucket passed in a bucket refer to pool data
- * @param b The bucket to make into a HEAP bucket
- * @param buf The buffer to insert into the bucket
- * @param p The pool the memory was allocated out of
- * @return The new bucket, or NULL if allocation failed
- * @deffunc ap_bucket *ap_bucket_make_pool(ap_bucket *b, const char *buf, apr_size_t *length, apr_pool_t *p)
- */
-APR_DECLARE(ap_bucket *) ap_bucket_make_pool(ap_bucket *b,
- const char *buf, apr_size_t length, apr_pool_t *p);
-
-/**
- * Create a bucket referring to mmap()ed memory.
- * @param mmap 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
- * @deffunc ap_bucket *ap_bucket_create_mmap(const apr_mmap_t *mm, apr_size_t start, apr_size_t length)
- */
-APR_DECLARE(ap_bucket *) ap_bucket_create_mmap(
- apr_mmap_t *mm, apr_off_t start, apr_size_t length);
-/**
- * Make the bucket passed in a bucket refer to an MMAP'ed file
- * @param b The bucket to make into a MMAP bucket
- * @param mmap 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
- * @deffunc ap_bucket *ap_bucket_make_mmap(ap_bucket *b, const apr_mmap_t *mm, apr_size_t start, apr_size_t length)
- */
-APR_DECLARE(ap_bucket *) ap_bucket_make_mmap(ap_bucket *b,
- apr_mmap_t *mm, apr_off_t start, apr_size_t length);
-
-/**
- * Create a bucket referring to a socket.
- * @param thissocket The socket to put in the bucket
- * @return The new bucket, or NULL if allocation failed
- * @deffunc ap_bucket *ap_bucket_create_socket(apr_socket_t *thissocket)
- */
-APR_DECLARE(ap_bucket *) ap_bucket_create_socket(apr_socket_t *thissock);
-/**
- * Make the bucket passed in a bucket refer to a socket
- * @param b The bucket to make into a SOCKET bucket
- * @param thissocket The socket to put in the bucket
- * @return The new bucket, or NULL if allocation failed
- * @deffunc ap_bucket *ap_bucket_make_socket(ap_bucket *b, apr_socket_t *thissocket)
- */
-APR_DECLARE(ap_bucket *) ap_bucket_make_socket(ap_bucket *b, apr_socket_t *thissock);
-
-/**
- * Create a bucket referring to a pipe.
- * @param thispipe The pipe to put in the bucket
- * @return The new bucket, or NULL if allocation failed
- * @deffunc ap_bucket *ap_bucket_create_pipe(apr_file_t *thispipe)
- */
-APR_DECLARE(ap_bucket *) ap_bucket_create_pipe(apr_file_t *thispipe);
-/**
- * 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
- * @deffunc ap_bucket *ap_bucket_make_pipe(ap_bucket *b, apr_file_t *thispipe)
- */
-APR_DECLARE(ap_bucket *) ap_bucket_make_pipe(ap_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
- * @return The new bucket, or NULL if allocation failed
- * @deffunc ap_bucket *ap_bucket_create_file(apr_file_t *fd, apr_off_t offset, apr_size_t len)
- */
-APR_DECLARE(ap_bucket *) ap_bucket_create_file(apr_file_t *fd, apr_off_t offset, apr_size_t len);
-/**
- * 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
- * @return The new bucket, or NULL if allocation failed
- * @deffunc ap_bucket *ap_bucket_make_file(ap_bucket *b, apr_file_t *fd, apr_off_t offset, apr_size_t len)
- */
-APR_DECLARE(ap_bucket *) ap_bucket_make_file(ap_bucket *b, apr_file_t *fd,
- apr_off_t offset, apr_size_t len);
-
-#endif /* !AP_BUCKETS_H */
diff --git a/include/apr_dbm.h b/include/apr_dbm.h
deleted file mode 100644
index b3fb3559..00000000
--- a/include/apr_dbm.h
+++ /dev/null
@@ -1,168 +0,0 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation. 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. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 APACHE SOFTWARE FOUNDATION OR
- * ITS 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.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-#ifndef APR_DBM_H
-#define APR_DBM_H
-
-#include "apr.h"
-#include "apr_errno.h"
-#include "apr_pools.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @package APR-UTIL DBM library
- */
-
-/**
- * Structure for referencing a dbm
- * @defvar apr_dbm_t
- */
-typedef struct apr_dbm_t apr_dbm_t;
-
-/**
- * Structure for referencing the datum record within a dbm
- * @defvar apr_datum_t
- */
-typedef struct
-{
- char *dptr;
- 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 */
-
-/**
- * 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
- * </PRE>
- * @param cntxt The pool to use when creating the dbm
- * @tip The dbm name may not be a true file name, as many dbm packages
- * append suffixes for seperate data and index files.
- */
-apr_status_t apr_dbm_open(apr_dbm_t **dbm, const char *name, int mode,
- apr_pool_t *cntxt);
-/**
- * Close a dbm file previously opened by apr_dbm_open
- * @param dbm The database to close
- */
-void apr_dbm_close(apr_dbm_t *db);
-/**
- * Fetch a dbm record value by key
- * @param dbm The database
- * @param key The key datum to find this record
- * @param value The value datum retrieved for this record
- */
-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
- */
-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
- */
-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
- */
-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 key The key datum of the first record
- */
-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 key The key datum of the next record
- */
-apr_status_t apr_dbm_nextkey(apr_dbm_t *dbm, apr_datum_t *pkey);
-
-/* XXX: This is bogus. If this is a pool-managed dbm wrapper, we
- * don't free datum. If it isn't why pass pools?
- */
-void apr_dbm_freedatum(apr_dbm_t *dbm, apr_datum_t data);
-
-/* XXX: Need to change errcode to be handled canonically, and modify
- * the prototype to follow apr_dso_error etc.
- */
-void apr_dbm_geterror(apr_dbm_t *dbm, int *errcode, const char **errmsg);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* !APR_DBM_H */
-
-
diff --git a/include/apr_hooks.h b/include/apr_hooks.h
deleted file mode 100644
index a36b6ffe..00000000
--- a/include/apr_hooks.h
+++ /dev/null
@@ -1,261 +0,0 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation. 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. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 APACHE SOFTWARE FOUNDATION OR
- * ITS 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.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-#ifndef APACHE_AP_HOOKS_H
-#define APACHE_AP_HOOKS_H
-
-/* For apr_array_header_t */
-#include "apr_tables.h"
-
-/**
- * @package Apache hooks functions
- */
-
-#define AP_DECLARE_EXTERNAL_HOOK(link,ret,name,args) \
-typedef ret HOOK_##name args; \
-link##_DECLARE(void) ap_hook_##name(HOOK_##name *pf, const char* const* aszPre, \
- const char * const *aszSucc, int nOrder); \
-link##_DECLARE(ret) ap_run_##name args; \
-typedef struct _LINK_##name \
- { \
- HOOK_##name *pFunc; \
- const char *szName; \
- const char * const *aszPredecessors; \
- const char * const *aszSuccessors; \
- int nOrder; \
- } LINK_##name;
-
-#define AP_HOOK_STRUCT(members) \
-static struct { members } _hooks;
-
-#define AP_HOOK_LINK(name) \
- apr_array_header_t *link_##name;
-
-#define AP_IMPLEMENT_EXTERNAL_HOOK_BASE(link,name) \
-link##_DECLARE(void) ap_hook_##name(HOOK_##name *pf,const char * const *aszPre, \
- const char * const *aszSucc,int nOrder) \
- { \
- LINK_##name *pHook; \
- if(!_hooks.link_##name) \
- { \
- _hooks.link_##name=apr_make_array(ap_global_hook_pool,1,sizeof(LINK_##name)); \
- ap_hook_sort_register(#name,&_hooks.link_##name); \
- } \
- pHook=apr_push_array(_hooks.link_##name); \
- pHook->pFunc=pf; \
- pHook->aszPredecessors=aszPre; \
- pHook->aszSuccessors=aszSucc; \
- pHook->nOrder=nOrder; \
- pHook->szName=ap_debug_module_name; \
- if(ap_debug_module_hooks) \
- ap_show_hook(#name,aszPre,aszSucc); \
- }
-
-/**
- * Implement a hook that has no return code, and therefore runs all of the
- * registered functions
- * @param link The linkage declaration prefix of the hook
- * @param name The name of the hook
- * @param args_decl The declaration of the arguments for the hook
- * @param args_used The names for the arguments for the hook
- * @deffunc void AP_IMPLEMENT_EXTERNAL_HOOK_VOID(link, name, args_decl, args_use)
- * @tip The link prefix FOO corresponds to FOO_DECLARE() macros, which
- * provide export linkage from the module that IMPLEMENTs the hook, and
- * import linkage from external modules that link to the hook's module.
- */
-#define AP_IMPLEMENT_EXTERNAL_HOOK_VOID(link,name,args_decl,args_use) \
-AP_IMPLEMENT_EXTERNAL_HOOK_BASE(link,name) \
-link##_DECLARE(void) ap_run_##name args_decl \
- { \
- LINK_##name *pHook; \
- int n; \
-\
- if(!_hooks.link_##name) \
- return; \
-\
- pHook=(LINK_##name *)_hooks.link_##name->elts; \
- for(n=0 ; n < _hooks.link_##name->nelts ; ++n) \
- pHook[n].pFunc args_use; \
- }
-
-/* FIXME: note that this returns ok when nothing is run. I suspect it should
- really return decline, but that breaks Apache currently - Ben
-*/
-/**
- * Implement a hook that runs until one of the functions returns something
- * other than OK or DECLINE
- * @param link The linkage declaration prefix of the hook
- * @param name The name of the hook
- * @param args_decl The declaration of the arguments for the hook
- * @param args_used The names for the arguments for the hook
- * @deffunc int AP_IMPLEMENT_EXTERNAL_HOOK_RUN_ALL(link, name, args_decl, args_use)
- * @tip The link prefix FOO corresponds to FOO_DECLARE() macros, which
- * provide export linkage from the module that IMPLEMENTs the hook, and
- * import linkage from external modules that link to the hook's module.
- */
-#define AP_IMPLEMENT_EXTERNAL_HOOK_RUN_ALL(link,ret,name,args_decl,args_use,ok,decline) \
-AP_IMPLEMENT_EXTERNAL_HOOK_BASE(link,name) \
-link##_DECLARE(ret) ap_run_##name args_decl \
- { \
- LINK_##name *pHook; \
- int n; \
- ret rv; \
-\
- if(!_hooks.link_##name) \
- return ok; \
-\
- pHook=(LINK_##name *)_hooks.link_##name->elts; \
- for(n=0 ; n < _hooks.link_##name->nelts ; ++n) \
- { \
- rv=pHook[n].pFunc args_use; \
-\
- if(rv != ok && rv != decline) \
- return rv; \
- } \
- return ok; \
- }
-
-
-/**
- * Implement a hook that runs until the first function returns something
- * other than DECLINE
- * @param link The linkage declaration prefix of the hook
- * @param name The name of the hook
- * @param args_decl The declaration of the arguments for the hook
- * @param args_used The names for the arguments for the hook
- * @deffunc int AP_IMPLEMENT_HOOK_RUN_FIRST(link, name, args_decl, args_use)
- * @tip The link prefix FOO corresponds to FOO_DECLARE() macros, which
- * provide export linkage from the module that IMPLEMENTs the hook, and
- * import linkage from external modules that link to the hook's module.
- */
-#define AP_IMPLEMENT_EXTERNAL_HOOK_RUN_FIRST(link,ret,name,args_decl,args_use,decline) \
-AP_IMPLEMENT_EXTERNAL_HOOK_BASE(link,name) \
-link##_DECLARE(ret) ap_run_##name args_decl \
- { \
- LINK_##name *pHook; \
- int n; \
- ret rv; \
-\
- if(!_hooks.link_##name) \
- return decline; \
-\
- pHook=(LINK_##name *)_hooks.link_##name->elts; \
- for(n=0 ; n < _hooks.link_##name->nelts ; ++n) \
- { \
- rv=pHook[n].pFunc args_use; \
-\
- if(rv != decline) \
- return rv; \
- } \
- return decline; \
- }
-
- /* Hook orderings */
-#define AP_HOOK_REALLY_FIRST (-10)
-#define AP_HOOK_FIRST 0
-#define AP_HOOK_MIDDLE 10
-#define AP_HOOK_LAST 20
-#define AP_HOOK_REALLY_LAST 30
-
-/**
- * The global pool used to allocate any memory needed by the hooks.
- * @defvar apr_pool_t *ap_global_hook_pool
- */
-extern APR_DECLARE_DATA apr_pool_t *ap_global_hook_pool;
-
-/**
- * A global variable to determine if debugging information about the
- * hooks functions should be printed
- * @defvar apr_pool_t *ap_debug_module_hooks
- */
-extern APR_DECLARE_DATA int ap_debug_module_hooks;
-
-/**
- * The name of the module that is currently registering a function
- * @defvar apr_pool_t *ap_debug_module_name
- */
-extern APR_DECLARE_DATA const char *ap_debug_module_name;
-
-/**
- * Register a hook function to be sorted
- * @param szHookName The name of the Hook the function is registered for
- * @param aHooks The array which stores all of the functions for this hook
- * @deffunc void ap_hook_sort_register(const char *szHookName, ap_arry_header_t **aHooks)
- */
-APR_DECLARE(void) ap_hook_sort_register(const char *szHookName,
- apr_array_header_t **aHooks);
-/**
- * Sort all of the registerd functions for a given hook
- * @deffunc void ap_sort_hooks(void)
- */
-APR_DECLARE(void) ap_sort_hooks(void);
-
-/**
- * Print all of the information about the current hook. This is used for
- * debugging purposes.
- * @param szName The name of the hook
- * @param aszPre All of the functions in the predecessor array
- * @param aszSucc All of the functions in the successor array
- * @deffunc void ap_show_hook(const char *szName, const char *const *aszPre, const char *const *aszSucc)
- */
-APR_DECLARE(void) ap_show_hook(const char *szName,const char * const *aszPre,
- const char * const *aszSucc);
-
-/**
- * Remove all currently registered functions.
- * @deffunc void ap_hook_deregister_all(void)
- */
-APR_DECLARE(void) ap_hook_deregister_all(void);
-
-#endif /* ndef(AP_HOOKS_H) */
diff --git a/include/apr_ring.h b/include/apr_ring.h
deleted file mode 100644
index 614c28e6..00000000
--- a/include/apr_ring.h
+++ /dev/null
@@ -1,274 +0,0 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation. 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. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 APACHE SOFTWARE FOUNDATION OR
- * ITS 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.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-/*
- * 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 AP_RING_H
-#define AP_RING_H
-
-/*
- * for offsetof()
- */
-#include <stddef.h>
-
-/*
- * A ring is a kind of doubly-linked list that can be manipulated
- * without knowing where its head is.
- */
-
-/*
- * A struct on a ring contains a field linking it to the other
- * elements in the ring, e.g.
- *
- * struct my_item_t {
- * AP_RING_ENTRY(my_item_t) link;
- * int foo;
- * char *bar;
- * };
- *
- * A struct may be put on more than one ring if it has more than one
- * AP_RING_ENTRY field.
- */
-#define AP_RING_ENTRY(elem) \
- struct { \
- struct elem *next; \
- struct elem *prev; \
- }
-
-/*
- * Each ring is managed via its head, which is a struct declared like this:
- *
- * AP_RING_HEAD(my_ring_t, my_item_t);
- * struct my_ring_t ring, *ringp;
- *
- * 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 AP_RING_HEAD(head, elem) \
- struct head { \
- struct elem *next; \
- struct elem *prev; \
- }
-
-/*
- * 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. The sentinel 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.
- *
- * Note that for strict C standards compliance you should put the
- * AP_RING_ENTRY first in struct elem unless the head is always part
- * of a larger object with enough earlier fields to accommodate the
- * offsetof() computed below. You can usually ignore this caveat.
- */
-#define AP_RING_SENTINEL(hp, elem, link) \
- (struct elem *)((char *)(hp) - offsetof(struct elem, link))
-
-/*
- * Accessor macros. Use these rather than footling inside the
- * structures directly so that you can more easily change to a
- * different flavour of list from BSD's <sys/queue.h>.
- */
-#define AP_RING_FIRST(hp) (hp)->next
-#define AP_RING_LAST(hp) (hp)->prev
-#define AP_RING_NEXT(ep, link) (ep)->link.next
-#define AP_RING_PREV(ep, link) (ep)->link.prev
-
-/*
- * Empty rings and singleton elements.
- */
-#define AP_RING_INIT(hp, elem, link) do { \
- AP_RING_FIRST((hp)) = AP_RING_SENTINEL((hp), elem, link); \
- AP_RING_LAST((hp)) = AP_RING_SENTINEL((hp), elem, link); \
- } while (0)
-
-#define AP_RING_EMPTY(hp, elem, link) \
- (AP_RING_FIRST((hp)) == AP_RING_SENTINEL((hp), elem, link))
-
-#define AP_RING_ELEM_INIT(ep, link) do { \
- AP_RING_NEXT((ep), link) = (ep); \
- AP_RING_PREV((ep), link) = (ep); \
- } while (0)
-
-/*
- * Adding elements.
- */
-#define AP_RING_SPLICE_BEFORE(lep, ep1, epN, link) do { \
- AP_RING_NEXT((epN), link) = (lep); \
- AP_RING_PREV((ep1), link) = AP_RING_PREV((lep), link); \
- AP_RING_NEXT(AP_RING_PREV((lep), link), link) = (ep1); \
- AP_RING_PREV((lep), link) = (epN); \
- } while (0)
-
-#define AP_RING_SPLICE_AFTER(lep, ep1, epN, link) do { \
- AP_RING_PREV((ep1), link) = (lep); \
- AP_RING_NEXT((epN), link) = AP_RING_NEXT((lep), link); \
- AP_RING_PREV(AP_RING_NEXT((lep), link), link) = (epN); \
- AP_RING_NEXT((lep), link) = (ep1); \
- } while (0)
-
-#define AP_RING_INSERT_BEFORE(lep, nep, link) \
- AP_RING_SPLICE_BEFORE((lep), (nep), (nep), link)
-
-#define AP_RING_INSERT_AFTER(lep, nep, link) \
- AP_RING_SPLICE_AFTER((lep), (nep), (nep), link)
-
-/*
- * These macros work when the ring is empty: inserting before the head
- * or after the tail of an empty ring using the macros above doesn't work.
- */
-#define AP_RING_SPLICE_HEAD(hp, ep1, epN, elem, link) \
- AP_RING_SPLICE_AFTER(AP_RING_SENTINEL((hp), elem, link), \
- (ep1), (epN), link)
-
-#define AP_RING_SPLICE_TAIL(hp, ep1, epN, elem, link) \
- AP_RING_SPLICE_BEFORE(AP_RING_SENTINEL((hp), elem, link), \
- (ep1), (epN), link)
-
-#define AP_RING_INSERT_HEAD(hp, nep, elem, link) \
- AP_RING_SPLICE_HEAD((hp), (nep), (nep), elem, link)
-
-#define AP_RING_INSERT_TAIL(hp, nep, elem, link) \
- AP_RING_SPLICE_TAIL((hp), (nep), (nep), elem, link)
-
-/*
- * Concatenating ring h2 onto the end of ring h1 leaves h2 empty.
- */
-#define AP_RING_CONCAT(h1, h2, elem, link) do { \
- if (!AP_RING_EMPTY((h2), elem, link)) { \
- AP_RING_SPLICE_BEFORE(AP_RING_SENTINEL((h1), elem, link), \
- AP_RING_FIRST((h2)), \
- AP_RING_LAST((h2)), link); \
- AP_RING_INIT((h2), elem, link); \
- } \
- } while (0)
-
-/*
- * Removing elements. Be warned that the unspliced elements are left
- * with dangling pointers at either end!
- */
-#define AP_RING_UNSPLICE(ep1, epN, link) do { \
- AP_RING_NEXT(AP_RING_PREV((ep1), link), link) = \
- AP_RING_NEXT((epN), link); \
- AP_RING_PREV(AP_RING_NEXT((epN), link), link) = \
- AP_RING_PREV((ep1), link); \
- } while (0)
-
-#define AP_RING_REMOVE(ep, link) \
- AP_RING_UNSPLICE((ep), (ep), link)
-
-/*
- * Iteration.
- */
-#define AP_RING_FOREACH(ep, hp, elem, link) \
- for ((ep) = AP_RING_FIRST((hp)); \
- (ep) != AP_RING_SENTINEL((hp), elem, link); \
- (ep) = AP_RING_NEXT((ep), link))
-
-#define AP_RING_FOREACH_REVERSE(ep, hp, elem, link) \
- for ((ep) = AP_RING_LAST((hp)); \
- (ep) != AP_RING_SENTINEL((hp), elem, link); \
- (ep) = AP_RING_PREV((ep), link))
-
-#ifdef AP_RING_DEBUG
-#include <stdio.h>
-#define AP_RING_CHECK_ONE(msg, ptr) \
- fprintf(stderr, "*** %s %p\n", msg, ptr)
-#define AP_RING_CHECK(hp, elem, link, msg) \
- AP_RING_CHECK_ELEM(AP_RING_SENTINEL(hp, elem, link), elem, link, msg)
-#define AP_RING_CHECK_ELEM(ep, elem, link, msg) do { \
- struct elem *start = (ep); \
- struct elem *this = start; \
- fprintf(stderr, "*** ring check start -- %s\n", msg); \
- do { \
- fprintf(stderr, "\telem %p\n", this); \
- fprintf(stderr, "\telem->next %p\n", \
- AP_RING_NEXT(this, link)); \
- fprintf(stderr, "\telem->prev %p\n", \
- AP_RING_PREV(this, link)); \
- fprintf(stderr, "\telem->next->prev %p\n", \
- AP_RING_PREV(AP_RING_NEXT(this, link), link)); \
- fprintf(stderr, "\telem->prev->next %p\n", \
- AP_RING_NEXT(AP_RING_PREV(this, link), link)); \
- if (AP_RING_PREV(AP_RING_NEXT(this, link), link) != this) { \
- fprintf(stderr, "\t*** this->next->prev != this\n"); \
- break; \
- } \
- if (AP_RING_NEXT(AP_RING_PREV(this, link), link) != this) { \
- fprintf(stderr, "\t*** this->prev->next != this\n"); \
- break; \
- } \
- this = AP_RING_NEXT(this, link); \
- } while (this != start); \
- fprintf(stderr, "*** ring check end\n"); \
- } while (0)
-#else
-#define AP_RING_CHECK_ONE(msg, ptr)
-#define AP_RING_CHECK(hp, elem, link, msg)
-#define AP_RING_CHECK_ELEM(ep, elem, link, msg)
-#endif
-
-#endif /* !AP_RING_H */
diff --git a/include/apr_sha1.h b/include/apr_sha1.h
deleted file mode 100644
index 96e3ab8d..00000000
--- a/include/apr_sha1.h
+++ /dev/null
@@ -1,159 +0,0 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation. 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. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 APACHE SOFTWARE FOUNDATION OR
- * ITS 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.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- * 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 APACHE_SHA1_H
-#define APACHE_SHA1_H
-
-#include "apr_general.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @package SHA1 library
- */
-
-#define SHA_DIGESTSIZE 20
-
-/**
- * Define the Magic String prefix that identifies a password as being
- * hashed using our algorithm.
- * @defvar AP_SHA1PW_ID "{SHA}"
- */
-#define AP_SHA1PW_ID "{SHA}"
-#define AP_SHA1PW_IDLEN 5
-
-typedef struct AP_SHA1_CTX AP_SHA1_CTX;
-
-/**
- * SHA1 context structure
- */
-struct AP_SHA1_CTX {
- /** 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
- * @tip 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.
- * @deffunc void ap_sha1_base64(const char *clear, int len, char *out)
- */
-APR_DECLARE(void) ap_sha1_base64(const char *clear, int len, char *out);
-
-/**
- * Initialize the SHA digest
- * @param context The SHA context to initialize
- * @deffunc void ap_SHA1Init(AP_SHA1_CTX *context);
- */
-APR_DECLARE(void) ap_SHA1Init(AP_SHA1_CTX *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
- * @deffunc void ap_SHA1Update(AP_SHA1_CTX *context, const char *input, unsigned int inputLen)
- */
-APR_DECLARE(void) ap_SHA1Update(AP_SHA1_CTX *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
- * @deffunc void ap_SHA1Update_binary(AP_SHA1_CTX *context, const unsigned char *input, unsigned int inputLen)
- */
-APR_DECLARE(void) ap_SHA1Update_binary(AP_SHA1_CTX *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
- * @deffunc void ap_SHA1Final(unsigned char digest[SHA_DIGESTSIZE], AP_SHA1_CTX *context)
- */
-APR_DECLARE(void) ap_SHA1Final(unsigned char digest[SHA_DIGESTSIZE],
- AP_SHA1_CTX *context);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* !APACHE_SHA1_H */
diff --git a/libaprutil.def b/libaprutil.def
deleted file mode 100644
index 5b2a4607..00000000
--- a/libaprutil.def
+++ /dev/null
@@ -1,63 +0,0 @@
-; aprutil.def :
-
-LIBRARY apr-util
-DESCRIPTION ''
-
-EXPORTS
-; Add new API calls to the end of this list.
-ap_SHA1Final
-ap_SHA1Init
-ap_SHA1Update
-ap_SHA1Update_binary
-ap_base64decode
-ap_base64decode_binary
-ap_base64decode_len
-ap_base64encode
-ap_base64encode_binary
-ap_base64encode_len
-ap_sha1_base64
-
-ap_init_bucket_types
-ap_bucket_create_pool
-ap_bucket_create_socket
-ap_bucket_create_transient
-ap_bucket_destroy_shared
-ap_bucket_make_shared
-ap_bucket_split_shared
-ap_bucket_create_eos
-ap_bucket_create_file
-ap_bucket_create_flush
-ap_bucket_create_heap
-ap_bucket_create_immortal
-ap_bucket_create_pipe
-ap_bucket_create_mmap
-ap_file_type
-ap_flush_type
-ap_pipe_type
-ap_eos_type
-ap_mmap_type
-
-ap_brigade_create
-ap_brigade_destroy
-ap_brigade_split
-ap_brigade_vprintf
-ap_brigade_vputstrs
-
-ap_debug_module_hooks
-ap_debug_module_name
-ap_global_hook_pool
-ap_hook_deregister_all
-ap_hook_sort_register
-ap_show_hook
-ap_sort_hooks
-
-apr_dbm_open
-apr_dbm_geterror
-apr_dbm_close
-apr_dbm_fetch
-apr_dbm_store
-apr_dbm_delete
-apr_dbm_exists
-apr_dbm_firstkey
-apr_dbm_nextkey
-apr_dbm_freedatum
diff --git a/libaprutil.dsp b/libaprutil.dsp
deleted file mode 100644
index 69e7d62d..00000000
--- a/libaprutil.dsp
+++ /dev/null
@@ -1,100 +0,0 @@
-# Microsoft Developer Studio Project File - Name="aprutildll" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=aprutildll - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "aprutildll.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "aprutildll.mak" CFG="aprutildll - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "aprutildll - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "aprutildll - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "aprutildll - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c
-# ADD CPP /nologo /MD /W3 /O2 /I "./include" /I "../apr/include" /I "./include/private" /I "./src/dbm/sdbm" /D "NDEBUG" /D "APR_DECLARE_EXPORT" /D "WIN32" /D "_WINDOWS" /Fd"Release\apr-utildll" /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o /win32 "NUL"
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o /win32 "NUL"
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib advapi32.lib ws2_32.lib mswsock.lib ole32.lib /nologo /base:"0x6ED0000" /subsystem:windows /dll /map /machine:I386 /out:"Release/apr-util.dll"
-# ADD LINK32 kernel32.lib advapi32.lib ws2_32.lib mswsock.lib ole32.lib /nologo /base:"0x6ED0000" /subsystem:windows /dll /map /machine:I386 /out:"Release/apr-util.dll"
-
-!ELSEIF "$(CFG)" == "aprutildll - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W3 /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "./include" /I "../apr/include" /I "./include/private" /I "./src/dbm/sdbm" /D "_DEBUG" /D "APR_DECLARE_EXPORT" /D "WIN32" /D "_WINDOWS" /D "APU_USE_SDBM" /Fd"Debug\apr-utildll" /FD /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o /win32 "NUL"
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o /win32 "NUL"
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib advapi32.lib ws2_32.lib mswsock.lib ole32.lib /nologo /base:"0x6ED0000" /subsystem:windows /dll /map /debug /machine:I386 /out:"Debug/apr-util.dll"
-# ADD LINK32 kernel32.lib advapi32.lib ws2_32.lib mswsock.lib ole32.lib /nologo /base:"0x6ED00000" /subsystem:windows /dll /debug /machine:I386 /out:"Debug/apr-util.dll"
-# SUBTRACT LINK32 /incremental:no /map
-
-!ENDIF
-
-# Begin Target
-
-# Name "aprutildll - Win32 Release"
-# Name "aprutildll - Win32 Debug"
-# Begin Source File
-
-SOURCE=.\src\misc\win32\aprutil.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\aprutil.def
-# End Source File
-# End Target
-# End Project
diff --git a/misc/win32/libaprutil.c b/misc/win32/libaprutil.c
deleted file mode 100644
index e807ac57..00000000
--- a/misc/win32/libaprutil.c
+++ /dev/null
@@ -1,7 +0,0 @@
-/*
- * Placeholder to force aprutil.dll creation with no LNK4001 error
- *
- * However, this isn't a bad place to store dynamic-only functions
- * that determine which version of apr the application has loaded.
- * These functions are of (less?) importance to static-bound apps.
- */
diff --git a/src/misc/win32/libaprutil.c b/src/misc/win32/libaprutil.c
deleted file mode 100644
index e807ac57..00000000
--- a/src/misc/win32/libaprutil.c
+++ /dev/null
@@ -1,7 +0,0 @@
-/*
- * Placeholder to force aprutil.dll creation with no LNK4001 error
- *
- * However, this isn't a bad place to store dynamic-only functions
- * that determine which version of apr the application has loaded.
- * These functions are of (less?) importance to static-bound apps.
- */
diff --git a/uri/.cvsignore b/uri/.cvsignore
deleted file mode 100644
index 2c9b9300..00000000
--- a/uri/.cvsignore
+++ /dev/null
@@ -1,4 +0,0 @@
-Makefile
-*.lo
-*.la
-.libs
diff --git a/uri/Makefile.in b/uri/Makefile.in
deleted file mode 100644
index 704d02c6..00000000
--- a/uri/Makefile.in
+++ /dev/null
@@ -1,3 +0,0 @@
-
-top_builddir = @top_builddir@
-include $(top_builddir)/build/rules.mk
diff --git a/xml/.cvsignore b/xml/.cvsignore
deleted file mode 100644
index 2c9b9300..00000000
--- a/xml/.cvsignore
+++ /dev/null
@@ -1,4 +0,0 @@
-Makefile
-*.lo
-*.la
-.libs
diff --git a/xml/Makefile.in b/xml/Makefile.in
deleted file mode 100644
index 704d02c6..00000000
--- a/xml/Makefile.in
+++ /dev/null
@@ -1,3 +0,0 @@
-
-top_builddir = @top_builddir@
-include $(top_builddir)/build/rules.mk