]> git.ipfire.org Git - thirdparty/squid.git/blob - src/structs.h
Rename 'tproxy' flags to 'spoof_client_ip' for a better description of their purpose.
[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
634 SQUIDCEXTERN SquidConfig Config;
635
636 struct SquidConfig2
637 {
638 struct
639 {
640 int enable_purge;
641 int mangle_request_headers;
642 } onoff;
643 uid_t effectiveUserID;
644 gid_t effectiveGroupID;
645 };
646
647 SQUIDCEXTERN SquidConfig2 Config2;
648
649 struct _close_handler
650 {
651 PF *handler;
652 void *data;
653 close_handler *next;
654 };
655
656 struct _dread_ctrl
657 {
658 int fd;
659 off_t offset;
660 int req_len;
661 char *buf;
662 int end_of_file;
663 DRCB *handler;
664 void *client_data;
665 };
666
667 struct _dwrite_q
668 {
669 off_t file_offset;
670 char *buf;
671 size_t len;
672 size_t buf_offset;
673 dwrite_q *next;
674 FREE *free_func;
675 };
676
677
678 /* ETag support is rudimantal;
679 * this struct is likely to change
680 * Note: "str" points to memory in HttpHeaderEntry (for now)
681 * so ETags should be used as tmp variables only (for now) */
682
683 struct _ETag
684 {
685 const char *str; /* quoted-string */
686 int weak; /* true if it is a weak validator */
687 };
688
689 struct _fde_disk
690 {
691 DWCB *wrt_handle;
692 void *wrt_handle_data;
693 dwrite_q *write_q;
694 dwrite_q *write_q_tail;
695 off_t offset;
696 };
697
698 struct _fileMap
699 {
700 int max_n_files;
701 int n_files_in_map;
702 int toggle;
703 int nwords;
704 unsigned long *file_map;
705 };
706
707 /*
708 * Note: HttpBody is used only for messages with a small content that is
709 * known a priory (e.g., error messages).
710 */
711
712 class MemBuf;
713
714 struct _HttpBody
715 {
716 /* private */
717 MemBuf *mb;
718 };
719
720 #include "SquidString.h"
721 /* http header extention field */
722
723 class HttpHdrExtField
724 {
725 String name; /* field-name from HTTP/1.1 (no column after name) */
726 String value; /* field-value from HTTP/1.1 */
727 };
728
729 /* http cache control header field */
730
731 class HttpHdrCc
732 {
733
734 public:
735 int mask;
736 int max_age;
737 int s_maxage;
738 int max_stale;
739 String other;
740 };
741
742 /* some fields can hold either time or etag specs (e.g. If-Range) */
743
744 struct _TimeOrTag
745 {
746 ETag tag; /* entity tag */
747 time_t time;
748 int valid; /* true if struct is usable */
749 };
750
751 /* per field statistics */
752
753 class HttpHeaderFieldStat
754 {
755
756 public:
757 HttpHeaderFieldStat() : aliveCount(0), seenCount(0), parsCount(0), errCount(0), repCount(0){}
758
759 int aliveCount; /* created but not destroyed (count) */
760 int seenCount; /* #fields we've seen */
761 int parsCount; /* #parsing attempts */
762 int errCount; /* #pasring errors */
763 int repCount; /* #repetitons */
764 };
765
766 /* compiled version of HttpHeaderFieldAttrs plus stats */
767
768 class HttpHeaderFieldInfo
769 {
770
771 public:
772 HttpHeaderFieldInfo() : id (HDR_ACCEPT), type (ftInvalid){}
773
774 http_hdr_type id;
775 String name;
776 field_type type;
777 HttpHeaderFieldStat stat;
778 };
779
780 struct _http_state_flags
781 {
782 unsigned int proxying:1;
783 unsigned int keepalive:1;
784 unsigned int only_if_cached:1;
785 unsigned int headers_parsed:1;
786 unsigned int front_end_https:2;
787 unsigned int originpeer:1;
788 unsigned int keepalive_broken:1;
789 unsigned int abuse_detected:1;
790 unsigned int request_sent:1;
791 unsigned int do_next_read:1;
792 unsigned int consume_body_data:1;
793 unsigned int chunked:1;
794 };
795
796 struct _ipcache_addrs
797 {
798 IPAddress *in_addrs;
799 unsigned char *bad_mask;
800 unsigned char count;
801 unsigned char cur;
802 unsigned char badcount;
803 };
804
805 struct _domain_ping
806 {
807 char *domain;
808 int do_ping; /* boolean */
809 domain_ping *next;
810 };
811
812 struct _domain_type
813 {
814 char *domain;
815 peer_t type;
816 domain_type *next;
817 };
818
819 #if USE_CACHE_DIGESTS
820
821 /* statistics for cache digests and other hit "predictors" */
822
823 struct _cd_guess_stats
824 {
825 /* public, read-only */
826 int true_hits;
827 int false_hits;
828 int true_misses;
829 int false_misses;
830 int close_hits; /* tmp, remove it later */
831 };
832
833 #endif
834
835 class PeerDigest;
836
837 struct peer
838 {
839 u_int index;
840 char *name;
841 char *host;
842 peer_t type;
843
844 IPAddress in_addr;
845
846 struct
847 {
848 int pings_sent;
849 int pings_acked;
850 int fetches;
851 int rtt;
852 int ignored_replies;
853 int n_keepalives_sent;
854 int n_keepalives_recv;
855 time_t probe_start;
856 time_t last_query;
857 time_t last_reply;
858 time_t last_connect_failure;
859 time_t last_connect_probe;
860 int logged_state; /* so we can print dead/revived msgs */
861 int conn_open; /* current opened connections */
862 } stats;
863
864 struct
865 {
866 int version;
867 int counts[ICP_END+1];
868 u_short port;
869 } icp;
870 #if USE_HTCP
871
872 struct
873 {
874 double version;
875 int counts[2];
876 u_short port;
877 } htcp;
878 #endif
879
880 u_short http_port;
881 domain_ping *peer_domain;
882 domain_type *typelist;
883 acl_access *access;
884
885 struct
886 {
887 unsigned int proxy_only:1;
888 unsigned int no_query:1;
889 unsigned int background_ping:1;
890 unsigned int no_digest:1;
891 unsigned int default_parent:1;
892 unsigned int roundrobin:1;
893 unsigned int weighted_roundrobin:1;
894 unsigned int mcast_responder:1;
895 unsigned int closest_only:1;
896 #if USE_HTCP
897 unsigned int htcp:1;
898 unsigned int htcp_oldsquid:1;
899 #endif
900 unsigned int no_netdb_exchange:1;
901 #if DELAY_POOLS
902 unsigned int no_delay:1;
903 #endif
904 unsigned int allow_miss:1;
905 #if USE_CARP
906 unsigned int carp:1;
907 #endif
908 unsigned int originserver:1;
909 } options;
910
911 int weight;
912 int basetime;
913
914 struct
915 {
916 double avg_n_members;
917 int n_times_counted;
918 int n_replies_expected;
919 int ttl;
920 int id;
921
922 struct
923 {
924 unsigned int count_event_pending:1;
925 unsigned int counting:1;
926 } flags;
927 } mcast;
928 #if USE_CACHE_DIGESTS
929
930 PeerDigest *digest;
931 char *digest_url;
932 #endif
933
934 int tcp_up; /* 0 if a connect() fails */
935
936 IPAddress addresses[10];
937 int n_addresses;
938 int rr_count;
939 int rr_lastcount;
940 peer *next;
941 int test_fd;
942 #if USE_CARP
943
944 struct
945 {
946 unsigned int hash;
947 double load_multiplier;
948 double load_factor; /* normalized weight value */
949 } carp;
950 #endif
951
952 char *login; /* Proxy authorization */
953 time_t connect_timeout;
954 int max_conn;
955 char *domain; /* Forced domain */
956 #if USE_SSL
957
958 int use_ssl;
959 char *sslcert;
960 char *sslkey;
961 int sslversion;
962 char *ssloptions;
963 char *sslcipher;
964 char *sslcafile;
965 char *sslcapath;
966 char *sslcrlfile;
967 char *sslflags;
968 char *ssldomain;
969 SSL_CTX *sslContext;
970 SSL_SESSION *sslSession;
971 #endif
972
973 int front_end_https;
974 };
975
976 struct _net_db_name
977 {
978 hash_link hash; /* must be first */
979 net_db_name *next;
980 netdbEntry *net_db_entry;
981 };
982
983 struct _net_db_peer
984 {
985 const char *peername;
986 double hops;
987 double rtt;
988 time_t expires;
989 };
990
991 struct _netdbEntry
992 {
993 hash_link hash; /* must be first */
994 char network[MAX_IPSTRLEN];
995 int pings_sent;
996 int pings_recv;
997 double hops;
998 double rtt;
999 time_t next_ping_time;
1000 time_t last_use_time;
1001 int link_count;
1002 net_db_name *hosts;
1003 net_db_peer *peers;
1004 int n_peers_alloc;
1005 int n_peers;
1006 };
1007
1008
1009 struct _iostats
1010 {
1011
1012 struct
1013 {
1014 int reads;
1015 int reads_deferred;
1016 int read_hist[16];
1017 int writes;
1018 int write_hist[16];
1019 }
1020
1021 Http, Ftp, Gopher;
1022 };
1023
1024
1025 struct request_flags
1026 {
1027 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)
1028 {
1029 #if HTTP_VIOLATIONS
1030 nocache_hack = 0;
1031 #endif
1032 }
1033
1034 unsigned int range:1;
1035 unsigned int nocache:1;
1036 unsigned int ims:1;
1037 unsigned int auth:1;
1038 unsigned int cachable:1;
1039 unsigned int hierarchical:1;
1040 unsigned int loopdetect:1;
1041 unsigned int proxy_keepalive:1;
1042 unsigned int proxying:1; /* this should be killed, also in httpstateflags */
1043 unsigned int refresh:1;
1044 unsigned int redirected:1;
1045 unsigned int need_validation:1;
1046 #if HTTP_VIOLATIONS
1047 unsigned int nocache_hack:1; /* for changing/ignoring no-cache requests */
1048 #endif
1049 unsigned int accelerated:1;
1050 unsigned int intercepted:1; /**< transparently intercepted request */
1051 unsigned int spoof_client_ip:1; /**< spoof client ip if possible */
1052 unsigned int internal:1;
1053 unsigned int internalclient:1;
1054 unsigned int must_keepalive:1;
1055
1056 // When adding new flags, please update cloneAdaptationImmune() as needed.
1057
1058 bool resetTCP() const;
1059 void setResetTCP();
1060 void clearResetTCP();
1061 void destinationIPLookupCompleted();
1062 bool destinationIPLookedUp() const;
1063
1064 // returns a partial copy of the flags that includes only those flags
1065 // that are safe for a related (e.g., ICAP-adapted) request to inherit
1066 request_flags cloneAdaptationImmune() const;
1067
1068 private:
1069
1070 unsigned int reset_tcp:1;
1071 unsigned int destinationIPLookedUp_:1;
1072 };
1073
1074 struct _link_list
1075 {
1076 void *ptr;
1077
1078 struct _link_list *next;
1079 };
1080
1081 struct _cachemgr_passwd
1082 {
1083 char *passwd;
1084 wordlist *actions;
1085 cachemgr_passwd *next;
1086 };
1087
1088 struct _refresh_t
1089 {
1090 const char *pattern;
1091 regex_t compiled_pattern;
1092 time_t min;
1093 double pct;
1094 time_t max;
1095 refresh_t *next;
1096
1097 struct
1098 {
1099 unsigned int icase:1;
1100 unsigned int refresh_ims:1;
1101 #if HTTP_VIOLATIONS
1102 unsigned int override_expire:1;
1103 unsigned int override_lastmod:1;
1104 unsigned int reload_into_ims:1;
1105 unsigned int ignore_reload:1;
1106 unsigned int ignore_no_cache:1;
1107 unsigned int ignore_no_store:1;
1108 unsigned int ignore_private:1;
1109 unsigned int ignore_auth:1;
1110 #endif
1111 } flags;
1112 };
1113
1114 /*
1115 * "very generic" histogram;
1116 * see important comments on hbase_f restrictions in StatHist.c
1117 */
1118
1119 struct _StatHist
1120 {
1121 int *bins;
1122 int capacity;
1123 double min;
1124 double max;
1125 double scale;
1126 hbase_f *val_in; /* e.g., log() for log-based histogram */
1127 hbase_f *val_out; /* e.g., exp() for log based histogram */
1128 };
1129
1130 /*
1131 * if you add a field to StatCounters,
1132 * you MUST sync statCountersInitSpecial, statCountersClean, and statCountersCopy
1133 */
1134
1135 struct _StatCounters
1136 {
1137
1138 struct
1139 {
1140 int clients;
1141 int requests;
1142 int hits;
1143 int mem_hits;
1144 int disk_hits;
1145 int errors;
1146 kb_t kbytes_in;
1147 kb_t kbytes_out;
1148 kb_t hit_kbytes_out;
1149 StatHist miss_svc_time;
1150 StatHist nm_svc_time;
1151 StatHist nh_svc_time;
1152 StatHist hit_svc_time;
1153 StatHist all_svc_time;
1154 } client_http;
1155
1156 struct
1157 {
1158
1159 struct
1160 {
1161 int requests;
1162 int errors;
1163 kb_t kbytes_in;
1164 kb_t kbytes_out;
1165 } all , http, ftp, other;
1166 } server;
1167
1168 struct
1169 {
1170 int pkts_sent;
1171 int queries_sent;
1172 int replies_sent;
1173 int pkts_recv;
1174 int queries_recv;
1175 int replies_recv;
1176 int hits_sent;
1177 int hits_recv;
1178 int replies_queued;
1179 int replies_dropped;
1180 kb_t kbytes_sent;
1181 kb_t q_kbytes_sent;
1182 kb_t r_kbytes_sent;
1183 kb_t kbytes_recv;
1184 kb_t q_kbytes_recv;
1185 kb_t r_kbytes_recv;
1186 StatHist query_svc_time;
1187 StatHist reply_svc_time;
1188 int query_timeouts;
1189 int times_used;
1190 } icp;
1191
1192 struct
1193 {
1194 int pkts_sent;
1195 int pkts_recv;
1196 } htcp;
1197
1198 struct
1199 {
1200 int requests;
1201 } unlink;
1202
1203 struct
1204 {
1205 StatHist svc_time;
1206 } dns;
1207
1208 struct
1209 {
1210 int times_used;
1211 kb_t kbytes_sent;
1212 kb_t kbytes_recv;
1213 kb_t memory;
1214 int msgs_sent;
1215 int msgs_recv;
1216 #if USE_CACHE_DIGESTS
1217
1218 cd_guess_stats guess;
1219 #endif
1220
1221 StatHist on_xition_count;
1222 } cd;
1223
1224 struct
1225 {
1226 int times_used;
1227 } netdb;
1228 int page_faults;
1229 int select_loops;
1230 int select_fds;
1231 double select_time;
1232 double cputime;
1233
1234 struct timeval timestamp;
1235 StatHist comm_icp_incoming;
1236 StatHist comm_dns_incoming;
1237 StatHist comm_http_incoming;
1238 StatHist select_fds_hist;
1239
1240 struct
1241 {
1242 struct
1243 {
1244 int opens;
1245 int closes;
1246 int reads;
1247 int writes;
1248 int seeks;
1249 int unlinks;
1250 } disk;
1251
1252 struct
1253 {
1254 int accepts;
1255 int sockets;
1256 int connects;
1257 int binds;
1258 int closes;
1259 int reads;
1260 int writes;
1261 int recvfroms;
1262 int sendtos;
1263 } sock;
1264 int selects;
1265 } syscalls;
1266 int aborted_requests;
1267
1268 struct
1269 {
1270 int files_cleaned;
1271 int outs;
1272 int ins;
1273 } swap;
1274 };
1275
1276 /* per header statistics */
1277
1278 struct _HttpHeaderStat
1279 {
1280 const char *label;
1281 HttpHeaderMask *owner_mask;
1282
1283 StatHist hdrUCountDistr;
1284 StatHist fieldTypeDistr;
1285 StatHist ccTypeDistr;
1286 StatHist scTypeDistr;
1287
1288 int parsedCount;
1289 int ccParsedCount;
1290 int scParsedCount;
1291 int destroyedCount;
1292 int busyDestroyedCount;
1293 };
1294
1295
1296 struct _ClientInfo
1297 {
1298 hash_link hash; /* must be first */
1299
1300 IPAddress addr;
1301
1302 struct
1303 {
1304 int result_hist[LOG_TYPE_MAX];
1305 int n_requests;
1306 kb_t kbytes_in;
1307 kb_t kbytes_out;
1308 kb_t hit_kbytes_out;
1309 } Http, Icp;
1310
1311 struct
1312 {
1313 time_t time;
1314 int n_req;
1315 int n_denied;
1316 } cutoff;
1317 int n_established; /* number of current established connections */
1318 time_t last_seen;
1319 };
1320
1321 struct _CacheDigest
1322 {
1323 /* public, read-only */
1324 char *mask; /* bit mask */
1325 int mask_size; /* mask size in bytes */
1326 int capacity; /* expected maximum for .count, not a hard limit */
1327 int bits_per_entry; /* number of bits allocated for each entry from capacity */
1328 int count; /* number of digested entries */
1329 int del_count; /* number of deletions performed so far */
1330 };
1331
1332
1333 struct _store_rebuild_data
1334 {
1335 int objcount; /* # objects successfully reloaded */
1336 int expcount; /* # objects expired */
1337 int scancount; /* # entries scanned or read from state file */
1338 int clashcount; /* # swapfile clashes avoided */
1339 int dupcount; /* # duplicates purged */
1340 int cancelcount; /* # SWAP_LOG_DEL objects purged */
1341 int invalid; /* # bad lines */
1342 int badflags; /* # bad e->flags */
1343 int bad_log_op;
1344 int zero_object_sz;
1345 };
1346
1347 struct _Logfile
1348 {
1349 int fd;
1350 char path[MAXPATHLEN];
1351 char *buf;
1352 size_t bufsz;
1353 size_t offset;
1354
1355 struct
1356 {
1357 unsigned int fatal;
1358 unsigned int syslog;
1359 } flags;
1360
1361 int syslog_priority;
1362 };
1363
1364 class logformat_token;
1365
1366 struct _logformat
1367 {
1368 char *name;
1369 logformat_token *format;
1370 logformat *next;
1371 };
1372
1373 struct _customlog
1374 {
1375 char *filename;
1376 ACLList *aclList;
1377 logformat *logFormat;
1378 Logfile *logfile;
1379 customlog *next;
1380 customlog_type type;
1381 };
1382
1383 #endif /* SQUID_STRUCTS_H */