MAJOR: chunks: replace struct chunk with struct buffer

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.
This commit is contained in:
Willy Tarreau 2018-07-13 11:56:34 +02:00
parent 843b7cbe9d
commit 83061a820e
55 changed files with 299 additions and 263 deletions

View File

@ -29,8 +29,8 @@ uint8_t buf[MAX_RQ_SIZE];
char trash_buf[MAX_RQ_SIZE]; char trash_buf[MAX_RQ_SIZE];
char tmp_buf[MAX_RQ_SIZE]; char tmp_buf[MAX_RQ_SIZE];
struct chunk trash = { .area = trash_buf, .data = 0, .size = sizeof(trash_buf) }; struct buffer trash = { .area = trash_buf, .data = 0, .size = sizeof(trash_buf) };
struct chunk tmp = { .area = tmp_buf, .data = 0, .size = sizeof(tmp_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> /* 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 * has address <baseaddr>. String <pfx> may be placed as a prefix in front of

View File

@ -75,7 +75,7 @@ static const apr_bucket_type_t apr_bucket_type_defender = {
struct apr_bucket_defender { struct apr_bucket_defender {
apr_bucket_refcount refcount; apr_bucket_refcount refcount;
struct chunk buf; struct buffer buf;
}; };
static apr_status_t defender_bucket_read(apr_bucket *b, const char **str, 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); 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; struct apr_bucket_defender *d;
@ -112,7 +113,7 @@ static apr_bucket *defender_bucket_make(apr_bucket *b, const struct chunk *buf)
return b; 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_alloc_t *list)
{ {
apr_bucket *b = apr_bucket_alloc(sizeof(*b), 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_brigade *bb = NULL;
struct apr_bucket *d = NULL, *e = NULL; struct apr_bucket *d = NULL, *e = NULL;
struct chunk *method; struct buffer *method;
struct chunk *path; struct buffer *path;
struct chunk *query; struct buffer *query;
struct chunk *version; struct buffer *version;
struct chunk *body; struct buffer *body;
struct defender_header hdr; struct defender_header hdr;
char *hdr_ptr, *hdr_end; char *hdr_ptr, *hdr_end;

View File

@ -229,7 +229,7 @@ existing callbacks. Available callbacks are listed in the following structure:
struct http_msg *msg); struct http_msg *msg);
void (*http_reply) (struct stream *s, struct filter *f, void (*http_reply) (struct stream *s, struct filter *f,
short status, short status,
const struct chunk *msg); const struct buffer *msg);
/* /*
* TCP callbacks * TCP callbacks

View File

@ -25,75 +25,73 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <common/buf.h>
#include <common/config.h> #include <common/config.h>
#include <common/memory.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; struct pool_head *pool_head_trash;
/* function prototypes */ /* 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))); __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))); __attribute__ ((format(printf, 2, 3)));
int chunk_htmlencode(struct chunk *dst, struct chunk *src); int chunk_htmlencode(struct buffer *dst, struct buffer *src);
int chunk_asciiencode(struct chunk *dst, struct chunk *src, char qc); int chunk_asciiencode(struct buffer *dst, struct buffer *src, char qc);
int chunk_strcmp(const struct chunk *chk, const char *str); int chunk_strcmp(const struct buffer *chk, const char *str);
int chunk_strcasecmp(const struct chunk *chk, const char *str); int chunk_strcasecmp(const struct buffer *chk, const char *str);
struct chunk *get_trash_chunk(void); struct buffer *get_trash_chunk(void);
struct chunk *alloc_trash_chunk(void); struct buffer *alloc_trash_chunk(void);
int init_trash_buffers(int first); int init_trash_buffers(int first);
void deinit_trash_buffers(void); void deinit_trash_buffers(void);
/* /*
* free a trash chunk allocated by alloc_trash_chunk(). NOP on NULL. * 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); 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; 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->area = str;
chk->data = 0; chk->head = 0;
chk->data = 0;
chk->size = size; chk->size = size;
} }
/* report 0 in case of error, 1 if OK. */ /* 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)) if (len < 0 || (size && len > size))
return 0; return 0;
chk->area = str; chk->area = str;
chk->data = len; chk->head = 0;
chk->data = len;
chk->size = size; chk->size = size;
return 1; return 1;
} }
/* this is only for temporary manipulation, the chunk is read-only */ /* 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->area = (char *)str;
chk->head = 0;
chk->data = strlen(str); chk->data = strlen(str);
chk->size = 0; /* mark it read-only */ 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 /* copies memory area <src> into <chk> for <len> bytes. Returns 0 in
* case of failure. No trailing zero is added. * 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)) if (unlikely(len >= chk->size))
return 0; 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 /* appends memory area <src> after <chk> for <len> bytes. Returns 0 in
* case of failure. No trailing zero is added. * 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)) if (unlikely(chk->data < 0 || chk->data + len >= chk->size))
return 0; 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 /* copies str into <chk> followed by a trailing zero. Returns 0 in
* case of failure. * 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; 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 /* appends str after <chk> followed by a trailing zero. Returns 0 in
* case of failure. * 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; 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>. /* appends <nb> characters from str after <chk>.
* Returns 0 in case of failure. * 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)) if (unlikely(chk->data < 0 || chk->data + nb >= chk->size))
return 0; return 0;
@ -185,7 +185,7 @@ static inline int chunk_strncat(struct chunk *chk, const char *str, int nb)
* chunk_appendf(&trash, "%s", gethosname()); * chunk_appendf(&trash, "%s", gethosname());
* printf("hostname=<%s>, pid=<%d>\n", name, pid); * 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) if (chk->data < 0 || chk->data + 1 >= chk->size)
return NULL; return NULL;
@ -194,14 +194,14 @@ static inline char *chunk_newstr(struct chunk *chk)
return chk->area + chk->data; 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->area = NULL;
chk->data = -1; chk->data = -1;
chk->size = 0; chk->size = 0;
} }
static inline void chunk_destroy(struct chunk *chk) static inline void chunk_destroy(struct buffer *chk)
{ {
if (!chk->size) if (!chk->size)
return; 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 * the destination string is returned, or NULL if the allocation fails or if
* any pointer is NULL. * 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) if (!dst || !src || src->data < 0 || !src->area)
return NULL; return NULL;
if (dst->size) if (dst->size)
free(dst->area); free(dst->area);
dst->head = src->head;
dst->data = src->data; dst->data = src->data;
dst->size = src->data; dst->size = src->data;
if (dst->size < src->size || !src->size) 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); dst->area = (char *)malloc(dst->size);
if (!dst->area) { if (!dst->area) {
dst->head = 0;
dst->data = 0; dst->data = 0;
dst->size = 0; dst->size = 0;
return NULL; return NULL;

View File

@ -34,6 +34,7 @@
#include <common/hpack-tbl.h> #include <common/hpack-tbl.h>
int hpack_decode_frame(struct hpack_dht *dht, const uint8_t *raw, uint32_t len, 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 */ #endif /* _COMMON_HPACK_DEC_H */

View File

@ -33,6 +33,7 @@
#include <common/config.h> #include <common/config.h>
#include <common/ist.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 */ #endif /* _COMMON_HPACK_ENC_H */

View File

@ -486,7 +486,7 @@ char *encode_string(char *start, char *stop,
*/ */
char *encode_chunk(char *start, char *stop, char *encode_chunk(char *start, char *stop,
const char escape, const fd_set *map, 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> * 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, char *escape_chunk(char *start, char *stop,
const char escape, const fd_set *map, 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 /* 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 * This function appends the encoding to the existing output chunk. Please
* use csv_enc() instead if you want to replace the output chunk. * 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 */ /* 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); chunk_reset(output);
return csv_enc_append(str, quote, output); return csv_enc_append(str, quote, output);
@ -1317,9 +1318,9 @@ static inline unsigned long long rdtsc()
struct list; struct list;
int list_append_word(struct list *li, const char *str, char **err); 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_text(struct buffer *out, const char *buf, int bsize);
int dump_binary(struct chunk *out, const char *buf, int bsize); int dump_binary(struct buffer *out, const char *buf, int bsize);
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 *line, int ptr);
/* same as realloc() except that ptr is also freed upon failure */ /* same as realloc() except that ptr is also freed upon failure */

View File

@ -44,7 +44,8 @@ static inline struct action_kw *action_lookup(struct list *keywords, const char
return NULL; 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; struct action_kw_list *kw_list;
int i; int i;

View 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 * Channel flag READ_PARTIAL is updated if some data can be transferred. The
* chunk's length is updated with the number of bytes sent. * 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; int ret;

View 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); 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_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_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); int flt_pre_analyze(struct stream *s, struct channel *chn, unsigned int an_bit);

View File

@ -45,7 +45,7 @@
*/ */
extern const int http_err_codes[HTTP_ERR_SIZE]; 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_302;
extern const char *HTTP_303; 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); 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_req_rules(struct list *r);
void free_http_res_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); void http_reply_and_close(struct stream *s, short status, struct buffer *msg);
struct chunk *http_error_message(struct stream *s); struct buffer *http_error_message(struct stream *s);
struct redirect_rule *http_parse_redirect_rule(const char *file, int linenum, struct proxy *curproxy, 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); 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); int smp_fetch_cookie(const struct arg *args, struct sample *smp, const char *kw, void *private);

View 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_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_stopped(struct server *s, const char *reason, struct check *check);
void srv_set_running(struct server *s, const char *reason, struct check *check); void srv_set_running(struct server *s, const char *reason, struct check *check);

View 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_STR:
case SMP_T_BIN: { 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 /* Here, we need to know if the sample has already been
* partially encoded. If yes, we only need to encode the * 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 * type (string or binary), the buffer length
* (as a varint) and at least 1 byte of the * (as a varint) and at least 1 byte of the
* buffer. */ * buffer. */
struct chunk *chk = &smp->data.u.str; struct buffer *chk = &smp->data.u.str;
*p++ = (smp->data.type == SMP_T_STR) *p++ = (smp->data.type == SMP_T_STR)
? SPOE_DATA_T_STR ? SPOE_DATA_T_STR

View 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); 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_sess(struct connection *conn);
int ssl_sock_get_cert_used_conn(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_remote_common_name(struct connection *conn,
int ssl_sock_get_pkey_algo(struct connection *conn, struct chunk *out); 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); unsigned int ssl_sock_get_verify_result(struct connection *conn);
#if (defined SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB && !defined OPENSSL_NO_OCSP) #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 #endif
#if (defined SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB && TLS_TICKETS_NO > 0) #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); void ssl_sock_update_tlskey_ref(struct tls_keys_ref *ref,
int ssl_sock_update_tlskey(char *filename, struct chunk *tlskey, char **err); 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_lookup(const char *filename);
struct tls_keys_ref *tlskeys_ref_lookupid(int unique_id); struct tls_keys_ref *tlskeys_ref_lookupid(int unique_id);
#endif #endif

View 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; extern struct applet http_stats_applet;
void stats_io_handler(struct stream_interface *si); void stats_io_handler(struct stream_interface *si);
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);
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);
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);
#endif /* _PROTO_STATS_H */ #endif /* _PROTO_STATS_H */

