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