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