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