Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 1 | /* |
Willy Tarreau | 5ab04ec | 2011-03-20 10:32:26 +0100 | [diff] [blame] | 2 | * include/types/server.h |
| 3 | * This file defines everything related to servers. |
| 4 | * |
Willy Tarreau | f09c660 | 2012-02-13 17:12:08 +0100 | [diff] [blame] | 5 | * Copyright (C) 2000-2012 Willy Tarreau - w@1wt.eu |
Willy Tarreau | 5ab04ec | 2011-03-20 10:32:26 +0100 | [diff] [blame] | 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 | */ |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 21 | |
| 22 | #ifndef _TYPES_SERVER_H |
| 23 | #define _TYPES_SERVER_H |
| 24 | |
| 25 | #include <netinet/in.h> |
| 26 | #include <arpa/inet.h> |
| 27 | |
Emeric Brun | c6545ac | 2012-05-18 15:46:21 +0200 | [diff] [blame] | 28 | #ifdef USE_OPENSSL |
| 29 | #include <openssl/ssl.h> |
| 30 | #endif |
| 31 | |
Willy Tarreau | e3ba5f0 | 2006-06-29 18:54:54 +0200 | [diff] [blame] | 32 | #include <common/config.h> |
Willy Tarreau | 2dd0d47 | 2006-06-29 17:53:05 +0200 | [diff] [blame] | 33 | #include <common/mini-clist.h> |
Willy Tarreau | 45cb4fb | 2009-10-26 21:10:04 +0100 | [diff] [blame] | 34 | #include <eb32tree.h> |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 35 | |
Willy Tarreau | da92e2f | 2012-07-06 09:40:59 +0200 | [diff] [blame] | 36 | #include <types/connection.h> |
Krzysztof Piotr Oledzki | 052d4fd | 2009-10-04 14:52:57 +0200 | [diff] [blame] | 37 | #include <types/counters.h> |
Willy Tarreau | 7f062c4 | 2009-03-05 18:43:00 +0100 | [diff] [blame] | 38 | #include <types/freq_ctr.h> |
Willy Tarreau | 3fdb366 | 2012-11-12 00:42:33 +0100 | [diff] [blame] | 39 | #include <types/obj_type.h> |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 40 | #include <types/proxy.h> |
| 41 | #include <types/queue.h> |
| 42 | #include <types/task.h> |
Krzysztof Piotr Oledzki | 0960541 | 2009-09-23 22:09:24 +0200 | [diff] [blame] | 43 | #include <types/checks.h> |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 44 | |
| 45 | |
| 46 | /* server flags */ |
Willy Tarreau | 77074d5 | 2006-11-12 23:57:19 +0100 | [diff] [blame] | 47 | #define SRV_RUNNING 0x0001 /* the server is UP */ |
| 48 | #define SRV_BACKUP 0x0002 /* this server is a backup server */ |
| 49 | #define SRV_MAPPORTS 0x0004 /* this server uses mapped ports */ |
Willy Tarreau | ef9a360 | 2012-12-08 22:29:20 +0100 | [diff] [blame] | 50 | /* unused: 0x0008 */ |
Willy Tarreau | 77074d5 | 2006-11-12 23:57:19 +0100 | [diff] [blame] | 51 | #define SRV_CHECKED 0x0010 /* this server needs to be checked */ |
Willy Tarreau | 48494c0 | 2007-11-30 10:41:39 +0100 | [diff] [blame] | 52 | #define SRV_GOINGDOWN 0x0020 /* this server says that it's going down (404) */ |
Willy Tarreau | 9909fc1 | 2007-11-30 17:42:05 +0100 | [diff] [blame] | 53 | #define SRV_WARMINGUP 0x0040 /* this server is warming up after a failure */ |
Cyril Bonté | cd19e51 | 2010-01-31 22:34:03 +0100 | [diff] [blame] | 54 | #define SRV_MAINTAIN 0x0080 /* this server is in maintenance mode */ |
Simon Horman | 8c3d0be | 2013-11-25 10:46:40 +0900 | [diff] [blame] | 55 | #define SRV_DRAIN 0x0100 /* this server has been requested to drain its connections */ |
| 56 | /* unused: 0x0200, 0x0400 */ |
Willy Tarreau | 5ab04ec | 2011-03-20 10:32:26 +0100 | [diff] [blame] | 57 | #define SRV_SEND_PROXY 0x0800 /* this server talks the PROXY protocol */ |
Simon Horman | fa46168 | 2011-06-25 09:39:49 +0900 | [diff] [blame] | 58 | #define SRV_NON_STICK 0x1000 /* never add connections allocated to this server to a stick table */ |
Simon Horman | d60d691 | 2013-11-25 10:46:36 +0900 | [diff] [blame] | 59 | #define SRV_AGENT_CHECKED 0x2000 /* this server needs to be checked using an agent check. |
| 60 | * This is run independently of the main check whose |
| 61 | * presence is indicated by the SRV_CHECKED flag */ |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 62 | |
| 63 | /* function which act on servers need to return various errors */ |
| 64 | #define SRV_STATUS_OK 0 /* everything is OK. */ |
| 65 | #define SRV_STATUS_INTERNAL 1 /* other unrecoverable errors. */ |
| 66 | #define SRV_STATUS_NOSRV 2 /* no server is available */ |
| 67 | #define SRV_STATUS_FULL 3 /* the/all server(s) are saturated */ |
| 68 | #define SRV_STATUS_QUEUED 4 /* the/all server(s) are saturated but the connection was queued */ |
| 69 | |
Willy Tarreau | c7dd71a | 2007-11-30 08:33:21 +0100 | [diff] [blame] | 70 | /* bits for s->result used for health-checks */ |
| 71 | #define SRV_CHK_UNKNOWN 0x0000 /* initialized to this by default */ |
Willy Tarreau | d3aac70 | 2012-11-23 11:32:12 +0100 | [diff] [blame] | 72 | #define SRV_CHK_FAILED 0x0001 /* server check failed, flag has precedence over SRV_CHK_PASSED */ |
| 73 | #define SRV_CHK_PASSED 0x0002 /* server check succeeded unless FAILED is also set */ |
Willy Tarreau | c7dd71a | 2007-11-30 08:33:21 +0100 | [diff] [blame] | 74 | #define SRV_CHK_DISABLE 0x0004 /* server returned a "disable" code */ |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 75 | |
Simon Horman | cd5d7b6 | 2013-02-24 17:23:38 +0900 | [diff] [blame] | 76 | /* check flags */ |
| 77 | #define CHK_STATE_RUNNING 0x0001 /* this check is currently running */ |
Simon Horman | 671b6f0 | 2013-11-25 10:46:39 +0900 | [diff] [blame] | 78 | #define CHK_STATE_DISABLED 0x0002 /* this check is currently administratively disabled */ |
Simon Horman | cd5d7b6 | 2013-02-24 17:23:38 +0900 | [diff] [blame] | 79 | |
Willy Tarreau | b698f0f | 2007-12-02 11:01:23 +0100 | [diff] [blame] | 80 | /* various constants */ |
| 81 | #define SRV_UWGHT_RANGE 256 |
Godbach | a34bdc0 | 2013-07-22 07:44:53 +0800 | [diff] [blame] | 82 | #define SRV_UWGHT_MAX (SRV_UWGHT_RANGE) |
Willy Tarreau | b698f0f | 2007-12-02 11:01:23 +0100 | [diff] [blame] | 83 | #define SRV_EWGHT_RANGE (SRV_UWGHT_RANGE * BE_WEIGHT_SCALE) |
| 84 | #define SRV_EWGHT_MAX (SRV_UWGHT_MAX * BE_WEIGHT_SCALE) |
| 85 | |
Emeric Brun | 8967549 | 2012-10-05 13:48:26 +0200 | [diff] [blame] | 86 | #ifdef USE_OPENSSL |
| 87 | /* server ssl options */ |
| 88 | #define SRV_SSL_O_NONE 0x0000 |
Emeric Brun | 992adc9 | 2012-10-11 18:36:21 +0200 | [diff] [blame] | 89 | #define SRV_SSL_O_NO_VMASK 0x000F /* force version mask */ |
Emeric Brun | 8967549 | 2012-10-05 13:48:26 +0200 | [diff] [blame] | 90 | #define SRV_SSL_O_NO_SSLV3 0x0001 /* disable SSLv3 */ |
| 91 | #define SRV_SSL_O_NO_TLSV10 0x0002 /* disable TLSv1.0 */ |
| 92 | #define SRV_SSL_O_NO_TLSV11 0x0004 /* disable TLSv1.1 */ |
| 93 | #define SRV_SSL_O_NO_TLSV12 0x0008 /* disable TLSv1.2 */ |
| 94 | /* 0x000F reserved for 'no' protocol version options */ |
Emeric Brun | 992adc9 | 2012-10-11 18:36:21 +0200 | [diff] [blame] | 95 | #define SRV_SSL_O_USE_VMASK 0x00F0 /* force version mask */ |
| 96 | #define SRV_SSL_O_USE_SSLV3 0x0010 /* force SSLv3 */ |
| 97 | #define SRV_SSL_O_USE_TLSV10 0x0020 /* force TLSv1.0 */ |
| 98 | #define SRV_SSL_O_USE_TLSV11 0x0040 /* force TLSv1.1 */ |
| 99 | #define SRV_SSL_O_USE_TLSV12 0x0080 /* force TLSv1.2 */ |
Emeric Brun | 8694b9a | 2012-10-05 14:39:07 +0200 | [diff] [blame] | 100 | /* 0x00F0 reserved for 'force' protocol version options */ |
Emeric Brun | f9c5c47 | 2012-10-11 15:28:34 +0200 | [diff] [blame] | 101 | #define SRV_SSL_O_NO_TLS_TICKETS 0x0100 /* disable session resumption tickets */ |
Emeric Brun | 8967549 | 2012-10-05 13:48:26 +0200 | [diff] [blame] | 102 | #endif |
| 103 | |
Willy Tarreau | 6b2e11b | 2009-10-01 07:52:15 +0200 | [diff] [blame] | 104 | /* A tree occurrence is a descriptor of a place in a tree, with a pointer back |
| 105 | * to the server itself. |
| 106 | */ |
| 107 | struct server; |
| 108 | struct tree_occ { |
| 109 | struct server *server; |
| 110 | struct eb32_node node; |
| 111 | }; |
| 112 | |
Simon Horman | 6618300 | 2013-02-23 10:16:43 +0900 | [diff] [blame] | 113 | struct check { |
| 114 | struct connection *conn; /* connection state for health checks */ |
| 115 | |
| 116 | short port; /* the port to use for the health checks */ |
| 117 | struct buffer *bi, *bo; /* input and output buffers to send/recv check */ |
| 118 | struct task *task; /* the task associated to the health check processing, NULL if disabled */ |
| 119 | struct timeval start; /* last health check start time */ |
| 120 | long duration; /* time in ms took to finish last health check */ |
| 121 | short status, code; /* check result, check code */ |
| 122 | char desc[HCHK_DESC_LEN]; /* health check descritpion */ |
| 123 | int use_ssl; /* use SSL for health checks */ |
| 124 | int send_proxy; /* send a PROXY protocol header with checks */ |
Baptiste Assmann | 5ecb77f | 2013-10-06 23:24:13 +0200 | [diff] [blame] | 125 | struct tcpcheck_rule *current_step; /* current step when using tcpcheck */ |
Simon Horman | 6618300 | 2013-02-23 10:16:43 +0900 | [diff] [blame] | 126 | int inter, fastinter, downinter; /* checks: time in milliseconds */ |
Simon Horman | 28b5ffc | 2013-02-24 07:25:29 +0900 | [diff] [blame] | 127 | int result; /* health-check result : SRV_CHK_* */ |
Simon Horman | cd5d7b6 | 2013-02-24 17:23:38 +0900 | [diff] [blame] | 128 | int state; /* health-check result : CHK_* */ |
Simon Horman | 58c3297 | 2013-11-25 10:46:38 +0900 | [diff] [blame] | 129 | int health; /* 0 to rise-1 = bad; |
| 130 | * rise to rise+fall-1 = good */ |
| 131 | int rise, fall; /* time in iterations */ |
Simon Horman | 4a74143 | 2013-02-23 15:35:38 +0900 | [diff] [blame] | 132 | int type; /* Check type, one of PR_O2_*_CHK */ |
Simon Horman | 6618300 | 2013-02-23 10:16:43 +0900 | [diff] [blame] | 133 | struct server *server; /* back-pointer to server */ |
| 134 | }; |
| 135 | |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 136 | struct server { |
Willy Tarreau | 3fdb366 | 2012-11-12 00:42:33 +0100 | [diff] [blame] | 137 | enum obj_type obj_type; /* object type == OBJ_TYPE_SERVER */ |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 138 | struct server *next; |
| 139 | int state; /* server state (SRV_*) */ |
Willy Tarreau | b625a08 | 2007-11-26 01:15:43 +0100 | [diff] [blame] | 140 | int prev_state; /* server state before last change (SRV_*) */ |
Krzysztof Piotr Oledzki | 0960541 | 2009-09-23 22:09:24 +0200 | [diff] [blame] | 141 | int cklen; /* the len of the cookie, to speed up checks */ |
Willy Tarreau | 21d2af3 | 2008-02-14 20:25:24 +0100 | [diff] [blame] | 142 | int rdr_len; /* the length of the redirection prefix */ |
Willy Tarreau | 91b6f32 | 2007-03-25 21:03:01 +0200 | [diff] [blame] | 143 | char *cookie; /* the id set in the cookie */ |
Willy Tarreau | 21d2af3 | 2008-02-14 20:25:24 +0100 | [diff] [blame] | 144 | char *rdr_pfx; /* the redirection prefix */ |
Willy Tarreau | 91b6f32 | 2007-03-25 21:03:01 +0200 | [diff] [blame] | 145 | |
| 146 | struct proxy *proxy; /* the proxy this server belongs to */ |
Willy Tarreau | 7c669d7 | 2008-06-20 15:04:11 +0200 | [diff] [blame] | 147 | int served; /* # of active sessions currently being served (ie not pending) */ |
Willy Tarreau | ac68c5d | 2009-10-04 23:12:44 +0200 | [diff] [blame] | 148 | int cur_sess; /* number of currently active sessions (including syn_sent) */ |
Willy Tarreau | 91b6f32 | 2007-03-25 21:03:01 +0200 | [diff] [blame] | 149 | unsigned maxconn, minconn; /* max # of active sessions (0 = unlimited), min# for dynamic limit. */ |
Willy Tarreau | ac68c5d | 2009-10-04 23:12:44 +0200 | [diff] [blame] | 150 | int nbpend; /* number of pending connections */ |
Elijah Epifanov | acafc5f | 2007-10-25 20:15:38 +0200 | [diff] [blame] | 151 | int maxqueue; /* maximum number of pending connections allowed */ |
Willy Tarreau | 7b81563 | 2011-10-21 18:51:57 +0200 | [diff] [blame] | 152 | struct freq_ctr sess_per_sec; /* sessions per second on this server */ |
Willy Tarreau | ac68c5d | 2009-10-04 23:12:44 +0200 | [diff] [blame] | 153 | struct srvcounters counters; /* statistics counters */ |
| 154 | |
Willy Tarreau | 91b6f32 | 2007-03-25 21:03:01 +0200 | [diff] [blame] | 155 | struct list pendconns; /* pending connections */ |
Simon Horman | af51495 | 2011-06-21 14:34:57 +0900 | [diff] [blame] | 156 | struct list actconns; /* active connections */ |
Willy Tarreau | 2e99390 | 2011-10-31 11:53:20 +0100 | [diff] [blame] | 157 | struct task *warmup; /* the task dedicated to the warmup when slowstart is set */ |
Willy Tarreau | 91b6f32 | 2007-03-25 21:03:01 +0200 | [diff] [blame] | 158 | |
Willy Tarreau | ef9a360 | 2012-12-08 22:29:20 +0100 | [diff] [blame] | 159 | struct conn_src conn_src; /* connection source settings */ |
Willy Tarreau | 91b6f32 | 2007-03-25 21:03:01 +0200 | [diff] [blame] | 160 | |
Willy Tarreau | 4426770 | 2011-10-28 15:35:33 +0200 | [diff] [blame] | 161 | struct server *tracknext, *track; /* next server in a tracking list, tracked server */ |
Krzysztof Piotr Oledzki | c8b16fc | 2008-02-18 01:26:35 +0100 | [diff] [blame] | 162 | char *trackit; /* temporary variable to make assignment deferrable */ |
Krzysztof Piotr Oledzki | 97f07b8 | 2009-12-15 22:31:24 +0100 | [diff] [blame] | 163 | int consecutive_errors; /* current number of consecutive errors */ |
Krzysztof Piotr Oledzki | 97f07b8 | 2009-12-15 22:31:24 +0100 | [diff] [blame] | 164 | int consecutive_errors_limit; /* number of consecutive errors that triggers an event */ |
| 165 | short observe, onerror; /* observing mode: one of HANA_OBS_*; what to do on error: on of ANA_ONERR_* */ |
Justin Karneges | eb2c24a | 2012-05-24 15:28:52 -0700 | [diff] [blame] | 166 | short onmarkeddown; /* what to do when marked down: one of HANA_ONMARKEDDOWN_* */ |
| 167 | short onmarkedup; /* what to do when marked up: one of HANA_ONMARKEDUP_* */ |
Willy Tarreau | 9909fc1 | 2007-11-30 17:42:05 +0100 | [diff] [blame] | 168 | int slowstart; /* slowstart time in seconds (ms in the conf) */ |
Willy Tarreau | 91b6f32 | 2007-03-25 21:03:01 +0200 | [diff] [blame] | 169 | |
| 170 | char *id; /* just for identification */ |
Willy Tarreau | 975c50b | 2009-10-10 19:34:06 +0200 | [diff] [blame] | 171 | unsigned iweight,uweight, eweight; /* initial weight, user-specified weight, and effective weight */ |
Willy Tarreau | 417fae0 | 2007-03-25 21:16:40 +0200 | [diff] [blame] | 172 | unsigned wscore; /* weight score, used during srv map computation */ |
Willy Tarreau | b625a08 | 2007-11-26 01:15:43 +0100 | [diff] [blame] | 173 | unsigned prev_eweight; /* eweight before last change */ |
| 174 | unsigned rweight; /* remainer of weight in the current LB tree */ |
| 175 | unsigned npos, lpos; /* next and last positions in the LB tree */ |
| 176 | struct eb32_node lb_node; /* node used for tree-based load balancing */ |
| 177 | struct eb_root *lb_tree; /* we want to know in what tree the server is */ |
| 178 | struct server *next_full; /* next server in the temporary full list */ |
Willy Tarreau | 6b2e11b | 2009-10-01 07:52:15 +0200 | [diff] [blame] | 179 | unsigned lb_nodes_tot; /* number of allocated lb_nodes (C-HASH) */ |
| 180 | unsigned lb_nodes_now; /* number of lb_nodes placed in the tree (C-HASH) */ |
| 181 | struct tree_occ *lb_nodes; /* lb_nodes_tot * struct tree_occ */ |
Willy Tarreau | 91b6f32 | 2007-03-25 21:03:01 +0200 | [diff] [blame] | 182 | |
Willy Tarreau | 7b81563 | 2011-10-21 18:51:57 +0200 | [diff] [blame] | 183 | /* warning, these structs are huge, keep them at the bottom */ |
| 184 | struct sockaddr_storage addr; /* the address to connect to */ |
Willy Tarreau | 26d8c59 | 2012-05-07 18:12:14 +0200 | [diff] [blame] | 185 | struct protocol *proto; /* server address protocol */ |
Willy Tarreau | f7bc57c | 2012-10-03 00:19:48 +0200 | [diff] [blame] | 186 | struct xprt_ops *xprt; /* transport-layer operations */ |
Krzysztof Oledzki | 8513094 | 2007-10-22 16:21:10 +0200 | [diff] [blame] | 187 | unsigned down_time; /* total time the server was down */ |
| 188 | time_t last_change; /* last time, when the state was changed */ |
| 189 | |
Willy Tarreau | f09c660 | 2012-02-13 17:12:08 +0100 | [diff] [blame] | 190 | int puid; /* proxy-unique server ID, used for SNMP, and "first" LB algo */ |
Krzysztof Piotr Oledzki | 052d4fd | 2009-10-04 14:52:57 +0200 | [diff] [blame] | 191 | |
Simon Horman | 6618300 | 2013-02-23 10:16:43 +0900 | [diff] [blame] | 192 | struct { /* configuration used by health-check and agent-check */ |
Willy Tarreau | f4288ee | 2012-09-28 18:13:10 +0200 | [diff] [blame] | 193 | struct protocol *proto; /* server address protocol for health checks */ |
| 194 | struct xprt_ops *xprt; /* transport layer operations for health checks */ |
Willy Tarreau | 5b3a202 | 2012-09-28 15:01:02 +0200 | [diff] [blame] | 195 | struct sockaddr_storage addr; /* the address to check, if different from <addr> */ |
Simon Horman | 6618300 | 2013-02-23 10:16:43 +0900 | [diff] [blame] | 196 | } check_common; |
| 197 | |
| 198 | struct check check; /* health-check specific configuration */ |
Simon Horman | d60d691 | 2013-11-25 10:46:36 +0900 | [diff] [blame] | 199 | struct check agent; /* agent specific configuration */ |
Nick Chalk | 57b1bf7 | 2010-03-16 15:50:46 +0000 | [diff] [blame] | 200 | |
Emeric Brun | c6545ac | 2012-05-18 15:46:21 +0200 | [diff] [blame] | 201 | #ifdef USE_OPENSSL |
Emeric Brun | 01f8e2f | 2012-05-18 16:02:00 +0200 | [diff] [blame] | 202 | int use_ssl; /* ssl enabled */ |
Emeric Brun | c6545ac | 2012-05-18 15:46:21 +0200 | [diff] [blame] | 203 | struct { |
| 204 | SSL_CTX *ctx; |
| 205 | SSL_SESSION *reused_sess; |
Willy Tarreau | d7aacbf | 2012-09-03 23:34:19 +0200 | [diff] [blame] | 206 | char *ciphers; /* cipher suite to use if non-null */ |
Emeric Brun | 8967549 | 2012-10-05 13:48:26 +0200 | [diff] [blame] | 207 | int options; /* ssl options */ |
Emeric Brun | ef42d92 | 2012-10-11 16:11:36 +0200 | [diff] [blame] | 208 | int verify; /* verify method (set of SSL_VERIFY_* flags) */ |
Evan Broder | be55431 | 2013-06-27 00:05:25 -0700 | [diff] [blame] | 209 | char *verify_host; /* hostname of certificate must match this host */ |
Emeric Brun | ef42d92 | 2012-10-11 16:11:36 +0200 | [diff] [blame] | 210 | char *ca_file; /* CAfile to use on verify */ |
| 211 | char *crl_file; /* CRLfile to use on verify */ |
Emeric Brun | a7aa309 | 2012-10-26 12:58:00 +0200 | [diff] [blame] | 212 | char *client_crt; /* client certificate to send */ |
Emeric Brun | c6545ac | 2012-05-18 15:46:21 +0200 | [diff] [blame] | 213 | } ssl_ctx; |
| 214 | #endif |
Willy Tarreau | 90a570f | 2009-10-04 20:54:54 +0200 | [diff] [blame] | 215 | struct { |
| 216 | const char *file; /* file where the section appears */ |
| 217 | int line; /* line where the section appears */ |
Willy Tarreau | 53fb4ae | 2009-10-04 23:04:08 +0200 | [diff] [blame] | 218 | struct eb32_node id; /* place in the tree of used IDs */ |
Willy Tarreau | 90a570f | 2009-10-04 20:54:54 +0200 | [diff] [blame] | 219 | } conf; /* config information */ |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 220 | }; |
| 221 | |
Willy Tarreau | 21faa91 | 2012-10-10 08:27:36 +0200 | [diff] [blame] | 222 | /* Descriptor for a "server" keyword. The ->parse() function returns 0 in case of |
| 223 | * success, or a combination of ERR_* flags if an error is encountered. The |
| 224 | * function pointer can be NULL if not implemented. The function also has an |
| 225 | * access to the current "server" config line. The ->skip value tells the parser |
| 226 | * how many words have to be skipped after the keyword. If the function needs to |
| 227 | * parse more keywords, it needs to update cur_arg. |
| 228 | */ |
| 229 | struct srv_kw { |
| 230 | const char *kw; |
| 231 | int (*parse)(char **args, int *cur_arg, struct proxy *px, struct server *srv, char **err); |
| 232 | int skip; /* nb min of args to skip, for use when kw is not handled */ |
| 233 | int default_ok; /* non-zero if kw is supported in default-server section */ |
| 234 | }; |
| 235 | |
| 236 | /* |
| 237 | * A keyword list. It is a NULL-terminated array of keywords. It embeds a |
| 238 | * struct list in order to be linked to other lists, allowing it to easily |
| 239 | * be declared where it is needed, and linked without duplicating data nor |
| 240 | * allocating memory. It is also possible to indicate a scope for the keywords. |
| 241 | */ |
| 242 | struct srv_kw_list { |
| 243 | const char *scope; |
| 244 | struct list list; |
| 245 | struct srv_kw kw[VAR_ARRAY]; |
| 246 | }; |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 247 | |
| 248 | #endif /* _TYPES_SERVER_H */ |
| 249 | |
| 250 | /* |
| 251 | * Local variables: |
| 252 | * c-indent-level: 8 |
| 253 | * c-basic-offset: 8 |
| 254 | * End: |
| 255 | */ |