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