]> git.ipfire.org Git - thirdparty/squid.git/blob - src/CachePeer.h
SourceFormat Enforcement
[thirdparty/squid.git] / src / CachePeer.h
1 /*
2 * Copyright (C) 1996-2014 The Squid Software Foundation and contributors
3 *
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
7 */
8
9 #ifndef SQUID_CACHEPEER_H_
10 #define SQUID_CACHEPEER_H_
11
12 #include "acl/forward.h"
13 #include "base/CbcPointer.h"
14 #include "enums.h"
15 #include "icp_opcode.h"
16 #include "ip/Address.h"
17
18 //TODO: remove, it is unconditionally defined and always used.
19 #define PEER_MULTICAST_SIBLINGS 1
20
21 #if HAVE_OPENSSL_SSL_H
22 #include <openssl/ssl.h>
23 #endif
24
25 class CachePeerDomainList;
26 class NeighborTypeDomainList;
27 class PconnPool;
28 class PeerDigest;
29 class PeerPoolMgr;
30
31 // currently a POD
32 class CachePeer
33 {
34 public:
35 u_int index;
36 char *name;
37 char *host;
38 peer_t type;
39
40 Ip::Address in_addr;
41
42 struct {
43 int pings_sent;
44 int pings_acked;
45 int fetches;
46 int rtt;
47 int ignored_replies;
48 int n_keepalives_sent;
49 int n_keepalives_recv;
50 time_t probe_start;
51 time_t last_query;
52 time_t last_reply;
53 time_t last_connect_failure;
54 time_t last_connect_probe;
55 int logged_state; /* so we can print dead/revived msgs */
56 int conn_open; /* current opened connections */
57 } stats;
58
59 struct {
60 int version;
61 int counts[ICP_END+1];
62 unsigned short port;
63 } icp;
64
65 #if USE_HTCP
66 struct {
67 double version;
68 int counts[2];
69 unsigned short port;
70 } htcp;
71 #endif
72
73 unsigned short http_port;
74 CachePeerDomainList *peer_domain;
75 NeighborTypeDomainList *typelist;
76 acl_access *access;
77
78 struct {
79 bool proxy_only;
80 bool no_query;
81 bool background_ping;
82 bool no_digest;
83 bool default_parent;
84 bool roundrobin;
85 bool weighted_roundrobin;
86 bool mcast_responder;
87 bool closest_only;
88 #if USE_HTCP
89 bool htcp;
90 bool htcp_oldsquid;
91 bool htcp_no_clr;
92 bool htcp_no_purge_clr;
93 bool htcp_only_clr;
94 bool htcp_forward_clr;
95 #endif
96 bool no_netdb_exchange;
97 #if USE_DELAY_POOLS
98 bool no_delay;
99 #endif
100 bool allow_miss;
101 bool carp;
102 struct {
103 bool set; //If false, whole url is to be used. Overrides others
104 bool scheme;
105 bool host;
106 bool port;
107 bool path;
108 bool params;
109 } carp_key;
110 #if USE_AUTH
111 bool userhash;
112 #endif
113 bool sourcehash;
114 bool originserver;
115 bool no_tproxy;
116 #if PEER_MULTICAST_SIBLINGS
117 bool mcast_siblings;
118 #endif
119 } options;
120
121 int weight;
122 int basetime;
123
124 struct {
125 double avg_n_members;
126 int n_times_counted;
127 int n_replies_expected;
128 int ttl;
129 int id;
130
131 struct {
132 bool count_event_pending;
133 bool counting;
134 } flags;
135 } mcast;
136 #if USE_CACHE_DIGESTS
137
138 PeerDigest *digest;
139 char *digest_url;
140 #endif
141
142 int tcp_up; /* 0 if a connect() fails */
143
144 Ip::Address addresses[10];
145 int n_addresses;
146 int rr_count;
147 CachePeer *next;
148 int testing_now;
149
150 struct {
151 unsigned int hash;
152 double load_multiplier;
153 double load_factor; /* normalized weight value */
154 } carp;
155 #if USE_AUTH
156 struct {
157 unsigned int hash;
158 double load_multiplier;
159 double load_factor; /* normalized weight value */
160 } userhash;
161 #endif
162 struct {
163 unsigned int hash;
164 double load_multiplier;
165 double load_factor; /* normalized weight value */
166 } sourcehash;
167
168 char *login; /* Proxy authorization */
169 time_t connect_timeout;
170 int connect_fail_limit;
171 int max_conn;
172 struct {
173 PconnPool *pool; ///< idle connection pool for this peer
174 CbcPointer<PeerPoolMgr> mgr; ///< pool manager
175 int limit; ///< the limit itself
176 bool waitingForClose; ///< a conn must close before we open a standby conn
177 } standby; ///< optional "cache_peer standby=limit" feature
178 char *domain; /* Forced domain */
179 #if USE_OPENSSL
180
181 int use_ssl;
182 char *sslcert;
183 char *sslkey;
184 int sslversion;
185 char *ssloptions;
186 char *sslcipher;
187 char *sslcafile;
188 char *sslcapath;
189 char *sslcrlfile;
190 char *sslflags;
191 char *ssldomain;
192 SSL_CTX *sslContext;
193 SSL_SESSION *sslSession;
194 #endif
195
196 int front_end_https;
197 int connection_auth;
198 };
199
200 #endif /* SQUID_CACHEPEER_H_ */
201