REORG/MAJOR: session: rename the "session" entity to "stream"

With HTTP/2, we'll have to support multiplexed streams. A stream is in
fact the largest part of what we currently call a session, it has buffers,
logs, etc.

In order to catch any error, this commit removes any reference to the
struct session and tries to rename most "session" occurrences in function
names to "stream" and "sess" to "strm" when that's related to a session.

The files stream.{c,h} were added and session.{c,h} removed.

The session will be reintroduced later and a few parts of the stream
will progressively be moved overthere. It will more or less contain
only what we need in an embryonic session.

Sample fetch functions and converters will have to change a bit so
that they'll use an L5 (session) instead of what's currently called
"L4" which is in fact L6 for now.

Once all changes are completed, we should see approximately this :

   L7 - http_txn
   L6 - stream
   L5 - session
   L4 - connection | applet

There will be at most one http_txn per stream, and a same session will
possibly be referenced by multiple streams. A connection will point to
a session and to a stream. The session will hold all the information
we need to keep even when we don't yet have a stream.

Some more cleanup is needed because some code was already far from
being clean. The server queue management still refers to sessions at
many places while comments talk about connections. This will have to
be cleaned up once we have a server-side connection pool manager.
Stream flags "SN_*" still need to be renamed, it doesn't seem like
any of them will need to move to the session.
This commit is contained in:
Willy Tarreau 2015-04-03 00:22:06 +02:00
parent 7073c471a1
commit 87b09668be
57 changed files with 1133 additions and 1143 deletions

View File

@ -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

View File

@ -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)

View File

@ -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 + \

View File

@ -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 <where>
* which is one of the SMP_VAL_* bits indicating a check place, or NULL if

View File

@ -28,16 +28,16 @@
#include <types/backend.h>
#include <types/proxy.h>
#include <types/server.h>
#include <types/session.h>
#include <types/stream.h>
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);

View File

@ -33,7 +33,7 @@
#include <types/channel.h>
#include <types/global.h>
#include <types/session.h>
#include <types/stream.h>
#include <types/stream_interface.h>
/* 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. */

View File

@ -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;

View File

@ -23,9 +23,9 @@
#define _PROTO_FRONTEND_H
#include <common/config.h>
#include <types/session.h>
#include <types/stream.h>
int frontend_accept(struct session *s);
int frontend_accept(struct stream *s);
#endif /* _PROTO_FRONTEND_H */

View File

@ -30,7 +30,7 @@
#include <common/memory.h>
#include <types/log.h>
#include <types/proxy.h>
#include <types/session.h>
#include <types/stream.h>
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

View File

@ -24,9 +24,9 @@
#include <common/config.h>
#include <types/sample.h>
#include <types/session.h>
#include <types/stream.h>
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 */

View File

@ -25,7 +25,7 @@
#include <common/config.h>
#include <common/ticks.h>
#include <common/time.h>
#include <types/session.h>
#include <types/stream.h>
#include <types/peers.h>
void peers_register_table(struct peers *, struct stktable *table);

View File

@ -24,7 +24,7 @@
#include <common/config.h>
#include <types/proto_http.h>
#include <types/session.h>
#include <types/stream.h>
#include <types/task.h>
/*
@ -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);

View File

@ -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);

View File

@ -23,7 +23,7 @@
#define _PROTO_PROTO_UXST_H
#include <common/config.h>
#include <types/session.h>
#include <types/stream.h>
#include <types/task.h>
void uxst_add_listener(struct listener *listener);

View File

@ -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);

View File

@ -28,7 +28,7 @@
#include <types/proxy.h>
#include <types/queue.h>
#include <types/session.h>
#include <types/stream.h>
#include <types/server.h>
#include <types/task.h>
@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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 <common/config.h>
#include <common/memory.h>
#include <types/session.h>
#include <types/stream.h>
#include <proto/fd.h>
#include <proto/freq_ctr.h>
#include <proto/stick_table.h>
#include <proto/task.h>
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 <why> (one of SN_ERR_*) */
void session_shutdown(struct session *session, int why);
/* kill a stream and set the termination flags to <why> (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)
* <t>. The caller is responsible for ensuring that <t> and <ts> 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 <stkctr> on stksess <ts>. The caller is
/* Enable tracking of stream counters as <stkctr> on stksess <ts>. The caller is
* responsible for ensuring that <t> and <ts> 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:

View File

@ -25,7 +25,7 @@
#include <stdlib.h>
#include <common/config.h>
#include <types/session.h>
#include <types/stream.h>
#include <types/stream_interface.h>
#include <proto/channel.h>
#include <proto/connection.h>
@ -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

View File

@ -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.

View File

@ -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. */
};

