]> 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 cache_miss_revalidate;
330 int emailErrData;
331 int httpd_suppress_version_string;
332 int global_internal_static;
333
334 #if FOLLOW_X_FORWARDED_FOR
335 int acl_uses_indirect_client;
336 int delay_pool_uses_indirect_client;
337 int log_uses_indirect_client;
338 #if LINUX_NETFILTER
339 int tproxy_uses_indirect_client;
340 #endif
341 #endif /* FOLLOW_X_FORWARDED_FOR */
342
343 int WIN32_IpAddrChangeMonitor;
344 int memory_cache_first;
345 int memory_cache_disk;
346 int hostStrictVerify;
347 int client_dst_passthru;
348 int dns_mdns;
349 } onoff;
350
351 int pipeline_max_prefetch;
352
353 int forward_max_tries;
354 int connect_retries;
355
356 class ACL *aclList;
357
358 struct {
359 acl_access *http;
360 acl_access *adapted_http;
361 acl_access *icp;
362 acl_access *miss;
363 acl_access *NeverDirect;
364 acl_access *AlwaysDirect;
365 acl_access *ASlists;
366 acl_access *noCache;
367 acl_access *sendHit;
368 acl_access *storeMiss;
369 acl_access *stats_collection;
370 #if SQUID_SNMP
371
372 acl_access *snmp;
373 #endif
374 #if USE_HTTP_VIOLATIONS
375 acl_access *brokenPosts;
376 #endif
377 acl_access *redirector;
378 acl_access *store_id;
379 acl_access *reply;
380 AclAddress *outgoing_address;
381 #if USE_HTCP
382
383 acl_access *htcp;
384 acl_access *htcp_clr;
385 #endif
386
387 #if USE_SSL
388 acl_access *ssl_bump;
389 #endif
390 #if FOLLOW_X_FORWARDED_FOR
391 acl_access *followXFF;
392 #endif /* FOLLOW_X_FORWARDED_FOR */
393
394 /// spoof_client_ip squid.conf acl.
395 /// nil unless configured
396 acl_access* spoof_client_ip;
397 } accessList;
398 AclDenyInfoList *denyInfoList;
399
400 struct {
401 size_t list_width;
402 int list_wrap;
403 char *anon_user;
404 int passive;
405 int epsv_all;
406 int epsv;
407 int eprt;
408 int sanitycheck;
409 int telnet;
410 } Ftp;
411 RefreshPattern *Refresh;
412
413 struct _cacheSwap {
414 RefCount<SwapDir> *swapDirs;
415 int n_allocated;
416 int n_configured;
417 /// number of disk processes required to support all cache_dirs
418 int n_strands;
419 } cacheSwap;
420 /*
421 * I'm sick of having to keep doing this ..
422 */
423 #define INDEXSD(i) (Config.cacheSwap.swapDirs[(i)].getRaw())
424
425 struct {
426 char *directory;
427 int use_short_names;
428 } icons;
429 char *errorDirectory;
430 #if USE_ERR_LOCALES
431 char *errorDefaultLanguage;
432 int errorLogMissingLanguages;
433 #endif
434 char *errorStylesheet;
435
436 struct {
437 int onerror;
438 } retry;
439
440 struct {
441 int64_t limit;
442 } MemPools;
443 #if USE_DELAY_POOLS
444
445 DelayConfig Delay;
446 ClientDelayConfig ClientDelay;
447 #endif
448
449 struct {
450 struct {
451 int average;
452 int min_poll;
453 } dns, udp, tcp;
454 } comm_incoming;
455 int max_open_disk_fds;
456 int uri_whitespace;
457 AclSizeLimit *rangeOffsetLimit;
458 #if MULTICAST_MISS_STREAM
459
460 struct {
461
462 Ip::Address addr;
463 int ttl;
464 unsigned short port;
465 char *encode_key;
466 } mcast_miss;
467 #endif
468
469 /// request_header_access and request_header_replace
470 HeaderManglers *request_header_access;
471 /// reply_header_access and reply_header_replace
472 HeaderManglers *reply_header_access;
473 ///request_header_add access list
474 HeaderWithAclList *request_header_add;
475 ///note
476 Notes notes;
477 char *coredump_dir;
478 char *chroot_dir;
479 #if USE_CACHE_DIGESTS
480
481 struct {
482 int bits_per_entry;
483 time_t rebuild_period;
484 time_t rewrite_period;
485 size_t swapout_chunk_size;
486 int rebuild_chunk_percentage;
487 } digest;
488 #endif
489 #if USE_SSL
490
491 struct {
492 int unclean_shutdown;
493 char *ssl_engine;
494 } SSL;
495 #endif
496
497 wordlist *ext_methods;
498
499 struct {
500 int high_rptm;
501 int high_pf;
502 size_t high_memory;
503 } warnings;
504 char *store_dir_select_algorithm;
505 int sleep_after_fork; /* microseconds */
506 time_t minimum_expiry_time; /* seconds */
507 external_acl *externalAclHelperList;
508
509 #if USE_SSL
510
511 struct {
512 char *cert;
513 char *key;
514 int version;
515 char *options;
516 char *cipher;
517 char *cafile;
518 char *capath;
519 char *crlfile;
520 char *flags;
521 acl_access *cert_error;
522 SSL_CTX *sslContext;
523 sslproxy_cert_sign *cert_sign;
524 sslproxy_cert_adapt *cert_adapt;
525 } ssl_client;
526 #endif
527
528 char *accept_filter;
529 int umask;
530 int max_filedescriptors;
531 int workers;
532 CpuAffinityMap *cpuAffinityMap;
533
534 #if USE_LOADABLE_MODULES
535 wordlist *loadable_module_names;
536 #endif
537
538 int client_ip_max_connections;
539
540 struct {
541 int v4_first; ///< Place IPv4 first in the order of DNS results.
542 ssize_t packet_max; ///< maximum size EDNS advertised for DNS replies.
543 } dns;
544
545 };
546
547 extern SquidConfig Config;
548
549 class SquidConfig2
550 {
551 public:
552 struct {
553 int enable_purge;
554 int mangle_request_headers;
555 } onoff;
556 uid_t effectiveUserID;
557 gid_t effectiveGroupID;
558 };
559
560 extern SquidConfig2 Config2;
561
562 #endif /* SQUID_SQUIDCONFIG_H_ */