2
* include/types/global.h
5
* Copyright (C) 2000-2010 Willy Tarreau - w@1wt.eu
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
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.
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
22
#ifndef _TYPES_GLOBAL_H
23
#define _TYPES_GLOBAL_H
25
#include <netinet/in.h>
27
#include <common/config.h>
28
#include <types/log.h>
29
#include <types/protocols.h>
30
#include <types/proxy.h>
31
#include <types/task.h>
33
/* modes of operation (global.mode) */
34
#define MODE_DEBUG 0x01
35
#define MODE_DAEMON 0x02
36
#define MODE_QUIET 0x04
37
#define MODE_CHECK 0x08
38
#define MODE_VERBOSE 0x10
39
#define MODE_STARTING 0x20
40
#define MODE_FOREGROUND 0x40
42
/* list of last checks to perform, depending on config options */
43
#define LSTCHK_CAP_BIND 0x00000001 /* check that we can bind to any port */
44
#define LSTCHK_CTTPROXY 0x00000002 /* check that tproxy is enabled */
45
#define LSTCHK_NETADM 0x00000004 /* check that we have CAP_NET_ADMIN */
47
/* Global tuning options */
48
/* available polling mechanisms */
49
#define GTUNE_USE_SELECT (1<<0)
50
#define GTUNE_USE_POLL (1<<1)
51
#define GTUNE_USE_EPOLL (1<<2)
52
#define GTUNE_USE_KQUEUE (1<<3)
53
#define GTUNE_USE_SEPOLL (1<<4)
54
/* platform-specific options */
55
#define GTUNE_USE_SPLICE (1<<5)
57
/* Access level for a stats socket */
58
#define ACCESS_LVL_NONE 0
59
#define ACCESS_LVL_USER 1
60
#define ACCESS_LVL_OPER 2
61
#define ACCESS_LVL_ADMIN 3
63
/* FIXME : this will have to be redefined correctly */
69
int maxpipes; /* max # of pipes */
70
int maxsock; /* max # of sockets */
71
int rlimit_nofile; /* default ulimit-n value : 0=unset */
72
int rlimit_memmax; /* default ulimit-d in megs value : 0=unset */
78
char *node, *desc; /* node name & description */
79
char *log_tag; /* name for syslog */
83
struct logsrv logsrv1, logsrv2;
84
char *log_send_hostname; /* set hostname in syslog header */
86
int maxpollevents; /* max number of poll events at once */
87
int maxaccept; /* max number of consecutive accept() */
88
int options; /* various tuning options */
89
int recv_enough; /* how many input bytes at once are "enough" */
90
int bufsize; /* buffer size in bytes, defaults to BUFSIZE */
91
int maxrewrite; /* buffer max rewrite size in bytes, defaults to MAXREWRITE */
92
int client_sndbuf; /* set client sndbuf to this value if not null */
93
int client_rcvbuf; /* set client rcvbuf to this value if not null */
94
int server_sndbuf; /* set server sndbuf to this value if not null */
95
int server_rcvbuf; /* set server rcvbuf to this value if not null */
96
int chksize; /* check buffer size in bytes, defaults to BUFSIZE */
98
struct listener stats_sock; /* unix socket listener for statistics */
99
struct proxy *stats_fe; /* the frontend holding the stats settings */
102
extern struct global global;
103
extern int pid; /* current process id */
104
extern int relative_pid; /* process id starting at 1 */
105
extern int actconn; /* # of active sessions */
106
extern int listeners;
107
extern char trash[BUFSIZE];
108
extern char *swap_buffer;
109
extern int nb_oldpids; /* contains the number of old pids found */
110
extern const int zero;
111
extern const int one;
112
extern const struct linger nolinger;
113
extern int stopping; /* non zero means stopping in progress */
114
extern char hostname[MAX_HOSTNAME_LEN];
116
#endif /* _TYPES_GLOBAL_H */