2006-06-25 20:48:02 -04:00
|
|
|
/*
|
2010-02-26 05:12:27 -05:00
|
|
|
* include/types/global.h
|
|
|
|
|
* Global variables.
|
|
|
|
|
*
|
|
|
|
|
* Copyright (C) 2000-2010 Willy Tarreau - w@1wt.eu
|
|
|
|
|
*
|
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
|
* License as published by the Free Software Foundation, version 2.1
|
|
|
|
|
* exclusively.
|
|
|
|
|
*
|
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
|
*/
|
2006-06-25 20:48:02 -04:00
|
|
|
|
|
|
|
|
#ifndef _TYPES_GLOBAL_H
|
|
|
|
|
#define _TYPES_GLOBAL_H
|
|
|
|
|
|
|
|
|
|
#include <netinet/in.h>
|
|
|
|
|
|
2006-06-29 12:54:54 -04:00
|
|
|
#include <common/config.h>
|
2012-08-24 13:22:53 -04:00
|
|
|
#include <types/freq_ctr.h>
|
2012-09-12 16:58:11 -04:00
|
|
|
#include <types/listener.h>
|
2009-08-16 11:41:45 -04:00
|
|
|
#include <types/proxy.h>
|
2006-06-25 20:48:02 -04:00
|
|
|
#include <types/task.h>
|
|
|
|
|
|
2012-10-02 12:42:10 -04:00
|
|
|
#ifndef UNIX_MAX_PATH
|
|
|
|
|
#define UNIX_MAX_PATH 108
|
|
|
|
|
#endif
|
|
|
|
|
|
2006-06-25 20:48:02 -04:00
|
|
|
/* modes of operation (global.mode) */
|
2007-10-18 07:53:22 -04:00
|
|
|
#define MODE_DEBUG 0x01
|
|
|
|
|
#define MODE_DAEMON 0x02
|
|
|
|
|
#define MODE_QUIET 0x04
|
|
|
|
|
#define MODE_CHECK 0x08
|
|
|
|
|
#define MODE_VERBOSE 0x10
|
|
|
|
|
#define MODE_STARTING 0x20
|
|
|
|
|
#define MODE_FOREGROUND 0x40
|
2006-06-25 20:48:02 -04:00
|
|
|
|
2006-11-12 17:57:19 -05:00
|
|
|
/* list of last checks to perform, depending on config options */
|
|
|
|
|
#define LSTCHK_CAP_BIND 0x00000001 /* check that we can bind to any port */
|
|
|
|
|
#define LSTCHK_CTTPROXY 0x00000002 /* check that tproxy is enabled */
|
|
|
|
|
#define LSTCHK_NETADM 0x00000004 /* check that we have CAP_NET_ADMIN */
|
2006-06-25 20:48:02 -04:00
|
|
|
|
2009-01-25 09:42:27 -05:00
|
|
|
/* Global tuning options */
|
|
|
|
|
/* available polling mechanisms */
|
|
|
|
|
#define GTUNE_USE_SELECT (1<<0)
|
|
|
|
|
#define GTUNE_USE_POLL (1<<1)
|
|
|
|
|
#define GTUNE_USE_EPOLL (1<<2)
|
|
|
|
|
#define GTUNE_USE_KQUEUE (1<<3)
|
|
|
|
|
#define GTUNE_USE_SEPOLL (1<<4)
|
2009-01-25 10:03:28 -05:00
|
|
|
/* platform-specific options */
|
|
|
|
|
#define GTUNE_USE_SPLICE (1<<5)
|
2009-01-25 09:42:27 -05:00
|
|
|
|
2009-10-10 11:13:00 -04:00
|
|
|
/* Access level for a stats socket */
|
|
|
|
|
#define ACCESS_LVL_NONE 0
|
|
|
|
|
#define ACCESS_LVL_USER 1
|
|
|
|
|
#define ACCESS_LVL_OPER 2
|
|
|
|
|
#define ACCESS_LVL_ADMIN 3
|
2009-01-25 09:42:27 -05:00
|
|
|
|
2006-06-25 20:48:02 -04:00
|
|
|
/* FIXME : this will have to be redefined correctly */
|
|
|
|
|
struct global {
|
2012-10-02 12:42:10 -04:00
|
|
|
#ifdef USE_OPENSSL
|
|
|
|
|
char *crt_base; /* base directory path for certificates */
|
|
|
|
|
char *ca_base; /* base directory path for CAs and CRLs */
|
|
|
|
|
#endif
|
2006-11-12 17:57:19 -05:00
|
|
|
int uid;
|
|
|
|
|
int gid;
|
|
|
|
|
int nbproc;
|
2011-09-07 08:38:31 -04:00
|
|
|
int maxconn, hardmaxconn;
|
2012-09-06 05:58:37 -04:00
|
|
|
#ifdef USE_OPENSSL
|
|
|
|
|
int maxsslconn;
|
2012-10-05 09:47:31 -04:00
|
|
|
char *listen_default_ciphers;
|
|
|
|
|
char *connect_default_ciphers;
|
2012-09-06 05:58:37 -04:00
|
|
|
#endif
|
2011-09-07 09:17:21 -04:00
|
|
|
struct freq_ctr conn_per_sec;
|
|
|
|
|
int cps_lim, cps_max;
|
2009-01-18 14:39:42 -05:00
|
|
|
int maxpipes; /* max # of pipes */
|
2006-11-12 17:57:19 -05:00
|
|
|
int maxsock; /* max # of sockets */
|
|
|
|
|
int rlimit_nofile; /* default ulimit-n value : 0=unset */
|
|
|
|
|
int rlimit_memmax; /* default ulimit-d in megs value : 0=unset */
|
|
|
|
|
int mode;
|
2012-04-05 12:02:55 -04:00
|
|
|
unsigned int req_count; /* HTTP request counter */
|
2006-11-12 17:57:19 -05:00
|
|
|
int last_checks;
|
2007-10-14 17:40:01 -04:00
|
|
|
int spread_checks;
|
2006-11-12 17:57:19 -05:00
|
|
|
char *chroot;
|
|
|
|
|
char *pidfile;
|
2009-10-02 16:51:14 -04:00
|
|
|
char *node, *desc; /* node name & description */
|
2010-12-22 11:08:21 -05:00
|
|
|
char *log_tag; /* name for syslog */
|
2011-10-12 11:50:54 -04:00
|
|
|
struct list logsrvs;
|
2010-12-29 11:05:48 -05:00
|
|
|
char *log_send_hostname; /* set hostname in syslog header */
|
2007-06-03 11:16:49 -04:00
|
|
|
struct {
|
|
|
|
|
int maxpollevents; /* max number of poll events at once */
|
2008-01-06 05:22:57 -05:00
|
|
|
int maxaccept; /* max number of consecutive accept() */
|
2009-01-25 09:42:27 -05:00
|
|
|
int options; /* various tuning options */
|
2009-03-21 15:43:57 -04:00
|
|
|
int recv_enough; /* how many input bytes at once are "enough" */
|
2009-08-17 01:23:33 -04:00
|
|
|
int bufsize; /* buffer size in bytes, defaults to BUFSIZE */
|
|
|
|
|
int maxrewrite; /* buffer max rewrite size in bytes, defaults to MAXREWRITE */
|
2010-01-21 11:43:04 -05:00
|
|
|
int client_sndbuf; /* set client sndbuf to this value if not null */
|
|
|
|
|
int client_rcvbuf; /* set client rcvbuf to this value if not null */
|
|
|
|
|
int server_sndbuf; /* set server sndbuf to this value if not null */
|
|
|
|
|
int server_rcvbuf; /* set server rcvbuf to this value if not null */
|
2010-10-04 14:39:20 -04:00
|
|
|
int chksize; /* check buffer size in bytes, defaults to BUFSIZE */
|
2011-10-23 15:14:29 -04:00
|
|
|
int pipesize; /* pipe size in bytes, system defaults if zero */
|
2011-10-24 13:14:41 -04:00
|
|
|
int max_http_hdr; /* max number of HTTP headers, use MAX_HTTP_HDR if zero */
|
2012-09-03 06:10:29 -04:00
|
|
|
#ifdef USE_OPENSSL
|
|
|
|
|
int sslcachesize; /* SSL cache size in session, defaults to 20000 */
|
|
|
|
|
#endif
|
2007-06-03 11:16:49 -04:00
|
|
|
} tune;
|
2010-10-22 11:59:25 -04:00
|
|
|
struct {
|
|
|
|
|
char *prefix; /* path prefix of unix bind socket */
|
|
|
|
|
struct { /* UNIX socket permissions */
|
|
|
|
|
uid_t uid; /* -1 to leave unchanged */
|
|
|
|
|
gid_t gid; /* -1 to leave unchanged */
|
|
|
|
|
mode_t mode; /* 0 to leave unchanged */
|
|
|
|
|
int level; /* access level (ACCESS_LVL_*) */
|
|
|
|
|
} ux;
|
|
|
|
|
} unix_bind;
|
2009-08-16 11:41:45 -04:00
|
|
|
struct proxy *stats_fe; /* the frontend holding the stats settings */
|
2006-06-25 20:48:02 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
extern struct global global;
|
|
|
|
|
extern int pid; /* current process id */
|
2007-11-04 17:35:08 -05:00
|
|
|
extern int relative_pid; /* process id starting at 1 */
|
2006-06-25 20:48:02 -04:00
|
|
|
extern int actconn; /* # of active sessions */
|
2010-08-31 09:39:26 -04:00
|
|
|
extern int listeners;
|
|
|
|
|
extern int jobs; /* # of active jobs */
|
2012-05-16 08:16:48 -04:00
|
|
|
extern char *trash;
|
|
|
|
|
extern int trashlen;
|
2010-02-26 05:12:27 -05:00
|
|
|
extern char *swap_buffer;
|
2010-08-25 06:58:59 -04:00
|
|
|
extern int nb_oldpids; /* contains the number of old pids found */
|
2006-06-25 20:48:02 -04:00
|
|
|
extern const int zero;
|
|
|
|
|
extern const int one;
|
2007-10-11 14:48:58 -04:00
|
|
|
extern const struct linger nolinger;
|
2006-06-25 20:48:02 -04:00
|
|
|
extern int stopping; /* non zero means stopping in progress */
|
2009-08-16 04:08:02 -04:00
|
|
|
extern char hostname[MAX_HOSTNAME_LEN];
|
2010-09-23 12:30:22 -04:00
|
|
|
extern char localpeer[MAX_HOSTNAME_LEN];
|
2011-07-24 16:58:00 -04:00
|
|
|
extern struct list global_listener_queue; /* list of the temporarily limited listeners */
|
2011-08-01 14:57:55 -04:00
|
|
|
extern struct task *global_listener_queue_task;
|
2006-06-25 20:48:02 -04:00
|
|
|
|
|
|
|
|
#endif /* _TYPES_GLOBAL_H */
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Local variables:
|
|
|
|
|
* c-indent-level: 8
|
|
|
|
|
* c-basic-offset: 8
|
|
|
|
|
* End:
|
|
|
|
|
*/
|