]>
Commit | Line | Data |
---|---|---|
4d5904f7 | 1 | /* |
bde978a6 | 2 | * Copyright (C) 1996-2015 The Squid Software Foundation and contributors |
4d5904f7 | 3 | * |
bbc27441 AJ |
4 | * Squid software is distributed under GPLv2+ license and includes |
5 | * contributions from numerous individuals and organizations. | |
6 | * Please see the COPYING and CONTRIBUTORS files for details. | |
4d5904f7 FC |
7 | */ |
8 | ||
bbc27441 AJ |
9 | #ifndef SQUID_SQUIDCONFIG_H_ |
10 | #define SQUID_SQUIDCONFIG_H_ | |
11 | ||
6f58d7d7 | 12 | #include "acl/forward.h" |
8bf217bd | 13 | #include "base/RefCount.h" |
4d5904f7 FC |
14 | #include "ClientDelayConfig.h" |
15 | #include "DelayConfig.h" | |
76d9b994 | 16 | #include "helper/ChildConfig.h" |
4d5904f7 | 17 | #include "HttpHeaderTools.h" |
4d5904f7 | 18 | #include "ip/Address.h" |
d7f4a0b7 | 19 | #include "Notes.h" |
a465e144 | 20 | #include "security/forward.h" |
6ebc477d | 21 | #include "SquidTime.h" |
bf35a4a7 | 22 | #include "YesNoNone.h" |
4d5904f7 | 23 | |
cb4f4424 | 24 | #if USE_OPENSSL |
d9c7489e FC |
25 | class sslproxy_cert_sign; |
26 | class sslproxy_cert_adapt; | |
a011edee FC |
27 | #endif |
28 | ||
e4a14600 A |
29 | namespace Mgr |
30 | { | |
613924ee FC |
31 | class ActionPasswordList; |
32 | } // namespace Mgr | |
7a5b5df7 | 33 | class CachePeer; |
613924ee | 34 | class CustomLog; |
c6983ec7 | 35 | class CpuAffinityMap; |
613924ee | 36 | class external_acl; |
4d5904f7 | 37 | class HeaderManglers; |
8d9a8184 | 38 | class RefreshPattern; |
4d5904f7 | 39 | class RemovalPolicySettings; |
ee82937c | 40 | class SwapDir; |
4d5904f7 | 41 | |
e4a14600 A |
42 | namespace AnyP |
43 | { | |
4d5904f7 FC |
44 | class PortCfg; |
45 | } | |
46 | ||
001d55dc | 47 | /// the representation of the configuration. POD. |
1b2f0924 FC |
48 | class SquidConfig |
49 | { | |
4d5904f7 FC |
50 | public: |
51 | struct { | |
52 | /* These should be for the Store::Root instance. | |
53 | * this needs pluggable parsing to be done smoothly. | |
54 | */ | |
55 | int highWaterMark; | |
56 | int lowWaterMark; | |
57 | } Swap; | |
58 | ||
59 | YesNoNone memShared; ///< whether the memory cache is shared among workers | |
60 | size_t memMaxSize; | |
61 | ||
62 | struct { | |
63 | int64_t min; | |
64 | int pct; | |
65 | int64_t max; | |
66 | } quickAbort; | |
67 | int64_t readAheadGap; | |
68 | RemovalPolicySettings *replPolicy; | |
69 | RemovalPolicySettings *memPolicy; | |
70 | #if USE_HTTP_VIOLATIONS | |
71 | time_t negativeTtl; | |
72 | #endif | |
73 | time_t maxStale; | |
74 | time_t negativeDnsTtl; | |
75 | time_t positiveDnsTtl; | |
76 | time_t shutdownLifetime; | |
77 | time_t backgroundPingRate; | |
78 | ||
79 | struct { | |
80 | time_t read; | |
81 | time_t write; | |
82 | time_t lifetime; | |
83 | time_t connect; | |
84 | time_t forward; | |
85 | time_t peer_connect; | |
86 | time_t request; | |
87 | time_t clientIdlePconn; | |
88 | time_t serverIdlePconn; | |
f6e8754a | 89 | time_t ftpClientIdle; |
c5c06f02 | 90 | time_t pconnLifetime; ///< pconn_lifetime in squid.conf |
4d5904f7 FC |
91 | time_t siteSelect; |
92 | time_t deadPeer; | |
3248e962 | 93 | time_t request_start_timeout; |
4d5904f7 FC |
94 | int icp_query; /* msec */ |
95 | int icp_query_max; /* msec */ | |
96 | int icp_query_min; /* msec */ | |
97 | int mcast_icp_query; /* msec */ | |
4d5904f7 FC |
98 | time_msec_t idns_retransmit; |
99 | time_msec_t idns_query; | |
32fd6d8a | 100 | time_t urlRewrite; |
4d5904f7 FC |
101 | } Timeout; |
102 | size_t maxRequestHeaderSize; | |
103 | int64_t maxRequestBodySize; | |
4d5904f7 FC |
104 | size_t maxRequestBufferSize; |
105 | size_t maxReplyHeaderSize; | |
1328cfb7 | 106 | AclSizeLimit *ReplyBodySize; |
4d5904f7 FC |
107 | |
108 | struct { | |
109 | unsigned short icp; | |
110 | #if USE_HTCP | |
111 | ||
112 | unsigned short htcp; | |
113 | #endif | |
114 | #if SQUID_SNMP | |
115 | ||
116 | unsigned short snmp; | |
117 | #endif | |
118 | } Port; | |
119 | ||
4d5904f7 FC |
120 | #if SQUID_SNMP |
121 | ||
122 | struct { | |
123 | char *configFile; | |
124 | char *agentInfo; | |
125 | } Snmp; | |
126 | #endif | |
127 | #if USE_WCCP | |
128 | ||
129 | struct { | |
130 | Ip::Address router; | |
131 | Ip::Address address; | |
132 | int version; | |
133 | } Wccp; | |
134 | #endif | |
135 | #if USE_WCCPv2 | |
136 | ||
137 | struct { | |
138 | Ip::Address_list *router; | |
139 | Ip::Address address; | |
140 | int forwarding_method; | |
141 | int return_method; | |
142 | int assignment_method; | |
143 | int weight; | |
144 | int rebuildwait; | |
145 | void *info; | |
146 | } Wccp2; | |
147 | #endif | |
148 | ||
4d5904f7 FC |
149 | char *as_whois_server; |
150 | ||
151 | struct { | |
152 | char *store; | |
153 | char *swap; | |
87ddff6e | 154 | CustomLog *accesslogs; |
4d5904f7 | 155 | #if ICAP_CLIENT |
87ddff6e | 156 | CustomLog *icaplogs; |
4d5904f7 FC |
157 | #endif |
158 | int rotateNumber; | |
159 | } Log; | |
160 | char *adminEmail; | |
161 | char *EmailFrom; | |
162 | char *EmailProgram; | |
163 | char *effectiveUser; | |
164 | char *visible_appname_string; | |
165 | char *effectiveGroup; | |
166 | ||
167 | struct { | |
4d5904f7 | 168 | wordlist *redirect; |
a8a0b1c2 | 169 | wordlist *store_id; |
4d5904f7 FC |
170 | #if USE_UNLINKD |
171 | ||
172 | char *unlinkd; | |
173 | #endif | |
174 | ||
175 | char *diskd; | |
cb4f4424 | 176 | #if USE_OPENSSL |
4d5904f7 FC |
177 | |
178 | char *ssl_password; | |
179 | #endif | |
180 | ||
181 | } Program; | |
4d5904f7 | 182 | |
76d9b994 AJ |
183 | Helper::ChildConfig redirectChildren; |
184 | Helper::ChildConfig storeIdChildren; | |
4d5904f7 FC |
185 | time_t authenticateGCInterval; |
186 | time_t authenticateTTL; | |
187 | time_t authenticateIpTTL; | |
188 | ||
189 | struct { | |
190 | char *surrogate_id; | |
191 | } Accel; | |
192 | char *appendDomain; | |
193 | size_t appendDomainLen; | |
194 | char *pidFilename; | |
195 | char *netdbFilename; | |
196 | char *mimeTablePathname; | |
197 | char *etcHostsPath; | |
198 | char *visibleHostname; | |
199 | char *uniqueHostname; | |
200 | wordlist *hostnameAliases; | |
201 | char *errHtmlText; | |
202 | ||
203 | struct { | |
204 | char *host; | |
205 | char *file; | |
206 | time_t period; | |
207 | unsigned short port; | |
208 | } Announce; | |
209 | ||
210 | struct { | |
211 | ||
212 | Ip::Address udp_incoming; | |
213 | Ip::Address udp_outgoing; | |
214 | #if SQUID_SNMP | |
215 | Ip::Address snmp_incoming; | |
216 | Ip::Address snmp_outgoing; | |
217 | #endif | |
218 | /* FIXME INET6 : this should really be a CIDR value */ | |
219 | Ip::Address client_netmask; | |
220 | } Addrs; | |
221 | size_t tcpRcvBufsz; | |
222 | size_t udpMaxHitObjsz; | |
4d5904f7 FC |
223 | wordlist *mcast_group_list; |
224 | wordlist *dns_nameservers; | |
a3c6762c | 225 | CachePeer *peers; |
4d5904f7 FC |
226 | int npeers; |
227 | ||
228 | struct { | |
229 | int size; | |
230 | int low; | |
231 | int high; | |
232 | } ipcache; | |
233 | ||
234 | struct { | |
235 | int size; | |
236 | } fqdncache; | |
237 | int minDirectHops; | |
238 | int minDirectRtt; | |
613924ee | 239 | Mgr::ActionPasswordList *passwd_list; |
4d5904f7 FC |
240 | |
241 | struct { | |
242 | int objectsPerBucket; | |
243 | int64_t avgObjectSize; | |
244 | int64_t maxObjectSize; | |
245 | int64_t minObjectSize; | |
246 | size_t maxInMemObjSize; | |
247 | } Store; | |
248 | ||
249 | struct { | |
250 | int high; | |
251 | int low; | |
252 | time_t period; | |
253 | } Netdb; | |
254 | ||
255 | struct { | |
256 | int log_udp; | |
257 | int res_defnames; | |
258 | int anonymizer; | |
259 | int client_db; | |
260 | int query_icmp; | |
261 | int icp_hit_stale; | |
262 | int buffered_logs; | |
263 | int common_log; | |
264 | int log_mime_hdrs; | |
265 | int log_fqdn; | |
266 | int announce; | |
267 | int mem_pools; | |
268 | int test_reachability; | |
269 | int half_closed_clients; | |
270 | int refresh_all_ims; | |
271 | #if USE_HTTP_VIOLATIONS | |
272 | ||
273 | int reload_into_ims; | |
274 | #endif | |
275 | ||
276 | int offline; | |
277 | int redir_rewrites_host; | |
278 | int prefer_direct; | |
279 | int nonhierarchical_direct; | |
280 | int strip_query_terms; | |
281 | int redirector_bypass; | |
a8a0b1c2 | 282 | int store_id_bypass; |
4d5904f7 FC |
283 | int ignore_unknown_nameservers; |
284 | int client_pconns; | |
285 | int server_pconns; | |
286 | int error_pconns; | |
287 | #if USE_CACHE_DIGESTS | |
288 | ||
289 | int digest_generation; | |
290 | #endif | |
291 | ||
292 | int ie_refresh; | |
293 | int vary_ignore_expire; | |
4d5904f7 FC |
294 | int surrogate_is_remote; |
295 | int request_entities; | |
296 | int detect_broken_server_pconns; | |
297 | int balance_on_multiple_ip; | |
298 | int relaxed_header_parser; | |
299 | int check_hostnames; | |
300 | int allow_underscore; | |
301 | int via; | |
96598f93 | 302 | int cache_miss_revalidate; |
4d5904f7 FC |
303 | int emailErrData; |
304 | int httpd_suppress_version_string; | |
305 | int global_internal_static; | |
55eae904 | 306 | int collapsed_forwarding; |
4d5904f7 FC |
307 | |
308 | #if FOLLOW_X_FORWARDED_FOR | |
309 | int acl_uses_indirect_client; | |
310 | int delay_pool_uses_indirect_client; | |
311 | int log_uses_indirect_client; | |
312 | #if LINUX_NETFILTER | |
313 | int tproxy_uses_indirect_client; | |
314 | #endif | |
315 | #endif /* FOLLOW_X_FORWARDED_FOR */ | |
316 | ||
317 | int WIN32_IpAddrChangeMonitor; | |
318 | int memory_cache_first; | |
319 | int memory_cache_disk; | |
320 | int hostStrictVerify; | |
321 | int client_dst_passthru; | |
bce61b00 | 322 | int dns_mdns; |
4d5904f7 FC |
323 | } onoff; |
324 | ||
079a8480 AJ |
325 | int pipeline_max_prefetch; |
326 | ||
4d5904f7 FC |
327 | int forward_max_tries; |
328 | int connect_retries; | |
329 | ||
330 | class ACL *aclList; | |
331 | ||
332 | struct { | |
333 | acl_access *http; | |
334 | acl_access *adapted_http; | |
335 | acl_access *icp; | |
336 | acl_access *miss; | |
337 | acl_access *NeverDirect; | |
338 | acl_access *AlwaysDirect; | |
339 | acl_access *ASlists; | |
340 | acl_access *noCache; | |
70706149 AR |
341 | acl_access *sendHit; |
342 | acl_access *storeMiss; | |
8ebad780 | 343 | acl_access *stats_collection; |
4d5904f7 FC |
344 | #if SQUID_SNMP |
345 | ||
346 | acl_access *snmp; | |
347 | #endif | |
348 | #if USE_HTTP_VIOLATIONS | |
349 | acl_access *brokenPosts; | |
350 | #endif | |
351 | acl_access *redirector; | |
a8a0b1c2 | 352 | acl_access *store_id; |
4d5904f7 | 353 | acl_access *reply; |
289848ca | 354 | Acl::Address *outgoing_address; |
4d5904f7 FC |
355 | #if USE_HTCP |
356 | ||
357 | acl_access *htcp; | |
358 | acl_access *htcp_clr; | |
359 | #endif | |
360 | ||
cb4f4424 | 361 | #if USE_OPENSSL |
4d5904f7 FC |
362 | acl_access *ssl_bump; |
363 | #endif | |
33b24cf0 | 364 | #if FOLLOW_X_FORWARDED_FOR |
4d5904f7 | 365 | acl_access *followXFF; |
33b24cf0 | 366 | #endif /* FOLLOW_X_FORWARDED_FOR */ |
4d5904f7 | 367 | |
d3d92daa AJ |
368 | /// acceptible PROXY protocol clients |
369 | acl_access *proxyProtocol; | |
370 | ||
0d901ef4 SH |
371 | /// spoof_client_ip squid.conf acl. |
372 | /// nil unless configured | |
373 | acl_access* spoof_client_ip; | |
3248e962 | 374 | acl_access *on_unsupported_protocol; |
ddf5aa2b CT |
375 | |
376 | acl_access *ftp_epsv; | |
ec69bdb2 CT |
377 | |
378 | acl_access *forceRequestBodyContinuation; | |
4d5904f7 | 379 | } accessList; |
7f0b3324 | 380 | AclDenyInfoList *denyInfoList; |
4d5904f7 FC |
381 | |
382 | struct { | |
383 | size_t list_width; | |
384 | int list_wrap; | |
385 | char *anon_user; | |
386 | int passive; | |
387 | int epsv_all; | |
388 | int epsv; | |
389 | int eprt; | |
390 | int sanitycheck; | |
391 | int telnet; | |
392 | } Ftp; | |
8d9a8184 | 393 | RefreshPattern *Refresh; |
4d5904f7 FC |
394 | |
395 | struct _cacheSwap { | |
396 | RefCount<SwapDir> *swapDirs; | |
397 | int n_allocated; | |
398 | int n_configured; | |
399 | /// number of disk processes required to support all cache_dirs | |
400 | int n_strands; | |
401 | } cacheSwap; | |
402 | /* | |
403 | * I'm sick of having to keep doing this .. | |
404 | */ | |
405 | #define INDEXSD(i) (Config.cacheSwap.swapDirs[(i)].getRaw()) | |
406 | ||
407 | struct { | |
408 | char *directory; | |
409 | int use_short_names; | |
410 | } icons; | |
411 | char *errorDirectory; | |
412 | #if USE_ERR_LOCALES | |
413 | char *errorDefaultLanguage; | |
414 | int errorLogMissingLanguages; | |
415 | #endif | |
416 | char *errorStylesheet; | |
417 | ||
418 | struct { | |
419 | int onerror; | |
420 | } retry; | |
421 | ||
422 | struct { | |
423 | int64_t limit; | |
424 | } MemPools; | |
425 | #if USE_DELAY_POOLS | |
426 | ||
427 | DelayConfig Delay; | |
428 | ClientDelayConfig ClientDelay; | |
429 | #endif | |
430 | ||
431 | struct { | |
432 | struct { | |
433 | int average; | |
434 | int min_poll; | |
435 | } dns, udp, tcp; | |
436 | } comm_incoming; | |
437 | int max_open_disk_fds; | |
438 | int uri_whitespace; | |
1328cfb7 | 439 | AclSizeLimit *rangeOffsetLimit; |
4d5904f7 FC |
440 | #if MULTICAST_MISS_STREAM |
441 | ||
442 | struct { | |
443 | ||
444 | Ip::Address addr; | |
445 | int ttl; | |
446 | unsigned short port; | |
447 | char *encode_key; | |
448 | } mcast_miss; | |
449 | #endif | |
450 | ||
451 | /// request_header_access and request_header_replace | |
452 | HeaderManglers *request_header_access; | |
453 | /// reply_header_access and reply_header_replace | |
454 | HeaderManglers *reply_header_access; | |
455 | ///request_header_add access list | |
456 | HeaderWithAclList *request_header_add; | |
d7f4a0b7 CT |
457 | ///note |
458 | Notes notes; | |
4d5904f7 FC |
459 | char *coredump_dir; |
460 | char *chroot_dir; | |
461 | #if USE_CACHE_DIGESTS | |
462 | ||
463 | struct { | |
464 | int bits_per_entry; | |
465 | time_t rebuild_period; | |
466 | time_t rewrite_period; | |
467 | size_t swapout_chunk_size; | |
468 | int rebuild_chunk_percentage; | |
469 | } digest; | |
470 | #endif | |
cb4f4424 | 471 | #if USE_OPENSSL |
4d5904f7 FC |
472 | |
473 | struct { | |
474 | int unclean_shutdown; | |
475 | char *ssl_engine; | |
10a69fc0 CT |
476 | int session_ttl; |
477 | size_t sessionCacheSize; | |
3c26b00a | 478 | char *certSignHash; |
4d5904f7 FC |
479 | } SSL; |
480 | #endif | |
481 | ||
482 | wordlist *ext_methods; | |
483 | ||
484 | struct { | |
485 | int high_rptm; | |
486 | int high_pf; | |
487 | size_t high_memory; | |
488 | } warnings; | |
489 | char *store_dir_select_algorithm; | |
490 | int sleep_after_fork; /* microseconds */ | |
491 | time_t minimum_expiry_time; /* seconds */ | |
492 | external_acl *externalAclHelperList; | |
493 | ||
4d5904f7 | 494 | struct { |
a465e144 AJ |
495 | Security::ContextPointer sslContext; |
496 | #if USE_OPENSSL | |
4d5904f7 | 497 | acl_access *cert_error; |
4d5904f7 FC |
498 | sslproxy_cert_sign *cert_sign; |
499 | sslproxy_cert_adapt *cert_adapt; | |
4d5904f7 | 500 | #endif |
a465e144 | 501 | } ssl_client; |
4d5904f7 FC |
502 | |
503 | char *accept_filter; | |
504 | int umask; | |
505 | int max_filedescriptors; | |
506 | int workers; | |
507 | CpuAffinityMap *cpuAffinityMap; | |
508 | ||
509 | #if USE_LOADABLE_MODULES | |
510 | wordlist *loadable_module_names; | |
511 | #endif | |
512 | ||
513 | int client_ip_max_connections; | |
514 | ||
b11724bb CT |
515 | char *redirector_extras; |
516 | ||
ced8def3 | 517 | struct UrlHelperTimeout { |
32fd6d8a CT |
518 | int action; |
519 | char *response; | |
520 | } onUrlRewriteTimeout; | |
521 | ||
b11724bb CT |
522 | char *storeId_extras; |
523 | ||
4d5904f7 FC |
524 | struct { |
525 | int v4_first; ///< Place IPv4 first in the order of DNS results. | |
526 | ssize_t packet_max; ///< maximum size EDNS advertised for DNS replies. | |
527 | } dns; | |
528 | ||
529 | }; | |
530 | ||
531 | extern SquidConfig Config; | |
532 | ||
5fed1735 AJ |
533 | class SquidConfig2 |
534 | { | |
535 | public: | |
7957fca1 FC |
536 | struct { |
537 | int enable_purge; | |
538 | int mangle_request_headers; | |
539 | } onoff; | |
540 | uid_t effectiveUserID; | |
541 | gid_t effectiveGroupID; | |
542 | }; | |
543 | ||
544 | extern SquidConfig2 Config2; | |
545 | ||
4d5904f7 | 546 | #endif /* SQUID_SQUIDCONFIG_H_ */ |
f53969cc | 547 |