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