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