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