diff --git a/Makefile b/Makefile index afe38a351..2f8c2eb06 100644 --- a/Makefile +++ b/Makefile @@ -704,7 +704,7 @@ OBJS = src/haproxy.o src/sessionhash.o src/base64.o src/protocol.o \ src/proto_http.o src/raw_sock.o src/appsession.o src/backend.o \ src/lb_chash.o src/lb_fwlc.o src/lb_fwrr.o src/lb_map.o src/lb_fas.o \ src/stream_interface.o src/dumpstats.o src/proto_tcp.o \ - src/session.o src/hdr_idx.o src/ev_select.o src/signal.o \ + src/stream.o src/hdr_idx.o src/ev_select.o src/signal.o \ src/acl.o src/sample.o src/memory.o src/freq_ctr.o src/auth.o \ src/compression.o src/payload.o src/hash.o src/pattern.o src/map.o \ src/namespace.o src/mailers.o diff --git a/include/common/debug.h b/include/common/debug.h index fe05a444a..baabf4a1d 100644 --- a/include/common/debug.h +++ b/include/common/debug.h @@ -42,15 +42,15 @@ #define ABORT_NOW() (*(int*)0=0) /* this one is provided for easy code tracing. - * Usage: TRACE(sess||0, fmt, args...); - * TRACE(sess, ""); + * Usage: TRACE(strm||0, fmt, args...); + * TRACE(strm, ""); */ -#define TRACE(sess, fmt, args...) do { \ +#define TRACE(strm, fmt, args...) do { \ fprintf(stderr, \ - "%d.%06d [%s:%d %s] [sess %p(%x)] " fmt "\n", \ + "%d.%06d [%s:%d %s] [strm %p(%x)] " fmt "\n", \ (int)now.tv_sec, (int)now.tv_usec, \ __FILE__, __LINE__, __FUNCTION__, \ - sess, sess?((struct session *)sess)->uniq_id:~0U, \ + strm, strm?((struct stream *)strm)->uniq_id:~0U, \ ##args); \ } while (0) diff --git a/include/common/defaults.h b/include/common/defaults.h index 3b3184972..63b2b89ea 100644 --- a/include/common/defaults.h +++ b/include/common/defaults.h @@ -24,7 +24,7 @@ /* * BUFSIZE defines the size of a read and write buffer. It is the maximum - * amount of bytes which can be stored by the proxy for each session. However, + * amount of bytes which can be stored by the proxy for each stream. However, * when reading HTTP headers, the proxy needs some spare space to add or rewrite * headers if needed. The size of this spare is defined with MAXREWRITE. So it * is not possible to process headers longer than BUFSIZE-MAXREWRITE bytes. By @@ -257,9 +257,9 @@ #define SSL_HANDSHAKE_MAX_COST (76*1024) // measured #endif -/* approximate session size (for maxconn estimate) */ -#ifndef SESSION_MAX_COST -#define SESSION_MAX_COST (sizeof(struct session) + \ +/* approximate stream size (for maxconn estimate) */ +#ifndef STREAM_MAX_COST +#define STREAM_MAX_COST (sizeof(struct stream) + \ 2 * sizeof(struct channel) + \ 2 * sizeof(struct connection) + \ REQURI_LEN + \ diff --git a/include/proto/acl.h b/include/proto/acl.h index 1a7c1f4f4..ee5b14be1 100644 --- a/include/proto/acl.h +++ b/include/proto/acl.h @@ -99,7 +99,7 @@ struct acl_cond *build_acl_cond(const char *file, int line, struct proxy *px, co * function only computes the condition, it does not apply the polarity required * by IF/UNLESS, it's up to the caller to do this. */ -enum acl_test_res acl_exec_cond(struct acl_cond *cond, struct proxy *px, struct session *l4, void *l7, unsigned int opt); +enum acl_test_res acl_exec_cond(struct acl_cond *cond, struct proxy *px, struct stream *l4, void *l7, unsigned int opt); /* Returns a pointer to the first ACL conflicting with usage at place * which is one of the SMP_VAL_* bits indicating a check place, or NULL if diff --git a/include/proto/backend.h b/include/proto/backend.h index 56df5160c..105807b54 100644 --- a/include/proto/backend.h +++ b/include/proto/backend.h @@ -28,16 +28,16 @@ #include #include #include -#include +#include -int assign_server(struct session *s); -int assign_server_address(struct session *s); -int assign_server_and_queue(struct session *s); -int connect_server(struct session *s); -int srv_redispatch_connect(struct session *t); +int assign_server(struct stream *s); +int assign_server_address(struct stream *s); +int assign_server_and_queue(struct stream *s); +int connect_server(struct stream *s); +int srv_redispatch_connect(struct stream *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 channel *req, int an_bit); +int tcp_persist_rdp_cookie(struct stream *s, struct channel *req, int an_bit); int be_downtime(struct proxy *px); void recount_servers(struct proxy *px); diff --git a/include/proto/channel.h b/include/proto/channel.h index 9907a51d6..b1c313ce6 100644 --- a/include/proto/channel.h +++ b/include/proto/channel.h @@ -33,7 +33,7 @@ #include #include -#include +#include #include /* perform minimal intializations, report 0 in case of error, 1 if OK. */ @@ -54,31 +54,31 @@ int bo_getline_nc(struct channel *chn, char **blk1, int *len1, char **blk2, int int bo_getblk_nc(struct channel *chn, char **blk1, int *len1, char **blk2, int *len2); -/* returns a pointer to the session the channel belongs to */ -static inline struct session *chn_sess(const struct channel *chn) +/* returns a pointer to the stream the channel belongs to */ +static inline struct stream *chn_sess(const struct channel *chn) { if (chn->flags & CF_ISRESP) - return LIST_ELEM(chn, struct session *, res); + return LIST_ELEM(chn, struct stream *, res); else - return LIST_ELEM(chn, struct session *, req); + return LIST_ELEM(chn, struct stream *, req); } /* returns a pointer to the stream interface feeding the channel (producer) */ static inline struct stream_interface *chn_prod(const struct channel *chn) { if (chn->flags & CF_ISRESP) - return &LIST_ELEM(chn, struct session *, res)->si[1]; + return &LIST_ELEM(chn, struct stream *, res)->si[1]; else - return &LIST_ELEM(chn, struct session *, req)->si[0]; + return &LIST_ELEM(chn, struct stream *, req)->si[0]; } /* returns a pointer to the stream interface consuming the channel (producer) */ static inline struct stream_interface *chn_cons(const struct channel *chn) { if (chn->flags & CF_ISRESP) - return &LIST_ELEM(chn, struct session *, res)->si[0]; + return &LIST_ELEM(chn, struct stream *, res)->si[0]; else - return &LIST_ELEM(chn, struct session *, req)->si[1]; + return &LIST_ELEM(chn, struct stream *, req)->si[1]; } /* Initialize all fields in the channel. */ diff --git a/include/proto/compression.h b/include/proto/compression.h index e5ae8b615..5c7c8cb98 100644 --- a/include/proto/compression.h +++ b/include/proto/compression.h @@ -31,9 +31,9 @@ int comp_append_type(struct comp *comp, const char *type); int comp_append_algo(struct comp *comp, const char *algo); int http_emit_chunk_size(char *end, unsigned int chksz); -int http_compression_buffer_init(struct session *s, struct buffer *in, struct buffer *out); -int http_compression_buffer_add_data(struct session *s, struct buffer *in, struct buffer *out); -int http_compression_buffer_end(struct session *s, struct buffer **in, struct buffer **out, int end); +int http_compression_buffer_init(struct stream *s, struct buffer *in, struct buffer *out); +int http_compression_buffer_add_data(struct stream *s, struct buffer *in, struct buffer *out); +int http_compression_buffer_end(struct stream *s, struct buffer **in, struct buffer **out, int end); #ifdef USE_ZLIB extern long zlib_used_memory; diff --git a/include/proto/frontend.h b/include/proto/frontend.h index 77d3206ce..61d040906 100644 --- a/include/proto/frontend.h +++ b/include/proto/frontend.h @@ -23,9 +23,9 @@ #define _PROTO_FRONTEND_H #include -#include +#include -int frontend_accept(struct session *s); +int frontend_accept(struct stream *s); #endif /* _PROTO_FRONTEND_H */ diff --git a/include/proto/log.h b/include/proto/log.h index 54c51d16c..0967ae8bf 100644 --- a/include/proto/log.h +++ b/include/proto/log.h @@ -30,7 +30,7 @@ #include #include #include -#include +#include extern struct pool_head *pool2_requri; extern struct pool_head *pool2_uniqueid; @@ -42,13 +42,13 @@ extern char clf_http_log_format[]; extern char *logline; -int build_logline(struct session *s, char *dst, size_t maxsize, struct list *list_format); +int build_logline(struct stream *s, char *dst, size_t maxsize, struct list *list_format); /* - * send a log for the session when we have enough info about it. + * send a log for the stream when we have enough info about it. * Will not log if the frontend has no log defined. */ -void sess_log(struct session *s); +void strm_log(struct stream *s); /* * Parse args in a logformat_var diff --git a/include/proto/payload.h b/include/proto/payload.h index fd89c88cb..9674832fa 100644 --- a/include/proto/payload.h +++ b/include/proto/payload.h @@ -24,9 +24,9 @@ #include #include -#include +#include -int fetch_rdp_cookie_name(struct session *s, struct sample *smp, const char *cname, int clen); +int fetch_rdp_cookie_name(struct stream *s, struct sample *smp, const char *cname, int clen); int val_payload_lv(struct arg *arg, char **err_msg); #endif /* _PROTO_PROTO_PAYLOAD_H */ diff --git a/include/proto/peers.h b/include/proto/peers.h index 39835fffd..27b3875bb 100644 --- a/include/proto/peers.h +++ b/include/proto/peers.h @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include void peers_register_table(struct peers *, struct stktable *table); diff --git a/include/proto/proto_http.h b/include/proto/proto_http.h index 36e6eb8e7..477b9b056 100644 --- a/include/proto/proto_http.h +++ b/include/proto/proto_http.h @@ -24,7 +24,7 @@ #include #include -#include +#include #include /* @@ -63,30 +63,30 @@ extern char *get_http_auth_buff; #define HTTP_IS_TOKEN(x) (http_is_token[(unsigned char)(x)]) #define HTTP_IS_VER_TOKEN(x) (http_is_ver_token[(unsigned char)(x)]) -int process_cli(struct session *s); -int process_srv_data(struct session *s); -int process_srv_conn(struct session *s); -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 *s, struct channel *req, int an_bit); -int http_process_tarpit(struct session *s, struct channel *req, int an_bit); -int http_wait_for_request_body(struct session *s, struct channel *req, int an_bit); +int process_cli(struct stream *s); +int process_srv_data(struct stream *s); +int process_srv_conn(struct stream *s); +int http_wait_for_request(struct stream *s, struct channel *req, int an_bit); +int http_process_req_common(struct stream *s, struct channel *req, int an_bit, struct proxy *px); +int http_process_request(struct stream *s, struct channel *req, int an_bit); +int http_process_tarpit(struct stream *s, struct channel *req, int an_bit); +int http_wait_for_request_body(struct stream *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 channel *rep, int an_bit); -int http_process_res_common(struct session *s, 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); +int http_wait_for_response(struct stream *s, struct channel *rep, int an_bit); +int http_process_res_common(struct stream *s, struct channel *rep, int an_bit, struct proxy *px); +int http_request_forward_body(struct stream *s, struct channel *req, int an_bit); +int http_response_forward_body(struct stream *s, struct channel *res, int an_bit); -void debug_hdr(const char *dir, struct session *s, const char *start, const char *end); -void get_srv_from_appsession(struct session *s, const char *begin, int len); -int apply_filter_to_req_headers(struct session *s, struct channel *req, struct hdr_exp *exp); -int apply_filter_to_req_line(struct session *s, 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 *s, struct channel *rtr, struct proxy *px); -void manage_client_side_appsession(struct session *s, const char *buf, int len); -void manage_client_side_cookies(struct session *s, struct channel *req); -void manage_server_side_cookies(struct session *s, struct channel *rtr); -void check_response_for_cacheability(struct session *s, struct channel *rtr); +void debug_hdr(const char *dir, struct stream *s, const char *start, const char *end); +void get_srv_from_appsession(struct stream *s, const char *begin, int len); +int apply_filter_to_req_headers(struct stream *s, struct channel *req, struct hdr_exp *exp); +int apply_filter_to_req_line(struct stream *s, struct channel *req, struct hdr_exp *exp); +int apply_filters_to_request(struct stream *s, struct channel *req, struct proxy *px); +int apply_filters_to_response(struct stream *s, struct channel *rtr, struct proxy *px); +void manage_client_side_appsession(struct stream *s, const char *buf, int len); +void manage_client_side_cookies(struct stream *s, struct channel *req); +void manage_server_side_cookies(struct stream *s, struct channel *rtr); +void check_response_for_cacheability(struct stream *s, 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_full_header2(const char *name, int len, @@ -100,37 +100,36 @@ int http_header_match2(const char *hdr, const char *end, const char *name, int l int http_remove_header2(struct http_msg *msg, struct hdr_idx *idx, struct hdr_ctx *ctx); int http_header_add_tail2(struct http_msg *msg, struct hdr_idx *hdr_idx, const char *text, int len); int http_replace_req_line(int action, const char *replace, int len, - struct proxy *px, struct session *s, struct http_txn *txn); -int http_transform_header_str(struct session* s, struct http_msg *msg, const char* name, + struct proxy *px, struct stream *s, struct http_txn *txn); +int http_transform_header_str(struct stream* s, struct http_msg *msg, const char* name, unsigned int name_len, const char *str, struct my_regex *re, int action); -void http_sess_log(struct session *s); void inet_set_tos(int fd, struct sockaddr_storage from, int tos); -void http_perform_server_redirect(struct session *s, struct stream_interface *si); -void http_return_srv_error(struct session *s, struct stream_interface *si); -void http_capture_bad_message(struct error_snapshot *es, struct session *s, +void http_perform_server_redirect(struct stream *s, struct stream_interface *si); +void http_return_srv_error(struct stream *s, struct stream_interface *si); +void http_capture_bad_message(struct error_snapshot *es, struct stream *s, struct http_msg *msg, enum ht_state state, struct proxy *other_end); unsigned int http_get_hdr(const struct http_msg *msg, const char *hname, int hlen, struct hdr_idx *idx, int occ, struct hdr_ctx *ctx, char **vptr, int *vlen); -void http_init_txn(struct session *s); -void http_end_txn(struct session *s); -void http_reset_txn(struct session *s); -void http_adjust_conn_mode(struct session *s, struct http_txn *txn, struct http_msg *msg); +void http_init_txn(struct stream *s); +void http_end_txn(struct stream *s); +void http_reset_txn(struct stream *s); +void http_adjust_conn_mode(struct stream *s, struct http_txn *txn, struct http_msg *msg); struct http_req_rule *parse_http_req_cond(const char **args, const char *file, int linenum, struct proxy *proxy); struct http_res_rule *parse_http_res_cond(const char **args, const char *file, int linenum, struct proxy *proxy); void free_http_req_rules(struct list *r); void free_http_res_rules(struct list *r); -struct chunk *http_error_message(struct session *s, int msgnum); +struct chunk *http_error_message(struct stream *s, int msgnum); struct redirect_rule *http_parse_redirect_rule(const char *file, int linenum, struct proxy *curproxy, const char **args, char **errmsg, int use_fmt); -int smp_fetch_cookie(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +int smp_fetch_cookie(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private); int -smp_fetch_base32(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_base32(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private); enum http_meth_t find_http_meth(const char *str, const int len); diff --git a/include/proto/proto_tcp.h b/include/proto/proto_tcp.h index a28c531cb..96488f107 100644 --- a/include/proto/proto_tcp.h +++ b/include/proto/proto_tcp.h @@ -36,9 +36,9 @@ 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_drain(int fd); -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 tcp_inspect_request(struct stream *s, struct channel *req, int an_bit); +int tcp_inspect_response(struct stream *s, struct channel *rep, int an_bit); +int tcp_exec_req_rules(struct stream *s); /* TCP keywords. */ void tcp_req_conn_keywords_register(struct tcp_action_kw_list *kw_list); diff --git a/include/proto/proto_uxst.h b/include/proto/proto_uxst.h index 8e796ecd1..d7bcaa6ef 100644 --- a/include/proto/proto_uxst.h +++ b/include/proto/proto_uxst.h @@ -23,7 +23,7 @@ #define _PROTO_PROTO_UXST_H #include -#include +#include #include void uxst_add_listener(struct listener *listener); diff --git a/include/proto/proxy.h b/include/proto/proxy.h index 116c00a16..139791f8c 100644 --- a/include/proto/proxy.h +++ b/include/proto/proxy.h @@ -43,7 +43,7 @@ int resume_proxy(struct proxy *p); void stop_proxy(struct proxy *p); void pause_proxies(void); void resume_proxies(void); -int session_set_backend(struct session *s, struct proxy *be); +int stream_set_backend(struct stream *s, struct proxy *be); const char *proxy_cap_str(int cap); const char *proxy_mode_str(int mode); diff --git a/include/proto/queue.h b/include/proto/queue.h index c7243bd1f..934e29dc8 100644 --- a/include/proto/queue.h +++ b/include/proto/queue.h @@ -28,7 +28,7 @@ #include #include -#include +#include #include #include @@ -37,8 +37,8 @@ extern struct pool_head *pool2_pendconn; int init_pendconn(); -struct session *pendconn_get_next_sess(struct server *srv, struct proxy *px); -struct pendconn *pendconn_add(struct session *sess); +struct stream *pendconn_get_next_strm(struct server *srv, struct proxy *px); +struct pendconn *pendconn_add(struct stream *strm); void pendconn_free(struct pendconn *p); void process_srv_queue(struct server *s); unsigned int srv_dynamic_maxconn(const struct server *s); diff --git a/include/proto/sample.h b/include/proto/sample.h index 91f451305..e9f9e2512 100644 --- a/include/proto/sample.h +++ b/include/proto/sample.h @@ -30,10 +30,10 @@ extern const char *smp_to_type[SMP_TYPES]; struct sample_expr *sample_parse_expr(char **str, int *idx, const char *file, int line, char **err, struct arg_list *al); struct sample_conv *find_sample_conv(const char *kw, int len); -struct sample *sample_process(struct proxy *px, struct session *l4, +struct sample *sample_process(struct proxy *px, struct stream *l4, void *l7, unsigned int dir, struct sample_expr *expr, struct sample *p); -struct sample *sample_fetch_string(struct proxy *px, struct session *l4, void *l7, +struct sample *sample_fetch_string(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, struct sample_expr *expr); void sample_register_fetches(struct sample_fetch_kw_list *psl); void sample_register_convs(struct sample_conv_kw_list *psl); diff --git a/include/proto/stick_table.h b/include/proto/stick_table.h index a5e7520bf..93204303a 100644 --- a/include/proto/stick_table.h +++ b/include/proto/stick_table.h @@ -48,7 +48,7 @@ struct stksess *stktable_lookup_key(struct stktable *t, struct stktable_key *key struct stksess *stktable_update_key(struct stktable *table, struct stktable_key *key); struct stktable_key *smp_to_stkey(struct sample *smp, struct stktable *t); struct stktable_key *stktable_fetch_key(struct stktable *t, struct proxy *px, - struct session *l4, void *l7, unsigned int opt, + struct stream *l4, void *l7, unsigned int opt, struct sample_expr *expr, struct sample *smp); int stktable_compatible_sample(struct sample_expr *expr, unsigned long table_type); int stktable_register_data_store(int idx, const char *name, int std_type, int arg_type); diff --git a/include/proto/session.h b/include/proto/stream.h similarity index 75% rename from include/proto/session.h rename to include/proto/stream.h index 2dc3d830e..c73ad201d 100644 --- a/include/proto/session.h +++ b/include/proto/stream.h @@ -1,6 +1,6 @@ /* - * include/proto/session.h - * This file defines everything related to sessions. + * include/proto/stream.h + * This file defines everything related to streams. * * Copyright (C) 2000-2010 Willy Tarreau - w@1wt.eu * @@ -19,48 +19,48 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef _PROTO_SESSION_H -#define _PROTO_SESSION_H +#ifndef _PROTO_STREAM_H +#define _PROTO_STREAM_H #include #include -#include +#include #include #include #include #include -extern struct pool_head *pool2_session; -extern struct list sessions; +extern struct pool_head *pool2_stream; +extern struct list streams; extern struct list buffer_wq; extern struct data_cb sess_conn_cb; -int session_accept(struct listener *l, int cfd, struct sockaddr_storage *addr); +int stream_accept(struct listener *l, int cfd, struct sockaddr_storage *addr); /* perform minimal intializations, report 0 in case of error, 1 if OK. */ -int init_session(); +int init_stream(); -/* kill a session and set the termination flags to (one of SN_ERR_*) */ -void session_shutdown(struct session *session, int why); +/* kill a stream and set the termination flags to (one of SN_ERR_*) */ +void stream_shutdown(struct stream *stream, int why); -void session_process_counters(struct session *s); -void sess_change_server(struct session *sess, struct server *newsrv); -struct task *process_session(struct task *t); -void default_srv_error(struct session *s, struct stream_interface *si); -struct stkctr *smp_fetch_sc_stkctr(struct session *l4, const struct arg *args, const char *kw); +void stream_process_counters(struct stream *s); +void sess_change_server(struct stream *sess, struct server *newsrv); +struct task *process_stream(struct task *t); +void default_srv_error(struct stream *s, struct stream_interface *si); +struct stkctr *smp_fetch_sc_stkctr(struct stream *l4, const struct arg *args, const char *kw); int parse_track_counters(char **args, int *arg, int section_type, struct proxy *curpx, struct track_ctr_prm *prm, struct proxy *defpx, char **err); -/* Update the session's backend and server time stats */ -void session_update_time_stats(struct session *s); -void __session_offer_buffers(int rqlimit); -static inline void session_offer_buffers(); -int session_alloc_work_buffer(struct session *s); -void session_release_buffers(struct session *s); -int session_alloc_recv_buffer(struct channel *chn); +/* Update the stream's backend and server time stats */ +void stream_update_time_stats(struct stream *s); +void __stream_offer_buffers(int rqlimit); +static inline void stream_offer_buffers(); +int stream_alloc_work_buffer(struct stream *s); +void stream_release_buffers(struct stream *s); +int stream_alloc_recv_buffer(struct channel *chn); /* sets the stick counter's entry pointer */ static inline void stkctr_set_entry(struct stkctr *stkctr, struct stksess *entry) @@ -92,11 +92,11 @@ static inline void stkctr_clr_flags(struct stkctr *stkctr, unsigned int flags) stkctr->entry = caddr_clr_flags(stkctr->entry, flags); } -/* Remove the refcount from the session to the tracked counters, and clear the +/* Remove the refcount from the stream to the tracked counters, and clear the * pointer to ensure this is only performed once. The caller is responsible for * ensuring that the pointer is valid first. */ -static inline void session_store_counters(struct session *s) +static inline void stream_store_counters(struct stream *s) { void *ptr; int i; @@ -113,11 +113,11 @@ static inline void session_store_counters(struct session *s) } } -/* Remove the refcount from the session counters tracked at the content level if +/* Remove the refcount from the stream counters tracked at the content level if * any, and clear the pointer to ensure this is only performed once. The caller * is responsible for ensuring that the pointer is valid first. */ -static inline void session_stop_content_counters(struct session *s) +static inline void stream_stop_content_counters(struct stream *s) { void *ptr; int i; @@ -142,7 +142,7 @@ static inline void session_stop_content_counters(struct session *s) * . The caller is responsible for ensuring that and are valid * pointers, and for calling this only once per connection. */ -static inline void session_start_counters(struct stktable *t, struct stksess *ts) +static inline void stream_start_counters(struct stktable *t, struct stksess *ts) { void *ptr; @@ -162,11 +162,11 @@ static inline void session_start_counters(struct stktable *t, struct stksess *ts ts->expire = tick_add(now_ms, MS_TO_TICKS(t->expire)); } -/* Enable tracking of session counters as on stksess . The caller is +/* Enable tracking of stream counters as on stksess . The caller is * responsible for ensuring that and are valid pointers. Some controls * are performed to ensure the state can still change. */ -static inline void session_track_stkctr(struct stkctr *ctr, struct stktable *t, struct stksess *ts) +static inline void stream_track_stkctr(struct stkctr *ctr, struct stktable *t, struct stksess *ts) { if (stkctr_entry(ctr)) return; @@ -174,11 +174,11 @@ static inline void session_track_stkctr(struct stkctr *ctr, struct stktable *t, ts->ref_cnt++; ctr->table = t; stkctr_set_entry(ctr, ts); - session_start_counters(t, ts); + stream_start_counters(t, ts); } /* Increase the number of cumulated HTTP requests in the tracked counters */ -static void inline session_inc_http_req_ctr(struct session *s) +static void inline stream_inc_http_req_ctr(struct stream *s) { void *ptr; int i; @@ -199,7 +199,7 @@ static void inline session_inc_http_req_ctr(struct session *s) } /* Increase the number of cumulated HTTP requests in the backend's tracked counters */ -static void inline session_inc_be_http_req_ctr(struct session *s) +static void inline stream_inc_be_http_req_ctr(struct stream *s) { void *ptr; int i; @@ -228,7 +228,7 @@ static void inline session_inc_be_http_req_ctr(struct session *s) * Note that even 404 are interesting because they're generally caused by * vulnerability scans. */ -static void inline session_inc_http_err_ctr(struct session *s) +static void inline stream_inc_http_err_ctr(struct stream *s) { void *ptr; int i; @@ -248,13 +248,13 @@ static void inline session_inc_http_err_ctr(struct session *s) } } -static void inline session_add_srv_conn(struct session *sess, struct server *srv) +static void inline stream_add_srv_conn(struct stream *sess, struct server *srv) { sess->srv_conn = srv; LIST_ADD(&srv->actconns, &sess->by_srv); } -static void inline session_del_srv_conn(struct session *sess) +static void inline stream_del_srv_conn(struct stream *sess) { if (!sess->srv_conn) return; @@ -263,22 +263,22 @@ static void inline session_del_srv_conn(struct session *sess) LIST_DEL(&sess->by_srv); } -static void inline session_init_srv_conn(struct session *sess) +static void inline stream_init_srv_conn(struct stream *sess) { sess->srv_conn = NULL; LIST_INIT(&sess->by_srv); } -static inline void session_offer_buffers() +static inline void stream_offer_buffers() { int avail; if (LIST_ISEMPTY(&buffer_wq)) return; - /* all sessions will need 1 buffer, so we can stop waking up sessions + /* all streams will need 1 buffer, so we can stop waking up streams * once we have enough of them to eat all the buffers. Note that we - * don't really know if they are sessions or just other tasks, but + * don't really know if they are streams or just other tasks, but * that's a rough estimate. Similarly, for each cached event we'll need * 1 buffer. If no buffer is currently used, always wake up the number * of tasks we can offer a buffer based on what is allocated, and in @@ -287,10 +287,10 @@ static inline void session_offer_buffers() avail = pool2_buffer->allocated - pool2_buffer->used - global.tune.reserved_bufs / 2; if (avail > (int)run_queue) - __session_offer_buffers(avail); + __stream_offer_buffers(avail); } -#endif /* _PROTO_SESSION_H */ +#endif /* _PROTO_STREAM_H */ /* * Local variables: diff --git a/include/proto/stream_interface.h b/include/proto/stream_interface.h index 70b2ac8d8..f96d81c34 100644 --- a/include/proto/stream_interface.h +++ b/include/proto/stream_interface.h @@ -25,7 +25,7 @@ #include #include -#include +#include #include #include #include @@ -50,18 +50,18 @@ void stream_int_unregister_handler(struct stream_interface *si); static inline struct channel *si_ic(struct stream_interface *si) { if (si->flags & SI_FL_ISBACK) - return &LIST_ELEM(si, struct session *, si[1])->res; + return &LIST_ELEM(si, struct stream *, si[1])->res; else - return &LIST_ELEM(si, struct session *, si[0])->req; + return &LIST_ELEM(si, struct stream *, si[0])->req; } /* returns the channel which feeds data to this stream interface (output channel) */ static inline struct channel *si_oc(struct stream_interface *si) { if (si->flags & SI_FL_ISBACK) - return &LIST_ELEM(si, struct session *, si[1])->req; + return &LIST_ELEM(si, struct stream *, si[1])->req; else - return &LIST_ELEM(si, struct session *, si[0])->res; + return &LIST_ELEM(si, struct stream *, si[0])->res; } /* returns the buffer which receives data from this stream interface (input channel's buffer) */ @@ -76,31 +76,31 @@ static inline struct buffer *si_ob(struct stream_interface *si) return si_oc(si)->buf; } -/* returns the session associated to a stream interface */ -static inline struct session *si_sess(struct stream_interface *si) +/* returns the stream associated to a stream interface */ +static inline struct stream *si_strm(struct stream_interface *si) { if (si->flags & SI_FL_ISBACK) - return LIST_ELEM(si, struct session *, si[1]); + return LIST_ELEM(si, struct stream *, si[1]); else - return LIST_ELEM(si, struct session *, si[0]); + return LIST_ELEM(si, struct stream *, si[0]); } /* returns the task associated to this stream interface */ static inline struct task *si_task(struct stream_interface *si) { if (si->flags & SI_FL_ISBACK) - return LIST_ELEM(si, struct session *, si[1])->task; + return LIST_ELEM(si, struct stream *, si[1])->task; else - return LIST_ELEM(si, struct session *, si[0])->task; + return LIST_ELEM(si, struct stream *, si[0])->task; } /* returns the stream interface on the other side. Used during forwarding. */ static inline struct stream_interface *si_opposite(struct stream_interface *si) { if (si->flags & SI_FL_ISBACK) - return &LIST_ELEM(si, struct session *, si[1])->si[0]; + return &LIST_ELEM(si, struct stream *, si[1])->si[0]; else - return &LIST_ELEM(si, struct session *, si[0])->si[1]; + return &LIST_ELEM(si, struct stream *, si[0])->si[1]; } /* Initializes all required fields for a new appctx. Note that it does the diff --git a/include/types/acl.h b/include/types/acl.h index 173204d5c..3d4428434 100644 --- a/include/types/acl.h +++ b/include/types/acl.h @@ -73,7 +73,7 @@ enum acl_cond_pol { /* some dummy declarations to silent the compiler */ struct proxy; -struct session; +struct stream; /* * ACL keyword: Associates keywords with parsers, methods to retrieve the value and testers. diff --git a/include/types/hlua.h b/include/types/hlua.h index 8418771fb..13465d8a4 100644 --- a/include/types/hlua.h +++ b/include/types/hlua.h @@ -17,7 +17,7 @@ #define CLASS_CHANNEL "Channel" #define CLASS_HTTP "HTTP" -struct session; +struct stream; #define HLUA_RUN 0x00000001 #define HLUA_CTRLYIELD 0x00000002 @@ -91,14 +91,14 @@ struct hlua_rule { * associated with the lua object called "TXN". */ struct hlua_txn { - struct session *s; + struct stream *s; struct proxy *p; void *l7; }; /* This struc is used with sample fetches and sample converters. */ struct hlua_smp { - struct session *s; + struct stream *s; struct proxy *p; void *l7; int stringsafe; @@ -112,10 +112,10 @@ struct hlua_sleep { }; /* This struct is used to create coprocess doing TCP or - * SSL I/O. It uses a fake session. + * SSL I/O. It uses a fake stream. */ struct hlua_socket { - struct session *s; /* Session used for socket I/O. */ + struct stream *s; /* Stream used for socket I/O. */ luaL_Buffer b; /* buffer used to prepare strings. */ }; diff --git a/include/types/peers.h b/include/types/peers.h index d52dc8c41..8f8eefa1c 100644 --- a/include/types/peers.h +++ b/include/types/peers.h @@ -38,7 +38,7 @@ struct peer_session { struct shared_table *table; /* shared table */ struct peer *peer; /* current peer */ - struct session *session; /* current transport session */ + struct stream *stream; /* current transport stream */ unsigned int flags; /* peer session flags */ unsigned int statuscode; /* current/last session status code */ unsigned int update; /* current peer acked update */ diff --git a/include/types/proto_http.h b/include/types/proto_http.h index 5a4489d33..a8c44e5d1 100644 --- a/include/types/proto_http.h +++ b/include/types/proto_http.h @@ -37,17 +37,17 @@ #define TX_CLALLOW 0x00000002 /* a client header matches an allow regex */ #define TX_SVDENY 0x00000004 /* a server header matches a deny regex */ #define TX_SVALLOW 0x00000008 /* a server header matches an allow regex */ -#define TX_CLTARPIT 0x00000010 /* the session is tarpitted (anti-dos) */ +#define TX_CLTARPIT 0x00000010 /* the transaction is tarpitted (anti-dos) */ /* transaction flags dedicated to cookies : bits values 0x20 to 0x80 (0-7 shift 5) */ -#define TX_CK_NONE 0x00000000 /* this session had no cookie */ -#define TX_CK_INVALID 0x00000020 /* this session had a cookie which matches no server */ -#define TX_CK_DOWN 0x00000040 /* this session had cookie matching a down server */ -#define TX_CK_VALID 0x00000060 /* this session had cookie matching a valid server */ -#define TX_CK_EXPIRED 0x00000080 /* this session had an expired cookie (idle for too long) */ -#define TX_CK_OLD 0x000000A0 /* this session had too old a cookie (offered too long ago) */ -#define TX_CK_UNUSED 0x000000C0 /* this session had a cookie but it was not used (eg: use-server was preferred) */ -#define TX_CK_MASK 0x000000E0 /* mask to get this session's cookie flags */ +#define TX_CK_NONE 0x00000000 /* this transaction had no cookie */ +#define TX_CK_INVALID 0x00000020 /* this transaction had a cookie which matches no server */ +#define TX_CK_DOWN 0x00000040 /* this transaction had cookie matching a down server */ +#define TX_CK_VALID 0x00000060 /* this transaction had cookie matching a valid server */ +#define TX_CK_EXPIRED 0x00000080 /* this transaction had an expired cookie (idle for too long) */ +#define TX_CK_OLD 0x000000A0 /* this transaction had too old a cookie (offered too long ago) */ +#define TX_CK_UNUSED 0x000000C0 /* this transaction had a cookie but it was not used (eg: use-server was preferred) */ +#define TX_CK_MASK 0x000000E0 /* mask to get this transaction's cookie flags */ #define TX_CK_SHIFT 5 /* bit shift */ /* response cookie information, bits values 0x100 to 0x700 (0-7 shift 8) */ @@ -411,13 +411,13 @@ struct http_auth_data { struct proxy; struct http_txn; -struct session; +struct stream; struct http_req_rule { struct list list; struct acl_cond *cond; /* acl condition to meet */ unsigned int action; /* HTTP_REQ_* */ - int (*action_ptr)(struct http_req_rule *rule, struct proxy *px, struct session *s, struct http_txn *http_txn); /* ptr to custom action */ + int (*action_ptr)(struct http_req_rule *rule, struct proxy *px, struct stream *s, struct http_txn *http_txn); /* ptr to custom action */ union { struct { char *realm; @@ -453,7 +453,7 @@ struct http_res_rule { struct list list; struct acl_cond *cond; /* acl condition to meet */ unsigned int action; /* HTTP_RES_* */ - int (*action_ptr)(struct http_res_rule *rule, struct proxy *px, struct session *s, struct http_txn *http_txn); /* ptr to custom action */ + int (*action_ptr)(struct http_res_rule *rule, struct proxy *px, struct stream *s, struct http_txn *http_txn); /* ptr to custom action */ union { struct { char *name; /* header name */ diff --git a/include/types/proto_tcp.h b/include/types/proto_tcp.h index fcdc3c852..ce21daefc 100644 --- a/include/types/proto_tcp.h +++ b/include/types/proto_tcp.h @@ -26,7 +26,7 @@ #include #include -#include +#include /* Layer4 accept/reject rules */ enum { @@ -52,7 +52,7 @@ struct tcp_rule { struct acl_cond *cond; int action; int (*action_ptr)(struct tcp_rule *rule, struct proxy *px, - struct session *s); + struct stream *s); union { struct track_ctr_prm trk_ctr; struct capture_prm cap; diff --git a/include/types/proxy.h b/include/types/proxy.h index 0cd00eef8..41d04fabc 100644 --- a/include/types/proxy.h +++ b/include/types/proxy.h @@ -86,11 +86,11 @@ enum pr_mode { /* unused: 0x0800, 0x1000 */ #define PR_O_FF_ALWAYS 0x00002000 /* always set x-forwarded-for */ #define PR_O_PERSIST 0x00004000 /* server persistence stays effective even when server is down */ -#define PR_O_LOGASAP 0x00008000 /* log as soon as possible, without waiting for the session to complete */ +#define PR_O_LOGASAP 0x00008000 /* log as soon as possible, without waiting for the stream to complete */ /* unused: 0x00010000 */ #define PR_O_CHK_CACHE 0x00020000 /* require examination of cacheability of the 'set-cookie' field */ -#define PR_O_TCP_CLI_KA 0x00040000 /* enable TCP keep-alive on client-side sessions */ -#define PR_O_TCP_SRV_KA 0x00080000 /* enable TCP keep-alive on server-side sessions */ +#define PR_O_TCP_CLI_KA 0x00040000 /* enable TCP keep-alive on client-side streams */ +#define PR_O_TCP_SRV_KA 0x00080000 /* enable TCP keep-alive on server-side streams */ #define PR_O_USE_ALL_BK 0x00100000 /* load-balance between backup servers */ /* unused: 0x00020000 */ #define PR_O_TCP_NOLING 0x00400000 /* disable lingering on client and server connections */ @@ -106,7 +106,7 @@ enum pr_mode { #define PR_O_HTTP_MODE 0x07000000 /* MASK to retrieve the HTTP mode */ #define PR_O_TCPCHK_SSL 0x08000000 /* at least one TCPCHECK connect rule requires SSL */ #define PR_O_CONTSTATS 0x10000000 /* continous counters */ -#define PR_O_HTTP_PROXY 0x20000000 /* Enable session to use HTTP proxy operations */ +#define PR_O_HTTP_PROXY 0x20000000 /* Enable stream to use HTTP proxy operations */ #define PR_O_DISABLE404 0x40000000 /* Disable a server on a 404 response to a health-check */ #define PR_O_ORGTO 0x80000000 /* insert x-original-to with destination address */ @@ -185,17 +185,17 @@ enum pr_mode { #define STK_IS_STORE 0x00000002 /* store on request fetch */ #define STK_ON_RSP 0x00000004 /* store on response fetch */ -struct session; +struct stream; struct error_snapshot { struct timeval when; /* date of this event, (tv_sec == 0) means "never" */ unsigned int len; /* original length of the last invalid request/response */ unsigned int pos; /* position of the first invalid character */ - unsigned int sid; /* ID of the faulty session */ + unsigned int sid; /* ID of the faulty stream */ unsigned int ev_id; /* event number (counter incremented for each capture) */ unsigned int state; /* message state before the error (when saved) */ unsigned int b_flags; /* buffer flags */ - unsigned int s_flags; /* session flags */ + unsigned int s_flags; /* stream flags */ unsigned int t_flags; /* transaction flags */ unsigned int m_flags; /* message flags */ unsigned int b_out; /* pending output bytes */ @@ -227,7 +227,7 @@ struct proxy { enum pr_state state; /* proxy state, one of PR_* */ enum pr_mode mode; /* mode = PR_MODE_TCP, PR_MODE_HTTP or PR_MODE_HEALTH */ char cap; /* supported capabilities (PR_CAP_*) */ - unsigned int maxconn; /* max # of active sessions on the frontend */ + unsigned int maxconn; /* max # of active streams on the frontend */ int options; /* PR_O_REDISP, PR_O_TRANSP, ... */ int options2; /* PR_O2_* */ @@ -307,7 +307,7 @@ struct proxy { struct list pendconns; /* pending connections with no server assigned yet */ int nbpend; /* number of pending connections with no server assigned yet */ int totpend; /* total number of pending connections on this instance (for stats) */ - unsigned int feconn, beconn; /* # of active frontend and backends sessions */ + unsigned int feconn, beconn; /* # of active frontend and backends streams */ struct freq_ctr fe_req_per_sec; /* HTTP requests per second on the frontend */ struct freq_ctr fe_conn_per_sec; /* received connections per second on the frontend */ struct freq_ctr fe_sess_per_sec; /* accepted sessions per second on the frontend (after tcp rules) */ @@ -327,9 +327,9 @@ struct proxy { unsigned down_trans; /* up-down transitions */ unsigned down_time; /* total time the proxy was down */ time_t last_change; /* last time, when the state was changed */ - int (*accept)(struct session *s); /* application layer's accept() */ + int (*accept)(struct stream *s); /* application layer's accept() */ struct conn_src conn_src; /* connection source settings */ - enum obj_type *default_target; /* default target to use for accepted sessions or NULL */ + enum obj_type *default_target; /* default target to use for accepted streams or NULL */ struct proxy *next; unsigned int log_count; /* number of logs produced by the frontend */ @@ -345,14 +345,14 @@ struct proxy { int nb_req_cap, nb_rsp_cap; /* # of headers to be captured */ struct cap_hdr *req_cap; /* chained list of request headers to be captured */ struct cap_hdr *rsp_cap; /* chained list of response headers to be captured */ - struct pool_head *req_cap_pool, /* pools of pre-allocated char ** used to build the sessions */ + struct pool_head *req_cap_pool, /* pools of pre-allocated char ** used to build the streams */ *rsp_cap_pool; struct list req_add, rsp_add; /* headers to be added */ struct pxcounters be_counters; /* backend statistics counters */ struct pxcounters fe_counters; /* frontend statistics counters */ struct list listener_queue; /* list of the temporarily limited listeners because of lack of a proxy resource */ - struct stktable table; /* table for storing sticking sessions */ + struct stktable table; /* table for storing sticking streams */ struct task *task; /* the associated task, mandatory to manage rate limiting, stopping and resource shortage, NULL if disabled */ struct list tcpcheck_rules; /* tcp-check send / expect rules */ diff --git a/include/types/queue.h b/include/types/queue.h index 9ff8df5f9..4b3545140 100644 --- a/include/types/queue.h +++ b/include/types/queue.h @@ -27,11 +27,11 @@ #include -struct session; +struct stream; struct pendconn { struct list list; /* chaining ... */ - struct session *sess; /* the session waiting for a connection */ + struct stream *strm; /* the stream waiting for a connection */ struct server *srv; /* the server we are waiting for */ }; diff --git a/include/types/sample.h b/include/types/sample.h index 3c49ad977..e054c27f8 100644 --- a/include/types/sample.h +++ b/include/types/sample.h @@ -71,7 +71,7 @@ enum { SMP_SRC_RQFIN, /* final information about request buffer (eg: tot bytes) */ SMP_SRC_RSFIN, /* final information about response buffer (eg: tot bytes) */ SMP_SRC_TXFIN, /* final information about the transaction (eg: #comp rate) */ - SMP_SRC_SSFIN, /* final information about the session (eg: #requests, final flags) */ + SMP_SRC_SSFIN, /* final information about the stream (eg: #requests, final flags) */ SMP_SRC_ENTRIES /* nothing after this */ }; @@ -80,7 +80,7 @@ enum { */ enum { SMP_CKP_FE_CON_ACC, /* FE connection accept rules ("tcp request connection") */ - SMP_CKP_FE_SES_ACC, /* FE session accept rules (to come soon) */ + SMP_CKP_FE_SES_ACC, /* FE stream accept rules (to come soon) */ SMP_CKP_FE_REQ_CNT, /* FE request content rules ("tcp request content") */ SMP_CKP_FE_HRQ_HDR, /* FE HTTP request headers (rules, headers, monitor, stats, redirect) */ SMP_CKP_FE_HRQ_BDY, /* FE HTTP request body */ @@ -97,7 +97,7 @@ enum { SMP_CKP_FE_RES_CNT, /* FE response content rules ("tcp response content") */ SMP_CKP_FE_HRS_HDR, /* FE HTTP response headers (rules, headers) */ SMP_CKP_FE_HRS_BDY, /* FE HTTP response body */ - SMP_CKP_FE_LOG_END, /* FE log at the end of the txn/session */ + SMP_CKP_FE_LOG_END, /* FE log at the end of the txn/stream */ SMP_CKP_ENTRIES /* nothing after this */ }; @@ -130,7 +130,7 @@ enum { SMP_USE_RQFIN = 1 << SMP_SRC_RQFIN, /* final information about request buffer (eg: tot bytes) */ SMP_USE_RSFIN = 1 << SMP_SRC_RSFIN, /* final information about response buffer (eg: tot bytes) */ SMP_USE_TXFIN = 1 << SMP_SRC_TXFIN, /* final information about the transaction (eg: #comp rate) */ - SMP_USE_SSFIN = 1 << SMP_SRC_SSFIN, /* final information about the session (eg: #requests, final flags) */ + SMP_USE_SSFIN = 1 << SMP_SRC_SSFIN, /* final information about the stream (eg: #requests, final flags) */ /* This composite one is useful to detect if an hdr_idx needs to be allocated */ SMP_USE_HTTP_ANY = SMP_USE_HRQHV | SMP_USE_HRQHP | SMP_USE_HRQBO | @@ -145,7 +145,7 @@ enum { enum { SMP_VAL___________ = 0, /* Just used as a visual marker */ SMP_VAL_FE_CON_ACC = 1 << SMP_CKP_FE_CON_ACC, /* FE connection accept rules ("tcp request connection") */ - SMP_VAL_FE_SES_ACC = 1 << SMP_CKP_FE_SES_ACC, /* FE session accept rules (to come soon) */ + SMP_VAL_FE_SES_ACC = 1 << SMP_CKP_FE_SES_ACC, /* FE stream accept rules (to come soon) */ SMP_VAL_FE_REQ_CNT = 1 << SMP_CKP_FE_REQ_CNT, /* FE request content rules ("tcp request content") */ SMP_VAL_FE_HRQ_HDR = 1 << SMP_CKP_FE_HRQ_HDR, /* FE HTTP request headers (rules, headers, monitor, stats, redirect) */ SMP_VAL_FE_HRQ_BDY = 1 << SMP_CKP_FE_HRQ_BDY, /* FE HTTP request body */ @@ -162,7 +162,7 @@ enum { SMP_VAL_FE_RES_CNT = 1 << SMP_CKP_FE_RES_CNT, /* FE response content rules ("tcp response content") */ SMP_VAL_FE_HRS_HDR = 1 << SMP_CKP_FE_HRS_HDR, /* FE HTTP response headers (rules, headers) */ SMP_VAL_FE_HRS_BDY = 1 << SMP_CKP_FE_HRS_BDY, /* FE HTTP response body */ - SMP_VAL_FE_LOG_END = 1 << SMP_CKP_FE_LOG_END, /* FE log at the end of the txn/session */ + SMP_VAL_FE_LOG_END = 1 << SMP_CKP_FE_LOG_END, /* FE log at the end of the txn/stream */ /* a few combinations to decide what direction to try to fetch (useful for logs) */ SMP_VAL_REQUEST = SMP_VAL_FE_CON_ACC | SMP_VAL_FE_SES_ACC | SMP_VAL_FE_REQ_CNT | @@ -207,7 +207,7 @@ enum { }; /* needed below */ -struct session; +struct stream; /* a sample context might be used by any sample fetch function in order to * store information needed across multiple calls (eg: restart point for a @@ -260,7 +260,7 @@ struct sample_storage { /* Descriptor for a sample conversion */ struct sample_conv { const char *kw; /* configuration keyword */ - int (*process)(struct session *session, + int (*process)(struct stream *stream, const struct arg *arg_p, struct sample *smp, void *private); /* process function */ @@ -285,7 +285,7 @@ struct sample_conv_expr { struct sample_fetch { const char *kw; /* configuration keyword */ int (*process)(struct proxy *px, - struct session *l4, + struct stream *l4, void *l7, unsigned int opt, /* fetch options (SMP_OPT_*) */ const struct arg *arg_p, diff --git a/include/types/session.h b/include/types/session.h deleted file mode 100644 index 78664fb2a..000000000 --- a/include/types/session.h +++ /dev/null @@ -1,174 +0,0 @@ -/* - * include/types/session.h - * This file defines everything related to sessions. - * - * Copyright (C) 2000-2010 Willy Tarreau - w@1wt.eu - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation, version 2.1 - * exclusively. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef _TYPES_SESSION_H -#define _TYPES_SESSION_H - - -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -/* various session flags, bits values 0x01 to 0x100 (shift 0) */ -#define SN_DIRECT 0x00000001 /* connection made on the server matching the client cookie */ -#define SN_ASSIGNED 0x00000002 /* no need to assign a server to this session */ -#define SN_ADDR_SET 0x00000004 /* this session's server address has been set */ -#define SN_BE_ASSIGNED 0x00000008 /* a backend was assigned. Conns are accounted. */ - -#define SN_FORCE_PRST 0x00000010 /* force persistence here, even if server is down */ -#define SN_MONITOR 0x00000020 /* this session comes from a monitoring system */ -#define SN_CURR_SESS 0x00000040 /* a connection is currently being counted on the server */ -#define SN_INITIALIZED 0x00000080 /* the session was fully initialized */ -#define SN_REDISP 0x00000100 /* set if this session was redispatched from one server to another */ -#define SN_CONN_TAR 0x00000200 /* set if this session is turning around before reconnecting */ -#define SN_REDIRECTABLE 0x00000400 /* set if this session is redirectable (GET or HEAD) */ -#define SN_TUNNEL 0x00000800 /* tunnel-mode session, nothing to catch after data */ - -/* session termination conditions, bits values 0x1000 to 0x7000 (0-9 shift 12) */ -#define SN_ERR_NONE 0x00000000 /* normal end of request */ -#define SN_ERR_LOCAL 0x00001000 /* the proxy locally processed this request => not an error */ -#define SN_ERR_CLITO 0x00002000 /* client time-out */ -#define SN_ERR_CLICL 0x00003000 /* client closed (read/write error) */ -#define SN_ERR_SRVTO 0x00004000 /* server time-out, connect time-out */ -#define SN_ERR_SRVCL 0x00005000 /* server closed (connect/read/write error) */ -#define SN_ERR_PRXCOND 0x00006000 /* the proxy decided to close (deny...) */ -#define SN_ERR_RESOURCE 0x00007000 /* the proxy encountered a lack of a local resources (fd, mem, ...) */ -#define SN_ERR_INTERNAL 0x00008000 /* the proxy encountered an internal error */ -#define SN_ERR_DOWN 0x00009000 /* the proxy killed a session because the backend became unavailable */ -#define SN_ERR_KILLED 0x0000a000 /* the proxy killed a session because it was asked to do so */ -#define SN_ERR_UP 0x0000b000 /* the proxy killed a session because a preferred backend became available */ -#define SN_ERR_MASK 0x0000f000 /* mask to get only session error flags */ -#define SN_ERR_SHIFT 12 /* bit shift */ - -/* session state at termination, bits values 0x10000 to 0x70000 (0-7 shift 16) */ -#define SN_FINST_R 0x00010000 /* session ended during client request */ -#define SN_FINST_C 0x00020000 /* session ended during server connect */ -#define SN_FINST_H 0x00030000 /* session ended during server headers */ -#define SN_FINST_D 0x00040000 /* session ended during data phase */ -#define SN_FINST_L 0x00050000 /* session ended while pushing last data to client */ -#define SN_FINST_Q 0x00060000 /* session ended while waiting in queue for a server slot */ -#define SN_FINST_T 0x00070000 /* session ended tarpitted */ -#define SN_FINST_MASK 0x00070000 /* mask to get only final session state flags */ -#define SN_FINST_SHIFT 16 /* bit shift */ - -#define SN_IGNORE_PRST 0x00080000 /* ignore persistence */ - -#define SN_COMP_READY 0x00100000 /* the compression is initialized */ -#define SN_SRV_REUSED 0x00200000 /* the server-side connection was reused */ - -/* - * Note: some session flags have dependencies : - * - SN_DIRECT cannot exist without SN_ASSIGNED, because a server is - * immediately assigned when SN_DIRECT is determined. Both must be cleared - * when clearing SN_DIRECT (eg: redispatch). - * - ->srv has no meaning without SN_ASSIGNED and must not be checked without - * it. ->target may be used to check previous ->srv after a failed connection attempt. - * - a session being processed has srv_conn set. - * - srv_conn might remain after SN_DIRECT has been reset, but the assigned - * server should eventually be released. - */ -struct session { - int flags; /* some flags describing the session */ - unsigned int uniq_id; /* unique ID used for the traces */ - enum obj_type *target; /* target to use for this session ; for mini-sess: incoming connection */ - - struct channel req; /* request channel */ - struct channel res; /* response channel */ - - struct proxy *fe; /* the proxy this session depends on for the client side */ - struct proxy *be; /* the proxy this session depends on for the server side */ - - struct listener *listener; /* the listener by which the request arrived */ - struct server *srv_conn; /* session already has a slot on a server and is not in queue */ - struct pendconn *pend_pos; /* if not NULL, points to the position in the pending queue */ - - struct http_txn txn; /* current HTTP transaction being processed. Should become a list. */ - - struct task *task; /* the task associated with this session */ - struct list list; /* position in global sessions list */ - struct list by_srv; /* position in server session list */ - struct list back_refs; /* list of users tracking this session */ - struct list buffer_wait; /* position in the list of sessions waiting for a buffer */ - - struct { - struct stksess *ts; - struct stktable *table; - } store[8]; /* tracked stickiness values to store */ - int store_count; - /* 4 unused bytes here */ - - struct stkctr stkctr[MAX_SESS_STKCTR]; /* stick counters */ - - struct stream_interface si[2]; /* client and server stream interfaces */ - struct { - int logwait; /* log fields waiting to be collected : LW_* */ - int level; /* log level to force + 1 if > 0, -1 = no log */ - struct timeval accept_date; /* date of the accept() in user date */ - struct timeval tv_accept; /* date of the accept() in internal date (monotonic) */ - struct timeval tv_request; /* date the request arrives, {0,0} if never occurs */ - long t_queue; /* delay before the session gets out of the connect queue, -1 if never occurs */ - long t_connect; /* delay before the connect() to the server succeeds, -1 if never occurs */ - long t_data; /* delay before the first data byte from the server ... */ - unsigned long t_close; /* total session duration */ - unsigned long srv_queue_size; /* number of sessions waiting for a connect slot on this server at accept() time (in direct assignment) */ - unsigned long prx_queue_size; /* overall number of sessions waiting for a connect slot on this instance at accept() time */ - long long bytes_in; /* number of bytes transferred from the client to the server */ - long long bytes_out; /* number of bytes transferred from the server to the client */ - } logs; - void (*do_log)(struct session *s); /* the function to call in order to log (or NULL) */ - void (*srv_error)(struct session *s, /* the function to call upon unrecoverable server errors (or NULL) */ - struct stream_interface *si); - struct comp_ctx *comp_ctx; /* HTTP compression context */ - struct comp_algo *comp_algo; /* HTTP compression algorithm if not NULL */ - char *unique_id; /* custom unique ID */ - - /* These two pointers are used to resume the execution of the rule lists. */ - struct list *current_rule_list; /* this is used to store the current executed rule list. */ - struct list *current_rule; /* this is used to store the current rule to be resumed. */ - - struct hlua hlua; /* lua runtime context */ -}; - -#endif /* _TYPES_SESSION_H */ - -/* - * Local variables: - * c-indent-level: 8 - * c-basic-offset: 8 - * End: - */ diff --git a/include/types/stick_table.h b/include/types/stick_table.h index 0cda10484..0867d86a7 100644 --- a/include/types/stick_table.h +++ b/include/types/stick_table.h @@ -44,7 +44,7 @@ enum { /* The types of extra data we can store in a stick table */ enum { - STKTABLE_DT_SERVER_ID, /* the server ID to use with this session if > 0 */ + STKTABLE_DT_SERVER_ID, /* the server ID to use with this stream if > 0 */ STKTABLE_DT_GPC0, /* General Purpose Counter 0 (unsigned 32-bit integer) */ STKTABLE_DT_GPC0_RATE, /* General Purpose Counter 0's event rate */ STKTABLE_DT_CONN_CNT, /* cumulated number of connections */ @@ -193,8 +193,8 @@ struct stktable_key { union stktable_key_data data; /* data, must always be last */ }; -/* WARNING: if new fields are added, they must be initialized in session_accept() - * and freed in session_free() ! +/* WARNING: if new fields are added, they must be initialized in stream_accept() + * and freed in stream_free() ! */ #define STKCTR_TRACK_BACKEND 1 #define STKCTR_TRACK_CONTENT 2 @@ -203,7 +203,7 @@ struct stktable_key { * pointer to an stksess struct, and two flags among STKCTR_TRACK_* above. */ struct stkctr { - unsigned long entry; /* entry containing counters currently being tracked by this session */ + unsigned long entry; /* entry containing counters currently being tracked by this stream */ struct stktable *table; /* table the counters above belong to (undefined if counters are null) */ }; diff --git a/include/types/stream.h b/include/types/stream.h new file mode 100644 index 000000000..5f6580933 --- /dev/null +++ b/include/types/stream.h @@ -0,0 +1,166 @@ +/* + * include/types/stream.h + * This file defines everything related to streams. + * + * Copyright (C) 2000-2015 Willy Tarreau - w@1wt.eu + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation, version 2.1 + * exclusively. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef _TYPES_STREAM_H +#define _TYPES_STREAM_H + + +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +/* various stream flags, bits values 0x01 to 0x100 (shift 0) */ +#define SN_DIRECT 0x00000001 /* connection made on the server matching the client cookie */ +#define SN_ASSIGNED 0x00000002 /* no need to assign a server to this stream */ +#define SN_ADDR_SET 0x00000004 /* this stream's server address has been set */ +#define SN_BE_ASSIGNED 0x00000008 /* a backend was assigned. Conns are accounted. */ + +#define SN_FORCE_PRST 0x00000010 /* force persistence here, even if server is down */ +#define SN_MONITOR 0x00000020 /* this stream comes from a monitoring system */ +#define SN_CURR_SESS 0x00000040 /* a connection is currently being counted on the server */ +#define SN_INITIALIZED 0x00000080 /* the stream was fully initialized */ +#define SN_REDISP 0x00000100 /* set if this stream was redispatched from one server to another */ +#define SN_CONN_TAR 0x00000200 /* set if this stream is turning around before reconnecting */ +#define SN_REDIRECTABLE 0x00000400 /* set if this stream is redirectable (GET or HEAD) */ +#define SN_TUNNEL 0x00000800 /* tunnel-mode stream, nothing to catch after data */ + +/* stream termination conditions, bits values 0x1000 to 0x7000 (0-9 shift 12) */ +#define SN_ERR_NONE 0x00000000 /* normal end of request */ +#define SN_ERR_LOCAL 0x00001000 /* the proxy locally processed this request => not an error */ +#define SN_ERR_CLITO 0x00002000 /* client time-out */ +#define SN_ERR_CLICL 0x00003000 /* client closed (read/write error) */ +#define SN_ERR_SRVTO 0x00004000 /* server time-out, connect time-out */ +#define SN_ERR_SRVCL 0x00005000 /* server closed (connect/read/write error) */ +#define SN_ERR_PRXCOND 0x00006000 /* the proxy decided to close (deny...) */ +#define SN_ERR_RESOURCE 0x00007000 /* the proxy encountered a lack of a local resources (fd, mem, ...) */ +#define SN_ERR_INTERNAL 0x00008000 /* the proxy encountered an internal error */ +#define SN_ERR_DOWN 0x00009000 /* the proxy killed a stream because the backend became unavailable */ +#define SN_ERR_KILLED 0x0000a000 /* the proxy killed a stream because it was asked to do so */ +#define SN_ERR_UP 0x0000b000 /* the proxy killed a stream because a preferred backend became available */ +#define SN_ERR_MASK 0x0000f000 /* mask to get only stream error flags */ +#define SN_ERR_SHIFT 12 /* bit shift */ + +/* stream state at termination, bits values 0x10000 to 0x70000 (0-7 shift 16) */ +#define SN_FINST_R 0x00010000 /* stream ended during client request */ +#define SN_FINST_C 0x00020000 /* stream ended during server connect */ +#define SN_FINST_H 0x00030000 /* stream ended during server headers */ +#define SN_FINST_D 0x00040000 /* stream ended during data phase */ +#define SN_FINST_L 0x00050000 /* stream ended while pushing last data to client */ +#define SN_FINST_Q 0x00060000 /* stream ended while waiting in queue for a server slot */ +#define SN_FINST_T 0x00070000 /* stream ended tarpitted */ +#define SN_FINST_MASK 0x00070000 /* mask to get only final stream state flags */ +#define SN_FINST_SHIFT 16 /* bit shift */ + +#define SN_IGNORE_PRST 0x00080000 /* ignore persistence */ + +#define SN_COMP_READY 0x00100000 /* the compression is initialized */ +#define SN_SRV_REUSED 0x00200000 /* the server-side connection was reused */ + +/* some external definitions */ +struct strm_logs { + int logwait; /* log fields waiting to be collected : LW_* */ + int level; /* log level to force + 1 if > 0, -1 = no log */ + struct timeval accept_date; /* date of the stream's accept() in user date */ + struct timeval tv_accept; /* date of the stream's accept() in internal date (monotonic) */ + struct timeval tv_request; /* date the request arrives, {0,0} if never occurs */ + long t_queue; /* delay before the stream gets out of the connect queue, -1 if never occurs */ + long t_connect; /* delay before the connect() to the server succeeds, -1 if never occurs */ + long t_data; /* delay before the first data byte from the server ... */ + unsigned long t_close; /* total stream duration */ + unsigned long srv_queue_size; /* number of streams waiting for a connect slot on this server at accept() time (in direct assignment) */ + unsigned long prx_queue_size; /* overall number of streams waiting for a connect slot on this instance at accept() time */ + long long bytes_in; /* number of bytes transferred from the client to the server */ + long long bytes_out; /* number of bytes transferred from the server to the client */ +}; + +struct stream { + int flags; /* some flags describing the stream */ + unsigned int uniq_id; /* unique ID used for the traces */ + enum obj_type *target; /* target to use for this stream ; for mini-sess: incoming connection */ + + struct channel req; /* request channel */ + struct channel res; /* response channel */ + + struct proxy *fe; /* the proxy this stream depends on for the client side */ + struct proxy *be; /* the proxy this stream depends on for the server side */ + + struct listener *listener; /* the listener by which the request arrived */ + struct server *srv_conn; /* stream already has a slot on a server and is not in queue */ + struct pendconn *pend_pos; /* if not NULL, points to the position in the pending queue */ + + struct http_txn txn; /* current HTTP transaction being processed. Should become a list. */ + + struct task *task; /* the task associated with this stream */ + struct list list; /* position in global streams list */ + struct list by_srv; /* position in server stream list */ + struct list back_refs; /* list of users tracking this stream */ + struct list buffer_wait; /* position in the list of streams waiting for a buffer */ + + struct { + struct stksess *ts; + struct stktable *table; + } store[8]; /* tracked stickiness values to store */ + int store_count; + /* 4 unused bytes here */ + + struct stkctr stkctr[MAX_SESS_STKCTR]; /* stick counters */ + + struct stream_interface si[2]; /* client and server stream interfaces */ + struct strm_logs logs; /* logs for this stream */ + + void (*do_log)(struct stream *s); /* the function to call in order to log (or NULL) */ + void (*srv_error)(struct stream *s, /* the function to call upon unrecoverable server errors (or NULL) */ + struct stream_interface *si); + struct comp_ctx *comp_ctx; /* HTTP compression context */ + struct comp_algo *comp_algo; /* HTTP compression algorithm if not NULL */ + char *unique_id; /* custom unique ID */ + + /* These two pointers are used to resume the execution of the rule lists. */ + struct list *current_rule_list; /* this is used to store the current executed rule list. */ + struct list *current_rule; /* this is used to store the current rule to be resumed. */ + struct hlua hlua; /* lua runtime context */ +}; + +#endif /* _TYPES_STREAM_H */ + +/* + * Local variables: + * c-indent-level: 8 + * c-basic-offset: 8 + * End: + */ diff --git a/src/acl.c b/src/acl.c index d8b3000c0..edf133970 100644 --- a/src/acl.c +++ b/src/acl.c @@ -1097,7 +1097,7 @@ struct acl_cond *build_acl_cond(const char *file, int line, struct proxy *px, co * if (cond->pol == ACL_COND_UNLESS) * res = !res; */ -enum acl_test_res acl_exec_cond(struct acl_cond *cond, struct proxy *px, struct session *l4, void *l7, unsigned int opt) +enum acl_test_res acl_exec_cond(struct acl_cond *cond, struct proxy *px, struct stream *l4, void *l7, unsigned int opt) { __label__ fetch_next; struct acl_term_suite *suite; diff --git a/src/backend.c b/src/backend.c index 5f200270e..ee8457189 100644 --- a/src/backend.c +++ b/src/backend.c @@ -50,7 +50,7 @@ #include #include #include -#include +#include #include #include #include @@ -297,7 +297,7 @@ struct server *get_server_ph(struct proxy *px, const char *uri, int uri_len) /* * this does the same as the previous server_ph, but check the body contents */ -struct server *get_server_ph_post(struct session *s) +struct server *get_server_ph_post(struct stream *s) { unsigned int hash = 0; struct http_txn *txn = &s->txn; @@ -375,7 +375,7 @@ struct server *get_server_ph_post(struct session *s) * is returned. If any server is found, it will be returned. If no valid server * is found, NULL is returned. */ -struct server *get_server_hh(struct session *s) +struct server *get_server_hh(struct stream *s) { unsigned int hash = 0; struct http_txn *txn = &s->txn; @@ -451,7 +451,7 @@ struct server *get_server_hh(struct session *s) } /* RDP Cookie HASH. */ -struct server *get_server_rch(struct session *s) +struct server *get_server_rch(struct stream *s) { unsigned int hash = 0; struct proxy *px = s->be; @@ -495,31 +495,31 @@ struct server *get_server_rch(struct session *s) } /* - * This function applies the load-balancing algorithm to the session, as - * defined by the backend it is assigned to. The session is then marked as + * This function applies the load-balancing algorithm to the stream, as + * defined by the backend it is assigned to. The stream is then marked as * 'assigned'. * - * This function MAY NOT be called with SN_ASSIGNED already set. If the session + * This function MAY NOT be called with SN_ASSIGNED already set. If the stream * had a server previously assigned, it is rebalanced, trying to avoid the same * server, which should still be present in target_srv(&s->target) before the call. * The function tries to keep the original connection slot if it reconnects to * the same server, otherwise it releases it and tries to offer it. * - * It is illegal to call this function with a session in a queue. + * It is illegal to call this function with a stream in a queue. * * It may return : * SRV_STATUS_OK if everything is OK. ->srv and ->target are assigned. - * SRV_STATUS_NOSRV if no server is available. Session is not ASSIGNED - * SRV_STATUS_FULL if all servers are saturated. Session is not ASSIGNED + * SRV_STATUS_NOSRV if no server is available. Stream is not ASSIGNED + * SRV_STATUS_FULL if all servers are saturated. Stream is not ASSIGNED * SRV_STATUS_INTERNAL for other unrecoverable errors. * - * Upon successful return, the session flag SN_ASSIGNED is set to indicate that + * Upon successful return, the stream flag SN_ASSIGNED is set to indicate that * it does not need to be called anymore. This means that target_srv(&s->target) * can be trusted in balance and direct modes. * */ -int assign_server(struct session *s) +int assign_server(struct stream *s) { struct connection *conn; struct server *conn_slot; @@ -559,7 +559,7 @@ int assign_server(struct session *s) server_has_room(__objt_server(conn->target)) || (__objt_server(conn->target)->nbpend + 1) < s->be->max_ka_queue))) && srv_is_usable(__objt_server(conn->target))) { - /* This session was relying on a server in a previous request + /* This stream was relying on a server in a previous request * and the proxy has "option prefer-last-server" set, so * let's try to reuse the same server. */ @@ -729,7 +729,7 @@ int assign_server(struct session *s) } /* - * This function assigns a server address to a session, and sets SN_ADDR_SET. + * This function assigns a server address to a stream, and sets SN_ADDR_SET. * The address is taken from the currently assigned server, or from the * dispatch or transparent address. * @@ -737,14 +737,14 @@ int assign_server(struct session *s) * SRV_STATUS_OK if everything is OK. * SRV_STATUS_INTERNAL for other unrecoverable errors. * - * Upon successful return, the session flag SN_ADDR_SET is set. This flag is + * Upon successful return, the stream flag SN_ADDR_SET is set. This flag is * not cleared, so it's to the caller to clear it if required. * * The caller is responsible for having already assigned a connection * to si->end. * */ -int assign_server_address(struct session *s) +int assign_server_address(struct stream *s) { struct connection *cli_conn = objt_conn(s->si[0].end); struct connection *srv_conn = objt_conn(s->si[1].end); @@ -754,7 +754,7 @@ int assign_server_address(struct session *s) #endif if ((s->flags & SN_DIRECT) || (s->be->lbprm.algo & BE_LB_KIND)) { - /* A server is necessarily known for this session */ + /* A server is necessarily known for this stream */ if (!(s->flags & SN_ASSIGNED)) return SRV_STATUS_INTERNAL; @@ -817,13 +817,13 @@ int assign_server_address(struct session *s) return SRV_STATUS_OK; } -/* This function assigns a server to session if required, and can add the +/* This function assigns a server to stream if required, and can add the * connection to either the assigned server's queue or to the proxy's queue. - * If ->srv_conn is set, the session is first released from the server. + * If ->srv_conn is set, the stream is first released from the server. * It may also be called with SN_DIRECT and/or SN_ASSIGNED though. It will * be called before any connection and after any retry or redispatch occurs. * - * It is not allowed to call this function with a session in a queue. + * It is not allowed to call this function with a stream in a queue. * * Returns : * @@ -836,7 +836,7 @@ int assign_server_address(struct session *s) * SRV_STATUS_INTERNAL for other unrecoverable errors. * */ -int assign_server_and_queue(struct session *s) +int assign_server_and_queue(struct stream *s) { struct pendconn *p; struct server *srv; @@ -851,8 +851,8 @@ int assign_server_and_queue(struct session *s) err = assign_server(s); if (prev_srv) { - /* This session was previously assigned to a server. We have to - * update the session's and the server's stats : + /* This stream was previously assigned to a server. We have to + * update the stream's and the server's stats : * - if the server changed : * - set TX_CK_DOWN if txn.flags was TX_CK_VALID * - set SN_REDISP if it was successfully redispatched @@ -886,7 +886,7 @@ int assign_server_and_queue(struct session *s) if (s->srv_conn == srv) return SRV_STATUS_OK; - /* OK, this session already has an assigned server, but no + /* OK, this stream already has an assigned server, but no * connection slot yet. Either it is a redispatch, or it was * assigned from persistence information (direct mode). */ @@ -898,7 +898,7 @@ int assign_server_and_queue(struct session *s) return SRV_STATUS_OK; } - /* We might have to queue this session if the assigned server is full. + /* We might have to queue this stream if the assigned server is full. * We know we have to queue it into the server's queue, so if a maxqueue * is set on the server, we must also check that the server's queue is * not full, in which case we have to return FULL. @@ -921,7 +921,7 @@ int assign_server_and_queue(struct session *s) return SRV_STATUS_OK; case SRV_STATUS_FULL: - /* queue this session into the proxy's queue */ + /* queue this stream into the proxy's queue */ p = pendconn_add(s); if (p) return SRV_STATUS_QUEUED; @@ -941,10 +941,10 @@ int assign_server_and_queue(struct session *s) /* If an explicit source binding is specified on the server and/or backend, and * this source makes use of the transparent proxy, then it is extracted now and - * assigned to the session's pending connection. This function assumes that an + * assigned to the stream's pending connection. This function assumes that an * outgoing connection has already been assigned to s->si[1].end. */ -static void assign_tproxy_address(struct session *s) +static void assign_tproxy_address(struct stream *s) { #if defined(CONFIG_HAP_CTTPROXY) || defined(CONFIG_HAP_TRANSPARENT) struct server *srv = objt_server(s->target); @@ -1000,7 +1000,7 @@ static void assign_tproxy_address(struct session *s) /* - * This function initiates a connection to the server assigned to this session + * This function initiates a connection to the server assigned to this stream * (s->target, s->si[1].addr.to). It will assign a server if none * is assigned yet. * It can return one of : @@ -1014,7 +1014,7 @@ static void assign_tproxy_address(struct session *s) * The server-facing stream interface is expected to hold a pre-allocated connection * in s->si[1].conn. */ -int connect_server(struct session *s) +int connect_server(struct stream *s) { struct connection *cli_conn; struct connection *srv_conn; @@ -1054,7 +1054,7 @@ int connect_server(struct session *s) } if (!conn_xprt_ready(srv_conn)) { - /* the target was only on the session, assign it to the SI now */ + /* the target was only on the stream, assign it to the SI now */ srv_conn->target = s->target; /* set the correct protocol on the output stream interface */ @@ -1127,7 +1127,7 @@ int connect_server(struct session *s) * that the connection is ready to use. */ -int srv_redispatch_connect(struct session *s) +int srv_redispatch_connect(struct stream *s) { struct server *srv; int conn_err; @@ -1177,7 +1177,7 @@ int srv_redispatch_connect(struct session *s) case SRV_STATUS_QUEUED: s->si[1].exp = tick_add_ifset(now_ms, s->be->timeout.queue); s->si[1].state = SI_ST_QUE; - /* do nothing else and do not wake any other session up */ + /* do nothing else and do not wake any other stream up */ return 1; case SRV_STATUS_INTERNAL: @@ -1194,7 +1194,7 @@ int srv_redispatch_connect(struct session *s) srv->counters.failed_conns++; s->be->be_counters.failed_conns++; - /* release other sessions waiting for this server */ + /* release other streams waiting for this server */ if (may_dequeue_tasks(srv, s->be)) process_srv_queue(srv); return 1; @@ -1217,13 +1217,13 @@ void set_backend_down(struct proxy *be) send_log(be, LOG_EMERG, "%s %s has no server available!\n", proxy_type_str(be), be->id); } -/* Apply RDP cookie persistence to the current session. For this, the function +/* Apply RDP cookie persistence to the current stream. For this, the function * tries to extract an RDP cookie from the request buffer, and look for the * matching server in the list. If the server is found, it is assigned to the - * session. This always returns 1, and the analyser removes itself from the + * stream. 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 channel *req, int an_bit) +int tcp_persist_rdp_cookie(struct stream *s, struct channel *req, int an_bit) { struct proxy *px = s->be; int ret; @@ -1232,7 +1232,7 @@ int tcp_persist_rdp_cookie(struct session *s, struct channel *req, int an_bit) struct sockaddr_in addr; char *p; - DPRINTF(stderr,"[%u] %s: session=%p b=%p, exp(r,w)=%u,%u bf=%08x bh=%d analysers=%02x\n", + DPRINTF(stderr,"[%u] %s: stream=%p b=%p, exp(r,w)=%u,%u bf=%08x bh=%d analysers=%02x\n", now_ms, __FUNCTION__, s, req, @@ -1483,7 +1483,7 @@ int backend_parse_balance(const char **args, char **err, struct proxy *curproxy) * undefined behaviour. */ static int -smp_fetch_nbsrv(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_nbsrv(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { smp->flags = SMP_F_VOL_TEST; @@ -1506,7 +1506,7 @@ smp_fetch_nbsrv(struct proxy *px, struct session *l4, void *l7, unsigned int opt * undefined behaviour. */ static int -smp_fetch_srv_is_up(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_srv_is_up(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct server *srv = args->data.srv; @@ -1526,7 +1526,7 @@ smp_fetch_srv_is_up(struct proxy *px, struct session *l4, void *l7, unsigned int * undefined behaviour. */ static int -smp_fetch_connslots(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_connslots(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct server *iterator; @@ -1554,7 +1554,7 @@ smp_fetch_connslots(struct proxy *px, struct session *l4, void *l7, unsigned int /* set temp integer to the id of the backend */ static int -smp_fetch_be_id(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_be_id(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { smp->flags = SMP_F_VOL_TXN; @@ -1565,7 +1565,7 @@ smp_fetch_be_id(struct proxy *px, struct session *l4, void *l7, unsigned int opt /* set temp integer to the id of the server */ static int -smp_fetch_srv_id(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_srv_id(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { if (!objt_server(l4->target)) @@ -1582,7 +1582,7 @@ smp_fetch_srv_id(struct proxy *px, struct session *l4, void *l7, unsigned int op * undefined behaviour. */ static int -smp_fetch_be_sess_rate(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_be_sess_rate(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { smp->flags = SMP_F_VOL_TEST; @@ -1596,7 +1596,7 @@ smp_fetch_be_sess_rate(struct proxy *px, struct session *l4, void *l7, unsigned * undefined behaviour. */ static int -smp_fetch_be_conn(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_be_conn(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { smp->flags = SMP_F_VOL_TEST; @@ -1610,7 +1610,7 @@ smp_fetch_be_conn(struct proxy *px, struct session *l4, void *l7, unsigned int o * undefined behaviour. */ static int -smp_fetch_queue_size(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_queue_size(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { smp->flags = SMP_F_VOL_TEST; @@ -1628,7 +1628,7 @@ smp_fetch_queue_size(struct proxy *px, struct session *l4, void *l7, unsigned in * undefined behaviour. */ static int -smp_fetch_avg_queue_size(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_avg_queue_size(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { int nbsrv; @@ -1657,7 +1657,7 @@ smp_fetch_avg_queue_size(struct proxy *px, struct session *l4, void *l7, unsigne * undefined behaviour. */ static int -smp_fetch_srv_conn(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_srv_conn(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { smp->flags = SMP_F_VOL_TEST; @@ -1671,7 +1671,7 @@ smp_fetch_srv_conn(struct proxy *px, struct session *l4, void *l7, unsigned int * undefined behaviour. */ static int -smp_fetch_srv_sess_rate(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_srv_sess_rate(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { smp->flags = SMP_F_VOL_TEST; diff --git a/src/cfgparse.c b/src/cfgparse.c index b17527d68..92f072e4d 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -74,7 +74,7 @@ #include #include #include -#include +#include #include #include #include @@ -1884,8 +1884,8 @@ int cfg_parse_peers(const char *file, int linenum, char **args, int kwm) l->maxaccept = 1; l->maxconn = ((struct proxy *)curpeers->peers_fe)->maxconn; l->backlog = ((struct proxy *)curpeers->peers_fe)->backlog; - l->accept = session_accept; - l->handler = process_session; + l->accept = stream_accept; + l->handler = process_stream; l->analysers |= ((struct proxy *)curpeers->peers_fe)->fe_req_ana; l->default_target = ((struct proxy *)curpeers->peers_fe)->default_target; l->options |= LI_O_UNLIMITED; /* don't make the peers subject to global limits */ @@ -4112,7 +4112,7 @@ stats_error_parsing: curproxy->conf.lfs_line = curproxy->conf.args.line; } else if (!strcmp(args[1], "tcpka")) { - /* enable TCP keep-alives on client and server sessions */ + /* enable TCP keep-alives on client and server streams */ if (warnifnotcap(curproxy, PR_CAP_BE | PR_CAP_FE, file, linenum, args[1], NULL)) err_code |= ERR_WARN; @@ -7708,8 +7708,8 @@ out_uri_auth_compat: listener->maxaccept = (listener->maxaccept + nbproc - 1) / nbproc; } - listener->accept = session_accept; - listener->handler = process_session; + listener->accept = stream_accept; + listener->handler = process_stream; listener->analysers |= curproxy->fe_req_ana; listener->default_target = curproxy->default_target; diff --git a/src/checks.c b/src/checks.c index 89e5eeeb3..b3a005b35 100644 --- a/src/checks.c +++ b/src/checks.c @@ -57,7 +57,6 @@ #include #include #include -#include #include #include diff --git a/src/compression.c b/src/compression.c index 9900d718c..feade6b38 100644 --- a/src/compression.c +++ b/src/compression.c @@ -157,7 +157,7 @@ int http_emit_chunk_size(char *end, unsigned int chksz) /* * Init HTTP compression */ -int http_compression_buffer_init(struct session *s, struct buffer *in, struct buffer *out) +int http_compression_buffer_init(struct stream *s, struct buffer *in, struct buffer *out) { /* output stream requires at least 10 bytes for the gzip header, plus * at least 8 bytes for the gzip trailer (crc+len), plus a possible @@ -181,7 +181,7 @@ int http_compression_buffer_init(struct session *s, struct buffer *in, struct bu /* * Add data to compress */ -int http_compression_buffer_add_data(struct session *s, struct buffer *in, struct buffer *out) +int http_compression_buffer_add_data(struct stream *s, struct buffer *in, struct buffer *out) { struct http_msg *msg = &s->txn.rsp; int consumed_data = 0; @@ -229,7 +229,7 @@ int http_compression_buffer_add_data(struct session *s, struct buffer *in, struc * Flush data in process, and write the header and footer of the chunk. Upon * success, in and out buffers are swapped to avoid a copy. */ -int http_compression_buffer_end(struct session *s, struct buffer **in, struct buffer **out, int end) +int http_compression_buffer_end(struct stream *s, struct buffer **in, struct buffer **out, int end) { int to_forward; int left; @@ -837,7 +837,7 @@ static int deflate_end(struct comp_ctx **comp_ctx) /* boolean, returns true if compression is used (either gzip or deflate) in the response */ static int -smp_fetch_res_comp(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_res_comp(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { smp->type = SMP_T_BOOL; @@ -847,7 +847,7 @@ smp_fetch_res_comp(struct proxy *px, struct session *l4, void *l7, unsigned int /* string, returns algo */ static int -smp_fetch_res_comp_algo(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_res_comp_algo(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { if (!l4->comp_algo) diff --git a/src/connection.c b/src/connection.c index efcd6e123..21fd8fe61 100644 --- a/src/connection.c +++ b/src/connection.c @@ -20,7 +20,6 @@ #include #include #include -#include #include #ifdef USE_OPENSSL diff --git a/src/dumpstats.c b/src/dumpstats.c index c23e9888b..5f663b6ac 100644 --- a/src/dumpstats.c +++ b/src/dumpstats.c @@ -56,7 +56,7 @@ #include #include #include -#include +#include #include #include #include @@ -76,7 +76,7 @@ enum { STAT_CLI_PRINT, /* display message in cli->msg */ STAT_CLI_PRINT_FREE, /* display message in cli->msg. After the display, free the pointer */ STAT_CLI_O_INFO, /* dump info */ - STAT_CLI_O_SESS, /* dump sessions */ + STAT_CLI_O_SESS, /* dump streams */ STAT_CLI_O_ERR, /* dump errors */ STAT_CLI_O_TAB, /* dump tables */ STAT_CLI_O_CLR, /* clear tables */ @@ -123,7 +123,7 @@ enum { static int stats_dump_info_to_buffer(struct stream_interface *si); static int stats_dump_pools_to_buffer(struct stream_interface *si); -static int stats_dump_full_sess_to_buffer(struct stream_interface *si, struct session *sess); +static int stats_dump_full_sess_to_buffer(struct stream_interface *si, struct stream *sess); static int stats_dump_sess_to_buffer(struct stream_interface *si); static int stats_dump_errors_to_buffer(struct stream_interface *si); static int stats_table_request(struct stream_interface *si, int show); @@ -337,8 +337,8 @@ static int stats_parse_global(char **args, int section_type, struct proxy *curpx list_for_each_entry(l, &bind_conf->listeners, by_bind) { l->maxconn = global.stats_fe->maxconn; l->backlog = global.stats_fe->backlog; - l->accept = session_accept; - l->handler = process_session; + l->accept = stream_accept; + l->handler = process_stream; l->default_target = global.stats_fe->default_target; l->options |= LI_O_UNLIMITED; /* don't make the peers subject to global limits */ l->nice = -64; /* we want to boost priority for local stats */ @@ -544,7 +544,7 @@ static int dump_binary(struct chunk *out, const char *buf, int bsize) static int stats_dump_table_head_to_buffer(struct chunk *msg, struct stream_interface *si, struct proxy *proxy, struct proxy *target) { - struct session *s = si_sess(si); + struct stream *s = si_strm(si); chunk_appendf(msg, "# table: %s, type: %s, size:%d, used:%d\n", proxy->id, stktable_types[proxy->table.type].kw, proxy->table.size, proxy->table.current); @@ -637,7 +637,7 @@ static int stats_dump_table_entry_to_buffer(struct chunk *msg, struct stream_int static void stats_sock_table_key_request(struct stream_interface *si, char **args, int action) { - struct session *s = si_sess(si); + struct stream *s = si_strm(si); struct appctx *appctx = __objt_appctx(si->end); struct proxy *px = appctx->ctx.table.target; struct stksess *ts; @@ -897,10 +897,10 @@ err_args: } /* Expects to find a frontend named and returns it, otherwise displays various - * adequate error messages and returns NULL. This function also expects the session + * adequate error messages and returns NULL. This function also expects the stream * level to be admin. */ -static struct proxy *expect_frontend_admin(struct session *s, struct stream_interface *si, const char *arg) +static struct proxy *expect_frontend_admin(struct stream *s, struct stream_interface *si, const char *arg) { struct appctx *appctx = __objt_appctx(si->end); struct proxy *px; @@ -928,10 +928,10 @@ static struct proxy *expect_frontend_admin(struct session *s, struct stream_inte /* Expects to find a backend and a server in under the form /, * and returns the pointer to the server. Otherwise, display adequate error messages - * and returns NULL. This function also expects the session level to be admin. Note: + * and returns NULL. This function also expects the stream level to be admin. Note: * the is modified to remove the '/'. */ -static struct server *expect_server_admin(struct session *s, struct stream_interface *si, char *arg) +static struct server *expect_server_admin(struct stream *s, struct stream_interface *si, char *arg) { struct appctx *appctx = __objt_appctx(si->end); struct proxy *px; @@ -1040,7 +1040,7 @@ struct pattern_expr *pat_expr_get_next(struct pattern_expr *getnext, struct list */ static int stats_sock_parse_request(struct stream_interface *si, char *line) { - struct session *s = si_sess(si); + struct stream *s = si_strm(si); struct appctx *appctx = __objt_appctx(si->end); char *args[MAX_STATS_ARGS + 1]; int arg; @@ -1122,7 +1122,7 @@ static int stats_sock_parse_request(struct stream_interface *si, char *line) appctx->ctx.sess.target = (void *)strtoul(args[2], NULL, 0); else appctx->ctx.sess.target = NULL; - appctx->ctx.sess.section = 0; /* start with session status */ + appctx->ctx.sess.section = 0; /* start with stream status */ appctx->ctx.sess.pos = 0; appctx->st0 = STAT_CLI_O_SESS; // stats_dump_sess_to_buffer } @@ -1979,7 +1979,7 @@ static int stats_sock_parse_request(struct stream_interface *si, char *line) return 1; } else if (strcmp(args[1], "session") == 0) { - struct session *sess, *ptr; + struct stream *sess, *ptr; if (s->listener->bind_conf->level < ACCESS_LVL_ADMIN) { appctx->ctx.cli.msg = stats_permission_denied_msg; @@ -1995,35 +1995,35 @@ static int stats_sock_parse_request(struct stream_interface *si, char *line) ptr = (void *)strtoul(args[2], NULL, 0); - /* first, look for the requested session in the session table */ - list_for_each_entry(sess, &sessions, list) { + /* first, look for the requested stream in the stream table */ + list_for_each_entry(sess, &streams, list) { if (sess == ptr) break; } - /* do we have the session ? */ + /* do we have the stream ? */ if (sess != ptr) { appctx->ctx.cli.msg = "No such session (use 'show sess').\n"; appctx->st0 = STAT_CLI_PRINT; return 1; } - session_shutdown(sess, SN_ERR_KILLED); + stream_shutdown(sess, SN_ERR_KILLED); return 1; } else if (strcmp(args[1], "sessions") == 0) { if (strcmp(args[2], "server") == 0) { struct server *sv; - struct session *sess, *sess_bck; + struct stream *sess, *sess_bck; sv = expect_server_admin(s, si, args[3]); if (!sv) return 1; - /* kill all the session that are on this server */ + /* kill all the stream that are on this server */ list_for_each_entry_safe(sess, sess_bck, &sv->actconns, by_srv) if (sess->srv_conn == sv) - session_shutdown(sess, SN_ERR_KILLED); + stream_shutdown(sess, SN_ERR_KILLED); return 1; } @@ -3727,7 +3727,7 @@ static void stats_dump_html_px_end(struct stream_interface *si, struct proxy *px static int stats_dump_proxy_to_buffer(struct stream_interface *si, struct proxy *px, struct uri_auth *uri) { struct appctx *appctx = __objt_appctx(si->end); - struct session *s = si_sess(si); + struct stream *s = si_strm(si); struct channel *rep = si_ic(si); struct server *sv, *svs; /* server and server-state, server-state=server or server->track */ struct listener *l; @@ -4306,7 +4306,7 @@ static void stats_dump_html_end() * either CSV or HTML format. contains some HTML-specific parameters that * are ignored for CSV format (hence may be NULL there). It returns 0 if * it had to stop writing data and an I/O is needed, 1 if the dump is finished - * and the session must be closed, or -1 in case of any error. This function is + * and the stream must be closed, or -1 in case of any error. This function is * used by both the CLI and the HTTP handlers. */ static int stats_dump_stat_to_buffer(struct stream_interface *si, struct uri_auth *uri) @@ -4401,7 +4401,7 @@ static int stats_dump_stat_to_buffer(struct stream_interface *si, struct uri_aut */ static int stats_process_http_post(struct stream_interface *si) { - struct session *s = si_sess(si); + struct stream *s = si_strm(si); struct appctx *appctx = objt_appctx(si->end); struct proxy *px = NULL; @@ -4670,11 +4670,11 @@ static int stats_process_http_post(struct stream_interface *si) break; case ST_ADM_ACTION_SHUTDOWN: if (px->state != PR_STSTOPPED) { - struct session *sess, *sess_bck; + struct stream *sess, *sess_bck; list_for_each_entry_safe(sess, sess_bck, &sv->actconns, by_srv) if (sess->srv_conn == sv) - session_shutdown(sess, SN_ERR_KILLED); + stream_shutdown(sess, SN_ERR_KILLED); altered_servers++; total_servers++; @@ -4720,7 +4720,7 @@ static int stats_process_http_post(struct stream_interface *si) static int stats_send_http_headers(struct stream_interface *si) { - struct session *s = si_sess(si); + struct stream *s = si_strm(si); struct uri_auth *uri = s->be->uri_auth; struct appctx *appctx = objt_appctx(si->end); @@ -4756,7 +4756,7 @@ static int stats_send_http_headers(struct stream_interface *si) static int stats_send_http_redirect(struct stream_interface *si) { char scope_txt[STAT_SCOPE_TXT_MAXLEN + sizeof STAT_SCOPE_PATTERN]; - struct session *s = si_sess(si); + struct stream *s = si_strm(si); struct uri_auth *uri = s->be->uri_auth; struct appctx *appctx = objt_appctx(si->end); @@ -4808,7 +4808,7 @@ static int stats_send_http_redirect(struct stream_interface *si) static void http_stats_io_handler(struct stream_interface *si) { struct appctx *appctx = __objt_appctx(si->end); - struct session *s = si_sess(si); + struct stream *s = si_strm(si); struct channel *req = si_oc(si); struct channel *res = si_ic(si); @@ -4978,12 +4978,12 @@ static inline const char *get_conn_data_name(const struct connection *conn) return ptr; } -/* This function dumps a complete session state onto the stream interface's - * read buffer. The session has to be set in sess->target. It returns +/* This function dumps a complete stream state onto the stream interface's + * read buffer. The stream has to be set in sess->target. It returns * 0 if the output buffer is full and it needs to be called again, otherwise * non-zero. It is designed to be called from stats_dump_sess_to_buffer() below. */ -static int stats_dump_full_sess_to_buffer(struct stream_interface *si, struct session *sess) +static int stats_dump_full_sess_to_buffer(struct stream_interface *si, struct stream *sess) { struct appctx *appctx = __objt_appctx(si->end); struct tm tm; @@ -4995,7 +4995,7 @@ static int stats_dump_full_sess_to_buffer(struct stream_interface *si, struct se chunk_reset(&trash); if (appctx->ctx.sess.section > 0 && appctx->ctx.sess.uid != sess->uniq_id) { - /* session changed, no need to go any further */ + /* stream changed, no need to go any further */ chunk_appendf(&trash, " *** session terminated while we were watching it ***\n"); if (bi_putchk(si_ic(si), &trash) == -1) { si->flags |= SI_FL_WAIT_ROOM; @@ -5007,7 +5007,7 @@ static int stats_dump_full_sess_to_buffer(struct stream_interface *si, struct se } switch (appctx->ctx.sess.section) { - case 0: /* main status of the session */ + case 0: /* main status of the stream */ appctx->ctx.sess.uid = sess->uniq_id; appctx->ctx.sess.section = 1; /* fall through */ @@ -5332,8 +5332,8 @@ static int stats_pats_list(struct stream_interface *si) appctx->ctx.map.ref->display); if (bi_putchk(si_ic(si), &trash) == -1) { - /* let's try again later from this session. We add ourselves into - * this session's users so that it can remove us upon termination. + /* let's try again later from this stream. We add ourselves into + * this stream's users so that it can remove us upon termination. */ si->flags |= SI_FL_WAIT_ROOM; return 0; @@ -5451,8 +5451,8 @@ static int stats_map_lookup(struct stream_interface *si) /* display response */ if (bi_putchk(si_ic(si), &trash) == -1) { - /* let's try again later from this session. We add ourselves into - * this session's users so that it can remove us upon termination. + /* let's try again later from this stream. We add ourselves into + * this stream's users so that it can remove us upon termination. */ si->flags |= SI_FL_WAIT_ROOM; return 0; @@ -5502,8 +5502,8 @@ static int stats_pat_list(struct stream_interface *si) appctx->ctx.map.elt, appctx->ctx.map.elt->pattern); if (bi_putchk(si_ic(si), &trash) == -1) { - /* let's try again later from this session. We add ourselves into - * this session's users so that it can remove us upon termination. + /* let's try again later from this stream. We add ourselves into + * this stream's users so that it can remove us upon termination. */ si->flags |= SI_FL_WAIT_ROOM; return 0; @@ -5525,7 +5525,7 @@ static int stats_pat_list(struct stream_interface *si) } } -/* This function dumps all sessions' states onto the stream interface's +/* This function dumps all streams' states onto the stream interface's * read buffer. It returns 0 if the output buffer is full and it needs * to be called again, otherwise non-zero. It is designed to be called * from stats_dump_sess_to_buffer() below. @@ -5537,7 +5537,7 @@ static int stats_dump_sess_to_buffer(struct stream_interface *si) if (unlikely(si_ic(si)->flags & (CF_WRITE_ERROR|CF_SHUTW))) { /* If we're forced to shut down, we might have to remove our - * reference to the last session being dumped. + * reference to the last stream being dumped. */ if (appctx->st2 == STAT_ST_LIST) { if (!LIST_ISEMPTY(&appctx->ctx.sess.bref.users)) { @@ -5553,30 +5553,30 @@ static int stats_dump_sess_to_buffer(struct stream_interface *si) switch (appctx->st2) { case STAT_ST_INIT: /* the function had not been called yet, let's prepare the - * buffer for a response. We initialize the current session + * buffer for a response. We initialize the current stream * pointer to the first in the global list. When a target - * session is being destroyed, it is responsible for updating + * stream is being destroyed, it is responsible for updating * this pointer. We know we have reached the end when this - * pointer points back to the head of the sessions list. + * pointer points back to the head of the streams list. */ LIST_INIT(&appctx->ctx.sess.bref.users); - appctx->ctx.sess.bref.ref = sessions.n; + appctx->ctx.sess.bref.ref = streams.n; appctx->st2 = STAT_ST_LIST; /* fall through */ case STAT_ST_LIST: - /* first, let's detach the back-ref from a possible previous session */ + /* first, let's detach the back-ref from a possible previous stream */ if (!LIST_ISEMPTY(&appctx->ctx.sess.bref.users)) { LIST_DEL(&appctx->ctx.sess.bref.users); LIST_INIT(&appctx->ctx.sess.bref.users); } /* and start from where we stopped */ - while (appctx->ctx.sess.bref.ref != &sessions) { + while (appctx->ctx.sess.bref.ref != &streams) { char pn[INET6_ADDRSTRLEN]; - struct session *curr_sess; + struct stream *curr_sess; - curr_sess = LIST_ELEM(appctx->ctx.sess.bref.ref, struct session *, list); + curr_sess = LIST_ELEM(appctx->ctx.sess.bref.ref, struct stream *, list); if (appctx->ctx.sess.target) { if (appctx->ctx.sess.target != (void *)-1 && appctx->ctx.sess.target != curr_sess) @@ -5587,7 +5587,7 @@ static int stats_dump_sess_to_buffer(struct stream_interface *si) if (!stats_dump_full_sess_to_buffer(si, curr_sess)) return 0; - /* session dump complete */ + /* stream dump complete */ LIST_DEL(&appctx->ctx.sess.bref.users); LIST_INIT(&appctx->ctx.sess.bref.users); if (appctx->ctx.sess.target != (void *)-1) { @@ -5707,8 +5707,8 @@ static int stats_dump_sess_to_buffer(struct stream_interface *si) chunk_appendf(&trash, "\n"); if (bi_putchk(si_ic(si), &trash) == -1) { - /* let's try again later from this session. We add ourselves into - * this session's users so that it can remove us upon termination. + /* let's try again later from this stream. We add ourselves into + * this stream's users so that it can remove us upon termination. */ si->flags |= SI_FL_WAIT_ROOM; LIST_ADDQ(&curr_sess->back_refs, &appctx->ctx.sess.bref.users); @@ -5720,7 +5720,7 @@ static int stats_dump_sess_to_buffer(struct stream_interface *si) } if (appctx->ctx.sess.target && appctx->ctx.sess.target != (void *)-1) { - /* specified session not found */ + /* specified stream not found */ if (appctx->ctx.sess.section > 0) chunk_appendf(&trash, " *** session terminated while we were watching it ***\n"); else @@ -5747,7 +5747,7 @@ static int stats_dump_sess_to_buffer(struct stream_interface *si) /* This is called when the stream interface is closed. For instance, upon an * external abort, we won't call the i/o handler anymore so we may need to - * remove back references to the session currently being dumped. + * remove back references to the stream currently being dumped. */ static void cli_release_handler(struct stream_interface *si) { @@ -5773,7 +5773,7 @@ static void cli_release_handler(struct stream_interface *si) static int stats_table_request(struct stream_interface *si, int action) { struct appctx *appctx = __objt_appctx(si->end); - struct session *s = si_sess(si); + struct stream *s = si_strm(si); struct ebmb_node *eb; int dt; int skip_entry; diff --git a/src/frontend.c b/src/frontend.c index 48dabe898..b793ff816 100644 --- a/src/frontend.c +++ b/src/frontend.c @@ -42,17 +42,17 @@ #include #include #include -#include +#include #include #include -/* Finish a session accept() for a proxy (TCP or HTTP). It returns a negative +/* Finish a stream accept() for a proxy (TCP or HTTP). It returns a negative * value in case of a critical failure which must cause the listener to be * disabled, a positive value in case of success, or zero if it is a success - * but the session must be closed ASAP (eg: monitoring). It only supports - * sessions with a connection in si[0]. + * but the stream must be closed ASAP (eg: monitoring). It only supports + * streams with a connection in si[0]. */ -int frontend_accept(struct session *s) +int frontend_accept(struct stream *s) { struct connection *conn = __objt_conn(s->si[0].end); int cfd = conn->t.sock.fd; @@ -69,7 +69,7 @@ int frontend_accept(struct session *s) /* FIXME: the logs are horribly complicated now, because they are * defined in

