]>
Commit | Line | Data |
---|---|---|
a8258824 | 1 | |
9cef6668 | 2 | /* |
92695e5e | 3 | * $Id: structs.h,v 1.208 1998/08/21 03:15:26 wessels 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 | |
13 | * Duane Wessels and the University of California San Diego. Please | |
14 | * see the COPYRIGHT file for full details. Squid incorporates | |
15 | * software developed and/or copyrighted by other sources. Please see | |
16 | * the CREDITS file for full details. | |
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 | ||
a8258824 | 34 | struct _acl_ip_data { |
35 | struct in_addr addr1; /* if addr2 non-zero then its a range */ | |
36 | struct in_addr addr2; | |
37 | struct in_addr mask; | |
1a106e18 | 38 | acl_ip_data *next; /* used for parsing, not for storing */ |
a8258824 | 39 | }; |
40 | ||
43d4303e | 41 | struct _acl_snmp_comm { |
42 | char *name; | |
43 | void *community; | |
44 | acl_snmp_comm *next; | |
45 | }; | |
46 | ||
a8258824 | 47 | struct _acl_time_data { |
48 | int weekbits; | |
49 | int start; | |
50 | int stop; | |
74fbf3c9 | 51 | acl_time_data *next; |
a8258824 | 52 | }; |
53 | ||
54 | struct _acl_name_list { | |
55 | char name[ACL_NAME_SZ]; | |
74fbf3c9 | 56 | acl_name_list *next; |
a8258824 | 57 | }; |
58 | ||
afe95a7e | 59 | struct _acl_proxy_auth { |
73e67ee0 | 60 | int timeout; /* timeout value for cached usercode:password entries */ |
afe95a7e | 61 | hash_table *hash; |
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; | |
ec878047 | 72 | }; |
73 | ||
a8258824 | 74 | struct _acl_deny_info_list { |
02922e76 | 75 | int err_page_id; |
76 | char *err_page_name; | |
74fbf3c9 | 77 | acl_name_list *acl_list; |
78 | acl_deny_info_list *next; | |
a8258824 | 79 | }; |
80 | ||
66c75c41 | 81 | #if USE_ARP_ACL |
cbe3a719 | 82 | |
66c75c41 | 83 | struct _acl_arp_data { |
74b7003b | 84 | char eth[6]; |
66c75c41 | 85 | }; |
cbe3a719 | 86 | |
66c75c41 | 87 | #endif |
88 | ||
02922e76 | 89 | struct _String { |
90 | /* never reference these directly! */ | |
a369131d | 91 | unsigned short int size; /* buffer size; 64K limit */ |
92 | unsigned short int len; /* current length */ | |
02922e76 | 93 | char *buf; |
94 | }; | |
95 | ||
1df370e3 | 96 | #if SQUID_SNMP |
43d4303e | 97 | |
a9ddb359 | 98 | struct _snmp_request_t { |
5e29a294 | 99 | u_char *buf; |
100 | u_char *outbuf; | |
2ac76861 | 101 | int len; |
102 | int sock; | |
103 | long reqid; | |
104 | int outlen; | |
105 | struct sockaddr_in from; | |
106 | struct snmp_pdu *PDU; | |
107 | aclCheck_t *acl_checklist; | |
5e29a294 | 108 | u_char *community; |
a9ddb359 | 109 | }; |
bdf18524 | 110 | |
a9ddb359 | 111 | struct _viewEntry { |
6ccb94e5 | 112 | char viewName[32]; |
113 | int viewIndex; | |
114 | int viewType; | |
115 | int viewSubtreeLen; | |
116 | oid viewSubtree[32]; | |
117 | struct _viewEntry *next; | |
a9ddb359 | 118 | }; |
6ccb94e5 | 119 | |
a9ddb359 | 120 | struct _communityEntry { |
6ccb94e5 | 121 | char name[64]; |
122 | int readView; | |
123 | int writeView; | |
bd05e3e3 | 124 | acl_access *acls; |
125 | communityEntry *next; | |
a9ddb359 | 126 | }; |
6ccb94e5 | 127 | |
a9ddb359 | 128 | struct _usecEntry { |
6ccb94e5 | 129 | u_char userName[32]; |
130 | int userLen; | |
131 | int qoS; | |
132 | u_char authKey[16]; | |
133 | u_char privKey[16]; | |
134 | int noauthReadView; | |
135 | int noauthWriteView; | |
136 | int authReadView; | |
137 | int authWriteView; | |
bd05e3e3 | 138 | usecEntry *next; |
a9ddb359 | 139 | }; |
194dd3b8 | 140 | |
1df370e3 | 141 | #endif |
a97cfa48 | 142 | |
a8258824 | 143 | struct _acl { |
144 | char name[ACL_NAME_SZ]; | |
145 | squid_acl type; | |
146 | void *data; | |
147 | char *cfgline; | |
bd05e3e3 | 148 | acl *next; |
a8258824 | 149 | }; |
150 | ||
151 | struct _acl_list { | |
152 | int op; | |
bd05e3e3 | 153 | acl *acl; |
154 | acl_list *next; | |
a8258824 | 155 | }; |
156 | ||
157 | struct _acl_access { | |
158 | int allow; | |
bd05e3e3 | 159 | acl_list *acl_list; |
a8258824 | 160 | char *cfgline; |
bd05e3e3 | 161 | acl_access *next; |
a8258824 | 162 | }; |
163 | ||
164 | struct _aclCheck_t { | |
bd05e3e3 | 165 | const acl_access *access_list; |
a8258824 | 166 | struct in_addr src_addr; |
167 | struct in_addr dst_addr; | |
168 | request_t *request; | |
def67559 | 169 | char ident[USER_IDENT_SZ]; |
a8258824 | 170 | char browser[BROWSERNAMELEN]; |
73e67ee0 | 171 | acl_proxy_auth_user *auth_user; |
a8258824 | 172 | acl_lookup_state state[ACL_ENUM_MAX]; |
173 | PF *callback; | |
174 | void *callback_data; | |
175 | }; | |
176 | ||
177 | struct _aio_result_t { | |
178 | int aio_return; | |
179 | int aio_errno; | |
180 | }; | |
181 | ||
182 | struct _wordlist { | |
183 | char *key; | |
bd05e3e3 | 184 | wordlist *next; |
a8258824 | 185 | }; |
186 | ||
187 | struct _intlist { | |
188 | int i; | |
bd05e3e3 | 189 | intlist *next; |
a8258824 | 190 | }; |
191 | ||
192 | struct _ushortlist { | |
193 | u_short i; | |
bd05e3e3 | 194 | ushortlist *next; |
a8258824 | 195 | }; |
196 | ||
197 | struct _relist { | |
198 | char *pattern; | |
199 | regex_t regex; | |
bd05e3e3 | 200 | relist *next; |
a8258824 | 201 | }; |
202 | ||
56e64999 | 203 | #if DELAY_POOLS |
95e36d02 | 204 | struct _delay_spec { |
205 | int restore_bps; | |
206 | int max_bytes; | |
207 | }; | |
1dfa1d81 | 208 | |
56e64999 | 209 | #endif |
95e36d02 | 210 | |
a8258824 | 211 | struct _SquidConfig { |
212 | struct { | |
9906e724 | 213 | size_t maxSize; |
a8258824 | 214 | int highWaterMark; |
215 | int lowWaterMark; | |
216 | } Mem , Swap; | |
217 | struct { | |
218 | char *relayHost; | |
219 | u_short relayPort; | |
220 | } Wais; | |
221 | struct { | |
9906e724 | 222 | size_t min; |
a8258824 | 223 | int pct; |
9906e724 | 224 | size_t max; |
a8258824 | 225 | } quickAbort; |
226 | time_t referenceAge; | |
227 | time_t negativeTtl; | |
228 | time_t negativeDnsTtl; | |
229 | time_t positiveDnsTtl; | |
230 | time_t shutdownLifetime; | |
a8258824 | 231 | struct { |
232 | time_t read; | |
a8258824 | 233 | time_t lifetime; |
234 | time_t connect; | |
235 | time_t request; | |
603a02fd | 236 | time_t pconn; |
23d92c64 | 237 | time_t siteSelect; |
dc835977 | 238 | time_t deadPeer; |
98829f69 | 239 | int icp_query; /* msec */ |
240 | int mcast_icp_query; /* msec */ | |
a8258824 | 241 | } Timeout; |
9906e724 | 242 | size_t maxRequestSize; |
a8258824 | 243 | struct { |
244 | ushortlist *http; | |
245 | u_short icp; | |
ace287ee | 246 | #if USE_HTCP |
247 | u_short htcp; | |
248 | #endif | |
1df370e3 | 249 | #if SQUID_SNMP |
678c6099 | 250 | u_short snmp; |
1df370e3 | 251 | #endif |
a8258824 | 252 | } Port; |
1df370e3 | 253 | #if SQUID_SNMP |
2bbd722b | 254 | struct { |
255 | char *configFile; | |
256 | char *agentInfo; | |
257 | char *mibPath; | |
a97cfa48 | 258 | char *trap_community; |
259 | char *trap_sink; | |
2bbd722b | 260 | u_short localPort; |
261 | int do_queueing; | |
a97cfa48 | 262 | int conf_authtraps; |
5e14bf6d | 263 | wordlist *snmpconf; |
be335c22 | 264 | viewEntry *views; |
265 | usecEntry *users; | |
266 | communityEntry *communities; | |
2ac237e2 | 267 | } Snmp; |
1df370e3 | 268 | #endif |
53ad48e6 | 269 | char *as_whois_server; |
a8258824 | 270 | struct { |
271 | char *log; | |
272 | char *access; | |
273 | char *store; | |
274 | char *swap; | |
275 | char *useragent; | |
276 | int rotateNumber; | |
a8258824 | 277 | } Log; |
a8258824 | 278 | char *adminEmail; |
279 | char *effectiveUser; | |
280 | char *effectiveGroup; | |
281 | struct { | |
282 | char *dnsserver; | |
283 | char *redirect; | |
f703eacb | 284 | wordlist *authenticate; |
a8258824 | 285 | char *pinger; |
286 | char *unlinkd; | |
287 | } Program; | |
288 | int dnsChildren; | |
289 | int redirectChildren; | |
73e67ee0 | 290 | int authenticateChildren; |
a8258824 | 291 | struct { |
292 | char *host; | |
293 | u_short port; | |
a8258824 | 294 | } Accel; |
295 | char *appendDomain; | |
296 | size_t appendDomainLen; | |
297 | char *debugOptions; | |
298 | char *pidFilename; | |
299 | char *mimeTablePathname; | |
300 | char *visibleHostname; | |
98829f69 | 301 | char *uniqueHostname; |
a8258824 | 302 | char *errHtmlText; |
303 | struct { | |
304 | char *host; | |
305 | char *file; | |
306 | time_t period; | |
a8258824 | 307 | u_short port; |
308 | } Announce; | |
309 | struct { | |
310 | struct in_addr tcp_incoming; | |
311 | struct in_addr tcp_outgoing; | |
312 | struct in_addr udp_incoming; | |
2bbd722b | 313 | struct in_addr udp_outgoing; |
15dcc168 | 314 | #if SQUID_SNMP |
678c6099 | 315 | struct in_addr snmp_incoming; |
2bbd722b | 316 | struct in_addr snmp_outgoing; |
15dcc168 | 317 | #endif |
a8258824 | 318 | struct in_addr client_netmask; |
319 | } Addrs; | |
9906e724 | 320 | size_t tcpRcvBufsz; |
321 | size_t udpMaxHitObjsz; | |
a8258824 | 322 | wordlist *hierarchy_stoplist; |
323 | wordlist *mcast_group_list; | |
324 | wordlist *dns_testname_list; | |
09c483ec | 325 | wordlist *dns_nameservers; |
40a1495e | 326 | peer *peers; |
327 | int npeers; | |
a8258824 | 328 | struct { |
89de058c | 329 | int size; |
a8258824 | 330 | int low; |
331 | int high; | |
332 | } ipcache; | |
333 | int minDirectHops; | |
334 | cachemgr_passwd *passwd_list; | |
335 | struct { | |
336 | int objectsPerBucket; | |
9906e724 | 337 | size_t avgObjectSize; |
338 | size_t maxObjectSize; | |
a8258824 | 339 | } Store; |
340 | struct { | |
341 | int high; | |
342 | int low; | |
343 | time_t period; | |
344 | } Netdb; | |
345 | struct { | |
346 | int log_udp; | |
347 | int enable_purge; | |
348 | int res_defnames; | |
349 | int anonymizer; | |
350 | int client_db; | |
351 | int query_icmp; | |
88738790 | 352 | int icp_hit_stale; |
78f1250a | 353 | int buffered_logs; |
0ab965da | 354 | #if ALLOW_SOURCE_PING |
9b312a19 | 355 | int source_ping; |
0ab965da | 356 | #endif |
9b312a19 | 357 | int common_log; |
358 | int log_mime_hdrs; | |
359 | int ident_lookup; | |
17a0a4ee | 360 | int log_fqdn; |
361 | int announce; | |
362 | int accel_with_proxy; | |
3f6c0fb2 | 363 | int mem_pools; |
194dd3b8 | 364 | int test_reachability; |
ea285003 | 365 | int half_closed_clients; |
465dc415 | 366 | int reload_into_ims; |
17a0a4ee | 367 | } onoff; |
bd05e3e3 | 368 | acl *aclList; |
a8258824 | 369 | struct { |
bd05e3e3 | 370 | acl_access *http; |
371 | acl_access *icp; | |
372 | acl_access *miss; | |
373 | acl_access *NeverDirect; | |
374 | acl_access *AlwaysDirect; | |
375 | acl_access *ASlists; | |
376 | acl_access *noCache; | |
a8258824 | 377 | } accessList; |
bd05e3e3 | 378 | acl_deny_info_list *denyInfoList; |
f715bd3a | 379 | char *proxyAuthRealm; |
a8258824 | 380 | struct { |
381 | size_t list_width; | |
382 | int list_wrap; | |
a8258824 | 383 | char *anon_user; |
384 | } Ftp; | |
385 | refresh_t *Refresh; | |
386 | struct _cacheSwap { | |
a47b9029 | 387 | SwapDir *swapDirs; |
388 | int n_allocated; | |
389 | int n_configured; | |
a8258824 | 390 | } cacheSwap; |
88738790 | 391 | char *fake_ua; |
365cb147 | 392 | struct { |
393 | char *directory; | |
365cb147 | 394 | } icons; |
9b312a19 | 395 | char *errorDirectory; |
22c653cd | 396 | struct { |
397 | time_t timeout; | |
398 | int maxtries; | |
399 | } retry; | |
7021844c | 400 | struct { |
401 | size_t limit; | |
402 | } MemPools; | |
95e36d02 | 403 | #if DELAY_POOLS |
404 | struct { | |
405 | struct { | |
406 | struct _delay_spec aggregate; | |
407 | acl_access *access; | |
408 | } class1; | |
409 | struct { | |
410 | struct _delay_spec aggregate; | |
411 | struct _delay_spec individual; | |
412 | acl_access *access; | |
413 | } class2; | |
414 | struct { | |
415 | struct _delay_spec aggregate; | |
416 | struct _delay_spec individual; | |
417 | struct _delay_spec network; | |
418 | acl_access *access; | |
419 | } class3; | |
420 | } Delay; | |
421 | #endif | |
a8258824 | 422 | }; |
423 | ||
424 | struct _SquidConfig2 { | |
425 | struct { | |
426 | char *prefix; | |
427 | int on; | |
428 | } Accel; | |
429 | }; | |
430 | ||
431 | struct _close_handler { | |
432 | PF *handler; | |
433 | void *data; | |
434 | close_handler *next; | |
435 | }; | |
436 | ||
437 | struct _dread_ctrl { | |
438 | int fd; | |
439 | off_t offset; | |
440 | int req_len; | |
441 | char *buf; | |
442 | int end_of_file; | |
443 | DRCB *handler; | |
444 | void *client_data; | |
445 | }; | |
446 | ||
447 | struct _dnsserver_t { | |
448 | int id; | |
449 | int flags; | |
450 | int inpipe; | |
451 | int outpipe; | |
452 | time_t answer; | |
78f1250a | 453 | off_t offset; |
454 | size_t size; | |
e144eae4 | 455 | char ip_inbuf[DNS_INBUF_SZ]; |
a8258824 | 456 | struct timeval dispatch_time; |
457 | void *data; | |
458 | }; | |
459 | ||
460 | struct _dnsStatData { | |
461 | int requests; | |
462 | int replies; | |
463 | int hist[DefaultDnsChildrenMax]; | |
464 | }; | |
465 | ||
466 | struct _dwrite_q { | |
d377699f | 467 | off_t file_offset; |
a8258824 | 468 | char *buf; |
469 | int len; | |
d377699f | 470 | off_t buf_offset; |
bd05e3e3 | 471 | dwrite_q *next; |
74fbf3c9 | 472 | FREE *free_func; |
a8258824 | 473 | }; |
474 | ||
a9771e51 | 475 | |
476 | /* ETag support is rudimantal; | |
477 | * this struct is likely to change | |
478 | * Note: "str" points to memory in HttpHeaderEntry (for now) | |
479 | * so ETags should be used as tmp variables only (for now) */ | |
480 | struct _ETag { | |
98829f69 | 481 | const char *str; /* quoted-string */ |
482 | int weak; /* true if it is a weak validator */ | |
a9771e51 | 483 | }; |
484 | ||
a8258824 | 485 | struct _fde { |
486 | unsigned int type; | |
487 | unsigned int open; | |
488 | u_short local_port; | |
489 | u_short remote_port; | |
490 | char ipaddr[16]; /* dotted decimal address of peer */ | |
491 | char desc[FD_DESC_SZ]; | |
58a6c186 | 492 | struct { |
493 | int close_request:1; | |
494 | int write_daemon:1; | |
495 | int closing:1; | |
496 | int socket_eof:1; | |
497 | int nolinger:1; | |
498 | int nonblocking:1; | |
de718ec4 | 499 | int ipc:1; |
9d66d521 | 500 | #ifdef OPTIMISTIC_IO |
501 | int calling_io_handler:1; | |
502 | #endif | |
58a6c186 | 503 | } flags; |
a8258824 | 504 | int bytes_read; |
505 | int bytes_written; | |
b716a8ad | 506 | int uses; /* ie # req's over persistent conn */ |
a8258824 | 507 | struct _fde_disk { |
508 | DWCB *wrt_handle; | |
509 | void *wrt_handle_data; | |
510 | dwrite_q *write_q; | |
511 | dwrite_q *write_q_tail; | |
711982d8 | 512 | off_t offset; |
a8258824 | 513 | } disk; |
514 | PF *read_handler; | |
515 | void *read_data; | |
516 | PF *write_handler; | |
517 | void *write_data; | |
518 | PF *timeout_handler; | |
519 | time_t timeout; | |
520 | void *timeout_data; | |
cb69b4c7 | 521 | void *lifetime_data; |
a8258824 | 522 | close_handler *close_handler; /* linked list */ |
da2b3a17 | 523 | DEFER *defer_check; /* check if we should defer read */ |
70a9dab4 | 524 | void *defer_data; |
a8258824 | 525 | CommWriteStateData *rwstate; /* State data for comm_write */ |
526 | }; | |
527 | ||
528 | struct _fileMap { | |
529 | int max_n_files; | |
530 | int n_files_in_map; | |
a8258824 | 531 | int toggle; |
532 | int nwords; | |
533 | unsigned long *file_map; | |
534 | }; | |
535 | ||
1d21d91d | 536 | /* auto-growing memory-resident buffer with printf interface */ |
537 | /* note: when updating this struct, update MemBufNULL #define */ | |
538 | struct _MemBuf { | |
539 | /* public, read-only */ | |
540 | char *buf; | |
541 | mb_size_t size; /* used space, does not count 0-terminator */ | |
542 | ||
543 | /* private, stay away; use interface function instead */ | |
544 | mb_size_t max_capacity; /* when grows: assert(new_capacity <= max_capacity) */ | |
545 | mb_size_t capacity; /* allocated space */ | |
546 | FREE *freefunc; /* what to use to free the buffer, NULL after memBufFreeFunc() is called */ | |
547 | }; | |
548 | ||
549 | /* see Packer.c for description */ | |
550 | struct _Packer { | |
551 | /* protected, use interface functions instead */ | |
552 | append_f append; | |
553 | vprintf_f vprintf; | |
554 | void *real_handler; /* first parameter to real append and vprintf */ | |
555 | }; | |
556 | ||
adba4a64 | 557 | /* http status line */ |
558 | struct _HttpStatusLine { | |
559 | /* public, read only */ | |
99edd1c3 | 560 | float version; |
2ac76861 | 561 | const char *reason; /* points to a _constant_ string (default or supplied), never free()d */ |
adba4a64 | 562 | http_status status; |
563 | }; | |
564 | ||
565 | /* | |
1d21d91d | 566 | * Note: HttpBody is used only for messages with a small content that is |
adba4a64 | 567 | * known a priory (e.g., error messages). |
568 | */ | |
569 | struct _HttpBody { | |
1d21d91d | 570 | /* private */ |
571 | MemBuf mb; | |
adba4a64 | 572 | }; |
573 | ||
2ecaa5e7 | 574 | /* http header extention field */ |
575 | struct _HttpHdrExtField { | |
a369131d | 576 | String name; /* field-name from HTTP/1.1 (no column after name) */ |
577 | String value; /* field-value from HTTP/1.1 */ | |
2ecaa5e7 | 578 | }; |
adba4a64 | 579 | |
399e85ea | 580 | /* http cache control header field */ |
7faf2bdb | 581 | struct _HttpHdrCc { |
4f087419 | 582 | int mask; |
d8b249ef | 583 | int max_age; |
a8258824 | 584 | }; |
ee1679df | 585 | |
b5107edb | 586 | /* http byte-range-spec */ |
587 | struct _HttpHdrRangeSpec { | |
588 | size_t offset; | |
589 | size_t length; | |
590 | }; | |
591 | ||
592 | /* There may be more than one byte range specified in the request. | |
59c4d35b | 593 | * This object holds all range specs in order of their appearence |
594 | * in the request because we SHOULD preserve that order. | |
595 | */ | |
b5107edb | 596 | struct _HttpHdrRange { |
597 | Stack specs; | |
598 | }; | |
7faf2bdb | 599 | |
d76fcfa7 | 600 | /* http content-range header field */ |
601 | struct _HttpHdrContRange { | |
602 | HttpHdrRangeSpec spec; | |
a369131d | 603 | size_t elength; /* entity length, not content length */ |
d76fcfa7 | 604 | }; |
605 | ||
a9771e51 | 606 | /* some fields can hold either time or etag specs (e.g. If-Range) */ |
607 | struct _TimeOrTag { | |
98829f69 | 608 | ETag tag; /* entity tag */ |
a9771e51 | 609 | time_t time; |
98829f69 | 610 | int valid; /* true if struct is usable */ |
a9771e51 | 611 | }; |
612 | ||
d192d11f | 613 | /* data for iterating thru range specs */ |
98829f69 | 614 | struct _HttpHdrRangeIter { |
d192d11f | 615 | HttpHdrRangePos pos; |
98829f69 | 616 | const HttpHdrRangeSpec *spec; /* current spec at pos */ |
617 | size_t debt_size; /* bytes left to send from the current spec */ | |
618 | size_t prefix_size; /* the size of the incoming HTTP msg prefix */ | |
619 | String boundary; /* boundary for multipart responses */ | |
d192d11f | 620 | }; |
d76fcfa7 | 621 | |
fcd2d3ef | 622 | /* constant attributes of http header fields */ |
623 | struct _HttpHeaderFieldAttrs { | |
624 | const char *name; | |
625 | http_hdr_type id; | |
626 | field_type type; | |
627 | }; | |
628 | ||
7faf2bdb | 629 | /* per field statistics */ |
630 | struct _HttpHeaderFieldStat { | |
399e85ea | 631 | int aliveCount; /* created but not destroyed (count) */ |
d8b249ef | 632 | int seenCount; /* #fields we've seen */ |
399e85ea | 633 | int parsCount; /* #parsing attempts */ |
634 | int errCount; /* #pasring errors */ | |
635 | int repCount; /* #repetitons */ | |
7faf2bdb | 636 | }; |
637 | ||
d8b249ef | 638 | /* compiled version of HttpHeaderFieldAttrs plus stats */ |
de336bbe | 639 | struct _HttpHeaderFieldInfo { |
640 | http_hdr_type id; | |
641 | String name; | |
642 | field_type type; | |
7faf2bdb | 643 | HttpHeaderFieldStat stat; |
644 | }; | |
645 | ||
d8b249ef | 646 | struct _HttpHeaderEntry { |
647 | http_hdr_type id; | |
648 | String name; | |
649 | String value; | |
650 | }; | |
4f087419 | 651 | |
d8b249ef | 652 | struct _HttpHeader { |
4f087419 | 653 | /* protected, do not use these, use interface functions instead */ |
ec878047 | 654 | Array entries; /* parsed fields in raw format */ |
655 | HttpHeaderMask mask; /* bit set <=> entry present */ | |
eeb423fb | 656 | http_hdr_owner_type owner; /* request or reply */ |
657 | int len; /* length when packed, not counting terminating '\0' */ | |
4f087419 | 658 | }; |
659 | ||
adba4a64 | 660 | struct _HttpReply { |
661 | /* unsupported, writable, may disappear/change in the future */ | |
2ac76861 | 662 | int hdr_sz; /* sums _stored_ status-line, headers, and <CRLF> */ |
adba4a64 | 663 | |
d8b249ef | 664 | /* public, readable; never update these or their .hdr equivalents directly */ |
665 | int content_length; | |
666 | time_t date; | |
667 | time_t last_modified; | |
668 | time_t expires; | |
ec878047 | 669 | String content_type; |
d8b249ef | 670 | HttpHdrCc *cache_control; |
671 | HttpHdrContRange *content_range; | |
9f5a2895 | 672 | short int keep_alive; |
d8b249ef | 673 | |
adba4a64 | 674 | /* public, readable */ |
2ac76861 | 675 | HttpMsgParseState pstate; /* the current parsing state */ |
4f087419 | 676 | |
de336bbe | 677 | /* public, writable, but use httpReply* interfaces when possible */ |
adba4a64 | 678 | HttpStatusLine sline; |
d8b249ef | 679 | HttpHeader header; |
680 | HttpBody body; /* for small constant memory-resident text bodies only */ | |
adba4a64 | 681 | }; |
cb69b4c7 | 682 | |
a8258824 | 683 | |
684 | struct _HttpStateData { | |
685 | StoreEntry *entry; | |
686 | request_t *request; | |
687 | char *reply_hdr; | |
688 | int reply_hdr_state; | |
1294c0fc | 689 | peer *peer; /* peer request made to */ |
a8258824 | 690 | int eof; /* reached end-of-object? */ |
691 | request_t *orig_request; | |
1294c0fc | 692 | int fd; |
603a02fd | 693 | int flags; |
910169e5 | 694 | FwdState *fwdState; |
a8258824 | 695 | }; |
696 | ||
697 | struct _icpUdpData { | |
698 | struct sockaddr_in address; | |
699 | void *msg; | |
700 | size_t len; | |
701 | icpUdpData *next; | |
702 | #ifndef LESS_TIMING | |
703 | struct timeval start; | |
704 | #endif | |
705 | log_type logcode; | |
17b6e784 | 706 | struct timeval queue_time; |
a8258824 | 707 | }; |
708 | ||
709 | struct _icp_ping_data { | |
710 | struct timeval start; | |
711 | struct timeval stop; | |
712 | int n_sent; | |
713 | int n_recv; | |
714 | int n_replies_expected; | |
98829f69 | 715 | int timeout; /* msec */ |
465dc415 | 716 | int timedout; |
a8258824 | 717 | int w_rtt; |
b3264694 | 718 | int p_rtt; |
a8258824 | 719 | }; |
720 | ||
721 | struct _HierarchyLogEntry { | |
722 | hier_code code; | |
723 | char host[SQUIDHOSTNAMELEN]; | |
ee1679df | 724 | icp_ping_data icp; |
4b4cd312 | 725 | char cd_host[SQUIDHOSTNAMELEN]; /* the host of selected by cd peer */ |
726 | peer_select_alg_t alg; /* peer selection algorithm */ | |
727 | lookup_t cd_lookup; /* cd prediction: none, miss, hit */ | |
728 | int n_choices; /* #peers we selected from (cd only) */ | |
729 | int n_ichoices; /* #peers with known rtt we selected from (cd only) */ | |
39edba21 | 730 | struct timeval peer_select_start; |
731 | struct timeval store_complete_stop; | |
a8258824 | 732 | }; |
733 | ||
734 | struct _AccessLogEntry { | |
735 | const char *url; | |
736 | struct { | |
737 | method_t method; | |
738 | int code; | |
739 | const char *content_type; | |
740 | } http; | |
741 | struct { | |
742 | icp_opcode opcode; | |
743 | } icp; | |
744 | struct { | |
745 | struct in_addr caddr; | |
746 | size_t size; | |
747 | log_type code; | |
748 | int msec; | |
749 | const char *ident; | |
750 | } cache; | |
a8258824 | 751 | struct { |
752 | char *request; | |
753 | char *reply; | |
754 | } headers; | |
755 | struct { | |
756 | const char *method_str; | |
757 | } private; | |
bd05e3e3 | 758 | HierarchyLogEntry hier; |
a8258824 | 759 | }; |
760 | ||
761 | struct _clientHttpRequest { | |
762 | ConnStateData *conn; | |
763 | request_t *request; /* Parsed URL ... */ | |
23d92c64 | 764 | char *uri; |
765 | char *log_uri; | |
a8258824 | 766 | struct { |
767 | char *buf; | |
78f1250a | 768 | off_t offset; |
769 | size_t size; | |
a8258824 | 770 | } out; |
98829f69 | 771 | HttpHdrRangeIter range_iter; /* data for iterating thru range specs */ |
772 | size_t req_sz; /* raw request size on input, not current request size */ | |
a8258824 | 773 | StoreEntry *entry; |
774 | StoreEntry *old_entry; | |
775 | log_type log_type; | |
6cfa8966 | 776 | #if USE_CACHE_DIGESTS |
04f0c415 | 777 | const char *lookup_type; /* temporary hack: storeGet() result: HIT/MISS/NONE */ |
778 | #endif | |
9b312a19 | 779 | http_status http_code; |
a8258824 | 780 | struct timeval start; |
781 | float http_ver; | |
782 | int redirect_state; | |
783 | aclCheck_t *acl_checklist; /* need ptr back so we can unreg if needed */ | |
784 | clientHttpRequest *next; | |
bd05e3e3 | 785 | AccessLogEntry al; |
77ed547a | 786 | struct { |
787 | int accel:1; | |
788 | int internal:1; | |
9f086470 | 789 | int done_copying:1; |
77ed547a | 790 | } flags; |
a8258824 | 791 | }; |
792 | ||
793 | struct _ConnStateData { | |
794 | int fd; | |
795 | struct { | |
796 | char *buf; | |
78f1250a | 797 | off_t offset; |
798 | size_t size; | |
a8258824 | 799 | } in; |
800 | clientHttpRequest *chr; | |
801 | struct sockaddr_in peer; | |
802 | struct sockaddr_in me; | |
803 | struct in_addr log_addr; | |
804 | struct { | |
805 | int fd; | |
def67559 | 806 | char ident[USER_IDENT_SZ]; |
a8258824 | 807 | IDCB *callback; |
808 | int state; | |
425ad52e | 809 | void *callback_data; |
a8258824 | 810 | } ident; |
811 | CommWriteStateData *commWriteState; | |
812 | int nrequests; | |
813 | int persistent; | |
da2b3a17 | 814 | struct { |
815 | int n; | |
816 | time_t until; | |
817 | } defer; | |
a8258824 | 818 | }; |
819 | ||
2ac237e2 | 820 | struct _dlink_node { |
821 | void *data; | |
822 | dlink_node *prev; | |
823 | dlink_node *next; | |
824 | }; | |
825 | ||
826 | struct _dlink_list { | |
827 | dlink_node *head; | |
828 | dlink_node *tail; | |
829 | }; | |
830 | ||
a8258824 | 831 | struct _ipcache_addrs { |
6d1c0d53 | 832 | struct in_addr *in_addrs; |
833 | unsigned char *bad_mask; | |
a8258824 | 834 | unsigned char count; |
835 | unsigned char cur; | |
22c653cd | 836 | unsigned char badcount; |
a8258824 | 837 | }; |
838 | ||
59c4d35b | 839 | struct _ip_pending { |
840 | IPH *handler; | |
841 | void *handlerData; | |
842 | ip_pending *next; | |
843 | }; | |
844 | ||
a8258824 | 845 | struct _ipcache_entry { |
ec878047 | 846 | /* first two items must be equivalent to hash_link */ |
a8258824 | 847 | char *name; |
bd05e3e3 | 848 | ipcache_entry *next; |
a8258824 | 849 | time_t lastref; |
850 | time_t expires; | |
851 | ipcache_addrs addrs; | |
59c4d35b | 852 | ip_pending *pending_head; |
a8258824 | 853 | char *error_message; |
b87b92fb | 854 | struct timeval request_time; |
2ac237e2 | 855 | dlink_node lru; |
856 | u_char locks; | |
a8258824 | 857 | ipcache_status_t status:3; |
858 | }; | |
859 | ||
59c4d35b | 860 | struct _fqdn_pending { |
861 | FQDNH *handler; | |
862 | void *handlerData; | |
863 | fqdn_pending *next; | |
864 | }; | |
865 | ||
1df370e3 | 866 | struct _fqdncache_entry { |
ec878047 | 867 | /* first two items must be equivalent to hash_link */ |
1df370e3 | 868 | char *name; |
bd05e3e3 | 869 | fqdncache_entry *next; |
1df370e3 | 870 | time_t lastref; |
871 | time_t expires; | |
872 | unsigned char name_count; | |
873 | char *names[FQDN_MAX_NAMES + 1]; | |
59c4d35b | 874 | fqdn_pending *pending_head; |
1df370e3 | 875 | char *error_message; |
876 | dlink_node lru; | |
877 | unsigned char locks; | |
878 | fqdncache_status_t status:3; | |
879 | }; | |
880 | ||
a8258824 | 881 | struct _domain_ping { |
882 | char *domain; | |
883 | int do_ping; /* boolean */ | |
bd05e3e3 | 884 | domain_ping *next; |
a8258824 | 885 | }; |
886 | ||
887 | struct _domain_type { | |
888 | char *domain; | |
889 | peer_t type; | |
bd05e3e3 | 890 | domain_type *next; |
a8258824 | 891 | }; |
892 | ||
e41e6dcd | 893 | struct _Version { |
4b4cd312 | 894 | short int current; /* current version */ |
895 | short int required; /* minimal version that can safely handle current version */ | |
e41e6dcd | 896 | }; |
897 | ||
898 | /* digest control block; used for transmission and storage */ | |
899 | struct _StoreDigestCBlock { | |
900 | Version ver; | |
901 | int capacity; | |
902 | int count; | |
903 | int del_count; | |
904 | int mask_size; | |
04f0c415 | 905 | unsigned char bits_per_entry; |
906 | unsigned char hash_func_count; | |
907 | short int reserved_short; | |
4b4cd312 | 908 | int reserved[32 - 6]; |
e41e6dcd | 909 | }; |
910 | ||
911 | struct _DigestFetchState { | |
912 | peer *peer; | |
913 | StoreEntry *entry; | |
914 | StoreEntry *old_entry; | |
915 | int offset; | |
916 | int mask_offset; | |
917 | time_t start_time; | |
903c39e4 | 918 | request_t *request; |
e41e6dcd | 919 | }; |
920 | ||
921 | /* statistics for cache digests and other hit "predictors" */ | |
922 | struct _cd_guess_stats { | |
923 | /* public, read-only */ | |
924 | int true_hits; | |
925 | int false_hits; | |
926 | int true_misses; | |
927 | int false_misses; | |
4b4cd312 | 928 | int close_hits; /* tmp, remove it later */ |
e41e6dcd | 929 | }; |
930 | ||
931 | struct _PeerDigest { | |
932 | CacheDigest *cd; | |
4b4cd312 | 933 | int flags; /* PD_ */ |
e41e6dcd | 934 | time_t last_fetch_resp_time; |
935 | time_t last_req_timestamp; | |
4b4cd312 | 936 | time_t last_dis_delay; /* last disability delay */ |
e41e6dcd | 937 | struct { |
938 | cd_guess_stats guess; | |
939 | int used_count; | |
ddc0f170 | 940 | int msgs_sent; |
941 | int msgs_recv; | |
942 | kb_t kbytes_sent; | |
943 | kb_t kbytes_recv; | |
e41e6dcd | 944 | } stats; |
945 | }; | |
946 | ||
a8258824 | 947 | struct _peer { |
948 | char *host; | |
949 | peer_t type; | |
950 | struct sockaddr_in in_addr; | |
951 | struct { | |
952 | int pings_sent; | |
953 | int pings_acked; | |
a8258824 | 954 | int fetches; |
955 | int rtt; | |
27cd7235 | 956 | int counts[ICP_END]; |
a8258824 | 957 | int ignored_replies; |
1294c0fc | 958 | int n_keepalives_sent; |
959 | int n_keepalives_recv; | |
dc835977 | 960 | time_t last_query; |
961 | time_t last_reply; | |
962 | int logged_state; /* so we can print dead/revived msgs */ | |
a8258824 | 963 | } stats; |
964 | u_short icp_port; | |
965 | u_short http_port; | |
966 | int icp_version; | |
bd05e3e3 | 967 | domain_ping *pinglist; |
968 | domain_type *typelist; | |
505e35db | 969 | acl_access *access; |
a8258824 | 970 | int options; |
971 | int weight; | |
972 | struct { | |
973 | double avg_n_members; | |
974 | int n_times_counted; | |
975 | int n_replies_expected; | |
976 | int ttl; | |
9fb13bb6 | 977 | u_num32 reqnum; |
a8258824 | 978 | int flags; |
979 | } mcast; | |
e41e6dcd | 980 | PeerDigest digest; |
a8258824 | 981 | int tcp_up; /* 0 if a connect() fails */ |
982 | time_t last_fail_time; | |
983 | struct in_addr addresses[10]; | |
984 | int n_addresses; | |
985 | int rr_count; | |
bd05e3e3 | 986 | peer *next; |
a8258824 | 987 | int test_fd; |
afd88fbe | 988 | #if USE_CARP |
989 | struct { | |
990 | unsigned long hash; | |
991 | unsigned long load_multiplier; | |
992 | float load_factor; | |
993 | } carp; | |
994 | #endif | |
a8258824 | 995 | }; |
996 | ||
997 | struct _net_db_name { | |
998 | char *name; | |
74fbf3c9 | 999 | net_db_name *htbl_next; |
1000 | net_db_name *next; | |
1001 | netdbEntry *net_db_entry; | |
a8258824 | 1002 | }; |
1003 | ||
1004 | struct _net_db_peer { | |
1005 | char *peername; | |
1006 | double hops; | |
1007 | double rtt; | |
1008 | time_t expires; | |
1009 | }; | |
1010 | ||
1011 | struct _netdbEntry { | |
ec878047 | 1012 | /* first two items must be equivalent to hash_link */ |
a8258824 | 1013 | char *key; |
74fbf3c9 | 1014 | netdbEntry *next; |
a8258824 | 1015 | char network[16]; |
1016 | int pings_sent; | |
1017 | int pings_recv; | |
1018 | double hops; | |
1019 | double rtt; | |
1020 | time_t next_ping_time; | |
1021 | time_t last_use_time; | |
1022 | int link_count; | |
1023 | net_db_name *hosts; | |
1024 | net_db_peer *peers; | |
1025 | int n_peers_alloc; | |
1026 | int n_peers; | |
1027 | }; | |
1028 | ||
1029 | struct _ps_state { | |
1030 | request_t *request; | |
1031 | StoreEntry *entry; | |
1032 | int always_direct; | |
1033 | int never_direct; | |
1034 | PSC *callback; | |
1035 | PSC *fail_callback; | |
1036 | void *callback_data; | |
85223cd7 | 1037 | /* |
1038 | * Why are these struct sockaddr_in instead of peer *? Because a | |
1039 | * peer structure can become invalid during the peer selection | |
1040 | * phase, specifically after a reconfigure. Thus we need to lookup | |
1041 | * the peer * based on the address when we are finally ready to | |
1042 | * reference the peer structure. | |
1043 | */ | |
1044 | struct sockaddr_in first_parent_miss; | |
1045 | struct sockaddr_in closest_parent_miss; | |
1046 | struct sockaddr_in single_parent; | |
a8258824 | 1047 | icp_ping_data icp; |
1048 | aclCheck_t *acl_checklist; | |
1049 | }; | |
1050 | ||
1051 | struct _pingerEchoData { | |
1052 | struct in_addr to; | |
1053 | unsigned char opcode; | |
1054 | int psize; | |
65ae9f56 | 1055 | char payload[PINGER_PAYLOAD_SZ]; |
a8258824 | 1056 | }; |
1057 | ||
1058 | struct _pingerReplyData { | |
1059 | struct in_addr from; | |
1060 | unsigned char opcode; | |
1061 | int rtt; | |
1062 | int hops; | |
1063 | int psize; | |
65ae9f56 | 1064 | char payload[PINGER_PAYLOAD_SZ]; |
a8258824 | 1065 | }; |
1066 | ||
1067 | struct _icp_common_t { | |
1068 | unsigned char opcode; /* opcode */ | |
1069 | unsigned char version; /* version number */ | |
1070 | unsigned short length; /* total length (bytes) */ | |
1071 | u_num32 reqnum; /* req number (req'd for UDP) */ | |
1072 | u_num32 flags; | |
1073 | u_num32 pad; | |
a8258824 | 1074 | u_num32 shostid; /* sender host id */ |
1075 | }; | |
1076 | ||
a8258824 | 1077 | struct _iostats { |
1078 | struct { | |
1079 | int reads; | |
1080 | int reads_deferred; | |
1081 | int read_hist[16]; | |
1082 | int writes; | |
1083 | int write_hist[16]; | |
1084 | } Http, Ftp, Gopher, Wais; | |
1085 | }; | |
1086 | ||
1087 | struct _mem_node { | |
1088 | char *data; | |
1089 | int len; | |
1090 | mem_node *next; | |
1091 | }; | |
1092 | ||
1093 | struct _mem_hdr { | |
1094 | mem_node *head; | |
1095 | mem_node *tail; | |
1096 | int origin_offset; | |
1097 | }; | |
1098 | ||
a8258824 | 1099 | /* keep track each client receiving data from that particular StoreEntry */ |
1100 | struct _store_client { | |
43329771 | 1101 | int type; |
a8258824 | 1102 | off_t copy_offset; |
1103 | off_t seen_offset; | |
1104 | size_t copy_size; | |
1105 | char *copy_buf; | |
1106 | STCB *callback; | |
1107 | void *callback_data; | |
07304bf9 | 1108 | StoreEntry *entry; /* ptr to the parent StoreEntry, argh! */ |
79d39a72 | 1109 | int swapin_fd; |
f115fadd | 1110 | struct { |
58a6c186 | 1111 | int disk_io_pending:1; |
f115fadd | 1112 | int store_copying:1; |
9f9c55cf | 1113 | int copy_event_pending:1; |
f115fadd | 1114 | } flags; |
bd05e3e3 | 1115 | store_client *next; |
447e176b | 1116 | #if DELAY_POOLS |
1117 | delay_id delay_id; | |
1118 | #endif | |
a8258824 | 1119 | }; |
1120 | ||
1a3db59c | 1121 | |
a8258824 | 1122 | /* This structure can be freed while object is purged out from memory */ |
1123 | struct _MemObject { | |
2ac237e2 | 1124 | method_t method; |
9fb13bb6 | 1125 | char *url; |
18fe65d0 | 1126 | mem_hdr data_hdr; |
8350fe9b | 1127 | off_t inmem_hi; |
1128 | off_t inmem_lo; | |
bd05e3e3 | 1129 | store_client *clients; |
a8258824 | 1130 | int nclients; |
8350fe9b | 1131 | struct { |
e3ef2b09 | 1132 | off_t queue_offset; /* relative to in-mem data */ |
1133 | off_t done_offset; /* relative to swap file with meta headers! */ | |
8350fe9b | 1134 | int fd; |
25354045 | 1135 | void *ctrl; |
8350fe9b | 1136 | } swapout; |
cb69b4c7 | 1137 | HttpReply *reply; |
a8258824 | 1138 | request_t *request; |
1139 | struct timeval start_ping; | |
1140 | IRCB *icp_reply_callback; | |
1141 | void *ircb_data; | |
1142 | int fd; /* FD of client creating this entry */ | |
1143 | struct { | |
1144 | STABH *callback; | |
1145 | void *data; | |
1146 | } abort; | |
88738790 | 1147 | char *log_url; |
b93bcace | 1148 | dlink_node lru; |
9fb13bb6 | 1149 | u_num32 reqnum; |
07304bf9 | 1150 | ssize_t object_sz; |
e3ef2b09 | 1151 | size_t swap_hdr_sz; |
a8258824 | 1152 | }; |
1153 | ||
a8258824 | 1154 | struct _StoreEntry { |
ec878047 | 1155 | /* first two items must be same as hash_link */ |
9fb13bb6 | 1156 | const cache_key *key; |
bd05e3e3 | 1157 | StoreEntry *next; |
a8258824 | 1158 | MemObject *mem_obj; |
a8258824 | 1159 | time_t timestamp; |
1160 | time_t lastref; | |
1161 | time_t expires; | |
1162 | time_t lastmod; | |
07304bf9 | 1163 | size_t swap_file_sz; |
a21fbb54 | 1164 | u_short refcount; |
1165 | u_short flag; | |
a8258824 | 1166 | int swap_file_number; |
b93bcace | 1167 | dlink_node lru; |
a3cb7458 | 1168 | u_short lock_count; /* Assume < 65536! */ |
a8258824 | 1169 | mem_status_t mem_status:3; |
1170 | ping_status_t ping_status:3; | |
1171 | store_status_t store_status:3; | |
1172 | swap_status_t swap_status:3; | |
a8258824 | 1173 | }; |
1174 | ||
1175 | struct _SwapDir { | |
1176 | char *path; | |
1177 | int l1; | |
1178 | int l2; | |
1179 | int cur_size; | |
1180 | int max_size; | |
1181 | int read_only; | |
1182 | int suggest; | |
1183 | fileMap *map; | |
1184 | int swaplog_fd; | |
1185 | }; | |
1186 | ||
92695e5e | 1187 | struct _request_flags { |
1188 | int range:1; | |
1189 | int nocache:1; | |
1190 | int ims:1; | |
1191 | int auth:1; | |
1192 | int cachable:1; | |
1193 | int hierarchical:1; | |
1194 | int loopdetect:1; | |
1195 | int proxy_keepalive:1; | |
1196 | int proxying:1; | |
1197 | int refresh:1; | |
1198 | int used_proxy_auth:1; | |
1199 | int redirected:1; | |
1200 | int nocache_hack:1; /* for changing/ignoring no-cache requests */ | |
1201 | }; | |
1202 | ||
a8258824 | 1203 | struct _request_t { |
1204 | method_t method; | |
1205 | protocol_t protocol; | |
1206 | char login[MAX_LOGIN_SZ]; | |
1207 | char host[SQUIDHOSTNAMELEN + 1]; | |
def67559 | 1208 | char user_ident[USER_IDENT_SZ]; /* from proxy auth or ident server */ |
a8258824 | 1209 | u_short port; |
02922e76 | 1210 | String urlpath; |
e4a45101 | 1211 | char *canonical; |
a8258824 | 1212 | int link_count; /* free when zero */ |
92695e5e | 1213 | request_flags flags; |
8e092300 | 1214 | HttpHdrCc *cache_control; |
d192d11f | 1215 | HttpHdrRange *range; |
a8258824 | 1216 | time_t max_age; |
1217 | float http_ver; | |
1218 | time_t ims; | |
1219 | int imslen; | |
1220 | int max_forwards; | |
1221 | struct in_addr client_addr; | |
99edd1c3 | 1222 | HttpHeader header; |
a8258824 | 1223 | char *body; |
1224 | size_t body_sz; | |
bd05e3e3 | 1225 | HierarchyLogEntry hier; |
88aad2e5 | 1226 | err_type err_type; |
95e36d02 | 1227 | #if DELAY_POOLS |
447e176b | 1228 | delay_id delay_id; |
95e36d02 | 1229 | #endif |
a8258824 | 1230 | }; |
1231 | ||
1232 | struct _cachemgr_passwd { | |
1233 | char *passwd; | |
22f3fd98 | 1234 | wordlist *actions; |
bd05e3e3 | 1235 | cachemgr_passwd *next; |
a8258824 | 1236 | }; |
1237 | ||
1238 | struct _refresh_t { | |
1239 | char *pattern; | |
1240 | regex_t compiled_pattern; | |
1241 | time_t min; | |
c3f6d204 | 1242 | double pct; |
a8258824 | 1243 | time_t max; |
bd05e3e3 | 1244 | refresh_t *next; |
c3f6d204 | 1245 | struct { |
1dfa1d81 | 1246 | unsigned int icase:1; |
1247 | unsigned int override_expire:1; | |
1248 | unsigned int override_lastmod:1; | |
cbe3a719 | 1249 | unsigned int reload_into_ims:1; |
1250 | unsigned int ignore_reload:1; | |
c3f6d204 | 1251 | } flags; |
a8258824 | 1252 | }; |
1253 | ||
1254 | struct _CommWriteStateData { | |
1255 | char *buf; | |
1256 | size_t size; | |
1257 | off_t offset; | |
1258 | CWCB *handler; | |
1259 | void *handler_data; | |
74fbf3c9 | 1260 | FREE *free_func; |
a8258824 | 1261 | }; |
9b312a19 | 1262 | |
1263 | struct _ErrorState { | |
1264 | err_type type; | |
02922e76 | 1265 | int page_id; |
9b312a19 | 1266 | http_status http_status; |
1267 | request_t *request; | |
1268 | char *url; | |
c45ed9ad | 1269 | int xerrno; |
9b312a19 | 1270 | char *host; |
1271 | u_short port; | |
1272 | char *dnsserver_msg; | |
1273 | time_t ttl; | |
1274 | struct in_addr src_addr; | |
1275 | char *redirect_url; | |
1276 | ERCB *callback; | |
1277 | void *callback_data; | |
bb0929d8 | 1278 | int flags; |
b9916917 | 1279 | struct { |
1280 | char *request; | |
1281 | char *reply; | |
1282 | } ftp; | |
e144eae4 | 1283 | char *request_hdrs; |
7131112f | 1284 | wordlist *ftp_server_msg; |
9b312a19 | 1285 | }; |
f2908497 | 1286 | |
12cf1be2 | 1287 | /* |
1288 | * "very generic" histogram; | |
1289 | * see important comments on hbase_f restrictions in StatHist.c | |
1290 | */ | |
1291 | struct _StatHist { | |
1292 | int *bins; | |
1293 | int capacity; | |
e9a13293 | 1294 | double min; |
1295 | double max; | |
1296 | double scale; | |
2ac76861 | 1297 | hbase_f val_in; /* e.g., log() for log-based histogram */ |
1298 | hbase_f val_out; /* e.g., exp() for log based histogram */ | |
7ae52c25 | 1299 | }; |
1300 | ||
12cf1be2 | 1301 | /* |
1302 | * if you add a field to StatCounters, | |
1d803566 | 1303 | * you MUST sync statCountersInitSpecial, statCountersClean, and statCountersCopy |
12cf1be2 | 1304 | */ |
f2908497 | 1305 | struct _StatCounters { |
1306 | struct { | |
98829f69 | 1307 | int clients; |
f2908497 | 1308 | int requests; |
1309 | int hits; | |
1310 | int errors; | |
a7c05555 | 1311 | kb_t kbytes_in; |
1312 | kb_t kbytes_out; | |
1313 | kb_t hit_kbytes_out; | |
12cf1be2 | 1314 | StatHist miss_svc_time; |
1315 | StatHist nm_svc_time; | |
7c9c84ad | 1316 | StatHist nh_svc_time; |
12cf1be2 | 1317 | StatHist hit_svc_time; |
1318 | StatHist all_svc_time; | |
f2908497 | 1319 | } client_http; |
7ae52c25 | 1320 | struct { |
a0f32775 | 1321 | struct { |
1322 | int requests; | |
1323 | int errors; | |
1324 | kb_t kbytes_in; | |
1325 | kb_t kbytes_out; | |
399e85ea | 1326 | } all , http, ftp, other; |
7ae52c25 | 1327 | } server; |
f2908497 | 1328 | struct { |
1329 | int pkts_sent; | |
071a3ae7 | 1330 | int queries_sent; |
1331 | int replies_sent; | |
f2908497 | 1332 | int pkts_recv; |
071a3ae7 | 1333 | int queries_recv; |
1334 | int replies_recv; | |
a7c05555 | 1335 | int hits_sent; |
1336 | int hits_recv; | |
8064065e | 1337 | int replies_queued; |
17b6e784 | 1338 | int replies_dropped; |
a7c05555 | 1339 | kb_t kbytes_sent; |
071a3ae7 | 1340 | kb_t q_kbytes_sent; |
1341 | kb_t r_kbytes_sent; | |
a7c05555 | 1342 | kb_t kbytes_recv; |
071a3ae7 | 1343 | kb_t q_kbytes_recv; |
1344 | kb_t r_kbytes_recv; | |
12cf1be2 | 1345 | StatHist query_svc_time; |
1346 | StatHist reply_svc_time; | |
4b4cd312 | 1347 | int query_timeouts; |
c127134a | 1348 | int times_used; |
f2908497 | 1349 | } icp; |
1350 | struct { | |
1351 | int requests; | |
1352 | } unlink; | |
9973e9fe | 1353 | struct { |
12cf1be2 | 1354 | StatHist svc_time; |
9973e9fe | 1355 | } dns; |
c127134a | 1356 | struct { |
1357 | int times_used; | |
26b164ac | 1358 | kb_t kbytes_sent; |
1359 | kb_t kbytes_recv; | |
c127134a | 1360 | kb_t memory; |
00485c29 | 1361 | int msgs_sent; |
1362 | int msgs_recv; | |
4b4cd312 | 1363 | cd_guess_stats guess; |
69c95dd3 | 1364 | StatHist on_xition_count; |
c127134a | 1365 | } cd; |
69c95dd3 | 1366 | struct { |
1367 | int times_used; | |
1368 | } netdb; | |
f2908497 | 1369 | int page_faults; |
1370 | int select_loops; | |
1371 | double cputime; | |
d5649d9f | 1372 | struct timeval timestamp; |
c6ecdbc3 | 1373 | StatHist comm_icp_incoming; |
1374 | StatHist comm_http_incoming; | |
f2908497 | 1375 | }; |
69c01cd7 | 1376 | |
fcd2d3ef | 1377 | /* per header statistics */ |
1378 | struct _HttpHeaderStat { | |
1379 | const char *label; | |
1380 | HttpHeaderMask *owner_mask; | |
1381 | ||
1382 | StatHist hdrUCountDistr; | |
1383 | StatHist fieldTypeDistr; | |
1384 | StatHist ccTypeDistr; | |
1385 | ||
1386 | int parsedCount; | |
1387 | int ccParsedCount; | |
1388 | int destroyedCount; | |
1389 | int busyDestroyedCount; | |
1390 | }; | |
1391 | ||
1392 | ||
69c01cd7 | 1393 | struct _tlv { |
5830cdb3 | 1394 | char type; |
1395 | int length; | |
1396 | void *value; | |
bd05e3e3 | 1397 | tlv *next; |
5830cdb3 | 1398 | }; |
1399 | ||
07304bf9 | 1400 | struct _storeSwapLogData { |
5830cdb3 | 1401 | char op; |
1402 | int swap_file_number; | |
1403 | time_t timestamp; | |
1404 | time_t lastref; | |
1405 | time_t expires; | |
1406 | time_t lastmod; | |
07304bf9 | 1407 | size_t swap_file_sz; |
5830cdb3 | 1408 | u_short refcount; |
1409 | u_short flags; | |
7363fc17 | 1410 | unsigned char key[MD5_DIGEST_CHARS]; |
69c01cd7 | 1411 | }; |
59c4d35b | 1412 | |
02922e76 | 1413 | /* object to track per-action memory usage (e.g. #idle objects) */ |
1414 | struct _MemMeter { | |
1415 | size_t level; /* current level (count or volume) */ | |
d8b249ef | 1416 | size_t hwater_level; /* high water mark */ |
1417 | time_t hwater_stamp; /* timestamp of last high water mark change */ | |
02922e76 | 1418 | }; |
1419 | ||
1420 | /* object to track per-pool memory usage (alloc = inuse+idle) */ | |
1421 | struct _MemPoolMeter { | |
1422 | MemMeter alloc; | |
1423 | MemMeter inuse; | |
1424 | MemMeter idle; | |
1425 | gb_t saved; | |
1426 | }; | |
1427 | ||
1428 | /* a pool is a [growing] space for objects of the same size */ | |
1429 | struct _MemPool { | |
1430 | const char *label; | |
1431 | size_t obj_size; | |
1432 | Stack pstack; /* stack for free pointers */ | |
1433 | MemPoolMeter meter; | |
1434 | }; | |
1435 | ||
59c4d35b | 1436 | struct _ClientInfo { |
ec878047 | 1437 | /* first two items must be equivalent to hash_link */ |
59c4d35b | 1438 | char *key; |
ca3c5a71 | 1439 | ClientInfo *next; |
59c4d35b | 1440 | struct in_addr addr; |
1441 | struct { | |
1442 | int result_hist[LOG_TYPE_MAX]; | |
1443 | int n_requests; | |
ec878047 | 1444 | kb_t kbytes_in; |
1445 | kb_t kbytes_out; | |
1446 | kb_t hit_kbytes_out; | |
59c4d35b | 1447 | } Http, Icp; |
1448 | struct { | |
1449 | time_t time; | |
1450 | int n_req; | |
1451 | int n_denied; | |
1452 | } cutoff; | |
1453 | }; | |
c411be12 | 1454 | |
c411be12 | 1455 | struct _CacheDigest { |
1456 | /* public, read-only */ | |
1afe05c5 | 1457 | char *mask; /* bit mask */ |
1458 | size_t mask_size; /* mask size in bytes */ | |
1459 | int capacity; /* expected maximum for .count, not a hard limit */ | |
04f0c415 | 1460 | int bits_per_entry; /* number of bits allocated for each entry from capacity */ |
1afe05c5 | 1461 | int count; /* number of digested entries */ |
1462 | int del_count; /* number of deletions performed so far */ | |
c411be12 | 1463 | }; |
910169e5 | 1464 | |
1465 | struct _FwdState { | |
1466 | int client_fd; | |
1467 | StoreEntry *entry; | |
1468 | request_t *request; | |
1469 | FwdServer *servers; | |
6801f8a8 | 1470 | int server_fd; |
910169e5 | 1471 | struct { |
0cdcddb9 | 1472 | int err_code; |
1473 | http_status http_code; | |
910169e5 | 1474 | int xerrno; |
1475 | } fail; | |
f563eea9 | 1476 | time_t start; |
68bd6892 | 1477 | int n_tries; |
910169e5 | 1478 | }; |
1479 | ||
1480 | struct _FwdServer { | |
1481 | char *host; | |
1482 | u_short port; | |
1483 | peer *peer; | |
1484 | struct _FwdServer *next; | |
1485 | }; |