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