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