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