]> git.ipfire.org Git - thirdparty/squid.git/blob - src/SquidConfig.h
0a0689e482f8b76b29084ed44f59f0cd6c0b03de
[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 size_t memMaxSize;
76
77 struct {
78 int64_t min;
79 int pct;
80 int64_t max;
81 } quickAbort;
82 int64_t readAheadGap;
83 RemovalPolicySettings *replPolicy;
84 RemovalPolicySettings *memPolicy;
85 #if USE_HTTP_VIOLATIONS
86 time_t negativeTtl;
87 #endif
88 time_t maxStale;
89 time_t negativeDnsTtl;
90 time_t positiveDnsTtl;
91 time_t shutdownLifetime;
92 time_t backgroundPingRate;
93
94 struct {
95 time_t read;
96 time_t write;
97 time_t lifetime;
98 time_t connect;
99 time_t forward;
100 time_t peer_connect;
101 time_t request;
102 time_t clientIdlePconn;
103 time_t serverIdlePconn;
104 time_t ftpClientIdle;
105 time_t pconnLifetime; ///< pconn_lifetime in squid.conf
106 time_t siteSelect;
107 time_t deadPeer;
108 time_t request_start_timeout;
109 int icp_query; /* msec */
110 int icp_query_max; /* msec */
111 int icp_query_min; /* msec */
112 int mcast_icp_query; /* msec */
113 time_msec_t idns_retransmit;
114 time_msec_t idns_query;
115 time_t urlRewrite;
116 } Timeout;
117 size_t maxRequestHeaderSize;
118 int64_t maxRequestBodySize;
119 size_t maxRequestBufferSize;
120 size_t maxReplyHeaderSize;
121 AclSizeLimit *ReplyBodySize;
122
123 struct {
124 unsigned short icp;
125 #if USE_HTCP
126
127 unsigned short htcp;
128 #endif
129 #if SQUID_SNMP
130
131 unsigned short snmp;
132 #endif
133 } Port;
134
135 #if SQUID_SNMP
136
137 struct {
138 char *configFile;
139 char *agentInfo;
140 } Snmp;
141 #endif
142 #if USE_WCCP
143
144 struct {
145 Ip::Address router;
146 Ip::Address address;
147 int version;
148 } Wccp;
149 #endif
150 #if USE_WCCPv2
151
152 struct {
153 Ip::Address_list *router;
154 Ip::Address address;
155 int forwarding_method;
156 int return_method;
157 int assignment_method;
158 int weight;
159 int rebuildwait;
160 void *info;
161 } Wccp2;
162 #endif
163
164 char *as_whois_server;
165
166 struct {
167 char *store;
168 char *swap;
169 CustomLog *accesslogs;
170 #if ICAP_CLIENT
171 CustomLog *icaplogs;
172 #endif
173 int rotateNumber;
174 } Log;
175 char *adminEmail;
176 char *EmailFrom;
177 char *EmailProgram;
178 char *effectiveUser;
179 char *visible_appname_string;
180 char *effectiveGroup;
181
182 struct {
183 wordlist *redirect;
184 wordlist *store_id;
185 #if USE_UNLINKD
186
187 char *unlinkd;
188 #endif
189
190 char *diskd;
191 #if USE_OPENSSL
192
193 char *ssl_password;
194 #endif
195
196 } Program;
197
198 Helper::ChildConfig redirectChildren;
199 Helper::ChildConfig storeIdChildren;
200 time_t authenticateGCInterval;
201 time_t authenticateTTL;
202 time_t authenticateIpTTL;
203
204 struct {
205 char *surrogate_id;
206 } Accel;
207 char *appendDomain;
208 size_t appendDomainLen;
209 char *pidFilename;
210 char *netdbFilename;
211 char *mimeTablePathname;
212 char *etcHostsPath;
213 char *visibleHostname;
214 char *uniqueHostname;
215 wordlist *hostnameAliases;
216 char *errHtmlText;
217
218 struct {
219 char *host;
220 char *file;
221 time_t period;
222 unsigned short port;
223 } Announce;
224
225 struct {
226
227 Ip::Address udp_incoming;
228 Ip::Address udp_outgoing;
229 #if SQUID_SNMP
230 Ip::Address snmp_incoming;
231 Ip::Address snmp_outgoing;
232 #endif
233 /* FIXME INET6 : this should really be a CIDR value */
234 Ip::Address client_netmask;
235 } Addrs;
236 size_t tcpRcvBufsz;
237 size_t udpMaxHitObjsz;
238 wordlist *mcast_group_list;
239 wordlist *dns_nameservers;
240 CachePeer *peers;
241 int npeers;
242
243 struct {
244 int size;
245 int low;
246 int high;
247 } ipcache;
248
249 struct {
250 int size;
251 } fqdncache;
252 int minDirectHops;
253 int minDirectRtt;
254 Mgr::ActionPasswordList *passwd_list;
255
256 struct {
257 int objectsPerBucket;
258 int64_t avgObjectSize;
259 int64_t maxObjectSize;
260 int64_t minObjectSize;
261 size_t maxInMemObjSize;
262 } Store;
263
264 struct {
265 int high;
266 int low;
267 time_t period;
268 } Netdb;
269
270 struct {
271 int log_udp;
272 int res_defnames;
273 int anonymizer;
274 int client_db;
275 int query_icmp;
276 int icp_hit_stale;
277 int buffered_logs;
278 int common_log;
279 int log_mime_hdrs;
280 int log_fqdn;
281 int announce;
282 int mem_pools;
283 int test_reachability;
284 int half_closed_clients;
285 int refresh_all_ims;
286 #if USE_HTTP_VIOLATIONS
287
288 int reload_into_ims;
289 #endif
290
291 int offline;
292 int redir_rewrites_host;
293 int prefer_direct;
294 int nonhierarchical_direct;
295 int strip_query_terms;
296 int redirector_bypass;
297 int store_id_bypass;
298 int ignore_unknown_nameservers;
299 int client_pconns;
300 int server_pconns;
301 int error_pconns;
302 #if USE_CACHE_DIGESTS
303
304 int digest_generation;
305 #endif
306
307 int ie_refresh;
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 int pipeline_max_prefetch;
344
345 int forward_max_tries;
346 int connect_retries;
347
348 class ACL *aclList;
349
350 struct {
351 acl_access *http;
352 acl_access *adapted_http;
353 acl_access *icp;
354 acl_access *miss;
355 acl_access *NeverDirect;
356 acl_access *AlwaysDirect;
357 acl_access *ASlists;
358 acl_access *noCache;
359 acl_access *sendHit;
360 acl_access *storeMiss;
361 acl_access *stats_collection;
362 #if SQUID_SNMP
363
364 acl_access *snmp;
365 #endif
366 #if USE_HTTP_VIOLATIONS
367 acl_access *brokenPosts;
368 #endif
369 acl_access *redirector;
370 acl_access *store_id;
371 acl_access *reply;
372 Acl::Address *outgoing_address;
373 #if USE_HTCP
374
375 acl_access *htcp;
376 acl_access *htcp_clr;
377 #endif
378
379 #if USE_OPENSSL
380 acl_access *ssl_bump;
381 #endif
382 #if FOLLOW_X_FORWARDED_FOR
383 acl_access *followXFF;
384 #endif /* FOLLOW_X_FORWARDED_FOR */
385
386 /// acceptible PROXY protocol clients
387 acl_access *proxyProtocol;
388
389 /// spoof_client_ip squid.conf acl.
390 /// nil unless configured
391 acl_access* spoof_client_ip;
392 acl_access *on_unsupported_protocol;
393
394 acl_access *ftp_epsv;
395
396 acl_access *forceRequestBodyContinuation;
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 ///note
466 Notes notes;
467 char *coredump_dir;
468 char *chroot_dir;
469 #if USE_CACHE_DIGESTS
470
471 struct {
472 int bits_per_entry;
473 time_t rebuild_period;
474 time_t rewrite_period;
475 size_t swapout_chunk_size;
476 int rebuild_chunk_percentage;
477 } digest;
478 #endif
479 #if USE_OPENSSL
480
481 struct {
482 int unclean_shutdown;
483 char *ssl_engine;
484 int session_ttl;
485 size_t sessionCacheSize;
486 char *certSignHash;
487 } SSL;
488 #endif
489
490 wordlist *ext_methods;
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::ContextPtr 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
540 extern SquidConfig Config;
541
542 class SquidConfig2
543 {
544 public:
545 struct {
546 int enable_purge;
547 int mangle_request_headers;
548 } onoff;
549 uid_t effectiveUserID;
550 gid_t effectiveGroupID;
551 };
552
553 extern SquidConfig2 Config2;
554
555 #endif /* SQUID_SQUIDCONFIG_H_ */
556