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

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors