CachePeer.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2017 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 #include "security/PeerOptions.h"
18 
19 //TODO: remove, it is unconditionally defined and always used.
20 #define PEER_MULTICAST_SIBLINGS 1
21 
22 #if HAVE_OPENSSL_SSL_H
23 #include <openssl/ssl.h>
24 #endif
25 
27 class PconnPool;
28 class PeerDigest;
29 class PeerPoolMgr;
30 
31 class CachePeer
32 {
34 
35 public:
36  CachePeer() = default;
37  ~CachePeer();
38 
39  u_int index = 0;
40  char *name = nullptr;
41  char *host = nullptr;
43 
45 
46  struct {
47  int pings_sent = 0;
48  int pings_acked = 0;
49  int fetches = 0;
50  int rtt = 0;
51  int ignored_replies = 0;
54  time_t probe_start = 0;
55  time_t last_query = 0;
56  time_t last_reply = 0;
58  time_t last_connect_probe = 0;
60  int conn_open = 0;
61  } stats;
62 
63  struct icp_ {
64  icp_() { memset(&counts, 0, sizeof(counts)); }
66  int counts[ICP_END+1];
67  unsigned short port = CACHE_ICP_PORT;
68  } icp;
69 
70 #if USE_HTCP
71  struct {
72  double version = 0.0;
73  int counts[2] = {0, 0};
74  unsigned short port = 0;
75  } htcp;
76 #endif
77 
78  unsigned short http_port = CACHE_HTTP_PORT;
80  acl_access *access = nullptr;
81 
82  struct {
83  bool proxy_only = false;
84  bool no_query = false;
85  bool background_ping = false;
86  bool no_digest = false;
87  bool default_parent = false;
88  bool roundrobin = false;
89  bool weighted_roundrobin = false;
90  bool mcast_responder = false;
91  bool closest_only = false;
92 #if USE_HTCP
93  bool htcp = false;
94  bool htcp_oldsquid = false;
95  bool htcp_no_clr = false;
96  bool htcp_no_purge_clr = false;
97  bool htcp_only_clr = false;
98  bool htcp_forward_clr = false;
99 #endif
100  bool no_netdb_exchange = false;
101 #if USE_DELAY_POOLS
102  bool no_delay = false;
103 #endif
104  bool allow_miss = false;
105  bool carp = false;
106  struct {
107  bool set = false; //If false, whole url is to be used. Overrides others
108  bool scheme = false;
109  bool host = false;
110  bool port = false;
111  bool path = false;
112  bool params = false;
113  } carp_key;
114 #if USE_AUTH
115  bool userhash = false;
116 #endif
117  bool sourcehash = false;
118  bool originserver = false;
119  bool no_tproxy = false;
120 #if PEER_MULTICAST_SIBLINGS
121  bool mcast_siblings = false;
122 #endif
123  bool auth_no_keytab = false;
124  } options;
125 
126  int weight = 1;
127  int basetime = 0;
128 
129  struct {
130  double avg_n_members = 0.0;
133  int ttl = 0;
134  int id = 0;
135 
136  struct {
137  bool count_event_pending = false;
138  bool counting = false;
139  } flags;
140  } mcast;
141 
142 #if USE_CACHE_DIGESTS
143  PeerDigest *digest = nullptr;
144  char *digest_url = nullptr;
145 #endif
146 
147  int tcp_up = 0; /* 0 if a connect() fails */
149  bool reprobe = false;
150 
152  int n_addresses = 0;
153  int rr_count = 0;
154  CachePeer *next = nullptr;
155  int testing_now = 0;
156 
157  struct {
158  unsigned int hash = 0;
159  double load_multiplier = 0.0;
160  double load_factor = 0.0;
161  } carp;
162 #if USE_AUTH
163  struct {
164  unsigned int hash = 0;
165  double load_multiplier = 0.0;
166  double load_factor = 0.0;
167  } userhash;
168 #endif
169  struct {
170  unsigned int hash = 0;
171  double load_multiplier = 0.0;
172  double load_factor = 0.0;
173  } sourcehash;
174 
175  char *login = nullptr; /* Proxy authorization */
176  time_t connect_timeout_raw = 0;
178  int max_conn = 0;
179 
181  struct {
182  PconnPool *pool = nullptr;
184  int limit = 0;
185  bool waitingForClose = false;
186  } standby;
187 
188  char *domain = nullptr;
189 
194 
195  int front_end_https = 0;
196  int connection_auth = 2;
197 };
198 
199 #endif /* SQUID_CACHEPEER_H_ */
200 
int n_addresses
Definition: CachePeer.h:152
bool background_ping
Definition: CachePeer.h:85
~CachePeer()
Definition: CachePeer.cc:19
bool mcast_responder
Definition: CachePeer.h:90
PeerDigest * digest
Definition: CachePeer.h:143
struct CachePeer::icp_ icp
unsigned short port
Definition: CachePeer.h:67
double load_factor
normalized weight value
Definition: CachePeer.h:160
char * login
Definition: CachePeer.h:175
bool mcast_siblings
Definition: CachePeer.h:121
bool htcp_no_clr
Definition: CachePeer.h:95
bool waitingForClose
a conn must close before we open a standby conn
Definition: CachePeer.h:185
unsigned short port
Definition: CachePeer.h:74
CachePeer * next
Definition: CachePeer.h:154
char * domain
Forced domain.
Definition: CachePeer.h:188
bool counting
Definition: CachePeer.h:138
bool htcp_forward_clr
Definition: CachePeer.h:98
struct CachePeer::@30 htcp
std::unique_ptr< SSL_SESSION, HardFun< void, SSL_SESSION *,&SSL_SESSION_free > > SessionStatePointer
Definition: Session.h:43
double load_multiplier
Definition: CachePeer.h:159
int n_keepalives_recv
Definition: CachePeer.h:53
struct CachePeer::@29 stats
bool htcp_oldsquid
Definition: CachePeer.h:94
char * name
Definition: CachePeer.h:40
time_t last_connect_probe
Definition: CachePeer.h:58
time_t probe_start
Definition: CachePeer.h:54
int pings_sent
Definition: CachePeer.h:47
representation of a neighbor_type_domain configuration directive. A POD
TLS squid.conf settings for a remote server peer.
Definition: PeerOptions.h:22
bool auth_no_keytab
Definition: CachePeer.h:123
CbcPointer< PeerPoolMgr > mgr
pool manager
Definition: CachePeer.h:183
int conn_open
current opened connections
Definition: CachePeer.h:60
int ignored_replies
Definition: CachePeer.h:51
int rr_count
Definition: CachePeer.h:153
NeighborTypeDomainList * typelist
Definition: CachePeer.h:79
Security::ContextPointer sslContext
Definition: CachePeer.h:192
struct CachePeer::@36 standby
optional "cache_peer standby=limit" feature
bool sourcehash
Definition: CachePeer.h:117
bool htcp_no_purge_clr
Definition: CachePeer.h:96
time_t last_query
Definition: CachePeer.h:55
bool weighted_roundrobin
Definition: CachePeer.h:89
bool scheme
Definition: CachePeer.h:108
acl_access * access
Definition: CachePeer.h:80
CachePeer()=default
bool default_parent
Definition: CachePeer.h:87
double avg_n_members
Definition: CachePeer.h:130
#define ICP_VERSION_CURRENT
Definition: defines.h:78
int max_conn
Definition: CachePeer.h:178
PconnPool * pool
idle connection pool for this peer
Definition: CachePeer.h:182
Security::PeerOptions secure
security settings for peer connection
Definition: CachePeer.h:191
int counts[2]
Definition: CachePeer.h:73
int pings_acked
Definition: CachePeer.h:48
Ip::Address in_addr
Definition: CachePeer.h:44
std::shared_ptr< SSL_CTX > ContextPointer
Definition: Context.h:28
bool set
Definition: CachePeer.h:107
int n_replies_expected
Definition: CachePeer.h:132
u_int index
Definition: CachePeer.h:39
bool allow_miss
Definition: CachePeer.h:104
peer_t type
Definition: CachePeer.h:42
int fetches
Definition: CachePeer.h:49
bool no_digest
Definition: CachePeer.h:86
bool userhash
Definition: CachePeer.h:115
int connection_auth
0 - off, 1 - on, 2 - auto
Definition: CachePeer.h:196
unsigned int hash
Definition: CachePeer.h:158
#define CACHE_HTTP_PORT
Definition: squid.h:21
bool htcp_only_clr
Definition: CachePeer.h:97
struct CachePeer::@32::@38 flags
int n_keepalives_sent
Definition: CachePeer.h:52
int front_end_https
0 - off, 1 - on, 2 - auto
Definition: CachePeer.h:195
Ip::Address addresses[10]
Definition: CachePeer.h:151
int tcp_up
Definition: CachePeer.h:147
#define CACHE_ICP_PORT
Definition: squid.h:22
time_t last_reply
Definition: CachePeer.h:56
bool no_query
Definition: CachePeer.h:84
bool path
Definition: CachePeer.h:111
char * digest_url
Definition: CachePeer.h:144
int counts[ICP_END+1]
Definition: CachePeer.h:66
bool reprobe
whether to do another TCP probe after current TCP probes
Definition: CachePeer.h:149
time_t connect_timeout_raw
connect_timeout; use peerConnectTimeout() instead!
Definition: CachePeer.h:176
int n_times_counted
Definition: CachePeer.h:131
#define PEER_ALIVE
Definition: defines.h:126
bool no_delay
Definition: CachePeer.h:102
bool params
Definition: CachePeer.h:112
int limit
the limit itself
Definition: CachePeer.h:184
int weight
Definition: CachePeer.h:126
peer_t
Definition: enums.h:27
struct CachePeer::@31 options
double version
Definition: CachePeer.h:72
unsigned short http_port
Definition: CachePeer.h:78
bool closest_only
Definition: CachePeer.h:91
Maintains an fixed-size "standby" PconnPool for a single CachePeer.
Definition: PeerPoolMgr.h:21
struct CachePeer::@31::@37 carp_key
int rtt
Definition: CachePeer.h:50
bool no_tproxy
Definition: CachePeer.h:119
int connect_fail_limit
Definition: CachePeer.h:177
bool count_event_pending
Definition: CachePeer.h:137
bool carp
Definition: CachePeer.h:105
CBDATA_CLASS(CachePeer)
#define acl_access
Definition: forward.h:44
struct CachePeer::@32 mcast
Security::SessionStatePointer sslSession
Definition: CachePeer.h:193
time_t last_connect_failure
Definition: CachePeer.h:57
bool originserver
Definition: CachePeer.h:118
int testing_now
Definition: CachePeer.h:155
bool roundrobin
Definition: CachePeer.h:88
int logged_state
so we can print dead/revived msgs
Definition: CachePeer.h:59
char * host
Definition: CachePeer.h:41
int basetime
Definition: CachePeer.h:127
bool no_netdb_exchange
Definition: CachePeer.h:100
bool proxy_only
Definition: CachePeer.h:83

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors