]> git.ipfire.org Git - thirdparty/squid.git/blob - src/SquidConfig.h
Automatically revive hopeless kids on reconfigure and after a timeout.
[thirdparty/squid.git] / src / SquidConfig.h
1 /*
2 * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
3 *
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
7 */
8
9 #ifndef SQUID_SQUIDCONFIG_H_
10 #define SQUID_SQUIDCONFIG_H_
11
12 #include "acl/forward.h"
13 #include "base/RefCount.h"
14 #include "base/YesNoNone.h"
15 #if USE_DELAY_POOLS
16 #include "ClientDelayConfig.h"
17 #include "DelayConfig.h"
18 #endif
19 #include "helper/ChildConfig.h"
20 #include "HttpHeaderTools.h"
21 #include "ip/Address.h"
22 #if USE_DELAY_POOLS
23 #include "MessageDelayPools.h"
24 #endif
25 #include "Notes.h"
26 #include "security/forward.h"
27 #include "SquidTime.h"
28 #if USE_OPENSSL
29 #include "ssl/support.h"
30 #endif
31 #include "store/forward.h"
32
33 #if USE_OPENSSL
34 class sslproxy_cert_sign;
35 class sslproxy_cert_adapt;
36 #endif
37
38 namespace Mgr
39 {
40 class ActionPasswordList;
41 } // namespace Mgr
42 class CachePeer;
43 class CustomLog;
44 class CpuAffinityMap;
45 class external_acl;
46 class HeaderManglers;
47 class RefreshPattern;
48 class RemovalPolicySettings;
49
50 namespace AnyP
51 {
52 class PortCfg;
53 }
54
55 namespace Store {
56 class DiskConfig {
57 public:
58 RefCount<SwapDir> *swapDirs;
59 int n_allocated;
60 int n_configured;
61 /// number of disk processes required to support all cache_dirs
62 int n_strands;
63 };
64 #define INDEXSD(i) (Config.cacheSwap.swapDirs[i].getRaw())
65 }
66
67 /// the representation of the configuration. POD.
68 class SquidConfig
69 {
70 public:
71 struct {
72 /* These should be for the Store::Root instance.
73 * this needs pluggable parsing to be done smoothly.
74 */
75 int highWaterMark;
76 int lowWaterMark;
77 } Swap;
78
79 YesNoNone memShared; ///< whether the memory cache is shared among workers
80 YesNoNone shmLocking; ///< shared_memory_locking
81 size_t memMaxSize;
82
83 struct {
84 int64_t min;
85 int pct;
86 int64_t max;
87 } quickAbort;
88 int64_t readAheadGap;
89 RemovalPolicySettings *replPolicy;
90 RemovalPolicySettings *memPolicy;
91 #if USE_HTTP_VIOLATIONS
92 time_t negativeTtl;
93 #endif
94 time_t maxStale;
95 time_t negativeDnsTtl;
96 time_t positiveDnsTtl;
97 time_t shutdownLifetime;
98 time_t backgroundPingRate;
99 time_t hopelessKidRevivalDelay; ///< hopeless_kid_revival_delay
100
101 struct {
102 time_t read;
103 time_t write;
104 time_t lifetime;
105 time_t connect;
106 time_t forward;
107 time_t peer_connect;
108 time_t request;
109 time_t clientIdlePconn;
110 time_t serverIdlePconn;
111 time_t ftpClientIdle;
112 time_t pconnLifetime; ///< pconn_lifetime in squid.conf
113 time_t siteSelect;
114 time_t deadPeer;
115 time_t request_start_timeout;
116 int icp_query; /* msec */
117 int icp_query_max; /* msec */
118 int icp_query_min; /* msec */
119 int mcast_icp_query; /* msec */
120 time_msec_t idns_retransmit;
121 time_msec_t idns_query;
122 time_t urlRewrite;
123 } Timeout;
124 size_t maxRequestHeaderSize;
125 int64_t maxRequestBodySize;
126 size_t maxRequestBufferSize;
127 size_t maxReplyHeaderSize;
128 AclSizeLimit *ReplyBodySize;
129
130 struct {
131 unsigned short icp;
132 #if USE_HTCP
133
134 unsigned short htcp;
135 #endif
136 #if SQUID_SNMP
137
138 unsigned short snmp;
139 #endif
140 } Port;
141
142 #if SQUID_SNMP
143
144 struct {
145 char *configFile;
146 char *agentInfo;
147 } Snmp;
148 #endif
149 #if USE_WCCP
150
151 struct {
152 Ip::Address router;
153 Ip::Address address;
154 int version;
155 } Wccp;
156 #endif
157 #if USE_WCCPv2
158
159 struct {
160 Ip::Address_list *router;
161 Ip::Address address;
162 int forwarding_method;
163 int return_method;
164 int assignment_method;
165 int weight;
166 int rebuildwait;
167 void *info;
168 } Wccp2;
169 #endif
170
171 char *as_whois_server;
172
173 struct {
174 char *store;
175 char *swap;
176 CustomLog *accesslogs;
177 #if ICAP_CLIENT
178 CustomLog *icaplogs;
179 #endif
180 int rotateNumber;
181 } Log;
182 char *adminEmail;
183 char *EmailFrom;
184 char *EmailProgram;
185 char *effectiveUser;
186 char *visible_appname_string;
187 char *effectiveGroup;
188
189 struct {
190 wordlist *redirect;
191 wordlist *store_id;
192 #if USE_UNLINKD
193
194 char *unlinkd;
195 #endif
196
197 char *diskd;
198 #if USE_OPENSSL
199
200 char *ssl_password;
201 #endif
202
203 } Program;
204
205 Helper::ChildConfig redirectChildren;
206 Helper::ChildConfig storeIdChildren;
207
208 struct {
209 char *surrogate_id;
210 } Accel;
211 char *appendDomain;
212 size_t appendDomainLen;
213 char *pidFilename;
214 char *netdbFilename;
215 char *mimeTablePathname;
216 char *etcHostsPath;
217 char *visibleHostname;
218 char *uniqueHostname;
219 wordlist *hostnameAliases;
220 char *errHtmlText;
221
222 struct {
223 char *host;
224 char *file;
225 time_t period;
226 unsigned short port;
227 } Announce;
228
229 struct {
230
231 Ip::Address udp_incoming;
232 Ip::Address udp_outgoing;
233 #if SQUID_SNMP
234 Ip::Address snmp_incoming;
235 Ip::Address snmp_outgoing;
236 #endif
237 /* FIXME INET6 : this should really be a CIDR value */
238 Ip::Address client_netmask;
239 } Addrs;
240 size_t tcpRcvBufsz;
241 size_t udpMaxHitObjsz;
242 wordlist *mcast_group_list;
243 CachePeer *peers;
244 int npeers;
245
246 struct {
247 int size;
248 int low;
249 int high;
250 } ipcache;
251
252 struct {
253 int size;
254 } fqdncache;
255 int minDirectHops;
256 int minDirectRtt;
257 Mgr::ActionPasswordList *passwd_list;
258
259 struct {
260 int objectsPerBucket;
261 int64_t avgObjectSize;
262 int64_t maxObjectSize;
263 int64_t minObjectSize;
264 size_t maxInMemObjSize;
265 } Store;
266
267 struct {
268 int high;
269 int low;
270 time_t period;
271 } Netdb;
272
273 struct {
274 int log_udp;
275 int res_defnames;
276 int anonymizer;
277 int client_db;
278 int query_icmp;
279 int icp_hit_stale;
280 int buffered_logs;
281 int common_log;
282 int log_mime_hdrs;
283 int log_fqdn;
284 int announce;
285 int mem_pools;
286 int test_reachability;
287 int half_closed_clients;
288 int refresh_all_ims;
289 #if USE_HTTP_VIOLATIONS
290
291 int reload_into_ims;
292 #endif
293
294 int offline;
295 int redir_rewrites_host;
296 int prefer_direct;
297 int nonhierarchical_direct;
298 int strip_query_terms;
299 int redirector_bypass;
300 int store_id_bypass;
301 int ignore_unknown_nameservers;
302 int client_pconns;
303 int server_pconns;
304 int error_pconns;
305 #if USE_CACHE_DIGESTS
306
307 int digest_generation;
308 #endif
309
310 int vary_ignore_expire;
311 int surrogate_is_remote;
312 int request_entities;
313 int detect_broken_server_pconns;
314 int balance_on_multiple_ip;
315 int relaxed_header_parser;
316 int check_hostnames;
317 int allow_underscore;
318 int via;
319 int cache_miss_revalidate;
320 int emailErrData;
321 int httpd_suppress_version_string;
322 int global_internal_static;
323 int collapsed_forwarding;
324
325 #if FOLLOW_X_FORWARDED_FOR
326 int acl_uses_indirect_client;
327 int delay_pool_uses_indirect_client;
328 int log_uses_indirect_client;
329 #if LINUX_NETFILTER
330 int tproxy_uses_indirect_client;
331 #endif
332 #endif /* FOLLOW_X_FORWARDED_FOR */
333
334 int WIN32_IpAddrChangeMonitor;
335 int memory_cache_first;
336 int memory_cache_disk;
337 int hostStrictVerify;
338 int client_dst_passthru;
339 int dns_mdns;
340 #if USE_OPENSSL
341 bool logTlsServerHelloDetails;
342 #endif
343 } onoff;
344
345 int64_t collapsed_forwarding_shared_entries_limit;
346
347 int pipeline_max_prefetch;
348
349 int forward_max_tries;
350 int connect_retries;
351
352 class ACL *aclList;
353
354 struct {
355 acl_access *http;
356 acl_access *adapted_http;
357 acl_access *icp;
358 acl_access *miss;
359 acl_access *NeverDirect;
360 acl_access *AlwaysDirect;
361 acl_access *ASlists;
362 acl_access *noCache;
363 acl_access *sendHit;
364 acl_access *storeMiss;
365 acl_access *stats_collection;
366 #if SQUID_SNMP
367
368 acl_access *snmp;
369 #endif
370 #if USE_HTTP_VIOLATIONS
371 acl_access *brokenPosts;
372 #endif
373 acl_access *redirector;
374 acl_access *store_id;
375 acl_access *reply;
376 Acl::Address *outgoing_address;
377 #if USE_HTCP
378
379 acl_access *htcp;
380 acl_access *htcp_clr;
381 #endif
382
383 #if USE_OPENSSL
384 acl_access *ssl_bump;
385 #endif
386 #if FOLLOW_X_FORWARDED_FOR
387 acl_access *followXFF;
388 #endif /* FOLLOW_X_FORWARDED_FOR */
389
390 /// acceptible PROXY protocol clients
391 acl_access *proxyProtocol;
392
393 /// spoof_client_ip squid.conf acl.
394 /// nil unless configured
395 acl_access* spoof_client_ip;
396 acl_access *on_unsupported_protocol;
397
398 acl_access *ftp_epsv;
399
400 acl_access *forceRequestBodyContinuation;
401 acl_access *serverPconnForNonretriable;
402 } accessList;
403 AclDenyInfoList *denyInfoList;
404
405 struct {
406 size_t list_width;
407 int list_wrap;
408 char *anon_user;
409 int passive;
410 int epsv_all;
411 int epsv;
412 int eprt;
413 int sanitycheck;
414 int telnet;
415 } Ftp;
416 RefreshPattern *Refresh;
417
418 Store::DiskConfig cacheSwap;
419
420 struct {
421 char *directory;
422 int use_short_names;
423 } icons;
424 char *errorDirectory;
425 #if USE_ERR_LOCALES
426 char *errorDefaultLanguage;
427 int errorLogMissingLanguages;
428 #endif
429 char *errorStylesheet;
430
431 struct {
432 int onerror;
433 } retry;
434
435 struct {
436 int64_t limit;
437 } MemPools;
438 #if USE_DELAY_POOLS
439
440 DelayConfig Delay;
441 ClientDelayConfig ClientDelay;
442 MessageDelayConfig MessageDelay;
443 #endif
444
445 struct {
446 struct {
447 int average;
448 int min_poll;
449 } dns, udp, tcp;
450 } comm_incoming;
451 int max_open_disk_fds;
452 int uri_whitespace;
453 AclSizeLimit *rangeOffsetLimit;
454 #if MULTICAST_MISS_STREAM
455
456 struct {
457
458 Ip::Address addr;
459 int ttl;
460 unsigned short port;
461 char *encode_key;
462 } mcast_miss;
463 #endif
464
465 /// request_header_access and request_header_replace
466 HeaderManglers *request_header_access;
467 /// reply_header_access and reply_header_replace
468 HeaderManglers *reply_header_access;
469 ///request_header_add access list
470 HeaderWithAclList *request_header_add;
471 ///reply_header_add access list
472 HeaderWithAclList *reply_header_add;
473 ///note
474 Notes notes;
475 char *coredump_dir;
476 char *chroot_dir;
477 #if USE_CACHE_DIGESTS
478
479 struct {
480 int bits_per_entry;
481 time_t rebuild_period;
482 time_t rewrite_period;
483 size_t swapout_chunk_size;
484 int rebuild_chunk_percentage;
485 } digest;
486 #endif
487 #if USE_OPENSSL
488
489 struct {
490 int unclean_shutdown;
491 char *ssl_engine;
492 int session_ttl;
493 size_t sessionCacheSize;
494 char *certSignHash;
495 } SSL;
496 #endif
497
498 struct {
499 int high_rptm;
500 int high_pf;
501 size_t high_memory;
502 } warnings;
503 char *store_dir_select_algorithm;
504 int sleep_after_fork; /* microseconds */
505 time_t minimum_expiry_time; /* seconds */
506 external_acl *externalAclHelperList;
507
508 struct {
509 Security::ContextPointer sslContext;
510 #if USE_OPENSSL
511 char *foreignIntermediateCertsPath;
512 acl_access *cert_error;
513 sslproxy_cert_sign *cert_sign;
514 sslproxy_cert_adapt *cert_adapt;
515 #endif
516 } ssl_client;
517
518 char *accept_filter;
519 int umask;
520 int max_filedescriptors;
521 int workers;
522 CpuAffinityMap *cpuAffinityMap;
523
524 #if USE_LOADABLE_MODULES
525 wordlist *loadable_module_names;
526 #endif
527
528 int client_ip_max_connections;
529
530 char *redirector_extras;
531
532 struct UrlHelperTimeout {
533 int action;
534 char *response;
535 } onUrlRewriteTimeout;
536
537 char *storeId_extras;
538
539 struct {
540 SBufList nameservers;
541 int v4_first; ///< Place IPv4 first in the order of DNS results.
542 ssize_t packet_max; ///< maximum size EDNS advertised for DNS replies.
543 } dns;
544 };
545
546 extern SquidConfig Config;
547
548 class SquidConfig2
549 {
550 public:
551 void clear() {
552 *this = SquidConfig2();
553 }
554
555 struct {
556 int enable_purge = 0;
557 } onoff;
558 uid_t effectiveUserID = 0;
559 gid_t effectiveGroupID = 0;
560 };
561
562 extern SquidConfig2 Config2;
563
564 #endif /* SQUID_SQUIDCONFIG_H_ */
565