]> git.ipfire.org Git - thirdparty/squid.git/blob - src/SquidConfig.h
Source Format Enforcement (#244)
[thirdparty/squid.git] / src / SquidConfig.h
1 /*
2 * Copyright (C) 1996-2018 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/Disk.h"
32 #include "store/forward.h"
33
34 #if USE_OPENSSL
35 class sslproxy_cert_sign;
36 class sslproxy_cert_adapt;
37 #endif
38
39 namespace Mgr
40 {
41 class ActionPasswordList;
42 } // namespace Mgr
43 class CachePeer;
44 class CustomLog;
45 class CpuAffinityMap;
46 class external_acl;
47 class HeaderManglers;
48 class RefreshPattern;
49 class RemovalPolicySettings;
50
51 namespace AnyP
52 {
53 class PortCfg;
54 }
55
56 namespace Store {
57 class DiskConfig {
58 public:
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;
65 /// number of disk processes required to support all cache_dirs
66 int n_strands = 0;
67 };
68 #define INDEXSD(i) (Config.cacheSwap.swapDirs[i].getRaw())
69 }
70
71 /// the representation of the configuration. POD.
72 class SquidConfig
73 {
74 public:
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
84 YesNoNone shmLocking; ///< shared_memory_locking
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;
103 time_t hopelessKidRevivalDelay; ///< hopeless_kid_revival_delay
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;
115 time_t ftpClientIdle;
116 time_t pconnLifetime; ///< pconn_lifetime in squid.conf
117 time_t siteSelect;
118 time_t deadPeer;
119 time_t request_start_timeout;
120 int icp_query; /* msec */
121 int icp_query_max; /* msec */
122 int icp_query_min; /* msec */
123 int mcast_icp_query; /* msec */
124 time_msec_t idns_retransmit;
125 time_msec_t idns_query;
126 time_t urlRewrite;
127 } Timeout;
128 size_t maxRequestHeaderSize;
129 int64_t maxRequestBodySize;
130 size_t maxRequestBufferSize;
131 size_t maxReplyHeaderSize;
132 AclSizeLimit *ReplyBodySize;
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
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
175 char *as_whois_server;
176
177 struct {
178 char *store;
179 char *swap;
180 CustomLog *accesslogs;
181 #if ICAP_CLIENT
182 CustomLog *icaplogs;
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 {
194 wordlist *redirect;
195 wordlist *store_id;
196 #if USE_UNLINKD
197
198 char *unlinkd;
199 #endif
200
201 char *diskd;
202 #if USE_OPENSSL
203
204 char *ssl_password;
205 #endif
206
207 } Program;
208
209 Helper::ChildConfig redirectChildren;
210 Helper::ChildConfig storeIdChildren;
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;
246 wordlist *mcast_group_list;
247 CachePeer *peers;
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;
261 Mgr::ActionPasswordList *passwd_list;
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;
304 int store_id_bypass;
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
314 int vary_ignore_expire;
315 int surrogate_is_remote;
316 int request_entities;
317 int detect_broken_server_pconns;
318 int balance_on_multiple_ip;
319 int relaxed_header_parser;
320 int check_hostnames;
321 int allow_underscore;
322 int via;
323 int cache_miss_revalidate;
324 int emailErrData;
325 int httpd_suppress_version_string;
326 int global_internal_static;
327 int collapsed_forwarding;
328
329 #if FOLLOW_X_FORWARDED_FOR
330 int acl_uses_indirect_client;
331 int delay_pool_uses_indirect_client;
332 int log_uses_indirect_client;
333 #if LINUX_NETFILTER
334 int tproxy_uses_indirect_client;
335 #endif
336 #endif /* FOLLOW_X_FORWARDED_FOR */
337
338 int WIN32_IpAddrChangeMonitor;
339 int memory_cache_first;
340 int memory_cache_disk;
341 int hostStrictVerify;
342 int client_dst_passthru;
343 int dns_mdns;
344 #if USE_OPENSSL
345 bool logTlsServerHelloDetails;
346 #endif
347 } onoff;
348
349 int64_t shared_transient_entries_limit;
350
351 int pipeline_max_prefetch;
352
353 int forward_max_tries;
354 int connect_retries;
355
356 class ACL *aclList;
357
358 struct {
359 acl_access *http;
360 acl_access *adapted_http;
361 acl_access *icp;
362 acl_access *miss;
363 acl_access *NeverDirect;
364 acl_access *AlwaysDirect;
365 acl_access *ASlists;
366 acl_access *noCache;
367 acl_access *sendHit;
368 acl_access *storeMiss;
369 acl_access *stats_collection;
370 #if SQUID_SNMP
371
372 acl_access *snmp;
373 #endif
374 #if USE_HTTP_VIOLATIONS
375 acl_access *brokenPosts;
376 #endif
377 acl_access *redirector;
378 acl_access *store_id;
379 acl_access *reply;
380 Acl::Address *outgoing_address;
381 #if USE_HTCP
382
383 acl_access *htcp;
384 acl_access *htcp_clr;
385 #endif
386
387 #if USE_OPENSSL
388 acl_access *ssl_bump;
389 #endif
390 #if FOLLOW_X_FORWARDED_FOR
391 acl_access *followXFF;
392 #endif /* FOLLOW_X_FORWARDED_FOR */
393
394 /// acceptible PROXY protocol clients
395 acl_access *proxyProtocol;
396
397 /// spoof_client_ip squid.conf acl.
398 /// nil unless configured
399 acl_access* spoof_client_ip;
400 acl_access *on_unsupported_protocol;
401
402 acl_access *ftp_epsv;
403
404 acl_access *forceRequestBodyContinuation;
405 acl_access *serverPconnForNonretriable;
406 acl_access *collapsedForwardingAccess;
407 } accessList;
408 AclDenyInfoList *denyInfoList;
409
410 struct {
411 size_t list_width;
412 int list_wrap;
413 char *anon_user;
414 int passive;
415 int epsv_all;
416 int epsv;
417 int eprt;
418 int sanitycheck;
419 int telnet;
420 } Ftp;
421 RefreshPattern *Refresh;
422
423 Store::DiskConfig cacheSwap;
424
425 struct {
426 char *directory;
427 int use_short_names;
428 } icons;
429 char *errorDirectory;
430 #if USE_ERR_LOCALES
431 char *errorDefaultLanguage;
432 int errorLogMissingLanguages;
433 #endif
434 char *errorStylesheet;
435
436 struct {
437 int onerror;
438 } retry;
439
440 struct {
441 int64_t limit;
442 } MemPools;
443 #if USE_DELAY_POOLS
444
445 DelayConfig Delay;
446 ClientDelayConfig ClientDelay;
447 MessageDelayConfig MessageDelay;
448 #endif
449
450 struct {
451 struct {
452 int average;
453 int min_poll;
454 } dns, udp, tcp;
455 } comm_incoming;
456 int max_open_disk_fds;
457 int uri_whitespace;
458 AclSizeLimit *rangeOffsetLimit;
459 #if MULTICAST_MISS_STREAM
460
461 struct {
462
463 Ip::Address addr;
464 int ttl;
465 unsigned short port;
466 char *encode_key;
467 } mcast_miss;
468 #endif
469
470 /// request_header_access and request_header_replace
471 HeaderManglers *request_header_access;
472 /// reply_header_access and reply_header_replace
473 HeaderManglers *reply_header_access;
474 ///request_header_add access list
475 HeaderWithAclList *request_header_add;
476 ///reply_header_add access list
477 HeaderWithAclList *reply_header_add;
478 ///note
479 Notes notes;
480 char *coredump_dir;
481 char *chroot_dir;
482 #if USE_CACHE_DIGESTS
483
484 struct {
485 int bits_per_entry;
486 time_t rebuild_period;
487 time_t rewrite_period;
488 size_t swapout_chunk_size;
489 int rebuild_chunk_percentage;
490 } digest;
491 #endif
492 #if USE_OPENSSL
493
494 struct {
495 int unclean_shutdown;
496 char *ssl_engine;
497 int session_ttl;
498 size_t sessionCacheSize;
499 char *certSignHash;
500 } SSL;
501 #endif
502
503 struct {
504 int high_rptm;
505 int high_pf;
506 size_t high_memory;
507 } warnings;
508 char *store_dir_select_algorithm;
509 int sleep_after_fork; /* microseconds */
510 time_t minimum_expiry_time; /* seconds */
511 external_acl *externalAclHelperList;
512
513 struct {
514 Security::ContextPointer sslContext;
515 #if USE_OPENSSL
516 char *foreignIntermediateCertsPath;
517 acl_access *cert_error;
518 sslproxy_cert_sign *cert_sign;
519 sslproxy_cert_adapt *cert_adapt;
520 #endif
521 } ssl_client;
522
523 char *accept_filter;
524 int umask;
525 int max_filedescriptors;
526 int workers;
527 CpuAffinityMap *cpuAffinityMap;
528
529 #if USE_LOADABLE_MODULES
530 wordlist *loadable_module_names;
531 #endif
532
533 int client_ip_max_connections;
534
535 char *redirector_extras;
536
537 struct UrlHelperTimeout {
538 int action;
539 char *response;
540 } onUrlRewriteTimeout;
541
542 char *storeId_extras;
543
544 struct {
545 SBufList nameservers;
546 int v4_first; ///< Place IPv4 first in the order of DNS results.
547 ssize_t packet_max; ///< maximum size EDNS advertised for DNS replies.
548 } dns;
549 };
550
551 extern SquidConfig Config;
552
553 class SquidConfig2
554 {
555 public:
556 void clear() {
557 *this = SquidConfig2();
558 }
559
560 struct {
561 int enable_purge = 0;
562 } onoff;
563 uid_t effectiveUserID = 0;
564 gid_t effectiveGroupID = 0;
565 };
566
567 extern SquidConfig2 Config2;
568
569 #endif /* SQUID_SQUIDCONFIG_H_ */
570