Author: rhuijben
Date: Mon Oct 26 20:15:02 2015
New Revision: 1710686

URL: http://svn.apache.org/viewvc?rev=1710686&view=rev
Log:
Turn all the http2 related new bucket types and their functions
into private types. No functional changes.

This patch breaks compilin http2_protocol.c. I'll fix that in
a separate commit that does contain functional changes.

* buckets/hpack_buckets.c
  (includes): Add http2_buckets.h.
  (serf_hpack_table_create): Rename to...
  (serf__hpack_table_create): ... this.
  (hpack_copy_from_headers,
   serf__bucket_hpack_create_from_request): Update caller.
  (serf_bucket_hpack_create): Rename to...
  (serf__bucket_hpack_create): ... this.
  (serf_bucket_hpack_setc): Rename to...
   serf__bucket_hpack_setc): ... this. Update caller
  (serf_bucket_hpack_setx): Rename to...
  (serf__bucket_hpack_setx): ... this.
  (serf_bucket_type_hpack): Rename to...
  (serf_bucket_type__hpack): ... this.
  (serf_bucket_hpack_decode_create): Rename to...
  (serf__bucket_hpack_decode_create): ... this.
  (serf_bucket_type_hpack_decode): Rename to...
  (serf_bucket_type__hpack_decode): ... this.

* buckets/http2_frame_buckets.c
  (includes): Add http2_buckets.h.
  (serf_bucket_http2_unframe_create): Rename to...
  (serf__bucket_http2_unframe_create): ... this.
  (serf_bucket_http2_unframe_read_info): Rename to...
  (serf__bucket_http2_unframe_read_info): ... this.
  (*): Update caller.
  (serf_bucket_http2_unpad_create): Rename to...
  (serf__bucket_http2_unpad_create): ... this.
  (serf_bucket_type_http2_unpad): Rename to...
  (serf_bucket_type__http2_unpad): ... this.
  (serf_bucket_http2_frame_create): Rename to...
  (serf__bucket_http2_frame_create): ... this.
  (serf_bucket_type_http2_frame): Rename to...
  (serf_bucket_type__http2_frame): ... this.

* protocols/http2_buckets.h
  New file, copied from serf_bucket_types.h.

* serf_bucket_types.h
  Remove all http2 types and functions.

* serf_private.h
  (serf_hpack_table_t): Add typedef.

* test/test_buckets.c
  (includes): Add http2_buckets.h.
  (test_http2_unframe_buckets,
   test_http2_unpad_buckets,
   test_hpack_header_encode,
   test_http2_frame_bucket_basic): Update caller.

Added:
    serf/trunk/protocols/http2_buckets.h
      - copied, changed from r1710678, serf/trunk/serf_bucket_types.h
Modified:
    serf/trunk/buckets/hpack_buckets.c
    serf/trunk/buckets/http2_frame_buckets.c
    serf/trunk/serf_bucket_types.h
    serf/trunk/serf_private.h
    serf/trunk/test/test_buckets.c

Modified: serf/trunk/buckets/hpack_buckets.c
URL: 
http://svn.apache.org/viewvc/serf/trunk/buckets/hpack_buckets.c?rev=1710686&r1=1710685&r2=1710686&view=diff
==============================================================================
--- serf/trunk/buckets/hpack_buckets.c (original)
+++ serf/trunk/buckets/hpack_buckets.c Mon Oct 26 20:15:02 2015
@@ -25,6 +25,7 @@
 #include "serf.h"
 #include "serf_bucket_util.h"
 #include "serf_private.h"
+#include "protocols/http2_buckets.h"
 
 #include "hpack_huffman.inc"
 #define EOS_CHAR (256)
@@ -372,9 +373,9 @@ static const apr_uint64_t hpack_static_t
 
 
 serf_hpack_table_t *
-serf_hpack_table_create(int for_http2,
-                        apr_size_t default_max_table_size,
-                        apr_pool_t *result_pool)
+serf__hpack_table_create(int for_http2,
+                         apr_size_t default_max_table_size,
+                         apr_pool_t *result_pool)
 {
   serf_hpack_table_t *tbl = apr_pcalloc(result_pool, sizeof(*tbl));
 
@@ -470,7 +471,7 @@ hpack_copy_from_headers(void *baton,
       return APR_SUCCESS;
     }
 
-  serf_bucket_hpack_setc(hpack, key, value);
+  serf__bucket_hpack_setc(hpack, key, value);
 
   return APR_SUCCESS;
 }
