]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MAJOR: chunks: replace struct chunk with struct buffer
authorWilly Tarreau <w@1wt.eu>
Fri, 13 Jul 2018 09:56:34 +0000 (11:56 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 19 Jul 2018 14:23:43 +0000 (16:23 +0200)
Now all the code used to manipulate chunks uses a struct buffer instead.
The functions are still called "chunk*", and some of them will progressively
move to the generic buffer handling code as they are cleaned up.

55 files changed:
contrib/hpack/decode.c
contrib/mod_defender/defender.c
doc/internals/filters.txt
include/common/chunk.h
include/common/hpack-dec.h
include/common/hpack-enc.h
include/common/standard.h
include/proto/action.h
include/proto/channel.h
include/proto/filters.h
include/proto/proto_http.h
include/proto/server.h
include/proto/spoe.h
include/proto/ssl_sock.h
include/proto/stats.h
include/proto/stream_interface.h
include/types/applet.h
include/types/arg.h
include/types/connection.h
include/types/filters.h
include/types/global.h
include/types/proto_http.h
include/types/proxy.h
include/types/sample.h
src/51d.c
src/cache.c
src/checks.c
src/chunk.c
src/cli.c
src/connection.c
src/da.c
src/filters.c
src/flt_spoe.c
src/flt_trace.c
src/hlua.c
src/hlua_fcn.c
src/hpack-dec.c
src/hpack-enc.c
src/log.c
src/map.c
src/mux_h2.c
src/pattern.c
src/peers.c
src/proto_http.c
src/proxy.c
src/sample.c
src/server.c
src/session.c
src/ssl_sock.c
src/standard.c
src/stats.c
src/stick_table.c
src/stream.c
src/stream_interface.c
src/wurfl.c

index 6f575eb07899cc56f369aaab934581fd6e7dfe37..006c9097bf514da194e459ac7fc52bab2e1529e7 100644 (file)
@@ -29,8 +29,8 @@ uint8_t buf[MAX_RQ_SIZE];
 char trash_buf[MAX_RQ_SIZE];
 char tmp_buf[MAX_RQ_SIZE];
 
-struct chunk trash = { .area = trash_buf, .data = 0, .size = sizeof(trash_buf) };
-struct chunk tmp   = { .area = tmp_buf,   .data = 0, .size = sizeof(tmp_buf)   };
+struct buffer trash = { .area = trash_buf, .data = 0, .size = sizeof(trash_buf) };
+struct buffer tmp   = { .area = tmp_buf,   .data = 0, .size = sizeof(tmp_buf)   };
 
 /* displays a <len> long memory block at <buf>, assuming first byte of <buf>
  * has address <baseaddr>. String <pfx> may be placed as a prefix in front of
index 789db71d49e9c79257d9bd0f47829fa90ebdce54..03f12a2727db8b9a487b75845e187d873d2f45c4 100644 (file)
@@ -75,7 +75,7 @@ static const apr_bucket_type_t apr_bucket_type_defender = {
 
 struct apr_bucket_defender {
        apr_bucket_refcount refcount;
-       struct chunk buf;
+       struct buffer buf;
 };
 
 static apr_status_t defender_bucket_read(apr_bucket *b, const char **str,
@@ -97,7 +97,8 @@ static void defender_bucket_destroy(void *data)
                apr_bucket_free(d);
 }
 
-static apr_bucket *defender_bucket_make(apr_bucket *b, const struct chunk *buf)
+static apr_bucket *defender_bucket_make(apr_bucket *b,
+                                       const struct buffer *buf)
 {
        struct apr_bucket_defender *d;
 
@@ -112,7 +113,7 @@ static apr_bucket *defender_bucket_make(apr_bucket *b, const struct chunk *buf)
        return b;
 }
 
-static apr_bucket *defender_bucket_create(const struct chunk *buf,
+static apr_bucket *defender_bucket_create(const struct buffer *buf,
                                           apr_bucket_alloc_t *list)
 {
        apr_bucket *b = apr_bucket_alloc(sizeof(*b), list);
@@ -458,11 +459,11 @@ int defender_process_request(struct worker *worker, struct defender_request *req
        struct apr_bucket_brigade *bb = NULL;
        struct apr_bucket *d = NULL, *e = NULL;
 
-       struct chunk *method;
-       struct chunk *path;
-       struct chunk *query;
-       struct chunk *version;
-       struct chunk *body;
+       struct buffer *method;
+       struct buffer *path;
+       struct buffer *query;
+       struct buffer *version;
+       struct buffer *body;
 
        struct defender_header hdr;
        char *hdr_ptr, *hdr_end;
index 75c640ce7e1466aa210c47ad35f40222cfb2cfd2..7b5144ad6b80ec92027a257238fc39cf31c918b2 100644 (file)
@@ -229,7 +229,7 @@ existing callbacks. Available callbacks are listed in the following structure:
                                     struct http_msg *msg);
         void (*http_reply)         (struct stream *s, struct filter *f,
                                     short status,
-                                    const struct chunk *msg);
+                                    const struct buffer *msg);
 
         /*
          * TCP callbacks
index b9c1d2066f09e835e06e8604592abdd17c78127b..a127f9af410ceb017af98f23e0d9a92c288e2841 100644 (file)
 #include <stdlib.h>
 #include <string.h>
 
+#include <common/buf.h>
 #include <common/config.h>
 #include <common/memory.h>
 
 
-/* describes a chunk of string */
-struct chunk {
-       char *area;                 /* points to <size> bytes */
-       size_t size;              /* buffer size in bytes */
-       size_t data;              /* amount of data after head including wrapping */
-};
-
 struct pool_head *pool_head_trash;
 
 /* function prototypes */
 
-int chunk_printf(struct chunk *chk, const char *fmt, ...)
+int chunk_printf(struct buffer *chk, const char *fmt, ...)
        __attribute__ ((format(printf, 2, 3)));
 
-int chunk_appendf(struct chunk *chk, const char *fmt, ...)
+int chunk_appendf(struct buffer *chk, const char *fmt, ...)
        __attribute__ ((format(printf, 2, 3)));
 
-int chunk_htmlencode(struct chunk *dst, struct chunk *src);
-int chunk_asciiencode(struct chunk *dst, struct chunk *src, char qc);
-int chunk_strcmp(const struct chunk *chk, const char *str);
-int chunk_strcasecmp(const struct chunk *chk, const char *str);
-struct chunk *get_trash_chunk(void);
-struct chunk *alloc_trash_chunk(void);
+int chunk_htmlencode(struct buffer *dst, struct buffer *src);
+int chunk_asciiencode(struct buffer *dst, struct buffer *src, char qc);
+int chunk_strcmp(const struct buffer *chk, const char *str);
+int chunk_strcasecmp(const struct buffer *chk, const char *str);
+struct buffer *get_trash_chunk(void);
+struct buffer *alloc_trash_chunk(void);
 int init_trash_buffers(int first);
 void deinit_trash_buffers(void);
 
 /*
  * free a trash chunk allocated by alloc_trash_chunk(). NOP on NULL.
  */
-static inline void free_trash_chunk(struct chunk *chunk)
+static inline void free_trash_chunk(struct buffer *chunk)
 {
        pool_free(pool_head_trash, chunk);
 }
 
 
-static inline void chunk_reset(struct chunk *chk)
+static inline void chunk_reset(struct buffer *chk)
 {
        chk->data  = 0;
 }
 
-static inline void chunk_init(struct chunk *chk, char *str, size_t size)
+static inline void chunk_init(struct buffer *chk, char *str, size_t size)
 {
-       chk->area  = str;
-       chk->data  = 0;
+       chk->area = str;
+       chk->head = 0;
+       chk->data = 0;
        chk->size = size;
 }
 
 /* report 0 in case of error, 1 if OK. */
-static inline int chunk_initlen(struct chunk *chk, char *str, size_t size, int len)
+static inline int chunk_initlen(struct buffer *chk, char *str, size_t size,
+                               int len)
 {
 
        if (len < 0 || (size && len > size))
                return 0;
 
-       chk->area  = str;
-       chk->data  = len;
+       chk->area = str;
+       chk->head = 0;
+       chk->data = len;
        chk->size = size;
 
        return 1;
 }
 
 /* this is only for temporary manipulation, the chunk is read-only */
-static inline void chunk_initstr(struct chunk *chk, const char *str)
+static inline void chunk_initstr(struct buffer *chk, const char *str)
 {
        chk->area = (char *)str;
+       chk->head = 0;
        chk->data = strlen(str);
        chk->size = 0;                  /* mark it read-only */
 }
@@ -101,7 +99,8 @@ static inline void chunk_initstr(struct chunk *chk, const char *str)
 /* copies memory area <src> into <chk> for <len> bytes. Returns 0 in
  * case of failure. No trailing zero is added.
  */
-static inline int chunk_memcpy(struct chunk *chk, const char *src, size_t len)
+static inline int chunk_memcpy(struct buffer *chk, const char *src,
+                              size_t len)
 {
        if (unlikely(len >= chk->size))
                return 0;
@@ -115,7 +114,8 @@ static inline int chunk_memcpy(struct chunk *chk, const char *src, size_t len)
 /* appends memory area <src> after <chk> for <len> bytes. Returns 0 in
  * case of failure. No trailing zero is added.
  */
-static inline int chunk_memcat(struct chunk *chk, const char *src, size_t len)
+static inline int chunk_memcat(struct buffer *chk, const char *src,
+                              size_t len)
 {
        if (unlikely(chk->data < 0 || chk->data + len >= chk->size))
                return 0;
@@ -128,7 +128,7 @@ static inline int chunk_memcat(struct chunk *chk, const char *src, size_t len)
 /* copies str into <chk> followed by a trailing zero. Returns 0 in
  * case of failure.
  */
-static inline int chunk_strcpy(struct chunk *chk, const char *str)
+static inline int chunk_strcpy(struct buffer *chk, const char *str)
 {
        size_t len;
 
@@ -146,7 +146,7 @@ static inline int chunk_strcpy(struct chunk *chk, const char *str)
 /* appends str after <chk> followed by a trailing zero. Returns 0 in
  * case of failure.
  */
-static inline int chunk_strcat(struct chunk *chk, const char *str)
+static inline int chunk_strcat(struct buffer *chk, const char *str)
 {
        size_t len;
 
@@ -163,7 +163,7 @@ static inline int chunk_strcat(struct chunk *chk, const char *str)
 /* appends <nb> characters from str after <chk>.
  * Returns 0 in case of failure.
  */
-static inline int chunk_strncat(struct chunk *chk, const char *str, int nb)
+static inline int chunk_strncat(struct buffer *chk, const char *str, int nb)
 {
        if (unlikely(chk->data < 0 || chk->data + nb >= chk->size))
                return 0;
@@ -185,7 +185,7 @@ static inline int chunk_strncat(struct chunk *chk, const char *str, int nb)
  *   chunk_appendf(&trash, "%s", gethosname());
  *   printf("hostname=<%s>, pid=<%d>\n", name, pid);
  */
-static inline char *chunk_newstr(struct chunk *chk)
+static inline char *chunk_newstr(struct buffer *chk)
 {
        if (chk->data < 0 || chk->data + 1 >= chk->size)
                return NULL;
@@ -194,14 +194,14 @@ static inline char *chunk_newstr(struct chunk *chk)
        return chk->area + chk->data;
 }
 
-static inline void chunk_drop(struct chunk *chk)
+static inline void chunk_drop(struct buffer *chk)
 {
        chk->area  = NULL;
        chk->data  = -1;
        chk->size = 0;
 }
 
-static inline void chunk_destroy(struct chunk *chk)
+static inline void chunk_destroy(struct buffer *chk)
 {
        if (!chk->size)
                return;
@@ -217,13 +217,14 @@ static inline void chunk_destroy(struct chunk *chk)
  * the destination string is returned, or NULL if the allocation fails or if
  * any pointer is NULL.
  */
-static inline char *chunk_dup(struct chunk *dst, const struct chunk *src)
+static inline char *chunk_dup(struct buffer *dst, const struct buffer *src)
 {
        if (!dst || !src || src->data < 0 || !src->area)
                return NULL;
 
        if (dst->size)
                free(dst->area);
+       dst->head = src->head;
        dst->data = src->data;
        dst->size = src->data;
        if (dst->size < src->size || !src->size)
@@ -231,6 +232,7 @@ static inline char *chunk_dup(struct chunk *dst, const struct chunk *src)
 
        dst->area = (char *)malloc(dst->size);
        if (!dst->area) {
+               dst->head = 0;
                dst->data = 0;
                dst->size = 0;
                return NULL;
index b03398a49be961fcc14f979cb7c19874226d905f..71039d3beb595f7d64201f818bbd422f5310dffe 100644 (file)
@@ -34,6 +34,7 @@
 #include <common/hpack-tbl.h>
 
 int hpack_decode_frame(struct hpack_dht *dht, const uint8_t *raw, uint32_t len,
-                       struct http_hdr *list, int list_size, struct chunk *tmp);
+                       struct http_hdr *list, int list_size,
+                       struct buffer *tmp);
 
 #endif /* _COMMON_HPACK_DEC_H */
index 0a44dfc70c5f3a68b58c0dda3c8cb21ed456aca5..5246b83cae2bae8a0ae0f181af04cadd35971d44 100644 (file)
@@ -33,6 +33,7 @@
 #include <common/config.h>
 #include <common/ist.h>
 
-int hpack_encode_header(struct chunk *out, const struct ist n, const struct ist v);
+int hpack_encode_header(struct buffer *out, const struct ist n,
+                       const struct ist v);
 
 #endif /* _COMMON_HPACK_ENC_H */
index 6542759d9f1027872c4760239e481f4d53146266..0a956e069f72b3ac33284d808a50a4a6c7a8345a 100644 (file)
@@ -486,7 +486,7 @@ char *encode_string(char *start, char *stop,
  */
 char *encode_chunk(char *start, char *stop,
                    const char escape, const fd_set *map,
-                   const struct chunk *chunk);
+                   const struct buffer *chunk);
 
 /*
  * Tries to prefix characters tagged in the <map> with the <escape>
@@ -509,7 +509,7 @@ char *escape_string(char *start, char *stop,
  */
 char *escape_chunk(char *start, char *stop,
                    const char escape, const fd_set *map,
-                   const struct chunk *chunk);
+                   const struct buffer *chunk);
 
 
 /* Check a string for using it in a CSV output format. If the string contains
@@ -539,10 +539,11 @@ char *escape_chunk(char *start, char *stop,
  * This function appends the encoding to the existing output chunk. Please
  * use csv_enc() instead if you want to replace the output chunk.
  */
-const char *csv_enc_append(const char *str, int quote, struct chunk *output);
+const char *csv_enc_append(const char *str, int quote, struct buffer *output);
 
 /* same as above but the output chunk is reset first */
-static inline const char *csv_enc(const char *str, int quote, struct chunk *output)
+static inline const char *csv_enc(const char *str, int quote,
+                                 struct buffer *output)
 {
        chunk_reset(output);
        return csv_enc_append(str, quote, output);
@@ -1317,9 +1318,9 @@ static inline unsigned long long rdtsc()
 struct list;
 int list_append_word(struct list *li, const char *str, char **err);
 
-int dump_text(struct chunk *out, const char *buf, int bsize);
-int dump_binary(struct chunk *out, const char *buf, int bsize);
-int dump_text_line(struct chunk *out, const char *buf, int bsize, int len,
+int dump_text(struct buffer *out, const char *buf, int bsize);
+int dump_binary(struct buffer *out, const char *buf, int bsize);
+int dump_text_line(struct buffer *out, const char *buf, int bsize, int len,
                    int *line, int ptr);
 
 /* same as realloc() except that ptr is also freed upon failure */
index dcfdeacca0fc362992fc325764bd772c93bf18d4..19312db406b4a09a5cd591fea428835e4f329abb 100644 (file)
@@ -44,7 +44,8 @@ static inline struct action_kw *action_lookup(struct list *keywords, const char
        return NULL;
 }
 
-static inline void action_build_list(struct list *keywords, struct chunk *chk)
+static inline void action_build_list(struct list *keywords,
+                                    struct buffer *chk)
 {
        struct action_kw_list *kw_list;
        int i;
index 10e3602db097dfa88208603f5728b7840824c42d..5a1a36ee5fc5a8d4c1a350f8f483f2f1fdfe5ceb 100644 (file)
@@ -784,7 +784,7 @@ static inline void co_skip(struct channel *chn, int len)
  * Channel flag READ_PARTIAL is updated if some data can be transferred. The
  * chunk's length is updated with the number of bytes sent.
  */
-static inline int ci_putchk(struct channel *chn, struct chunk *chunk)
+static inline int ci_putchk(struct channel *chn, struct buffer *chunk)
 {
        int ret;
 
index 1be163783440fdba32709d7d7b1b0dd28733b1f1..d16f70651c98624db9bc7f0941aa0cde670c1362 100644 (file)
@@ -111,7 +111,7 @@ int  flt_http_end(struct stream *s, struct http_msg *msg);
 int  flt_http_forward_data(struct stream *s, struct http_msg *msg, unsigned int len);
 
 void flt_http_reset(struct stream *s, struct http_msg *msg);
-void flt_http_reply(struct stream *s, short status, const struct chunk *msg);
+void flt_http_reply(struct stream *s, short status, const struct buffer *msg);
 
 int  flt_start_analyze(struct stream *s, struct channel *chn, unsigned int an_bit);
 int  flt_pre_analyze(struct stream *s, struct channel *chn, unsigned int an_bit);
index d3b1f439edc5524ff1ed8d4f633be3b035bda00b..49cb501e416c59b0577776db34ed893971ba1e02 100644 (file)
@@ -45,7 +45,7 @@
  */
 
 extern const int http_err_codes[HTTP_ERR_SIZE];
-extern struct chunk http_err_chunks[HTTP_ERR_SIZE];
+extern struct buffer http_err_chunks[HTTP_ERR_SIZE];
 extern const char *HTTP_302;
 extern const char *HTTP_303;
 
@@ -119,8 +119,8 @@ struct act_rule *parse_http_req_cond(const char **args, const char *file, int li
 struct act_rule *parse_http_res_cond(const char **args, const char *file, int linenum, struct proxy *proxy);
 void free_http_req_rules(struct list *r);
 void free_http_res_rules(struct list *r);
-void http_reply_and_close(struct stream *s, short status, struct chunk *msg);
-struct chunk *http_error_message(struct stream *s);
+void http_reply_and_close(struct stream *s, short status, struct buffer *msg);
+struct buffer *http_error_message(struct stream *s);
 struct redirect_rule *http_parse_redirect_rule(const char *file, int linenum, struct proxy *curproxy,
                                                const char **args, char **errmsg, int use_fmt, int dir);
 int smp_fetch_cookie(const struct arg *args, struct sample *smp, const char *kw, void *private);
index 14f4926e286410b6900fb4cd3c3e46c63f0ad3da..3378c2bc1ed5c1274d8170ade1a6b7b26c2954d5 100644 (file)
@@ -150,7 +150,8 @@ void srv_shutdown_streams(struct server *srv, int why);
  */
 void srv_shutdown_backup_streams(struct proxy *px, int why);
 
-void srv_append_status(struct chunk *msg, struct server *s, struct check *, int xferred, int forced);
+void srv_append_status(struct buffer *msg, struct server *s, struct check *,
+                      int xferred, int forced);
 
 void srv_set_stopped(struct server *s, const char *reason, struct check *check);
 void srv_set_running(struct server *s, const char *reason, struct check *check);
index 299836bb0fc55e03c24a305a5490395e4b618e1a..b6c4ee2cc37c19ace14868e52515275d0debb6f4 100644 (file)
@@ -164,7 +164,7 @@ spoe_encode_data(struct sample *smp, unsigned int *off, char **buf, char *end)
 
                case SMP_T_STR:
                case SMP_T_BIN: {
-                       struct chunk *chk = &smp->data.u.str;
+                       struct buffer *chk = &smp->data.u.str;
 
                        /* Here, we need to know if the sample has already been
                         * partially encoded. If yes, we only need to encode the
@@ -175,7 +175,7 @@ spoe_encode_data(struct sample *smp, unsigned int *off, char **buf, char *end)
                                 * type (string or binary), the buffer length
                                 * (as a varint) and at least 1 byte of the
                                 * buffer. */
-                               struct chunk *chk = &smp->data.u.str;
+                               struct buffer *chk = &smp->data.u.str;
 
                                *p++ = (smp->data.type == SMP_T_STR)
                                        ? SPOE_DATA_T_STR
index c6075eb7c04ad1050b68c903fa1b92ff9ec09fba..f04317ae9bcb970ba42f312560538f3b4c2a710d 100644 (file)
@@ -57,15 +57,17 @@ const char *ssl_sock_get_proto_version(struct connection *conn);
 void ssl_sock_set_servername(struct connection *conn, const char *hostname);
 int ssl_sock_get_cert_used_sess(struct connection *conn);
 int ssl_sock_get_cert_used_conn(struct connection *conn);
-int ssl_sock_get_remote_common_name(struct connection *conn, struct chunk *out);
-int ssl_sock_get_pkey_algo(struct connection *conn, struct chunk *out);
+int ssl_sock_get_remote_common_name(struct connection *conn,
+                                   struct buffer *out);
+int ssl_sock_get_pkey_algo(struct connection *conn, struct buffer *out);
 unsigned int ssl_sock_get_verify_result(struct connection *conn);
 #if (defined SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB && !defined OPENSSL_NO_OCSP)
-int ssl_sock_update_ocsp_response(struct chunk *ocsp_response, char **err);
+int ssl_sock_update_ocsp_response(struct buffer *ocsp_response, char **err);
 #endif
 #if (defined SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB && TLS_TICKETS_NO > 0)
-void ssl_sock_update_tlskey_ref(struct tls_keys_ref *ref, struct chunk *tlskey);
-int ssl_sock_update_tlskey(char *filename, struct chunk *tlskey, char **err);
+void ssl_sock_update_tlskey_ref(struct tls_keys_ref *ref,
+                               struct buffer *tlskey);
+int ssl_sock_update_tlskey(char *filename, struct buffer *tlskey, char **err);
 struct tls_keys_ref *tlskeys_ref_lookup(const char *filename);
 struct tls_keys_ref *tlskeys_ref_lookupid(int unique_id);
 #endif
index ac893b843c189e2fef03864a02b3697c28affc7b..02a3506d336a9ac0b2be615bef630b91b72d7348 100644 (file)
@@ -101,9 +101,10 @@ int stats_fill_be_stats(struct proxy *px, int flags, struct field *stats, int le
 extern struct applet http_stats_applet;
 
 void stats_io_handler(struct stream_interface *si);
-int stats_emit_raw_data_field(struct chunk *out, const struct field *f);
-int stats_emit_typed_data_field(struct chunk *out, const struct field *f);
-int stats_emit_field_tags(struct chunk *out, const struct field *f, char delim);
+int stats_emit_raw_data_field(struct buffer *out, const struct field *f);
+int stats_emit_typed_data_field(struct buffer *out, const struct field *f);
+int stats_emit_field_tags(struct buffer *out, const struct field *f,
+                         char delim);
 
 #endif /* _PROTO_STATS_H */
 
index 03756ba220835dd6b38b885b375230f8a20b36ff..7fcd4c8ce9dc3a3859a63272e58b7a52c9a35eb1 100644 (file)
@@ -36,7 +36,8 @@
 /* main event functions used to move data between sockets and buffers */
 int stream_int_check_timeouts(struct stream_interface *si);
 void stream_int_report_error(struct stream_interface *si);
-void stream_int_retnclose(struct stream_interface *si, const struct chunk *msg);
+void stream_int_retnclose(struct stream_interface *si,
+                         const struct buffer *msg);
 int conn_si_send_proxy(struct connection *conn, unsigned int flag);
 void stream_sock_read0(struct stream_interface *si);
 
index 8b7c28fc01786a63d603829bcb4ac15b63b5d0a6..d4172bd3333fd170dca7192f0b2ed2ee707c5477 100644 (file)
@@ -57,7 +57,7 @@ struct appctx {
        unsigned short state;      /* Internal appctx state */
        unsigned int st0;          /* CLI state for stats, session state for peers */
        unsigned int st1;          /* prompt/payload (bitwise OR of APPCTX_CLI_ST1_*) for stats, session error for peers */
-       struct chunk *chunk;       /* used to store unfinished commands */
+       struct buffer *chunk;       /* used to store unfinished commands */
        unsigned int st2;          /* output state for stats, unused by peers  */
        struct applet *applet;     /* applet this context refers to */
        void *owner;               /* pointer to upper layer's entity (eg: stream interface) */
@@ -150,7 +150,7 @@ struct appctx {
                        struct pat_ref *ref;
                        struct bref bref;       /* back-reference from the pat_ref_elt being dumped */
                        struct pattern_expr *expr;
-                       struct chunk chunk;
+                       struct buffer chunk;
                } map;
                struct {
                        struct hlua *hlua;
index c3b09deffff9071617a5863e6a37ad2b76e56f03..96974ba880d1b4129c3ddf121ffae5b150f7cedd 100644 (file)
@@ -92,7 +92,7 @@ struct my_regex;
 
 union arg_data {
        long long int sint;
-       struct chunk str;
+       struct buffer str;
        struct in_addr ipv4;
        struct in6_addr ipv6;
        struct proxy *prx; /* used for fe, be, tables */
index 624e01e5139a4a37b0c6bc4df9d41861157a58f9..ad406acd34a8228d8c68eb41dc595c0313365105 100644 (file)
@@ -311,7 +311,7 @@ struct mux_ops {
 
        struct conn_stream *(*attach)(struct connection *); /* Create and attach a conn_stream to an outgoing connection */
        void (*detach)(struct conn_stream *); /* Detach a conn_stream from an outgoing connection, when the request is done */
-       void (*show_fd)(struct chunk *, struct connection *); /* append some data about connection into chunk for "show fd" */
+       void (*show_fd)(struct buffer *, struct connection *); /* append some data about connection into chunk for "show fd" */
        unsigned int flags;                           /* some flags characterizing the mux's capabilities (MX_FL_*) */
        char name[8];                                 /* mux layer name, zero-terminated */
 };
index 488a97fa3060d2640c49b7046ad9498798e4d6e7..714cee9666218c60adc5ab7cb4ed7369b36a10fd 100644 (file)
@@ -189,7 +189,7 @@ struct flt_ops {
 
        void (*http_reset)         (struct stream *s, struct filter *f, struct http_msg *msg);
        void (*http_reply)         (struct stream *s, struct filter *f, short status,
-                                   const struct chunk *msg);
+                                   const struct buffer *msg);
 
        /*
         * TCP callbacks
index 2ab124b6294f946750ec938b188d03768b4501f5..a684ea6dd74c3a32398900e90c69ed03ea6a5bc2 100644 (file)
@@ -127,7 +127,7 @@ struct global {
        char *chroot;
        char *pidfile;
        char *node, *desc;              /* node name & description */
-       struct chunk log_tag;           /* name for syslog */
+       struct buffer log_tag;           /* name for syslog */
        struct list logsrvs;
        char *log_send_hostname;   /* set hostname in syslog header */
        char *server_state_base;   /* path to a directory where server state files can be found */
@@ -207,7 +207,7 @@ extern unsigned long pid_bit;   /* bit corresponding to the process id */
 extern int  actconn;            /* # of active sessions */
 extern int  listeners;
 extern int  jobs;               /* # of active jobs (listeners, sessions, open devices) */
-extern THREAD_LOCAL struct chunk trash;
+extern THREAD_LOCAL struct buffer trash;
 extern int nb_oldpids;          /* contains the number of old pids found */
 extern const int zero;
 extern const int one;
index 5a6cc931291d3ad4b9f9b53a3227ce03e1fe8d14..9c3905639298593be2de0d1656c210a238fbbe22 100644 (file)
@@ -301,7 +301,7 @@ struct http_msg {
 struct http_auth_data {
        enum ht_auth_m method;                /* one of HTTP_AUTH_* */
        /* 7 bytes unused here */
-       struct chunk method_data;             /* points to the creditial part from 'Authorization:' header */
+       struct buffer method_data;             /* points to the creditial part from 'Authorization:' header */
        char *user, *pass;                    /* extracted username & password */
 };
 
index 16c13a1c1a72a7d2589dbd2a5ea0125dc3423933..ec95286b6b955ef421cabcfc4ad80dd0914a24b5 100644 (file)
@@ -356,7 +356,7 @@ struct proxy {
        struct list logsrvs;
        struct list logformat;                  /* log_format linked list */
        struct list logformat_sd;               /* log_format linked list for the RFC5424 structured-data part */
-       struct chunk log_tag;                   /* override default syslog tag */
+       struct buffer log_tag;                   /* override default syslog tag */
        char *header_unique_id;                 /* unique-id header */
        struct list format_unique_id;           /* unique-id format */
        int to_log;                             /* things to be logged (LW_*) */
@@ -384,7 +384,7 @@ struct proxy {
        char *check_path;                       /* PATH environment to use for external agent checks */
        char *expect_str;                       /* http-check expected content : string or text version of the regex */
        struct my_regex *expect_regex;          /* http-check expected content */
-       struct chunk errmsg[HTTP_ERR_SIZE];     /* default or customized error messages for known errors */
+       struct buffer errmsg[HTTP_ERR_SIZE];    /* default or customized error messages for known errors */
        int uuid;                               /* universally unique proxy ID, used for SNMP */
        unsigned int backlog;                   /* force the frontend's listen backlog */
        unsigned long bind_proc;                /* bitmask of processes using this proxy */
index cf0528edc22d894af2ce96b3550ad1984c8c3880..987a099a2857f3fc36a23165f6ed78b20f01a3eb 100644 (file)
@@ -244,14 +244,14 @@ union smp_ctx {
  */
 struct meth {
        enum http_meth_t meth;
-       struct chunk str;
+       struct buffer str;
 };
 
 union sample_value {
        long long int   sint;  /* used for signed 64bits integers */
        struct in_addr  ipv4;  /* used for ipv4 addresses */
        struct in6_addr ipv6;  /* used for ipv6 addresses */
-       struct chunk    str;   /* used for char strings or buffers */
+       struct buffer    str;   /* used for char strings or buffers */
        struct meth     meth;  /* used for http method */
 };
 
index 4ad82fe5666e942796f94d33da498ceef89211a6..687528e683bb8b869e93e5f902441d3145f56c18 100644 (file)
--- a/src/51d.c
+++ b/src/51d.c
@@ -27,7 +27,7 @@ static struct {
        struct list property_names; /* list of properties to load into the data set. this is taken from 51degrees-property-name-list from config. */
        char *data_file_path;
        int header_count; /* number of HTTP headers related to device detection. */
-       struct chunk *header_names; /* array of HTTP header names. */
+       struct buffer *header_names; /* array of HTTP header names. */
        fiftyoneDegreesDataSet data_set; /* data set used with the pattern and trie detection methods. */
 #ifdef FIFTYONEDEGREES_H_PATTERN_INCLUDED
        fiftyoneDegreesWorksetPool *pool; /* pool of worksets to avoid creating a new one for each request. */
@@ -155,7 +155,7 @@ static int _51d_conv_check(struct arg *arg, struct sample_conv *conv,
 #ifdef FIFTYONEDEGREES_H_PATTERN_INCLUDED
 static void _51d_lru_free(void *cache_entry)
 {
-       struct chunk *ptr = cache_entry;
+       struct buffer *ptr = cache_entry;
 
        if (!ptr)
                return;
@@ -184,7 +184,7 @@ static void *_51d_malloc(int size)
  */
 static void _51d_insert_cache_entry(struct sample *smp, struct lru64 *lru, void* domain)
 {
-       struct chunk *cache_entry = _51d_malloc(sizeof(*cache_entry));
+       struct buffer *cache_entry = _51d_malloc(sizeof(*cache_entry));
 
        if (!cache_entry)
                return;
@@ -205,7 +205,7 @@ static void _51d_insert_cache_entry(struct sample *smp, struct lru64 *lru, void*
  */
 static void _51d_retrieve_cache_entry(struct sample *smp, struct lru64 *lru)
 {
-       struct chunk *cache_entry = lru->data;
+       struct buffer *cache_entry = lru->data;
        smp->data.u.str.area = cache_entry->area;
        smp->data.u.str.data = cache_entry->data;
 }
@@ -300,7 +300,7 @@ static void _51d_process_match(const struct arg *args, struct sample *smp)
 #endif
 
        char no_data[] = "NoData";  /* response when no data could be found */
-       struct chunk *temp = get_trash_chunk();
+       struct buffer *temp = get_trash_chunk();
        int j, i = 0, found;
        const char* property_name;
 
@@ -503,7 +503,7 @@ void _51d_init_http_headers()
        const fiftyoneDegreesAsciiString *headerName;
        fiftyoneDegreesDataSet *ds = &global_51degrees.data_set;
        global_51degrees.header_count = ds->httpHeadersCount;
-       global_51degrees.header_names = malloc(global_51degrees.header_count * sizeof(struct chunk));
+       global_51degrees.header_names = malloc(global_51degrees.header_count * sizeof(struct buffer));
        for (index = 0; index < global_51degrees.header_count; index++) {
                headerName = fiftyoneDegreesGetString(ds, ds->httpHeaders[index].headerNameOffset);
                (global_51degrees.header_names + index)->area = (char*)&headerName->firstByte;
@@ -521,7 +521,7 @@ void _51d_init_http_headers()
        global_51degrees.header_count = fiftyoneDegreesGetHttpHeaderCount(ds);
        global_51degrees.device_offsets.firstOffset = malloc(
                global_51degrees.header_count * sizeof(fiftyoneDegreesDeviceOffset));
-       global_51degrees.header_names = malloc(global_51degrees.header_count * sizeof(struct chunk));
+       global_51degrees.header_names = malloc(global_51degrees.header_count * sizeof(struct buffer));
        global_51degrees.header_offsets = malloc(global_51degrees.header_count * sizeof(int32_t));
        for (index = 0; index < global_51degrees.header_count; index++) {
                global_51degrees.header_offsets[index] = fiftyoneDegreesGetHttpHeaderNameOffset(ds, index);
@@ -538,7 +538,7 @@ void _51d_init_http_headers()
 static int init_51degrees(void)
 {
        int i = 0;
-       struct chunk *temp;
+       struct buffer *temp;
        struct _51d_property_names *name;
        char **_51d_property_list = NULL;
        fiftyoneDegreesDataSetInitStatus _51d_dataset_status = DATA_SET_INIT_STATUS_NOT_SET;
index 4143edc03d23bca3cd7222f14f555a8c8c4350ad..f58c3cc4ad4ddad09f69b226e6910925928290f5 100644 (file)
@@ -345,7 +345,7 @@ int http_calc_maxage(struct stream *s, struct cache *cache)
 
                value = directive_value(directive, ctx.vlen, "s-maxage", 8);
                if (value) {
-                       struct chunk *chk = get_trash_chunk();
+                       struct buffer *chk = get_trash_chunk();
 
                        chunk_strncat(chk, value, ctx.vlen - 8 + 1);
                        chunk_strncat(chk, "", 1);
@@ -354,7 +354,7 @@ int http_calc_maxage(struct stream *s, struct cache *cache)
 
                value = directive_value(ctx.line + ctx.val, ctx.vlen, "max-age", 7);
                if (value) {
-                       struct chunk *chk = get_trash_chunk();
+                       struct buffer *chk = get_trash_chunk();
 
                        chunk_strncat(chk, value, ctx.vlen - 7 + 1);
                        chunk_strncat(chk, "", 1);
@@ -637,7 +637,7 @@ int sha1_hosturi(struct http_txn *txn)
        struct hdr_ctx ctx;
 
        blk_SHA_CTX sha1_ctx;
-       struct chunk *trash;
+       struct buffer *trash;
        char *path;
        char *end;
        trash = get_trash_chunk();
index 5100c7ec58b5b6637c397bad160344c115ee86b3..c7b5c30a9289bef7a185cbd679b253fb9b0aee11 100644 (file)
@@ -587,7 +587,7 @@ static void chk_report_conn_err(struct check *check, int errno_bck, int expired)
        struct conn_stream *cs = check->cs;
        struct connection *conn = cs_conn(cs);
        const char *err_msg;
-       struct chunk *chk;
+       struct buffer *chk;
        int step;
        char *comment;
 
@@ -1103,7 +1103,7 @@ static void event_srv_chk_r(struct conn_stream *cs)
                         * ERR first, then WARN.
                         */
                        const char *msg = cmd;
-                       struct chunk *t;
+                       struct buffer *t;
 
                        if (!*msg || status == HCHK_STATUS_L7OKD) {
                                if (err && *err)
index f655277d51922ab0c5c9e20e968271c4bb7c0638..56070e28ac5c09ce04188c8102368c6db3184131 100644 (file)
@@ -22,9 +22,9 @@
 #include <types/global.h>
 
 /* trash chunks used for various conversions */
-static THREAD_LOCAL struct chunk *trash_chunk;
-static THREAD_LOCAL struct chunk trash_chunk1;
-static THREAD_LOCAL struct chunk trash_chunk2;
+static THREAD_LOCAL struct buffer *trash_chunk;
+static THREAD_LOCAL struct buffer trash_chunk1;
+static THREAD_LOCAL struct buffer trash_chunk2;
 
 /* trash buffers used for various conversions */
 static int trash_size;
@@ -35,7 +35,7 @@ static THREAD_LOCAL char *trash_buf2;
 struct pool_head *pool_head_trash = NULL;
 
 /* this is used to drain data, and as a temporary buffer for sprintf()... */
-THREAD_LOCAL struct chunk trash = { };
+THREAD_LOCAL struct buffer trash = { };
 
 /*
 * Returns a pre-allocated and initialized trash chunk that can be used for any
@@ -46,7 +46,7 @@ THREAD_LOCAL struct chunk trash = { };
 * a zero is always emitted at the beginning of the string so that it may be
 * used as an empty string as well.
 */
-struct chunk *get_trash_chunk(void)
+struct buffer *get_trash_chunk(void)
 {
        char *trash_buf;
 
@@ -97,7 +97,9 @@ int init_trash_buffers(int first)
                hap_register_per_thread_deinit(deinit_trash_buffers_per_thread);
        }
        pool_destroy(pool_head_trash);
-       pool_head_trash = create_pool("trash", sizeof(struct chunk) + global.tune.bufsize, MEM_F_EXACT);
+       pool_head_trash = create_pool("trash",
+                                     sizeof(struct buffer) + global.tune.bufsize,
+                                     MEM_F_EXACT);
        if (!pool_head_trash || !alloc_trash_buffers(global.tune.bufsize))
                return 0;
        return 1;
@@ -117,15 +119,16 @@ void deinit_trash_buffers(void)
  * call may fail and the caller is responsible for checking that the returned
  * pointer is not NULL.
  */
-struct chunk *alloc_trash_chunk(void)
+struct buffer *alloc_trash_chunk(void)
 {
-       struct chunk *chunk;
+       struct buffer *chunk;
 
        chunk = pool_alloc(pool_head_trash);
        if (chunk) {
-               char *buf = (char *)chunk + sizeof(struct chunk);
+               char *buf = (char *)chunk + sizeof(struct buffer);
                *buf = 0;
-               chunk_init(chunk, buf, pool_head_trash->size - sizeof(struct chunk));
+               chunk_init(chunk, buf,
+                          pool_head_trash->size - sizeof(struct buffer));
        }
        return chunk;
 }
@@ -135,7 +138,7 @@ struct chunk *alloc_trash_chunk(void)
  * at most chk->size chars. If the chk->len is over, nothing is added. Returns
  * the new chunk size, or < 0 in case of failure.
  */
-int chunk_printf(struct chunk *chk, const char *fmt, ...)
+int chunk_printf(struct buffer *chk, const char *fmt, ...)
 {
        va_list argp;
        int ret;
@@ -160,7 +163,7 @@ int chunk_printf(struct chunk *chk, const char *fmt, ...)
  * at most chk->size chars. If the chk->len is over, nothing is added. Returns
  * the new chunk size.
  */
-int chunk_appendf(struct chunk *chk, const char *fmt, ...)
+int chunk_appendf(struct buffer *chk, const char *fmt, ...)
 {
        va_list argp;
        int ret;
@@ -185,7 +188,7 @@ int chunk_appendf(struct chunk *chk, const char *fmt, ...)
  * chk->size chars. Replace non-printable or special chracters with "&#%d;".
  * If the chk->len is over, nothing is added. Returns the new chunk size.
  */
-int chunk_htmlencode(struct chunk *dst, struct chunk *src)
+int chunk_htmlencode(struct buffer *dst, struct buffer *src)
 {
        int i, l;
        int olen, free;
@@ -230,7 +233,7 @@ int chunk_htmlencode(struct chunk *dst, struct chunk *src)
  * chk->size chars. Replace non-printable or char passed in qc with "<%02X>".
  * If the chk->len is over, nothing is added. Returns the new chunk size.
  */
-int chunk_asciiencode(struct chunk *dst, struct chunk *src, char qc)
+int chunk_asciiencode(struct buffer *dst, struct buffer *src, char qc)
 {
        int i, l;
        int olen, free;
@@ -274,7 +277,7 @@ int chunk_asciiencode(struct chunk *dst, struct chunk *src, char qc)
  * zero-terminated. Return is the same as with strcmp(). Neither is allowed
  * to be null.
  */
-int chunk_strcmp(const struct chunk *chk, const char *str)
+int chunk_strcmp(const struct buffer *chk, const char *str)
 {
        const char *s1 = chk->area;
        int len = chk->data;
@@ -294,7 +297,7 @@ int chunk_strcmp(const struct chunk *chk, const char *str)
  * <str> which must be zero-terminated. Return is the same as with strcmp().
  * Neither is allowed to be null.
  */
-int chunk_strcasecmp(const struct chunk *chk, const char *str)
+int chunk_strcasecmp(const struct buffer *chk, const char *str)
 {
        const char *s1 = chk->area;
        int len = chk->data;
index 4440f251642b1400800bdbb551150c087ee26869..0d3c95c228064fcc77945b480ec9c48aacc7183f 100644 (file)
--- a/src/cli.c
+++ b/src/cli.c
@@ -96,8 +96,8 @@ static char *cli_gen_usage_msg(struct appctx *appctx)
 {
        struct cli_kw_list *kw_list;
        struct cli_kw *kw;
-       struct chunk *tmp = get_trash_chunk();
-       struct chunk out;
+       struct buffer *tmp = get_trash_chunk();
+       struct buffer out;
 
        free(dynamic_usage_msg);
        dynamic_usage_msg = NULL;
@@ -474,7 +474,7 @@ static int cli_parse_request(struct appctx *appctx)
 /* prepends then outputs the argument msg with a syslog-type severity depending on severity_output value */
 static int cli_output_msg(struct channel *chn, const char *msg, int severity, int severity_output)
 {
-       struct chunk *tmp;
+       struct buffer *tmp;
 
        if (likely(severity_output == CLI_SEVERITY_NONE))
                return ci_putblk(chn, msg, strlen(msg));
index ca9a8ca2febc784677c6e256fd8bf0929557b6cc..db869fb0f0e020da67d5c8fa9f0f2887745d3a1e 100644 (file)
@@ -1096,7 +1096,7 @@ int make_proxy_line_v2(char *buf, int buf_len, struct server *srv, struct connec
                                        tlv->client |= PP2_CLIENT_CERT_CONN;
                        }
                        if (srv->pp_opts & SRV_PP_V2_SSL_CN) {
-                               struct chunk *cn_trash = get_trash_chunk();
+                               struct buffer *cn_trash = get_trash_chunk();
                                if (ssl_sock_get_remote_common_name(remote, cn_trash) > 0) {
                                        ssl_tlv_len += make_tlv(&buf[ret+ssl_tlv_len], (buf_len - ret - ssl_tlv_len), PP2_SUBTYPE_SSL_CN,
                                                                cn_trash->data,
@@ -1104,7 +1104,7 @@ int make_proxy_line_v2(char *buf, int buf_len, struct server *srv, struct connec
                                }
                        }
                        if (srv->pp_opts & SRV_PP_V2_SSL_KEY_ALG) {
-                               struct chunk *pkey_trash = get_trash_chunk();
+                               struct buffer *pkey_trash = get_trash_chunk();
                                if (ssl_sock_get_pkey_algo(remote, pkey_trash) > 0) {
                                        ssl_tlv_len += make_tlv(&buf[ret+ssl_tlv_len], (buf_len - ret - ssl_tlv_len), PP2_SUBTYPE_SSL_KEY_ALG,
                                                                pkey_trash->data,
index b21159ce420c88e50d4753b3edcca89b52e76ebe..23da04aed6873fbe32cccb0aa50d6d6c4a0d371a 100644 (file)
--- a/src/da.c
+++ b/src/da.c
@@ -183,7 +183,7 @@ static void deinit_deviceatlas(void)
 
 static int da_haproxy(const struct arg *args, struct sample *smp, da_deviceinfo_t *devinfo)
 {
-       struct chunk *tmp;
+       struct buffer *tmp;
        da_propid_t prop, *pprop;
        da_status_t status;
        da_type_t proptype;
index a4005edf62b3153b87695b9254bb049c40b64513..3956667a426512e3890dedc2c864d2666737fe31 100644 (file)
@@ -667,7 +667,7 @@ flt_http_reset(struct stream *s, struct http_msg *msg)
  * decides to stop the HTTP message processing.
  */
 void
-flt_http_reply(struct stream *s, short status, const struct chunk *msg)
+flt_http_reply(struct stream *s, short status, const struct buffer *msg)
 {
        struct filter *filter;
 
index 06125e208ddf9fd046c366788b562ca5fa433ea6..63482f5704aed51c237d564f8b0d948c5326eb93 100644 (file)
@@ -387,7 +387,7 @@ spoe_str_to_vsn(const char *str, size_t len)
 static int
 spoe_prepare_hahello_frame(struct appctx *appctx, char *frame, size_t size)
 {
-       struct chunk      *chk;
+       struct buffer      *chk;
        struct spoe_agent *agent = SPOE_APPCTX(appctx)->agent;
        char              *p, *end;
        unsigned int       flags = SPOE_FRM_FL_FIN;
index 5d24a4184171232b5103cfba87a420281aa142b5..6b65fe9389ef7b5009466d4a5439b71cb2732f63 100644 (file)
@@ -440,7 +440,7 @@ trace_http_reset(struct stream *s, struct filter *filter,
 
 static void
 trace_http_reply(struct stream *s, struct filter *filter, short status,
-                const struct chunk *msg)
+                const struct buffer *msg)
 {
        struct trace_config *conf = FLT_CONF(filter);
 
index 9e43593b8ecbfcb3d4a315b41745873bf95b299e..4d42b1fec8b777848ecd133ba9c4abe7b5168e5b 100644 (file)
@@ -291,7 +291,7 @@ __LJMP static const char *hlua_traceback(lua_State *L)
 {
        lua_Debug ar;
        int level = 0;
-       struct chunk *msg = get_trash_chunk();
+       struct buffer *msg = get_trash_chunk();
        int filled = 0;
 
        while (lua_getstack(L, level++, &ar)) {
@@ -4466,7 +4466,7 @@ __LJMP static int hlua_applet_http_start_response_yield(lua_State *L, int status
 
 __LJMP static int hlua_applet_http_start_response(lua_State *L)
 {
-       struct chunk *tmp = get_trash_chunk();
+       struct buffer *tmp = get_trash_chunk();
        struct hlua_appctx *appctx = MAY_LJMP(hlua_checkapplet_http(L, 1));
        const char *name;
        size_t name_len;
@@ -5847,7 +5847,7 @@ static int hlua_sample_fetch_wrapper(const struct arg *arg_p, struct sample *smp
        struct hlua_function *fcn = private;
        struct stream *stream = smp->strm;
        const char *error;
-       const struct chunk msg = { };
+       const struct buffer msg = { };
 
        if (!stream)
                return 0;
@@ -6116,7 +6116,7 @@ static enum act_return hlua_action(struct act_rule *rule, struct proxy *px,
        unsigned int analyzer;
        int dir;
        const char *error;
-       const struct chunk msg = { };
+       const struct buffer msg = { };
 
        switch (rule->from) {
        case ACT_F_TCP_REQ_CNT: analyzer = AN_REQ_INSPECT_FE     ; dir = SMP_OPT_DIR_REQ; break;
index bc32401e77be6436439bd3fc919c1b9fb1c80c1c..cebce2244490623ed71338ad68cfb9dfb64f4db2 100644 (file)
@@ -1191,7 +1191,7 @@ static int hlua_regex_exec(struct lua_State *L)
        struct my_regex *regex;
        const char *str;
        size_t len;
-       struct chunk *tmp;
+       struct buffer *tmp;
 
        regex = hlua_check_regex(L, 1);
        str = luaL_checklstring(L, 2, &len);
@@ -1219,7 +1219,7 @@ static int hlua_regex_match(struct lua_State *L)
        regmatch_t pmatch[20];
        int ret;
        int i;
-       struct chunk *tmp;
+       struct buffer *tmp;
 
        regex = hlua_check_regex(L, 1);
        str = luaL_checklstring(L, 2, &len);
index 7c4147be0a4c729cfc47b237614965cb32a1ec36..16a722f99461f598deda6c098e758bc8290a6e17 100644 (file)
@@ -114,7 +114,8 @@ static inline int hpack_idx_to_phdr(uint32_t idx)
  * allocated there. In case of allocation failure, returns a string whose
  * pointer is NULL.
  */
-static inline struct ist hpack_alloc_string(struct chunk *store, int idx, struct ist in)
+static inline struct ist hpack_alloc_string(struct buffer *store, int idx,
+                                           struct ist in)
 {
        struct ist out;
 
@@ -148,7 +149,8 @@ static inline struct ist hpack_alloc_string(struct chunk *store, int idx, struct
  * can use list[].n.len == 0 as a marker for the end of list.
  */
 int hpack_decode_frame(struct hpack_dht *dht, const uint8_t *raw, uint32_t len,
-                       struct http_hdr *list, int list_size, struct chunk *tmp)
+                       struct http_hdr *list, int list_size,
+                       struct buffer *tmp)
 {
        uint32_t idx;
        uint32_t nlen;
index c6bfce7640ccf98812a3bd86776c6658129e31a3..70d2b12f65a9506f3e5f4ff3ff68aaaa1056fd49 100644 (file)
@@ -76,7 +76,8 @@ static inline int hpack_encode_len(char *out, int pos, int len)
 /* Tries to encode header whose name is <n> and value <v> into the chunk <out>.
  * Returns non-zero on success, 0 on failure (buffer full).
  */
-int hpack_encode_header(struct chunk *out, const struct ist n, const struct ist v)
+int hpack_encode_header(struct buffer *out, const struct ist n,
+                       const struct ist v)
 {
        int len = out->data;
        int size = out->size;
index 899266c2f414479bc919b4599d5d690e88c3e458..e2ced80d89b840bd065a30af0d5311dbb45e0f8c 100644 (file)
--- a/src/log.c
+++ b/src/log.c
@@ -48,8 +48,8 @@
 struct log_fmt {
        char *name;
        struct {
-               struct chunk sep1; /* first pid separator */
-               struct chunk sep2; /* second pid separator */
+               struct buffer sep1; /* first pid separator */
+               struct buffer sep2; /* second pid separator */
        } pid;
 };
 
@@ -1006,7 +1006,7 @@ static char *lf_encode_string(char *start, char *stop,
  */
 static char *lf_encode_chunk(char *start, char *stop,
                              const char escape, const fd_set *map,
-                             const struct chunk *chunk,
+                             const struct buffer *chunk,
                              struct logformat_node *node)
 {
        char *str, *end;
@@ -1158,7 +1158,7 @@ static char *update_log_hdr(const time_t time)
 {
        static THREAD_LOCAL long tvsec;
        static THREAD_LOCAL char *dataptr = NULL; /* backup of last end of header, NULL first time */
-       static THREAD_LOCAL struct chunk host = { };
+       static THREAD_LOCAL struct buffer host = { };
        static THREAD_LOCAL int sep = 0;
 
        if (unlikely(time != tvsec || dataptr == NULL)) {
@@ -1280,10 +1280,10 @@ void __send_log(struct proxy *p, int level, char *message, size_t size, char *sd
        char *hdr, *hdr_ptr;
        size_t hdr_size;
        time_t time = date.tv_sec;
-       struct chunk *tag = &global.log_tag;
+       struct buffer *tag = &global.log_tag;
        static THREAD_LOCAL int curr_pid;
        static THREAD_LOCAL char pidstr[100];
-       static THREAD_LOCAL struct chunk pid;
+       static THREAD_LOCAL struct buffer pid;
 
        msghdr.msg_iov = iovec;
 
@@ -1574,7 +1574,7 @@ int build_logline(struct stream *s, char *dst, size_t maxsize, struct list *list
        struct proxy *fe = sess->fe;
        struct proxy *be = s->be;
        struct http_txn *txn = s->txn;
-       struct chunk chunk;
+       struct buffer chunk;
        char *uri;
        char *spc;
        char *qmark;
@@ -1606,7 +1606,7 @@ int build_logline(struct stream *s, char *dst, size_t maxsize, struct list *list
                struct connection *conn;
                const char *src = NULL;
                struct sample *key;
-               const struct chunk empty = { };
+               const struct buffer empty = { };
 
                switch (tmp->type) {
                        case LOG_FMT_SEPARATOR:
index 64f2388d552186fffccaab1687e15920dace4c2c..5c107355efc0ae0b9f431f17c66d4a6a5360fbed 100644 (file)
--- a/src/map.c
+++ b/src/map.c
@@ -172,7 +172,7 @@ static int sample_conv_map(const struct arg *arg_p, struct sample *smp, void *pr
 {
        struct map_descriptor *desc;
        struct pattern *pat;
-       struct chunk *str;
+       struct buffer *str;
 
        /* get config */
        desc = arg_p[0].data.map;
index 92f5090193077ec269a99830a057cd2d3ce05e5f..e25208360ae7c4cda6212df9c05e2ea1bc6526ad 100644 (file)
@@ -670,7 +670,7 @@ static int h2c_snd_settings(struct h2c *h2c)
 {
        struct buffer *res;
        char buf_data[100]; // enough for 15 settings
-       struct chunk buf;
+       struct buffer buf;
        int ret;
 
        if (h2c_mux_busy(h2c, NULL)) {
@@ -2617,9 +2617,9 @@ static int h2_frt_decode_headers(struct h2s *h2s, struct buffer *buf, int count,
 {
        struct h2c *h2c = h2s->h2c;
        const uint8_t *hdrs = (uint8_t *)b_head(&h2c->dbuf);
-       struct chunk *tmp = get_trash_chunk();
+       struct buffer *tmp = get_trash_chunk();
        struct http_hdr list[MAX_HTTP_HDR * 2];
-       struct chunk *copy = NULL;
+       struct buffer *copy = NULL;
        unsigned int msgf;
        int flen = h2c->dfl;
        int outlen = 0;
@@ -2954,7 +2954,7 @@ static size_t h2s_frt_make_resp_headers(struct h2s *h2s, const struct buffer *bu
        struct http_hdr list[MAX_HTTP_HDR];
        struct h2c *h2c = h2s->h2c;
        struct h1m *h1m = &h2s->res;
-       struct chunk outbuf;
+       struct buffer outbuf;
        int es_now = 0;
        int ret = 0;
        int hdr;
@@ -3125,7 +3125,7 @@ static size_t h2s_frt_make_resp_data(struct h2s *h2s, const struct buffer *buf,
 {
        struct h2c *h2c = h2s->h2c;
        struct h1m *h1m = &h2s->res;
-       struct chunk outbuf;
+       struct buffer outbuf;
        int ret = 0;
        size_t total = 0;
        int es_now = 0;
@@ -3447,7 +3447,7 @@ static size_t h2_snd_buf(struct conn_stream *cs, const struct buffer *buf, size_
 }
 
 /* for debugging with CLI's "show fd" command */
-static void h2_show_fd(struct chunk *msg, struct connection *conn)
+static void h2_show_fd(struct buffer *msg, struct connection *conn)
 {
        struct h2c *h2c = conn->mux_ctx;
        struct h2s *h2s;
index 2975afacbd54bdf4ddf0f22083162cc6e7a1aa5c..261a0b4b1f3699ee39bf6441f4d5615ba81ed1d6 100644 (file)
@@ -221,7 +221,7 @@ int pat_parse_str(const char *text, struct pattern *pattern, int mflags, char **
 /* Parse a binary written in hexa. It is allocated. */
 int pat_parse_bin(const char *text, struct pattern *pattern, int mflags, char **err)
 {
-       struct chunk *trash;
+       struct buffer *trash;
 
        pattern->type = SMP_T_BIN;
        trash = get_trash_chunk();
index 08a29a6a76a515154f504436862f1efd8beccdc4..f26c3dfb9edda103b0055e4cf7733fd69c2f4613 100644 (file)
@@ -387,7 +387,7 @@ static int peer_prepare_switchmsg(struct shared_table *st, char *msg, size_t siz
 {
        int len;
        unsigned short datalen;
-       struct chunk *chunk;
+       struct buffer *chunk;
        char *cursor, *datamsg, *chunkp, *chunkq;
        uint64_t data = 0;
        unsigned int data_type;
index ea10b91ed27e0aec573177178ab5565be9618425..117d27404af5919820bb51d9a5598f2a183272e3 100644 (file)
@@ -78,7 +78,7 @@
 const char HTTP_100[] =
        "HTTP/1.1 100 Continue\r\n\r\n";
 
-const struct chunk http_100_chunk = {
+const struct buffer http_100_chunk = {
        .area = (char *)&HTTP_100,
        .data = sizeof(HTTP_100)-1
 };
@@ -275,7 +275,7 @@ struct action_kw_list http_res_keywords = {
 /* We must put the messages here since GCC cannot initialize consts depending
  * on strlen().
  */
-struct chunk http_err_chunks[HTTP_ERR_SIZE];
+struct buffer http_err_chunks[HTTP_ERR_SIZE];
 
 /* this struct is used between calls to smp_fetch_hdr() or smp_fetch_cookie() */
 static THREAD_LOCAL struct hdr_ctx static_hdr_ctx;
@@ -917,7 +917,7 @@ int http_remove_header2(struct http_msg *msg, struct hdr_idx *idx, struct hdr_ct
  * in this buffer will be lost.
  */
 static void http_server_error(struct stream *s, struct stream_interface *si,
-                             int err, int finst, const struct chunk *msg)
+                             int err, int finst, const struct buffer *msg)
 {
        FLT_STRM_CB(s, flt_http_reply(s, s->txn->status, msg));
        channel_auto_read(si_oc(si));
@@ -938,7 +938,7 @@ static void http_server_error(struct stream *s, struct stream_interface *si,
  * and message.
  */
 
-struct chunk *http_error_message(struct stream *s)
+struct buffer *http_error_message(struct stream *s)
 {
        const int msgnum = http_get_status_idx(s->txn->status);
 
@@ -951,7 +951,7 @@ struct chunk *http_error_message(struct stream *s)
 }
 
 void
-http_reply_and_close(struct stream *s, short status, struct chunk *msg)
+http_reply_and_close(struct stream *s, short status, struct buffer *msg)
 {
        s->txn->flags &= ~TX_WAIT_NEXT_RQ;
        FLT_STRM_CB(s, flt_http_reply(s, status, msg));
@@ -1264,7 +1264,7 @@ get_http_auth(struct stream *s)
 {
 
        struct http_txn *txn = s->txn;
-       struct chunk auth_method;
+       struct buffer auth_method;
        struct hdr_ctx ctx;
        char *h, *p;
        int len;
@@ -1304,7 +1304,7 @@ get_http_auth(struct stream *s)
        chunk_initlen(&txn->auth.method_data, p + 1, 0, ctx.vlen - len - 1);
 
        if (!strncasecmp("Basic", auth_method.area, auth_method.data)) {
-               struct chunk *http_auth = get_trash_chunk();
+               struct buffer *http_auth = get_trash_chunk();
 
                len = base64dec(txn->auth.method_data.area,
                                txn->auth.method_data.data,
@@ -2403,7 +2403,7 @@ int http_transform_header_str(struct stream* s, struct http_msg *msg,
        struct hdr_idx *idx = &s->txn->hdr_idx;
        int (*http_find_hdr_func)(const char *name, int len, char *sol,
                                  struct hdr_idx *idx, struct hdr_ctx *ctx);
-       struct chunk *output = get_trash_chunk();
+       struct buffer *output = get_trash_chunk();
 
        ctx.idx = 0;
 
@@ -2451,7 +2451,7 @@ static int http_transform_header(struct stream* s, struct http_msg *msg,
                                  struct list *fmt, struct my_regex *re,
                                  int action)
 {
-       struct chunk *replace;
+       struct buffer *replace;
        int ret = -1;
 
        replace = alloc_trash_chunk();
@@ -2607,7 +2607,7 @@ resume_execution:
                         * buffer, we build first the header value using build_logline, and
                         * after we store the header name.
                         */
-                       struct chunk *replace;
+                       struct buffer *replace;
 
                        replace = alloc_trash_chunk();
                        if (!replace)
@@ -2655,7 +2655,7 @@ resume_execution:
                case ACT_HTTP_DEL_ACL:
                case ACT_HTTP_DEL_MAP: {
                        struct pat_ref *ref;
-                       struct chunk *key;
+                       struct buffer *key;
 
                        /* collect reference */
                        ref = pat_ref_lookup(rule->arg.map.ref);
@@ -2684,7 +2684,7 @@ resume_execution:
 
                case ACT_HTTP_ADD_ACL: {
                        struct pat_ref *ref;
-                       struct chunk *key;
+                       struct buffer *key;
 
                        /* collect reference */
                        ref = pat_ref_lookup(rule->arg.map.ref);
@@ -2714,7 +2714,7 @@ resume_execution:
 
                case ACT_HTTP_SET_MAP: {
                        struct pat_ref *ref;
-                       struct chunk *key, *value;
+                       struct buffer *key, *value;
 
                        /* collect reference */
                        ref = pat_ref_lookup(rule->arg.map.ref);
@@ -2929,7 +2929,7 @@ resume_execution:
 
                case ACT_HTTP_SET_HDR:
                case ACT_HTTP_ADD_HDR: {
-                       struct chunk *replace;
+                       struct buffer *replace;
 
                        replace = alloc_trash_chunk();
                        if (!replace)
@@ -2980,7 +2980,7 @@ resume_execution:
                case ACT_HTTP_DEL_ACL:
                case ACT_HTTP_DEL_MAP: {
                        struct pat_ref *ref;
-                       struct chunk *key;
+                       struct buffer *key;
 
                        /* collect reference */
                        ref = pat_ref_lookup(rule->arg.map.ref);
@@ -3009,7 +3009,7 @@ resume_execution:
 
                case ACT_HTTP_ADD_ACL: {
                        struct pat_ref *ref;
-                       struct chunk *key;
+                       struct buffer *key;
 
                        /* collect reference */
                        ref = pat_ref_lookup(rule->arg.map.ref);
@@ -3037,7 +3037,7 @@ resume_execution:
 
                case ACT_HTTP_SET_MAP: {
                        struct pat_ref *ref;
-                       struct chunk *key, *value;
+                       struct buffer *key, *value;
 
                        /* collect reference */
                        ref = pat_ref_lookup(rule->arg.map.ref);
@@ -3185,7 +3185,7 @@ static int http_apply_redirect_rule(struct redirect_rule *rule, struct stream *s
        struct http_msg *req = &txn->req;
        struct http_msg *res = &txn->rsp;
        const char *msg_fmt;
-       struct chunk *chunk;
+       struct buffer *chunk;
        int ret = 0;
 
        chunk = alloc_trash_chunk();
@@ -9870,7 +9870,7 @@ static int
 smp_fetch_hdrs_bin(const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
        struct http_msg *msg;
-       struct chunk *temp;
+       struct buffer *temp;
        struct hdr_idx *idx;
        const char *cur_ptr, *cur_next, *p;
        int old_idx, cur_idx;
@@ -9973,7 +9973,7 @@ smp_fetch_body(const struct arg *args, struct sample *smp, const char *kw, void
        unsigned long len;
        unsigned long block1;
        char *body;
-       struct chunk *temp;
+       struct buffer *temp;
 
        CHECK_HTTP_MESSAGE_FIRST();
 
@@ -10213,7 +10213,7 @@ smp_fetch_hdr_names(const struct arg *args, struct sample *smp, const char *kw,
        struct hdr_idx *idx;
        struct hdr_ctx ctx;
        const struct http_msg *msg;
-       struct chunk *temp;
+       struct buffer *temp;
        char del = ',';
 
        if (args && args->type == ARGT_STR)
@@ -10367,7 +10367,7 @@ smp_fetch_hdr_ip(const struct arg *args, struct sample *smp, const char *kw, voi
                        smp->data.type = SMP_T_IPV4;
                        break;
                } else {
-                       struct chunk *temp = get_trash_chunk();
+                       struct buffer *temp = get_trash_chunk();
                        if (smp->data.u.str.data < temp->size - 1) {
                                memcpy(temp->area, smp->data.u.str.area,
                                       smp->data.u.str.data);
@@ -10428,7 +10428,7 @@ smp_fetch_base(const struct arg *args, struct sample *smp, const char *kw, void
        struct http_txn *txn;
        char *ptr, *end, *beg;
        struct hdr_ctx ctx;
-       struct chunk *temp;
+       struct buffer *temp;
 
        CHECK_HTTP_MESSAGE_FIRST();
 
@@ -10521,7 +10521,7 @@ smp_fetch_base32(const struct arg *args, struct sample *smp, const char *kw, voi
 static int
 smp_fetch_base32_src(const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
-       struct chunk *temp;
+       struct buffer *temp;
        struct connection *cli_conn = objt_conn(smp->sess->origin);
 
        if (!cli_conn)
@@ -10807,7 +10807,7 @@ smp_fetch_capture_header_res(const struct arg *args, struct sample *smp, const c
 static int
 smp_fetch_capture_req_method(const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
-       struct chunk *temp;
+       struct buffer *temp;
        struct http_txn *txn = smp->strm->txn;
        char *ptr;
 
@@ -10834,7 +10834,7 @@ smp_fetch_capture_req_method(const struct arg *args, struct sample *smp, const c
 static int
 smp_fetch_capture_req_uri(const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
-       struct chunk *temp;
+       struct buffer *temp;
        struct http_txn *txn = smp->strm->txn;
        char *ptr;
 
@@ -11334,7 +11334,7 @@ static int
 smp_fetch_param(char delim, const char *name, int name_len, const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
        const char *vstart, *vend;
-       struct chunk *temp;
+       struct buffer *temp;
        const char **chunks = (const char **)smp->ctx.a;
 
        if (!find_next_url_param(chunks,
@@ -11571,7 +11571,7 @@ smp_fetch_url32(const struct arg *args, struct sample *smp, const char *kw, void
 static int
 smp_fetch_url32_src(const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
-       struct chunk *temp;
+       struct buffer *temp;
        struct connection *cli_conn = objt_conn(smp->sess->origin);
 
        if (!cli_conn)
@@ -11631,7 +11631,7 @@ static int sample_conv_http_date(const struct arg *args, struct sample *smp, voi
 {
        const char day[7][4] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
        const char mon[12][4] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
-       struct chunk *temp;
+       struct buffer *temp;
        struct tm *tm;
        /* With high numbers, the date returned can be negative, the 55 bits mask prevent this. */
        time_t curr_date = smp->data.u.sint & 0x007fffffffffffffLL;
@@ -11836,7 +11836,7 @@ static int sample_conv_url_dec(const struct arg *args, struct sample *smp, void
          * before decoding.
         */
        if (smp->flags & SMP_F_CONST || smp->data.u.str.size <= smp->data.u.str.data) {
-               struct chunk *str = get_trash_chunk();
+               struct buffer *str = get_trash_chunk();
                memcpy(str->area, smp->data.u.str.area, smp->data.u.str.data);
                smp->data.u.str.area = str->area;
                smp->data.u.str.size = str->size;
@@ -12079,7 +12079,7 @@ void http_set_status(unsigned int status, const char *reason, struct stream *s)
 enum act_return http_action_set_req_line(struct act_rule *rule, struct proxy *px,
                                          struct session *sess, struct stream *s, int flags)
 {
-       struct chunk *replace;
+       struct buffer *replace;
        enum act_return ret = ACT_RET_ERR;
 
        replace = alloc_trash_chunk();
index c262966a203f20de6731b39fa37ed65f84eb824c..bf87a2f9c299c40e3bc043e30be77aa9bc4577ac 100644 (file)
@@ -1421,7 +1421,7 @@ static int cli_parse_show_servers(char **args, char *payload, struct appctx *app
  * It uses the proxy pointer from cli.p0, the proxy's id from cli.i0 and the server's
  * pointer from cli.p1.
  */
-static int dump_servers_state(struct stream_interface *si, struct chunk *buf)
+static int dump_servers_state(struct stream_interface *si, struct buffer *buf)
 {
        struct appctx *appctx = __objt_appctx(si->end);
        struct proxy *px = appctx->ctx.cli.p0;
index 9ccfe7d6f73cd6a40e7589756c2d2c2e21c9627a..e3dea1bf43c6e92844dc15f6fac27b40299b48d9 100644 (file)
@@ -508,7 +508,7 @@ static int c_ip2int(struct sample *smp)
 
 static int c_ip2str(struct sample *smp)
 {
-       struct chunk *trash = get_trash_chunk();
+       struct buffer *trash = get_trash_chunk();
 
        if (!inet_ntop(AF_INET, (void *)&smp->data.u.ipv4, trash->area, trash->size))
                return 0;
@@ -538,7 +538,7 @@ static int c_ipv62ip(struct sample *smp)
 
 static int c_ipv62str(struct sample *smp)
 {
-       struct chunk *trash = get_trash_chunk();
+       struct buffer *trash = get_trash_chunk();
 
        if (!inet_ntop(AF_INET6, (void *)&smp->data.u.ipv6, trash->area, trash->size))
                return 0;
@@ -623,7 +623,7 @@ static int c_bin2str(struct sample *smp)
 
 static int c_int2str(struct sample *smp)
 {
-       struct chunk *trash = get_trash_chunk();
+       struct buffer *trash = get_trash_chunk();
        char *pos;
 
        pos = lltoa_r(smp->data.u.sint, trash->area, trash->size);
@@ -647,7 +647,7 @@ static int c_int2str(struct sample *smp)
  */
 int smp_dup(struct sample *smp)
 {
-       struct chunk *trash;
+       struct buffer *trash;
 
        switch (smp->data.type) {
        case SMP_T_BOOL:
@@ -763,7 +763,7 @@ static int c_meth2str(struct sample *smp)
 
 static int c_addr2bin(struct sample *smp)
 {
-       struct chunk *chk = get_trash_chunk();
+       struct buffer *chk = get_trash_chunk();
 
        if (smp->data.type == SMP_T_IPV4) {
                chk->data = 4;
@@ -783,7 +783,7 @@ static int c_addr2bin(struct sample *smp)
 
 static int c_int2bin(struct sample *smp)
 {
-       struct chunk *chk = get_trash_chunk();
+       struct buffer *chk = get_trash_chunk();
 
        *(unsigned long long int *) chk->area = my_htonll(smp->data.u.sint);
        chk->data = 8;
@@ -1474,7 +1474,7 @@ static int sample_conv_debug(const struct arg *arg_p, struct sample *smp, void *
 
 static int sample_conv_base642bin(const struct arg *arg_p, struct sample *smp, void *private)
 {
-       struct chunk *trash = get_trash_chunk();
+       struct buffer *trash = get_trash_chunk();
        int bin_len;
 
        trash->data = 0;
@@ -1492,7 +1492,7 @@ static int sample_conv_base642bin(const struct arg *arg_p, struct sample *smp, v
 
 static int sample_conv_bin2base64(const struct arg *arg_p, struct sample *smp, void *private)
 {
-       struct chunk *trash = get_trash_chunk();
+       struct buffer *trash = get_trash_chunk();
        int b64_len;
 
        trash->data = 0;
@@ -1511,7 +1511,7 @@ static int sample_conv_bin2base64(const struct arg *arg_p, struct sample *smp, v
 static int sample_conv_sha1(const struct arg *arg_p, struct sample *smp, void *private)
 {
        blk_SHA_CTX ctx;
-       struct chunk *trash = get_trash_chunk();
+       struct buffer *trash = get_trash_chunk();
 
        memset(&ctx, 0, sizeof(ctx));
 
@@ -1528,7 +1528,7 @@ static int sample_conv_sha1(const struct arg *arg_p, struct sample *smp, void *p
 
 static int sample_conv_bin2hex(const struct arg *arg_p, struct sample *smp, void *private)
 {
-       struct chunk *trash = get_trash_chunk();
+       struct buffer *trash = get_trash_chunk();
        unsigned char c;
        int ptr = 0;
 
@@ -1640,7 +1640,7 @@ static int sample_conv_ipmask(const struct arg *args, struct sample *smp, void *
  */
 static int sample_conv_ltime(const struct arg *args, struct sample *smp, void *private)
 {
-       struct chunk *temp;
+       struct buffer *temp;
        /* With high numbers, the date returned can be negative, the 55 bits mask prevent this. */
        time_t curr_date = smp->data.u.sint & 0x007fffffffffffffLL;
        struct tm *tm;
@@ -1677,7 +1677,7 @@ static int sample_conv_sdbm(const struct arg *arg_p, struct sample *smp, void *p
  */
 static int sample_conv_utime(const struct arg *args, struct sample *smp, void *private)
 {
-       struct chunk *temp;
+       struct buffer *temp;
        /* With high numbers, the date returned can be negative, the 55 bits mask prevent this. */
        time_t curr_date = smp->data.u.sint & 0x007fffffffffffffLL;
        struct tm *tm;
@@ -1840,7 +1840,7 @@ static int sample_conv_json_check(struct arg *arg, struct sample_conv *conv,
 
 static int sample_conv_json(const struct arg *arg_p, struct sample *smp, void *private)
 {
-       struct chunk *temp;
+       struct buffer *temp;
        char _str[7]; /* \u + 4 hex digit + null char for sprintf. */
        const char *str;
        int len;
@@ -2227,7 +2227,7 @@ static int sample_conv_regsub(const struct arg *arg_p, struct sample *smp, void
        char *start, *end;
        struct my_regex *reg = arg_p[0].data.reg;
        regmatch_t pmatch[MAX_MATCH];
-       struct chunk *trash = get_trash_chunk();
+       struct buffer *trash = get_trash_chunk();
        int flag, max;
        int found;
 
@@ -2629,7 +2629,7 @@ static int sample_conv_arith_even(const struct arg *arg_p,
  */
 static int sample_conv_concat(const struct arg *arg_p, struct sample *smp, void *private)
 {
-       struct chunk *trash;
+       struct buffer *trash;
        struct sample tmp;
        int max;
 
index 422f8bf1c632c65fefdfbda9af3abec447877669..d96edc77a6995580f4d8f8719c0ae4eb7d8dde78 100644 (file)
@@ -844,7 +844,8 @@ void srv_shutdown_backup_streams(struct proxy *px, int why)
  * If <xferred> is non-negative, some information about requeued sessions are
  * provided.
  */
-void srv_append_status(struct chunk *msg, struct server *s, struct check *check, int xferred, int forced)
+void srv_append_status(struct buffer *msg, struct server *s,
+                      struct check *check, int xferred, int forced)
 {
        short status = s->op_st_chg.status;
        short code = s->op_st_chg.code;
@@ -865,7 +866,7 @@ void srv_append_status(struct chunk *msg, struct server *s, struct check *check,
                        chunk_appendf(msg, ", code: %d", code);
 
                if (desc && *desc) {
-                       struct chunk src;
+                       struct buffer src;
 
                        chunk_appendf(msg, ", info: \"");
 
@@ -2686,7 +2687,7 @@ static void srv_register_update(struct server *srv)
 static void srv_update_state(struct server *srv, int version, char **params)
 {
        char *p;
-       struct chunk *msg;
+       struct buffer *msg;
 
        /* fields since version 1
         * and common to all other upcoming versions
@@ -3415,7 +3416,7 @@ const char *update_server_addr_port(struct server *s, const char *addr, const ch
        int ret, port_change_required;
        char current_addr[INET6_ADDRSTRLEN];
        uint16_t current_port, new_port;
-       struct chunk *msg;
+       struct buffer *msg;
        int changed = 0;
 
        msg = get_trash_chunk();
@@ -3674,7 +3675,7 @@ int snr_resolution_cb(struct dns_requester *requester, struct dns_nameserver *na
        void *serverip, *firstip;
        short server_sin_family, firstip_sin_family;
        int ret;
-       struct chunk *chk = get_trash_chunk();
+       struct buffer *chk = get_trash_chunk();
        int has_no_ip = 0;
 
        s = objt_server(requester->owner);
@@ -4035,7 +4036,7 @@ int srv_init_addr(void)
 const char *update_server_fqdn(struct server *server, const char *fqdn, const char *updater, int dns_locked)
 {
 
-       struct chunk *msg;
+       struct buffer *msg;
 
        msg = get_trash_chunk();
        chunk_reset(msg);
@@ -4524,7 +4525,7 @@ void srv_update_status(struct server *s)
        int prev_srv_count = s->proxy->srv_bck + s->proxy->srv_act;
        int srv_was_stopping = (s->cur_state == SRV_ST_STOPPING) || (s->cur_admin & SRV_ADMF_DRAIN);
        int log_level;
-       struct chunk *tmptrash = NULL;
+       struct buffer *tmptrash = NULL;
 
 
        /* If currently main is not set we try to apply pending state changes */
index 6cea612c54106e0f36f3aa998f28e7e2ab757292..635aee5f6e05ed55f396f73052d98f68f4cdb346 100644 (file)
@@ -281,7 +281,7 @@ int session_accept_fd(struct listener *l, int cfd, struct sockaddr_storage *addr
        listener_release(l);
        if (ret < 0 && l->bind_conf->xprt == xprt_get(XPRT_RAW) && p->mode == PR_MODE_HTTP) {
                /* critical error, no more memory, try to emit a 500 response */
-               struct chunk *err_msg = &p->errmsg[HTTP_ERR_500];
+               struct buffer *err_msg = &p->errmsg[HTTP_ERR_500];
                if (!err_msg->area)
                        err_msg = &http_err_chunks[HTTP_ERR_500];
                send(cfd, err_msg->area, err_msg->data,
index b0b7d25437b25ac383898d6eacf4cde03655e3fe..56898209a616ef12361f513e0452dd9d7a0fe91c 100644 (file)
@@ -368,7 +368,7 @@ static forceinline void ssl_sock_dump_errors(struct connection *conn)
 struct certificate_ocsp {
        struct ebmb_node key;
        unsigned char key_data[OCSP_MAX_CERTID_ASN1_LENGTH];
-       struct chunk response;
+       struct buffer response;
        long expire;
 };
 
@@ -644,7 +644,9 @@ static struct eb_root cert_ocsp_tree = EB_ROOT_UNIQUE;
  *
  * Returns 0 on success, 1 in error case.
  */
-static int ssl_sock_load_ocsp_response(struct chunk *ocsp_response, struct certificate_ocsp *ocsp, OCSP_CERTID *cid, char **err)
+static int ssl_sock_load_ocsp_response(struct buffer *ocsp_response,
+                                      struct certificate_ocsp *ocsp,
+                                      OCSP_CERTID *cid, char **err)
 {
        OCSP_RESPONSE *resp;
        OCSP_BASICRESP *bs = NULL;
@@ -766,7 +768,7 @@ out:
  *
  * Returns 0 on success, 1 in error case.
  */
-int ssl_sock_update_ocsp_response(struct chunk *ocsp_response, char **err)
+int ssl_sock_update_ocsp_response(struct buffer *ocsp_response, char **err)
 {
        return ssl_sock_load_ocsp_response(ocsp_response, NULL, NULL, err);
 }
@@ -886,7 +888,8 @@ struct tls_keys_ref *tlskeys_ref_lookupid(int unique_id)
         return NULL;
 }
 
-void ssl_sock_update_tlskey_ref(struct tls_keys_ref *ref, struct chunk *tlskey)
+void ssl_sock_update_tlskey_ref(struct tls_keys_ref *ref,
+                               struct buffer *tlskey)
 {
        HA_RWLOCK_WRLOCK(TLSKEYS_REF_LOCK, &ref->lock);
        memcpy((char *) (ref->tlskeys + ((ref->tls_ticket_enc_index + 2) % TLS_TICKETS_NO)),
@@ -895,7 +898,7 @@ void ssl_sock_update_tlskey_ref(struct tls_keys_ref *ref, struct chunk *tlskey)
        HA_RWLOCK_WRUNLOCK(TLSKEYS_REF_LOCK, &ref->lock);
 }
 
-int ssl_sock_update_tlskey(char *filename, struct chunk *tlskey, char **err)
+int ssl_sock_update_tlskey(char *filename, struct buffer *tlskey, char **err)
 {
        struct tls_keys_ref *ref = tlskeys_ref_lookup(filename);
 
@@ -1267,7 +1270,7 @@ static int sctl_ex_index = -1;
  * makes only basic test if the data seems like SCTL. No signature validation
  * is performed.
  */
-static int ssl_sock_parse_sctl(struct chunk *sctl)
+static int ssl_sock_parse_sctl(struct buffer *sctl)
 {
        int ret = 1;
        int len, pos, sct_len;
@@ -1301,7 +1304,8 @@ out:
        return ret;
 }
 
-static int ssl_sock_load_sctl_from_file(const char *sctl_path, struct chunk **sctl)
+static int ssl_sock_load_sctl_from_file(const char *sctl_path,
+                                       struct buffer **sctl)
 {
        int fd = -1;
        int r = 0;
@@ -1348,7 +1352,7 @@ end:
 
 int ssl_sock_sctl_add_cbk(SSL *ssl, unsigned ext_type, const unsigned char **out, size_t *outlen, int *al, void *add_arg)
 {
-       struct chunk *sctl = add_arg;
+       struct buffer *sctl = add_arg;
 
        *out = (unsigned char *) sctl->area;
        *outlen = sctl->data;
@@ -1366,7 +1370,7 @@ static int ssl_sock_load_sctl(SSL_CTX *ctx, const char *cert_path)
        char sctl_path[MAXPATHLEN+1];
        int ret = -1;
        struct stat st;
-       struct chunk *sctl = NULL;
+       struct buffer *sctl = NULL;
 
        snprintf(sctl_path, MAXPATHLEN+1, "%s.sctl", cert_path);
 
@@ -5708,7 +5712,7 @@ static void ssl_sock_shutw(struct connection *conn, int clean)
 }
 
 /* used for ppv2 pkey alog (can be used for logging) */
-int ssl_sock_get_pkey_algo(struct connection *conn, struct chunk *out)
+int ssl_sock_get_pkey_algo(struct connection *conn, struct buffer *out)
 {
        struct pkey_info *pkinfo;
        int bits = 0;
@@ -5815,7 +5819,7 @@ const char *ssl_sock_get_proto_version(struct connection *conn)
  * -1 if output is not large enough.
  */
 static int
-ssl_sock_get_serial(X509 *crt, struct chunk *out)
+ssl_sock_get_serial(X509 *crt, struct buffer *out)
 {
        ASN1_INTEGER *serial;
 
@@ -5836,7 +5840,7 @@ ssl_sock_get_serial(X509 *crt, struct chunk *out)
  * -1 if output is not large enough.
  */
 static int
-ssl_sock_crt2der(X509 *crt, struct chunk *out)
+ssl_sock_crt2der(X509 *crt, struct buffer *out)
 {
        int len;
        unsigned char *p = (unsigned char *) out->area;;
@@ -5854,12 +5858,12 @@ ssl_sock_crt2der(X509 *crt, struct chunk *out)
 }
 
 
-/* Copy Date in ASN1_UTCTIME format in struct chunk out.
+/* Copy Date in ASN1_UTCTIME format in struct buffer out.
  * Returns 1 if serial is found and copied, 0 if no valid time found
  * and -1 if output is not large enough.
  */
 static int
-ssl_sock_get_time(ASN1_TIME *tm, struct chunk *out)
+ssl_sock_get_time(ASN1_TIME *tm, struct buffer *out)
 {
        if (tm->type == V_ASN1_GENERALIZEDTIME) {
                ASN1_GENERALIZEDTIME *gentm = (ASN1_GENERALIZEDTIME *)tm;
@@ -5897,7 +5901,8 @@ ssl_sock_get_time(ASN1_TIME *tm, struct chunk *out)
  * Returns 1 if entry found, 0 if entry not found, or -1 if output not large enough.
  */
 static int
-ssl_sock_get_dn_entry(X509_NAME *a, const struct chunk *entry, int pos, struct chunk *out)
+ssl_sock_get_dn_entry(X509_NAME *a, const struct buffer *entry, int pos,
+                     struct buffer *out)
 {
        X509_NAME_ENTRY *ne;
        ASN1_OBJECT *obj;
@@ -5957,7 +5962,7 @@ ssl_sock_get_dn_entry(X509_NAME *a, const struct chunk *entry, int pos, struct c
  * Returns 1 if dn entries exits, 0 if no dn entry found or -1 if output is not large enough.
  */
 static int
-ssl_sock_get_dn_oneline(X509_NAME *a, struct chunk *out)
+ssl_sock_get_dn_oneline(X509_NAME *a, struct buffer *out)
 {
        X509_NAME_ENTRY *ne;
        ASN1_OBJECT *obj;
@@ -6039,12 +6044,13 @@ void ssl_sock_set_servername(struct connection *conn, const char *hostname)
  *  or 0 if no CN found in DN
  *  or -1 on error case (i.e. no peer certificate)
  */
-int ssl_sock_get_remote_common_name(struct connection *conn, struct chunk *dest)
+int ssl_sock_get_remote_common_name(struct connection *conn,
+                                   struct buffer *dest)
 {
        X509 *crt = NULL;
        X509_NAME *name;
        const char find_cn[] = "CN";
-       const struct chunk find_cn_chunk = {
+       const struct buffer find_cn_chunk = {
                .area = (char *)&find_cn,
                .data = sizeof(find_cn)-1
        };
@@ -6182,7 +6188,7 @@ smp_fetch_ssl_x_der(const struct arg *args, struct sample *smp, const char *kw,
        int cert_peer = (kw[4] == 'c') ? 1 : 0;
        X509 *crt = NULL;
        int ret = 0;
-       struct chunk *smp_trash;
+       struct buffer *smp_trash;
        struct connection *conn;
 
        conn = objt_conn(smp->sess->origin);
@@ -6226,7 +6232,7 @@ smp_fetch_ssl_x_serial(const struct arg *args, struct sample *smp, const char *k
        int cert_peer = (kw[4] == 'c') ? 1 : 0;
        X509 *crt = NULL;
        int ret = 0;
-       struct chunk *smp_trash;
+       struct buffer *smp_trash;
        struct connection *conn;
 
        conn = objt_conn(smp->sess->origin);
@@ -6271,7 +6277,7 @@ smp_fetch_ssl_x_sha1(const struct arg *args, struct sample *smp, const char *kw,
        X509 *crt = NULL;
        const EVP_MD *digest;
        int ret = 0;
-       struct chunk *smp_trash;
+       struct buffer *smp_trash;
        struct connection *conn;
 
        conn = objt_conn(smp->sess->origin);
@@ -6315,7 +6321,7 @@ smp_fetch_ssl_x_notafter(const struct arg *args, struct sample *smp, const char
        int cert_peer = (kw[4] == 'c') ? 1 : 0;
        X509 *crt = NULL;
        int ret = 0;
-       struct chunk *smp_trash;
+       struct buffer *smp_trash;
        struct connection *conn;
 
        conn = objt_conn(smp->sess->origin);
@@ -6359,7 +6365,7 @@ smp_fetch_ssl_x_i_dn(const struct arg *args, struct sample *smp, const char *kw,
        X509 *crt = NULL;
        X509_NAME *name;
        int ret = 0;
-       struct chunk *smp_trash;
+       struct buffer *smp_trash;
        struct connection *conn;
 
        conn = objt_conn(smp->sess->origin);
@@ -6415,7 +6421,7 @@ smp_fetch_ssl_x_notbefore(const struct arg *args, struct sample *smp, const char
        int cert_peer = (kw[4] == 'c') ? 1 : 0;
        X509 *crt = NULL;
        int ret = 0;
-       struct chunk *smp_trash;
+       struct buffer *smp_trash;
        struct connection *conn;
 
        conn = objt_conn(smp->sess->origin);
@@ -6459,7 +6465,7 @@ smp_fetch_ssl_x_s_dn(const struct arg *args, struct sample *smp, const char *kw,
        X509 *crt = NULL;
        X509_NAME *name;
        int ret = 0;
-       struct chunk *smp_trash;
+       struct buffer *smp_trash;
        struct connection *conn;
 
        conn = objt_conn(smp->sess->origin);
@@ -6904,7 +6910,7 @@ smp_fetch_ssl_fc_session_key(const struct arg *args, struct sample *smp, const c
        struct connection *conn = (kw[4] != 'b') ? objt_conn(smp->sess->origin) :
                                            smp->strm ? cs_conn(objt_cs(smp->strm->si[1].end)) : NULL;
        SSL_SESSION *ssl_sess;
-       struct chunk *data;
+       struct buffer *data;
 
        if (!conn || !conn->xprt_ctx || conn->xprt != &ssl_sock)
                return 0;
@@ -6974,7 +6980,7 @@ smp_fetch_ssl_fc_cl_bin(const struct arg *args, struct sample *smp, const char *
 static int
 smp_fetch_ssl_fc_cl_hex(const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
-       struct chunk *data;
+       struct buffer *data;
 
        if (!smp_fetch_ssl_fc_cl_bin(args, smp, kw, private))
                return 0;
@@ -7009,7 +7015,7 @@ static int
 smp_fetch_ssl_fc_cl_str(const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 #if (OPENSSL_VERSION_NUMBER >= 0x1000200fL) && !defined(LIBRESSL_VERSION_NUMBER)
-       struct chunk *data;
+       struct buffer *data;
        int i;
 
        if (!smp_fetch_ssl_fc_cl_bin(args, smp, kw, private))
@@ -7048,7 +7054,7 @@ smp_fetch_ssl_fc_unique_id(const struct arg *args, struct sample *smp, const cha
        struct connection *conn = (kw[4] != 'b') ? objt_conn(smp->sess->origin) :
                                            smp->strm ? cs_conn(objt_cs(smp->strm->si[1].end)) : NULL;
        int finished_len;
-       struct chunk *finished_trash;
+       struct buffer *finished_trash;
 
        smp->flags = 0;
        if (!conn || !conn->xprt_ctx || conn->xprt != &ssl_sock)
@@ -8487,7 +8493,7 @@ static int cli_io_handler_tlskeys_files(struct appctx *appctx) {
                                HA_RWLOCK_RDLOCK(TLSKEYS_REF_LOCK, &ref->lock);
                                head = ref->tls_ticket_enc_index;
                                while (appctx->ctx.cli.i1 < TLS_TICKETS_NO) {
-                                       struct chunk *t2 = get_trash_chunk();
+                                       struct buffer *t2 = get_trash_chunk();
 
                                        chunk_reset(t2);
                                        /* should never fail here because we dump only a key in the t2 buffer */
index 86827dbbf3e9c680097bd2abe3177e53e1e917b2..732932ea11c243b41e27fe8f66655388cf42ac2b 100644 (file)
@@ -1555,7 +1555,7 @@ char *encode_string(char *start, char *stop,
  */
 char *encode_chunk(char *start, char *stop,
                    const char escape, const fd_set *map,
-                   const struct chunk *chunk)
+                   const struct buffer *chunk)
 {
        char *str = chunk->area;
        char *end = chunk->area + chunk->data;
@@ -1618,7 +1618,7 @@ char *escape_string(char *start, char *stop,
  */
 char *escape_chunk(char *start, char *stop,
                   const char escape, const fd_set *map,
-                  const struct chunk *chunk)
+                  const struct buffer *chunk)
 {
        char *str = chunk->area;
        char *end = chunk->area + chunk->data;
@@ -1656,7 +1656,7 @@ char *escape_chunk(char *start, char *stop,
  * If <quote> is 1, the converter puts the quotes only if any reserved character
  * is present. If <quote> is 2, the converter always puts the quotes.
  *
- * <output> is a struct chunk used for storing the output string.
+ * <output> is a struct buffer used for storing the output string.
  *
  * The function returns the converted string on its output. If an error
  * occurs, the function returns an empty string. This type of output is useful
@@ -1670,7 +1670,7 @@ char *escape_chunk(char *start, char *stop,
  * the chunk. Please use csv_enc() instead if you want to replace the output
  * chunk.
  */
-const char *csv_enc_append(const char *str, int quote, struct chunk *output)
+const char *csv_enc_append(const char *str, int quote, struct buffer *output)
 {
        char *end = output->area + output->size;
        char *out = output->area + output->data;
@@ -3825,7 +3825,7 @@ fail_wl:
  * Other non-printable chars are encoded "\xHH". Space, '\', and '=' are also escaped.
  * Print stopped if null char or <bsize> is reached, or if no more place in the chunk.
  */
-int dump_text(struct chunk *out, const char *buf, int bsize)
+int dump_text(struct buffer *out, const char *buf, int bsize)
 {
        unsigned char c;
        int ptr = 0;
@@ -3869,7 +3869,7 @@ int dump_text(struct chunk *out, const char *buf, int bsize)
 /* print a buffer in hexa.
  * Print stopped if <bsize> is reached, or if no more place in the chunk.
  */
-int dump_binary(struct chunk *out, const char *buf, int bsize)
+int dump_binary(struct buffer *out, const char *buf, int bsize)
 {
        unsigned char c;
        int ptr = 0;
@@ -3895,7 +3895,7 @@ int dump_binary(struct chunk *out, const char *buf, int bsize)
  * continuation of a previous truncated line begin with "+" instead of " "
  * after the offset. The new pointer is returned.
  */
-int dump_text_line(struct chunk *out, const char *buf, int bsize, int len,
+int dump_text_line(struct buffer *out, const char *buf, int bsize, int len,
                    int *line, int ptr)
 {
        int end;
index 88d665e977b4f62c1802d022c282bd0eea4d43a5..2632ef780037d00d25811904da6725724654f7a3 100644 (file)
@@ -267,7 +267,7 @@ static void stats_dump_csv_header()
 /* Emits a stats field without any surrounding element and properly encoded to
  * resist CSV output. Returns non-zero on success, 0 if the buffer is full.
  */
-int stats_emit_raw_data_field(struct chunk *out, const struct field *f)
+int stats_emit_raw_data_field(struct buffer *out, const struct field *f)
 {
        switch (field_format(f, 0)) {
        case FF_EMPTY: return 1;
@@ -284,7 +284,7 @@ int stats_emit_raw_data_field(struct chunk *out, const struct field *f)
  * output is supposed to be used on its own line. Returns non-zero on success, 0
  * if the buffer is full.
  */
-int stats_emit_typed_data_field(struct chunk *out, const struct field *f)
+int stats_emit_typed_data_field(struct buffer *out, const struct field *f)
 {
        switch (field_format(f, 0)) {
        case FF_EMPTY: return 1;
@@ -306,7 +306,7 @@ int stats_emit_typed_data_field(struct chunk *out, const struct field *f)
 /* Emits a stats field value and its type in JSON.
  * Returns non-zero on success, 0 on error.
  */
-int stats_emit_json_data_field(struct chunk *out, const struct field *f)
+int stats_emit_json_data_field(struct buffer *out, const struct field *f)
 {
        int old_len;
        char buf[20];
@@ -352,7 +352,8 @@ int stats_emit_json_data_field(struct chunk *out, const struct field *f)
 /* Emits an encoding of the field type on 3 characters followed by a delimiter.
  * Returns non-zero on success, 0 if the buffer is full.
  */
-int stats_emit_field_tags(struct chunk *out, const struct field *f, char delim)
+int stats_emit_field_tags(struct buffer *out, const struct field *f,
+                         char delim)
 {
        char origin, nature, scope;
 
@@ -395,7 +396,7 @@ int stats_emit_field_tags(struct chunk *out, const struct field *f, char delim)
 /* Emits an encoding of the field type as JSON.
   * Returns non-zero on success, 0 if the buffer is full.
   */
-int stats_emit_json_field_tags(struct chunk *out, const struct field *f)
+int stats_emit_json_field_tags(struct buffer *out, const struct field *f)
 {
        const char *origin, *nature, *scope;
        int old_len;
@@ -443,7 +444,8 @@ int stats_emit_json_field_tags(struct chunk *out, const struct field *f)
 }
 
 /* Dump all fields from <stats> into <out> using CSV format */
-static int stats_dump_fields_csv(struct chunk *out, const struct field *stats)
+static int stats_dump_fields_csv(struct buffer *out,
+                                const struct field *stats)
 {
        int field;
 
@@ -458,7 +460,8 @@ static int stats_dump_fields_csv(struct chunk *out, const struct field *stats)
 }
 
 /* Dump all fields from <stats> into <out> using a typed "field:desc:type:value" format */
-static int stats_dump_fields_typed(struct chunk *out, const struct field *stats)
+static int stats_dump_fields_typed(struct buffer *out,
+                                  const struct field *stats)
 {
        int field;
 
@@ -486,7 +489,7 @@ static int stats_dump_fields_typed(struct chunk *out, const struct field *stats)
 }
 
 /* Dump all fields from <stats> into <out> using the "show info json" format */
-static int stats_dump_json_info_fields(struct chunk *out,
+static int stats_dump_json_info_fields(struct buffer *out,
                                       const struct field *info)
 {
        int field;
@@ -535,7 +538,8 @@ err:
 }
 
 /* Dump all fields from <stats> into <out> using a typed "field:desc:type:value" format */
-static int stats_dump_fields_json(struct chunk *out, const struct field *stats,
+static int stats_dump_fields_json(struct buffer *out,
+                                 const struct field *stats,
                                  int first_stat)
 {
        int field;
@@ -606,9 +610,11 @@ err:
  * reserved for the checkbox is ST_SHOWADMIN is set in <flags>. Some extra info
  * are provided if ST_SHLGNDS is present in <flags>.
  */
-static int stats_dump_fields_html(struct chunk *out, const struct field *stats, unsigned int flags)
+static int stats_dump_fields_html(struct buffer *out,
+                                 const struct field *stats,
+                                 unsigned int flags)
 {
-       struct chunk src;
+       struct buffer src;
 
        if (stats[ST_F_TYPE].u.u32 == STATS_TYPE_FE) {
                chunk_appendf(out,
@@ -1366,7 +1372,7 @@ static int stats_dump_fe_stats(struct stream_interface *si, struct proxy *px)
 int stats_fill_li_stats(struct proxy *px, struct listener *l, int flags,
                         struct field *stats, int len)
 {
-       struct chunk *out = get_trash_chunk();
+       struct buffer *out = get_trash_chunk();
 
        if (len < ST_F_TOTAL_FIELDS)
                return 0;
@@ -1483,7 +1489,7 @@ int stats_fill_sv_stats(struct proxy *px, struct server *sv, int flags,
 {
        struct server *via, *ref;
        char str[INET6_ADDRSTRLEN];
-       struct chunk *out = get_trash_chunk();
+       struct buffer *out = get_trash_chunk();
        enum srv_stats_state state;
        char *fld_status;
 
@@ -2638,7 +2644,7 @@ static int stats_process_http_post(struct stream_interface *si)
        char *st_cur_param = NULL;
        char *st_next_param = NULL;
 
-       struct chunk *temp;
+       struct buffer *temp;
        int reql;
 
        temp = get_trash_chunk();
@@ -3146,7 +3152,8 @@ static void http_stats_io_handler(struct appctx *appctx)
 }
 
 /* Dump all fields from <info> into <out> using the "show info" format (name: value) */
-static int stats_dump_info_fields(struct chunk *out, const struct field *info)
+static int stats_dump_info_fields(struct buffer *out,
+                                 const struct field *info)
 {
        int field;
 
@@ -3165,7 +3172,8 @@ static int stats_dump_info_fields(struct chunk *out, const struct field *info)
 }
 
 /* Dump all fields from <info> into <out> using the "show info typed" format */
-static int stats_dump_typed_info_fields(struct chunk *out, const struct field *info)
+static int stats_dump_typed_info_fields(struct buffer *out,
+                                       const struct field *info)
 {
        int field;
 
@@ -3193,7 +3201,7 @@ static int stats_dump_typed_info_fields(struct chunk *out, const struct field *i
 int stats_fill_info(struct field *info, int len)
 {
        unsigned int up = (now.tv_sec - start_date.tv_sec);
-       struct chunk *out = get_trash_chunk();
+       struct buffer *out = get_trash_chunk();
 
 #ifdef USE_OPENSSL
        int ssl_sess_rate = read_freq_ctr(&global.ssl_per_sec);
@@ -3315,7 +3323,7 @@ static int stats_dump_info_to_buffer(struct stream_interface *si)
  * Integer values bouned to the range [-(2**53)+1, (2**53)-1] as
  * per the recommendation for interoperable integers in section 6 of RFC 7159.
  */
-static void stats_dump_json_schema(struct chunk *out)
+static void stats_dump_json_schema(struct buffer *out)
 {
 
        int old_len = out->data;
index f688740af5ae71465b2098c1a7706379a3904788..e8d4f3a6038b4a21cda2b7c8d27ae3e5f0ad44e3 100644 (file)
@@ -3030,7 +3030,8 @@ enum {
  * read buffer. It returns 0 if the output buffer is full
  * and needs to be called again, otherwise non-zero.
  */
-static int table_dump_head_to_buffer(struct chunk *msg, struct stream_interface *si,
+static int table_dump_head_to_buffer(struct buffer *msg,
+                                     struct stream_interface *si,
                                      struct proxy *proxy, struct proxy *target)
 {
        struct stream *s = si_strm(si);
@@ -3055,7 +3056,8 @@ static int table_dump_head_to_buffer(struct chunk *msg, struct stream_interface
  * read buffer. It returns 0 if the output buffer is full
  * and needs to be called again, otherwise non-zero.
  */
-static int table_dump_entry_to_buffer(struct chunk *msg, struct stream_interface *si,
+static int table_dump_entry_to_buffer(struct buffer *msg,
+                                      struct stream_interface *si,
                                       struct proxy *proxy, struct stksess *entry)
 {
        int dt;
index 6c7bd5b93054e32374ba5cec8474186f4b82cc2b..3687bd05307e903e58adb0c659412faf76b981da 100644 (file)
@@ -1226,7 +1226,7 @@ static int process_switching_rules(struct stream *s, struct channel *req, int an
                                struct proxy *backend = NULL;
 
                                if (rule->dynamic) {
-                                       struct chunk *tmp;
+                                       struct buffer *tmp;
 
                                        tmp = alloc_trash_chunk();
                                        if (!tmp)
index 245f680379aafb03ff25ac1d40c8bbb3c513c3f6..2fecb94036ce47b26f10abe72b3a03675d717518 100644 (file)
@@ -132,7 +132,8 @@ void stream_int_report_error(struct stream_interface *si)
  * not need to be empty before this, and its contents will not be overwritten.
  * The primary goal of this function is to return error messages to a client.
  */
-void stream_int_retnclose(struct stream_interface *si, const struct chunk *msg)
+void stream_int_retnclose(struct stream_interface *si,
+                         const struct buffer *msg)
 {
        struct channel *ic = si_ic(si);
        struct channel *oc = si_oc(si);
index 9d2dfa6443eff32ae31f38ed8a05cdcddeb8a8a4..f7ac9b665ed38ec235d560638b691a34b44abba6 100644 (file)
@@ -520,7 +520,7 @@ static void ha_wurfl_deinit(void)
 static int ha_wurfl_get_all(const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
        wurfl_device_handle dHandle;
-       struct chunk *temp;
+       struct buffer *temp;
        wurfl_information_t *wi;
        ha_wurfl_header_t wh;
 
@@ -584,7 +584,7 @@ static int ha_wurfl_get_all(const struct arg *args, struct sample *smp, const ch
 static int ha_wurfl_get(const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
        wurfl_device_handle dHandle;
-       struct chunk *temp;
+       struct buffer *temp;
        wurfl_data_t *wn = NULL;
        struct ebmb_node *node;
        ha_wurfl_header_t wh;