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