]>
Commit | Line | Data |
---|---|---|
a8258824 | 1 | |
53ad48e6 | 2 | |
16300b58 | 3 | |
a8258824 | 4 | struct _acl_ip_data { |
5 | struct in_addr addr1; /* if addr2 non-zero then its a range */ | |
6 | struct in_addr addr2; | |
7 | struct in_addr mask; | |
8 | #ifndef USE_SPLAY_TREE | |
74fbf3c9 | 9 | acl_ip_data *next; |
a8258824 | 10 | #endif |
11 | }; | |
12 | ||
13 | struct _acl_time_data { | |
14 | int weekbits; | |
15 | int start; | |
16 | int stop; | |
74fbf3c9 | 17 | acl_time_data *next; |
a8258824 | 18 | }; |
19 | ||
20 | struct _acl_name_list { | |
21 | char name[ACL_NAME_SZ]; | |
74fbf3c9 | 22 | acl_name_list *next; |
a8258824 | 23 | }; |
24 | ||
afe95a7e | 25 | struct _acl_proxy_auth { |
26 | char *filename; | |
27 | time_t last_time; | |
28 | time_t change_time; | |
29 | int check_interval; | |
30 | hash_table *hash; | |
31 | }; | |
32 | ||
a8258824 | 33 | struct _acl_deny_info_list { |
34 | char url[MAX_URL]; | |
74fbf3c9 | 35 | acl_name_list *acl_list; |
36 | acl_deny_info_list *next; | |
a8258824 | 37 | }; |
38 | ||
66c75c41 | 39 | #if USE_ARP_ACL |
40 | struct _acl_arp_data { | |
53ad48e6 | 41 | unsigned char eth[6]; |
66c75c41 | 42 | #ifndef USE_SPLAY_TREE |
74fbf3c9 | 43 | acl_arp_data *next; |
66c75c41 | 44 | #endif |
45 | }; | |
53ad48e6 | 46 | |
66c75c41 | 47 | #endif |
48 | ||
1df370e3 | 49 | #if SQUID_SNMP |
a97cfa48 | 50 | struct _snmpconf { |
be335c22 | 51 | char *line; |
52 | int type; | |
74fbf3c9 | 53 | snmpconf *next; |
a97cfa48 | 54 | }; |
6ccb94e5 | 55 | |
bdf18524 | 56 | struct _snmp_request_t { |
57 | char *buf; | |
58 | char *outbuf; | |
59 | int len; | |
60 | int sock; | |
61 | long reqid; | |
62 | int outlen; | |
63 | struct sockaddr_in from; | |
64 | struct snmp_pdu *PDU; | |
65 | aclCheck_t *acl_checklist; | |
66 | char *community; | |
67 | }; | |
68 | ||
6ccb94e5 | 69 | typedef struct _viewEntry { |
70 | char viewName[32]; | |
71 | int viewIndex; | |
72 | int viewType; | |
73 | int viewSubtreeLen; | |
74 | oid viewSubtree[32]; | |
75 | struct _viewEntry *next; | |
76 | } viewEntry; | |
77 | ||
78 | typedef struct _communityEntry { | |
79 | char name[64]; | |
80 | int readView; | |
81 | int writeView; | |
bdf18524 | 82 | struct _acl_access *acls; |
6ccb94e5 | 83 | struct _communityEntry *next; |
84 | } communityEntry; | |
85 | ||
86 | typedef struct _usecEntry { | |
87 | u_char userName[32]; | |
88 | int userLen; | |
89 | int qoS; | |
90 | u_char authKey[16]; | |
91 | u_char privKey[16]; | |
92 | int noauthReadView; | |
93 | int noauthWriteView; | |
94 | int authReadView; | |
95 | int authWriteView; | |
96 | struct _usecEntry *next; | |
97 | } usecEntry; | |
98 | ||
1df370e3 | 99 | #endif |
a97cfa48 | 100 | |
a8258824 | 101 | struct _acl { |
102 | char name[ACL_NAME_SZ]; | |
103 | squid_acl type; | |
104 | void *data; | |
105 | char *cfgline; | |
106 | struct _acl *next; | |
107 | }; | |
108 | ||
109 | struct _acl_list { | |
110 | int op; | |
111 | struct _acl *acl; | |
112 | struct _acl_list *next; | |
113 | }; | |
114 | ||
115 | struct _acl_access { | |
116 | int allow; | |
117 | struct _acl_list *acl_list; | |
118 | char *cfgline; | |
119 | struct _acl_access *next; | |
120 | }; | |
121 | ||
bdf18524 | 122 | |
a8258824 | 123 | struct _aclCheck_t { |
124 | const struct _acl_access *access_list; | |
125 | struct in_addr src_addr; | |
126 | struct in_addr dst_addr; | |
127 | request_t *request; | |
128 | char ident[ICP_IDENT_SZ]; | |
129 | char browser[BROWSERNAMELEN]; | |
130 | acl_lookup_state state[ACL_ENUM_MAX]; | |
131 | PF *callback; | |
132 | void *callback_data; | |
133 | }; | |
134 | ||
135 | struct _aio_result_t { | |
136 | int aio_return; | |
137 | int aio_errno; | |
138 | }; | |
139 | ||
140 | struct _wordlist { | |
141 | char *key; | |
142 | struct _wordlist *next; | |
143 | }; | |
144 | ||
145 | struct _intlist { | |
146 | int i; | |
147 | struct _intlist *next; | |
148 | }; | |
149 | ||
150 | struct _ushortlist { | |
151 | u_short i; | |
152 | struct _ushortlist *next; | |
153 | }; | |
154 | ||
155 | struct _relist { | |
156 | char *pattern; | |
157 | regex_t regex; | |
158 | struct _relist *next; | |
159 | }; | |
160 | ||
a8258824 | 161 | struct _SquidConfig { |
162 | struct { | |
9906e724 | 163 | size_t maxSize; |
a8258824 | 164 | int highWaterMark; |
165 | int lowWaterMark; | |
166 | } Mem , Swap; | |
167 | struct { | |
168 | char *relayHost; | |
169 | u_short relayPort; | |
170 | } Wais; | |
171 | struct { | |
9906e724 | 172 | size_t min; |
a8258824 | 173 | int pct; |
9906e724 | 174 | size_t max; |
a8258824 | 175 | } quickAbort; |
176 | time_t referenceAge; | |
177 | time_t negativeTtl; | |
178 | time_t negativeDnsTtl; | |
179 | time_t positiveDnsTtl; | |
180 | time_t shutdownLifetime; | |
181 | time_t neighborTimeout; | |
a8258824 | 182 | struct { |
183 | time_t read; | |
a8258824 | 184 | time_t lifetime; |
185 | time_t connect; | |
186 | time_t request; | |
603a02fd | 187 | time_t pconn; |
23d92c64 | 188 | time_t siteSelect; |
dc835977 | 189 | time_t deadPeer; |
a8258824 | 190 | } Timeout; |
9906e724 | 191 | size_t maxRequestSize; |
a8258824 | 192 | struct { |
193 | ushortlist *http; | |
194 | u_short icp; | |
1df370e3 | 195 | #if SQUID_SNMP |
678c6099 | 196 | u_short snmp; |
1df370e3 | 197 | #endif |
a8258824 | 198 | } Port; |
1df370e3 | 199 | #if SQUID_SNMP |
2bbd722b | 200 | struct { |
201 | char *configFile; | |
202 | char *agentInfo; | |
203 | char *mibPath; | |
a97cfa48 | 204 | char *trap_community; |
205 | char *trap_sink; | |
2bbd722b | 206 | u_short localPort; |
207 | int do_queueing; | |
a97cfa48 | 208 | int conf_authtraps; |
209 | struct _snmpconf *snmpconf; | |
be335c22 | 210 | viewEntry *views; |
211 | usecEntry *users; | |
212 | communityEntry *communities; | |
2ac237e2 | 213 | } Snmp; |
1df370e3 | 214 | #endif |
53ad48e6 | 215 | char *as_whois_server; |
a8258824 | 216 | struct { |
217 | char *log; | |
218 | char *access; | |
219 | char *store; | |
220 | char *swap; | |
221 | char *useragent; | |
222 | int rotateNumber; | |
a8258824 | 223 | } Log; |
a8258824 | 224 | char *adminEmail; |
225 | char *effectiveUser; | |
226 | char *effectiveGroup; | |
227 | struct { | |
228 | char *dnsserver; | |
229 | char *redirect; | |
230 | char *pinger; | |
231 | char *unlinkd; | |
232 | } Program; | |
233 | int dnsChildren; | |
234 | int redirectChildren; | |
a8258824 | 235 | struct { |
236 | char *host; | |
237 | u_short port; | |
a8258824 | 238 | } Accel; |
239 | char *appendDomain; | |
240 | size_t appendDomainLen; | |
241 | char *debugOptions; | |
242 | char *pidFilename; | |
243 | char *mimeTablePathname; | |
244 | char *visibleHostname; | |
245 | char *errHtmlText; | |
246 | struct { | |
247 | char *host; | |
248 | char *file; | |
249 | time_t period; | |
a8258824 | 250 | u_short port; |
251 | } Announce; | |
252 | struct { | |
253 | struct in_addr tcp_incoming; | |
254 | struct in_addr tcp_outgoing; | |
255 | struct in_addr udp_incoming; | |
2bbd722b | 256 | struct in_addr udp_outgoing; |
678c6099 | 257 | struct in_addr snmp_incoming; |
2bbd722b | 258 | struct in_addr snmp_outgoing; |
a8258824 | 259 | struct in_addr client_netmask; |
260 | } Addrs; | |
9906e724 | 261 | size_t tcpRcvBufsz; |
262 | size_t udpMaxHitObjsz; | |
a8258824 | 263 | wordlist *cache_stoplist; |
264 | wordlist *hierarchy_stoplist; | |
265 | wordlist *mcast_group_list; | |
266 | wordlist *dns_testname_list; | |
09c483ec | 267 | wordlist *dns_nameservers; |
a8258824 | 268 | relist *cache_stop_relist; |
40a1495e | 269 | peer *peers; |
270 | int npeers; | |
a8258824 | 271 | struct { |
89de058c | 272 | int size; |
a8258824 | 273 | int low; |
274 | int high; | |
275 | } ipcache; | |
276 | int minDirectHops; | |
277 | cachemgr_passwd *passwd_list; | |
278 | struct { | |
279 | int objectsPerBucket; | |
9906e724 | 280 | size_t avgObjectSize; |
281 | size_t maxObjectSize; | |
a8258824 | 282 | } Store; |
283 | struct { | |
284 | int high; | |
285 | int low; | |
286 | time_t period; | |
287 | } Netdb; | |
288 | struct { | |
289 | int log_udp; | |
290 | int enable_purge; | |
291 | int res_defnames; | |
292 | int anonymizer; | |
293 | int client_db; | |
294 | int query_icmp; | |
88738790 | 295 | int icp_hit_stale; |
78f1250a | 296 | int buffered_logs; |
9b312a19 | 297 | int source_ping; |
298 | int common_log; | |
299 | int log_mime_hdrs; | |
300 | int ident_lookup; | |
301 | int single_parent_bypass; | |
17a0a4ee | 302 | int log_fqdn; |
303 | int announce; | |
304 | int accel_with_proxy; | |
3f6c0fb2 | 305 | int mem_pools; |
17a0a4ee | 306 | } onoff; |
a8258824 | 307 | struct _acl *aclList; |
308 | struct { | |
309 | struct _acl_access *http; | |
310 | struct _acl_access *icp; | |
311 | struct _acl_access *miss; | |
312 | struct _acl_access *NeverDirect; | |
313 | struct _acl_access *AlwaysDirect; | |
53ad48e6 | 314 | struct _acl_access *ASlists; |
a8258824 | 315 | } accessList; |
316 | struct _acl_deny_info_list *denyInfoList; | |
317 | struct { | |
318 | size_t list_width; | |
319 | int list_wrap; | |
a8258824 | 320 | char *anon_user; |
321 | } Ftp; | |
322 | refresh_t *Refresh; | |
323 | struct _cacheSwap { | |
a47b9029 | 324 | SwapDir *swapDirs; |
325 | int n_allocated; | |
326 | int n_configured; | |
a8258824 | 327 | } cacheSwap; |
88738790 | 328 | char *fake_ua; |
365cb147 | 329 | struct { |
330 | char *directory; | |
365cb147 | 331 | } icons; |
9b312a19 | 332 | char *errorDirectory; |
22c653cd | 333 | struct { |
334 | time_t timeout; | |
335 | int maxtries; | |
336 | } retry; | |
a8258824 | 337 | }; |
338 | ||
339 | struct _SquidConfig2 { | |
340 | struct { | |
341 | char *prefix; | |
342 | int on; | |
343 | } Accel; | |
344 | }; | |
345 | ||
346 | struct _close_handler { | |
347 | PF *handler; | |
348 | void *data; | |
349 | close_handler *next; | |
350 | }; | |
351 | ||
352 | struct _dread_ctrl { | |
353 | int fd; | |
354 | off_t offset; | |
355 | int req_len; | |
356 | char *buf; | |
357 | int end_of_file; | |
358 | DRCB *handler; | |
359 | void *client_data; | |
360 | }; | |
361 | ||
362 | struct _dnsserver_t { | |
363 | int id; | |
364 | int flags; | |
365 | int inpipe; | |
366 | int outpipe; | |
367 | time_t answer; | |
78f1250a | 368 | off_t offset; |
369 | size_t size; | |
e144eae4 | 370 | char ip_inbuf[DNS_INBUF_SZ]; |
a8258824 | 371 | struct timeval dispatch_time; |
372 | void *data; | |
373 | }; | |
374 | ||
375 | struct _dnsStatData { | |
376 | int requests; | |
377 | int replies; | |
378 | int hist[DefaultDnsChildrenMax]; | |
379 | }; | |
380 | ||
381 | struct _dwrite_q { | |
d377699f | 382 | off_t file_offset; |
a8258824 | 383 | char *buf; |
384 | int len; | |
d377699f | 385 | off_t buf_offset; |
a8258824 | 386 | struct _dwrite_q *next; |
74fbf3c9 | 387 | FREE *free_func; |
a8258824 | 388 | }; |
389 | ||
a8258824 | 390 | struct _fde { |
391 | unsigned int type; | |
392 | unsigned int open; | |
393 | u_short local_port; | |
394 | u_short remote_port; | |
395 | char ipaddr[16]; /* dotted decimal address of peer */ | |
396 | char desc[FD_DESC_SZ]; | |
397 | int flags; | |
398 | int bytes_read; | |
399 | int bytes_written; | |
b716a8ad | 400 | int uses; /* ie # req's over persistent conn */ |
a8258824 | 401 | struct _fde_disk { |
402 | DWCB *wrt_handle; | |
403 | void *wrt_handle_data; | |
404 | dwrite_q *write_q; | |
405 | dwrite_q *write_q_tail; | |
711982d8 | 406 | off_t offset; |
a8258824 | 407 | } disk; |
408 | PF *read_handler; | |
409 | void *read_data; | |
410 | PF *write_handler; | |
411 | void *write_data; | |
412 | PF *timeout_handler; | |
413 | time_t timeout; | |
414 | void *timeout_data; | |
cb69b4c7 | 415 | void *lifetime_data; |
a8258824 | 416 | close_handler *close_handler; /* linked list */ |
da2b3a17 | 417 | DEFER *defer_check; /* check if we should defer read */ |
70a9dab4 | 418 | void *defer_data; |
a8258824 | 419 | CommWriteStateData *rwstate; /* State data for comm_write */ |
22c653cd | 420 | time_t connect_timeout; |
a8258824 | 421 | }; |
422 | ||
423 | struct _fileMap { | |
424 | int max_n_files; | |
425 | int n_files_in_map; | |
a8258824 | 426 | int toggle; |
427 | int nwords; | |
428 | unsigned long *file_map; | |
429 | }; | |
430 | ||
a8258824 | 431 | struct _hash_link { |
432 | char *key; | |
433 | struct _hash_link *next; | |
434 | void *item; | |
435 | }; | |
436 | ||
437 | struct _hash_table { | |
438 | int valid; | |
439 | hash_link **buckets; | |
440 | HASHCMP *cmp; | |
441 | HASHHASH *hash; | |
442 | unsigned int size; | |
443 | unsigned int current_slot; | |
444 | hash_link *current_ptr; | |
445 | }; | |
446 | ||
cb69b4c7 | 447 | #include "MemBuf.h" |
448 | #include "Packer.h" | |
449 | #include "HttpReply.h" | |
450 | ||
ee1679df | 451 | #if 0 /* tmp moved to HttpReply.h */ |
cb69b4c7 | 452 | #define Const const |
a8258824 | 453 | struct _http_reply { |
454 | double version; | |
455 | int code; | |
456 | int content_length; | |
ee1679df | 457 | int hdr_sz; /* includes _stored_ status-line, headers, and <CRLF> */ |
cb69b4c7 | 458 | /* Note: fields below may not match info stored on disk */ |
459 | Const int cache_control; | |
460 | Const int misc_headers; | |
461 | Const time_t date; | |
462 | Const time_t expires; | |
463 | Const time_t last_modified; | |
464 | Const char content_type[HTTP_REPLY_FIELD_SZ]; | |
ee1679df | 465 | #if 0 /* unused 512 bytes? */ |
cb69b4c7 | 466 | Const char user_agent[HTTP_REPLY_FIELD_SZ << 2]; |
467 | #endif | |
a8258824 | 468 | }; |
ee1679df | 469 | |
cb69b4c7 | 470 | #endif |
471 | ||
a8258824 | 472 | |
473 | struct _HttpStateData { | |
474 | StoreEntry *entry; | |
475 | request_t *request; | |
476 | char *reply_hdr; | |
477 | int reply_hdr_state; | |
1294c0fc | 478 | peer *peer; /* peer request made to */ |
a8258824 | 479 | int eof; /* reached end-of-object? */ |
480 | request_t *orig_request; | |
1294c0fc | 481 | int fd; |
603a02fd | 482 | int flags; |
a8258824 | 483 | }; |
484 | ||
485 | struct _icpUdpData { | |
486 | struct sockaddr_in address; | |
487 | void *msg; | |
488 | size_t len; | |
489 | icpUdpData *next; | |
490 | #ifndef LESS_TIMING | |
491 | struct timeval start; | |
492 | #endif | |
493 | log_type logcode; | |
494 | protocol_t proto; | |
495 | }; | |
496 | ||
497 | struct _icp_ping_data { | |
498 | struct timeval start; | |
499 | struct timeval stop; | |
500 | int n_sent; | |
501 | int n_recv; | |
502 | int n_replies_expected; | |
503 | int timeout; | |
504 | int w_rtt; | |
b3264694 | 505 | int p_rtt; |
a8258824 | 506 | }; |
507 | ||
508 | struct _HierarchyLogEntry { | |
509 | hier_code code; | |
510 | char host[SQUIDHOSTNAMELEN]; | |
ee1679df | 511 | icp_ping_data icp; |
a8258824 | 512 | }; |
513 | ||
514 | struct _AccessLogEntry { | |
515 | const char *url; | |
516 | struct { | |
517 | method_t method; | |
518 | int code; | |
519 | const char *content_type; | |
520 | } http; | |
521 | struct { | |
522 | icp_opcode opcode; | |
523 | } icp; | |
524 | struct { | |
525 | struct in_addr caddr; | |
526 | size_t size; | |
527 | log_type code; | |
528 | int msec; | |
529 | const char *ident; | |
530 | } cache; | |
531 | struct _HierarchyLogEntry hier; | |
532 | struct { | |
533 | char *request; | |
534 | char *reply; | |
535 | } headers; | |
536 | struct { | |
537 | const char *method_str; | |
538 | } private; | |
539 | }; | |
540 | ||
541 | struct _clientHttpRequest { | |
542 | ConnStateData *conn; | |
543 | request_t *request; /* Parsed URL ... */ | |
23d92c64 | 544 | char *uri; |
545 | char *log_uri; | |
a8258824 | 546 | struct { |
547 | char *buf; | |
78f1250a | 548 | off_t offset; |
549 | size_t size; | |
a8258824 | 550 | } out; |
551 | size_t req_sz; | |
552 | StoreEntry *entry; | |
553 | StoreEntry *old_entry; | |
554 | log_type log_type; | |
9b312a19 | 555 | http_status http_code; |
a8258824 | 556 | int accel; |
557 | struct timeval start; | |
558 | float http_ver; | |
559 | int redirect_state; | |
560 | aclCheck_t *acl_checklist; /* need ptr back so we can unreg if needed */ | |
561 | clientHttpRequest *next; | |
562 | struct _AccessLogEntry al; | |
563 | }; | |
564 | ||
565 | struct _ConnStateData { | |
566 | int fd; | |
567 | struct { | |
568 | char *buf; | |
78f1250a | 569 | off_t offset; |
570 | size_t size; | |
a8258824 | 571 | } in; |
572 | clientHttpRequest *chr; | |
573 | struct sockaddr_in peer; | |
574 | struct sockaddr_in me; | |
575 | struct in_addr log_addr; | |
576 | struct { | |
577 | int fd; | |
578 | char ident[ICP_IDENT_SZ]; | |
579 | IDCB *callback; | |
580 | int state; | |
581 | } ident; | |
582 | CommWriteStateData *commWriteState; | |
583 | int nrequests; | |
584 | int persistent; | |
da2b3a17 | 585 | struct { |
586 | int n; | |
587 | time_t until; | |
588 | } defer; | |
a8258824 | 589 | }; |
590 | ||
2ac237e2 | 591 | struct _dlink_node { |
592 | void *data; | |
593 | dlink_node *prev; | |
594 | dlink_node *next; | |
595 | }; | |
596 | ||
597 | struct _dlink_list { | |
598 | dlink_node *head; | |
599 | dlink_node *tail; | |
600 | }; | |
601 | ||
a8258824 | 602 | struct _ipcache_addrs { |
6d1c0d53 | 603 | struct in_addr *in_addrs; |
604 | unsigned char *bad_mask; | |
a8258824 | 605 | unsigned char count; |
606 | unsigned char cur; | |
22c653cd | 607 | unsigned char badcount; |
a8258824 | 608 | }; |
609 | ||
610 | struct _ipcache_entry { | |
611 | /* first two items must be equivalent to hash_link in hash.h */ | |
612 | char *name; | |
613 | struct _ipcache_entry *next; | |
614 | time_t lastref; | |
615 | time_t expires; | |
616 | ipcache_addrs addrs; | |
617 | struct _ip_pending *pending_head; | |
618 | char *error_message; | |
2ac237e2 | 619 | dlink_node lru; |
620 | u_char locks; | |
a8258824 | 621 | ipcache_status_t status:3; |
622 | }; | |
623 | ||
1df370e3 | 624 | struct _fqdncache_entry { |
625 | /* first two items must be equivalent to hash_link in hash.h */ | |
626 | char *name; | |
627 | struct _fqdncache_entry *next; | |
628 | time_t lastref; | |
629 | time_t expires; | |
630 | unsigned char name_count; | |
631 | char *names[FQDN_MAX_NAMES + 1]; | |
632 | struct _fqdn_pending *pending_head; | |
633 | char *error_message; | |
634 | dlink_node lru; | |
635 | unsigned char locks; | |
636 | fqdncache_status_t status:3; | |
637 | }; | |
638 | ||
a8258824 | 639 | struct _domain_ping { |
640 | char *domain; | |
641 | int do_ping; /* boolean */ | |
642 | struct _domain_ping *next; | |
643 | }; | |
644 | ||
645 | struct _domain_type { | |
646 | char *domain; | |
647 | peer_t type; | |
648 | struct _domain_type *next; | |
649 | }; | |
650 | ||
651 | struct _peer { | |
652 | char *host; | |
653 | peer_t type; | |
654 | struct sockaddr_in in_addr; | |
655 | struct { | |
656 | int pings_sent; | |
657 | int pings_acked; | |
a8258824 | 658 | int fetches; |
659 | int rtt; | |
27cd7235 | 660 | int counts[ICP_END]; |
a8258824 | 661 | int ignored_replies; |
1294c0fc | 662 | int n_keepalives_sent; |
663 | int n_keepalives_recv; | |
dc835977 | 664 | time_t last_query; |
665 | time_t last_reply; | |
666 | int logged_state; /* so we can print dead/revived msgs */ | |
a8258824 | 667 | } stats; |
668 | u_short icp_port; | |
669 | u_short http_port; | |
670 | int icp_version; | |
671 | struct _domain_ping *pinglist; | |
672 | struct _domain_type *typelist; | |
673 | struct _acl_list *acls; | |
674 | int options; | |
675 | int weight; | |
676 | struct { | |
677 | double avg_n_members; | |
678 | int n_times_counted; | |
679 | int n_replies_expected; | |
680 | int ttl; | |
9fb13bb6 | 681 | u_num32 reqnum; |
a8258824 | 682 | int flags; |
683 | } mcast; | |
684 | int tcp_up; /* 0 if a connect() fails */ | |
685 | time_t last_fail_time; | |
686 | struct in_addr addresses[10]; | |
687 | int n_addresses; | |
688 | int rr_count; | |
689 | struct _peer *next; | |
690 | int ip_lookup_pending; | |
88738790 | 691 | int ck_conn_event_pend; |
a8258824 | 692 | int test_fd; |
693 | }; | |
694 | ||
695 | struct _net_db_name { | |
696 | char *name; | |
74fbf3c9 | 697 | net_db_name *htbl_next; |
698 | net_db_name *next; | |
699 | netdbEntry *net_db_entry; | |
a8258824 | 700 | }; |
701 | ||
702 | struct _net_db_peer { | |
703 | char *peername; | |
704 | double hops; | |
705 | double rtt; | |
706 | time_t expires; | |
707 | }; | |
708 | ||
709 | struct _netdbEntry { | |
710 | char *key; | |
74fbf3c9 | 711 | netdbEntry *next; |
a8258824 | 712 | char network[16]; |
713 | int pings_sent; | |
714 | int pings_recv; | |
715 | double hops; | |
716 | double rtt; | |
717 | time_t next_ping_time; | |
718 | time_t last_use_time; | |
719 | int link_count; | |
720 | net_db_name *hosts; | |
721 | net_db_peer *peers; | |
722 | int n_peers_alloc; | |
723 | int n_peers; | |
724 | }; | |
725 | ||
726 | struct _ps_state { | |
727 | request_t *request; | |
728 | StoreEntry *entry; | |
729 | int always_direct; | |
730 | int never_direct; | |
731 | PSC *callback; | |
732 | PSC *fail_callback; | |
733 | void *callback_data; | |
734 | peer *first_parent_miss; | |
735 | peer *closest_parent_miss; | |
736 | icp_ping_data icp; | |
737 | aclCheck_t *acl_checklist; | |
738 | }; | |
739 | ||
740 | struct _pingerEchoData { | |
741 | struct in_addr to; | |
742 | unsigned char opcode; | |
743 | int psize; | |
744 | char payload[8192]; | |
745 | }; | |
746 | ||
747 | struct _pingerReplyData { | |
748 | struct in_addr from; | |
749 | unsigned char opcode; | |
750 | int rtt; | |
751 | int hops; | |
752 | int psize; | |
753 | char payload[8192]; | |
754 | }; | |
755 | ||
756 | struct _icp_common_t { | |
757 | unsigned char opcode; /* opcode */ | |
758 | unsigned char version; /* version number */ | |
759 | unsigned short length; /* total length (bytes) */ | |
760 | u_num32 reqnum; /* req number (req'd for UDP) */ | |
761 | u_num32 flags; | |
762 | u_num32 pad; | |
a8258824 | 763 | u_num32 shostid; /* sender host id */ |
764 | }; | |
765 | ||
ee1679df | 766 | #if 0 /* this struct is not used */ |
a8258824 | 767 | struct _Stack { |
768 | void **base; | |
769 | void **top; | |
770 | int stack_size; | |
771 | }; | |
ee1679df | 772 | |
cb69b4c7 | 773 | #endif |
a8258824 | 774 | |
a8258824 | 775 | struct _Meta_data { |
776 | int hot_vm; | |
a8258824 | 777 | int ipcache_count; |
778 | int fqdncache_count; | |
a8258824 | 779 | int netdb_peers; |
a8258824 | 780 | int misc; |
781 | int client_info; | |
9fb13bb6 | 782 | int store_keys; |
a8258824 | 783 | }; |
784 | ||
a8258824 | 785 | struct _iostats { |
786 | struct { | |
787 | int reads; | |
788 | int reads_deferred; | |
789 | int read_hist[16]; | |
790 | int writes; | |
791 | int write_hist[16]; | |
792 | } Http, Ftp, Gopher, Wais; | |
793 | }; | |
794 | ||
795 | struct _mem_node { | |
796 | char *data; | |
797 | int len; | |
798 | mem_node *next; | |
799 | }; | |
800 | ||
801 | struct _mem_hdr { | |
802 | mem_node *head; | |
803 | mem_node *tail; | |
804 | int origin_offset; | |
805 | }; | |
806 | ||
a8258824 | 807 | /* keep track each client receiving data from that particular StoreEntry */ |
808 | struct _store_client { | |
43329771 | 809 | int type; |
a8258824 | 810 | off_t copy_offset; |
811 | off_t seen_offset; | |
812 | size_t copy_size; | |
813 | char *copy_buf; | |
814 | STCB *callback; | |
815 | void *callback_data; | |
07304bf9 | 816 | StoreEntry *entry; /* ptr to the parent StoreEntry, argh! */ |
79d39a72 | 817 | int swapin_fd; |
6cf028ab | 818 | int disk_op_in_progress; |
43329771 | 819 | struct _store_client *next; |
a8258824 | 820 | }; |
821 | ||
a8258824 | 822 | /* This structure can be freed while object is purged out from memory */ |
823 | struct _MemObject { | |
2ac237e2 | 824 | method_t method; |
9fb13bb6 | 825 | char *url; |
a8258824 | 826 | mem_hdr *data; |
8350fe9b | 827 | off_t inmem_hi; |
828 | off_t inmem_lo; | |
a8258824 | 829 | struct _store_client *clients; |
830 | int nclients; | |
8350fe9b | 831 | struct { |
e3ef2b09 | 832 | off_t queue_offset; /* relative to in-mem data */ |
833 | off_t done_offset; /* relative to swap file with meta headers! */ | |
8350fe9b | 834 | int fd; |
25354045 | 835 | void *ctrl; |
8350fe9b | 836 | } swapout; |
cb69b4c7 | 837 | #if 0 |
a8258824 | 838 | struct _http_reply *reply; |
cb69b4c7 | 839 | #else |
840 | HttpReply *reply; | |
841 | #endif | |
a8258824 | 842 | request_t *request; |
843 | struct timeval start_ping; | |
844 | IRCB *icp_reply_callback; | |
845 | void *ircb_data; | |
846 | int fd; /* FD of client creating this entry */ | |
847 | struct { | |
848 | STABH *callback; | |
849 | void *data; | |
850 | } abort; | |
88738790 | 851 | char *log_url; |
b93bcace | 852 | dlink_node lru; |
9fb13bb6 | 853 | u_num32 reqnum; |
07304bf9 | 854 | ssize_t object_sz; |
e3ef2b09 | 855 | size_t swap_hdr_sz; |
a8258824 | 856 | }; |
857 | ||
a8258824 | 858 | struct _StoreEntry { |
859 | /* first two items must be same as hash_link in hash.h */ | |
9fb13bb6 | 860 | const cache_key *key; |
b93bcace | 861 | struct _StoreEntry *next; |
a8258824 | 862 | MemObject *mem_obj; |
a8258824 | 863 | time_t timestamp; |
864 | time_t lastref; | |
865 | time_t expires; | |
866 | time_t lastmod; | |
07304bf9 | 867 | size_t swap_file_sz; |
a21fbb54 | 868 | u_short refcount; |
869 | u_short flag; | |
870 | ||
a8258824 | 871 | int swap_file_number; |
b93bcace | 872 | dlink_node lru; |
2ac237e2 | 873 | u_char lock_count; /* Assume < 256! */ |
a8258824 | 874 | mem_status_t mem_status:3; |
875 | ping_status_t ping_status:3; | |
876 | store_status_t store_status:3; | |
877 | swap_status_t swap_status:3; | |
a8258824 | 878 | }; |
879 | ||
880 | struct _SwapDir { | |
881 | char *path; | |
882 | int l1; | |
883 | int l2; | |
884 | int cur_size; | |
885 | int max_size; | |
886 | int read_only; | |
887 | int suggest; | |
888 | fileMap *map; | |
889 | int swaplog_fd; | |
890 | }; | |
891 | ||
892 | struct _request_t { | |
893 | method_t method; | |
894 | protocol_t protocol; | |
895 | char login[MAX_LOGIN_SZ]; | |
896 | char host[SQUIDHOSTNAMELEN + 1]; | |
897 | u_short port; | |
898 | char urlpath[MAX_URL]; | |
899 | int link_count; /* free when zero */ | |
900 | int flags; | |
901 | time_t max_age; | |
902 | float http_ver; | |
903 | time_t ims; | |
904 | int imslen; | |
905 | int max_forwards; | |
906 | struct in_addr client_addr; | |
907 | char *headers; | |
908 | size_t headers_sz; | |
909 | char *body; | |
910 | size_t body_sz; | |
911 | struct _HierarchyLogEntry hier; | |
88aad2e5 | 912 | err_type err_type; |
a8258824 | 913 | }; |
914 | ||
915 | struct _cachemgr_passwd { | |
916 | char *passwd; | |
22f3fd98 | 917 | wordlist *actions; |
a8258824 | 918 | struct _cachemgr_passwd *next; |
919 | }; | |
920 | ||
921 | struct _refresh_t { | |
922 | char *pattern; | |
923 | regex_t compiled_pattern; | |
924 | time_t min; | |
925 | int pct; | |
926 | time_t max; | |
927 | struct _refresh_t *next; | |
928 | }; | |
929 | ||
930 | struct _CommWriteStateData { | |
931 | char *buf; | |
932 | size_t size; | |
933 | off_t offset; | |
934 | CWCB *handler; | |
935 | void *handler_data; | |
74fbf3c9 | 936 | FREE *free_func; |
a8258824 | 937 | }; |
9b312a19 | 938 | |
939 | struct _ErrorState { | |
940 | err_type type; | |
941 | http_status http_status; | |
942 | request_t *request; | |
943 | char *url; | |
c45ed9ad | 944 | int xerrno; |
9b312a19 | 945 | char *host; |
946 | u_short port; | |
947 | char *dnsserver_msg; | |
948 | time_t ttl; | |
949 | struct in_addr src_addr; | |
950 | char *redirect_url; | |
951 | ERCB *callback; | |
952 | void *callback_data; | |
bb0929d8 | 953 | int flags; |
b9916917 | 954 | struct { |
955 | char *request; | |
956 | char *reply; | |
957 | } ftp; | |
e144eae4 | 958 | char *request_hdrs; |
9b312a19 | 959 | }; |
f2908497 | 960 | |
12cf1be2 | 961 | /* |
962 | * "very generic" histogram; | |
963 | * see important comments on hbase_f restrictions in StatHist.c | |
964 | */ | |
965 | struct _StatHist { | |
966 | int *bins; | |
967 | int capacity; | |
e9a13293 | 968 | double min; |
969 | double max; | |
970 | double scale; | |
12cf1be2 | 971 | hbase_f val_in; /* e.g., log() for log-based histogram */ |
972 | hbase_f val_out; /* e.g., exp() for log based histogram */ | |
7ae52c25 | 973 | }; |
974 | ||
12cf1be2 | 975 | /* |
976 | * if you add a field to StatCounters, | |
1d803566 | 977 | * you MUST sync statCountersInitSpecial, statCountersClean, and statCountersCopy |
12cf1be2 | 978 | */ |
f2908497 | 979 | struct _StatCounters { |
980 | struct { | |
981 | int requests; | |
982 | int hits; | |
983 | int errors; | |
a7c05555 | 984 | kb_t kbytes_in; |
985 | kb_t kbytes_out; | |
986 | kb_t hit_kbytes_out; | |
12cf1be2 | 987 | StatHist miss_svc_time; |
988 | StatHist nm_svc_time; | |
989 | StatHist hit_svc_time; | |
990 | StatHist all_svc_time; | |
f2908497 | 991 | } client_http; |
7ae52c25 | 992 | struct { |
993 | int requests; | |
994 | int errors; | |
995 | kb_t kbytes_in; | |
996 | kb_t kbytes_out; | |
997 | } server; | |
f2908497 | 998 | struct { |
999 | int pkts_sent; | |
1000 | int pkts_recv; | |
a7c05555 | 1001 | int hits_sent; |
1002 | int hits_recv; | |
1003 | kb_t kbytes_sent; | |
1004 | kb_t kbytes_recv; | |
12cf1be2 | 1005 | StatHist query_svc_time; |
1006 | StatHist reply_svc_time; | |
f2908497 | 1007 | } icp; |
1008 | struct { | |
1009 | int requests; | |
1010 | } unlink; | |
9973e9fe | 1011 | struct { |
12cf1be2 | 1012 | StatHist svc_time; |
9973e9fe | 1013 | } dns; |
f2908497 | 1014 | int page_faults; |
1015 | int select_loops; | |
1016 | double cputime; | |
d5649d9f | 1017 | struct timeval timestamp; |
f2908497 | 1018 | }; |
69c01cd7 | 1019 | |
1020 | struct _tlv { | |
5830cdb3 | 1021 | char type; |
1022 | int length; | |
1023 | void *value; | |
1024 | struct _tlv *next; | |
1025 | }; | |
1026 | ||
07304bf9 | 1027 | struct _storeSwapLogData { |
5830cdb3 | 1028 | char op; |
1029 | int swap_file_number; | |
1030 | time_t timestamp; | |
1031 | time_t lastref; | |
1032 | time_t expires; | |
1033 | time_t lastmod; | |
07304bf9 | 1034 | size_t swap_file_sz; |
5830cdb3 | 1035 | u_short refcount; |
1036 | u_short flags; | |
7363fc17 | 1037 | unsigned char key[MD5_DIGEST_CHARS]; |
69c01cd7 | 1038 | }; |