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