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