net_db.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2018 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 ICMP_NET_DB_H
10 #define 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:
40  const char *peername;
41  double hops;
42  double rtt;
43  time_t expires;
44 };
45 
46 class netdbEntry:
47  public hash_link /* must be first */
48 {
50 
51 public:
52  netdbEntry() { *network = 0; }
53 
55  int pings_sent = 0;
56  int pings_recv = 0;
57  double hops = 0;
58  double rtt = 1.0;
59  time_t next_ping_time = 0;
60  time_t last_use_time = 0;
61  int link_count = 0;
62  net_db_name *hosts = nullptr;
63  net_db_peer *peers = nullptr;
64  int n_peers_alloc = 0;
65  int n_peers = 0;
66 };
67 
68 void netdbInit(void);
69 
70 void netdbHandlePingReply(const Ip::Address &from, int hops, int rtt);
71 void netdbPingSite(const char *hostname);
72 void netdbDump(StoreEntry *);
73 
74 void netdbFreeMemory(void);
75 int netdbHostHops(const char *host);
76 int netdbHostRtt(const char *host);
77 void netdbUpdatePeer(const AnyP::Uri &, CachePeer *, int rtt, int hops);
78 
81 void netdbExchangeStart(void *);
82 
83 void netdbExchangeUpdatePeer(Ip::Address &, CachePeer *, double, double);
85 void netdbHostData(const char *host, int *samp, int *rtt, int *hops);
86 
87 #endif /* ICMP_NET_DB_H */
88 
int n_peers
Definition: net_db.h:65
~net_db_name()
Definition: net_db.h:30
double rtt
Definition: net_db.h:58
time_t next_ping_time
Definition: net_db.h:59
double hops
Definition: net_db.h:57
void netdbInit(void)
Definition: net_db.cc:885
int pings_sent
Definition: net_db.h:55
const char * peername
Definition: net_db.h:40
void netdbFreeMemory(void)
Definition: net_db.cc:955
void netdbDeleteAddrNetwork(Ip::Address &addr)
Definition: net_db.cc:1165
netdbEntry * net_db_entry
Definition: net_db.h:33
void netdbDump(StoreEntry *)
Definition: net_db.cc:970
int link_count
Definition: net_db.h:61
void netdbHostData(const char *host, int *samp, int *rtt, int *hops)
Definition: net_db.cc:1067
int netdbHostHops(const char *host)
Definition: net_db.cc:1037
char network[MAX_IPSTRLEN]
Definition: net_db.h:54
void netdbUpdatePeer(const AnyP::Uri &, CachePeer *, int rtt, int hops)
Definition: net_db.cc:1087
void * addr
Definition: membanger.c:46
net_db_name(const char *name, netdbEntry *)
Definition: net_db.cc:142
MEMPROXY_CLASS(netdbEntry)
CachePeer * netdbClosestParent(PeerSelector *)
Definition: net_db.cc:1308
int n_peers_alloc
Definition: net_db.h:64
net_db_name * hosts
Definition: net_db.h:62
net_db_name * next
Definition: net_db.h:32
void netdbExchangeUpdatePeer(Ip::Address &, CachePeer *, double, double)
Definition: net_db.cc:1123
net_db_peer * peers
Definition: net_db.h:63
Definition: Uri.h:30
int pings_recv
Definition: net_db.h:56
netdbEntry()
Definition: net_db.h:52
void netdbPingSite(const char *hostname)
Definition: net_db.cc:909
time_t last_use_time
Definition: net_db.h:60
double rtt
Definition: net_db.h:42
#define MAX_IPSTRLEN
Length of buffer that needs to be allocated to old a null-terminated IP-string.
Definition: forward.h:23
void netdbBinaryExchange(StoreEntry *)
Definition: net_db.cc:1180
void netdbHandlePingReply(const Ip::Address &from, int hops, int rtt)
Definition: net_db.cc:925
double hops
Definition: net_db.h:41
time_t expires
Definition: net_db.h:43
#define xfree
void netdbExchangeStart(void *)
Definition: net_db.cc:1270
MEMPROXY_CLASS(net_db_name)
int netdbHostRtt(const char *host)
Definition: net_db.cc:1052

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors