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