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