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