net_db.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2023 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_SRC_ICMP_NET_DB_H
10 #define SQUID_SRC_ICMP_NET_DB_H
11 
12 #include "anyp/forward.h"
13 #include "hash.h"
14 #include "ip/forward.h"
15 #include "mem/forward.h"
16 
17 class CachePeer;
18 class HttpRequest;
19 class netdbEntry;
20 class PeerSelector;
21 class StoreEntry;
22 
24  public hash_link /* must be first */
25 {
27 
28 public:
29  net_db_name(const char *name, netdbEntry *);
31 
34 };
35 
36 // POD
38 {
39 public:
41  const char *peername;
42 
43  double hops;
44  double rtt;
45  time_t expires;
46 };
47 
48 class netdbEntry:
49  public hash_link /* must be first */
50 {
52 
53 public:
54  netdbEntry() { *network = 0; }
55 
57  int pings_sent = 0;
58  int pings_recv = 0;
59  double hops = 0;
60  double rtt = 1.0;
61  time_t next_ping_time = 0;
62  time_t last_use_time = 0;
63  int link_count = 0;
64  net_db_name *hosts = nullptr;
65  net_db_peer *peers = nullptr;
66  int n_peers_alloc = 0;
67  int n_peers = 0;
68 };
69 
70 void netdbInit(void);
71 
72 void netdbHandlePingReply(const Ip::Address &from, int hops, int rtt);
73 void netdbPingSite(const char *hostname);
74 void netdbDump(StoreEntry *);
75 
76 int netdbHostHops(const char *host);
77 int netdbHostRtt(const char *host);
78 void netdbUpdatePeer(const AnyP::Uri &, CachePeer *, int rtt, int hops);
79 
82 void netdbExchangeStart(void *);
83 
84 void netdbExchangeUpdatePeer(Ip::Address &, CachePeer *, double, double);
86 void netdbHostData(const char *host, int *samp, int *rtt, int *hops);
87 
88 #endif /* SQUID_SRC_ICMP_NET_DB_H */
89 
net_db_name * next
Definition: net_db.h:32
int link_count
Definition: net_db.h:63
Definition: Uri.h:31
~net_db_name()
Definition: net_db.h:30
net_db_name(const char *name, netdbEntry *)
Definition: net_db.cc:138
net_db_peer * peers
Definition: net_db.h:65
int netdbHostRtt(const char *host)
Definition: net_db.cc:944
time_t last_use_time
Definition: net_db.h:62
int n_peers
Definition: net_db.h:67
CachePeer * netdbClosestParent(PeerSelector *)
Definition: net_db.cc:1242
void netdbDeleteAddrNetwork(Ip::Address &addr)
Definition: net_db.cc:1074
#define MAX_IPSTRLEN
Length of buffer that needs to be allocated to old a null-terminated IP-string.
Definition: forward.h:25
netdbEntry * net_db_entry
Definition: net_db.h:33
void netdbUpdatePeer(const AnyP::Uri &, CachePeer *, int rtt, int hops)
Definition: net_db.cc:986
void netdbDump(StoreEntry *)
Definition: net_db.cc:861
netdbEntry()
Definition: net_db.h:54
time_t expires
Definition: net_db.h:45
MEMPROXY_CLASS(netdbEntry)
double rtt
Definition: net_db.h:60
int n_peers_alloc
Definition: net_db.h:66
const char * peername
associated CachePeer::host (i.e. cache_peer hostname, not name=value!)
Definition: net_db.h:41
time_t next_ping_time
Definition: net_db.h:61
double rtt
Definition: net_db.h:44
#define xfree
void netdbHandlePingReply(const Ip::Address &from, int hops, int rtt)
Definition: net_db.cc:828
void netdbExchangeUpdatePeer(Ip::Address &, CachePeer *, double, double)
Definition: net_db.cc:1027
int pings_recv
Definition: net_db.h:58
void netdbHostData(const char *host, int *samp, int *rtt, int *hops)
Definition: net_db.cc:961
int pings_sent
Definition: net_db.h:57
int netdbHostHops(const char *host)
Definition: net_db.cc:928
MEMPROXY_CLASS(net_db_name)
void netdbInit(void)
Definition: net_db.cc:787
double hops
Definition: net_db.h:59
void netdbPingSite(const char *hostname)
Definition: net_db.cc:811
void netdbBinaryExchange(StoreEntry *)
Definition: net_db.cc:1091
double hops
Definition: net_db.h:43
net_db_name * hosts
Definition: net_db.h:64
char network[MAX_IPSTRLEN]
Definition: net_db.h:56
void netdbExchangeStart(void *)
Definition: net_db.cc:1181

 

Introduction

Documentation

Support

Miscellaneous