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