blob: 570710b1be38e9f17147878da95e657d8882c7b1 [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
27struct capture_prm {
28 struct sample_expr *expr; /* expression used as the key */
29 struct cap_hdr *hdr; /* the capture storage */
30};
31
32struct act_rule {
33 struct list list;
34 struct acl_cond *cond; /* acl condition to meet */
35 unsigned int action; /* HTTP_REQ_* */
36 short deny_status; /* HTTP status to return to user when denying */
37 int (*action_ptr)(struct act_rule *rule, struct proxy *px,
38 struct session *sess, struct stream *s); /* ptr to custom action */
39 union {
40 struct {
41 char *realm;
42 } auth; /* arg used by "auth" */
43 struct {
44 char *name; /* header name */
45 int name_len; /* header name's length */
46 struct list fmt; /* log-format compatible expression */
47 struct my_regex re; /* used by replace-header and replace-value */
48 } hdr_add; /* args used by "add-header" and "set-header" */
49 struct redirect_rule *redir; /* redirect rule or "http-request redirect" */
50 int nice; /* nice value for HTTP_REQ_ACT_SET_NICE */
51 int loglevel; /* log-level value for HTTP_REQ_ACT_SET_LOGL */
52 int tos; /* tos value for HTTP_REQ_ACT_SET_TOS */
53 int mark; /* nfmark value for HTTP_REQ_ACT_SET_MARK */
Thierry FOURNIERa28a9422015-08-04 19:35:46 +020054 struct {
55 char *ref; /* MAP or ACL file name to update */
56 struct list key; /* pattern to retrieve MAP or ACL key */
57 struct list value; /* pattern to retrieve MAP value */
58 } map;
Thierry FOURNIERa002dc92015-07-31 08:50:51 +020059 struct sample_expr *expr;
Thierry FOURNIER8855a922015-07-31 08:54:25 +020060 struct {
61 struct list logfmt;
62 int action;
63 } http;
Thierry FOURNIER32b15002015-07-31 08:56:16 +020064 struct {
65 struct sample_expr *expr;
66 struct cap_hdr *hdr;
67 } cap;
Thierry FOURNIERe2097972015-07-31 08:56:35 +020068 struct {
69 struct sample_expr *expr;
70 int idx;
71 } capid;
Thierry FOURNIER231ef1d2015-07-30 19:03:55 +020072 struct hlua_rule *hlua_rule;
Thierry FOURNIERa28a9422015-08-04 19:35:46 +020073 struct {
Thierry FOURNIERf8c1dce2015-07-30 19:12:50 +020074 struct sample_expr *expr;
75 const char *name;
76 enum vars_scope scope;
77 } vars;
Thierry FOURNIER5ec63e02015-08-04 09:09:48 +020078 struct track_ctr_prm trk_ctr;
Thierry FOURNIERf8c1dce2015-07-30 19:12:50 +020079 struct {
Thierry FOURNIERa28a9422015-08-04 19:35:46 +020080 void *p[4];
81 } act; /* generic pointers to be used by custom actions */
82 } arg; /* arguments used by some actions */
83
84 union {
85 struct capture_prm cap;
Thierry FOURNIERa28a9422015-08-04 19:35:46 +020086 } act_prm;
87};
88
89#endif /* _TYPES_ACTION_H */