@@ -485,7 +486,7 @@ serf__bucket_hpack_create_from_request(s
 {
   const char *uri, *method, *host;
 
-  serf_bucket_t *hpack = serf_bucket_hpack_create(hpack_table, allocator);
+  serf_bucket_t *hpack = serf__bucket_hpack_create(hpack_table, allocator);
 
   serf_bucket_t *headers = serf_bucket_request_get_headers(request);
 
@@ -493,10 +494,10 @@ serf__bucket_hpack_create_from_request(s
 
   serf__bucket_request_read(request, NULL, &uri, &method);
 
-  serf_bucket_hpack_setc(hpack, ":method", method);
-  serf_bucket_hpack_setc(hpack, ":scheme", scheme);
-  serf_bucket_hpack_setc(hpack, ":authority", host);
-  serf_bucket_hpack_setc(hpack, ":path", uri);
+  serf__bucket_hpack_setc(hpack, ":method", method);
+  serf__bucket_hpack_setc(hpack, ":scheme", scheme);
+  serf__bucket_hpack_setc(hpack, ":authority", host);
+  serf__bucket_hpack_setc(hpack, ":path", uri);
 
   serf_bucket_headers_do(headers, hpack_copy_from_headers, hpack);
 
@@ -507,8 +508,8 @@ serf__bucket_hpack_create_from_request(s
 
 
 serf_bucket_t *
-serf_bucket_hpack_create(serf_hpack_table_t *hpack_table,
-                         serf_bucket_alloc_t *allocator)
+serf__bucket_hpack_create(serf_hpack_table_t *hpack_table,
+                          serf_bucket_alloc_t *allocator)
 {
   serf_hpack_context_t *ctx = serf_bucket_mem_alloc(allocator, sizeof(*ctx));
 
@@ -516,25 +517,27 @@ serf_bucket_hpack_create(serf_hpack_tabl
   ctx->tbl = hpack_table;
   ctx->first = ctx->last = NULL;
 
-  return serf_bucket_create(&serf_bucket_type_hpack, allocator, ctx);
+  return serf_bucket_create(&serf_bucket_type__hpack, allocator, ctx);
 }
 
-void serf_bucket_hpack_setc(serf_bucket_t *hpack_bucket,
-                            const char *key,
-                            const char *value)
+void 
+serf__bucket_hpack_setc(serf_bucket_t *hpack_bucket,
+                        const char *key,
+                        const char *value)
 {
-  serf_bucket_hpack_setx(hpack_bucket,
-                         key, strlen(key), TRUE,
-                         value, strlen(value), TRUE);
+  serf__bucket_hpack_setx(hpack_bucket,
+                          key, strlen(key), TRUE,
+                          value, strlen(value), TRUE);
 }
 
-void serf_bucket_hpack_setx(serf_bucket_t *hpack_bucket,
-                            const char *key,
-                            apr_size_t key_size,
-                            int key_copy,
-                            const char *value,
-                            apr_size_t value_size,
-                            int value_copy)
+void
+serf__bucket_hpack_setx(serf_bucket_t *hpack_bucket,
+                        const char *key,
+                        apr_size_t key_size,
+                        int key_copy,
+                        const char *value,
+                        apr_size_t value_size,
+                        int value_copy)
 {
   serf_hpack_context_t *ctx = hpack_bucket->data;
   serf_hpack_entry_t *entry;
@@ -820,7 +823,7 @@ serf_hpack_destroy_and_data(serf_bucket_
 /* ### need to implement */
 #define serf_hpack_readline NULL
 
-const serf_bucket_type_t serf_bucket_type_hpack = {
+const serf_bucket_type_t serf_bucket_type__hpack = {
   "HPACK",
   serf_hpack_read,
   serf_hpack_readline,
@@ -889,17 +892,17 @@ hpack_decode_databuf_reader(void *baton,
                             apr_size_t *len);
 
 serf_bucket_t *
-serf_bucket_hpack_decode_create(serf_bucket_t *stream,
-                                apr_status_t (*item_callback)(
+serf__bucket_hpack_decode_create(serf_bucket_t *stream,
+                                 apr_status_t (*item_callback)(
                                         void *baton,
                                         const char *key,
                                         apr_size_t key_size,
                                         const char *value,
                                         apr_size_t value_size),
-                                void *item_baton,
-                                apr_size_t max_entry_size,
-                                serf_hpack_table_t *hpack_table,
-                                serf_bucket_alloc_t *alloc)
+                                 void *item_baton,
+                                 apr_size_t max_entry_size,
+                                 serf_hpack_table_t *hpack_table,
+                                 serf_bucket_alloc_t *alloc)
 {
   serf_hpack_decode_ctx_t *ctx = serf_bucket_mem_calloc(alloc, sizeof(*ctx));
 
@@ -933,7 +936,7 @@ serf_bucket_hpack_decode_create(serf_buc
   ctx->tbl->rl_start = ctx->tbl->rl_first;
   ctx->tbl->rl_indexable = ctx->tbl->rl_count;
 
-  return serf_bucket_create(&serf_bucket_type_hpack_decode, alloc, ctx);
+  return serf_bucket_create(&serf_bucket_type__hpack_decode, alloc, ctx);
 }
 
 static apr_status_t
@@ -1558,7 +1561,7 @@ serf_hpack_decode_destroy(serf_bucket_t
   serf_default_destroy_and_data(bucket);
 }
 
-const serf_bucket_type_t serf_bucket_type_hpack_decode = {
+const serf_bucket_type_t serf_bucket_type__hpack_decode = {
   "HPACK-DECODE",
   serf_hpack_decode_read,
   serf_hpack_decode_readline,
@@ -1567,4 +1570,4 @@ const serf_bucket_type_t serf_bucket_typ
   serf_default_read_bucket,
   serf_hpack_decode_peek,
   serf_hpack_decode_destroy
-};
\ No newline at end of file
+};

Modified: serf/trunk/buckets/http2_frame_buckets.c
URL: 
http://svn.apache.org/viewvc/serf/trunk/buckets/http2_frame_buckets.c?rev=1710686&r1=1710685&r2=1710686&view=diff
==============================================================================
--- serf/trunk/buckets/http2_frame_buckets.c (original)
+++ serf/trunk/buckets/http2_frame_buckets.c Mon Oct 26 20:15:02 2015
@@ -26,6 +26,8 @@
 #include "serf_bucket_util.h"
 #include "serf_private.h"
 
+#include "protocols/http2_buckets.h"
+
 /* https://tools.ietf.org/html/rfc7540#section-4.1 */
 #define FRAME_PREFIX_SIZE 9 
 
@@ -47,10 +49,10 @@ typedef struct http2_unframe_context_t
 } http2_unframe_context_t;
 
 serf_bucket_t *
-serf_bucket_http2_unframe_create(serf_bucket_t *stream,
-                                 int destroy_stream,
-                                 apr_size_t max_payload_size,
-                                 serf_bucket_alloc_t *allocator)
+serf__bucket_http2_unframe_create(serf_bucket_t *stream,
+                                  int destroy_stream,
+                                  apr_size_t max_payload_size,
+                                  serf_bucket_alloc_t *allocator)
 {
   http2_unframe_context_t *ctx;
 
@@ -60,14 +62,14 @@ serf_bucket_http2_unframe_create(serf_bu
   ctx->prefix_remaining = sizeof(ctx->prefix_buffer);
   ctx->destroy_stream = (destroy_stream != 0);
 
-  return serf_bucket_create(&serf_bucket_type_http2_unframe, allocator, ctx);
+  return serf_bucket_create(&serf_bucket_type__http2_unframe, allocator, ctx);
 }
 
 apr_status_t
-serf_bucket_http2_unframe_read_info(serf_bucket_t *bucket,
-                                    apr_int32_t *stream_id,
-                                    unsigned char *frame_type,
-                                    unsigned char *flags)
+serf__bucket_http2_unframe_read_info(serf_bucket_t *bucket,
+                                     apr_int32_t *stream_id,
+                                     unsigned char *frame_type,
+                                     unsigned char *flags)
 {
   http2_unframe_context_t *ctx = bucket->data;
   const char *data;
@@ -110,8 +112,8 @@ serf_bucket_http2_unframe_read_info(serf
           ctx->payload_remaining = payload_length;
 
           /* Use recursion to fill output arguments if necessary */
-          serf_bucket_http2_unframe_read_info(bucket, stream_id, frame_type,
-                                              flags);
+          serf__bucket_http2_unframe_read_info(bucket, stream_id, frame_type,
+                                               flags);
 
           /* https://tools.ietf.org/html/rfc7540#section-4.2
             An endpoint MUST send an error code of FRAME_SIZE_ERROR if a frame
@@ -138,7 +140,7 @@ serf_http2_unframe_read(serf_bucket_t *b
   http2_unframe_context_t *ctx = bucket->data;
   apr_status_t status;
 
-  status = serf_bucket_http2_unframe_read_info(bucket, NULL, NULL, NULL);
+  status = serf__bucket_http2_unframe_read_info(bucket, NULL, NULL, NULL);
 
   if (status)
     {
@@ -177,7 +179,7 @@ serf_http2_unframe_read_iovec(serf_bucke
   http2_unframe_context_t *ctx = bucket->data;
   apr_status_t status;
 
-  status = serf_bucket_http2_unframe_read_info(bucket, NULL, NULL, NULL);
+  status = serf__bucket_http2_unframe_read_info(bucket, NULL, NULL, NULL);
 
   if (status)
     {
@@ -221,7 +223,7 @@ serf_http2_unframe_peek(serf_bucket_t *b
   http2_unframe_context_t *ctx = bucket->data;
   apr_status_t status;
 
-  status = serf_bucket_http2_unframe_read_info(bucket, NULL, NULL, NULL);
+  status = serf__bucket_http2_unframe_read_info(bucket, NULL, NULL, NULL);
 
   if (status)
     {
@@ -256,7 +258,7 @@ serf_http2_unframe_get_remaining(serf_bu
   http2_unframe_context_t *ctx = bucket->data;
   apr_status_t status;
 
-  status = serf_bucket_http2_unframe_read_info(bucket, NULL, NULL, NULL);
+  status = serf__bucket_http2_unframe_read_info(bucket, NULL, NULL, NULL);
 
   if (status)
     return SERF_LENGTH_UNKNOWN;
@@ -267,7 +269,7 @@ serf_http2_unframe_get_remaining(serf_bu
 /* ### need to implement */
 #define serf_http2_unframe_readline NULL
 
-const serf_bucket_type_t serf_bucket_type_http2_unframe = {
+const serf_bucket_type_t serf_bucket_type__http2_unframe = {
   "H2-UNFRAME",
   serf_http2_unframe_read,
   serf_http2_unframe_readline /* ### TODO */,
@@ -292,9 +294,9 @@ typedef struct http2_unpad_context_t
 } http2_unpad_context_t;
 
 serf_bucket_t *
-serf_bucket_http2_unpad_create(serf_bucket_t *stream,
-                               int destroy_stream,
-                               serf_bucket_alloc_t *allocator)
+serf__bucket_http2_unpad_create(serf_bucket_t *stream,
+                                int destroy_stream,
+                                serf_bucket_alloc_t *allocator)
 {
   http2_unpad_context_t *ctx;
 
@@ -303,7 +305,7 @@ serf_bucket_http2_unpad_create(serf_buck
   ctx->padsize_read = FALSE;
   ctx->destroy_stream = destroy_stream;
 
-  return serf_bucket_create(&serf_bucket_type_http2_unpad, allocator, ctx);
+  return serf_bucket_create(&serf_bucket_type__http2_unpad, allocator, ctx);
 }
 
 static apr_status_t
@@ -509,7 +511,7 @@ serf_http2_unpad_get_remaining(serf_buck
 /* ### need to implement */
 #define serf_h2_dechunk_readline NULL
 
-const serf_bucket_type_t serf_bucket_type_http2_unpad = {
+const serf_bucket_type_t serf_bucket_type__http2_unpad = {
   "H2-UNPAD",
   serf_http2_unpad_read,
   serf_h2_dechunk_readline /* ### TODO */,
@@ -554,23 +556,23 @@ typedef struct serf_http2_frame_context_
 } serf_http2_frame_context_t;
 
 serf_bucket_t *
-serf_bucket_http2_frame_create(serf_bucket_t *stream,
-                               unsigned char frame_type,
-                               unsigned char flags,
-                               apr_int32_t *stream_id,
-                               void (*stream_id_alloc)(
-                                                  void *baton,
-                                                  apr_int32_t *stream_id),
-                               void *stream_id_baton,
-                               apr_size_t max_payload_size,
-                               apr_int32_t (*alloc_window)(
-                                                  void *baton,
-                                                  unsigned char frametype,
-                                                  apr_int32_t stream_id,
-                                                  apr_size_t requested,
-                                                  int peek),
-                               void *alloc_window_baton,
-                               serf_bucket_alloc_t *alloc)
+serf__bucket_http2_frame_create(serf_bucket_t *stream,
+                                unsigned char frame_type,
+                                unsigned char flags,
+                                apr_int32_t *stream_id,
+                                void (*stream_id_alloc)(
+                                                   void *baton,
+                                                   apr_int32_t *stream_id),
+                                void *stream_id_baton,
+                                apr_size_t max_payload_size,
+                                apr_int32_t (*alloc_window)(
+                                                   void *baton,
+                                                   unsigned char frametype,
+                                                   apr_int32_t stream_id,
+                                                   apr_size_t requested,
+                                                   int peek),
+                                void *alloc_window_baton,
+                                serf_bucket_alloc_t *alloc)
 {
   serf_http2_frame_context_t *ctx = serf_bucket_mem_alloc(alloc, sizeof(*ctx));
 
@@ -612,7 +614,7 @@ serf_bucket_http2_frame_create(serf_buck
 
   ctx->end_of_stream = ctx->end_of_headers = ctx->created_frame = FALSE;
 
-  return serf_bucket_create(&serf_bucket_type_http2_frame, alloc, ctx);
+  return serf_bucket_create(&serf_bucket_type__http2_frame, alloc, ctx);
 }
 
 
@@ -770,7 +772,7 @@ serf_http2_frame_destroy(serf_bucket_t *
 /* ### need to implement */
 #define serf_http2_frame_readline NULL
 
-const serf_bucket_type_t serf_bucket_type_http2_frame = {
+const serf_bucket_type_t serf_bucket_type__http2_frame = {
   "H2-FRAME",
   serf_http2_frame_read,
   serf_http2_frame_readline,

Copied: serf/trunk/protocols/http2_buckets.h (from r1710678, 
serf/trunk/serf_bucket_types.h)
URL: 
http://svn.apache.org/viewvc/serf/trunk/protocols/http2_buckets.h?p2=serf/trunk/protocols/http2_buckets.h&p1=serf/trunk/serf_bucket_types.h&r1=1710678&r2=1710686&rev=1710686&view=diff
==============================================================================
--- serf/trunk/serf_bucket_types.h (original)
+++ serf/trunk/protocols/http2_buckets.h Mon Oct 26 20:15:02 2015
@@ -18,17 +18,10 @@
  * ====================================================================
  */
 
-#ifndef SERF_BUCKET_TYPES_H
-#define SERF_BUCKET_TYPES_H
-
-#include <apr_mmap.h>
-#include <apr_hash.h>
-
-/* this header and serf.h refer to each other, so take a little extra care */
-#ifndef SERF_H
-#include "serf.h"
-#endif
+#ifndef SERF_PROTOCOL_HTTP2_BUCKETS_H
+#define SERF_PROTOCOL_HTTP2_BUCKETS_H
 
+#include "serf_bucket_types.h"
 
 /**
  * @file serf_bucket_types.h
@@ -42,728 +35,14 @@ extern "C" {
 
 /* ==================================================================== */
 
-
-extern const serf_bucket_type_t serf_bucket_type_request;
-#define SERF_BUCKET_IS_REQUEST(b) SERF_BUCKET_CHECK((b), request)
-
-serf_bucket_t *serf_bucket_request_create(
-    const char *method,
-    const char *URI,
-    serf_bucket_t *body,
-    serf_bucket_alloc_t *allocator);
-
-/* Send a Content-Length header with @a len. The @a body bucket should
-   contain precisely that much data.  */
-void serf_bucket_request_set_CL(
-    serf_bucket_t *bucket,
-    apr_int64_t len);
-
-serf_bucket_t *serf_bucket_request_get_headers(
-    serf_bucket_t *request);
-
-/** Transform @a bucket in-place into a request bucket.
- *
- * It is callers responsibility to free resources held by the original
- * bucket */
-void serf_bucket_request_become(
-    serf_bucket_t *bucket,
-    const char *method,
-    const char *uri,
-    serf_bucket_t *body);
-
-/**
- * Sets the root url of the remote host. If this request contains a relative
- * url, it will be prefixed with the root url to form an absolute url.
- * @a bucket is the request bucket. @a root_url is the absolute url of the
- * root of the remote host, without the closing '/'.
- */
-void serf_bucket_request_set_root(
-    serf_bucket_t *bucket,
-    const char *root_url);
-
-/* ==================================================================== */
-
-
-extern const serf_bucket_type_t serf_bucket_type_response;
-#define SERF_BUCKET_IS_RESPONSE(b) SERF_BUCKET_CHECK((b), response)
-
-serf_bucket_t *serf_bucket_response_create(
-    serf_bucket_t *stream,
-    serf_bucket_alloc_t *allocator);
-
-#define SERF_HTTP_VERSION(major, minor)  ((major) * 1000 + (minor))
-#define SERF_HTTP_11 SERF_HTTP_VERSION(1, 1)
-#define SERF_HTTP_10 SERF_HTTP_VERSION(1, 0)
-#define SERF_HTTP_VERSION_MAJOR(shv) ((int)shv / 1000)
-#define SERF_HTTP_VERSION_MINOR(shv) ((int)shv % 1000)
-
-typedef struct serf_status_line {
-    int version;
-    int code;
-    const char *reason;
-} serf_status_line;
-
-/**
- * Return the Status-Line information, if available. This function
- * works like other bucket read functions: it may return APR_EAGAIN or
- * APR_EOF to signal the state of the bucket for reading. A return
- * value of APR_SUCCESS will always indicate that status line
- * information was returned; for other return values the caller must
- * check the version field in @a sline. A value of 0 means that the
- * data is not (yet) present.
- */
-apr_status_t serf_bucket_response_status(
-    serf_bucket_t *bkt,
-    serf_status_line *sline);
-
-/**
- * Wait for the HTTP headers to be processed for a @a response.
- *
- * If the headers are available, APR_SUCCESS is returned.
- * If the headers aren't available, APR_EAGAIN is returned.
- */
-apr_status_t serf_bucket_response_wait_for_headers(
-    serf_bucket_t *response);
-
-/**
- * Get the headers bucket for @a response.
- */
-serf_bucket_t *serf_bucket_response_get_headers(
-    serf_bucket_t *response);
-
-/**
- * Advise the response @a bucket that this was from a HEAD request and
- * that it should not expect to see a response body.
- */
-void serf_bucket_response_set_head(
-    serf_bucket_t *bucket);
-
-/* ==================================================================== */
-
-extern const serf_bucket_type_t serf_bucket_type_response_body;
-#define SERF_BUCKET_IS_RESPONSE_BODY(b) SERF_BUCKET_CHECK((b), response_body)
-
-serf_bucket_t *serf_bucket_response_body_create(
-    serf_bucket_t *stream,
-    apr_uint64_t limit,
-    serf_bucket_alloc_t *allocator);
-
-/* ==================================================================== */
-
-extern const serf_bucket_type_t serf_bucket_type_bwtp_frame;
-#define SERF_BUCKET_IS_BWTP_FRAME(b) SERF_BUCKET_CHECK((b), bwtp_frame)
-
-extern const serf_bucket_type_t serf_bucket_type_bwtp_incoming_frame;
-#define SERF_BUCKET_IS_BWTP_INCOMING_FRAME(b) SERF_BUCKET_CHECK((b), 
bwtp_incoming_frame)
-
-int serf_bucket_bwtp_frame_get_channel(
-    serf_bucket_t *hdr);
-
-int serf_bucket_bwtp_frame_get_type(
-    serf_bucket_t *hdr);
-
-const char *serf_bucket_bwtp_frame_get_phrase(
-    serf_bucket_t *hdr);
-
-serf_bucket_t *serf_bucket_bwtp_frame_get_headers(
-    serf_bucket_t *hdr);
-
-serf_bucket_t *serf_bucket_bwtp_channel_open(
-    int channel,
-    const char *URI,
-    serf_bucket_alloc_t *allocator);
-
-serf_bucket_t *serf_bucket_bwtp_channel_close(
-    int channel,
-    serf_bucket_alloc_t *allocator);
-
-serf_bucket_t *serf_bucket_bwtp_header_create(
-    int channel,
-    const char *phrase,
-    serf_bucket_alloc_t *allocator);
-
-serf_bucket_t *serf_bucket_bwtp_message_create(
-    int channel,
-    serf_bucket_t *body,
-    serf_bucket_alloc_t *allocator);
-
-serf_bucket_t *serf_bucket_bwtp_incoming_frame_create(
-    serf_bucket_t *bkt,
-    serf_bucket_alloc_t *allocator);
-
-apr_status_t serf_bucket_bwtp_incoming_frame_wait_for_headers(
-    serf_bucket_t *bkt);
-
-/* ==================================================================== */
-
-
-extern const serf_bucket_type_t serf_bucket_type_aggregate;
-#define SERF_BUCKET_IS_AGGREGATE(b) SERF_BUCKET_CHECK((b), aggregate)
-
-typedef apr_status_t (*serf_bucket_aggregate_eof_t)(
-    void *baton,
-    serf_bucket_t *aggregate_bucket);
-
-/** serf_bucket_aggregate_cleanup will instantly destroy all buckets in
-    the aggregate bucket that have been read completely. Whereas normally, 
-    these buckets are destroyed on every read operation. */ 
-void serf_bucket_aggregate_cleanup(
-    serf_bucket_t *bucket,
-    serf_bucket_alloc_t *allocator);
-
-serf_bucket_t *serf_bucket_aggregate_create(
-    serf_bucket_alloc_t *allocator);
-
-/* Creates a stream bucket.
-   A stream bucket is like an aggregate bucket, but:
-   - it doesn't destroy its child buckets on cleanup
-   - one can always keep adding child buckets, the handler FN should return
-     APR_EOF when no more buckets will be added.
-
-  Note: keep this factory function internal for now. If it turns out this
-  bucket type is useful outside serf, we should make it an actual separate
-  type.
-  */
-serf_bucket_t *serf__bucket_stream_create(
-    serf_bucket_alloc_t *allocator,
-    serf_bucket_aggregate_eof_t fn,
-    void *baton);
-
-/** Transform @a bucket in-place into an aggregate bucket.
- *
- * It is callers responsibility to free resources held by the original
- * bucket */
-void serf_bucket_aggregate_become(
-    serf_bucket_t *bucket);
-
-void serf_bucket_aggregate_prepend(
-    serf_bucket_t *aggregate_bucket,
-    serf_bucket_t *prepend_bucket);
-
-void serf_bucket_aggregate_append(
-    serf_bucket_t *aggregate_bucket,
-    serf_bucket_t *append_bucket);
-    
-void serf_bucket_aggregate_hold_open(
-    serf_bucket_t *aggregate_bucket,
-    serf_bucket_aggregate_eof_t fn,
-    void *baton);
-
-void serf_bucket_aggregate_prepend_iovec(
-    serf_bucket_t *aggregate_bucket,
-    struct iovec *vecs,
-    int vecs_count);
-
-void serf_bucket_aggregate_append_iovec(
-    serf_bucket_t *aggregate_bucket,
-    struct iovec *vecs,
-    int vecs_count);
-
-/* ==================================================================== */
-
-
-extern const serf_bucket_type_t serf_bucket_type_file;
-#define SERF_BUCKET_IS_FILE(b) SERF_BUCKET_CHECK((b), file)
-
-serf_bucket_t *serf_bucket_file_create(
-    apr_file_t *file,
-    serf_bucket_alloc_t *allocator);
-
-
-/* ==================================================================== */
-
-
-extern const serf_bucket_type_t serf_bucket_type_socket;
-#define SERF_BUCKET_IS_SOCKET(b) SERF_BUCKET_CHECK((b), socket)
-
-serf_bucket_t *serf_bucket_socket_create(
-    apr_socket_t *skt,
-    serf_bucket_alloc_t *allocator);
-
-/**
- * Call @a progress_func every time bytes are read from the socket, pass
- * the number of bytes read.
- *
- * When using serf's bytes read & written progress indicator, pass 
- * @a serf_context_progress_delta for progress_func and the serf_context for
- * progress_baton.
- */
-void serf_bucket_socket_set_read_progress_cb(
-    serf_bucket_t *bucket,
-    const serf_progress_t progress_func,
-    void *progress_baton);
-
-/* ==================================================================== */
-
-
-extern const serf_bucket_type_t serf_bucket_type_simple;
-#define SERF_BUCKET_IS_SIMPLE(b) SERF_BUCKET_CHECK((b), simple)
-
-typedef void (*serf_simple_freefunc_t)(
-    void *baton,
-    const char *data);
-
-serf_bucket_t *serf_bucket_simple_create(
-    const char *data,
-    apr_size_t len,
-    serf_simple_freefunc_t freefunc,
-    void *freefunc_baton,
-    serf_bucket_alloc_t *allocator);
-
-/**
- * Equivalent to serf_bucket_simple_create, except that the bucket takes
- * ownership of a private copy of the data.
- */
-serf_bucket_t *serf_bucket_simple_copy_create(
-    const char *data,
-    apr_size_t len,
-    serf_bucket_alloc_t *allocator);
-
-/**
- * Equivalent to serf_bucket_simple_create, except that the bucket assumes
- * responsibility for freeing the data on this allocator without making
- * a copy.  It is assumed that data was created by a call from allocator.
- */
-serf_bucket_t *serf_bucket_simple_own_create(
-    const char *data,
-    apr_size_t len,
-    serf_bucket_alloc_t *allocator);
-
-#define SERF_BUCKET_SIMPLE_STRING(s,a) \
-    serf_bucket_simple_create(s, strlen(s), NULL, NULL, a);
-
-#define SERF_BUCKET_SIMPLE_STRING_LEN(s,l,a) \
-    serf_bucket_simple_create(s, l, NULL, NULL, a);
-
-/* ==================================================================== */
-
-
-/* Note: apr_mmap_t is always defined, but if APR doesn't have mmaps, then
-   the caller can never create an apr_mmap_t to pass to this function. */
-
-extern const serf_bucket_type_t serf_bucket_type_mmap;
-#define SERF_BUCKET_IS_MMAP(b) SERF_BUCKET_CHECK((b), mmap)
-
-serf_bucket_t *serf_bucket_mmap_create(
-    apr_mmap_t *mmap,
-    serf_bucket_alloc_t *allocator);
-
-
-/* ==================================================================== */
-
-
-extern const serf_bucket_type_t serf_bucket_type_headers;
-#define SERF_BUCKET_IS_HEADERS(b) SERF_BUCKET_CHECK((b), headers)
-
-serf_bucket_t *serf_bucket_headers_create(
-    serf_bucket_alloc_t *allocator);
-
-/**
- * Set, default: value copied.
- *
- * Set the specified @a header within the bucket, copying the @a value
- * into space from this bucket's allocator. The header is NOT copied,
- * so it should remain in scope at least as long as the bucket.
- */
-void serf_bucket_headers_set(
-    serf_bucket_t *headers_bucket,
-    const char *header,
-    const char *value);
-
-/**
- * Set, copies: header and value copied.
- *
- * Copy the specified @a header and @a value into the bucket, using space
- * from this bucket's allocator.
- */
-void serf_bucket_headers_setc(
-    serf_bucket_t *headers_bucket,
-    const char *header,
-    const char *value);
-
-/**
- * Set, no copies.
- *
- * Set the specified @a header and @a value into the bucket, without
- * copying either attribute. Both attributes should remain in scope at
- * least as long as the bucket.
- *
- * @note In the case where a header already exists this will result
- *       in a reallocation and copy, @see serf_bucket_headers_setn.
- */
-void serf_bucket_headers_setn(
-    serf_bucket_t *headers_bucket,
-    const char *header,
-    const char *value);
-
-/**
- * Set, extended: fine grained copy control of header and value.
- *
- * Set the specified @a header, with length @a header_size with the
- * @a value, and length @a value_size, into the bucket. The header will
- * be copied if @a header_copy is set, and the value is copied if
- * @a value_copy is set. If the values are not copied, then they should
- * remain in scope at least as long as the bucket.
- *
- * If @a headers_bucket already contains a header with the same name
- * as @a header, then append @a value to the existing value,
- * separating with a comma (as per RFC 2616, section 4.2).  In this
- * case, the new value must be allocated and the header re-used, so
- * behave as if @a value_copy were true and @a header_copy false.
- */
-void serf_bucket_headers_setx(
-    serf_bucket_t *headers_bucket,
-    const char *header,
-    apr_size_t header_size,
-    int header_copy,
-    const char *value,
-    apr_size_t value_size,
-    int value_copy);
-
-const char *serf_bucket_headers_get(
-    serf_bucket_t *headers_bucket,
-    const char *header);
-
-/**
- * @param baton opaque baton as passed to @see serf_bucket_headers_do
- * @param key The header key from this iteration through the table
- * @param value The header value from this iteration through the table
- */
-typedef int (serf_bucket_headers_do_callback_fn_t)(
-    void *baton,
-    const char *key,
-    const char *value);
-
-/**
- * Iterates over all headers of the message and invokes the callback 
- * function with header key and value. Stop iterating when no more
- * headers are available or when the callback function returned a 
- * non-0 value.
- *
- * @param headers_bucket headers to iterate over
- * @param func callback routine to invoke for every header in the bucket
- * @param baton baton to pass on each invocation to func
- */
-void serf_bucket_headers_do(
-    serf_bucket_t *headers_bucket,
-    serf_bucket_headers_do_callback_fn_t func,
-    void *baton);
-
-
-/* ==================================================================== */
-
-
-extern const serf_bucket_type_t serf_bucket_type_chunk;
-#define SERF_BUCKET_IS_CHUNK(b) SERF_BUCKET_CHECK((b), chunk)
-
-serf_bucket_t *serf_bucket_chunk_create(
-    serf_bucket_t *stream,
-    serf_bucket_alloc_t *allocator);
-
-
-/* ==================================================================== */
-
-
-extern const serf_bucket_type_t serf_bucket_type_dechunk;
-#define SERF_BUCKET_IS_DECHUNK(b) SERF_BUCKET_CHECK((b), dechunk)
-
-serf_bucket_t *serf_bucket_dechunk_create(
-    serf_bucket_t *stream,
-    serf_bucket_alloc_t *allocator);
-
-
-/* ==================================================================== */
-
-
-extern const serf_bucket_type_t serf_bucket_type_deflate;
-#define SERF_BUCKET_IS_DEFLATE(b) SERF_BUCKET_CHECK((b), deflate)
-
-#define SERF_DEFLATE_GZIP 0
-#define SERF_DEFLATE_DEFLATE 1
-
-serf_bucket_t *serf_bucket_deflate_create(
-    serf_bucket_t *stream,
-    serf_bucket_alloc_t *allocator,
-    int format);
-
-
-/* ==================================================================== */
-
-
-extern const serf_bucket_type_t serf_bucket_type_limit;
-#define SERF_BUCKET_IS_LIMIT(b) SERF_BUCKET_CHECK((b), limit)
-
-serf_bucket_t *serf_bucket_limit_create(
-    serf_bucket_t *stream,
-    apr_uint64_t limit,
-    serf_bucket_alloc_t *allocator);
-
-
-/* ==================================================================== */
-#define SERF_SSL_CERT_NOTYETVALID       0x0001
-#define SERF_SSL_CERT_EXPIRED           0x0002
-#define SERF_SSL_CERT_UNKNOWNCA         0x0004
-#define SERF_SSL_CERT_SELF_SIGNED       0x0008
-#define SERF_SSL_CERT_UNKNOWN_FAILURE   0x0010
-#define SERF_SSL_CERT_REVOKED           0x0020
-#define SERF_SSL_CERT_UNABLE_TO_GET_CRL 0x0040
-#define SERF_SSL_CERT_INVALID_HOST      0x0080
-
-#define SERF_SSL_OCSP_RESPONDER_TRYLATER        0x0100
-#define SERF_SSL_OCSP_RESPONDER_ERROR           0x0200
-#define SERF_SSL_OCSP_RESPONDER_UNKNOWN_FAILURE 0x0400
-
-extern const serf_bucket_type_t serf_bucket_type_ssl_encrypt;
-#define SERF_BUCKET_IS_SSL_ENCRYPT(b) SERF_BUCKET_CHECK((b), ssl_encrypt)
-
-typedef struct serf_ssl_context_t serf_ssl_context_t;
-typedef struct serf_ssl_certificate_t serf_ssl_certificate_t;
-
-typedef apr_status_t (*serf_ssl_need_client_cert_t)(
-    void *data,
-    const char **cert_path);
-
-typedef apr_status_t (*serf_ssl_need_cert_password_t)(
-    void *data,
-    const char *cert_path,
-    const char **password);
-
-/* Callback type for server certificate status info and OCSP responses.
-   Note that CERT can be NULL in case its called from the OCSP callback. */
-typedef apr_status_t (*serf_ssl_need_server_cert_t)(
-    void *data, 
-    int failures,
-    const serf_ssl_certificate_t *cert);
-
-typedef apr_status_t (*serf_ssl_server_cert_chain_cb_t)(
-    void *data,
-    int failures,
-    int error_depth,
-    const serf_ssl_certificate_t * const * certs,
-    apr_size_t certs_len);
-
-void serf_ssl_client_cert_provider_set(
-    serf_ssl_context_t *context,
-    serf_ssl_need_client_cert_t callback,
-    void *data,
-    void *cache_pool);
-
-void serf_ssl_client_cert_password_set(
-    serf_ssl_context_t *context,
-    serf_ssl_need_cert_password_t callback,
-    void *data,
-    void *cache_pool);
-
-/**
- * Set a callback to override the default SSL server certificate validation 
- * algorithm.
- */
-void serf_ssl_server_cert_callback_set(
-    serf_ssl_context_t *context,
-    serf_ssl_need_server_cert_t callback,
-    void *data);
-
-/**
- * Set callbacks to override the default SSL server certificate validation 
- * algorithm for the current certificate or the entire certificate chain. 
- */
-void serf_ssl_server_cert_chain_callback_set(
-    serf_ssl_context_t *context,
-    serf_ssl_need_server_cert_t cert_callback,
-    serf_ssl_server_cert_chain_cb_t cert_chain_callback,
-    void *data);
-
-/**
- * Use the default root CA certificates as included with the OpenSSL library.
- */
-apr_status_t serf_ssl_use_default_certificates(
-    serf_ssl_context_t *context);
-
-/**
- * Allow SNI indicators to be sent to the server.
- */
-apr_status_t serf_ssl_set_hostname(
-    serf_ssl_context_t *context, const char *hostname);
-
-
-typedef apr_status_t (*serf_ssl_protocol_result_cb_t)(
-    void *data,
-    const char *protocol);
-
-/**
- * Enables ALPN negotiation with the server. Setups that the supported 
protocols
- * will be sent to the server, and enables handling the response via a 
callback.
- *
- * SUPPORTED_PROTOCOLS is a comma separated list of protocols. No whitespace
- * should be added as the values are used literally. E.g. "h2,http/1.1,h2-16"
- *
- * Returns APR_ENOTIMPL when the ssl library doesn't implement ALPN.
- *
- * If successfull CALLBACK will be called as soon as the protocol is negotiated
- * or directly after the secured stream is connected.
- *
- * @since New in 1.4.
- */
-apr_status_t serf_ssl_negotiate_protocol(
-    serf_ssl_context_t *context,
-    const char *protocols,
-    serf_ssl_protocol_result_cb_t callback,
-    void *callback_data);
-
-/**
- * Return the depth of the certificate.
- */
-int serf_ssl_cert_depth(
-    const serf_ssl_certificate_t *cert);
-
-/**
- * Extract the fields of the issuer in a table with keys (E, CN, OU, O, L, 
- * ST and C). The returned table will be allocated in @a pool.
- */
-apr_hash_t *serf_ssl_cert_issuer(
-    const serf_ssl_certificate_t *cert,
-    apr_pool_t *pool);
-
-/**
- * Extract the fields of the subject in a table with keys (E, CN, OU, O, L, 
- * ST and C). The returned table will be allocated in @a pool.
- */
-apr_hash_t *serf_ssl_cert_subject(
-    const serf_ssl_certificate_t *cert,
-    apr_pool_t *pool);
-
-/**
- * Extract the fields of the certificate in a table with keys (sha1, notBefore,
- * notAfter, subjectAltName). The returned table will be allocated in @a pool.
- */
-apr_hash_t *serf_ssl_cert_certificate(
-    const serf_ssl_certificate_t *cert,
-    apr_pool_t *pool);
-
-/**
- * Export a certificate to base64-encoded, zero-terminated string.
- * The returned string is allocated in @a pool. Returns NULL on failure.
- */
-const char *serf_ssl_cert_export(
-    const serf_ssl_certificate_t *cert,
-    apr_pool_t *pool);
-
-/**
- * Load a CA certificate file from a path @a file_path. If the file was loaded
- * and parsed correctly, a certificate @a cert will be created and returned.
- * This certificate object will be alloced in @a pool.
- */
-apr_status_t serf_ssl_load_cert_file(
-    serf_ssl_certificate_t **cert,
-    const char *file_path,
-    apr_pool_t *pool);
-
-/**
- * Adds the certificate @a cert to the list of trusted certificates in 
- * @a ssl_ctx that will be used for verification. 
- * See also @a serf_ssl_load_cert_file.
- */
-apr_status_t serf_ssl_trust_cert(
-    serf_ssl_context_t *ssl_ctx,
-    serf_ssl_certificate_t *cert);
-
-/** 
- * Load a CRL .pem file from @a file_path and enable CRL checking.
- */
-apr_status_t serf_ssl_add_crl_from_file(serf_ssl_context_t *ssl_ctx,
-                                        const char *file_path,
-                                        apr_pool_t *pool);
-
-/**
- * Enable or disable CRL checking of all server certificates.
- * @a enabled = 1 to enable CRL checking, 0 to disable CRL checking.
- * Default = disabled.
- */
-apr_status_t serf_ssl_check_crl(serf_ssl_context_t *ssl_ctx,
-                                int enabled);
-
-/**
- * Enable or disable certificate status request (OCSP stapling) checking of all
- * server certificates.
- * @a enabled = 1 to enable checking, 0 to disable checking.
- * Default = disabled.
- */
-apr_status_t
-serf_ssl_check_cert_status_request(serf_ssl_context_t *ssl_ctx, int enabled);
-
-/**
- * Enable or disable SSL compression on a SSL session.
- * @a enabled = 1 to enable compression, 0 to disable compression.
- * Default = disabled.
- */
-apr_status_t serf_ssl_use_compression(
-    serf_ssl_context_t *ssl_ctx,
-    int enabled);
-
-serf_bucket_t *serf_bucket_ssl_encrypt_create(
-    serf_bucket_t *stream,
-    serf_ssl_context_t *ssl_context,
-    serf_bucket_alloc_t *allocator);
-
-serf_ssl_context_t *serf_bucket_ssl_encrypt_context_get(
-    serf_bucket_t *bucket);
-
-/* ==================================================================== */
-
-
-extern const serf_bucket_type_t serf_bucket_type_ssl_decrypt;
-#define SERF_BUCKET_IS_SSL_DECRYPT(b) SERF_BUCKET_CHECK((b), ssl_decrypt)
-
-serf_bucket_t *serf_bucket_ssl_decrypt_create(
-    serf_bucket_t *stream,
-    serf_ssl_context_t *ssl_context,
-    serf_bucket_alloc_t *allocator);
-
-serf_ssl_context_t *serf_bucket_ssl_decrypt_context_get(
-    serf_bucket_t *bucket);
-
-
-/* ==================================================================== */
-
-
-extern const serf_bucket_type_t serf_bucket_type_barrier;
-#define SERF_BUCKET_IS_BARRIER(b) SERF_BUCKET_CHECK((b), barrier)
-
-serf_bucket_t *serf_bucket_barrier_create(
-    serf_bucket_t *stream,
-    serf_bucket_alloc_t *allocator);
-
-
-/* ==================================================================== */
-
-extern const serf_bucket_type_t serf_bucket_type_iovec;
-#define SERF_BUCKET_IS_IOVEC(b) SERF_BUCKET_CHECK((b), iovec)
-
-serf_bucket_t *serf_bucket_iovec_create(
-    struct iovec vecs[],
-    int len,
-    serf_bucket_alloc_t *allocator);
-
-/* ==================================================================== */
-
-extern const serf_bucket_type_t serf_bucket_type_copy;
-#define SERF_BUCKET_IS_COPY(b) SERF_BUCKET_CHECK((b), copy)
-
-serf_bucket_t *serf_bucket_copy_create(
-    serf_bucket_t *wrapped,
-    apr_size_t min_size,
-    serf_bucket_alloc_t *allocator);
-
-/* ==================================================================== */
-
-extern const serf_bucket_type_t serf_bucket_type_http2_unframe;
-#define SERF_BUCKET_IS_HTTP2_UNFRAME(b) SERF_BUCKET_CHECK((b), http2_unframe)
+extern const serf_bucket_type_t serf_bucket_type__http2_unframe;
+#define SERF__BUCKET_IS_HTTP2_UNFRAME(b) SERF_BUCKET_CHECK((b), _http2_unframe)
 
 serf_bucket_t *
-serf_bucket_http2_unframe_create(serf_bucket_t *stream,
-                                 int destroy_stream,
-                                 apr_size_t max_payload_size,
-                                 serf_bucket_alloc_t *allocator);
+serf__bucket_http2_unframe_create(serf_bucket_t *stream,
+                                  int destroy_stream,
+                                  apr_size_t max_payload_size,
+                                  serf_bucket_alloc_t *allocator);
 
 /* Obtains the frame header state, reading from the bucket if necessary.
    If the header was read successfully (or was already read before calling)
@@ -773,31 +52,31 @@ serf_bucket_http2_unframe_create(serf_bu
    returns APR_SUCCESS when the header was already read before calling this,
    function. Otherwise it will return the result of reading. */
 apr_status_t
-serf_bucket_http2_unframe_read_info(serf_bucket_t *bucket,
-                                    apr_int32_t *stream_id,
-                                    unsigned char *frame_type,
-                                    unsigned char *flags);
+serf__bucket_http2_unframe_read_info(serf_bucket_t *bucket,
+                                     apr_int32_t *stream_id,
+                                     unsigned char *frame_type,
+                                     unsigned char *flags);
 
 /* ==================================================================== */
 
-extern const serf_bucket_type_t serf_bucket_type_http2_unpad;
-#define SERF_BUCKET_IS_HTTP2_UNPAD(b) SERF_BUCKET_CHECK((b), http2_unpad)
+extern const serf_bucket_type_t serf_bucket_type__http2_unpad;
+#define SERF__BUCKET_IS_HTTP2_UNPAD(b) SERF_BUCKET_CHECK((b), _http2_unpad)
 
 serf_bucket_t *
-serf_bucket_http2_unpad_create(serf_bucket_t *stream,
-                               int destroy_stream,
-                               serf_bucket_alloc_t *allocator);
+serf__bucket_http2_unpad_create(serf_bucket_t *stream,
+                                int destroy_stream,
+                                serf_bucket_alloc_t *allocator);
 
 /* ==================================================================== */
 
-extern const serf_bucket_type_t serf_bucket_type_hpack;
-#define SERF_BUCKET_IS_HPACK(b) SERF_BUCKET_CHECK((b), hpack)
+extern const serf_bucket_type_t serf_bucket_type__hpack;
+#define SERF_BUCKET_IS_HPACK(b) SERF_BUCKET_CHECK((b), _hpack)
 
 typedef struct serf_hpack_table_t serf_hpack_table_t;
 
 serf_bucket_t *
-serf_bucket_hpack_create(serf_hpack_table_t *hpack_table,
-                         serf_bucket_alloc_t *allocator);
+serf__bucket_hpack_create(serf_hpack_table_t *hpack_table,
+                          serf_bucket_alloc_t *allocator);
 
 /**
  * Set, copies: header and value copied.
@@ -805,9 +84,9 @@ serf_bucket_hpack_create(serf_hpack_tabl
  * Copy the specified @a header and @a value into the bucket, using space
  * from this bucket's allocator.
  */
-void serf_bucket_hpack_setc(serf_bucket_t *hpack_bucket,
-                            const char *key,
-                            const char *value);
+void serf__bucket_hpack_setc(serf_bucket_t *hpack_bucket,
+                             const char *key,
+                             const char *value);
 
 /**
  * Set, extended: fine grained copy control of key and value.
@@ -824,16 +103,18 @@ void serf_bucket_hpack_setc(serf_bucket_
  * case, the new value must be allocated and the header re-used, so
  * behave as if @a value_copy were true and @a header_copy false.
  */
-void serf_bucket_hpack_setx(serf_bucket_t *hpack_bucket,
-                            const char *key,
-                            apr_size_t key_size,
-                            int header_copy,
-                            const char *value,
-                            apr_size_t value_size,
-                            int value_copy);
-
-const char *serf_bucket_hpack_getc(serf_bucket_t *hpack_bucket,
-                                   const char *key);
+void
+serf__bucket_hpack_setx(serf_bucket_t *hpack_bucket,
+                        const char *key,
+                        apr_size_t key_size,
+                        int header_copy,
+                        const char *value,
+                        apr_size_t value_size,
+                        int value_copy);
+
+const char *
+serf__bucket_hpack_getc(serf_bucket_t *hpack_bucket,
+                        const char *key);
 
 /**
  * @param baton opaque baton as passed to @see serf_bucket_hpack_do
@@ -856,17 +137,18 @@ typedef int (serf_bucket_hpack_do_callba
  * @param func callback routine to invoke for every header in the bucket
  * @param baton baton to pass on each invocation to func
  */
-void serf_bucket_hpack_do(serf_bucket_t *hpack_bucket,
-                          serf_bucket_hpack_do_callback_fn_t func,
-                          void *baton);
+void
+serf__bucket_hpack_do(serf_bucket_t *hpack_bucket,
+                     serf_bucket_hpack_do_callback_fn_t func,
+                     void *baton);
 
 serf_hpack_table_t *
-serf_hpack_table_create(int for_http2,
-                        apr_size_t default_max_table_size,
-                        apr_pool_t *result_pool);
+serf__hpack_table_create(int for_http2,
+                         apr_size_t default_max_table_size,
+                         apr_pool_t *result_pool);
 
 /* ==================================================================== */
-extern const serf_bucket_type_t serf_bucket_type_hpack_decode;
+extern const serf_bucket_type_t serf_bucket_type__hpack_decode;
 #define SERF_BUCKET_IS_HPACK_DECODE(b) SERF_BUCKET_CHECK((b), hpack_decode)
 
 /* If ITEM_CALLBACK is not null calls it for every item while reading, and
@@ -877,52 +159,50 @@ extern const serf_bucket_type_t serf_buc
    the result as the start of the result for a response_bucket.
  */
 serf_bucket_t *
-serf_bucket_hpack_decode_create(serf_bucket_t *stream,
-                                apr_status_t(*item_callback)(
+serf__bucket_hpack_decode_create(serf_bucket_t *stream,
+                                 apr_status_t(*item_callback)(
                                                   void *baton,
                                                   const char *key,
                                                   apr_size_t key_size,
                                                   const char *value,
                                                   apr_size_t value_size),
-                                void *item_baton,
-                                apr_size_t max_entry_size,
-                                serf_hpack_table_t *hpack_table,
-                                serf_bucket_alloc_t *alloc);
+                                 void *item_baton,
+                                 apr_size_t max_entry_size,
+                                 serf_hpack_table_t *hpack_table,
+                                 serf_bucket_alloc_t *alloc);
 
 /* ==================================================================== */
-extern const serf_bucket_type_t serf_bucket_type_http2_frame;
+extern const serf_bucket_type_t serf_bucket_type__http2_frame;
 
-#define SERF_BUCKET_IS_HTTP2_FRAME(b) SERF_BUCKET_CHECK((b), http2_frame)
+#define SERF__BUCKET_IS_HTTP2_FRAME(b) SERF_BUCKET_CHECK((b), _http2_frame)
 
 serf_bucket_t *
-serf_bucket_http2_frame_create(serf_bucket_t *stream,
-                               unsigned char frame_type,
-                               unsigned char flags,
-                               apr_int32_t *stream_id,
-                               void(*stream_id_alloc)(
-                                 void *baton,
-                                 apr_int32_t *stream_id),
-                               void *stream_id_baton,
-                               apr_size_t max_payload_size,
-                               apr_int32_t(*alloc_window)(
-                                 void *baton,
-                                 unsigned char frametype,
-                                 apr_int32_t stream_id,
-                                 apr_size_t requested,
-                                 int peek),
-                               void *alloc_window_baton,
-                               serf_bucket_alloc_t *alloc);
+serf__bucket_http2_frame_create(serf_bucket_t *stream,
+                                unsigned char frame_type,
+                                unsigned char flags,
+                                apr_int32_t *stream_id,
+                                void(*stream_id_alloc)(
+                                      void *baton,
+                                      apr_int32_t *stream_id),
+                                void *stream_id_baton,
+                                apr_size_t max_payload_size,
+                                apr_int32_t(*alloc_window)(
+                                      void *baton,
+                                      unsigned char frametype,
+                                      apr_int32_t stream_id,
+                                      apr_size_t requested,
+                                      int peek),
+                                void *alloc_window_baton,
+                                serf_bucket_alloc_t *alloc);
 
 int
-serf_bucket_http2_frame_within_frame(serf_bucket_t *bucket);
+serf__bucket_http2_frame_within_frame(serf_bucket_t *bucket);
 
 /* ==================================================================== */
 
-/* ### do we need a PIPE bucket type? they are simple apr_file_t objects */
-
-
 #ifdef __cplusplus
 }
 #endif
 
-#endif /* !SERF_BUCKET_TYPES_H */
+#endif /* !SERF_PROTOCOL_HTTP2_BUCKETS_H */
+

Modified: serf/trunk/serf_bucket_types.h
URL: 
http://svn.apache.org/viewvc/serf/trunk/serf_bucket_types.h?rev=1710686&r1=1710685&r2=1710686&view=diff
==============================================================================
--- serf/trunk/serf_bucket_types.h (original)
+++ serf/trunk/serf_bucket_types.h Mon Oct 26 20:15:02 2015
@@ -756,168 +756,6 @@ serf_bucket_t *serf_bucket_copy_create(
 
 /* ==================================================================== */
 
-extern const serf_bucket_type_t serf_bucket_type_http2_unframe;
-#define SERF_BUCKET_IS_HTTP2_UNFRAME(b) SERF_BUCKET_CHECK((b), http2_unframe)
-
-serf_bucket_t *
-serf_bucket_http2_unframe_create(serf_bucket_t *stream,
-                                 int destroy_stream,
-                                 apr_size_t max_payload_size,
-                                 serf_bucket_alloc_t *allocator);
-
-/* Obtains the frame header state, reading from the bucket if necessary.
-   If the header was read successfully (or was already read before calling)
-   the *stream_id, * frame_type and *flags values (when not pointing to NULL)
-   will be set to the requested values.
-
-   returns APR_SUCCESS when the header was already read before calling this,
-   function. Otherwise it will return the result of reading. */
-apr_status_t
-serf_bucket_http2_unframe_read_info(serf_bucket_t *bucket,
-                                    apr_int32_t *stream_id,
-                                    unsigned char *frame_type,
-                                    unsigned char *flags);
-
-/* ==================================================================== */
-
-extern const serf_bucket_type_t serf_bucket_type_http2_unpad;
-#define SERF_BUCKET_IS_HTTP2_UNPAD(b) SERF_BUCKET_CHECK((b), http2_unpad)
-
-serf_bucket_t *
-serf_bucket_http2_unpad_create(serf_bucket_t *stream,
-                               int destroy_stream,
-                               serf_bucket_alloc_t *allocator);
-
-/* ==================================================================== */
-
-extern const serf_bucket_type_t serf_bucket_type_hpack;
-#define SERF_BUCKET_IS_HPACK(b) SERF_BUCKET_CHECK((b), hpack)
-
-typedef struct serf_hpack_table_t serf_hpack_table_t;
-
-serf_bucket_t *
-serf_bucket_hpack_create(serf_hpack_table_t *hpack_table,
-                         serf_bucket_alloc_t *allocator);
-
-/**
- * Set, copies: header and value copied.
- *
- * Copy the specified @a header and @a value into the bucket, using space
- * from this bucket's allocator.
- */
-void serf_bucket_hpack_setc(serf_bucket_t *hpack_bucket,
-                            const char *key,
-                            const char *value);
-
-/**
- * Set, extended: fine grained copy control of key and value.
- *
- * Set the specified @a key, with length @a key_size with the
- * @a value, and length @a value_size, into the bucket. The header will
- * be copied if @a header_copy is set, and the value is copied if
- * @a value_copy is set. If the values are not copied, then they should
- * remain in scope at least as long as the bucket.
- *
- * If @a headers_bucket already contains a header with the same name
- * as @a header, then append @a value to the existing value,
- * separating with a comma (as per RFC 2616, section 4.2).  In this
- * case, the new value must be allocated and the header re-used, so
- * behave as if @a value_copy were true and @a header_copy false.
- */
-void serf_bucket_hpack_setx(serf_bucket_t *hpack_bucket,
-                            const char *key,
-                            apr_size_t key_size,
-                            int header_copy,
-                            const char *value,
-                            apr_size_t value_size,
-                            int value_copy);
-
-const char *serf_bucket_hpack_getc(serf_bucket_t *hpack_bucket,
-                                   const char *key);
-
-/**
- * @param baton opaque baton as passed to @see serf_bucket_hpack_do
- * @param key The header key from this iteration through the table
- * @param value The header value from this iteration through the table
- */
-typedef int (serf_bucket_hpack_do_callback_fn_t)(void *baton,
-                                                 const char *key,
-                                                 apr_size_t keylen,
-                                                 const char *value,
-                                                 apr_size_t value_len);
-
-/**
- * Iterates over all headers of the message and invokes the callback 
- * function with header key and value. Stop iterating when no more
- * headers are available or when the callback function returned a 
- * non-0 value.
- *
- * @param headers_bucket headers to iterate over
- * @param func callback routine to invoke for every header in the bucket
- * @param baton baton to pass on each invocation to func
- */
-void serf_bucket_hpack_do(serf_bucket_t *hpack_bucket,
-                          serf_bucket_hpack_do_callback_fn_t func,
-                          void *baton);
-
-serf_hpack_table_t *
-serf_hpack_table_create(int for_http2,
-                        apr_size_t default_max_table_size,
-                        apr_pool_t *result_pool);
-
-/* ==================================================================== */
-extern const serf_bucket_type_t serf_bucket_type_hpack_decode;
-#define SERF_BUCKET_IS_HPACK_DECODE(b) SERF_BUCKET_CHECK((b), hpack_decode)
-
-/* If ITEM_CALLBACK is not null calls it for every item while reading, and
-   the bucket will just return no data and APR_EAGAIN until done.
-
-   If ITEM_CALLBACK is NULL, the bucket will read as a HTTP/1 like header 
block,
-   starting with a status line and ending with "\r\n\r\n", which allows using
-   the result as the start of the result for a response_bucket.
- */
-serf_bucket_t *
-serf_bucket_hpack_decode_create(serf_bucket_t *stream,
-                                apr_status_t(*item_callback)(
-                                                  void *baton,
-                                                  const char *key,
-                                                  apr_size_t key_size,
-                                                  const char *value,
-                                                  apr_size_t value_size),
-                                void *item_baton,
-                                apr_size_t max_entry_size,
-                                serf_hpack_table_t *hpack_table,
-                                serf_bucket_alloc_t *alloc);
-
-/* ==================================================================== */
-extern const serf_bucket_type_t serf_bucket_type_http2_frame;
-
-#define SERF_BUCKET_IS_HTTP2_FRAME(b) SERF_BUCKET_CHECK((b), http2_frame)
-
-serf_bucket_t *
-serf_bucket_http2_frame_create(serf_bucket_t *stream,
-                               unsigned char frame_type,
-                               unsigned char flags,
-                               apr_int32_t *stream_id,
-                               void(*stream_id_alloc)(
-                                 void *baton,
-                                 apr_int32_t *stream_id),
-                               void *stream_id_baton,
-                               apr_size_t max_payload_size,
-                               apr_int32_t(*alloc_window)(
-                                 void *baton,
-                                 unsigned char frametype,
-                                 apr_int32_t stream_id,
-                                 apr_size_t requested,
-                                 int peek),
-                               void *alloc_window_baton,
-                               serf_bucket_alloc_t *alloc);
-
-int
-serf_bucket_http2_frame_within_frame(serf_bucket_t *bucket);
-
-/* ==================================================================== */
-
 /* ### do we need a PIPE bucket type? they are simple apr_file_t objects */
 
 

Modified: serf/trunk/serf_private.h
URL: 
http://svn.apache.org/viewvc/serf/trunk/serf_private.h?rev=1710686&r1=1710685&r2=1710686&view=diff
==============================================================================
--- serf/trunk/serf_private.h (original)
+++ serf/trunk/serf_private.h Mon Oct 26 20:15:02 2015
@@ -543,6 +543,8 @@ serf_bucket_t *serf__bucket_log_wrapper_
 /* From http2_protocol.c: Initializes http2 state on connection */
 void serf__http2_protocol_init(serf_connection_t *conn);
 
+typedef struct serf_hpack_table_t serf_hpack_table_t;
+
 /* From http2_hpack_buckets.c */
 apr_status_t serf__hpack_huffman_decode(const unsigned char *encoded,
                                         apr_size_t encoded_len,

Modified: serf/trunk/test/test_buckets.c
URL: 
http://svn.apache.org/viewvc/serf/trunk/test/test_buckets.c?rev=1710686&r1=1710685&r2=1710686&view=diff
==============================================================================
--- serf/trunk/test/test_buckets.c (original)
+++ serf/trunk/test/test_buckets.c Mon Oct 26 20:15:02 2015
@@ -33,6 +33,8 @@
 #include "serf_private.h"
 #include "serf_bucket_util.h"
 
+#include "protocols/http2_buckets.h"
+
 static apr_status_t read_all(serf_bucket_t *bkt,
                              char *buf,
                              apr_size_t buf_len,
@@ -1779,10 +1781,10 @@ static void test_http2_unframe_buckets(C
   raw = serf_bucket_simple_create(raw_frame1, sizeof(raw_frame1),
                                   NULL, NULL, alloc);
 
-  unframe = serf_bucket_http2_unframe_create(raw, TRUE, SERF_READ_ALL_AVAIL,
-                                             alloc);
+  unframe = serf__bucket_http2_unframe_create(raw, TRUE, SERF_READ_ALL_AVAIL,
+                                              alloc);
 
-  CuAssertTrue(tc, SERF_BUCKET_IS_HTTP2_UNFRAME(unframe));
+  CuAssertTrue(tc, SERF__BUCKET_IS_HTTP2_UNFRAME(unframe));
 
   status = read_all(unframe, result1, sizeof(result1), &read_len);
   CuAssertIntEquals(tc, APR_EOF, status);
@@ -1796,10 +1798,10 @@ static void test_http2_unframe_buckets(C
     unsigned char frame_type, flags;
 
     CuAssertIntEquals(tc, 0,
-                      serf_bucket_http2_unframe_read_info(unframe,
-                                                          &stream_id,
-                                                          &frame_type,
-                                                          &flags));
+                      serf__bucket_http2_unframe_read_info(unframe,
+                                                           &stream_id,
+                                                           &frame_type,
+                                                           &flags));
     CuAssertIntEquals(tc, 0, stream_id);
     CuAssertIntEquals(tc, 4, frame_type);
     CuAssertIntEquals(tc, 0, flags);
@@ -1808,8 +1810,8 @@ static void test_http2_unframe_buckets(C
   raw = serf_bucket_simple_create(raw_frame2, sizeof(raw_frame2),
                                   NULL, NULL, alloc);
 
-  unframe = serf_bucket_http2_unframe_create(raw, TRUE, SERF_READ_ALL_AVAIL,
-                                             alloc);
+  unframe = serf__bucket_http2_unframe_create(raw, TRUE, SERF_READ_ALL_AVAIL,
+                                              alloc);
 
   status = read_all(unframe, result2, sizeof(result2), &read_len);
   CuAssertIntEquals(tc, APR_EOF, status);
@@ -1823,10 +1825,10 @@ static void test_http2_unframe_buckets(C
     unsigned char frame_type, flags;
 
     CuAssertIntEquals(tc, 0,
-                      serf_bucket_http2_unframe_read_info(unframe,
-                                                          &stream_id,
-                                                          &frame_type,
-                                                          &flags));
+                      serf__bucket_http2_unframe_read_info(unframe,
+                                                           &stream_id,
+                                                           &frame_type,
+                                                           &flags));
     CuAssertIntEquals(tc, 0x03040506, stream_id);
     CuAssertIntEquals(tc, 0x01, frame_type);
     CuAssertIntEquals(tc, 0x02, flags);
@@ -1836,7 +1838,7 @@ static void test_http2_unframe_buckets(C
   raw = serf_bucket_simple_create(raw_frame2, sizeof(raw_frame2),
                                   NULL, NULL, alloc);
 
-  unframe = serf_bucket_http2_unframe_create(raw, TRUE, 5, alloc);
+  unframe = serf__bucket_http2_unframe_create(raw, TRUE, 5, alloc);
 
   status = read_all(unframe, result2, sizeof(result2), &read_len);
   CuAssertIntEquals(tc, SERF_ERROR_HTTP2_FRAME_SIZE_ERROR, status);
@@ -1872,15 +1874,15 @@ static void test_http2_unpad_buckets(CuT
   raw = serf_bucket_simple_create(raw_frame, sizeof(raw_frame)-1,
                                   NULL, NULL, alloc);
 
-  unframe = serf_bucket_http2_unframe_create(raw, FALSE, SERF_READ_ALL_AVAIL,
-                                             alloc);
+  unframe = serf__bucket_http2_unframe_create(raw, FALSE, SERF_READ_ALL_AVAIL,
+                                              alloc);
 
   {
     apr_int32_t streamid;
     unsigned char frame_type, flags;
 
-    status = serf_bucket_http2_unframe_read_info(unframe, &streamid,
-                                                 &frame_type, &flags);
+    status = serf__bucket_http2_unframe_read_info(unframe, &streamid,
+                                                  &frame_type, &flags);
 
     CuAssertIntEquals(tc, APR_SUCCESS, status);
     CuAssertIntEquals(tc, 7, streamid);
@@ -1888,9 +1890,9 @@ static void test_http2_unpad_buckets(CuT
     CuAssertIntEquals(tc, 8, flags);
   }
 
-  unpad = serf_bucket_http2_unpad_create(unframe, TRUE, alloc);
+  unpad = serf__bucket_http2_unpad_create(unframe, TRUE, alloc);
 
-  CuAssertTrue(tc, SERF_BUCKET_IS_HTTP2_UNPAD(unpad));
+  CuAssertTrue(tc, SERF__BUCKET_IS_HTTP2_UNPAD(unpad));
 
   status = read_all(unpad, result1, sizeof(result1), &read_len);
   CuAssertIntEquals(tc, APR_EOF, status);
@@ -1899,11 +1901,11 @@ static void test_http2_unpad_buckets(CuT
   read_and_check_bucket(tc, raw, "Extra");
 
   raw = serf_bucket_simple_create("\0a", 2, NULL, NULL, alloc);
-  unpad = serf_bucket_http2_unpad_create(raw, TRUE, alloc);
+  unpad = serf__bucket_http2_unpad_create(raw, TRUE, alloc);
   read_and_check_bucket(tc, unpad, "a");
 
   raw = serf_bucket_simple_create("\5a", 2, NULL, NULL, alloc);
-  unpad = serf_bucket_http2_unpad_create(raw, TRUE, alloc);
+  unpad = serf__bucket_http2_unpad_create(raw, TRUE, alloc);
 
   {
     const char *data;
@@ -2135,14 +2137,14 @@ static void test_hpack_header_encode(CuT
 
   alloc = serf_bucket_allocator_create(tb->pool, NULL, NULL);
 
-  hpack = serf_bucket_hpack_create(NULL, alloc);
+  hpack = serf__bucket_hpack_create(NULL, alloc);
 
   CuAssertTrue(tc, SERF_BUCKET_IS_HPACK(hpack));
 
-  serf_bucket_hpack_setc(hpack, ":method", "PUT");
-  serf_bucket_hpack_setc(hpack, ":scheme", "https");
-  serf_bucket_hpack_setc(hpack, ":path", "/");
-  serf_bucket_hpack_setc(hpack, ":authority", "localhost");
+  serf__bucket_hpack_setc(hpack, ":method", "PUT");
+  serf__bucket_hpack_setc(hpack, ":scheme", "https");
+  serf__bucket_hpack_setc(hpack, ":path", "/");
+  serf__bucket_hpack_setc(hpack, ":authority", "localhost");
 
   CuAssertIntEquals(tc, APR_EOF,
                     read_all(hpack, resultbuffer, sizeof(resultbuffer), &sz));
@@ -2166,10 +2168,10 @@ static void test_http2_frame_bucket_basi
   alloc = serf_bucket_allocator_create(tb->pool, NULL, NULL);
 
   body_in = SERF_BUCKET_SIMPLE_STRING("This is no config!", alloc);
-  frame_in = serf_bucket_http2_frame_create(body_in, 99, 7, &exp_streamid,
-                                            NULL, NULL,
-                                            16384, NULL, NULL, alloc);
-  frame_out = serf_bucket_http2_unframe_create(frame_in, FALSE, 16384, alloc);
+  frame_in = serf__bucket_http2_frame_create(body_in, 99, 7, &exp_streamid,
+                                             NULL, NULL,
+                                             16384, NULL, NULL, alloc);
+  frame_out = serf__bucket_http2_unframe_create(frame_in, FALSE, 16384, alloc);
 
   read_and_check_bucket(tc, frame_out, "This is no config!");
 
@@ -2181,8 +2183,8 @@ static void test_http2_frame_bucket_basi
     apr_size_t sz;
 
     CuAssertIntEquals(tc, 0,
-                      serf_bucket_http2_unframe_read_info(frame_out, &streamid,
-                                                          &frametype, &flags));
+                      serf__bucket_http2_unframe_read_info(frame_out, 
&streamid,
+                                                           &frametype, 
&flags));
     CuAssertIntEquals(tc, 0x01020304, streamid);
     CuAssertIntEquals(tc, 99, frametype);
     CuAssertIntEquals(tc, 7, flags);


Reply via email to