View File

@ -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 */

View File

@ -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 */

View File

@ -26,7 +26,7 @@
#include <common/mini-clist.h>
#include <types/acl.h>
#include <types/session.h>
#include <types/stream.h>
/* 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;

View File

@ -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 */

View File

@ -27,11 +27,11 @@
#include <types/server.h>
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 */
};

View File

@ -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,

View File

@ -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 <sys/time.h>
#include <unistd.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <common/config.h>
#include <common/mini-clist.h>
#include <types/channel.h>
#include <types/compression.h>
#include <types/hlua.h>
#include <types/obj_type.h>
#include <types/proto_http.h>
#include <types/proxy.h>
#include <types/queue.h>
#include <types/server.h>
#include <types/stream_interface.h>
#include <types/task.h>
#include <types/stick_table.h>
/* 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:
*/

View File

@ -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) */
};

166
include/types/stream.h Normal file
View File

@ -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 <sys/time.h>
#include <unistd.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <common/config.h>
#include <common/mini-clist.h>
#include <types/channel.h>
#include <types/compression.h>
#include <types/hlua.h>
#include <types/obj_type.h>
#include <types/proto_http.h>
#include <types/proxy.h>
#include <types/queue.h>
#include <types/server.h>
#include <types/stream_interface.h>
#include <types/task.h>
#include <types/stick_table.h>
/* 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:
*/

View File

@ -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;

View File

@ -50,7 +50,7 @@
#include <proto/queue.h>
#include <proto/sample.h>
#include <proto/server.h>
#include <proto/session.h>
#include <proto/stream.h>
#include <proto/raw_sock.h>
#include <proto/stream_interface.h>
#include <proto/task.h>
@ -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 <s> if required, and can add the
/* This function assigns a server to stream <s> 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;

View File

@ -74,7 +74,7 @@
#include <proto/peers.h>
#include <proto/sample.h>
#include <proto/server.h>
#include <proto/session.h>
#include <proto/stream.h>
#include <proto/raw_sock.h>
#include <proto/task.h>
#include <proto/stick_table.h>
@ -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;

View File

@ -57,7 +57,6 @@
#include <proto/proxy.h>
#include <proto/raw_sock.h>
#include <proto/server.h>
#include <proto/session.h>
#include <proto/stream_interface.h>
#include <proto/task.h>

View File

@ -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)

View File

@ -20,7 +20,6 @@
#include <proto/fd.h>
#include <proto/frontend.h>
#include <proto/proto_tcp.h>
#include <proto/session.h>
#include <proto/stream_interface.h>
#ifdef USE_OPENSSL

View File

@ -56,7 +56,7 @@
#include <proto/proto_uxst.h>
#include <proto/proxy.h>
#include <proto/sample.h>
#include <proto/session.h>
#include <proto/stream.h>
#include <proto/server.h>
#include <proto/raw_sock.h>
#include <proto/stream_interface.h>
@ -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 <arg> 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 <arg> under the form <backend>/<server>,
* 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 <arg> 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. <uri> contains some HTML-specific parameters that
* are ignored for CSV format (hence <uri> 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;

View File

@ -42,17 +42,17 @@
#include <proto/proto_http.h>
#include <proto/proxy.h>
#include <proto/sample.h>
#include <proto/session.h>
#include <proto/stream.h>
#include <proto/stream_interface.h>
#include <proto/task.h>
/* 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 <p>, <p>, and later <be> and <be>.
*/
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;

