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