View File

@ -36,7 +36,8 @@
/* main event functions used to move data between sockets and buffers */ /* main event functions used to move data between sockets and buffers */
int stream_int_check_timeouts(struct stream_interface *si); int stream_int_check_timeouts(struct stream_interface *si);
void stream_int_report_error(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); int conn_si_send_proxy(struct connection *conn, unsigned int flag);
void stream_sock_read0(struct stream_interface *si); void stream_sock_read0(struct stream_interface *si);

View File

@ -57,7 +57,7 @@ struct appctx {
unsigned short state; /* Internal appctx state */ unsigned short state; /* Internal appctx state */
unsigned int st0; /* CLI state for stats, session state for peers */ 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 */ 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 */ unsigned int st2; /* output state for stats, unused by peers */
struct applet *applet; /* applet this context refers to */ struct applet *applet; /* applet this context refers to */
void *owner; /* pointer to upper layer's entity (eg: stream interface) */ void *owner; /* pointer to upper layer's entity (eg: stream interface) */
@ -150,7 +150,7 @@ struct appctx {
struct pat_ref *ref; struct pat_ref *ref;
struct bref bref; /* back-reference from the pat_ref_elt being dumped */ struct bref bref; /* back-reference from the pat_ref_elt being dumped */
struct pattern_expr *expr; struct pattern_expr *expr;
struct chunk chunk; struct buffer chunk;
} map; } map;
struct { struct {
struct hlua *hlua; struct hlua *hlua;

View File

@ -92,7 +92,7 @@ struct my_regex;
union arg_data { union arg_data {
long long int sint; long long int sint;
struct chunk str; struct buffer str;
struct in_addr ipv4; struct in_addr ipv4;
struct in6_addr ipv6; struct in6_addr ipv6;
struct proxy *prx; /* used for fe, be, tables */ struct proxy *prx; /* used for fe, be, tables */

View File

@ -311,7 +311,7 @@ struct mux_ops {
struct conn_stream *(*attach)(struct connection *); /* Create and attach a conn_stream to an outgoing connection */ 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 (*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_*) */ unsigned int flags; /* some flags characterizing the mux's capabilities (MX_FL_*) */
char name[8]; /* mux layer name, zero-terminated */ char name[8]; /* mux layer name, zero-terminated */
}; };

View File

@ -189,7 +189,7 @@ struct flt_ops {
void (*http_reset) (struct stream *s, struct filter *f, struct http_msg *msg); void (*http_reset) (struct stream *s, struct filter *f, struct http_msg *msg);
void (*http_reply) (struct stream *s, struct filter *f, short status, void (*http_reply) (struct stream *s, struct filter *f, short status,
const struct chunk *msg); const struct buffer *msg);
/* /*
* TCP callbacks * TCP callbacks

View File

@ -127,7 +127,7 @@ struct global {
char *chroot; char *chroot;
char *pidfile; char *pidfile;
char *node, *desc; /* node name & description */ char *node, *desc; /* node name & description */
struct chunk log_tag; /* name for syslog */ struct buffer log_tag; /* name for syslog */
struct list logsrvs; struct list logsrvs;
char *log_send_hostname; /* set hostname in syslog header */ char *log_send_hostname; /* set hostname in syslog header */
char *server_state_base; /* path to a directory where server state files can be found */ 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 actconn; /* # of active sessions */
extern int listeners; extern int listeners;
extern int jobs; /* # of active jobs (listeners, sessions, open devices) */ 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 int nb_oldpids; /* contains the number of old pids found */
extern const int zero; extern const int zero;
extern const int one; extern const int one;

View File

@ -301,7 +301,7 @@ struct http_msg {
struct http_auth_data { struct http_auth_data {
enum ht_auth_m method; /* one of HTTP_AUTH_* */ enum ht_auth_m method; /* one of HTTP_AUTH_* */
/* 7 bytes unused here */ /* 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 */ char *user, *pass; /* extracted username & password */
}; };

View File

@ -356,7 +356,7 @@ struct proxy {
struct list logsrvs; struct list logsrvs;
struct list logformat; /* log_format linked list */ struct list logformat; /* log_format linked list */
struct list logformat_sd; /* log_format linked list for the RFC5424 structured-data part */ 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 */ char *header_unique_id; /* unique-id header */
struct list format_unique_id; /* unique-id format */ struct list format_unique_id; /* unique-id format */
int to_log; /* things to be logged (LW_*) */ 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 *check_path; /* PATH environment to use for external agent checks */
char *expect_str; /* http-check expected content : string or text version of the regex */ char *expect_str; /* http-check expected content : string or text version of the regex */
struct my_regex *expect_regex; /* http-check expected content */ 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 */ int uuid; /* universally unique proxy ID, used for SNMP */
unsigned int backlog; /* force the frontend's listen backlog */ unsigned int backlog; /* force the frontend's listen backlog */
unsigned long bind_proc; /* bitmask of processes using this proxy */ unsigned long bind_proc; /* bitmask of processes using this proxy */

View File

@ -244,14 +244,14 @@ union smp_ctx {
*/ */
struct meth { struct meth {
enum http_meth_t meth; enum http_meth_t meth;
struct chunk str; struct buffer str;
}; };
union sample_value { union sample_value {
long long int sint; /* used for signed 64bits integers */ long long int sint; /* used for signed 64bits integers */
struct in_addr ipv4; /* used for ipv4 addresses */ struct in_addr ipv4; /* used for ipv4 addresses */
struct in6_addr ipv6; /* used for ipv6 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 */ struct meth meth; /* used for http method */
}; };

View File

@ -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. */ 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; char *data_file_path;
int header_count; /* number of HTTP headers related to device detection. */ 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. */ fiftyoneDegreesDataSet data_set; /* data set used with the pattern and trie detection methods. */
#ifdef FIFTYONEDEGREES_H_PATTERN_INCLUDED #ifdef FIFTYONEDEGREES_H_PATTERN_INCLUDED
fiftyoneDegreesWorksetPool *pool; /* pool of worksets to avoid creating a new one for each request. */ 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 #ifdef FIFTYONEDEGREES_H_PATTERN_INCLUDED
static void _51d_lru_free(void *cache_entry) static void _51d_lru_free(void *cache_entry)
{ {
struct chunk *ptr = cache_entry; struct buffer *ptr = cache_entry;
if (!ptr) if (!ptr)
return; 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) 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) if (!cache_entry)
return; 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) 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.area = cache_entry->area;
smp->data.u.str.data = cache_entry->data; 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 #endif
char no_data[] = "NoData"; /* response when no data could be found */ 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; int j, i = 0, found;
const char* property_name; const char* property_name;
@ -503,7 +503,7 @@ void _51d_init_http_headers()
const fiftyoneDegreesAsciiString *headerName; const fiftyoneDegreesAsciiString *headerName;
fiftyoneDegreesDataSet *ds = &global_51degrees.data_set; fiftyoneDegreesDataSet *ds = &global_51degrees.data_set;
global_51degrees.header_count = ds->httpHeadersCount; 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++) { for (index = 0; index < global_51degrees.header_count; index++) {
headerName = fiftyoneDegreesGetString(ds, ds->httpHeaders[index].headerNameOffset); headerName = fiftyoneDegreesGetString(ds, ds->httpHeaders[index].headerNameOffset);
(global_51degrees.header_names + index)->area = (char*)&headerName->firstByte; (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.header_count = fiftyoneDegreesGetHttpHeaderCount(ds);
global_51degrees.device_offsets.firstOffset = malloc( global_51degrees.device_offsets.firstOffset = malloc(
global_51degrees.header_count * sizeof(fiftyoneDegreesDeviceOffset)); 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)); global_51degrees.header_offsets = malloc(global_51degrees.header_count * sizeof(int32_t));
for (index = 0; index < global_51degrees.header_count; index++) { for (index = 0; index < global_51degrees.header_count; index++) {
global_51degrees.header_offsets[index] = fiftyoneDegreesGetHttpHeaderNameOffset(ds, index); global_51degrees.header_offsets[index] = fiftyoneDegreesGetHttpHeaderNameOffset(ds, index);
@ -538,7 +538,7 @@ void _51d_init_http_headers()
static int init_51degrees(void) static int init_51degrees(void)
{ {
int i = 0; int i = 0;
struct chunk *temp; struct buffer *temp;
struct _51d_property_names *name; struct _51d_property_names *name;
char **_51d_property_list = NULL; char **_51d_property_list = NULL;
fiftyoneDegreesDataSetInitStatus _51d_dataset_status = DATA_SET_INIT_STATUS_NOT_SET; fiftyoneDegreesDataSetInitStatus _51d_dataset_status = DATA_SET_INIT_STATUS_NOT_SET;

View File

@ -345,7 +345,7 @@ int http_calc_maxage(struct stream *s, struct cache *cache)
value = directive_value(directive, ctx.vlen, "s-maxage", 8); value = directive_value(directive, ctx.vlen, "s-maxage", 8);
if (value) { 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, value, ctx.vlen - 8 + 1);
chunk_strncat(chk, "", 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); value = directive_value(ctx.line + ctx.val, ctx.vlen, "max-age", 7);
if (value) { 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, value, ctx.vlen - 7 + 1);
chunk_strncat(chk, "", 1); chunk_strncat(chk, "", 1);
@ -637,7 +637,7 @@ int sha1_hosturi(struct http_txn *txn)
struct hdr_ctx ctx; struct hdr_ctx ctx;
blk_SHA_CTX sha1_ctx; blk_SHA_CTX sha1_ctx;
struct chunk *trash; struct buffer *trash;
char *path; char *path;
char *end; char *end;
trash = get_trash_chunk(); trash = get_trash_chunk();

View 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 conn_stream *cs = check->cs;
struct connection *conn = cs_conn(cs); struct connection *conn = cs_conn(cs);
const char *err_msg; const char *err_msg;
struct chunk *chk; struct buffer *chk;
int step; int step;
char *comment; char *comment;
@ -1103,7 +1103,7 @@ static void event_srv_chk_r(struct conn_stream *cs)
* ERR first, then WARN. * ERR first, then WARN.
*/ */
const char *msg = cmd; const char *msg = cmd;
struct chunk *t; struct buffer *t;
if (!*msg || status == HCHK_STATUS_L7OKD) { if (!*msg || status == HCHK_STATUS_L7OKD) {
if (err && *err) if (err && *err)

View File

@ -22,9 +22,9 @@
#include <types/global.h> #include <types/global.h>
/* trash chunks used for various conversions */ /* trash chunks used for various conversions */
static THREAD_LOCAL struct chunk *trash_chunk; static THREAD_LOCAL struct buffer *trash_chunk;
static THREAD_LOCAL struct chunk trash_chunk1; static THREAD_LOCAL struct buffer trash_chunk1;
static THREAD_LOCAL struct chunk trash_chunk2; static THREAD_LOCAL struct buffer trash_chunk2;
/* trash buffers used for various conversions */ /* trash buffers used for various conversions */
static int trash_size; static int trash_size;
@ -35,7 +35,7 @@ static THREAD_LOCAL char *trash_buf2;
struct pool_head *pool_head_trash = NULL; struct pool_head *pool_head_trash = NULL;
/* this is used to drain data, and as a temporary buffer for sprintf()... */ /* 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 * 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 * a zero is always emitted at the beginning of the string so that it may be
* used as an empty string as well. * used as an empty string as well.
*/ */
struct chunk *get_trash_chunk(void) struct buffer *get_trash_chunk(void)
{ {
char *trash_buf; char *trash_buf;
@ -97,7 +97,9 @@ int init_trash_buffers(int first)
hap_register_per_thread_deinit(deinit_trash_buffers_per_thread); hap_register_per_thread_deinit(deinit_trash_buffers_per_thread);
} }
pool_destroy(pool_head_trash); 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)) if (!pool_head_trash || !alloc_trash_buffers(global.tune.bufsize))
return 0; return 0;
return 1; return 1;
@ -117,15 +119,16 @@ void deinit_trash_buffers(void)
* call may fail and the caller is responsible for checking that the returned * call may fail and the caller is responsible for checking that the returned
* pointer is not NULL. * 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); chunk = pool_alloc(pool_head_trash);
if (chunk) { if (chunk) {
char *buf = (char *)chunk + sizeof(struct chunk); char *buf = (char *)chunk + sizeof(struct buffer);
*buf = 0; *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; 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 * 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. * 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; va_list argp;
int ret; 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 * at most chk->size chars. If the chk->len is over, nothing is added. Returns
* the new chunk size. * 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; va_list argp;
int ret; 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;". * 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. * 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 i, l;
int olen, free; 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>". * 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. * 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 i, l;
int olen, free; 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 * zero-terminated. Return is the same as with strcmp(). Neither is allowed
* to be null. * 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; const char *s1 = chk->area;
int len = chk->data; 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(). * <str> which must be zero-terminated. Return is the same as with strcmp().
* Neither is allowed to be null. * 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; const char *s1 = chk->area;
int len = chk->data; int len = chk->data;

View File

@ -96,8 +96,8 @@ static char *cli_gen_usage_msg(struct appctx *appctx)
{ {
struct cli_kw_list *kw_list; struct cli_kw_list *kw_list;
struct cli_kw *kw; struct cli_kw *kw;
struct chunk *tmp = get_trash_chunk(); struct buffer *tmp = get_trash_chunk();
struct chunk out; struct buffer out;
free(dynamic_usage_msg); free(dynamic_usage_msg);
dynamic_usage_msg = NULL; 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 */ /* 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) 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)) if (likely(severity_output == CLI_SEVERITY_NONE))
return ci_putblk(chn, msg, strlen(msg)); return ci_putblk(chn, msg, strlen(msg));

View 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; tlv->client |= PP2_CLIENT_CERT_CONN;
} }
if (srv->pp_opts & SRV_PP_V2_SSL_CN) { 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) { 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, ssl_tlv_len += make_tlv(&buf[ret+ssl_tlv_len], (buf_len - ret - ssl_tlv_len), PP2_SUBTYPE_SSL_CN,
cn_trash->data, 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) { 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) { 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, ssl_tlv_len += make_tlv(&buf[ret+ssl_tlv_len], (buf_len - ret - ssl_tlv_len), PP2_SUBTYPE_SSL_KEY_ALG,
pkey_trash->data, pkey_trash->data,

View File

@ -183,7 +183,7 @@ static void deinit_deviceatlas(void)
static int da_haproxy(const struct arg *args, struct sample *smp, da_deviceinfo_t *devinfo) 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_propid_t prop, *pprop;
da_status_t status; da_status_t status;
da_type_t proptype; da_type_t proptype;

View File

@ -667,7 +667,7 @@ flt_http_reset(struct stream *s, struct http_msg *msg)
* decides to stop the HTTP message processing. * decides to stop the HTTP message processing.
*/ */
void 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; struct filter *filter;

View File

@ -387,7 +387,7 @@ spoe_str_to_vsn(const char *str, size_t len)
static int static int
spoe_prepare_hahello_frame(struct appctx *appctx, char *frame, size_t size) 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; struct spoe_agent *agent = SPOE_APPCTX(appctx)->agent;
char *p, *end; char *p, *end;
unsigned int flags = SPOE_FRM_FL_FIN; unsigned int flags = SPOE_FRM_FL_FIN;

View File

@ -440,7 +440,7 @@ trace_http_reset(struct stream *s, struct filter *filter,
static void static void
trace_http_reply(struct stream *s, struct filter *filter, short status, 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); struct trace_config *conf = FLT_CONF(filter);

View File

@ -291,7 +291,7 @@ __LJMP static const char *hlua_traceback(lua_State *L)
{ {
lua_Debug ar; lua_Debug ar;
int level = 0; int level = 0;
struct chunk *msg = get_trash_chunk(); struct buffer *msg = get_trash_chunk();
int filled = 0; int filled = 0;
while (lua_getstack(L, level++, &ar)) { 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) __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)); struct hlua_appctx *appctx = MAY_LJMP(hlua_checkapplet_http(L, 1));
const char *name; const char *name;
size_t name_len; 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 hlua_function *fcn = private;
struct stream *stream = smp->strm; struct stream *stream = smp->strm;
const char *error; const char *error;
const struct chunk msg = { }; const struct buffer msg = { };
if (!stream) if (!stream)
return 0; return 0;
@ -6116,7 +6116,7 @@ static enum act_return hlua_action(struct act_rule *rule, struct proxy *px,
unsigned int analyzer; unsigned int analyzer;
int dir; int dir;
const char *error; const char *error;
const struct chunk msg = { }; const struct buffer msg = { };
switch (rule->from) { switch (rule->from) {
case ACT_F_TCP_REQ_CNT: analyzer = AN_REQ_INSPECT_FE ; dir = SMP_OPT_DIR_REQ; break; case ACT_F_TCP_REQ_CNT: analyzer = AN_REQ_INSPECT_FE ; dir = SMP_OPT_DIR_REQ; break;

View File

@ -1191,7 +1191,7 @@ static int hlua_regex_exec(struct lua_State *L)
struct my_regex *regex; struct my_regex *regex;
const char *str; const char *str;
size_t len; size_t len;
struct chunk *tmp; struct buffer *tmp;
regex = hlua_check_regex(L, 1); regex = hlua_check_regex(L, 1);
str = luaL_checklstring(L, 2, &len); str = luaL_checklstring(L, 2, &len);
@ -1219,7 +1219,7 @@ static int hlua_regex_match(struct lua_State *L)
regmatch_t pmatch[20]; regmatch_t pmatch[20];
int ret; int ret;
int i; int i;
struct chunk *tmp; struct buffer *tmp;
regex = hlua_check_regex(L, 1); regex = hlua_check_regex(L, 1);
str = luaL_checklstring(L, 2, &len); str = luaL_checklstring(L, 2, &len);

View 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 * allocated there. In case of allocation failure, returns a string whose
* pointer is NULL. * 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; 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. * 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, 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 idx;
uint32_t nlen; uint32_t nlen;

View 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>. /* 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). * 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 len = out->data;
int size = out->size; int size = out->size;

View File

@ -48,8 +48,8 @@
struct log_fmt { struct log_fmt {
char *name; char *name;
struct { struct {
struct chunk sep1; /* first pid separator */ struct buffer sep1; /* first pid separator */
struct chunk sep2; /* second pid separator */ struct buffer sep2; /* second pid separator */
} pid; } pid;
}; };
@ -1006,7 +1006,7 @@ static char *lf_encode_string(char *start, char *stop,
*/ */
static char *lf_encode_chunk(char *start, char *stop, static char *lf_encode_chunk(char *start, char *stop,
const char escape, const fd_set *map, const char escape, const fd_set *map,
const struct chunk *chunk, const struct buffer *chunk,
struct logformat_node *node) struct logformat_node *node)
{ {
char *str, *end; char *str, *end;
@ -1158,7 +1158,7 @@ static char *update_log_hdr(const time_t time)
{ {
static THREAD_LOCAL long tvsec; static THREAD_LOCAL long tvsec;
static THREAD_LOCAL char *dataptr = NULL; /* backup of last end of header, NULL first time */ 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; static THREAD_LOCAL int sep = 0;
if (unlikely(time != tvsec || dataptr == NULL)) { 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; char *hdr, *hdr_ptr;
size_t hdr_size; size_t hdr_size;
time_t time = date.tv_sec; 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 int curr_pid;
static THREAD_LOCAL char pidstr[100]; static THREAD_LOCAL char pidstr[100];
static THREAD_LOCAL struct chunk pid; static THREAD_LOCAL struct buffer pid;
msghdr.msg_iov = iovec; 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 *fe = sess->fe;
struct proxy *be = s->be; struct proxy *be = s->be;
struct http_txn *txn = s->txn; struct http_txn *txn = s->txn;
struct chunk chunk; struct buffer chunk;
char *uri; char *uri;
char *spc; char *spc;
char *qmark; char *qmark;
@ -1606,7 +1606,7 @@ int build_logline(struct stream *s, char *dst, size_t maxsize, struct list *list
struct connection *conn; struct connection *conn;
const char *src = NULL; const char *src = NULL;
struct sample *key; struct sample *key;
const struct chunk empty = { }; const struct buffer empty = { };
switch (tmp->type) { switch (tmp->type) {
case LOG_FMT_SEPARATOR: case LOG_FMT_SEPARATOR:

View File

@ -172,7 +172,7 @@ static int sample_conv_map(const struct arg *arg_p, struct sample *smp, void *pr
{ {
struct map_descriptor *desc; struct map_descriptor *desc;
struct pattern *pat; struct pattern *pat;
struct chunk *str; struct buffer *str;
/* get config */ /* get config */
desc = arg_p[0].data.map; desc = arg_p[0].data.map;

View File

@ -670,7 +670,7 @@ static int h2c_snd_settings(struct h2c *h2c)
{ {
struct buffer *res; struct buffer *res;
char buf_data[100]; // enough for 15 settings char buf_data[100]; // enough for 15 settings
struct chunk buf; struct buffer buf;
int ret; int ret;
if (h2c_mux_busy(h2c, NULL)) { 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; struct h2c *h2c = h2s->h2c;
const uint8_t *hdrs = (uint8_t *)b_head(&h2c->dbuf); 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 http_hdr list[MAX_HTTP_HDR * 2];
struct chunk *copy = NULL; struct buffer *copy = NULL;
unsigned int msgf; unsigned int msgf;
int flen = h2c->dfl; int flen = h2c->dfl;
int outlen = 0; 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 http_hdr list[MAX_HTTP_HDR];
struct h2c *h2c = h2s->h2c; struct h2c *h2c = h2s->h2c;
struct h1m *h1m = &h2s->res; struct h1m *h1m = &h2s->res;
struct chunk outbuf; struct buffer outbuf;
int es_now = 0; int es_now = 0;
int ret = 0; int ret = 0;
int hdr; 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 h2c *h2c = h2s->h2c;
struct h1m *h1m = &h2s->res; struct h1m *h1m = &h2s->res;
struct chunk outbuf; struct buffer outbuf;
int ret = 0; int ret = 0;
size_t total = 0; size_t total = 0;
int es_now = 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 */ /* 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 h2c *h2c = conn->mux_ctx;
struct h2s *h2s; struct h2s *h2s;

View 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. */ /* Parse a binary written in hexa. It is allocated. */
int pat_parse_bin(const char *text, struct pattern *pattern, int mflags, char **err) 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; pattern->type = SMP_T_BIN;
trash = get_trash_chunk(); trash = get_trash_chunk();

View File

@ -387,7 +387,7 @@ static int peer_prepare_switchmsg(struct shared_table *st, char *msg, size_t siz
{ {
int len; int len;
unsigned short datalen; unsigned short datalen;
struct chunk *chunk; struct buffer *chunk;
char *cursor, *datamsg, *chunkp, *chunkq; char *cursor, *datamsg, *chunkp, *chunkq;
uint64_t data = 0; uint64_t data = 0;
unsigned int data_type; unsigned int data_type;

View File

@ -78,7 +78,7 @@
const char HTTP_100[] = const char HTTP_100[] =
"HTTP/1.1 100 Continue\r\n\r\n"; "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, .area = (char *)&HTTP_100,
.data = sizeof(HTTP_100)-1 .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 /* We must put the messages here since GCC cannot initialize consts depending
* on strlen(). * 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() */ /* this struct is used between calls to smp_fetch_hdr() or smp_fetch_cookie() */
static THREAD_LOCAL struct hdr_ctx static_hdr_ctx; 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. * in this buffer will be lost.
*/ */
static void http_server_error(struct stream *s, struct stream_interface *si, 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)); FLT_STRM_CB(s, flt_http_reply(s, s->txn->status, msg));
channel_auto_read(si_oc(si)); channel_auto_read(si_oc(si));
@ -938,7 +938,7 @@ static void http_server_error(struct stream *s, struct stream_interface *si,
* and message. * 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); const int msgnum = http_get_status_idx(s->txn->status);
@ -951,7 +951,7 @@ struct chunk *http_error_message(struct stream *s)
} }
void 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; s->txn->flags &= ~TX_WAIT_NEXT_RQ;
FLT_STRM_CB(s, flt_http_reply(s, status, msg)); 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 http_txn *txn = s->txn;
struct chunk auth_method; struct buffer auth_method;
struct hdr_ctx ctx; struct hdr_ctx ctx;
char *h, *p; char *h, *p;
int len; 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); chunk_initlen(&txn->auth.method_data, p + 1, 0, ctx.vlen - len - 1);
if (!strncasecmp("Basic", auth_method.area, auth_method.data)) { 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, len = base64dec(txn->auth.method_data.area,
txn->auth.method_data.data, 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; struct hdr_idx *idx = &s->txn->hdr_idx;
int (*http_find_hdr_func)(const char *name, int len, char *sol, int (*http_find_hdr_func)(const char *name, int len, char *sol,
struct hdr_idx *idx, struct hdr_ctx *ctx); struct hdr_idx *idx, struct hdr_ctx *ctx);
struct chunk *output = get_trash_chunk(); struct buffer *output = get_trash_chunk();
ctx.idx = 0; 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, struct list *fmt, struct my_regex *re,
int action) int action)
{ {
struct chunk *replace; struct buffer *replace;
int ret = -1; int ret = -1;
replace = alloc_trash_chunk(); replace = alloc_trash_chunk();
@ -2607,7 +2607,7 @@ resume_execution:
* buffer, we build first the header value using build_logline, and * buffer, we build first the header value using build_logline, and
* after we store the header name. * after we store the header name.
*/ */
struct chunk *replace; struct buffer *replace;
replace = alloc_trash_chunk(); replace = alloc_trash_chunk();
if (!replace) if (!replace)
@ -2655,7 +2655,7 @@ resume_execution:
case ACT_HTTP_DEL_ACL: case ACT_HTTP_DEL_ACL:
case ACT_HTTP_DEL_MAP: { case ACT_HTTP_DEL_MAP: {
struct pat_ref *ref; struct pat_ref *ref;
struct chunk *key; struct buffer *key;
/* collect reference */ /* collect reference */
ref = pat_ref_lookup(rule->arg.map.ref); ref = pat_ref_lookup(rule->arg.map.ref);
@ -2684,7 +2684,7 @@ resume_execution:
case ACT_HTTP_ADD_ACL: { case ACT_HTTP_ADD_ACL: {
struct pat_ref *ref; struct pat_ref *ref;
struct chunk *key; struct buffer *key;
/* collect reference */ /* collect reference */
ref = pat_ref_lookup(rule->arg.map.ref); ref = pat_ref_lookup(rule->arg.map.ref);
@ -2714,7 +2714,7 @@ resume_execution:
case ACT_HTTP_SET_MAP: { case ACT_HTTP_SET_MAP: {
struct pat_ref *ref; struct pat_ref *ref;
struct chunk *key, *value; struct buffer *key, *value;
/* collect reference */ /* collect reference */
ref = pat_ref_lookup(rule->arg.map.ref); ref = pat_ref_lookup(rule->arg.map.ref);
@ -2929,7 +2929,7 @@ resume_execution:
case ACT_HTTP_SET_HDR: case ACT_HTTP_SET_HDR:
case ACT_HTTP_ADD_HDR: { case ACT_HTTP_ADD_HDR: {
struct chunk *replace; struct buffer *replace;
replace = alloc_trash_chunk(); replace = alloc_trash_chunk();
if (!replace) if (!replace)
@ -2980,7 +2980,7 @@ resume_execution:
case ACT_HTTP_DEL_ACL: case ACT_HTTP_DEL_ACL:
case ACT_HTTP_DEL_MAP: { case ACT_HTTP_DEL_MAP: {
struct pat_ref *ref; struct pat_ref *ref;
struct chunk *key; struct buffer *key;
/* collect reference */ /* collect reference */
ref = pat_ref_lookup(rule->arg.map.ref); ref = pat_ref_lookup(rule->arg.map.ref);
@ -3009,7 +3009,7 @@ resume_execution:
case ACT_HTTP_ADD_ACL: { case ACT_HTTP_ADD_ACL: {
struct pat_ref *ref; struct pat_ref *ref;
struct chunk *key; struct buffer *key;
/* collect reference */ /* collect reference */
ref = pat_ref_lookup(rule->arg.map.ref); ref = pat_ref_lookup(rule->arg.map.ref);
@ -3037,7 +3037,7 @@ resume_execution:
case ACT_HTTP_SET_MAP: { case ACT_HTTP_SET_MAP: {
struct pat_ref *ref; struct pat_ref *ref;
struct chunk *key, *value; struct buffer *key, *value;
/* collect reference */ /* collect reference */
ref = pat_ref_lookup(rule->arg.map.ref); 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 *req = &txn->req;
struct http_msg *res = &txn->rsp; struct http_msg *res = &txn->rsp;
const char *msg_fmt; const char *msg_fmt;
struct chunk *chunk; struct buffer *chunk;
int ret = 0; int ret = 0;
chunk = alloc_trash_chunk(); 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) smp_fetch_hdrs_bin(const struct arg *args, struct sample *smp, const char *kw, void *private)
{ {
struct http_msg *msg; struct http_msg *msg;
struct chunk *temp; struct buffer *temp;
struct hdr_idx *idx; struct hdr_idx *idx;
const char *cur_ptr, *cur_next, *p; const char *cur_ptr, *cur_next, *p;
int old_idx, cur_idx; 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 len;
unsigned long block1; unsigned long block1;
char *body; char *body;
struct chunk *temp; struct buffer *temp;
CHECK_HTTP_MESSAGE_FIRST(); 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_idx *idx;
struct hdr_ctx ctx; struct hdr_ctx ctx;
const struct http_msg *msg; const struct http_msg *msg;
struct chunk *temp; struct buffer *temp;
char del = ','; char del = ',';
if (args && args->type == ARGT_STR) 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; smp->data.type = SMP_T_IPV4;
break; break;
} else { } else {
struct chunk *temp = get_trash_chunk(); struct buffer *temp = get_trash_chunk();
if (smp->data.u.str.data < temp->size - 1) { if (smp->data.u.str.data < temp->size - 1) {
memcpy(temp->area, smp->data.u.str.area, memcpy(temp->area, smp->data.u.str.area,
smp->data.u.str.data); 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; struct http_txn *txn;
char *ptr, *end, *beg; char *ptr, *end, *beg;
struct hdr_ctx ctx; struct hdr_ctx ctx;
struct chunk *temp; struct buffer *temp;
CHECK_HTTP_MESSAGE_FIRST(); CHECK_HTTP_MESSAGE_FIRST();
@ -10521,7 +10521,7 @@ smp_fetch_base32(const struct arg *args, struct sample *smp, const char *kw, voi
static int static int
smp_fetch_base32_src(const struct arg *args, struct sample *smp, const char *kw, void *private) 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); struct connection *cli_conn = objt_conn(smp->sess->origin);
if (!cli_conn) if (!cli_conn)
@ -10807,7 +10807,7 @@ smp_fetch_capture_header_res(const struct arg *args, struct sample *smp, const c
static int static int
smp_fetch_capture_req_method(const struct arg *args, struct sample *smp, const char *kw, void *private) 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; struct http_txn *txn = smp->strm->txn;
char *ptr; char *ptr;
@ -10834,7 +10834,7 @@ smp_fetch_capture_req_method(const struct arg *args, struct sample *smp, const c
static int static int
smp_fetch_capture_req_uri(const struct arg *args, struct sample *smp, const char *kw, void *private) 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; struct http_txn *txn = smp->strm->txn;
char *ptr; 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) 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; const char *vstart, *vend;
struct chunk *temp; struct buffer *temp;
const char **chunks = (const char **)smp->ctx.a; const char **chunks = (const char **)smp->ctx.a;
if (!find_next_url_param(chunks, 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 static int
smp_fetch_url32_src(const struct arg *args, struct sample *smp, const char *kw, void *private) 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); struct connection *cli_conn = objt_conn(smp->sess->origin);
if (!cli_conn) 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 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" }; 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; struct tm *tm;
/* With high numbers, the date returned can be negative, the 55 bits mask prevent this. */ /* With high numbers, the date returned can be negative, the 55 bits mask prevent this. */
time_t curr_date = smp->data.u.sint & 0x007fffffffffffffLL; 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. * before decoding.
*/ */
if (smp->flags & SMP_F_CONST || smp->data.u.str.size <= smp->data.u.str.data) { 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); memcpy(str->area, smp->data.u.str.area, smp->data.u.str.data);
smp->data.u.str.area = str->area; smp->data.u.str.area = str->area;
smp->data.u.str.size = str->size; 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, enum act_return http_action_set_req_line(struct act_rule *rule, struct proxy *px,
struct session *sess, struct stream *s, int flags) struct session *sess, struct stream *s, int flags)
{ {
struct chunk *replace; struct buffer *replace;
enum act_return ret = ACT_RET_ERR; enum act_return ret = ACT_RET_ERR;
replace = alloc_trash_chunk(); replace = alloc_trash_chunk();

View 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 * It uses the proxy pointer from cli.p0, the proxy's id from cli.i0 and the server's
* pointer from cli.p1. * 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 appctx *appctx = __objt_appctx(si->end);
struct proxy *px = appctx->ctx.cli.p0; struct proxy *px = appctx->ctx.cli.p0;

View File

@ -508,7 +508,7 @@ static int c_ip2int(struct sample *smp)
static int c_ip2str(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)) if (!inet_ntop(AF_INET, (void *)&smp->data.u.ipv4, trash->area, trash->size))
return 0; return 0;
@ -538,7 +538,7 @@ static int c_ipv62ip(struct sample *smp)
static int c_ipv62str(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)) if (!inet_ntop(AF_INET6, (void *)&smp->data.u.ipv6, trash->area, trash->size))
return 0; return 0;
@ -623,7 +623,7 @@ static int c_bin2str(struct sample *smp)
static int c_int2str(struct sample *smp) static int c_int2str(struct sample *smp)
{ {
struct chunk *trash = get_trash_chunk(); struct buffer *trash = get_trash_chunk();
char *pos; char *pos;
pos = lltoa_r(smp->data.u.sint, trash->area, trash->size); 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) int smp_dup(struct sample *smp)
{ {
struct chunk *trash; struct buffer *trash;
switch (smp->data.type) { switch (smp->data.type) {
case SMP_T_BOOL: case SMP_T_BOOL:
@ -763,7 +763,7 @@ static int c_meth2str(struct sample *smp)
static int c_addr2bin(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) { if (smp->data.type == SMP_T_IPV4) {
chk->data = 4; chk->data = 4;
@ -783,7 +783,7 @@ static int c_addr2bin(struct sample *smp)
static int c_int2bin(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); *(unsigned long long int *) chk->area = my_htonll(smp->data.u.sint);
chk->data = 8; 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) 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; int bin_len;
trash->data = 0; 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) 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; int b64_len;
trash->data = 0; 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) static int sample_conv_sha1(const struct arg *arg_p, struct sample *smp, void *private)
{ {
blk_SHA_CTX ctx; blk_SHA_CTX ctx;
struct chunk *trash = get_trash_chunk(); struct buffer *trash = get_trash_chunk();
memset(&ctx, 0, sizeof(ctx)); 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) 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; unsigned char c;
int ptr = 0; 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) 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. */ /* With high numbers, the date returned can be negative, the 55 bits mask prevent this. */
time_t curr_date = smp->data.u.sint & 0x007fffffffffffffLL; time_t curr_date = smp->data.u.sint & 0x007fffffffffffffLL;
struct tm *tm; 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) 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. */ /* With high numbers, the date returned can be negative, the 55 bits mask prevent this. */
time_t curr_date = smp->data.u.sint & 0x007fffffffffffffLL; time_t curr_date = smp->data.u.sint & 0x007fffffffffffffLL;
struct tm *tm; 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) 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. */ char _str[7]; /* \u + 4 hex digit + null char for sprintf. */
const char *str; const char *str;
int len; int len;
@ -2227,7 +2227,7 @@ static int sample_conv_regsub(const struct arg *arg_p, struct sample *smp, void
char *start, *end; char *start, *end;
struct my_regex *reg = arg_p[0].data.reg; struct my_regex *reg = arg_p[0].data.reg;
regmatch_t pmatch[MAX_MATCH]; regmatch_t pmatch[MAX_MATCH];
struct chunk *trash = get_trash_chunk(); struct buffer *trash = get_trash_chunk();
int flag, max; int flag, max;
int found; 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) static int sample_conv_concat(const struct arg *arg_p, struct sample *smp, void *private)
{ {
struct chunk *trash; struct buffer *trash;
struct sample tmp; struct sample tmp;
int max; int max;

View 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 * If <xferred> is non-negative, some information about requeued sessions are
* provided. * 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 status = s->op_st_chg.status;
short code = s->op_st_chg.code; 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); chunk_appendf(msg, ", code: %d", code);
if (desc && *desc) { if (desc && *desc) {
struct chunk src; struct buffer src;
chunk_appendf(msg, ", info: \""); 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) static void srv_update_state(struct server *srv, int version, char **params)
{ {
char *p; char *p;
struct chunk *msg; struct buffer *msg;
/* fields since version 1 /* fields since version 1
* and common to all other upcoming versions * 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; int ret, port_change_required;
char current_addr[INET6_ADDRSTRLEN]; char current_addr[INET6_ADDRSTRLEN];
uint16_t current_port, new_port; uint16_t current_port, new_port;
struct chunk *msg; struct buffer *msg;
int changed = 0; int changed = 0;
msg = get_trash_chunk(); msg = get_trash_chunk();
@ -3674,7 +3675,7 @@ int snr_resolution_cb(struct dns_requester *requester, struct dns_nameserver *na
void *serverip, *firstip; void *serverip, *firstip;
short server_sin_family, firstip_sin_family; short server_sin_family, firstip_sin_family;
int ret; int ret;
struct chunk *chk = get_trash_chunk(); struct buffer *chk = get_trash_chunk();
int has_no_ip = 0; int has_no_ip = 0;
s = objt_server(requester->owner); 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) 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(); msg = get_trash_chunk();
chunk_reset(msg); 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 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 srv_was_stopping = (s->cur_state == SRV_ST_STOPPING) || (s->cur_admin & SRV_ADMF_DRAIN);
int log_level; int log_level;
struct chunk *tmptrash = NULL; struct buffer *tmptrash = NULL;
/* If currently main is not set we try to apply pending state changes */ /* If currently main is not set we try to apply pending state changes */

View File

@ -281,7 +281,7 @@ int session_accept_fd(struct listener *l, int cfd, struct sockaddr_storage *addr
listener_release(l); listener_release(l);
if (ret < 0 && l->bind_conf->xprt == xprt_get(XPRT_RAW) && p->mode == PR_MODE_HTTP) { 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 */ /* 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) if (!err_msg->area)
err_msg = &http_err_chunks[HTTP_ERR_500]; err_msg = &http_err_chunks[HTTP_ERR_500];
send(cfd, err_msg->area, err_msg->data, send(cfd, err_msg->area, err_msg->data,

View File

@ -368,7 +368,7 @@ static forceinline void ssl_sock_dump_errors(struct connection *conn)
struct certificate_ocsp { struct certificate_ocsp {
struct ebmb_node key; struct ebmb_node key;
unsigned char key_data[OCSP_MAX_CERTID_ASN1_LENGTH]; unsigned char key_data[OCSP_MAX_CERTID_ASN1_LENGTH];
struct chunk response; struct buffer response;
long expire; long expire;
}; };
@ -644,7 +644,9 @@ static struct eb_root cert_ocsp_tree = EB_ROOT_UNIQUE;
* *
* Returns 0 on success, 1 in error case. * 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_RESPONSE *resp;
OCSP_BASICRESP *bs = NULL; OCSP_BASICRESP *bs = NULL;
@ -766,7 +768,7 @@ out:
* *
* Returns 0 on success, 1 in error case. * 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); 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; 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); HA_RWLOCK_WRLOCK(TLSKEYS_REF_LOCK, &ref->lock);
memcpy((char *) (ref->tlskeys + ((ref->tls_ticket_enc_index + 2) % TLS_TICKETS_NO)), 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); 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); 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 * makes only basic test if the data seems like SCTL. No signature validation
* is performed. * is performed.
*/ */
static int ssl_sock_parse_sctl(struct chunk *sctl) static int ssl_sock_parse_sctl(struct buffer *sctl)
{ {
int ret = 1; int ret = 1;
int len, pos, sct_len; int len, pos, sct_len;
@ -1301,7 +1304,8 @@ out:
return ret; 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 fd = -1;
int r = 0; 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) 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; *out = (unsigned char *) sctl->area;
*outlen = sctl->data; *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]; char sctl_path[MAXPATHLEN+1];
int ret = -1; int ret = -1;
struct stat st; struct stat st;
struct chunk *sctl = NULL; struct buffer *sctl = NULL;
snprintf(sctl_path, MAXPATHLEN+1, "%s.sctl", cert_path); 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) */ /* 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; struct pkey_info *pkinfo;
int bits = 0; int bits = 0;
@ -5815,7 +5819,7 @@ const char *ssl_sock_get_proto_version(struct connection *conn)
* -1 if output is not large enough. * -1 if output is not large enough.
*/ */
static int static int
ssl_sock_get_serial(X509 *crt, struct chunk *out) ssl_sock_get_serial(X509 *crt, struct buffer *out)
{ {
ASN1_INTEGER *serial; ASN1_INTEGER *serial;
@ -5836,7 +5840,7 @@ ssl_sock_get_serial(X509 *crt, struct chunk *out)
* -1 if output is not large enough. * -1 if output is not large enough.
*/ */
static int static int
ssl_sock_crt2der(X509 *crt, struct chunk *out) ssl_sock_crt2der(X509 *crt, struct buffer *out)
{ {
int len; int len;
unsigned char *p = (unsigned char *) out->area;; 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 * Returns 1 if serial is found and copied, 0 if no valid time found
* and -1 if output is not large enough. * and -1 if output is not large enough.
*/ */
static int 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) { if (tm->type == V_ASN1_GENERALIZEDTIME) {
ASN1_GENERALIZEDTIME *gentm = (ASN1_GENERALIZEDTIME *)tm; 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. * Returns 1 if entry found, 0 if entry not found, or -1 if output not large enough.
*/ */
static int 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; X509_NAME_ENTRY *ne;
ASN1_OBJECT *obj; 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. * Returns 1 if dn entries exits, 0 if no dn entry found or -1 if output is not large enough.
*/ */
static int 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; X509_NAME_ENTRY *ne;
ASN1_OBJECT *obj; 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 0 if no CN found in DN
* or -1 on error case (i.e. no peer certificate) * 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 *crt = NULL;
X509_NAME *name; X509_NAME *name;
const char find_cn[] = "CN"; const char find_cn[] = "CN";
const struct chunk find_cn_chunk = { const struct buffer find_cn_chunk = {
.area = (char *)&find_cn, .area = (char *)&find_cn,
.data = sizeof(find_cn)-1 .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; int cert_peer = (kw[4] == 'c') ? 1 : 0;
X509 *crt = NULL; X509 *crt = NULL;
int ret = 0; int ret = 0;
struct chunk *smp_trash; struct buffer *smp_trash;
struct connection *conn; struct connection *conn;
conn = objt_conn(smp->sess->origin); 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; int cert_peer = (kw[4] == 'c') ? 1 : 0;
X509 *crt = NULL; X509 *crt = NULL;
int ret = 0; int ret = 0;
struct chunk *smp_trash; struct buffer *smp_trash;
struct connection *conn; struct connection *conn;
conn = objt_conn(smp->sess->origin); 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; X509 *crt = NULL;
const EVP_MD *digest; const EVP_MD *digest;
int ret = 0; int ret = 0;
struct chunk *smp_trash; struct buffer *smp_trash;
struct connection *conn; struct connection *conn;
conn = objt_conn(smp->sess->origin); 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; int cert_peer = (kw[4] == 'c') ? 1 : 0;
X509 *crt = NULL; X509 *crt = NULL;
int ret = 0; int ret = 0;
struct chunk *smp_trash; struct buffer *smp_trash;
struct connection *conn; struct connection *conn;
conn = objt_conn(smp->sess->origin); 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 *crt = NULL;
X509_NAME *name; X509_NAME *name;
int ret = 0; int ret = 0;
struct chunk *smp_trash; struct buffer *smp_trash;
struct connection *conn; struct connection *conn;
conn = objt_conn(smp->sess->origin); 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; int cert_peer = (kw[4] == 'c') ? 1 : 0;
X509 *crt = NULL; X509 *crt = NULL;
int ret = 0; int ret = 0;
struct chunk *smp_trash; struct buffer *smp_trash;
struct connection *conn; struct connection *conn;
conn = objt_conn(smp->sess->origin); 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 *crt = NULL;
X509_NAME *name; X509_NAME *name;
int ret = 0; int ret = 0;
struct chunk *smp_trash; struct buffer *smp_trash;
struct connection *conn; struct connection *conn;
conn = objt_conn(smp->sess->origin); 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) : struct connection *conn = (kw[4] != 'b') ? objt_conn(smp->sess->origin) :
smp->strm ? cs_conn(objt_cs(smp->strm->si[1].end)) : NULL; smp->strm ? cs_conn(objt_cs(smp->strm->si[1].end)) : NULL;
SSL_SESSION *ssl_sess; SSL_SESSION *ssl_sess;
struct chunk *data; struct buffer *data;
if (!conn || !conn->xprt_ctx || conn->xprt != &ssl_sock) if (!conn || !conn->xprt_ctx || conn->xprt != &ssl_sock)
return 0; return 0;
@ -6974,7 +6980,7 @@ smp_fetch_ssl_fc_cl_bin(const struct arg *args, struct sample *smp, const char *
static int static int
smp_fetch_ssl_fc_cl_hex(const struct arg *args, struct sample *smp, const char *kw, void *private) 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)) if (!smp_fetch_ssl_fc_cl_bin(args, smp, kw, private))
return 0; 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) 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) #if (OPENSSL_VERSION_NUMBER >= 0x1000200fL) && !defined(LIBRESSL_VERSION_NUMBER)
struct chunk *data; struct buffer *data;
int i; int i;
if (!smp_fetch_ssl_fc_cl_bin(args, smp, kw, private)) 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) : struct connection *conn = (kw[4] != 'b') ? objt_conn(smp->sess->origin) :
smp->strm ? cs_conn(objt_cs(smp->strm->si[1].end)) : NULL; smp->strm ? cs_conn(objt_cs(smp->strm->si[1].end)) : NULL;
int finished_len; int finished_len;
struct chunk *finished_trash; struct buffer *finished_trash;
smp->flags = 0; smp->flags = 0;
if (!conn || !conn->xprt_ctx || conn->xprt != &ssl_sock) 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); HA_RWLOCK_RDLOCK(TLSKEYS_REF_LOCK, &ref->lock);
head = ref->tls_ticket_enc_index; head = ref->tls_ticket_enc_index;
while (appctx->ctx.cli.i1 < TLS_TICKETS_NO) { while (appctx->ctx.cli.i1 < TLS_TICKETS_NO) {
struct chunk *t2 = get_trash_chunk(); struct buffer *t2 = get_trash_chunk();
chunk_reset(t2); chunk_reset(t2);
/* should never fail here because we dump only a key in the t2 buffer */ /* should never fail here because we dump only a key in the t2 buffer */

View File

@ -1555,7 +1555,7 @@ char *encode_string(char *start, char *stop,
*/ */
char *encode_chunk(char *start, char *stop, char *encode_chunk(char *start, char *stop,
const char escape, const fd_set *map, const char escape, const fd_set *map,
const struct chunk *chunk) const struct buffer *chunk)
{ {
char *str = chunk->area; char *str = chunk->area;
char *end = chunk->area + chunk->data; char *end = chunk->area + chunk->data;
@ -1618,7 +1618,7 @@ char *escape_string(char *start, char *stop,
*/ */
char *escape_chunk(char *start, char *stop, char *escape_chunk(char *start, char *stop,
const char escape, const fd_set *map, const char escape, const fd_set *map,
const struct chunk *chunk) const struct buffer *chunk)
{ {
char *str = chunk->area; char *str = chunk->area;
char *end = chunk->area + chunk->data; 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 * 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. * 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 * 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 * 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 * the chunk. Please use csv_enc() instead if you want to replace the output
* chunk. * 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 *end = output->area + output->size;
char *out = output->area + output->data; char *out = output->area + output->data;
@ -3825,7 +3825,7 @@ fail_wl:
* Other non-printable chars are encoded "\xHH". Space, '\', and '=' are also escaped. * 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. * 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; unsigned char c;
int ptr = 0; int ptr = 0;
@ -3869,7 +3869,7 @@ int dump_text(struct chunk *out, const char *buf, int bsize)
/* print a buffer in hexa. /* print a buffer in hexa.
* Print stopped if <bsize> is reached, or if no more place in the chunk. * 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; unsigned char c;
int ptr = 0; 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 " " * continuation of a previous truncated line begin with "+" instead of " "
* after the offset. The new pointer is returned. * 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 *line, int ptr)
{ {
int end; int end;

View File

@ -267,7 +267,7 @@ static void stats_dump_csv_header()
/* Emits a stats field without any surrounding element and properly encoded to /* 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. * 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)) { switch (field_format(f, 0)) {
case FF_EMPTY: return 1; 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 * output is supposed to be used on its own line. Returns non-zero on success, 0
* if the buffer is full. * 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)) { switch (field_format(f, 0)) {
case FF_EMPTY: return 1; 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. /* Emits a stats field value and its type in JSON.
* Returns non-zero on success, 0 on error. * 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; int old_len;
char buf[20]; 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. /* 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. * 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; 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. /* Emits an encoding of the field type as JSON.
* Returns non-zero on success, 0 if the buffer is full. * 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; const char *origin, *nature, *scope;
int old_len; 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 */ /* 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; 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 */ /* 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; 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 */ /* 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) const struct field *info)
{ {
int field; int field;
@ -535,7 +538,8 @@ err:
} }
/* Dump all fields from <stats> into <out> using a typed "field:desc:type:value" format */ /* 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 first_stat)
{ {
int field; int field;
@ -606,9 +610,11 @@ err:
* reserved for the checkbox is ST_SHOWADMIN is set in <flags>. Some extra info * reserved for the checkbox is ST_SHOWADMIN is set in <flags>. Some extra info
* are provided if ST_SHLGNDS is present in <flags>. * 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) { if (stats[ST_F_TYPE].u.u32 == STATS_TYPE_FE) {
chunk_appendf(out, 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, int stats_fill_li_stats(struct proxy *px, struct listener *l, int flags,
struct field *stats, int len) struct field *stats, int len)
{ {
struct chunk *out = get_trash_chunk(); struct buffer *out = get_trash_chunk();
if (len < ST_F_TOTAL_FIELDS) if (len < ST_F_TOTAL_FIELDS)
return 0; return 0;
@ -1483,7 +1489,7 @@ int stats_fill_sv_stats(struct proxy *px, struct server *sv, int flags,
{ {
struct server *via, *ref; struct server *via, *ref;
char str[INET6_ADDRSTRLEN]; char str[INET6_ADDRSTRLEN];
struct chunk *out = get_trash_chunk(); struct buffer *out = get_trash_chunk();
enum srv_stats_state state; enum srv_stats_state state;
char *fld_status; char *fld_status;
@ -2638,7 +2644,7 @@ static int stats_process_http_post(struct stream_interface *si)
char *st_cur_param = NULL; char *st_cur_param = NULL;
char *st_next_param = NULL; char *st_next_param = NULL;
struct chunk *temp; struct buffer *temp;
int reql; int reql;
temp = get_trash_chunk(); 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) */ /* 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; 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 */ /* 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; 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) int stats_fill_info(struct field *info, int len)
{ {
unsigned int up = (now.tv_sec - start_date.tv_sec); 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 #ifdef USE_OPENSSL
int ssl_sess_rate = read_freq_ctr(&global.ssl_per_sec); 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 * 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. * 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; int old_len = out->data;

View File

@ -3030,7 +3030,8 @@ enum {
* read buffer. It returns 0 if the output buffer is full * read buffer. It returns 0 if the output buffer is full
* and needs to be called again, otherwise non-zero. * 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 proxy *proxy, struct proxy *target)
{ {
struct stream *s = si_strm(si); 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 * read buffer. It returns 0 if the output buffer is full
* and needs to be called again, otherwise non-zero. * 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) struct proxy *proxy, struct stksess *entry)
{ {
int dt; int dt;

View File

@ -1226,7 +1226,7 @@ static int process_switching_rules(struct stream *s, struct channel *req, int an
struct proxy *backend = NULL; struct proxy *backend = NULL;
if (rule->dynamic) { if (rule->dynamic) {
struct chunk *tmp; struct buffer *tmp;
tmp = alloc_trash_chunk(); tmp = alloc_trash_chunk();
if (!tmp) if (!tmp)

View 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. * 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. * 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 *ic = si_ic(si);
struct channel *oc = si_oc(si); struct channel *oc = si_oc(si);

View 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) static int ha_wurfl_get_all(const struct arg *args, struct sample *smp, const char *kw, void *private)
{ {
wurfl_device_handle dHandle; wurfl_device_handle dHandle;
struct chunk *temp; struct buffer *temp;
wurfl_information_t *wi; wurfl_information_t *wi;
ha_wurfl_header_t wh; 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) static int ha_wurfl_get(const struct arg *args, struct sample *smp, const char *kw, void *private)
{ {
wurfl_device_handle dHandle; wurfl_device_handle dHandle;
struct chunk *temp; struct buffer *temp;
wurfl_data_t *wn = NULL; wurfl_data_t *wn = NULL;
struct ebmb_node *node; struct ebmb_node *node;
ha_wurfl_header_t wh; ha_wurfl_header_t wh;