blob: 84454e41e3feb3a62f76f9672426950d15407938 [file] [log] [blame]
Thierry FOURNIERa28a9422015-08-04 19:35:46 +02001/*
2 * include/types/action.h
3 * This file contains TCP protocol definitions.
4 *
5 * Copyright (C) 2000-2010 Willy Tarreau - w@1wt.eu
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation, version 2.1
10 * exclusively.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22#ifndef _TYPES_ACTION_H
23#define _TYPES_ACTION_H
24
25#include <types/stick_table.h>
26
Thierry FOURNIERa28a9422015-08-04 19:35:46 +020027struct act_rule {
28 struct list list;
29 struct acl_cond *cond; /* acl condition to meet */
30 unsigned int action; /* HTTP_REQ_* */
31 short deny_status; /* HTTP status to return to user when denying */
32 int (*action_ptr)(struct act_rule *rule, struct proxy *px,
33 struct session *sess, struct stream *s); /* ptr to custom action */
34 union {
35 struct {
36 char *realm;
37 } auth; /* arg used by "auth" */
38 struct {
39 char *name; /* header name */
40 int name_len; /* header name's length */
41 struct list fmt; /* log-format compatible expression */
42 struct my_regex re; /* used by replace-header and replace-value */
43 } hdr_add; /* args used by "add-header" and "set-header" */
44 struct redirect_rule *redir; /* redirect rule or "http-request redirect" */
45 int nice; /* nice value for HTTP_REQ_ACT_SET_NICE */
46 int loglevel; /* log-level value for HTTP_REQ_ACT_SET_LOGL */
47 int tos; /* tos value for HTTP_REQ_ACT_SET_TOS */
48 int mark; /* nfmark value for HTTP_REQ_ACT_SET_MARK */
Thierry FOURNIERa28a9422015-08-04 19:35:46 +020049 struct {
50 char *ref; /* MAP or ACL file name to update */
51 struct list key; /* pattern to retrieve MAP or ACL key */
52 struct list value; /* pattern to retrieve MAP value */
53 } map;
Thierry FOURNIERa002dc92015-07-31 08:50:51 +020054 struct sample_expr *expr;
Thierry FOURNIER8855a922015-07-31 08:54:25 +020055 struct {
56 struct list logfmt;
57 int action;
58 } http;
Thierry FOURNIER32b15002015-07-31 08:56:16 +020059 struct {
Thierry FOURNIERd0d65ae2015-08-04 08:21:12 +020060 struct sample_expr *expr; /* expression used as the key */
61 struct cap_hdr *hdr; /* the capture storage */
Thierry FOURNIER32b15002015-07-31 08:56:16 +020062 } cap;
Thierry FOURNIERe2097972015-07-31 08:56:35 +020063 struct {
64 struct sample_expr *expr;
65 int idx;
66 } capid;
Thierry FOURNIER231ef1d2015-07-30 19:03:55 +020067 struct hlua_rule *hlua_rule;
Thierry FOURNIERa28a9422015-08-04 19:35:46 +020068 struct {
Thierry FOURNIERf8c1dce2015-07-30 19:12:50 +020069 struct sample_expr *expr;
70 const char *name;
71 enum vars_scope scope;
72 } vars;
Thierry FOURNIER5ec63e02015-08-04 09:09:48 +020073 struct track_ctr_prm trk_ctr;
Thierry FOURNIERf8c1dce2015-07-30 19:12:50 +020074 struct {
Thierry FOURNIERa28a9422015-08-04 19:35:46 +020075 void *p[4];
76 } act; /* generic pointers to be used by custom actions */
77 } arg; /* arguments used by some actions */
Thierry FOURNIERa28a9422015-08-04 19:35:46 +020078};
79
80#endif /* _TYPES_ACTION_H */