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