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