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.
diff --git a/src/51d.c b/src/51d.c
index 4ad82fe..687528e 100644
--- a/src/51d.c
+++ b/src/51d.c
@@ -27,7 +27,7 @@
struct list property_names; /* list of properties to load into the data set. this is taken from 51degrees-property-name-list from config. */
char *data_file_path;
int header_count; /* number of HTTP headers related to device detection. */
- struct chunk *header_names; /* array of HTTP header names. */
+ struct buffer *header_names; /* array of HTTP header names. */
fiftyoneDegreesDataSet data_set; /* data set used with the pattern and trie detection methods. */
#ifdef FIFTYONEDEGREES_H_PATTERN_INCLUDED
fiftyoneDegreesWorksetPool *pool; /* pool of worksets to avoid creating a new one for each request. */
@@ -155,7 +155,7 @@
#ifdef FIFTYONEDEGREES_H_PATTERN_INCLUDED
static void _51d_lru_free(void *cache_entry)
{
- struct chunk *ptr = cache_entry;
+ struct buffer *ptr = cache_entry;
if (!ptr)
return;
@@ -184,7 +184,7 @@
*/
static void _51d_insert_cache_entry(struct sample *smp, struct lru64 *lru, void* domain)
{
- struct chunk *cache_entry = _51d_malloc(sizeof(*cache_entry));
+ struct buffer *cache_entry = _51d_malloc(sizeof(*cache_entry));
if (!cache_entry)
return;
@@ -205,7 +205,7 @@
*/
static void _51d_retrieve_cache_entry(struct sample *smp, struct lru64 *lru)
{
- struct chunk *cache_entry = lru->data;
+ struct buffer *cache_entry = lru->data;
smp->data.u.str.area = cache_entry->area;
smp->data.u.str.data = cache_entry->data;
}
@@ -300,7 +300,7 @@
#endif
char no_data[] = "NoData"; /* response when no data could be found */
- struct chunk *temp = get_trash_chunk();
+ struct buffer *temp = get_trash_chunk();
int j, i = 0, found;
const char* property_name;
@@ -503,7 +503,7 @@
const fiftyoneDegreesAsciiString *headerName;
fiftyoneDegreesDataSet *ds = &global_51degrees.data_set;
global_51degrees.header_count = ds->httpHeadersCount;
- global_51degrees.header_names = malloc(global_51degrees.header_count * sizeof(struct chunk));
+ global_51degrees.header_names = malloc(global_51degrees.header_count * sizeof(struct buffer));
for (index = 0; index < global_51degrees.header_count; index++) {
headerName = fiftyoneDegreesGetString(ds, ds->httpHeaders[index].headerNameOffset);
(global_51degrees.header_names + index)->area = (char*)&headerName->firstByte;
@@ -521,7 +521,7 @@
global_51degrees.header_count = fiftyoneDegreesGetHttpHeaderCount(ds);
global_51degrees.device_offsets.firstOffset = malloc(
global_51degrees.header_count * sizeof(fiftyoneDegreesDeviceOffset));
- global_51degrees.header_names = malloc(global_51degrees.header_count * sizeof(struct chunk));
+ global_51degrees.header_names = malloc(global_51degrees.header_count * sizeof(struct buffer));
global_51degrees.header_offsets = malloc(global_51degrees.header_count * sizeof(int32_t));
for (index = 0; index < global_51degrees.header_count; index++) {
global_51degrees.header_offsets[index] = fiftyoneDegreesGetHttpHeaderNameOffset(ds, index);
@@ -538,7 +538,7 @@
static int init_51degrees(void)
{
int i = 0;
- struct chunk *temp;
+ struct buffer *temp;
struct _51d_property_names *name;
char **_51d_property_list = NULL;
fiftyoneDegreesDataSetInitStatus _51d_dataset_status = DATA_SET_INIT_STATUS_NOT_SET;
diff --git a/src/cache.c b/src/cache.c
index 4143edc..f58c3cc 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -345,7 +345,7 @@
value = directive_value(directive, ctx.vlen, "s-maxage", 8);
if (value) {
- struct chunk *chk = get_trash_chunk();
+ struct buffer *chk = get_trash_chunk();
chunk_strncat(chk, value, ctx.vlen - 8 + 1);
chunk_strncat(chk, "", 1);
@@ -354,7 +354,7 @@
value = directive_value(ctx.line + ctx.val, ctx.vlen, "max-age", 7);
if (value) {
- struct chunk *chk = get_trash_chunk();
+ struct buffer *chk = get_trash_chunk();
chunk_strncat(chk, value, ctx.vlen - 7 + 1);
chunk_strncat(chk, "", 1);
@@ -637,7 +637,7 @@
struct hdr_ctx ctx;
blk_SHA_CTX sha1_ctx;
- struct chunk *trash;
+ struct buffer *trash;
char *path;
char *end;
trash = get_trash_chunk();
diff --git a/src/checks.c b/src/checks.c
index 5100c7e..c7b5c30 100644
--- a/src/checks.c
+++ b/src/checks.c
@@ -587,7 +587,7 @@
struct conn_stream *cs = check->cs;
struct connection *conn = cs_conn(cs);
const char *err_msg;
- struct chunk *chk;
+ struct buffer *chk;
int step;
char *comment;
@@ -1103,7 +1103,7 @@
* ERR first, then WARN.
*/
const char *msg = cmd;
- struct chunk *t;
+ struct buffer *t;
if (!*msg || status == HCHK_STATUS_L7OKD) {
if (err && *err)
diff --git a/src/chunk.c b/src/chunk.c
index f655277..56070e2 100644
--- a/src/chunk.c
+++ b/src/chunk.c
@@ -22,9 +22,9 @@
#include <types/global.h>
/* trash chunks used for various conversions */
-static THREAD_LOCAL struct chunk *trash_chunk;
-static THREAD_LOCAL struct chunk trash_chunk1;
-static THREAD_LOCAL struct chunk trash_chunk2;
+static THREAD_LOCAL struct buffer *trash_chunk;
+static THREAD_LOCAL struct buffer trash_chunk1;
+static THREAD_LOCAL struct buffer trash_chunk2;
/* trash buffers used for various conversions */
static int trash_size;
@@ -35,7 +35,7 @@
struct pool_head *pool_head_trash = NULL;
/* this is used to drain data, and as a temporary buffer for sprintf()... */
-THREAD_LOCAL struct chunk trash = { };
+THREAD_LOCAL struct buffer trash = { };
/*
* Returns a pre-allocated and initialized trash chunk that can be used for any
@@ -46,7 +46,7 @@
* a zero is always emitted at the beginning of the string so that it may be
* used as an empty string as well.
*/
-struct chunk *get_trash_chunk(void)
+struct buffer *get_trash_chunk(void)
{
char *trash_buf;
@@ -97,7 +97,9 @@
hap_register_per_thread_deinit(deinit_trash_buffers_per_thread);
}
pool_destroy(pool_head_trash);
- pool_head_trash = create_pool("trash", sizeof(struct chunk) + global.tune.bufsize, MEM_F_EXACT);
+ pool_head_trash = create_pool("trash",
+ sizeof(struct buffer) + global.tune.bufsize,
+ MEM_F_EXACT);
if (!pool_head_trash || !alloc_trash_buffers(global.tune.bufsize))
return 0;
return 1;
@@ -117,15 +119,16 @@
* call may fail and the caller is responsible for checking that the returned
* pointer is not NULL.
*/
-struct chunk *alloc_trash_chunk(void)
+struct buffer *alloc_trash_chunk(void)
{
- struct chunk *chunk;
+ struct buffer *chunk;
chunk = pool_alloc(pool_head_trash);
if (chunk) {
- char *buf = (char *)chunk + sizeof(struct chunk);
+ char *buf = (char *)chunk + sizeof(struct buffer);
*buf = 0;
- chunk_init(chunk, buf, pool_head_trash->size - sizeof(struct chunk));
+ chunk_init(chunk, buf,
+ pool_head_trash->size - sizeof(struct buffer));
}
return chunk;
}
@@ -135,7 +138,7 @@
* at most chk->size chars. If the chk->len is over, nothing is added. Returns
* the new chunk size, or < 0 in case of failure.
*/
-int chunk_printf(struct chunk *chk, const char *fmt, ...)
+int chunk_printf(struct buffer *chk, const char *fmt, ...)
{
va_list argp;
int ret;
@@ -160,7 +163,7 @@
* at most chk->size chars. If the chk->len is over, nothing is added. Returns
* the new chunk size.
*/
-int chunk_appendf(struct chunk *chk, const char *fmt, ...)
+int chunk_appendf(struct buffer *chk, const char *fmt, ...)
{
va_list argp;
int ret;
@@ -185,7 +188,7 @@
* chk->size chars. Replace non-printable or special chracters with "&#%d;".
* If the chk->len is over, nothing is added. Returns the new chunk size.
*/
-int chunk_htmlencode(struct chunk *dst, struct chunk *src)
+int chunk_htmlencode(struct buffer *dst, struct buffer *src)
{
int i, l;
int olen, free;
@@ -230,7 +233,7 @@
* chk->size chars. Replace non-printable or char passed in qc with "<%02X>".
* If the chk->len is over, nothing is added. Returns the new chunk size.
*/
-int chunk_asciiencode(struct chunk *dst, struct chunk *src, char qc)
+int chunk_asciiencode(struct buffer *dst, struct buffer *src, char qc)
{
int i, l;
int olen, free;
@@ -274,7 +277,7 @@
* zero-terminated. Return is the same as with strcmp(). Neither is allowed
* to be null.
*/
-int chunk_strcmp(const struct chunk *chk, const char *str)
+int chunk_strcmp(const struct buffer *chk, const char *str)
{
const char *s1 = chk->area;
int len = chk->data;
@@ -294,7 +297,7 @@
* <str> which must be zero-terminated. Return is the same as with strcmp().
* Neither is allowed to be null.
*/
-int chunk_strcasecmp(const struct chunk *chk, const char *str)
+int chunk_strcasecmp(const struct buffer *chk, const char *str)
{
const char *s1 = chk->area;
int len = chk->data;
diff --git a/src/cli.c b/src/cli.c
index 4440f25..0d3c95c 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -96,8 +96,8 @@
{
struct cli_kw_list *kw_list;
struct cli_kw *kw;
- struct chunk *tmp = get_trash_chunk();
- struct chunk out;
+ struct buffer *tmp = get_trash_chunk();
+ struct buffer out;
free(dynamic_usage_msg);
dynamic_usage_msg = NULL;
@@ -474,7 +474,7 @@
/* prepends then outputs the argument msg with a syslog-type severity depending on severity_output value */
static int cli_output_msg(struct channel *chn, const char *msg, int severity, int severity_output)
{
- struct chunk *tmp;
+ struct buffer *tmp;
if (likely(severity_output == CLI_SEVERITY_NONE))
return ci_putblk(chn, msg, strlen(msg));
diff --git a/src/connection.c b/src/connection.c
index ca9a8ca..db869fb 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -1096,7 +1096,7 @@
tlv->client |= PP2_CLIENT_CERT_CONN;
}
if (srv->pp_opts & SRV_PP_V2_SSL_CN) {
- struct chunk *cn_trash = get_trash_chunk();
+ struct buffer *cn_trash = get_trash_chunk();
if (ssl_sock_get_remote_common_name(remote, cn_trash) > 0) {
ssl_tlv_len += make_tlv(&buf[ret+ssl_tlv_len], (buf_len - ret - ssl_tlv_len), PP2_SUBTYPE_SSL_CN,
cn_trash->data,
@@ -1104,7 +1104,7 @@
}
}
if (srv->pp_opts & SRV_PP_V2_SSL_KEY_ALG) {
- struct chunk *pkey_trash = get_trash_chunk();
+ struct buffer *pkey_trash = get_trash_chunk();
if (ssl_sock_get_pkey_algo(remote, pkey_trash) > 0) {
ssl_tlv_len += make_tlv(&buf[ret+ssl_tlv_len], (buf_len - ret - ssl_tlv_len), PP2_SUBTYPE_SSL_KEY_ALG,
pkey_trash->data,
diff --git a/src/da.c b/src/da.c
index b21159c..23da04a 100644
--- a/src/da.c
+++ b/src/da.c
@@ -183,7 +183,7 @@
static int da_haproxy(const struct arg *args, struct sample *smp, da_deviceinfo_t *devinfo)
{
- struct chunk *tmp;
+ struct buffer *tmp;
da_propid_t prop, *pprop;
da_status_t status;
da_type_t proptype;
diff --git a/src/filters.c b/src/filters.c
index a4005ed..3956667 100644
--- a/src/filters.c
+++ b/src/filters.c
@@ -667,7 +667,7 @@
* decides to stop the HTTP message processing.
*/
void
-flt_http_reply(struct stream *s, short status, const struct chunk *msg)
+flt_http_reply(struct stream *s, short status, const struct buffer *msg)
{
struct filter *filter;
diff --git a/src/flt_spoe.c b/src/flt_spoe.c
index 06125e2..63482f5 100644
--- a/src/flt_spoe.c
+++ b/src/flt_spoe.c
@@ -387,7 +387,7 @@
static int
spoe_prepare_hahello_frame(struct appctx *appctx, char *frame, size_t size)
{
- struct chunk *chk;
+ struct buffer *chk;
struct spoe_agent *agent = SPOE_APPCTX(appctx)->agent;
char *p, *end;
unsigned int flags = SPOE_FRM_FL_FIN;
diff --git a/src/flt_trace.c b/src/flt_trace.c
index 5d24a41..6b65fe9 100644
--- a/src/flt_trace.c
+++ b/src/flt_trace.c
@@ -440,7 +440,7 @@
static void
trace_http_reply(struct stream *s, struct filter *filter, short status,
- const struct chunk *msg)
+ const struct buffer *msg)
{
struct trace_config *conf = FLT_CONF(filter);
diff --git a/src/hlua.c b/src/hlua.c
index 9e43593..4d42b1f 100644
--- a/src/hlua.c
+++ b/src/hlua.c
@@ -291,7 +291,7 @@
{
lua_Debug ar;
int level = 0;
- struct chunk *msg = get_trash_chunk();
+ struct buffer *msg = get_trash_chunk();
int filled = 0;
while (lua_getstack(L, level++, &ar)) {
@@ -4466,7 +4466,7 @@
__LJMP static int hlua_applet_http_start_response(lua_State *L)
{
- struct chunk *tmp = get_trash_chunk();
+ struct buffer *tmp = get_trash_chunk();
struct hlua_appctx *appctx = MAY_LJMP(hlua_checkapplet_http(L, 1));
const char *name;
size_t name_len;
@@ -5847,7 +5847,7 @@
struct hlua_function *fcn = private;
struct stream *stream = smp->strm;
const char *error;
- const struct chunk msg = { };
+ const struct buffer msg = { };
if (!stream)
return 0;
@@ -6116,7 +6116,7 @@
unsigned int analyzer;
int dir;
const char *error;
- const struct chunk msg = { };
+ const struct buffer msg = { };
switch (rule->from) {
case ACT_F_TCP_REQ_CNT: analyzer = AN_REQ_INSPECT_FE ; dir = SMP_OPT_DIR_REQ; break;
diff --git a/src/hlua_fcn.c b/src/hlua_fcn.c
index bc32401..cebce22 100644
--- a/src/hlua_fcn.c
+++ b/src/hlua_fcn.c
@@ -1191,7 +1191,7 @@
struct my_regex *regex;
const char *str;
size_t len;
- struct chunk *tmp;
+ struct buffer *tmp;
regex = hlua_check_regex(L, 1);
str = luaL_checklstring(L, 2, &len);
@@ -1219,7 +1219,7 @@
regmatch_t pmatch[20];
int ret;
int i;
- struct chunk *tmp;
+ struct buffer *tmp;
regex = hlua_check_regex(L, 1);
str = luaL_checklstring(L, 2, &len);
diff --git a/src/hpack-dec.c b/src/hpack-dec.c
index 7c4147b..16a722f 100644
--- a/src/hpack-dec.c
+++ b/src/hpack-dec.c
@@ -114,7 +114,8 @@
* allocated there. In case of allocation failure, returns a string whose
* pointer is NULL.
*/
-static inline struct ist hpack_alloc_string(struct chunk *store, int idx, struct ist in)
+static inline struct ist hpack_alloc_string(struct buffer *store, int idx,
+ struct ist in)
{
struct ist out;
@@ -148,7 +149,8 @@
* can use list[].n.len == 0 as a marker for the end of list.
*/
int hpack_decode_frame(struct hpack_dht *dht, const uint8_t *raw, uint32_t len,
- struct http_hdr *list, int list_size, struct chunk *tmp)
+ struct http_hdr *list, int list_size,
+ struct buffer *tmp)
{
uint32_t idx;
uint32_t nlen;
diff --git a/src/hpack-enc.c b/src/hpack-enc.c
index c6bfce7..70d2b12 100644
--- a/src/hpack-enc.c
+++ b/src/hpack-enc.c
@@ -76,7 +76,8 @@
/* Tries to encode header whose name is <n> and value <v> into the chunk <out>.
* Returns non-zero on success, 0 on failure (buffer full).
*/
-int hpack_encode_header(struct chunk *out, const struct ist n, const struct ist v)
+int hpack_encode_header(struct buffer *out, const struct ist n,
+ const struct ist v)
{
int len = out->data;
int size = out->size;
diff --git a/src/log.c b/src/log.c
index 899266c..e2ced80 100644
--- a/src/log.c
+++ b/src/log.c
@@ -48,8 +48,8 @@
struct log_fmt {
char *name;
struct {
- struct chunk sep1; /* first pid separator */
- struct chunk sep2; /* second pid separator */
+ struct buffer sep1; /* first pid separator */
+ struct buffer sep2; /* second pid separator */
} pid;
};
@@ -1006,7 +1006,7 @@
*/
static char *lf_encode_chunk(char *start, char *stop,
const char escape, const fd_set *map,
- const struct chunk *chunk,
+ const struct buffer *chunk,
struct logformat_node *node)
{
char *str, *end;
@@ -1158,7 +1158,7 @@
{
static THREAD_LOCAL long tvsec;
static THREAD_LOCAL char *dataptr = NULL; /* backup of last end of header, NULL first time */
- static THREAD_LOCAL struct chunk host = { };
+ static THREAD_LOCAL struct buffer host = { };
static THREAD_LOCAL int sep = 0;
if (unlikely(time != tvsec || dataptr == NULL)) {
@@ -1280,10 +1280,10 @@
char *hdr, *hdr_ptr;
size_t hdr_size;
time_t time = date.tv_sec;
- struct chunk *tag = &global.log_tag;
+ struct buffer *tag = &global.log_tag;
static THREAD_LOCAL int curr_pid;
static THREAD_LOCAL char pidstr[100];
- static THREAD_LOCAL struct chunk pid;
+ static THREAD_LOCAL struct buffer pid;
msghdr.msg_iov = iovec;
@@ -1574,7 +1574,7 @@
struct proxy *fe = sess->fe;
struct proxy *be = s->be;
struct http_txn *txn = s->txn;
- struct chunk chunk;
+ struct buffer chunk;
char *uri;
char *spc;
char *qmark;
@@ -1606,7 +1606,7 @@
struct connection *conn;
const char *src = NULL;
struct sample *key;
- const struct chunk empty = { };
+ const struct buffer empty = { };
switch (tmp->type) {
case LOG_FMT_SEPARATOR:
diff --git a/src/map.c b/src/map.c
index 64f2388..5c10735 100644
--- a/src/map.c
+++ b/src/map.c
@@ -172,7 +172,7 @@
{
struct map_descriptor *desc;
struct pattern *pat;
- struct chunk *str;
+ struct buffer *str;
/* get config */
desc = arg_p[0].data.map;
diff --git a/src/mux_h2.c b/src/mux_h2.c
index 92f5090..e252083 100644
--- a/src/mux_h2.c
+++ b/src/mux_h2.c
@@ -670,7 +670,7 @@
{
struct buffer *res;
char buf_data[100]; // enough for 15 settings
- struct chunk buf;
+ struct buffer buf;
int ret;
if (h2c_mux_busy(h2c, NULL)) {
@@ -2617,9 +2617,9 @@
{
struct h2c *h2c = h2s->h2c;
const uint8_t *hdrs = (uint8_t *)b_head(&h2c->dbuf);
- struct chunk *tmp = get_trash_chunk();
+ struct buffer *tmp = get_trash_chunk();
struct http_hdr list[MAX_HTTP_HDR * 2];
- struct chunk *copy = NULL;
+ struct buffer *copy = NULL;
unsigned int msgf;
int flen = h2c->dfl;
int outlen = 0;
@@ -2954,7 +2954,7 @@
struct http_hdr list[MAX_HTTP_HDR];
struct h2c *h2c = h2s->h2c;
struct h1m *h1m = &h2s->res;
- struct chunk outbuf;
+ struct buffer outbuf;
int es_now = 0;
int ret = 0;
int hdr;
@@ -3125,7 +3125,7 @@
{
struct h2c *h2c = h2s->h2c;
struct h1m *h1m = &h2s->res;
- struct chunk outbuf;
+ struct buffer outbuf;
int ret = 0;
size_t total = 0;
int es_now = 0;
@@ -3447,7 +3447,7 @@
}
/* for debugging with CLI's "show fd" command */
-static void h2_show_fd(struct chunk *msg, struct connection *conn)
+static void h2_show_fd(struct buffer *msg, struct connection *conn)
{
struct h2c *h2c = conn->mux_ctx;
struct h2s *h2s;
diff --git a/src/pattern.c b/src/pattern.c
index 2975afa..261a0b4 100644
--- a/src/pattern.c
+++ b/src/pattern.c
@@ -221,7 +221,7 @@
/* Parse a binary written in hexa. It is allocated. */
int pat_parse_bin(const char *text, struct pattern *pattern, int mflags, char **err)
{
- struct chunk *trash;
+ struct buffer *trash;
pattern->type = SMP_T_BIN;
trash = get_trash_chunk();
diff --git a/src/peers.c b/src/peers.c
index 08a29a6..f26c3df 100644
--- a/src/peers.c
+++ b/src/peers.c
@@ -387,7 +387,7 @@
{
int len;
unsigned short datalen;
- struct chunk *chunk;
+ struct buffer *chunk;
char *cursor, *datamsg, *chunkp, *chunkq;
uint64_t data = 0;
unsigned int data_type;
diff --git a/src/proto_http.c b/src/proto_http.c
index ea10b91..117d274 100644
--- a/src/proto_http.c
+++ b/src/proto_http.c
@@ -78,7 +78,7 @@
const char HTTP_100[] =
"HTTP/1.1 100 Continue\r\n\r\n";
-const struct chunk http_100_chunk = {
+const struct buffer http_100_chunk = {
.area = (char *)&HTTP_100,
.data = sizeof(HTTP_100)-1
};
@@ -275,7 +275,7 @@
/* We must put the messages here since GCC cannot initialize consts depending
* on strlen().
*/
-struct chunk http_err_chunks[HTTP_ERR_SIZE];
+struct buffer http_err_chunks[HTTP_ERR_SIZE];
/* this struct is used between calls to smp_fetch_hdr() or smp_fetch_cookie() */
static THREAD_LOCAL struct hdr_ctx static_hdr_ctx;
@@ -917,7 +917,7 @@
* in this buffer will be lost.
*/
static void http_server_error(struct stream *s, struct stream_interface *si,
- int err, int finst, const struct chunk *msg)
+ int err, int finst, const struct buffer *msg)
{
FLT_STRM_CB(s, flt_http_reply(s, s->txn->status, msg));
channel_auto_read(si_oc(si));
@@ -938,7 +938,7 @@
* and message.
*/
-struct chunk *http_error_message(struct stream *s)
+struct buffer *http_error_message(struct stream *s)
{
const int msgnum = http_get_status_idx(s->txn->status);
@@ -951,7 +951,7 @@
}
void
-http_reply_and_close(struct stream *s, short status, struct chunk *msg)
+http_reply_and_close(struct stream *s, short status, struct buffer *msg)
{
s->txn->flags &= ~TX_WAIT_NEXT_RQ;
FLT_STRM_CB(s, flt_http_reply(s, status, msg));
@@ -1264,7 +1264,7 @@
{
struct http_txn *txn = s->txn;
- struct chunk auth_method;
+ struct buffer auth_method;
struct hdr_ctx ctx;
char *h, *p;
int len;
@@ -1304,7 +1304,7 @@
chunk_initlen(&txn->auth.method_data, p + 1, 0, ctx.vlen - len - 1);
if (!strncasecmp("Basic", auth_method.area, auth_method.data)) {
- struct chunk *http_auth = get_trash_chunk();
+ struct buffer *http_auth = get_trash_chunk();
len = base64dec(txn->auth.method_data.area,
txn->auth.method_data.data,
@@ -2403,7 +2403,7 @@
struct hdr_idx *idx = &s->txn->hdr_idx;
int (*http_find_hdr_func)(const char *name, int len, char *sol,
struct hdr_idx *idx, struct hdr_ctx *ctx);
- struct chunk *output = get_trash_chunk();
+ struct buffer *output = get_trash_chunk();
ctx.idx = 0;
@@ -2451,7 +2451,7 @@
struct list *fmt, struct my_regex *re,
int action)
{
- struct chunk *replace;
+ struct buffer *replace;
int ret = -1;
replace = alloc_trash_chunk();
@@ -2607,7 +2607,7 @@
* buffer, we build first the header value using build_logline, and
* after we store the header name.
*/
- struct chunk *replace;
+ struct buffer *replace;
replace = alloc_trash_chunk();
if (!replace)
@@ -2655,7 +2655,7 @@
case ACT_HTTP_DEL_ACL:
case ACT_HTTP_DEL_MAP: {
struct pat_ref *ref;
- struct chunk *key;
+ struct buffer *key;
/* collect reference */
ref = pat_ref_lookup(rule->arg.map.ref);
@@ -2684,7 +2684,7 @@
case ACT_HTTP_ADD_ACL: {
struct pat_ref *ref;
- struct chunk *key;
+ struct buffer *key;
/* collect reference */
ref = pat_ref_lookup(rule->arg.map.ref);
@@ -2714,7 +2714,7 @@
case ACT_HTTP_SET_MAP: {
struct pat_ref *ref;
- struct chunk *key, *value;
+ struct buffer *key, *value;
/* collect reference */
ref = pat_ref_lookup(rule->arg.map.ref);
@@ -2929,7 +2929,7 @@
case ACT_HTTP_SET_HDR:
case ACT_HTTP_ADD_HDR: {
- struct chunk *replace;
+ struct buffer *replace;
replace = alloc_trash_chunk();
if (!replace)
@@ -2980,7 +2980,7 @@
case ACT_HTTP_DEL_ACL:
case ACT_HTTP_DEL_MAP: {
struct pat_ref *ref;
- struct chunk *key;
+ struct buffer *key;
/* collect reference */
ref = pat_ref_lookup(rule->arg.map.ref);
@@ -3009,7 +3009,7 @@
case ACT_HTTP_ADD_ACL: {
struct pat_ref *ref;
- struct chunk *key;
+ struct buffer *key;
/* collect reference */
ref = pat_ref_lookup(rule->arg.map.ref);
@@ -3037,7 +3037,7 @@
case ACT_HTTP_SET_MAP: {
struct pat_ref *ref;
- struct chunk *key, *value;
+ struct buffer *key, *value;
/* collect reference */
ref = pat_ref_lookup(rule->arg.map.ref);
@@ -3185,7 +3185,7 @@
struct http_msg *req = &txn->req;
struct http_msg *res = &txn->rsp;
const char *msg_fmt;
- struct chunk *chunk;
+ struct buffer *chunk;
int ret = 0;
chunk = alloc_trash_chunk();
@@ -9870,7 +9870,7 @@
smp_fetch_hdrs_bin(const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct http_msg *msg;
- struct chunk *temp;
+ struct buffer *temp;
struct hdr_idx *idx;
const char *cur_ptr, *cur_next, *p;
int old_idx, cur_idx;
@@ -9973,7 +9973,7 @@
unsigned long len;
unsigned long block1;
char *body;
- struct chunk *temp;
+ struct buffer *temp;
CHECK_HTTP_MESSAGE_FIRST();
@@ -10213,7 +10213,7 @@
struct hdr_idx *idx;
struct hdr_ctx ctx;
const struct http_msg *msg;
- struct chunk *temp;
+ struct buffer *temp;
char del = ',';
if (args && args->type == ARGT_STR)
@@ -10367,7 +10367,7 @@
smp->data.type = SMP_T_IPV4;
break;
} else {
- struct chunk *temp = get_trash_chunk();
+ struct buffer *temp = get_trash_chunk();
if (smp->data.u.str.data < temp->size - 1) {
memcpy(temp->area, smp->data.u.str.area,
smp->data.u.str.data);
@@ -10428,7 +10428,7 @@
struct http_txn *txn;
char *ptr, *end, *beg;
struct hdr_ctx ctx;
- struct chunk *temp;
+ struct buffer *temp;
CHECK_HTTP_MESSAGE_FIRST();
@@ -10521,7 +10521,7 @@
static int
smp_fetch_base32_src(const struct arg *args, struct sample *smp, const char *kw, void *private)
{
- struct chunk *temp;
+ struct buffer *temp;
struct connection *cli_conn = objt_conn(smp->sess->origin);
if (!cli_conn)
@@ -10807,7 +10807,7 @@
static int
smp_fetch_capture_req_method(const struct arg *args, struct sample *smp, const char *kw, void *private)
{
- struct chunk *temp;
+ struct buffer *temp;
struct http_txn *txn = smp->strm->txn;
char *ptr;
@@ -10834,7 +10834,7 @@
static int
smp_fetch_capture_req_uri(const struct arg *args, struct sample *smp, const char *kw, void *private)
{
- struct chunk *temp;
+ struct buffer *temp;
struct http_txn *txn = smp->strm->txn;
char *ptr;
@@ -11334,7 +11334,7 @@
smp_fetch_param(char delim, const char *name, int name_len, const struct arg *args, struct sample *smp, const char *kw, void *private)
{
const char *vstart, *vend;
- struct chunk *temp;
+ struct buffer *temp;
const char **chunks = (const char **)smp->ctx.a;
if (!find_next_url_param(chunks,
@@ -11571,7 +11571,7 @@
static int
smp_fetch_url32_src(const struct arg *args, struct sample *smp, const char *kw, void *private)
{
- struct chunk *temp;
+ struct buffer *temp;
struct connection *cli_conn = objt_conn(smp->sess->origin);
if (!cli_conn)
@@ -11631,7 +11631,7 @@
{
const char day[7][4] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
const char mon[12][4] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
- struct chunk *temp;
+ struct buffer *temp;
struct tm *tm;
/* With high numbers, the date returned can be negative, the 55 bits mask prevent this. */
time_t curr_date = smp->data.u.sint & 0x007fffffffffffffLL;
@@ -11836,7 +11836,7 @@
* before decoding.
*/
if (smp->flags & SMP_F_CONST || smp->data.u.str.size <= smp->data.u.str.data) {
- struct chunk *str = get_trash_chunk();
+ struct buffer *str = get_trash_chunk();
memcpy(str->area, smp->data.u.str.area, smp->data.u.str.data);
smp->data.u.str.area = str->area;
smp->data.u.str.size = str->size;
@@ -12079,7 +12079,7 @@
enum act_return http_action_set_req_line(struct act_rule *rule, struct proxy *px,
struct session *sess, struct stream *s, int flags)
{
- struct chunk *replace;
+ struct buffer *replace;
enum act_return ret = ACT_RET_ERR;
replace = alloc_trash_chunk();
diff --git a/src/proxy.c b/src/proxy.c
index c262966..bf87a2f 100644
--- a/src/proxy.c
+++ b/src/proxy.c
@@ -1421,7 +1421,7 @@
* It uses the proxy pointer from cli.p0, the proxy's id from cli.i0 and the server's
* pointer from cli.p1.
*/
-static int dump_servers_state(struct stream_interface *si, struct chunk *buf)
+static int dump_servers_state(struct stream_interface *si, struct buffer *buf)
{
struct appctx *appctx = __objt_appctx(si->end);
struct proxy *px = appctx->ctx.cli.p0;
diff --git a/src/sample.c b/src/sample.c
index 9ccfe7d..e3dea1b 100644
--- a/src/sample.c
+++ b/src/sample.c
@@ -508,7 +508,7 @@
static int c_ip2str(struct sample *smp)
{
- struct chunk *trash = get_trash_chunk();
+ struct buffer *trash = get_trash_chunk();
if (!inet_ntop(AF_INET, (void *)&smp->data.u.ipv4, trash->area, trash->size))
return 0;
@@ -538,7 +538,7 @@
static int c_ipv62str(struct sample *smp)
{
- struct chunk *trash = get_trash_chunk();
+ struct buffer *trash = get_trash_chunk();
if (!inet_ntop(AF_INET6, (void *)&smp->data.u.ipv6, trash->area, trash->size))
return 0;
@@ -623,7 +623,7 @@
static int c_int2str(struct sample *smp)
{
- struct chunk *trash = get_trash_chunk();
+ struct buffer *trash = get_trash_chunk();
char *pos;
pos = lltoa_r(smp->data.u.sint, trash->area, trash->size);
@@ -647,7 +647,7 @@
*/
int smp_dup(struct sample *smp)
{
- struct chunk *trash;
+ struct buffer *trash;
switch (smp->data.type) {
case SMP_T_BOOL:
@@ -763,7 +763,7 @@
static int c_addr2bin(struct sample *smp)
{
- struct chunk *chk = get_trash_chunk();
+ struct buffer *chk = get_trash_chunk();
if (smp->data.type == SMP_T_IPV4) {
chk->data = 4;
@@ -783,7 +783,7 @@
static int c_int2bin(struct sample *smp)
{
- struct chunk *chk = get_trash_chunk();
+ struct buffer *chk = get_trash_chunk();
*(unsigned long long int *) chk->area = my_htonll(smp->data.u.sint);
chk->data = 8;
@@ -1474,7 +1474,7 @@
static int sample_conv_base642bin(const struct arg *arg_p, struct sample *smp, void *private)
{
- struct chunk *trash = get_trash_chunk();
+ struct buffer *trash = get_trash_chunk();
int bin_len;
trash->data = 0;
@@ -1492,7 +1492,7 @@
static int sample_conv_bin2base64(const struct arg *arg_p, struct sample *smp, void *private)
{
- struct chunk *trash = get_trash_chunk();
+ struct buffer *trash = get_trash_chunk();
int b64_len;
trash->data = 0;
@@ -1511,7 +1511,7 @@
static int sample_conv_sha1(const struct arg *arg_p, struct sample *smp, void *private)
{
blk_SHA_CTX ctx;
- struct chunk *trash = get_trash_chunk();
+ struct buffer *trash = get_trash_chunk();
memset(&ctx, 0, sizeof(ctx));
@@ -1528,7 +1528,7 @@
static int sample_conv_bin2hex(const struct arg *arg_p, struct sample *smp, void *private)
{
- struct chunk *trash = get_trash_chunk();
+ struct buffer *trash = get_trash_chunk();
unsigned char c;
int ptr = 0;
@@ -1640,7 +1640,7 @@
*/
static int sample_conv_ltime(const struct arg *args, struct sample *smp, void *private)
{
- struct chunk *temp;
+ struct buffer *temp;
/* With high numbers, the date returned can be negative, the 55 bits mask prevent this. */
time_t curr_date = smp->data.u.sint & 0x007fffffffffffffLL;
struct tm *tm;
@@ -1677,7 +1677,7 @@
*/
static int sample_conv_utime(const struct arg *args, struct sample *smp, void *private)
{
- struct chunk *temp;
+ struct buffer *temp;
/* With high numbers, the date returned can be negative, the 55 bits mask prevent this. */
time_t curr_date = smp->data.u.sint & 0x007fffffffffffffLL;
struct tm *tm;
@@ -1840,7 +1840,7 @@
static int sample_conv_json(const struct arg *arg_p, struct sample *smp, void *private)
{
- struct chunk *temp;
+ struct buffer *temp;
char _str[7]; /* \u + 4 hex digit + null char for sprintf. */
const char *str;
int len;
@@ -2227,7 +2227,7 @@
char *start, *end;
struct my_regex *reg = arg_p[0].data.reg;
regmatch_t pmatch[MAX_MATCH];
- struct chunk *trash = get_trash_chunk();
+ struct buffer *trash = get_trash_chunk();
int flag, max;
int found;
@@ -2629,7 +2629,7 @@
*/
static int sample_conv_concat(const struct arg *arg_p, struct sample *smp, void *private)
{
- struct chunk *trash;
+ struct buffer *trash;
struct sample tmp;
int max;
diff --git a/src/server.c b/src/server.c
index 422f8bf..d96edc7 100644
--- a/src/server.c
+++ b/src/server.c
@@ -844,7 +844,8 @@
* If <xferred> is non-negative, some information about requeued sessions are
* provided.
*/
-void srv_append_status(struct chunk *msg, struct server *s, struct check *check, int xferred, int forced)
+void srv_append_status(struct buffer *msg, struct server *s,
+ struct check *check, int xferred, int forced)
{
short status = s->op_st_chg.status;
short code = s->op_st_chg.code;
@@ -865,7 +866,7 @@
chunk_appendf(msg, ", code: %d", code);
if (desc && *desc) {
- struct chunk src;
+ struct buffer src;
chunk_appendf(msg, ", info: \"");
@@ -2686,7 +2687,7 @@
static void srv_update_state(struct server *srv, int version, char **params)
{
char *p;
- struct chunk *msg;
+ struct buffer *msg;
/* fields since version 1
* and common to all other upcoming versions
@@ -3415,7 +3416,7 @@
int ret, port_change_required;
char current_addr[INET6_ADDRSTRLEN];
uint16_t current_port, new_port;
- struct chunk *msg;
+ struct buffer *msg;
int changed = 0;
msg = get_trash_chunk();
@@ -3674,7 +3675,7 @@
void *serverip, *firstip;
short server_sin_family, firstip_sin_family;
int ret;
- struct chunk *chk = get_trash_chunk();
+ struct buffer *chk = get_trash_chunk();
int has_no_ip = 0;
s = objt_server(requester->owner);
@@ -4035,7 +4036,7 @@
const char *update_server_fqdn(struct server *server, const char *fqdn, const char *updater, int dns_locked)
{
- struct chunk *msg;
+ struct buffer *msg;
msg = get_trash_chunk();
chunk_reset(msg);
@@ -4524,7 +4525,7 @@
int prev_srv_count = s->proxy->srv_bck + s->proxy->srv_act;
int srv_was_stopping = (s->cur_state == SRV_ST_STOPPING) || (s->cur_admin & SRV_ADMF_DRAIN);
int log_level;
- struct chunk *tmptrash = NULL;
+ struct buffer *tmptrash = NULL;
/* If currently main is not set we try to apply pending state changes */
diff --git a/src/session.c b/src/session.c
index 6cea612..635aee5 100644
--- a/src/session.c
+++ b/src/session.c
@@ -281,7 +281,7 @@
listener_release(l);
if (ret < 0 && l->bind_conf->xprt == xprt_get(XPRT_RAW) && p->mode == PR_MODE_HTTP) {
/* critical error, no more memory, try to emit a 500 response */
- struct chunk *err_msg = &p->errmsg[HTTP_ERR_500];
+ struct buffer *err_msg = &p->errmsg[HTTP_ERR_500];
if (!err_msg->area)
err_msg = &http_err_chunks[HTTP_ERR_500];
send(cfd, err_msg->area, err_msg->data,
diff --git a/src/ssl_sock.c b/src/ssl_sock.c
index b0b7d25..5689820 100644
--- a/src/ssl_sock.c
+++ b/src/ssl_sock.c
@@ -368,7 +368,7 @@
struct certificate_ocsp {
struct ebmb_node key;
unsigned char key_data[OCSP_MAX_CERTID_ASN1_LENGTH];
- struct chunk response;
+ struct buffer response;
long expire;
};
@@ -644,7 +644,9 @@
*
* Returns 0 on success, 1 in error case.
*/
-static int ssl_sock_load_ocsp_response(struct chunk *ocsp_response, struct certificate_ocsp *ocsp, OCSP_CERTID *cid, char **err)
+static int ssl_sock_load_ocsp_response(struct buffer *ocsp_response,
+ struct certificate_ocsp *ocsp,
+ OCSP_CERTID *cid, char **err)
{
OCSP_RESPONSE *resp;
OCSP_BASICRESP *bs = NULL;
@@ -766,7 +768,7 @@
*
* Returns 0 on success, 1 in error case.
*/
-int ssl_sock_update_ocsp_response(struct chunk *ocsp_response, char **err)
+int ssl_sock_update_ocsp_response(struct buffer *ocsp_response, char **err)
{
return ssl_sock_load_ocsp_response(ocsp_response, NULL, NULL, err);
}
@@ -886,7 +888,8 @@
return NULL;
}
-void ssl_sock_update_tlskey_ref(struct tls_keys_ref *ref, struct chunk *tlskey)
+void ssl_sock_update_tlskey_ref(struct tls_keys_ref *ref,
+ struct buffer *tlskey)
{
HA_RWLOCK_WRLOCK(TLSKEYS_REF_LOCK, &ref->lock);
memcpy((char *) (ref->tlskeys + ((ref->tls_ticket_enc_index + 2) % TLS_TICKETS_NO)),
@@ -895,7 +898,7 @@
HA_RWLOCK_WRUNLOCK(TLSKEYS_REF_LOCK, &ref->lock);
}
-int ssl_sock_update_tlskey(char *filename, struct chunk *tlskey, char **err)
+int ssl_sock_update_tlskey(char *filename, struct buffer *tlskey, char **err)
{
struct tls_keys_ref *ref = tlskeys_ref_lookup(filename);
@@ -1267,7 +1270,7 @@
* makes only basic test if the data seems like SCTL. No signature validation
* is performed.
*/
-static int ssl_sock_parse_sctl(struct chunk *sctl)
+static int ssl_sock_parse_sctl(struct buffer *sctl)
{
int ret = 1;
int len, pos, sct_len;
@@ -1301,7 +1304,8 @@
return ret;
}
-static int ssl_sock_load_sctl_from_file(const char *sctl_path, struct chunk **sctl)
+static int ssl_sock_load_sctl_from_file(const char *sctl_path,
+ struct buffer **sctl)
{
int fd = -1;
int r = 0;
@@ -1348,7 +1352,7 @@
int ssl_sock_sctl_add_cbk(SSL *ssl, unsigned ext_type, const unsigned char **out, size_t *outlen, int *al, void *add_arg)
{
- struct chunk *sctl = add_arg;
+ struct buffer *sctl = add_arg;
*out = (unsigned char *) sctl->area;
*outlen = sctl->data;
@@ -1366,7 +1370,7 @@
char sctl_path[MAXPATHLEN+1];
int ret = -1;
struct stat st;
- struct chunk *sctl = NULL;
+ struct buffer *sctl = NULL;
snprintf(sctl_path, MAXPATHLEN+1, "%s.sctl", cert_path);
@@ -5708,7 +5712,7 @@
}
/* used for ppv2 pkey alog (can be used for logging) */
-int ssl_sock_get_pkey_algo(struct connection *conn, struct chunk *out)
+int ssl_sock_get_pkey_algo(struct connection *conn, struct buffer *out)
{
struct pkey_info *pkinfo;
int bits = 0;
@@ -5815,7 +5819,7 @@
* -1 if output is not large enough.
*/
static int
-ssl_sock_get_serial(X509 *crt, struct chunk *out)
+ssl_sock_get_serial(X509 *crt, struct buffer *out)
{
ASN1_INTEGER *serial;
@@ -5836,7 +5840,7 @@
* -1 if output is not large enough.
*/
static int
-ssl_sock_crt2der(X509 *crt, struct chunk *out)
+ssl_sock_crt2der(X509 *crt, struct buffer *out)
{
int len;
unsigned char *p = (unsigned char *) out->area;;
@@ -5854,12 +5858,12 @@
}
-/* Copy Date in ASN1_UTCTIME format in struct chunk out.
+/* Copy Date in ASN1_UTCTIME format in struct buffer out.
* Returns 1 if serial is found and copied, 0 if no valid time found
* and -1 if output is not large enough.
*/
static int
-ssl_sock_get_time(ASN1_TIME *tm, struct chunk *out)
+ssl_sock_get_time(ASN1_TIME *tm, struct buffer *out)
{
if (tm->type == V_ASN1_GENERALIZEDTIME) {
ASN1_GENERALIZEDTIME *gentm = (ASN1_GENERALIZEDTIME *)tm;
@@ -5897,7 +5901,8 @@
* Returns 1 if entry found, 0 if entry not found, or -1 if output not large enough.
*/
static int
-ssl_sock_get_dn_entry(X509_NAME *a, const struct chunk *entry, int pos, struct chunk *out)
+ssl_sock_get_dn_entry(X509_NAME *a, const struct buffer *entry, int pos,
+ struct buffer *out)
{
X509_NAME_ENTRY *ne;
ASN1_OBJECT *obj;
@@ -5957,7 +5962,7 @@
* Returns 1 if dn entries exits, 0 if no dn entry found or -1 if output is not large enough.
*/
static int
-ssl_sock_get_dn_oneline(X509_NAME *a, struct chunk *out)
+ssl_sock_get_dn_oneline(X509_NAME *a, struct buffer *out)
{
X509_NAME_ENTRY *ne;
ASN1_OBJECT *obj;
@@ -6039,12 +6044,13 @@
* or 0 if no CN found in DN
* or -1 on error case (i.e. no peer certificate)
*/
-int ssl_sock_get_remote_common_name(struct connection *conn, struct chunk *dest)
+int ssl_sock_get_remote_common_name(struct connection *conn,
+ struct buffer *dest)
{
X509 *crt = NULL;
X509_NAME *name;
const char find_cn[] = "CN";
- const struct chunk find_cn_chunk = {
+ const struct buffer find_cn_chunk = {
.area = (char *)&find_cn,
.data = sizeof(find_cn)-1
};
@@ -6182,7 +6188,7 @@
int cert_peer = (kw[4] == 'c') ? 1 : 0;
X509 *crt = NULL;
int ret = 0;
- struct chunk *smp_trash;
+ struct buffer *smp_trash;
struct connection *conn;
conn = objt_conn(smp->sess->origin);
@@ -6226,7 +6232,7 @@
int cert_peer = (kw[4] == 'c') ? 1 : 0;
X509 *crt = NULL;
int ret = 0;
- struct chunk *smp_trash;
+ struct buffer *smp_trash;
struct connection *conn;
conn = objt_conn(smp->sess->origin);
@@ -6271,7 +6277,7 @@
X509 *crt = NULL;
const EVP_MD *digest;
int ret = 0;
- struct chunk *smp_trash;
+ struct buffer *smp_trash;
struct connection *conn;
conn = objt_conn(smp->sess->origin);
@@ -6315,7 +6321,7 @@
int cert_peer = (kw[4] == 'c') ? 1 : 0;
X509 *crt = NULL;
int ret = 0;
- struct chunk *smp_trash;
+ struct buffer *smp_trash;
struct connection *conn;
conn = objt_conn(smp->sess->origin);
@@ -6359,7 +6365,7 @@
X509 *crt = NULL;
X509_NAME *name;
int ret = 0;
- struct chunk *smp_trash;
+ struct buffer *smp_trash;
struct connection *conn;
conn = objt_conn(smp->sess->origin);
@@ -6415,7 +6421,7 @@
int cert_peer = (kw[4] == 'c') ? 1 : 0;
X509 *crt = NULL;
int ret = 0;
- struct chunk *smp_trash;
+ struct buffer *smp_trash;
struct connection *conn;
conn = objt_conn(smp->sess->origin);
@@ -6459,7 +6465,7 @@
X509 *crt = NULL;
X509_NAME *name;
int ret = 0;
- struct chunk *smp_trash;
+ struct buffer *smp_trash;
struct connection *conn;
conn = objt_conn(smp->sess->origin);
@@ -6904,7 +6910,7 @@
struct connection *conn = (kw[4] != 'b') ? objt_conn(smp->sess->origin) :
smp->strm ? cs_conn(objt_cs(smp->strm->si[1].end)) : NULL;
SSL_SESSION *ssl_sess;
- struct chunk *data;
+ struct buffer *data;
if (!conn || !conn->xprt_ctx || conn->xprt != &ssl_sock)
return 0;
@@ -6974,7 +6980,7 @@
static int
smp_fetch_ssl_fc_cl_hex(const struct arg *args, struct sample *smp, const char *kw, void *private)
{
- struct chunk *data;
+ struct buffer *data;
if (!smp_fetch_ssl_fc_cl_bin(args, smp, kw, private))
return 0;
@@ -7009,7 +7015,7 @@
smp_fetch_ssl_fc_cl_str(const struct arg *args, struct sample *smp, const char *kw, void *private)
{
#if (OPENSSL_VERSION_NUMBER >= 0x1000200fL) && !defined(LIBRESSL_VERSION_NUMBER)
- struct chunk *data;
+ struct buffer *data;
int i;
if (!smp_fetch_ssl_fc_cl_bin(args, smp, kw, private))
@@ -7048,7 +7054,7 @@
struct connection *conn = (kw[4] != 'b') ? objt_conn(smp->sess->origin) :
smp->strm ? cs_conn(objt_cs(smp->strm->si[1].end)) : NULL;
int finished_len;
- struct chunk *finished_trash;
+ struct buffer *finished_trash;
smp->flags = 0;
if (!conn || !conn->xprt_ctx || conn->xprt != &ssl_sock)
@@ -8487,7 +8493,7 @@
HA_RWLOCK_RDLOCK(TLSKEYS_REF_LOCK, &ref->lock);
head = ref->tls_ticket_enc_index;
while (appctx->ctx.cli.i1 < TLS_TICKETS_NO) {
- struct chunk *t2 = get_trash_chunk();
+ struct buffer *t2 = get_trash_chunk();
chunk_reset(t2);
/* should never fail here because we dump only a key in the t2 buffer */
diff --git a/src/standard.c b/src/standard.c
index 86827db..732932e 100644
--- a/src/standard.c
+++ b/src/standard.c
@@ -1555,7 +1555,7 @@
*/
char *encode_chunk(char *start, char *stop,
const char escape, const fd_set *map,
- const struct chunk *chunk)
+ const struct buffer *chunk)
{
char *str = chunk->area;
char *end = chunk->area + chunk->data;
@@ -1618,7 +1618,7 @@
*/
char *escape_chunk(char *start, char *stop,
const char escape, const fd_set *map,
- const struct chunk *chunk)
+ const struct buffer *chunk)
{
char *str = chunk->area;
char *end = chunk->area + chunk->data;
@@ -1656,7 +1656,7 @@
* If <quote> is 1, the converter puts the quotes only if any reserved character
* is present. If <quote> is 2, the converter always puts the quotes.
*
- * <output> is a struct chunk used for storing the output string.
+ * <output> is a struct buffer used for storing the output string.
*
* The function returns the converted string on its output. If an error
* occurs, the function returns an empty string. This type of output is useful
@@ -1670,7 +1670,7 @@
* the chunk. Please use csv_enc() instead if you want to replace the output
* chunk.
*/
-const char *csv_enc_append(const char *str, int quote, struct chunk *output)
+const char *csv_enc_append(const char *str, int quote, struct buffer *output)
{
char *end = output->area + output->size;
char *out = output->area + output->data;
@@ -3825,7 +3825,7 @@
* Other non-printable chars are encoded "\xHH". Space, '\', and '=' are also escaped.
* Print stopped if null char or <bsize> is reached, or if no more place in the chunk.
*/
-int dump_text(struct chunk *out, const char *buf, int bsize)
+int dump_text(struct buffer *out, const char *buf, int bsize)
{
unsigned char c;
int ptr = 0;
@@ -3869,7 +3869,7 @@
/* print a buffer in hexa.
* Print stopped if <bsize> is reached, or if no more place in the chunk.
*/
-int dump_binary(struct chunk *out, const char *buf, int bsize)
+int dump_binary(struct buffer *out, const char *buf, int bsize)
{
unsigned char c;
int ptr = 0;
@@ -3895,7 +3895,7 @@
* continuation of a previous truncated line begin with "+" instead of " "
* after the offset. The new pointer is returned.
*/
-int dump_text_line(struct chunk *out, const char *buf, int bsize, int len,
+int dump_text_line(struct buffer *out, const char *buf, int bsize, int len,
int *line, int ptr)
{
int end;
diff --git a/src/stats.c b/src/stats.c
index 88d665e..2632ef7 100644
--- a/src/stats.c
+++ b/src/stats.c
@@ -267,7 +267,7 @@
/* Emits a stats field without any surrounding element and properly encoded to
* resist CSV output. Returns non-zero on success, 0 if the buffer is full.
*/
-int stats_emit_raw_data_field(struct chunk *out, const struct field *f)
+int stats_emit_raw_data_field(struct buffer *out, const struct field *f)
{
switch (field_format(f, 0)) {
case FF_EMPTY: return 1;
@@ -284,7 +284,7 @@
* output is supposed to be used on its own line. Returns non-zero on success, 0
* if the buffer is full.
*/
-int stats_emit_typed_data_field(struct chunk *out, const struct field *f)
+int stats_emit_typed_data_field(struct buffer *out, const struct field *f)
{
switch (field_format(f, 0)) {
case FF_EMPTY: return 1;
@@ -306,7 +306,7 @@
/* Emits a stats field value and its type in JSON.
* Returns non-zero on success, 0 on error.
*/
-int stats_emit_json_data_field(struct chunk *out, const struct field *f)
+int stats_emit_json_data_field(struct buffer *out, const struct field *f)
{
int old_len;
char buf[20];
@@ -352,7 +352,8 @@
/* Emits an encoding of the field type on 3 characters followed by a delimiter.
* Returns non-zero on success, 0 if the buffer is full.
*/
-int stats_emit_field_tags(struct chunk *out, const struct field *f, char delim)
+int stats_emit_field_tags(struct buffer *out, const struct field *f,
+ char delim)
{
char origin, nature, scope;
@@ -395,7 +396,7 @@
/* Emits an encoding of the field type as JSON.
* Returns non-zero on success, 0 if the buffer is full.
*/
-int stats_emit_json_field_tags(struct chunk *out, const struct field *f)
+int stats_emit_json_field_tags(struct buffer *out, const struct field *f)
{
const char *origin, *nature, *scope;
int old_len;
@@ -443,7 +444,8 @@
}
/* Dump all fields from <stats> into <out> using CSV format */
-static int stats_dump_fields_csv(struct chunk *out, const struct field *stats)
+static int stats_dump_fields_csv(struct buffer *out,
+ const struct field *stats)
{
int field;
@@ -458,7 +460,8 @@
}
/* Dump all fields from <stats> into <out> using a typed "field:desc:type:value" format */
-static int stats_dump_fields_typed(struct chunk *out, const struct field *stats)
+static int stats_dump_fields_typed(struct buffer *out,
+ const struct field *stats)
{
int field;
@@ -486,7 +489,7 @@
}
/* Dump all fields from <stats> into <out> using the "show info json" format */
-static int stats_dump_json_info_fields(struct chunk *out,
+static int stats_dump_json_info_fields(struct buffer *out,
const struct field *info)
{
int field;
@@ -535,7 +538,8 @@
}
/* Dump all fields from <stats> into <out> using a typed "field:desc:type:value" format */
-static int stats_dump_fields_json(struct chunk *out, const struct field *stats,
+static int stats_dump_fields_json(struct buffer *out,
+ const struct field *stats,
int first_stat)
{
int field;
@@ -606,9 +610,11 @@
* reserved for the checkbox is ST_SHOWADMIN is set in <flags>. Some extra info
* are provided if ST_SHLGNDS is present in <flags>.
*/
-static int stats_dump_fields_html(struct chunk *out, const struct field *stats, unsigned int flags)
+static int stats_dump_fields_html(struct buffer *out,
+ const struct field *stats,
+ unsigned int flags)
{
- struct chunk src;
+ struct buffer src;
if (stats[ST_F_TYPE].u.u32 == STATS_TYPE_FE) {
chunk_appendf(out,
@@ -1366,7 +1372,7 @@
int stats_fill_li_stats(struct proxy *px, struct listener *l, int flags,
struct field *stats, int len)
{
- struct chunk *out = get_trash_chunk();
+ struct buffer *out = get_trash_chunk();
if (len < ST_F_TOTAL_FIELDS)
return 0;
@@ -1483,7 +1489,7 @@
{
struct server *via, *ref;
char str[INET6_ADDRSTRLEN];
- struct chunk *out = get_trash_chunk();
+ struct buffer *out = get_trash_chunk();
enum srv_stats_state state;
char *fld_status;
@@ -2638,7 +2644,7 @@
char *st_cur_param = NULL;
char *st_next_param = NULL;
- struct chunk *temp;
+ struct buffer *temp;
int reql;
temp = get_trash_chunk();
@@ -3146,7 +3152,8 @@
}
/* Dump all fields from <info> into <out> using the "show info" format (name: value) */
-static int stats_dump_info_fields(struct chunk *out, const struct field *info)
+static int stats_dump_info_fields(struct buffer *out,
+ const struct field *info)
{
int field;
@@ -3165,7 +3172,8 @@
}
/* Dump all fields from <info> into <out> using the "show info typed" format */
-static int stats_dump_typed_info_fields(struct chunk *out, const struct field *info)
+static int stats_dump_typed_info_fields(struct buffer *out,
+ const struct field *info)
{
int field;
@@ -3193,7 +3201,7 @@
int stats_fill_info(struct field *info, int len)
{
unsigned int up = (now.tv_sec - start_date.tv_sec);
- struct chunk *out = get_trash_chunk();
+ struct buffer *out = get_trash_chunk();
#ifdef USE_OPENSSL
int ssl_sess_rate = read_freq_ctr(&global.ssl_per_sec);
@@ -3315,7 +3323,7 @@
* Integer values bouned to the range [-(2**53)+1, (2**53)-1] as
* per the recommendation for interoperable integers in section 6 of RFC 7159.
*/
-static void stats_dump_json_schema(struct chunk *out)
+static void stats_dump_json_schema(struct buffer *out)
{
int old_len = out->data;
diff --git a/src/stick_table.c b/src/stick_table.c
index f688740..e8d4f3a 100644
--- a/src/stick_table.c
+++ b/src/stick_table.c
@@ -3030,7 +3030,8 @@
* read buffer. It returns 0 if the output buffer is full
* and needs to be called again, otherwise non-zero.
*/
-static int table_dump_head_to_buffer(struct chunk *msg, struct stream_interface *si,
+static int table_dump_head_to_buffer(struct buffer *msg,
+ struct stream_interface *si,
struct proxy *proxy, struct proxy *target)
{
struct stream *s = si_strm(si);
@@ -3055,7 +3056,8 @@
* read buffer. It returns 0 if the output buffer is full
* and needs to be called again, otherwise non-zero.
*/
-static int table_dump_entry_to_buffer(struct chunk *msg, struct stream_interface *si,
+static int table_dump_entry_to_buffer(struct buffer *msg,
+ struct stream_interface *si,
struct proxy *proxy, struct stksess *entry)
{
int dt;
diff --git a/src/stream.c b/src/stream.c
index 6c7bd5b..3687bd0 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -1226,7 +1226,7 @@
struct proxy *backend = NULL;
if (rule->dynamic) {
- struct chunk *tmp;
+ struct buffer *tmp;
tmp = alloc_trash_chunk();
if (!tmp)
diff --git a/src/stream_interface.c b/src/stream_interface.c
index 245f680..2fecb94 100644
--- a/src/stream_interface.c
+++ b/src/stream_interface.c
@@ -132,7 +132,8 @@
* not need to be empty before this, and its contents will not be overwritten.
* The primary goal of this function is to return error messages to a client.
*/
-void stream_int_retnclose(struct stream_interface *si, const struct chunk *msg)
+void stream_int_retnclose(struct stream_interface *si,
+ const struct buffer *msg)
{
struct channel *ic = si_ic(si);
struct channel *oc = si_oc(si);
diff --git a/src/wurfl.c b/src/wurfl.c
index 9d2dfa6..f7ac9b6 100644
--- a/src/wurfl.c
+++ b/src/wurfl.c
@@ -520,7 +520,7 @@
static int ha_wurfl_get_all(const struct arg *args, struct sample *smp, const char *kw, void *private)
{
wurfl_device_handle dHandle;
- struct chunk *temp;
+ struct buffer *temp;
wurfl_information_t *wi;
ha_wurfl_header_t wh;
@@ -584,7 +584,7 @@
static int ha_wurfl_get(const struct arg *args, struct sample *smp, const char *kw, void *private)
{
wurfl_device_handle dHandle;
- struct chunk *temp;
+ struct buffer *temp;
wurfl_data_t *wn = NULL;
struct ebmb_node *node;
ha_wurfl_header_t wh;