View File

@ -97,7 +97,7 @@
#include <proto/proxy.h>
#include <proto/queue.h>
#include <proto/server.h>
#include <proto/session.h>
#include <proto/stream.h>
#include <proto/signal.h>
#include <proto/task.h>
@ -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);

View File

@ -31,7 +31,7 @@
#include <proto/raw_sock.h>
#include <proto/sample.h>
#include <proto/server.h>
#include <proto/session.h>
#include <proto/stream.h>
#include <proto/ssl_sock.h>
#include <proto/stream_interface.h>
#include <proto/task.h>
@ -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. */

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -38,7 +38,7 @@
#include <proto/proto_tcp.h>
#include <proto/proto_http.h>
#include <proto/proxy.h>
#include <proto/session.h>
#include <proto/stream.h>
#include <proto/signal.h>
#include <proto/stick_table.h>
#include <proto/stream_interface.h>
@ -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 */

File diff suppressed because it is too large Load Diff

View File

@ -51,7 +51,7 @@
#include <proto/proto_tcp.h>
#include <proto/proxy.h>
#include <proto/sample.h>
#include <proto/session.h>
#include <proto/stream.h>
#include <proto/stick_table.h>
#include <proto/stream_interface.h>
#include <proto/task.h>
@ -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);

View File

@ -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 <be>. Nothing is done if the
* session already had a backend assigned, which is indicated by
/* Set current stream's backend to <be>. 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;

View File

@ -16,7 +16,7 @@
#include <proto/queue.h>
#include <proto/server.h>
#include <proto/session.h>
#include <proto/stream.h>
#include <proto/stream_interface.h>
#include <proto/task.h>
@ -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 <srv> nor <px> may be NULL.
* Priority is given to the oldest request in the queue if both <srv> and <px>
* 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 <srv> and
* The stream is immediately marked as "assigned", and both its <srv> and
* <srv_conn> are set to <srv>,
*/
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 <sess> to the pending connection list of server <sess>->srv
* or to the one of <sess>->proxy if srv is NULL. All counters and back pointers
/* Adds the stream <strm> to the pending connection list of server <strm>->srv
* or to the one of <strm>->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 <p>, 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);
}

View File

@ -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;

View File

@ -27,7 +27,7 @@
#include <proto/queue.h>
#include <proto/raw_sock.h>
#include <proto/server.h>
#include <proto/session.h>
#include <proto/stream.h>
#include <proto/task.h>
@ -166,26 +166,26 @@ static int srv_parse_id(char **args, int *cur_arg, struct proxy *curproxy, struc
* code in <why>, 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 <why>, 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 <reason> 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 <xferred> is non-negative, some information about requeued sessions are
* If <xferred> 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 <s> 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 <reason> if non-null as the reason for going down. Note
* that it makes use of the trash to build the log strings, so <reason> 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.

View File

@ -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;

View File

@ -25,7 +25,7 @@
#include <proto/arg.h>
#include <proto/proxy.h>
#include <proto/sample.h>
#include <proto/session.h>
#include <proto/stream.h>
#include <proto/stick_table.h>
#include <proto/task.h>
#include <proto/peers.h>
@ -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,
* <not found> 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,
* <not found> 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, <not found> 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,
* <not found> 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,
* <not found> 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,
* <not found> 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,
* <not found> 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, <not found> 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,
* <not found> 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, <not found> 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, <not found>
* 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,
* <not found> 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,
* <not found> 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,
* <not found> 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, <not found> 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, <not found>
* 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, <not found> 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;

File diff suppressed because it is too large Load Diff

View File

@ -30,7 +30,7 @@
#include <proto/channel.h>
#include <proto/connection.h>
#include <proto/pipe.h>
#include <proto/session.h>
#include <proto/stream.h>
#include <proto/stream_interface.h>
#include <proto/task.h>
@ -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;
}

View File

@ -20,7 +20,7 @@
#include <eb32tree.h>
#include <proto/proxy.h>
#include <proto/session.h>
#include <proto/stream.h>
#include <proto/task.h>
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);