]> git.ipfire.org Git - thirdparty/squid.git/blame - src/CachePeer.h
SourceFormat Enforcement
[thirdparty/squid.git] / src / CachePeer.h
CommitLineData
a011edee 1/*
4ac4a490 2 * Copyright (C) 1996-2017 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"
cdfb670c
AJ
17#include "security/PeerOptions.h"
18
a7458115
FC
19//TODO: remove, it is unconditionally defined and always used.
20#define PEER_MULTICAST_SIBLINGS 1
21
cb4f4424 22#if HAVE_OPENSSL_SSL_H
a011edee
FC
23#include <openssl/ssl.h>
24#endif
25
5844d003 26class NeighborTypeDomainList;
e8dca475 27class PconnPool;
a011edee 28class PeerDigest;
e8dca475 29class PeerPoolMgr;
a011edee 30
1b2f0924
FC
31class CachePeer
32{
719815a0
AJ
33 CBDATA_CLASS(CachePeer);
34
a011edee 35public:
719815a0
AJ
36 CachePeer();
37 ~CachePeer();
38
a011edee
FC
39 u_int index;
40 char *name;
41 char *host;
42 peer_t type;
43
44 Ip::Address in_addr;
45
46 struct {
47 int pings_sent;
48 int pings_acked;
49 int fetches;
50 int rtt;
51 int ignored_replies;
52 int n_keepalives_sent;
53 int n_keepalives_recv;
54 time_t probe_start;
55 time_t last_query;
56 time_t last_reply;
57 time_t last_connect_failure;
58 time_t last_connect_probe;
59 int logged_state; /* so we can print dead/revived msgs */
60 int conn_open; /* current opened connections */
61 } stats;
62
63 struct {
64 int version;
65 int counts[ICP_END+1];
66 unsigned short port;
67 } icp;
68
69#if USE_HTCP
70 struct {
71 double version;
72 int counts[2];
73 unsigned short port;
74 } htcp;
75#endif
76
77 unsigned short http_port;
5844d003 78 NeighborTypeDomainList *typelist;
a011edee
FC
79 acl_access *access;
80
81 struct {
ccdf4138
FC
82 bool proxy_only;
83 bool no_query;
84 bool background_ping;
85 bool no_digest;
86 bool default_parent;
87 bool roundrobin;
88 bool weighted_roundrobin;
89 bool mcast_responder;
90 bool closest_only;
a011edee 91#if USE_HTCP
ccdf4138
FC
92 bool htcp;
93 bool htcp_oldsquid;
94 bool htcp_no_clr;
95 bool htcp_no_purge_clr;
96 bool htcp_only_clr;
97 bool htcp_forward_clr;
a011edee 98#endif
ccdf4138 99 bool no_netdb_exchange;
a011edee 100#if USE_DELAY_POOLS
ccdf4138 101 bool no_delay;
a011edee 102#endif
ccdf4138
FC
103 bool allow_miss;
104 bool carp;
a011edee 105 struct {
ccdf4138
FC
106 bool set; //If false, whole url is to be used. Overrides others
107 bool scheme;
108 bool host;
109 bool port;
110 bool path;
111 bool params;
a011edee
FC
112 } carp_key;
113#if USE_AUTH
ccdf4138 114 bool userhash;
a011edee 115#endif
ccdf4138
FC
116 bool sourcehash;
117 bool originserver;
118 bool no_tproxy;
a011edee 119#if PEER_MULTICAST_SIBLINGS
ccdf4138 120 bool mcast_siblings;
a011edee 121#endif
9825b398 122 bool auth_no_keytab;
a011edee
FC
123 } options;
124
125 int weight;
126 int basetime;
127
128 struct {
129 double avg_n_members;
130 int n_times_counted;
131 int n_replies_expected;
132 int ttl;
133 int id;
134
135 struct {
ccdf4138
FC
136 bool count_event_pending;
137 bool counting;
a011edee
FC
138 } flags;
139 } mcast;
140#if USE_CACHE_DIGESTS
141
142 PeerDigest *digest;
143 char *digest_url;
144#endif
145
146 int tcp_up; /* 0 if a connect() fails */
147
148 Ip::Address addresses[10];
149 int n_addresses;
150 int rr_count;
151 CachePeer *next;
152 int testing_now;
153
154 struct {
155 unsigned int hash;
156 double load_multiplier;
157 double load_factor; /* normalized weight value */
158 } carp;
159#if USE_AUTH
160 struct {
161 unsigned int hash;
162 double load_multiplier;
163 double load_factor; /* normalized weight value */
164 } userhash;
165#endif
166 struct {
167 unsigned int hash;
168 double load_multiplier;
169 double load_factor; /* normalized weight value */
170 } sourcehash;
171
172 char *login; /* Proxy authorization */
173 time_t connect_timeout;
174 int connect_fail_limit;
175 int max_conn;
e8dca475
CT
176 struct {
177 PconnPool *pool; ///< idle connection pool for this peer
178 CbcPointer<PeerPoolMgr> mgr; ///< pool manager
179 int limit; ///< the limit itself
180 bool waitingForClose; ///< a conn must close before we open a standby conn
181 } standby; ///< optional "cache_peer standby=limit" feature
a011edee 182 char *domain; /* Forced domain */
a011edee 183
cdfb670c
AJ
184 /// security settings for peer connection
185 Security::PeerOptions secure;
900daee3 186 Security::ContextPointer sslContext;
5d9a65df 187 Security::SessionStatePointer sslSession;
a011edee
FC
188
189 int front_end_https;
190 int connection_auth;
191};
192
193#endif /* SQUID_CACHEPEER_H_ */
f53969cc 194