]> git.ipfire.org Git - thirdparty/squid.git/blame - src/structs.h
Disable the dyn & tmp hardcoded settings to allow doxygen to be used
[thirdparty/squid.git] / src / structs.h
CommitLineData
a8258824 1
9cef6668 2/*
4c9da963 3 * $Id: structs.h,v 1.575 2008/02/11 22:28:47 rousskov 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"
4c9da963 39#include "cbdata.h"
0009ba2f 40
25b6a907 41/* needed for various structures still in structs.h */
42#include "dlink.h"
43/* needed for the global config */
44#include "HttpHeader.h"
0f1bc304 45
62e76326 46struct _acl_name_list
47{
a8258824 48 char name[ACL_NAME_SZ];
74fbf3c9 49 acl_name_list *next;
a8258824 50};
51
62e76326 52struct _acl_deny_info_list
53{
e6ccf245 54 err_type err_page_id;
02922e76 55 char *err_page_name;
74fbf3c9 56 acl_name_list *acl_list;
57 acl_deny_info_list *next;
a8258824 58};
59
02922e76 60
8000a965 61class acl_access;
62e76326 62
63struct _header_mangler
64{
6bccf575 65 acl_access *access_list;
66 char *replacement;
67};
68
1df370e3 69#if SQUID_SNMP
43d4303e 70
62e76326 71struct _snmp_request_t
72{
5e29a294 73 u_char *buf;
74 u_char *outbuf;
2ac76861 75 int len;
76 int sock;
77 long reqid;
78 int outlen;
62e76326 79
cc192b50 80 IPAddress from;
62e76326 81
2ac76861 82 struct snmp_pdu *PDU;
4fb35c3c 83 ACLChecklist *acl_checklist;
5e29a294 84 u_char *community;
0536fdfc 85
86 struct snmp_session session;
a9ddb359 87};
bdf18524 88
1df370e3 89#endif
a97cfa48 90
a8258824 91
62e76326 92struct _acl_address
93{
d6827718 94 acl_address *next;
76cd39d7 95 ACLList *aclList;
62e76326 96
cc192b50 97 IPAddress addr;
d6827718 98};
99
62e76326 100struct _acl_tos
101{
d6827718 102 acl_tos *next;
76cd39d7 103 ACLList *aclList;
d6827718 104 int tos;
105};
106
ef1955a5 107struct _acl_size_t
108{
109 acl_size_t *next;
76cd39d7 110 ACLList *aclList;
47f6e231 111 int64_t size;
ef1955a5 112};
113
62e76326 114struct _ushortlist
115{
a8258824 116 u_short i;
bd05e3e3 117 ushortlist *next;
a8258824 118};
119
62e76326 120struct _relist
121{
a8258824 122 char *pattern;
123 regex_t regex;
bd05e3e3 124 relist *next;
a8258824 125};
126
56e64999 127#if DELAY_POOLS
b67e2c8c 128#include "DelayConfig.h"
56e64999 129#endif
95e36d02 130
cc192b50 131#if USE_ICMP
132#include "ICMPConfig.h"
133#endif
134
aa839030 135/* forward decl for SquidConfig, see RemovalPolicy.h */
b7d249f9 136
aa839030 137class RemovalPolicySettings;
d598ee28 138
6a566b9c 139
1e5562e3 140class external_acl;
141
c8f4eac4 142class Store;
143
62e76326 144struct _SquidConfig
145{
146
147 struct
148 {
c8f4eac4 149 /* These should be for the Store::Root instance.
150 * this needs pluggable parsing to be done smoothly.
151 */
62e76326 152 int highWaterMark;
153 int lowWaterMark;
154 }
155
156 Swap;
43a70238 157 size_t memMaxSize;
62e76326 158
62e76326 159 struct
160 {
47f6e231 161 int64_t min;
62e76326 162 int pct;
47f6e231 163 int64_t max;
62e76326 164 }
165
166 quickAbort;
47f6e231 167 int64_t readAheadGap;
6a566b9c 168 RemovalPolicySettings *replPolicy;
169 RemovalPolicySettings *memPolicy;
a8258824 170 time_t negativeTtl;
171 time_t negativeDnsTtl;
172 time_t positiveDnsTtl;
173 time_t shutdownLifetime;
d1b63fc8 174 time_t backgroundPingRate;
62e76326 175
176 struct
177 {
178 time_t read;
179 time_t lifetime;
180 time_t connect;
777831e0 181 time_t forward;
62e76326 182 time_t peer_connect;
183 time_t request;
184 time_t persistent_request;
185 time_t pconn;
186 time_t siteSelect;
187 time_t deadPeer;
188 int icp_query; /* msec */
189 int icp_query_max; /* msec */
190 int icp_query_min; /* msec */
191 int mcast_icp_query; /* msec */
3898f57f 192#if USE_IDENT
62e76326 193
194 time_t ident;
4fe0e1d0 195#endif
196#if !USE_DNSSERVERS
62e76326 197
198 time_t idns_retransmit;
199 time_t idns_query;
3898f57f 200#endif
62e76326 201
202 }
203
204 Timeout;
0483b991 205 size_t maxRequestHeaderSize;
47f6e231 206 int64_t maxRequestBodySize;
4eb368f9 207 size_t maxReplyHeaderSize;
ef1955a5 208 acl_size_t *ReplyBodySize;
62e76326 209
210 struct
211 {
212 u_short icp;
ace287ee 213#if USE_HTCP
62e76326 214
215 u_short htcp;
ace287ee 216#endif
1df370e3 217#if SQUID_SNMP
62e76326 218
219 u_short snmp;
1df370e3 220#endif
62e76326 221
222 }
223
224 Port;
225
226 struct
227 {
228 http_port_list *http;
1f7c9178 229#if USE_SSL
62e76326 230
231 https_port_list *https;
1f7c9178 232#endif
62e76326 233
234 }
235
236 Sockaddr;
1df370e3 237#if SQUID_SNMP
62e76326 238
239 struct
240 {
241 char *configFile;
242 char *agentInfo;
243 }
244
245 Snmp;
320e9f36 246#endif
eb824054 247#if USE_WCCP
62e76326 248
249 struct
250 {
251
cc192b50 252 IPAddress router;
62e76326 253
cc192b50 254 IPAddress address;
62e76326 255 int version;
256 }
257
258 Wccp;
1df370e3 259#endif
0b0cfcf2 260#if USE_WCCPv2
261
262 struct
263 {
cc192b50 264 IPAddress_list *router;
0b0cfcf2 265
cc192b50 266 IPAddress address;
0b0cfcf2 267 int forwarding_method;
268 int return_method;
b7d249f9 269 int assignment_method;
270 int weight;
f67332d3 271 int rebuildwait;
0b0cfcf2 272 void *info;
273 }
274
275 Wccp2;
276#endif
62e76326 277
cc192b50 278#if USE_ICMP
279 ICMPConfig pinger;
280#endif
281
53ad48e6 282 char *as_whois_server;
62e76326 283
284 struct
285 {
286 char *log;
62e76326 287 char *store;
288 char *swap;
82839306 289#if USE_USERAGENT_LOG
62e76326 290
291 char *useragent;
fd2c5549 292#endif
293#if USE_REFERER_LOG
62e76326 294
295 char *referer;
225644d7 296#endif
297#if WIP_FWD_LOG
62e76326 298
299 char *forward;
82839306 300#endif
62e76326 301
7684c4b1 302 logformat *logformats;
303
304 customlog *accesslogs;
305
62e76326 306 int rotateNumber;
307 }
308
309 Log;
a8258824 310 char *adminEmail;
abacf776 311 char *EmailFrom;
d084bf20 312 char *EmailProgram;
a8258824 313 char *effectiveUser;
d3caee79 314 char *visible_appname_string;
a8258824 315 char *effectiveGroup;
62e76326 316
317 struct
318 {
82839306 319#if USE_DNSSERVERS
62e76326 320 char *dnsserver;
efd900cb 321#endif
62e76326 322
323 wordlist *redirect;
a3d0a19d 324#if USE_UNLINKD
62e76326 325
326 char *unlinkd;
a3d0a19d 327#endif
62e76326 328
329 char *diskd;
307b83b7 330#if USE_SSL
331
332 char *ssl_password;
333#endif
334
62e76326 335 }
336
337 Program;
82839306 338#if USE_DNSSERVERS
62e76326 339
a8258824 340 int dnsChildren;
efd900cb 341#endif
62e76326 342
a8258824 343 int redirectChildren;
07eca7e0 344 int redirectConcurrency;
94439e4e 345 time_t authenticateGCInterval;
70a76033 346 time_t authenticateTTL;
347 time_t authenticateIpTTL;
43ae1d95 348
349 struct
350 {
f41735ea 351#if USE_SQUID_ESI
43ae1d95 352 char *surrogate_id;
353#endif
354
355 }
356
357 Accel;
a8258824 358 char *appendDomain;
359 size_t appendDomainLen;
360 char *debugOptions;
361 char *pidFilename;
2b753521 362 char *netdbFilename;
a8258824 363 char *mimeTablePathname;
0e70aa1e 364 char *etcHostsPath;
a8258824 365 char *visibleHostname;
98829f69 366 char *uniqueHostname;
1f38f50a 367 wordlist *hostnameAliases;
a8258824 368 char *errHtmlText;
62e76326 369
370 struct
371 {
372 char *host;
373 char *file;
374 time_t period;
375 u_short port;
376 }
377
378 Announce;
379
380 struct
381 {
382
cc192b50 383 IPAddress udp_incoming;
62e76326 384
cc192b50 385 IPAddress udp_outgoing;
15dcc168 386#if SQUID_SNMP
62e76326 387
cc192b50 388 IPAddress snmp_incoming;
62e76326 389
cc192b50 390 IPAddress snmp_outgoing;
15dcc168 391#endif
cc192b50 392 /* FIXME INET6 : this should really be a CIDR value */
393 IPAddress client_netmask;
62e76326 394 }
395
396 Addrs;
9906e724 397 size_t tcpRcvBufsz;
398 size_t udpMaxHitObjsz;
a8258824 399 wordlist *hierarchy_stoplist;
400 wordlist *mcast_group_list;
401 wordlist *dns_testname_list;
09c483ec 402 wordlist *dns_nameservers;
40a1495e 403 peer *peers;
404 int npeers;
62e76326 405
406 struct
407 {
408 int size;
409 int low;
410 int high;
411 }
412
413 ipcache;
414
415 struct
416 {
417 int size;
418 }
419
420 fqdncache;
a8258824 421 int minDirectHops;
5f84d830 422 int minDirectRtt;
a8258824 423 cachemgr_passwd *passwd_list;
62e76326 424
425 struct
426 {
427 int objectsPerBucket;
3e62bd58 428 int64_t avgObjectSize;
47f6e231 429 int64_t maxObjectSize;
430 int64_t minObjectSize;
62e76326 431 size_t maxInMemObjSize;
432 }
433
434 Store;
435
436 struct
437 {
438 int high;
439 int low;
440 time_t period;
441 }
442
443 Netdb;
444
445 struct
446 {
447 int log_udp;
62e76326 448 int res_defnames;
62e76326 449 int anonymizer;
450 int client_db;
451 int query_icmp;
452 int icp_hit_stale;
453 int buffered_logs;
62e76326 454 int common_log;
455 int log_mime_hdrs;
456 int log_fqdn;
457 int announce;
458 int mem_pools;
459 int test_reachability;
460 int half_closed_clients;
4c3ef9b2 461 int refresh_all_ims;
9f60cfdf 462#if HTTP_VIOLATIONS
62e76326 463
464 int reload_into_ims;
9f60cfdf 465#endif
62e76326 466
467 int offline;
468 int redir_rewrites_host;
469 int prefer_direct;
470 int nonhierarchical_direct;
471 int strip_query_terms;
472 int redirector_bypass;
473 int ignore_unknown_nameservers;
474 int client_pconns;
475 int server_pconns;
58850d15 476 int error_pconns;
7e3ce7b9 477#if USE_CACHE_DIGESTS
62e76326 478
479 int digest_generation;
7e3ce7b9 480#endif
62e76326 481
482 int log_ip_on_direct;
483 int ie_refresh;
484 int vary_ignore_expire;
485 int pipeline_prefetch;
f41735ea 486#if USE_SQUID_ESI
43ae1d95 487
488 int surrogate_is_remote;
489#endif
490
62e76326 491 int request_entities;
21b92762 492 int detect_broken_server_pconns;
a12a049a 493 int balance_on_multiple_ip;
52d3f198 494 int relaxed_header_parser;
62e76326 495 int check_hostnames;
a78278e2 496 int allow_underscore;
62e76326 497 int via;
498 int emailErrData;
d3caee79 499 int httpd_suppress_version_string;
f024c970 500 int global_internal_static;
cc192b50 501 int dns_require_A;
37296f4c 502 int debug_override_X;
62e76326 503 }
504
505 onoff;
97427e90 506
507 class ACL *aclList;
62e76326 508
509 struct
510 {
511 acl_access *http;
512 acl_access *icp;
513 acl_access *miss;
514 acl_access *NeverDirect;
515 acl_access *AlwaysDirect;
516 acl_access *ASlists;
517 acl_access *noCache;
7684c4b1 518 acl_access *log;
dba79ac5 519#if SQUID_SNMP
62e76326 520
521 acl_access *snmp;
dba79ac5 522#endif
62e76326 523
524 acl_access *brokenPosts;
3898f57f 525#if USE_IDENT
62e76326 526
527 acl_access *identLookup;
3898f57f 528#endif
62e76326 529
530 acl_access *redirector;
531 acl_access *reply;
532 acl_address *outgoing_address;
533 acl_tos *outgoing_tos;
057f5854 534 acl_tos *clientside_tos;
5401aa8d 535#if USE_HTCP
536
537 acl_access *htcp;
538 acl_access *htcp_clr;
539#endif
4c9da963 540
541#if USE_SSL
542 acl_access *ssl_bump;
543#endif
5401aa8d 544
62e76326 545 }
546
547 accessList;
bd05e3e3 548 acl_deny_info_list *denyInfoList;
e6ccf245 549 authConfig authConfiguration;
62e76326 550
551 struct
552 {
553 size_t list_width;
554 int list_wrap;
555 char *anon_user;
556 int passive;
a689bd4e 557 int epsv_all;
62e76326 558 int sanitycheck;
dad0fe12 559 int telnet;
62e76326 560 }
561
562 Ftp;
a8258824 563 refresh_t *Refresh;
62e76326 564
565 struct _cacheSwap
566 {
c8f4eac4 567 RefCount<class Store> *swapDirs;
62e76326 568 int n_allocated;
569 int n_configured;
570 }
571
572 cacheSwap;
573
574 struct
575 {
576 char *directory;
e72a0ec0 577 int use_short_names;
62e76326 578 }
579
580 icons;
9b312a19 581 char *errorDirectory;
62e76326 582
583 struct
584 {
62e76326 585 int maxtries;
5894ad28 586 int onerror;
62e76326 587 }
588
589 retry;
590
591 struct
592 {
593 size_t limit;
594 }
595
596 MemPools;
95e36d02 597#if DELAY_POOLS
62e76326 598
b67e2c8c 599 DelayConfig Delay;
95e36d02 600#endif
62e76326 601
602 struct
603 {
604 int icp_average;
605 int dns_average;
606 int http_average;
607 int icp_min_poll;
608 int dns_min_poll;
609 int http_min_poll;
610 }
611
612 comm_incoming;
c5f627c2 613 int max_open_disk_fds;
d548ee64 614 int uri_whitespace;
47f6e231 615 int64_t rangeOffsetLimit;
e66d7923 616#if MULTICAST_MISS_STREAM
62e76326 617
618 struct
619 {
620
cc192b50 621 IPAddress addr;
62e76326 622 int ttl;
623 unsigned short port;
624 char *encode_key;
625 }
626
627 mcast_miss;
e66d7923 628#endif
62e76326 629
25b6a907 630 /* one access list per header type we know of */
8c01ada0 631 header_mangler request_header_access[HDR_ENUM_END];
25b6a907 632 /* one access list per header type we know of */
8c01ada0 633 header_mangler reply_header_access[HDR_ENUM_END];
b6a2f15e 634 char *coredump_dir;
efd900cb 635 char *chroot_dir;
7e3ce7b9 636#if USE_CACHE_DIGESTS
62e76326 637
638 struct
639 {
640 int bits_per_entry;
641 time_t rebuild_period;
642 time_t rewrite_period;
643 size_t swapout_chunk_size;
644 int rebuild_chunk_percentage;
645 }
646
647 digest;
1f7c9178 648#endif
649#if USE_SSL
62e76326 650
651 struct
652 {
653 int unclean_shutdown;
654 char *ssl_engine;
655 }
656
657 SSL;
7e3ce7b9 658#endif
62e76326 659
56fe752e 660 wordlist *ext_methods;
62e76326 661
662 struct
663 {
664 int high_rptm;
665 int high_pf;
666 size_t high_memory;
667 }
668
669 warnings;
65a53c8e 670 char *store_dir_select_algorithm;
1fbbdcb0 671 int sleep_after_fork; /* microseconds */
6a2f3fcf 672 time_t minimum_expiry_time; /* seconds */
d9572179 673 external_acl *externalAclHelperList;
a7ad6e4e 674#if USE_SSL
62e76326 675
676 struct
677 {
678 char *cert;
679 char *key;
680 int version;
681 char *options;
682 char *cipher;
683 char *cafile;
684 char *capath;
a82a4fe4 685 char *crlfile;
62e76326 686 char *flags;
4c9da963 687 acl_access *cert_error;
62e76326 688 SSL_CTX *sslContext;
689 }
690
691 ssl_client;
a7ad6e4e 692#endif
cc9f92d4 693
cc9f92d4 694 char *accept_filter;
a8258824 695};
696
62e76326 697struct _SquidConfig2
698{
699
700 struct
701 {
702 int enable_purge;
4f56514c 703 int mangle_request_headers;
62e76326 704 }
705
706 onoff;
d20b1cd0 707 uid_t effectiveUserID;
708 gid_t effectiveGroupID;
a8258824 709};
710
62e76326 711struct _close_handler
712{
a8258824 713 PF *handler;
714 void *data;
715 close_handler *next;
716};
717
62e76326 718struct _dread_ctrl
719{
a8258824 720 int fd;
721 off_t offset;
722 int req_len;
723 char *buf;
724 int end_of_file;
725 DRCB *handler;
726 void *client_data;
727};
728
62e76326 729struct _dwrite_q
730{
d377699f 731 off_t file_offset;
a8258824 732 char *buf;
57d55dfa 733 size_t len;
734 size_t buf_offset;
bd05e3e3 735 dwrite_q *next;
74fbf3c9 736 FREE *free_func;
a8258824 737};
738
a9771e51 739
740/* ETag support is rudimantal;
741 * this struct is likely to change
742 * Note: "str" points to memory in HttpHeaderEntry (for now)
743 * so ETags should be used as tmp variables only (for now) */
62e76326 744
745struct _ETag
746{
98829f69 747 const char *str; /* quoted-string */
748 int weak; /* true if it is a weak validator */
a9771e51 749};
750
62e76326 751struct _fde_disk
752{
e6ccf245 753 DWCB *wrt_handle;
754 void *wrt_handle_data;
755 dwrite_q *write_q;
756 dwrite_q *write_q_tail;
757 off_t offset;
758};
759
62e76326 760struct _fileMap
761{
a8258824 762 int max_n_files;
763 int n_files_in_map;
a8258824 764 int toggle;
765 int nwords;
766 unsigned long *file_map;
767};
768
adba4a64 769/*
1d21d91d 770 * Note: HttpBody is used only for messages with a small content that is
adba4a64 771 * known a priory (e.g., error messages).
772 */
0eb49b6d 773
774class MemBuf;
62e76326 775
776struct _HttpBody
777{
1d21d91d 778 /* private */
032785bf 779 MemBuf *mb;
adba4a64 780};
781
cf414c2d 782#include "SquidString.h"
2ecaa5e7 783/* http header extention field */
62e76326 784
0353e724 785class HttpHdrExtField
62e76326 786{
30abd221 787 String name; /* field-name from HTTP/1.1 (no column after name) */
788 String value; /* field-value from HTTP/1.1 */
2ecaa5e7 789};
adba4a64 790
399e85ea 791/* http cache control header field */
62e76326 792
985c86bc 793class HttpHdrCc
62e76326 794{
985c86bc 795
796public:
4f087419 797 int mask;
d8b249ef 798 int max_age;
7e3ce7b9 799 int s_maxage;
49ff0930 800 int max_stale;
30abd221 801 String other;
a8258824 802};
ee1679df 803
a9771e51 804/* some fields can hold either time or etag specs (e.g. If-Range) */
62e76326 805
806struct _TimeOrTag
807{
98829f69 808 ETag tag; /* entity tag */
a9771e51 809 time_t time;
98829f69 810 int valid; /* true if struct is usable */
a9771e51 811};
812
7faf2bdb 813/* per field statistics */
62e76326 814
0353e724 815class HttpHeaderFieldStat
62e76326 816{
0353e724 817
818public:
819 HttpHeaderFieldStat() : aliveCount(0), seenCount(0), parsCount(0), errCount(0), repCount(0){}
820
399e85ea 821 int aliveCount; /* created but not destroyed (count) */
d8b249ef 822 int seenCount; /* #fields we've seen */
399e85ea 823 int parsCount; /* #parsing attempts */
824 int errCount; /* #pasring errors */
825 int repCount; /* #repetitons */
7faf2bdb 826};
827
d8b249ef 828/* compiled version of HttpHeaderFieldAttrs plus stats */
62e76326 829
0353e724 830class HttpHeaderFieldInfo
62e76326 831{
0353e724 832
833public:
834 HttpHeaderFieldInfo() : id (HDR_ACCEPT), type (ftInvalid){}
835
de336bbe 836 http_hdr_type id;
30abd221 837 String name;
de336bbe 838 field_type type;
7faf2bdb 839 HttpHeaderFieldStat stat;
840};
841
62e76326 842struct _http_state_flags
843{
844
845unsigned int proxying:
846 1;
847
848unsigned int keepalive:
849 1;
850
851unsigned int only_if_cached:
852 1;
853
1a98175f 854unsigned int headers_parsed:
855 1;
856
62e76326 857unsigned int front_end_https:
858 2;
859
860unsigned int originpeer:
861 1;
21b92762 862
863unsigned int keepalive_broken:
864 1;
865
866unsigned int abuse_detected:
867 1;
72b63f06 868
869unsigned int request_sent:
870 1;
f61f0107 871
872unsigned int do_next_read:
873 1;
3b299123 874
875unsigned int consume_body_data:
876 1;
af0bb8e5 877
878unsigned int chunked:1;
b515fc11 879};
a8258824 880
62e76326 881struct _ipcache_addrs
882{
cc192b50 883 IPAddress *in_addrs;
6d1c0d53 884 unsigned char *bad_mask;
a8258824 885 unsigned char count;
886 unsigned char cur;
22c653cd 887 unsigned char badcount;
a8258824 888};
889
62e76326 890struct _domain_ping
891{
a8258824 892 char *domain;
893 int do_ping; /* boolean */
bd05e3e3 894 domain_ping *next;
a8258824 895};
896
62e76326 897struct _domain_type
898{
a8258824 899 char *domain;
900 peer_t type;
bd05e3e3 901 domain_type *next;
a8258824 902};
903
c68e9c6b 904#if USE_CACHE_DIGESTS
62e76326 905
e41e6dcd 906/* statistics for cache digests and other hit "predictors" */
62e76326 907
908struct _cd_guess_stats
909{
e41e6dcd 910 /* public, read-only */
911 int true_hits;
912 int false_hits;
913 int true_misses;
914 int false_misses;
4b4cd312 915 int close_hits; /* tmp, remove it later */
e41e6dcd 916};
917
c68e9c6b 918#endif
919
62e76326 920struct _peer
921{
cc192b50 922 u_int index;
be753325 923 char *name;
a8258824 924 char *host;
925 peer_t type;
62e76326 926
cc192b50 927 IPAddress in_addr;
62e76326 928
929 struct
930 {
931 int pings_sent;
932 int pings_acked;
933 int fetches;
934 int rtt;
935 int ignored_replies;
936 int n_keepalives_sent;
937 int n_keepalives_recv;
938 time_t probe_start;
939 time_t last_query;
940 time_t last_reply;
941 time_t last_connect_failure;
942 time_t last_connect_probe;
943 int logged_state; /* so we can print dead/revived msgs */
944 int conn_open; /* current opened connections */
945 }
946
947 stats;
948
949 struct
950 {
951 int version;
093bce8b 952 int counts[ICP_END+1];
62e76326 953 u_short port;
954 }
955
956 icp;
399cabec 957#if USE_HTCP
62e76326 958
959 struct
960 {
961 double version;
962 int counts[2];
963 u_short port;
964 }
965
966 htcp;
399cabec 967#endif
62e76326 968
a8258824 969 u_short http_port;
b6a2f15e 970 domain_ping *peer_domain;
bd05e3e3 971 domain_type *typelist;
505e35db 972 acl_access *access;
62e76326 973
974 struct
975 {
976
977unsigned int proxy_only:
978 1;
979
980unsigned int no_query:
981 1;
982
983unsigned int background_ping:
984 1;
985
986unsigned int no_digest:
987 1;
988
989unsigned int default_parent:
990 1;
991
992unsigned int roundrobin:
993 1;
994
995unsigned int weighted_roundrobin:
996 1;
997
998unsigned int mcast_responder:
999 1;
1000
1001unsigned int closest_only:
1002 1;
cd196bc8 1003#if USE_HTCP
62e76326 1004
1005unsigned int htcp:
1006 1;
527ee50d 1007
1008unsigned int htcp_oldsquid:
1009 1;
cd196bc8 1010#endif
62e76326 1011
1012unsigned int no_netdb_exchange:
1013 1;
cd196bc8 1014#if DELAY_POOLS
62e76326 1015
1016unsigned int no_delay:
1017 1;
cd196bc8 1018#endif
62e76326 1019
1020unsigned int allow_miss:
1021 1;
b3995439 1022#if USE_CARP
62e76326 1023
1024unsigned int carp:
1025 1;
b3995439 1026#endif
62e76326 1027
1028unsigned int originserver:
1029 1;
1030 }
1031
1032 options;
a8258824 1033 int weight;
d1b63fc8 1034 int basetime;
62e76326 1035
1036 struct
1037 {
1038 double avg_n_members;
1039 int n_times_counted;
1040 int n_replies_expected;
1041 int ttl;
1042 int id;
1043
1044 struct
1045 {
1046
1047unsigned int count_event_pending:
1048 1;
1049
1050unsigned int counting:
1051 1;
1052 }
1053
1054 flags;
1055 }
1056
1057 mcast;
c68e9c6b 1058#if USE_CACHE_DIGESTS
62e76326 1059
e13ee7ad 1060 PeerDigest *digest;
7e3ce7b9 1061 char *digest_url;
c68e9c6b 1062#endif
62e76326 1063
a8258824 1064 int tcp_up; /* 0 if a connect() fails */
62e76326 1065
cc192b50 1066 IPAddress addresses[10];
a8258824 1067 int n_addresses;
1068 int rr_count;
82056f1e 1069 int rr_lastcount;
bd05e3e3 1070 peer *next;
a8258824 1071 int test_fd;
afd88fbe 1072#if USE_CARP
62e76326 1073
1074 struct
1075 {
1076 unsigned int hash;
1077 double load_multiplier;
1078 double load_factor; /* normalized weight value */
1079 }
1080
1081 carp;
afd88fbe 1082#endif
62e76326 1083
c68e9c6b 1084 char *login; /* Proxy authorization */
3f62decd 1085 time_t connect_timeout;
c7f9eb6d 1086 int max_conn;
be753325 1087 char *domain; /* Forced domain */
a7ad6e4e 1088#if USE_SSL
62e76326 1089
a7ad6e4e 1090 int use_ssl;
1091 char *sslcert;
1092 char *sslkey;
1093 int sslversion;
1094 char *ssloptions;
1095 char *sslcipher;
1096 char *sslcafile;
1097 char *sslcapath;
a82a4fe4 1098 char *sslcrlfile;
a7ad6e4e 1099 char *sslflags;
1100 char *ssldomain;
1101 SSL_CTX *sslContext;
f38c5e43 1102 SSL_SESSION *sslSession;
a7ad6e4e 1103#endif
62e76326 1104
a7ad6e4e 1105 int front_end_https;
a8258824 1106};
1107
62e76326 1108struct _net_db_name
1109{
186477c1 1110 hash_link hash; /* must be first */
74fbf3c9 1111 net_db_name *next;
1112 netdbEntry *net_db_entry;
a8258824 1113};
1114
62e76326 1115struct _net_db_peer
1116{
6b53c392 1117 const char *peername;
a8258824 1118 double hops;
1119 double rtt;
1120 time_t expires;
1121};
1122
62e76326 1123struct _netdbEntry
1124{
186477c1 1125 hash_link hash; /* must be first */
cc192b50 1126 char network[MAX_IPSTRLEN];
a8258824 1127 int pings_sent;
1128 int pings_recv;
1129 double hops;
1130 double rtt;
1131 time_t next_ping_time;
1132 time_t last_use_time;
1133 int link_count;
1134 net_db_name *hosts;
1135 net_db_peer *peers;
1136 int n_peers_alloc;
1137 int n_peers;
1138};
1139
a8258824 1140
62e76326 1141struct _iostats
1142{
1143
1144 struct
1145 {
1146 int reads;
1147 int reads_deferred;
1148 int read_hist[16];
1149 int writes;
1150 int write_hist[16];
1151 }
1152
db80e881 1153 Http, Ftp, Gopher;
a8258824 1154};
1155
6a566b9c 1156
62e76326 1157struct request_flags
1158{
58217e94 1159 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),must_keepalive(0),destinationIPLookedUp_(0)
62e76326 1160 {
e429f975 1161#if HTTP_VIOLATIONS
72eee553 1162 nocache_hack = 0;
e429f975 1163#endif
fc68f6b1 1164#if LINUX_TPROXY
1165 tproxy = 0;
1166#endif
62e76326 1167
1168 }
1169
1170unsigned int range:
1171 1;
1172
1173unsigned int nocache:
1174 1;
1175
1176unsigned int ims:
1177 1;
1178
1179unsigned int auth:
1180 1;
1181
1182unsigned int cachable:
1183 1;
1184
1185unsigned int hierarchical:
1186 1;
1187
1188unsigned int loopdetect:
1189 1;
1190
1191unsigned int proxy_keepalive:
1192 1;
1193
1194unsigned int proxying:
1195 1; /* this should be killed, also in httpstateflags */
1196
1197unsigned int refresh:
1198 1;
1199
1200unsigned int redirected:
1201 1;
1202
1203unsigned int need_validation:
1204 1;
9f60cfdf 1205#if HTTP_VIOLATIONS
62e76326 1206
1207unsigned int nocache_hack:
1208 1; /* for changing/ignoring no-cache requests */
9f60cfdf 1209#endif
62e76326 1210
1211unsigned int accelerated:
1212 1;
1213
d048c262 1214unsigned int transparent:
1215 1;
1216
fc68f6b1 1217#if LINUX_TPROXY
1218unsigned int tproxy:
1219 1; /* spoof client ip using tproxy */
1220#endif
62e76326 1221unsigned int internal:
1222 1;
1223
1224unsigned int internalclient:
1225 1;
1226
f5e45ad8 1227unsigned int must_keepalive:
1228 1;
5f8252d2 1229
1230 // When adding new flags, please update cloneAdaptationImmune() as needed.
1231
e429f975 1232 bool resetTCP() const;
1233 void setResetTCP();
1234 void clearResetTCP();
8000a965 1235 void destinationIPLookupCompleted();
1236 bool destinationIPLookedUp() const;
62e76326 1237
5f8252d2 1238 // returns a partial copy of the flags that includes only those flags
1239 // that are safe for a related (e.g., ICAP-adapted) request to inherit
1240 request_flags cloneAdaptationImmune() const;
1241
e429f975 1242private:
62e76326 1243
1244unsigned int reset_tcp:
1245 1;
1246
1247unsigned int destinationIPLookedUp_:
1248 1;
92695e5e 1249};
1250
62e76326 1251struct _link_list
1252{
d03d26fb 1253 void *ptr;
62e76326 1254
d03d26fb 1255 struct _link_list *next;
1256};
1257
62e76326 1258struct _cachemgr_passwd
1259{
a8258824 1260 char *passwd;
22f3fd98 1261 wordlist *actions;
bd05e3e3 1262 cachemgr_passwd *next;
a8258824 1263};
1264
62e76326 1265struct _refresh_t
1266{
a2c963ae 1267 const char *pattern;
a8258824 1268 regex_t compiled_pattern;
1269 time_t min;
c3f6d204 1270 double pct;
a8258824 1271 time_t max;
bd05e3e3 1272 refresh_t *next;
62e76326 1273
1274 struct
1275 {
1276
1277unsigned int icase:
1278 1;
4c3ef9b2 1279
1280unsigned int refresh_ims:
1281 1;
9f60cfdf 1282#if HTTP_VIOLATIONS
62e76326 1283
1284unsigned int override_expire:
1285 1;
1286
1287unsigned int override_lastmod:
1288 1;
1289
1290unsigned int reload_into_ims:
1291 1;
1292
1293unsigned int ignore_reload:
1294 1;
38f9c547 1295
1296unsigned int ignore_no_cache:
1297 1;
1298
1299unsigned int ignore_no_store:
1300 1;
1301
1302unsigned int ignore_private:
1303 1;
1304
1305unsigned int ignore_auth:
1306 1;
9f60cfdf 1307#endif
62e76326 1308
1309 }
1310
1311 flags;
a8258824 1312};
1313
12cf1be2 1314/*
1315 * "very generic" histogram;
1316 * see important comments on hbase_f restrictions in StatHist.c
1317 */
62e76326 1318
1319struct _StatHist
1320{
12cf1be2 1321 int *bins;
1322 int capacity;
e9a13293 1323 double min;
1324 double max;
1325 double scale;
95c297ec 1326 hbase_f *val_in; /* e.g., log() for log-based histogram */
1327 hbase_f *val_out; /* e.g., exp() for log based histogram */
7ae52c25 1328};
1329
12cf1be2 1330/*
1331 * if you add a field to StatCounters,
1d803566 1332 * you MUST sync statCountersInitSpecial, statCountersClean, and statCountersCopy
12cf1be2 1333 */
62e76326 1334
1335struct _StatCounters
1336{
1337
1338 struct
1339 {
1340 int clients;
1341 int requests;
1342 int hits;
1343 int mem_hits;
1344 int disk_hits;
1345 int errors;
1346 kb_t kbytes_in;
1347 kb_t kbytes_out;
1348 kb_t hit_kbytes_out;
1349 StatHist miss_svc_time;
1350 StatHist nm_svc_time;
1351 StatHist nh_svc_time;
1352 StatHist hit_svc_time;
1353 StatHist all_svc_time;
1354 }
1355
1356 client_http;
1357
1358 struct
1359 {
1360
1361 struct
1362 {
1363 int requests;
1364 int errors;
1365 kb_t kbytes_in;
1366 kb_t kbytes_out;
1367 }
1368
1369 all , http, ftp, other;
1370 }
1371
1372 server;
1373
1374 struct
1375 {
1376 int pkts_sent;
1377 int queries_sent;
1378 int replies_sent;
1379 int pkts_recv;
1380 int queries_recv;
1381 int replies_recv;
1382 int hits_sent;
1383 int hits_recv;
1384 int replies_queued;
1385 int replies_dropped;
1386 kb_t kbytes_sent;
1387 kb_t q_kbytes_sent;
1388 kb_t r_kbytes_sent;
1389 kb_t kbytes_recv;
1390 kb_t q_kbytes_recv;
1391 kb_t r_kbytes_recv;
1392 StatHist query_svc_time;
1393 StatHist reply_svc_time;
1394 int query_timeouts;
1395 int times_used;
1396 }
1397
1398 icp;
1399
c4ebc830 1400 struct
1401 {
1402 int pkts_sent;
1403 int pkts_recv;
1404 }
1405
1406 htcp;
1407
62e76326 1408 struct
1409 {
1410 int requests;
1411 }
1412
1413 unlink;
1414
1415 struct
1416 {
1417 StatHist svc_time;
1418 }
1419
1420 dns;
1421
1422 struct
1423 {
1424 int times_used;
1425 kb_t kbytes_sent;
1426 kb_t kbytes_recv;
1427 kb_t memory;
1428 int msgs_sent;
1429 int msgs_recv;
c68e9c6b 1430#if USE_CACHE_DIGESTS
62e76326 1431
1432 cd_guess_stats guess;
c68e9c6b 1433#endif
62e76326 1434
1435 StatHist on_xition_count;
1436 }
1437
1438 cd;
1439
1440 struct
1441 {
1442 int times_used;
1443 }
1444
1445 netdb;
f2908497 1446 int page_faults;
1447 int select_loops;
d239c2f5 1448 int select_fds;
1449 double select_time;
f2908497 1450 double cputime;
62e76326 1451
d5649d9f 1452 struct timeval timestamp;
c6ecdbc3 1453 StatHist comm_icp_incoming;
ef523f99 1454 StatHist comm_dns_incoming;
c6ecdbc3 1455 StatHist comm_http_incoming;
26d6ee93 1456 StatHist select_fds_hist;
62e76326 1457
1458 struct
1459 {
1460
1461 struct
1462 {
1463 int opens;
1464 int closes;
1465 int reads;
1466 int writes;
1467 int seeks;
1468 int unlinks;
1469 }
1470
1471 disk;
1472
1473 struct
1474 {
1475 int accepts;
1476 int sockets;
1477 int connects;
1478 int binds;
1479 int closes;
1480 int reads;
1481 int writes;
1482 int recvfroms;
1483 int sendtos;
1484 }
1485
1486 sock;
62e76326 1487 int selects;
62e76326 1488 }
1489
1490 syscalls;
bfae3379 1491 int aborted_requests;
62e76326 1492
1493 struct
1494 {
1495 int files_cleaned;
1496 int outs;
1497 int ins;
1498 }
1499
1500 swap;
f2908497 1501};
69c01cd7 1502
fcd2d3ef 1503/* per header statistics */
62e76326 1504
1505struct _HttpHeaderStat
1506{
fcd2d3ef 1507 const char *label;
1508 HttpHeaderMask *owner_mask;
1509
1510 StatHist hdrUCountDistr;
1511 StatHist fieldTypeDistr;
1512 StatHist ccTypeDistr;
43ae1d95 1513 StatHist scTypeDistr;
fcd2d3ef 1514
1515 int parsedCount;
1516 int ccParsedCount;
43ae1d95 1517 int scParsedCount;
fcd2d3ef 1518 int destroyedCount;
1519 int busyDestroyedCount;
1520};
1521
59c4d35b 1522
62e76326 1523struct _ClientInfo
1524{
186477c1 1525 hash_link hash; /* must be first */
62e76326 1526
cc192b50 1527 IPAddress addr;
62e76326 1528
1529 struct
1530 {
1531 int result_hist[LOG_TYPE_MAX];
1532 int n_requests;
1533 kb_t kbytes_in;
1534 kb_t kbytes_out;
1535 kb_t hit_kbytes_out;
1536 }
1537
1538 Http, Icp;
1539
1540 struct
1541 {
1542 time_t time;
1543 int n_req;
1544 int n_denied;
1545 }
1546
1547 cutoff;
9bc73deb 1548 int n_established; /* number of current established connections */
a0eba6bc 1549 time_t last_seen;
59c4d35b 1550};
c411be12 1551
62e76326 1552struct _CacheDigest
1553{
c411be12 1554 /* public, read-only */
1afe05c5 1555 char *mask; /* bit mask */
57d55dfa 1556 int mask_size; /* mask size in bytes */
1afe05c5 1557 int capacity; /* expected maximum for .count, not a hard limit */
04f0c415 1558 int bits_per_entry; /* number of bits allocated for each entry from capacity */
1afe05c5 1559 int count; /* number of digested entries */
1560 int del_count; /* number of deletions performed so far */
c411be12 1561};
910169e5 1562
b2c141d4 1563
62e76326 1564struct _store_rebuild_data
1565{
b2c141d4 1566 int objcount; /* # objects successfully reloaded */
1567 int expcount; /* # objects expired */
1568 int scancount; /* # entries scanned or read from state file */
1569 int clashcount; /* # swapfile clashes avoided */
1570 int dupcount; /* # duplicates purged */
1571 int cancelcount; /* # SWAP_LOG_DEL objects purged */
1572 int invalid; /* # bad lines */
1573 int badflags; /* # bad e->flags */
1574 int bad_log_op;
1575 int zero_object_sz;
1576};
5673c2e2 1577
62e76326 1578struct _Logfile
1579{
5673c2e2 1580 int fd;
1581 char path[MAXPATHLEN];
1582 char *buf;
1583 size_t bufsz;
57d55dfa 1584 size_t offset;
62e76326 1585
1586 struct
1587 {
c33aa074 1588 unsigned int fatal;
1589 unsigned int syslog;
62e76326 1590 }
1591
1592 flags;
c33aa074 1593
1594 int syslog_priority;
5673c2e2 1595};
8e8d4f30 1596
7684c4b1 1597struct _logformat
1598{
1599 char *name;
1600 logformat_token *format;
1601 logformat *next;
1602};
1603
1604struct _customlog
1605{
1606 char *filename;
76cd39d7 1607 ACLList *aclList;
7684c4b1 1608 logformat *logFormat;
1609 Logfile *logfile;
1610 customlog *next;
1611 customlog_type type;
1612};
1613
b5638623 1614#endif /* SQUID_STRUCTS_H */