]>
Commit | Line | Data |
---|---|---|
a8258824 | 1 | |
9cef6668 | 2 | /* |
cd748f27 | 3 | * $Id: structs.h,v 1.329 2000/05/03 17:15:44 adrian Exp $ |
9cef6668 | 4 | * |
5 | * | |
6 | * SQUID Internet Object Cache http://squid.nlanr.net/Squid/ | |
7 | * ---------------------------------------------------------- | |
8 | * | |
9 | * Squid is the result of efforts by numerous individuals from the | |
10 | * Internet community. Development is led by Duane Wessels of the | |
11 | * National Laboratory for Applied Network Research and funded by the | |
12 | * National Science Foundation. Squid is Copyrighted (C) 1998 by | |
efd900cb | 13 | * the Regents of the University of California. Please see the |
14 | * COPYRIGHT file for full details. Squid incorporates software | |
15 | * developed and/or copyrighted by other sources. Please see the | |
16 | * 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 | ||
0f1bc304 | 34 | struct _dlink_node { |
35 | void *data; | |
36 | dlink_node *prev; | |
37 | dlink_node *next; | |
38 | }; | |
39 | ||
40 | struct _dlink_list { | |
41 | dlink_node *head; | |
42 | dlink_node *tail; | |
43 | }; | |
44 | ||
a8258824 | 45 | struct _acl_ip_data { |
46 | struct in_addr addr1; /* if addr2 non-zero then its a range */ | |
47 | struct in_addr addr2; | |
48 | struct in_addr mask; | |
1a106e18 | 49 | acl_ip_data *next; /* used for parsing, not for storing */ |
a8258824 | 50 | }; |
51 | ||
52 | struct _acl_time_data { | |
53 | int weekbits; | |
54 | int start; | |
55 | int stop; | |
74fbf3c9 | 56 | acl_time_data *next; |
a8258824 | 57 | }; |
58 | ||
59 | struct _acl_name_list { | |
60 | char name[ACL_NAME_SZ]; | |
74fbf3c9 | 61 | acl_name_list *next; |
a8258824 | 62 | }; |
63 | ||
ec878047 | 64 | struct _acl_proxy_auth_user { |
65 | /* first two items must be same as hash_link */ | |
66 | char *user; | |
67 | acl_proxy_auth_user *next; | |
73e67ee0 | 68 | /* extra fields for proxy_auth */ |
ec878047 | 69 | char *passwd; |
73e67ee0 | 70 | int passwd_ok; /* 1 = passwd checked OK */ |
71 | long expiretime; | |
9bc73deb | 72 | struct in_addr ipaddr; /* IP addr this user authenticated from */ |
73 | time_t ip_expiretime; | |
ec878047 | 74 | }; |
75 | ||
a8258824 | 76 | struct _acl_deny_info_list { |
02922e76 | 77 | int err_page_id; |
78 | char *err_page_name; | |
74fbf3c9 | 79 | acl_name_list *acl_list; |
80 | acl_deny_info_list *next; | |
a8258824 | 81 | }; |
82 | ||
66c75c41 | 83 | #if USE_ARP_ACL |
cbe3a719 | 84 | |
66c75c41 | 85 | struct _acl_arp_data { |
74b7003b | 86 | char eth[6]; |
66c75c41 | 87 | }; |
cbe3a719 | 88 | |
66c75c41 | 89 | #endif |
90 | ||
02922e76 | 91 | struct _String { |
92 | /* never reference these directly! */ | |
a369131d | 93 | unsigned short int size; /* buffer size; 64K limit */ |
94 | unsigned short int len; /* current length */ | |
02922e76 | 95 | char *buf; |
96 | }; | |
97 | ||
1df370e3 | 98 | #if SQUID_SNMP |
43d4303e | 99 | |
a9ddb359 | 100 | struct _snmp_request_t { |
5e29a294 | 101 | u_char *buf; |
102 | u_char *outbuf; | |
2ac76861 | 103 | int len; |
104 | int sock; | |
105 | long reqid; | |
106 | int outlen; | |
107 | struct sockaddr_in from; | |
108 | struct snmp_pdu *PDU; | |
109 | aclCheck_t *acl_checklist; | |
5e29a294 | 110 | u_char *community; |
a9ddb359 | 111 | }; |
bdf18524 | 112 | |
1df370e3 | 113 | #endif |
a97cfa48 | 114 | |
a8258824 | 115 | struct _acl { |
116 | char name[ACL_NAME_SZ]; | |
117 | squid_acl type; | |
118 | void *data; | |
119 | char *cfgline; | |
bd05e3e3 | 120 | acl *next; |
a8258824 | 121 | }; |
122 | ||
123 | struct _acl_list { | |
124 | int op; | |
bd05e3e3 | 125 | acl *acl; |
126 | acl_list *next; | |
a8258824 | 127 | }; |
128 | ||
129 | struct _acl_access { | |
130 | int allow; | |
bd05e3e3 | 131 | acl_list *acl_list; |
a8258824 | 132 | char *cfgline; |
bd05e3e3 | 133 | acl_access *next; |
a8258824 | 134 | }; |
135 | ||
136 | struct _aclCheck_t { | |
bd05e3e3 | 137 | const acl_access *access_list; |
a8258824 | 138 | struct in_addr src_addr; |
139 | struct in_addr dst_addr; | |
ae2c08a2 | 140 | struct in_addr my_addr; |
7e3ce7b9 | 141 | unsigned short my_port; |
a8258824 | 142 | request_t *request; |
3898f57f | 143 | #if USE_IDENT |
144 | ConnStateData *conn; /* hack for ident */ | |
def67559 | 145 | char ident[USER_IDENT_SZ]; |
3898f57f | 146 | #endif |
73e67ee0 | 147 | acl_proxy_auth_user *auth_user; |
a8258824 | 148 | acl_lookup_state state[ACL_ENUM_MAX]; |
dba79ac5 | 149 | #if SQUID_SNMP |
150 | char *snmp_community; | |
151 | #endif | |
a8258824 | 152 | PF *callback; |
153 | void *callback_data; | |
154 | }; | |
155 | ||
a8258824 | 156 | struct _wordlist { |
157 | char *key; | |
bd05e3e3 | 158 | wordlist *next; |
a8258824 | 159 | }; |
160 | ||
161 | struct _intlist { | |
162 | int i; | |
bd05e3e3 | 163 | intlist *next; |
a8258824 | 164 | }; |
165 | ||
8f663d72 | 166 | struct _intrange { |
167 | int i; | |
168 | int j; | |
169 | intrange *next; | |
170 | }; | |
171 | ||
a8258824 | 172 | struct _ushortlist { |
173 | u_short i; | |
bd05e3e3 | 174 | ushortlist *next; |
a8258824 | 175 | }; |
176 | ||
177 | struct _relist { | |
178 | char *pattern; | |
179 | regex_t regex; | |
bd05e3e3 | 180 | relist *next; |
a8258824 | 181 | }; |
182 | ||
7e3ce7b9 | 183 | struct _sockaddr_in_list { |
184 | struct sockaddr_in s; | |
185 | sockaddr_in_list *next; | |
186 | }; | |
187 | ||
56e64999 | 188 | #if DELAY_POOLS |
59715b38 | 189 | struct _delaySpec { |
95e36d02 | 190 | int restore_bps; |
191 | int max_bytes; | |
192 | }; | |
1dfa1d81 | 193 | |
59715b38 | 194 | /* malloc()'d only as far as used (class * sizeof(delaySpec)! |
195 | * order of elements very important! | |
196 | */ | |
197 | struct _delaySpecSet { | |
198 | delaySpec aggregate; | |
199 | delaySpec individual; | |
200 | delaySpec network; | |
201 | }; | |
202 | ||
203 | struct _delayConfig { | |
204 | unsigned short pools; | |
205 | unsigned short initial; | |
206 | unsigned char *class; | |
207 | delaySpecSet **rates; | |
208 | acl_access **access; | |
209 | }; | |
210 | ||
56e64999 | 211 | #endif |
95e36d02 | 212 | |
a8258824 | 213 | struct _SquidConfig { |
214 | struct { | |
9906e724 | 215 | size_t maxSize; |
a8258824 | 216 | int highWaterMark; |
217 | int lowWaterMark; | |
43a70238 | 218 | } Swap; |
219 | size_t memMaxSize; | |
a8258824 | 220 | struct { |
221 | char *relayHost; | |
222 | u_short relayPort; | |
db1cd23c | 223 | peer *peer; |
a8258824 | 224 | } Wais; |
225 | struct { | |
9906e724 | 226 | size_t min; |
a8258824 | 227 | int pct; |
9906e724 | 228 | size_t max; |
a8258824 | 229 | } quickAbort; |
2b906e48 | 230 | #if HEAP_REPLACEMENT |
231 | char *replPolicy; | |
232 | #else | |
233 | /* | |
234 | * Note: the non-LRU policies do not use referenceAge, but we cannot | |
235 | * remove it until we find out how to implement #else for cf_parser.c | |
236 | */ | |
237 | #endif | |
a8258824 | 238 | time_t referenceAge; |
239 | time_t negativeTtl; | |
240 | time_t negativeDnsTtl; | |
241 | time_t positiveDnsTtl; | |
242 | time_t shutdownLifetime; | |
a8258824 | 243 | struct { |
244 | time_t read; | |
a8258824 | 245 | time_t lifetime; |
246 | time_t connect; | |
3f62decd | 247 | time_t peer_connect; |
a8258824 | 248 | time_t request; |
603a02fd | 249 | time_t pconn; |
23d92c64 | 250 | time_t siteSelect; |
dc835977 | 251 | time_t deadPeer; |
98829f69 | 252 | int icp_query; /* msec */ |
28993292 | 253 | int icp_query_max; /* msec */ |
98829f69 | 254 | int mcast_icp_query; /* msec */ |
3898f57f | 255 | #if USE_IDENT |
05832ae1 | 256 | time_t ident; |
4fe0e1d0 | 257 | #endif |
258 | #if !USE_DNSSERVERS | |
259 | time_t idns_retransmit; | |
260 | time_t idns_query; | |
3898f57f | 261 | #endif |
a8258824 | 262 | } Timeout; |
0483b991 | 263 | size_t maxRequestHeaderSize; |
264 | size_t maxRequestBodySize; | |
265 | size_t maxReplyBodySize; | |
a8258824 | 266 | struct { |
a8258824 | 267 | u_short icp; |
ace287ee | 268 | #if USE_HTCP |
269 | u_short htcp; | |
270 | #endif | |
1df370e3 | 271 | #if SQUID_SNMP |
678c6099 | 272 | u_short snmp; |
1df370e3 | 273 | #endif |
a8258824 | 274 | } Port; |
7e3ce7b9 | 275 | struct { |
276 | sockaddr_in_list *http; | |
277 | } Sockaddr; | |
1df370e3 | 278 | #if SQUID_SNMP |
2bbd722b | 279 | struct { |
280 | char *configFile; | |
281 | char *agentInfo; | |
2ac237e2 | 282 | } Snmp; |
320e9f36 | 283 | #endif |
eb824054 | 284 | #if USE_WCCP |
320e9f36 | 285 | struct { |
286 | struct in_addr router; | |
eb824054 | 287 | struct in_addr incoming; |
288 | struct in_addr outgoing; | |
320e9f36 | 289 | } Wccp; |
1df370e3 | 290 | #endif |
53ad48e6 | 291 | char *as_whois_server; |
a8258824 | 292 | struct { |
293 | char *log; | |
294 | char *access; | |
295 | char *store; | |
296 | char *swap; | |
82839306 | 297 | #if USE_USERAGENT_LOG |
a8258824 | 298 | char *useragent; |
82839306 | 299 | #endif |
a8258824 | 300 | int rotateNumber; |
a8258824 | 301 | } Log; |
a8258824 | 302 | char *adminEmail; |
303 | char *effectiveUser; | |
304 | char *effectiveGroup; | |
305 | struct { | |
82839306 | 306 | #if USE_DNSSERVERS |
a8258824 | 307 | char *dnsserver; |
efd900cb | 308 | #endif |
c6d5b87b | 309 | wordlist *redirect; |
f703eacb | 310 | wordlist *authenticate; |
82839306 | 311 | #if USE_ICMP |
a8258824 | 312 | char *pinger; |
82839306 | 313 | #endif |
a8258824 | 314 | char *unlinkd; |
315 | } Program; | |
82839306 | 316 | #if USE_DNSSERVERS |
a8258824 | 317 | int dnsChildren; |
efd900cb | 318 | #endif |
a8258824 | 319 | int redirectChildren; |
73e67ee0 | 320 | int authenticateChildren; |
70a76033 | 321 | time_t authenticateTTL; |
322 | time_t authenticateIpTTL; | |
a8258824 | 323 | struct { |
13c7936a | 324 | int single_host; |
a8258824 | 325 | char *host; |
326 | u_short port; | |
a8258824 | 327 | } Accel; |
328 | char *appendDomain; | |
329 | size_t appendDomainLen; | |
330 | char *debugOptions; | |
331 | char *pidFilename; | |
332 | char *mimeTablePathname; | |
333 | char *visibleHostname; | |
98829f69 | 334 | char *uniqueHostname; |
1f38f50a | 335 | wordlist *hostnameAliases; |
a8258824 | 336 | char *errHtmlText; |
337 | struct { | |
338 | char *host; | |
339 | char *file; | |
340 | time_t period; | |
a8258824 | 341 | u_short port; |
342 | } Announce; | |
343 | struct { | |
a8258824 | 344 | struct in_addr tcp_outgoing; |
345 | struct in_addr udp_incoming; | |
2bbd722b | 346 | struct in_addr udp_outgoing; |
15dcc168 | 347 | #if SQUID_SNMP |
678c6099 | 348 | struct in_addr snmp_incoming; |
2bbd722b | 349 | struct in_addr snmp_outgoing; |
15dcc168 | 350 | #endif |
a8258824 | 351 | struct in_addr client_netmask; |
352 | } Addrs; | |
9906e724 | 353 | size_t tcpRcvBufsz; |
354 | size_t udpMaxHitObjsz; | |
a8258824 | 355 | wordlist *hierarchy_stoplist; |
356 | wordlist *mcast_group_list; | |
357 | wordlist *dns_testname_list; | |
09c483ec | 358 | wordlist *dns_nameservers; |
40a1495e | 359 | peer *peers; |
360 | int npeers; | |
a8258824 | 361 | struct { |
89de058c | 362 | int size; |
a8258824 | 363 | int low; |
364 | int high; | |
365 | } ipcache; | |
e55650e3 | 366 | struct { |
367 | int size; | |
368 | } fqdncache; | |
a8258824 | 369 | int minDirectHops; |
370 | cachemgr_passwd *passwd_list; | |
371 | struct { | |
372 | int objectsPerBucket; | |
9906e724 | 373 | size_t avgObjectSize; |
374 | size_t maxObjectSize; | |
a8258824 | 375 | } Store; |
376 | struct { | |
377 | int high; | |
378 | int low; | |
379 | time_t period; | |
380 | } Netdb; | |
381 | struct { | |
382 | int log_udp; | |
82839306 | 383 | #if USE_DNSSERVERS |
a8258824 | 384 | int res_defnames; |
efd900cb | 385 | #endif |
a8258824 | 386 | int anonymizer; |
387 | int client_db; | |
388 | int query_icmp; | |
88738790 | 389 | int icp_hit_stale; |
78f1250a | 390 | int buffered_logs; |
0ab965da | 391 | #if ALLOW_SOURCE_PING |
9b312a19 | 392 | int source_ping; |
0ab965da | 393 | #endif |
9b312a19 | 394 | int common_log; |
395 | int log_mime_hdrs; | |
17a0a4ee | 396 | int log_fqdn; |
397 | int announce; | |
398 | int accel_with_proxy; | |
3f6c0fb2 | 399 | int mem_pools; |
194dd3b8 | 400 | int test_reachability; |
ea285003 | 401 | int half_closed_clients; |
9f60cfdf | 402 | #if HTTP_VIOLATIONS |
465dc415 | 403 | int reload_into_ims; |
9f60cfdf | 404 | #endif |
b540e168 | 405 | int offline; |
c68e9c6b | 406 | int redir_rewrites_host; |
9b094667 | 407 | int prefer_direct; |
168dfda9 | 408 | int nonhierarchical_direct; |
bcbc11b0 | 409 | int strip_query_terms; |
07476a7f | 410 | int redirector_bypass; |
9bc73deb | 411 | int ignore_unknown_nameservers; |
efd900cb | 412 | int client_pconns; |
413 | int server_pconns; | |
7e3ce7b9 | 414 | #if USE_CACHE_DIGESTS |
415 | int digest_generation; | |
416 | #endif | |
890b0fa8 | 417 | int log_ip_on_direct; |
70a76033 | 418 | int authenticateIpTTLStrict; |
17a0a4ee | 419 | } onoff; |
bd05e3e3 | 420 | acl *aclList; |
a8258824 | 421 | struct { |
bd05e3e3 | 422 | acl_access *http; |
423 | acl_access *icp; | |
424 | acl_access *miss; | |
425 | acl_access *NeverDirect; | |
426 | acl_access *AlwaysDirect; | |
427 | acl_access *ASlists; | |
428 | acl_access *noCache; | |
dba79ac5 | 429 | #if SQUID_SNMP |
430 | acl_access *snmp; | |
431 | #endif | |
376bb137 | 432 | acl_access *brokenPosts; |
3898f57f | 433 | #if USE_IDENT |
a40699cd | 434 | acl_access *identLookup; |
3898f57f | 435 | #endif |
9bc73deb | 436 | acl_access *redirector; |
a8258824 | 437 | } accessList; |
bd05e3e3 | 438 | acl_deny_info_list *denyInfoList; |
f715bd3a | 439 | char *proxyAuthRealm; |
a8258824 | 440 | struct { |
441 | size_t list_width; | |
442 | int list_wrap; | |
a8258824 | 443 | char *anon_user; |
444 | } Ftp; | |
445 | refresh_t *Refresh; | |
446 | struct _cacheSwap { | |
a47b9029 | 447 | SwapDir *swapDirs; |
448 | int n_allocated; | |
449 | int n_configured; | |
a8258824 | 450 | } cacheSwap; |
88738790 | 451 | char *fake_ua; |
365cb147 | 452 | struct { |
453 | char *directory; | |
365cb147 | 454 | } icons; |
9b312a19 | 455 | char *errorDirectory; |
22c653cd | 456 | struct { |
457 | time_t timeout; | |
458 | int maxtries; | |
459 | } retry; | |
7021844c | 460 | struct { |
461 | size_t limit; | |
462 | } MemPools; | |
95e36d02 | 463 | #if DELAY_POOLS |
59715b38 | 464 | delayConfig Delay; |
95e36d02 | 465 | #endif |
6be2389e | 466 | struct { |
467 | int icp_average; | |
ef523f99 | 468 | int dns_average; |
6be2389e | 469 | int http_average; |
470 | int icp_min_poll; | |
ef523f99 | 471 | int dns_min_poll; |
6be2389e | 472 | int http_min_poll; |
473 | } comm_incoming; | |
c5f627c2 | 474 | int max_open_disk_fds; |
d548ee64 | 475 | int uri_whitespace; |
c68e9c6b | 476 | size_t rangeOffsetLimit; |
e66d7923 | 477 | #if MULTICAST_MISS_STREAM |
478 | struct { | |
479 | struct in_addr addr; | |
7e3ce7b9 | 480 | int ttl; |
e66d7923 | 481 | unsigned short port; |
482 | char *encode_key; | |
483 | } mcast_miss; | |
484 | #endif | |
5bcad01d | 485 | HttpHeaderMask anonymize_headers; |
b6a2f15e | 486 | char *coredump_dir; |
efd900cb | 487 | char *chroot_dir; |
7e3ce7b9 | 488 | #if USE_CACHE_DIGESTS |
489 | struct { | |
490 | int bits_per_entry; | |
efd900cb | 491 | time_t rebuild_period; |
492 | time_t rewrite_period; | |
493 | size_t swapout_chunk_size; | |
7e3ce7b9 | 494 | int rebuild_chunk_percentage; |
495 | } digest; | |
496 | #endif | |
708ef61c | 497 | #if USE_DISKD |
498 | struct { | |
499 | int magic1; | |
500 | int magic2; | |
501 | } diskd; | |
502 | #endif | |
a8258824 | 503 | }; |
504 | ||
505 | struct _SquidConfig2 { | |
506 | struct { | |
507 | char *prefix; | |
508 | int on; | |
509 | } Accel; | |
53cb32a9 | 510 | struct { |
511 | int enable_purge; | |
512 | } onoff; | |
a8258824 | 513 | }; |
514 | ||
515 | struct _close_handler { | |
516 | PF *handler; | |
517 | void *data; | |
518 | close_handler *next; | |
519 | }; | |
520 | ||
521 | struct _dread_ctrl { | |
522 | int fd; | |
523 | off_t offset; | |
524 | int req_len; | |
525 | char *buf; | |
526 | int end_of_file; | |
527 | DRCB *handler; | |
528 | void *client_data; | |
529 | }; | |
530 | ||
531 | struct _dnsserver_t { | |
532 | int id; | |
a8258824 | 533 | int inpipe; |
534 | int outpipe; | |
535 | time_t answer; | |
78f1250a | 536 | off_t offset; |
537 | size_t size; | |
e144eae4 | 538 | char ip_inbuf[DNS_INBUF_SZ]; |
a8258824 | 539 | struct timeval dispatch_time; |
540 | void *data; | |
541 | }; | |
542 | ||
543 | struct _dnsStatData { | |
544 | int requests; | |
545 | int replies; | |
546 | int hist[DefaultDnsChildrenMax]; | |
547 | }; | |
548 | ||
549 | struct _dwrite_q { | |
d377699f | 550 | off_t file_offset; |
a8258824 | 551 | char *buf; |
552 | int len; | |
d377699f | 553 | off_t buf_offset; |
bd05e3e3 | 554 | dwrite_q *next; |
74fbf3c9 | 555 | FREE *free_func; |
a8258824 | 556 | }; |
557 | ||
a9771e51 | 558 | |
559 | /* ETag support is rudimantal; | |
560 | * this struct is likely to change | |
561 | * Note: "str" points to memory in HttpHeaderEntry (for now) | |
562 | * so ETags should be used as tmp variables only (for now) */ | |
563 | struct _ETag { | |
98829f69 | 564 | const char *str; /* quoted-string */ |
565 | int weak; /* true if it is a weak validator */ | |
a9771e51 | 566 | }; |
567 | ||
a8258824 | 568 | struct _fde { |
569 | unsigned int type; | |
a8258824 | 570 | u_short local_port; |
571 | u_short remote_port; | |
572 | char ipaddr[16]; /* dotted decimal address of peer */ | |
573 | char desc[FD_DESC_SZ]; | |
58a6c186 | 574 | struct { |
60c0b5a2 | 575 | unsigned int open:1; |
3d94aed0 | 576 | unsigned int close_request:1; |
577 | unsigned int write_daemon:1; | |
578 | unsigned int closing:1; | |
579 | unsigned int socket_eof:1; | |
580 | unsigned int nolinger:1; | |
581 | unsigned int nonblocking:1; | |
582 | unsigned int ipc:1; | |
b5568a61 | 583 | unsigned int called_connect:1; |
58a6c186 | 584 | } flags; |
a8258824 | 585 | int bytes_read; |
586 | int bytes_written; | |
b716a8ad | 587 | int uses; /* ie # req's over persistent conn */ |
a8258824 | 588 | struct _fde_disk { |
589 | DWCB *wrt_handle; | |
590 | void *wrt_handle_data; | |
591 | dwrite_q *write_q; | |
592 | dwrite_q *write_q_tail; | |
711982d8 | 593 | off_t offset; |
a8258824 | 594 | } disk; |
595 | PF *read_handler; | |
596 | void *read_data; | |
597 | PF *write_handler; | |
598 | void *write_data; | |
599 | PF *timeout_handler; | |
600 | time_t timeout; | |
601 | void *timeout_data; | |
cb69b4c7 | 602 | void *lifetime_data; |
a8258824 | 603 | close_handler *close_handler; /* linked list */ |
da2b3a17 | 604 | DEFER *defer_check; /* check if we should defer read */ |
70a9dab4 | 605 | void *defer_data; |
a8258824 | 606 | CommWriteStateData *rwstate; /* State data for comm_write */ |
607 | }; | |
608 | ||
609 | struct _fileMap { | |
610 | int max_n_files; | |
611 | int n_files_in_map; | |
a8258824 | 612 | int toggle; |
613 | int nwords; | |
614 | unsigned long *file_map; | |
615 | }; | |
616 | ||
1d21d91d | 617 | /* auto-growing memory-resident buffer with printf interface */ |
618 | /* note: when updating this struct, update MemBufNULL #define */ | |
619 | struct _MemBuf { | |
620 | /* public, read-only */ | |
621 | char *buf; | |
622 | mb_size_t size; /* used space, does not count 0-terminator */ | |
623 | ||
624 | /* private, stay away; use interface function instead */ | |
625 | mb_size_t max_capacity; /* when grows: assert(new_capacity <= max_capacity) */ | |
626 | mb_size_t capacity; /* allocated space */ | |
627 | FREE *freefunc; /* what to use to free the buffer, NULL after memBufFreeFunc() is called */ | |
628 | }; | |
629 | ||
630 | /* see Packer.c for description */ | |
631 | struct _Packer { | |
632 | /* protected, use interface functions instead */ | |
633 | append_f append; | |
634 | vprintf_f vprintf; | |
635 | void *real_handler; /* first parameter to real append and vprintf */ | |
636 | }; | |
637 | ||
adba4a64 | 638 | /* http status line */ |
639 | struct _HttpStatusLine { | |
640 | /* public, read only */ | |
99edd1c3 | 641 | float version; |
2ac76861 | 642 | const char *reason; /* points to a _constant_ string (default or supplied), never free()d */ |
adba4a64 | 643 | http_status status; |
644 | }; | |
645 | ||
646 | /* | |
1d21d91d | 647 | * Note: HttpBody is used only for messages with a small content that is |
adba4a64 | 648 | * known a priory (e.g., error messages). |
649 | */ | |
650 | struct _HttpBody { | |
1d21d91d | 651 | /* private */ |
652 | MemBuf mb; | |
adba4a64 | 653 | }; |
654 | ||
2ecaa5e7 | 655 | /* http header extention field */ |
656 | struct _HttpHdrExtField { | |
a369131d | 657 | String name; /* field-name from HTTP/1.1 (no column after name) */ |
658 | String value; /* field-value from HTTP/1.1 */ | |
2ecaa5e7 | 659 | }; |
adba4a64 | 660 | |
399e85ea | 661 | /* http cache control header field */ |
7faf2bdb | 662 | struct _HttpHdrCc { |
4f087419 | 663 | int mask; |
d8b249ef | 664 | int max_age; |
7e3ce7b9 | 665 | int s_maxage; |
a8258824 | 666 | }; |
ee1679df | 667 | |
b5107edb | 668 | /* http byte-range-spec */ |
669 | struct _HttpHdrRangeSpec { | |
9bc73deb | 670 | ssize_t offset; |
671 | ssize_t length; | |
b5107edb | 672 | }; |
673 | ||
674 | /* There may be more than one byte range specified in the request. | |
59c4d35b | 675 | * This object holds all range specs in order of their appearence |
676 | * in the request because we SHOULD preserve that order. | |
677 | */ | |
b5107edb | 678 | struct _HttpHdrRange { |
679 | Stack specs; | |
680 | }; | |
7faf2bdb | 681 | |
d76fcfa7 | 682 | /* http content-range header field */ |
683 | struct _HttpHdrContRange { | |
684 | HttpHdrRangeSpec spec; | |
9bc73deb | 685 | ssize_t elength; /* entity length, not content length */ |
d76fcfa7 | 686 | }; |
687 | ||
a9771e51 | 688 | /* some fields can hold either time or etag specs (e.g. If-Range) */ |
689 | struct _TimeOrTag { | |
98829f69 | 690 | ETag tag; /* entity tag */ |
a9771e51 | 691 | time_t time; |
98829f69 | 692 | int valid; /* true if struct is usable */ |
a9771e51 | 693 | }; |
694 | ||
d192d11f | 695 | /* data for iterating thru range specs */ |
98829f69 | 696 | struct _HttpHdrRangeIter { |
d192d11f | 697 | HttpHdrRangePos pos; |
98829f69 | 698 | const HttpHdrRangeSpec *spec; /* current spec at pos */ |
9bc73deb | 699 | ssize_t debt_size; /* bytes left to send from the current spec */ |
700 | ssize_t prefix_size; /* the size of the incoming HTTP msg prefix */ | |
98829f69 | 701 | String boundary; /* boundary for multipart responses */ |
d192d11f | 702 | }; |
d76fcfa7 | 703 | |
fcd2d3ef | 704 | /* constant attributes of http header fields */ |
705 | struct _HttpHeaderFieldAttrs { | |
706 | const char *name; | |
707 | http_hdr_type id; | |
708 | field_type type; | |
709 | }; | |
710 | ||
7faf2bdb | 711 | /* per field statistics */ |
712 | struct _HttpHeaderFieldStat { | |
399e85ea | 713 | int aliveCount; /* created but not destroyed (count) */ |
d8b249ef | 714 | int seenCount; /* #fields we've seen */ |
399e85ea | 715 | int parsCount; /* #parsing attempts */ |
716 | int errCount; /* #pasring errors */ | |
717 | int repCount; /* #repetitons */ | |
7faf2bdb | 718 | }; |
719 | ||
d8b249ef | 720 | /* compiled version of HttpHeaderFieldAttrs plus stats */ |
de336bbe | 721 | struct _HttpHeaderFieldInfo { |
722 | http_hdr_type id; | |
723 | String name; | |
724 | field_type type; | |
7faf2bdb | 725 | HttpHeaderFieldStat stat; |
726 | }; | |
727 | ||
d8b249ef | 728 | struct _HttpHeaderEntry { |
729 | http_hdr_type id; | |
730 | String name; | |
731 | String value; | |
732 | }; | |
4f087419 | 733 | |
d8b249ef | 734 | struct _HttpHeader { |
4f087419 | 735 | /* protected, do not use these, use interface functions instead */ |
ec878047 | 736 | Array entries; /* parsed fields in raw format */ |
737 | HttpHeaderMask mask; /* bit set <=> entry present */ | |
eeb423fb | 738 | http_hdr_owner_type owner; /* request or reply */ |
739 | int len; /* length when packed, not counting terminating '\0' */ | |
4f087419 | 740 | }; |
741 | ||
adba4a64 | 742 | struct _HttpReply { |
743 | /* unsupported, writable, may disappear/change in the future */ | |
2ac76861 | 744 | int hdr_sz; /* sums _stored_ status-line, headers, and <CRLF> */ |
adba4a64 | 745 | |
d8b249ef | 746 | /* public, readable; never update these or their .hdr equivalents directly */ |
747 | int content_length; | |
748 | time_t date; | |
749 | time_t last_modified; | |
750 | time_t expires; | |
ec878047 | 751 | String content_type; |
d8b249ef | 752 | HttpHdrCc *cache_control; |
753 | HttpHdrContRange *content_range; | |
9f5a2895 | 754 | short int keep_alive; |
d8b249ef | 755 | |
adba4a64 | 756 | /* public, readable */ |
2ac76861 | 757 | HttpMsgParseState pstate; /* the current parsing state */ |
4f087419 | 758 | |
de336bbe | 759 | /* public, writable, but use httpReply* interfaces when possible */ |
adba4a64 | 760 | HttpStatusLine sline; |
d8b249ef | 761 | HttpHeader header; |
762 | HttpBody body; /* for small constant memory-resident text bodies only */ | |
adba4a64 | 763 | }; |
cb69b4c7 | 764 | |
b515fc11 | 765 | struct _http_state_flags { |
79618ba9 | 766 | unsigned int proxying:1; |
767 | unsigned int keepalive:1; | |
db1cd23c | 768 | unsigned int only_if_cached:1; |
b515fc11 | 769 | }; |
a8258824 | 770 | |
771 | struct _HttpStateData { | |
772 | StoreEntry *entry; | |
773 | request_t *request; | |
774 | char *reply_hdr; | |
304d289e | 775 | size_t reply_hdr_size; |
a8258824 | 776 | int reply_hdr_state; |
1294c0fc | 777 | peer *peer; /* peer request made to */ |
a8258824 | 778 | int eof; /* reached end-of-object? */ |
779 | request_t *orig_request; | |
1294c0fc | 780 | int fd; |
b515fc11 | 781 | http_state_flags flags; |
db1cd23c | 782 | FwdState *fwd; |
a8258824 | 783 | }; |
784 | ||
785 | struct _icpUdpData { | |
786 | struct sockaddr_in address; | |
787 | void *msg; | |
788 | size_t len; | |
789 | icpUdpData *next; | |
790 | #ifndef LESS_TIMING | |
791 | struct timeval start; | |
792 | #endif | |
793 | log_type logcode; | |
17b6e784 | 794 | struct timeval queue_time; |
a8258824 | 795 | }; |
796 | ||
b4e7f82d | 797 | struct _ping_data { |
a8258824 | 798 | struct timeval start; |
799 | struct timeval stop; | |
800 | int n_sent; | |
801 | int n_recv; | |
802 | int n_replies_expected; | |
98829f69 | 803 | int timeout; /* msec */ |
465dc415 | 804 | int timedout; |
a8258824 | 805 | int w_rtt; |
b3264694 | 806 | int p_rtt; |
a8258824 | 807 | }; |
808 | ||
809 | struct _HierarchyLogEntry { | |
810 | hier_code code; | |
811 | char host[SQUIDHOSTNAMELEN]; | |
b4e7f82d | 812 | ping_data ping; |
4b4cd312 | 813 | char cd_host[SQUIDHOSTNAMELEN]; /* the host of selected by cd peer */ |
814 | peer_select_alg_t alg; /* peer selection algorithm */ | |
815 | lookup_t cd_lookup; /* cd prediction: none, miss, hit */ | |
816 | int n_choices; /* #peers we selected from (cd only) */ | |
817 | int n_ichoices; /* #peers with known rtt we selected from (cd only) */ | |
39edba21 | 818 | struct timeval peer_select_start; |
819 | struct timeval store_complete_stop; | |
a8258824 | 820 | }; |
821 | ||
822 | struct _AccessLogEntry { | |
823 | const char *url; | |
824 | struct { | |
825 | method_t method; | |
826 | int code; | |
827 | const char *content_type; | |
c68e9c6b | 828 | float version; |
a8258824 | 829 | } http; |
830 | struct { | |
831 | icp_opcode opcode; | |
832 | } icp; | |
833 | struct { | |
834 | struct in_addr caddr; | |
835 | size_t size; | |
836 | log_type code; | |
837 | int msec; | |
838 | const char *ident; | |
839 | } cache; | |
a8258824 | 840 | struct { |
841 | char *request; | |
842 | char *reply; | |
843 | } headers; | |
844 | struct { | |
845 | const char *method_str; | |
846 | } private; | |
bd05e3e3 | 847 | HierarchyLogEntry hier; |
a8258824 | 848 | }; |
849 | ||
850 | struct _clientHttpRequest { | |
851 | ConnStateData *conn; | |
852 | request_t *request; /* Parsed URL ... */ | |
23d92c64 | 853 | char *uri; |
854 | char *log_uri; | |
a8258824 | 855 | struct { |
78f1250a | 856 | off_t offset; |
857 | size_t size; | |
a8258824 | 858 | } out; |
98829f69 | 859 | HttpHdrRangeIter range_iter; /* data for iterating thru range specs */ |
860 | size_t req_sz; /* raw request size on input, not current request size */ | |
a8258824 | 861 | StoreEntry *entry; |
862 | StoreEntry *old_entry; | |
863 | log_type log_type; | |
6cfa8966 | 864 | #if USE_CACHE_DIGESTS |
04f0c415 | 865 | const char *lookup_type; /* temporary hack: storeGet() result: HIT/MISS/NONE */ |
866 | #endif | |
9b312a19 | 867 | http_status http_code; |
a8258824 | 868 | struct timeval start; |
869 | float http_ver; | |
870 | int redirect_state; | |
871 | aclCheck_t *acl_checklist; /* need ptr back so we can unreg if needed */ | |
872 | clientHttpRequest *next; | |
bd05e3e3 | 873 | AccessLogEntry al; |
77ed547a | 874 | struct { |
3d94aed0 | 875 | unsigned int accel:1; |
876 | unsigned int internal:1; | |
877 | unsigned int done_copying:1; | |
77ed547a | 878 | } flags; |
6d38ef86 | 879 | struct { |
880 | http_status status; | |
881 | char *location; | |
882 | } redirect; | |
0f1bc304 | 883 | dlink_node active; |
a8258824 | 884 | }; |
885 | ||
886 | struct _ConnStateData { | |
887 | int fd; | |
888 | struct { | |
889 | char *buf; | |
78f1250a | 890 | off_t offset; |
891 | size_t size; | |
a8258824 | 892 | } in; |
893 | clientHttpRequest *chr; | |
894 | struct sockaddr_in peer; | |
895 | struct sockaddr_in me; | |
896 | struct in_addr log_addr; | |
05832ae1 | 897 | char ident[USER_IDENT_SZ]; |
a8258824 | 898 | int nrequests; |
899 | int persistent; | |
da2b3a17 | 900 | struct { |
901 | int n; | |
902 | time_t until; | |
903 | } defer; | |
a8258824 | 904 | }; |
905 | ||
906 | struct _ipcache_addrs { | |
6d1c0d53 | 907 | struct in_addr *in_addrs; |
908 | unsigned char *bad_mask; | |
a8258824 | 909 | unsigned char count; |
910 | unsigned char cur; | |
22c653cd | 911 | unsigned char badcount; |
a8258824 | 912 | }; |
913 | ||
59c4d35b | 914 | struct _ip_pending { |
915 | IPH *handler; | |
916 | void *handlerData; | |
917 | ip_pending *next; | |
918 | }; | |
919 | ||
a8258824 | 920 | struct _ipcache_entry { |
ec878047 | 921 | /* first two items must be equivalent to hash_link */ |
a8258824 | 922 | char *name; |
bd05e3e3 | 923 | ipcache_entry *next; |
a8258824 | 924 | time_t lastref; |
925 | time_t expires; | |
926 | ipcache_addrs addrs; | |
59c4d35b | 927 | ip_pending *pending_head; |
a8258824 | 928 | char *error_message; |
b87b92fb | 929 | struct timeval request_time; |
2ac237e2 | 930 | dlink_node lru; |
931 | u_char locks; | |
a8258824 | 932 | ipcache_status_t status:3; |
933 | }; | |
934 | ||
59c4d35b | 935 | struct _fqdn_pending { |
936 | FQDNH *handler; | |
937 | void *handlerData; | |
938 | fqdn_pending *next; | |
939 | }; | |
940 | ||
1df370e3 | 941 | struct _fqdncache_entry { |
ec878047 | 942 | /* first two items must be equivalent to hash_link */ |
1df370e3 | 943 | char *name; |
bd05e3e3 | 944 | fqdncache_entry *next; |
1df370e3 | 945 | time_t lastref; |
946 | time_t expires; | |
947 | unsigned char name_count; | |
948 | char *names[FQDN_MAX_NAMES + 1]; | |
59c4d35b | 949 | fqdn_pending *pending_head; |
1df370e3 | 950 | char *error_message; |
74addf6c | 951 | struct timeval request_time; |
1df370e3 | 952 | dlink_node lru; |
953 | unsigned char locks; | |
954 | fqdncache_status_t status:3; | |
955 | }; | |
956 | ||
a8258824 | 957 | struct _domain_ping { |
958 | char *domain; | |
959 | int do_ping; /* boolean */ | |
bd05e3e3 | 960 | domain_ping *next; |
a8258824 | 961 | }; |
962 | ||
963 | struct _domain_type { | |
964 | char *domain; | |
965 | peer_t type; | |
bd05e3e3 | 966 | domain_type *next; |
a8258824 | 967 | }; |
968 | ||
c68e9c6b | 969 | #if USE_CACHE_DIGESTS |
e41e6dcd | 970 | struct _Version { |
4b4cd312 | 971 | short int current; /* current version */ |
972 | short int required; /* minimal version that can safely handle current version */ | |
e41e6dcd | 973 | }; |
974 | ||
975 | /* digest control block; used for transmission and storage */ | |
976 | struct _StoreDigestCBlock { | |
977 | Version ver; | |
978 | int capacity; | |
979 | int count; | |
980 | int del_count; | |
981 | int mask_size; | |
04f0c415 | 982 | unsigned char bits_per_entry; |
983 | unsigned char hash_func_count; | |
984 | short int reserved_short; | |
4b4cd312 | 985 | int reserved[32 - 6]; |
e41e6dcd | 986 | }; |
987 | ||
988 | struct _DigestFetchState { | |
e13ee7ad | 989 | PeerDigest *pd; |
e41e6dcd | 990 | StoreEntry *entry; |
991 | StoreEntry *old_entry; | |
e13ee7ad | 992 | request_t *request; |
e41e6dcd | 993 | int offset; |
994 | int mask_offset; | |
995 | time_t start_time; | |
e13ee7ad | 996 | time_t resp_time; |
997 | time_t expires; | |
998 | struct { | |
999 | int msg; | |
1000 | int bytes; | |
1001 | } sent, recv; | |
e41e6dcd | 1002 | }; |
1003 | ||
1004 | /* statistics for cache digests and other hit "predictors" */ | |
1005 | struct _cd_guess_stats { | |
1006 | /* public, read-only */ | |
1007 | int true_hits; | |
1008 | int false_hits; | |
1009 | int true_misses; | |
1010 | int false_misses; | |
4b4cd312 | 1011 | int close_hits; /* tmp, remove it later */ |
e41e6dcd | 1012 | }; |
1013 | ||
1014 | struct _PeerDigest { | |
4d62b0af | 1015 | peer *peer; /* pointer back to peer structure, argh */ |
1016 | CacheDigest *cd; /* actual digest structure */ | |
1017 | String host; /* copy of peer->host */ | |
e13ee7ad | 1018 | const char *req_result; /* text status of the last request */ |
b515fc11 | 1019 | struct { |
4d62b0af | 1020 | unsigned int needed:1; /* there were requests for this digest */ |
e13ee7ad | 1021 | unsigned int usable:1; /* can be used for lookups */ |
79618ba9 | 1022 | unsigned int requested:1; /* in process of receiving [fresh] digest */ |
b515fc11 | 1023 | } flags; |
e13ee7ad | 1024 | struct { |
1025 | /* all times are absolute unless augmented with _delay */ | |
1026 | time_t initialized; /* creation */ | |
1027 | time_t needed; /* first lookup/use by a peer */ | |
1028 | time_t next_check; /* next scheduled check/refresh event */ | |
1029 | time_t retry_delay; /* delay before re-checking _invalid_ digest */ | |
1030 | time_t requested; /* requested a fresh copy of a digest */ | |
4d62b0af | 1031 | time_t req_delay; /* last request response time */ |
e13ee7ad | 1032 | time_t received; /* received the current copy of a digest */ |
1033 | time_t disabled; /* disabled for good */ | |
1034 | } times; | |
e41e6dcd | 1035 | struct { |
1036 | cd_guess_stats guess; | |
1037 | int used_count; | |
e13ee7ad | 1038 | struct { |
1039 | int msgs; | |
1040 | kb_t kbytes; | |
1041 | } sent, recv; | |
e41e6dcd | 1042 | } stats; |
1043 | }; | |
1044 | ||
c68e9c6b | 1045 | #endif |
1046 | ||
a8258824 | 1047 | struct _peer { |
1048 | char *host; | |
1049 | peer_t type; | |
1050 | struct sockaddr_in in_addr; | |
1051 | struct { | |
1052 | int pings_sent; | |
1053 | int pings_acked; | |
a8258824 | 1054 | int fetches; |
1055 | int rtt; | |
a8258824 | 1056 | int ignored_replies; |
1294c0fc | 1057 | int n_keepalives_sent; |
1058 | int n_keepalives_recv; | |
83b381d5 | 1059 | time_t probe_start; |
dc835977 | 1060 | time_t last_query; |
1061 | time_t last_reply; | |
eb406bb7 | 1062 | time_t last_connect_failure; |
1063 | time_t last_connect_probe; | |
dc835977 | 1064 | int logged_state; /* so we can print dead/revived msgs */ |
a8258824 | 1065 | } stats; |
399cabec | 1066 | struct { |
886f2785 | 1067 | int version; |
399cabec | 1068 | int counts[ICP_END]; |
886f2785 | 1069 | u_short port; |
399cabec | 1070 | } icp; |
1071 | #if USE_HTCP | |
1072 | struct { | |
1073 | double version; | |
1074 | int counts[2]; | |
886f2785 | 1075 | u_short port; |
399cabec | 1076 | } htcp; |
1077 | #endif | |
a8258824 | 1078 | u_short http_port; |
b6a2f15e | 1079 | domain_ping *peer_domain; |
bd05e3e3 | 1080 | domain_type *typelist; |
505e35db | 1081 | acl_access *access; |
cd196bc8 | 1082 | struct { |
79618ba9 | 1083 | unsigned int proxy_only:1; |
1084 | unsigned int no_query:1; | |
1085 | unsigned int no_digest:1; | |
1086 | unsigned int default_parent:1; | |
1087 | unsigned int roundrobin:1; | |
1088 | unsigned int mcast_responder:1; | |
1089 | unsigned int closest_only:1; | |
cd196bc8 | 1090 | #if USE_HTCP |
79618ba9 | 1091 | unsigned int htcp:1; |
cd196bc8 | 1092 | #endif |
79618ba9 | 1093 | unsigned int no_netdb_exchange:1; |
cd196bc8 | 1094 | #if DELAY_POOLS |
79618ba9 | 1095 | unsigned int no_delay:1; |
cd196bc8 | 1096 | #endif |
987de783 | 1097 | unsigned int allow_miss:1; |
cd196bc8 | 1098 | } options; |
a8258824 | 1099 | int weight; |
1100 | struct { | |
1101 | double avg_n_members; | |
1102 | int n_times_counted; | |
1103 | int n_replies_expected; | |
1104 | int ttl; | |
007b8be4 | 1105 | int id; |
b515fc11 | 1106 | struct { |
79618ba9 | 1107 | unsigned int count_event_pending:1; |
1108 | unsigned int counting:1; | |
ff283ec1 | 1109 | } flags; |
a8258824 | 1110 | } mcast; |
c68e9c6b | 1111 | #if USE_CACHE_DIGESTS |
e13ee7ad | 1112 | PeerDigest *digest; |
7e3ce7b9 | 1113 | char *digest_url; |
c68e9c6b | 1114 | #endif |
a8258824 | 1115 | int tcp_up; /* 0 if a connect() fails */ |
a8258824 | 1116 | struct in_addr addresses[10]; |
1117 | int n_addresses; | |
1118 | int rr_count; | |
82056f1e | 1119 | int rr_lastcount; |
bd05e3e3 | 1120 | peer *next; |
a8258824 | 1121 | int test_fd; |
afd88fbe | 1122 | #if USE_CARP |
1123 | struct { | |
1124 | unsigned long hash; | |
1125 | unsigned long load_multiplier; | |
1126 | float load_factor; | |
1127 | } carp; | |
1128 | #endif | |
c68e9c6b | 1129 | char *login; /* Proxy authorization */ |
3f62decd | 1130 | time_t connect_timeout; |
a8258824 | 1131 | }; |
1132 | ||
1133 | struct _net_db_name { | |
1134 | char *name; | |
74fbf3c9 | 1135 | net_db_name *htbl_next; |
1136 | net_db_name *next; | |
1137 | netdbEntry *net_db_entry; | |
a8258824 | 1138 | }; |
1139 | ||
1140 | struct _net_db_peer { | |
6b53c392 | 1141 | const char *peername; |
a8258824 | 1142 | double hops; |
1143 | double rtt; | |
1144 | time_t expires; | |
1145 | }; | |
1146 | ||
1147 | struct _netdbEntry { | |
ec878047 | 1148 | /* first two items must be equivalent to hash_link */ |
a8258824 | 1149 | char *key; |
74fbf3c9 | 1150 | netdbEntry *next; |
a8258824 | 1151 | char network[16]; |
1152 | int pings_sent; | |
1153 | int pings_recv; | |
1154 | double hops; | |
1155 | double rtt; | |
1156 | time_t next_ping_time; | |
1157 | time_t last_use_time; | |
1158 | int link_count; | |
1159 | net_db_name *hosts; | |
1160 | net_db_peer *peers; | |
1161 | int n_peers_alloc; | |
1162 | int n_peers; | |
1163 | }; | |
1164 | ||
1165 | struct _ps_state { | |
1166 | request_t *request; | |
1167 | StoreEntry *entry; | |
1168 | int always_direct; | |
1169 | int never_direct; | |
db1cd23c | 1170 | int direct; |
a8258824 | 1171 | PSC *callback; |
a8258824 | 1172 | void *callback_data; |
db1cd23c | 1173 | FwdServer *servers; |
85223cd7 | 1174 | /* |
1175 | * Why are these struct sockaddr_in instead of peer *? Because a | |
1176 | * peer structure can become invalid during the peer selection | |
1177 | * phase, specifically after a reconfigure. Thus we need to lookup | |
1178 | * the peer * based on the address when we are finally ready to | |
1179 | * reference the peer structure. | |
1180 | */ | |
1181 | struct sockaddr_in first_parent_miss; | |
1182 | struct sockaddr_in closest_parent_miss; | |
db1cd23c | 1183 | /* |
1184 | * ->hit and ->secho can be peer* because they should only be | |
1185 | * accessed during the thread when they are set | |
1186 | */ | |
1187 | peer *hit; | |
1188 | peer_t hit_type; | |
1189 | #if ALLOW_SOURCE_PING | |
1190 | peer *secho; | |
1191 | #endif | |
b4e7f82d | 1192 | ping_data ping; |
a8258824 | 1193 | aclCheck_t *acl_checklist; |
1194 | }; | |
1195 | ||
6b53c392 | 1196 | #if USE_ICMP |
a8258824 | 1197 | struct _pingerEchoData { |
1198 | struct in_addr to; | |
1199 | unsigned char opcode; | |
1200 | int psize; | |
65ae9f56 | 1201 | char payload[PINGER_PAYLOAD_SZ]; |
a8258824 | 1202 | }; |
1203 | ||
1204 | struct _pingerReplyData { | |
1205 | struct in_addr from; | |
1206 | unsigned char opcode; | |
1207 | int rtt; | |
1208 | int hops; | |
1209 | int psize; | |
65ae9f56 | 1210 | char payload[PINGER_PAYLOAD_SZ]; |
a8258824 | 1211 | }; |
6b53c392 | 1212 | #endif |
a8258824 | 1213 | |
1214 | struct _icp_common_t { | |
1215 | unsigned char opcode; /* opcode */ | |
1216 | unsigned char version; /* version number */ | |
1217 | unsigned short length; /* total length (bytes) */ | |
1218 | u_num32 reqnum; /* req number (req'd for UDP) */ | |
1219 | u_num32 flags; | |
1220 | u_num32 pad; | |
a8258824 | 1221 | u_num32 shostid; /* sender host id */ |
1222 | }; | |
1223 | ||
a8258824 | 1224 | struct _iostats { |
1225 | struct { | |
1226 | int reads; | |
1227 | int reads_deferred; | |
1228 | int read_hist[16]; | |
1229 | int writes; | |
1230 | int write_hist[16]; | |
1231 | } Http, Ftp, Gopher, Wais; | |
1232 | }; | |
1233 | ||
1234 | struct _mem_node { | |
1235 | char *data; | |
1236 | int len; | |
1237 | mem_node *next; | |
1238 | }; | |
1239 | ||
1240 | struct _mem_hdr { | |
1241 | mem_node *head; | |
1242 | mem_node *tail; | |
1243 | int origin_offset; | |
1244 | }; | |
1245 | ||
a8258824 | 1246 | /* keep track each client receiving data from that particular StoreEntry */ |
1247 | struct _store_client { | |
43329771 | 1248 | int type; |
a8258824 | 1249 | off_t copy_offset; |
1250 | off_t seen_offset; | |
1251 | size_t copy_size; | |
1252 | char *copy_buf; | |
1253 | STCB *callback; | |
1254 | void *callback_data; | |
07304bf9 | 1255 | StoreEntry *entry; /* ptr to the parent StoreEntry, argh! */ |
2391a162 | 1256 | storeIOState *swapin_sio; |
f115fadd | 1257 | struct { |
3d94aed0 | 1258 | unsigned int disk_io_pending:1; |
1259 | unsigned int store_copying:1; | |
1260 | unsigned int copy_event_pending:1; | |
f115fadd | 1261 | } flags; |
bd05e3e3 | 1262 | store_client *next; |
447e176b | 1263 | #if DELAY_POOLS |
1264 | delay_id delay_id; | |
1265 | #endif | |
a8258824 | 1266 | }; |
1267 | ||
1a3db59c | 1268 | |
a8258824 | 1269 | /* This structure can be freed while object is purged out from memory */ |
1270 | struct _MemObject { | |
2ac237e2 | 1271 | method_t method; |
9fb13bb6 | 1272 | char *url; |
18fe65d0 | 1273 | mem_hdr data_hdr; |
8350fe9b | 1274 | off_t inmem_hi; |
1275 | off_t inmem_lo; | |
bd05e3e3 | 1276 | store_client *clients; |
a8258824 | 1277 | int nclients; |
8350fe9b | 1278 | struct { |
e3ef2b09 | 1279 | off_t queue_offset; /* relative to in-mem data */ |
cd748f27 | 1280 | mem_node *memnode; /* which node we're currently paging out */ |
2391a162 | 1281 | storeIOState *sio; |
8350fe9b | 1282 | } swapout; |
cb69b4c7 | 1283 | HttpReply *reply; |
a8258824 | 1284 | request_t *request; |
1285 | struct timeval start_ping; | |
b4e7f82d | 1286 | IRCB *ping_reply_callback; |
a8258824 | 1287 | void *ircb_data; |
1288 | int fd; /* FD of client creating this entry */ | |
1289 | struct { | |
1290 | STABH *callback; | |
1291 | void *data; | |
1292 | } abort; | |
88738790 | 1293 | char *log_url; |
2b906e48 | 1294 | #if HEAP_REPLACEMENT |
1295 | /* | |
1296 | * A MemObject knows where it is in the in-memory heap. | |
1297 | */ | |
1298 | heap_node *node; | |
1299 | #else | |
b93bcace | 1300 | dlink_node lru; |
2b906e48 | 1301 | #endif |
007b8be4 | 1302 | int id; |
07304bf9 | 1303 | ssize_t object_sz; |
e3ef2b09 | 1304 | size_t swap_hdr_sz; |
bc87dc25 | 1305 | #if URL_CHECKSUM_DEBUG |
1306 | unsigned int chksum; | |
1307 | #endif | |
a8258824 | 1308 | }; |
1309 | ||
a8258824 | 1310 | struct _StoreEntry { |
ec878047 | 1311 | /* first two items must be same as hash_link */ |
9fb13bb6 | 1312 | const cache_key *key; |
bd05e3e3 | 1313 | StoreEntry *next; |
a8258824 | 1314 | MemObject *mem_obj; |
a8258824 | 1315 | time_t timestamp; |
1316 | time_t lastref; | |
1317 | time_t expires; | |
1318 | time_t lastmod; | |
07304bf9 | 1319 | size_t swap_file_sz; |
a21fbb54 | 1320 | u_short refcount; |
d46a87a8 | 1321 | u_short flags; |
cd748f27 | 1322 | sdirno swap_dirn; |
1323 | sfileno swap_filen; | |
1324 | union { | |
1325 | #ifdef HEAP_REPLACEMENT | |
1326 | heap_node *node; | |
2b906e48 | 1327 | #endif |
cd748f27 | 1328 | dlink_node lru; |
1329 | } repl; | |
a3cb7458 | 1330 | u_short lock_count; /* Assume < 65536! */ |
a8258824 | 1331 | mem_status_t mem_status:3; |
1332 | ping_status_t ping_status:3; | |
1333 | store_status_t store_status:3; | |
1334 | swap_status_t swap_status:3; | |
a8258824 | 1335 | }; |
1336 | ||
1337 | struct _SwapDir { | |
cd748f27 | 1338 | char *type; |
a8258824 | 1339 | int cur_size; |
c6844e77 | 1340 | int low_size; |
a8258824 | 1341 | int max_size; |
0e4e0e7d | 1342 | char *path; |
b2c141d4 | 1343 | int index; /* This entry's index into the swapDirs array */ |
cd748f27 | 1344 | int suggest; |
1345 | size_t max_objsize; | |
1346 | union { | |
1347 | #ifdef HEAP_REPLACEMENT | |
1348 | struct { | |
1349 | heap *heap; | |
1350 | } heap; | |
1351 | #endif | |
1352 | struct { | |
1353 | dlink_list list; | |
1354 | dlink_node *walker; | |
1355 | } lru; | |
1356 | } repl; | |
fc8b9fc0 | 1357 | int removals; |
1358 | int scanned; | |
72615e4a | 1359 | struct { |
1360 | unsigned int selected:1; | |
b6a2f15e | 1361 | unsigned int read_only:1; |
72615e4a | 1362 | } flags; |
cd748f27 | 1363 | STINIT *init; /* Initialise the fs */ |
1364 | STNEWFS *newfs; /* Create a new fs */ | |
1365 | STDUMP *dump; /* Dump fs config snippet */ | |
1366 | STFREE *freefs; /* Free the fs data */ | |
1367 | STDBLCHECK *dblcheck; /* Double check the obj integrity */ | |
1368 | STSTATFS *statfs; /* Dump fs statistics */ | |
1369 | STMAINTAINFS *maintainfs; /* Replacement maintainence */ | |
1370 | STCHECKOBJ *checkobj; /* Check if the fs will store an object */ | |
1371 | /* These two are notifications */ | |
1372 | STREFOBJ *refobj; /* Reference this object */ | |
1373 | STUNREFOBJ *unrefobj; /* Unreference this object */ | |
1374 | STCALLBACK *callback; /* Handle pending callbacks */ | |
1375 | STSYNC *sync; /* Sync the directory */ | |
1376 | struct { | |
1377 | STOBJCREATE *create; | |
b2c141d4 | 1378 | STOBJOPEN *open; |
1379 | STOBJCLOSE *close; | |
1380 | STOBJREAD *read; | |
1381 | STOBJWRITE *write; | |
1382 | STOBJUNLINK *unlink; | |
b2c141d4 | 1383 | } obj; |
1384 | struct { | |
1385 | STLOGOPEN *open; | |
1386 | STLOGCLOSE *close; | |
200ba06e | 1387 | STLOGWRITE *write; |
b2c141d4 | 1388 | struct { |
1389 | STLOGCLEANOPEN *open; | |
1390 | STLOGCLEANWRITE *write; | |
1391 | void *state; | |
1392 | } clean; | |
1393 | } log; | |
cd748f27 | 1394 | void *fsdata; |
a8258824 | 1395 | }; |
1396 | ||
92695e5e | 1397 | struct _request_flags { |
3d94aed0 | 1398 | unsigned int range:1; |
1399 | unsigned int nocache:1; | |
1400 | unsigned int ims:1; | |
1401 | unsigned int auth:1; | |
1402 | unsigned int cachable:1; | |
1403 | unsigned int hierarchical:1; | |
1404 | unsigned int loopdetect:1; | |
1405 | unsigned int proxy_keepalive:1; | |
1406 | unsigned int proxying:1; | |
1407 | unsigned int refresh:1; | |
1408 | unsigned int used_proxy_auth:1; | |
1409 | unsigned int redirected:1; | |
9689d97c | 1410 | unsigned int need_validation:1; |
9f60cfdf | 1411 | #if HTTP_VIOLATIONS |
886f2785 | 1412 | unsigned int nocache_hack:1; /* for changing/ignoring no-cache requests */ |
9f60cfdf | 1413 | #endif |
c68e9c6b | 1414 | unsigned int accelerated:1; |
1415 | unsigned int internal:1; | |
92695e5e | 1416 | }; |
1417 | ||
d03d26fb | 1418 | struct _link_list { |
1419 | void *ptr; | |
1420 | struct _link_list *next; | |
1421 | }; | |
1422 | ||
2391a162 | 1423 | struct _storeIOState { |
cd748f27 | 1424 | sdirno swap_dirn; |
1425 | sfileno swap_filen; | |
1426 | StoreEntry *e; /* Need this so the FS layers can play god */ | |
2391a162 | 1427 | mode_t mode; |
1428 | size_t st_size; /* do stat(2) after read open */ | |
cd748f27 | 1429 | off_t offset; /* current on-disk offset pointer */ |
1430 | STFNCB *file_callback; /* called on delayed sfileno assignments */ | |
2391a162 | 1431 | STIOCB *callback; |
1432 | void *callback_data; | |
1433 | struct { | |
1434 | STRCB *callback; | |
1435 | void *callback_data; | |
1436 | } read; | |
1437 | struct { | |
1438 | unsigned int closing:1; /* debugging aid */ | |
1439 | } flags; | |
cd748f27 | 1440 | void *fsstate; |
2391a162 | 1441 | }; |
1442 | ||
a8258824 | 1443 | struct _request_t { |
1444 | method_t method; | |
1445 | protocol_t protocol; | |
1446 | char login[MAX_LOGIN_SZ]; | |
1447 | char host[SQUIDHOSTNAMELEN + 1]; | |
def67559 | 1448 | char user_ident[USER_IDENT_SZ]; /* from proxy auth or ident server */ |
a8258824 | 1449 | u_short port; |
02922e76 | 1450 | String urlpath; |
e4a45101 | 1451 | char *canonical; |
a8258824 | 1452 | int link_count; /* free when zero */ |
92695e5e | 1453 | request_flags flags; |
8e092300 | 1454 | HttpHdrCc *cache_control; |
d192d11f | 1455 | HttpHdrRange *range; |
a8258824 | 1456 | float http_ver; |
1457 | time_t ims; | |
1458 | int imslen; | |
1459 | int max_forwards; | |
7e3ce7b9 | 1460 | /* these in_addr's could probably be sockaddr_in's */ |
a8258824 | 1461 | struct in_addr client_addr; |
3c11d1f5 | 1462 | struct in_addr my_addr; |
7e3ce7b9 | 1463 | unsigned short my_port; |
99edd1c3 | 1464 | HttpHeader header; |
a8258824 | 1465 | char *body; |
1466 | size_t body_sz; | |
1f38f50a | 1467 | int content_length; |
bd05e3e3 | 1468 | HierarchyLogEntry hier; |
88aad2e5 | 1469 | err_type err_type; |
c68e9c6b | 1470 | char *peer_login; /* Configured peer login:password */ |
9bc73deb | 1471 | time_t lastmod; /* Used on refreshes */ |
a8258824 | 1472 | }; |
1473 | ||
1474 | struct _cachemgr_passwd { | |
1475 | char *passwd; | |
22f3fd98 | 1476 | wordlist *actions; |
bd05e3e3 | 1477 | cachemgr_passwd *next; |
a8258824 | 1478 | }; |
1479 | ||
1480 | struct _refresh_t { | |
1481 | char *pattern; | |
1482 | regex_t compiled_pattern; | |
1483 | time_t min; | |
c3f6d204 | 1484 | double pct; |
a8258824 | 1485 | time_t max; |
bd05e3e3 | 1486 | refresh_t *next; |
c3f6d204 | 1487 | struct { |
1dfa1d81 | 1488 | unsigned int icase:1; |
9f60cfdf | 1489 | #if HTTP_VIOLATIONS |
1dfa1d81 | 1490 | unsigned int override_expire:1; |
1491 | unsigned int override_lastmod:1; | |
cbe3a719 | 1492 | unsigned int reload_into_ims:1; |
1493 | unsigned int ignore_reload:1; | |
9f60cfdf | 1494 | #endif |
c3f6d204 | 1495 | } flags; |
a8258824 | 1496 | }; |
1497 | ||
1498 | struct _CommWriteStateData { | |
1499 | char *buf; | |
1500 | size_t size; | |
1501 | off_t offset; | |
1502 | CWCB *handler; | |
1503 | void *handler_data; | |
74fbf3c9 | 1504 | FREE *free_func; |
a8258824 | 1505 | }; |
9b312a19 | 1506 | |
1507 | struct _ErrorState { | |
1508 | err_type type; | |
02922e76 | 1509 | int page_id; |
9b312a19 | 1510 | http_status http_status; |
1511 | request_t *request; | |
1512 | char *url; | |
c45ed9ad | 1513 | int xerrno; |
9b312a19 | 1514 | char *host; |
1515 | u_short port; | |
1516 | char *dnsserver_msg; | |
1517 | time_t ttl; | |
1518 | struct in_addr src_addr; | |
1519 | char *redirect_url; | |
1520 | ERCB *callback; | |
1521 | void *callback_data; | |
b515fc11 | 1522 | struct { |
79618ba9 | 1523 | unsigned int flag_cbdata:1; |
b515fc11 | 1524 | } flags; |
b9916917 | 1525 | struct { |
9bc73deb | 1526 | wordlist *server_msg; |
b9916917 | 1527 | char *request; |
1528 | char *reply; | |
1529 | } ftp; | |
e144eae4 | 1530 | char *request_hdrs; |
9b312a19 | 1531 | }; |
f2908497 | 1532 | |
12cf1be2 | 1533 | /* |
1534 | * "very generic" histogram; | |
1535 | * see important comments on hbase_f restrictions in StatHist.c | |
1536 | */ | |
1537 | struct _StatHist { | |
1538 | int *bins; | |
1539 | int capacity; | |
e9a13293 | 1540 | double min; |
1541 | double max; | |
1542 | double scale; | |
95c297ec | 1543 | hbase_f *val_in; /* e.g., log() for log-based histogram */ |
1544 | hbase_f *val_out; /* e.g., exp() for log based histogram */ | |
7ae52c25 | 1545 | }; |
1546 | ||
12cf1be2 | 1547 | /* |
1548 | * if you add a field to StatCounters, | |
1d803566 | 1549 | * you MUST sync statCountersInitSpecial, statCountersClean, and statCountersCopy |
12cf1be2 | 1550 | */ |
f2908497 | 1551 | struct _StatCounters { |
1552 | struct { | |
98829f69 | 1553 | int clients; |
f2908497 | 1554 | int requests; |
1555 | int hits; | |
4f4d1d6e | 1556 | int mem_hits; |
1557 | int disk_hits; | |
f2908497 | 1558 | int errors; |
a7c05555 | 1559 | kb_t kbytes_in; |
1560 | kb_t kbytes_out; | |
1561 | kb_t hit_kbytes_out; | |
12cf1be2 | 1562 | StatHist miss_svc_time; |
1563 | StatHist nm_svc_time; | |
7c9c84ad | 1564 | StatHist nh_svc_time; |
12cf1be2 | 1565 | StatHist hit_svc_time; |
1566 | StatHist all_svc_time; | |
f2908497 | 1567 | } client_http; |
7ae52c25 | 1568 | struct { |
a0f32775 | 1569 | struct { |
1570 | int requests; | |
1571 | int errors; | |
1572 | kb_t kbytes_in; | |
1573 | kb_t kbytes_out; | |
399e85ea | 1574 | } all , http, ftp, other; |
7ae52c25 | 1575 | } server; |
f2908497 | 1576 | struct { |
1577 | int pkts_sent; | |
071a3ae7 | 1578 | int queries_sent; |
1579 | int replies_sent; | |
f2908497 | 1580 | int pkts_recv; |
071a3ae7 | 1581 | int queries_recv; |
1582 | int replies_recv; | |
a7c05555 | 1583 | int hits_sent; |
1584 | int hits_recv; | |
8064065e | 1585 | int replies_queued; |
17b6e784 | 1586 | int replies_dropped; |
a7c05555 | 1587 | kb_t kbytes_sent; |
071a3ae7 | 1588 | kb_t q_kbytes_sent; |
1589 | kb_t r_kbytes_sent; | |
a7c05555 | 1590 | kb_t kbytes_recv; |
071a3ae7 | 1591 | kb_t q_kbytes_recv; |
1592 | kb_t r_kbytes_recv; | |
12cf1be2 | 1593 | StatHist query_svc_time; |
1594 | StatHist reply_svc_time; | |
4b4cd312 | 1595 | int query_timeouts; |
c127134a | 1596 | int times_used; |
f2908497 | 1597 | } icp; |
1598 | struct { | |
1599 | int requests; | |
1600 | } unlink; | |
9973e9fe | 1601 | struct { |
12cf1be2 | 1602 | StatHist svc_time; |
9973e9fe | 1603 | } dns; |
c127134a | 1604 | struct { |
1605 | int times_used; | |
26b164ac | 1606 | kb_t kbytes_sent; |
1607 | kb_t kbytes_recv; | |
c127134a | 1608 | kb_t memory; |
00485c29 | 1609 | int msgs_sent; |
1610 | int msgs_recv; | |
c68e9c6b | 1611 | #if USE_CACHE_DIGESTS |
4b4cd312 | 1612 | cd_guess_stats guess; |
c68e9c6b | 1613 | #endif |
69c95dd3 | 1614 | StatHist on_xition_count; |
c127134a | 1615 | } cd; |
69c95dd3 | 1616 | struct { |
1617 | int times_used; | |
1618 | } netdb; | |
f2908497 | 1619 | int page_faults; |
1620 | int select_loops; | |
d239c2f5 | 1621 | int select_fds; |
1622 | double select_time; | |
f2908497 | 1623 | double cputime; |
d5649d9f | 1624 | struct timeval timestamp; |
c6ecdbc3 | 1625 | StatHist comm_icp_incoming; |
ef523f99 | 1626 | StatHist comm_dns_incoming; |
c6ecdbc3 | 1627 | StatHist comm_http_incoming; |
26d6ee93 | 1628 | StatHist select_fds_hist; |
886f2785 | 1629 | struct { |
1630 | struct { | |
1631 | int opens; | |
1632 | int closes; | |
1633 | int reads; | |
1634 | int writes; | |
1635 | int seeks; | |
64b54eed | 1636 | int unlinks; |
886f2785 | 1637 | } disk; |
1638 | struct { | |
1639 | int accepts; | |
1640 | int sockets; | |
1641 | int connects; | |
1642 | int binds; | |
1643 | int closes; | |
1644 | int reads; | |
1645 | int writes; | |
1646 | int recvfroms; | |
1647 | int sendtos; | |
1648 | } sock; | |
1649 | #if HAVE_POLL | |
1650 | int polls; | |
1651 | #else | |
1652 | int selects; | |
1653 | #endif | |
1654 | } syscalls; | |
2c4f7ab2 | 1655 | int swap_files_cleaned; |
bfae3379 | 1656 | int aborted_requests; |
f2908497 | 1657 | }; |
69c01cd7 | 1658 | |
fcd2d3ef | 1659 | /* per header statistics */ |
1660 | struct _HttpHeaderStat { | |
1661 | const char *label; | |
1662 | HttpHeaderMask *owner_mask; | |
1663 | ||
1664 | StatHist hdrUCountDistr; | |
1665 | StatHist fieldTypeDistr; | |
1666 | StatHist ccTypeDistr; | |
1667 | ||
1668 | int parsedCount; | |
1669 | int ccParsedCount; | |
1670 | int destroyedCount; | |
1671 | int busyDestroyedCount; | |
1672 | }; | |
1673 | ||
1674 | ||
69c01cd7 | 1675 | struct _tlv { |
5830cdb3 | 1676 | char type; |
1677 | int length; | |
1678 | void *value; | |
bd05e3e3 | 1679 | tlv *next; |
5830cdb3 | 1680 | }; |
1681 | ||
cd748f27 | 1682 | /* |
1683 | * Do we need to have the dirn in here? I don't think so, since we already | |
1684 | * know the dirn .. | |
1685 | */ | |
07304bf9 | 1686 | struct _storeSwapLogData { |
5830cdb3 | 1687 | char op; |
cd748f27 | 1688 | sfileno swap_filen; |
5830cdb3 | 1689 | time_t timestamp; |
1690 | time_t lastref; | |
1691 | time_t expires; | |
1692 | time_t lastmod; | |
07304bf9 | 1693 | size_t swap_file_sz; |
5830cdb3 | 1694 | u_short refcount; |
d46a87a8 | 1695 | u_short flags; |
7363fc17 | 1696 | unsigned char key[MD5_DIGEST_CHARS]; |
69c01cd7 | 1697 | }; |
59c4d35b | 1698 | |
02922e76 | 1699 | /* object to track per-action memory usage (e.g. #idle objects) */ |
1700 | struct _MemMeter { | |
9bc73deb | 1701 | ssize_t level; /* current level (count or volume) */ |
1702 | ssize_t hwater_level; /* high water mark */ | |
d8b249ef | 1703 | time_t hwater_stamp; /* timestamp of last high water mark change */ |
02922e76 | 1704 | }; |
1705 | ||
1706 | /* object to track per-pool memory usage (alloc = inuse+idle) */ | |
1707 | struct _MemPoolMeter { | |
1708 | MemMeter alloc; | |
1709 | MemMeter inuse; | |
1710 | MemMeter idle; | |
1711 | gb_t saved; | |
7f8bbdcd | 1712 | gb_t total; |
02922e76 | 1713 | }; |
1714 | ||
1715 | /* a pool is a [growing] space for objects of the same size */ | |
1716 | struct _MemPool { | |
1717 | const char *label; | |
1718 | size_t obj_size; | |
1719 | Stack pstack; /* stack for free pointers */ | |
1720 | MemPoolMeter meter; | |
1721 | }; | |
1722 | ||
59c4d35b | 1723 | struct _ClientInfo { |
ec878047 | 1724 | /* first two items must be equivalent to hash_link */ |
59c4d35b | 1725 | char *key; |
ca3c5a71 | 1726 | ClientInfo *next; |
59c4d35b | 1727 | struct in_addr addr; |
1728 | struct { | |
1729 | int result_hist[LOG_TYPE_MAX]; | |
1730 | int n_requests; | |
ec878047 | 1731 | kb_t kbytes_in; |
1732 | kb_t kbytes_out; | |
1733 | kb_t hit_kbytes_out; | |
59c4d35b | 1734 | } Http, Icp; |
1735 | struct { | |
1736 | time_t time; | |
1737 | int n_req; | |
1738 | int n_denied; | |
1739 | } cutoff; | |
9bc73deb | 1740 | int n_established; /* number of current established connections */ |
59c4d35b | 1741 | }; |
c411be12 | 1742 | |
c411be12 | 1743 | struct _CacheDigest { |
1744 | /* public, read-only */ | |
1afe05c5 | 1745 | char *mask; /* bit mask */ |
1746 | size_t mask_size; /* mask size in bytes */ | |
1747 | int capacity; /* expected maximum for .count, not a hard limit */ | |
04f0c415 | 1748 | int bits_per_entry; /* number of bits allocated for each entry from capacity */ |
1afe05c5 | 1749 | int count; /* number of digested entries */ |
1750 | int del_count; /* number of deletions performed so far */ | |
c411be12 | 1751 | }; |
910169e5 | 1752 | |
db1cd23c | 1753 | struct _FwdServer { |
1754 | peer *peer; /* NULL --> origin server */ | |
1755 | hier_code code; | |
1756 | FwdServer *next; | |
1757 | }; | |
1758 | ||
910169e5 | 1759 | struct _FwdState { |
1760 | int client_fd; | |
1761 | StoreEntry *entry; | |
1762 | request_t *request; | |
1763 | FwdServer *servers; | |
6801f8a8 | 1764 | int server_fd; |
ec250dfd | 1765 | ErrorState *err; |
f563eea9 | 1766 | time_t start; |
68bd6892 | 1767 | int n_tries; |
ee08bdf5 | 1768 | struct { |
1769 | unsigned int dont_retry:1; | |
9bc73deb | 1770 | unsigned int ftp_pasv_failed:1; |
ee08bdf5 | 1771 | } flags; |
910169e5 | 1772 | }; |
1773 | ||
86aebcda | 1774 | #if USE_HTCP |
1775 | struct _htcpReplyData { | |
886f2785 | 1776 | int hit; |
1777 | HttpHeader hdr; | |
1778 | u_num32 msg_id; | |
1779 | double version; | |
1780 | struct { | |
b4e7f82d | 1781 | /* cache-to-origin */ |
886f2785 | 1782 | double rtt; |
1783 | int samp; | |
1784 | int hops; | |
1785 | } cto; | |
86aebcda | 1786 | }; |
886f2785 | 1787 | |
86aebcda | 1788 | #endif |
74addf6c | 1789 | |
1790 | ||
1791 | struct _helper_request { | |
1792 | char *buf; | |
1793 | HLPCB *callback; | |
1794 | void *data; | |
1795 | }; | |
1796 | ||
1797 | struct _helper { | |
1798 | wordlist *cmdline; | |
1799 | dlink_list servers; | |
1800 | dlink_list queue; | |
1f5f60dd | 1801 | const char *id_name; |
74addf6c | 1802 | int n_to_start; |
1803 | int n_running; | |
1804 | int ipc_type; | |
1805 | time_t last_queue_warn; | |
1806 | struct { | |
1807 | int requests; | |
1808 | int replies; | |
1809 | int queue_size; | |
1810 | int avg_svc_time; | |
1811 | } stats; | |
1812 | }; | |
1813 | ||
1814 | struct _helper_server { | |
1815 | int index; | |
1816 | int rfd; | |
1817 | int wfd; | |
1818 | char *buf; | |
1819 | size_t buf_sz; | |
1820 | off_t offset; | |
1821 | struct timeval dispatch_time; | |
1822 | struct timeval answer_time; | |
1823 | dlink_node link; | |
1824 | helper *parent; | |
1825 | helper_request *request; | |
838b993c | 1826 | struct _helper_flags { |
1827 | unsigned int alive:1; | |
1828 | unsigned int busy:1; | |
1829 | unsigned int closing:1; | |
1830 | unsigned int shutdown:1; | |
1831 | } flags; | |
74addf6c | 1832 | struct { |
1833 | int uses; | |
1834 | } stats; | |
1835 | }; | |
1836 | ||
1837 | /* | |
1838 | * use this when you need to pass callback data to a blocking | |
1839 | * operation, but you don't want to add that pointer to cbdata | |
1840 | */ | |
1841 | struct _generic_cbdata { | |
1842 | void *data; | |
1843 | }; | |
b2c141d4 | 1844 | |
1845 | struct _store_rebuild_data { | |
1846 | int objcount; /* # objects successfully reloaded */ | |
1847 | int expcount; /* # objects expired */ | |
1848 | int scancount; /* # entries scanned or read from state file */ | |
1849 | int clashcount; /* # swapfile clashes avoided */ | |
1850 | int dupcount; /* # duplicates purged */ | |
1851 | int cancelcount; /* # SWAP_LOG_DEL objects purged */ | |
1852 | int invalid; /* # bad lines */ | |
1853 | int badflags; /* # bad e->flags */ | |
1854 | int bad_log_op; | |
1855 | int zero_object_sz; | |
1856 | }; | |
5673c2e2 | 1857 | |
cd748f27 | 1858 | /* |
1859 | * This defines an fs type | |
1860 | */ | |
1861 | ||
1862 | struct _storefs_entry { | |
1863 | char *typestr; | |
1864 | STFSPARSE *parsefunc; | |
1865 | STFSRECONFIGURE *reconfigurefunc; | |
1866 | STFSSHUTDOWN *donefunc; | |
1867 | }; | |
1868 | ||
1869 | /* | |
1870 | * Async disk IO - this defines a async disk io queue | |
1871 | */ | |
1872 | ||
1873 | struct _diskd_queue { | |
1874 | int smsgid; /* send sysvmsg id */ | |
1875 | int rmsgid; /* recv sysvmsg id */ | |
1876 | int wfd; /* queue file descriptor ? */ | |
1877 | int away; /* number of requests away */ | |
1878 | int sent_count; /* number of messages sent */ | |
1879 | int recv_count; /* number of messages received */ | |
1880 | struct { | |
1881 | char *buf; /* shm buffer */ | |
1882 | link_list *stack; | |
1883 | int id; /* sysvshm id */ | |
1884 | } shm; | |
1885 | }; | |
1886 | ||
5673c2e2 | 1887 | struct _Logfile { |
1888 | int fd; | |
1889 | char path[MAXPATHLEN]; | |
1890 | char *buf; | |
1891 | size_t bufsz; | |
1892 | off_t offset; | |
1893 | }; |