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