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