From: Willy Tarreau Date: Mon, 2 Jul 2012 13:11:27 +0000 (+0200) Subject: REORG/MAJOR: use "struct channel" instead of "struct buffer" X-Git-Tag: v1.5-dev12~83 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7421efb85fb3d87f9265071949d0d5e8bfc431e7;p=thirdparty%2Fhaproxy.git REORG/MAJOR: use "struct channel" instead of "struct buffer" This is a massive rename. We'll then split channel and buffer. This change needs a lot of cleanups. At many locations, the parameter or variable is still called "buf" which will become ambiguous. Also, the "struct channel" is still defined in buffers.h. --- diff --git a/include/proto/backend.h b/include/proto/backend.h index 24cd909362..74caaaac1f 100644 --- a/include/proto/backend.h +++ b/include/proto/backend.h @@ -36,7 +36,7 @@ int connect_server(struct session *s); int srv_redispatch_connect(struct session *t); const char *backend_lb_algo_str(int algo); int backend_parse_balance(const char **args, char **err, struct proxy *curproxy); -int tcp_persist_rdp_cookie(struct session *s, struct buffer *req, int an_bit); +int tcp_persist_rdp_cookie(struct session *s, struct channel *req, int an_bit); int be_downtime(struct proxy *px); void recount_servers(struct proxy *px); diff --git a/include/proto/buffers.h b/include/proto/buffers.h index 80f43ae4a6..4bc79ba51e 100644 --- a/include/proto/buffers.h +++ b/include/proto/buffers.h @@ -40,20 +40,20 @@ extern struct pool_head *pool2_buffer; int init_buffer(); /* SI-to-buffer functions : buffer_{get,put}_{char,block,string,chunk} */ -int bo_inject(struct buffer *buf, const char *msg, int len); -int bi_putblk(struct buffer *buf, const char *str, int len); -int bi_putchr(struct buffer *buf, char c); -int bo_getline(struct buffer *buf, char *str, int len); -int bo_getblk(struct buffer *buf, char *blk, int len, int offset); -int buffer_replace2(struct buffer *b, char *pos, char *end, const char *str, int len); -int buffer_insert_line2(struct buffer *b, char *pos, const char *str, int len); -void buffer_dump(FILE *o, struct buffer *b, int from, int to); -void buffer_slow_realign(struct buffer *buf); -void buffer_bounce_realign(struct buffer *buf); -unsigned long long buffer_forward(struct buffer *buf, unsigned long long bytes); +int bo_inject(struct channel *buf, const char *msg, int len); +int bi_putblk(struct channel *buf, const char *str, int len); +int bi_putchr(struct channel *buf, char c); +int bo_getline(struct channel *buf, char *str, int len); +int bo_getblk(struct channel *buf, char *blk, int len, int offset); +int buffer_replace2(struct channel *b, char *pos, char *end, const char *str, int len); +int buffer_insert_line2(struct channel *b, char *pos, const char *str, int len); +void buffer_dump(FILE *o, struct channel *b, int from, int to); +void buffer_slow_realign(struct channel *buf); +void buffer_bounce_realign(struct channel *buf); +unsigned long long buffer_forward(struct channel *buf, unsigned long long bytes); /* Initialize all fields in the buffer. The BF_OUT_EMPTY flags is set. */ -static inline void buffer_init(struct buffer *buf) +static inline void buffer_init(struct channel *buf) { buf->o = 0; buf->i = 0; @@ -86,7 +86,7 @@ static inline void buffer_init(struct buffer *buf) }) /* Returns the start of the input data in a buffer */ -static inline char *bi_ptr(const struct buffer *b) +static inline char *bi_ptr(const struct channel *b) { return b->p; } @@ -94,7 +94,7 @@ static inline char *bi_ptr(const struct buffer *b) /* Returns the end of the input data in a buffer (pointer to next * insertion point). */ -static inline char *bi_end(const struct buffer *b) +static inline char *bi_end(const struct channel *b) { char *ret = b->p + b->i; @@ -104,7 +104,7 @@ static inline char *bi_end(const struct buffer *b) } /* Returns the amount of input data that can contiguously be read at once */ -static inline int bi_contig_data(const struct buffer *b) +static inline int bi_contig_data(const struct channel *b) { int data = b->data + b->size - b->p; @@ -114,7 +114,7 @@ static inline int bi_contig_data(const struct buffer *b) } /* Returns the start of the output data in a buffer */ -static inline char *bo_ptr(const struct buffer *b) +static inline char *bo_ptr(const struct channel *b) { char *ret = b->p - b->o; @@ -124,13 +124,13 @@ static inline char *bo_ptr(const struct buffer *b) } /* Returns the end of the output data in a buffer */ -static inline char *bo_end(const struct buffer *b) +static inline char *bo_end(const struct channel *b) { return b->p; } /* Returns the amount of output data that can contiguously be read at once */ -static inline int bo_contig_data(const struct buffer *b) +static inline int bo_contig_data(const struct channel *b) { char *beg = b->p - b->o; @@ -140,25 +140,25 @@ static inline int bo_contig_data(const struct buffer *b) } /* Return the buffer's length in bytes by summing the input and the output */ -static inline int buffer_len(const struct buffer *buf) +static inline int buffer_len(const struct channel *buf) { return buf->i + buf->o; } /* Return non-zero only if the buffer is not empty */ -static inline int buffer_not_empty(const struct buffer *buf) +static inline int buffer_not_empty(const struct channel *buf) { return buf->i | buf->o; } /* Return non-zero only if the buffer is empty */ -static inline int buffer_empty(const struct buffer *buf) +static inline int buffer_empty(const struct channel *buf) { return !buffer_not_empty(buf); } /* Normalizes a pointer after a subtract */ -static inline char *buffer_wrap_sub(const struct buffer *buf, char *ptr) +static inline char *buffer_wrap_sub(const struct channel *buf, char *ptr) { if (ptr < buf->data) ptr += buf->size; @@ -166,7 +166,7 @@ static inline char *buffer_wrap_sub(const struct buffer *buf, char *ptr) } /* Normalizes a pointer after an addition */ -static inline char *buffer_wrap_add(const struct buffer *buf, char *ptr) +static inline char *buffer_wrap_add(const struct channel *buf, char *ptr) { if (ptr - buf->size >= buf->data) ptr -= buf->size; @@ -178,7 +178,7 @@ static inline char *buffer_wrap_add(const struct buffer *buf, char *ptr) * bytes free. The result is between 0 and global.maxrewrite, which is itself * smaller than any buf->size. */ -static inline int buffer_reserved(const struct buffer *buf) +static inline int buffer_reserved(const struct channel *buf) { int ret = global.tune.maxrewrite - buf->to_forward - buf->o; @@ -193,7 +193,7 @@ static inline int buffer_reserved(const struct buffer *buf) * pending bytes are forwarded, the buffer still has global.tune.maxrewrite * bytes free. The result sits between buf->size - maxrewrite and buf->size. */ -static inline int buffer_max_len(const struct buffer *buf) +static inline int buffer_max_len(const struct channel *buf) { return buf->size - buffer_reserved(buf); } @@ -203,7 +203,7 @@ static inline int buffer_max_len(const struct buffer *buf) * close to happen. The test is optimized to avoid as many operations as * possible for the fast case and to be used as an "if" condition. */ -static inline int bi_full(const struct buffer *b) +static inline int bi_full(const struct channel *b) { int rem = b->size; @@ -228,7 +228,7 @@ static inline int bi_full(const struct buffer *b) * is close to happen. The test is optimized to avoid as many operations as * possible for the fast case. */ -static inline int bi_avail(const struct buffer *b) +static inline int bi_avail(const struct channel *b) { int rem = b->size; int rem2; @@ -257,7 +257,7 @@ static inline int bi_avail(const struct buffer *b) /* Return the maximum amount of bytes that can be written into the buffer, * including reserved space which may be overwritten. */ -static inline int buffer_total_space(const struct buffer *buf) +static inline int buffer_total_space(const struct channel *buf) { return buf->size - buffer_len(buf); } @@ -266,7 +266,7 @@ static inline int buffer_total_space(const struct buffer *buf) * and enforces a limit on buf->data + buf->size. must be within the * buffer. */ -static inline int buffer_contig_area(const struct buffer *buf, const char *start, int count) +static inline int buffer_contig_area(const struct channel *buf, const char *start, int count) { if (count > buf->data - start + buf->size) count = buf->data - start + buf->size; @@ -276,7 +276,7 @@ static inline int buffer_contig_area(const struct buffer *buf, const char *start /* Return the amount of bytes that can be written into the buffer at once, * including reserved space which may be overwritten. */ -static inline int buffer_contig_space(const struct buffer *buf) +static inline int buffer_contig_space(const struct channel *buf) { const char *left, *right; @@ -294,7 +294,7 @@ static inline int buffer_contig_space(const struct buffer *buf) * to out. The caller is responsible for ensuring that adv is always * smaller than or equal to b->i. The BF_OUT_EMPTY flag is updated. */ -static inline void b_adv(struct buffer *b, unsigned int adv) +static inline void b_adv(struct channel *b, unsigned int adv) { b->i -= adv; b->o += adv; @@ -307,7 +307,7 @@ static inline void b_adv(struct buffer *b, unsigned int adv) * backwards, and that as many bytes from out are moved to in. The caller is * responsible for ensuring that adv is always smaller than or equal to b->o. */ -static inline void b_rew(struct buffer *b, unsigned int adv) +static inline void b_rew(struct channel *b, unsigned int adv) { b->i += adv; b->o -= adv; @@ -320,7 +320,7 @@ static inline void b_rew(struct buffer *b, unsigned int adv) * excluding the amount of reserved space passed in , which is * preserved. */ -static inline int buffer_contig_space_with_res(const struct buffer *buf, int res) +static inline int buffer_contig_space_with_res(const struct channel *buf, int res) { /* Proceed differently if the buffer is full, partially used or empty. * The hard situation is when it's partially used and either data or @@ -342,7 +342,7 @@ static inline int buffer_contig_space_with_res(const struct buffer *buf, int res /* Return the amount of bytes that can be written into the buffer at once, * excluding reserved space, which is preserved. */ -static inline int buffer_contig_space_res(const struct buffer *buf) +static inline int buffer_contig_space_res(const struct channel *buf) { return buffer_contig_space_with_res(buf, buffer_reserved(buf)); } @@ -353,7 +353,7 @@ static inline int buffer_contig_space_res(const struct buffer *buf) * once, so the original pointer must be between ->data-size and ->data+2*size-1, * otherwise an invalid pointer might be returned. */ -static inline const char *buffer_pointer(const struct buffer *buf, const char *ptr) +static inline const char *buffer_pointer(const struct channel *buf, const char *ptr) { if (ptr < buf->data) ptr += buf->size; @@ -365,7 +365,7 @@ static inline const char *buffer_pointer(const struct buffer *buf, const char *p /* Returns the distance between two pointers, taking into account the ability * to wrap around the buffer's end. */ -static inline int buffer_count(const struct buffer *buf, const char *from, const char *to) +static inline int buffer_count(const struct channel *buf, const char *from, const char *to) { int count = to - from; if (count < 0) @@ -376,7 +376,7 @@ static inline int buffer_count(const struct buffer *buf, const char *from, const /* returns the amount of pending bytes in the buffer. It is the amount of bytes * that is not scheduled to be sent. */ -static inline int buffer_pending(const struct buffer *buf) +static inline int buffer_pending(const struct channel *buf) { return buf->i; } @@ -387,7 +387,7 @@ static inline int buffer_pending(const struct buffer *buf) * . It always starts at buf->p. The work area includes the * reserved area. */ -static inline int buffer_work_area(const struct buffer *buf, const char *end) +static inline int buffer_work_area(const struct channel *buf, const char *end) { end = buffer_pointer(buf, end); if (end == buffer_wrap_add(buf, buf->p + buf->i)) @@ -397,7 +397,7 @@ static inline int buffer_work_area(const struct buffer *buf, const char *end) } /* Return 1 if the buffer has less than 1/4 of its capacity free, otherwise 0 */ -static inline int buffer_almost_full(const struct buffer *buf) +static inline int buffer_almost_full(const struct channel *buf) { if (buffer_total_space(buf) < buf->size / 4) return 1; @@ -405,13 +405,13 @@ static inline int buffer_almost_full(const struct buffer *buf) } /* Returns true if the buffer's input is already closed */ -static inline int buffer_input_closed(struct buffer *buf) +static inline int buffer_input_closed(struct channel *buf) { return ((buf->flags & BF_SHUTR) != 0); } /* Returns true if the buffer's output is already closed */ -static inline int buffer_output_closed(struct buffer *buf) +static inline int buffer_output_closed(struct channel *buf) { return ((buf->flags & BF_SHUTW) != 0); } @@ -422,7 +422,7 @@ static inline int buffer_output_closed(struct buffer *buf) * That way, we don't have to update the timeout on every I/O. Note that the * analyser timeout is always checked. */ -static inline void buffer_check_timeouts(struct buffer *b) +static inline void buffer_check_timeouts(struct channel *b) { if (likely(!(b->flags & (BF_SHUTR|BF_READ_TIMEOUT|BF_READ_ACTIVITY|BF_READ_NOEXP))) && unlikely(tick_is_expired(b->rex, now_ms))) @@ -441,7 +441,7 @@ static inline void buffer_check_timeouts(struct buffer *b) * already covers those data. That permits doing a flush even after a forward, * although not recommended. */ -static inline void buffer_flush(struct buffer *buf) +static inline void buffer_flush(struct channel *buf) { buf->p = buffer_wrap_add(buf, buf->p + buf->i); buf->o += buf->i; @@ -454,7 +454,7 @@ static inline void buffer_flush(struct buffer *buf) * that any spliced data is not affected since we may not have any access to * it. */ -static inline void buffer_erase(struct buffer *buf) +static inline void buffer_erase(struct channel *buf) { buf->o = 0; buf->i = 0; @@ -470,7 +470,7 @@ static inline void buffer_erase(struct buffer *buf) * stopped. This is mainly to be used to send error messages after existing * data. */ -static inline void bi_erase(struct buffer *buf) +static inline void bi_erase(struct channel *buf) { if (!buf->o) return buffer_erase(buf); @@ -491,26 +491,26 @@ static inline void bi_erase(struct buffer *buf) * This is mainly used to remove empty lines at the beginning of a request * or a response. */ -static inline void bi_fast_delete(struct buffer *buf, int n) +static inline void bi_fast_delete(struct channel *buf, int n) { buf->i -= n; buf->p += n; } /* marks the buffer as "shutdown" ASAP for reads */ -static inline void buffer_shutr_now(struct buffer *buf) +static inline void buffer_shutr_now(struct channel *buf) { buf->flags |= BF_SHUTR_NOW; } /* marks the buffer as "shutdown" ASAP for writes */ -static inline void buffer_shutw_now(struct buffer *buf) +static inline void buffer_shutw_now(struct channel *buf) { buf->flags |= BF_SHUTW_NOW; } /* marks the buffer as "shutdown" ASAP in both directions */ -static inline void buffer_abort(struct buffer *buf) +static inline void buffer_abort(struct channel *buf) { buf->flags |= BF_SHUTR_NOW | BF_SHUTW_NOW; buf->flags &= ~BF_AUTO_CONNECT; @@ -522,8 +522,8 @@ static inline void buffer_abort(struct buffer *buf) * during this first call. */ static inline void buffer_install_hijacker(struct session *s, - struct buffer *b, - void (*func)(struct session *, struct buffer *)) + struct channel *b, + void (*func)(struct session *, struct channel *)) { b->hijacker = func; b->flags |= BF_HIJACK; @@ -531,13 +531,13 @@ static inline void buffer_install_hijacker(struct session *s, } /* Releases the buffer from hijacking mode. Often used by the hijack function */ -static inline void buffer_stop_hijack(struct buffer *buf) +static inline void buffer_stop_hijack(struct channel *buf) { buf->flags &= ~BF_HIJACK; } /* allow the consumer to try to establish a new connection. */ -static inline void buffer_auto_connect(struct buffer *buf) +static inline void buffer_auto_connect(struct channel *buf) { buf->flags |= BF_AUTO_CONNECT; } @@ -545,31 +545,31 @@ static inline void buffer_auto_connect(struct buffer *buf) /* prevent the consumer from trying to establish a new connection, and also * disable auto shutdown forwarding. */ -static inline void buffer_dont_connect(struct buffer *buf) +static inline void buffer_dont_connect(struct channel *buf) { buf->flags &= ~(BF_AUTO_CONNECT|BF_AUTO_CLOSE); } /* allow the producer to forward shutdown requests */ -static inline void buffer_auto_close(struct buffer *buf) +static inline void buffer_auto_close(struct channel *buf) { buf->flags |= BF_AUTO_CLOSE; } /* prevent the producer from forwarding shutdown requests */ -static inline void buffer_dont_close(struct buffer *buf) +static inline void buffer_dont_close(struct channel *buf) { buf->flags &= ~BF_AUTO_CLOSE; } /* allow the producer to read / poll the input */ -static inline void buffer_auto_read(struct buffer *buf) +static inline void buffer_auto_read(struct channel *buf) { buf->flags &= ~BF_DONT_READ; } /* prevent the producer from read / poll the input */ -static inline void buffer_dont_read(struct buffer *buf) +static inline void buffer_dont_read(struct channel *buf) { buf->flags |= BF_DONT_READ; } @@ -578,7 +578,7 @@ static inline void buffer_dont_read(struct buffer *buf) * Tries to realign the given buffer, and returns how many bytes can be written * there at once without overwriting anything. */ -static inline int buffer_realign(struct buffer *buf) +static inline int buffer_realign(struct channel *buf) { if (!(buf->i | buf->o)) { /* let's realign the buffer to optimize I/O */ @@ -593,7 +593,7 @@ static inline int buffer_realign(struct buffer *buf) * with causing a wrapping at the end of the buffer. It's the caller's * responsibility to ensure that is never larger than buf->o. */ -static inline void bo_skip(struct buffer *buf, int len) +static inline void bo_skip(struct channel *buf, int len) { buf->o -= len; if (!buf->o && !buf->pipe) @@ -617,7 +617,7 @@ static inline void bo_skip(struct buffer *buf, int len) * Buffer flags FULL, EMPTY and READ_PARTIAL are updated if some data can be * transferred. The chunk's length is updated with the number of bytes sent. */ -static inline int bi_putchk(struct buffer *buf, struct chunk *chunk) +static inline int bi_putchk(struct channel *buf, struct chunk *chunk) { int ret; @@ -635,7 +635,7 @@ static inline int bi_putchk(struct buffer *buf, struct chunk *chunk) * Buffer flags FULL, EMPTY and READ_PARTIAL are updated if some data can be * transferred. */ -static inline int bi_putstr(struct buffer *buf, const char *str) +static inline int bi_putstr(struct channel *buf, const char *str) { return bi_putblk(buf, str, strlen(str)); } @@ -646,7 +646,7 @@ static inline int bi_putstr(struct buffer *buf, const char *str) * it's up to the caller to call bo_skip(buf, 1) when it has consumed the char. * Also note that this function respects the ->o limit. */ -static inline int bo_getchr(struct buffer *buf) +static inline int bo_getchr(struct channel *buf) { /* closed or empty + imminent close = -2; empty = -1 */ if (unlikely(buf->flags & (BF_OUT_EMPTY|BF_SHUTW))) { @@ -664,7 +664,7 @@ static inline int bo_getchr(struct buffer *buf) * not done. The function does not adjust ->o nor BF_OUT_EMPTY because * it does not make sense to use it on data scheduled to be sent. */ -static inline int buffer_replace(struct buffer *b, char *pos, char *end, const char *str) +static inline int buffer_replace(struct channel *b, char *pos, char *end, const char *str) { return buffer_replace2(b, pos, end, str, strlen(str)); } diff --git a/include/proto/frontend.h b/include/proto/frontend.h index a80f9bd643..3f67d4f36b 100644 --- a/include/proto/frontend.h +++ b/include/proto/frontend.h @@ -26,7 +26,7 @@ #include int frontend_accept(struct session *s); -int frontend_decode_proxy_request(struct session *s, struct buffer *req, int an_bit); +int frontend_decode_proxy_request(struct session *s, struct channel *req, int an_bit); int make_proxy_line(char *buf, int buf_len, struct sockaddr_storage *src, struct sockaddr_storage *dst); diff --git a/include/proto/proto_http.h b/include/proto/proto_http.h index 06fe292574..69d932c497 100644 --- a/include/proto/proto_http.h +++ b/include/proto/proto_http.h @@ -66,27 +66,27 @@ int event_accept(int fd); int process_cli(struct session *t); int process_srv_data(struct session *t); int process_srv_conn(struct session *t); -int http_wait_for_request(struct session *s, struct buffer *req, int an_bit); -int http_process_req_common(struct session *s, struct buffer *req, int an_bit, struct proxy *px); -int http_process_request(struct session *t, struct buffer *req, int an_bit); -int http_process_tarpit(struct session *s, struct buffer *req, int an_bit); -int http_process_request_body(struct session *s, struct buffer *req, int an_bit); +int http_wait_for_request(struct session *s, struct channel *req, int an_bit); +int http_process_req_common(struct session *s, struct channel *req, int an_bit, struct proxy *px); +int http_process_request(struct session *t, struct channel *req, int an_bit); +int http_process_tarpit(struct session *s, struct channel *req, int an_bit); +int http_process_request_body(struct session *s, struct channel *req, int an_bit); int http_send_name_header(struct http_txn *txn, struct proxy* be, const char* svr_name); -int http_wait_for_response(struct session *s, struct buffer *rep, int an_bit); -int http_process_res_common(struct session *t, struct buffer *rep, int an_bit, struct proxy *px); -int http_request_forward_body(struct session *s, struct buffer *req, int an_bit); -int http_response_forward_body(struct session *s, struct buffer *res, int an_bit); +int http_wait_for_response(struct session *s, struct channel *rep, int an_bit); +int http_process_res_common(struct session *t, struct channel *rep, int an_bit, struct proxy *px); +int http_request_forward_body(struct session *s, struct channel *req, int an_bit); +int http_response_forward_body(struct session *s, struct channel *res, int an_bit); void debug_hdr(const char *dir, struct session *t, const char *start, const char *end); void get_srv_from_appsession(struct session *t, const char *begin, int len); -int apply_filter_to_req_headers(struct session *t, struct buffer *req, struct hdr_exp *exp); -int apply_filter_to_req_line(struct session *t, struct buffer *req, struct hdr_exp *exp); -int apply_filters_to_request(struct session *s, struct buffer *req, struct proxy *px); -int apply_filters_to_response(struct session *t, struct buffer *rtr, struct proxy *px); +int apply_filter_to_req_headers(struct session *t, struct channel *req, struct hdr_exp *exp); +int apply_filter_to_req_line(struct session *t, struct channel *req, struct hdr_exp *exp); +int apply_filters_to_request(struct session *s, struct channel *req, struct proxy *px); +int apply_filters_to_response(struct session *t, struct channel *rtr, struct proxy *px); void manage_client_side_appsession(struct session *t, const char *buf, int len); -void manage_client_side_cookies(struct session *t, struct buffer *req); -void manage_server_side_cookies(struct session *t, struct buffer *rtr); -void check_response_for_cacheability(struct session *t, struct buffer *rtr); +void manage_client_side_cookies(struct session *t, struct channel *req); +void manage_server_side_cookies(struct session *t, struct channel *rtr); +void check_response_for_cacheability(struct session *t, struct channel *rtr); int stats_check_uri(struct stream_interface *si, struct http_txn *txn, struct proxy *backend); void init_proto_http(); int http_find_header2(const char *name, int len, diff --git a/include/proto/proto_tcp.h b/include/proto/proto_tcp.h index 6a60121d21..6aadb5ae22 100644 --- a/include/proto/proto_tcp.h +++ b/include/proto/proto_tcp.h @@ -34,8 +34,8 @@ int tcp_connect_server(struct stream_interface *si); int tcp_connect_probe(struct connection *conn); int tcp_get_src(int fd, struct sockaddr *sa, socklen_t salen, int dir); int tcp_get_dst(int fd, struct sockaddr *sa, socklen_t salen, int dir); -int tcp_inspect_request(struct session *s, struct buffer *req, int an_bit); -int tcp_inspect_response(struct session *s, struct buffer *rep, int an_bit); +int tcp_inspect_request(struct session *s, struct channel *req, int an_bit); +int tcp_inspect_response(struct session *s, struct channel *rep, int an_bit); int tcp_exec_req_rules(struct session *s); int smp_fetch_rdp_cookie(struct proxy *px, struct session *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp); diff --git a/include/types/buffers.h b/include/types/buffers.h index ab56129125..68b4319c52 100644 --- a/include/types/buffers.h +++ b/include/types/buffers.h @@ -27,7 +27,7 @@ #include /* The BF_* macros designate Buffer Flags, which may be ORed in the bit field - * member 'flags' in struct buffer. Here we have several types of flags : + * member 'flags' in struct channel. Here we have several types of flags : * * - pure status flags, reported by the lower layer, which must be cleared * before doing further I/O : @@ -174,7 +174,7 @@ struct chunk { /* needed for a declaration below */ struct session; -struct buffer { +struct channel { unsigned int flags; /* BF_* */ int rex; /* expiration date for a read, in ticks */ int wex; /* expiration date for a write or connect, in ticks */ @@ -187,7 +187,7 @@ struct buffer { unsigned int to_forward; /* number of bytes to forward after out without a wake-up */ unsigned int analysers; /* bit field indicating what to do on the buffer */ int analyse_exp; /* expiration date for current analysers (if set) */ - void (*hijacker)(struct session *, struct buffer *); /* alternative content producer */ + void (*hijacker)(struct session *, struct channel *); /* alternative content producer */ unsigned char xfer_large; /* number of consecutive large xfers */ unsigned char xfer_small; /* number of consecutive small xfers */ unsigned long long total; /* total data read */ diff --git a/include/types/proto_http.h b/include/types/proto_http.h index 76c8e6b506..158f0948d5 100644 --- a/include/types/proto_http.h +++ b/include/types/proto_http.h @@ -305,7 +305,7 @@ enum { struct http_msg { unsigned int msg_state; /* where we are in the current message parsing */ unsigned int flags; /* flags describing the message (HTTP version, ...) */ - struct buffer *buf; /* pointer to the buffer which holds the message */ + struct channel *buf; /* pointer to the buffer which holds the message */ unsigned int next; /* pointer to next byte to parse, relative to buf->p */ unsigned int sov; /* current header: start of value */ unsigned int eoh; /* End Of Headers, relative to buffer */ diff --git a/include/types/session.h b/include/types/session.h index a0980028ce..9180a94b57 100644 --- a/include/types/session.h +++ b/include/types/session.h @@ -169,8 +169,8 @@ struct session { struct proxy *be; /* the proxy this session depends on for the server side */ int flags; /* some flags describing the session */ unsigned term_trace; /* term trace: 4*8 bits indicating which part of the code closed */ - struct buffer *req; /* request buffer */ - struct buffer *rep; /* response buffer */ + struct channel *req; /* request buffer */ + struct channel *rep; /* response buffer */ struct stream_interface si[2]; /* client and server stream interfaces */ struct server *srv_conn; /* session already has a slot on a server and is not in queue */ struct target target; /* target to use for this session */ diff --git a/include/types/stream_interface.h b/include/types/stream_interface.h index e181d570c4..1a75c8d45b 100644 --- a/include/types/stream_interface.h +++ b/include/types/stream_interface.h @@ -136,7 +136,7 @@ struct stream_interface { unsigned int state; /* SI_ST* */ unsigned int prev_state;/* SI_ST*, copy of previous state */ unsigned int flags; /* SI_FL_* */ - struct buffer *ib, *ob; /* input and output buffers */ + struct channel *ib, *ob; /* input and output buffers */ unsigned int exp; /* wake up time for connect, queue, turn-around, ... */ void *owner; /* generally a (struct task*) */ unsigned int err_type; /* first error detected, one of SI_ET_* */ diff --git a/src/acl.c b/src/acl.c index e2e72ceb6a..b4c5908fc2 100644 --- a/src/acl.c +++ b/src/acl.c @@ -120,7 +120,7 @@ acl_fetch_ssl_hello_type(struct proxy *px, struct session *l4, void *l7, unsigne { int hs_len; int hs_type, bleft; - struct buffer *b; + struct channel *b; const unsigned char *data; if (!l4) @@ -324,7 +324,7 @@ acl_fetch_ssl_hello_sni(struct proxy *px, struct session *l4, void *l7, unsigned const struct arg *args, struct sample *smp) { int hs_len, ext_len, bleft; - struct buffer *b; + struct channel *b; unsigned char *data; if (!l4) diff --git a/src/backend.c b/src/backend.c index e3a64e9149..b3bd972e7b 100644 --- a/src/backend.c +++ b/src/backend.c @@ -252,7 +252,7 @@ struct server *get_server_ph_post(struct session *s) { unsigned long hash = 0; struct http_txn *txn = &s->txn; - struct buffer *req = s->req; + struct channel *req = s->req; struct http_msg *msg = &txn->req; struct proxy *px = s->be; unsigned int plen = px->url_param_len; @@ -1122,7 +1122,7 @@ int srv_redispatch_connect(struct session *t) * session. This always returns 1, and the analyser removes itself from the * list. Nothing is performed if a server was already assigned. */ -int tcp_persist_rdp_cookie(struct session *s, struct buffer *req, int an_bit) +int tcp_persist_rdp_cookie(struct session *s, struct channel *req, int an_bit) { struct proxy *px = s->be; int ret; diff --git a/src/buffers.c b/src/buffers.c index 6eeb64f548..6d87ef9fe8 100644 --- a/src/buffers.c +++ b/src/buffers.c @@ -26,7 +26,7 @@ struct pool_head *pool2_buffer; /* perform minimal intializations, report 0 in case of error, 1 if OK. */ int init_buffer() { - pool2_buffer = create_pool("buffer", sizeof(struct buffer) + global.tune.bufsize, MEM_F_SHARED); + pool2_buffer = create_pool("buffer", sizeof(struct channel) + global.tune.bufsize, MEM_F_SHARED); return pool2_buffer != NULL; } @@ -38,7 +38,7 @@ int init_buffer() * Directly touching ->to_forward will cause lockups when ->o goes down to * zero if nobody is ready to push the remaining data. */ -unsigned long long buffer_forward(struct buffer *buf, unsigned long long bytes) +unsigned long long buffer_forward(struct channel *buf, unsigned long long bytes) { unsigned int new_forward; unsigned int forwarded; @@ -96,7 +96,7 @@ unsigned long long buffer_forward(struct buffer *buf, unsigned long long bytes) * Note: this function appends data to the buffer's output and possibly overwrites * any pending input data which are assumed not to exist. */ -int bo_inject(struct buffer *buf, const char *msg, int len) +int bo_inject(struct channel *buf, const char *msg, int len) { int max; @@ -136,7 +136,7 @@ int bo_inject(struct buffer *buf, const char *msg, int len) * flags FULL, EMPTY and READ_PARTIAL are updated if some data can be * transferred. */ -int bi_putchr(struct buffer *buf, char c) +int bi_putchr(struct channel *buf, char c) { if (unlikely(buffer_input_closed(buf))) return -2; @@ -169,7 +169,7 @@ int bi_putchr(struct buffer *buf, char c) * Buffer flags FULL, EMPTY and READ_PARTIAL are updated if some data can be * transferred. */ -int bi_putblk(struct buffer *buf, const char *blk, int len) +int bi_putblk(struct channel *buf, const char *blk, int len) { int max; @@ -228,7 +228,7 @@ int bi_putblk(struct buffer *buf, const char *blk, int len) * output are full. If either of them is full, the string may be returned * as is, without the '\n'. */ -int bo_getline(struct buffer *buf, char *str, int len) +int bo_getline(struct channel *buf, char *str, int len) { int ret, max; char *p; @@ -276,7 +276,7 @@ int bo_getline(struct buffer *buf, char *str, int len) * The buffer status is not changed. The caller must call bo_skip() to * update it. */ -int bo_getblk(struct buffer *buf, char *blk, int len, int offset) +int bo_getblk(struct channel *buf, char *blk, int len, int offset) { int firstblock; @@ -315,7 +315,7 @@ int bo_getblk(struct buffer *buf, char *blk, int len, int offset) * is not updated. The string length is taken from parameter . If * is null, the pointer is allowed to be null. */ -int buffer_replace2(struct buffer *b, char *pos, char *end, const char *str, int len) +int buffer_replace2(struct channel *b, char *pos, char *end, const char *str, int len) { int delta; @@ -357,7 +357,7 @@ int buffer_replace2(struct buffer *b, char *pos, char *end, const char *str, int * * The number of bytes added is returned on success. 0 is returned on failure. */ -int buffer_insert_line2(struct buffer *b, char *pos, const char *str, int len) +int buffer_insert_line2(struct channel *b, char *pos, const char *str, int len) { int delta; @@ -390,7 +390,7 @@ int buffer_insert_line2(struct buffer *b, char *pos, const char *str, int len) * becomes contiguous and starts at the beginning of the buffer area. The * function may only be used when the buffer's output is empty. */ -void buffer_slow_realign(struct buffer *buf) +void buffer_slow_realign(struct channel *buf) { /* two possible cases : * - the buffer is in one contiguous block, we move it in-place @@ -420,7 +420,7 @@ void buffer_slow_realign(struct buffer *buf) * so it's desirable to use it only on non-contiguous buffers. No pointers are * changed, the caller is responsible for that. */ -void buffer_bounce_realign(struct buffer *buf) +void buffer_bounce_realign(struct channel *buf) { int advance, to_move; char *from, *to; @@ -584,7 +584,7 @@ int chunk_asciiencode(struct chunk *dst, struct chunk *src, char qc) { /* * Dumps part or all of a buffer. */ -void buffer_dump(FILE *o, struct buffer *b, int from, int to) +void buffer_dump(FILE *o, struct channel *b, int from, int to) { fprintf(o, "Dumping buffer %p\n", b); fprintf(o, " data=%p o=%d i=%d p=%p\n", diff --git a/src/dumpstats.c b/src/dumpstats.c index a125242c18..a3d0f2809a 100644 --- a/src/dumpstats.c +++ b/src/dumpstats.c @@ -1456,8 +1456,8 @@ static int stats_sock_parse_request(struct stream_interface *si, char *line) */ static void cli_io_handler(struct stream_interface *si) { - struct buffer *req = si->ob; - struct buffer *res = si->ib; + struct channel *req = si->ob; + struct channel *res = si->ib; int reql; int len; @@ -1816,8 +1816,8 @@ static int stats_http_redir(struct stream_interface *si, struct uri_auth *uri) static void http_stats_io_handler(struct stream_interface *si) { struct session *s = si->conn.data_ctx; - struct buffer *req = si->ob; - struct buffer *res = si->ib; + struct channel *req = si->ob; + struct channel *res = si->ib; if (unlikely(si->state == SI_ST_DIS || si->state == SI_ST_CLO)) goto out; @@ -1872,7 +1872,7 @@ static void http_stats_io_handler(struct stream_interface *si) static int stats_dump_http(struct stream_interface *si, struct uri_auth *uri) { struct session *s = si->conn.data_ctx; - struct buffer *rep = si->ib; + struct channel *rep = si->ib; struct proxy *px; struct chunk msg; unsigned int up; @@ -2242,7 +2242,7 @@ static int stats_dump_http(struct stream_interface *si, struct uri_auth *uri) static int stats_dump_proxy(struct stream_interface *si, struct proxy *px, struct uri_auth *uri) { struct session *s = si->conn.data_ctx; - struct buffer *rep = si->ib; + struct channel *rep = si->ib; struct server *sv, *svs; /* server and server-state, server-state=server or server->track */ struct listener *l; struct chunk msg; diff --git a/src/frontend.c b/src/frontend.c index 82699dc4c0..8405bf63f9 100644 --- a/src/frontend.c +++ b/src/frontend.c @@ -251,7 +251,7 @@ int frontend_accept(struct session *s) * are removed from the buffer. The function returns zero if it needs to wait * for more data (max: timeout_client), or 1 if it has finished and removed itself. */ -int frontend_decode_proxy_request(struct session *s, struct buffer *req, int an_bit) +int frontend_decode_proxy_request(struct session *s, struct channel *req, int an_bit) { char *line = req->data; char *end = req->data + req->i; diff --git a/src/proto_http.c b/src/proto_http.c index 08e2c9d80a..173ba32a61 100644 --- a/src/proto_http.c +++ b/src/proto_http.c @@ -1290,7 +1290,7 @@ void http_msg_analyzer(struct http_msg *msg, struct hdr_idx *idx) { unsigned int state; /* updated only when leaving the FSM */ register char *ptr, *end; /* request pointers, to avoid dereferences */ - struct buffer *buf = msg->buf; + struct channel *buf = msg->buf; state = msg->msg_state; ptr = buf->p + msg->next; @@ -1747,7 +1747,7 @@ void http_change_connection_header(struct http_txn *txn, struct http_msg *msg, i */ int http_parse_chunk_size(struct http_msg *msg) { - const struct buffer *buf = msg->buf; + const struct channel *buf = msg->buf; const char *ptr = b_ptr(buf, msg->next); const char *ptr_old = ptr; const char *end = buf->data + buf->size; @@ -1855,7 +1855,7 @@ int http_parse_chunk_size(struct http_msg *msg) */ int http_forward_trailers(struct http_msg *msg) { - const struct buffer *buf = msg->buf; + const struct channel *buf = msg->buf; /* we have msg->next which points to next line. Look for CRLF. */ while (1) { @@ -1929,7 +1929,7 @@ int http_forward_trailers(struct http_msg *msg) */ int http_skip_chunk_crlf(struct http_msg *msg) { - const struct buffer *buf = msg->buf; + const struct channel *buf = msg->buf; const char *ptr; int bytes; @@ -1971,7 +1971,7 @@ int http_skip_chunk_crlf(struct http_msg *msg) * when it has nothing left to do, and may remove any analyser when it wants to * abort. */ -int http_wait_for_request(struct session *s, struct buffer *req, int an_bit) +int http_wait_for_request(struct session *s, struct channel *req, int an_bit) { /* * We will parse the partial (or complete) lines. @@ -2519,7 +2519,7 @@ int http_wait_for_request(struct session *s, struct buffer *req, int an_bit) * Parse the posted data and enable/disable servers if necessary. * Returns 1 if request was parsed or zero if it needs more data. */ -int http_process_req_stat_post(struct stream_interface *si, struct http_txn *txn, struct buffer *req) +int http_process_req_stat_post(struct stream_interface *si, struct http_txn *txn, struct channel *req) { struct proxy *px = NULL; struct server *sv = NULL; @@ -2772,7 +2772,7 @@ http_check_access_rule(struct proxy *px, struct list *rules, struct session *s, * either needs more data or wants to immediately abort the request (eg: deny, * error, ...). */ -int http_process_req_common(struct session *s, struct buffer *req, int an_bit, struct proxy *px) +int http_process_req_common(struct session *s, struct channel *req, int an_bit, struct proxy *px) { struct http_txn *txn = &s->txn; struct http_msg *msg = &txn->req; @@ -3237,7 +3237,7 @@ int http_process_req_common(struct session *s, struct buffer *req, int an_bit, s * needs more data, encounters an error, or wants to immediately abort the * request. It relies on buffers flags, and updates s->req->analysers. */ -int http_process_request(struct session *s, struct buffer *req, int an_bit) +int http_process_request(struct session *s, struct channel *req, int an_bit) { struct http_txn *txn = &s->txn; struct http_msg *msg = &txn->req; @@ -3517,7 +3517,7 @@ int http_process_request(struct session *s, struct buffer *req, int an_bit) * returns zero, at the beginning because it prevents any other processing * from occurring, and at the end because it terminates the request. */ -int http_process_tarpit(struct session *s, struct buffer *req, int an_bit) +int http_process_tarpit(struct session *s, struct channel *req, int an_bit) { struct http_txn *txn = &s->txn; @@ -3563,7 +3563,7 @@ int http_process_tarpit(struct session *s, struct buffer *req, int an_bit) * because it expects the request to be parsed. It returns zero if it needs to * read more data, or 1 once it has completed its analysis. */ -int http_process_request_body(struct session *s, struct buffer *req, int an_bit) +int http_process_request_body(struct session *s, struct channel *req, int an_bit) { struct http_txn *txn = &s->txn; struct http_msg *msg = &s->txn.req; @@ -3702,7 +3702,7 @@ int http_send_name_header(struct http_txn *txn, struct proxy* be, const char* sr char *hdr_name = be->server_id_hdr_name; int hdr_name_len = be->server_id_hdr_len; - struct buffer *req = txn->req.buf; + struct channel *req = txn->req.buf; char *hdr_val; unsigned int old_o, old_i; @@ -3881,7 +3881,7 @@ void http_end_txn_clean_session(struct session *s) */ int http_sync_req_state(struct session *s) { - struct buffer *buf = s->req; + struct channel *buf = s->req; struct http_txn *txn = &s->txn; unsigned int old_flags = buf->flags; unsigned int old_state = txn->req.msg_state; @@ -4002,7 +4002,7 @@ int http_sync_req_state(struct session *s) */ int http_sync_res_state(struct session *s) { - struct buffer *buf = s->rep; + struct channel *buf = s->rep; struct http_txn *txn = &s->txn; unsigned int old_flags = buf->flags; unsigned int old_state = txn->rsp.msg_state; @@ -4202,7 +4202,7 @@ int http_resync_states(struct session *s) * bytes of pending data + the headers if not already done (between sol and sov). * It eventually adjusts sol to match sov after the data in between have been sent. */ -int http_request_forward_body(struct session *s, struct buffer *req, int an_bit) +int http_request_forward_body(struct session *s, struct channel *req, int an_bit) { struct http_txn *txn = &s->txn; struct http_msg *msg = &s->txn.req; @@ -4468,7 +4468,7 @@ int http_request_forward_body(struct session *s, struct buffer *req, int an_bit) * when it has nothing left to do, and may remove any analyser when it wants to * abort. */ -int http_wait_for_response(struct session *s, struct buffer *rep, int an_bit) +int http_wait_for_response(struct session *s, struct channel *rep, int an_bit) { struct http_txn *txn = &s->txn; struct http_msg *msg = &txn->rsp; @@ -4897,7 +4897,7 @@ skip_content_length: * and updates t->rep->analysers. It might make sense to explode it into several * other functions. It works like process_request (see indications above). */ -int http_process_res_common(struct session *t, struct buffer *rep, int an_bit, struct proxy *px) +int http_process_res_common(struct session *t, struct channel *rep, int an_bit, struct proxy *px) { struct http_txn *txn = &t->txn; struct http_msg *msg = &txn->rsp; @@ -5269,7 +5269,7 @@ int http_process_res_common(struct session *t, struct buffer *rep, int an_bit, s * bytes of pending data + the headers if not already done (between sol and sov). * It eventually adjusts sol to match sov after the data in between have been sent. */ -int http_response_forward_body(struct session *s, struct buffer *res, int an_bit) +int http_response_forward_body(struct session *s, struct channel *res, int an_bit) { struct http_txn *txn = &s->txn; struct http_msg *msg = &s->txn.rsp; @@ -5498,7 +5498,7 @@ int http_response_forward_body(struct session *s, struct buffer *res, int an_bit * Since it can manage the switch to another backend, it updates the per-proxy * DENY stats. */ -int apply_filter_to_req_headers(struct session *t, struct buffer *req, struct hdr_exp *exp) +int apply_filter_to_req_headers(struct session *t, struct channel *req, struct hdr_exp *exp) { char term; char *cur_ptr, *cur_end, *cur_next; @@ -5632,7 +5632,7 @@ int apply_filter_to_req_headers(struct session *t, struct buffer *req, struct hd * Since it can manage the switch to another backend, it updates the per-proxy * DENY stats. */ -int apply_filter_to_req_line(struct session *t, struct buffer *req, struct hdr_exp *exp) +int apply_filter_to_req_line(struct session *t, struct channel *req, struct hdr_exp *exp) { char term; char *cur_ptr, *cur_end; @@ -5749,7 +5749,7 @@ int apply_filter_to_req_line(struct session *t, struct buffer *req, struct hdr_e * unparsable request. Since it can manage the switch to another backend, it * updates the per-proxy DENY stats. */ -int apply_filters_to_request(struct session *s, struct buffer *req, struct proxy *px) +int apply_filters_to_request(struct session *s, struct channel *req, struct proxy *px) { struct http_txn *txn = &s->txn; struct hdr_exp *exp; @@ -5914,7 +5914,7 @@ char *find_cookie_value_end(char *s, const char *e) * - there are non-space chars before ; * - there is a CR/LF at or after . */ -int del_hdr_value(struct buffer *buf, char **from, char *next) +int del_hdr_value(struct channel *buf, char **from, char *next) { char *prev = *from; @@ -5956,7 +5956,7 @@ int del_hdr_value(struct buffer *buf, char **from, char *next) * of the multiple very crappy and ambiguous syntaxes we have to support. it * highly recommended not to touch this part without a good reason ! */ -void manage_client_side_cookies(struct session *t, struct buffer *req) +void manage_client_side_cookies(struct session *t, struct channel *req) { struct http_txn *txn = &t->txn; int preserve_hdr; @@ -6405,7 +6405,7 @@ void manage_client_side_cookies(struct session *t, struct buffer *req) /* Iterate the same filter through all response headers contained in . * Returns 1 if this filter can be stopped upon return, otherwise 0. */ -int apply_filter_to_resp_headers(struct session *t, struct buffer *rtr, struct hdr_exp *exp) +int apply_filter_to_resp_headers(struct session *t, struct channel *rtr, struct hdr_exp *exp) { char term; char *cur_ptr, *cur_end, *cur_next; @@ -6504,7 +6504,7 @@ int apply_filter_to_resp_headers(struct session *t, struct buffer *rtr, struct h * Returns 0 if nothing has been done, 1 if the filter has been applied, * or -1 if a replacement resulted in an invalid status line. */ -int apply_filter_to_sts_line(struct session *t, struct buffer *rtr, struct hdr_exp *exp) +int apply_filter_to_sts_line(struct session *t, struct channel *rtr, struct hdr_exp *exp) { char term; char *cur_ptr, *cur_end; @@ -6587,7 +6587,7 @@ int apply_filter_to_sts_line(struct session *t, struct buffer *rtr, struct hdr_e * Returns 0 if everything is alright, or -1 in case a replacement lead to an * unparsable response. */ -int apply_filters_to_response(struct session *s, struct buffer *rtr, struct proxy *px) +int apply_filters_to_response(struct session *s, struct channel *rtr, struct proxy *px) { struct http_txn *txn = &s->txn; struct hdr_exp *exp; @@ -6644,7 +6644,7 @@ int apply_filters_to_response(struct session *s, struct buffer *rtr, struct prox * desirable to call it only when needed. This function is also used when we * just need to know if there is a cookie (eg: for check-cache). */ -void manage_server_side_cookies(struct session *t, struct buffer *res) +void manage_server_side_cookies(struct session *t, struct channel *res) { struct http_txn *txn = &t->txn; struct server *srv; @@ -7007,7 +7007,7 @@ void manage_server_side_cookies(struct session *t, struct buffer *res) /* * Check if response is cacheable or not. Updates t->flags. */ -void check_response_for_cacheability(struct session *t, struct buffer *rtr) +void check_response_for_cacheability(struct session *t, struct channel *rtr) { struct http_txn *txn = &t->txn; char *p1, *p2; @@ -7258,7 +7258,7 @@ void http_capture_bad_message(struct error_snapshot *es, struct session *s, struct http_msg *msg, int state, struct proxy *other_end) { - struct buffer *buf = msg->buf; + struct channel *buf = msg->buf; int len1, len2; es->len = MIN(buf->i, sizeof(es->buf)); diff --git a/src/proto_tcp.c b/src/proto_tcp.c index 6c411afe63..57339c6288 100644 --- a/src/proto_tcp.c +++ b/src/proto_tcp.c @@ -785,7 +785,7 @@ void tcpv6_add_listener(struct listener *listener) * function may be called for frontend rules and backend rules. It only relies * on the backend pointer so this works for both cases. */ -int tcp_inspect_request(struct session *s, struct buffer *req, int an_bit) +int tcp_inspect_request(struct session *s, struct channel *req, int an_bit) { struct tcp_rule *rule; struct stksess *ts; @@ -905,7 +905,7 @@ int tcp_inspect_request(struct session *s, struct buffer *req, int an_bit) * response. It relies on buffers flags, and updates s->rep->analysers. The * function may be called for backend rules. */ -int tcp_inspect_response(struct session *s, struct buffer *rep, int an_bit) +int tcp_inspect_response(struct session *s, struct channel *rep, int an_bit) { struct tcp_rule *rule; int partial; @@ -1583,7 +1583,7 @@ smp_fetch_payload_lv(struct proxy *px, struct session *l4, void *l7, unsigned in unsigned int len_size = arg_p[1].data.uint; unsigned int buf_offset; unsigned int buf_size = 0; - struct buffer *b; + struct channel *b; int i; /* Format is (len offset, len size, buf offset) or (len offset, len size) */ @@ -1638,7 +1638,7 @@ smp_fetch_payload(struct proxy *px, struct session *l4, void *l7, unsigned int o { unsigned int buf_offset = arg_p[0].data.uint; unsigned int buf_size = arg_p[1].data.uint; - struct buffer *b; + struct channel *b; if (!l4) return 0; diff --git a/src/session.c b/src/session.c index 6612f0a43a..3984104724 100644 --- a/src/session.c +++ b/src/session.c @@ -533,8 +533,8 @@ void session_process_counters(struct session *s) */ static int sess_update_st_con_tcp(struct session *s, struct stream_interface *si) { - struct buffer *req = si->ob; - struct buffer *rep = si->ib; + struct channel *req = si->ob; + struct channel *rep = si->ib; /* If we got an error, or if nothing happened and the connection timed * out, we must give up. The CER state handler will take care of retry @@ -683,8 +683,8 @@ static int sess_update_st_cer(struct session *s, struct stream_interface *si) */ static void sess_establish(struct session *s, struct stream_interface *si) { - struct buffer *req = si->ob; - struct buffer *rep = si->ib; + struct channel *req = si->ob; + struct channel *rep = si->ib; if (target_srv(&s->target)) health_adjust(target_srv(&s->target), HANA_STATUS_L4_OK); @@ -954,7 +954,7 @@ static void sess_prepare_conn_req(struct session *s, struct stream_interface *si * It returns 1 if the processing can continue on next analysers, or zero if it * either needs more data or wants to immediately abort the request. */ -static int process_switching_rules(struct session *s, struct buffer *req, int an_bit) +static int process_switching_rules(struct session *s, struct channel *req, int an_bit) { struct persist_rule *prst_rule; @@ -1051,7 +1051,7 @@ static int process_switching_rules(struct session *s, struct buffer *req, int an * it then returns 1. The data must already be present in the buffer otherwise * they won't match. It always returns 1. */ -static int process_server_rules(struct session *s, struct buffer *req, int an_bit) +static int process_server_rules(struct session *s, struct channel *req, int an_bit) { struct proxy *px = s->be; struct server_rule *rule; @@ -1100,7 +1100,7 @@ static int process_server_rules(struct session *s, struct buffer *req, int an_bi * it then returns 1. The data must already be present in the buffer otherwise * they won't match. It always returns 1. */ -static int process_sticking_rules(struct session *s, struct buffer *req, int an_bit) +static int process_sticking_rules(struct session *s, struct channel *req, int an_bit) { struct proxy *px = s->be; struct sticking_rule *rule; @@ -1189,7 +1189,7 @@ static int process_sticking_rules(struct session *s, struct buffer *req, int an_ * then returns 1. The data must already be present in the buffer otherwise * they won't match. It always returns 1. */ -static int process_store_rules(struct session *s, struct buffer *rep, int an_bit) +static int process_store_rules(struct session *s, struct channel *rep, int an_bit) { struct proxy *px = s->be; struct sticking_rule *rule; diff --git a/src/sock_raw.c b/src/sock_raw.c index 991b46b9f3..272935a359 100644 --- a/src/sock_raw.c +++ b/src/sock_raw.c @@ -74,7 +74,7 @@ static void sock_raw_read(struct connection *conn); * This function automatically allocates a pipe from the pipe pool. It also * carefully ensures to clear b->pipe whenever it leaves the pipe empty. */ -static int sock_raw_splice_in(struct buffer *b, struct stream_interface *si) +static int sock_raw_splice_in(struct channel *b, struct stream_interface *si) { static int splice_detects_close; int fd = si_fd(si); @@ -216,7 +216,7 @@ static void sock_raw_read(struct connection *conn) { int fd = conn->t.sock.fd; struct stream_interface *si = container_of(conn, struct stream_interface, conn); - struct buffer *b = si->ib; + struct channel *b = si->ib; int ret, max, cur_read; int read_poll = MAX_READ_POLL_LOOPS; @@ -452,7 +452,7 @@ static void sock_raw_read(struct connection *conn) static int sock_raw_write_loop(struct connection *conn) { struct stream_interface *si = container_of(conn, struct stream_interface, conn); - struct buffer *b = si->ob; + struct channel *b = si->ob; int write_poll = MAX_WRITE_POLL_LOOPS; int ret, max; diff --git a/src/stream_interface.c b/src/stream_interface.c index 17f2447db1..08560a9c52 100644 --- a/src/stream_interface.c +++ b/src/stream_interface.c @@ -354,7 +354,7 @@ int stream_int_shutw(struct stream_interface *si) /* default chk_rcv function for scheduled tasks */ static void stream_int_chk_rcv(struct stream_interface *si) { - struct buffer *ib = si->ib; + struct channel *ib = si->ib; DPRINTF(stderr, "%s: si=%p, si->state=%d ib->flags=%08x ob->flags=%08x\n", __FUNCTION__, @@ -379,7 +379,7 @@ static void stream_int_chk_rcv(struct stream_interface *si) /* default chk_snd function for scheduled tasks */ static void stream_int_chk_snd(struct stream_interface *si) { - struct buffer *ob = si->ob; + struct channel *ob = si->ob; DPRINTF(stderr, "%s: si=%p, si->state=%d ib->flags=%08x ob->flags=%08x\n", __FUNCTION__, @@ -482,7 +482,7 @@ int conn_si_send_proxy(struct connection *conn, unsigned int flag) { int fd = conn->t.sock.fd; struct stream_interface *si = container_of(conn, struct stream_interface, conn); - struct buffer *b = si->ob; + struct channel *b = si->ob; /* we might have been called just after an asynchronous shutw */ if (b->flags & BF_SHUTW) @@ -664,8 +664,8 @@ void conn_notify_si(struct connection *conn) */ void stream_int_update_conn(struct stream_interface *si) { - struct buffer *ib = si->ib; - struct buffer *ob = si->ob; + struct channel *ib = si->ib; + struct channel *ob = si->ob; if (si->conn.flags & CO_FL_HANDSHAKE) { /* a handshake is in progress */ @@ -742,7 +742,7 @@ void stream_int_update_conn(struct stream_interface *si) */ void stream_int_chk_rcv_conn(struct stream_interface *si) { - struct buffer *ib = si->ib; + struct channel *ib = si->ib; if (unlikely(si->state != SI_ST_EST || (ib->flags & BF_SHUTR))) return; @@ -773,7 +773,7 @@ void stream_int_chk_rcv_conn(struct stream_interface *si) */ void stream_int_chk_snd_conn(struct stream_interface *si) { - struct buffer *ob = si->ob; + struct channel *ob = si->ob; if (unlikely(si->state != SI_ST_EST || (ob->flags & BF_SHUTW))) return; @@ -872,7 +872,7 @@ void stream_int_chk_snd_conn(struct stream_interface *si) void si_conn_send_cb(struct connection *conn) { struct stream_interface *si = container_of(conn, struct stream_interface, conn); - struct buffer *b = si->ob; + struct channel *b = si->ob; if (conn->flags & CO_FL_ERROR) goto out_error;