2 * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
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.
9 #ifndef SQUID_SRC_SQUIDCONFIG_H
10 #define SQUID_SRC_SQUIDCONFIG_H
12 #include "acl/forward.h"
13 #include "base/RefCount.h"
14 #include "base/YesNoNone.h"
16 #include "ClientDelayConfig.h"
17 #include "DelayConfig.h"
19 #include "helper/ChildConfig.h"
20 #include "HttpHeaderTools.h"
21 #include "ip/Address.h"
23 #include "MessageDelayPools.h"
26 #include "security/Context.h"
27 #include "security/forward.h"
29 #include "ssl/support.h"
31 #include "store/Disk.h"
32 #include "store/forward.h"
33 #include "time/gadgets.h"
38 class sslproxy_cert_sign
;
39 class sslproxy_cert_adapt
;
44 class ActionPasswordList
;
54 class RemovalPolicySettings
;
55 class HttpUpgradeProtocolAccess
;
65 DiskConfig() { assert(swapDirs
== nullptr); }
66 ~DiskConfig() { delete[] swapDirs
; }
68 RefCount
<SwapDir
> *swapDirs
= nullptr;
71 /// number of disk processes required to support all cache_dirs
74 #define INDEXSD(i) (Config.cacheSwap.swapDirs[i].getRaw())
77 /// the representation of the configuration. POD.
82 /* These should be for the Store::Root instance.
83 * this needs pluggable parsing to be done smoothly.
89 YesNoNone memShared
; ///< whether the memory cache is shared among workers
90 YesNoNone shmLocking
; ///< shared_memory_locking
99 RemovalPolicySettings
*replPolicy
;
100 RemovalPolicySettings
*memPolicy
;
101 #if USE_HTTP_VIOLATIONS
105 time_t negativeDnsTtl
;
106 time_t positiveDnsTtl
;
107 time_t shutdownLifetime
;
108 time_t backgroundPingRate
;
109 time_t hopelessKidRevivalDelay
; ///< hopeless_kid_revival_delay
119 time_t clientIdlePconn
;
120 time_t serverIdlePconn
;
121 time_t ftpClientIdle
;
122 time_t pconnLifetime
; ///< pconn_lifetime in squid.conf
125 time_t request_start_timeout
;
126 int icp_query
; /* msec */
127 int icp_query_max
; /* msec */
128 int icp_query_min
; /* msec */
129 int mcast_icp_query
; /* msec */
130 time_msec_t idns_retransmit
;
131 time_msec_t idns_query
;
134 size_t maxRequestHeaderSize
;
135 int64_t maxRequestBodySize
;
136 size_t maxRequestBufferSize
;
137 size_t maxReplyHeaderSize
;
138 AclSizeLimit
*ReplyBodySize
;
170 Ip::Address_list
*router
;
172 int forwarding_method
;
174 int assignment_method
;
181 char *as_whois_server
;
186 CustomLog
*accesslogs
;
190 Security::KeyLog
*tlsKeys
; ///< one optional tls_key_log
197 char *visible_appname_string
;
198 char *effectiveGroup
;
216 Helper::ChildConfig redirectChildren
;
217 Helper::ChildConfig storeIdChildren
;
223 size_t appendDomainLen
;
226 char *mimeTablePathname
;
228 char *visibleHostname
;
229 char *uniqueHostname
;
230 wordlist
*hostnameAliases
;
235 Ip::Address udp_incoming
;
236 Ip::Address udp_outgoing
;
238 Ip::Address snmp_incoming
;
239 Ip::Address snmp_outgoing
;
241 // TODO: this should really be a CIDR value
242 Ip::Address client_netmask
;
245 size_t udpMaxHitObjsz
;
246 wordlist
*mcast_group_list
;
261 Mgr::ActionPasswordList
*passwd_list
;
264 int objectsPerBucket
;
265 int64_t avgObjectSize
;
266 int64_t maxObjectSize
;
267 int64_t minObjectSize
;
268 size_t maxInMemObjSize
;
288 int test_reachability
;
289 int half_closed_clients
;
291 #if USE_HTTP_VIOLATIONS
297 int redir_rewrites_host
;
299 int nonhierarchical_direct
;
300 int strip_query_terms
;
301 int redirector_bypass
;
303 int ignore_unknown_nameservers
;
307 #if USE_CACHE_DIGESTS
309 int digest_generation
;
312 int vary_ignore_expire
;
313 int surrogate_is_remote
;
314 int detect_broken_server_pconns
;
315 int relaxed_header_parser
;
317 int allow_underscore
;
319 int cache_miss_revalidate
;
321 int httpd_suppress_version_string
;
322 int global_internal_static
;
323 int collapsed_forwarding
;
325 #if FOLLOW_X_FORWARDED_FOR
326 int acl_uses_indirect_client
;
327 int delay_pool_uses_indirect_client
;
328 int log_uses_indirect_client
;
330 int tproxy_uses_indirect_client
;
332 #endif /* FOLLOW_X_FORWARDED_FOR */
334 int WIN32_IpAddrChangeMonitor
;
335 int memory_cache_first
;
336 int memory_cache_disk
;
337 int hostStrictVerify
;
338 int client_dst_passthru
;
341 bool logTlsServerHelloDetails
;
345 int64_t shared_transient_entries_limit
;
347 int pipeline_max_prefetch
;
349 // these values are actually unsigned
350 // TODO: extend the parser to support more nuanced types
351 int forward_max_tries
;
354 std::chrono::nanoseconds paranoid_hit_validation
;
356 class Acl::Node
*aclList
;
360 acl_access
*adapted_http
;
363 acl_access
*NeverDirect
;
364 acl_access
*AlwaysDirect
;
368 acl_access
*storeMiss
;
369 acl_access
*stats_collection
;
374 #if USE_HTTP_VIOLATIONS
375 acl_access
*brokenPosts
;
377 acl_access
*redirector
;
378 acl_access
*store_id
;
380 Acl::Address
*outgoing_address
;
384 acl_access
*htcp_clr
;
388 acl_access
*ssl_bump
;
390 #if FOLLOW_X_FORWARDED_FOR
391 acl_access
*followXFF
;
392 #endif /* FOLLOW_X_FORWARDED_FOR */
394 /// acceptable PROXY protocol clients
395 acl_access
*proxyProtocol
;
397 /// spoof_client_ip squid.conf acl.
398 /// nil unless configured
399 acl_access
* spoof_client_ip
;
400 acl_access
*on_unsupported_protocol
;
402 acl_access
*ftp_epsv
;
404 acl_access
*forceRequestBodyContinuation
;
405 acl_access
*serverPconnForNonretriable
;
406 acl_access
*collapsedForwardingAccess
;
408 AclDenyInfoList
*denyInfoList
;
421 RefreshPattern
*Refresh
;
423 Store::DiskConfig cacheSwap
;
429 char *errorDirectory
;
431 char *errorDefaultLanguage
;
432 int errorLogMissingLanguages
;
434 char *errorStylesheet
;
446 ClientDelayConfig ClientDelay
;
447 MessageDelayConfig MessageDelay
;
450 struct CommIncoming
{
456 int max_open_disk_fds
;
458 AclSizeLimit
*rangeOffsetLimit
;
460 /// request_header_access and request_header_replace
461 HeaderManglers
*request_header_access
;
462 /// reply_header_access and reply_header_replace
463 HeaderManglers
*reply_header_access
;
464 ///request_header_add access list
465 HeaderWithAclList
*request_header_add
;
466 ///reply_header_add access list
467 HeaderWithAclList
*reply_header_add
;
468 /// http_upgrade_request_protocols
469 HttpUpgradeProtocolAccess
*http_upgrade_request_protocols
;
474 #if USE_CACHE_DIGESTS
478 time_t rebuild_period
;
479 time_t rewrite_period
;
480 size_t swapout_chunk_size
;
481 int rebuild_chunk_percentage
;
487 int unclean_shutdown
;
490 size_t sessionCacheSize
;
500 char *store_dir_select_algorithm
;
501 int sleep_after_fork
; /* microseconds */
502 time_t minimum_expiry_time
; /* seconds */
503 external_acl
*externalAclHelperList
;
506 Security::ContextPointer sslContext
;
508 char *foreignIntermediateCertsPath
;
509 acl_access
*cert_error
;
510 sslproxy_cert_sign
*cert_sign
;
511 sslproxy_cert_adapt
*cert_adapt
;
517 int max_filedescriptors
;
519 CpuAffinityMap
*cpuAffinityMap
;
521 #if USE_LOADABLE_MODULES
522 wordlist
*loadable_module_names
;
525 int client_ip_max_connections
;
527 char *redirector_extras
;
529 struct UrlHelperTimeout
{
532 } onUrlRewriteTimeout
;
534 char *storeId_extras
;
537 SBufList nameservers
;
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.
549 extern SquidConfig Config
;
555 *this = SquidConfig2();
559 int enable_purge
= 0;
561 uid_t effectiveUserID
= 0;
562 gid_t effectiveGroupID
= 0;
565 extern SquidConfig2 Config2
;
567 #endif /* SQUID_SRC_SQUIDCONFIG_H */