]> git.ipfire.org Git - thirdparty/squid.git/blob - src/SquidConfig.h
72da8bb7c483037a7c1359d9df97d908241cfcb2
[thirdparty/squid.git] / src / SquidConfig.h
1 /*
2 * Copyright (C) 1996-2016 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
202 struct {
203 char *surrogate_id;
204 } Accel;
205 char *appendDomain;
206 size_t appendDomainLen;
207 char *pidFilename;
208 char *netdbFilename;
209 char *mimeTablePathname;
210 char *etcHostsPath;
211 char *visibleHostname;
212 char *uniqueHostname;
213 wordlist *hostnameAliases;
214 char *errHtmlText;
215
216 struct {
217 char *host;
218 char *file;
219 time_t period;
220 unsigned short port;
221 } Announce;
222
223 struct {
224
225 Ip::Address udp_incoming;
226 Ip::Address udp_outgoing;
227 #if SQUID_SNMP
228 Ip::Address snmp_incoming;
229 Ip::Address snmp_outgoing;
230 #endif
231 /* FIXME INET6 : this should really be a CIDR value */
232 Ip::Address client_netmask;
233 } Addrs;
234 size_t tcpRcvBufsz;
235 size_t udpMaxHitObjsz;
236 wordlist *mcast_group_list;
237 wordlist *dns_nameservers;
238 CachePeer *peers;
239 int npeers;
240
241 struct {
242 int size;
243 int low;
244 int high;
245 } ipcache;
246
247 struct {
248 int size;
249 } fqdncache;
250 int minDirectHops;
251 int minDirectRtt;
252 Mgr::ActionPasswordList *passwd_list;
253
254 struct {
255 int objectsPerBucket;
256 int64_t avgObjectSize;
257 int64_t maxObjectSize;
258 int64_t minObjectSize;
259 size_t maxInMemObjSize;
260 } Store;
261
262 struct {
263 int high;
264 int low;
265 time_t period;
266 } Netdb;
267
268 struct {
269 int log_udp;
270 int res_defnames;
271 int anonymizer;
272 int client_db;
273 int query_icmp;
274 int icp_hit_stale;
275 int buffered_logs;
276 int common_log;
277 int log_mime_hdrs;
278 int log_fqdn;
279 int announce;
280 int mem_pools;
281 int test_reachability;
282 int half_closed_clients;
283 int refresh_all_ims;
284 #if USE_HTTP_VIOLATIONS
285
286 int reload_into_ims;
287 #endif
288
289 int offline;
290 int redir_rewrites_host;
291 int prefer_direct;
292 int nonhierarchical_direct;
293 int strip_query_terms;
294 int redirector_bypass;
295 int store_id_bypass;
296 int ignore_unknown_nameservers;
297 int client_pconns;
298 int server_pconns;
299 int error_pconns;
300 #if USE_CACHE_DIGESTS
301
302 int digest_generation;
303 #endif
304
305 int vary_ignore_expire;
306 int surrogate_is_remote;
307 int request_entities;
308 int detect_broken_server_pconns;
309 int balance_on_multiple_ip;
310 int relaxed_header_parser;
311 int check_hostnames;
312 int allow_underscore;
313 int via;
314 int cache_miss_revalidate;
315 int emailErrData;
316 int httpd_suppress_version_string;
317 int global_internal_static;
318 int collapsed_forwarding;
319
320 #if FOLLOW_X_FORWARDED_FOR
321 int acl_uses_indirect_client;
322 int delay_pool_uses_indirect_client;
323 int log_uses_indirect_client;
324 #if LINUX_NETFILTER
325 int tproxy_uses_indirect_client;
326 #endif
327 #endif /* FOLLOW_X_FORWARDED_FOR */
328
329 int WIN32_IpAddrChangeMonitor;
330 int memory_cache_first;
331 int memory_cache_disk;
332 int hostStrictVerify;
333 int client_dst_passthru;
334 int dns_mdns;
335 #if USE_OPENSSL
336 bool logTlsServerHelloDetails;
337 #endif
338 } onoff;
339
340 int64_t collapsed_forwarding_shared_entries_limit;
341
342 int pipeline_max_prefetch;
343
344 int forward_max_tries;
345 int connect_retries;
346
347 class ACL *aclList;
348
349 struct {
350 acl_access *http;
351 acl_access *adapted_http;
352 acl_access *icp;
353 acl_access *miss;
354 acl_access *NeverDirect;
355 acl_access *AlwaysDirect;
356 acl_access *ASlists;
357 acl_access *noCache;
358 acl_access *sendHit;
359 acl_access *storeMiss;
360 acl_access *stats_collection;
361 #if SQUID_SNMP
362
363 acl_access *snmp;
364 #endif
365 #if USE_HTTP_VIOLATIONS
366 acl_access *brokenPosts;
367 #endif
368 acl_access *redirector;
369 acl_access *store_id;
370 acl_access *reply;
371 Acl::Address *outgoing_address;
372 #if USE_HTCP
373
374 acl_access *htcp;
375 acl_access *htcp_clr;
376 #endif
377
378 #if USE_OPENSSL
379 acl_access *ssl_bump;
380 #endif
381 #if FOLLOW_X_FORWARDED_FOR
382 acl_access *followXFF;
383 #endif /* FOLLOW_X_FORWARDED_FOR */
384
385 /// acceptible PROXY protocol clients
386 acl_access *proxyProtocol;
387
388 /// spoof_client_ip squid.conf acl.
389 /// nil unless configured
390 acl_access* spoof_client_ip;
391 acl_access *on_unsupported_protocol;
392
393 acl_access *ftp_epsv;
394
395 acl_access *forceRequestBodyContinuation;
396 acl_access *serverPconnForNonretriable;
397 } accessList;
398 AclDenyInfoList *denyInfoList;
399
400 struct {
401 size_t list_width;
402 int list_wrap;
403 char *anon_user;
404 int passive;
405 int epsv_all;
406 int epsv;
407 int eprt;
408 int sanitycheck;
409 int telnet;
410 } Ftp;
411 RefreshPattern *Refresh;
412
413 Store::DiskConfig cacheSwap;
414
415 struct {
416 char *directory;
417 int use_short_names;
418 } icons;
419 char *errorDirectory;
420 #if USE_ERR_LOCALES
421 char *errorDefaultLanguage;
422 int errorLogMissingLanguages;
423 #endif
424 char *errorStylesheet;
425
426 struct {
427 int onerror;
428 } retry;
429
430 struct {
431 int64_t limit;
432 } MemPools;
433 #if USE_DELAY_POOLS
434
435 DelayConfig Delay;
436 ClientDelayConfig ClientDelay;
437 #endif
438
439 struct {
440 struct {
441 int average;
442 int min_poll;
443 } dns, udp, tcp;
444 } comm_incoming;
445 int max_open_disk_fds;
446 int uri_whitespace;
447 AclSizeLimit *rangeOffsetLimit;
448 #if MULTICAST_MISS_STREAM
449
450 struct {
451
452 Ip::Address addr;
453 int ttl;
454 unsigned short port;
455 char *encode_key;
456 } mcast_miss;
457 #endif
458
459 /// request_header_access and request_header_replace
460 HeaderManglers *request_header_access;
461 /// reply_header_access and reply_header_replace
462 HeaderManglers *reply_header_access;
463 ///request_header_add access list
464 HeaderWithAclList *request_header_add;
465 ///reply_header_add access list
466 HeaderWithAclList *reply_header_add;
467 ///note
468 Notes notes;
469 char *coredump_dir;
470 char *chroot_dir;
471 #if USE_CACHE_DIGESTS
472
473 struct {
474 int bits_per_entry;
475 time_t rebuild_period;
476 time_t rewrite_period;
477 size_t swapout_chunk_size;
478 int rebuild_chunk_percentage;
479 } digest;
480 #endif
481 #if USE_OPENSSL
482
483 struct {
484 int unclean_shutdown;
485 char *ssl_engine;
486 int session_ttl;
487 size_t sessionCacheSize;
488 char *certSignHash;
489 } SSL;
490 #endif
491
492 struct {
493 int high_rptm;
494 int high_pf;
495 size_t high_memory;
496 } warnings;
497 char *store_dir_select_algorithm;
498 int sleep_after_fork; /* microseconds */
499 time_t minimum_expiry_time; /* seconds */
500 external_acl *externalAclHelperList;
501
502 struct {
503 Security::ContextPointer sslContext;
504 #if USE_OPENSSL
505 char *foreignIntermediateCertsPath;
506 acl_access *cert_error;
507 sslproxy_cert_sign *cert_sign;
508 sslproxy_cert_adapt *cert_adapt;
509 #endif
510 } ssl_client;
511
512 char *accept_filter;
513 int umask;
514 int max_filedescriptors;
515 int workers;
516 CpuAffinityMap *cpuAffinityMap;
517
518 #if USE_LOADABLE_MODULES
519 wordlist *loadable_module_names;
520 #endif
521
522 int client_ip_max_connections;
523
524 char *redirector_extras;
525
526 struct UrlHelperTimeout {
527 int action;
528 char *response;
529 } onUrlRewriteTimeout;
530
531 char *storeId_extras;
532
533 struct {
534 int v4_first; ///< Place IPv4 first in the order of DNS results.
535 ssize_t packet_max; ///< maximum size EDNS advertised for DNS replies.
536 } dns;
537 };
538
539 extern SquidConfig Config;
540
541 class SquidConfig2
542 {
543 public:
544 void clear() {
545 *this = SquidConfig2();
546 }
547
548 struct {
549 int enable_purge = 0;
550 } onoff;
551 uid_t effectiveUserID = 0;
552 gid_t effectiveGroupID = 0;
553 };
554
555 extern SquidConfig2 Config2;
556
557 #endif /* SQUID_SQUIDCONFIG_H_ */
558