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