]> git.ipfire.org Git - thirdparty/squid.git/blob - src/SquidConfig.h
SourceLayout: shuffle HelperChildConfig into libhelper.la
[thirdparty/squid.git] / src / SquidConfig.h
1 /*
2 * Copyright (C) 1996-2014 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 siteSelect;
93 time_t deadPeer;
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 } Timeout;
101 size_t maxRequestHeaderSize;
102 int64_t maxRequestBodySize;
103 int64_t maxChunkedRequestBodySize;
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 #if USE_ICMP
150 IcmpConfig pinger;
151 #endif
152
153 char *as_whois_server;
154
155 struct {
156 char *store;
157 char *swap;
158 CustomLog *accesslogs;
159 #if ICAP_CLIENT
160 CustomLog *icaplogs;
161 #endif
162 int rotateNumber;
163 } Log;
164 char *adminEmail;
165 char *EmailFrom;
166 char *EmailProgram;
167 char *effectiveUser;
168 char *visible_appname_string;
169 char *effectiveGroup;
170
171 struct {
172 wordlist *redirect;
173 wordlist *store_id;
174 #if USE_UNLINKD
175
176 char *unlinkd;
177 #endif
178
179 char *diskd;
180 #if USE_OPENSSL
181
182 char *ssl_password;
183 #endif
184
185 } Program;
186
187 Helper::ChildConfig redirectChildren;
188 Helper::ChildConfig storeIdChildren;
189 time_t authenticateGCInterval;
190 time_t authenticateTTL;
191 time_t authenticateIpTTL;
192
193 struct {
194 char *surrogate_id;
195 } Accel;
196 char *appendDomain;
197 size_t appendDomainLen;
198 char *pidFilename;
199 char *netdbFilename;
200 char *mimeTablePathname;
201 char *etcHostsPath;
202 char *visibleHostname;
203 char *uniqueHostname;
204 wordlist *hostnameAliases;
205 char *errHtmlText;
206
207 struct {
208 char *host;
209 char *file;
210 time_t period;
211 unsigned short port;
212 } Announce;
213
214 struct {
215
216 Ip::Address udp_incoming;
217 Ip::Address udp_outgoing;
218 #if SQUID_SNMP
219 Ip::Address snmp_incoming;
220 Ip::Address snmp_outgoing;
221 #endif
222 /* FIXME INET6 : this should really be a CIDR value */
223 Ip::Address client_netmask;
224 } Addrs;
225 size_t tcpRcvBufsz;
226 size_t udpMaxHitObjsz;
227 wordlist *mcast_group_list;
228 wordlist *dns_nameservers;
229 CachePeer *peers;
230 int npeers;
231
232 struct {
233 int size;
234 int low;
235 int high;
236 } ipcache;
237
238 struct {
239 int size;
240 } fqdncache;
241 int minDirectHops;
242 int minDirectRtt;
243 Mgr::ActionPasswordList *passwd_list;
244
245 struct {
246 int objectsPerBucket;
247 int64_t avgObjectSize;
248 int64_t maxObjectSize;
249 int64_t minObjectSize;
250 size_t maxInMemObjSize;
251 } Store;
252
253 struct {
254 int high;
255 int low;
256 time_t period;
257 } Netdb;
258
259 struct {
260 int log_udp;
261 int res_defnames;
262 int anonymizer;
263 int client_db;
264 int query_icmp;
265 int icp_hit_stale;
266 int buffered_logs;
267 int common_log;
268 int log_mime_hdrs;
269 int log_fqdn;
270 int announce;
271 int mem_pools;
272 int test_reachability;
273 int half_closed_clients;
274 int refresh_all_ims;
275 #if USE_HTTP_VIOLATIONS
276
277 int reload_into_ims;
278 #endif
279
280 int offline;
281 int redir_rewrites_host;
282 int prefer_direct;
283 int nonhierarchical_direct;
284 int strip_query_terms;
285 int redirector_bypass;
286 int store_id_bypass;
287 int ignore_unknown_nameservers;
288 int client_pconns;
289 int server_pconns;
290 int error_pconns;
291 #if USE_CACHE_DIGESTS
292
293 int digest_generation;
294 #endif
295
296 int ie_refresh;
297 int vary_ignore_expire;
298 int surrogate_is_remote;
299 int request_entities;
300 int detect_broken_server_pconns;
301 int balance_on_multiple_ip;
302 int relaxed_header_parser;
303 int check_hostnames;
304 int allow_underscore;
305 int via;
306 int cache_miss_revalidate;
307 int emailErrData;
308 int httpd_suppress_version_string;
309 int global_internal_static;
310 int collapsed_forwarding;
311
312 #if FOLLOW_X_FORWARDED_FOR
313 int acl_uses_indirect_client;
314 int delay_pool_uses_indirect_client;
315 int log_uses_indirect_client;
316 #if LINUX_NETFILTER
317 int tproxy_uses_indirect_client;
318 #endif
319 #endif /* FOLLOW_X_FORWARDED_FOR */
320
321 int WIN32_IpAddrChangeMonitor;
322 int memory_cache_first;
323 int memory_cache_disk;
324 int hostStrictVerify;
325 int client_dst_passthru;
326 int dns_mdns;
327 } onoff;
328
329 int pipeline_max_prefetch;
330
331 int forward_max_tries;
332 int connect_retries;
333
334 class ACL *aclList;
335
336 struct {
337 acl_access *http;
338 acl_access *adapted_http;
339 acl_access *icp;
340 acl_access *miss;
341 acl_access *NeverDirect;
342 acl_access *AlwaysDirect;
343 acl_access *ASlists;
344 acl_access *noCache;
345 acl_access *sendHit;
346 acl_access *storeMiss;
347 acl_access *stats_collection;
348 #if SQUID_SNMP
349
350 acl_access *snmp;
351 #endif
352 #if USE_HTTP_VIOLATIONS
353 acl_access *brokenPosts;
354 #endif
355 acl_access *redirector;
356 acl_access *store_id;
357 acl_access *reply;
358 AclAddress *outgoing_address;
359 #if USE_HTCP
360
361 acl_access *htcp;
362 acl_access *htcp_clr;
363 #endif
364
365 #if USE_OPENSSL
366 acl_access *ssl_bump;
367 #endif
368 #if FOLLOW_X_FORWARDED_FOR
369 acl_access *followXFF;
370 #endif /* FOLLOW_X_FORWARDED_FOR */
371
372 /// acceptible PROXY protocol clients
373 acl_access *proxyProtocol;
374
375 /// spoof_client_ip squid.conf acl.
376 /// nil unless configured
377 acl_access* spoof_client_ip;
378
379 acl_access *ftp_epsv;
380 } accessList;
381 AclDenyInfoList *denyInfoList;
382
383 struct {
384 size_t list_width;
385 int list_wrap;
386 char *anon_user;
387 int passive;
388 int epsv_all;
389 int epsv;
390 int eprt;
391 int sanitycheck;
392 int telnet;
393 } Ftp;
394 RefreshPattern *Refresh;
395
396 struct _cacheSwap {
397 RefCount<SwapDir> *swapDirs;
398 int n_allocated;
399 int n_configured;
400 /// number of disk processes required to support all cache_dirs
401 int n_strands;
402 } cacheSwap;
403 /*
404 * I'm sick of having to keep doing this ..
405 */
406 #define INDEXSD(i) (Config.cacheSwap.swapDirs[(i)].getRaw())
407
408 struct {
409 char *directory;
410 int use_short_names;
411 } icons;
412 char *errorDirectory;
413 #if USE_ERR_LOCALES
414 char *errorDefaultLanguage;
415 int errorLogMissingLanguages;
416 #endif
417 char *errorStylesheet;
418
419 struct {
420 int onerror;
421 } retry;
422
423 struct {
424 int64_t limit;
425 } MemPools;
426 #if USE_DELAY_POOLS
427
428 DelayConfig Delay;
429 ClientDelayConfig ClientDelay;
430 #endif
431
432 struct {
433 struct {
434 int average;
435 int min_poll;
436 } dns, udp, tcp;
437 } comm_incoming;
438 int max_open_disk_fds;
439 int uri_whitespace;
440 AclSizeLimit *rangeOffsetLimit;
441 #if MULTICAST_MISS_STREAM
442
443 struct {
444
445 Ip::Address addr;
446 int ttl;
447 unsigned short port;
448 char *encode_key;
449 } mcast_miss;
450 #endif
451
452 /// request_header_access and request_header_replace
453 HeaderManglers *request_header_access;
454 /// reply_header_access and reply_header_replace
455 HeaderManglers *reply_header_access;
456 ///request_header_add access list
457 HeaderWithAclList *request_header_add;
458 ///note
459 Notes notes;
460 char *coredump_dir;
461 char *chroot_dir;
462 #if USE_CACHE_DIGESTS
463
464 struct {
465 int bits_per_entry;
466 time_t rebuild_period;
467 time_t rewrite_period;
468 size_t swapout_chunk_size;
469 int rebuild_chunk_percentage;
470 } digest;
471 #endif
472 #if USE_OPENSSL
473
474 struct {
475 int unclean_shutdown;
476 char *ssl_engine;
477 int session_ttl;
478 size_t sessionCacheSize;
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 #if USE_OPENSSL
495
496 struct {
497 char *cert;
498 char *key;
499 int version;
500 char *options;
501 char *cipher;
502 char *cafile;
503 char *capath;
504 char *crlfile;
505 char *flags;
506 acl_access *cert_error;
507 SSL_CTX *sslContext;
508 sslproxy_cert_sign *cert_sign;
509 sslproxy_cert_adapt *cert_adapt;
510 } ssl_client;
511 #endif
512
513 char *accept_filter;
514 int umask;
515 int max_filedescriptors;
516 int workers;
517 CpuAffinityMap *cpuAffinityMap;
518
519 #if USE_LOADABLE_MODULES
520 wordlist *loadable_module_names;
521 #endif
522
523 int client_ip_max_connections;
524
525 char *redirector_extras;
526
527 char *storeId_extras;
528
529 struct {
530 int v4_first; ///< Place IPv4 first in the order of DNS results.
531 ssize_t packet_max; ///< maximum size EDNS advertised for DNS replies.
532 } dns;
533
534 };
535
536 extern SquidConfig Config;
537
538 class SquidConfig2
539 {
540 public:
541 struct {
542 int enable_purge;
543 int mangle_request_headers;
544 } onoff;
545 uid_t effectiveUserID;
546 gid_t effectiveGroupID;
547 };
548
549 extern SquidConfig2 Config2;
550
551 #endif /* SQUID_SQUIDCONFIG_H_ */