5
#include "backenddef/backenddef"
6
#include "servertype/servertype"
7
#include "dispatchmode/dispatchmode"
9
#include "ThreadsAndMutexes/mutex/mutex"
10
#include "backendcheck/backendcheck"
19
void parsecmdline (int ac, char **av);
22
bool verbose() const { return (verbose_flag); }
23
void verbose (bool v) { verbose_flag = v; }
25
bool debug() const { return (debug_flag); }
26
void debug (bool d) { debug_flag = d; }
28
unsigned quitafter() const { return (quit_after); }
30
Servertype::Type stype() const { return (styp.type()); }
31
void stype(string const &s) { styp.type(s); }
32
string stypestr() const { return (styp.typestr()); }
33
string const &sipaddr() const { return (sip); }
34
int sport() const { return (lport); }
36
int backends() const { return (blist.size()); }
39
void pidfile(string const &s);
40
string const &pidfile() {
45
unsigned client_read_timeout() const {
48
void client_read_timeout (unsigned c) {
51
unsigned client_write_timeout() const {
52
return c_write_timeout;
54
void client_write_timeout(unsigned c) {
58
/* Back end timeouts */
59
unsigned backend_read_timeout() const {
62
void backend_read_timeout (unsigned b) {
65
unsigned backend_write_timeout() const {
66
return b_write_timeout;
68
void backend_write_timeout(unsigned b) {
72
unsigned wakeupsec() const { return (wakeup); }
73
void wakeupsec (unsigned w) { wakeup = w; }
75
unsigned checkupsec() const { return (checkup); }
76
void checkupsec (unsigned w) { checkup = w; }
78
unsigned buffersize() const { return (bufsize); }
79
void buffersize (unsigned b);
81
bool foregroundmode() const { return (foreground_mode); }
83
bool addxrversion() const { return (add_xr_version); }
84
void addxrversion (bool b);
86
bool addxforwardedfor() const { return (add_x_forwarded_for); }
87
void addxforwardedfor (bool b);
89
bool stickyhttp() const { return (sticky_http); }
90
void stickyhttp(bool b);
92
bool replacehostheader() const { return replace_host_header; }
93
void replacehostheader(bool s) { replace_host_header = s; }
95
unsigned maxconn() const { return (max_conn); }
96
void maxconn (unsigned m);
98
string const &externalalgorithm() const {
99
return (external_algorithm);
102
bool prefixtimestamp() const { return (prefix_timestamp); }
103
void prefixtimestamp (bool p);
105
bool fastclose() const { return (fast_close); }
106
void fastclose (bool f);
108
bool usewebinterface() const { return use_webinterface; }
109
string const &webinterfaceip() const {
110
return webinterface_ip;
112
int webinterfaceport() const { return webinterface_port; }
114
unsigned nserverheaders() const { return (serverheaders.size()); }
115
string const &serverheader (unsigned n) {
116
return (serverheaders[n]);
118
void addserverheader (string const &s);
119
void removeserverheader (unsigned i);
120
void changeserverheader (unsigned i, string const &s);
122
string const &dumpdir() const { return (dump_dir); }
123
void dumpdir (string s) { dump_dir = s; }
125
unsigned softmaxconnrate() const { return soft_maxconnrate; }
126
void softmaxconnrate(unsigned n) { soft_maxconnrate = n; }
127
unsigned hardmaxconnrate() const { return hard_maxconnrate; }
128
void hardmaxconnrate(unsigned n) { hard_maxconnrate = n; }
129
unsigned defertime() const { return defer_time; }
130
void defertime(unsigned n) { defer_time = n; }
131
unsigned connrate_time() const { return connrate_timeinterval; }
132
void connrate_time(unsigned n) { connrate_timeinterval = n; }
134
unsigned dnscachetimeout() const { return dns_cache_timeout; }
135
void dnscachetimeout(unsigned t) { dns_cache_timeout = t; }
137
unsigned nallow() const { return (allowlist.size()); }
138
unsigned ndeny() const { return (denylist.size()); }
139
void addallow (string a);
140
void adddeny (string d);
141
void changeallow(string &a, unsigned index);
142
void changedeny(string &a, unsigned index);
143
void deleteallow(unsigned index);
144
void deletedeny(unsigned index);
146
int ipstoretimeout() const { return (ipstore_timeout); }
147
void ipstoretimeout(int t);
148
struct in_addr allow(unsigned n) const {
149
return (allowlist[n]);
151
struct in_addr deny(unsigned n) const {
152
return (denylist[n]);
155
BackendDef const &backend (int i) const {
158
Dispatchmode::Mode dispatchmode() const {
159
return (dmode.mode());
161
string dispatchmodestr() const {
162
return (dmode.modestr());
164
bool removereservations() const {
165
return remove_reservations;
167
void removereservations(bool b) {
168
remove_reservations = b;
171
string const &softmaxconnexcess() const {
172
return soft_maxconn_excess_prog;
174
void softmaxconnexcess(string const &s) {
175
soft_maxconn_excess_prog = s;
177
string const &hardmaxconnexcess() const {
178
return hard_maxconn_excess_prog;
180
void hardmaxconnexcess(string const &s) {
181
hard_maxconn_excess_prog = s;
184
void onstart(string s) { on_start = s; }
185
string const &onstart() const { return on_start; }
186
void onend(string s) { on_end = s; }
187
string const &onend() const { return on_end; }
188
void onfail(string s) { on_fail = s; }
189
string const &onfail() const { return on_fail; }
191
/* Restart of program */
195
void setbackend (string const &s, string const &hostmatch,
196
string const &urlmatch,
197
BackendCheck const &bc);
198
void setwebinterface (string s);
199
void setserver (string s);
200
void setdispatchmode (string s);
201
int setinteger (string s) const;
203
static string pid_file;
204
static bool verbose_flag;
206
static Servertype styp;
208
static vector<BackendDef> blist;
209
static Dispatchmode dmode;
210
static unsigned c_timeout, c_write_timeout;
211
static unsigned b_timeout, b_write_timeout;
212
static unsigned wakeup;
213
static unsigned checkup;
214
static unsigned bufsize;
215
static bool foreground_mode;
216
static bool add_xr_version;
217
static bool debug_flag;
218
static bool add_x_forwarded_for;
219
static bool sticky_http;
220
static bool replace_host_header;
221
static unsigned max_conn;
222
static string external_algorithm;
223
static bool prefix_timestamp;
224
static vector<string> serverheaders;
225
static vector<struct in_addr> allowlist;
226
static vector<struct in_addr> denylist;
227
static bool fast_close;
228
static int ipstore_timeout;
229
static bool use_webinterface;
230
static string webinterface_ip;
231
static int webinterface_port;
232
static string dump_dir;
233
static unsigned soft_maxconnrate;
234
static unsigned hard_maxconnrate;
235
static unsigned defer_time;
236
static unsigned connrate_timeinterval;
237
static unsigned quit_after;
238
static string soft_maxconn_excess_prog;
239
static string hard_maxconn_excess_prog;
240
static unsigned dns_cache_timeout;
241
static string on_start, on_end, on_fail;
242
static bool remove_reservations;
243
static char **org_argv;
246
extern Config config;