]>
Commit | Line | Data |
---|---|---|
a8258824 | 1 | |
9cef6668 | 2 | /* |
cc192b50 | 3 | * $Id: structs.h,v 1.569 2007/12/14 23:11:48 amosjeffries Exp $ |
9cef6668 | 4 | * |
5 | * | |
2b6662ba | 6 | * SQUID Web Proxy Cache http://www.squid-cache.org/ |
9cef6668 | 7 | * ---------------------------------------------------------- |
8 | * | |
2b6662ba | 9 | * Squid is the result of efforts by numerous individuals from |
10 | * the Internet community; see the CONTRIBUTORS file for full | |
11 | * details. Many organizations have provided support for Squid's | |
12 | * development; see the SPONSORS file for full details. Squid is | |
13 | * Copyrighted (C) 2001 by the Regents of the University of | |
14 | * California; see the COPYRIGHT file for full details. Squid | |
15 | * incorporates software developed and/or copyrighted by other | |
16 | * sources; see the CREDITS file for full details. | |
9cef6668 | 17 | * |
18 | * This program is free software; you can redistribute it and/or modify | |
19 | * it under the terms of the GNU General Public License as published by | |
20 | * the Free Software Foundation; either version 2 of the License, or | |
21 | * (at your option) any later version. | |
22 | * | |
23 | * This program is distributed in the hope that it will be useful, | |
24 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
25 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
26 | * GNU General Public License for more details. | |
27 | * | |
28 | * You should have received a copy of the GNU General Public License | |
29 | * along with this program; if not, write to the Free Software | |
30 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. | |
31 | * | |
32 | */ | |
33 | ||
b5638623 | 34 | #ifndef SQUID_STRUCTS_H |
35 | #define SQUID_STRUCTS_H | |
36 | ||
0009ba2f | 37 | #include "config.h" |
c8f4eac4 | 38 | #include "RefCount.h" |
0009ba2f | 39 | |
25b6a907 | 40 | /* needed for various structures still in structs.h */ |
41 | #include "dlink.h" | |
42 | /* needed for the global config */ | |
43 | #include "HttpHeader.h" | |
0f1bc304 | 44 | |
62e76326 | 45 | struct _acl_name_list |
46 | { | |
a8258824 | 47 | char name[ACL_NAME_SZ]; |
74fbf3c9 | 48 | acl_name_list *next; |
a8258824 | 49 | }; |
50 | ||
62e76326 | 51 | struct _acl_deny_info_list |
52 | { | |
e6ccf245 | 53 | err_type err_page_id; |
02922e76 | 54 | char *err_page_name; |
74fbf3c9 | 55 | acl_name_list *acl_list; |
56 | acl_deny_info_list *next; | |
a8258824 | 57 | }; |
58 | ||
02922e76 | 59 | |
8000a965 | 60 | class acl_access; |
62e76326 | 61 | |
62 | struct _header_mangler | |
63 | { | |
6bccf575 | 64 | acl_access *access_list; |
65 | char *replacement; | |
66 | }; | |
67 | ||
1df370e3 | 68 | #if SQUID_SNMP |
43d4303e | 69 | |
62e76326 | 70 | struct _snmp_request_t |
71 | { | |
5e29a294 | 72 | u_char *buf; |
73 | u_char *outbuf; | |
2ac76861 | 74 | int len; |
75 | int sock; | |
76 | long reqid; | |
77 | int outlen; | |
62e76326 | 78 | |
cc192b50 | 79 | IPAddress from; |
62e76326 | 80 | |
2ac76861 | 81 | struct snmp_pdu *PDU; |
4fb35c3c | 82 | ACLChecklist *acl_checklist; |
5e29a294 | 83 | u_char *community; |
0536fdfc | 84 | |
85 | struct snmp_session session; | |
a9ddb359 | 86 | }; |
bdf18524 | 87 | |
1df370e3 | 88 | #endif |
a97cfa48 | 89 | |
a8258824 | 90 | |
62e76326 | 91 | struct _acl_address |
92 | { | |
d6827718 | 93 | acl_address *next; |
76cd39d7 | 94 | ACLList *aclList; |
62e76326 | 95 | |
cc192b50 | 96 | IPAddress addr; |
d6827718 | 97 | }; |
98 | ||
62e76326 | 99 | struct _acl_tos |
100 | { | |
d6827718 | 101 | acl_tos *next; |
76cd39d7 | 102 | ACLList *aclList; |
d6827718 | 103 | int tos; |
104 | }; | |
105 | ||
ef1955a5 | 106 | struct _acl_size_t |
107 | { | |
108 | acl_size_t *next; | |
76cd39d7 | 109 | ACLList *aclList; |
47f6e231 | 110 | int64_t size; |
ef1955a5 | 111 | }; |
112 | ||
62e76326 | 113 | struct _ushortlist |
114 | { | |
a8258824 | 115 | u_short i; |
bd05e3e3 | 116 | ushortlist *next; |
a8258824 | 117 | }; |
118 | ||
62e76326 | 119 | struct _relist |
120 | { | |
a8258824 | 121 | char *pattern; |
122 | regex_t regex; | |
bd05e3e3 | 123 | relist *next; |
a8258824 | 124 | }; |
125 | ||
fbdba7c4 | 126 | struct _http_port_list |
127 | { | |
128 | http_port_list *next; | |
129 | ||
cc192b50 | 130 | IPAddress s; |
fbdba7c4 | 131 | char *protocol; /* protocol name */ |
132 | char *name; /* visible name */ | |
133 | char *defaultsite; /* default web site */ | |
134 | ||
135 | unsigned int transparent: | |
136 | 1; /* transparent proxy */ | |
137 | ||
138 | unsigned int accel: | |
139 | 1; /* HTTP accelerator */ | |
140 | ||
141 | unsigned int vhost: | |
142 | 1; /* uses host header */ | |
143 | ||
144 | int vport; /* virtual port support, -1 for dynamic, >0 static*/ | |
5529ca8a | 145 | int disable_pmtu_discovery; |
fc68f6b1 | 146 | #if LINUX_TPROXY |
147 | unsigned int tproxy: | |
148 | 1; /* spoof client ip using tproxy */ | |
149 | #endif | |
fbdba7c4 | 150 | }; |
151 | ||
152 | ||
d193a436 | 153 | #if USE_SSL |
62e76326 | 154 | |
155 | struct _https_port_list | |
156 | { | |
fbdba7c4 | 157 | http_port_list http; /* must be first */ |
d193a436 | 158 | char *cert; |
159 | char *key; | |
79d4ccdf | 160 | int version; |
161 | char *cipher; | |
162 | char *options; | |
a7ad6e4e | 163 | char *clientca; |
164 | char *cafile; | |
165 | char *capath; | |
a82a4fe4 | 166 | char *crlfile; |
35105e4b | 167 | char *dhfile; |
a7ad6e4e | 168 | char *sslflags; |
6b2936d5 | 169 | char *sslcontext; |
a7ad6e4e | 170 | SSL_CTX *sslContext; |
d193a436 | 171 | }; |
62e76326 | 172 | |
d193a436 | 173 | #endif |
94439e4e | 174 | |
56e64999 | 175 | #if DELAY_POOLS |
b67e2c8c | 176 | #include "DelayConfig.h" |
56e64999 | 177 | #endif |
95e36d02 | 178 | |
cc192b50 | 179 | #if USE_ICMP |
180 | #include "ICMPConfig.h" | |
181 | #endif | |
182 | ||
aa839030 | 183 | /* forward decl for SquidConfig, see RemovalPolicy.h */ |
b7d249f9 | 184 | |
aa839030 | 185 | class RemovalPolicySettings; |
d598ee28 | 186 | |
6a566b9c | 187 | |
1e5562e3 | 188 | class external_acl; |
189 | ||
c8f4eac4 | 190 | class Store; |
191 | ||
62e76326 | 192 | struct _SquidConfig |
193 | { | |
194 | ||
195 | struct | |
196 | { | |
c8f4eac4 | 197 | /* These should be for the Store::Root instance. |
198 | * this needs pluggable parsing to be done smoothly. | |
199 | */ | |
62e76326 | 200 | int highWaterMark; |
201 | int lowWaterMark; | |
202 | } | |
203 | ||
204 | Swap; | |
43a70238 | 205 | size_t memMaxSize; |
62e76326 | 206 | |
62e76326 | 207 | struct |
208 | { | |
47f6e231 | 209 | int64_t min; |
62e76326 | 210 | int pct; |
47f6e231 | 211 | int64_t max; |
62e76326 | 212 | } |
213 | ||
214 | quickAbort; | |
47f6e231 | 215 | int64_t readAheadGap; |
6a566b9c | 216 | RemovalPolicySettings *replPolicy; |
217 | RemovalPolicySettings *memPolicy; | |
a8258824 | 218 | time_t negativeTtl; |
219 | time_t negativeDnsTtl; | |
220 | time_t positiveDnsTtl; | |
221 | time_t shutdownLifetime; | |
d1b63fc8 | 222 | time_t backgroundPingRate; |
62e76326 | 223 | |
224 | struct | |
225 | { | |
226 | time_t read; | |
227 | time_t lifetime; | |
228 | time_t connect; | |
777831e0 | 229 | time_t forward; |
62e76326 | 230 | time_t peer_connect; |
231 | time_t request; | |
232 | time_t persistent_request; | |
233 | time_t pconn; | |
234 | time_t siteSelect; | |
235 | time_t deadPeer; | |
236 | int icp_query; /* msec */ | |
237 | int icp_query_max; /* msec */ | |
238 | int icp_query_min; /* msec */ | |
239 | int mcast_icp_query; /* msec */ | |
3898f57f | 240 | #if USE_IDENT |
62e76326 | 241 | |
242 | time_t ident; | |
4fe0e1d0 | 243 | #endif |
244 | #if !USE_DNSSERVERS | |
62e76326 | 245 | |
246 | time_t idns_retransmit; | |
247 | time_t idns_query; | |
3898f57f | 248 | #endif |
62e76326 | 249 | |
250 | } | |
251 | ||
252 | Timeout; | |
0483b991 | 253 | size_t maxRequestHeaderSize; |
47f6e231 | 254 | int64_t maxRequestBodySize; |
4eb368f9 | 255 | size_t maxReplyHeaderSize; |
ef1955a5 | 256 | acl_size_t *ReplyBodySize; |
62e76326 | 257 | |
258 | struct | |
259 | { | |
260 | u_short icp; | |
ace287ee | 261 | #if USE_HTCP |
62e76326 | 262 | |
263 | u_short htcp; | |
ace287ee | 264 | #endif |
1df370e3 | 265 | #if SQUID_SNMP |
62e76326 | 266 | |
267 | u_short snmp; | |
1df370e3 | 268 | #endif |
62e76326 | 269 | |
270 | } | |
271 | ||
272 | Port; | |
273 | ||
274 | struct | |
275 | { | |
276 | http_port_list *http; | |
1f7c9178 | 277 | #if USE_SSL |
62e76326 | 278 | |
279 | https_port_list *https; | |
1f7c9178 | 280 | #endif |
62e76326 | 281 | |
282 | } | |
283 | ||
284 | Sockaddr; | |
1df370e3 | 285 | #if SQUID_SNMP |
62e76326 | 286 | |
287 | struct | |
288 | { | |
289 | char *configFile; | |
290 | char *agentInfo; | |
291 | } | |
292 | ||
293 | Snmp; | |
320e9f36 | 294 | #endif |
eb824054 | 295 | #if USE_WCCP |
62e76326 | 296 | |
297 | struct | |
298 | { | |
299 | ||
cc192b50 | 300 | IPAddress router; |
62e76326 | 301 | |
cc192b50 | 302 | IPAddress address; |
62e76326 | 303 | int version; |
304 | } | |
305 | ||
306 | Wccp; | |
1df370e3 | 307 | #endif |
0b0cfcf2 | 308 | #if USE_WCCPv2 |
309 | ||
310 | struct | |
311 | { | |
cc192b50 | 312 | IPAddress_list *router; |
0b0cfcf2 | 313 | |
cc192b50 | 314 | IPAddress address; |
0b0cfcf2 | 315 | int forwarding_method; |
316 | int return_method; | |
b7d249f9 | 317 | int assignment_method; |
318 | int weight; | |
f67332d3 | 319 | int rebuildwait; |
0b0cfcf2 | 320 | void *info; |
321 | } | |
322 | ||
323 | Wccp2; | |
324 | #endif | |
62e76326 | 325 | |
cc192b50 | 326 | #if USE_ICMP |
327 | ICMPConfig pinger; | |
328 | #endif | |
329 | ||
53ad48e6 | 330 | char *as_whois_server; |
62e76326 | 331 | |
332 | struct | |
333 | { | |
334 | char *log; | |
62e76326 | 335 | char *store; |
336 | char *swap; | |
82839306 | 337 | #if USE_USERAGENT_LOG |
62e76326 | 338 | |
339 | char *useragent; | |
fd2c5549 | 340 | #endif |
341 | #if USE_REFERER_LOG | |
62e76326 | 342 | |
343 | char *referer; | |
225644d7 | 344 | #endif |
345 | #if WIP_FWD_LOG | |
62e76326 | 346 | |
347 | char *forward; | |
82839306 | 348 | #endif |
62e76326 | 349 | |
7684c4b1 | 350 | logformat *logformats; |
351 | ||
352 | customlog *accesslogs; | |
353 | ||
62e76326 | 354 | int rotateNumber; |
355 | } | |
356 | ||
357 | Log; | |
a8258824 | 358 | char *adminEmail; |
abacf776 | 359 | char *EmailFrom; |
d084bf20 | 360 | char *EmailProgram; |
a8258824 | 361 | char *effectiveUser; |
d3caee79 | 362 | char *visible_appname_string; |
a8258824 | 363 | char *effectiveGroup; |
62e76326 | 364 | |
365 | struct | |
366 | { | |
82839306 | 367 | #if USE_DNSSERVERS |
62e76326 | 368 | char *dnsserver; |
efd900cb | 369 | #endif |
62e76326 | 370 | |
371 | wordlist *redirect; | |
a3d0a19d | 372 | #if USE_UNLINKD |
62e76326 | 373 | |
374 | char *unlinkd; | |
a3d0a19d | 375 | #endif |
62e76326 | 376 | |
377 | char *diskd; | |
307b83b7 | 378 | #if USE_SSL |
379 | ||
380 | char *ssl_password; | |
381 | #endif | |
382 | ||
62e76326 | 383 | } |
384 | ||
385 | Program; | |
82839306 | 386 | #if USE_DNSSERVERS |
62e76326 | 387 | |
a8258824 | 388 | int dnsChildren; |
efd900cb | 389 | #endif |
62e76326 | 390 | |
a8258824 | 391 | int redirectChildren; |
07eca7e0 | 392 | int redirectConcurrency; |
94439e4e | 393 | time_t authenticateGCInterval; |
70a76033 | 394 | time_t authenticateTTL; |
395 | time_t authenticateIpTTL; | |
43ae1d95 | 396 | |
397 | struct | |
398 | { | |
f41735ea | 399 | #if USE_SQUID_ESI |
43ae1d95 | 400 | char *surrogate_id; |
401 | #endif | |
402 | ||
403 | } | |
404 | ||
405 | Accel; | |
a8258824 | 406 | char *appendDomain; |
407 | size_t appendDomainLen; | |
408 | char *debugOptions; | |
409 | char *pidFilename; | |
410 | char *mimeTablePathname; | |
0e70aa1e | 411 | char *etcHostsPath; |
a8258824 | 412 | char *visibleHostname; |
98829f69 | 413 | char *uniqueHostname; |
1f38f50a | 414 | wordlist *hostnameAliases; |
a8258824 | 415 | char *errHtmlText; |
62e76326 | 416 | |
417 | struct | |
418 | { | |
419 | char *host; | |
420 | char *file; | |
421 | time_t period; | |
422 | u_short port; | |
423 | } | |
424 | ||
425 | Announce; | |
426 | ||
427 | struct | |
428 | { | |
429 | ||
cc192b50 | 430 | IPAddress udp_incoming; |
62e76326 | 431 | |
cc192b50 | 432 | IPAddress udp_outgoing; |
15dcc168 | 433 | #if SQUID_SNMP |
62e76326 | 434 | |
cc192b50 | 435 | IPAddress snmp_incoming; |
62e76326 | 436 | |
cc192b50 | 437 | IPAddress snmp_outgoing; |
15dcc168 | 438 | #endif |
cc192b50 | 439 | /* FIXME INET6 : this should really be a CIDR value */ |
440 | IPAddress client_netmask; | |
62e76326 | 441 | } |
442 | ||
443 | Addrs; | |
9906e724 | 444 | size_t tcpRcvBufsz; |
445 | size_t udpMaxHitObjsz; | |
a8258824 | 446 | wordlist *hierarchy_stoplist; |
447 | wordlist *mcast_group_list; | |
448 | wordlist *dns_testname_list; | |
09c483ec | 449 | wordlist *dns_nameservers; |
40a1495e | 450 | peer *peers; |
451 | int npeers; | |
62e76326 | 452 | |
453 | struct | |
454 | { | |
455 | int size; | |
456 | int low; | |
457 | int high; | |
458 | } | |
459 | ||
460 | ipcache; | |
461 | ||
462 | struct | |
463 | { | |
464 | int size; | |
465 | } | |
466 | ||
467 | fqdncache; | |
a8258824 | 468 | int minDirectHops; |
5f84d830 | 469 | int minDirectRtt; |
a8258824 | 470 | cachemgr_passwd *passwd_list; |
62e76326 | 471 | |
472 | struct | |
473 | { | |
474 | int objectsPerBucket; | |
3e62bd58 | 475 | int64_t avgObjectSize; |
47f6e231 | 476 | int64_t maxObjectSize; |
477 | int64_t minObjectSize; | |
62e76326 | 478 | size_t maxInMemObjSize; |
479 | } | |
480 | ||
481 | Store; | |
482 | ||
483 | struct | |
484 | { | |
485 | int high; | |
486 | int low; | |
487 | time_t period; | |
488 | } | |
489 | ||
490 | Netdb; | |
491 | ||
492 | struct | |
493 | { | |
494 | int log_udp; | |
62e76326 | 495 | int res_defnames; |
62e76326 | 496 | int anonymizer; |
497 | int client_db; | |
498 | int query_icmp; | |
499 | int icp_hit_stale; | |
500 | int buffered_logs; | |
62e76326 | 501 | int common_log; |
502 | int log_mime_hdrs; | |
503 | int log_fqdn; | |
504 | int announce; | |
505 | int mem_pools; | |
506 | int test_reachability; | |
507 | int half_closed_clients; | |
4c3ef9b2 | 508 | int refresh_all_ims; |
9f60cfdf | 509 | #if HTTP_VIOLATIONS |
62e76326 | 510 | |
511 | int reload_into_ims; | |
9f60cfdf | 512 | #endif |
62e76326 | 513 | |
514 | int offline; | |
515 | int redir_rewrites_host; | |
516 | int prefer_direct; | |
517 | int nonhierarchical_direct; | |
518 | int strip_query_terms; | |
519 | int redirector_bypass; | |
520 | int ignore_unknown_nameservers; | |
521 | int client_pconns; | |
522 | int server_pconns; | |
58850d15 | 523 | int error_pconns; |
7e3ce7b9 | 524 | #if USE_CACHE_DIGESTS |
62e76326 | 525 | |
526 | int digest_generation; | |
7e3ce7b9 | 527 | #endif |
62e76326 | 528 | |
529 | int log_ip_on_direct; | |
530 | int ie_refresh; | |
531 | int vary_ignore_expire; | |
532 | int pipeline_prefetch; | |
f41735ea | 533 | #if USE_SQUID_ESI |
43ae1d95 | 534 | |
535 | int surrogate_is_remote; | |
536 | #endif | |
537 | ||
62e76326 | 538 | int request_entities; |
21b92762 | 539 | int detect_broken_server_pconns; |
a12a049a | 540 | int balance_on_multiple_ip; |
52d3f198 | 541 | int relaxed_header_parser; |
62e76326 | 542 | int check_hostnames; |
a78278e2 | 543 | int allow_underscore; |
62e76326 | 544 | int via; |
545 | int emailErrData; | |
d3caee79 | 546 | int httpd_suppress_version_string; |
f024c970 | 547 | int global_internal_static; |
cc192b50 | 548 | int dns_require_A; |
37296f4c | 549 | int debug_override_X; |
62e76326 | 550 | } |
551 | ||
552 | onoff; | |
97427e90 | 553 | |
554 | class ACL *aclList; | |
62e76326 | 555 | |
556 | struct | |
557 | { | |
558 | acl_access *http; | |
559 | acl_access *icp; | |
560 | acl_access *miss; | |
561 | acl_access *NeverDirect; | |
562 | acl_access *AlwaysDirect; | |
563 | acl_access *ASlists; | |
564 | acl_access *noCache; | |
7684c4b1 | 565 | acl_access *log; |
dba79ac5 | 566 | #if SQUID_SNMP |
62e76326 | 567 | |
568 | acl_access *snmp; | |
dba79ac5 | 569 | #endif |
62e76326 | 570 | |
571 | acl_access *brokenPosts; | |
3898f57f | 572 | #if USE_IDENT |
62e76326 | 573 | |
574 | acl_access *identLookup; | |
3898f57f | 575 | #endif |
62e76326 | 576 | |
577 | acl_access *redirector; | |
578 | acl_access *reply; | |
579 | acl_address *outgoing_address; | |
580 | acl_tos *outgoing_tos; | |
057f5854 | 581 | acl_tos *clientside_tos; |
5401aa8d | 582 | #if USE_HTCP |
583 | ||
584 | acl_access *htcp; | |
585 | acl_access *htcp_clr; | |
586 | #endif | |
587 | ||
62e76326 | 588 | } |
589 | ||
590 | accessList; | |
bd05e3e3 | 591 | acl_deny_info_list *denyInfoList; |
e6ccf245 | 592 | authConfig authConfiguration; |
62e76326 | 593 | |
594 | struct | |
595 | { | |
596 | size_t list_width; | |
597 | int list_wrap; | |
598 | char *anon_user; | |
599 | int passive; | |
600 | int sanitycheck; | |
dad0fe12 | 601 | int telnet; |
62e76326 | 602 | } |
603 | ||
604 | Ftp; | |
a8258824 | 605 | refresh_t *Refresh; |
62e76326 | 606 | |
607 | struct _cacheSwap | |
608 | { | |
c8f4eac4 | 609 | RefCount<class Store> *swapDirs; |
62e76326 | 610 | int n_allocated; |
611 | int n_configured; | |
612 | } | |
613 | ||
614 | cacheSwap; | |
615 | ||
616 | struct | |
617 | { | |
618 | char *directory; | |
e72a0ec0 | 619 | int use_short_names; |
62e76326 | 620 | } |
621 | ||
622 | icons; | |
9b312a19 | 623 | char *errorDirectory; |
62e76326 | 624 | |
625 | struct | |
626 | { | |
62e76326 | 627 | int maxtries; |
5894ad28 | 628 | int onerror; |
62e76326 | 629 | } |
630 | ||
631 | retry; | |
632 | ||
633 | struct | |
634 | { | |
635 | size_t limit; | |
636 | } | |
637 | ||
638 | MemPools; | |
95e36d02 | 639 | #if DELAY_POOLS |
62e76326 | 640 | |
b67e2c8c | 641 | DelayConfig Delay; |
95e36d02 | 642 | #endif |
62e76326 | 643 | |
644 | struct | |
645 | { | |
646 | int icp_average; | |
647 | int dns_average; | |
648 | int http_average; | |
649 | int icp_min_poll; | |
650 | int dns_min_poll; | |
651 | int http_min_poll; | |
652 | } | |
653 | ||
654 | comm_incoming; | |
c5f627c2 | 655 | int max_open_disk_fds; |
d548ee64 | 656 | int uri_whitespace; |
47f6e231 | 657 | int64_t rangeOffsetLimit; |
e66d7923 | 658 | #if MULTICAST_MISS_STREAM |
62e76326 | 659 | |
660 | struct | |
661 | { | |
662 | ||
cc192b50 | 663 | IPAddress addr; |
62e76326 | 664 | int ttl; |
665 | unsigned short port; | |
666 | char *encode_key; | |
667 | } | |
668 | ||
669 | mcast_miss; | |
e66d7923 | 670 | #endif |
62e76326 | 671 | |
25b6a907 | 672 | /* one access list per header type we know of */ |
8c01ada0 | 673 | header_mangler request_header_access[HDR_ENUM_END]; |
25b6a907 | 674 | /* one access list per header type we know of */ |
8c01ada0 | 675 | header_mangler reply_header_access[HDR_ENUM_END]; |
b6a2f15e | 676 | char *coredump_dir; |
efd900cb | 677 | char *chroot_dir; |
7e3ce7b9 | 678 | #if USE_CACHE_DIGESTS |
62e76326 | 679 | |
680 | struct | |
681 | { | |
682 | int bits_per_entry; | |
683 | time_t rebuild_period; | |
684 | time_t rewrite_period; | |
685 | size_t swapout_chunk_size; | |
686 | int rebuild_chunk_percentage; | |
687 | } | |
688 | ||
689 | digest; | |
1f7c9178 | 690 | #endif |
691 | #if USE_SSL | |
62e76326 | 692 | |
693 | struct | |
694 | { | |
695 | int unclean_shutdown; | |
696 | char *ssl_engine; | |
697 | } | |
698 | ||
699 | SSL; | |
7e3ce7b9 | 700 | #endif |
62e76326 | 701 | |
56fe752e | 702 | wordlist *ext_methods; |
62e76326 | 703 | |
704 | struct | |
705 | { | |
706 | int high_rptm; | |
707 | int high_pf; | |
708 | size_t high_memory; | |
709 | } | |
710 | ||
711 | warnings; | |
65a53c8e | 712 | char *store_dir_select_algorithm; |
1fbbdcb0 | 713 | int sleep_after_fork; /* microseconds */ |
6a2f3fcf | 714 | time_t minimum_expiry_time; /* seconds */ |
d9572179 | 715 | external_acl *externalAclHelperList; |
a7ad6e4e | 716 | #if USE_SSL |
62e76326 | 717 | |
718 | struct | |
719 | { | |
720 | char *cert; | |
721 | char *key; | |
722 | int version; | |
723 | char *options; | |
724 | char *cipher; | |
725 | char *cafile; | |
726 | char *capath; | |
a82a4fe4 | 727 | char *crlfile; |
62e76326 | 728 | char *flags; |
729 | SSL_CTX *sslContext; | |
730 | } | |
731 | ||
732 | ssl_client; | |
a7ad6e4e | 733 | #endif |
cc9f92d4 | 734 | |
cc9f92d4 | 735 | char *accept_filter; |
a8258824 | 736 | }; |
737 | ||
62e76326 | 738 | struct _SquidConfig2 |
739 | { | |
740 | ||
741 | struct | |
742 | { | |
743 | int enable_purge; | |
4f56514c | 744 | int mangle_request_headers; |
62e76326 | 745 | } |
746 | ||
747 | onoff; | |
d20b1cd0 | 748 | uid_t effectiveUserID; |
749 | gid_t effectiveGroupID; | |
a8258824 | 750 | }; |
751 | ||
62e76326 | 752 | struct _close_handler |
753 | { | |
a8258824 | 754 | PF *handler; |
755 | void *data; | |
756 | close_handler *next; | |
757 | }; | |
758 | ||
62e76326 | 759 | struct _dread_ctrl |
760 | { | |
a8258824 | 761 | int fd; |
762 | off_t offset; | |
763 | int req_len; | |
764 | char *buf; | |
765 | int end_of_file; | |
766 | DRCB *handler; | |
767 | void *client_data; | |
768 | }; | |
769 | ||
62e76326 | 770 | struct _dnsserver_t |
771 | { | |
a8258824 | 772 | int id; |
a8258824 | 773 | int inpipe; |
774 | int outpipe; | |
775 | time_t answer; | |
78f1250a | 776 | off_t offset; |
777 | size_t size; | |
e144eae4 | 778 | char ip_inbuf[DNS_INBUF_SZ]; |
62e76326 | 779 | |
a8258824 | 780 | struct timeval dispatch_time; |
781 | void *data; | |
782 | }; | |
783 | ||
62e76326 | 784 | struct _dwrite_q |
785 | { | |
d377699f | 786 | off_t file_offset; |
a8258824 | 787 | char *buf; |
788 | int len; | |
d377699f | 789 | off_t buf_offset; |
bd05e3e3 | 790 | dwrite_q *next; |
74fbf3c9 | 791 | FREE *free_func; |
a8258824 | 792 | }; |
793 | ||
a9771e51 | 794 | |
795 | /* ETag support is rudimantal; | |
796 | * this struct is likely to change | |
797 | * Note: "str" points to memory in HttpHeaderEntry (for now) | |
798 | * so ETags should be used as tmp variables only (for now) */ | |
62e76326 | 799 | |
800 | struct _ETag | |
801 | { | |
98829f69 | 802 | const char *str; /* quoted-string */ |
803 | int weak; /* true if it is a weak validator */ | |
a9771e51 | 804 | }; |
805 | ||
62e76326 | 806 | struct _fde_disk |
807 | { | |
e6ccf245 | 808 | DWCB *wrt_handle; |
809 | void *wrt_handle_data; | |
810 | dwrite_q *write_q; | |
811 | dwrite_q *write_q_tail; | |
812 | off_t offset; | |
813 | }; | |
814 | ||
62e76326 | 815 | struct _fileMap |
816 | { | |
a8258824 | 817 | int max_n_files; |
818 | int n_files_in_map; | |
a8258824 | 819 | int toggle; |
820 | int nwords; | |
821 | unsigned long *file_map; | |
822 | }; | |
823 | ||
adba4a64 | 824 | /* |
1d21d91d | 825 | * Note: HttpBody is used only for messages with a small content that is |
adba4a64 | 826 | * known a priory (e.g., error messages). |
827 | */ | |
0eb49b6d | 828 | |
829 | class MemBuf; | |
62e76326 | 830 | |
831 | struct _HttpBody | |
832 | { | |
1d21d91d | 833 | /* private */ |
032785bf | 834 | MemBuf *mb; |
adba4a64 | 835 | }; |
836 | ||
cf414c2d | 837 | #include "SquidString.h" |
2ecaa5e7 | 838 | /* http header extention field */ |
62e76326 | 839 | |
0353e724 | 840 | class HttpHdrExtField |
62e76326 | 841 | { |
30abd221 | 842 | String name; /* field-name from HTTP/1.1 (no column after name) */ |
843 | String value; /* field-value from HTTP/1.1 */ | |
2ecaa5e7 | 844 | }; |
adba4a64 | 845 | |
399e85ea | 846 | /* http cache control header field */ |
62e76326 | 847 | |
985c86bc | 848 | class HttpHdrCc |
62e76326 | 849 | { |
985c86bc | 850 | |
851 | public: | |
4f087419 | 852 | int mask; |
d8b249ef | 853 | int max_age; |
7e3ce7b9 | 854 | int s_maxage; |
49ff0930 | 855 | int max_stale; |
30abd221 | 856 | String other; |
a8258824 | 857 | }; |
ee1679df | 858 | |
a9771e51 | 859 | /* some fields can hold either time or etag specs (e.g. If-Range) */ |
62e76326 | 860 | |
861 | struct _TimeOrTag | |
862 | { | |
98829f69 | 863 | ETag tag; /* entity tag */ |
a9771e51 | 864 | time_t time; |
98829f69 | 865 | int valid; /* true if struct is usable */ |
a9771e51 | 866 | }; |
867 | ||
7faf2bdb | 868 | /* per field statistics */ |
62e76326 | 869 | |
0353e724 | 870 | class HttpHeaderFieldStat |
62e76326 | 871 | { |
0353e724 | 872 | |
873 | public: | |
874 | HttpHeaderFieldStat() : aliveCount(0), seenCount(0), parsCount(0), errCount(0), repCount(0){} | |
875 | ||
399e85ea | 876 | int aliveCount; /* created but not destroyed (count) */ |
d8b249ef | 877 | int seenCount; /* #fields we've seen */ |
399e85ea | 878 | int parsCount; /* #parsing attempts */ |
879 | int errCount; /* #pasring errors */ | |
880 | int repCount; /* #repetitons */ | |
7faf2bdb | 881 | }; |
882 | ||
d8b249ef | 883 | /* compiled version of HttpHeaderFieldAttrs plus stats */ |
62e76326 | 884 | |
0353e724 | 885 | class HttpHeaderFieldInfo |
62e76326 | 886 | { |
0353e724 | 887 | |
888 | public: | |
889 | HttpHeaderFieldInfo() : id (HDR_ACCEPT), type (ftInvalid){} | |
890 | ||
de336bbe | 891 | http_hdr_type id; |
30abd221 | 892 | String name; |
de336bbe | 893 | field_type type; |
7faf2bdb | 894 | HttpHeaderFieldStat stat; |
895 | }; | |
896 | ||
62e76326 | 897 | struct _http_state_flags |
898 | { | |
899 | ||
900 | unsigned int proxying: | |
901 | 1; | |
902 | ||
903 | unsigned int keepalive: | |
904 | 1; | |
905 | ||
906 | unsigned int only_if_cached: | |
907 | 1; | |
908 | ||
1a98175f | 909 | unsigned int headers_parsed: |
910 | 1; | |
911 | ||
62e76326 | 912 | unsigned int front_end_https: |
913 | 2; | |
914 | ||
915 | unsigned int originpeer: | |
916 | 1; | |
21b92762 | 917 | |
918 | unsigned int keepalive_broken: | |
919 | 1; | |
920 | ||
921 | unsigned int abuse_detected: | |
922 | 1; | |
72b63f06 | 923 | |
924 | unsigned int request_sent: | |
925 | 1; | |
f61f0107 | 926 | |
927 | unsigned int do_next_read: | |
928 | 1; | |
3b299123 | 929 | |
930 | unsigned int consume_body_data: | |
931 | 1; | |
b515fc11 | 932 | }; |
a8258824 | 933 | |
62e76326 | 934 | struct _ipcache_addrs |
935 | { | |
cc192b50 | 936 | IPAddress *in_addrs; |
6d1c0d53 | 937 | unsigned char *bad_mask; |
a8258824 | 938 | unsigned char count; |
939 | unsigned char cur; | |
22c653cd | 940 | unsigned char badcount; |
a8258824 | 941 | }; |
942 | ||
62e76326 | 943 | struct _domain_ping |
944 | { | |
a8258824 | 945 | char *domain; |
946 | int do_ping; /* boolean */ | |
bd05e3e3 | 947 | domain_ping *next; |
a8258824 | 948 | }; |
949 | ||
62e76326 | 950 | struct _domain_type |
951 | { | |
a8258824 | 952 | char *domain; |
953 | peer_t type; | |
bd05e3e3 | 954 | domain_type *next; |
a8258824 | 955 | }; |
956 | ||
c68e9c6b | 957 | #if USE_CACHE_DIGESTS |
62e76326 | 958 | |
e41e6dcd | 959 | /* statistics for cache digests and other hit "predictors" */ |
62e76326 | 960 | |
961 | struct _cd_guess_stats | |
962 | { | |
e41e6dcd | 963 | /* public, read-only */ |
964 | int true_hits; | |
965 | int false_hits; | |
966 | int true_misses; | |
967 | int false_misses; | |
4b4cd312 | 968 | int close_hits; /* tmp, remove it later */ |
e41e6dcd | 969 | }; |
970 | ||
c68e9c6b | 971 | #endif |
972 | ||
62e76326 | 973 | struct _peer |
974 | { | |
cc192b50 | 975 | u_int index; |
be753325 | 976 | char *name; |
a8258824 | 977 | char *host; |
978 | peer_t type; | |
62e76326 | 979 | |
cc192b50 | 980 | IPAddress in_addr; |
62e76326 | 981 | |
982 | struct | |
983 | { | |
984 | int pings_sent; | |
985 | int pings_acked; | |
986 | int fetches; | |
987 | int rtt; | |
988 | int ignored_replies; | |
989 | int n_keepalives_sent; | |
990 | int n_keepalives_recv; | |
991 | time_t probe_start; | |
992 | time_t last_query; | |
993 | time_t last_reply; | |
994 | time_t last_connect_failure; | |
995 | time_t last_connect_probe; | |
996 | int logged_state; /* so we can print dead/revived msgs */ | |
997 | int conn_open; /* current opened connections */ | |
998 | } | |
999 | ||
1000 | stats; | |
1001 | ||
1002 | struct | |
1003 | { | |
1004 | int version; | |
093bce8b | 1005 | int counts[ICP_END+1]; |
62e76326 | 1006 | u_short port; |
1007 | } | |
1008 | ||
1009 | icp; | |
399cabec | 1010 | #if USE_HTCP |
62e76326 | 1011 | |
1012 | struct | |
1013 | { | |
1014 | double version; | |
1015 | int counts[2]; | |
1016 | u_short port; | |
1017 | } | |
1018 | ||
1019 | htcp; | |
399cabec | 1020 | #endif |
62e76326 | 1021 | |
a8258824 | 1022 | u_short http_port; |
b6a2f15e | 1023 | domain_ping *peer_domain; |
bd05e3e3 | 1024 | domain_type *typelist; |
505e35db | 1025 | acl_access *access; |
62e76326 | 1026 | |
1027 | struct | |
1028 | { | |
1029 | ||
1030 | unsigned int proxy_only: | |
1031 | 1; | |
1032 | ||
1033 | unsigned int no_query: | |
1034 | 1; | |
1035 | ||
1036 | unsigned int background_ping: | |
1037 | 1; | |
1038 | ||
1039 | unsigned int no_digest: | |
1040 | 1; | |
1041 | ||
1042 | unsigned int default_parent: | |
1043 | 1; | |
1044 | ||
1045 | unsigned int roundrobin: | |
1046 | 1; | |
1047 | ||
1048 | unsigned int weighted_roundrobin: | |
1049 | 1; | |
1050 | ||
1051 | unsigned int mcast_responder: | |
1052 | 1; | |
1053 | ||
1054 | unsigned int closest_only: | |
1055 | 1; | |
cd196bc8 | 1056 | #if USE_HTCP |
62e76326 | 1057 | |
1058 | unsigned int htcp: | |
1059 | 1; | |
527ee50d | 1060 | |
1061 | unsigned int htcp_oldsquid: | |
1062 | 1; | |
cd196bc8 | 1063 | #endif |
62e76326 | 1064 | |
1065 | unsigned int no_netdb_exchange: | |
1066 | 1; | |
cd196bc8 | 1067 | #if DELAY_POOLS |
62e76326 | 1068 | |
1069 | unsigned int no_delay: | |
1070 | 1; | |
cd196bc8 | 1071 | #endif |
62e76326 | 1072 | |
1073 | unsigned int allow_miss: | |
1074 | 1; | |
b3995439 | 1075 | #if USE_CARP |
62e76326 | 1076 | |
1077 | unsigned int carp: | |
1078 | 1; | |
b3995439 | 1079 | #endif |
62e76326 | 1080 | |
1081 | unsigned int originserver: | |
1082 | 1; | |
1083 | } | |
1084 | ||
1085 | options; | |
a8258824 | 1086 | int weight; |
d1b63fc8 | 1087 | int basetime; |
62e76326 | 1088 | |
1089 | struct | |
1090 | { | |
1091 | double avg_n_members; | |
1092 | int n_times_counted; | |
1093 | int n_replies_expected; | |
1094 | int ttl; | |
1095 | int id; | |
1096 | ||
1097 | struct | |
1098 | { | |
1099 | ||
1100 | unsigned int count_event_pending: | |
1101 | 1; | |
1102 | ||
1103 | unsigned int counting: | |
1104 | 1; | |
1105 | } | |
1106 | ||
1107 | flags; | |
1108 | } | |
1109 | ||
1110 | mcast; | |
c68e9c6b | 1111 | #if USE_CACHE_DIGESTS |
62e76326 | 1112 | |
e13ee7ad | 1113 | PeerDigest *digest; |
7e3ce7b9 | 1114 | char *digest_url; |
c68e9c6b | 1115 | #endif |
62e76326 | 1116 | |
a8258824 | 1117 | int tcp_up; /* 0 if a connect() fails */ |
62e76326 | 1118 | |
cc192b50 | 1119 | IPAddress addresses[10]; |
a8258824 | 1120 | int n_addresses; |
1121 | int rr_count; | |
82056f1e | 1122 | int rr_lastcount; |
bd05e3e3 | 1123 | peer *next; |
a8258824 | 1124 | int test_fd; |
afd88fbe | 1125 | #if USE_CARP |
62e76326 | 1126 | |
1127 | struct | |
1128 | { | |
1129 | unsigned int hash; | |
1130 | double load_multiplier; | |
1131 | double load_factor; /* normalized weight value */ | |
1132 | } | |
1133 | ||
1134 | carp; | |
afd88fbe | 1135 | #endif |
62e76326 | 1136 | |
c68e9c6b | 1137 | char *login; /* Proxy authorization */ |
3f62decd | 1138 | time_t connect_timeout; |
c7f9eb6d | 1139 | int max_conn; |
be753325 | 1140 | char *domain; /* Forced domain */ |
a7ad6e4e | 1141 | #if USE_SSL |
62e76326 | 1142 | |
a7ad6e4e | 1143 | int use_ssl; |
1144 | char *sslcert; | |
1145 | char *sslkey; | |
1146 | int sslversion; | |
1147 | char *ssloptions; | |
1148 | char *sslcipher; | |
1149 | char *sslcafile; | |
1150 | char *sslcapath; | |
a82a4fe4 | 1151 | char *sslcrlfile; |
a7ad6e4e | 1152 | char *sslflags; |
1153 | char *ssldomain; | |
1154 | SSL_CTX *sslContext; | |
f38c5e43 | 1155 | SSL_SESSION *sslSession; |
a7ad6e4e | 1156 | #endif |
62e76326 | 1157 | |
a7ad6e4e | 1158 | int front_end_https; |
a8258824 | 1159 | }; |
1160 | ||
62e76326 | 1161 | struct _net_db_name |
1162 | { | |
186477c1 | 1163 | hash_link hash; /* must be first */ |
74fbf3c9 | 1164 | net_db_name *next; |
1165 | netdbEntry *net_db_entry; | |
a8258824 | 1166 | }; |
1167 | ||
62e76326 | 1168 | struct _net_db_peer |
1169 | { | |
6b53c392 | 1170 | const char *peername; |
a8258824 | 1171 | double hops; |
1172 | double rtt; | |
1173 | time_t expires; | |
1174 | }; | |
1175 | ||
62e76326 | 1176 | struct _netdbEntry |
1177 | { | |
186477c1 | 1178 | hash_link hash; /* must be first */ |
cc192b50 | 1179 | char network[MAX_IPSTRLEN]; |
a8258824 | 1180 | int pings_sent; |
1181 | int pings_recv; | |
1182 | double hops; | |
1183 | double rtt; | |
1184 | time_t next_ping_time; | |
1185 | time_t last_use_time; | |
1186 | int link_count; | |
1187 | net_db_name *hosts; | |
1188 | net_db_peer *peers; | |
1189 | int n_peers_alloc; | |
1190 | int n_peers; | |
1191 | }; | |
1192 | ||
a8258824 | 1193 | |
62e76326 | 1194 | struct _iostats |
1195 | { | |
1196 | ||
1197 | struct | |
1198 | { | |
1199 | int reads; | |
1200 | int reads_deferred; | |
1201 | int read_hist[16]; | |
1202 | int writes; | |
1203 | int write_hist[16]; | |
1204 | } | |
1205 | ||
db80e881 | 1206 | Http, Ftp, Gopher; |
a8258824 | 1207 | }; |
1208 | ||
6a566b9c | 1209 | |
62e76326 | 1210 | struct request_flags |
1211 | { | |
58217e94 | 1212 | 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),transparent(0),internal(0),internalclient(0),must_keepalive(0),destinationIPLookedUp_(0) |
62e76326 | 1213 | { |
e429f975 | 1214 | #if HTTP_VIOLATIONS |
72eee553 | 1215 | nocache_hack = 0; |
e429f975 | 1216 | #endif |
fc68f6b1 | 1217 | #if LINUX_TPROXY |
1218 | tproxy = 0; | |
1219 | #endif | |
62e76326 | 1220 | |
1221 | } | |
1222 | ||
1223 | unsigned int range: | |
1224 | 1; | |
1225 | ||
1226 | unsigned int nocache: | |
1227 | 1; | |
1228 | ||
1229 | unsigned int ims: | |
1230 | 1; | |
1231 | ||
1232 | unsigned int auth: | |
1233 | 1; | |
1234 | ||
1235 | unsigned int cachable: | |
1236 | 1; | |
1237 | ||
1238 | unsigned int hierarchical: | |
1239 | 1; | |
1240 | ||
1241 | unsigned int loopdetect: | |
1242 | 1; | |
1243 | ||
1244 | unsigned int proxy_keepalive: | |
1245 | 1; | |
1246 | ||
1247 | unsigned int proxying: | |
1248 | 1; /* this should be killed, also in httpstateflags */ | |
1249 | ||
1250 | unsigned int refresh: | |
1251 | 1; | |
1252 | ||
1253 | unsigned int redirected: | |
1254 | 1; | |
1255 | ||
1256 | unsigned int need_validation: | |
1257 | 1; | |
9f60cfdf | 1258 | #if HTTP_VIOLATIONS |
62e76326 | 1259 | |
1260 | unsigned int nocache_hack: | |
1261 | 1; /* for changing/ignoring no-cache requests */ | |
9f60cfdf | 1262 | #endif |
62e76326 | 1263 | |
1264 | unsigned int accelerated: | |
1265 | 1; | |
1266 | ||
d048c262 | 1267 | unsigned int transparent: |
1268 | 1; | |
1269 | ||
fc68f6b1 | 1270 | #if LINUX_TPROXY |
1271 | unsigned int tproxy: | |
1272 | 1; /* spoof client ip using tproxy */ | |
1273 | #endif | |
62e76326 | 1274 | unsigned int internal: |
1275 | 1; | |
1276 | ||
1277 | unsigned int internalclient: | |
1278 | 1; | |
1279 | ||
f5e45ad8 | 1280 | unsigned int must_keepalive: |
1281 | 1; | |
5f8252d2 | 1282 | |
1283 | // When adding new flags, please update cloneAdaptationImmune() as needed. | |
1284 | ||
e429f975 | 1285 | bool resetTCP() const; |
1286 | void setResetTCP(); | |
1287 | void clearResetTCP(); | |
8000a965 | 1288 | void destinationIPLookupCompleted(); |
1289 | bool destinationIPLookedUp() const; | |
62e76326 | 1290 | |
5f8252d2 | 1291 | // returns a partial copy of the flags that includes only those flags |
1292 | // that are safe for a related (e.g., ICAP-adapted) request to inherit | |
1293 | request_flags cloneAdaptationImmune() const; | |
1294 | ||
e429f975 | 1295 | private: |
62e76326 | 1296 | |
1297 | unsigned int reset_tcp: | |
1298 | 1; | |
1299 | ||
1300 | unsigned int destinationIPLookedUp_: | |
1301 | 1; | |
92695e5e | 1302 | }; |
1303 | ||
62e76326 | 1304 | struct _link_list |
1305 | { | |
d03d26fb | 1306 | void *ptr; |
62e76326 | 1307 | |
d03d26fb | 1308 | struct _link_list *next; |
1309 | }; | |
1310 | ||
62e76326 | 1311 | struct _cachemgr_passwd |
1312 | { | |
a8258824 | 1313 | char *passwd; |
22f3fd98 | 1314 | wordlist *actions; |
bd05e3e3 | 1315 | cachemgr_passwd *next; |
a8258824 | 1316 | }; |
1317 | ||
62e76326 | 1318 | struct _refresh_t |
1319 | { | |
a2c963ae | 1320 | const char *pattern; |
a8258824 | 1321 | regex_t compiled_pattern; |
1322 | time_t min; | |
c3f6d204 | 1323 | double pct; |
a8258824 | 1324 | time_t max; |
bd05e3e3 | 1325 | refresh_t *next; |
62e76326 | 1326 | |
1327 | struct | |
1328 | { | |
1329 | ||
1330 | unsigned int icase: | |
1331 | 1; | |
4c3ef9b2 | 1332 | |
1333 | unsigned int refresh_ims: | |
1334 | 1; | |
9f60cfdf | 1335 | #if HTTP_VIOLATIONS |
62e76326 | 1336 | |
1337 | unsigned int override_expire: | |
1338 | 1; | |
1339 | ||
1340 | unsigned int override_lastmod: | |
1341 | 1; | |
1342 | ||
1343 | unsigned int reload_into_ims: | |
1344 | 1; | |
1345 | ||
1346 | unsigned int ignore_reload: | |
1347 | 1; | |
38f9c547 | 1348 | |
1349 | unsigned int ignore_no_cache: | |
1350 | 1; | |
1351 | ||
1352 | unsigned int ignore_no_store: | |
1353 | 1; | |
1354 | ||
1355 | unsigned int ignore_private: | |
1356 | 1; | |
1357 | ||
1358 | unsigned int ignore_auth: | |
1359 | 1; | |
9f60cfdf | 1360 | #endif |
62e76326 | 1361 | |
1362 | } | |
1363 | ||
1364 | flags; | |
a8258824 | 1365 | }; |
1366 | ||
12cf1be2 | 1367 | /* |
1368 | * "very generic" histogram; | |
1369 | * see important comments on hbase_f restrictions in StatHist.c | |
1370 | */ | |
62e76326 | 1371 | |
1372 | struct _StatHist | |
1373 | { | |
12cf1be2 | 1374 | int *bins; |
1375 | int capacity; | |
e9a13293 | 1376 | double min; |
1377 | double max; | |
1378 | double scale; | |
95c297ec | 1379 | hbase_f *val_in; /* e.g., log() for log-based histogram */ |
1380 | hbase_f *val_out; /* e.g., exp() for log based histogram */ | |
7ae52c25 | 1381 | }; |
1382 | ||
12cf1be2 | 1383 | /* |
1384 | * if you add a field to StatCounters, | |
1d803566 | 1385 | * you MUST sync statCountersInitSpecial, statCountersClean, and statCountersCopy |
12cf1be2 | 1386 | */ |
62e76326 | 1387 | |
1388 | struct _StatCounters | |
1389 | { | |
1390 | ||
1391 | struct | |
1392 | { | |
1393 | int clients; | |
1394 | int requests; | |
1395 | int hits; | |
1396 | int mem_hits; | |
1397 | int disk_hits; | |
1398 | int errors; | |
1399 | kb_t kbytes_in; | |
1400 | kb_t kbytes_out; | |
1401 | kb_t hit_kbytes_out; | |
1402 | StatHist miss_svc_time; | |
1403 | StatHist nm_svc_time; | |
1404 | StatHist nh_svc_time; | |
1405 | StatHist hit_svc_time; | |
1406 | StatHist all_svc_time; | |
1407 | } | |
1408 | ||
1409 | client_http; | |
1410 | ||
1411 | struct | |
1412 | { | |
1413 | ||
1414 | struct | |
1415 | { | |
1416 | int requests; | |
1417 | int errors; | |
1418 | kb_t kbytes_in; | |
1419 | kb_t kbytes_out; | |
1420 | } | |
1421 | ||
1422 | all , http, ftp, other; | |
1423 | } | |
1424 | ||
1425 | server; | |
1426 | ||
1427 | struct | |
1428 | { | |
1429 | int pkts_sent; | |
1430 | int queries_sent; | |
1431 | int replies_sent; | |
1432 | int pkts_recv; | |
1433 | int queries_recv; | |
1434 | int replies_recv; | |
1435 | int hits_sent; | |
1436 | int hits_recv; | |
1437 | int replies_queued; | |
1438 | int replies_dropped; | |
1439 | kb_t kbytes_sent; | |
1440 | kb_t q_kbytes_sent; | |
1441 | kb_t r_kbytes_sent; | |
1442 | kb_t kbytes_recv; | |
1443 | kb_t q_kbytes_recv; | |
1444 | kb_t r_kbytes_recv; | |
1445 | StatHist query_svc_time; | |
1446 | StatHist reply_svc_time; | |
1447 | int query_timeouts; | |
1448 | int times_used; | |
1449 | } | |
1450 | ||
1451 | icp; | |
1452 | ||
c4ebc830 | 1453 | struct |
1454 | { | |
1455 | int pkts_sent; | |
1456 | int pkts_recv; | |
1457 | } | |
1458 | ||
1459 | htcp; | |
1460 | ||
62e76326 | 1461 | struct |
1462 | { | |
1463 | int requests; | |
1464 | } | |
1465 | ||
1466 | unlink; | |
1467 | ||
1468 | struct | |
1469 | { | |
1470 | StatHist svc_time; | |
1471 | } | |
1472 | ||
1473 | dns; | |
1474 | ||
1475 | struct | |
1476 | { | |
1477 | int times_used; | |
1478 | kb_t kbytes_sent; | |
1479 | kb_t kbytes_recv; | |
1480 | kb_t memory; | |
1481 | int msgs_sent; | |
1482 | int msgs_recv; | |
c68e9c6b | 1483 | #if USE_CACHE_DIGESTS |
62e76326 | 1484 | |
1485 | cd_guess_stats guess; | |
c68e9c6b | 1486 | #endif |
62e76326 | 1487 | |
1488 | StatHist on_xition_count; | |
1489 | } | |
1490 | ||
1491 | cd; | |
1492 | ||
1493 | struct | |
1494 | { | |
1495 | int times_used; | |
1496 | } | |
1497 | ||
1498 | netdb; | |
f2908497 | 1499 | int page_faults; |
1500 | int select_loops; | |
d239c2f5 | 1501 | int select_fds; |
1502 | double select_time; | |
f2908497 | 1503 | double cputime; |
62e76326 | 1504 | |
d5649d9f | 1505 | struct timeval timestamp; |
c6ecdbc3 | 1506 | StatHist comm_icp_incoming; |
ef523f99 | 1507 | StatHist comm_dns_incoming; |
c6ecdbc3 | 1508 | StatHist comm_http_incoming; |
26d6ee93 | 1509 | StatHist select_fds_hist; |
62e76326 | 1510 | |
1511 | struct | |
1512 | { | |
1513 | ||
1514 | struct | |
1515 | { | |
1516 | int opens; | |
1517 | int closes; | |
1518 | int reads; | |
1519 | int writes; | |
1520 | int seeks; | |
1521 | int unlinks; | |
1522 | } | |
1523 | ||
1524 | disk; | |
1525 | ||
1526 | struct | |
1527 | { | |
1528 | int accepts; | |
1529 | int sockets; | |
1530 | int connects; | |
1531 | int binds; | |
1532 | int closes; | |
1533 | int reads; | |
1534 | int writes; | |
1535 | int recvfroms; | |
1536 | int sendtos; | |
1537 | } | |
1538 | ||
1539 | sock; | |
62e76326 | 1540 | int selects; |
62e76326 | 1541 | } |
1542 | ||
1543 | syscalls; | |
bfae3379 | 1544 | int aborted_requests; |
62e76326 | 1545 | |
1546 | struct | |
1547 | { | |
1548 | int files_cleaned; | |
1549 | int outs; | |
1550 | int ins; | |
1551 | } | |
1552 | ||
1553 | swap; | |
f2908497 | 1554 | }; |
69c01cd7 | 1555 | |
fcd2d3ef | 1556 | /* per header statistics */ |
62e76326 | 1557 | |
1558 | struct _HttpHeaderStat | |
1559 | { | |
fcd2d3ef | 1560 | const char *label; |
1561 | HttpHeaderMask *owner_mask; | |
1562 | ||
1563 | StatHist hdrUCountDistr; | |
1564 | StatHist fieldTypeDistr; | |
1565 | StatHist ccTypeDistr; | |
43ae1d95 | 1566 | StatHist scTypeDistr; |
fcd2d3ef | 1567 | |
1568 | int parsedCount; | |
1569 | int ccParsedCount; | |
43ae1d95 | 1570 | int scParsedCount; |
fcd2d3ef | 1571 | int destroyedCount; |
1572 | int busyDestroyedCount; | |
1573 | }; | |
1574 | ||
59c4d35b | 1575 | |
62e76326 | 1576 | struct _ClientInfo |
1577 | { | |
186477c1 | 1578 | hash_link hash; /* must be first */ |
62e76326 | 1579 | |
cc192b50 | 1580 | IPAddress addr; |
62e76326 | 1581 | |
1582 | struct | |
1583 | { | |
1584 | int result_hist[LOG_TYPE_MAX]; | |
1585 | int n_requests; | |
1586 | kb_t kbytes_in; | |
1587 | kb_t kbytes_out; | |
1588 | kb_t hit_kbytes_out; | |
1589 | } | |
1590 | ||
1591 | Http, Icp; | |
1592 | ||
1593 | struct | |
1594 | { | |
1595 | time_t time; | |
1596 | int n_req; | |
1597 | int n_denied; | |
1598 | } | |
1599 | ||
1600 | cutoff; | |
9bc73deb | 1601 | int n_established; /* number of current established connections */ |
a0eba6bc | 1602 | time_t last_seen; |
59c4d35b | 1603 | }; |
c411be12 | 1604 | |
62e76326 | 1605 | struct _CacheDigest |
1606 | { | |
c411be12 | 1607 | /* public, read-only */ |
1afe05c5 | 1608 | char *mask; /* bit mask */ |
1609 | size_t mask_size; /* mask size in bytes */ | |
1610 | int capacity; /* expected maximum for .count, not a hard limit */ | |
04f0c415 | 1611 | int bits_per_entry; /* number of bits allocated for each entry from capacity */ |
1afe05c5 | 1612 | int count; /* number of digested entries */ |
1613 | int del_count; /* number of deletions performed so far */ | |
c411be12 | 1614 | }; |
910169e5 | 1615 | |
b2c141d4 | 1616 | |
62e76326 | 1617 | struct _store_rebuild_data |
1618 | { | |
b2c141d4 | 1619 | int objcount; /* # objects successfully reloaded */ |
1620 | int expcount; /* # objects expired */ | |
1621 | int scancount; /* # entries scanned or read from state file */ | |
1622 | int clashcount; /* # swapfile clashes avoided */ | |
1623 | int dupcount; /* # duplicates purged */ | |
1624 | int cancelcount; /* # SWAP_LOG_DEL objects purged */ | |
1625 | int invalid; /* # bad lines */ | |
1626 | int badflags; /* # bad e->flags */ | |
1627 | int bad_log_op; | |
1628 | int zero_object_sz; | |
1629 | }; | |
5673c2e2 | 1630 | |
62e76326 | 1631 | struct _Logfile |
1632 | { | |
5673c2e2 | 1633 | int fd; |
1634 | char path[MAXPATHLEN]; | |
1635 | char *buf; | |
1636 | size_t bufsz; | |
1637 | off_t offset; | |
62e76326 | 1638 | |
1639 | struct | |
1640 | { | |
c33aa074 | 1641 | unsigned int fatal; |
1642 | unsigned int syslog; | |
62e76326 | 1643 | } |
1644 | ||
1645 | flags; | |
c33aa074 | 1646 | |
1647 | int syslog_priority; | |
5673c2e2 | 1648 | }; |
8e8d4f30 | 1649 | |
7684c4b1 | 1650 | struct _logformat |
1651 | { | |
1652 | char *name; | |
1653 | logformat_token *format; | |
1654 | logformat *next; | |
1655 | }; | |
1656 | ||
1657 | struct _customlog | |
1658 | { | |
1659 | char *filename; | |
76cd39d7 | 1660 | ACLList *aclList; |
7684c4b1 | 1661 | logformat *logFormat; |
1662 | Logfile *logfile; | |
1663 | customlog *next; | |
1664 | customlog_type type; | |
1665 | }; | |
1666 | ||
b5638623 | 1667 | #endif /* SQUID_STRUCTS_H */ |