You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@commons.apache.org by gs...@apache.org on 2003/10/27 22:49:03 UTC
svn commit: rev 54 - commons/serf/branches/gen2
Author: gstein
Date: Mon Oct 27 13:49:02 2003
New Revision: 54
Added:
commons/serf/branches/gen2/serf_bucket_util.h
Modified:
commons/serf/branches/gen2/serf.h
commons/serf/branches/gen2/serf_bucket_types.h
Log:
Set up a new header to define supporting utilities for implementing
buckets. Most users of serf will not require this information (which means
it shouldn't be in the primary interface header: serf.h)
* serf/branches/gen2/serf.h:
(serf_bucket_create, serf_default_set_metadata,
serf_default_get_metadta, serf_default_read_bucket,
serf_default_destroy): moved to serf_bucket_util.h
* serf/branches/gen2/serf_bucket_util: new header
* serf/branches/gen2/serf_bucket_types.h: updated copyright year
Modified: commons/serf/branches/gen2/serf.h
==============================================================================
--- commons/serf/branches/gen2/serf.h (original)
+++ commons/serf/branches/gen2/serf.h Mon Oct 27 13:49:02 2003
@@ -1,7 +1,7 @@
/* ====================================================================
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2002 The Apache Software Foundation. All rights
+ * Copyright (c) 2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -411,60 +411,6 @@
*/
#define SERF_BUCKET_CHECK(b, btype) ((b)->type == &serf_bucket_type_ ## btype)
-
-/**
- * Basic bucket creation function.
- *
- * This function will create a bucket of @a type, allocating the necessary
- * memory from @a allocator. The @a data bucket-private information will
- * be stored into the bucket.
- *
- * The metadata for the bucket will be empty.
- */
-SERF_DECLARE(serf_bucket_t *) serf_bucket_create(
- serf_bucket_type_t *type,
- serf_bucket_alloc_t *allocator,
- void *data);
-
-/**
- * Default implementation to set metadata within a bucket.
- *
- * Stores @a md_value into @a bucket under the metadata type @a md_type
- * and name @a md_name.
- */
-SERF_DECLARE(apr_status_t) serf_default_set_metadata(serf_bucket_t *bucket,
- const char *md_type,
- const char *md_name,
- const void *md_value);
-
-/**
- * Default implementation to get metadata from @a bucket.
- *
- * The @a md_value for the specified @a md_type and @a md_name will
- * be returned. If the metadata is not present, then NULL will be stored
- * into @a md_value.
- */
-SERF_DECLARE(apr_status_t) serf_default_get_metadata(serf_bucket_t *bucket,
- const char *md_type,
- const char *md_name,
- const void **md_value);
-
-/**
- * Default implementation of the @see read_bucket functionality.
- *
- * This function will always return NULL, indicating that the @a type
- * of bucket cannot be found within @a bucket.
- */
-SERF_DECLARE(serf_bucket_t *) serf_default_read_bucket(
- serf_bucket_t *bucket,
- serf_bucket_type_t *type);
-
-/**
- * Default implementation of the @see destroy functionality.
- *
- * This function will return the @a bucket to its allcoator.
- */
-SERF_DECLARE(void) serf_default_destroy(serf_bucket_t *bucket);
/** @} */
Modified: commons/serf/branches/gen2/serf_bucket_types.h
==============================================================================
--- commons/serf/branches/gen2/serf_bucket_types.h (original)
+++ commons/serf/branches/gen2/serf_bucket_types.h Mon Oct 27 13:49:02 2003
@@ -1,7 +1,7 @@
/* ====================================================================
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2002 The Apache Software Foundation. All rights
+ * Copyright (c) 2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
Added: commons/serf/branches/gen2/serf_bucket_util.h
==============================================================================
--- (empty file)
+++ commons/serf/branches/gen2/serf_bucket_util.h Mon Oct 27 13:49:02 2003
@@ -0,0 +1,128 @@
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2003 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.
+ * ====================================================================
+ *
+ */
+
+#ifndef SERF_BUCKET_UTIL_H
+#define SERF_BUCKET_UTILH
+
+/**
+ * @file serf_bucket_util.h
+ * @brief This header defines a set of functions and other utilities
+ * for implementing buckets. It is not needed by users of the bucket
+ * system.
+ */
+
+#include "serf.h"
+#include "serf_declare.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/**
+ * Basic bucket creation function.
+ *
+ * This function will create a bucket of @a type, allocating the necessary
+ * memory from @a allocator. The @a data bucket-private information will
+ * be stored into the bucket.
+ *
+ * The metadata for the bucket will be empty.
+ */
+SERF_DECLARE(serf_bucket_t *) serf_bucket_create(
+ serf_bucket_type_t *type,
+ serf_bucket_alloc_t *allocator,
+ void *data);
+
+/**
+ * Default implementation to set metadata within a bucket.
+ *
+ * Stores @a md_value into @a bucket under the metadata type @a md_type
+ * and name @a md_name.
+ */
+SERF_DECLARE(apr_status_t) serf_default_set_metadata(serf_bucket_t *bucket,
+ const char *md_type,
+ const char *md_name,
+ const void *md_value);
+
+/**
+ * Default implementation to get metadata from @a bucket.
+ *
+ * The @a md_value for the specified @a md_type and @a md_name will
+ * be returned. If the metadata is not present, then NULL will be stored
+ * into @a md_value.
+ */
+SERF_DECLARE(apr_status_t) serf_default_get_metadata(serf_bucket_t *bucket,
+ const char *md_type,
+ const char *md_name,
+ const void **md_value);
+
+/**
+ * Default implementation of the @see read_bucket functionality.
+ *
+ * This function will always return NULL, indicating that the @a type
+ * of bucket cannot be found within @a bucket.
+ */
+SERF_DECLARE(serf_bucket_t *) serf_default_read_bucket(
+ serf_bucket_t *bucket,
+ serf_bucket_type_t *type);
+
+/**
+ * Default implementation of the @see destroy functionality.
+ *
+ * This function will return the @a bucket to its allcoator.
+ */
+SERF_DECLARE(void) serf_default_destroy(serf_bucket_t *bucket);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !SERF_BUCKET_UTIL_H */