]> git.ipfire.org Git - thirdparty/squid.git/blob - src/structs.h
Fix build errors when ICMP pinger is enabled.
[thirdparty/squid.git] / src / structs.h
1 /*
2 * SQUID Web Proxy Cache http://www.squid-cache.org/
3 * ----------------------------------------------------------
4 *
5 * Squid is the result of efforts by numerous individuals from
6 * the Internet community; see the CONTRIBUTORS file for full
7 * details. Many organizations have provided support for Squid's
8 * development; see the SPONSORS file for full details. Squid is
9 * Copyrighted (C) 2001 by the Regents of the University of
10 * California; see the COPYRIGHT file for full details. Squid
11 * incorporates software developed and/or copyrighted by other
12 * sources; see the CREDITS file for full details.
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
27 *
28 */
29 #ifndef SQUID_STRUCTS_H
30 #define SQUID_STRUCTS_H
31
32 #include "RefCount.h"
33 #include "cbdata.h"
34 #include "dlink.h"
35 #include "err_type.h"
36
37 /* needed for the global config */
38 #include "HttpHeader.h"
39
40 /* for ICP_END */
41 #include "icp_opcode.h"
42
43 #if USE_SSL
44 #include <openssl/ssl.h>
45 #endif
46
47 #define PEER_MULTICAST_SIBLINGS 1
48
49 struct acl_name_list {
50 char name[ACL_NAME_SZ];
51 acl_name_list *next;
52 };
53
54 struct acl_deny_info_list {
55 err_type err_page_id;
56 char *err_page_name;
57 acl_name_list *acl_list;
58 acl_deny_info_list *next;
59 };
60
61
62 class acl_access;
63
64 struct _header_mangler {
65 acl_access *access_list;
66 char *replacement;
67 };
68
69 class ACLChecklist;
70
71 #if SQUID_SNMP
72
73 struct _snmp_request_t {
74 u_char *buf;
75 u_char *outbuf;
76 int len;
77 int sock;
78 long reqid;
79 int outlen;
80
81 Ip::Address from;
82
83 struct snmp_pdu *PDU;
84 ACLChecklist *acl_checklist;
85 u_char *community;
86
87 struct snmp_session session;
88 };
89
90 #endif
91
92 class ACLList;
93
94 struct acl_address {
95 acl_address *next;
96 ACLList *aclList;
97
98 Ip::Address addr;
99 };
100
101 struct acl_tos {
102 acl_tos *next;
103 ACLList *aclList;
104 tos_t tos;
105 };
106
107 struct acl_nfmark {
108 acl_nfmark *next;
109 ACLList *aclList;
110 nfmark_t nfmark;
111 };
112
113 struct acl_size_t {
114 acl_size_t *next;
115 ACLList *aclList;
116 int64_t size;
117 };
118
119 struct ushortlist {
120 u_short i;
121 ushortlist *next;
122 };
123
124 struct relist {
125 int flags;
126 char *pattern;
127 regex_t regex;
128 relist *next;
129 };
130
131 #if USE_DELAY_POOLS
132 #include "DelayConfig.h"
133 #include "ClientDelayConfig.h"
134 #endif
135
136 #if USE_ICMP
137 #include "icmp/IcmpConfig.h"
138 #endif
139
140 #include "HelperChildConfig.h"
141
142 /* forward decl for SquidConfig, see RemovalPolicy.h */
143
144 class CpuAffinityMap;
145 class RemovalPolicySettings;
146 class external_acl;
147 class SwapDir;
148
149 /// Used for boolean enabled/disabled options with complex default logic.
150 /// Allows Squid to compute the right default after configuration.
151 /// Checks that not-yet-defined option values are not used.
152 class YesNoNone {
153 // TODO: generalize to non-boolean option types
154 public:
155 YesNoNone(): option(0) {}
156
157 /// returns true iff enabled; asserts if the option has not been configured
158 operator void *() const; // TODO: use a fancy/safer version of the operator
159
160 /// enables or disables the option;
161 void configure(bool beSet);
162
163 /// whether the option was enabled or disabled, by user or Squid
164 bool configured() const { return option != 0; }
165
166 private:
167 enum { optUnspecified = -1, optDisabled = 0, optEnabled = 1 };
168 int option; ///< configured value or zero
169 };
170
171 struct SquidConfig {
172
173 struct {
174 /* These should be for the Store::Root instance.
175 * this needs pluggable parsing to be done smoothly.
176 */
177 int highWaterMark;
178 int lowWaterMark;
179 } Swap;
180
181 YesNoNone memShared; ///< whether the memory cache is shared among workers
182 size_t memMaxSize;
183
184 struct {
185 int64_t min;
186 int pct;
187 int64_t max;
188 } quickAbort;
189 int64_t readAheadGap;
190 RemovalPolicySettings *replPolicy;
191 RemovalPolicySettings *memPolicy;
192 #if USE_HTTP_VIOLATIONS
193 time_t negativeTtl;
194 #endif
195 time_t maxStale;
196 time_t negativeDnsTtl;
197 time_t positiveDnsTtl;
198 time_t shutdownLifetime;
199 time_t backgroundPingRate;
200
201 struct {
202 time_t read;
203 time_t write;
204 time_t lifetime;
205 time_t connect;
206 time_t forward;
207 time_t peer_connect;
208 time_t request;
209 time_t persistent_request;
210 time_t pconn;
211 time_t siteSelect;
212 time_t deadPeer;
213 int icp_query; /* msec */
214 int icp_query_max; /* msec */
215 int icp_query_min; /* msec */
216 int mcast_icp_query; /* msec */
217 time_msec_t disk_io;
218
219 #if !USE_DNSSERVERS
220
221 time_msec_t idns_retransmit;
222 time_msec_t idns_query;
223 #endif
224
225 } Timeout;
226 size_t maxRequestHeaderSize;
227 int64_t maxRequestBodySize;
228 int64_t maxChunkedRequestBodySize;
229 size_t maxRequestBufferSize;
230 size_t maxReplyHeaderSize;
231 acl_size_t *ReplyBodySize;
232
233 struct {
234 u_short icp;
235 #if USE_HTCP
236
237 u_short htcp;
238 #endif
239 #if SQUID_SNMP
240
241 u_short snmp;
242 #endif
243 } Port;
244
245 struct {
246 http_port_list *http;
247 #if USE_SSL
248
249 https_port_list *https;
250 #endif
251
252 } Sockaddr;
253 #if SQUID_SNMP
254
255 struct {
256 char *configFile;
257 char *agentInfo;
258 } Snmp;
259 #endif
260 #if USE_WCCP
261
262 struct {
263 Ip::Address router;
264 Ip::Address address;
265 int version;
266 } Wccp;
267 #endif
268 #if USE_WCCPv2
269
270 struct {
271 Ip::Address_list *router;
272 Ip::Address address;
273 int forwarding_method;
274 int return_method;
275 int assignment_method;
276 int weight;
277 int rebuildwait;
278 void *info;
279 } Wccp2;
280 #endif
281
282 #if USE_ICMP
283 IcmpConfig pinger;
284 #endif
285
286 char *as_whois_server;
287
288 struct {
289 char *store;
290 char *swap;
291 customlog *accesslogs;
292 #if ICAP_CLIENT
293 customlog *icaplogs;
294 #endif
295 int rotateNumber;
296 } Log;
297 char *adminEmail;
298 char *EmailFrom;
299 char *EmailProgram;
300 char *effectiveUser;
301 char *visible_appname_string;
302 char *effectiveGroup;
303
304 struct {
305 #if USE_DNSSERVERS
306 char *dnsserver;
307 #endif
308
309 wordlist *redirect;
310 #if USE_UNLINKD
311
312 char *unlinkd;
313 #endif
314
315 char *diskd;
316 #if USE_SSL
317
318 char *ssl_password;
319 #endif
320
321 } Program;
322 #if USE_DNSSERVERS
323
324 HelperChildConfig dnsChildren;
325 #endif
326
327 HelperChildConfig redirectChildren;
328 time_t authenticateGCInterval;
329 time_t authenticateTTL;
330 time_t authenticateIpTTL;
331
332 struct {
333 char *surrogate_id;
334 } Accel;
335 char *appendDomain;
336 size_t appendDomainLen;
337 char *pidFilename;
338 char *netdbFilename;
339 char *mimeTablePathname;
340 char *etcHostsPath;
341 char *visibleHostname;
342 char *uniqueHostname;
343 wordlist *hostnameAliases;
344 char *errHtmlText;
345
346 struct {
347 char *host;
348 char *file;
349 time_t period;
350 u_short port;
351 } Announce;
352
353 struct {
354
355 Ip::Address udp_incoming;
356 Ip::Address udp_outgoing;
357 #if SQUID_SNMP
358 Ip::Address snmp_incoming;
359 Ip::Address snmp_outgoing;
360 #endif
361 /* FIXME INET6 : this should really be a CIDR value */
362 Ip::Address client_netmask;
363 } Addrs;
364 size_t tcpRcvBufsz;
365 size_t udpMaxHitObjsz;
366 wordlist *hierarchy_stoplist;
367 wordlist *mcast_group_list;
368 wordlist *dns_nameservers;
369 peer *peers;
370 int npeers;
371
372 struct {
373 int size;
374 int low;
375 int high;
376 } ipcache;
377
378 struct {
379 int size;
380 } fqdncache;
381 int minDirectHops;
382 int minDirectRtt;
383 cachemgr_passwd *passwd_list;
384
385 struct {
386 int objectsPerBucket;
387 int64_t avgObjectSize;
388 int64_t maxObjectSize;
389 int64_t minObjectSize;
390 size_t maxInMemObjSize;
391 } Store;
392
393 struct {
394 int high;
395 int low;
396 time_t period;
397 } Netdb;
398
399 struct {
400 int log_udp;
401 int res_defnames;
402 int anonymizer;
403 int client_db;
404 int query_icmp;
405 int icp_hit_stale;
406 int buffered_logs;
407 int common_log;
408 int log_mime_hdrs;
409 int log_fqdn;
410 int announce;
411 int mem_pools;
412 int test_reachability;
413 int half_closed_clients;
414 int refresh_all_ims;
415 #if USE_HTTP_VIOLATIONS
416
417 int reload_into_ims;
418 #endif
419
420 int offline;
421 int redir_rewrites_host;
422 int prefer_direct;
423 int nonhierarchical_direct;
424 int strip_query_terms;
425 int redirector_bypass;
426 int ignore_unknown_nameservers;
427 int client_pconns;
428 int server_pconns;
429 int error_pconns;
430 #if USE_CACHE_DIGESTS
431
432 int digest_generation;
433 #endif
434
435 int log_ip_on_direct;
436 int ie_refresh;
437 int vary_ignore_expire;
438 int pipeline_prefetch;
439 int surrogate_is_remote;
440 int request_entities;
441 int detect_broken_server_pconns;
442 int balance_on_multiple_ip;
443 int relaxed_header_parser;
444 int check_hostnames;
445 int allow_underscore;
446 int via;
447 int emailErrData;
448 int httpd_suppress_version_string;
449 int global_internal_static;
450 int dns_require_A;
451
452 #if FOLLOW_X_FORWARDED_FOR
453 int acl_uses_indirect_client;
454 int delay_pool_uses_indirect_client;
455 int log_uses_indirect_client;
456 #if LINUX_NETFILTER
457 int tproxy_uses_indirect_client;
458 #endif
459 #endif /* FOLLOW_X_FORWARDED_FOR */
460
461 int WIN32_IpAddrChangeMonitor;
462 int memory_cache_first;
463 int memory_cache_disk;
464 int client_dst_passthru;
465 } onoff;
466
467 int forward_max_tries;
468 int connect_retries;
469
470 class ACL *aclList;
471
472 struct {
473 acl_access *http;
474 acl_access *adapted_http;
475 acl_access *icp;
476 acl_access *miss;
477 acl_access *NeverDirect;
478 acl_access *AlwaysDirect;
479 acl_access *ASlists;
480 acl_access *noCache;
481 acl_access *log;
482 #if SQUID_SNMP
483
484 acl_access *snmp;
485 #endif
486 #if USE_HTTP_VIOLATIONS
487 acl_access *brokenPosts;
488 #endif
489 acl_access *redirector;
490 acl_access *reply;
491 acl_address *outgoing_address;
492 #if USE_HTCP
493
494 acl_access *htcp;
495 acl_access *htcp_clr;
496 #endif
497
498 #if USE_SSL
499 acl_access *ssl_bump;
500 #endif
501 #if FOLLOW_X_FORWARDED_FOR
502 acl_access *followXFF;
503 #endif /* FOLLOW_X_FORWARDED_FOR */
504
505 #if ICAP_CLIENT
506 acl_access* icap;
507 #endif
508 } accessList;
509 acl_deny_info_list *denyInfoList;
510
511 struct {
512 size_t list_width;
513 int list_wrap;
514 char *anon_user;
515 int passive;
516 int epsv_all;
517 int epsv;
518 int eprt;
519 int sanitycheck;
520 int telnet;
521 } Ftp;
522 refresh_t *Refresh;
523
524 struct _cacheSwap {
525 RefCount<SwapDir> *swapDirs;
526 int n_allocated;
527 int n_configured;
528 ///< number of disk processes required to support all cache_dirs
529 int n_strands;
530 } cacheSwap;
531 /*
532 * I'm sick of having to keep doing this ..
533 */
534 #define INDEXSD(i) (Config.cacheSwap.swapDirs[(i)].getRaw())
535
536 struct {
537 char *directory;
538 int use_short_names;
539 } icons;
540 char *errorDirectory;
541 #if USE_ERR_LOCALES
542 char *errorDefaultLanguage;
543 int errorLogMissingLanguages;
544 #endif
545 char *errorStylesheet;
546
547 struct {
548 int onerror;
549 } retry;
550
551 struct {
552 int64_t limit;
553 } MemPools;
554 #if USE_DELAY_POOLS
555
556 DelayConfig Delay;
557 ClientDelayConfig ClientDelay;
558 #endif
559
560 struct {
561 int icp_average;
562 int dns_average;
563 int http_average;
564 int icp_min_poll;
565 int dns_min_poll;
566 int http_min_poll;
567 } comm_incoming;
568 int max_open_disk_fds;
569 int uri_whitespace;
570 acl_size_t *rangeOffsetLimit;
571 #if MULTICAST_MISS_STREAM
572
573 struct {
574
575 Ip::Address addr;
576 int ttl;
577 unsigned short port;
578 char *encode_key;
579 } mcast_miss;
580 #endif
581
582 /* one access list per header type we know of */
583 header_mangler request_header_access[HDR_ENUM_END];
584 /* one access list per header type we know of */
585 header_mangler reply_header_access[HDR_ENUM_END];
586 char *coredump_dir;
587 char *chroot_dir;
588 #if USE_CACHE_DIGESTS
589
590 struct {
591 int bits_per_entry;
592 time_t rebuild_period;
593 time_t rewrite_period;
594 size_t swapout_chunk_size;
595 int rebuild_chunk_percentage;
596 } digest;
597 #endif
598 #if USE_SSL
599
600 struct {
601 int unclean_shutdown;
602 char *ssl_engine;
603 } SSL;
604 #endif
605
606 wordlist *ext_methods;
607
608 struct {
609 int high_rptm;
610 int high_pf;
611 size_t high_memory;
612 } warnings;
613 char *store_dir_select_algorithm;
614 int sleep_after_fork; /* microseconds */
615 time_t minimum_expiry_time; /* seconds */
616 external_acl *externalAclHelperList;
617
618 #if USE_SSL
619
620 struct {
621 char *cert;
622 char *key;
623 int version;
624 char *options;
625 char *cipher;
626 char *cafile;
627 char *capath;
628 char *crlfile;
629 char *flags;
630 acl_access *cert_error;
631 SSL_CTX *sslContext;
632 } ssl_client;
633 #endif
634
635 char *accept_filter;
636 int umask;
637 int max_filedescriptors;
638 int workers;
639 CpuAffinityMap *cpuAffinityMap;
640
641 #if USE_LOADABLE_MODULES
642 wordlist *loadable_module_names;
643 #endif
644
645 int client_ip_max_connections;
646
647 struct {
648 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 struct _fileMap {
699 int max_n_files;
700 int n_files_in_map;
701 int toggle;
702 int nwords;
703 unsigned long *file_map;
704 };
705
706 /*
707 * Note: HttpBody is used only for messages with a small content that is
708 * known a priory (e.g., error messages).
709 */
710
711 class MemBuf;
712
713 struct _HttpBody {
714 /* private */
715 MemBuf *mb;
716 };
717
718 #include "SquidString.h"
719 /* http header extention field */
720
721 class HttpHdrExtField
722 {
723 String name; /* field-name from HTTP/1.1 (no column after name) */
724 String value; /* field-value from HTTP/1.1 */
725 };
726
727 /* http cache control header field */
728
729 class HttpHdrCc
730 {
731
732 public:
733 int mask;
734 int max_age;
735 int s_maxage;
736 int max_stale;
737 int stale_if_error;
738 int min_fresh;
739 String other;
740 };
741
742 /* per field statistics */
743
744 class HttpHeaderFieldStat
745 {
746
747 public:
748 HttpHeaderFieldStat() : aliveCount(0), seenCount(0), parsCount(0), errCount(0), repCount(0) {}
749
750 int aliveCount; /* created but not destroyed (count) */
751 int seenCount; /* #fields we've seen */
752 int parsCount; /* #parsing attempts */
753 int errCount; /* #pasring errors */
754 int repCount; /* #repetitons */
755 };
756
757 /* compiled version of HttpHeaderFieldAttrs plus stats */
758
759 class HttpHeaderFieldInfo
760 {
761
762 public:
763 HttpHeaderFieldInfo() : id (HDR_ACCEPT), type (ftInvalid) {}
764
765 http_hdr_type id;
766 String name;
767 field_type type;
768 HttpHeaderFieldStat stat;
769 };
770
771 struct _http_state_flags {
772 unsigned int proxying:1;
773 unsigned int keepalive:1;
774 unsigned int only_if_cached:1;
775 unsigned int handling1xx:1; ///< we are ignoring or forwarding 1xx response
776 unsigned int headers_parsed:1;
777 unsigned int front_end_https:2;
778 unsigned int originpeer:1;
779 unsigned int keepalive_broken:1;
780 unsigned int abuse_detected:1;
781 unsigned int request_sent:1;
782 unsigned int do_next_read:1;
783 unsigned int consume_body_data:1;
784 unsigned int chunked:1; ///< reading a chunked response; TODO: rename
785 unsigned int chunked_request:1; ///< writing a chunked request
786 unsigned int sentLastChunk:1; ///< do not try to write last-chunk again
787 };
788
789 struct _domain_ping {
790 char *domain;
791 int do_ping; /* boolean */
792 domain_ping *next;
793 };
794
795 struct _domain_type {
796 char *domain;
797 peer_t type;
798 domain_type *next;
799 };
800
801 #if USE_CACHE_DIGESTS
802
803 /* statistics for cache digests and other hit "predictors" */
804
805 struct _cd_guess_stats {
806 /* public, read-only */
807 int true_hits;
808 int false_hits;
809 int true_misses;
810 int false_misses;
811 int close_hits; /* tmp, remove it later */
812 };
813
814 #endif
815
816 class PeerDigest;
817
818 struct peer {
819 u_int index;
820 char *name;
821 char *host;
822 peer_t type;
823
824 Ip::Address in_addr;
825
826 struct {
827 int pings_sent;
828 int pings_acked;
829 int fetches;
830 int rtt;
831 int ignored_replies;
832 int n_keepalives_sent;
833 int n_keepalives_recv;
834 time_t probe_start;
835 time_t last_query;
836 time_t last_reply;
837 time_t last_connect_failure;
838 time_t last_connect_probe;
839 int logged_state; /* so we can print dead/revived msgs */
840 int conn_open; /* current opened connections */
841 } stats;
842
843 struct {
844 int version;
845 int counts[ICP_END+1];
846 u_short port;
847 } icp;
848
849 #if USE_HTCP
850 struct {
851 double version;
852 int counts[2];
853 u_short port;
854 } htcp;
855 #endif
856
857 u_short http_port;
858 domain_ping *peer_domain;
859 domain_type *typelist;
860 acl_access *access;
861
862 struct {
863 unsigned int proxy_only:1;
864 unsigned int no_query:1;
865 unsigned int background_ping:1;
866 unsigned int no_digest:1;
867 unsigned int default_parent:1;
868 unsigned int roundrobin:1;
869 unsigned int weighted_roundrobin:1;
870 unsigned int mcast_responder:1;
871 unsigned int closest_only:1;
872 #if USE_HTCP
873 unsigned int htcp:1;
874 unsigned int htcp_oldsquid:1;
875 unsigned int htcp_no_clr:1;
876 unsigned int htcp_no_purge_clr:1;
877 unsigned int htcp_only_clr:1;
878 unsigned int htcp_forward_clr:1;
879 #endif
880 unsigned int no_netdb_exchange:1;
881 #if USE_DELAY_POOLS
882 unsigned int no_delay:1;
883 #endif
884 unsigned int allow_miss:1;
885 unsigned int carp:1;
886 struct {
887 unsigned int set:1; //If false, whole url is to be used. Overrides others
888 unsigned int scheme:1;
889 unsigned int host:1;
890 unsigned int port:1;
891 unsigned int path:1;
892 unsigned int params:1;
893 } carp_key;
894 #if USE_AUTH
895 unsigned int userhash:1;
896 #endif
897 unsigned int sourcehash:1;
898 unsigned int originserver:1;
899 unsigned int no_tproxy:1;
900 #if PEER_MULTICAST_SIBLINGS
901 unsigned int mcast_siblings:1;
902 #endif
903 } options;
904
905 int weight;
906 int basetime;
907
908 struct {
909 double avg_n_members;
910 int n_times_counted;
911 int n_replies_expected;
912 int ttl;
913 int id;
914
915 struct {
916 unsigned int count_event_pending:1;
917 unsigned int counting:1;
918 } flags;
919 } mcast;
920 #if USE_CACHE_DIGESTS
921
922 PeerDigest *digest;
923 char *digest_url;
924 #endif
925
926 int tcp_up; /* 0 if a connect() fails */
927
928 Ip::Address addresses[10];
929 int n_addresses;
930 int rr_count;
931 peer *next;
932 int testing_now;
933
934 struct {
935 unsigned int hash;
936 double load_multiplier;
937 double load_factor; /* normalized weight value */
938 } carp;
939 #if USE_AUTH
940 struct {
941 unsigned int hash;
942 double load_multiplier;
943 double load_factor; /* normalized weight value */
944 } userhash;
945 #endif
946 struct {
947 unsigned int hash;
948 double load_multiplier;
949 double load_factor; /* normalized weight value */
950 } sourcehash;
951
952 char *login; /* Proxy authorization */
953 time_t connect_timeout;
954 int connect_fail_limit;
955 int max_conn;
956 char *domain; /* Forced domain */
957 #if USE_SSL
958
959 int use_ssl;
960 char *sslcert;
961 char *sslkey;
962 int sslversion;
963 char *ssloptions;
964 char *sslcipher;
965 char *sslcafile;
966 char *sslcapath;
967 char *sslcrlfile;
968 char *sslflags;
969 char *ssldomain;
970 SSL_CTX *sslContext;
971 SSL_SESSION *sslSession;
972 #endif
973
974 int front_end_https;
975 int connection_auth;
976 };
977
978 struct _net_db_name {
979 hash_link hash; /* must be first */
980 net_db_name *next;
981 netdbEntry *net_db_entry;
982 };
983
984 struct _net_db_peer {
985 const char *peername;
986 double hops;
987 double rtt;
988 time_t expires;
989 };
990
991 struct _netdbEntry {
992 hash_link hash; /* must be first */
993 char network[MAX_IPSTRLEN];
994 int pings_sent;
995 int pings_recv;
996 double hops;
997 double rtt;
998 time_t next_ping_time;
999 time_t last_use_time;
1000 int link_count;
1001 net_db_name *hosts;
1002 net_db_peer *peers;
1003 int n_peers_alloc;
1004 int n_peers;
1005 };
1006
1007 struct _iostats {
1008
1009 enum { histSize = 16 };
1010
1011 struct {
1012 int reads;
1013 int reads_deferred;
1014 int read_hist[histSize];
1015 int writes;
1016 int write_hist[histSize];
1017 }
1018
1019 Http, Ftp, Gopher;
1020 };
1021
1022
1023 struct request_flags {
1024 request_flags(): range(0),nocache(0),ims(0),auth(0),cachable(0),hierarchical(0),loopdetect(0),proxy_keepalive(0),proxying(0),refresh(0),redirected(0),need_validation(0),fail_on_validation_err(0),stale_if_hit(0),accelerated(0),ignore_cc(0),intercepted(0),spoof_client_ip(0),internal(0),internalclient(0),must_keepalive(0),chunked_reply(0),stream_error(0),sslBumped(0),destinationIPLookedUp_(0) {
1025 #if USE_HTTP_VIOLATIONS
1026 nocache_hack = 0;
1027 #endif
1028 #if FOLLOW_X_FORWARDED_FOR
1029 done_follow_x_forwarded_for = 0;
1030 #endif /* FOLLOW_X_FORWARDED_FOR */
1031 }
1032
1033 unsigned int range:1;
1034 unsigned int nocache:1;
1035 unsigned int ims:1;
1036 unsigned int auth:1;
1037 unsigned int cachable:1;
1038 unsigned int hierarchical:1;
1039 unsigned int loopdetect:1;
1040 unsigned int proxy_keepalive:1;
1041 unsigned int proxying:
1042 1; /* this should be killed, also in httpstateflags */
1043 unsigned int refresh:1;
1044 unsigned int redirected:1;
1045 unsigned int need_validation:1;
1046 unsigned int fail_on_validation_err:1; ///< whether we should fail if validation fails
1047 unsigned int stale_if_hit:1; ///< reply is stale if it is a hit
1048 #if USE_HTTP_VIOLATIONS
1049 unsigned int nocache_hack:1; /* for changing/ignoring no-cache requests */
1050 #endif
1051 unsigned int accelerated:1;
1052 unsigned int ignore_cc:1;
1053 unsigned int intercepted:1; /**< transparently intercepted request */
1054 unsigned int spoof_client_ip:1; /**< spoof client ip if possible */
1055 unsigned int internal:1;
1056 unsigned int internalclient:1;
1057 unsigned int must_keepalive:1;
1058 unsigned int connection_auth:1; /** Request wants connection oriented auth */
1059 unsigned int connection_auth_disabled:1; /** Connection oriented auth can not be supported */
1060 unsigned int connection_proxy_auth:1; /** Request wants connection oriented auth */
1061 unsigned int pinned:1; /* Request sent on a pinned connection */
1062 unsigned int auth_sent:1; /* Authentication forwarded */
1063 unsigned int no_direct:1; /* Deny direct forwarding unless overriden by always_direct. Used in accelerator mode */
1064 unsigned int chunked_reply:1; /**< Reply with chunked transfer encoding */
1065 unsigned int stream_error:1; /**< Whether stream error has occured */
1066 unsigned int sslBumped:1; /**< ssl-bumped request*/
1067
1068 // When adding new flags, please update cloneAdaptationImmune() as needed.
1069
1070 bool resetTCP() const;
1071 void setResetTCP();
1072 void clearResetTCP();
1073 void destinationIPLookupCompleted();
1074 bool destinationIPLookedUp() const;
1075
1076 // returns a partial copy of the flags that includes only those flags
1077 // that are safe for a related (e.g., ICAP-adapted) request to inherit
1078 request_flags cloneAdaptationImmune() const;
1079
1080 #if FOLLOW_X_FORWARDED_FOR
1081 unsigned int done_follow_x_forwarded_for;
1082 #endif /* FOLLOW_X_FORWARDED_FOR */
1083 private:
1084
1085 unsigned int reset_tcp:1;
1086 unsigned int destinationIPLookedUp_:1;
1087 };
1088
1089 struct _link_list {
1090 void *ptr;
1091
1092 struct _link_list *next;
1093 };
1094
1095 struct _cachemgr_passwd {
1096 char *passwd;
1097 wordlist *actions;
1098 cachemgr_passwd *next;
1099 };
1100
1101 struct _refresh_t {
1102 const char *pattern;
1103 regex_t compiled_pattern;
1104 time_t min;
1105 double pct;
1106 time_t max;
1107 refresh_t *next;
1108
1109 struct {
1110 unsigned int icase:1;
1111 unsigned int refresh_ims:1;
1112 unsigned int store_stale:1;
1113 #if USE_HTTP_VIOLATIONS
1114 unsigned int override_expire:1;
1115 unsigned int override_lastmod:1;
1116 unsigned int reload_into_ims:1;
1117 unsigned int ignore_reload:1;
1118 unsigned int ignore_no_cache:1;
1119 unsigned int ignore_no_store:1;
1120 unsigned int ignore_must_revalidate:1;
1121 unsigned int ignore_private:1;
1122 unsigned int ignore_auth:1;
1123 #endif
1124 } flags;
1125 int max_stale;
1126 };
1127
1128 /*
1129 * "very generic" histogram;
1130 * see important comments on hbase_f restrictions in StatHist.c
1131 */
1132
1133 struct _StatHist {
1134 int *bins;
1135 int capacity;
1136 double min;
1137 double max;
1138 double scale;
1139 hbase_f *val_in; /* e.g., log() for log-based histogram */
1140 hbase_f *val_out; /* e.g., exp() for log based histogram */
1141 };
1142
1143 /*
1144 * if you add a field to StatCounters,
1145 * you MUST sync statCountersInitSpecial, statCountersClean, and statCountersCopy
1146 */
1147
1148 struct _StatCounters {
1149
1150 struct {
1151 int clients;
1152 int requests;
1153 int hits;
1154 int mem_hits;
1155 int disk_hits;
1156 int errors;
1157 kb_t kbytes_in;
1158 kb_t kbytes_out;
1159 kb_t hit_kbytes_out;
1160 StatHist miss_svc_time;
1161 StatHist nm_svc_time;
1162 StatHist nh_svc_time;
1163 StatHist hit_svc_time;
1164 StatHist all_svc_time;
1165 } client_http;
1166
1167 struct {
1168
1169 struct {
1170 int requests;
1171 int errors;
1172 kb_t kbytes_in;
1173 kb_t kbytes_out;
1174 } all , http, ftp, other;
1175 } server;
1176
1177 struct {
1178 int pkts_sent;
1179 int queries_sent;
1180 int replies_sent;
1181 int pkts_recv;
1182 int queries_recv;
1183 int replies_recv;
1184 int hits_sent;
1185 int hits_recv;
1186 int replies_queued;
1187 int replies_dropped;
1188 kb_t kbytes_sent;
1189 kb_t q_kbytes_sent;
1190 kb_t r_kbytes_sent;
1191 kb_t kbytes_recv;
1192 kb_t q_kbytes_recv;
1193 kb_t r_kbytes_recv;
1194 StatHist query_svc_time;
1195 StatHist reply_svc_time;
1196 int query_timeouts;
1197 int times_used;
1198 } icp;
1199
1200 struct {
1201 int pkts_sent;
1202 int pkts_recv;
1203 } htcp;
1204
1205 struct {
1206 int requests;
1207 } unlink;
1208
1209 struct {
1210 StatHist svc_time;
1211 } dns;
1212
1213 struct {
1214 int times_used;
1215 kb_t kbytes_sent;
1216 kb_t kbytes_recv;
1217 kb_t memory;
1218 int msgs_sent;
1219 int msgs_recv;
1220 #if USE_CACHE_DIGESTS
1221
1222 cd_guess_stats guess;
1223 #endif
1224
1225 StatHist on_xition_count;
1226 } cd;
1227
1228 struct {
1229 int times_used;
1230 } netdb;
1231 int page_faults;
1232 unsigned long int select_loops;
1233 int select_fds;
1234 double select_time;
1235 double cputime;
1236
1237 struct timeval timestamp;
1238 StatHist comm_icp_incoming;
1239 StatHist comm_dns_incoming;
1240 StatHist comm_http_incoming;
1241 StatHist select_fds_hist;
1242
1243 struct {
1244 struct {
1245 int opens;
1246 int closes;
1247 int reads;
1248 int writes;
1249 int seeks;
1250 int unlinks;
1251 } disk;
1252
1253 struct {
1254 int accepts;
1255 int sockets;
1256 int connects;
1257 int binds;
1258 int closes;
1259 int reads;
1260 int writes;
1261 int recvfroms;
1262 int sendtos;
1263 } sock;
1264 int selects;
1265 } syscalls;
1266 int aborted_requests;
1267
1268 struct {
1269 int files_cleaned;
1270 int outs;
1271 int ins;
1272 } swap;
1273 };
1274
1275 /* per header statistics */
1276
1277 struct _HttpHeaderStat {
1278 const char *label;
1279 HttpHeaderMask *owner_mask;
1280
1281 StatHist hdrUCountDistr;
1282 StatHist fieldTypeDistr;
1283 StatHist ccTypeDistr;
1284 StatHist scTypeDistr;
1285
1286 int parsedCount;
1287 int ccParsedCount;
1288 int scParsedCount;
1289 int destroyedCount;
1290 int busyDestroyedCount;
1291 };
1292
1293
1294 struct _CacheDigest {
1295 /* public, read-only */
1296 char *mask; /* bit mask */
1297 int mask_size; /* mask size in bytes */
1298 int capacity; /* expected maximum for .count, not a hard limit */
1299 int bits_per_entry; /* number of bits allocated for each entry from capacity */
1300 int count; /* number of digested entries */
1301 int del_count; /* number of deletions performed so far */
1302 };
1303
1304
1305 struct _store_rebuild_data {
1306 int objcount; /* # objects successfully reloaded */
1307 int expcount; /* # objects expired */
1308 int scancount; /* # entries scanned or read from state file */
1309 int clashcount; /* # swapfile clashes avoided */
1310 int dupcount; /* # duplicates purged */
1311 int cancelcount; /* # SWAP_LOG_DEL objects purged */
1312 int invalid; /* # bad lines */
1313 int badflags; /* # bad e->flags */
1314 int bad_log_op;
1315 int zero_object_sz;
1316 };
1317
1318 class Logfile;
1319
1320 #include "format/Format.h"
1321 #include "log/Formats.h"
1322 struct _customlog {
1323 char *filename;
1324 ACLList *aclList;
1325 Format::Format *logFormat;
1326 Logfile *logfile;
1327 customlog *next;
1328 Log::Format::log_type type;
1329 };
1330
1331 #endif /* SQUID_STRUCTS_H */