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