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