2
2
* include/types/global.h
5
* Copyright (C) 2000-2010 Willy Tarreau - w@1wt.eu
5
* Copyright (C) 2000-2012 Willy Tarreau - w@1wt.eu
7
7
* This library is free software; you can redistribute it and/or
8
8
* modify it under the terms of the GNU Lesser General Public
25
25
#include <netinet/in.h>
27
27
#include <common/config.h>
28
#include <types/log.h>
29
#include <types/protocols.h>
28
#include <types/freq_ctr.h>
29
#include <types/listener.h>
30
30
#include <types/proxy.h>
31
31
#include <types/task.h>
34
#define UNIX_MAX_PATH 108
33
37
/* modes of operation (global.mode) */
34
38
#define MODE_DEBUG 0x01
35
39
#define MODE_DAEMON 0x02
38
42
#define MODE_VERBOSE 0x10
39
43
#define MODE_STARTING 0x20
40
44
#define MODE_FOREGROUND 0x40
45
#define MODE_SYSTEMD 0x80
42
47
/* list of last checks to perform, depending on config options */
43
48
#define LSTCHK_CAP_BIND 0x00000001 /* check that we can bind to any port */
50
55
#define GTUNE_USE_POLL (1<<1)
51
56
#define GTUNE_USE_EPOLL (1<<2)
52
57
#define GTUNE_USE_KQUEUE (1<<3)
53
#define GTUNE_USE_SEPOLL (1<<4)
54
58
/* platform-specific options */
55
#define GTUNE_USE_SPLICE (1<<5)
59
#define GTUNE_USE_SPLICE (1<<4)
60
#define GTUNE_USE_GAI (1<<5)
57
62
/* Access level for a stats socket */
58
63
#define ACCESS_LVL_NONE 0
60
65
#define ACCESS_LVL_OPER 2
61
66
#define ACCESS_LVL_ADMIN 3
68
/* SSL server verify mode */
70
SSL_SERVER_VERIFY_NONE = 0,
71
SSL_SERVER_VERIFY_REQUIRED = 1,
63
74
/* FIXME : this will have to be redefined correctly */
77
char *crt_base; /* base directory path for certificates */
78
char *ca_base; /* base directory path for CAs and CRLs */
83
int maxconn, hardmaxconn;
86
char *listen_default_ciphers;
87
char *connect_default_ciphers;
89
unsigned int ssl_server_verify; /* default verify mode on servers side */
90
struct freq_ctr conn_per_sec;
91
struct freq_ctr sess_per_sec;
92
struct freq_ctr ssl_per_sec;
93
struct freq_ctr ssl_fe_keys_per_sec;
94
struct freq_ctr ssl_be_keys_per_sec;
95
struct freq_ctr comp_bps_in; /* bytes per second, before http compression */
96
struct freq_ctr comp_bps_out; /* bytes per second, after http compression */
100
int ssl_fe_keys_max, ssl_be_keys_max;
101
unsigned int shctx_lookups, shctx_misses;
102
int comp_rate_lim; /* HTTP compression rate limit */
69
103
int maxpipes; /* max # of pipes */
70
104
int maxsock; /* max # of sockets */
71
105
int rlimit_nofile; /* default ulimit-n value : 0=unset */
72
106
int rlimit_memmax; /* default ulimit-d in megs value : 0=unset */
107
long maxzlibmem; /* max RAM for zlib in bytes */
109
unsigned int req_count; /* request counter (HTTP or TCP session) for logs and unique_id */
75
111
int spread_checks;
112
int max_spread_checks;
78
115
char *node, *desc; /* node name & description */
79
116
char *log_tag; /* name for syslog */
83
struct logsrv logsrv1, logsrv2;
84
118
char *log_send_hostname; /* set hostname in syslog header */
86
120
int maxpollevents; /* max number of poll events at once */
94
128
int server_sndbuf; /* set server sndbuf to this value if not null */
95
129
int server_rcvbuf; /* set server rcvbuf to this value if not null */
96
130
int chksize; /* check buffer size in bytes, defaults to BUFSIZE */
131
int pipesize; /* pipe size in bytes, system defaults if zero */
132
int max_http_hdr; /* max number of HTTP headers, use MAX_HTTP_HDR if zero */
133
int cookie_len; /* max length of cookie captures */
135
int sslcachesize; /* SSL cache size in session, defaults to 20000 */
136
int sslprivatecache; /* Force to use a private session cache even if nbproc > 1 */
137
unsigned int ssllifetime; /* SSL session lifetime in seconds */
138
unsigned int ssl_max_record; /* SSL max record size */
139
unsigned int ssl_default_dh_param; /* SSL maximum DH parameter size */
142
int zlibmemlevel; /* zlib memlevel */
143
int zlibwindowsize; /* zlib window size */
145
int comp_maxlevel; /* max HTTP compression level */
146
unsigned short idle_timer; /* how long before an empty buffer is considered idle (ms) */
98
struct listener stats_sock; /* unix socket listener for statistics */
149
char *prefix; /* path prefix of unix bind socket */
150
struct { /* UNIX socket permissions */
151
uid_t uid; /* -1 to leave unchanged */
152
gid_t gid; /* -1 to leave unchanged */
153
mode_t mode; /* 0 to leave unchanged */
156
#ifdef USE_CPU_AFFINITY
157
unsigned long cpu_map[LONGBITS]; /* list of CPU masks for the 32/64 first processes */
99
159
struct proxy *stats_fe; /* the frontend holding the stats settings */
103
163
extern int pid; /* current process id */
104
164
extern int relative_pid; /* process id starting at 1 */
105
165
extern int actconn; /* # of active sessions */
106
extern int listeners;
166
extern int listeners;
167
extern int jobs; /* # of active jobs */
168
extern struct chunk trash;
109
169
extern char *swap_buffer;
110
170
extern int nb_oldpids; /* contains the number of old pids found */
111
171
extern const int zero;
113
173
extern const struct linger nolinger;
114
174
extern int stopping; /* non zero means stopping in progress */
115
175
extern char hostname[MAX_HOSTNAME_LEN];
176
extern char localpeer[MAX_HOSTNAME_LEN];
177
extern struct list global_listener_queue; /* list of the temporarily limited listeners */
178
extern struct task *global_listener_queue_task;
179
extern unsigned int warned; /* bitfield of a few warnings to emit just once */
181
/* bit values to go with "warned" above */
182
#define WARN_BLOCK_DEPRECATED 0x00000001
183
#define WARN_REQSETBE_DEPRECATED 0x00000002
184
#define WARN_REDISPATCH_DEPRECATED 0x00000004
185
#define WARN_CLITO_DEPRECATED 0x00000008
186
#define WARN_SRVTO_DEPRECATED 0x00000010
187
#define WARN_CONTO_DEPRECATED 0x00000020
189
/* to be used with warned and WARN_* */
190
static inline int already_warned(unsigned int warning)
192
if (warned & warning)
117
198
#endif /* _TYPES_GLOBAL_H */