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