]> git.ipfire.org Git - thirdparty/squid.git/blob - src/structs.h
Merged from trunk
[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 SwapDir;
148
149 /// Used for boolean enabled/disabled options with complex default logic.
150 /// Allows Squid to compute the right default after configuration.
151 /// Checks that not-yet-defined option values are not used.
152 class YesNoNone
153 {
154 // TODO: generalize to non-boolean option types
155 public:
156 YesNoNone(): option(0) {}
157
158 /// returns true iff enabled; asserts if the option has not been configured
159 operator void *() const; // TODO: use a fancy/safer version of the operator
160
161 /// enables or disables the option;
162 void configure(bool beSet);
163
164 /// whether the option was enabled or disabled, by user or Squid
165 bool configured() const { return option != 0; }
166
167 private:
168 enum { optUnspecified = -1, optDisabled = 0, optEnabled = 1 };
169 int option; ///< configured value or zero
170 };
171
172 struct SquidConfig {
173
174 struct {
175 /* These should be for the Store::Root instance.
176 * this needs pluggable parsing to be done smoothly.
177 */
178 int highWaterMark;
179 int lowWaterMark;
180 } Swap;
181
182 YesNoNone memShared; ///< whether the memory cache is shared among workers
183 size_t memMaxSize;
184
185 struct {
186 int64_t min;
187 int pct;
188 int64_t max;
189 } quickAbort;
190 int64_t readAheadGap;
191 RemovalPolicySettings *replPolicy;
192 RemovalPolicySettings *memPolicy;
193 #if USE_HTTP_VIOLATIONS
194 time_t negativeTtl;
195 #endif
196 time_t maxStale;
197 time_t negativeDnsTtl;
198 time_t positiveDnsTtl;
199 time_t shutdownLifetime;
200 time_t backgroundPingRate;
201
202 struct {
203 time_t read;
204 time_t write;
205 time_t lifetime;
206 time_t connect;
207 time_t forward;
208 time_t peer_connect;
209 time_t request;
210 time_t clientIdlePconn;
211 time_t serverIdlePconn;
212 time_t siteSelect;
213 time_t deadPeer;
214 int icp_query; /* msec */
215 int icp_query_max; /* msec */
216 int icp_query_min; /* msec */
217 int mcast_icp_query; /* msec */
218
219 #if !USE_DNSSERVERS
220
221 time_msec_t idns_retransmit;
222 time_msec_t idns_query;
223 #endif
224
225 } Timeout;
226 size_t maxRequestHeaderSize;
227 int64_t maxRequestBodySize;
228 int64_t maxChunkedRequestBodySize;
229 size_t maxRequestBufferSize;
230 size_t maxReplyHeaderSize;
231 acl_size_t *ReplyBodySize;
232
233 struct {
234 unsigned short icp;
235 #if USE_HTCP
236
237 unsigned short htcp;
238 #endif
239 #if SQUID_SNMP
240
241 unsigned short snmp;
242 #endif
243 } Port;
244
245 struct {
246 http_port_list *http;
247 #if USE_SSL
248
249 https_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_DNSSERVERS
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_DNSSERVERS
323
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 int dns_require_A;
450
451 #if FOLLOW_X_FORWARDED_FOR
452 int acl_uses_indirect_client;
453 int delay_pool_uses_indirect_client;
454 int log_uses_indirect_client;
455 #if LINUX_NETFILTER
456 int tproxy_uses_indirect_client;
457 #endif
458 #endif /* FOLLOW_X_FORWARDED_FOR */
459
460 int WIN32_IpAddrChangeMonitor;
461 int memory_cache_first;
462 int memory_cache_disk;
463 int hostStrictVerify;
464 int client_dst_passthru;
465 } onoff;
466
467 int forward_max_tries;
468 int connect_retries;
469
470 class ACL *aclList;
471
472 struct {
473 acl_access *http;
474 acl_access *adapted_http;
475 acl_access *icp;
476 acl_access *miss;
477 acl_access *NeverDirect;
478 acl_access *AlwaysDirect;
479 acl_access *ASlists;
480 acl_access *noCache;
481 acl_access *log;
482 #if SQUID_SNMP
483
484 acl_access *snmp;
485 #endif
486 #if USE_HTTP_VIOLATIONS
487 acl_access *brokenPosts;
488 #endif
489 acl_access *redirector;
490 acl_access *reply;
491 acl_address *outgoing_address;
492 #if USE_HTCP
493
494 acl_access *htcp;
495 acl_access *htcp_clr;
496 #endif
497
498 #if USE_SSL
499 acl_access *ssl_bump;
500 #endif
501 #if FOLLOW_X_FORWARDED_FOR
502 acl_access *followXFF;
503 #endif /* FOLLOW_X_FORWARDED_FOR */
504
505 #if ICAP_CLIENT
506 acl_access* icap;
507 #endif
508 } accessList;
509 acl_deny_info_list *denyInfoList;
510
511 struct {
512 size_t list_width;
513 int list_wrap;
514 char *anon_user;
515 int passive;
516 int epsv_all;
517 int epsv;
518 int eprt;
519 int sanitycheck;
520 int telnet;
521 } Ftp;
522 refresh_t *Refresh;
523
524 struct _cacheSwap {
525 RefCount<SwapDir> *swapDirs;
526 int n_allocated;
527 int n_configured;
528 /// number of disk processes required to support all cache_dirs
529 int n_strands;
530 } cacheSwap;
531 /*
532 * I'm sick of having to keep doing this ..
533 */
534 #define INDEXSD(i) (Config.cacheSwap.swapDirs[(i)].getRaw())
535
536 struct {
537 char *directory;
538 int use_short_names;
539 } icons;
540 char *errorDirectory;
541 #if USE_ERR_LOCALES
542 char *errorDefaultLanguage;
543 int errorLogMissingLanguages;
544 #endif
545 char *errorStylesheet;
546
547 struct {
548 int onerror;
549 } retry;
550
551 struct {
552 int64_t limit;
553 } MemPools;
554 #if USE_DELAY_POOLS
555
556 DelayConfig Delay;
557 ClientDelayConfig ClientDelay;
558 #endif
559
560 struct {
561 int icp_average;
562 int dns_average;
563 int http_average;
564 int icp_min_poll;
565 int dns_min_poll;
566 int http_min_poll;
567 } comm_incoming;
568 int max_open_disk_fds;
569 int uri_whitespace;
570 acl_size_t *rangeOffsetLimit;
571 #if MULTICAST_MISS_STREAM
572
573 struct {
574
575 Ip::Address addr;
576 int ttl;
577 unsigned short port;
578 char *encode_key;
579 } mcast_miss;
580 #endif
581
582 /* one access list per header type we know of */
583 header_mangler request_header_access[HDR_ENUM_END];
584 /* one access list per header type we know of */
585 header_mangler reply_header_access[HDR_ENUM_END];
586 char *coredump_dir;
587 char *chroot_dir;
588 #if USE_CACHE_DIGESTS
589
590 struct {
591 int bits_per_entry;
592 time_t rebuild_period;
593 time_t rewrite_period;
594 size_t swapout_chunk_size;
595 int rebuild_chunk_percentage;
596 } digest;
597 #endif
598 #if USE_SSL
599
600 struct {
601 int unclean_shutdown;
602 char *ssl_engine;
603 } SSL;
604 #endif
605
606 wordlist *ext_methods;
607
608 struct {
609 int high_rptm;
610 int high_pf;
611 size_t high_memory;
612 } warnings;
613 char *store_dir_select_algorithm;
614 int sleep_after_fork; /* microseconds */
615 time_t minimum_expiry_time; /* seconds */
616 external_acl *externalAclHelperList;
617
618 #if USE_SSL
619
620 struct {
621 char *cert;
622 char *key;
623 int version;
624 char *options;
625 char *cipher;
626 char *cafile;
627 char *capath;
628 char *crlfile;
629 char *flags;
630 acl_access *cert_error;
631 SSL_CTX *sslContext;
632 } ssl_client;
633 #endif
634
635 char *accept_filter;
636 int umask;
637 int max_filedescriptors;
638 int workers;
639 CpuAffinityMap *cpuAffinityMap;
640
641 #if USE_LOADABLE_MODULES
642 wordlist *loadable_module_names;
643 #endif
644
645 int client_ip_max_connections;
646
647 struct {
648 int v4_first; ///< Place IPv4 first in the order of DNS results.
649 ssize_t packet_max; ///< maximum size EDNS advertised for DNS replies.
650 } dns;
651 };
652
653 SQUIDCEXTERN SquidConfig Config;
654
655 struct SquidConfig2 {
656 struct {
657 int enable_purge;
658 int mangle_request_headers;
659 } onoff;
660 uid_t effectiveUserID;
661 gid_t effectiveGroupID;
662 };
663
664 SQUIDCEXTERN SquidConfig2 Config2;
665
666 struct _close_handler {
667 PF *handler;
668 void *data;
669 close_handler *next;
670 };
671
672 struct _dread_ctrl {
673 int fd;
674 off_t offset;
675 int req_len;
676 char *buf;
677 int end_of_file;
678 DRCB *handler;
679 void *client_data;
680 };
681
682 struct _dwrite_q {
683 off_t file_offset;
684 char *buf;
685 size_t len;
686 size_t buf_offset;
687 dwrite_q *next;
688 FREE *free_func;
689 };
690
691 struct _fde_disk {
692 DWCB *wrt_handle;
693 void *wrt_handle_data;
694 dwrite_q *write_q;
695 dwrite_q *write_q_tail;
696 off_t offset;
697 };
698
699
700 /* per field statistics */
701
702 class HttpHeaderFieldStat
703 {
704
705 public:
706 HttpHeaderFieldStat() : aliveCount(0), seenCount(0), parsCount(0), errCount(0), repCount(0) {}
707
708 int aliveCount; /* created but not destroyed (count) */
709 int seenCount; /* #fields we've seen */
710 int parsCount; /* #parsing attempts */
711 int errCount; /* #pasring errors */
712 int repCount; /* #repetitons */
713 };
714
715 /* compiled version of HttpHeaderFieldAttrs plus stats */
716 #include "SquidString.h"
717
718 class HttpHeaderFieldInfo
719 {
720
721 public:
722 HttpHeaderFieldInfo() : id (HDR_ACCEPT), type (ftInvalid) {}
723
724 http_hdr_type id;
725 String name;
726 field_type type;
727 HttpHeaderFieldStat stat;
728 };
729
730 struct _http_state_flags {
731 unsigned int proxying:1;
732 unsigned int keepalive:1;
733 unsigned int only_if_cached:1;
734 unsigned int handling1xx:1; ///< we are ignoring or forwarding 1xx response
735 unsigned int headers_parsed:1;
736 unsigned int front_end_https:2;
737 unsigned int originpeer:1;
738 unsigned int keepalive_broken:1;
739 unsigned int abuse_detected:1;
740 unsigned int request_sent:1;
741 unsigned int do_next_read:1;
742 unsigned int consume_body_data:1;
743 unsigned int chunked:1; ///< reading a chunked response; TODO: rename
744 unsigned int chunked_request:1; ///< writing a chunked request
745 unsigned int sentLastChunk:1; ///< do not try to write last-chunk again
746 };
747
748 struct _domain_ping {
749 char *domain;
750 int do_ping; /* boolean */
751 domain_ping *next;
752 };
753
754 struct _domain_type {
755 char *domain;
756 peer_t type;
757 domain_type *next;
758 };
759
760 class PeerDigest;
761
762 struct peer {
763 u_int index;
764 char *name;
765 char *host;
766 peer_t type;
767
768 Ip::Address in_addr;
769
770 struct {
771 int pings_sent;
772 int pings_acked;
773 int fetches;
774 int rtt;
775 int ignored_replies;
776 int n_keepalives_sent;
777 int n_keepalives_recv;
778 time_t probe_start;
779 time_t last_query;
780 time_t last_reply;
781 time_t last_connect_failure;
782 time_t last_connect_probe;
783 int logged_state; /* so we can print dead/revived msgs */
784 int conn_open; /* current opened connections */
785 } stats;
786
787 struct {
788 int version;
789 int counts[ICP_END+1];
790 unsigned short port;
791 } icp;
792
793 #if USE_HTCP
794 struct {
795 double version;
796 int counts[2];
797 unsigned short port;
798 } htcp;
799 #endif
800
801 unsigned short http_port;
802 domain_ping *peer_domain;
803 domain_type *typelist;
804 acl_access *access;
805
806 struct {
807 unsigned int proxy_only:1;
808 unsigned int no_query:1;
809 unsigned int background_ping:1;
810 unsigned int no_digest:1;
811 unsigned int default_parent:1;
812 unsigned int roundrobin:1;
813 unsigned int weighted_roundrobin:1;
814 unsigned int mcast_responder:1;
815 unsigned int closest_only:1;
816 #if USE_HTCP
817 unsigned int htcp:1;
818 unsigned int htcp_oldsquid:1;
819 unsigned int htcp_no_clr:1;
820 unsigned int htcp_no_purge_clr:1;
821 unsigned int htcp_only_clr:1;
822 unsigned int htcp_forward_clr:1;
823 #endif
824 unsigned int no_netdb_exchange:1;
825 #if USE_DELAY_POOLS
826 unsigned int no_delay:1;
827 #endif
828 unsigned int allow_miss:1;
829 unsigned int carp:1;
830 struct {
831 unsigned int set:1; //If false, whole url is to be used. Overrides others
832 unsigned int scheme:1;
833 unsigned int host:1;
834 unsigned int port:1;
835 unsigned int path:1;
836 unsigned int params:1;
837 } carp_key;
838 #if USE_AUTH
839 unsigned int userhash:1;
840 #endif
841 unsigned int sourcehash:1;
842 unsigned int originserver:1;
843 unsigned int no_tproxy:1;
844 #if PEER_MULTICAST_SIBLINGS
845 unsigned int mcast_siblings:1;
846 #endif
847 } options;
848
849 int weight;
850 int basetime;
851
852 struct {
853 double avg_n_members;
854 int n_times_counted;
855 int n_replies_expected;
856 int ttl;
857 int id;
858
859 struct {
860 unsigned int count_event_pending:1;
861 unsigned int counting:1;
862 } flags;
863 } mcast;
864 #if USE_CACHE_DIGESTS
865
866 PeerDigest *digest;
867 char *digest_url;
868 #endif
869
870 int tcp_up; /* 0 if a connect() fails */
871
872 Ip::Address addresses[10];
873 int n_addresses;
874 int rr_count;
875 peer *next;
876 int testing_now;
877
878 struct {
879 unsigned int hash;
880 double load_multiplier;
881 double load_factor; /* normalized weight value */
882 } carp;
883 #if USE_AUTH
884 struct {
885 unsigned int hash;
886 double load_multiplier;
887 double load_factor; /* normalized weight value */
888 } userhash;
889 #endif
890 struct {
891 unsigned int hash;
892 double load_multiplier;
893 double load_factor; /* normalized weight value */
894 } sourcehash;
895
896 char *login; /* Proxy authorization */
897 time_t connect_timeout;
898 int connect_fail_limit;
899 int max_conn;
900 char *domain; /* Forced domain */
901 #if USE_SSL
902
903 int use_ssl;
904 char *sslcert;
905 char *sslkey;
906 int sslversion;
907 char *ssloptions;
908 char *sslcipher;
909 char *sslcafile;
910 char *sslcapath;
911 char *sslcrlfile;
912 char *sslflags;
913 char *ssldomain;
914 SSL_CTX *sslContext;
915 SSL_SESSION *sslSession;
916 #endif
917
918 int front_end_https;
919 int connection_auth;
920 };
921
922 struct _net_db_name {
923 hash_link hash; /* must be first */
924 net_db_name *next;
925 netdbEntry *net_db_entry;
926 };
927
928 struct _net_db_peer {
929 const char *peername;
930 double hops;
931 double rtt;
932 time_t expires;
933 };
934
935 struct _netdbEntry {
936 hash_link hash; /* must be first */
937 char network[MAX_IPSTRLEN];
938 int pings_sent;
939 int pings_recv;
940 double hops;
941 double rtt;
942 time_t next_ping_time;
943 time_t last_use_time;
944 int link_count;
945 net_db_name *hosts;
946 net_db_peer *peers;
947 int n_peers_alloc;
948 int n_peers;
949 };
950
951 struct _iostats {
952
953 enum { histSize = 16 };
954
955 struct {
956 int reads;
957 int reads_deferred;
958 int read_hist[histSize];
959 int writes;
960 int write_hist[histSize];
961 }
962
963 Http, Ftp, Gopher;
964 };
965
966
967 struct request_flags {
968 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) {
969 #if USE_HTTP_VIOLATIONS
970 nocache_hack = 0;
971 #endif
972 #if FOLLOW_X_FORWARDED_FOR
973 done_follow_x_forwarded_for = 0;
974 #endif /* FOLLOW_X_FORWARDED_FOR */
975 }
976
977 unsigned int range:1;
978 unsigned int nocache:1;
979 unsigned int ims:1;
980 unsigned int auth:1;
981 unsigned int cachable:1;
982 unsigned int hierarchical:1;
983 unsigned int loopdetect:1;
984 unsigned int proxy_keepalive:1;
985 unsigned int proxying:
986 1; /* this should be killed, also in httpstateflags */
987 unsigned int refresh:1;
988 unsigned int redirected:1;
989 unsigned int need_validation:1;
990 unsigned int fail_on_validation_err:1; ///< whether we should fail if validation fails
991 unsigned int stale_if_hit:1; ///< reply is stale if it is a hit
992 #if USE_HTTP_VIOLATIONS
993 unsigned int nocache_hack:1; /* for changing/ignoring no-cache requests */
994 #endif
995 unsigned int accelerated:1;
996 unsigned int ignore_cc:1;
997 unsigned int intercepted:1; /**< transparently intercepted request */
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 */