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