]> git.ipfire.org Git - thirdparty/squid.git/blob - src/structs.h
merge from trunk (r12216 v3.2.0.18+)
[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 ///request_header_add access list
578 HeaderWithAclList *request_header_add;
579 char *coredump_dir;
580 char *chroot_dir;
581 #if USE_CACHE_DIGESTS
582
583 struct {
584 int bits_per_entry;
585 time_t rebuild_period;
586 time_t rewrite_period;
587 size_t swapout_chunk_size;
588 int rebuild_chunk_percentage;
589 } digest;
590 #endif
591 #if USE_SSL
592
593 struct {
594 int unclean_shutdown;
595 char *ssl_engine;
596 } SSL;
597 #endif
598
599 wordlist *ext_methods;
600
601 struct {
602 int high_rptm;
603 int high_pf;
604 size_t high_memory;
605 } warnings;
606 char *store_dir_select_algorithm;
607 int sleep_after_fork; /* microseconds */
608 time_t minimum_expiry_time; /* seconds */
609 external_acl *externalAclHelperList;
610
611 #if USE_SSL
612
613 struct {
614 char *cert;
615 char *key;
616 int version;
617 char *options;
618 char *cipher;
619 char *cafile;
620 char *capath;
621 char *crlfile;
622 char *flags;
623 acl_access *cert_error;
624 SSL_CTX *sslContext;
625 sslproxy_cert_sign *cert_sign;
626 sslproxy_cert_adapt *cert_adapt;
627 } ssl_client;
628 #endif
629
630 char *accept_filter;
631 int umask;
632 int max_filedescriptors;
633 int workers;
634 CpuAffinityMap *cpuAffinityMap;
635
636 #if USE_LOADABLE_MODULES
637 wordlist *loadable_module_names;
638 #endif
639
640 int client_ip_max_connections;
641
642 struct {
643 int v4_first; ///< Place IPv4 first in the order of DNS results.
644 ssize_t packet_max; ///< maximum size EDNS advertised for DNS replies.
645 } dns;
646 };
647
648 SQUIDCEXTERN SquidConfig Config;
649
650 struct SquidConfig2 {
651 struct {
652 int enable_purge;
653 int mangle_request_headers;
654 } onoff;
655 uid_t effectiveUserID;
656 gid_t effectiveGroupID;
657 };
658
659 SQUIDCEXTERN SquidConfig2 Config2;
660
661 struct _close_handler {
662 PF *handler;
663 void *data;
664 close_handler *next;
665 };
666
667 struct _dread_ctrl {
668 int fd;
669 off_t offset;
670 int req_len;
671 char *buf;
672 int end_of_file;
673 DRCB *handler;
674 void *client_data;
675 };
676
677 struct _dwrite_q {
678 off_t file_offset;
679 char *buf;
680 size_t len;
681 size_t buf_offset;
682 dwrite_q *next;
683 FREE *free_func;
684 };
685
686 struct _fde_disk {
687 DWCB *wrt_handle;
688 void *wrt_handle_data;
689 dwrite_q *write_q;
690 dwrite_q *write_q_tail;
691 off_t offset;
692 };
693
694
695 /* per field statistics */
696
697 class HttpHeaderFieldStat
698 {
699
700 public:
701 HttpHeaderFieldStat() : aliveCount(0), seenCount(0), parsCount(0), errCount(0), repCount(0) {}
702
703 int aliveCount; /* created but not destroyed (count) */
704 int seenCount; /* #fields we've seen */
705 int parsCount; /* #parsing attempts */
706 int errCount; /* #pasring errors */
707 int repCount; /* #repetitons */
708 };
709
710 /* compiled version of HttpHeaderFieldAttrs plus stats */
711 #include "SquidString.h"
712
713 class HttpHeaderFieldInfo
714 {
715
716 public:
717 HttpHeaderFieldInfo() : id (HDR_ACCEPT), type (ftInvalid) {}
718
719 http_hdr_type id;
720 String name;
721 field_type type;
722 HttpHeaderFieldStat stat;
723 };
724
725 struct _http_state_flags {
726 unsigned int proxying:1;
727 unsigned int keepalive:1;
728 unsigned int only_if_cached:1;
729 unsigned int handling1xx:1; ///< we are ignoring or forwarding 1xx response
730 unsigned int headers_parsed:1;
731 unsigned int front_end_https:2;
732 unsigned int originpeer:1;
733 unsigned int keepalive_broken:1;
734 unsigned int abuse_detected:1;
735 unsigned int request_sent:1;
736 unsigned int do_next_read:1;
737 unsigned int consume_body_data:1;
738 unsigned int chunked:1; ///< reading a chunked response; TODO: rename
739 unsigned int chunked_request:1; ///< writing a chunked request
740 unsigned int sentLastChunk:1; ///< do not try to write last-chunk again
741 };
742
743 struct _domain_ping {
744 char *domain;
745 int do_ping; /* boolean */
746 domain_ping *next;
747 };
748
749 struct _domain_type {
750 char *domain;
751 peer_t type;
752 domain_type *next;
753 };
754
755 class PeerDigest;
756
757 struct peer {
758 u_int index;
759 char *name;
760 char *host;
761 peer_t type;
762
763 Ip::Address in_addr;
764
765 struct {
766 int pings_sent;
767 int pings_acked;
768 int fetches;
769 int rtt;
770 int ignored_replies;
771 int n_keepalives_sent;
772 int n_keepalives_recv;
773 time_t probe_start;
774 time_t last_query;
775 time_t last_reply;
776 time_t last_connect_failure;
777 time_t last_connect_probe;
778 int logged_state; /* so we can print dead/revived msgs */
779 int conn_open; /* current opened connections */
780 } stats;
781
782 struct {
783 int version;
784 int counts[ICP_END+1];
785 unsigned short port;
786 } icp;
787
788 #if USE_HTCP
789 struct {
790 double version;
791 int counts[2];
792 unsigned short port;
793 } htcp;
794 #endif
795
796 unsigned short http_port;
797 domain_ping *peer_domain;
798 domain_type *typelist;
799 acl_access *access;
800
801 struct {
802 unsigned int proxy_only:1;
803 unsigned int no_query:1;
804 unsigned int background_ping:1;
805 unsigned int no_digest:1;
806 unsigned int default_parent:1;
807 unsigned int roundrobin:1;
808 unsigned int weighted_roundrobin:1;
809 unsigned int mcast_responder:1;
810 unsigned int closest_only:1;
811 #if USE_HTCP
812 unsigned int htcp:1;
813 unsigned int htcp_oldsquid:1;
814 unsigned int htcp_no_clr:1;
815 unsigned int htcp_no_purge_clr:1;
816 unsigned int htcp_only_clr:1;
817 unsigned int htcp_forward_clr:1;
818 #endif
819 unsigned int no_netdb_exchange:1;
820 #if USE_DELAY_POOLS
821 unsigned int no_delay:1;
822 #endif
823 unsigned int allow_miss:1;
824 unsigned int carp:1;
825 struct {
826 unsigned int set:1; //If false, whole url is to be used. Overrides others
827 unsigned int scheme:1;
828 unsigned int host:1;
829 unsigned int port:1;
830 unsigned int path:1;
831 unsigned int params:1;
832 } carp_key;
833 #if USE_AUTH
834 unsigned int userhash:1;
835 #endif
836 unsigned int sourcehash:1;
837 unsigned int originserver:1;
838 unsigned int no_tproxy:1;
839 #if PEER_MULTICAST_SIBLINGS
840 unsigned int mcast_siblings:1;
841 #endif
842 } options;
843
844 int weight;
845 int basetime;
846
847 struct {
848 double avg_n_members;
849 int n_times_counted;
850 int n_replies_expected;
851 int ttl;
852 int id;
853
854 struct {
855 unsigned int count_event_pending:1;
856 unsigned int counting:1;
857 } flags;
858 } mcast;
859 #if USE_CACHE_DIGESTS
860
861 PeerDigest *digest;
862 char *digest_url;
863 #endif
864
865 int tcp_up; /* 0 if a connect() fails */
866
867 Ip::Address addresses[10];
868 int n_addresses;
869 int rr_count;
870 peer *next;
871 int testing_now;
872
873 struct {
874 unsigned int hash;
875 double load_multiplier;
876 double load_factor; /* normalized weight value */
877 } carp;
878 #if USE_AUTH
879 struct {
880 unsigned int hash;
881 double load_multiplier;
882 double load_factor; /* normalized weight value */
883 } userhash;
884 #endif
885 struct {
886 unsigned int hash;
887 double load_multiplier;
888 double load_factor; /* normalized weight value */
889 } sourcehash;
890
891 char *login; /* Proxy authorization */
892 time_t connect_timeout;
893 int connect_fail_limit;
894 int max_conn;
895 char *domain; /* Forced domain */
896 #if USE_SSL
897
898 int use_ssl;
899 char *sslcert;
900 char *sslkey;
901 int sslversion;
902 char *ssloptions;
903 char *sslcipher;
904 char *sslcafile;
905 char *sslcapath;
906 char *sslcrlfile;
907 char *sslflags;
908 char *ssldomain;
909 SSL_CTX *sslContext;
910 SSL_SESSION *sslSession;
911 #endif
912
913 int front_end_https;
914 int connection_auth;
915 };
916
917 struct _net_db_name {
918 hash_link hash; /* must be first */
919 net_db_name *next;
920 netdbEntry *net_db_entry;
921 };
922
923 struct _net_db_peer {
924 const char *peername;
925 double hops;
926 double rtt;
927 time_t expires;
928 };
929
930 struct _netdbEntry {
931 hash_link hash; /* must be first */
932 char network[MAX_IPSTRLEN];
933 int pings_sent;
934 int pings_recv;
935 double hops;
936 double rtt;
937 time_t next_ping_time;
938 time_t last_use_time;
939 int link_count;
940 net_db_name *hosts;
941 net_db_peer *peers;
942 int n_peers_alloc;
943 int n_peers;
944 };
945
946 struct _iostats {
947
948 enum { histSize = 16 };
949
950 struct {
951 int reads;
952 int reads_deferred;
953 int read_hist[histSize];
954 int writes;
955 int write_hist[histSize];
956 }
957
958 Http, Ftp, Gopher;
959 };
960
961
962 struct request_flags {
963 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),hostVerified(0),spoof_client_ip(0),internal(0),internalclient(0),must_keepalive(0),pinned(0),canRePin(0),chunked_reply(0),stream_error(0),sslPeek(0),sslBumped(0),destinationIPLookedUp_(0) {
964 #if USE_HTTP_VIOLATIONS
965 nocache_hack = 0;
966 #endif
967 #if FOLLOW_X_FORWARDED_FOR
968 done_follow_x_forwarded_for = 0;
969 #endif /* FOLLOW_X_FORWARDED_FOR */
970 }
971
972 unsigned int range:1;
973 unsigned int nocache:1; ///< whether the response to this request may be READ from cache
974 unsigned int ims:1;
975 unsigned int auth:1;
976 unsigned int cachable:1; ///< whether the response to thie request may be stored in the cache
977 unsigned int hierarchical:1;
978 unsigned int loopdetect:1;
979 unsigned int proxy_keepalive:1;
980 unsigned int proxying:
981 1; /* this should be killed, also in httpstateflags */
982 unsigned int refresh:1;
983 unsigned int redirected:1;
984 unsigned int need_validation:1;
985 unsigned int fail_on_validation_err:1; ///< whether we should fail if validation fails
986 unsigned int stale_if_hit:1; ///< reply is stale if it is a hit
987 #if USE_HTTP_VIOLATIONS
988 unsigned int nocache_hack:1; /* for changing/ignoring no-cache requests */
989 #endif
990 unsigned int accelerated:1;
991 unsigned int ignore_cc:1;
992 unsigned int intercepted:1; ///< intercepted request
993 unsigned int hostVerified:1; ///< whether the Host: header passed verification
994 unsigned int spoof_client_ip:1; /**< spoof client ip if possible */
995 unsigned int internal:1;
996 unsigned int internalclient:1;
997 unsigned int must_keepalive:1;
998 unsigned int connection_auth:1; /** Request wants connection oriented auth */
999 unsigned int connection_auth_disabled:1; /** Connection oriented auth can not be supported */
1000 unsigned int connection_proxy_auth:1; /** Request wants connection oriented auth */
1001 unsigned int pinned:1; /* Request sent on a pinned connection */
1002 unsigned int canRePin:1; ///< OK to reopen a failed pinned connection
1003 unsigned int auth_sent:1; /* Authentication forwarded */
1004 unsigned int no_direct:1; /* Deny direct forwarding unless overriden by always_direct. Used in accelerator mode */
1005 unsigned int chunked_reply:1; /**< Reply with chunked transfer encoding */
1006 unsigned int stream_error:1; /**< Whether stream error has occured */
1007 unsigned int sslPeek:1; ///< internal ssl-bump request to get server cert
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 #if USE_SSL
1096 struct _sslproxy_cert_sign {
1097 int alg;
1098 ACLList *aclList;
1099 sslproxy_cert_sign *next;
1100 };
1101
1102 struct _sslproxy_cert_adapt {
1103 int alg;
1104 char *param;
1105 ACLList *aclList;
1106 sslproxy_cert_adapt *next;
1107 };
1108 #endif
1109
1110 class Logfile;
1111
1112 #include "format/Format.h"
1113 #include "log/Formats.h"
1114 struct _customlog {
1115 char *filename;
1116 ACLList *aclList;
1117 Format::Format *logFormat;
1118 Logfile *logfile;
1119 customlog *next;
1120 Log::Format::log_type type;
1121 };
1122
1123 #endif /* SQUID_STRUCTS_H */