]>
Commit | Line | Data |
---|---|---|
9cef6668 | 1 | /* |
2b6662ba | 2 | * SQUID Web Proxy Cache http://www.squid-cache.org/ |
9cef6668 | 3 | * ---------------------------------------------------------- |
4 | * | |
2b6662ba | 5 | * Squid is the result of efforts by numerous individuals from |
6 | * the Internet community; see the CONTRIBUTORS file for full | |
7 | * details. Many organizations have provided support for Squid's | |
8 | * development; see the SPONSORS file for full details. Squid is | |
9 | * Copyrighted (C) 2001 by the Regents of the University of | |
10 | * California; see the COPYRIGHT file for full details. Squid | |
11 | * incorporates software developed and/or copyrighted by other | |
12 | * sources; see the CREDITS file for full details. | |
9cef6668 | 13 | * |
14 | * This program is free software; you can redistribute it and/or modify | |
15 | * it under the terms of the GNU General Public License as published by | |
16 | * the Free Software Foundation; either version 2 of the License, or | |
17 | * (at your option) any later version. | |
9e008dda | 18 | * |
9cef6668 | 19 | * This program is distributed in the hope that it will be useful, |
20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
22 | * GNU General Public License for more details. | |
9e008dda | 23 | * |
9cef6668 | 24 | * You should have received a copy of the GNU General Public License |
25 | * along with this program; if not, write to the Free Software | |
26 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. | |
27 | * | |
28 | */ | |
b5638623 | 29 | #ifndef SQUID_STRUCTS_H |
30 | #define SQUID_STRUCTS_H | |
31 | ||
0009ba2f | 32 | #include "config.h" |
c8f4eac4 | 33 | #include "RefCount.h" |
4c9da963 | 34 | #include "cbdata.h" |
25b6a907 | 35 | #include "dlink.h" |
4b981814 AJ |
36 | #include "err_type.h" |
37 | ||
25b6a907 | 38 | /* needed for the global config */ |
39 | #include "HttpHeader.h" | |
0f1bc304 | 40 | |
4b981814 AJ |
41 | /* for ICP_END */ |
42 | #include "icp_opcode.h" | |
43 | ||
8a368316 AJ |
44 | #define PEER_MULTICAST_SIBLINGS 1 |
45 | ||
9e008dda | 46 | struct acl_name_list { |
a8258824 | 47 | char name[ACL_NAME_SZ]; |
74fbf3c9 | 48 | acl_name_list *next; |
a8258824 | 49 | }; |
50 | ||
9e008dda | 51 | struct acl_deny_info_list { |
e6ccf245 | 52 | err_type err_page_id; |
02922e76 | 53 | char *err_page_name; |
74fbf3c9 | 54 | acl_name_list *acl_list; |
55 | acl_deny_info_list *next; | |
a8258824 | 56 | }; |
57 | ||
02922e76 | 58 | |
8000a965 | 59 | class acl_access; |
62e76326 | 60 | |
9e008dda | 61 | struct _header_mangler { |
6bccf575 | 62 | acl_access *access_list; |
63 | char *replacement; | |
64 | }; | |
65 | ||
e1f7507e AJ |
66 | class ACLChecklist; |
67 | ||
1df370e3 | 68 | #if SQUID_SNMP |
43d4303e | 69 | |
9e008dda | 70 | struct _snmp_request_t { |
5e29a294 | 71 | u_char *buf; |
72 | u_char *outbuf; | |
2ac76861 | 73 | int len; |
74 | int sock; | |
75 | long reqid; | |
76 | int outlen; | |
62e76326 | 77 | |
b7ac5457 | 78 | Ip::Address from; |
62e76326 | 79 | |
2ac76861 | 80 | struct snmp_pdu *PDU; |
4fb35c3c | 81 | ACLChecklist *acl_checklist; |
5e29a294 | 82 | u_char *community; |
0536fdfc | 83 | |
84 | struct snmp_session session; | |
a9ddb359 | 85 | }; |
bdf18524 | 86 | |
1df370e3 | 87 | #endif |
a97cfa48 | 88 | |
e1f7507e | 89 | class ACLList; |
a8258824 | 90 | |
9e008dda | 91 | struct acl_address { |
d6827718 | 92 | acl_address *next; |
76cd39d7 | 93 | ACLList *aclList; |
62e76326 | 94 | |
b7ac5457 | 95 | Ip::Address addr; |
d6827718 | 96 | }; |
97 | ||
9e008dda | 98 | struct acl_tos { |
d6827718 | 99 | acl_tos *next; |
76cd39d7 | 100 | ACLList *aclList; |
d6827718 | 101 | int tos; |
102 | }; | |
103 | ||
9e008dda | 104 | struct acl_size_t { |
ef1955a5 | 105 | acl_size_t *next; |
76cd39d7 | 106 | ACLList *aclList; |
47f6e231 | 107 | int64_t size; |
ef1955a5 | 108 | }; |
109 | ||
9e008dda | 110 | struct ushortlist { |
a8258824 | 111 | u_short i; |
bd05e3e3 | 112 | ushortlist *next; |
a8258824 | 113 | }; |
114 | ||
9e008dda | 115 | struct relist { |
a8258824 | 116 | char *pattern; |
117 | regex_t regex; | |
bd05e3e3 | 118 | relist *next; |
a8258824 | 119 | }; |
120 | ||
56e64999 | 121 | #if DELAY_POOLS |
b67e2c8c | 122 | #include "DelayConfig.h" |
56e64999 | 123 | #endif |
95e36d02 | 124 | |
cc192b50 | 125 | #if USE_ICMP |
663ff9aa | 126 | #include "icmp/IcmpConfig.h" |
cc192b50 | 127 | #endif |
128 | ||
48d54e4d AJ |
129 | #include "HelperChildConfig.h" |
130 | ||
aa839030 | 131 | /* forward decl for SquidConfig, see RemovalPolicy.h */ |
b7d249f9 | 132 | |
aa839030 | 133 | class RemovalPolicySettings; |
1e5562e3 | 134 | class external_acl; |
c8f4eac4 | 135 | class Store; |
136 | ||
9e008dda | 137 | struct SquidConfig { |
62e76326 | 138 | |
9e008dda | 139 | struct { |
c8f4eac4 | 140 | /* These should be for the Store::Root instance. |
141 | * this needs pluggable parsing to be done smoothly. | |
142 | */ | |
62e76326 | 143 | int highWaterMark; |
144 | int lowWaterMark; | |
3d0ac046 | 145 | } Swap; |
43a70238 | 146 | size_t memMaxSize; |
62e76326 | 147 | |
9e008dda | 148 | struct { |
47f6e231 | 149 | int64_t min; |
62e76326 | 150 | int pct; |
47f6e231 | 151 | int64_t max; |
3d0ac046 | 152 | } quickAbort; |
47f6e231 | 153 | int64_t readAheadGap; |
6a566b9c | 154 | RemovalPolicySettings *replPolicy; |
155 | RemovalPolicySettings *memPolicy; | |
626096be | 156 | #if USE_HTTP_VIOLATIONS |
a8258824 | 157 | time_t negativeTtl; |
ac9cc053 | 158 | #endif |
a8258824 | 159 | time_t negativeDnsTtl; |
160 | time_t positiveDnsTtl; | |
161 | time_t shutdownLifetime; | |
d1b63fc8 | 162 | time_t backgroundPingRate; |
62e76326 | 163 | |
9e008dda | 164 | struct { |
62e76326 | 165 | time_t read; |
5ef5e5cc | 166 | time_t write; |
62e76326 | 167 | time_t lifetime; |
168 | time_t connect; | |
777831e0 | 169 | time_t forward; |
62e76326 | 170 | time_t peer_connect; |
171 | time_t request; | |
172 | time_t persistent_request; | |
173 | time_t pconn; | |
174 | time_t siteSelect; | |
175 | time_t deadPeer; | |
176 | int icp_query; /* msec */ | |
177 | int icp_query_max; /* msec */ | |
178 | int icp_query_min; /* msec */ | |
179 | int mcast_icp_query; /* msec */ | |
62e76326 | 180 | |
4fe0e1d0 | 181 | #if !USE_DNSSERVERS |
62e76326 | 182 | |
183 | time_t idns_retransmit; | |
184 | time_t idns_query; | |
3898f57f | 185 | #endif |
62e76326 | 186 | |
3d0ac046 | 187 | } Timeout; |
0483b991 | 188 | size_t maxRequestHeaderSize; |
47f6e231 | 189 | int64_t maxRequestBodySize; |
3ff65596 | 190 | int64_t maxChunkedRequestBodySize; |
4eb368f9 | 191 | size_t maxReplyHeaderSize; |
ef1955a5 | 192 | acl_size_t *ReplyBodySize; |
62e76326 | 193 | |
9e008dda | 194 | struct { |
62e76326 | 195 | u_short icp; |
ace287ee | 196 | #if USE_HTCP |
62e76326 | 197 | |
198 | u_short htcp; | |
ace287ee | 199 | #endif |
1df370e3 | 200 | #if SQUID_SNMP |
62e76326 | 201 | |
202 | u_short snmp; | |
1df370e3 | 203 | #endif |
3d0ac046 | 204 | } Port; |
62e76326 | 205 | |
9e008dda | 206 | struct { |
62e76326 | 207 | http_port_list *http; |
1f7c9178 | 208 | #if USE_SSL |
62e76326 | 209 | |
210 | https_port_list *https; | |
1f7c9178 | 211 | #endif |
62e76326 | 212 | |
3d0ac046 | 213 | } Sockaddr; |
1df370e3 | 214 | #if SQUID_SNMP |
62e76326 | 215 | |
9e008dda | 216 | struct { |
62e76326 | 217 | char *configFile; |
218 | char *agentInfo; | |
3d0ac046 | 219 | } Snmp; |
320e9f36 | 220 | #endif |
eb824054 | 221 | #if USE_WCCP |
62e76326 | 222 | |
9e008dda | 223 | struct { |
b7ac5457 AJ |
224 | Ip::Address router; |
225 | Ip::Address address; | |
62e76326 | 226 | int version; |
3d0ac046 | 227 | } Wccp; |
1df370e3 | 228 | #endif |
0b0cfcf2 | 229 | #if USE_WCCPv2 |
230 | ||
9e008dda | 231 | struct { |
b7ac5457 AJ |
232 | Ip::Address_list *router; |
233 | Ip::Address address; | |
0b0cfcf2 | 234 | int forwarding_method; |
235 | int return_method; | |
b7d249f9 | 236 | int assignment_method; |
237 | int weight; | |
f67332d3 | 238 | int rebuildwait; |
0b0cfcf2 | 239 | void *info; |
2fadd50d | 240 | } Wccp2; |
0b0cfcf2 | 241 | #endif |
62e76326 | 242 | |
cc192b50 | 243 | #if USE_ICMP |
663ff9aa | 244 | IcmpConfig pinger; |
cc192b50 | 245 | #endif |
246 | ||
53ad48e6 | 247 | char *as_whois_server; |
62e76326 | 248 | |
9e008dda | 249 | struct { |
62e76326 | 250 | char *store; |
251 | char *swap; | |
82839306 | 252 | #if USE_USERAGENT_LOG |
62e76326 | 253 | |
254 | char *useragent; | |
fd2c5549 | 255 | #endif |
256 | #if USE_REFERER_LOG | |
62e76326 | 257 | |
258 | char *referer; | |
225644d7 | 259 | #endif |
260 | #if WIP_FWD_LOG | |
62e76326 | 261 | |
262 | char *forward; | |
82839306 | 263 | #endif |
62e76326 | 264 | |
7684c4b1 | 265 | logformat *logformats; |
266 | ||
267 | customlog *accesslogs; | |
268 | ||
e1381638 | 269 | #if ICAP_CLIENT |
3ff65596 AR |
270 | customlog *icaplogs; |
271 | #endif | |
272 | ||
62e76326 | 273 | int rotateNumber; |
2fadd50d | 274 | } Log; |
a8258824 | 275 | char *adminEmail; |
abacf776 | 276 | char *EmailFrom; |
d084bf20 | 277 | char *EmailProgram; |
a8258824 | 278 | char *effectiveUser; |
d3caee79 | 279 | char *visible_appname_string; |
a8258824 | 280 | char *effectiveGroup; |
62e76326 | 281 | |
9e008dda | 282 | struct { |
82839306 | 283 | #if USE_DNSSERVERS |
62e76326 | 284 | char *dnsserver; |
efd900cb | 285 | #endif |
62e76326 | 286 | |
287 | wordlist *redirect; | |
a3d0a19d | 288 | #if USE_UNLINKD |
62e76326 | 289 | |
290 | char *unlinkd; | |
a3d0a19d | 291 | #endif |
62e76326 | 292 | |
293 | char *diskd; | |
307b83b7 | 294 | #if USE_SSL |
295 | ||
296 | char *ssl_password; | |
297 | #endif | |
298 | ||
2fadd50d | 299 | } Program; |
82839306 | 300 | #if USE_DNSSERVERS |
62e76326 | 301 | |
48d54e4d | 302 | HelperChildConfig dnsChildren; |
efd900cb | 303 | #endif |
62e76326 | 304 | |
48d54e4d | 305 | HelperChildConfig redirectChildren; |
94439e4e | 306 | time_t authenticateGCInterval; |
70a76033 | 307 | time_t authenticateTTL; |
308 | time_t authenticateIpTTL; | |
43ae1d95 | 309 | |
9e008dda | 310 | struct { |
43ae1d95 | 311 | char *surrogate_id; |
2fadd50d | 312 | } Accel; |
a8258824 | 313 | char *appendDomain; |
314 | size_t appendDomainLen; | |
a8258824 | 315 | char *pidFilename; |
2b753521 | 316 | char *netdbFilename; |
a8258824 | 317 | char *mimeTablePathname; |
0e70aa1e | 318 | char *etcHostsPath; |
a8258824 | 319 | char *visibleHostname; |
98829f69 | 320 | char *uniqueHostname; |
1f38f50a | 321 | wordlist *hostnameAliases; |
a8258824 | 322 | char *errHtmlText; |
62e76326 | 323 | |
9e008dda | 324 | struct { |
62e76326 | 325 | char *host; |
326 | char *file; | |
327 | time_t period; | |
328 | u_short port; | |
2fadd50d | 329 | } Announce; |
62e76326 | 330 | |
9e008dda | 331 | struct { |
62e76326 | 332 | |
b7ac5457 AJ |
333 | Ip::Address udp_incoming; |
334 | Ip::Address udp_outgoing; | |
15dcc168 | 335 | #if SQUID_SNMP |
b7ac5457 AJ |
336 | Ip::Address snmp_incoming; |
337 | Ip::Address snmp_outgoing; | |
15dcc168 | 338 | #endif |
cc192b50 | 339 | /* FIXME INET6 : this should really be a CIDR value */ |
b7ac5457 | 340 | Ip::Address client_netmask; |
2fadd50d | 341 | } Addrs; |
9906e724 | 342 | size_t tcpRcvBufsz; |
343 | size_t udpMaxHitObjsz; | |
a8258824 | 344 | wordlist *hierarchy_stoplist; |
345 | wordlist *mcast_group_list; | |
09c483ec | 346 | wordlist *dns_nameservers; |
40a1495e | 347 | peer *peers; |
348 | int npeers; | |
62e76326 | 349 | |
9e008dda | 350 | struct { |
62e76326 | 351 | int size; |
352 | int low; | |
353 | int high; | |
2fadd50d | 354 | } ipcache; |
62e76326 | 355 | |
9e008dda | 356 | struct { |
62e76326 | 357 | int size; |
2fadd50d | 358 | } fqdncache; |
a8258824 | 359 | int minDirectHops; |
5f84d830 | 360 | int minDirectRtt; |
a8258824 | 361 | cachemgr_passwd *passwd_list; |
62e76326 | 362 | |
9e008dda | 363 | struct { |
62e76326 | 364 | int objectsPerBucket; |
3e62bd58 | 365 | int64_t avgObjectSize; |
47f6e231 | 366 | int64_t maxObjectSize; |
367 | int64_t minObjectSize; | |
62e76326 | 368 | size_t maxInMemObjSize; |
2fadd50d | 369 | } Store; |
62e76326 | 370 | |
9e008dda | 371 | struct { |
62e76326 | 372 | int high; |
373 | int low; | |
374 | time_t period; | |
2fadd50d | 375 | } Netdb; |
62e76326 | 376 | |
9e008dda | 377 | struct { |
62e76326 | 378 | int log_udp; |
62e76326 | 379 | int res_defnames; |
62e76326 | 380 | int anonymizer; |
381 | int client_db; | |
382 | int query_icmp; | |
383 | int icp_hit_stale; | |
384 | int buffered_logs; | |
62e76326 | 385 | int common_log; |
386 | int log_mime_hdrs; | |
387 | int log_fqdn; | |
388 | int announce; | |
389 | int mem_pools; | |
390 | int test_reachability; | |
391 | int half_closed_clients; | |
4c3ef9b2 | 392 | int refresh_all_ims; |
626096be | 393 | #if USE_HTTP_VIOLATIONS |
62e76326 | 394 | |
395 | int reload_into_ims; | |
9f60cfdf | 396 | #endif |
62e76326 | 397 | |
398 | int offline; | |
399 | int redir_rewrites_host; | |
400 | int prefer_direct; | |
401 | int nonhierarchical_direct; | |
402 | int strip_query_terms; | |
403 | int redirector_bypass; | |
404 | int ignore_unknown_nameservers; | |
405 | int client_pconns; | |
406 | int server_pconns; | |
58850d15 | 407 | int error_pconns; |
7e3ce7b9 | 408 | #if USE_CACHE_DIGESTS |
62e76326 | 409 | |
410 | int digest_generation; | |
7e3ce7b9 | 411 | #endif |
62e76326 | 412 | |
413 | int log_ip_on_direct; | |
414 | int ie_refresh; | |
415 | int vary_ignore_expire; | |
416 | int pipeline_prefetch; | |
43ae1d95 | 417 | int surrogate_is_remote; |
62e76326 | 418 | int request_entities; |
21b92762 | 419 | int detect_broken_server_pconns; |
a12a049a | 420 | int balance_on_multiple_ip; |
52d3f198 | 421 | int relaxed_header_parser; |
62e76326 | 422 | int check_hostnames; |
a78278e2 | 423 | int allow_underscore; |
62e76326 | 424 | int via; |
425 | int emailErrData; | |
d3caee79 | 426 | int httpd_suppress_version_string; |
f024c970 | 427 | int global_internal_static; |
cc192b50 | 428 | int dns_require_A; |
3d674977 AJ |
429 | |
430 | #if FOLLOW_X_FORWARDED_FOR | |
431 | int acl_uses_indirect_client; | |
432 | int delay_pool_uses_indirect_client; | |
433 | int log_uses_indirect_client; | |
96d64448 AJ |
434 | #if LINUX_NETFILTER |
435 | int tproxy_uses_indirect_client; | |
436 | #endif | |
3d674977 AJ |
437 | #endif /* FOLLOW_X_FORWARDED_FOR */ |
438 | ||
b6696974 | 439 | int WIN32_IpAddrChangeMonitor; |
ff4b33f4 HN |
440 | int memory_cache_first; |
441 | int memory_cache_disk; | |
2fadd50d | 442 | } onoff; |
97427e90 | 443 | |
437823b4 AJ |
444 | int forward_max_tries; |
445 | ||
97427e90 | 446 | class ACL *aclList; |
62e76326 | 447 | |
9e008dda | 448 | struct { |
62e76326 | 449 | acl_access *http; |
533493da | 450 | acl_access *adapted_http; |
62e76326 | 451 | acl_access *icp; |
452 | acl_access *miss; | |
453 | acl_access *NeverDirect; | |
454 | acl_access *AlwaysDirect; | |
455 | acl_access *ASlists; | |
456 | acl_access *noCache; | |
7684c4b1 | 457 | acl_access *log; |
dba79ac5 | 458 | #if SQUID_SNMP |
62e76326 | 459 | |
460 | acl_access *snmp; | |
dba79ac5 | 461 | #endif |
626096be | 462 | #if USE_HTTP_VIOLATIONS |
62e76326 | 463 | acl_access *brokenPosts; |
aa49962c | 464 | #endif |
62e76326 | 465 | acl_access *redirector; |
466 | acl_access *reply; | |
467 | acl_address *outgoing_address; | |
468 | acl_tos *outgoing_tos; | |
057f5854 | 469 | acl_tos *clientside_tos; |
5401aa8d | 470 | #if USE_HTCP |
471 | ||
472 | acl_access *htcp; | |
473 | acl_access *htcp_clr; | |
474 | #endif | |
9e008dda | 475 | |
4c9da963 | 476 | #if USE_SSL |
477 | acl_access *ssl_bump; | |
478 | #endif | |
3d674977 AJ |
479 | #if FOLLOW_X_FORWARDED_FOR |
480 | acl_access *followXFF; | |
481 | #endif /* FOLLOW_X_FORWARDED_FOR */ | |
5401aa8d | 482 | |
3ff65596 AR |
483 | #if ICAP_CLIENT |
484 | acl_access* icap; | |
485 | #endif | |
2fadd50d | 486 | } accessList; |
bd05e3e3 | 487 | acl_deny_info_list *denyInfoList; |
62e76326 | 488 | |
9e008dda | 489 | struct { |
62e76326 | 490 | size_t list_width; |
491 | int list_wrap; | |
492 | char *anon_user; | |
493 | int passive; | |
a689bd4e | 494 | int epsv_all; |
51ee534d | 495 | int epsv; |
62e76326 | 496 | int sanitycheck; |
dad0fe12 | 497 | int telnet; |
2fadd50d | 498 | } Ftp; |
a8258824 | 499 | refresh_t *Refresh; |
62e76326 | 500 | |
9e008dda | 501 | struct _cacheSwap { |
c8f4eac4 | 502 | RefCount<class Store> *swapDirs; |
62e76326 | 503 | int n_allocated; |
504 | int n_configured; | |
2fadd50d | 505 | } cacheSwap; |
cdb527f0 A |
506 | /* |
507 | * I'm sick of having to keep doing this .. | |
508 | */ | |
ef364f64 | 509 | #define INDEXSD(i) (Config.cacheSwap.swapDirs[(i)].getRaw()) |
62e76326 | 510 | |
9e008dda | 511 | struct { |
62e76326 | 512 | char *directory; |
e72a0ec0 | 513 | int use_short_names; |
2fadd50d | 514 | } icons; |
9b312a19 | 515 | char *errorDirectory; |
43000484 AJ |
516 | #if USE_ERR_LOCALES |
517 | char *errorDefaultLanguage; | |
c411820c | 518 | int errorLogMissingLanguages; |
43000484 | 519 | #endif |
5b52cb6c | 520 | char *errorStylesheet; |
62e76326 | 521 | |
9e008dda | 522 | struct { |
62e76326 | 523 | int maxtries; |
5894ad28 | 524 | int onerror; |
2fadd50d | 525 | } retry; |
62e76326 | 526 | |
9e008dda | 527 | struct { |
70be1349 | 528 | int64_t limit; |
2fadd50d | 529 | } MemPools; |
95e36d02 | 530 | #if DELAY_POOLS |
62e76326 | 531 | |
b67e2c8c | 532 | DelayConfig Delay; |
95e36d02 | 533 | #endif |
62e76326 | 534 | |
9e008dda | 535 | struct { |
62e76326 | 536 | int icp_average; |
537 | int dns_average; | |
538 | int http_average; | |
539 | int icp_min_poll; | |
540 | int dns_min_poll; | |
541 | int http_min_poll; | |
2fadd50d | 542 | } comm_incoming; |
c5f627c2 | 543 | int max_open_disk_fds; |
d548ee64 | 544 | int uri_whitespace; |
11e3fa1c | 545 | acl_size_t *rangeOffsetLimit; |
e66d7923 | 546 | #if MULTICAST_MISS_STREAM |
62e76326 | 547 | |
9e008dda | 548 | struct { |
62e76326 | 549 | |
b7ac5457 | 550 | Ip::Address addr; |
62e76326 | 551 | int ttl; |
552 | unsigned short port; | |
553 | char *encode_key; | |
2fadd50d | 554 | } mcast_miss; |
e66d7923 | 555 | #endif |
62e76326 | 556 | |
25b6a907 | 557 | /* one access list per header type we know of */ |
8c01ada0 | 558 | header_mangler request_header_access[HDR_ENUM_END]; |
25b6a907 | 559 | /* one access list per header type we know of */ |
8c01ada0 | 560 | header_mangler reply_header_access[HDR_ENUM_END]; |
b6a2f15e | 561 | char *coredump_dir; |
efd900cb | 562 | char *chroot_dir; |
7e3ce7b9 | 563 | #if USE_CACHE_DIGESTS |
62e76326 | 564 | |
9e008dda | 565 | struct { |
62e76326 | 566 | int bits_per_entry; |
567 | time_t rebuild_period; | |
568 | time_t rewrite_period; | |
569 | size_t swapout_chunk_size; | |
570 | int rebuild_chunk_percentage; | |
2fadd50d | 571 | } digest; |
1f7c9178 | 572 | #endif |
573 | #if USE_SSL | |
62e76326 | 574 | |
9e008dda | 575 | struct { |
62e76326 | 576 | int unclean_shutdown; |
577 | char *ssl_engine; | |
2fadd50d | 578 | } SSL; |
7e3ce7b9 | 579 | #endif |
62e76326 | 580 | |
56fe752e | 581 | wordlist *ext_methods; |
62e76326 | 582 | |
9e008dda | 583 | struct { |
62e76326 | 584 | int high_rptm; |
585 | int high_pf; | |
586 | size_t high_memory; | |
2fadd50d | 587 | } warnings; |
65a53c8e | 588 | char *store_dir_select_algorithm; |
1fbbdcb0 | 589 | int sleep_after_fork; /* microseconds */ |
6a2f3fcf | 590 | time_t minimum_expiry_time; /* seconds */ |
d9572179 | 591 | external_acl *externalAclHelperList; |
575cb927 | 592 | |
a7ad6e4e | 593 | #if USE_SSL |
62e76326 | 594 | |
9e008dda | 595 | struct { |
62e76326 | 596 | char *cert; |
597 | char *key; | |
598 | int version; | |
599 | char *options; | |
600 | char *cipher; | |
601 | char *cafile; | |
602 | char *capath; | |
a82a4fe4 | 603 | char *crlfile; |
62e76326 | 604 | char *flags; |
4c9da963 | 605 | acl_access *cert_error; |
62e76326 | 606 | SSL_CTX *sslContext; |
2fadd50d | 607 | } ssl_client; |
a7ad6e4e | 608 | #endif |
cc9f92d4 | 609 | |
cc9f92d4 | 610 | char *accept_filter; |
c642c141 | 611 | int umask; |
f3f0f563 | 612 | int max_filedescriptors; |
13aeac35 | 613 | int workers; |
57afc994 AR |
614 | |
615 | #if USE_LOADABLE_MODULES | |
616 | wordlist *loadable_module_names; | |
617 | #endif | |
ab2ecb0e AJ |
618 | |
619 | int client_ip_max_connections; | |
a8258824 | 620 | }; |
621 | ||
e1f7507e | 622 | SQUIDCEXTERN SquidConfig Config; |
62e76326 | 623 | |
9e008dda AJ |
624 | struct SquidConfig2 { |
625 | struct { | |
62e76326 | 626 | int enable_purge; |
4f56514c | 627 | int mangle_request_headers; |
2fadd50d | 628 | } onoff; |
d20b1cd0 | 629 | uid_t effectiveUserID; |
630 | gid_t effectiveGroupID; | |
a8258824 | 631 | }; |
632 | ||
e1f7507e AJ |
633 | SQUIDCEXTERN SquidConfig2 Config2; |
634 | ||
9e008dda | 635 | struct _close_handler { |
a8258824 | 636 | PF *handler; |
637 | void *data; | |
638 | close_handler *next; | |
639 | }; | |
640 | ||
9e008dda | 641 | struct _dread_ctrl { |
a8258824 | 642 | int fd; |
643 | off_t offset; | |
644 | int req_len; | |
645 | char *buf; | |
646 | int end_of_file; | |
647 | DRCB *handler; | |
648 | void *client_data; | |
649 | }; | |
650 | ||
9e008dda | 651 | struct _dwrite_q { |
d377699f | 652 | off_t file_offset; |
a8258824 | 653 | char *buf; |
57d55dfa | 654 | size_t len; |
655 | size_t buf_offset; | |
bd05e3e3 | 656 | dwrite_q *next; |
74fbf3c9 | 657 | FREE *free_func; |
a8258824 | 658 | }; |
659 | ||
a9771e51 | 660 | |
661 | /* ETag support is rudimantal; | |
662 | * this struct is likely to change | |
663 | * Note: "str" points to memory in HttpHeaderEntry (for now) | |
664 | * so ETags should be used as tmp variables only (for now) */ | |
62e76326 | 665 | |
9e008dda | 666 | struct _ETag { |
98829f69 | 667 | const char *str; /* quoted-string */ |
668 | int weak; /* true if it is a weak validator */ | |
a9771e51 | 669 | }; |
670 | ||
9e008dda | 671 | struct _fde_disk { |
e6ccf245 | 672 | DWCB *wrt_handle; |
673 | void *wrt_handle_data; | |
674 | dwrite_q *write_q; | |
675 | dwrite_q *write_q_tail; | |
676 | off_t offset; | |
677 | }; | |
678 | ||
9e008dda | 679 | struct _fileMap { |
a8258824 | 680 | int max_n_files; |
681 | int n_files_in_map; | |
a8258824 | 682 | int toggle; |
683 | int nwords; | |
684 | unsigned long *file_map; | |
685 | }; | |
686 | ||
adba4a64 | 687 | /* |
1d21d91d | 688 | * Note: HttpBody is used only for messages with a small content that is |
adba4a64 | 689 | * known a priory (e.g., error messages). |
690 | */ | |
0eb49b6d | 691 | |
692 | class MemBuf; | |
62e76326 | 693 | |
9e008dda | 694 | struct _HttpBody { |
1d21d91d | 695 | /* private */ |
032785bf | 696 | MemBuf *mb; |
adba4a64 | 697 | }; |
698 | ||
cf414c2d | 699 | #include "SquidString.h" |
2ecaa5e7 | 700 | /* http header extention field */ |
62e76326 | 701 | |
0353e724 | 702 | class HttpHdrExtField |
62e76326 | 703 | { |
30abd221 | 704 | String name; /* field-name from HTTP/1.1 (no column after name) */ |
705 | String value; /* field-value from HTTP/1.1 */ | |
2ecaa5e7 | 706 | }; |
adba4a64 | 707 | |
399e85ea | 708 | /* http cache control header field */ |
62e76326 | 709 | |
985c86bc | 710 | class HttpHdrCc |
62e76326 | 711 | { |
985c86bc | 712 | |
713 | public: | |
4f087419 | 714 | int mask; |
d8b249ef | 715 | int max_age; |
7e3ce7b9 | 716 | int s_maxage; |
49ff0930 | 717 | int max_stale; |
30abd221 | 718 | String other; |
a8258824 | 719 | }; |
ee1679df | 720 | |
a9771e51 | 721 | /* some fields can hold either time or etag specs (e.g. If-Range) */ |
62e76326 | 722 | |
9e008dda | 723 | struct _TimeOrTag { |
98829f69 | 724 | ETag tag; /* entity tag */ |
a9771e51 | 725 | time_t time; |
98829f69 | 726 | int valid; /* true if struct is usable */ |
a9771e51 | 727 | }; |
728 | ||
7faf2bdb | 729 | /* per field statistics */ |
62e76326 | 730 | |
0353e724 | 731 | class HttpHeaderFieldStat |
62e76326 | 732 | { |
0353e724 | 733 | |
734 | public: | |
9e008dda | 735 | HttpHeaderFieldStat() : aliveCount(0), seenCount(0), parsCount(0), errCount(0), repCount(0) {} |
0353e724 | 736 | |
399e85ea | 737 | int aliveCount; /* created but not destroyed (count) */ |
d8b249ef | 738 | int seenCount; /* #fields we've seen */ |
399e85ea | 739 | int parsCount; /* #parsing attempts */ |
740 | int errCount; /* #pasring errors */ | |
741 | int repCount; /* #repetitons */ | |
7faf2bdb | 742 | }; |
743 | ||
d8b249ef | 744 | /* compiled version of HttpHeaderFieldAttrs plus stats */ |
62e76326 | 745 | |
0353e724 | 746 | class HttpHeaderFieldInfo |
62e76326 | 747 | { |
0353e724 | 748 | |
749 | public: | |
9e008dda | 750 | HttpHeaderFieldInfo() : id (HDR_ACCEPT), type (ftInvalid) {} |
0353e724 | 751 | |
de336bbe | 752 | http_hdr_type id; |
30abd221 | 753 | String name; |
de336bbe | 754 | field_type type; |
7faf2bdb | 755 | HttpHeaderFieldStat stat; |
756 | }; | |
757 | ||
9e008dda | 758 | struct _http_state_flags { |
3d0ac046 HN |
759 | unsigned int proxying:1; |
760 | unsigned int keepalive:1; | |
761 | unsigned int only_if_cached:1; | |
655daa06 | 762 | unsigned int handling1xx:1; ///< we are ignoring or forwarding 1xx response |
3d0ac046 HN |
763 | unsigned int headers_parsed:1; |
764 | unsigned int front_end_https:2; | |
765 | unsigned int originpeer:1; | |
766 | unsigned int keepalive_broken:1; | |
767 | unsigned int abuse_detected:1; | |
768 | unsigned int request_sent:1; | |
769 | unsigned int do_next_read:1; | |
770 | unsigned int consume_body_data:1; | |
e31a1e67 AR |
771 | unsigned int chunked:1; ///< reading a chunked response; TODO: rename |
772 | unsigned int chunked_request:1; ///< writing a chunked request | |
39cb8c41 | 773 | unsigned int sentLastChunk:1; ///< do not try to write last-chunk again |
b515fc11 | 774 | }; |
a8258824 | 775 | |
9e008dda | 776 | struct _ipcache_addrs { |
b7ac5457 | 777 | Ip::Address *in_addrs; |
6d1c0d53 | 778 | unsigned char *bad_mask; |
a8258824 | 779 | unsigned char count; |
780 | unsigned char cur; | |
22c653cd | 781 | unsigned char badcount; |
a8258824 | 782 | }; |
783 | ||
9e008dda | 784 | struct _domain_ping { |
a8258824 | 785 | char *domain; |
786 | int do_ping; /* boolean */ | |
bd05e3e3 | 787 | domain_ping *next; |
a8258824 | 788 | }; |
789 | ||
9e008dda | 790 | struct _domain_type { |
a8258824 | 791 | char *domain; |
792 | peer_t type; | |
bd05e3e3 | 793 | domain_type *next; |
a8258824 | 794 | }; |
795 | ||
c68e9c6b | 796 | #if USE_CACHE_DIGESTS |
62e76326 | 797 | |
e41e6dcd | 798 | /* statistics for cache digests and other hit "predictors" */ |
62e76326 | 799 | |
9e008dda | 800 | struct _cd_guess_stats { |
e41e6dcd | 801 | /* public, read-only */ |
802 | int true_hits; | |
803 | int false_hits; | |
804 | int true_misses; | |
805 | int false_misses; | |
4b4cd312 | 806 | int close_hits; /* tmp, remove it later */ |
e41e6dcd | 807 | }; |
808 | ||
c68e9c6b | 809 | #endif |
810 | ||
e1f7507e AJ |
811 | class PeerDigest; |
812 | ||
9e008dda | 813 | struct peer { |
cc192b50 | 814 | u_int index; |
be753325 | 815 | char *name; |
a8258824 | 816 | char *host; |
817 | peer_t type; | |
62e76326 | 818 | |
b7ac5457 | 819 | Ip::Address in_addr; |
62e76326 | 820 | |
9e008dda | 821 | struct { |
62e76326 | 822 | int pings_sent; |
823 | int pings_acked; | |
824 | int fetches; | |
825 | int rtt; | |
826 | int ignored_replies; | |
827 | int n_keepalives_sent; | |
828 | int n_keepalives_recv; | |
829 | time_t probe_start; | |
830 | time_t last_query; | |
831 | time_t last_reply; | |
832 | time_t last_connect_failure; | |
833 | time_t last_connect_probe; | |
834 | int logged_state; /* so we can print dead/revived msgs */ | |
835 | int conn_open; /* current opened connections */ | |
2fadd50d | 836 | } stats; |
62e76326 | 837 | |
9e008dda | 838 | struct { |
62e76326 | 839 | int version; |
093bce8b | 840 | int counts[ICP_END+1]; |
62e76326 | 841 | u_short port; |
2fadd50d | 842 | } icp; |
62e76326 | 843 | |
a8b1cdf6 | 844 | #if USE_HTCP |
9e008dda | 845 | struct { |
62e76326 | 846 | double version; |
847 | int counts[2]; | |
848 | u_short port; | |
2fadd50d | 849 | } htcp; |
399cabec | 850 | #endif |
62e76326 | 851 | |
a8258824 | 852 | u_short http_port; |
b6a2f15e | 853 | domain_ping *peer_domain; |
bd05e3e3 | 854 | domain_type *typelist; |
505e35db | 855 | acl_access *access; |
62e76326 | 856 | |
9e008dda | 857 | struct { |
3d0ac046 HN |
858 | unsigned int proxy_only:1; |
859 | unsigned int no_query:1; | |
860 | unsigned int background_ping:1; | |
861 | unsigned int no_digest:1; | |
862 | unsigned int default_parent:1; | |
863 | unsigned int roundrobin:1; | |
864 | unsigned int weighted_roundrobin:1; | |
865 | unsigned int mcast_responder:1; | |
866 | unsigned int closest_only:1; | |
cd196bc8 | 867 | #if USE_HTCP |
3d0ac046 HN |
868 | unsigned int htcp:1; |
869 | unsigned int htcp_oldsquid:1; | |
4f4fa815 BR |
870 | unsigned int htcp_no_clr:1; |
871 | unsigned int htcp_no_purge_clr:1; | |
872 | unsigned int htcp_only_clr:1; | |
873 | unsigned int htcp_forward_clr:1; | |
cd196bc8 | 874 | #endif |
3d0ac046 | 875 | unsigned int no_netdb_exchange:1; |
cd196bc8 | 876 | #if DELAY_POOLS |
3d0ac046 | 877 | unsigned int no_delay:1; |
cd196bc8 | 878 | #endif |
3d0ac046 | 879 | unsigned int allow_miss:1; |
3d0ac046 | 880 | unsigned int carp:1; |
f7e1d9ce HN |
881 | unsigned int userhash:1; |
882 | unsigned int sourcehash:1; | |
3d0ac046 | 883 | unsigned int originserver:1; |
b0758e04 | 884 | unsigned int no_tproxy:1; |
8a368316 AJ |
885 | #if PEER_MULTICAST_SIBLINGS |
886 | unsigned int mcast_siblings:1; | |
887 | #endif | |
3d0ac046 | 888 | } options; |
62e76326 | 889 | |
a8258824 | 890 | int weight; |
d1b63fc8 | 891 | int basetime; |
62e76326 | 892 | |
9e008dda | 893 | struct { |
62e76326 | 894 | double avg_n_members; |
895 | int n_times_counted; | |
896 | int n_replies_expected; | |
897 | int ttl; | |
898 | int id; | |
899 | ||
9e008dda | 900 | struct { |
3d0ac046 HN |
901 | unsigned int count_event_pending:1; |
902 | unsigned int counting:1; | |
903 | } flags; | |
904 | } mcast; | |
c68e9c6b | 905 | #if USE_CACHE_DIGESTS |
62e76326 | 906 | |
e13ee7ad | 907 | PeerDigest *digest; |
7e3ce7b9 | 908 | char *digest_url; |
c68e9c6b | 909 | #endif |
62e76326 | 910 | |
a8258824 | 911 | int tcp_up; /* 0 if a connect() fails */ |
62e76326 | 912 | |
b7ac5457 | 913 | Ip::Address addresses[10]; |
a8258824 | 914 | int n_addresses; |
915 | int rr_count; | |
bd05e3e3 | 916 | peer *next; |
a8258824 | 917 | int test_fd; |
62e76326 | 918 | |
9e008dda | 919 | struct { |
62e76326 | 920 | unsigned int hash; |
921 | double load_multiplier; | |
922 | double load_factor; /* normalized weight value */ | |
2fadd50d | 923 | } carp; |
62e76326 | 924 | |
9e008dda | 925 | struct { |
f7e1d9ce HN |
926 | unsigned int hash; |
927 | double load_multiplier; | |
928 | double load_factor; /* normalized weight value */ | |
929 | } userhash; | |
930 | ||
9e008dda | 931 | struct { |
f7e1d9ce HN |
932 | unsigned int hash; |
933 | double load_multiplier; | |
934 | double load_factor; /* normalized weight value */ | |
935 | } sourcehash; | |
936 | ||
c68e9c6b | 937 | char *login; /* Proxy authorization */ |
3f62decd | 938 | time_t connect_timeout; |
ff9970cc | 939 | int connect_fail_limit; |
c7f9eb6d | 940 | int max_conn; |
be753325 | 941 | char *domain; /* Forced domain */ |
a7ad6e4e | 942 | #if USE_SSL |
62e76326 | 943 | |
a7ad6e4e | 944 | int use_ssl; |
945 | char *sslcert; | |
946 | char *sslkey; | |
947 | int sslversion; | |
948 | char *ssloptions; | |
949 | char *sslcipher; | |
950 | char *sslcafile; | |
951 | char *sslcapath; | |
a82a4fe4 | 952 | char *sslcrlfile; |
a7ad6e4e | 953 | char *sslflags; |
954 | char *ssldomain; | |
955 | SSL_CTX *sslContext; | |
f38c5e43 | 956 | SSL_SESSION *sslSession; |
a7ad6e4e | 957 | #endif |
62e76326 | 958 | |
a7ad6e4e | 959 | int front_end_https; |
d67acb4e | 960 | int connection_auth; |
a8258824 | 961 | }; |
962 | ||
9e008dda | 963 | struct _net_db_name { |
186477c1 | 964 | hash_link hash; /* must be first */ |
74fbf3c9 | 965 | net_db_name *next; |
966 | netdbEntry *net_db_entry; | |
a8258824 | 967 | }; |
968 | ||
9e008dda | 969 | struct _net_db_peer { |
6b53c392 | 970 | const char *peername; |
a8258824 | 971 | double hops; |
972 | double rtt; | |
973 | time_t expires; | |
974 | }; | |
975 | ||
9e008dda | 976 | struct _netdbEntry { |
186477c1 | 977 | hash_link hash; /* must be first */ |
cc192b50 | 978 | char network[MAX_IPSTRLEN]; |
a8258824 | 979 | int pings_sent; |
980 | int pings_recv; | |
981 | double hops; | |
982 | double rtt; | |
983 | time_t next_ping_time; | |
984 | time_t last_use_time; | |
985 | int link_count; | |
986 | net_db_name *hosts; | |
987 | net_db_peer *peers; | |
988 | int n_peers_alloc; | |
989 | int n_peers; | |
990 | }; | |
991 | ||
a8258824 | 992 | |
9e008dda | 993 | struct _iostats { |
62e76326 | 994 | |
9e008dda | 995 | struct { |
62e76326 | 996 | int reads; |
997 | int reads_deferred; | |
998 | int read_hist[16]; | |
999 | int writes; | |
1000 | int write_hist[16]; | |
1001 | } | |
1002 | ||
db80e881 | 1003 | Http, Ftp, Gopher; |
a8258824 | 1004 | }; |
1005 | ||
6a566b9c | 1006 | |
9e008dda | 1007 | struct request_flags { |
4ad60609 | 1008 | request_flags(): range(0),nocache(0),ims(0),auth(0),cachable(0),hierarchical(0),loopdetect(0),proxy_keepalive(0),proxying(0),refresh(0),redirected(0),need_validation(0),accelerated(0),ignore_cc(0),intercepted(0),spoof_client_ip(0),internal(0),internalclient(0),must_keepalive(0),chunked_reply(0),stream_error(0),destinationIPLookedUp_(0) { |
626096be | 1009 | #if USE_HTTP_VIOLATIONS |
72eee553 | 1010 | nocache_hack = 0; |
e429f975 | 1011 | #endif |
3d674977 | 1012 | #if FOLLOW_X_FORWARDED_FOR |
9e008dda | 1013 | done_follow_x_forwarded_for = 0; |
3d674977 | 1014 | #endif /* FOLLOW_X_FORWARDED_FOR */ |
62e76326 | 1015 | } |
1016 | ||
3d0ac046 HN |
1017 | unsigned int range:1; |
1018 | unsigned int nocache:1; | |
1019 | unsigned int ims:1; | |
1020 | unsigned int auth:1; | |
1021 | unsigned int cachable:1; | |
1022 | unsigned int hierarchical:1; | |
1023 | unsigned int loopdetect:1; | |
1024 | unsigned int proxy_keepalive:1; | |
9e008dda AJ |
1025 | unsigned int proxying: |
1026 | 1; /* this should be killed, also in httpstateflags */ | |
3d0ac046 HN |
1027 | unsigned int refresh:1; |
1028 | unsigned int redirected:1; | |
1029 | unsigned int need_validation:1; | |
626096be | 1030 | #if USE_HTTP_VIOLATIONS |
3d0ac046 | 1031 | unsigned int nocache_hack:1; /* for changing/ignoring no-cache requests */ |
9f60cfdf | 1032 | #endif |
3d0ac046 | 1033 | unsigned int accelerated:1; |
432bc83c | 1034 | unsigned int ignore_cc:1; |
2ad20b4f | 1035 | unsigned int intercepted:1; /**< transparently intercepted request */ |
f165d2fb | 1036 | unsigned int spoof_client_ip:1; /**< spoof client ip if possible */ |
3d0ac046 HN |
1037 | unsigned int internal:1; |
1038 | unsigned int internalclient:1; | |
1039 | unsigned int must_keepalive:1; | |
d67acb4e AJ |
1040 | unsigned int connection_auth:1; /** Request wants connection oriented auth */ |
1041 | unsigned int connection_auth_disabled:1; /** Connection oriented auth can not be supported */ | |
1042 | unsigned int connection_proxy_auth:1; /** Request wants connection oriented auth */ | |
1043 | unsigned int pinned:1; /* Request sent on a pinned connection */ | |
1044 | unsigned int auth_sent:1; /* Authentication forwarded */ | |
7f7bdd96 | 1045 | unsigned int no_direct:1; /* Deny direct forwarding unless overriden by always_direct. Used in accelerator mode */ |
4ad60609 AR |
1046 | unsigned int chunked_reply:1; /**< Reply with chunked transfer encoding */ |
1047 | unsigned int stream_error:1; /**< Whether stream error has occured */ | |
5f8252d2 | 1048 | |
1049 | // When adding new flags, please update cloneAdaptationImmune() as needed. | |
1050 | ||
e429f975 | 1051 | bool resetTCP() const; |
1052 | void setResetTCP(); | |
1053 | void clearResetTCP(); | |
8000a965 | 1054 | void destinationIPLookupCompleted(); |
1055 | bool destinationIPLookedUp() const; | |
62e76326 | 1056 | |
5f8252d2 | 1057 | // returns a partial copy of the flags that includes only those flags |
1058 | // that are safe for a related (e.g., ICAP-adapted) request to inherit | |
1059 | request_flags cloneAdaptationImmune() const; | |
1060 | ||
3d674977 AJ |
1061 | #if FOLLOW_X_FORWARDED_FOR |
1062 | unsigned int done_follow_x_forwarded_for; | |
1063 | #endif /* FOLLOW_X_FORWARDED_FOR */ | |
e429f975 | 1064 | private: |
62e76326 | 1065 | |
3d0ac046 HN |
1066 | unsigned int reset_tcp:1; |
1067 | unsigned int destinationIPLookedUp_:1; | |
92695e5e | 1068 | }; |
1069 | ||
9e008dda | 1070 | struct _link_list { |
d03d26fb | 1071 | void *ptr; |
62e76326 | 1072 | |
d03d26fb | 1073 | struct _link_list *next; |
1074 | }; | |
1075 | ||
9e008dda | 1076 | struct _cachemgr_passwd { |
a8258824 | 1077 | char *passwd; |
22f3fd98 | 1078 | wordlist *actions; |
bd05e3e3 | 1079 | cachemgr_passwd *next; |
a8258824 | 1080 | }; |
1081 | ||
9e008dda | 1082 | struct _refresh_t { |
a2c963ae | 1083 | const char *pattern; |
a8258824 | 1084 | regex_t compiled_pattern; |
1085 | time_t min; | |
c3f6d204 | 1086 | double pct; |
a8258824 | 1087 | time_t max; |
bd05e3e3 | 1088 | refresh_t *next; |
62e76326 | 1089 | |
9e008dda | 1090 | struct { |
3d0ac046 HN |
1091 | unsigned int icase:1; |
1092 | unsigned int refresh_ims:1; | |
3d8b6ba4 | 1093 | unsigned int store_stale:1; |
626096be | 1094 | #if USE_HTTP_VIOLATIONS |
3d0ac046 HN |
1095 | unsigned int override_expire:1; |
1096 | unsigned int override_lastmod:1; | |
1097 | unsigned int reload_into_ims:1; | |
1098 | unsigned int ignore_reload:1; | |
1099 | unsigned int ignore_no_cache:1; | |
1100 | unsigned int ignore_no_store:1; | |
4ca08219 | 1101 | unsigned int ignore_must_revalidate:1; |
3d0ac046 HN |
1102 | unsigned int ignore_private:1; |
1103 | unsigned int ignore_auth:1; | |
9f60cfdf | 1104 | #endif |
3d0ac046 | 1105 | } flags; |
a8258824 | 1106 | }; |
1107 | ||
12cf1be2 | 1108 | /* |
9e008dda | 1109 | * "very generic" histogram; |
12cf1be2 | 1110 | * see important comments on hbase_f restrictions in StatHist.c |
1111 | */ | |
62e76326 | 1112 | |
9e008dda | 1113 | struct _StatHist { |
12cf1be2 | 1114 | int *bins; |
1115 | int capacity; | |
e9a13293 | 1116 | double min; |
1117 | double max; | |
1118 | double scale; | |
95c297ec | 1119 | hbase_f *val_in; /* e.g., log() for log-based histogram */ |
1120 | hbase_f *val_out; /* e.g., exp() for log based histogram */ | |
7ae52c25 | 1121 | }; |
1122 | ||
12cf1be2 | 1123 | /* |
9e008dda | 1124 | * if you add a field to StatCounters, |
1d803566 | 1125 | * you MUST sync statCountersInitSpecial, statCountersClean, and statCountersCopy |
12cf1be2 | 1126 | */ |
62e76326 | 1127 | |
9e008dda | 1128 | struct _StatCounters { |
62e76326 | 1129 | |
9e008dda | 1130 | struct { |
62e76326 | 1131 | int clients; |
1132 | int requests; | |
1133 | int hits; | |
1134 | int mem_hits; | |
1135 | int disk_hits; | |
1136 | int errors; | |
1137 | kb_t kbytes_in; | |
1138 | kb_t kbytes_out; | |
1139 | kb_t hit_kbytes_out; | |
1140 | StatHist miss_svc_time; | |
1141 | StatHist nm_svc_time; | |
1142 | StatHist nh_svc_time; | |
1143 | StatHist hit_svc_time; | |
1144 | StatHist all_svc_time; | |
3d0ac046 | 1145 | } client_http; |
62e76326 | 1146 | |
9e008dda | 1147 | struct { |
62e76326 | 1148 | |
9e008dda | 1149 | struct { |
62e76326 | 1150 | int requests; |
1151 | int errors; | |
1152 | kb_t kbytes_in; | |
1153 | kb_t kbytes_out; | |
3d0ac046 HN |
1154 | } all , http, ftp, other; |
1155 | } server; | |
62e76326 | 1156 | |
9e008dda | 1157 | struct { |
62e76326 | 1158 | int pkts_sent; |
1159 | int queries_sent; | |
1160 | int replies_sent; | |
1161 | int pkts_recv; | |
1162 | int queries_recv; | |
1163 | int replies_recv; | |
1164 | int hits_sent; | |
1165 | int hits_recv; | |
1166 | int replies_queued; | |
1167 | int replies_dropped; | |
1168 | kb_t kbytes_sent; | |
1169 | kb_t q_kbytes_sent; | |
1170 | kb_t r_kbytes_sent; | |
1171 | kb_t kbytes_recv; | |
1172 | kb_t q_kbytes_recv; | |
1173 | kb_t r_kbytes_recv; | |
1174 | StatHist query_svc_time; | |
1175 | StatHist reply_svc_time; | |
1176 | int query_timeouts; | |
1177 | int times_used; | |
2fadd50d | 1178 | } icp; |
62e76326 | 1179 | |
9e008dda | 1180 | struct { |
c4ebc830 | 1181 | int pkts_sent; |
1182 | int pkts_recv; | |
3d0ac046 | 1183 | } htcp; |
c4ebc830 | 1184 | |
9e008dda | 1185 | struct { |
62e76326 | 1186 | int requests; |
3d0ac046 | 1187 | } unlink; |
62e76326 | 1188 | |
9e008dda | 1189 | struct { |
62e76326 | 1190 | StatHist svc_time; |
3d0ac046 | 1191 | } dns; |
62e76326 | 1192 | |
9e008dda | 1193 | struct { |
62e76326 | 1194 | int times_used; |
1195 | kb_t kbytes_sent; | |
1196 | kb_t kbytes_recv; | |
1197 | kb_t memory; | |
1198 | int msgs_sent; | |
1199 | int msgs_recv; | |
c68e9c6b | 1200 | #if USE_CACHE_DIGESTS |
62e76326 | 1201 | |
1202 | cd_guess_stats guess; | |
c68e9c6b | 1203 | #endif |
62e76326 | 1204 | |
1205 | StatHist on_xition_count; | |
3d0ac046 | 1206 | } cd; |
62e76326 | 1207 | |
9e008dda | 1208 | struct { |
62e76326 | 1209 | int times_used; |
3d0ac046 | 1210 | } netdb; |
f2908497 | 1211 | int page_faults; |
0a515876 | 1212 | unsigned long int select_loops; |
d239c2f5 | 1213 | int select_fds; |
1214 | double select_time; | |
f2908497 | 1215 | double cputime; |
62e76326 | 1216 | |
d5649d9f | 1217 | struct timeval timestamp; |
c6ecdbc3 | 1218 | StatHist comm_icp_incoming; |
ef523f99 | 1219 | StatHist comm_dns_incoming; |
c6ecdbc3 | 1220 | StatHist comm_http_incoming; |
26d6ee93 | 1221 | StatHist select_fds_hist; |
62e76326 | 1222 | |
9e008dda AJ |
1223 | struct { |
1224 | struct { | |
62e76326 | 1225 | int opens; |
1226 | int closes; | |
1227 | int reads; | |
1228 | int writes; | |
1229 | int seeks; | |
1230 | int unlinks; | |
3d0ac046 | 1231 | } disk; |
62e76326 | 1232 | |
9e008dda | 1233 | struct { |
62e76326 | 1234 | int accepts; |
1235 | int sockets; | |
1236 | int connects; | |
1237 | int binds; | |
1238 | int closes; | |
1239 | int reads; | |
1240 | int writes; | |
1241 | int recvfroms; | |
1242 | int sendtos; | |
3d0ac046 | 1243 | } sock; |
62e76326 | 1244 | int selects; |
3d0ac046 | 1245 | } syscalls; |
bfae3379 | 1246 | int aborted_requests; |
62e76326 | 1247 | |
9e008dda | 1248 | struct { |
62e76326 | 1249 | int files_cleaned; |
1250 | int outs; | |
1251 | int ins; | |
3d0ac046 | 1252 | } swap; |
f2908497 | 1253 | }; |
69c01cd7 | 1254 | |
fcd2d3ef | 1255 | /* per header statistics */ |
62e76326 | 1256 | |
9e008dda | 1257 | struct _HttpHeaderStat { |
fcd2d3ef | 1258 | const char *label; |
1259 | HttpHeaderMask *owner_mask; | |
1260 | ||
1261 | StatHist hdrUCountDistr; | |
1262 | StatHist fieldTypeDistr; | |
1263 | StatHist ccTypeDistr; | |
43ae1d95 | 1264 | StatHist scTypeDistr; |
fcd2d3ef | 1265 | |
1266 | int parsedCount; | |
1267 | int ccParsedCount; | |
43ae1d95 | 1268 | int scParsedCount; |
fcd2d3ef | 1269 | int destroyedCount; |
1270 | int busyDestroyedCount; | |
1271 | }; | |
1272 | ||
59c4d35b | 1273 | |
9e008dda | 1274 | struct _CacheDigest { |
c411be12 | 1275 | /* public, read-only */ |
1afe05c5 | 1276 | char *mask; /* bit mask */ |
57d55dfa | 1277 | int mask_size; /* mask size in bytes */ |
1afe05c5 | 1278 | int capacity; /* expected maximum for .count, not a hard limit */ |
04f0c415 | 1279 | int bits_per_entry; /* number of bits allocated for each entry from capacity */ |
1afe05c5 | 1280 | int count; /* number of digested entries */ |
1281 | int del_count; /* number of deletions performed so far */ | |
c411be12 | 1282 | }; |
910169e5 | 1283 | |
b2c141d4 | 1284 | |
9e008dda | 1285 | struct _store_rebuild_data { |
b2c141d4 | 1286 | int objcount; /* # objects successfully reloaded */ |
1287 | int expcount; /* # objects expired */ | |
1288 | int scancount; /* # entries scanned or read from state file */ | |
1289 | int clashcount; /* # swapfile clashes avoided */ | |
1290 | int dupcount; /* # duplicates purged */ | |
1291 | int cancelcount; /* # SWAP_LOG_DEL objects purged */ | |
1292 | int invalid; /* # bad lines */ | |
1293 | int badflags; /* # bad e->flags */ | |
1294 | int bad_log_op; | |
1295 | int zero_object_sz; | |
1296 | }; | |
5673c2e2 | 1297 | |
e1f7507e AJ |
1298 | class logformat_token; |
1299 | ||
9e008dda | 1300 | struct _logformat { |
7684c4b1 | 1301 | char *name; |
1302 | logformat_token *format; | |
1303 | logformat *next; | |
1304 | }; | |
1305 | ||
82b7abe3 AJ |
1306 | class Logfile; |
1307 | ||
9e008dda | 1308 | struct _customlog { |
7684c4b1 | 1309 | char *filename; |
76cd39d7 | 1310 | ACLList *aclList; |
7684c4b1 | 1311 | logformat *logFormat; |
1312 | Logfile *logfile; | |
1313 | customlog *next; | |
1314 | customlog_type type; | |
1315 | }; | |
1316 | ||
b5638623 | 1317 | #endif /* SQUID_STRUCTS_H */ |