,

, and later and . */ - s->do_log = sess_log; + s->do_log = strm_log; /* default error reporting function, may be changed by analysers */ s->srv_error = default_srv_error; @@ -218,7 +218,7 @@ int frontend_accept(struct session *s) /* set temp integer to the id of the frontend */ static int -smp_fetch_fe_id(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_fe_id(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { smp->flags = SMP_F_VOL_SESS; @@ -232,7 +232,7 @@ smp_fetch_fe_id(struct proxy *px, struct session *l4, void *l7, unsigned int opt * an undefined behaviour. */ static int -smp_fetch_fe_sess_rate(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_fe_sess_rate(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { smp->flags = SMP_F_VOL_TEST; @@ -246,7 +246,7 @@ smp_fetch_fe_sess_rate(struct proxy *px, struct session *l4, void *l7, unsigned * an undefined behaviour. */ static int -smp_fetch_fe_conn(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_fe_conn(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { smp->flags = SMP_F_VOL_TEST; diff --git a/src/haproxy.c b/src/haproxy.c index 8063f37b9..11b781038 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -97,7 +97,7 @@ #include #include #include -#include +#include #include #include @@ -559,7 +559,7 @@ void init(int argc, char **argv) if (init_acl() != 0) exit(1); init_task(); - init_session(); + init_stream(); init_connection(); /* warning, we init buffers later */ init_pendconn(); @@ -840,7 +840,7 @@ void init(int argc, char **argv) mem = mem * MEM_USABLE_RATIO; global.maxconn = mem / - ((SESSION_MAX_COST + 2 * global.tune.bufsize) + // session + 2 buffers per session + ((STREAM_MAX_COST + 2 * global.tune.bufsize) + // stream + 2 buffers per stream sides * global.ssl_session_max_cost + // SSL buffers, one per side global.ssl_handshake_max_cost); // 1 handshake per connection max @@ -870,7 +870,7 @@ void init(int argc, char **argv) mem -= global.maxzlibmem; mem = mem * MEM_USABLE_RATIO; - sslmem = mem - global.maxconn * (int64_t)(SESSION_MAX_COST + 2 * global.tune.bufsize); + sslmem = mem - global.maxconn * (int64_t)(STREAM_MAX_COST + 2 * global.tune.bufsize); global.maxsslconn = sslmem / (global.ssl_session_max_cost + global.ssl_handshake_max_cost); global.maxsslconn = round_2dig(global.maxsslconn); @@ -879,7 +879,7 @@ void init(int argc, char **argv) "high for the global.memmax value (%d MB). The absolute maximum possible value " "without SSL is %d, but %d was found and SSL is in use.\n", global.rlimit_memmax, - (int)(mem / (SESSION_MAX_COST + 2 * global.tune.bufsize)), + (int)(mem / (STREAM_MAX_COST + 2 * global.tune.bufsize)), global.maxconn); exit(1); } @@ -907,7 +907,7 @@ void init(int argc, char **argv) if (sides) clearmem -= (global.ssl_session_max_cost + global.ssl_handshake_max_cost) * (int64_t)global.maxsslconn; - global.maxconn = clearmem / (SESSION_MAX_COST + 2 * global.tune.bufsize); + global.maxconn = clearmem / (STREAM_MAX_COST + 2 * global.tune.bufsize); global.maxconn = round_2dig(global.maxconn); #ifdef SYSTEM_MAXCONN if (global.maxconn > DEFAULT_MAXCONN) @@ -1430,7 +1430,7 @@ void deinit(void) free(wl); } - pool_destroy2(pool2_session); + pool_destroy2(pool2_stream); pool_destroy2(pool2_connection); pool_destroy2(pool2_buffer); pool_destroy2(pool2_requri); diff --git a/src/hlua.c b/src/hlua.c index c8a0cc5cd..4b04f876d 100644 --- a/src/hlua.c +++ b/src/hlua.c @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include #include @@ -77,7 +77,7 @@ static int class_converters_ref; static int class_http_ref; /* Global Lua execution timeout. By default Lua, execution linked - * with session (actions, sample-fetches and converters) have a + * with stream (actions, sample-fetches and converters) have a * short timeout. Lua linked with tasks doesn't have a timeout * because a task may remain alive during all the haproxy execution. */ @@ -792,8 +792,8 @@ __LJMP void hlua_yieldk(lua_State *L, int nresults, int ctx, WILL_LJMP(lua_yieldk(L, nresults, ctx, k)); } -/* This function initialises the Lua environment stored in the session. - * It must be called at the start of the session. This function creates +/* This function initialises the Lua environment stored in the stream. + * It must be called at the start of the stream. This function creates * an LUA coroutine. It can not be use to crete the main LUA context. */ int hlua_ctx_init(struct hlua *lua, struct task *task) @@ -812,7 +812,7 @@ int hlua_ctx_init(struct hlua *lua, struct task *task) return 1; } -/* Used to destroy the Lua coroutine when the attached session or task +/* Used to destroy the Lua coroutine when the attached stream or task * is destroyed. The destroy also the memory context. The struct "lua" * is not freed. */ @@ -1286,7 +1286,7 @@ static void hlua_socket_handler(struct stream_interface *si) struct appctx *appctx = objt_appctx(si->end); struct connection *c = objt_conn(si_opposite(si)->end); - /* Wakeup the main session if the client connection is closed. */ + /* Wakeup the main stream if the client connection is closed. */ if (!c || channel_output_closed(si_ic(si)) || channel_input_closed(si_oc(si))) { if (appctx->ctx.hlua.socket) { appctx->ctx.hlua.socket->s = NULL; @@ -1315,8 +1315,8 @@ static void hlua_socket_handler(struct stream_interface *si) hlua_com_wake(&appctx->ctx.hlua.wake_on_read); } -/* This function is called when the "struct session" is destroyed. - * Remove the link from the object to this session. +/* This function is called when the "struct stream" is destroyed. + * Remove the link from the object to this stream. * Wake all the pending signals. */ static void hlua_socket_release(struct stream_interface *si) @@ -1333,8 +1333,8 @@ static void hlua_socket_release(struct stream_interface *si) } /* If the garbage collectio of the object is launch, nobody - * uses this object. If the session does not exists, just quit. - * Send the shutdown signal to the session. In some cases, + * uses this object. If the stream does not exists, just quit. + * Send the shutdown signal to the stream. In some cases, * pending signal can rest in the read and write lists. destroy * it. */ @@ -1349,9 +1349,9 @@ __LJMP static int hlua_socket_gc(lua_State *L) if (!socket->s) return 0; - /* Remove all reference between the Lua stack and the coroutine session. */ + /* Remove all reference between the Lua stack and the coroutine stream. */ appctx = objt_appctx(socket->s->si[0].end); - session_shutdown(socket->s, SN_ERR_KILLED); + stream_shutdown(socket->s, SN_ERR_KILLED); socket->s = NULL; appctx->ctx.hlua.socket = NULL; @@ -1359,7 +1359,7 @@ __LJMP static int hlua_socket_gc(lua_State *L) } /* The close function send shutdown signal and break the - * links between the session and the object. + * links between the stream and the object. */ __LJMP static int hlua_socket_close(lua_State *L) { @@ -1372,8 +1372,8 @@ __LJMP static int hlua_socket_close(lua_State *L) if (!socket->s) return 0; - /* Close the session and remove the associated stop task. */ - session_shutdown(socket->s, SN_ERR_KILLED); + /* Close the stream and remove the associated stop task. */ + stream_shutdown(socket->s, SN_ERR_KILLED); appctx = objt_appctx(socket->s->si[0].end); appctx->ctx.hlua.socket = NULL; socket->s = NULL; @@ -1629,7 +1629,7 @@ static int hlua_socket_write_yield(struct lua_State *L,int status, lua_KContext * the request buffer if its not required. */ if (socket->s->req.buf->size == 0) { - if (!session_alloc_recv_buffer(&socket->s->req)) { + if (!stream_alloc_recv_buffer(&socket->s->req)) { socket->s->si[0].flags |= SI_FL_WAIT_ROOM; goto hlua_socket_write_yield_return; } @@ -2011,12 +2011,12 @@ __LJMP static int hlua_socket_new(lua_State *L) memset(socket, 0, sizeof(*socket)); /* Check if the various memory pools are intialized. */ - if (!pool2_session || !pool2_buffer) { + if (!pool2_stream || !pool2_buffer) { hlua_pusherror(L, "socket: uninitialized pools."); goto out_fail_conf; } - /* Pop a class session metatable and affect it to the userdata. */ + /* Pop a class stream metatable and affect it to the userdata. */ lua_rawgeti(L, LUA_REGISTRYINDEX, class_socket_ref); lua_setmetatable(L, -2); @@ -2026,7 +2026,7 @@ __LJMP static int hlua_socket_new(lua_State *L) * */ - socket->s = pool_alloc2(pool2_session); + socket->s = pool_alloc2(pool2_stream); if (!socket->s) { hlua_pusherror(L, "socket: out of memory"); goto out_fail_conf; @@ -2050,7 +2050,7 @@ __LJMP static int hlua_socket_new(lua_State *L) goto out_fail_rep_buf; } - /* Configura empty Lua for the session. */ + /* Configura empty Lua for the stream. */ socket->s->hlua.T = NULL; socket->s->hlua.Tref = LUA_REFNIL; socket->s->hlua.Mref = LUA_REFNIL; @@ -2058,8 +2058,8 @@ __LJMP static int hlua_socket_new(lua_State *L) socket->s->hlua.flags = 0; LIST_INIT(&socket->s->hlua.com); - /* session initialisation. */ - session_init_srv_conn(socket->s); + /* stream initialisation. */ + stream_init_srv_conn(socket->s); /* * @@ -2067,12 +2067,12 @@ __LJMP static int hlua_socket_new(lua_State *L) * */ - /* This is the dedicated function to process the session. This function + /* This is the dedicated function to process the stream. This function * is able to establish the conection, process the timeouts, etc ... */ - socket->s->task->process = process_session; + socket->s->task->process = process_stream; - /* Back reference to session. This is used by process_session(). */ + /* Back reference to stream. This is used by process_stream(). */ socket->s->task->context = socket->s; /* The priority of the task is normal. */ @@ -2120,11 +2120,11 @@ __LJMP static int hlua_socket_new(lua_State *L) /* * - * Configure the session. + * Configure the stream. * */ - /* The session dont have listener. The listener is used with real + /* The stream dont have listener. The listener is used with real * proxies. */ socket->s->listener = NULL; @@ -2132,7 +2132,7 @@ __LJMP static int hlua_socket_new(lua_State *L) /* The flags are initialized to 0. Values are setted later. */ socket->s->flags = 0; - /* Assign the configured proxy to the new session. */ + /* Assign the configured proxy to the new stream. */ socket->s->be = &socket_proxy; socket->s->fe = &socket_proxy; @@ -2207,8 +2207,8 @@ __LJMP static int hlua_socket_new(lua_State *L) socket->s->flags |= SN_DIRECT | SN_ASSIGNED | SN_ADDR_SET | SN_BE_ASSIGNED; socket->s->target = &socket_tcp.obj_type; - /* This session is added to te lists of alive sessions. */ - LIST_ADDQ(&sessions, &socket->s->list); + /* This stream is added to te lists of alive streams. */ + LIST_ADDQ(&streams, &socket->s->list); /* XXX: I think that this list is used by stats. */ LIST_INIT(&socket->s->back_refs); @@ -2228,7 +2228,7 @@ out_fail_rep_buf: out_fail_req_buf: task_free(socket->s->task); out_free_session: - pool_free2(pool2_session, socket->s); + pool_free2(pool2_stream, socket->s); out_fail_conf: WILL_LJMP(lua_error(L)); return 0; @@ -2509,7 +2509,7 @@ __LJMP static int hlua_channel_send_yield(lua_State *L, int status, lua_KContext * the request buffer if its not required. */ if (chn->buf->size == 0) { - if (!session_alloc_recv_buffer(chn)) { + if (!stream_alloc_recv_buffer(chn)) { chn_prod(chn)->flags |= SI_FL_WAIT_ROOM; WILL_LJMP(hlua_yieldk(L, 0, 0, hlua_channel_send_yield, TICK_ETERNITY, 0)); } @@ -2686,7 +2686,7 @@ __LJMP static int hlua_channel_get_out_len(lua_State *L) */ /* Returns a struct hlua_session if the stack entry "ud" is - * a class session, otherwise it throws an error. + * a class stream, otherwise it throws an error. */ __LJMP static struct hlua_smp *hlua_checkfetches(lua_State *L, int ud) { @@ -2790,7 +2790,7 @@ __LJMP static int hlua_run_sample_fetch(lua_State *L) */ /* Returns a struct hlua_session if the stack entry "ud" is - * a class session, otherwise it throws an error. + * a class stream, otherwise it throws an error. */ __LJMP static struct hlua_smp *hlua_checkconverters(lua_State *L, int ud) { @@ -2821,7 +2821,7 @@ static int hlua_converters_new(lua_State *L, struct hlua_txn *txn, int stringsaf hsmp->l7 = txn->l7; hsmp->stringsafe = stringsafe; - /* Pop a class session metatable and affect it to the table. */ + /* Pop a class stream metatable and affect it to the table. */ lua_rawgeti(L, LUA_REGISTRYINDEX, class_converters_ref); lua_setmetatable(L, -2); @@ -2909,7 +2909,7 @@ __LJMP static int hlua_run_sample_conv(lua_State *L) */ /* Returns a struct hlua_txn if the stack entry "ud" is - * a class session, otherwise it throws an error. + * a class stream, otherwise it throws an error. */ __LJMP static struct hlua_txn *hlua_checkhttp(lua_State *L, int ud) { @@ -2939,7 +2939,7 @@ static int hlua_http_new(lua_State *L, struct hlua_txn *txn) htxn->p = txn->p; htxn->l7 = txn->l7; - /* Pop a class session metatable and affect it to the table. */ + /* Pop a class stream metatable and affect it to the table. */ lua_rawgeti(L, LUA_REGISTRYINDEX, class_http_ref); lua_setmetatable(L, -2); @@ -3264,7 +3264,7 @@ static int hlua_http_req_set_uri(lua_State *L) */ /* Returns a struct hlua_session if the stack entry "ud" is - * a class session, otherwise it throws an error. + * a class stream, otherwise it throws an error. */ __LJMP static struct hlua_txn *hlua_checktxn(lua_State *L, int ud) { @@ -3277,8 +3277,8 @@ __LJMP static int hlua_set_priv(lua_State *L) MAY_LJMP(check_args(L, 2, "set_priv")); - /* It is useles to retrieve the session, but this function - * runs only in a session context. + /* It is useles to retrieve the stream, but this function + * runs only in a stream context. */ MAY_LJMP(hlua_checktxn(L, 1)); hlua = hlua_gethlua(L); @@ -3300,8 +3300,8 @@ __LJMP static int hlua_get_priv(lua_State *L) MAY_LJMP(check_args(L, 1, "get_priv")); - /* It is useles to retrieve the session, but this function - * runs only in a session context. + /* It is useles to retrieve the stream, but this function + * runs only in a stream context. */ MAY_LJMP(hlua_checktxn(L, 1)); hlua = hlua_gethlua(L); @@ -3316,7 +3316,7 @@ __LJMP static int hlua_get_priv(lua_State *L) * return 0 if the stack does not contains free slots, * otherwise it returns 1. */ -static int hlua_txn_new(lua_State *L, struct session *s, struct proxy *p, void *l7) +static int hlua_txn_new(lua_State *L, struct stream *s, struct proxy *p, void *l7) { struct hlua_txn *htxn; @@ -3806,79 +3806,79 @@ static int hlua_register_task(lua_State *L) * doesn't allow "yield" functions because the HAProxy engine cannot * resume converters. */ -static int hlua_sample_conv_wrapper(struct session *session, const struct arg *arg_p, +static int hlua_sample_conv_wrapper(struct stream *stream, const struct arg *arg_p, struct sample *smp, void *private) { struct hlua_function *fcn = (struct hlua_function *)private; - /* In the execution wrappers linked with a session, the + /* In the execution wrappers linked with a stream, the * Lua context can be not initialized. This behavior * permits to save performances because a systematic * Lua initialization cause 5% performances loss. */ - if (!session->hlua.T && !hlua_ctx_init(&session->hlua, session->task)) { - send_log(session->be, LOG_ERR, "Lua converter '%s': can't initialize Lua context.", fcn->name); + if (!stream->hlua.T && !hlua_ctx_init(&stream->hlua, stream->task)) { + send_log(stream->be, LOG_ERR, "Lua converter '%s': can't initialize Lua context.", fcn->name); if (!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE)) Alert("Lua converter '%s': can't initialize Lua context.\n", fcn->name); return 0; } /* If it is the first run, initialize the data for the call. */ - if (!HLUA_IS_RUNNING(&session->hlua)) { + if (!HLUA_IS_RUNNING(&stream->hlua)) { /* Check stack available size. */ - if (!lua_checkstack(session->hlua.T, 1)) { - send_log(session->be, LOG_ERR, "Lua converter '%s': full stack.", fcn->name); + if (!lua_checkstack(stream->hlua.T, 1)) { + send_log(stream->be, LOG_ERR, "Lua converter '%s': full stack.", fcn->name); if (!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE)) Alert("Lua converter '%s': full stack.\n", fcn->name); return 0; } /* Restore the function in the stack. */ - lua_rawgeti(session->hlua.T, LUA_REGISTRYINDEX, fcn->function_ref); + lua_rawgeti(stream->hlua.T, LUA_REGISTRYINDEX, fcn->function_ref); /* convert input sample and pust-it in the stack. */ - if (!lua_checkstack(session->hlua.T, 1)) { - send_log(session->be, LOG_ERR, "Lua converter '%s': full stack.", fcn->name); + if (!lua_checkstack(stream->hlua.T, 1)) { + send_log(stream->be, LOG_ERR, "Lua converter '%s': full stack.", fcn->name); if (!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE)) Alert("Lua converter '%s': full stack.\n", fcn->name); return 0; } - hlua_smp2lua(session->hlua.T, smp); - session->hlua.nargs = 2; + hlua_smp2lua(stream->hlua.T, smp); + stream->hlua.nargs = 2; /* push keywords in the stack. */ if (arg_p) { for (; arg_p->type != ARGT_STOP; arg_p++) { - if (!lua_checkstack(session->hlua.T, 1)) { - send_log(session->be, LOG_ERR, "Lua converter '%s': full stack.", fcn->name); + if (!lua_checkstack(stream->hlua.T, 1)) { + send_log(stream->be, LOG_ERR, "Lua converter '%s': full stack.", fcn->name); if (!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE)) Alert("Lua converter '%s': full stack.\n", fcn->name); return 0; } - hlua_arg2lua(session->hlua.T, arg_p); - session->hlua.nargs++; + hlua_arg2lua(stream->hlua.T, arg_p); + stream->hlua.nargs++; } } /* We must initialize the execution timeouts. */ - session->hlua.expire = tick_add(now_ms, hlua_timeout_session); + stream->hlua.expire = tick_add(now_ms, hlua_timeout_session); /* Set the currently running flag. */ - HLUA_SET_RUN(&session->hlua); + HLUA_SET_RUN(&stream->hlua); } /* Execute the function. */ - switch (hlua_ctx_resume(&session->hlua, 0)) { + switch (hlua_ctx_resume(&stream->hlua, 0)) { /* finished. */ case HLUA_E_OK: /* Convert the returned value in sample. */ - hlua_lua2smp(session->hlua.T, -1, smp); - lua_pop(session->hlua.T, 1); + hlua_lua2smp(stream->hlua.T, -1, smp); + lua_pop(stream->hlua.T, 1); return 1; /* yield. */ case HLUA_E_AGAIN: - send_log(session->be, LOG_ERR, "Lua converter '%s': cannot use yielded functions.", fcn->name); + send_log(stream->be, LOG_ERR, "Lua converter '%s': cannot use yielded functions.", fcn->name); if (!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE)) Alert("Lua converter '%s': cannot use yielded functions.\n", fcn->name); return 0; @@ -3886,15 +3886,15 @@ static int hlua_sample_conv_wrapper(struct session *session, const struct arg *a /* finished with error. */ case HLUA_E_ERRMSG: /* Display log. */ - send_log(session->be, LOG_ERR, "Lua converter '%s': %s.", fcn->name, lua_tostring(session->hlua.T, -1)); + send_log(stream->be, LOG_ERR, "Lua converter '%s': %s.", fcn->name, lua_tostring(stream->hlua.T, -1)); if (!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE)) - Alert("Lua converter '%s': %s.\n", fcn->name, lua_tostring(session->hlua.T, -1)); - lua_pop(session->hlua.T, 1); + Alert("Lua converter '%s': %s.\n", fcn->name, lua_tostring(stream->hlua.T, -1)); + lua_pop(stream->hlua.T, 1); return 0; case HLUA_E_ERR: /* Display log. */ - send_log(session->be, LOG_ERR, "Lua converter '%s' returns an unknown error.", fcn->name); + send_log(stream->be, LOG_ERR, "Lua converter '%s' returns an unknown error.", fcn->name); if (!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE)) Alert("Lua converter '%s' returns an unknown error.\n", fcn->name); @@ -3907,13 +3907,13 @@ static int hlua_sample_conv_wrapper(struct session *session, const struct arg *a * doesn't allow "yield" functions because the HAProxy engine cannot * resume sample-fetches. */ -static int hlua_sample_fetch_wrapper(struct proxy *px, struct session *s, void *l7, +static int hlua_sample_fetch_wrapper(struct proxy *px, struct stream *s, void *l7, unsigned int opt, const struct arg *arg_p, struct sample *smp, const char *kw, void *private) { struct hlua_function *fcn = (struct hlua_function *)private; - /* In the execution wrappers linked with a session, the + /* In the execution wrappers linked with a stream, the * Lua context can be not initialized. This behavior * permits to save performances because a systematic * Lua initialization cause 5% performances loss. @@ -4188,12 +4188,12 @@ static int hlua_parse_rule(const char **args, int *cur_arg, struct proxy *px, * returns a yield. */ static int hlua_request_act_wrapper(struct hlua_rule *rule, struct proxy *px, - struct session *s, struct http_txn *http_txn, + struct stream *s, struct http_txn *http_txn, unsigned int analyzer) { char **arg; - /* In the execution wrappers linked with a session, the + /* In the execution wrappers linked with a stream, the * Lua context can be not initialized. This behavior * permits to save performances because a systematic * Lua initialization cause 5% performances loss. @@ -4218,7 +4218,7 @@ static int hlua_request_act_wrapper(struct hlua_rule *rule, struct proxy *px, /* Restore the function in the stack. */ lua_rawgeti(s->hlua.T, LUA_REGISTRYINDEX, rule->fcn.function_ref); - /* Create and and push object session in the stack. */ + /* Create and and push object stream in the stack. */ if (!hlua_txn_new(s->hlua.T, s, px, http_txn)) { send_log(px, LOG_ERR, "Lua function '%s': full stack.", rule->fcn.name); if (!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE)) @@ -4298,7 +4298,7 @@ static int hlua_request_act_wrapper(struct hlua_rule *rule, struct proxy *px, * "hlua_request_act_wrapper" for executing the LUA code. */ int hlua_tcp_req_act_wrapper(struct tcp_rule *tcp_rule, struct proxy *px, - struct session *s) + struct stream *s) { return hlua_request_act_wrapper((struct hlua_rule *)tcp_rule->act_prm.data, px, s, NULL, AN_REQ_INSPECT_FE); @@ -4308,7 +4308,7 @@ int hlua_tcp_req_act_wrapper(struct tcp_rule *tcp_rule, struct proxy *px, * "hlua_request_act_wrapper" for executing the LUA code. */ int hlua_tcp_res_act_wrapper(struct tcp_rule *tcp_rule, struct proxy *px, - struct session *s) + struct stream *s) { return hlua_request_act_wrapper((struct hlua_rule *)tcp_rule->act_prm.data, px, s, NULL, AN_RES_INSPECT); @@ -4319,7 +4319,7 @@ int hlua_tcp_res_act_wrapper(struct tcp_rule *tcp_rule, struct proxy *px, * the LUA code. */ int hlua_http_req_act_wrapper(struct http_req_rule *rule, struct proxy *px, - struct session *s, struct http_txn *http_txn) + struct stream *s, struct http_txn *http_txn) { return hlua_request_act_wrapper((struct hlua_rule *)rule->arg.data, px, s, http_txn, AN_REQ_HTTP_PROCESS_FE); @@ -4330,7 +4330,7 @@ int hlua_http_req_act_wrapper(struct http_req_rule *rule, struct proxy *px, * the LUA code. */ int hlua_http_res_act_wrapper(struct http_res_rule *rule, struct proxy *px, - struct session *s, struct http_txn *http_txn) + struct stream *s, struct http_txn *http_txn) { return hlua_request_act_wrapper((struct hlua_rule *)rule->arg.data, px, s, http_txn, AN_RES_HTTP_PROCESS_BE); @@ -4613,7 +4613,7 @@ void hlua_init(void) }; #endif - /* Initialise com signals pool session. */ + /* Initialise com signals pool */ pool2_hlua_com = create_pool("hlua_com", sizeof(struct hlua_com), MEM_F_SHARED); /* Register configuration keywords. */ diff --git a/src/listener.c b/src/listener.c index 349c20492..6b5fc6a48 100644 --- a/src/listener.c +++ b/src/listener.c @@ -169,7 +169,7 @@ int resume_listener(struct listener *l) return 1; } -/* Marks a ready listener as full so that the session code tries to re-enable +/* Marks a ready listener as full so that the stream code tries to re-enable * it upon next close() using resume_listener(). */ void listener_full(struct listener *l) @@ -466,7 +466,7 @@ void listener_accept(int fd) ret = l->accept(l, cfd, &addr); if (unlikely(ret <= 0)) { - /* The connection was closed by session_accept(). Either + /* The connection was closed by stream_accept(). Either * we just have to ignore it (ret == 0) or it's a critical * error due to a resource shortage, and we must stop the * listener (ret < 0). @@ -589,7 +589,7 @@ void bind_dump_kws(char **out) /* set temp integer to the number of connexions to the same listening socket */ static int -smp_fetch_dconn(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_dconn(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { smp->type = SMP_T_UINT; @@ -599,7 +599,7 @@ smp_fetch_dconn(struct proxy *px, struct session *l4, void *l7, unsigned int opt /* set temp integer to the id of the socket (listener) */ static int -smp_fetch_so_id(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_so_id(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { smp->type = SMP_T_UINT; diff --git a/src/log.c b/src/log.c index 20a98b2cc..f9c78a276 100644 --- a/src/log.c +++ b/src/log.c @@ -916,7 +916,7 @@ const char sess_set_cookie[8] = "NPDIRU67"; /* No set-cookie, Set-cookie found a * not counting the trailing zero which is always added if the resulting size * is not zero. */ -int build_logline(struct session *s, char *dst, size_t maxsize, struct list *list_format) +int build_logline(struct stream *s, char *dst, size_t maxsize, struct list *list_format) { struct proxy *fe = s->fe; struct proxy *be = s->be; @@ -1599,10 +1599,10 @@ out: } /* - * send a log for the session when we have enough info about it. + * send a log for the stream when we have enough info about it. * Will not log if the frontend has no log defined. */ -void sess_log(struct session *s) +void strm_log(struct stream *s) { char *tmplog; int size, err, level; diff --git a/src/map.c b/src/map.c index 451fad67f..3fb84ac9f 100644 --- a/src/map.c +++ b/src/map.c @@ -164,7 +164,7 @@ static int sample_load_map(struct arg *arg, struct sample_conv *conv, return 1; } -static int sample_conv_map(struct session *session, const struct arg *arg_p, +static int sample_conv_map(struct stream *stream, const struct arg *arg_p, struct sample *smp, void *private) { struct map_descriptor *desc; diff --git a/src/payload.c b/src/payload.c index b5d8478ba..3a2dc1553 100644 --- a/src/payload.c +++ b/src/payload.c @@ -29,7 +29,7 @@ * used with content inspection. */ static int -smp_fetch_wait_end(struct proxy *px, struct session *s, void *l7, unsigned int opt, +smp_fetch_wait_end(struct proxy *px, struct stream *s, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { if (!(opt & SMP_OPT_FINAL)) { @@ -43,7 +43,7 @@ smp_fetch_wait_end(struct proxy *px, struct session *s, void *l7, unsigned int o /* return the number of bytes in the request buffer */ static int -smp_fetch_len(struct proxy *px, struct session *s, void *l7, unsigned int opt, +smp_fetch_len(struct proxy *px, struct stream *s, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct channel *chn; @@ -63,7 +63,7 @@ smp_fetch_len(struct proxy *px, struct session *s, void *l7, unsigned int opt, /* returns the type of SSL hello message (mainly used to detect an SSL hello) */ static int -smp_fetch_ssl_hello_type(struct proxy *px, struct session *s, void *l7, unsigned int opt, +smp_fetch_ssl_hello_type(struct proxy *px, struct stream *s, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { int hs_len; @@ -134,7 +134,7 @@ smp_fetch_ssl_hello_type(struct proxy *px, struct session *s, void *l7, unsigned * Note: this decoder only works with non-wrapping data. */ static int -smp_fetch_req_ssl_ver(struct proxy *px, struct session *s, void *l7, unsigned int opt, +smp_fetch_req_ssl_ver(struct proxy *px, struct stream *s, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { int version, bleft, msg_len; @@ -270,7 +270,7 @@ smp_fetch_req_ssl_ver(struct proxy *px, struct session *s, void *l7, unsigned in * - opaque hostname[name_len bytes] */ static int -smp_fetch_ssl_hello_sni(struct proxy *px, struct session *s, void *l7, unsigned int opt, +smp_fetch_ssl_hello_sni(struct proxy *px, struct stream *s, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { int hs_len, ext_len, bleft; @@ -410,7 +410,7 @@ smp_fetch_ssl_hello_sni(struct proxy *px, struct session *s, void *l7, unsigned * of type SMP_T_CSTR. Note: this decoder only works with non-wrapping data. */ int -fetch_rdp_cookie_name(struct session *s, struct sample *smp, const char *cname, int clen) +fetch_rdp_cookie_name(struct stream *s, struct sample *smp, const char *cname, int clen) { int bleft; const unsigned char *data; @@ -502,7 +502,7 @@ fetch_rdp_cookie_name(struct session *s, struct sample *smp, const char *cname, * returned sample has type SMP_T_CSTR. */ int -smp_fetch_rdp_cookie(struct proxy *px, struct session *s, void *l7, unsigned int opt, +smp_fetch_rdp_cookie(struct proxy *px, struct stream *s, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { return fetch_rdp_cookie_name(s, smp, args ? args->data.str.str : NULL, args ? args->data.str.len : 0); @@ -510,7 +510,7 @@ smp_fetch_rdp_cookie(struct proxy *px, struct session *s, void *l7, unsigned int /* returns either 1 or 0 depending on whether an RDP cookie is found or not */ static int -smp_fetch_rdp_cookie_cnt(struct proxy *px, struct session *s, void *l7, unsigned int opt, +smp_fetch_rdp_cookie_cnt(struct proxy *px, struct stream *s, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { int ret; @@ -528,7 +528,7 @@ smp_fetch_rdp_cookie_cnt(struct proxy *px, struct session *s, void *l7, unsigned /* extracts part of a payload with offset and length at a given position */ static int -smp_fetch_payload_lv(struct proxy *px, struct session *s, void *l7, unsigned int opt, +smp_fetch_payload_lv(struct proxy *px, struct stream *s, void *l7, unsigned int opt, const struct arg *arg_p, struct sample *smp, const char *kw, void *private) { unsigned int len_offset = arg_p[0].data.uint; @@ -585,7 +585,7 @@ smp_fetch_payload_lv(struct proxy *px, struct session *s, void *l7, unsigned int /* extracts some payload at a fixed position and length */ static int -smp_fetch_payload(struct proxy *px, struct session *s, void *l7, unsigned int opt, +smp_fetch_payload(struct proxy *px, struct stream *s, void *l7, unsigned int opt, const struct arg *arg_p, struct sample *smp, const char *kw, void *private) { unsigned int buf_offset = arg_p[0].data.uint; diff --git a/src/peers.c b/src/peers.c index 3cd441272..a2f29d2ee 100644 --- a/src/peers.c +++ b/src/peers.c @@ -38,7 +38,7 @@ #include #include #include -#include +#include #include #include #include @@ -120,7 +120,7 @@ enum { #define PEER_SESSION_PROTO_NAME "HAProxyS" struct peers *peers = NULL; -static void peer_session_forceshutdown(struct session * session); +static void peer_session_forceshutdown(struct stream * stream); /* @@ -179,7 +179,7 @@ static int peer_prepare_datamsg(struct stksess *ts, struct peer_session *ps, cha */ static void peer_session_release(struct stream_interface *si) { - struct session *s = si_sess(si); + struct stream *s = si_strm(si); struct appctx *appctx = objt_appctx(si->end); struct peer_session *ps = (struct peer_session *)appctx->ctx.peers.ptr; @@ -189,8 +189,8 @@ static void peer_session_release(struct stream_interface *si) /* peer session identified */ if (ps) { - if (ps->session == s) { - ps->session = NULL; + if (ps->stream == s) { + ps->stream = NULL; if (ps->flags & PEER_F_LEARN_ASSIGN) { /* unassign current peer for learning */ ps->flags &= ~(PEER_F_LEARN_ASSIGN); @@ -213,7 +213,7 @@ static void peer_session_release(struct stream_interface *si) */ static void peer_io_handler(struct stream_interface *si) { - struct session *s = si_sess(si); + struct stream *s = si_strm(si); struct peers *curpeers = (struct peers *)s->fe->parent; struct appctx *appctx = objt_appctx(si->end); int reql = 0; @@ -405,20 +405,20 @@ switchstate: goto switchstate; } - /* lookup peer session of current peer */ + /* lookup peer stream of current peer */ for (ps = st->sessions; ps; ps = ps->next) { if (ps->peer == curpeer) { - /* If session already active, replaced by new one */ - if (ps->session && ps->session != s) { + /* If stream already active, replaced by new one */ + if (ps->stream && ps->stream != s) { if (ps->peer->local) { /* Local connection, reply a retry */ appctx->st0 = PEER_SESS_ST_EXIT; appctx->st1 = PEER_SESS_SC_TRYAGAIN; goto switchstate; } - peer_session_forceshutdown(ps->session); + peer_session_forceshutdown(ps->stream); } - ps->session = s; + ps->stream = s; break; } } @@ -1063,20 +1063,20 @@ static struct si_applet peer_applet = { /* * Use this function to force a close of a peer session */ -static void peer_session_forceshutdown(struct session * session) +static void peer_session_forceshutdown(struct stream * stream) { struct stream_interface *oldsi = NULL; struct appctx *appctx = NULL; int i; for (i = 0; i <= 1; i++) { - appctx = objt_appctx(session->si[i].end); + appctx = objt_appctx(stream->si[i].end); if (!appctx) continue; if (appctx->applet != &peer_applet) continue; - oldsi = &session->si[i]; + oldsi = &stream->si[i]; break; } @@ -1087,7 +1087,7 @@ static void peer_session_forceshutdown(struct session * session) peer_session_release(oldsi); appctx->st0 = PEER_SESS_ST_END; appctx->ctx.peers.ptr = NULL; - task_wakeup(session->task, TASK_WOKEN_MSG); + task_wakeup(stream->task, TASK_WOKEN_MSG); } /* Pre-configures a peers frontend to accept incoming connections */ @@ -1106,22 +1106,22 @@ void peers_setup_frontend(struct proxy *fe) /* * Create a new peer session in assigned state (connect will start automatically) */ -static struct session *peer_session_create(struct peer *peer, struct peer_session *ps) +static struct stream *peer_session_create(struct peer *peer, struct peer_session *ps) { struct listener *l = LIST_NEXT(&peer->peers->peers_fe->conf.listeners, struct listener *, by_fe); struct proxy *p = (struct proxy *)l->frontend; /* attached frontend */ struct appctx *appctx; - struct session *s; + struct stream *s; struct http_txn *txn; struct task *t; struct connection *conn; - if ((s = pool_alloc2(pool2_session)) == NULL) { /* disable this proxy for a while */ + if ((s = pool_alloc2(pool2_stream)) == NULL) { /* disable this proxy for a while */ Alert("out of memory in peer_session_create().\n"); goto out_close; } - LIST_ADDQ(&sessions, &s->list); + LIST_ADDQ(&streams, &s->list); LIST_INIT(&s->back_refs); LIST_INIT(&s->buffer_wait); @@ -1145,7 +1145,7 @@ static struct session *peer_session_create(struct peer *peer, struct peer_sessio s->task = t; s->listener = l; - /* Note: initially, the session's backend points to the frontend. + /* Note: initially, the stream's backend points to the frontend. * This changes later when switching rules are executed or * when the default backend is assigned. */ @@ -1188,7 +1188,7 @@ static struct session *peer_session_create(struct peer *peer, struct peer_sessio conn->target = s->target = &s->be->obj_type; memcpy(&conn->addr.to, &peer->addr, sizeof(conn->addr.to)); - session_init_srv_conn(s); + stream_init_srv_conn(s); s->pend_pos = NULL; /* init store persistence */ @@ -1214,7 +1214,7 @@ static struct session *peer_session_create(struct peer *peer, struct peer_sessio txn = &s->txn; /* Those variables will be checked and freed if non-NULL in - * session.c:session_free(). It is important that they are + * stream.c:stream_free(). It is important that they are * properly initialized. */ txn->sessid = NULL; @@ -1277,7 +1277,7 @@ static struct session *peer_session_create(struct peer *peer, struct peer_sessio task_free(t); out_free_session: LIST_DEL(&s->list); - pool_free2(pool2_session, s); + pool_free2(pool2_stream, s); out_close: return s; } @@ -1314,20 +1314,20 @@ static struct task *process_peer_sync(struct task * task) for (ps = st->sessions; ps; ps = ps->next) { /* For each remote peers */ if (!ps->peer->local) { - if (!ps->session) { - /* no active session */ + if (!ps->stream) { + /* no active stream */ if (ps->statuscode == 0 || ps->statuscode == PEER_SESS_SC_SUCCESSCODE || ((ps->statuscode == PEER_SESS_SC_CONNECTCODE || ps->statuscode == PEER_SESS_SC_CONNECTEDCODE) && tick_is_expired(ps->reconnect, now_ms))) { /* connection never tried - * or previous session established with success - * or previous session failed during connection + * or previous stream established with success + * or previous stream failed during connection * and reconnection timer is expired */ /* retry a connect */ - ps->session = peer_session_create(ps->peer, ps); + ps->stream = peer_session_create(ps->peer, ps); } else if (ps->statuscode == PEER_SESS_SC_CONNECTCODE || ps->statuscode == PEER_SESS_SC_CONNECTEDCODE) { @@ -1338,9 +1338,9 @@ static struct task *process_peer_sync(struct task * task) task->expire = tick_first(task->expire, ps->reconnect); } /* else do nothing */ - } /* !ps->session */ + } /* !ps->stream */ else if (ps->statuscode == PEER_SESS_SC_SUCCESSCODE) { - /* current session is active and established */ + /* current stream is active and established */ if (((st->flags & SHTABLE_RESYNC_STATEMASK) == SHTABLE_RESYNC_FROMREMOTE) && !(st->flags & SHTABLE_F_RESYNC_ASSIGN) && !(ps->flags & PEER_F_LEARN_NOTUP2DATE)) { @@ -1352,12 +1352,12 @@ static struct task *process_peer_sync(struct task * task) ps->flags |= PEER_F_LEARN_ASSIGN; st->flags |= SHTABLE_F_RESYNC_ASSIGN; - /* awake peer session task to handle a request of resync */ - task_wakeup(ps->session->task, TASK_WOKEN_MSG); + /* awake peer stream task to handle a request of resync */ + task_wakeup(ps->stream->task, TASK_WOKEN_MSG); } else if ((int)(ps->pushed - ps->table->table->localupdate) < 0) { - /* awake peer session task to push local updates */ - task_wakeup(ps->session->task, TASK_WOKEN_MSG); + /* awake peer stream task to push local updates */ + task_wakeup(ps->stream->task, TASK_WOKEN_MSG); } /* else do nothing */ } /* SUCCESSCODE */ @@ -1395,9 +1395,9 @@ static struct task *process_peer_sync(struct task * task) /* disconnect all connected peers */ for (ps = st->sessions; ps; ps = ps->next) { - if (ps->session) { - peer_session_forceshutdown(ps->session); - ps->session = NULL; + if (ps->stream) { + peer_session_forceshutdown(ps->stream); + ps->stream = NULL; } } } @@ -1411,19 +1411,19 @@ static struct task *process_peer_sync(struct task * task) st->table->syncing--; } } - else if (!ps->session) { - /* If session is not active */ + else if (!ps->stream) { + /* If stream is not active */ if (ps->statuscode == 0 || ps->statuscode == PEER_SESS_SC_SUCCESSCODE || ps->statuscode == PEER_SESS_SC_CONNECTEDCODE || ps->statuscode == PEER_SESS_SC_TRYAGAIN) { /* connection never tried - * or previous session was successfully established - * or previous session tcp connect success but init state incomplete + * or previous stream was successfully established + * or previous stream tcp connect success but init state incomplete * or during previous connect, peer replies a try again statuscode */ /* connect to the peer */ - ps->session = peer_session_create(ps->peer, ps); + ps->stream = peer_session_create(ps->peer, ps); } else { /* Other error cases */ @@ -1437,9 +1437,9 @@ static struct task *process_peer_sync(struct task * task) } else if (ps->statuscode == PEER_SESS_SC_SUCCESSCODE && (int)(ps->pushed - ps->table->table->localupdate) < 0) { - /* current session active and established - awake session to push remaining local updates */ - task_wakeup(ps->session->task, TASK_WOKEN_MSG); + /* current stream active and established + awake stream to push remaining local updates */ + task_wakeup(ps->stream->task, TASK_WOKEN_MSG); } } /* stopping */ /* Wakeup for re-connect */ diff --git a/src/proto_http.c b/src/proto_http.c index 90176fc85..2df2ce896 100644 --- a/src/proto_http.c +++ b/src/proto_http.c @@ -61,7 +61,7 @@ #include #include #include -#include +#include #include #include #include @@ -252,7 +252,7 @@ fd_set http_encode_map[(sizeof(fd_set) > (256/8)) ? 1 : ((256/8) / sizeof(fd_set #error "Check if your OS uses bitfields for fd_sets" #endif -static int http_apply_redirect_rule(struct redirect_rule *rule, struct session *s, struct http_txn *txn); +static int http_apply_redirect_rule(struct redirect_rule *rule, struct stream *s, struct http_txn *txn); void init_proto_http() { @@ -823,7 +823,7 @@ int http_remove_header2(struct http_msg *msg, struct hdr_idx *idx, struct hdr_ct * The error flags are set to the values in arguments. Any pending request * in this buffer will be lost. */ -static void http_server_error(struct session *s, struct stream_interface *si, +static void http_server_error(struct stream *s, struct stream_interface *si, int err, int finst, int status, const struct chunk *msg) { channel_auto_read(si_oc(si)); @@ -842,11 +842,11 @@ static void http_server_error(struct session *s, struct stream_interface *si, s->flags |= finst; } -/* This function returns the appropriate error location for the given session +/* This function returns the appropriate error location for the given stream * and message. */ -struct chunk *http_error_message(struct session *s, int msgnum) +struct chunk *http_error_message(struct stream *s, int msgnum) { if (s->be->errmsg[msgnum].str) return &s->be->errmsg[msgnum]; @@ -974,7 +974,7 @@ http_get_path_from_string(char *str) * follow normal proxy processing. NOTE: this function is designed to support * being called once data are scheduled for forwarding. */ -void http_perform_server_redirect(struct session *s, struct stream_interface *si) +void http_perform_server_redirect(struct stream *s, struct stream_interface *si) { struct http_txn *txn; struct server *srv; @@ -1050,7 +1050,7 @@ void http_perform_server_redirect(struct session *s, struct stream_interface *si * Note that connection errors appearing on the second request of a keep-alive * connection are not reported since this allows the client to retry. */ -void http_return_srv_error(struct session *s, struct stream_interface *si) +void http_return_srv_error(struct stream *s, struct stream_interface *si) { int err_type = si->err_type; @@ -1423,7 +1423,7 @@ const char *http_parse_reqline(struct http_msg *msg, * or auth method is unknown auth_method is set to HTTP_AUTH_WRONG to avoid * searching again for something we are unable to find anyway. However, if * the result if valid, the cache is not reused because we would risk to - * have the credentials overwritten by another session in parallel. + * have the credentials overwritten by another stream in parallel. */ /* This bufffer is initialized in the file 'src/haproxy.c'. This length is @@ -1432,7 +1432,7 @@ const char *http_parse_reqline(struct http_msg *msg, char *get_http_auth_buff; int -get_http_auth(struct session *s) +get_http_auth(struct stream *s) { struct http_txn *txn = &s->txn; @@ -1442,7 +1442,7 @@ get_http_auth(struct session *s) int len; #ifdef DEBUG_AUTH - printf("Auth for session %p: %d\n", s, txn->auth.method); + printf("Auth for stream %p: %d\n", s, txn->auth.method); #endif if (txn->auth.method == HTTP_AUTH_WRONG) @@ -2236,7 +2236,7 @@ int parse_qvalue(const char *qvalue, const char **end) /* * Selects a compression algorithm depending on the client request. */ -int select_compression_request_header(struct session *s, struct buffer *req) +int select_compression_request_header(struct stream *s, struct buffer *req) { struct http_txn *txn = &s->txn; struct http_msg *msg = &txn->req; @@ -2347,7 +2347,7 @@ int select_compression_request_header(struct session *s, struct buffer *req) /* * Selects a comression algorithm depending of the server response. */ -int select_compression_response_header(struct session *s, struct buffer *res) +int select_compression_response_header(struct stream *s, struct buffer *res) { struct http_txn *txn = &s->txn; struct http_msg *msg = &txn->rsp; @@ -2460,7 +2460,7 @@ fail: return 0; } -void http_adjust_conn_mode(struct session *s, struct http_txn *txn, struct http_msg *msg) +void http_adjust_conn_mode(struct stream *s, struct http_txn *txn, struct http_msg *msg) { int tmp = TX_CON_WANT_KAL; @@ -2521,7 +2521,7 @@ void http_adjust_conn_mode(struct session *s, struct http_txn *txn, struct http_ * 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 channel *req, int an_bit) +int http_wait_for_request(struct stream *s, struct channel *req, int an_bit) { /* * We will parse the partial (or complete) lines. @@ -2550,7 +2550,7 @@ int http_wait_for_request(struct session *s, struct channel *req, int an_bit) struct http_msg *msg = &txn->req; struct hdr_ctx ctx; - DPRINTF(stderr,"[%u] %s: session=%p b=%p, exp(r,w)=%u,%u bf=%08x bh=%d analysers=%02x\n", + DPRINTF(stderr,"[%u] %s: stream=%p b=%p, exp(r,w)=%u,%u bf=%08x bh=%d analysers=%02x\n", now_ms, __FUNCTION__, s, req, @@ -2642,10 +2642,10 @@ int http_wait_for_request(struct session *s, struct channel *req, int an_bit) * A full request is indicated by the fact that we have seen * the double LF/CRLF, so the state is >= HTTP_MSG_BODY. Invalid * requests are checked first. When waiting for a second request - * on a keep-alive session, if we encounter and error, close, t/o, - * we note the error in the session flags but don't set any state. + * on a keep-alive stream, if we encounter and error, close, t/o, + * we note the error in the stream flags but don't set any state. * Since the error will be noted there, it will not be counted by - * process_session() as a frontend error. + * process_stream() as a frontend error. * Last, we may increase some tracked counters' http request errors on * the cases that are deliberately the client's fault. For instance, * a timeout or connection reset is not counted as an error. However @@ -2657,23 +2657,23 @@ int http_wait_for_request(struct session *s, struct channel *req, int an_bit) * First, let's catch bad requests. */ if (unlikely(msg->msg_state == HTTP_MSG_ERROR)) { - session_inc_http_req_ctr(s); - session_inc_http_err_ctr(s); + stream_inc_http_req_ctr(s); + stream_inc_http_err_ctr(s); proxy_inc_fe_req_ctr(s->fe); goto return_bad_req; } /* 1: Since we are in header mode, if there's no space * left for headers, we won't be able to free more - * later, so the session will never terminate. We + * later, so the stream will never terminate. We * must terminate it now. */ if (unlikely(buffer_full(req->buf, global.tune.maxrewrite))) { /* FIXME: check if URI is set and return Status * 414 Request URI too long instead. */ - session_inc_http_req_ctr(s); - session_inc_http_err_ctr(s); + stream_inc_http_req_ctr(s); + stream_inc_http_err_ctr(s); proxy_inc_fe_req_ctr(s->fe); if (msg->err_pos < 0) msg->err_pos = req->buf->i; @@ -2691,7 +2691,7 @@ int http_wait_for_request(struct session *s, struct channel *req, int an_bit) /* we cannot return any message on error */ if (msg->err_pos >= 0) { http_capture_bad_message(&s->fe->invalid_req, s, msg, msg->msg_state, s->fe); - session_inc_http_err_ctr(s); + stream_inc_http_err_ctr(s); } txn->status = 400; @@ -2699,7 +2699,7 @@ int http_wait_for_request(struct session *s, struct channel *req, int an_bit) msg->msg_state = HTTP_MSG_ERROR; req->analysers = 0; - session_inc_http_req_ctr(s); + stream_inc_http_req_ctr(s); proxy_inc_fe_req_ctr(s->fe); s->fe->fe_counters.failed_req++; if (s->listener->counters) @@ -2721,14 +2721,14 @@ int http_wait_for_request(struct session *s, struct channel *req, int an_bit) /* read timeout : give up with an error message. */ if (msg->err_pos >= 0) { http_capture_bad_message(&s->fe->invalid_req, s, msg, msg->msg_state, s->fe); - session_inc_http_err_ctr(s); + stream_inc_http_err_ctr(s); } txn->status = 408; stream_int_retnclose(&s->si[0], http_error_message(s, HTTP_ERR_408)); msg->msg_state = HTTP_MSG_ERROR; req->analysers = 0; - session_inc_http_req_ctr(s); + stream_inc_http_req_ctr(s); proxy_inc_fe_req_ctr(s->fe); s->fe->fe_counters.failed_req++; if (s->listener->counters) @@ -2754,8 +2754,8 @@ int http_wait_for_request(struct session *s, struct channel *req, int an_bit) msg->msg_state = HTTP_MSG_ERROR; req->analysers = 0; - session_inc_http_err_ctr(s); - session_inc_http_req_ctr(s); + stream_inc_http_err_ctr(s); + stream_inc_http_req_ctr(s); proxy_inc_fe_req_ctr(s->fe); s->fe->fe_counters.failed_req++; if (s->listener->counters) @@ -2826,7 +2826,7 @@ int http_wait_for_request(struct session *s, struct channel *req, int an_bit) * (for instance in the absence of headers). */ - session_inc_http_req_ctr(s); + stream_inc_http_req_ctr(s); proxy_inc_fe_req_ctr(s->fe); /* one more valid request for this FE */ if (txn->flags & TX_WAIT_NEXT_RQ) { @@ -3092,9 +3092,9 @@ int http_wait_for_request(struct session *s, struct channel *req, int an_bit) * and always relies on the stats applet to complete the job. It does not touch * analysers nor counters, which are left to the caller. It does not touch * s->target which is supposed to already point to the stats applet. The caller - * is expected to have already assigned an appctx to the session. + * is expected to have already assigned an appctx to the stream. */ -int http_handle_stats(struct session *s, struct channel *req) +int http_handle_stats(struct stream *s, struct channel *req) { struct stats_admin_rule *stats_admin_rule; struct stream_interface *si = &s->si[1]; @@ -3246,7 +3246,7 @@ void inet_set_tos(int fd, struct sockaddr_storage from, int tos) #endif } -int http_transform_header_str(struct session* s, struct http_msg *msg, +int http_transform_header_str(struct stream* s, struct http_msg *msg, const char* name, unsigned int name_len, const char *str, struct my_regex *re, int action) @@ -3299,7 +3299,7 @@ int http_transform_header_str(struct session* s, struct http_msg *msg, return 0; } -static int http_transform_header(struct session* s, struct http_msg *msg, +static int http_transform_header(struct stream* s, struct http_msg *msg, const char* name, unsigned int name_len, struct list *fmt, struct my_regex *re, int action) @@ -3313,7 +3313,7 @@ static int http_transform_header(struct session* s, struct http_msg *msg, return http_transform_header_str(s, msg, name, name_len, replace->str, re, action); } -/* Executes the http-request rules for session , proxy and +/* Executes the http-request rules for stream , proxy and * transaction . Returns the verdict of the first rule that prevents * further processing of the request (auth, deny, ...), and defaults to * HTTP_RULE_RES_STOP if it executed all rules or stopped on an allow, or @@ -3321,7 +3321,7 @@ static int http_transform_header(struct session* s, struct http_msg *msg, * on txn->flags if it encounters a tarpit rule. */ enum rule_result -http_req_get_intercept_rule(struct proxy *px, struct list *rules, struct session *s, struct http_txn *txn) +http_req_get_intercept_rule(struct proxy *px, struct list *rules, struct stream *s, struct http_txn *txn) { struct connection *cli_conn; struct http_req_rule *rule; @@ -3385,7 +3385,7 @@ resume_execution: chunk_printf(&trash, (txn->flags & TX_USE_PX_CONN) ? HTTP_407_fmt : HTTP_401_fmt, auth_realm); txn->status = (txn->flags & TX_USE_PX_CONN) ? 407 : 401; stream_int_retnclose(&s->si[0], &trash); - session_inc_http_err_ctr(s); + stream_inc_http_err_ctr(s); return HTTP_RULE_RES_ABRT; case HTTP_REQ_ACT_REDIR: @@ -3562,7 +3562,7 @@ resume_execution: key = stktable_fetch_key(t, s->be, s, &s->txn, SMP_OPT_DIR_REQ | SMP_OPT_FINAL, rule->act_prm.trk_ctr.expr, NULL); if (key && (ts = stktable_get_entry(t, key))) { - session_track_stkctr(&s->stkctr[http_req_trk_idx(rule->action)], t, ts); + stream_track_stkctr(&s->stkctr[http_req_trk_idx(rule->action)], t, ts); /* let's count a new HTTP request as it's the first time we do it */ ptr = stktable_data_ptr(t, ts, STKTABLE_DT_HTTP_REQ_CNT); @@ -3587,7 +3587,7 @@ resume_execution: } -/* Executes the http-response rules for session , proxy and +/* Executes the http-response rules for stream , proxy and * transaction . Returns 3 states: HTTP_RULE_RES_CONT, HTTP_RULE_RES_YIELD * or HTTP_RULE_RES_STOP. If *CONT is returned, the process can continue the * evaluation of next rule list. If *STOP is returned, the process must stop @@ -3596,7 +3596,7 @@ resume_execution: * the same context. */ static enum rule_result -http_res_get_intercept_rule(struct proxy *px, struct list *rules, struct session *s, struct http_txn *txn) +http_res_get_intercept_rule(struct proxy *px, struct list *rules, struct stream *s, struct http_txn *txn) { struct connection *cli_conn; struct http_res_rule *rule; @@ -3804,7 +3804,7 @@ resume_execution: * returns non-zero on success, or zero in case of a, irrecoverable error such * as too large a request to build a valid response. */ -static int http_apply_redirect_rule(struct redirect_rule *rule, struct session *s, struct http_txn *txn) +static int http_apply_redirect_rule(struct redirect_rule *rule, struct stream *s, struct http_txn *txn) { struct http_msg *msg = &txn->req; const char *msg_fmt; @@ -4063,7 +4063,7 @@ static int http_apply_redirect_rule(struct redirect_rule *rule, struct session * * either needs more data or wants to immediately abort the request (eg: deny, * error, ...). */ -int http_process_req_common(struct session *s, struct channel *req, int an_bit, struct proxy *px) +int http_process_req_common(struct stream *s, struct channel *req, int an_bit, struct proxy *px) { struct http_txn *txn = &s->txn; struct http_msg *msg = &txn->req; @@ -4076,7 +4076,7 @@ int http_process_req_common(struct session *s, struct channel *req, int an_bit, goto return_prx_yield; } - DPRINTF(stderr,"[%u] %s: session=%p b=%p, exp(r,w)=%u,%u bf=%08x bh=%d analysers=%02x\n", + DPRINTF(stderr,"[%u] %s: stream=%p b=%p, exp(r,w)=%u,%u bf=%08x bh=%d analysers=%02x\n", now_ms, __FUNCTION__, s, req, @@ -4086,7 +4086,7 @@ int http_process_req_common(struct session *s, struct channel *req, int an_bit, req->analysers); /* just in case we have some per-backend tracking */ - session_inc_be_http_req_ctr(s); + stream_inc_be_http_req_ctr(s); /* evaluate http-request rules */ if (!LIST_ISEMPTY(&px->http_req_rules)) { @@ -4245,7 +4245,7 @@ int http_process_req_common(struct session *s, struct channel *req, int an_bit, req->analyse_exp = tick_add_ifset(now_ms, s->be->timeout.tarpit); if (!req->analyse_exp) req->analyse_exp = tick_add(now_ms, 0); - session_inc_http_err_ctr(s); + stream_inc_http_err_ctr(s); s->fe->fe_counters.denied_req++; if (s->fe != s->be) s->be->be_counters.denied_req++; @@ -4258,7 +4258,7 @@ int http_process_req_common(struct session *s, struct channel *req, int an_bit, txn->status = 403; s->logs.tv_request = now; stream_int_retnclose(&s->si[0], http_error_message(s, HTTP_ERR_403)); - session_inc_http_err_ctr(s); + stream_inc_http_err_ctr(s); s->fe->fe_counters.denied_req++; if (s->fe != s->be) s->be->be_counters.denied_req++; @@ -4303,7 +4303,7 @@ int http_process_req_common(struct session *s, struct channel *req, int an_bit, * 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 channel *req, int an_bit) +int http_process_request(struct stream *s, struct channel *req, int an_bit) { struct http_txn *txn = &s->txn; struct http_msg *msg = &txn->req; @@ -4315,7 +4315,7 @@ int http_process_request(struct session *s, struct channel *req, int an_bit) return 0; } - DPRINTF(stderr,"[%u] %s: session=%p b=%p, exp(r,w)=%u,%u bf=%08x bh=%d analysers=%02x\n", + DPRINTF(stderr,"[%u] %s: stream=%p b=%p, exp(r,w)=%u,%u bf=%08x bh=%d analysers=%02x\n", now_ms, __FUNCTION__, s, req, @@ -4650,7 +4650,7 @@ int http_process_request(struct session *s, struct channel *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 channel *req, int an_bit) +int http_process_tarpit(struct stream *s, struct channel *req, int an_bit) { struct http_txn *txn = &s->txn; @@ -4695,7 +4695,7 @@ int http_process_tarpit(struct session *s, struct channel *req, int an_bit) * HTTP_MSG_CHK_SIZE, HTTP_MSG_DATA or HTTP_MSG_TRAILERS. It returns zero if it * needs to read more data, or 1 once it has completed its analysis. */ -int http_wait_for_request_body(struct session *s, struct channel *req, int an_bit) +int http_wait_for_request_body(struct stream *s, struct channel *req, int an_bit) { struct http_txn *txn = &s->txn; struct http_msg *msg = &s->txn.req; @@ -4761,7 +4761,7 @@ int http_wait_for_request_body(struct session *s, struct channel *req, int an_bi if (!ret) goto missing_data; else if (ret < 0) { - session_inc_http_err_ctr(s); + stream_inc_http_err_ctr(s); goto return_bad_req; } } @@ -4891,7 +4891,7 @@ int http_send_name_header(struct http_txn *txn, struct proxy* be, const char* sr /* Terminate current transaction and prepare a new one. This is very tricky * right now but it works. */ -void http_end_txn_clean_session(struct session *s) +void http_end_txn_clean_session(struct stream *s) { int prev_status = s->txn.status; @@ -4918,7 +4918,7 @@ void http_end_txn_clean_session(struct session *s) } s->logs.t_close = tv_ms_elapsed(&s->logs.tv_accept, &now); - session_process_counters(s); + stream_process_counters(s); if (s->txn.status) { int n; @@ -4953,8 +4953,8 @@ void http_end_txn_clean_session(struct session *s) } /* stop tracking content-based counters */ - session_stop_content_counters(s); - session_update_time_stats(s); + stream_stop_content_counters(s); + stream_update_time_stats(s); s->logs.accept_date = date; /* user-visible date for logging */ s->logs.tv_accept = now; /* corrected date for internal use */ @@ -4995,7 +4995,7 @@ void http_end_txn_clean_session(struct session *s) s->si[1].err_type = SI_ET_NONE; s->si[1].conn_retries = 0; /* used for logging too */ s->si[1].exp = TICK_ETERNITY; - s->si[1].flags &= SI_FL_ISBACK | SI_FL_DONT_WAKE; /* we're in the context of process_session */ + s->si[1].flags &= SI_FL_ISBACK | SI_FL_DONT_WAKE; /* we're in the context of process_stream */ s->req.flags &= ~(CF_SHUTW|CF_SHUTW_NOW|CF_AUTO_CONNECT|CF_WRITE_ERROR|CF_STREAMER|CF_STREAMER_FAST|CF_NEVER_WAIT|CF_WAKE_CONNECT|CF_WROTE_DATA); s->res.flags &= ~(CF_SHUTR|CF_SHUTR_NOW|CF_READ_ATTACHED|CF_READ_ERROR|CF_READ_NOEXP|CF_STREAMER|CF_STREAMER_FAST|CF_WRITE_PARTIAL|CF_NEVER_WAIT|CF_WROTE_DATA); s->flags &= ~(SN_DIRECT|SN_ASSIGNED|SN_ADDR_SET|SN_BE_ASSIGNED|SN_FORCE_PRST|SN_IGNORE_PRST); @@ -5060,7 +5060,7 @@ void http_end_txn_clean_session(struct session *s) * this function and its equivalent should loop until both return zero. It * can set its own state to DONE, CLOSING, CLOSED, TUNNEL, ERROR. */ -int http_sync_req_state(struct session *s) +int http_sync_req_state(struct stream *s) { struct channel *chn = &s->req; struct http_txn *txn = &s->txn; @@ -5080,7 +5080,7 @@ int http_sync_req_state(struct session *s) * (eg: Linux). * Note that if we're using keep-alive on the client side, we'd * rather poll now and keep the polling enabled for the whole - * session's life than enabling/disabling it between each + * stream's life than enabling/disabling it between each * response and next request. */ if (((txn->flags & TX_CON_WANT_MSK) != TX_CON_WANT_SCL) && @@ -5126,7 +5126,7 @@ int http_sync_req_state(struct session *s) else if ((txn->flags & TX_CON_WANT_MSK) == TX_CON_WANT_CLO) { /* Option forceclose is set, or either side wants to close, * let's enforce it now that we're not expecting any new - * data to come. The caller knows the session is complete + * data to come. The caller knows the stream is complete * once both states are CLOSED. */ if (!(chn->flags & (CF_SHUTW|CF_SHUTW_NOW))) { @@ -5198,7 +5198,7 @@ int http_sync_req_state(struct session *s) * this function and its equivalent should loop until both return zero. It * can set its own state to DONE, CLOSING, CLOSED, TUNNEL, ERROR. */ -int http_sync_res_state(struct session *s) +int http_sync_res_state(struct stream *s) { struct channel *chn = &s->res; struct http_txn *txn = &s->txn; @@ -5254,7 +5254,7 @@ int http_sync_res_state(struct session *s) else if ((txn->flags & TX_CON_WANT_MSK) == TX_CON_WANT_CLO) { /* Option forceclose is set, or either side wants to close, * let's enforce it now that we're not expecting any new - * data to come. The caller knows the session is complete + * data to come. The caller knows the stream is complete * once both states are CLOSED. */ if (!(chn->flags & (CF_SHUTW|CF_SHUTW_NOW))) { @@ -5327,7 +5327,7 @@ int http_sync_res_state(struct session *s) /* Resync the request and response state machines. Return 1 if either state * changes. */ -int http_resync_states(struct session *s) +int http_resync_states(struct stream *s) { struct http_txn *txn = &s->txn; int old_req_state = txn->req.msg_state; @@ -5399,11 +5399,11 @@ int http_resync_states(struct session *s) * tunnel mode and we want to forward till the close. It's used both to forward * remaining data and to resync after end of body. It expects the msg_state to * be between MSG_BODY and MSG_DONE (inclusive). It returns zero if it needs to - * read more data, or 1 once we can go on with next request or end the session. + * read more data, or 1 once we can go on with next request or end the stream. * When in MSG_DATA or MSG_TRAILERS, it will automatically forward chunk_len * bytes of pending data + the headers if not already done. */ -int http_request_forward_body(struct session *s, struct channel *req, int an_bit) +int http_request_forward_body(struct stream *s, struct channel *req, int an_bit) { struct http_txn *txn = &s->txn; struct http_msg *msg = &s->txn.req; @@ -5498,7 +5498,7 @@ int http_request_forward_body(struct session *s, struct channel *req, int an_bit if (ret == 0) goto missing_data; else if (ret < 0) { - session_inc_http_err_ctr(s); + stream_inc_http_err_ctr(s); if (msg->err_pos >= 0) http_capture_bad_message(&s->fe->invalid_req, s, msg, HTTP_MSG_CHUNK_SIZE, s->be); goto return_bad_req; @@ -5512,7 +5512,7 @@ int http_request_forward_body(struct session *s, struct channel *req, int an_bit if (ret == 0) goto missing_data; else if (ret < 0) { - session_inc_http_err_ctr(s); + stream_inc_http_err_ctr(s); if (msg->err_pos >= 0) http_capture_bad_message(&s->fe->invalid_req, s, msg, HTTP_MSG_CHUNK_CRLF, s->be); goto return_bad_req; @@ -5525,7 +5525,7 @@ int http_request_forward_body(struct session *s, struct channel *req, int an_bit if (ret == 0) goto missing_data; else if (ret < 0) { - session_inc_http_err_ctr(s); + stream_inc_http_err_ctr(s); if (msg->err_pos >= 0) http_capture_bad_message(&s->fe->invalid_req, s, msg, HTTP_MSG_TRAILERS, s->be); goto return_bad_req; @@ -5707,7 +5707,7 @@ int http_request_forward_body(struct session *s, struct channel *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 channel *rep, int an_bit) +int http_wait_for_response(struct stream *s, struct channel *rep, int an_bit) { struct http_txn *txn = &s->txn; struct http_msg *msg = &txn->rsp; @@ -5716,7 +5716,7 @@ int http_wait_for_response(struct session *s, struct channel *rep, int an_bit) int cur_idx; int n; - DPRINTF(stderr,"[%u] %s: session=%p b=%p, exp(r,w)=%u,%u bf=%08x bh=%d analysers=%02x\n", + DPRINTF(stderr,"[%u] %s: stream=%p b=%p, exp(r,w)=%u,%u bf=%08x bh=%d analysers=%02x\n", now_ms, __FUNCTION__, s, rep, @@ -5911,7 +5911,7 @@ int http_wait_for_response(struct session *s, struct channel *rep, int an_bit) if (!(s->flags & SN_FINST_MASK)) s->flags |= SN_FINST_H; - /* process_session() will take care of the error */ + /* process_stream() will take care of the error */ return 0; } @@ -5958,7 +5958,7 @@ int http_wait_for_response(struct session *s, struct channel *rep, int an_bit) if (!(s->flags & SN_FINST_MASK)) s->flags |= SN_FINST_H; - /* process_session() will take care of the error */ + /* process_stream() will take care of the error */ return 0; } @@ -5987,7 +5987,7 @@ int http_wait_for_response(struct session *s, struct channel *rep, int an_bit) * vulnerability scan. */ if (n == 4) - session_inc_http_err_ctr(s); + stream_inc_http_err_ctr(s); if (objt_server(s->target)) objt_server(s->target)->counters.p.http.rsp[n]++; @@ -6274,7 +6274,7 @@ skip_content_length: * and updates s->res.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 *s, struct channel *rep, int an_bit, struct proxy *px) +int http_process_res_common(struct stream *s, struct channel *rep, int an_bit, struct proxy *px) { struct http_txn *txn = &s->txn; struct http_msg *msg = &txn->rsp; @@ -6282,7 +6282,7 @@ int http_process_res_common(struct session *s, struct channel *rep, int an_bit, struct cond_wordlist *wl; enum rule_result ret = HTTP_RULE_RES_CONT; - DPRINTF(stderr,"[%u] %s: session=%p b=%p, exp(r,w)=%u,%u bf=%08x bh=%d analysers=%02x\n", + DPRINTF(stderr,"[%u] %s: stream=%p b=%p, exp(r,w)=%u,%u bf=%08x bh=%d analysers=%02x\n", now_ms, __FUNCTION__, s, rep, @@ -6590,7 +6590,7 @@ int http_process_res_common(struct session *s, struct channel *rep, int an_bit, * tunnel mode and we want to forward till the close. It's used both to forward * remaining data and to resync after end of body. It expects the msg_state to * be between MSG_BODY and MSG_DONE (inclusive). It returns zero if it needs to - * read more data, or 1 once we can go on with next request or end the session. + * read more data, or 1 once we can go on with next request or end the stream. * * It is capable of compressing response data both in content-length mode and * in chunked mode. The state machines follows different flows depending on @@ -6613,7 +6613,7 @@ int http_process_res_common(struct session *s, struct channel *rep, int an_bit, * is performed at once on final states for all bytes parsed, or when leaving * on missing data. */ -int http_response_forward_body(struct session *s, struct channel *res, int an_bit) +int http_response_forward_body(struct stream *s, struct channel *res, int an_bit) { struct http_txn *txn = &s->txn; struct http_msg *msg = &s->txn.rsp; @@ -6865,7 +6865,7 @@ int http_response_forward_body(struct session *s, struct channel *res, int an_bi if ((msg->flags & HTTP_MSGF_TE_CHNK) || s->comp_algo) res->flags |= CF_EXPECT_MORE; - /* the session handler will take care of timeouts and errors */ + /* the stream handler will take care of timeouts and errors */ return 0; return_bad_res: /* let's centralize all bad responses */ @@ -6928,7 +6928,7 @@ int http_response_forward_body(struct session *s, struct channel *res, int an_bi * Since it can manage the switch to another backend, it updates the per-proxy * DENY stats. */ -int apply_filter_to_req_headers(struct session *s, struct channel *req, struct hdr_exp *exp) +int apply_filter_to_req_headers(struct stream *s, struct channel *req, struct hdr_exp *exp) { char *cur_ptr, *cur_end, *cur_next; int cur_idx, old_idx, last_hdr; @@ -6974,7 +6974,7 @@ int apply_filter_to_req_headers(struct session *s, struct channel *req, struct h break; /* Swithing Proxy */ - session_set_backend(s, (struct proxy *)exp->replace); + stream_set_backend(s, (struct proxy *)exp->replace); last_hdr = 1; break; @@ -7040,7 +7040,7 @@ int apply_filter_to_req_headers(struct session *s, struct channel *req, struct h * Since it can manage the switch to another backend, it updates the per-proxy * DENY stats. */ -int apply_filter_to_req_line(struct session *s, struct channel *req, struct hdr_exp *exp) +int apply_filter_to_req_line(struct stream *s, struct channel *req, struct hdr_exp *exp) { char *cur_ptr, *cur_end; int done; @@ -7075,7 +7075,7 @@ int apply_filter_to_req_line(struct session *s, struct channel *req, struct hdr_ break; /* Swithing Proxy */ - session_set_backend(s, (struct proxy *)exp->replace); + stream_set_backend(s, (struct proxy *)exp->replace); done = 1; break; @@ -7129,12 +7129,12 @@ int apply_filter_to_req_line(struct session *s, struct channel *req, struct hdr_ /* - * Apply all the req filters of proxy to all headers in buffer of session . + * Apply all the req filters of proxy to all headers in buffer of stream . * Returns 0 if everything is alright, or -1 in case a replacement lead to an * 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 channel *req, struct proxy *px) +int apply_filters_to_request(struct stream *s, struct channel *req, struct proxy *px) { struct http_txn *txn = &s->txn; struct hdr_exp *exp; @@ -7189,9 +7189,9 @@ int apply_filters_to_request(struct session *s, struct channel *req, struct prox /* * Try to retrieve the server associated to the appsession. - * If the server is found, it's assigned to the session. + * If the server is found, it's assigned to the stream. */ -void manage_client_side_appsession(struct session *s, const char *buf, int len) { +void manage_client_side_appsession(struct stream *s, const char *buf, int len) { struct http_txn *txn = &s->txn; appsess *asession = NULL; char *sessid_temp = NULL; @@ -7201,9 +7201,9 @@ void manage_client_side_appsession(struct session *s, const char *buf, int len) } if (s->be->options2 & PR_O2_AS_REQL) { - /* request-learn option is enabled : store the sessid in the session for future use */ + /* request-learn option is enabled : store the sessid in the stream for future use */ if (txn->sessid != NULL) { - /* free previously allocated memory as we don't need the session id found in the URL anymore */ + /* free previously allocated memory as we don't need the stream id found in the URL anymore */ pool_free2(apools.sessid, txn->sessid); } @@ -7342,7 +7342,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 *s, struct channel *req) +void manage_client_side_cookies(struct stream *s, struct channel *req) { struct http_txn *txn = &s->txn; int preserve_hdr; @@ -7791,7 +7791,7 @@ void manage_client_side_cookies(struct session *s, struct channel *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 *s, struct channel *rtr, struct hdr_exp *exp) +int apply_filter_to_resp_headers(struct stream *s, struct channel *rtr, struct hdr_exp *exp) { char *cur_ptr, *cur_end, *cur_next; int cur_idx, old_idx, last_hdr; @@ -7882,7 +7882,7 @@ int apply_filter_to_resp_headers(struct session *s, struct channel *rtr, struct * 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 *s, struct channel *rtr, struct hdr_exp *exp) +int apply_filter_to_sts_line(struct stream *s, struct channel *rtr, struct hdr_exp *exp) { char *cur_ptr, *cur_end; int done; @@ -7953,11 +7953,11 @@ int apply_filter_to_sts_line(struct session *s, struct channel *rtr, struct hdr_ /* - * Apply all the resp filters of proxy to all headers in buffer of session . + * Apply all the resp filters of proxy to all headers in buffer of stream . * 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 channel *rtr, struct proxy *px) +int apply_filters_to_response(struct stream *s, struct channel *rtr, struct proxy *px) { struct http_txn *txn = &s->txn; struct hdr_exp *exp; @@ -8015,7 +8015,7 @@ int apply_filters_to_response(struct session *s, struct channel *rtr, struct pro * 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 *s, struct channel *res) +void manage_server_side_cookies(struct stream *s, struct channel *res) { struct http_txn *txn = &s->txn; struct server *srv; @@ -8315,7 +8315,7 @@ void manage_server_side_cookies(struct session *s, struct channel *res) /* free a possibly previously allocated memory */ pool_free2(apools.sessid, txn->sessid); - /* Store the sessid in the session for future use */ + /* Store the sessid in the stream for future use */ if ((txn->sessid = pool_alloc2(apools.sessid)) == NULL) { Alert("Not enough Memory process_srv():asession->sessid:malloc().\n"); send_log(s->be, LOG_ALERT, "Not enough Memory process_srv():asession->sessid:malloc().\n"); @@ -8378,7 +8378,7 @@ void manage_server_side_cookies(struct session *s, struct channel *res) /* * Check if response is cacheable or not. Updates s->flags. */ -void check_response_for_cacheability(struct session *s, struct channel *rtr) +void check_response_for_cacheability(struct stream *s, struct channel *rtr) { struct http_txn *txn = &s->txn; char *p1, *p2; @@ -8465,9 +8465,9 @@ void check_response_for_cacheability(struct session *s, struct channel *rtr) /* * Try to retrieve a known appsession in the URI, then the associated server. - * If the server is found, it's assigned to the session. + * If the server is found, it's assigned to the stream. */ -void get_srv_from_appsession(struct session *s, const char *begin, int len) +void get_srv_from_appsession(struct stream *s, const char *begin, int len) { char *end_params, *first_param, *cur_param, *next_param; char separator; @@ -8573,7 +8573,7 @@ int stats_check_uri(struct stream_interface *si, struct http_txn *txn, struct pr * parsing point. The function is able to deal with wrapping buffers. It always * displays buffers as a contiguous area starting at buf->p. */ -void http_capture_bad_message(struct error_snapshot *es, struct session *s, +void http_capture_bad_message(struct error_snapshot *es, struct stream *s, struct http_msg *msg, enum ht_state state, struct proxy *other_end) { @@ -8751,7 +8751,7 @@ unsigned int http_get_fhdr(const struct http_msg *msg, const char *hname, int hl * so it is safe to pass it a full buffer if needed. If is not NULL, an * arrow is printed after the line which contains the pointer. */ -void debug_hdr(const char *dir, struct session *s, const char *start, const char *end) +void debug_hdr(const char *dir, struct stream *s, const char *start, const char *end) { int max; chunk_printf(&trash, "%08x:%s.%s[%04x:%04x]: ", s->uniq_id, s->be->id, @@ -8770,11 +8770,11 @@ void debug_hdr(const char *dir, struct session *s, const char *start, const char } /* - * Initialize a new HTTP transaction for session . It is assumed that all + * Initialize a new HTTP transaction for stream . It is assumed that all * the required fields are properly allocated and that we only need to (re)init * them. This should be used before processing any new request. */ -void http_init_txn(struct session *s) +void http_init_txn(struct stream *s) { struct http_txn *txn = &s->txn; struct proxy *fe = s->fe; @@ -8817,7 +8817,7 @@ void http_init_txn(struct session *s) } /* to be used at the end of a transaction */ -void http_end_txn(struct session *s) +void http_end_txn(struct stream *s) { struct http_txn *txn = &s->txn; @@ -8857,7 +8857,7 @@ void http_end_txn(struct session *s) } /* to be used at the end of a transaction to prepare a new one */ -void http_reset_txn(struct session *s) +void http_reset_txn(struct stream *s) { http_end_txn(s); http_init_txn(s); @@ -8870,7 +8870,7 @@ void http_reset_txn(struct session *s) s->be = s->fe; s->logs.logwait = s->fe->to_log; s->logs.level = 0; - session_del_srv_conn(s); + stream_del_srv_conn(s); s->target = NULL; /* re-init store persistence */ s->store_count = 0; @@ -9855,7 +9855,7 @@ struct redirect_rule *http_parse_redirect_rule(const char *file, int linenum, st * 1 if an HTTP message is ready */ static int -smp_prefetch_http(struct proxy *px, struct session *s, void *l7, unsigned int opt, +smp_prefetch_http(struct proxy *px, struct stream *s, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, int req_vol) { struct http_txn *txn = l7; @@ -9984,7 +9984,7 @@ static int pat_parse_meth(const char *text, struct pattern *pattern, int mflags, * This is intended to be used with pat_match_meth() only. */ static int -smp_fetch_meth(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_meth(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { int meth; @@ -10038,7 +10038,7 @@ static struct pattern *pat_match_meth(struct sample *smp, struct pattern_expr *e } static int -smp_fetch_rqver(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_rqver(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct http_txn *txn = l7; @@ -10063,7 +10063,7 @@ smp_fetch_rqver(struct proxy *px, struct session *l4, void *l7, unsigned int opt } static int -smp_fetch_stver(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_stver(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct http_txn *txn = l7; @@ -10092,7 +10092,7 @@ smp_fetch_stver(struct proxy *px, struct session *l4, void *l7, unsigned int opt /* 3. Check on Status Code. We manipulate integers here. */ static int -smp_fetch_stcode(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_stcode(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct http_txn *txn = l7; @@ -10115,7 +10115,7 @@ smp_fetch_stcode(struct proxy *px, struct session *l4, void *l7, unsigned int op /* 4. Check on URL/URI. A pointer to the URI is stored. */ static int -smp_fetch_url(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_url(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct http_txn *txn = l7; @@ -10130,7 +10130,7 @@ smp_fetch_url(struct proxy *px, struct session *l4, void *l7, unsigned int opt, } static int -smp_fetch_url_ip(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_url_ip(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct http_txn *txn = l7; @@ -10149,7 +10149,7 @@ smp_fetch_url_ip(struct proxy *px, struct session *l4, void *l7, unsigned int op } static int -smp_fetch_url_port(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_url_port(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct http_txn *txn = l7; @@ -10175,7 +10175,7 @@ smp_fetch_url_port(struct proxy *px, struct session *l4, void *l7, unsigned int * returns full lines instead (useful for User-Agent or Date for example). */ static int -smp_fetch_fhdr(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_fhdr(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct http_txn *txn = l7; @@ -10231,7 +10231,7 @@ smp_fetch_fhdr(struct proxy *px, struct session *l4, void *l7, unsigned int opt, * returns full lines instead (useful for User-Agent or Date for example). */ static int -smp_fetch_fhdr_cnt(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_fhdr_cnt(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct http_txn *txn = l7; @@ -10261,7 +10261,7 @@ smp_fetch_fhdr_cnt(struct proxy *px, struct session *l4, void *l7, unsigned int } static int -smp_fetch_hdr_names(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_hdr_names(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct http_txn *txn = l7; @@ -10300,7 +10300,7 @@ smp_fetch_hdr_names(struct proxy *px, struct session *l4, void *l7, unsigned int * headers are considered from the first one. */ static int -smp_fetch_hdr(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_hdr(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct http_txn *txn = l7; @@ -10355,7 +10355,7 @@ smp_fetch_hdr(struct proxy *px, struct session *l4, void *l7, unsigned int opt, * Accepts exactly 1 argument of type string. */ static int -smp_fetch_hdr_cnt(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_hdr_cnt(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct http_txn *txn = l7; @@ -10390,7 +10390,7 @@ smp_fetch_hdr_cnt(struct proxy *px, struct session *l4, void *l7, unsigned int o * may or may not be appropriate for everything. */ static int -smp_fetch_hdr_val(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_hdr_val(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { int ret = smp_fetch_hdr(px, l4, l7, opt, args, smp, kw, private); @@ -10408,7 +10408,7 @@ smp_fetch_hdr_val(struct proxy *px, struct session *l4, void *l7, unsigned int o * It returns an IPv4 or IPv6 address. */ static int -smp_fetch_hdr_ip(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_hdr_ip(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { int ret; @@ -10440,7 +10440,7 @@ smp_fetch_hdr_ip(struct proxy *px, struct session *l4, void *l7, unsigned int op * the first '/' after the possible hostname, and ends before the possible '?'. */ static int -smp_fetch_path(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_path(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct http_txn *txn = l7; @@ -10473,7 +10473,7 @@ smp_fetch_path(struct proxy *px, struct session *l4, void *l7, unsigned int opt, * The returned sample is of type string. */ static int -smp_fetch_base(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_base(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct http_txn *txn = l7; @@ -10520,7 +10520,7 @@ smp_fetch_base(struct proxy *px, struct session *l4, void *l7, unsigned int opt, * high-traffic sites without having to store whole paths. */ int -smp_fetch_base32(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_base32(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct http_txn *txn = l7; @@ -10568,7 +10568,7 @@ smp_fetch_base32(struct proxy *px, struct session *l4, void *l7, unsigned int op * 8 bytes would still work. */ static int -smp_fetch_base32_src(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_base32_src(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct chunk *temp; @@ -10607,7 +10607,7 @@ smp_fetch_base32_src(struct proxy *px, struct session *l4, void *l7, unsigned in * of type string carrying the whole query string. */ static int -smp_fetch_query(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_query(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct http_txn *txn = l7; @@ -10632,7 +10632,7 @@ smp_fetch_query(struct proxy *px, struct session *l4, void *l7, unsigned int opt } static int -smp_fetch_proto_http(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_proto_http(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { /* Note: hdr_idx.v cannot be NULL in this ACL because the ACL is tagged @@ -10648,7 +10648,7 @@ smp_fetch_proto_http(struct proxy *px, struct session *l4, void *l7, unsigned in /* return a valid test if the current request is the first one on the connection */ static int -smp_fetch_http_first_req(struct proxy *px, struct session *s, void *l7, unsigned int opt, +smp_fetch_http_first_req(struct proxy *px, struct stream *s, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { if (!s) @@ -10661,7 +10661,7 @@ smp_fetch_http_first_req(struct proxy *px, struct session *s, void *l7, unsigned /* Accepts exactly 1 argument of type userlist */ static int -smp_fetch_http_auth(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_http_auth(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { @@ -10680,7 +10680,7 @@ smp_fetch_http_auth(struct proxy *px, struct session *l4, void *l7, unsigned int /* Accepts exactly 1 argument of type userlist */ static int -smp_fetch_http_auth_grp(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_http_auth_grp(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { @@ -10809,7 +10809,7 @@ extract_cookie_value(char *hdr, const char *hdr_end, * the "capture" option in the configuration file */ static int -smp_fetch_capture_header_req(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_capture_header_req(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct proxy *fe = l4->fe; @@ -10836,7 +10836,7 @@ smp_fetch_capture_header_req(struct proxy *px, struct session *l4, void *l7, uns * the "capture" option in the configuration file */ static int -smp_fetch_capture_header_res(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_capture_header_res(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct proxy *fe = l4->fe; @@ -10861,7 +10861,7 @@ smp_fetch_capture_header_res(struct proxy *px, struct session *l4, void *l7, uns /* Extracts the METHOD in the HTTP request, the txn->uri should be filled before the call */ static int -smp_fetch_capture_req_method(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_capture_req_method(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct chunk *temp; @@ -10889,7 +10889,7 @@ smp_fetch_capture_req_method(struct proxy *px, struct session *l4, void *l7, uns /* Extracts the path in the HTTP request, the txn->uri should be filled before the call */ static int -smp_fetch_capture_req_uri(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_capture_req_uri(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct chunk *temp; @@ -10928,7 +10928,7 @@ smp_fetch_capture_req_uri(struct proxy *px, struct session *l4, void *l7, unsign * as a string (either "HTTP/1.0" or "HTTP/1.1"). */ static int -smp_fetch_capture_req_ver(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_capture_req_ver(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct http_txn *txn = l7; @@ -10952,7 +10952,7 @@ smp_fetch_capture_req_ver(struct proxy *px, struct session *l4, void *l7, unsign * as a string (either "HTTP/1.0" or "HTTP/1.1"). */ static int -smp_fetch_capture_res_ver(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_capture_res_ver(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct http_txn *txn = l7; @@ -10983,7 +10983,7 @@ smp_fetch_capture_res_ver(struct proxy *px, struct session *l4, void *l7, unsign * The returned sample is of type CSTR. Can be used to parse cookies in other * files. */ -int smp_fetch_cookie(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +int smp_fetch_cookie(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct http_txn *txn = l7; @@ -11082,7 +11082,7 @@ int smp_fetch_cookie(struct proxy *px, struct session *l4, void *l7, unsigned in * type UINT. Accepts exactly 1 argument of type string. */ static int -smp_fetch_cookie_cnt(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_cookie_cnt(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct http_txn *txn = l7; @@ -11149,7 +11149,7 @@ smp_fetch_cookie_cnt(struct proxy *px, struct session *l4, void *l7, unsigned in * takes a mandatory argument of type string. It relies on smp_fetch_cookie(). */ static int -smp_fetch_cookie_val(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_cookie_val(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { int ret = smp_fetch_cookie(px, l4, l7, opt, args, smp, kw, private); @@ -11254,7 +11254,7 @@ find_url_param_value(char* path, size_t path_l, } static int -smp_fetch_url_param(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_url_param(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { char delim = '?'; @@ -11285,7 +11285,7 @@ smp_fetch_url_param(struct proxy *px, struct session *l4, void *l7, unsigned int * above). */ static int -smp_fetch_url_param_val(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_url_param_val(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { int ret = smp_fetch_url_param(px, l4, l7, opt, args, smp, kw, private); @@ -11309,7 +11309,7 @@ smp_fetch_url_param_val(struct proxy *px, struct session *l4, void *l7, unsigned * as well as the path */ static int -smp_fetch_url32(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_url32(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct http_txn *txn = l7; @@ -11357,7 +11357,7 @@ smp_fetch_url32(struct proxy *px, struct session *l4, void *l7, unsigned int opt * 8 bytes would still work. */ static int -smp_fetch_url32_src(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_url32_src(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct chunk *temp; @@ -11409,7 +11409,7 @@ int val_hdr(struct arg *arg, char **err_msg) * adds an optional offset found in args[0] and emits a string representing * the date in RFC-1123/5322 format. */ -static int sample_conv_http_date(struct session *session, const struct arg *args, +static int sample_conv_http_date(struct stream *stream, const struct arg *args, struct sample *smp, void *private) { const char day[7][4] = { "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun" }; @@ -11461,7 +11461,7 @@ static inline int language_range_match(const char *range, int range_len, } /* Arguments: The list of expected value, the number of parts returned and the separator */ -static int sample_conv_q_prefered(struct session *session, const struct arg *args, +static int sample_conv_q_prefered(struct stream *stream, const struct arg *args, struct sample *smp, void *private) { const char *al = smp->data.str.str; @@ -11623,7 +11623,7 @@ expect_comma: * string by the caller, event if the replacement query string is empty. */ int http_replace_req_line(int action, const char *replace, int len, - struct proxy *px, struct session *s, struct http_txn *txn) + struct proxy *px, struct stream *s, struct http_txn *txn) { char *cur_ptr, *cur_end; int offset = 0; @@ -11704,7 +11704,7 @@ int http_replace_req_line(int action, const char *replace, int len, * http_action_set_req_line_exec(). It always returns 1. If an error occurs * the action is canceled, but the rule processing continue. */ -int http_action_set_req_line(struct http_req_rule *rule, struct proxy *px, struct session *s, struct http_txn *txn) +int http_action_set_req_line(struct http_req_rule *rule, struct proxy *px, struct stream *s, struct http_txn *txn) { chunk_reset(&trash); @@ -11914,7 +11914,7 @@ static struct sample_fetch_kw_list sample_fetch_keywords = {ILH, { { "base32", smp_fetch_base32, 0, NULL, SMP_T_UINT, SMP_USE_HRQHV }, { "base32+src", smp_fetch_base32_src, 0, NULL, SMP_T_BIN, SMP_USE_HRQHV }, - /* capture are allocated and are permanent in the session */ + /* capture are allocated and are permanent in the stream */ { "capture.req.hdr", smp_fetch_capture_header_req, ARG1(1, UINT), NULL, SMP_T_STR, SMP_USE_HRQHP }, /* retrieve these captures from the HTTP logs */ diff --git a/src/proto_tcp.c b/src/proto_tcp.c index b1ce8b60b..83669f362 100644 --- a/src/proto_tcp.c +++ b/src/proto_tcp.c @@ -51,7 +51,7 @@ #include #include #include -#include +#include #include #include #include @@ -1087,14 +1087,14 @@ int tcp_pause_listener(struct listener *l) * 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 channel *req, int an_bit) +int tcp_inspect_request(struct stream *s, struct channel *req, int an_bit) { struct tcp_rule *rule; struct stksess *ts; struct stktable *t; int partial; - DPRINTF(stderr,"[%u] %s: session=%p b=%p, exp(r,w)=%u,%u bf=%08x bh=%d analysers=%02x\n", + DPRINTF(stderr,"[%u] %s: stream=%p b=%p, exp(r,w)=%u,%u bf=%08x bh=%d analysers=%02x\n", now_ms, __FUNCTION__, s, req, @@ -1180,7 +1180,7 @@ resume_execution: goto missing_data; /* key might appear later */ if (key && (ts = stktable_get_entry(t, key))) { - session_track_stkctr(&s->stkctr[tcp_trk_idx(rule->action)], t, ts); + stream_track_stkctr(&s->stkctr[tcp_trk_idx(rule->action)], t, ts); stkctr_set_flags(&s->stkctr[tcp_trk_idx(rule->action)], STKCTR_TRACK_CONTENT); if (s->fe != s->be) stkctr_set_flags(&s->stkctr[tcp_trk_idx(rule->action)], STKCTR_TRACK_BACKEND); @@ -1247,12 +1247,12 @@ resume_execution: * 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 channel *rep, int an_bit) +int tcp_inspect_response(struct stream *s, struct channel *rep, int an_bit) { struct tcp_rule *rule; int partial; - DPRINTF(stderr,"[%u] %s: session=%p b=%p, exp(r,w)=%u,%u bf=%08x bh=%d analysers=%02x\n", + DPRINTF(stderr,"[%u] %s: stream=%p b=%p, exp(r,w)=%u,%u bf=%08x bh=%d analysers=%02x\n", now_ms, __FUNCTION__, s, rep, @@ -1358,7 +1358,7 @@ resume_execution: * matches or if no more rule matches. It can only use rules which don't need * any data. This only works on connection-based client-facing stream interfaces. */ -int tcp_exec_req_rules(struct session *s) +int tcp_exec_req_rules(struct stream *s) { struct tcp_rule *rule; struct stksess *ts; @@ -1407,7 +1407,7 @@ int tcp_exec_req_rules(struct session *s) key = stktable_fetch_key(t, s->be, s, &s->txn, SMP_OPT_DIR_REQ|SMP_OPT_FINAL, rule->act_prm.trk_ctr.expr, NULL); if (key && (ts = stktable_get_entry(t, key))) - session_track_stkctr(&s->stkctr[tcp_trk_idx(rule->action)], t, ts); + stream_track_stkctr(&s->stkctr[tcp_trk_idx(rule->action)], t, ts); } else if (rule->action == TCP_ACT_EXPECT_PX) { conn->flags |= CO_FL_ACCEPT_PROXY; @@ -1962,7 +1962,7 @@ static int tcp_parse_tcp_req(char **args, int section_type, struct proxy *curpx, /* fetch the connection's source IPv4/IPv6 address */ static int -smp_fetch_src(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_src(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct connection *cli_conn = objt_conn(l4->si[0].end); @@ -1989,7 +1989,7 @@ smp_fetch_src(struct proxy *px, struct session *l4, void *l7, unsigned int opt, /* set temp integer to the connection's source port */ static int -smp_fetch_sport(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_sport(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *k, void *private) { struct connection *cli_conn = objt_conn(l4->si[0].end); @@ -2007,7 +2007,7 @@ smp_fetch_sport(struct proxy *px, struct session *l4, void *l7, unsigned int opt /* fetch the connection's destination IPv4/IPv6 address */ static int -smp_fetch_dst(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_dst(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct connection *cli_conn = objt_conn(l4->si[0].end); @@ -2036,7 +2036,7 @@ smp_fetch_dst(struct proxy *px, struct session *l4, void *l7, unsigned int opt, /* set temp integer to the frontend connexion's destination port */ static int -smp_fetch_dport(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_dport(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct connection *cli_conn = objt_conn(l4->si[0].end); diff --git a/src/proxy.c b/src/proxy.c index a8cb443b5..df8bc1e5a 100644 --- a/src/proxy.c +++ b/src/proxy.c @@ -623,7 +623,7 @@ int start_proxies(int verbose) /* * This is the proxy management task. It enables proxies when there are enough - * free sessions, or stops them when the table is full. It is designed to be + * free streams, or stops them when the table is full. It is designed to be * called as a task which is woken up upon stopping or when rate limiting must * be enforced. */ @@ -658,7 +658,7 @@ struct task *manage_proxy(struct task *t) /* If the proxy holds a stick table, we need to purge all unused * entries. These are all the ones in the table with ref_cnt == 0 * and all the ones in the pool used to allocate new entries. Any - * entry attached to an existing session waiting for a store will + * entry attached to an existing stream waiting for a store will * be in neither list. Any entry being dumped will have ref_cnt > 0. * However we protect tables that are being synced to peers. */ @@ -918,13 +918,13 @@ void resume_proxies(void) } } -/* Set current session's backend to . Nothing is done if the - * session already had a backend assigned, which is indicated by +/* Set current stream's backend to . Nothing is done if the + * stream already had a backend assigned, which is indicated by * s->flags & SN_BE_ASSIGNED. * All flags, stats and counters which need be updated are updated. * Returns 1 if done, 0 in case of internal error, eg: lack of resource. */ -int session_set_backend(struct session *s, struct proxy *be) +int stream_set_backend(struct stream *s, struct proxy *be) { if (s->flags & SN_BE_ASSIGNED) return 1; @@ -934,7 +934,7 @@ int session_set_backend(struct session *s, struct proxy *be) be->be_counters.conn_max = be->beconn; proxy_inc_be_ctr(be); - /* assign new parameters to the session from the new backend */ + /* assign new parameters to the stream from the new backend */ s->si[1].flags &= ~SI_FL_INDEP_STR; if (be->options2 & PR_O2_INDEPSTR) s->si[1].flags |= SI_FL_INDEP_STR; diff --git a/src/queue.c b/src/queue.c index 74fa65921..14e4be6c5 100644 --- a/src/queue.c +++ b/src/queue.c @@ -16,7 +16,7 @@ #include #include -#include +#include #include #include @@ -63,7 +63,7 @@ unsigned int srv_dynamic_maxconn(const struct server *s) /* * Manages a server's connection queue. This function will try to dequeue as - * many pending sessions as possible, and wake them up. + * many pending streams as possible, and wake them up. */ void process_srv_queue(struct server *s) { @@ -76,15 +76,16 @@ void process_srv_queue(struct server *s) maxconn = srv_dynamic_maxconn(s); while (s->served < maxconn) { - struct session *sess = pendconn_get_next_sess(s, p); - if (sess == NULL) + struct stream *strm = pendconn_get_next_strm(s, p); + + if (strm == NULL) break; - task_wakeup(sess->task, TASK_WOKEN_RES); + task_wakeup(strm->task, TASK_WOKEN_RES); } } /* Detaches the next pending connection from either a server or a proxy, and - * returns its associated session. If no pending connection is found, NULL is + * returns its associated stream. If no pending connection is found, NULL is * returned. Note that neither nor may be NULL. * Priority is given to the oldest request in the queue if both and * have pending requests. This ensures that no request will be left unserved. @@ -93,13 +94,13 @@ void process_srv_queue(struct server *s) * queue is still considered in this case, because if some connections remain * there, it means that some requests have been forced there after it was seen * down (eg: due to option persist). - * The session is immediately marked as "assigned", and both its and + * The stream is immediately marked as "assigned", and both its and * are set to , */ -struct session *pendconn_get_next_sess(struct server *srv, struct proxy *px) +struct stream *pendconn_get_next_strm(struct server *srv, struct proxy *px) { struct pendconn *ps, *pp; - struct session *sess; + struct stream *strm; struct server *rsrv; rsrv = srv->track; @@ -114,30 +115,30 @@ struct session *pendconn_get_next_sess(struct server *srv, struct proxy *px) return NULL; } else { /* pendconn exists in the proxy queue */ - if (!ps || tv_islt(&pp->sess->logs.tv_request, &ps->sess->logs.tv_request)) + if (!ps || tv_islt(&pp->strm->logs.tv_request, &ps->strm->logs.tv_request)) ps = pp; } - sess = ps->sess; + strm = ps->strm; pendconn_free(ps); - /* we want to note that the session has now been assigned a server */ - sess->flags |= SN_ASSIGNED; - sess->target = &srv->obj_type; - session_add_srv_conn(sess, srv); + /* we want to note that the stream has now been assigned a server */ + strm->flags |= SN_ASSIGNED; + strm->target = &srv->obj_type; + stream_add_srv_conn(strm, srv); srv->served++; if (px->lbprm.server_take_conn) px->lbprm.server_take_conn(srv); - return sess; + return strm; } -/* Adds the session to the pending connection list of server ->srv - * or to the one of ->proxy if srv is NULL. All counters and back pointers +/* Adds the stream to the pending connection list of server ->srv + * or to the one of ->proxy if srv is NULL. All counters and back pointers * are updated accordingly. Returns NULL if no memory is available, otherwise the - * pendconn itself. If the session was already marked as served, its flag is - * cleared. It is illegal to call this function with a non-NULL sess->srv_conn. + * pendconn itself. If the stream was already marked as served, its flag is + * cleared. It is illegal to call this function with a non-NULL strm->srv_conn. */ -struct pendconn *pendconn_add(struct session *sess) +struct pendconn *pendconn_add(struct stream *strm) { struct pendconn *p; struct server *srv; @@ -146,24 +147,24 @@ struct pendconn *pendconn_add(struct session *sess) if (!p) return NULL; - sess->pend_pos = p; - p->sess = sess; - p->srv = srv = objt_server(sess->target); + strm->pend_pos = p; + p->strm = strm; + p->srv = srv = objt_server(strm->target); - if (sess->flags & SN_ASSIGNED && srv) { + if (strm->flags & SN_ASSIGNED && srv) { LIST_ADDQ(&srv->pendconns, &p->list); srv->nbpend++; - sess->logs.srv_queue_size += srv->nbpend; + strm->logs.srv_queue_size += srv->nbpend; if (srv->nbpend > srv->counters.nbpend_max) srv->counters.nbpend_max = srv->nbpend; } else { - LIST_ADDQ(&sess->be->pendconns, &p->list); - sess->be->nbpend++; - sess->logs.prx_queue_size += sess->be->nbpend; - if (sess->be->nbpend > sess->be->be_counters.nbpend_max) - sess->be->be_counters.nbpend_max = sess->be->nbpend; + LIST_ADDQ(&strm->be->pendconns, &p->list); + strm->be->nbpend++; + strm->logs.prx_queue_size += strm->be->nbpend; + if (strm->be->nbpend > strm->be->be_counters.nbpend_max) + strm->be->be_counters.nbpend_max = strm->be->nbpend; } - sess->be->totpend++; + strm->be->totpend++; return p; } @@ -176,19 +177,19 @@ int pendconn_redistribute(struct server *s) int xferred = 0; list_for_each_entry_safe(pc, pc_bck, &s->pendconns, list) { - struct session *sess = pc->sess; + struct stream *strm = pc->strm; - if ((sess->be->options & (PR_O_REDISP|PR_O_PERSIST)) == PR_O_REDISP && - !(sess->flags & SN_FORCE_PRST)) { + if ((strm->be->options & (PR_O_REDISP|PR_O_PERSIST)) == PR_O_REDISP && + !(strm->flags & SN_FORCE_PRST)) { /* The REDISP option was specified. We will ignore * cookie and force to balance or use the dispatcher. */ /* it's left to the dispatcher to choose a server */ - sess->flags &= ~(SN_DIRECT | SN_ASSIGNED | SN_ADDR_SET); + strm->flags &= ~(SN_DIRECT | SN_ASSIGNED | SN_ADDR_SET); pendconn_free(pc); - task_wakeup(sess->task, TASK_WOKEN_RES); + task_wakeup(strm->task, TASK_WOKEN_RES); xferred++; } } @@ -208,16 +209,16 @@ int pendconn_grab_from_px(struct server *s) return 0; for (xferred = 0; !s->maxconn || xferred < srv_dynamic_maxconn(s); xferred++) { - struct session *sess; + struct stream *strm; struct pendconn *p; p = pendconn_from_px(s->proxy); if (!p) break; - p->sess->target = &s->obj_type; - sess = p->sess; + p->strm->target = &s->obj_type; + strm = p->strm; pendconn_free(p); - task_wakeup(sess->task, TASK_WOKEN_RES); + task_wakeup(strm->task, TASK_WOKEN_RES); } return xferred; } @@ -225,17 +226,17 @@ int pendconn_grab_from_px(struct server *s) /* * Detaches pending connection

, decreases the pending count, and frees * the pending connection. The connection might have been queued to a specific - * server as well as to the proxy. The session also gets marked unqueued. + * server as well as to the proxy. The stream also gets marked unqueued. */ void pendconn_free(struct pendconn *p) { LIST_DEL(&p->list); - p->sess->pend_pos = NULL; + p->strm->pend_pos = NULL; if (p->srv) p->srv->nbpend--; else - p->sess->be->nbpend--; - p->sess->be->totpend--; + p->strm->be->nbpend--; + p->strm->be->totpend--; pool_free2(pool2_pendconn, p); } diff --git a/src/sample.c b/src/sample.c index 3c464c46f..c5f5b1694 100644 --- a/src/sample.c +++ b/src/sample.c @@ -1022,7 +1022,7 @@ out_error: * smp 1 0 Present, may change (eg: request length) * smp 1 1 Present, last known value (eg: request length) */ -struct sample *sample_process(struct proxy *px, struct session *l4, void *l7, +struct sample *sample_process(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, struct sample_expr *expr, struct sample *p) { @@ -1331,7 +1331,7 @@ int smp_resolve_args(struct proxy *p) * smp 1 0 Not present yet, may appear later (eg: header) * smp 1 1 never happens (either flag is cleared on output) */ -struct sample *sample_fetch_string(struct proxy *px, struct session *l4, void *l7, +struct sample *sample_fetch_string(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, struct sample_expr *expr) { struct sample *smp = &temp_smp; @@ -1360,7 +1360,7 @@ struct sample *sample_fetch_string(struct proxy *px, struct session *l4, void *l /* These functions set the data type on return. */ /*****************************************************************/ -static int sample_conv_bin2base64(struct session *session, const struct arg *arg_p, +static int sample_conv_bin2base64(struct stream *stream, const struct arg *arg_p, struct sample *smp, void *private) { struct chunk *trash = get_trash_chunk(); @@ -1378,7 +1378,7 @@ static int sample_conv_bin2base64(struct session *session, const struct arg *arg return 1; } -static int sample_conv_bin2hex(struct session *session, const struct arg *arg_p, +static int sample_conv_bin2hex(struct stream *stream, const struct arg *arg_p, struct sample *smp, void *private) { struct chunk *trash = get_trash_chunk(); @@ -1398,7 +1398,7 @@ static int sample_conv_bin2hex(struct session *session, const struct arg *arg_p, } /* hashes the binary input into a 32-bit unsigned int */ -static int sample_conv_djb2(struct session *session, const struct arg *arg_p, +static int sample_conv_djb2(struct stream *stream, const struct arg *arg_p, struct sample *smp, void *private) { smp->data.uint = hash_djb2(smp->data.str.str, smp->data.str.len); @@ -1408,7 +1408,7 @@ static int sample_conv_djb2(struct session *session, const struct arg *arg_p, return 1; } -static int sample_conv_str2lower(struct session *session, const struct arg *arg_p, +static int sample_conv_str2lower(struct stream *stream, const struct arg *arg_p, struct sample *smp, void *private) { int i; @@ -1426,7 +1426,7 @@ static int sample_conv_str2lower(struct session *session, const struct arg *arg_ return 1; } -static int sample_conv_str2upper(struct session *session, const struct arg *arg_p, +static int sample_conv_str2upper(struct stream *stream, const struct arg *arg_p, struct sample *smp, void *private) { int i; @@ -1445,7 +1445,7 @@ static int sample_conv_str2upper(struct session *session, const struct arg *arg_ } /* takes the netmask in arg_p */ -static int sample_conv_ipmask(struct session *session, const struct arg *arg_p, +static int sample_conv_ipmask(struct stream *stream, const struct arg *arg_p, struct sample *smp, void *private) { smp->data.ipv4.s_addr &= arg_p->data.ipv4.s_addr; @@ -1457,7 +1457,7 @@ static int sample_conv_ipmask(struct session *session, const struct arg *arg_p, * adds an optional offset found in args[1] and emits a string representing * the local time in the format specified in args[1] using strftime(). */ -static int sample_conv_ltime(struct session *session, const struct arg *args, +static int sample_conv_ltime(struct stream *stream, const struct arg *args, struct sample *smp, void *private) { struct chunk *temp; @@ -1475,7 +1475,7 @@ static int sample_conv_ltime(struct session *session, const struct arg *args, } /* hashes the binary input into a 32-bit unsigned int */ -static int sample_conv_sdbm(struct session *session, const struct arg *arg_p, +static int sample_conv_sdbm(struct stream *stream, const struct arg *arg_p, struct sample *smp, void *private) { smp->data.uint = hash_sdbm(smp->data.str.str, smp->data.str.len); @@ -1489,7 +1489,7 @@ static int sample_conv_sdbm(struct session *session, const struct arg *arg_p, * adds an optional offset found in args[1] and emits a string representing * the UTC date in the format specified in args[1] using strftime(). */ -static int sample_conv_utime(struct session *session, const struct arg *args, +static int sample_conv_utime(struct stream *stream, const struct arg *args, struct sample *smp, void *private) { struct chunk *temp; @@ -1507,7 +1507,7 @@ static int sample_conv_utime(struct session *session, const struct arg *args, } /* hashes the binary input into a 32-bit unsigned int */ -static int sample_conv_wt6(struct session *session, const struct arg *arg_p, +static int sample_conv_wt6(struct stream *stream, const struct arg *arg_p, struct sample *smp, void *private) { smp->data.uint = hash_wt6(smp->data.str.str, smp->data.str.len); @@ -1518,7 +1518,7 @@ static int sample_conv_wt6(struct session *session, const struct arg *arg_p, } /* hashes the binary input into a 32-bit unsigned int */ -static int sample_conv_crc32(struct session *session, const struct arg *arg_p, +static int sample_conv_crc32(struct stream *stream, const struct arg *arg_p, struct sample *smp, void *private) { smp->data.uint = hash_crc32(smp->data.str.str, smp->data.str.len); @@ -1599,7 +1599,7 @@ static int sample_conv_json_check(struct arg *arg, struct sample_conv *conv, return 0; } -static int sample_conv_json(struct session *session, const struct arg *arg_p, +static int sample_conv_json(struct stream *stream, const struct arg *arg_p, struct sample *smp, void *private) { struct chunk *temp; @@ -1714,7 +1714,7 @@ static int sample_conv_json(struct session *session, const struct arg *arg_p, /* This sample function is designed to extract some bytes from an input buffer. * First arg is the offset. * Optional second arg is the length to truncate */ -static int sample_conv_bytes(struct session *session, const struct arg *arg_p, +static int sample_conv_bytes(struct stream *stream, const struct arg *arg_p, struct sample *smp, void *private) { if (smp->data.str.len <= arg_p[0].data.uint) { @@ -1772,7 +1772,7 @@ static int sample_conv_field_check(struct arg *args, struct sample_conv *conv, * First arg is the index of the field (start at 1) * Second arg is a char list of separators (type string) */ -static int sample_conv_field(struct session *session, const struct arg *arg_p, +static int sample_conv_field(struct stream *stream, const struct arg *arg_p, struct sample *smp, void *private) { unsigned int field; @@ -1824,7 +1824,7 @@ found: * First arg is the index of the word (start at 1) * Second arg is a char list of words separators (type string) */ -static int sample_conv_word(struct session *session, const struct arg *arg_p, +static int sample_conv_word(struct stream *stream, const struct arg *arg_p, struct sample *smp, void *private) { unsigned int word; @@ -1919,7 +1919,7 @@ static int sample_conv_regsub_check(struct arg *args, struct sample_conv *conv, * location until nothing matches anymore. First arg is the regex to apply to * the input string, second arg is the replacement expression. */ -static int sample_conv_regsub(struct session *session, const struct arg *arg_p, +static int sample_conv_regsub(struct stream *stream, const struct arg *arg_p, struct sample *smp, void *private) { char *start, *end; @@ -1992,7 +1992,7 @@ static int sample_conv_regsub(struct session *session, const struct arg *arg_p, /* Takes a UINT on input, applies a binary twos complement and returns the UINT * result. */ -static int sample_conv_binary_cpl(struct session *session, const struct arg *arg_p, +static int sample_conv_binary_cpl(struct stream *stream, const struct arg *arg_p, struct sample *smp, void *private) { smp->data.uint = ~smp->data.uint; @@ -2002,7 +2002,7 @@ static int sample_conv_binary_cpl(struct session *session, const struct arg *arg /* Takes a UINT on input, applies a binary "and" with the UINT in arg_p, and * returns the UINT result. */ -static int sample_conv_binary_and(struct session *session, const struct arg *arg_p, +static int sample_conv_binary_and(struct stream *stream, const struct arg *arg_p, struct sample *smp, void *private) { smp->data.uint &= arg_p->data.uint; @@ -2012,7 +2012,7 @@ static int sample_conv_binary_and(struct session *session, const struct arg *arg /* Takes a UINT on input, applies a binary "or" with the UINT in arg_p, and * returns the UINT result. */ -static int sample_conv_binary_or(struct session *session, const struct arg *arg_p, +static int sample_conv_binary_or(struct stream *stream, const struct arg *arg_p, struct sample *smp, void *private) { smp->data.uint |= arg_p->data.uint; @@ -2022,7 +2022,7 @@ static int sample_conv_binary_or(struct session *session, const struct arg *arg_ /* Takes a UINT on input, applies a binary "xor" with the UINT in arg_p, and * returns the UINT result. */ -static int sample_conv_binary_xor(struct session *session, const struct arg *arg_p, +static int sample_conv_binary_xor(struct stream *stream, const struct arg *arg_p, struct sample *smp, void *private) { smp->data.uint ^= arg_p->data.uint; @@ -2032,7 +2032,7 @@ static int sample_conv_binary_xor(struct session *session, const struct arg *arg /* Takes a UINT on input, applies an arithmetic "add" with the UINT in arg_p, * and returns the UINT result. */ -static int sample_conv_arith_add(struct session *session, const struct arg *arg_p, +static int sample_conv_arith_add(struct stream *stream, const struct arg *arg_p, struct sample *smp, void *private) { smp->data.uint += arg_p->data.uint; @@ -2042,7 +2042,7 @@ static int sample_conv_arith_add(struct session *session, const struct arg *arg_ /* Takes a UINT on input, applies an arithmetic "sub" with the UINT in arg_p, * and returns the UINT result. */ -static int sample_conv_arith_sub(struct session *session, const struct arg *arg_p, +static int sample_conv_arith_sub(struct stream *stream, const struct arg *arg_p, struct sample *smp, void *private) { smp->data.uint -= arg_p->data.uint; @@ -2052,7 +2052,7 @@ static int sample_conv_arith_sub(struct session *session, const struct arg *arg_ /* Takes a UINT on input, applies an arithmetic "mul" with the UINT in arg_p, * and returns the UINT result. */ -static int sample_conv_arith_mul(struct session *session, const struct arg *arg_p, +static int sample_conv_arith_mul(struct stream *stream, const struct arg *arg_p, struct sample *smp, void *private) { smp->data.uint *= arg_p->data.uint; @@ -2063,7 +2063,7 @@ static int sample_conv_arith_mul(struct session *session, const struct arg *arg_ * and returns the UINT result. If arg_p makes the result overflow, then the * largest possible quantity is returned. */ -static int sample_conv_arith_div(struct session *session, const struct arg *arg_p, +static int sample_conv_arith_div(struct stream *stream, const struct arg *arg_p, struct sample *smp, void *private) { if (arg_p->data.uint) @@ -2077,7 +2077,7 @@ static int sample_conv_arith_div(struct session *session, const struct arg *arg_ * and returns the UINT result. If arg_p makes the result overflow, then zero * is returned. */ -static int sample_conv_arith_mod(struct session *session, const struct arg *arg_p, +static int sample_conv_arith_mod(struct stream *stream, const struct arg *arg_p, struct sample *smp, void *private) { if (arg_p->data.uint) @@ -2090,7 +2090,7 @@ static int sample_conv_arith_mod(struct session *session, const struct arg *arg_ /* Takes an UINT on input, applies an arithmetic "neg" and returns the UINT * result. */ -static int sample_conv_arith_neg(struct session *session, const struct arg *arg_p, +static int sample_conv_arith_neg(struct stream *stream, const struct arg *arg_p, struct sample *smp, void *private) { smp->data.uint = -smp->data.uint; @@ -2100,7 +2100,7 @@ static int sample_conv_arith_neg(struct session *session, const struct arg *arg_ /* Takes a UINT on input, returns true is the value is non-null, otherwise * false. The output is a BOOL. */ -static int sample_conv_arith_bool(struct session *session, const struct arg *arg_p, +static int sample_conv_arith_bool(struct stream *stream, const struct arg *arg_p, struct sample *smp, void *private) { smp->data.uint = !!smp->data.uint; @@ -2111,7 +2111,7 @@ static int sample_conv_arith_bool(struct session *session, const struct arg *arg /* Takes a UINT on input, returns false is the value is non-null, otherwise * truee. The output is a BOOL. */ -static int sample_conv_arith_not(struct session *session, const struct arg *arg_p, +static int sample_conv_arith_not(struct stream *stream, const struct arg *arg_p, struct sample *smp, void *private) { smp->data.uint = !smp->data.uint; @@ -2122,7 +2122,7 @@ static int sample_conv_arith_not(struct session *session, const struct arg *arg_ /* Takes a UINT on input, returns true is the value is odd, otherwise false. * The output is a BOOL. */ -static int sample_conv_arith_odd(struct session *session, const struct arg *arg_p, +static int sample_conv_arith_odd(struct stream *stream, const struct arg *arg_p, struct sample *smp, void *private) { smp->data.uint = smp->data.uint & 1; @@ -2133,7 +2133,7 @@ static int sample_conv_arith_odd(struct session *session, const struct arg *arg_ /* Takes a UINT on input, returns true is the value is even, otherwise false. * The output is a BOOL. */ -static int sample_conv_arith_even(struct session *session, const struct arg *arg_p, +static int sample_conv_arith_even(struct stream *stream, const struct arg *arg_p, struct sample *smp, void *private) { smp->data.uint = !(smp->data.uint & 1); @@ -2147,7 +2147,7 @@ static int sample_conv_arith_even(struct session *session, const struct arg *arg /* force TRUE to be returned at the fetch level */ static int -smp_fetch_true(struct proxy *px, struct session *s, void *l7, unsigned int opt, +smp_fetch_true(struct proxy *px, struct stream *s, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { smp->type = SMP_T_BOOL; @@ -2157,7 +2157,7 @@ smp_fetch_true(struct proxy *px, struct session *s, void *l7, unsigned int opt, /* force FALSE to be returned at the fetch level */ static int -smp_fetch_false(struct proxy *px, struct session *s, void *l7, unsigned int opt, +smp_fetch_false(struct proxy *px, struct stream *s, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { smp->type = SMP_T_BOOL; @@ -2167,7 +2167,7 @@ smp_fetch_false(struct proxy *px, struct session *s, void *l7, unsigned int opt, /* retrieve environment variable $1 as a string */ static int -smp_fetch_env(struct proxy *px, struct session *s, void *l7, unsigned int opt, +smp_fetch_env(struct proxy *px, struct stream *s, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { char *env; @@ -2190,7 +2190,7 @@ smp_fetch_env(struct proxy *px, struct session *s, void *l7, unsigned int opt, * of args[0] seconds. */ static int -smp_fetch_date(struct proxy *px, struct session *s, void *l7, unsigned int opt, +smp_fetch_date(struct proxy *px, struct stream *s, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { smp->data.uint = date.tv_sec; @@ -2206,7 +2206,7 @@ smp_fetch_date(struct proxy *px, struct session *s, void *l7, unsigned int opt, /* returns the number of processes */ static int -smp_fetch_nbproc(struct proxy *px, struct session *s, void *l7, unsigned int opt, +smp_fetch_nbproc(struct proxy *px, struct stream *s, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { smp->type = SMP_T_UINT; @@ -2216,7 +2216,7 @@ smp_fetch_nbproc(struct proxy *px, struct session *s, void *l7, unsigned int opt /* returns the number of the current process (between 1 and nbproc */ static int -smp_fetch_proc(struct proxy *px, struct session *s, void *l7, unsigned int opt, +smp_fetch_proc(struct proxy *px, struct stream *s, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { smp->type = SMP_T_UINT; @@ -2228,7 +2228,7 @@ smp_fetch_proc(struct proxy *px, struct session *s, void *l7, unsigned int opt, * range specified in argument. */ static int -smp_fetch_rand(struct proxy *px, struct session *s, void *l7, unsigned int opt, +smp_fetch_rand(struct proxy *px, struct stream *s, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { smp->data.uint = random(); @@ -2244,7 +2244,7 @@ smp_fetch_rand(struct proxy *px, struct session *s, void *l7, unsigned int opt, /* returns true if the current process is stopping */ static int -smp_fetch_stopping(struct proxy *px, struct session *s, void *l7, unsigned int opt, +smp_fetch_stopping(struct proxy *px, struct stream *s, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { smp->type = SMP_T_BOOL; diff --git a/src/server.c b/src/server.c index edd76708b..aee08b0b6 100644 --- a/src/server.c +++ b/src/server.c @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include @@ -166,26 +166,26 @@ static int srv_parse_id(char **args, int *cur_arg, struct proxy *curproxy, struc * code in , which must be one of SN_ERR_* indicating the reason for the * shutdown. */ -void srv_shutdown_sessions(struct server *srv, int why) +void srv_shutdown_streams(struct server *srv, int why) { - struct session *session, *session_bck; + struct stream *stream, *stream_bck; - list_for_each_entry_safe(session, session_bck, &srv->actconns, by_srv) - if (session->srv_conn == srv) - session_shutdown(session, why); + list_for_each_entry_safe(stream, stream_bck, &srv->actconns, by_srv) + if (stream->srv_conn == srv) + stream_shutdown(stream, why); } /* Shutdown all connections of all backup servers of a proxy. The caller must * pass a termination code in , which must be one of SN_ERR_* indicating * the reason for the shutdown. */ -void srv_shutdown_backup_sessions(struct proxy *px, int why) +void srv_shutdown_backup_streams(struct proxy *px, int why) { struct server *srv; for (srv = px->srv; srv != NULL; srv = srv->next) if (srv->flags & SRV_F_BACKUP) - srv_shutdown_sessions(srv, why); + srv_shutdown_streams(srv, why); } /* Appends some information to a message string related to a server going UP or @@ -193,7 +193,7 @@ void srv_shutdown_backup_sessions(struct proxy *px, int why) * one, a "via" information will be provided to know where the status came from. * If is non-null, the entire string will be appended after a comma and * a space (eg: to report some information from the check that changed the state). - * If is non-negative, some information about requeued sessions are + * If is non-negative, some information about requeued streams are * provided. */ void srv_append_status(struct chunk *msg, struct server *s, const char *reason, int xferred, int forced) @@ -221,7 +221,7 @@ void srv_append_status(struct chunk *msg, struct server *s, const char *reason, /* Marks server down, regardless of its checks' statuses, notifies by all * available means, recounts the remaining servers on the proxy and transfers - * queued sessions whenever possible to other servers. It automatically + * queued streams whenever possible to other servers. It automatically * recomputes the number of servers, but not the map. Maintenance servers are * ignored. It reports if non-null as the reason for going down. Note * that it makes use of the trash to build the log strings, so must @@ -244,9 +244,9 @@ void srv_set_stopped(struct server *s, const char *reason) s->proxy->lbprm.set_server_status_down(s); if (s->onmarkeddown & HANA_ONMARKEDDOWN_SHUTDOWNSESSIONS) - srv_shutdown_sessions(s, SN_ERR_DOWN); + srv_shutdown_streams(s, SN_ERR_DOWN); - /* we might have sessions queued on this server and waiting for + /* we might have streams queued on this server and waiting for * a connection. Those which are redispatchable will be queued * to another server or to the proxy itself. */ @@ -313,12 +313,12 @@ void srv_set_running(struct server *s, const char *reason) /* If the server is set with "on-marked-up shutdown-backup-sessions", * and it's not a backup server and its effective weight is > 0, - * then it can accept new connections, so we shut down all sessions + * then it can accept new connections, so we shut down all streams * on all backup servers. */ if ((s->onmarkedup & HANA_ONMARKEDUP_SHUTDOWNBACKUPSESSIONS) && !(s->flags & SRV_F_BACKUP) && s->eweight) - srv_shutdown_backup_sessions(s->proxy, SN_ERR_UP); + srv_shutdown_backup_streams(s->proxy, SN_ERR_UP); /* check if we can handle some connections queued at the proxy. We * will take as many as we can handle. @@ -361,7 +361,7 @@ void srv_set_stopping(struct server *s, const char *reason) if (s->proxy->lbprm.set_server_status_down) s->proxy->lbprm.set_server_status_down(s); - /* we might have sessions queued on this server and waiting for + /* we might have streams queued on this server and waiting for * a connection. Those which are redispatchable will be queued * to another server or to the proxy itself. */ @@ -438,9 +438,9 @@ void srv_set_admin_flag(struct server *s, enum srv_admin mode) s->proxy->lbprm.set_server_status_down(s); if (s->onmarkeddown & HANA_ONMARKEDDOWN_SHUTDOWNSESSIONS) - srv_shutdown_sessions(s, SN_ERR_DOWN); + srv_shutdown_streams(s, SN_ERR_DOWN); - /* we might have sessions queued on this server and waiting for + /* we might have streams queued on this server and waiting for * a connection. Those which are redispatchable will be queued * to another server or to the proxy itself. */ @@ -471,7 +471,7 @@ void srv_set_admin_flag(struct server *s, enum srv_admin mode) if (s->proxy->lbprm.set_server_status_down) s->proxy->lbprm.set_server_status_down(s); - /* we might have sessions queued on this server and waiting for + /* we might have streams queued on this server and waiting for * a connection. Those which are redispatchable will be queued * to another server or to the proxy itself. */ @@ -595,12 +595,12 @@ void srv_clr_admin_flag(struct server *s, enum srv_admin mode) /* If the server is set with "on-marked-up shutdown-backup-sessions", * and it's not a backup server and its effective weight is > 0, - * then it can accept new connections, so we shut down all sessions + * then it can accept new connections, so we shut down all streams * on all backup servers. */ if ((s->onmarkedup & HANA_ONMARKEDUP_SHUTDOWNBACKUPSESSIONS) && !(s->flags & SRV_F_BACKUP) && s->eweight) - srv_shutdown_backup_sessions(s->proxy, SN_ERR_UP); + srv_shutdown_backup_streams(s->proxy, SN_ERR_UP); /* check if we can handle some connections queued at the proxy. We * will take as many as we can handle. diff --git a/src/ssl_sock.c b/src/ssl_sock.c index 77c44904d..f695309f3 100644 --- a/src/ssl_sock.c +++ b/src/ssl_sock.c @@ -3083,7 +3083,7 @@ unsigned int ssl_sock_get_verify_result(struct connection *conn) /* boolean, returns true if client cert was present */ static int -smp_fetch_ssl_fc_has_crt(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_ssl_fc_has_crt(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct connection *conn; @@ -3112,7 +3112,7 @@ smp_fetch_ssl_fc_has_crt(struct proxy *px, struct session *l4, void *l7, unsigne * should be use. */ static int -smp_fetch_ssl_x_der(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_ssl_x_der(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { int cert_peer = (kw[4] == 'c') ? 1 : 0; @@ -3160,7 +3160,7 @@ out: * should be use. */ static int -smp_fetch_ssl_x_serial(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_ssl_x_serial(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { int cert_peer = (kw[4] == 'c') ? 1 : 0; @@ -3208,7 +3208,7 @@ out: * should be use. */ static int -smp_fetch_ssl_x_sha1(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_ssl_x_sha1(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { int cert_peer = (kw[4] == 'c') ? 1 : 0; @@ -3256,7 +3256,7 @@ out: * should be use. */ static int -smp_fetch_ssl_x_notafter(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_ssl_x_notafter(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { int cert_peer = (kw[4] == 'c') ? 1 : 0; @@ -3303,7 +3303,7 @@ out: * should be use. */ static int -smp_fetch_ssl_x_i_dn(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_ssl_x_i_dn(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { int cert_peer = (kw[4] == 'c') ? 1 : 0; @@ -3366,7 +3366,7 @@ out: * should be use. */ static int -smp_fetch_ssl_x_notbefore(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_ssl_x_notbefore(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { int cert_peer = (kw[4] == 'c') ? 1 : 0; @@ -3413,7 +3413,7 @@ out: * should be use. */ static int -smp_fetch_ssl_x_s_dn(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_ssl_x_s_dn(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { int cert_peer = (kw[4] == 'c') ? 1 : 0; @@ -3473,7 +3473,7 @@ out: /* integer, returns true if current session use a client certificate */ static int -smp_fetch_ssl_c_used(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_ssl_c_used(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { X509 *crt; @@ -3507,7 +3507,7 @@ smp_fetch_ssl_c_used(struct proxy *px, struct session *l4, void *l7, unsigned in * should be use. */ static int -smp_fetch_ssl_x_version(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_ssl_x_version(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { int cert_peer = (kw[4] == 'c') ? 1 : 0; @@ -3547,7 +3547,7 @@ smp_fetch_ssl_x_version(struct proxy *px, struct session *l4, void *l7, unsigned * should be use. */ static int -smp_fetch_ssl_x_sig_alg(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_ssl_x_sig_alg(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { int cert_peer = (kw[4] == 'c') ? 1 : 0; @@ -3599,7 +3599,7 @@ smp_fetch_ssl_x_sig_alg(struct proxy *px, struct session *l4, void *l7, unsigned * should be use. */ static int -smp_fetch_ssl_x_key_alg(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_ssl_x_key_alg(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { int cert_peer = (kw[4] == 'c') ? 1 : 0; @@ -3650,7 +3650,7 @@ smp_fetch_ssl_x_key_alg(struct proxy *px, struct session *l4, void *l7, unsigned * char is 'b'. */ static int -smp_fetch_ssl_fc(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_ssl_fc(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { int back_conn = (kw[4] == 'b') ? 1 : 0; @@ -3663,7 +3663,7 @@ smp_fetch_ssl_fc(struct proxy *px, struct session *l4, void *l7, unsigned int op /* boolean, returns true if client present a SNI */ static int -smp_fetch_ssl_fc_has_sni(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_ssl_fc_has_sni(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { #ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME @@ -3684,7 +3684,7 @@ smp_fetch_ssl_fc_has_sni(struct proxy *px, struct session *l4, void *l7, unsigne * char is 'b'. */ static int -smp_fetch_ssl_fc_cipher(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_ssl_fc_cipher(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { int back_conn = (kw[4] == 'b') ? 1 : 0; @@ -3716,7 +3716,7 @@ smp_fetch_ssl_fc_cipher(struct proxy *px, struct session *l4, void *l7, unsigned * char is 'b'. */ static int -smp_fetch_ssl_fc_alg_keysize(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_ssl_fc_alg_keysize(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { int back_conn = (kw[4] == 'b') ? 1 : 0; @@ -3744,7 +3744,7 @@ smp_fetch_ssl_fc_alg_keysize(struct proxy *px, struct session *l4, void *l7, uns * char is 'b'. */ static int -smp_fetch_ssl_fc_use_keysize(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_ssl_fc_use_keysize(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { int back_conn = (kw[4] == 'b') ? 1 : 0; @@ -3770,7 +3770,7 @@ smp_fetch_ssl_fc_use_keysize(struct proxy *px, struct session *l4, void *l7, uns #ifdef OPENSSL_NPN_NEGOTIATED static int -smp_fetch_ssl_fc_npn(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_ssl_fc_npn(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct connection *conn; @@ -3798,7 +3798,7 @@ smp_fetch_ssl_fc_npn(struct proxy *px, struct session *l4, void *l7, unsigned in #ifdef TLSEXT_TYPE_application_layer_protocol_negotiation static int -smp_fetch_ssl_fc_alpn(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_ssl_fc_alpn(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct connection *conn; @@ -3829,7 +3829,7 @@ smp_fetch_ssl_fc_alpn(struct proxy *px, struct session *l4, void *l7, unsigned i * char is 'b'. */ static int -smp_fetch_ssl_fc_protocol(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_ssl_fc_protocol(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { int back_conn = (kw[4] == 'b') ? 1 : 0; @@ -3855,12 +3855,12 @@ smp_fetch_ssl_fc_protocol(struct proxy *px, struct session *l4, void *l7, unsign return 1; } -/* binary, returns the SSL session id if front conn. transport layer is SSL. +/* binary, returns the SSL stream id if front conn. transport layer is SSL. * This function is also usable on backend conn if the fetch keyword 5th * char is 'b'. */ static int -smp_fetch_ssl_fc_session_id(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_ssl_fc_session_id(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { #if OPENSSL_VERSION_NUMBER > 0x0090800fL @@ -3893,7 +3893,7 @@ smp_fetch_ssl_fc_session_id(struct proxy *px, struct session *l4, void *l7, unsi } static int -smp_fetch_ssl_fc_sni(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_ssl_fc_sni(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { #ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME @@ -3921,7 +3921,7 @@ smp_fetch_ssl_fc_sni(struct proxy *px, struct session *l4, void *l7, unsigned in } static int -smp_fetch_ssl_fc_unique_id(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_ssl_fc_unique_id(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { #if OPENSSL_VERSION_NUMBER > 0x0090800fL @@ -3965,7 +3965,7 @@ smp_fetch_ssl_fc_unique_id(struct proxy *px, struct session *l4, void *l7, unsig /* integer, returns the first verify error in CA chain of client certificate chain. */ static int -smp_fetch_ssl_c_ca_err(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_ssl_c_ca_err(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct connection *conn; @@ -3991,7 +3991,7 @@ smp_fetch_ssl_c_ca_err(struct proxy *px, struct session *l4, void *l7, unsigned /* integer, returns the depth of the first verify error in CA chain of client certificate chain. */ static int -smp_fetch_ssl_c_ca_err_depth(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_ssl_c_ca_err_depth(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct connection *conn; @@ -4017,7 +4017,7 @@ smp_fetch_ssl_c_ca_err_depth(struct proxy *px, struct session *l4, void *l7, uns /* integer, returns the first verify error on client certificate */ static int -smp_fetch_ssl_c_err(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_ssl_c_err(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct connection *conn; @@ -4043,7 +4043,7 @@ smp_fetch_ssl_c_err(struct proxy *px, struct session *l4, void *l7, unsigned int /* integer, returns the verify result on client cert */ static int -smp_fetch_ssl_c_verify(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_ssl_c_verify(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct connection *conn; diff --git a/src/stick_table.c b/src/stick_table.c index d128cfff0..f0f780841 100644 --- a/src/stick_table.c +++ b/src/stick_table.c @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include #include @@ -680,7 +680,7 @@ struct stktable_key *smp_to_stkey(struct sample *smp, struct stktable *t) * smp 1 0 not possible * smp 1 1 Present, last known value (eg: request length) */ -struct stktable_key *stktable_fetch_key(struct stktable *t, struct proxy *px, struct session *l4, void *l7, +struct stktable_key *stktable_fetch_key(struct stktable *t, struct proxy *px, struct stream *l4, void *l7, unsigned int opt, struct sample_expr *expr, struct sample *smp) { if (smp) @@ -809,7 +809,7 @@ struct proxy *find_stktable(const char *name) * the table's type. This is a double conversion, but in the future we might * support automatic input types to perform the cast on the fly. */ -static int sample_conv_in_table(struct session *session, const struct arg *arg_p, +static int sample_conv_in_table(struct stream *stream, const struct arg *arg_p, struct sample *smp, void *private) { struct stktable *t; @@ -836,7 +836,7 @@ static int sample_conv_in_table(struct session *session, const struct arg *arg_p * be easily performed. If the inspected parameter is not stored in the table, * is returned. */ -static int sample_conv_table_bytes_in_rate(struct session *session, const struct arg *arg_p, +static int sample_conv_table_bytes_in_rate(struct stream *stream, const struct arg *arg_p, struct sample *smp, void *private) { struct stktable *t; @@ -873,7 +873,7 @@ static int sample_conv_table_bytes_in_rate(struct session *session, const struct * be easily performed. If the inspected parameter is not stored in the table, * is returned. */ -static int sample_conv_table_conn_cnt(struct session *session, const struct arg *arg_p, +static int sample_conv_table_conn_cnt(struct stream *stream, const struct arg *arg_p, struct sample *smp, void *private) { struct stktable *t; @@ -909,7 +909,7 @@ static int sample_conv_table_conn_cnt(struct session *session, const struct arg * can be easily performed. If the inspected parameter is not stored in the * table, is returned. */ -static int sample_conv_table_conn_cur(struct session *session, const struct arg *arg_p, +static int sample_conv_table_conn_cur(struct stream *stream, const struct arg *arg_p, struct sample *smp, void *private) { struct stktable *t; @@ -945,7 +945,7 @@ static int sample_conv_table_conn_cur(struct session *session, const struct arg * be easily performed. If the inspected parameter is not stored in the table, * is returned. */ -static int sample_conv_table_conn_rate(struct session *session, const struct arg *arg_p, +static int sample_conv_table_conn_rate(struct stream *stream, const struct arg *arg_p, struct sample *smp, void *private) { struct stktable *t; @@ -982,7 +982,7 @@ static int sample_conv_table_conn_rate(struct session *session, const struct arg * be easily performed. If the inspected parameter is not stored in the table, * is returned. */ -static int sample_conv_table_bytes_out_rate(struct session *session, const struct arg *arg_p, +static int sample_conv_table_bytes_out_rate(struct stream *stream, const struct arg *arg_p, struct sample *smp, void *private) { struct stktable *t; @@ -1019,7 +1019,7 @@ static int sample_conv_table_bytes_out_rate(struct session *session, const struc * be easily performed. If the inspected parameter is not stored in the table, * is returned. */ -static int sample_conv_table_gpc0(struct session *session, const struct arg *arg_p, +static int sample_conv_table_gpc0(struct stream *stream, const struct arg *arg_p, struct sample *smp, void *private) { struct stktable *t; @@ -1055,7 +1055,7 @@ static int sample_conv_table_gpc0(struct session *session, const struct arg *arg * be easily performed. If the inspected parameter is not stored in the table, * is returned. */ -static int sample_conv_table_gpc0_rate(struct session *session, const struct arg *arg_p, +static int sample_conv_table_gpc0_rate(struct stream *stream, const struct arg *arg_p, struct sample *smp, void *private) { struct stktable *t; @@ -1092,7 +1092,7 @@ static int sample_conv_table_gpc0_rate(struct session *session, const struct arg * comparisons can be easily performed. If the inspected parameter is not stored * in the table, is returned. */ -static int sample_conv_table_http_err_cnt(struct session *session, const struct arg *arg_p, +static int sample_conv_table_http_err_cnt(struct stream *stream, const struct arg *arg_p, struct sample *smp, void *private) { struct stktable *t; @@ -1128,7 +1128,7 @@ static int sample_conv_table_http_err_cnt(struct session *session, const struct * be easily performed. If the inspected parameter is not stored in the table, * is returned. */ -static int sample_conv_table_http_err_rate(struct session *session, const struct arg *arg_p, +static int sample_conv_table_http_err_rate(struct stream *stream, const struct arg *arg_p, struct sample *smp, void *private) { struct stktable *t; @@ -1165,7 +1165,7 @@ static int sample_conv_table_http_err_rate(struct session *session, const struct * can be easily performed. If the inspected parameter is not stored in the * table, is returned. */ -static int sample_conv_table_http_req_cnt(struct session *session, const struct arg *arg_p, +static int sample_conv_table_http_req_cnt(struct stream *stream, const struct arg *arg_p, struct sample *smp, void *private) { struct stktable *t; @@ -1201,7 +1201,7 @@ static int sample_conv_table_http_req_cnt(struct session *session, const struct * performed. If the inspected parameter is not stored in the table, * is returned. */ -static int sample_conv_table_http_req_rate(struct session *session, const struct arg *arg_p, +static int sample_conv_table_http_req_rate(struct stream *stream, const struct arg *arg_p, struct sample *smp, void *private) { struct stktable *t; @@ -1238,7 +1238,7 @@ static int sample_conv_table_http_req_rate(struct session *session, const struct * be easily performed. If the inspected parameter is not stored in the table, * is returned. */ -static int sample_conv_table_kbytes_in(struct session *session, const struct arg *arg_p, +static int sample_conv_table_kbytes_in(struct stream *stream, const struct arg *arg_p, struct sample *smp, void *private) { struct stktable *t; @@ -1274,7 +1274,7 @@ static int sample_conv_table_kbytes_in(struct session *session, const struct arg * be easily performed. If the inspected parameter is not stored in the table, * is returned. */ -static int sample_conv_table_kbytes_out(struct session *session, const struct arg *arg_p, +static int sample_conv_table_kbytes_out(struct stream *stream, const struct arg *arg_p, struct sample *smp, void *private) { struct stktable *t; @@ -1310,7 +1310,7 @@ static int sample_conv_table_kbytes_out(struct session *session, const struct ar * easily performed. If the inspected parameter is not stored in the table, * is returned. */ -static int sample_conv_table_server_id(struct session *session, const struct arg *arg_p, +static int sample_conv_table_server_id(struct stream *stream, const struct arg *arg_p, struct sample *smp, void *private) { struct stktable *t; @@ -1346,7 +1346,7 @@ static int sample_conv_table_server_id(struct session *session, const struct arg * can be easily performed. If the inspected parameter is not stored in the * table, is returned. */ -static int sample_conv_table_sess_cnt(struct session *session, const struct arg *arg_p, +static int sample_conv_table_sess_cnt(struct stream *stream, const struct arg *arg_p, struct sample *smp, void *private) { struct stktable *t; @@ -1382,7 +1382,7 @@ static int sample_conv_table_sess_cnt(struct session *session, const struct arg * performed. If the inspected parameter is not stored in the table, * is returned. */ -static int sample_conv_table_sess_rate(struct session *session, const struct arg *arg_p, +static int sample_conv_table_sess_rate(struct stream *stream, const struct arg *arg_p, struct sample *smp, void *private) { struct stktable *t; @@ -1419,7 +1419,7 @@ static int sample_conv_table_sess_rate(struct session *session, const struct arg * comparisons can be easily performed. If the inspected parameter is not * stored in the table, is returned. */ -static int sample_conv_table_trackers(struct session *session, const struct arg *arg_p, +static int sample_conv_table_trackers(struct stream *stream, const struct arg *arg_p, struct sample *smp, void *private) { struct stktable *t; diff --git a/src/session.c b/src/stream.c similarity index 91% rename from src/session.c rename to src/stream.c index 677d3a1a6..36ef2cac4 100644 --- a/src/session.c +++ b/src/stream.c @@ -1,5 +1,5 @@ /* - * Session management functions. + * Stream management functions. * * Copyright 2000-2012 Willy Tarreau * @@ -37,7 +37,7 @@ #include #include #include -#include +#include #include #include #include @@ -49,36 +49,36 @@ #include #include -struct pool_head *pool2_session; -struct list sessions; +struct pool_head *pool2_stream; +struct list streams; -/* list of sessions waiting for at least one buffer */ +/* list of streams waiting for at least one buffer */ struct list buffer_wq = LIST_HEAD_INIT(buffer_wq); -static int conn_session_complete(struct connection *conn); -static int conn_session_update(struct connection *conn); +static int conn_stream_complete(struct connection *conn); +static int conn_stream_update(struct connection *conn); static struct task *expire_mini_session(struct task *t); -int session_complete(struct session *s); +int stream_complete(struct stream *s); -/* data layer callbacks for an embryonic session */ +/* data layer callbacks for an embryonic stream */ struct data_cb sess_conn_cb = { .recv = NULL, .send = NULL, - .wake = conn_session_update, - .init = conn_session_complete, + .wake = conn_stream_update, + .init = conn_stream_complete, }; /* This function is called from the protocol layer accept() in order to - * instanciate a new embryonic session on behalf of a given listener and + * instanciate a new embryonic stream on behalf of a given listener and * frontend. It returns a positive value upon success, 0 if the connection * can be ignored, or a negative value upon critical failure. The accepted * file descriptor is closed if we return <= 0. */ -int session_accept(struct listener *l, int cfd, struct sockaddr_storage *addr) +int stream_accept(struct listener *l, int cfd, struct sockaddr_storage *addr) { struct connection *cli_conn; struct proxy *p = l->frontend; - struct session *s; + struct stream *s; struct task *t; int ret; @@ -96,10 +96,10 @@ int session_accept(struct listener *l, int cfd, struct sockaddr_storage *addr) cli_conn->target = &l->obj_type; cli_conn->proxy_netns = l->netns; - if (unlikely((s = pool_alloc2(pool2_session)) == NULL)) + if (unlikely((s = pool_alloc2(pool2_stream)) == NULL)) goto out_free_conn; - /* minimum session initialization required for an embryonic session is + /* minimum stream initialization required for an embryonic stream is * fairly low. We need very little to execute L4 ACLs, then we need a * task to make the client-side connection live on its own. * - flags @@ -123,9 +123,9 @@ int session_accept(struct listener *l, int cfd, struct sockaddr_storage *addr) s->si[1].flags = SI_FL_ISBACK; /* On a mini-session, the connection is directly attached to the - * session's target so that we don't need to initialize the stream + * stream's target so that we don't need to initialize the stream * interfaces. Another benefit is that it's easy to detect a mini- - * session in dumps using this : it's the only one which has a + * stream in dumps using this : it's the only one which has a * connection in s->target. */ s->target = &cli_conn->obj_type; @@ -134,7 +134,7 @@ int session_accept(struct listener *l, int cfd, struct sockaddr_storage *addr) s->logs.tv_accept = now; /* corrected date for internal use */ s->uniq_id = global.req_count++; p->feconn++; - /* This session was accepted, count it now */ + /* This stream was accepted, count it now */ if (p->feconn > p->fe_counters.conn_max) p->fe_counters.conn_max = p->feconn; @@ -212,7 +212,7 @@ int session_accept(struct listener *l, int cfd, struct sockaddr_storage *addr) /* OK, now either we have a pending handshake to execute with and * then we must return to the I/O layer, or we can proceed with the - * end of the session initialization. In case of handshake, we also + * end of the stream initialization. In case of handshake, we also * set the I/O timeout to the frontend's client timeout. */ @@ -224,9 +224,9 @@ int session_accept(struct listener *l, int cfd, struct sockaddr_storage *addr) return 1; } - /* OK let's complete session initialization since there is no handshake */ + /* OK let's complete stream initialization since there is no handshake */ cli_conn->flags |= CO_FL_CONNECTED; - ret = session_complete(s); + ret = stream_complete(s); if (ret > 0) return ret; @@ -235,8 +235,8 @@ int session_accept(struct listener *l, int cfd, struct sockaddr_storage *addr) task_free(t); out_free_session: p->feconn--; - session_store_counters(s); - pool_free2(pool2_session, s); + stream_store_counters(s); + pool_free2(pool2_stream, s); out_free_conn: cli_conn->flags &= ~CO_FL_XPRT_TRACKED; conn_xprt_close(cli_conn); @@ -258,11 +258,11 @@ int session_accept(struct listener *l, int cfd, struct sockaddr_storage *addr) } -/* prepare the trash with a log prefix for session . It only works with - * embryonic sessions based on a real connection. This function requires that +/* prepare the trash with a log prefix for stream . It only works with + * embryonic streams based on a real connection. This function requires that * at s->target still points to the incoming connection. */ -static void prepare_mini_sess_log_prefix(struct session *s) +static void prepare_mini_sess_log_prefix(struct stream *s) { struct tm tm; char pn[INET6_ADDRSTRLEN]; @@ -287,12 +287,12 @@ static void prepare_mini_sess_log_prefix(struct session *s) chunk_appendf(&trash, "] %s/%d", s->fe->id, s->listener->luid); } -/* This function kills an existing embryonic session. It stops the connection's +/* This function kills an existing embryonic stream. It stops the connection's * transport layer, releases assigned resources, resumes the listener if it was * disabled and finally kills the file descriptor. This function requires that * at s->target still points to the incoming connection. */ -static void kill_mini_session(struct session *s) +static void kill_mini_session(struct stream *s) { int level = LOG_INFO; struct connection *conn = __objt_conn(s->target); @@ -332,7 +332,7 @@ static void kill_mini_session(struct session *s) conn_free(conn); s->fe->feconn--; - session_store_counters(s); + stream_store_counters(s); if (!(s->listener->options & LI_O_UNLIMITED)) actconn--; @@ -351,17 +351,17 @@ static void kill_mini_session(struct session *s) task_delete(s->task); task_free(s->task); - pool_free2(pool2_session, s); + pool_free2(pool2_stream, s); } -/* Finish initializing a session from a connection, or kills it if the +/* Finish initializing a stream from a connection, or kills it if the * connection shows and error. Returns <0 if the connection was killed. */ -static int conn_session_complete(struct connection *conn) +static int conn_stream_complete(struct connection *conn) { - struct session *s = conn->owner; + struct stream *s = conn->owner; - if (!(conn->flags & CO_FL_ERROR) && (session_complete(s) > 0)) { + if (!(conn->flags & CO_FL_ERROR) && (stream_complete(s) > 0)) { conn->flags &= ~CO_FL_INIT_DATA; return 0; } @@ -371,10 +371,10 @@ static int conn_session_complete(struct connection *conn) return -1; } -/* Update an embryonic session status. The connection is killed in case of +/* Update an embryonic stream status. The connection is killed in case of * error, and <0 will be returned. Otherwise it does nothing. */ -static int conn_session_update(struct connection *conn) +static int conn_stream_update(struct connection *conn) { if (conn->flags & CO_FL_ERROR) { kill_mini_session(conn->owner); @@ -383,12 +383,12 @@ static int conn_session_update(struct connection *conn) return 0; } -/* Manages embryonic sessions timeout. It is only called when the timeout +/* Manages embryonic streams timeout. It is only called when the timeout * strikes and performs the required cleanup. */ static struct task *expire_mini_session(struct task *t) { - struct session *s = t->context; + struct stream *s = t->context; if (!(t->state & TASK_WOKEN_TIMER)) return t; @@ -398,15 +398,15 @@ static struct task *expire_mini_session(struct task *t) } /* This function is called from the I/O handler which detects the end of - * handshake, in order to complete initialization of a valid session. It must - * be called with an embryonic session. It returns a positive value upon + * handshake, in order to complete initialization of a valid stream. It must + * be called with an embryonic stream. It returns a positive value upon * success, 0 if the connection can be ignored, or a negative value upon * critical failure. The accepted file descriptor is closed if we return <= 0. * The client-side end point is assumed to be a connection, whose pointer is * taken from s->target which is assumed to be valid. If the function fails, * it restores s->target. */ -int session_complete(struct session *s) +int stream_complete(struct stream *s) { struct listener *l = s->listener; struct proxy *p = s->fe; @@ -418,8 +418,8 @@ int session_complete(struct session *s) ret = -1; /* assume unrecoverable error by default */ - /* OK, we're keeping the session, so let's properly initialize the session */ - LIST_ADDQ(&sessions, &s->list); + /* OK, we're keeping the stream, so let's properly initialize the stream */ + LIST_ADDQ(&streams, &s->list); LIST_INIT(&s->back_refs); LIST_INIT(&s->buffer_wait); @@ -430,7 +430,7 @@ int session_complete(struct session *s) t->context = s; t->expire = TICK_ETERNITY; - /* Note: initially, the session's backend points to the frontend. + /* Note: initially, the stream's backend points to the frontend. * This changes later when switching rules are executed or * when the default backend is assigned. */ @@ -438,7 +438,7 @@ int session_complete(struct session *s) s->comp_algo = NULL; s->req.buf = s->res.buf = NULL; - /* Let's count a session now */ + /* Let's count a stream now */ proxy_inc_fe_sess_ctr(l, p); for (i = 0; i < MAX_SESS_STKCTR; i++) { @@ -480,7 +480,7 @@ int session_complete(struct session *s) if (likely(s->fe->options2 & PR_O2_INDEPSTR)) s->si[1].flags |= SI_FL_INDEP_STR; - session_init_srv_conn(s); + stream_init_srv_conn(s); s->target = l->default_target; /* used by peers and CLI */ s->pend_pos = NULL; @@ -516,7 +516,7 @@ int session_complete(struct session *s) txn = &s->txn; /* Those variables will be checked and freed if non-NULL in - * session.c:session_free(). It is important that they are + * stream.c:stream_free(). It is important that they are * properly initialized. */ txn->sessid = NULL; @@ -572,9 +572,9 @@ int session_complete(struct session *s) } /* - * frees the context associated to a session. It must have been removed first. + * frees the context associated to a stream. It must have been removed first. */ -static void session_free(struct session *s) +static void stream_free(struct stream *s) { struct http_txn *txn = &s->txn; struct proxy *fe = s->fe; @@ -595,7 +595,7 @@ static void session_free(struct session *s) } if (unlikely(s->srv_conn)) { - /* the session still has a reserved slot on a server, but + /* the stream still has a reserved slot on a server, but * it should normally be only the same as the one above, * so this should not happen in fact. */ @@ -617,7 +617,7 @@ static void session_free(struct session *s) b_drop(&s->req.buf); b_drop(&s->res.buf); if (!LIST_ISEMPTY(&buffer_wq)) - session_offer_buffers(); + stream_offer_buffers(); hlua_ctx_destroy(&s->hlua); http_end_txn(s); @@ -639,22 +639,22 @@ static void session_free(struct session *s) pool_free2(fe->req_cap_pool, txn->req.cap); } - session_store_counters(s); + stream_store_counters(s); list_for_each_entry_safe(bref, back, &s->back_refs, users) { /* we have to unlink all watchers. We must not relink them if - * this session was the last one in the list. + * this stream was the last one in the list. */ LIST_DEL(&bref->users); LIST_INIT(&bref->users); - if (s->list.n != &sessions) - LIST_ADDQ(&LIST_ELEM(s->list.n, struct session *, list)->back_refs, &bref->users); + if (s->list.n != &streams) + LIST_ADDQ(&LIST_ELEM(s->list.n, struct stream *, list)->back_refs, &bref->users); bref->ref = s->list.n; } LIST_DEL(&s->list); si_release_endpoint(&s->si[1]); si_release_endpoint(&s->si[0]); - pool_free2(pool2_session, s); + pool_free2(pool2_stream, s); /* We may want to free the maximum amount of pools if the proxy is stopping */ if (fe && unlikely(fe->state == PR_STSTOPPED)) { @@ -662,7 +662,7 @@ static void session_free(struct session *s) pool_flush2(pool2_hdr_idx); pool_flush2(pool2_requri); pool_flush2(pool2_capture); - pool_flush2(pool2_session); + pool_flush2(pool2_stream); pool_flush2(pool2_connection); pool_flush2(pool2_pendconn); pool_flush2(fe->req_cap_pool); @@ -678,9 +678,9 @@ static void session_free(struct session *s) * buffers are properly allocated. Returns 0 in case of failure, non-zero * otherwise. */ -int session_alloc_recv_buffer(struct channel *chn) +int stream_alloc_recv_buffer(struct channel *chn) { - struct session *s; + struct stream *s; struct buffer *b; int margin = 0; @@ -698,8 +698,8 @@ int session_alloc_recv_buffer(struct channel *chn) return 0; } -/* Allocates a work buffer for session . It is meant to be called inside - * process_session(). It will only allocate the side needed for the function +/* Allocates a work buffer for stream . It is meant to be called inside + * process_stream(). It will only allocate the side needed for the function * to work fine. For a regular connection, only the response is needed so that * an error message may be built and returned. In case where the initiator is * an applet (eg: peers), then we need to allocate the request buffer for the @@ -709,7 +709,7 @@ int session_alloc_recv_buffer(struct channel *chn) * a response may always flow and will never block a server from releasing a * connection. Returns 0 in case of failure, non-zero otherwise. */ -int session_alloc_work_buffer(struct session *s) +int stream_alloc_work_buffer(struct stream *s) { int margin; struct buffer **buf; @@ -737,11 +737,11 @@ int session_alloc_work_buffer(struct session *s) /* releases unused buffers after processing. Typically used at the end of the * update() functions. It will try to wake up as many tasks as the number of - * buffers that it releases. In practice, most often sessions are blocked on + * buffers that it releases. In practice, most often streams are blocked on * a single buffer, so it makes sense to try to wake two up when two buffers * are released at once. */ -void session_release_buffers(struct session *s) +void stream_release_buffers(struct stream *s) { if (s->req.buf->size && buffer_empty(s->req.buf)) b_free(&s->req.buf); @@ -753,16 +753,16 @@ void session_release_buffers(struct session *s) * someone waiting, we can wake up a waiter and offer them. */ if (!LIST_ISEMPTY(&buffer_wq)) - session_offer_buffers(); + stream_offer_buffers(); } -/* Runs across the list of pending sessions waiting for a buffer and wakes one +/* Runs across the list of pending streams waiting for a buffer and wakes one * up if buffers are available. Will stop when the run queue reaches . - * Should not be called directly, use session_offer_buffers() instead. + * Should not be called directly, use stream_offer_buffers() instead. */ -void __session_offer_buffers(int rqlimit) +void __stream_offer_buffers(int rqlimit) { - struct session *sess, *bak; + struct stream *sess, *bak; list_for_each_entry_safe(sess, bak, &buffer_wq, buffer_wait) { if (rqlimit <= run_queue) @@ -778,14 +778,14 @@ void __session_offer_buffers(int rqlimit) } /* perform minimal intializations, report 0 in case of error, 1 if OK. */ -int init_session() +int init_stream() { - LIST_INIT(&sessions); - pool2_session = create_pool("session", sizeof(struct session), MEM_F_SHARED); - return pool2_session != NULL; + LIST_INIT(&streams); + pool2_stream = create_pool("stream", sizeof(struct stream), MEM_F_SHARED); + return pool2_stream != NULL; } -void session_process_counters(struct session *s) +void stream_process_counters(struct stream *s) { unsigned long long bytes; void *ptr; @@ -861,9 +861,9 @@ void session_process_counters(struct session *s) * We must check for establishment, error and abort. Possible output states * are SI_ST_EST (established), SI_ST_CER (error), SI_ST_DIS (abort), and * SI_ST_CON (no change). The function returns 0 if it switches to SI_ST_CER, - * otherwise 1. This only works with connection-based sessions. + * otherwise 1. This only works with connection-based streams. */ -static int sess_update_st_con_tcp(struct session *s) +static int sess_update_st_con_tcp(struct stream *s) { struct stream_interface *si = &s->si[1]; struct channel *req = &s->req; @@ -935,11 +935,11 @@ static int sess_update_st_con_tcp(struct session *s) * and SI_ST_REQ when an immediate redispatch is wanted. The buffers are * marked as in error state. It returns 0. */ -static int sess_update_st_cer(struct session *s) +static int sess_update_st_cer(struct stream *s) { struct stream_interface *si = &s->si[1]; - /* we probably have to release last session from the server */ + /* we probably have to release last stream from the server */ if (objt_server(s->target)) { health_adjust(objt_server(s->target), HANA_STATUS_L4_ERR); @@ -976,7 +976,7 @@ static int sess_update_st_cer(struct session *s) /* If the "redispatch" option is set on the backend, we are allowed to * retry on another server for the last retry. In order to achieve this, - * we must mark the session unassigned, and eventually clear the DIRECT + * we must mark the stream unassigned, and eventually clear the DIRECT * bit to ignore any persistence cookie. We won't count a retry nor a * redispatch yet, because this will depend on what server is selected. * If the connection is not persistent, the balancing algorithm is not @@ -1034,7 +1034,7 @@ static int sess_update_st_cer(struct session *s) * SI_ST_EST state. It must only be called after switching from SI_ST_CON (or * SI_ST_INI) to SI_ST_EST, but only when a ->proto is defined. */ -static void sess_establish(struct session *s) +static void sess_establish(struct stream *s) { struct stream_interface *si = &s->si[1]; struct channel *req = &s->req; @@ -1080,7 +1080,7 @@ static void sess_establish(struct session *s) * and SI_ST_EST. Flags must have previously been updated for timeouts and other * conditions. */ -static void sess_update_stream_int(struct session *s) +static void sess_update_stream_int(struct stream *s) { struct server *srv = objt_server(s->target); struct stream_interface *si = &s->si[1]; @@ -1126,7 +1126,7 @@ static void sess_update_stream_int(struct session *s) srv->counters.failed_conns++; s->be->be_counters.failed_conns++; - /* release other sessions waiting for this server */ + /* release other streams waiting for this server */ sess_change_server(s, NULL); if (may_dequeue_tasks(srv, s->be)) process_srv_queue(srv); @@ -1138,7 +1138,7 @@ static void sess_update_stream_int(struct session *s) s->logs.t_queue = tv_ms_elapsed(&s->logs.tv_accept, &now); - /* no session was ever accounted for this server */ + /* no stream was ever accounted for this server */ si->state = SI_ST_CLO; if (s->srv_error) s->srv_error(s, si); @@ -1232,7 +1232,7 @@ static void sess_update_stream_int(struct session *s) si->exp = TICK_ETERNITY; - /* we keep trying on the same server as long as the session is + /* we keep trying on the same server as long as the stream is * marked "assigned". * FIXME: Should we force a redispatch attempt when the server is down ? */ @@ -1244,11 +1244,11 @@ static void sess_update_stream_int(struct session *s) } } -/* Set correct session termination flags in case no analyser has done it. It +/* Set correct stream termination flags in case no analyser has done it. It * also counts a failed request if the server state has not reached the request * stage. */ -static void sess_set_term_flags(struct session *s) +static void sess_set_term_flags(struct stream *s) { if (!(s->flags & SN_FINST_MASK)) { if (s->si[1].state < SI_ST_REQ) { @@ -1276,7 +1276,7 @@ static void sess_set_term_flags(struct session *s) * or SI_ST_EST for a successful connection to an applet. It may also return * SI_ST_QUE, or SI_ST_CLO upon error. */ -static void sess_prepare_conn_req(struct session *s) +static void sess_prepare_conn_req(struct stream *s) { struct stream_interface *si = &s->si[1]; @@ -1355,14 +1355,14 @@ static void sess_prepare_conn_req(struct session *s) * 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 channel *req, int an_bit) +static int process_switching_rules(struct stream *s, struct channel *req, int an_bit) { struct persist_rule *prst_rule; req->analysers &= ~an_bit; req->analyse_exp = TICK_ETERNITY; - DPRINTF(stderr,"[%u] %s: session=%p b=%p, exp(r,w)=%u,%u bf=%08x bh=%d analysers=%02x\n", + DPRINTF(stderr,"[%u] %s: stream=%p b=%p, exp(r,w)=%u,%u bf=%08x bh=%d analysers=%02x\n", now_ms, __FUNCTION__, s, req, @@ -1403,7 +1403,7 @@ static int process_switching_rules(struct session *s, struct channel *req, int a else backend = rule->be.backend; - if (!session_set_backend(s, backend)) + if (!stream_set_backend(s, backend)) goto sw_failed; break; } @@ -1415,7 +1415,7 @@ static int process_switching_rules(struct session *s, struct channel *req, int a * backend if any. */ if (!(s->flags & SN_BE_ASSIGNED)) - if (!session_set_backend(s, s->fe->defbe.be ? s->fe->defbe.be : s->be)) + if (!stream_set_backend(s, s->fe->defbe.be ? s->fe->defbe.be : s->be)) goto sw_failed; } @@ -1426,7 +1426,7 @@ static int process_switching_rules(struct session *s, struct channel *req, int a } /* as soon as we know the backend, we must check if we have a matching forced or ignored - * persistence rule, and report that in the session. + * persistence rule, and report that in the stream. */ list_for_each_entry(prst_rule, &s->be->persist_rules, list) { int ret = 1; @@ -1471,12 +1471,12 @@ static int process_switching_rules(struct session *s, struct channel *req, int a * 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 channel *req, int an_bit) +static int process_server_rules(struct stream *s, struct channel *req, int an_bit) { struct proxy *px = s->be; struct server_rule *rule; - DPRINTF(stderr,"[%u] %s: session=%p b=%p, exp(r,w)=%u,%u bf=%08x bl=%d analysers=%02x\n", + DPRINTF(stderr,"[%u] %s: stream=%p b=%p, exp(r,w)=%u,%u bf=%08x bl=%d analysers=%02x\n", now_ms, __FUNCTION__, s, req, @@ -1520,12 +1520,12 @@ static int process_server_rules(struct session *s, struct channel *req, int an_b * 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 channel *req, int an_bit) +static int process_sticking_rules(struct stream *s, struct channel *req, int an_bit) { struct proxy *px = s->be; struct sticking_rule *rule; - DPRINTF(stderr,"[%u] %s: session=%p b=%p, exp(r,w)=%u,%u bf=%08x bh=%d analysers=%02x\n", + DPRINTF(stderr,"[%u] %s: stream=%p b=%p, exp(r,w)=%u,%u bf=%08x bh=%d analysers=%02x\n", now_ms, __FUNCTION__, s, req, @@ -1616,14 +1616,14 @@ static int process_sticking_rules(struct session *s, struct channel *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 channel *rep, int an_bit) +static int process_store_rules(struct stream *s, struct channel *rep, int an_bit) { struct proxy *px = s->be; struct sticking_rule *rule; int i; int nbreq = s->store_count; - DPRINTF(stderr,"[%u] %s: session=%p b=%p, exp(r,w)=%u,%u bf=%08x bh=%d analysers=%02x\n", + DPRINTF(stderr,"[%u] %s: stream=%p b=%p, exp(r,w)=%u,%u bf=%08x bh=%d analysers=%02x\n", now_ms, __FUNCTION__, s, rep, @@ -1714,7 +1714,7 @@ static int process_store_rules(struct session *s, struct channel *rep, int an_bi } /* This macro is very specific to the function below. See the comments in - * process_session() below to understand the logic and the tests. + * process_stream() below to understand the logic and the tests. */ #define UPDATE_ANALYSERS(real, list, back, flag) { \ list = (((list) & ~(flag)) | ~(back)) & (real); \ @@ -1725,7 +1725,7 @@ static int process_store_rules(struct session *s, struct channel *rep, int an_bi continue; \ } -/* Processes the client, server, request and response jobs of a session task, +/* Processes the client, server, request and response jobs of a stream task, * then puts it back to the wait queue in a clean state, or cleans up its * resources if it must be deleted. Returns in the date the task wants * to be woken up, or TICK_ETERNITY. In order not to call all functions for @@ -1733,10 +1733,10 @@ static int process_store_rules(struct session *s, struct channel *rep, int an_bi * and each function is called only if at least another function has changed at * least one flag it is interested in. */ -struct task *process_session(struct task *t) +struct task *process_stream(struct task *t) { struct server *srv; - struct session *s = t->context; + struct stream *s = t->context; unsigned int rqf_last, rpf_last; unsigned int rq_prod_last, rq_cons_last; unsigned int rp_cons_last, rp_prod_last; @@ -1809,7 +1809,7 @@ struct task *process_session(struct task *t) /* Once in a while we're woken up because the task expires. But * this does not necessarily mean that a timeout has been reached. - * So let's not run a whole session processing if only an expiration + * So let's not run a whole stream processing if only an expiration * timeout needs to be refreshed. */ if (!((req->flags | res->flags) & @@ -1823,7 +1823,7 @@ struct task *process_session(struct task *t) /* below we may emit error messages so we have to ensure that we have * our buffers properly allocated. */ - if (!session_alloc_work_buffer(s)) { + if (!stream_alloc_work_buffer(s)) { /* No buffer available, we've been subscribed to the list of * buffer waiters, let's wait for our turn. */ @@ -1969,7 +1969,7 @@ struct task *process_session(struct task *t) * the list when not needed. Any analyser may return 0 * to break out of the loop, either because of missing * data to take a decision, or because it decides to - * kill the session. We loop at least once through each + * kill the stream. We loop at least once through each * analyser, and we may loop again if other analysers * are added in the middle. * @@ -2139,7 +2139,7 @@ struct task *process_session(struct task *t) * the list when not needed. Any analyser may return 0 * to break out of the loop, either because of missing * data to take a decision, or because it decides to - * kill the session. We loop at least once through each + * kill the stream. We loop at least once through each * analyser, and we may loop again if other analysers * are added in the middle. */ @@ -2202,7 +2202,7 @@ struct task *process_session(struct task *t) /* - * Now we propagate unhandled errors to the session. Normally + * Now we propagate unhandled errors to the stream. Normally * we're just in a data phase here since it means we have not * seen any analyser who could set an error status. */ @@ -2589,7 +2589,7 @@ struct task *process_session(struct task *t) (si_b->state > SI_ST_INI && si_b->state < SI_ST_CLO))) { if ((s->fe->options & PR_O_CONTSTATS) && (s->flags & SN_BE_ASSIGNED)) - session_process_counters(s); + stream_process_counters(s); if (si_f->state == SI_ST_EST && obj_type(si_f->end) != OBJ_TYPE_APPCTX) si_update(si_f); @@ -2630,7 +2630,7 @@ struct task *process_session(struct task *t) if ((si_applet_call(si_b) | si_applet_call(si_f)) != 0) { if (task_in_rq(t)) { t->expire = TICK_ETERNITY; - session_release_buffers(s); + stream_release_buffers(s); return t; } } @@ -2660,7 +2660,7 @@ struct task *process_session(struct task *t) if (!tick_isset(t->expire)) ABORT_NOW(); #endif - session_release_buffers(s); + stream_release_buffers(s); return t; /* nothing more to do */ } @@ -2694,7 +2694,7 @@ struct task *process_session(struct task *t) } s->logs.t_close = tv_ms_elapsed(&s->logs.tv_accept, &now); - session_process_counters(s); + stream_process_counters(s); if (s->txn.status) { int n; @@ -2724,18 +2724,18 @@ struct task *process_session(struct task *t) s->do_log(s); } - /* update time stats for this session */ - session_update_time_stats(s); + /* update time stats for this stream */ + stream_update_time_stats(s); /* the task MUST not be in the run queue anymore */ - session_free(s); + stream_free(s); task_delete(t); task_free(t); return NULL; } -/* Update the session's backend and server time stats */ -void session_update_time_stats(struct session *s) +/* Update the stream's backend and server time stats */ +void stream_update_time_stats(struct stream *s) { int t_request; int t_queue; @@ -2778,12 +2778,12 @@ void session_update_time_stats(struct session *s) /* * This function adjusts sess->srv_conn and maintains the previous and new - * server's served session counts. Setting newsrv to NULL is enough to release + * server's served stream counts. Setting newsrv to NULL is enough to release * current connection slot. This function also notifies any LB algo which might - * expect to be informed about any change in the number of active sessions on a + * expect to be informed about any change in the number of active streams on a * server. */ -void sess_change_server(struct session *sess, struct server *newsrv) +void sess_change_server(struct stream *sess, struct server *newsrv) { if (sess->srv_conn == newsrv) return; @@ -2792,23 +2792,23 @@ void sess_change_server(struct session *sess, struct server *newsrv) sess->srv_conn->served--; if (sess->srv_conn->proxy->lbprm.server_drop_conn) sess->srv_conn->proxy->lbprm.server_drop_conn(sess->srv_conn); - session_del_srv_conn(sess); + stream_del_srv_conn(sess); } if (newsrv) { newsrv->served++; if (newsrv->proxy->lbprm.server_take_conn) newsrv->proxy->lbprm.server_take_conn(newsrv); - session_add_srv_conn(sess, newsrv); + stream_add_srv_conn(sess, newsrv); } } /* Handle server-side errors for default protocols. It is called whenever a a * connection setup is aborted or a request is aborted in queue. It sets the - * session termination flags so that the caller does not have to worry about + * stream termination flags so that the caller does not have to worry about * them. It's installed as ->srv_error for the server-side stream_interface. */ -void default_srv_error(struct session *s, struct stream_interface *si) +void default_srv_error(struct stream *s, struct stream_interface *si) { int err_type = si->err_type; int err = 0, fin = 0; @@ -2852,18 +2852,18 @@ void default_srv_error(struct session *s, struct stream_interface *si) s->flags |= fin; } -/* kill a session and set the termination flags to (one of SN_ERR_*) */ -void session_shutdown(struct session *session, int why) +/* kill a stream and set the termination flags to (one of SN_ERR_*) */ +void stream_shutdown(struct stream *stream, int why) { - if (session->req.flags & (CF_SHUTW|CF_SHUTW_NOW)) + if (stream->req.flags & (CF_SHUTW|CF_SHUTW_NOW)) return; - channel_shutw_now(&session->req); - channel_shutr_now(&session->res); - session->task->nice = 1024; - if (!(session->flags & SN_ERR_MASK)) - session->flags |= why; - task_wakeup(session->task, TASK_WOKEN_OTHER); + channel_shutw_now(&stream->req); + channel_shutr_now(&stream->res); + stream->task->nice = 1024; + if (!(stream->flags & SN_ERR_MASK)) + stream->flags |= why; + task_wakeup(stream->task, TASK_WOKEN_OTHER); } /************************************************************************/ @@ -2873,7 +2873,7 @@ void session_shutdown(struct session *session, int why) /* Returns a pointer to a stkctr depending on the fetch keyword name. * It is designed to be called as sc[0-9]_* sc_* or src_* exclusively. * sc[0-9]_* will return a pointer to the respective field in the - * session . sc_* requires an UINT argument specifying the stick + * stream . sc_* requires an UINT argument specifying the stick * counter number. src_* will fill a locally allocated structure with * the table and entry corresponding to what is specified with src_*. * NULL may be returned if the designated stkctr is not tracked. For @@ -2884,7 +2884,7 @@ void session_shutdown(struct session *session, int why) * multiple tables). */ struct stkctr * -smp_fetch_sc_stkctr(struct session *l4, const struct arg *args, const char *kw) +smp_fetch_sc_stkctr(struct stream *l4, const struct arg *args, const char *kw) { static struct stkctr stkctr; struct stksess *stksess; @@ -2930,12 +2930,12 @@ smp_fetch_sc_stkctr(struct session *l4, const struct arg *args, const char *kw) return &l4->stkctr[num]; } -/* set return a boolean indicating if the requested session counter is +/* set return a boolean indicating if the requested stream counter is * currently being tracked or not. * Supports being called as "sc[0-9]_tracked" only. */ static int -smp_fetch_sc_tracked(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_sc_tracked(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { smp->flags = SMP_F_VOL_TEST; @@ -2944,13 +2944,13 @@ smp_fetch_sc_tracked(struct proxy *px, struct session *l4, void *l7, unsigned in return 1; } -/* set to the General Purpose Counter 0 value from the session's tracked +/* set to the General Purpose Counter 0 value from the stream's tracked * frontend counters or from the src. * Supports being called as "sc[0-9]_get_gpc0" or "src_get_gpc0" only. Value * zero is returned if the key is new. */ static int -smp_fetch_sc_get_gpc0(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_sc_get_gpc0(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct stkctr *stkctr = smp_fetch_sc_stkctr(l4, args, kw); @@ -2971,13 +2971,13 @@ smp_fetch_sc_get_gpc0(struct proxy *px, struct session *l4, void *l7, unsigned i return 1; } -/* set to the General Purpose Counter 0's event rate from the session's +/* set to the General Purpose Counter 0's event rate from the stream's * tracked frontend counters or from the src. * Supports being called as "sc[0-9]_gpc0_rate" or "src_gpc0_rate" only. * Value zero is returned if the key is new. */ static int -smp_fetch_sc_gpc0_rate(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_sc_gpc0_rate(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct stkctr *stkctr = smp_fetch_sc_stkctr(l4, args, kw); @@ -2998,12 +2998,12 @@ smp_fetch_sc_gpc0_rate(struct proxy *px, struct session *l4, void *l7, unsigned return 1; } -/* Increment the General Purpose Counter 0 value from the session's tracked +/* Increment the General Purpose Counter 0 value from the stream's tracked * frontend counters and return it into temp integer. * Supports being called as "sc[0-9]_inc_gpc0" or "src_inc_gpc0" only. */ static int -smp_fetch_sc_inc_gpc0(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_sc_inc_gpc0(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct stkctr *stkctr = smp_fetch_sc_stkctr(l4, args, kw); @@ -3035,12 +3035,12 @@ smp_fetch_sc_inc_gpc0(struct proxy *px, struct session *l4, void *l7, unsigned i return 1; } -/* Clear the General Purpose Counter 0 value from the session's tracked +/* Clear the General Purpose Counter 0 value from the stream's tracked * frontend counters and return its previous value into temp integer. * Supports being called as "sc[0-9]_clr_gpc0" or "src_clr_gpc0" only. */ static int -smp_fetch_sc_clr_gpc0(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_sc_clr_gpc0(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct stkctr *stkctr = smp_fetch_sc_stkctr(l4, args, kw); @@ -3061,12 +3061,12 @@ smp_fetch_sc_clr_gpc0(struct proxy *px, struct session *l4, void *l7, unsigned i return 1; } -/* set to the cumulated number of connections from the session's tracked +/* set to the cumulated number of connections from the stream's tracked * frontend counters. Supports being called as "sc[0-9]_conn_cnt" or * "src_conn_cnt" only. */ static int -smp_fetch_sc_conn_cnt(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_sc_conn_cnt(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct stkctr *stkctr = smp_fetch_sc_stkctr(l4, args, kw); @@ -3086,12 +3086,12 @@ smp_fetch_sc_conn_cnt(struct proxy *px, struct session *l4, void *l7, unsigned i return 1; } -/* set to the connection rate from the session's tracked frontend +/* set to the connection rate from the stream's tracked frontend * counters. Supports being called as "sc[0-9]_conn_rate" or "src_conn_rate" * only. */ static int -smp_fetch_sc_conn_rate(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_sc_conn_rate(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct stkctr *stkctr = smp_fetch_sc_stkctr(l4, args, kw); @@ -3112,12 +3112,12 @@ smp_fetch_sc_conn_rate(struct proxy *px, struct session *l4, void *l7, unsigned return 1; } -/* set temp integer to the number of connections from the session's source address +/* set temp integer to the number of connections from the stream's source address * in the table pointed to by expr, after updating it. * Accepts exactly 1 argument of type table. */ static int -smp_fetch_src_updt_conn_cnt(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_src_updt_conn_cnt(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct connection *conn = objt_conn(l4->si[0].end); @@ -3148,12 +3148,12 @@ smp_fetch_src_updt_conn_cnt(struct proxy *px, struct session *l4, void *l7, unsi return 1; } -/* set to the number of concurrent connections from the session's tracked +/* set to the number of concurrent connections from the stream's tracked * frontend counters. Supports being called as "sc[0-9]_conn_cur" or * "src_conn_cur" only. */ static int -smp_fetch_sc_conn_cur(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_sc_conn_cur(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct stkctr *stkctr = smp_fetch_sc_stkctr(l4, args, kw); @@ -3173,12 +3173,12 @@ smp_fetch_sc_conn_cur(struct proxy *px, struct session *l4, void *l7, unsigned i return 1; } -/* set to the cumulated number of sessions from the session's tracked +/* set to the cumulated number of streams from the stream's tracked * frontend counters. Supports being called as "sc[0-9]_sess_cnt" or * "src_sess_cnt" only. */ static int -smp_fetch_sc_sess_cnt(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_sc_sess_cnt(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct stkctr *stkctr = smp_fetch_sc_stkctr(l4, args, kw); @@ -3198,11 +3198,11 @@ smp_fetch_sc_sess_cnt(struct proxy *px, struct session *l4, void *l7, unsigned i return 1; } -/* set to the session rate from the session's tracked frontend counters. +/* set to the stream rate from the stream's tracked frontend counters. * Supports being called as "sc[0-9]_sess_rate" or "src_sess_rate" only. */ static int -smp_fetch_sc_sess_rate(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_sc_sess_rate(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct stkctr *stkctr = smp_fetch_sc_stkctr(l4, args, kw); @@ -3223,12 +3223,12 @@ smp_fetch_sc_sess_rate(struct proxy *px, struct session *l4, void *l7, unsigned return 1; } -/* set to the cumulated number of HTTP requests from the session's tracked +/* set to the cumulated number of HTTP requests from the stream's tracked * frontend counters. Supports being called as "sc[0-9]_http_req_cnt" or * "src_http_req_cnt" only. */ static int -smp_fetch_sc_http_req_cnt(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_sc_http_req_cnt(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct stkctr *stkctr = smp_fetch_sc_stkctr(l4, args, kw); @@ -3248,12 +3248,12 @@ smp_fetch_sc_http_req_cnt(struct proxy *px, struct session *l4, void *l7, unsign return 1; } -/* set to the HTTP request rate from the session's tracked frontend +/* set to the HTTP request rate from the stream's tracked frontend * counters. Supports being called as "sc[0-9]_http_req_rate" or * "src_http_req_rate" only. */ static int -smp_fetch_sc_http_req_rate(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_sc_http_req_rate(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct stkctr *stkctr = smp_fetch_sc_stkctr(l4, args, kw); @@ -3274,12 +3274,12 @@ smp_fetch_sc_http_req_rate(struct proxy *px, struct session *l4, void *l7, unsig return 1; } -/* set to the cumulated number of HTTP requests errors from the session's +/* set to the cumulated number of HTTP requests errors from the stream's * tracked frontend counters. Supports being called as "sc[0-9]_http_err_cnt" or * "src_http_err_cnt" only. */ static int -smp_fetch_sc_http_err_cnt(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_sc_http_err_cnt(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct stkctr *stkctr = smp_fetch_sc_stkctr(l4, args, kw); @@ -3299,12 +3299,12 @@ smp_fetch_sc_http_err_cnt(struct proxy *px, struct session *l4, void *l7, unsign return 1; } -/* set to the HTTP request error rate from the session's tracked frontend +/* set to the HTTP request error rate from the stream's tracked frontend * counters. Supports being called as "sc[0-9]_http_err_rate" or * "src_http_err_rate" only. */ static int -smp_fetch_sc_http_err_rate(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_sc_http_err_rate(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct stkctr *stkctr = smp_fetch_sc_stkctr(l4, args, kw); @@ -3326,11 +3326,11 @@ smp_fetch_sc_http_err_rate(struct proxy *px, struct session *l4, void *l7, unsig } /* set to the number of kbytes received from clients, as found in the - * session's tracked frontend counters. Supports being called as + * stream's tracked frontend counters. Supports being called as * "sc[0-9]_kbytes_in" or "src_kbytes_in" only. */ static int -smp_fetch_sc_kbytes_in(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_sc_kbytes_in(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct stkctr *stkctr = smp_fetch_sc_stkctr(l4, args, kw); @@ -3351,11 +3351,11 @@ smp_fetch_sc_kbytes_in(struct proxy *px, struct session *l4, void *l7, unsigned } /* set to the data rate received from clients in bytes/s, as found - * in the session's tracked frontend counters. Supports being called as + * in the stream's tracked frontend counters. Supports being called as * "sc[0-9]_bytes_in_rate" or "src_bytes_in_rate" only. */ static int -smp_fetch_sc_bytes_in_rate(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_sc_bytes_in_rate(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct stkctr *stkctr = smp_fetch_sc_stkctr(l4, args, kw); @@ -3377,11 +3377,11 @@ smp_fetch_sc_bytes_in_rate(struct proxy *px, struct session *l4, void *l7, unsig } /* set to the number of kbytes sent to clients, as found in the - * session's tracked frontend counters. Supports being called as + * stream's tracked frontend counters. Supports being called as * "sc[0-9]_kbytes_out" or "src_kbytes_out" only. */ static int -smp_fetch_sc_kbytes_out(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_sc_kbytes_out(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct stkctr *stkctr = smp_fetch_sc_stkctr(l4, args, kw); @@ -3402,11 +3402,11 @@ smp_fetch_sc_kbytes_out(struct proxy *px, struct session *l4, void *l7, unsigned } /* set to the data rate sent to clients in bytes/s, as found in the - * session's tracked frontend counters. Supports being called as + * stream's tracked frontend counters. Supports being called as * "sc[0-9]_bytes_out_rate" or "src_bytes_out_rate" only. */ static int -smp_fetch_sc_bytes_out_rate(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_sc_bytes_out_rate(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct stkctr *stkctr = smp_fetch_sc_stkctr(l4, args, kw); @@ -3427,11 +3427,11 @@ smp_fetch_sc_bytes_out_rate(struct proxy *px, struct session *l4, void *l7, unsi return 1; } -/* set to the number of active trackers on the SC entry in the session's +/* set to the number of active trackers on the SC entry in the stream's * tracked frontend counters. Supports being called as "sc[0-9]_trackers" only. */ static int -smp_fetch_sc_trackers(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_sc_trackers(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { struct stkctr *stkctr = smp_fetch_sc_stkctr(l4, args, kw); @@ -3449,7 +3449,7 @@ smp_fetch_sc_trackers(struct proxy *px, struct session *l4, void *l7, unsigned i * Accepts exactly 1 argument of type table. */ static int -smp_fetch_table_cnt(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_table_cnt(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { smp->flags = SMP_F_VOL_TEST; @@ -3462,7 +3462,7 @@ smp_fetch_table_cnt(struct proxy *px, struct session *l4, void *l7, unsigned int * Accepts exactly 1 argument of type table. */ static int -smp_fetch_table_avl(struct proxy *px, struct session *l4, void *l7, unsigned int opt, +smp_fetch_table_avl(struct proxy *px, struct stream *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw, void *private) { px = args->data.prx; @@ -3583,7 +3583,7 @@ static struct sample_fetch_kw_list smp_fetch_keywords = {ILH, { }}; __attribute__((constructor)) -static void __session_init(void) +static void __stream_init(void) { sample_register_fetches(&smp_fetch_keywords); acl_register_keywords(&acl_kws); diff --git a/src/stream_interface.c b/src/stream_interface.c index b97c9c8e5..b8ed071ae 100644 --- a/src/stream_interface.c +++ b/src/stream_interface.c @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include @@ -629,7 +629,7 @@ static int si_conn_wake_cb(struct connection *conn) if (ic->flags & CF_READ_ACTIVITY) ic->flags &= ~CF_READ_DONTWAIT; - session_release_buffers(si_sess(si)); + stream_release_buffers(si_strm(si)); return 0; } @@ -1149,7 +1149,7 @@ static void si_conn_recv_cb(struct connection *conn) } /* now we'll need a buffer */ - if (!session_alloc_recv_buffer(ic)) { + if (!stream_alloc_recv_buffer(ic)) { si->flags |= SI_FL_WAIT_ROOM; goto end_recv; } @@ -1330,7 +1330,7 @@ void stream_sock_read0(struct stream_interface *si) if (si->flags & SI_FL_NOHALF) { /* we want to immediately forward this close to the write side */ - /* force flag on ssl to keep session in cache */ + /* force flag on ssl to keep stream in cache */ conn_data_shutw_hard(conn); goto do_close; } diff --git a/src/task.c b/src/task.c index d475322c4..4a8b9074f 100644 --- a/src/task.c +++ b/src/task.c @@ -20,7 +20,7 @@ #include #include -#include +#include #include struct pool_head *pool2_task; @@ -234,8 +234,8 @@ void process_runnable_tasks() * predictor take this most common call. */ t->calls++; - if (likely(t->process == process_session)) - t = process_session(t); + if (likely(t->process == process_stream)) + t = process_stream(t); else t = t->process(t);