]> git.ipfire.org Git - thirdparty/squid.git/blob - src/SquidConfig.h
Merged from trunk (r12813).
[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_SSL
44 #include <openssl/ssl.h>
45 class sslproxy_cert_sign;
46 class sslproxy_cert_adapt;
47 #endif
48
49 namespace Mgr
50 {
51 class ActionPasswordList;
52 } // namespace Mgr
53 class CustomLog;
54 class CpuAffinityMap;
55 class external_acl;
56 class HeaderManglers;
57 class RefreshPattern;
58 class RemovalPolicySettings;
59 class SwapDir;
60
61 namespace AnyP
62 {
63 class PortCfg;
64 }
65
66 /// the representation of the configuration. POD.
67 class SquidConfig
68 {
69 public:
70 struct {
71 /* These should be for the Store::Root instance.
72 * this needs pluggable parsing to be done smoothly.
73 */
74 int highWaterMark;
75 int lowWaterMark;
76 } Swap;
77
78 YesNoNone memShared; ///< whether the memory cache is shared among workers
79 size_t memMaxSize;
80
81 struct {
82 int64_t min;
83 int pct;
84 int64_t max;
85 } quickAbort;
86 int64_t readAheadGap;
87 RemovalPolicySettings *replPolicy;
88 RemovalPolicySettings *memPolicy;
89 #if USE_HTTP_VIOLATIONS
90 time_t negativeTtl;
91 #endif
92 time_t maxStale;
93 time_t negativeDnsTtl;
94 time_t positiveDnsTtl;
95 time_t shutdownLifetime;
96 time_t backgroundPingRate;
97
98 struct {
99 time_t read;
100 time_t write;
101 time_t lifetime;
102 time_t connect;
103 time_t forward;
104 time_t peer_connect;
105 time_t request;
106 time_t clientIdlePconn;
107 time_t serverIdlePconn;
108 time_t siteSelect;
109 time_t deadPeer;
110 int icp_query; /* msec */
111 int icp_query_max; /* msec */
112 int icp_query_min; /* msec */
113 int mcast_icp_query; /* msec */
114
115 #if !USE_DNSHELPER
116 time_msec_t idns_retransmit;
117 time_msec_t idns_query;
118 #endif
119
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_SSL
143 AnyP::PortCfg *https;
144 #endif
145 } Sockaddr;
146 #if SQUID_SNMP
147
148 struct {
149 char *configFile;
150 char *agentInfo;
151 } Snmp;
152 #endif
153 #if USE_WCCP
154
155 struct {
156 Ip::Address router;
157 Ip::Address address;
158 int version;
159 } Wccp;
160 #endif
161 #if USE_WCCPv2
162
163 struct {
164 Ip::Address_list *router;
165 Ip::Address address;
166 int forwarding_method;
167 int return_method;
168 int assignment_method;
169 int weight;
170 int rebuildwait;
171 void *info;
172 } Wccp2;
173 #endif
174
175 #if USE_ICMP
176 IcmpConfig pinger;
177 #endif
178
179 char *as_whois_server;
180
181 struct {
182 char *store;
183 char *swap;
184 CustomLog *accesslogs;
185 #if ICAP_CLIENT
186 CustomLog *icaplogs;
187 #endif
188 int rotateNumber;
189 } Log;
190 char *adminEmail;
191 char *EmailFrom;
192 char *EmailProgram;
193 char *effectiveUser;
194 char *visible_appname_string;
195 char *effectiveGroup;
196
197 struct {
198 #if USE_DNSHELPER
199 char *dnsserver;
200 #endif
201
202 wordlist *redirect;
203 wordlist *store_id;
204 #if USE_UNLINKD
205
206 char *unlinkd;
207 #endif
208
209 char *diskd;
210 #if USE_SSL
211
212 char *ssl_password;
213 #endif
214
215 } Program;
216 #if USE_DNSHELPER
217 HelperChildConfig dnsChildren;
218 #endif
219
220 HelperChildConfig redirectChildren;
221 HelperChildConfig storeIdChildren;
222 time_t authenticateGCInterval;
223 time_t authenticateTTL;
224 time_t authenticateIpTTL;
225
226 struct {
227 char *surrogate_id;
228 } Accel;
229 char *appendDomain;
230 size_t appendDomainLen;
231 char *pidFilename;
232 char *netdbFilename;
233 char *mimeTablePathname;
234 char *etcHostsPath;
235 char *visibleHostname;
236 char *uniqueHostname;
237 wordlist *hostnameAliases;
238 char *errHtmlText;
239
240 struct {
241 char *host;
242 char *file;
243 time_t period;
244 unsigned short port;
245 } Announce;
246
247 struct {
248
249 Ip::Address udp_incoming;
250 Ip::Address udp_outgoing;
251 #if SQUID_SNMP
252 Ip::Address snmp_incoming;
253 Ip::Address snmp_outgoing;
254 #endif
255 /* FIXME INET6 : this should really be a CIDR value */
256 Ip::Address client_netmask;
257 } Addrs;
258 size_t tcpRcvBufsz;
259 size_t udpMaxHitObjsz;
260 wordlist *hierarchy_stoplist;
261 wordlist *mcast_group_list;
262 wordlist *dns_nameservers;
263 CachePeer *peers;
264 int npeers;
265
266 struct {
267 int size;
268 int low;
269 int high;
270 } ipcache;
271
272 struct {
273 int size;
274 } fqdncache;
275 int minDirectHops;
276 int minDirectRtt;
277 Mgr::ActionPasswordList *passwd_list;
278
279 struct {
280 int objectsPerBucket;
281 int64_t avgObjectSize;
282 int64_t maxObjectSize;
283 int64_t minObjectSize;
284 size_t maxInMemObjSize;
285 } Store;
286
287 struct {
288 int high;
289 int low;
290 time_t period;
291 } Netdb;
292
293 struct {
294 int log_udp;
295 int res_defnames;
296 int anonymizer;
297 int client_db;
298 int query_icmp;
299 int icp_hit_stale;
300 int buffered_logs;
301 int common_log;
302 int log_mime_hdrs;
303 int log_fqdn;
304 int announce;
305 int mem_pools;
306 int test_reachability;
307 int half_closed_clients;
308 int refresh_all_ims;
309 #if USE_HTTP_VIOLATIONS
310
311 int reload_into_ims;
312 #endif
313
314 int offline;
315 int redir_rewrites_host;
316 int prefer_direct;
317 int nonhierarchical_direct;
318 int strip_query_terms;
319 int redirector_bypass;
320 int store_id_bypass;
321 int ignore_unknown_nameservers;
322 int client_pconns;
323 int server_pconns;
324 int error_pconns;
325 #if USE_CACHE_DIGESTS
326
327 int digest_generation;
328 #endif
329
330 int ie_refresh;
331 int vary_ignore_expire;
332 int pipeline_prefetch;
333 int surrogate_is_remote;
334 int request_entities;
335 int detect_broken_server_pconns;
336 int balance_on_multiple_ip;
337 int relaxed_header_parser;
338 int check_hostnames;
339 int allow_underscore;
340 int via;
341 int emailErrData;
342 int httpd_suppress_version_string;
343 int global_internal_static;
344
345 #if FOLLOW_X_FORWARDED_FOR
346 int acl_uses_indirect_client;
347 int delay_pool_uses_indirect_client;
348 int log_uses_indirect_client;
349 #if LINUX_NETFILTER
350 int tproxy_uses_indirect_client;
351 #endif
352 #endif /* FOLLOW_X_FORWARDED_FOR */
353
354 int WIN32_IpAddrChangeMonitor;
355 int memory_cache_first;
356 int memory_cache_disk;
357 int hostStrictVerify;
358 int client_dst_passthru;
359 } onoff;
360
361 int forward_max_tries;
362 int connect_retries;
363
364 class ACL *aclList;
365
366 struct {
367 acl_access *http;
368 acl_access *adapted_http;
369 acl_access *icp;
370 acl_access *miss;
371 acl_access *NeverDirect;
372 acl_access *AlwaysDirect;
373 acl_access *ASlists;
374 acl_access *noCache;
375 acl_access *log;
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_SSL
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 #if ICAP_CLIENT
401 acl_access* icap;
402 #endif
403
404 /// spoof_client_ip squid.conf acl.
405 /// nil unless configured
406 acl_access* spoof_client_ip;
407 } accessList;
408 AclDenyInfoList *denyInfoList;
409
410 struct {
411 size_t list_width;
412 int list_wrap;
413 char *anon_user;
414 int passive;
415 int epsv_all;
416 int epsv;
417 int eprt;
418 int sanitycheck;
419 int telnet;
420 } Ftp;
421 RefreshPattern *Refresh;
422
423 struct _cacheSwap {
424 RefCount<SwapDir> *swapDirs;
425 int n_allocated;
426 int n_configured;
427 /// number of disk processes required to support all cache_dirs
428 int n_strands;
429 } cacheSwap;
430 /*
431 * I'm sick of having to keep doing this ..
432 */
433 #define INDEXSD(i) (Config.cacheSwap.swapDirs[(i)].getRaw())
434
435 struct {
436 char *directory;
437 int use_short_names;
438 } icons;
439 char *errorDirectory;
440 #if USE_ERR_LOCALES
441 char *errorDefaultLanguage;
442 int errorLogMissingLanguages;
443 #endif
444 char *errorStylesheet;
445
446 struct {
447 int onerror;
448 } retry;
449
450 struct {
451 int64_t limit;
452 } MemPools;
453 #if USE_DELAY_POOLS
454
455 DelayConfig Delay;
456 ClientDelayConfig ClientDelay;
457 #endif
458
459 struct {
460 struct {
461 int average;
462 int min_poll;
463 } dns, udp, tcp;
464 } comm_incoming;
465 int max_open_disk_fds;
466 int uri_whitespace;
467 AclSizeLimit *rangeOffsetLimit;
468 #if MULTICAST_MISS_STREAM
469
470 struct {
471
472 Ip::Address addr;
473 int ttl;
474 unsigned short port;
475 char *encode_key;
476 } mcast_miss;
477 #endif
478
479 /// request_header_access and request_header_replace
480 HeaderManglers *request_header_access;
481 /// reply_header_access and reply_header_replace
482 HeaderManglers *reply_header_access;
483 ///request_header_add access list
484 HeaderWithAclList *request_header_add;
485 ///note
486 Notes notes;
487 char *coredump_dir;
488 char *chroot_dir;
489 #if USE_CACHE_DIGESTS
490
491 struct {
492 int bits_per_entry;
493 time_t rebuild_period;
494 time_t rewrite_period;
495 size_t swapout_chunk_size;
496 int rebuild_chunk_percentage;
497 } digest;
498 #endif
499 #if USE_SSL
500
501 struct {
502 int unclean_shutdown;
503 char *ssl_engine;
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_SSL
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 struct {
551 int v4_first; ///< Place IPv4 first in the order of DNS results.
552 ssize_t packet_max; ///< maximum size EDNS advertised for DNS replies.
553 } dns;
554
555 };
556
557 extern SquidConfig Config;
558
559 class SquidConfig2
560 {
561 public:
562 struct {
563 int enable_purge;
564 int mangle_request_headers;
565 } onoff;
566 uid_t effectiveUserID;
567 gid_t effectiveGroupID;
568 };
569
570 extern SquidConfig2 Config2;
571
572 #endif /* SQUID_SQUIDCONFIG_H_ */