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