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