]>
Commit | Line | Data |
---|---|---|
4d5904f7 FC |
1 | #ifndef SQUID_SQUIDCONFIG_H_ |
2 | #define SQUID_SQUIDCONFIG_H_ | |
3 | /* | |
4d5904f7 FC |
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 | ||
0dc8ffa5 | 32 | #include "acl/AclAddress.h" |
8bf217bd | 33 | #include "base/RefCount.h" |
4d5904f7 FC |
34 | #include "ClientDelayConfig.h" |
35 | #include "DelayConfig.h" | |
c6983ec7 | 36 | #include "HelperChildConfig.h" |
4d5904f7 FC |
37 | #include "HttpHeaderTools.h" |
38 | #include "icmp/IcmpConfig.h" | |
39 | #include "ip/Address.h" | |
d7f4a0b7 | 40 | #include "Notes.h" |
bf35a4a7 | 41 | #include "YesNoNone.h" |
4d5904f7 | 42 | |
a011edee FC |
43 | #if USE_SSL |
44 | #include <openssl/ssl.h> | |
d9c7489e FC |
45 | class sslproxy_cert_sign; |
46 | class sslproxy_cert_adapt; | |
a011edee FC |
47 | #endif |
48 | ||
4d5904f7 | 49 | class acl_access; |
1328cfb7 | 50 | class AclSizeLimit; |
ee82937c | 51 | class AclDenyInfoList; |
e4a14600 A |
52 | namespace Mgr |
53 | { | |
613924ee FC |
54 | class ActionPasswordList; |
55 | } // namespace Mgr | |
56 | class CustomLog; | |
c6983ec7 | 57 | class CpuAffinityMap; |
613924ee | 58 | class external_acl; |
4d5904f7 | 59 | class HeaderManglers; |
8d9a8184 | 60 | class RefreshPattern; |
4d5904f7 | 61 | class RemovalPolicySettings; |
ee82937c | 62 | class SwapDir; |
4d5904f7 | 63 | |
e4a14600 A |
64 | namespace AnyP |
65 | { | |
4d5904f7 FC |
66 | class PortCfg; |
67 | } | |
68 | ||
001d55dc | 69 | /// the representation of the configuration. POD. |
1b2f0924 FC |
70 | class SquidConfig |
71 | { | |
4d5904f7 FC |
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 siteSelect; | |
112 | time_t deadPeer; | |
113 | int icp_query; /* msec */ | |
114 | int icp_query_max; /* msec */ | |
115 | int icp_query_min; /* msec */ | |
116 | int mcast_icp_query; /* msec */ | |
117 | ||
118 | #if !USE_DNSHELPER | |
119 | time_msec_t idns_retransmit; | |
120 | time_msec_t idns_query; | |
121 | #endif | |
122 | ||
123 | } Timeout; | |
124 | size_t maxRequestHeaderSize; | |
125 | int64_t maxRequestBodySize; | |
126 | int64_t maxChunkedRequestBodySize; | |
127 | size_t maxRequestBufferSize; | |
128 | size_t maxReplyHeaderSize; | |
1328cfb7 | 129 | AclSizeLimit *ReplyBodySize; |
4d5904f7 FC |
130 | |
131 | struct { | |
132 | unsigned short icp; | |
133 | #if USE_HTCP | |
134 | ||
135 | unsigned short htcp; | |
136 | #endif | |
137 | #if SQUID_SNMP | |
138 | ||
139 | unsigned short snmp; | |
140 | #endif | |
141 | } Port; | |
142 | ||
143 | struct { | |
144 | AnyP::PortCfg *http; | |
145 | #if USE_SSL | |
146 | AnyP::PortCfg *https; | |
147 | #endif | |
148 | } Sockaddr; | |
149 | #if SQUID_SNMP | |
150 | ||
151 | struct { | |
152 | char *configFile; | |
153 | char *agentInfo; | |
154 | } Snmp; | |
155 | #endif | |
156 | #if USE_WCCP | |
157 | ||
158 | struct { | |
159 | Ip::Address router; | |
160 | Ip::Address address; | |
161 | int version; | |
162 | } Wccp; | |
163 | #endif | |
164 | #if USE_WCCPv2 | |
165 | ||
166 | struct { | |
167 | Ip::Address_list *router; | |
168 | Ip::Address address; | |
169 | int forwarding_method; | |
170 | int return_method; | |
171 | int assignment_method; | |
172 | int weight; | |
173 | int rebuildwait; | |
174 | void *info; | |
175 | } Wccp2; | |
176 | #endif | |
177 | ||
178 | #if USE_ICMP | |
179 | IcmpConfig pinger; | |
180 | #endif | |
181 | ||
182 | char *as_whois_server; | |
183 | ||
184 | struct { | |
185 | char *store; | |
186 | char *swap; | |
87ddff6e | 187 | CustomLog *accesslogs; |
4d5904f7 | 188 | #if ICAP_CLIENT |
87ddff6e | 189 | CustomLog *icaplogs; |
4d5904f7 FC |
190 | #endif |
191 | int rotateNumber; | |
192 | } Log; | |
193 | char *adminEmail; | |
194 | char *EmailFrom; | |
195 | char *EmailProgram; | |
196 | char *effectiveUser; | |
197 | char *visible_appname_string; | |
198 | char *effectiveGroup; | |
199 | ||
200 | struct { | |
201 | #if USE_DNSHELPER | |
202 | char *dnsserver; | |
203 | #endif | |
204 | ||
205 | wordlist *redirect; | |
206 | #if USE_UNLINKD | |
207 | ||
208 | char *unlinkd; | |
209 | #endif | |
210 | ||
211 | char *diskd; | |
212 | #if USE_SSL | |
213 | ||
214 | char *ssl_password; | |
215 | #endif | |
216 | ||
217 | } Program; | |
218 | #if USE_DNSHELPER | |
219 | HelperChildConfig dnsChildren; | |
220 | #endif | |
221 | ||
222 | HelperChildConfig redirectChildren; | |
223 | time_t authenticateGCInterval; | |
224 | time_t authenticateTTL; | |
225 | time_t authenticateIpTTL; | |
226 | ||
227 | struct { | |
228 | char *surrogate_id; | |
229 | } Accel; | |
230 | char *appendDomain; | |
231 | size_t appendDomainLen; | |
232 | char *pidFilename; | |
233 | char *netdbFilename; | |
234 | char *mimeTablePathname; | |
235 | char *etcHostsPath; | |
236 | char *visibleHostname; | |
237 | char *uniqueHostname; | |
238 | wordlist *hostnameAliases; | |
239 | char *errHtmlText; | |
240 | ||
241 | struct { | |
242 | char *host; | |
243 | char *file; | |
244 | time_t period; | |
245 | unsigned short port; | |
246 | } Announce; | |
247 | ||
248 | struct { | |
249 | ||
250 | Ip::Address udp_incoming; | |
251 | Ip::Address udp_outgoing; | |
252 | #if SQUID_SNMP | |
253 | Ip::Address snmp_incoming; | |
254 | Ip::Address snmp_outgoing; | |
255 | #endif | |
256 | /* FIXME INET6 : this should really be a CIDR value */ | |
257 | Ip::Address client_netmask; | |
258 | } Addrs; | |
259 | size_t tcpRcvBufsz; | |
260 | size_t udpMaxHitObjsz; | |
261 | wordlist *hierarchy_stoplist; | |
262 | wordlist *mcast_group_list; | |
263 | wordlist *dns_nameservers; | |
a3c6762c | 264 | CachePeer *peers; |
4d5904f7 FC |
265 | int npeers; |
266 | ||
267 | struct { | |
268 | int size; | |
269 | int low; | |
270 | int high; | |
271 | } ipcache; | |
272 | ||
273 | struct { | |
274 | int size; | |
275 | } fqdncache; | |
276 | int minDirectHops; | |
277 | int minDirectRtt; | |
613924ee | 278 | Mgr::ActionPasswordList *passwd_list; |
4d5904f7 FC |
279 | |
280 | struct { | |
281 | int objectsPerBucket; | |
282 | int64_t avgObjectSize; | |
283 | int64_t maxObjectSize; | |
284 | int64_t minObjectSize; | |
285 | size_t maxInMemObjSize; | |
286 | } Store; | |
287 | ||
288 | struct { | |
289 | int high; | |
290 | int low; | |
291 | time_t period; | |
292 | } Netdb; | |
293 | ||
294 | struct { | |
295 | int log_udp; | |
296 | int res_defnames; | |
297 | int anonymizer; | |
298 | int client_db; | |
299 | int query_icmp; | |
300 | int icp_hit_stale; | |
301 | int buffered_logs; | |
302 | int common_log; | |
303 | int log_mime_hdrs; | |
304 | int log_fqdn; | |
305 | int announce; | |
306 | int mem_pools; | |
307 | int test_reachability; | |
308 | int half_closed_clients; | |
309 | int refresh_all_ims; | |
310 | #if USE_HTTP_VIOLATIONS | |
311 | ||
312 | int reload_into_ims; | |
313 | #endif | |
314 | ||
315 | int offline; | |
316 | int redir_rewrites_host; | |
317 | int prefer_direct; | |
318 | int nonhierarchical_direct; | |
319 | int strip_query_terms; | |
320 | int redirector_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 *reply; | |
0dc8ffa5 | 385 | AclAddress *outgoing_address; |
4d5904f7 FC |
386 | #if USE_HTCP |
387 | ||
388 | acl_access *htcp; | |
389 | acl_access *htcp_clr; | |
390 | #endif | |
391 | ||
392 | #if USE_SSL | |
393 | acl_access *ssl_bump; | |
394 | #endif | |
33b24cf0 | 395 | #if FOLLOW_X_FORWARDED_FOR |
4d5904f7 | 396 | acl_access *followXFF; |
33b24cf0 | 397 | #endif /* FOLLOW_X_FORWARDED_FOR */ |
4d5904f7 FC |
398 | |
399 | #if ICAP_CLIENT | |
400 | acl_access* icap; | |
401 | #endif | |
402 | } accessList; | |
7f0b3324 | 403 | AclDenyInfoList *denyInfoList; |
4d5904f7 FC |
404 | |
405 | struct { | |
406 | size_t list_width; | |
407 | int list_wrap; | |
408 | char *anon_user; | |
409 | int passive; | |
410 | int epsv_all; | |
411 | int epsv; | |
412 | int eprt; | |
413 | int sanitycheck; | |
414 | int telnet; | |
415 | } Ftp; | |
8d9a8184 | 416 | RefreshPattern *Refresh; |
4d5904f7 FC |
417 | |
418 | struct _cacheSwap { | |
419 | RefCount<SwapDir> *swapDirs; | |
420 | int n_allocated; | |
421 | int n_configured; | |
422 | /// number of disk processes required to support all cache_dirs | |
423 | int n_strands; | |
424 | } cacheSwap; | |
425 | /* | |
426 | * I'm sick of having to keep doing this .. | |
427 | */ | |
428 | #define INDEXSD(i) (Config.cacheSwap.swapDirs[(i)].getRaw()) | |
429 | ||
430 | struct { | |
431 | char *directory; | |
432 | int use_short_names; | |
433 | } icons; | |
434 | char *errorDirectory; | |
435 | #if USE_ERR_LOCALES | |
436 | char *errorDefaultLanguage; | |
437 | int errorLogMissingLanguages; | |
438 | #endif | |
439 | char *errorStylesheet; | |
440 | ||
441 | struct { | |
442 | int onerror; | |
443 | } retry; | |
444 | ||
445 | struct { | |
446 | int64_t limit; | |
447 | } MemPools; | |
448 | #if USE_DELAY_POOLS | |
449 | ||
450 | DelayConfig Delay; | |
451 | ClientDelayConfig ClientDelay; | |
452 | #endif | |
453 | ||
454 | struct { | |
455 | struct { | |
456 | int average; | |
457 | int min_poll; | |
458 | } dns, udp, tcp; | |
459 | } comm_incoming; | |
460 | int max_open_disk_fds; | |
461 | int uri_whitespace; | |
1328cfb7 | 462 | AclSizeLimit *rangeOffsetLimit; |
4d5904f7 FC |
463 | #if MULTICAST_MISS_STREAM |
464 | ||
465 | struct { | |
466 | ||
467 | Ip::Address addr; | |
468 | int ttl; | |
469 | unsigned short port; | |
470 | char *encode_key; | |
471 | } mcast_miss; | |
472 | #endif | |
473 | ||
474 | /// request_header_access and request_header_replace | |
475 | HeaderManglers *request_header_access; | |
476 | /// reply_header_access and reply_header_replace | |
477 | HeaderManglers *reply_header_access; | |
478 | ///request_header_add access list | |
479 | HeaderWithAclList *request_header_add; | |
d7f4a0b7 CT |
480 | ///note |
481 | Notes notes; | |
4d5904f7 FC |
482 | char *coredump_dir; |
483 | char *chroot_dir; | |
484 | #if USE_CACHE_DIGESTS | |
485 | ||
486 | struct { | |
487 | int bits_per_entry; | |
488 | time_t rebuild_period; | |
489 | time_t rewrite_period; | |
490 | size_t swapout_chunk_size; | |
491 | int rebuild_chunk_percentage; | |
492 | } digest; | |
493 | #endif | |
494 | #if USE_SSL | |
495 | ||
496 | struct { | |
497 | int unclean_shutdown; | |
498 | char *ssl_engine; | |
499 | } SSL; | |
500 | #endif | |
501 | ||
502 | wordlist *ext_methods; | |
503 | ||
504 | struct { | |
505 | int high_rptm; | |
506 | int high_pf; | |
507 | size_t high_memory; | |
508 | } warnings; | |
509 | char *store_dir_select_algorithm; | |
510 | int sleep_after_fork; /* microseconds */ | |
511 | time_t minimum_expiry_time; /* seconds */ | |
512 | external_acl *externalAclHelperList; | |
513 | ||
514 | #if USE_SSL | |
515 | ||
516 | struct { | |
517 | char *cert; | |
518 | char *key; | |
519 | int version; | |
520 | char *options; | |
521 | char *cipher; | |
522 | char *cafile; | |
523 | char *capath; | |
524 | char *crlfile; | |
525 | char *flags; | |
526 | acl_access *cert_error; | |
527 | SSL_CTX *sslContext; | |
528 | sslproxy_cert_sign *cert_sign; | |
529 | sslproxy_cert_adapt *cert_adapt; | |
530 | } ssl_client; | |
531 | #endif | |
532 | ||
533 | char *accept_filter; | |
534 | int umask; | |
535 | int max_filedescriptors; | |
536 | int workers; | |
537 | CpuAffinityMap *cpuAffinityMap; | |
538 | ||
539 | #if USE_LOADABLE_MODULES | |
540 | wordlist *loadable_module_names; | |
541 | #endif | |
542 | ||
543 | int client_ip_max_connections; | |
544 | ||
545 | struct { | |
546 | int v4_first; ///< Place IPv4 first in the order of DNS results. | |
547 | ssize_t packet_max; ///< maximum size EDNS advertised for DNS replies. | |
548 | } dns; | |
549 | ||
550 | }; | |
551 | ||
552 | extern SquidConfig Config; | |
553 | ||
5fed1735 AJ |
554 | class SquidConfig2 |
555 | { | |
556 | public: | |
7957fca1 FC |
557 | struct { |
558 | int enable_purge; | |
559 | int mangle_request_headers; | |
560 | } onoff; | |
561 | uid_t effectiveUserID; | |
562 | gid_t effectiveGroupID; | |
563 | }; | |
564 | ||
565 | extern SquidConfig2 Config2; | |
566 | ||
4d5904f7 | 567 | #endif /* SQUID_SQUIDCONFIG_H_ */ |