]> git.ipfire.org Git - thirdparty/squid.git/blame - src/structs.h
Bootstrapped
[thirdparty/squid.git] / src / structs.h
CommitLineData
a8258824 1
9cef6668 2/*
777831e0 3 * $Id: structs.h,v 1.491 2004/10/10 02:49:05 hno 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"
0009ba2f 38
2d8c0b1a 39class dlink_node
62e76326 40{
2d8c0b1a 41
42public:
43 dlink_node() : data(NULL), prev(NULL), next(NULL){}
44
0f1bc304 45 void *data;
46 dlink_node *prev;
47 dlink_node *next;
48};
49
62e76326 50struct _dlink_list
51{
0f1bc304 52 dlink_node *head;
53 dlink_node *tail;
54};
55
62e76326 56struct _acl_name_list
57{
a8258824 58 char name[ACL_NAME_SZ];
74fbf3c9 59 acl_name_list *next;
a8258824 60};
61
62e76326 62struct _acl_proxy_auth_match_cache
63{
94439e4e 64 dlink_node link;
65 int matchrv;
66 void *acl_data;
67};
68
62e76326 69struct _acl_deny_info_list
70{
e6ccf245 71 err_type err_page_id;
02922e76 72 char *err_page_name;
74fbf3c9 73 acl_name_list *acl_list;
74 acl_deny_info_list *next;
a8258824 75};
76
02922e76 77
8000a965 78class acl_access;
62e76326 79
80struct _header_mangler
81{
6bccf575 82 acl_access *access_list;
83 char *replacement;
84};
85
62e76326 86struct _body_size
87{
a560ee93 88 dlink_node node;
89 acl_access *access_list;
90 size_t maxsize;
91};
92
ccf44862 93
1df370e3 94#if SQUID_SNMP
43d4303e 95
62e76326 96struct _snmp_request_t
97{
5e29a294 98 u_char *buf;
99 u_char *outbuf;
2ac76861 100 int len;
101 int sock;
102 long reqid;
103 int outlen;
62e76326 104
2ac76861 105 struct sockaddr_in from;
62e76326 106
2ac76861 107 struct snmp_pdu *PDU;
4fb35c3c 108 ACLChecklist *acl_checklist;
5e29a294 109 u_char *community;
a9ddb359 110};
bdf18524 111
1df370e3 112#endif
a97cfa48 113
a8258824 114
62e76326 115struct _acl_address
116{
d6827718 117 acl_address *next;
29b8d8d6 118 acl_list *aclList;
62e76326 119
d6827718 120 struct in_addr addr;
121};
122
62e76326 123struct _acl_tos
124{
d6827718 125 acl_tos *next;
29b8d8d6 126 acl_list *aclList;
d6827718 127 int tos;
128};
129
ef1955a5 130struct _acl_size_t
131{
132 acl_size_t *next;
133 acl_list *aclList;
134 size_t size;
135};
136
62e76326 137struct _wordlist
138{
a8258824 139 char *key;
bd05e3e3 140 wordlist *next;
a8258824 141};
142
62e76326 143struct _ushortlist
144{
a8258824 145 u_short i;
bd05e3e3 146 ushortlist *next;
a8258824 147};
148
62e76326 149struct _relist
150{
a8258824 151 char *pattern;
152 regex_t regex;
bd05e3e3 153 relist *next;
a8258824 154};
155
62e76326 156struct _sockaddr_in_list
157{
158
7e3ce7b9 159 struct sockaddr_in s;
160 sockaddr_in_list *next;
161};
162
fbdba7c4 163struct _http_port_list
164{
165 http_port_list *next;
166
167 struct sockaddr_in s;
168 char *protocol; /* protocol name */
169 char *name; /* visible name */
170 char *defaultsite; /* default web site */
171
172unsigned int transparent:
173 1; /* transparent proxy */
174
175unsigned int accel:
176 1; /* HTTP accelerator */
177
178unsigned int vhost:
179 1; /* uses host header */
180
181 int vport; /* virtual port support, -1 for dynamic, >0 static*/
182};
183
184
d193a436 185#if USE_SSL
62e76326 186
187struct _https_port_list
188{
fbdba7c4 189 http_port_list http; /* must be first */
d193a436 190 char *cert;
191 char *key;
79d4ccdf 192 int version;
193 char *cipher;
194 char *options;
a7ad6e4e 195 char *clientca;
196 char *cafile;
197 char *capath;
35105e4b 198 char *dhfile;
a7ad6e4e 199 char *sslflags;
200 SSL_CTX *sslContext;
d193a436 201};
62e76326 202
d193a436 203#endif
94439e4e 204
56e64999 205#if DELAY_POOLS
b67e2c8c 206#include "DelayConfig.h"
56e64999 207#endif
95e36d02 208
62e76326 209struct _RemovalPolicySettings
210{
6a566b9c 211 char *type;
212 wordlist *args;
213};
214
1e5562e3 215class external_acl;
216
62e76326 217struct _SquidConfig
218{
219
220 struct
221 {
222 size_t maxSize;
223 int highWaterMark;
224 int lowWaterMark;
225 }
226
227 Swap;
43a70238 228 size_t memMaxSize;
62e76326 229
230 struct
231 {
232 char *relayHost;
233 u_short relayPort;
234 peer *_peer;
235 }
236
237 Wais;
238
239 struct
240 {
241 size_t min;
242 int pct;
243 size_t max;
244 }
245
246 quickAbort;
7e820f36 247 size_t readAheadGap;
6a566b9c 248 RemovalPolicySettings *replPolicy;
249 RemovalPolicySettings *memPolicy;
a8258824 250 time_t negativeTtl;
251 time_t negativeDnsTtl;
252 time_t positiveDnsTtl;
253 time_t shutdownLifetime;
d1b63fc8 254 time_t backgroundPingRate;
62e76326 255
256 struct
257 {
258 time_t read;
259 time_t lifetime;
260 time_t connect;
777831e0 261 time_t forward;
62e76326 262 time_t peer_connect;
263 time_t request;
264 time_t persistent_request;
265 time_t pconn;
266 time_t siteSelect;
267 time_t deadPeer;
268 int icp_query; /* msec */
269 int icp_query_max; /* msec */
270 int icp_query_min; /* msec */
271 int mcast_icp_query; /* msec */
3898f57f 272#if USE_IDENT
62e76326 273
274 time_t ident;
4fe0e1d0 275#endif
276#if !USE_DNSSERVERS
62e76326 277
278 time_t idns_retransmit;
279 time_t idns_query;
3898f57f 280#endif
62e76326 281
282 }
283
284 Timeout;
0483b991 285 size_t maxRequestHeaderSize;
286 size_t maxRequestBodySize;
ef1955a5 287 acl_size_t *ReplyBodySize;
62e76326 288
289 struct
290 {
291 u_short icp;
ace287ee 292#if USE_HTCP
62e76326 293
294 u_short htcp;
ace287ee 295#endif
1df370e3 296#if SQUID_SNMP
62e76326 297
298 u_short snmp;
1df370e3 299#endif
62e76326 300
301 }
302
303 Port;
304
305 struct
306 {
307 http_port_list *http;
1f7c9178 308#if USE_SSL
62e76326 309
310 https_port_list *https;
1f7c9178 311#endif
62e76326 312
313 }
314
315 Sockaddr;
1df370e3 316#if SQUID_SNMP
62e76326 317
318 struct
319 {
320 char *configFile;
321 char *agentInfo;
322 }
323
324 Snmp;
320e9f36 325#endif
eb824054 326#if USE_WCCP
62e76326 327
328 struct
329 {
330
331 struct in_addr router;
332
333 struct in_addr incoming;
334
335 struct in_addr outgoing;
336 int version;
337 }
338
339 Wccp;
1df370e3 340#endif
62e76326 341
53ad48e6 342 char *as_whois_server;
62e76326 343
344 struct
345 {
346 char *log;
62e76326 347 char *store;
348 char *swap;
82839306 349#if USE_USERAGENT_LOG
62e76326 350
351 char *useragent;
fd2c5549 352#endif
353#if USE_REFERER_LOG
62e76326 354
355 char *referer;
225644d7 356#endif
357#if WIP_FWD_LOG
62e76326 358
359 char *forward;
82839306 360#endif
62e76326 361
7684c4b1 362 logformat *logformats;
363
364 customlog *accesslogs;
365
62e76326 366 int rotateNumber;
367 }
368
369 Log;
a8258824 370 char *adminEmail;
371 char *effectiveUser;
372 char *effectiveGroup;
62e76326 373
374 struct
375 {
82839306 376#if USE_DNSSERVERS
62e76326 377 char *dnsserver;
efd900cb 378#endif
62e76326 379
380 wordlist *redirect;
82839306 381#if USE_ICMP
62e76326 382
383 char *pinger;
82839306 384#endif
a3d0a19d 385#if USE_UNLINKD
62e76326 386
387 char *unlinkd;
a3d0a19d 388#endif
62e76326 389
390 char *diskd;
307b83b7 391#if USE_SSL
392
393 char *ssl_password;
394#endif
395
62e76326 396 }
397
398 Program;
82839306 399#if USE_DNSSERVERS
62e76326 400
a8258824 401 int dnsChildren;
efd900cb 402#endif
62e76326 403
a8258824 404 int redirectChildren;
07eca7e0 405 int redirectConcurrency;
94439e4e 406 time_t authenticateGCInterval;
70a76033 407 time_t authenticateTTL;
408 time_t authenticateIpTTL;
43ae1d95 409
410 struct
411 {
412#if ESI
413 char *surrogate_id;
414#endif
415
416 }
417
418 Accel;
a8258824 419 char *appendDomain;
420 size_t appendDomainLen;
421 char *debugOptions;
422 char *pidFilename;
423 char *mimeTablePathname;
0e70aa1e 424 char *etcHostsPath;
a8258824 425 char *visibleHostname;
98829f69 426 char *uniqueHostname;
1f38f50a 427 wordlist *hostnameAliases;
a8258824 428 char *errHtmlText;
62e76326 429
430 struct
431 {
432 char *host;
433 char *file;
434 time_t period;
435 u_short port;
436 }
437
438 Announce;
439
440 struct
441 {
442
443 struct in_addr udp_incoming;
444
445 struct in_addr udp_outgoing;
15dcc168 446#if SQUID_SNMP
62e76326 447
448 struct in_addr snmp_incoming;
449
450 struct in_addr snmp_outgoing;
15dcc168 451#endif
62e76326 452
453 struct in_addr client_netmask;
454 }
455
456 Addrs;
9906e724 457 size_t tcpRcvBufsz;
458 size_t udpMaxHitObjsz;
a8258824 459 wordlist *hierarchy_stoplist;
460 wordlist *mcast_group_list;
461 wordlist *dns_testname_list;
09c483ec 462 wordlist *dns_nameservers;
40a1495e 463 peer *peers;
464 int npeers;
62e76326 465
466 struct
467 {
468 int size;
469 int low;
470 int high;
471 }
472
473 ipcache;
474
475 struct
476 {
477 int size;
478 }
479
480 fqdncache;
a8258824 481 int minDirectHops;
5f84d830 482 int minDirectRtt;
a8258824 483 cachemgr_passwd *passwd_list;
62e76326 484
485 struct
486 {
487 int objectsPerBucket;
488 size_t avgObjectSize;
489 size_t maxObjectSize;
490 size_t minObjectSize;
491 size_t maxInMemObjSize;
492 }
493
494 Store;
495
496 struct
497 {
498 int high;
499 int low;
500 time_t period;
501 }
502
503 Netdb;
504
505 struct
506 {
507 int log_udp;
82839306 508#if USE_DNSSERVERS
62e76326 509
510 int res_defnames;
efd900cb 511#endif
62e76326 512
513 int anonymizer;
514 int client_db;
515 int query_icmp;
516 int icp_hit_stale;
517 int buffered_logs;
0ab965da 518#if ALLOW_SOURCE_PING
62e76326 519
520 int source_ping;
0ab965da 521#endif
62e76326 522
523 int common_log;
524 int log_mime_hdrs;
525 int log_fqdn;
526 int announce;
527 int mem_pools;
528 int test_reachability;
529 int half_closed_clients;
9f60cfdf 530#if HTTP_VIOLATIONS
62e76326 531
532 int reload_into_ims;
9f60cfdf 533#endif
62e76326 534
535 int offline;
536 int redir_rewrites_host;
537 int prefer_direct;
538 int nonhierarchical_direct;
539 int strip_query_terms;
540 int redirector_bypass;
541 int ignore_unknown_nameservers;
542 int client_pconns;
543 int server_pconns;
7e3ce7b9 544#if USE_CACHE_DIGESTS
62e76326 545
546 int digest_generation;
7e3ce7b9 547#endif
62e76326 548
549 int log_ip_on_direct;
550 int ie_refresh;
551 int vary_ignore_expire;
552 int pipeline_prefetch;
43ae1d95 553#if ESI
554
555 int surrogate_is_remote;
556#endif
557
62e76326 558 int request_entities;
559 int check_hostnames;
560 int via;
561 int emailErrData;
562 }
563
564 onoff;
97427e90 565
566 class ACL *aclList;
62e76326 567
568 struct
569 {
570 acl_access *http;
571 acl_access *icp;
572 acl_access *miss;
573 acl_access *NeverDirect;
574 acl_access *AlwaysDirect;
575 acl_access *ASlists;
576 acl_access *noCache;
7684c4b1 577 acl_access *log;
dba79ac5 578#if SQUID_SNMP
62e76326 579
580 acl_access *snmp;
dba79ac5 581#endif
62e76326 582
583 acl_access *brokenPosts;
3898f57f 584#if USE_IDENT
62e76326 585
586 acl_access *identLookup;
3898f57f 587#endif
62e76326 588
589 acl_access *redirector;
590 acl_access *reply;
591 acl_address *outgoing_address;
592 acl_tos *outgoing_tos;
593 }
594
595 accessList;
bd05e3e3 596 acl_deny_info_list *denyInfoList;
e6ccf245 597 authConfig authConfiguration;
62e76326 598
599 struct
600 {
601 size_t list_width;
602 int list_wrap;
603 char *anon_user;
604 int passive;
605 int sanitycheck;
dad0fe12 606 int telnet;
62e76326 607 }
608
609 Ftp;
a8258824 610 refresh_t *Refresh;
62e76326 611
612 struct _cacheSwap
613 {
614 SwapDir **swapDirs;
615 int n_allocated;
616 int n_configured;
617 }
618
619 cacheSwap;
620
621 struct
622 {
623 char *directory;
e72a0ec0 624 int use_short_names;
62e76326 625 }
626
627 icons;
9b312a19 628 char *errorDirectory;
62e76326 629
630 struct
631 {
62e76326 632 int maxtries;
633 }
634
635 retry;
636
637 struct
638 {
639 size_t limit;
640 }
641
642 MemPools;
95e36d02 643#if DELAY_POOLS
62e76326 644
b67e2c8c 645 DelayConfig Delay;
95e36d02 646#endif
62e76326 647
648 struct
649 {
650 int icp_average;
651 int dns_average;
652 int http_average;
653 int icp_min_poll;
654 int dns_min_poll;
655 int http_min_poll;
656 }
657
658 comm_incoming;
c5f627c2 659 int max_open_disk_fds;
d548ee64 660 int uri_whitespace;
c68e9c6b 661 size_t rangeOffsetLimit;
e66d7923 662#if MULTICAST_MISS_STREAM
62e76326 663
664 struct
665 {
666
667 struct in_addr addr;
668 int ttl;
669 unsigned short port;
670 char *encode_key;
671 }
672
673 mcast_miss;
e66d7923 674#endif
62e76326 675
6bccf575 676 header_mangler header_access[HDR_ENUM_END];
b6a2f15e 677 char *coredump_dir;
efd900cb 678 char *chroot_dir;
7e3ce7b9 679#if USE_CACHE_DIGESTS
62e76326 680
681 struct
682 {
683 int bits_per_entry;
684 time_t rebuild_period;
685 time_t rewrite_period;
686 size_t swapout_chunk_size;
687 int rebuild_chunk_percentage;
688 }
689
690 digest;
1f7c9178 691#endif
692#if USE_SSL
62e76326 693
694 struct
695 {
696 int unclean_shutdown;
697 char *ssl_engine;
698 }
699
700 SSL;
7e3ce7b9 701#endif
62e76326 702
56fe752e 703 wordlist *ext_methods;
62e76326 704
705 struct
706 {
707 int high_rptm;
708 int high_pf;
709 size_t high_memory;
710 }
711
712 warnings;
65a53c8e 713 char *store_dir_select_algorithm;
1fbbdcb0 714 int sleep_after_fork; /* microseconds */
d9572179 715 external_acl *externalAclHelperList;
a7ad6e4e 716#if USE_SSL
62e76326 717
718 struct
719 {
720 char *cert;
721 char *key;
722 int version;
723 char *options;
724 char *cipher;
725 char *cafile;
726 char *capath;
727 char *flags;
728 SSL_CTX *sslContext;
729 }
730
731 ssl_client;
a7ad6e4e 732#endif
a8258824 733};
734
62e76326 735struct _SquidConfig2
736{
737
738 struct
739 {
740 int enable_purge;
741 }
742
743 onoff;
d20b1cd0 744 uid_t effectiveUserID;
745 gid_t effectiveGroupID;
a8258824 746};
747
62e76326 748struct _close_handler
749{
a8258824 750 PF *handler;
751 void *data;
752 close_handler *next;
753};
754
62e76326 755struct _dread_ctrl
756{
a8258824 757 int fd;
758 off_t offset;
759 int req_len;
760 char *buf;
761 int end_of_file;
762 DRCB *handler;
763 void *client_data;
764};
765
62e76326 766struct _dnsserver_t
767{
a8258824 768 int id;
a8258824 769 int inpipe;
770 int outpipe;
771 time_t answer;
78f1250a 772 off_t offset;
773 size_t size;
e144eae4 774 char ip_inbuf[DNS_INBUF_SZ];
62e76326 775
a8258824 776 struct timeval dispatch_time;
777 void *data;
778};
779
62e76326 780struct _dwrite_q
781{
d377699f 782 off_t file_offset;
a8258824 783 char *buf;
784 int len;
d377699f 785 off_t buf_offset;
bd05e3e3 786 dwrite_q *next;
74fbf3c9 787 FREE *free_func;
a8258824 788};
789
a9771e51 790
791/* ETag support is rudimantal;
792 * this struct is likely to change
793 * Note: "str" points to memory in HttpHeaderEntry (for now)
794 * so ETags should be used as tmp variables only (for now) */
62e76326 795
796struct _ETag
797{
98829f69 798 const char *str; /* quoted-string */
799 int weak; /* true if it is a weak validator */
a9771e51 800};
801
62e76326 802struct _fde_disk
803{
e6ccf245 804 DWCB *wrt_handle;
805 void *wrt_handle_data;
806 dwrite_q *write_q;
807 dwrite_q *write_q_tail;
808 off_t offset;
809};
810
62e76326 811struct _fileMap
812{
a8258824 813 int max_n_files;
814 int n_files_in_map;
a8258824 815 int toggle;
816 int nwords;
817 unsigned long *file_map;
818};
819
1d21d91d 820/* see Packer.c for description */
62e76326 821
822struct _Packer
823{
1d21d91d 824 /* protected, use interface functions instead */
825 append_f append;
826 vprintf_f vprintf;
827 void *real_handler; /* first parameter to real append and vprintf */
828};
829
adba4a64 830
831/*
1d21d91d 832 * Note: HttpBody is used only for messages with a small content that is
adba4a64 833 * known a priory (e.g., error messages).
834 */
528b2c61 835#include "MemBuf.h"
62e76326 836
837struct _HttpBody
838{
1d21d91d 839 /* private */
840 MemBuf mb;
adba4a64 841};
842
cf414c2d 843#include "SquidString.h"
2ecaa5e7 844/* http header extention field */
62e76326 845
0353e724 846class HttpHdrExtField
62e76326 847{
a369131d 848 String name; /* field-name from HTTP/1.1 (no column after name) */
849 String value; /* field-value from HTTP/1.1 */
2ecaa5e7 850};
adba4a64 851
399e85ea 852/* http cache control header field */
62e76326 853
854struct _HttpHdrCc
855{
4f087419 856 int mask;
d8b249ef 857 int max_age;
7e3ce7b9 858 int s_maxage;
49ff0930 859 int max_stale;
a8258824 860};
ee1679df 861
a9771e51 862/* some fields can hold either time or etag specs (e.g. If-Range) */
62e76326 863
864struct _TimeOrTag
865{
98829f69 866 ETag tag; /* entity tag */
a9771e51 867 time_t time;
98829f69 868 int valid; /* true if struct is usable */
a9771e51 869};
870
7faf2bdb 871/* per field statistics */
62e76326 872
0353e724 873class HttpHeaderFieldStat
62e76326 874{
0353e724 875
876public:
877 HttpHeaderFieldStat() : aliveCount(0), seenCount(0), parsCount(0), errCount(0), repCount(0){}
878
399e85ea 879 int aliveCount; /* created but not destroyed (count) */
d8b249ef 880 int seenCount; /* #fields we've seen */
399e85ea 881 int parsCount; /* #parsing attempts */
882 int errCount; /* #pasring errors */
883 int repCount; /* #repetitons */
7faf2bdb 884};
885
d8b249ef 886/* compiled version of HttpHeaderFieldAttrs plus stats */
62e76326 887
0353e724 888class HttpHeaderFieldInfo
62e76326 889{
0353e724 890
891public:
892 HttpHeaderFieldInfo() : id (HDR_ACCEPT), type (ftInvalid){}
893
de336bbe 894 http_hdr_type id;
895 String name;
896 field_type type;
7faf2bdb 897 HttpHeaderFieldStat stat;
898};
899
0353e724 900class HttpHeaderEntry
62e76326 901{
0353e724 902
903public:
b001e822 904 MEMPROXY_CLASS(HttpHeaderEntry);
d8b249ef 905 http_hdr_type id;
906 String name;
907 String value;
908};
4f087419 909
b001e822 910/* bah. remove this when HttpHeaderEntry is moved
911 * out
912 */
913extern void xassert(const char *, const char *, int);
914MEMPROXY_CLASS_INLINE(HttpHeaderEntry)
915
43ae1d95 916/* http surogate control header field */
917
918struct _HttpHdrScTarget
919{
920 dlink_node node;
921 int mask;
922 int max_age;
923 int max_stale;
924 String content;
925 String target;
926};
927
928struct _HttpHdrSc
929{
930 dlink_list targets;
931};
932
62e76326 933struct _http_state_flags
934{
935
936unsigned int proxying:
937 1;
938
939unsigned int keepalive:
940 1;
941
942unsigned int only_if_cached:
943 1;
944
945unsigned int headers_pushed:
946 1;
947
948unsigned int front_end_https:
949 2;
950
951unsigned int originpeer:
952 1;
b515fc11 953};
a8258824 954
62e76326 955struct _ipcache_addrs
956{
957
6d1c0d53 958 struct in_addr *in_addrs;
959 unsigned char *bad_mask;
a8258824 960 unsigned char count;
961 unsigned char cur;
22c653cd 962 unsigned char badcount;
a8258824 963};
964
62e76326 965struct _domain_ping
966{
a8258824 967 char *domain;
968 int do_ping; /* boolean */
bd05e3e3 969 domain_ping *next;
a8258824 970};
971
62e76326 972struct _domain_type
973{
a8258824 974 char *domain;
975 peer_t type;
bd05e3e3 976 domain_type *next;
a8258824 977};
978
c68e9c6b 979#if USE_CACHE_DIGESTS
62e76326 980
981struct _Version
982{
4b4cd312 983 short int current; /* current version */
984 short int required; /* minimal version that can safely handle current version */
e41e6dcd 985};
986
987/* digest control block; used for transmission and storage */
62e76326 988
989struct _StoreDigestCBlock
990{
e41e6dcd 991 Version ver;
992 int capacity;
993 int count;
994 int del_count;
995 int mask_size;
04f0c415 996 unsigned char bits_per_entry;
997 unsigned char hash_func_count;
998 short int reserved_short;
4b4cd312 999 int reserved[32 - 6];
e41e6dcd 1000};
1001
62e76326 1002struct _DigestFetchState
1003{
e13ee7ad 1004 PeerDigest *pd;
e41e6dcd 1005 StoreEntry *entry;
1006 StoreEntry *old_entry;
06d2839d 1007 store_client *sc;
1008 store_client *old_sc;
190154cf 1009 HttpRequest *request;
e41e6dcd 1010 int offset;
1011 int mask_offset;
1012 time_t start_time;
e13ee7ad 1013 time_t resp_time;
1014 time_t expires;
62e76326 1015
1016 struct
1017 {
1018 int msg;
1019 int bytes;
1020 }
1021
1022 sent, recv;
add2192d 1023 char buf[SM_PAGE_SIZE];
3dfaa3d2 1024 ssize_t bufofs;
add2192d 1025 digest_read_state_t state;
e41e6dcd 1026};
1027
1028/* statistics for cache digests and other hit "predictors" */
62e76326 1029
1030struct _cd_guess_stats
1031{
e41e6dcd 1032 /* public, read-only */
1033 int true_hits;
1034 int false_hits;
1035 int true_misses;
1036 int false_misses;
4b4cd312 1037 int close_hits; /* tmp, remove it later */
e41e6dcd 1038};
1039
0353e724 1040class PeerDigest
62e76326 1041{
1042
0353e724 1043public:
1044 void *operator new (size_t);
1045 void operator delete(void *);
0353e724 1046
e6ccf245 1047 struct _peer *peer; /* pointer back to peer structure, argh */
4d62b0af 1048 CacheDigest *cd; /* actual digest structure */
1049 String host; /* copy of peer->host */
e13ee7ad 1050 const char *req_result; /* text status of the last request */
62e76326 1051
1052 struct
1053 {
1054
1055unsigned int needed:
1056 1; /* there were requests for this digest */
1057
1058unsigned int usable:
1059 1; /* can be used for lookups */
1060
1061unsigned int requested:
1062 1; /* in process of receiving [fresh] digest */
1063 }
1064
1065 flags;
1066
1067 struct
1068 {
1069 /* all times are absolute unless augmented with _delay */
1070 time_t initialized; /* creation */
1071 time_t needed; /* first lookup/use by a peer */
1072 time_t next_check; /* next scheduled check/refresh event */
1073 time_t retry_delay; /* delay before re-checking _invalid_ digest */
1074 time_t requested; /* requested a fresh copy of a digest */
1075 time_t req_delay; /* last request response time */
1076 time_t received; /* received the current copy of a digest */
1077 time_t disabled; /* disabled for good */
1078 }
1079
1080 times;
1081
1082 struct
1083 {
1084 cd_guess_stats guess;
1085 int used_count;
1086
1087 struct
1088 {
1089 int msgs;
1090 kb_t kbytes;
1091 }
1092
1093 sent, recv;
1094 }
1095
1096 stats;
0353e724 1097
1098private:
1099 CBDATA_CLASS(PeerDigest);
e41e6dcd 1100};
1101
c68e9c6b 1102#endif
1103
62e76326 1104struct _peer
1105{
be753325 1106 char *name;
a8258824 1107 char *host;
1108 peer_t type;
62e76326 1109
a8258824 1110 struct sockaddr_in in_addr;
62e76326 1111
1112 struct
1113 {
1114 int pings_sent;
1115 int pings_acked;
1116 int fetches;
1117 int rtt;
1118 int ignored_replies;
1119 int n_keepalives_sent;
1120 int n_keepalives_recv;
1121 time_t probe_start;
1122 time_t last_query;
1123 time_t last_reply;
1124 time_t last_connect_failure;
1125 time_t last_connect_probe;
1126 int logged_state; /* so we can print dead/revived msgs */
1127 int conn_open; /* current opened connections */
1128 }
1129
1130 stats;
1131
1132 struct
1133 {
1134 int version;
1135 int counts[ICP_END];
1136 u_short port;
1137 }
1138
1139 icp;
399cabec 1140#if USE_HTCP
62e76326 1141
1142 struct
1143 {
1144 double version;
1145 int counts[2];
1146 u_short port;
1147 }
1148
1149 htcp;
399cabec 1150#endif
62e76326 1151
a8258824 1152 u_short http_port;
b6a2f15e 1153 domain_ping *peer_domain;
bd05e3e3 1154 domain_type *typelist;
505e35db 1155 acl_access *access;
62e76326 1156
1157 struct
1158 {
1159
1160unsigned int proxy_only:
1161 1;
1162
1163unsigned int no_query:
1164 1;
1165
1166unsigned int background_ping:
1167 1;
1168
1169unsigned int no_digest:
1170 1;
1171
1172unsigned int default_parent:
1173 1;
1174
1175unsigned int roundrobin:
1176 1;
1177
1178unsigned int weighted_roundrobin:
1179 1;
1180
1181unsigned int mcast_responder:
1182 1;
1183
1184unsigned int closest_only:
1185 1;
cd196bc8 1186#if USE_HTCP
62e76326 1187
1188unsigned int htcp:
1189 1;
cd196bc8 1190#endif
62e76326 1191
1192unsigned int no_netdb_exchange:
1193 1;
cd196bc8 1194#if DELAY_POOLS
62e76326 1195
1196unsigned int no_delay:
1197 1;
cd196bc8 1198#endif
62e76326 1199
1200unsigned int allow_miss:
1201 1;
b3995439 1202#if USE_CARP
62e76326 1203
1204unsigned int carp:
1205 1;
b3995439 1206#endif
62e76326 1207
1208unsigned int originserver:
1209 1;
1210 }
1211
1212 options;
a8258824 1213 int weight;
d1b63fc8 1214 int basetime;
62e76326 1215
1216 struct
1217 {
1218 double avg_n_members;
1219 int n_times_counted;
1220 int n_replies_expected;
1221 int ttl;
1222 int id;
1223
1224 struct
1225 {
1226
1227unsigned int count_event_pending:
1228 1;
1229
1230unsigned int counting:
1231 1;
1232 }
1233
1234 flags;
1235 }
1236
1237 mcast;
c68e9c6b 1238#if USE_CACHE_DIGESTS
62e76326 1239
e13ee7ad 1240 PeerDigest *digest;
7e3ce7b9 1241 char *digest_url;
c68e9c6b 1242#endif
62e76326 1243
a8258824 1244 int tcp_up; /* 0 if a connect() fails */
62e76326 1245
a8258824 1246 struct in_addr addresses[10];
1247 int n_addresses;
1248 int rr_count;
82056f1e 1249 int rr_lastcount;
bd05e3e3 1250 peer *next;
a8258824 1251 int test_fd;
afd88fbe 1252#if USE_CARP
62e76326 1253
1254 struct
1255 {
1256 unsigned int hash;
1257 double load_multiplier;
1258 double load_factor; /* normalized weight value */
1259 }
1260
1261 carp;
afd88fbe 1262#endif
62e76326 1263
c68e9c6b 1264 char *login; /* Proxy authorization */
3f62decd 1265 time_t connect_timeout;
c7f9eb6d 1266 int max_conn;
be753325 1267 char *domain; /* Forced domain */
a7ad6e4e 1268#if USE_SSL
62e76326 1269
a7ad6e4e 1270 int use_ssl;
1271 char *sslcert;
1272 char *sslkey;
1273 int sslversion;
1274 char *ssloptions;
1275 char *sslcipher;
1276 char *sslcafile;
1277 char *sslcapath;
1278 char *sslflags;
1279 char *ssldomain;
1280 SSL_CTX *sslContext;
f38c5e43 1281 SSL_SESSION *sslSession;
a7ad6e4e 1282#endif
62e76326 1283
a7ad6e4e 1284 int front_end_https;
a8258824 1285};
1286
62e76326 1287struct _net_db_name
1288{
186477c1 1289 hash_link hash; /* must be first */
74fbf3c9 1290 net_db_name *next;
1291 netdbEntry *net_db_entry;
a8258824 1292};
1293
62e76326 1294struct _net_db_peer
1295{
6b53c392 1296 const char *peername;
a8258824 1297 double hops;
1298 double rtt;
1299 time_t expires;
1300};
1301
62e76326 1302struct _netdbEntry
1303{
186477c1 1304 hash_link hash; /* must be first */
a8258824 1305 char network[16];
1306 int pings_sent;
1307 int pings_recv;
1308 double hops;
1309 double rtt;
1310 time_t next_ping_time;
1311 time_t last_use_time;
1312 int link_count;
1313 net_db_name *hosts;
1314 net_db_peer *peers;
1315 int n_peers_alloc;
1316 int n_peers;
1317};
1318
a8258824 1319
6b53c392 1320#if USE_ICMP
62e76326 1321
1322struct _pingerEchoData
1323{
1324
a8258824 1325 struct in_addr to;
1326 unsigned char opcode;
1327 int psize;
65ae9f56 1328 char payload[PINGER_PAYLOAD_SZ];
a8258824 1329};
1330
62e76326 1331struct _pingerReplyData
1332{
1333
a8258824 1334 struct in_addr from;
1335 unsigned char opcode;
1336 int rtt;
1337 int hops;
1338 int psize;
65ae9f56 1339 char payload[PINGER_PAYLOAD_SZ];
a8258824 1340};
a4b8110e 1341
6b53c392 1342#endif
a8258824 1343
62e76326 1344struct _iostats
1345{
1346
1347 struct
1348 {
1349 int reads;
1350 int reads_deferred;
1351 int read_hist[16];
1352 int writes;
1353 int write_hist[16];
1354 }
1355
1356 Http, Ftp, Gopher, Wais;
a8258824 1357};
1358
6a566b9c 1359/* Removal policies */
1360
62e76326 1361struct _RemovalPolicyNode
1362{
6a566b9c 1363 void *data;
1364};
1365
62e76326 1366struct _RemovalPolicy
1367{
c193c972 1368 const char *_type;
6a566b9c 1369 void *_data;
c1dd71ae 1370 void (*Free) (RemovalPolicy * policy);
1371 void (*Add) (RemovalPolicy * policy, StoreEntry * entry, RemovalPolicyNode * node);
1372 void (*Remove) (RemovalPolicy * policy, StoreEntry * entry, RemovalPolicyNode * node);
1373 void (*Referenced) (RemovalPolicy * policy, const StoreEntry * entry, RemovalPolicyNode * node);
1374 void (*Dereferenced) (RemovalPolicy * policy, const StoreEntry * entry, RemovalPolicyNode * node);
1375 RemovalPolicyWalker *(*WalkInit) (RemovalPolicy * policy);
1376 RemovalPurgeWalker *(*PurgeInit) (RemovalPolicy * policy, int max_scan);
8a3e7d9e 1377 void (*Stats) (RemovalPolicy * policy, StoreEntry * entry);
6a566b9c 1378};
1379
62e76326 1380struct _RemovalPolicyWalker
1381{
6a566b9c 1382 RemovalPolicy *_policy;
1383 void *_data;
c1dd71ae 1384 const StoreEntry *(*Next) (RemovalPolicyWalker * walker);
1385 void (*Done) (RemovalPolicyWalker * walker);
6a566b9c 1386};
1387
62e76326 1388struct _RemovalPurgeWalker
1389{
6a566b9c 1390 RemovalPolicy *_policy;
1391 void *_data;
1392 int scanned, max_scan, locked;
c1dd71ae 1393 StoreEntry *(*Next) (RemovalPurgeWalker * walker);
1394 void (*Done) (RemovalPurgeWalker * walker);
6a566b9c 1395};
1396
62e76326 1397struct request_flags
1398{
d048c262 1399 request_flags():range(0),nocache(0),ims(0),auth(0),cachable(0),hierarchical(0),loopdetect(0),proxy_keepalive(0),proxying(0),refresh(0),redirected(0),need_validation(0),accelerated(0),transparent(0),internal(0),internalclient(0),body_sent(0),destinationIPLookedUp_(0)
62e76326 1400 {
e429f975 1401#if HTTP_VIOLATIONS
72eee553 1402 nocache_hack = 0;
e429f975 1403#endif
62e76326 1404
1405 }
1406
1407unsigned int range:
1408 1;
1409
1410unsigned int nocache:
1411 1;
1412
1413unsigned int ims:
1414 1;
1415
1416unsigned int auth:
1417 1;
1418
1419unsigned int cachable:
1420 1;
1421
1422unsigned int hierarchical:
1423 1;
1424
1425unsigned int loopdetect:
1426 1;
1427
1428unsigned int proxy_keepalive:
1429 1;
1430
1431unsigned int proxying:
1432 1; /* this should be killed, also in httpstateflags */
1433
1434unsigned int refresh:
1435 1;
1436
1437unsigned int redirected:
1438 1;
1439
1440unsigned int need_validation:
1441 1;
9f60cfdf 1442#if HTTP_VIOLATIONS
62e76326 1443
1444unsigned int nocache_hack:
1445 1; /* for changing/ignoring no-cache requests */
9f60cfdf 1446#endif
62e76326 1447
1448unsigned int accelerated:
1449 1;
1450
d048c262 1451unsigned int transparent:
1452 1;
1453
62e76326 1454unsigned int internal:
1455 1;
1456
1457unsigned int internalclient:
1458 1;
1459
1460unsigned int body_sent:
1461 1;
e429f975 1462 bool resetTCP() const;
1463 void setResetTCP();
1464 void clearResetTCP();
8000a965 1465 void destinationIPLookupCompleted();
1466 bool destinationIPLookedUp() const;
62e76326 1467
e429f975 1468private:
62e76326 1469
1470unsigned int reset_tcp:
1471 1;
1472
1473unsigned int destinationIPLookedUp_:
1474 1;
92695e5e 1475};
1476
62e76326 1477struct _link_list
1478{
d03d26fb 1479 void *ptr;
62e76326 1480
d03d26fb 1481 struct _link_list *next;
1482};
1483
62e76326 1484struct _cachemgr_passwd
1485{
a8258824 1486 char *passwd;
22f3fd98 1487 wordlist *actions;
bd05e3e3 1488 cachemgr_passwd *next;
a8258824 1489};
1490
62e76326 1491struct _refresh_t
1492{
a2c963ae 1493 const char *pattern;
a8258824 1494 regex_t compiled_pattern;
1495 time_t min;
c3f6d204 1496 double pct;
a8258824 1497 time_t max;
bd05e3e3 1498 refresh_t *next;
62e76326 1499
1500 struct
1501 {
1502
1503unsigned int icase:
1504 1;
9f60cfdf 1505#if HTTP_VIOLATIONS
62e76326 1506
1507unsigned int override_expire:
1508 1;
1509
1510unsigned int override_lastmod:
1511 1;
1512
1513unsigned int reload_into_ims:
1514 1;
1515
1516unsigned int ignore_reload:
1517 1;
9f60cfdf 1518#endif
62e76326 1519
1520 }
1521
1522 flags;
a8258824 1523};
1524
62e76326 1525struct _CommWriteStateData
1526{
a8258824 1527 char *buf;
1528 size_t size;
1529 off_t offset;
1530 CWCB *handler;
1531 void *handler_data;
74fbf3c9 1532 FREE *free_func;
a8258824 1533};
9b312a19 1534
62e76326 1535struct _ErrorState
1536{
9b312a19 1537 err_type type;
02922e76 1538 int page_id;
29b8d8d6 1539 http_status httpStatus;
94439e4e 1540 auth_user_request_t *auth_user_request;
190154cf 1541 HttpRequest *request;
9b312a19 1542 char *url;
c45ed9ad 1543 int xerrno;
9b312a19 1544 char *host;
1545 u_short port;
1546 char *dnsserver_msg;
1547 time_t ttl;
62e76326 1548
9b312a19 1549 struct in_addr src_addr;
1550 char *redirect_url;
1551 ERCB *callback;
1552 void *callback_data;
62e76326 1553
1554 struct
1555 {
1556
1557unsigned int flag_cbdata:
1558 1;
1559 }
1560
1561 flags;
1562
1563 struct
1564 {
1565 wordlist *server_msg;
1566 char *request;
1567 char *reply;
1568 }
1569
1570 ftp;
e144eae4 1571 char *request_hdrs;
43ae1d95 1572 char *err_msg; /* Preformatted error message from the cache */
9b312a19 1573};
f2908497 1574
12cf1be2 1575/*
1576 * "very generic" histogram;
1577 * see important comments on hbase_f restrictions in StatHist.c
1578 */
62e76326 1579
1580struct _StatHist
1581{
12cf1be2 1582 int *bins;
1583 int capacity;
e9a13293 1584 double min;
1585 double max;
1586 double scale;
95c297ec 1587 hbase_f *val_in; /* e.g., log() for log-based histogram */
1588 hbase_f *val_out; /* e.g., exp() for log based histogram */
7ae52c25 1589};
1590
12cf1be2 1591/*
1592 * if you add a field to StatCounters,
1d803566 1593 * you MUST sync statCountersInitSpecial, statCountersClean, and statCountersCopy
12cf1be2 1594 */
62e76326 1595
1596struct _StatCounters
1597{
1598
1599 struct
1600 {
1601 int clients;
1602 int requests;
1603 int hits;
1604 int mem_hits;
1605 int disk_hits;
1606 int errors;
1607 kb_t kbytes_in;
1608 kb_t kbytes_out;
1609 kb_t hit_kbytes_out;
1610 StatHist miss_svc_time;
1611 StatHist nm_svc_time;
1612 StatHist nh_svc_time;
1613 StatHist hit_svc_time;
1614 StatHist all_svc_time;
1615 }
1616
1617 client_http;
1618
1619 struct
1620 {
1621
1622 struct
1623 {
1624 int requests;
1625 int errors;
1626 kb_t kbytes_in;
1627 kb_t kbytes_out;
1628 }
1629
1630 all , http, ftp, other;
1631 }
1632
1633 server;
1634
1635 struct
1636 {
1637 int pkts_sent;
1638 int queries_sent;
1639 int replies_sent;
1640 int pkts_recv;
1641 int queries_recv;
1642 int replies_recv;
1643 int hits_sent;
1644 int hits_recv;
1645 int replies_queued;
1646 int replies_dropped;
1647 kb_t kbytes_sent;
1648 kb_t q_kbytes_sent;
1649 kb_t r_kbytes_sent;
1650 kb_t kbytes_recv;
1651 kb_t q_kbytes_recv;
1652 kb_t r_kbytes_recv;
1653 StatHist query_svc_time;
1654 StatHist reply_svc_time;
1655 int query_timeouts;
1656 int times_used;
1657 }
1658
1659 icp;
1660
c4ebc830 1661 struct
1662 {
1663 int pkts_sent;
1664 int pkts_recv;
1665 }
1666
1667 htcp;
1668
62e76326 1669 struct
1670 {
1671 int requests;
1672 }
1673
1674 unlink;
1675
1676 struct
1677 {
1678 StatHist svc_time;
1679 }
1680
1681 dns;
1682
1683 struct
1684 {
1685 int times_used;
1686 kb_t kbytes_sent;
1687 kb_t kbytes_recv;
1688 kb_t memory;
1689 int msgs_sent;
1690 int msgs_recv;
c68e9c6b 1691#if USE_CACHE_DIGESTS
62e76326 1692
1693 cd_guess_stats guess;
c68e9c6b 1694#endif
62e76326 1695
1696 StatHist on_xition_count;
1697 }
1698
1699 cd;
1700
1701 struct
1702 {
1703 int times_used;
1704 }
1705
1706 netdb;
f2908497 1707 int page_faults;
1708 int select_loops;
d239c2f5 1709 int select_fds;
1710 double select_time;
f2908497 1711 double cputime;
62e76326 1712
d5649d9f 1713 struct timeval timestamp;
c6ecdbc3 1714 StatHist comm_icp_incoming;
ef523f99 1715 StatHist comm_dns_incoming;
c6ecdbc3 1716 StatHist comm_http_incoming;
26d6ee93 1717 StatHist select_fds_hist;
62e76326 1718
1719 struct
1720 {
1721
1722 struct
1723 {
1724 int opens;
1725 int closes;
1726 int reads;
1727 int writes;
1728 int seeks;
1729 int unlinks;
1730 }
1731
1732 disk;
1733
1734 struct
1735 {
1736 int accepts;
1737 int sockets;
1738 int connects;
1739 int binds;
1740 int closes;
1741 int reads;
1742 int writes;
1743 int recvfroms;
1744 int sendtos;
1745 }
1746
1747 sock;
886f2785 1748#if HAVE_POLL
62e76326 1749
1750 int polls;
886f2785 1751#else
62e76326 1752
1753 int selects;
886f2785 1754#endif
62e76326 1755
1756 }
1757
1758 syscalls;
bfae3379 1759 int aborted_requests;
62e76326 1760
1761 struct
1762 {
1763 int files_cleaned;
1764 int outs;
1765 int ins;
1766 }
1767
1768 swap;
f2908497 1769};
69c01cd7 1770
fcd2d3ef 1771/* per header statistics */
62e76326 1772
1773struct _HttpHeaderStat
1774{
fcd2d3ef 1775 const char *label;
1776 HttpHeaderMask *owner_mask;
1777
1778 StatHist hdrUCountDistr;
1779 StatHist fieldTypeDistr;
1780 StatHist ccTypeDistr;
43ae1d95 1781 StatHist scTypeDistr;
fcd2d3ef 1782
1783 int parsedCount;
1784 int ccParsedCount;
43ae1d95 1785 int scParsedCount;
fcd2d3ef 1786 int destroyedCount;
1787 int busyDestroyedCount;
1788};
1789
59c4d35b 1790
62e76326 1791struct _ClientInfo
1792{
186477c1 1793 hash_link hash; /* must be first */
62e76326 1794
59c4d35b 1795 struct in_addr addr;
62e76326 1796
1797 struct
1798 {
1799 int result_hist[LOG_TYPE_MAX];
1800 int n_requests;
1801 kb_t kbytes_in;
1802 kb_t kbytes_out;
1803 kb_t hit_kbytes_out;
1804 }
1805
1806 Http, Icp;
1807
1808 struct
1809 {
1810 time_t time;
1811 int n_req;
1812 int n_denied;
1813 }
1814
1815 cutoff;
9bc73deb 1816 int n_established; /* number of current established connections */
59c4d35b 1817};
c411be12 1818
62e76326 1819struct _CacheDigest
1820{
c411be12 1821 /* public, read-only */
1afe05c5 1822 char *mask; /* bit mask */
1823 size_t mask_size; /* mask size in bytes */
1824 int capacity; /* expected maximum for .count, not a hard limit */
04f0c415 1825 int bits_per_entry; /* number of bits allocated for each entry from capacity */
1afe05c5 1826 int count; /* number of digested entries */
1827 int del_count; /* number of deletions performed so far */
c411be12 1828};
910169e5 1829
62e76326 1830struct _FwdServer
1831{
29b8d8d6 1832 peer *_peer; /* NULL --> origin server */
db1cd23c 1833 hier_code code;
1834 FwdServer *next;
1835};
1836
62e76326 1837struct _FwdState
1838{
910169e5 1839 int client_fd;
1840 StoreEntry *entry;
190154cf 1841 HttpRequest *request;
910169e5 1842 FwdServer *servers;
6801f8a8 1843 int server_fd;
ec250dfd 1844 ErrorState *err;
f563eea9 1845 time_t start;
68bd6892 1846 int n_tries;
4ed0e075 1847 int origin_tries;
225644d7 1848#if WIP_FWD_LOG
62e76326 1849
225644d7 1850 http_status last_status;
1851#endif
62e76326 1852
1853 struct
1854 {
1855
1856unsigned int dont_retry:
1857 1;
1858
1859unsigned int ftp_pasv_failed:
1860 1;
1861 }
1862
1863 flags;
910169e5 1864};
1865
51ee7c82 1866class helper_request;
94439e4e 1867
62e76326 1868struct _helper
1869{
74addf6c 1870 wordlist *cmdline;
1871 dlink_list servers;
1872 dlink_list queue;
1f5f60dd 1873 const char *id_name;
74addf6c 1874 int n_to_start;
1875 int n_running;
1876 int ipc_type;
07eca7e0 1877 unsigned int concurrency;
74addf6c 1878 time_t last_queue_warn;
62e76326 1879
1880 struct
1881 {
1882 int requests;
1883 int replies;
1884 int queue_size;
1885 int avg_svc_time;
1886 }
1887
1888 stats;
74addf6c 1889};
1890
62e76326 1891struct _helper_stateful
1892{
94439e4e 1893 wordlist *cmdline;
1894 dlink_list servers;
1895 dlink_list queue;
1896 const char *id_name;
1897 int n_to_start;
1898 int n_running;
1899 int ipc_type;
b001e822 1900 MemAllocatorProxy *datapool;
94439e4e 1901 HLPSAVAIL *IsAvailable;
1902 HLPSONEQ *OnEmptyQueue;
1903 time_t last_queue_warn;
62e76326 1904
1905 struct
1906 {
1907 int requests;
1908 int replies;
1909 int queue_size;
1910 int avg_svc_time;
1911 }
1912
1913 stats;
94439e4e 1914};
1915
62e76326 1916struct _helper_server
1917{
74addf6c 1918 int index;
7d2bd2b5 1919 int pid;
74addf6c 1920 int rfd;
1921 int wfd;
07eca7e0 1922 MemBuf wqueue;
1923 MemBuf writebuf;
1924 char *rbuf;
1925 size_t rbuf_sz;
1926 off_t roffset;
62e76326 1927
74addf6c 1928 dlink_node link;
1929 helper *parent;
07eca7e0 1930 helper_request **requests;
62e76326 1931
1932 struct _helper_flags
1933 {
1934
07eca7e0 1935unsigned int writing:
62e76326 1936 1;
1937
07eca7e0 1938unsigned int alive:
62e76326 1939 1;
1940
1941unsigned int closing:
1942 1;
1943
1944unsigned int shutdown:
1945 1;
1946 }
1947
1948 flags;
1949
1950 struct
1951 {
1952 int uses;
07eca7e0 1953 unsigned int pending;
62e76326 1954 }
1955
1956 stats;
74addf6c 1957};
1958
51ee7c82 1959class helper_stateful_request;
94439e4e 1960
62e76326 1961struct _helper_stateful_server
1962{
94439e4e 1963 int index;
5d146f7d 1964 int pid;
94439e4e 1965 int rfd;
1966 int wfd;
07eca7e0 1967 /* MemBuf wqueue; */
1968 /* MemBuf writebuf; */
1969 char *rbuf;
1970 size_t rbuf_sz;
1971 off_t roffset;
62e76326 1972
94439e4e 1973 struct timeval dispatch_time;
62e76326 1974
94439e4e 1975 struct timeval answer_time;
1976 dlink_node link;
1977 dlink_list queue;
1978 statefulhelper *parent;
1979 helper_stateful_request *request;
62e76326 1980
1981 struct _helper_stateful_flags
1982 {
1983
1984unsigned int alive:
1985 1;
1986
1987unsigned int busy:
1988 1;
1989
1990unsigned int closing:
1991 1;
1992
1993unsigned int shutdown:
1994 1;
1995 stateful_helper_reserve_t reserved;
1996 }
1997
1998 flags;
1999
2000 struct
2001 {
2002 int uses;
2003 int submits;
2004 int releases;
2005 int deferbyfunc;
2006 int deferbycb;
2007 }
2008
2009 stats;
32754419 2010 int deferred_requests; /* current number of deferred requests */
94439e4e 2011 void *data; /* State data used by the calling routines */
2012};
2013
74addf6c 2014/*
2015 * use this when you need to pass callback data to a blocking
2016 * operation, but you don't want to add that pointer to cbdata
2017 */
62e76326 2018
2019struct _generic_cbdata
2020{
74addf6c 2021 void *data;
2022};
b2c141d4 2023
62e76326 2024struct _store_rebuild_data
2025{
b2c141d4 2026 int objcount; /* # objects successfully reloaded */
2027 int expcount; /* # objects expired */
2028 int scancount; /* # entries scanned or read from state file */
2029 int clashcount; /* # swapfile clashes avoided */
2030 int dupcount; /* # duplicates purged */
2031 int cancelcount; /* # SWAP_LOG_DEL objects purged */
2032 int invalid; /* # bad lines */
2033 int badflags; /* # bad e->flags */
2034 int bad_log_op;
2035 int zero_object_sz;
2036};
5673c2e2 2037
22d38e05 2038/*
2039 * This defines an repl type
2040 */
2041
62e76326 2042struct _storerepl_entry
2043{
a2c963ae 2044 const char *typestr;
22d38e05 2045 REMOVALPOLICYCREATE *create;
2046};
2047
cd748f27 2048/*
2049 * Async disk IO - this defines a async disk io queue
2050 */
2051
62e76326 2052struct _diskd_queue
2053{
cd748f27 2054 int smsgid; /* send sysvmsg id */
2055 int rmsgid; /* recv sysvmsg id */
2056 int wfd; /* queue file descriptor ? */
2057 int away; /* number of requests away */
2058 int sent_count; /* number of messages sent */
2059 int recv_count; /* number of messages received */
62e76326 2060
2061 struct
2062 {
2063 char *buf; /* shm buffer */
2064 link_list *stack;
2065 int id; /* sysvshm id */
2066 }
2067
2068 shm;
cd748f27 2069};
2070
62e76326 2071struct _Logfile
2072{
5673c2e2 2073 int fd;
2074 char path[MAXPATHLEN];
2075 char *buf;
2076 size_t bufsz;
2077 off_t offset;
62e76326 2078
2079 struct
2080 {
2081
2082unsigned int fatal:
2083 1;
2084 }
2085
2086 flags;
5673c2e2 2087};
8e8d4f30 2088
7684c4b1 2089struct _logformat
2090{
2091 char *name;
2092 logformat_token *format;
2093 logformat *next;
2094};
2095
2096struct _customlog
2097{
2098 char *filename;
2099 acl_list *aclList;
2100 logformat *logFormat;
2101 Logfile *logfile;
2102 customlog *next;
2103 customlog_type type;
2104};
2105
62e76326 2106struct cache_dir_option
2107{
c193c972 2108 const char *name;
8e8d4f30 2109 void (*parse) (SwapDir * sd, const char *option, const char *value, int reconfiguring);
d3b3ab85 2110 void (*dump) (StoreEntry * e, const char *option, SwapDir const * sd);
8e8d4f30 2111};
b5638623 2112
2113#endif /* SQUID_STRUCTS_H */