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