Thierry FOURNIER | a28a942 | 2015-08-04 19:35:46 +0200 | [diff] [blame] | 1 | /* |
| 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 | |
| 27 | struct capture_prm { |
| 28 | struct sample_expr *expr; /* expression used as the key */ |
| 29 | struct cap_hdr *hdr; /* the capture storage */ |
| 30 | }; |
| 31 | |
| 32 | struct 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 FOURNIER | a28a942 | 2015-08-04 19:35:46 +0200 | [diff] [blame] | 54 | 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; |
| 59 | struct { |
| 60 | void *p[4]; |
| 61 | } act; /* generic pointers to be used by custom actions */ |
| 62 | } arg; /* arguments used by some actions */ |
| 63 | |
| 64 | union { |
| 65 | struct capture_prm cap; |
| 66 | struct track_ctr_prm trk_ctr; |
| 67 | } act_prm; |
| 68 | }; |
| 69 | |
| 70 | #endif /* _TYPES_ACTION_H */ |