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