]> git.ipfire.org Git - thirdparty/squid.git/blob - src/structs.h
Send DNS A and AAAA queries in parallel
[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 "RefCount.h"
33 #include "cbdata.h"
34 #include "dlink.h"
35 #include "err_type.h"
36
37 /* needed for the global config */
38 #include "HttpHeader.h"
39
40 /* for ICP_END */
41 #include "icp_opcode.h"
42
43 #if USE_SSL
44 #include <openssl/ssl.h>
45 #endif
46
47 #define PEER_MULTICAST_SIBLINGS 1
48
49 struct acl_name_list {
50 char name[ACL_NAME_SZ];
51 acl_name_list *next;
52 };
53
54 struct acl_deny_info_list {
55 err_type err_page_id;
56 char *err_page_name;
57 acl_name_list *acl_list;
58 acl_deny_info_list *next;
59 };
60
61
62 class acl_access;
63
64 struct _header_mangler {
65 acl_access *access_list;
66 char *replacement;
67 };
68
69 class ACLChecklist;
70
71 #if SQUID_SNMP
72
73 struct _snmp_request_t {
74 u_char *buf;
75 u_char *outbuf;
76 int len;
77 int sock;
78 long reqid;
79 int outlen;
80
81 Ip::Address from;
82
83 struct snmp_pdu *PDU;
84 ACLChecklist *acl_checklist;
85 u_char *community;
86
87 struct snmp_session session;
88 };
89
90 #endif
91
92 class ACLList;
93
94 struct acl_address {
95 acl_address *next;
96 ACLList *aclList;
97
98 Ip::Address addr;
99 };
100
101 struct acl_tos {
102 acl_tos *next;
103 ACLList *aclList;
104 tos_t tos;
105 };
106
107 struct acl_nfmark {
108 acl_nfmark *next;
109 ACLList *aclList;
110 nfmark_t nfmark;
111 };
112
113 struct acl_size_t {
114 acl_size_t *next;
115 ACLList *aclList;
116 int64_t size;
117 };
118
119 struct ushortlist {
120 unsigned short i;
121 ushortlist *next;
122 };
123
124 struct relist {
125 int flags;
126 char *pattern;
127 regex_t regex;
128 relist *next;
129 };
130
131 #if USE_DELAY_POOLS
132 #include "DelayConfig.h"
133 #include "ClientDelayConfig.h"
134 #endif
135
136 #if USE_ICMP
137 #include "icmp/IcmpConfig.h"
138 #endif
139
140 #include "HelperChildConfig.h"
141
142 /* forward decl for SquidConfig, see RemovalPolicy.h */
143
144 class CpuAffinityMap;
145 class RemovalPolicySettings;
146 class external_acl;
147 class Store;
148 struct http_port_list;
149 class SwapDir;
150
151 /// Used for boolean enabled/disabled options with complex default logic.
152 /// Allows Squid to compute the right default after configuration.
153 /// Checks that not-yet-defined option values are not used.
154 class YesNoNone
155 {
156 // TODO: generalize to non-boolean option types
157 public:
158 YesNoNone(): option(0) {}
159
160 /// returns true iff enabled; asserts if the option has not been configured
161 operator void *() const; // TODO: use a fancy/safer version of the operator
162
163 /// enables or disables the option;
164 void configure(bool beSet);
165
166 /// whether the option was enabled or disabled, by user or Squid
167 bool configured() const { return option != 0; }
168
169 private:
170 enum { optUnspecified = -1, optDisabled = 0, optEnabled = 1 };
171 int option; ///< configured value or zero
172 };
173
174 struct SquidConfig {
175
176 struct {
177 /* These should be for the Store::Root instance.
178 * this needs pluggable parsing to be done smoothly.
179 */
180 int highWaterMark;
181 int lowWaterMark;
182 } Swap;
183
184 YesNoNone memShared; ///< whether the memory cache is shared among workers
185 size_t memMaxSize;
186
187 struct {
188 int64_t min;
189 int pct;
190 int64_t max;
191 } quickAbort;
192 int64_t readAheadGap;
193 RemovalPolicySettings *replPolicy;
194 RemovalPolicySettings *memPolicy;
195 #if USE_HTTP_VIOLATIONS
196 time_t negativeTtl;
197 #endif
198 time_t maxStale;
199 time_t negativeDnsTtl;
200 time_t positiveDnsTtl;
201 time_t shutdownLifetime;
202 time_t backgroundPingRate;
203
204 struct {
205 time_t read;
206 time_t write;
207 time_t lifetime;
208 time_t connect;
209 time_t forward;
210 time_t peer_connect;
211 time_t request;
212 time_t clientIdlePconn;
213 time_t serverIdlePconn;
214 time_t siteSelect;
215 time_t deadPeer;
216 int icp_query; /* msec */
217 int icp_query_max; /* msec */
218 int icp_query_min; /* msec */
219 int mcast_icp_query; /* msec */
220
221 #if !USE_DNSHELPER
222 time_msec_t idns_retransmit;
223 time_msec_t idns_query;
224 #endif
225
226 } Timeout;
227 size_t maxRequestHeaderSize;
228 int64_t maxRequestBodySize;
229 int64_t maxChunkedRequestBodySize;
230 size_t maxRequestBufferSize;
231 size_t maxReplyHeaderSize;
232 acl_size_t *ReplyBodySize;
233
234 struct {
235 unsigned short icp;
236 #if USE_HTCP
237
238 unsigned short htcp;
239 #endif
240 #if SQUID_SNMP
241
242 unsigned short snmp;
243 #endif
244 } Port;
245
246 struct {
247 http_port_list *http;
248 #if USE_SSL
249 http_port_list *https;
250 #endif
251
252 } Sockaddr;
253 #if SQUID_SNMP
254
255 struct {
256 char *configFile;
257 char *agentInfo;
258 } Snmp;
259 #endif
260 #if USE_WCCP
261
262 struct {
263 Ip::Address router;
264 Ip::Address address;
265 int version;
266 } Wccp;
267 #endif
268 #if USE_WCCPv2
269
270 struct {
271 Ip::Address_list *router;
272 Ip::Address address;
273 int forwarding_method;
274 int return_method;
275 int assignment_method;
276 int weight;
277 int rebuildwait;
278 void *info;
279 } Wccp2;
280 #endif
281
282 #if USE_ICMP
283 IcmpConfig pinger;
284 #endif
285
286 char *as_whois_server;
287
288 struct {
289 char *store;
290 char *swap;
291 customlog *accesslogs;
292 #if ICAP_CLIENT
293 customlog *icaplogs;
294 #endif
295 int rotateNumber;
296 } Log;
297 char *adminEmail;
298 char *EmailFrom;
299 char *EmailProgram;
300 char *effectiveUser;
301 char *visible_appname_string;
302 char *effectiveGroup;
303
304 struct {
305 #if USE_DNSHELPER
306 char *dnsserver;
307 #endif
308
309 wordlist *redirect;
310 #if USE_UNLINKD
311
312 char *unlinkd;
313 #endif
314
315 char *diskd;
316 #if USE_SSL
317
318 char *ssl_password;
319 #endif
320
321 } Program;
322 #if USE_DNSHELPER
323 HelperChildConfig dnsChildren;
324 #endif
325
326 HelperChildConfig redirectChildren;
327 time_t authenticateGCInterval;
328 time_t authenticateTTL;
329 time_t authenticateIpTTL;
330
331 struct {
332 char *surrogate_id;
333 } Accel;
334 char *appendDomain;
335 size_t appendDomainLen;
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 char *host;
347 char *file;
348 time_t period;
349 unsigned short port;
350 } Announce;
351
352 struct {
353
354 Ip::Address udp_incoming;
355 Ip::Address udp_outgoing;
356 #if SQUID_SNMP
357 Ip::Address snmp_incoming;
358 Ip::Address snmp_outgoing;
359 #endif
360 /* FIXME INET6 : this should really be a CIDR value */
361 Ip::Address client_netmask;
362 } Addrs;
363 size_t tcpRcvBufsz;
364 size_t udpMaxHitObjsz;
365 wordlist *hierarchy_stoplist;
366 wordlist *mcast_group_list;
367 wordlist *dns_nameservers;
368 peer *peers;
369 int npeers;
370
371 struct {
372 int size;
373 int low;
374 int high;
375 } ipcache;
376
377 struct {
378 int size;
379 } fqdncache;
380 int minDirectHops;
381 int minDirectRtt;
382 cachemgr_passwd *passwd_list;
383
384 struct {
385 int objectsPerBucket;
386 int64_t avgObjectSize;
387 int64_t maxObjectSize;
388 int64_t minObjectSize;
389 size_t maxInMemObjSize;
390 } Store;
391
392 struct {
393 int high;
394 int low;
395 time_t period;
396 } Netdb;
397
398 struct {
399 int log_udp;
400 int res_defnames;
401 int anonymizer;
402 int client_db;
403 int query_icmp;
404 int icp_hit_stale;
405 int buffered_logs;
406 int common_log;
407 int log_mime_hdrs;
408 int log_fqdn;
409 int announce;
410 int mem_pools;
411 int test_reachability;
412 int half_closed_clients;
413 int refresh_all_ims;
414 #if USE_HTTP_VIOLATIONS
415
416 int reload_into_ims;
417 #endif
418
419 int offline;
420 int redir_rewrites_host;
421 int prefer_direct;
422 int nonhierarchical_direct;
423 int strip_query_terms;
424 int redirector_bypass;
425 int ignore_unknown_nameservers;
426 int client_pconns;
427 int server_pconns;
428 int error_pconns;
429 #if USE_CACHE_DIGESTS
430
431 int digest_generation;
432 #endif
433
434 int ie_refresh;
435 int vary_ignore_expire;
436 int pipeline_prefetch;
437 int surrogate_is_remote;
438 int request_entities;
439 int detect_broken_server_pconns;
440 int balance_on_multiple_ip;
441 int relaxed_header_parser;
442 int check_hostnames;
443 int allow_underscore;
444 int via;
445 int emailErrData;
446 int httpd_suppress_version_string;
447 int global_internal_static;
448
449 #if FOLLOW_X_FORWARDED_FOR
450 int acl_uses_indirect_client;
451 int delay_pool_uses_indirect_client;
452 int log_uses_indirect_client;
453 #if LINUX_NETFILTER
454 int tproxy_uses_indirect_client;
455 #endif
456 #endif /* FOLLOW_X_FORWARDED_FOR */
457
458 int WIN32_IpAddrChangeMonitor;
459 int memory_cache_first;
460 int memory_cache_disk;
461 int hostStrictVerify;
462 int client_dst_passthru;
463 } onoff;
464
465 int forward_max_tries;
466 int connect_retries;
467
468 class ACL *aclList;
469
470 struct {
471 acl_access *http;
472 acl_access *adapted_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 #if USE_HTTP_VIOLATIONS
485 acl_access *brokenPosts;
486 #endif
487 acl_access *redirector;
488 acl_access *reply;
489 acl_address *outgoing_address;
490 #if USE_HTCP
491
492 acl_access *htcp;
493 acl_access *htcp_clr;
494 #endif
495
496 #if USE_SSL
497 acl_access *ssl_bump;
498 #endif
499 #if FOLLOW_X_FORWARDED_FOR
500 acl_access *followXFF;
501 #endif /* FOLLOW_X_FORWARDED_FOR */
502
503 #if ICAP_CLIENT
504 acl_access* icap;
505 #endif
506 } accessList;
507 acl_deny_info_list *denyInfoList;
508
509 struct {
510 size_t list_width;
511 int list_wrap;
512 char *anon_user;
513 int passive;
514 int epsv_all;
515 int epsv;
516 int eprt;
517 int sanitycheck;
518 int telnet;
519 } Ftp;
520 refresh_t *Refresh;
521
522 struct _cacheSwap {
523 RefCount<SwapDir> *swapDirs;
524 int n_allocated;
525 int n_configured;
526 /// number of disk processes required to support all cache_dirs
527 int n_strands;
528 } cacheSwap;
529 /*
530 * I'm sick of having to keep doing this ..
531 */
532 #define INDEXSD(i) (Config.cacheSwap.swapDirs[(i)].getRaw())
533
534 struct {
535 char *directory;
536 int use_short_names;
537 } icons;
538 char *errorDirectory;
539 #if USE_ERR_LOCALES
540 char *errorDefaultLanguage;
541 int errorLogMissingLanguages;
542 #endif
543 char *errorStylesheet;
544
545 struct {
546 int onerror;
547 } retry;
548
549 struct {
550 int64_t limit;
551 } MemPools;
552 #if USE_DELAY_POOLS
553
554 DelayConfig Delay;
555 ClientDelayConfig ClientDelay;
556 #endif
557
558 struct {
559 int icp_average;
560 int dns_average;
561 int http_average;
562 int icp_min_poll;
563 int dns_min_poll;
564 int http_min_poll;
565 } comm_incoming;
566 int max_open_disk_fds;
567 int uri_whitespace;
568 acl_size_t *rangeOffsetLimit;
569 #if MULTICAST_MISS_STREAM
570
571 struct {
572
573 Ip::Address addr;
574 int ttl;
575 unsigned short port;
576 char *encode_key;
577 } mcast_miss;
578 #endif
579
580 /* one access list per header type we know of */
581 header_mangler request_header_access[HDR_ENUM_END];
582 /* one access list per header type we know of */
583 header_mangler reply_header_access[HDR_ENUM_END];
584 char *coredump_dir;
585 char *chroot_dir;
586 #if USE_CACHE_DIGESTS
587
588 struct {
589 int bits_per_entry;
590 time_t rebuild_period;
591 time_t rewrite_period;
592 size_t swapout_chunk_size;
593 int rebuild_chunk_percentage;
594 } digest;
595 #endif
596 #if USE_SSL
597
598 struct {
599 int unclean_shutdown;
600 char *ssl_engine;
601 } SSL;
602 #endif
603
604 wordlist *ext_methods;
605
606 struct {
607 int high_rptm;
608 int high_pf;
609 size_t high_memory;
610 } warnings;
611 char *store_dir_select_algorithm;
612 int sleep_after_fork; /* microseconds */
613 time_t minimum_expiry_time; /* seconds */
614 external_acl *externalAclHelperList;
615
616 #if USE_SSL
617
618 struct {
619 char *cert;
620 char *key;
621 int version;
622 char *options;
623 char *cipher;
624 char *cafile;
625 char *capath;
626 char *crlfile;
627 char *flags;
628 acl_access *cert_error;
629 SSL_CTX *sslContext;
630 } ssl_client;
631 #endif
632
633 char *accept_filter;
634 int umask;
635 int max_filedescriptors;
636 int workers;
637 CpuAffinityMap *cpuAffinityMap;
638
639 #if USE_LOADABLE_MODULES
640 wordlist *loadable_module_names;
641 #endif
642
643 int client_ip_max_connections;
644
645 struct {
646 int v4_first; ///< Place IPv4 first in the order of DNS results.
647 ssize_t packet_max; ///< maximum size EDNS advertised for DNS replies.
648 } dns;
649 };
650
651 SQUIDCEXTERN SquidConfig Config;
652
653 struct SquidConfig2 {
654 struct {
655 int enable_purge;
656 int mangle_request_headers;
657 } onoff;
658 uid_t effectiveUserID;
659 gid_t effectiveGroupID;
660 };
661
662 SQUIDCEXTERN SquidConfig2 Config2;
663
664 struct _close_handler {
665 PF *handler;
666 void *data;
667 close_handler *next;
668 };
669
670 struct _dread_ctrl {
671 int fd;
672 off_t offset;
673 int req_len;
674 char *buf;
675 int end_of_file;
676 DRCB *handler;
677 void *client_data;
678 };
679
680 struct _dwrite_q {
681 off_t file_offset;
682 char *buf;
683 size_t len;
684 size_t buf_offset;
685 dwrite_q *next;
686 FREE *free_func;
687 };
688
689 struct _fde_disk {
690 DWCB *wrt_handle;
691 void *wrt_handle_data;
692 dwrite_q *write_q;
693 dwrite_q *write_q_tail;
694 off_t offset;
695 };
696
697
698 /* per field statistics */
699
700 class HttpHeaderFieldStat
701 {
702
703 public:
704 HttpHeaderFieldStat() : aliveCount(0), seenCount(0), parsCount(0), errCount(0), repCount(0) {}
705
706 int aliveCount; /* created but not destroyed (count) */
707 int seenCount; /* #fields we've seen */
708 int parsCount; /* #parsing attempts */
709 int errCount; /* #pasring errors */
710 int repCount; /* #repetitons */
711 };
712
713 /* compiled version of HttpHeaderFieldAttrs plus stats */
714 #include "SquidString.h"
715
716 class HttpHeaderFieldInfo
717 {
718
719 public:
720 HttpHeaderFieldInfo() : id (HDR_ACCEPT), type (ftInvalid) {}
721
722 http_hdr_type id;
723 String name;
724 field_type type;
725 HttpHeaderFieldStat stat;
726 };
727
728 struct _http_state_flags {
729 unsigned int proxying:1;
730 unsigned int keepalive:1;
731 unsigned int only_if_cached:1;
732 unsigned int handling1xx:1; ///< we are ignoring or forwarding 1xx response
733 unsigned int headers_parsed:1;
734 unsigned int front_end_https:2;
735 unsigned int originpeer:1;
736 unsigned int keepalive_broken:1;
737 unsigned int abuse_detected:1;
738 unsigned int request_sent:1;
739 unsigned int do_next_read:1;
740 unsigned int consume_body_data:1;
741 unsigned int chunked:1; ///< reading a chunked response; TODO: rename
742 unsigned int chunked_request:1; ///< writing a chunked request
743 unsigned int sentLastChunk:1; ///< do not try to write last-chunk again
744 };
745
746 struct _domain_ping {
747 char *domain;
748 int do_ping; /* boolean */
749 domain_ping *next;
750 };
751
752 struct _domain_type {
753 char *domain;
754 peer_t type;
755 domain_type *next;
756 };
757
758 class PeerDigest;
759
760 struct peer {
761 u_int index;
762 char *name;
763 char *host;
764 peer_t type;
765
766 Ip::Address in_addr;
767
768 struct {
769 int pings_sent;
770 int pings_acked;
771 int fetches;
772 int rtt;
773 int ignored_replies;
774 int n_keepalives_sent;
775 int n_keepalives_recv;
776 time_t probe_start;
777 time_t last_query;
778 time_t last_reply;
779 time_t last_connect_failure;
780 time_t last_connect_probe;
781 int logged_state; /* so we can print dead/revived msgs */
782 int conn_open; /* current opened connections */
783 } stats;
784
785 struct {
786 int version;
787 int counts[ICP_END+1];
788 unsigned short port;
789 } icp;
790
791 #if USE_HTCP
792 struct {
793 double version;
794 int counts[2];
795 unsigned short port;
796 } htcp;
797 #endif
798
799 unsigned short http_port;
800 domain_ping *peer_domain;
801 domain_type *typelist;
802 acl_access *access;
803
804 struct {
805 unsigned int proxy_only:1;
806 unsigned int no_query:1;
807 unsigned int background_ping:1;
808 unsigned int no_digest:1;
809 unsigned int default_parent:1;
810 unsigned int roundrobin:1;
811 unsigned int weighted_roundrobin:1;
812 unsigned int mcast_responder:1;
813 unsigned int closest_only:1;
814 #if USE_HTCP
815 unsigned int htcp:1;
816 unsigned int htcp_oldsquid:1;
817 unsigned int htcp_no_clr:1;
818 unsigned int htcp_no_purge_clr:1;
819 unsigned int htcp_only_clr:1;
820 unsigned int htcp_forward_clr:1;
821 #endif
822 unsigned int no_netdb_exchange:1;
823 #if USE_DELAY_POOLS
824 unsigned int no_delay:1;
825 #endif
826 unsigned int allow_miss:1;
827 unsigned int carp:1;
828 struct {
829 unsigned int set:1; //If false, whole url is to be used. Overrides others
830 unsigned int scheme:1;
831 unsigned int host:1;
832 unsigned int port:1;
833 unsigned int path:1;
834 unsigned int params:1;
835 } carp_key;
836 #if USE_AUTH
837 unsigned int userhash:1;
838 #endif
839 unsigned int sourcehash:1;
840 unsigned int originserver:1;
841 unsigned int no_tproxy:1;
842 #if PEER_MULTICAST_SIBLINGS
843 unsigned int mcast_siblings:1;
844 #endif
845 } options;
846
847 int weight;
848 int basetime;
849
850 struct {
851 double avg_n_members;
852 int n_times_counted;
853 int n_replies_expected;
854 int ttl;
855 int id;
856
857 struct {
858 unsigned int count_event_pending:1;
859 unsigned int counting:1;
860 } flags;
861 } mcast;
862 #if USE_CACHE_DIGESTS
863
864 PeerDigest *digest;
865 char *digest_url;
866 #endif
867
868 int tcp_up; /* 0 if a connect() fails */
869
870 Ip::Address addresses[10];
871 int n_addresses;
872 int rr_count;
873 peer *next;
874 int testing_now;
875
876 struct {
877 unsigned int hash;
878 double load_multiplier;
879 double load_factor; /* normalized weight value */
880 } carp;
881 #if USE_AUTH
882 struct {
883 unsigned int hash;
884 double load_multiplier;
885 double load_factor; /* normalized weight value */
886 } userhash;
887 #endif
888 struct {
889 unsigned int hash;
890 double load_multiplier;
891 double load_factor; /* normalized weight value */
892 } sourcehash;
893
894 char *login; /* Proxy authorization */
895 time_t connect_timeout;
896 int connect_fail_limit;
897 int max_conn;
898 char *domain; /* Forced domain */
899 #if USE_SSL
900
901 int use_ssl;
902 char *sslcert;
903 char *sslkey;
904 int sslversion;
905 char *ssloptions;
906 char *sslcipher;
907 char *sslcafile;
908 char *sslcapath;
909 char *sslcrlfile;
910 char *sslflags;
911 char *ssldomain;
912 SSL_CTX *sslContext;
913 SSL_SESSION *sslSession;
914 #endif
915
916 int front_end_https;
917 int connection_auth;
918 };
919
920 struct _net_db_name {
921 hash_link hash; /* must be first */
922 net_db_name *next;
923 netdbEntry *net_db_entry;
924 };
925
926 struct _net_db_peer {
927 const char *peername;
928 double hops;
929 double rtt;
930 time_t expires;
931 };
932
933 struct _netdbEntry {
934 hash_link hash; /* must be first */
935 char network[MAX_IPSTRLEN];
936 int pings_sent;
937 int pings_recv;
938 double hops;
939 double rtt;
940 time_t next_ping_time;
941 time_t last_use_time;
942 int link_count;
943 net_db_name *hosts;
944 net_db_peer *peers;
945 int n_peers_alloc;
946 int n_peers;
947 };
948
949 struct _iostats {
950
951 enum { histSize = 16 };
952
953 struct {
954 int reads;
955 int reads_deferred;
956 int read_hist[histSize];
957 int writes;
958 int write_hist[histSize];
959 }
960
961 Http, Ftp, Gopher;
962 };
963
964
965 struct request_flags {
966 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),fail_on_validation_err(0),stale_if_hit(0),accelerated(0),ignore_cc(0),intercepted(0),spoof_client_ip(0),internal(0),internalclient(0),must_keepalive(0),chunked_reply(0),stream_error(0),sslBumped(0),destinationIPLookedUp_(0) {
967 #if USE_HTTP_VIOLATIONS
968 nocache_hack = 0;
969 #endif
970 #if FOLLOW_X_FORWARDED_FOR
971 done_follow_x_forwarded_for = 0;
972 #endif /* FOLLOW_X_FORWARDED_FOR */
973 }
974
975 unsigned int range:1;
976 unsigned int nocache:1;
977 unsigned int ims:1;
978 unsigned int auth:1;
979 unsigned int cachable:1;
980 unsigned int hierarchical:1;
981 unsigned int loopdetect:1;
982 unsigned int proxy_keepalive:1;
983 unsigned int proxying:
984 1; /* this should be killed, also in httpstateflags */
985 unsigned int refresh:1;
986 unsigned int redirected:1;
987 unsigned int need_validation:1;
988 unsigned int fail_on_validation_err:1; ///< whether we should fail if validation fails
989 unsigned int stale_if_hit:1; ///< reply is stale if it is a hit
990 #if USE_HTTP_VIOLATIONS
991 unsigned int nocache_hack:1; /* for changing/ignoring no-cache requests */
992 #endif
993 unsigned int accelerated:1;
994 unsigned int ignore_cc:1;
995 unsigned int intercepted:1; /**< transparently intercepted request */
996 unsigned int spoof_client_ip:1; /**< spoof client ip if possible */
997 unsigned int internal:1;
998 unsigned int internalclient:1;
999 unsigned int must_keepalive:1;
1000 unsigned int connection_auth:1; /** Request wants connection oriented auth */
1001 unsigned int connection_auth_disabled:1; /** Connection oriented auth can not be supported */
1002 unsigned int connection_proxy_auth:1; /** Request wants connection oriented auth */
1003 unsigned int pinned:1; /* Request sent on a pinned connection */
1004 unsigned int auth_sent:1; /* Authentication forwarded */
1005 unsigned int no_direct:1; /* Deny direct forwarding unless overriden by always_direct. Used in accelerator mode */
1006 unsigned int chunked_reply:1; /**< Reply with chunked transfer encoding */
1007 unsigned int stream_error:1; /**< Whether stream error has occured */
1008 unsigned int sslBumped:1; /**< ssl-bumped request*/
1009
1010 // When adding new flags, please update cloneAdaptationImmune() as needed.
1011
1012 bool resetTCP() const;
1013 void setResetTCP();
1014 void clearResetTCP();
1015 void destinationIPLookupCompleted();
1016 bool destinationIPLookedUp() const;
1017
1018 // returns a partial copy of the flags that includes only those flags
1019 // that are safe for a related (e.g., ICAP-adapted) request to inherit
1020 request_flags cloneAdaptationImmune() const;
1021
1022 #if FOLLOW_X_FORWARDED_FOR
1023 unsigned int done_follow_x_forwarded_for;
1024 #endif /* FOLLOW_X_FORWARDED_FOR */
1025 private:
1026
1027 unsigned int reset_tcp:1;
1028 unsigned int destinationIPLookedUp_:1;
1029 };
1030
1031 struct _link_list {
1032 void *ptr;
1033
1034 struct _link_list *next;
1035 };
1036
1037 struct _cachemgr_passwd {
1038 char *passwd;
1039 wordlist *actions;
1040 cachemgr_passwd *next;
1041 };
1042
1043 struct _refresh_t {
1044 const char *pattern;
1045 regex_t compiled_pattern;
1046 time_t min;
1047 double pct;
1048 time_t max;
1049 refresh_t *next;
1050
1051 struct {
1052 unsigned int icase:1;
1053 unsigned int refresh_ims:1;
1054 unsigned int store_stale:1;
1055 #if USE_HTTP_VIOLATIONS
1056 unsigned int override_expire:1;
1057 unsigned int override_lastmod:1;
1058 unsigned int reload_into_ims:1;
1059 unsigned int ignore_reload:1;
1060 unsigned int ignore_no_cache:1;
1061 unsigned int ignore_no_store:1;
1062 unsigned int ignore_must_revalidate:1;
1063 unsigned int ignore_private:1;
1064 unsigned int ignore_auth:1;
1065 #endif
1066 } flags;
1067 int max_stale;
1068 };
1069
1070
1071 struct _CacheDigest {
1072 /* public, read-only */
1073 char *mask; /* bit mask */
1074 int mask_size; /* mask size in bytes */
1075 int capacity; /* expected maximum for .count, not a hard limit */
1076 int bits_per_entry; /* number of bits allocated for each entry from capacity */
1077 int count; /* number of digested entries */
1078 int del_count; /* number of deletions performed so far */
1079 };
1080
1081
1082 struct _store_rebuild_data {
1083 int objcount; /* # objects successfully reloaded */
1084 int expcount; /* # objects expired */
1085 int scancount; /* # entries scanned or read from state file */
1086 int clashcount; /* # swapfile clashes avoided */
1087 int dupcount; /* # duplicates purged */
1088 int cancelcount; /* # SWAP_LOG_DEL objects purged */
1089 int invalid; /* # bad lines */
1090 int badflags; /* # bad e->flags */
1091 int bad_log_op;
1092 int zero_object_sz;
1093 };
1094
1095 class Logfile;
1096
1097 #include "format/Format.h"
1098 #include "log/Formats.h"
1099 struct _customlog {
1100 char *filename;
1101 ACLList *aclList;
1102 Format::Format *logFormat;
1103 Logfile *logfile;
1104 customlog *next;
1105 Log::Format::log_type type;
1106 };
1107
1108 #endif /* SQUID_STRUCTS_H */