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