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);
+struct act_rule *parse_http_req_cond(const char **args, const char *file, int linenum, struct proxy *proxy);
+struct act_rule *parse_http_res_cond(const char **args, const char *file, int linenum, struct proxy *proxy);
void free_http_req_rules(struct list *r);
void free_http_res_rules(struct list *r);
struct chunk *http_error_message(struct stream *s, int msgnum);
--- /dev/null
+/*
+ * include/types/action.h
+ * This file contains TCP protocol definitions.
+ *
+ * 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_ACTION_H
+#define _TYPES_ACTION_H
+
+#include <types/stick_table.h>
+
+struct capture_prm {
+ struct sample_expr *expr; /* expression used as the key */
+ struct cap_hdr *hdr; /* the capture storage */
+};
+
+struct act_rule {
+ struct list list;
+ struct acl_cond *cond; /* acl condition to meet */
+ unsigned int action; /* HTTP_REQ_* */
+ short deny_status; /* HTTP status to return to user when denying */
+ int (*action_ptr)(struct act_rule *rule, struct proxy *px,
+ struct session *sess, struct stream *s); /* ptr to custom action */
+ union {
+ struct {
+ char *realm;
+ } auth; /* arg used by "auth" */
+ struct {
+ char *name; /* header name */
+ int name_len; /* header name's length */
+ struct list fmt; /* log-format compatible expression */
+ struct my_regex re; /* used by replace-header and replace-value */
+ } hdr_add; /* args used by "add-header" and "set-header" */
+ struct redirect_rule *redir; /* redirect rule or "http-request redirect" */
+ int nice; /* nice value for HTTP_REQ_ACT_SET_NICE */
+ int loglevel; /* log-level value for HTTP_REQ_ACT_SET_LOGL */
+ int tos; /* tos value for HTTP_REQ_ACT_SET_TOS */
+ int mark; /* nfmark value for HTTP_REQ_ACT_SET_MARK */
+ void *data; /* generic pointer for module or external rule */
+ struct {
+ char *ref; /* MAP or ACL file name to update */
+ struct list key; /* pattern to retrieve MAP or ACL key */
+ struct list value; /* pattern to retrieve MAP value */
+ } map;
+ struct {
+ void *p[4];
+ } act; /* generic pointers to be used by custom actions */
+ } arg; /* arguments used by some actions */
+
+ union {
+ struct capture_prm cap;
+ struct track_ctr_prm trk_ctr;
+ } act_prm;
+};
+
+#endif /* _TYPES_ACTION_H */
#include <common/mini-clist.h>
#include <common/regex.h>
+#include <types/action.h>
#include <types/hdr_idx.h>
-#include <types/stick_table.h>
/* These are the flags that are found in txn->flags */
struct http_txn;
struct stream;
-struct http_req_rule {
- struct list list;
- struct acl_cond *cond; /* acl condition to meet */
- unsigned int action; /* HTTP_REQ_* */
- short deny_status; /* HTTP status to return to user when denying */
- int (*action_ptr)(struct http_req_rule *rule, struct proxy *px, struct stream *s); /* ptr to custom action */
- union {
- struct {
- char *realm;
- } auth; /* arg used by "auth" */
- struct {
- char *name; /* header name */
- int name_len; /* header name's length */
- struct list fmt; /* log-format compatible expression */
- struct my_regex re; /* used by replace-header and replace-value */
- } hdr_add; /* args used by "add-header" and "set-header" */
- struct redirect_rule *redir; /* redirect rule or "http-request redirect" */
- int nice; /* nice value for HTTP_REQ_ACT_SET_NICE */
- int loglevel; /* log-level value for HTTP_REQ_ACT_SET_LOGL */
- int tos; /* tos value for HTTP_REQ_ACT_SET_TOS */
- int mark; /* nfmark value for HTTP_REQ_ACT_SET_MARK */
- void *data; /* generic pointer for module or external rule */
- struct {
- char *ref; /* MAP or ACL file name to update */
- struct list key; /* pattern to retrieve MAP or ACL key */
- struct list value; /* pattern to retrieve MAP value */
- } map;
- struct {
- void *p[4];
- } act; /* generic pointers to be used by custom actions */
- } arg; /* arguments used by some actions */
-
- union {
- struct track_ctr_prm trk_ctr;
- } act_prm;
-};
-
-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 stream *s); /* ptr to custom action */
- union {
- struct {
- char *name; /* header name */
- int name_len; /* header name's length */
- struct list fmt; /* log-format compatible expression */
- struct my_regex re; /* used by replace-header and replace-value */
- } hdr_add; /* args used by "add-header" and "set-header" */
- struct redirect_rule *redir; /* redirect rule or "http-request redirect" */
- int nice; /* nice value for HTTP_RES_ACT_SET_NICE */
- int loglevel; /* log-level value for HTTP_RES_ACT_SET_LOGL */
- int tos; /* tos value for HTTP_RES_ACT_SET_TOS */
- int mark; /* nfmark value for HTTP_RES_ACT_SET_MARK */
- void *data; /* generic pointer for module or external rule */
- struct {
- char *ref; /* MAP or ACL file name to update */
- struct list key; /* pattern to retrieve MAP or ACL key */
- struct list value; /* pattern to retrieve MAP value */
- } map;
- struct {
- void *p[4];
- } act; /* generic pointers to be used by custom actions */
- } arg; /* arguments used by some actions */
-};
-
/* This is an HTTP transaction. It contains both a request message and a
* response message (which can be empty).
*/
struct http_req_action_kw {
const char *kw;
- int (*parse)(const char **args, int *cur_arg, struct proxy *px, struct http_req_rule *rule, char **err);
+ int (*parse)(const char **args, int *cur_arg, struct proxy *px, struct act_rule *rule, char **err);
int match_pfx;
};
struct http_res_action_kw {
const char *kw;
- int (*parse)(const char **args, int *cur_arg, struct proxy *px, struct http_res_rule *rule, char **err);
+ int (*parse)(const char **args, int *cur_arg, struct proxy *px, struct act_rule *rule, char **err);
int match_pfx;
};
#include <common/config.h>
#include <common/mini-clist.h>
+#include <types/action.h>
#include <types/acl.h>
#include <types/stream.h>
TCP_ACT_CUSTOM_CONT, /* Use for custom registered keywords. */
};
-struct capture_prm {
- struct sample_expr *expr; /* expression used as the key */
- struct cap_hdr *hdr; /* the capture storage */
-};
-
-struct tcp_rule {
- struct list list;
- struct acl_cond *cond;
- int action;
- int (*action_ptr)(struct tcp_rule *rule, struct proxy *px,
- struct session *sess, struct stream *s);
- union {
- struct track_ctr_prm trk_ctr;
- struct capture_prm cap;
- void *data[4];
- } act_prm;
-};
-
struct tcp_action_kw {
const char *kw;
int (*parse)(const char **args, int *cur_arg, struct proxy *px,
- struct tcp_rule *rule, char **err);
+ struct act_rule *rule, char **err);
int match_pfx;
};
curproxy->conn_retries = atol(args[1]);
}
else if (!strcmp(args[0], "http-request")) { /* request access control: allow/deny/auth */
- struct http_req_rule *rule;
+ struct act_rule *rule;
if (curproxy == &defproxy) {
Alert("parsing [%s:%d]: '%s' not allowed in 'defaults' section.\n", file, linenum, args[0]);
}
if (!LIST_ISEMPTY(&curproxy->http_req_rules) &&
- !LIST_PREV(&curproxy->http_req_rules, struct http_req_rule *, list)->cond &&
- (LIST_PREV(&curproxy->http_req_rules, struct http_req_rule *, list)->action == HTTP_REQ_ACT_ALLOW ||
- LIST_PREV(&curproxy->http_req_rules, struct http_req_rule *, list)->action == HTTP_REQ_ACT_DENY ||
- LIST_PREV(&curproxy->http_req_rules, struct http_req_rule *, list)->action == HTTP_REQ_ACT_REDIR ||
- LIST_PREV(&curproxy->http_req_rules, struct http_req_rule *, list)->action == HTTP_REQ_ACT_AUTH)) {
+ !LIST_PREV(&curproxy->http_req_rules, struct act_rule *, list)->cond &&
+ (LIST_PREV(&curproxy->http_req_rules, struct act_rule *, list)->action == HTTP_REQ_ACT_ALLOW ||
+ LIST_PREV(&curproxy->http_req_rules, struct act_rule *, list)->action == HTTP_REQ_ACT_DENY ||
+ LIST_PREV(&curproxy->http_req_rules, struct act_rule *, list)->action == HTTP_REQ_ACT_REDIR ||
+ LIST_PREV(&curproxy->http_req_rules, struct act_rule *, list)->action == HTTP_REQ_ACT_AUTH)) {
Warning("parsing [%s:%d]: previous '%s' action is final and has no condition attached, further entries are NOOP.\n",
file, linenum, args[0]);
err_code |= ERR_WARN;
LIST_ADDQ(&curproxy->http_req_rules, &rule->list);
}
else if (!strcmp(args[0], "http-response")) { /* response access control */
- struct http_res_rule *rule;
+ struct act_rule *rule;
if (curproxy == &defproxy) {
Alert("parsing [%s:%d]: '%s' not allowed in 'defaults' section.\n", file, linenum, args[0]);
}
if (!LIST_ISEMPTY(&curproxy->http_res_rules) &&
- !LIST_PREV(&curproxy->http_res_rules, struct http_res_rule *, list)->cond &&
- (LIST_PREV(&curproxy->http_res_rules, struct http_res_rule *, list)->action == HTTP_RES_ACT_ALLOW ||
- LIST_PREV(&curproxy->http_res_rules, struct http_res_rule *, list)->action == HTTP_RES_ACT_DENY)) {
+ !LIST_PREV(&curproxy->http_res_rules, struct act_rule *, list)->cond &&
+ (LIST_PREV(&curproxy->http_res_rules, struct act_rule *, list)->action == HTTP_RES_ACT_ALLOW ||
+ LIST_PREV(&curproxy->http_res_rules, struct act_rule *, list)->action == HTTP_RES_ACT_DENY)) {
Warning("parsing [%s:%d]: previous '%s' action is final and has no condition attached, further entries are NOOP.\n",
file, linenum, args[0]);
err_code |= ERR_WARN;
curproxy->server_id_hdr_len = strlen(curproxy->server_id_hdr_name);
}
else if (!strcmp(args[0], "block")) { /* early blocking based on ACLs */
- struct http_req_rule *rule;
+ struct act_rule *rule;
if (curproxy == &defproxy) {
Alert("parsing [%s:%d] : '%s' not allowed in 'defaults' section.\n", file, linenum, args[0]);
goto out;
}
} else if (!strcmp(args[1], "http-request")) { /* request access control: allow/deny/auth */
- struct http_req_rule *rule;
+ struct act_rule *rule;
if (curproxy == &defproxy) {
Alert("parsing [%s:%d]: '%s' not allowed in 'defaults' section.\n", file, linenum, args[0]);
}
if (!LIST_ISEMPTY(&curproxy->uri_auth->http_req_rules) &&
- !LIST_PREV(&curproxy->uri_auth->http_req_rules, struct http_req_rule *, list)->cond) {
+ !LIST_PREV(&curproxy->uri_auth->http_req_rules, struct act_rule *, list)->cond) {
Warning("parsing [%s:%d]: previous '%s' action has no condition attached, further entries are NOOP.\n",
file, linenum, args[0]);
err_code |= ERR_WARN;
struct switching_rule *rule;
struct server_rule *srule;
struct sticking_rule *mrule;
- struct tcp_rule *trule;
- struct http_req_rule *hrqrule;
+ struct act_rule *trule;
+ struct act_rule *hrqrule;
unsigned int next_id;
int nbproc;
if (curproxy->uri_auth && curproxy->uri_auth->userlist && !(curproxy->uri_auth->flags & ST_CONVDONE)) {
const char *uri_auth_compat_req[10];
- struct http_req_rule *rule;
+ struct act_rule *rule;
int i = 0;
/* build the ACL condition from scratch. We're relying on anonymous ACLs for that */
static void deinit_tcp_rules(struct list *rules)
{
- struct tcp_rule *trule, *truleb;
+ struct act_rule *trule, *truleb;
list_for_each_entry_safe(trule, truleb, rules, list) {
LIST_DEL(&trule->list);
/* Lua execution wrapper for "tcp-request". This function uses
* "hlua_request_act_wrapper" for executing the LUA code.
*/
-int hlua_tcp_req_act_wrapper(struct tcp_rule *tcp_rule, struct proxy *px,
+int hlua_tcp_req_act_wrapper(struct act_rule *act_rule, struct proxy *px,
struct session *sess, struct stream *s)
{
- return hlua_request_act_wrapper((struct hlua_rule *)tcp_rule->act_prm.data[0],
+ return hlua_request_act_wrapper((struct hlua_rule *)act_rule->arg.data,
px, s, AN_REQ_INSPECT_FE);
}
/* Lua execution wrapper for "tcp-response". This function uses
* "hlua_request_act_wrapper" for executing the LUA code.
*/
-int hlua_tcp_res_act_wrapper(struct tcp_rule *tcp_rule, struct proxy *px,
+int hlua_tcp_res_act_wrapper(struct act_rule *act_rule, struct proxy *px,
struct session *sess, struct stream *s)
{
- return hlua_request_act_wrapper((struct hlua_rule *)tcp_rule->act_prm.data[0],
+ return hlua_request_act_wrapper((struct hlua_rule *)act_rule->arg.data,
px, s, AN_RES_INSPECT);
}
* This function uses "hlua_request_act_wrapper" for executing
* the LUA code.
*/
-int hlua_http_req_act_wrapper(struct http_req_rule *rule, struct proxy *px,
- struct stream *s)
+int hlua_http_req_act_wrapper(struct act_rule *rule, struct proxy *px,
+ struct session *sess, struct stream *s)
{
return hlua_request_act_wrapper((struct hlua_rule *)rule->arg.data, px,
s, AN_REQ_HTTP_PROCESS_FE);
* This function uses "hlua_request_act_wrapper" for executing
* the LUA code.
*/
-int hlua_http_res_act_wrapper(struct http_res_rule *rule, struct proxy *px,
- struct stream *s)
+int hlua_http_res_act_wrapper(struct act_rule *rule, struct proxy *px,
+ struct session *sess, struct stream *s)
{
return hlua_request_act_wrapper((struct hlua_rule *)rule->arg.data, px,
s, AN_RES_HTTP_PROCESS_BE);
/* tcp-request <*> configuration wrapper. */
static int tcp_req_action_register_lua(const char **args, int *cur_arg, struct proxy *px,
- struct tcp_rule *rule, char **err)
+ struct act_rule *rule, char **err)
{
- if (!hlua_parse_rule(args, cur_arg, px, (struct hlua_rule **)&rule->act_prm.data[0], err))
+ if (!hlua_parse_rule(args, cur_arg, px, (struct hlua_rule **)&rule->arg.data, err))
return 0;
rule->action = TCP_ACT_CUSTOM_CONT;
rule->action_ptr = hlua_tcp_req_act_wrapper;
/* tcp-response <*> configuration wrapper. */
static int tcp_res_action_register_lua(const char **args, int *cur_arg, struct proxy *px,
- struct tcp_rule *rule, char **err)
+ struct act_rule *rule, char **err)
{
- if (!hlua_parse_rule(args, cur_arg, px, (struct hlua_rule **)&rule->act_prm.data[0], err))
+ if (!hlua_parse_rule(args, cur_arg, px, (struct hlua_rule **)&rule->arg.data, err))
return 0;
rule->action = TCP_ACT_CUSTOM_CONT;
rule->action_ptr = hlua_tcp_res_act_wrapper;
/* http-request <*> configuration wrapper. */
static int http_req_action_register_lua(const char **args, int *cur_arg, struct proxy *px,
- struct http_req_rule *rule, char **err)
+ struct act_rule *rule, char **err)
{
if (!hlua_parse_rule(args, cur_arg, px, (struct hlua_rule **)&rule->arg.data, err))
return -1;
/* http-response <*> configuration wrapper. */
static int http_res_action_register_lua(const char **args, int *cur_arg, struct proxy *px,
- struct http_res_rule *rule, char **err)
+ struct act_rule *rule, char **err)
{
if (!hlua_parse_rule(args, cur_arg, px, (struct hlua_rule **)&rule->arg.data, err))
return -1;
struct session *sess = strm_sess(s);
struct http_txn *txn = s->txn;
struct connection *cli_conn;
- struct http_req_rule *rule;
+ struct act_rule *rule;
struct hdr_ctx ctx;
const char *auth_realm;
}
case HTTP_REQ_ACT_CUSTOM_CONT:
- if (!rule->action_ptr(rule, px, s)) {
+ if (!rule->action_ptr(rule, px, s->sess, s)) {
s->current_rule = rule;
return HTTP_RULE_RES_YIELD;
}
break;
case HTTP_REQ_ACT_CUSTOM_STOP:
- rule->action_ptr(rule, px, s);
+ rule->action_ptr(rule, px, s->sess, s);
return HTTP_RULE_RES_DONE;
case HTTP_REQ_ACT_TRK_SC0 ... HTTP_REQ_ACT_TRK_SCMAX:
struct session *sess = strm_sess(s);
struct http_txn *txn = s->txn;
struct connection *cli_conn;
- struct http_res_rule *rule;
+ struct act_rule *rule;
struct hdr_ctx ctx;
/* If "the current_rule_list" match the executed rule list, we are in
return HTTP_RULE_RES_DONE;
case HTTP_RES_ACT_CUSTOM_CONT:
- if (!rule->action_ptr(rule, px, s)) {
+ if (!rule->action_ptr(rule, px, s->sess, s)) {
s->current_rule = rule;
return HTTP_RULE_RES_YIELD;
}
break;
case HTTP_RES_ACT_CUSTOM_STOP:
- rule->action_ptr(rule, px, s);
+ rule->action_ptr(rule, px, s->sess, s);
return HTTP_RULE_RES_STOP;
}
}
void free_http_res_rules(struct list *r)
{
- struct http_res_rule *tr, *pr;
+ struct act_rule *tr, *pr;
list_for_each_entry_safe(pr, tr, r, list) {
LIST_DEL(&pr->list);
void free_http_req_rules(struct list *r)
{
- struct http_req_rule *tr, *pr;
+ struct act_rule *tr, *pr;
list_for_each_entry_safe(pr, tr, r, list) {
LIST_DEL(&pr->list);
}
/* parse an "http-request" rule */
-struct http_req_rule *parse_http_req_cond(const char **args, const char *file, int linenum, struct proxy *proxy)
+struct act_rule *parse_http_req_cond(const char **args, const char *file, int linenum, struct proxy *proxy)
{
- struct http_req_rule *rule;
+ struct act_rule *rule;
struct http_req_action_kw *custom = NULL;
int cur_arg;
char *error;
- rule = (struct http_req_rule*)calloc(1, sizeof(struct http_req_rule));
+ rule = (struct act_rule*)calloc(1, sizeof(struct act_rule));
if (!rule) {
Alert("parsing [%s:%d]: out of memory.\n", file, linenum);
goto out_err;
}
/* parse an "http-respose" rule */
-struct http_res_rule *parse_http_res_cond(const char **args, const char *file, int linenum, struct proxy *proxy)
+struct act_rule *parse_http_res_cond(const char **args, const char *file, int linenum, struct proxy *proxy)
{
- struct http_res_rule *rule;
+ struct act_rule *rule;
struct http_res_action_kw *custom = NULL;
int cur_arg;
char *error;
* http_action_set_req_line_exec(). It always returns 1. If an error occurs
* the action is canceled, but the rule processing continue.
*/
-int http_action_set_req_line(struct http_req_rule *rule, struct proxy *px, struct stream *s)
+int http_action_set_req_line(struct act_rule *rule, struct proxy *px,
+ struct session *sess, struct stream *s)
{
chunk_reset(&trash);
* head, and p[2] to store the action as an int (0=method, 1=path, 2=query, 3=uri).
* It returns 0 on success, < 0 on error.
*/
-int parse_set_req_line(const char **args, int *orig_arg, struct proxy *px, struct http_req_rule *rule, char **err)
+int parse_set_req_line(const char **args, int *orig_arg, struct proxy *px, struct act_rule *rule, char **err)
{
int cur_arg = *orig_arg;
* returns 1. If an error occurs the action is cancelled, but the rule
* processing continues.
*/
-int http_action_req_capture(struct http_req_rule *rule, struct proxy *px, struct stream *s)
+int http_action_req_capture(struct act_rule *rule, struct proxy *px,
+ struct session *sess, struct stream *s)
{
- struct session *sess = s->sess;
struct sample *key;
struct sample_expr *expr = rule->arg.act.p[0];
struct cap_hdr *h = rule->arg.act.p[1];
* into a string and puts it in a capture slot. It always returns 1. If an
* error occurs the action is cancelled, but the rule processing continues.
*/
-int http_action_req_capture_by_id(struct http_req_rule *rule, struct proxy *px, struct stream *s)
+int http_action_req_capture_by_id(struct act_rule *rule, struct proxy *px,
+ struct session *sess, struct stream *s)
{
- struct session *sess = s->sess;
struct sample *key;
struct sample_expr *expr = rule->arg.act.p[0];
struct cap_hdr *h;
* the allocated hdr_cap struct or the preallocated "id" into arg->act.p[1].
* It returns 0 on success, < 0 on error.
*/
-int parse_http_req_capture(const char **args, int *orig_arg, struct proxy *px, struct http_req_rule *rule, char **err)
+int parse_http_req_capture(const char **args, int *orig_arg, struct proxy *px, struct act_rule *rule, char **err)
{
struct sample_expr *expr;
struct cap_hdr *hdr;
* into a string and puts it in a capture slot. It always returns 1. If an
* error occurs the action is cancelled, but the rule processing continues.
*/
-int http_action_res_capture_by_id(struct http_res_rule *rule, struct proxy *px, struct stream *s)
+int http_action_res_capture_by_id(struct act_rule *rule, struct proxy *px,
+ struct session *sess, struct stream *s)
{
- struct session *sess = s->sess;
struct sample *key;
struct sample_expr *expr = rule->arg.act.p[0];
struct cap_hdr *h;
* the allocated hdr_cap struct od the preallocated id into arg->act.p[1].
* It returns 0 on success, < 0 on error.
*/
-int parse_http_res_capture(const char **args, int *orig_arg, struct proxy *px, struct http_res_rule *rule, char **err)
+int parse_http_res_capture(const char **args, int *orig_arg, struct proxy *px, struct act_rule *rule, char **err)
{
struct sample_expr *expr;
int cur_arg;
int tcp_inspect_request(struct stream *s, struct channel *req, int an_bit)
{
struct session *sess = s->sess;
- struct tcp_rule *rule;
+ struct act_rule *rule;
struct stksess *ts;
struct stktable *t;
int partial;
int tcp_inspect_response(struct stream *s, struct channel *rep, int an_bit)
{
struct session *sess = s->sess;
- struct tcp_rule *rule;
+ struct act_rule *rule;
int partial;
DPRINTF(stderr,"[%u] %s: stream=%p b=%p, exp(r,w)=%u,%u bf=%08x bh=%d analysers=%02x\n",
*/
int tcp_exec_req_rules(struct session *sess)
{
- struct tcp_rule *rule;
+ struct act_rule *rule;
struct stksess *ts;
struct stktable *t = NULL;
struct connection *conn = objt_conn(sess->origin);
/* Parse a tcp-response rule. Return a negative value in case of failure */
static int tcp_parse_response_rule(char **args, int arg, int section_type,
struct proxy *curpx, struct proxy *defpx,
- struct tcp_rule *rule, char **err,
+ struct act_rule *rule, char **err,
unsigned int where,
const char *file, int line)
{
/* Parse a tcp-request rule. Return a negative value in case of failure */
static int tcp_parse_request_rule(char **args, int arg, int section_type,
struct proxy *curpx, struct proxy *defpx,
- struct tcp_rule *rule, char **err,
+ struct act_rule *rule, char **err,
unsigned int where, const char *file, int line)
{
if (curpx == defpx) {
unsigned int val;
int warn = 0;
int arg;
- struct tcp_rule *rule;
+ struct act_rule *rule;
unsigned int where;
const struct acl *acl;
const char *kw;
unsigned int val;
int warn = 0;
int arg;
- struct tcp_rule *rule;
+ struct act_rule *rule;
unsigned int where;
const struct acl *acl;
const char *kw;
return 1;
}
-
/* Note: must not be declared <const> as its list will be overwritten */
static struct sample_conv_kw_list sample_conv_kws = {ILH, {
{ "in_table", sample_conv_in_table, ARG1(1,TAB), NULL, SMP_T_STR, SMP_T_BOOL },
}
/* Wrapper for action_store */
-static int action_tcp_req_store(struct tcp_rule *rule, struct proxy *px,
+static int action_tcp_req_store(struct act_rule *rule, struct proxy *px,
struct session *sess, struct stream *s)
{
- return action_store(rule->act_prm.data[0], rule->act_prm.data[1],
- (long)rule->act_prm.data[2], px, s, SMP_OPT_DIR_REQ);
+ return action_store(rule->arg.act.p[0], rule->arg.act.p[1],
+ (long)rule->arg.act.p[2], px, s, SMP_OPT_DIR_REQ);
}
/* Wrapper for action_store */
-static int action_tcp_res_store(struct tcp_rule *rule, struct proxy *px,
+static int action_tcp_res_store(struct act_rule *rule, struct proxy *px,
struct session *sess, struct stream *s)
{
- return action_store(rule->act_prm.data[0], rule->act_prm.data[1],
- (long)rule->act_prm.data[2], px, s, SMP_OPT_DIR_RES);
+ return action_store(rule->arg.act.p[0], rule->arg.act.p[1],
+ (long)rule->arg.act.p[2], px, s, SMP_OPT_DIR_RES);
}
/* Wrapper for action_store */
-static int action_http_req_store(struct http_req_rule *rule, struct proxy *px, struct stream *s)
+static int action_http_req_store(struct act_rule *rule, struct proxy *px,
+ struct session *sess, struct stream *s)
{
return action_store(rule->arg.act.p[0], rule->arg.act.p[1],
(long)rule->arg.act.p[2], px, s, SMP_OPT_DIR_REQ);
}
/* Wrapper for action_store */
-static int action_http_res_store(struct http_res_rule *rule, struct proxy *px, struct stream *s)
+static int action_http_res_store(struct act_rule *rule, struct proxy *px,
+ struct session *sess, struct stream *s)
{
return action_store(rule->arg.act.p[0], rule->arg.act.p[1],
(long)rule->arg.act.p[2], px, s, SMP_OPT_DIR_RES);
/* Wrapper for parse_vars */
static int parse_tcp_req_store(const char **args, int *arg, struct proxy *px,
- struct tcp_rule *rule, char **err)
+ struct act_rule *rule, char **err)
{
if (!parse_vars(args, arg, px, SMP_VAL_FE_REQ_CNT, err,
- (struct sample_expr **)&rule->act_prm.data[0],
- (char **)&rule->act_prm.data[1],
- (enum vars_scope *)&rule->act_prm.data[2]))
+ (struct sample_expr **)&rule->arg.act.p[0],
+ (char **)&rule->arg.act.p[1],
+ (enum vars_scope *)&rule->arg.act.p[2]))
return 0;
rule->action = TCP_ACT_CUSTOM_CONT;
rule->action_ptr = action_tcp_req_store;
/* Wrapper for parse_vars */
static int parse_tcp_res_store(const char **args, int *arg, struct proxy *px,
- struct tcp_rule *rule, char **err)
+ struct act_rule *rule, char **err)
{
if (!parse_vars(args, arg, px, SMP_VAL_BE_RES_CNT, err,
- (struct sample_expr **)&rule->act_prm.data[0],
- (char **)&rule->act_prm.data[1],
- (enum vars_scope *)&rule->act_prm.data[2]))
+ (struct sample_expr **)&rule->arg.act.p[0],
+ (char **)&rule->arg.act.p[1],
+ (enum vars_scope *)&rule->arg.act.p[2]))
return 0;
rule->action = TCP_ACT_CUSTOM_CONT;
rule->action_ptr = action_tcp_res_store;
/* Wrapper for parse_vars */
static int parse_http_req_store(const char **args, int *arg, struct proxy *px,
- struct http_req_rule *rule, char **err)
+ struct act_rule *rule, char **err)
{
if (!parse_vars(args, arg, px, SMP_VAL_FE_HRQ_HDR, err,
(struct sample_expr **)&rule->arg.act.p[0],
/* Wrapper for parse_vars */
static int parse_http_res_store(const char **args, int *arg, struct proxy *px,
- struct http_res_rule *rule, char **err)
+ struct act_rule *rule, char **err)
{
if (!parse_vars(args, arg, px, SMP_VAL_BE_HRS_HDR, err,
(struct sample_expr **)&rule->arg.act.p[0],