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