]> git.ipfire.org Git - thirdparty/squid.git/blame - src/CachePeer.h
SourceFormat Enforcement
[thirdparty/squid.git] / src / CachePeer.h
CommitLineData
a011edee 1/*
bde978a6 2 * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
a011edee 3 *
bbc27441
AJ
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.
a011edee
FC
7 */
8
bbc27441
AJ
9#ifndef SQUID_CACHEPEER_H_
10#define SQUID_CACHEPEER_H_
11
6f58d7d7 12#include "acl/forward.h"
e8dca475 13#include "base/CbcPointer.h"
a011edee
FC
14#include "enums.h"
15#include "icp_opcode.h"
16#include "ip/Address.h"
17
a7458115
FC
18//TODO: remove, it is unconditionally defined and always used.
19#define PEER_MULTICAST_SIBLINGS 1
20
cb4f4424 21#if HAVE_OPENSSL_SSL_H
a011edee
FC
22#include <openssl/ssl.h>
23#endif
24
b802d2cb 25class CachePeerDomainList;
5844d003 26class NeighborTypeDomainList;
e8dca475 27class PconnPool;
a011edee 28class PeerDigest;
e8dca475 29class PeerPoolMgr;
a011edee 30
001d55dc 31// currently a POD
1b2f0924
FC
32class CachePeer
33{
a011edee
FC
34public:
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;
b802d2cb 74 CachePeerDomainList *peer_domain;
5844d003 75 NeighborTypeDomainList *typelist;
a011edee
FC
76 acl_access *access;
77
78 struct {
ccdf4138
FC
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;
a011edee 88#if USE_HTCP
ccdf4138
FC
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;
a011edee 95#endif
ccdf4138 96 bool no_netdb_exchange;
a011edee 97#if USE_DELAY_POOLS
ccdf4138 98 bool no_delay;
a011edee 99#endif
ccdf4138
FC
100 bool allow_miss;
101 bool carp;
a011edee 102 struct {
ccdf4138
FC
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;
a011edee
FC
109 } carp_key;
110#if USE_AUTH
ccdf4138 111 bool userhash;
a011edee 112#endif
ccdf4138
FC
113 bool sourcehash;
114 bool originserver;
115 bool no_tproxy;
a011edee 116#if PEER_MULTICAST_SIBLINGS
ccdf4138 117 bool mcast_siblings;
a011edee
FC
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 {
ccdf4138
FC
132 bool count_event_pending;
133 bool counting;
a011edee
FC
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;
e8dca475
CT
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
a011edee 178 char *domain; /* Forced domain */
cb4f4424 179#if USE_OPENSSL
a011edee
FC
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_ */
f53969cc 201