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 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
17class CachePeer;
18class HttpRequest;
19class netdbEntry;
20class PeerSelector;
21class StoreEntry;
22
24 public hash_link /* must be first */
25{
27
28public:
29 net_db_name(const char *name, netdbEntry *);
31
34};
35
36// POD
38{
39public:
41 const char *peername;
42
43 double hops;
44 double rtt;
45 time_t expires;
46};
47
49 public hash_link /* must be first */
50{
52
53public:
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;
67 int n_peers = 0;
68};
69
70void netdbInit(void);
71
72void netdbHandlePingReply(const Ip::Address &from, int hops, int rtt);
73void netdbPingSite(const char *hostname);
74void netdbDump(StoreEntry *);
75
76int netdbHostHops(const char *host);
77int netdbHostRtt(const char *host);
78void netdbUpdatePeer(const AnyP::Uri &, CachePeer *, int rtt, int hops);
79
82void netdbExchangeStart(void *);
83
84void netdbExchangeUpdatePeer(Ip::Address &, CachePeer *, double, double);
86void netdbHostData(const char *host, int *samp, int *rtt, int *hops);
87
88#endif /* ICMP_NET_DB_H */
89
Definition: Uri.h:31
net_db_name(const char *name, netdbEntry *)
Definition: net_db.cc:138
~net_db_name()
Definition: net_db.h:30
MEMPROXY_CLASS(net_db_name)
netdbEntry * net_db_entry
Definition: net_db.h:33
net_db_name * next
Definition: net_db.h:32
double hops
Definition: net_db.h:43
time_t expires
Definition: net_db.h:45
double rtt
Definition: net_db.h:44
const char * peername
associated CachePeer::host (i.e. cache_peer hostname, not name=value!)
Definition: net_db.h:41
int link_count
Definition: net_db.h:63
char network[MAX_IPSTRLEN]
Definition: net_db.h:56
double hops
Definition: net_db.h:59
int pings_recv
Definition: net_db.h:58
int n_peers_alloc
Definition: net_db.h:66
net_db_peer * peers
Definition: net_db.h:65
int pings_sent
Definition: net_db.h:57
time_t next_ping_time
Definition: net_db.h:61
time_t last_use_time
Definition: net_db.h:62
net_db_name * hosts
Definition: net_db.h:64
netdbEntry()
Definition: net_db.h:54
int n_peers
Definition: net_db.h:67
double rtt
Definition: net_db.h:60
MEMPROXY_CLASS(netdbEntry)
#define MAX_IPSTRLEN
Length of buffer that needs to be allocated to old a null-terminated IP-string.
Definition: forward.h:25
#define xfree
void netdbPingSite(const char *hostname)
Definition: net_db.cc:827
void netdbHostData(const char *host, int *samp, int *rtt, int *hops)
Definition: net_db.cc:977
int netdbHostHops(const char *host)
Definition: net_db.cc:944
int netdbHostRtt(const char *host)
Definition: net_db.cc:960
void netdbBinaryExchange(StoreEntry *)
Definition: net_db.cc:1107
void netdbDump(StoreEntry *)
Definition: net_db.cc:877
void netdbInit(void)
Definition: net_db.cc:803
void netdbExchangeStart(void *)
Definition: net_db.cc:1197
void netdbDeleteAddrNetwork(Ip::Address &addr)
Definition: net_db.cc:1090
CachePeer * netdbClosestParent(PeerSelector *)
Definition: net_db.cc:1258
void netdbExchangeUpdatePeer(Ip::Address &, CachePeer *, double, double)
Definition: net_db.cc:1043
void netdbUpdatePeer(const AnyP::Uri &, CachePeer *, int rtt, int hops)
Definition: net_db.cc:1002
void netdbHandlePingReply(const Ip::Address &from, int hops, int rtt)
Definition: net_db.cc:844

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors