~ubuntu-branches/debian/stretch/haproxy/stretch

« back to all changes in this revision

Viewing changes to include/types/global.h

  • Committer: Package Import Robot
  • Author(s): Apollon Oikonomopoulos
  • Date: 2014-06-20 11:05:17 UTC
  • mfrom: (1.1.15) (15.1.12 experimental)
  • Revision ID: package-import@ubuntu.com-20140620110517-u6q5p9kyy2f3ozw9
Tags: 1.5.0-1
* New upstream stable series. Notable changes since the 1.4 series:
  + Native SSL support on both sides with SNI/NPN/ALPN and OCSP stapling.
  + IPv6 and UNIX sockets are supported everywhere
  + End-to-end HTTP keep-alive for better support of NTLM and improved
    efficiency in static farms
  + HTTP/1.1 response compression (deflate, gzip) to save bandwidth
  + PROXY protocol versions 1 and 2 on both sides
  + Data sampling on everything in request or response, including payload
  + ACLs can use any matching method with any input sample
  + Maps and dynamic ACLs updatable from the CLI
  + Stick-tables support counters to track activity on any input sample
  + Custom format for logs, unique-id, header rewriting, and redirects
  + Improved health checks (SSL, scripted TCP, check agent, ...)
  + Much more scalable configuration supports hundreds of thousands of
    backends and certificates without sweating

* Upload to unstable, merge all 1.5 work from experimental. Most important
  packaging changes since 1.4.25-1 include:
  + systemd support.
  + A more sane default config file.
  + Zero-downtime upgrades between 1.5 releases by gracefully reloading
    HAProxy during upgrades.
  + HTML documentation shipped in the haproxy-doc package.
  + kqueue support for kfreebsd.

* Packaging changes since 1.5~dev26-2:
  + Drop patches merged upstream:
    o Fix-reference-location-in-manpage.patch
    o 0001-BUILD-stats-workaround-stupid-and-bogus-Werror-forma.patch
  + d/watch: look for stable 1.5 releases
  + systemd: respect CONFIG and EXTRAOPTS when specified in
    /etc/default/haproxy.
  + initscript: test the configuration before start or reload.
  + initscript: remove the ENABLED flag and logic.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 * include/types/global.h
3
3
 * Global variables.
4
4
 *
5
 
 * Copyright (C) 2000-2010 Willy Tarreau - w@1wt.eu
 
5
 * Copyright (C) 2000-2012 Willy Tarreau - w@1wt.eu
6
6
 *
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>
26
26
 
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>
32
32
 
 
33
#ifndef UNIX_MAX_PATH
 
34
#define UNIX_MAX_PATH 108
 
35
#endif
 
36
 
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
41
46
 
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)
56
61
 
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
62
67
 
 
68
/* SSL server verify mode */
 
69
enum {
 
70
        SSL_SERVER_VERIFY_NONE = 0,
 
71
        SSL_SERVER_VERIFY_REQUIRED = 1,
 
72
};
 
73
 
63
74
/* FIXME : this will have to be redefined correctly */
64
75
struct global {
 
76
#ifdef USE_OPENSSL
 
77
        char *crt_base;             /* base directory path for certificates */
 
78
        char *ca_base;              /* base directory path for CAs and CRLs */
 
79
#endif
65
80
        int uid;
66
81
        int gid;
67
82
        int nbproc;
68
 
        int maxconn;
 
83
        int maxconn, hardmaxconn;
 
84
#ifdef USE_OPENSSL
 
85
        int maxsslconn;
 
86
        char *listen_default_ciphers;
 
87
        char *connect_default_ciphers;
 
88
#endif
 
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 */
 
97
        int cps_lim, cps_max;
 
98
        int sps_lim, sps_max;
 
99
        int ssl_lim, ssl_max;
 
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 */
73
108
        int mode;
 
109
        unsigned int req_count; /* request counter (HTTP or TCP session) for logs and unique_id */
74
110
        int last_checks;
75
111
        int spread_checks;
 
112
        int max_spread_checks;
76
113
        char *chroot;
77
114
        char *pidfile;
78
115
        char *node, *desc;              /* node name & description */
79
116
        char *log_tag;                  /* name for syslog */
80
 
        int logfac1, logfac2;
81
 
        int loglev1, loglev2;
82
 
        int minlvl1, minlvl2;
83
 
        struct logsrv logsrv1, logsrv2;
 
117
        struct list logsrvs;
84
118
        char *log_send_hostname;   /* set hostname in syslog header */
85
119
        struct {
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 */
 
134
#ifdef USE_OPENSSL
 
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 */
 
140
#endif
 
141
#ifdef USE_ZLIB
 
142
                int zlibmemlevel;    /* zlib memlevel */
 
143
                int zlibwindowsize;  /* zlib window size */
 
144
#endif
 
145
                int comp_maxlevel;    /* max HTTP compression level */
 
146
                unsigned short idle_timer; /* how long before an empty buffer is considered idle (ms) */
97
147
        } tune;
98
 
        struct listener stats_sock; /* unix socket listener for statistics */
 
148
        struct {
 
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 */
 
154
                } ux;
 
155
        } unix_bind;
 
156
#ifdef USE_CPU_AFFINITY
 
157
        unsigned long cpu_map[LONGBITS];  /* list of CPU masks for the 32/64 first processes */
 
158
#endif
99
159
        struct proxy *stats_fe;     /* the frontend holding the stats settings */
100
160
};
101
161
 
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;
107
 
extern char *trash;
108
 
extern int  trashlen;
 
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 */
 
180
 
 
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
 
188
 
 
189
/* to be used with warned and WARN_* */
 
190
static inline int already_warned(unsigned int warning)
 
191
{
 
192
        if (warned & warning)
 
193
                return 1;
 
194
        warned |= warning;
 
195
        return 0;
 
196
}
116
197
 
117
198
#endif /* _TYPES_GLOBAL_H */
118
199