net_db.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 ICMP_NET_DB_H
10 #define ICMP_NET_DB_H
11 
12 #include "hash.h"
13 #include "ip/forward.h"
14 #include "mem/forward.h"
15 
16 class CachePeer;
17 class HttpRequest;
18 class netdbEntry;
19 class StoreEntry;
20 class URL;
21 
23  public hash_link /* must be first */
24 {
26 
27 public:
28  net_db_name(const char *name, netdbEntry *);
30 
33 };
34 
35 // POD
37 {
38 public:
39  const char *peername;
40  double hops;
41  double rtt;
42  time_t expires;
43 };
44 
45 class netdbEntry:
46  public hash_link /* must be first */
47 {
49 
50 public:
51  netdbEntry() { *network = 0; }
52 
54  int pings_sent = 0;
55  int pings_recv = 0;
56  double hops = 0;
57  double rtt = 1.0;
58  time_t next_ping_time = 0;
59  time_t last_use_time = 0;
60  int link_count = 0;
61  net_db_name *hosts = nullptr;
62  net_db_peer *peers = nullptr;
63  int n_peers_alloc = 0;
64  int n_peers = 0;
65 };
66 
67 void netdbInit(void);
68 
69 void netdbHandlePingReply(const Ip::Address &from, int hops, int rtt);
70 void netdbPingSite(const char *hostname);
71 void netdbDump(StoreEntry *);
72 
73 void netdbFreeMemory(void);
74 int netdbHostHops(const char *host);
75 int netdbHostRtt(const char *host);
76 void netdbUpdatePeer(const URL &, CachePeer * e, int rtt, int hops);
77 
80 void netdbExchangeStart(void *);
81 
82 void netdbExchangeUpdatePeer(Ip::Address &, CachePeer *, double, double);
84 void netdbHostData(const char *host, int *samp, int *rtt, int *hops);
85 
86 #endif /* ICMP_NET_DB_H */
87 
CachePeer * netdbClosestParent(HttpRequest *)
Definition: net_db.cc:1307
int n_peers
Definition: net_db.h:64
~net_db_name()
Definition: net_db.h:29
double rtt
Definition: net_db.h:57
time_t next_ping_time
Definition: net_db.h:58
double hops
Definition: net_db.h:56
void netdbInit(void)
Definition: net_db.cc:884
int pings_sent
Definition: net_db.h:54
const char * peername
Definition: net_db.h:39
void netdbFreeMemory(void)
Definition: net_db.cc:954
Definition: URL.h:24
void netdbDeleteAddrNetwork(Ip::Address &addr)
Definition: net_db.cc:1164
netdbEntry * net_db_entry
Definition: net_db.h:32
void netdbDump(StoreEntry *)
Definition: net_db.cc:969
int link_count
Definition: net_db.h:60
void netdbHostData(const char *host, int *samp, int *rtt, int *hops)
Definition: net_db.cc:1066
int netdbHostHops(const char *host)
Definition: net_db.cc:1036
char network[MAX_IPSTRLEN]
Definition: net_db.h:53
void * addr
Definition: membanger.c:46
net_db_name(const char *name, netdbEntry *)
Definition: net_db.cc:141
MEMPROXY_CLASS(netdbEntry)
int n_peers_alloc
Definition: net_db.h:63
net_db_name * hosts
Definition: net_db.h:61
net_db_name * next
Definition: net_db.h:31
void netdbExchangeUpdatePeer(Ip::Address &, CachePeer *, double, double)
Definition: net_db.cc:1122
net_db_peer * peers
Definition: net_db.h:62
void netdbUpdatePeer(const URL &, CachePeer *e, int rtt, int hops)
Definition: net_db.cc:1086
int pings_recv
Definition: net_db.h:55
netdbEntry()
Definition: net_db.h:51
void netdbPingSite(const char *hostname)
Definition: net_db.cc:908
time_t last_use_time
Definition: net_db.h:59
double rtt
Definition: net_db.h:41
#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:1179
void netdbHandlePingReply(const Ip::Address &from, int hops, int rtt)
Definition: net_db.cc:924
double hops
Definition: net_db.h:40
time_t expires
Definition: net_db.h:42
#define xfree
void netdbExchangeStart(void *)
Definition: net_db.cc:1269
MEMPROXY_CLASS(net_db_name)
int netdbHostRtt(const char *host)
Definition: net_db.cc:1051

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors