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