]> git.ipfire.org Git - thirdparty/squid.git/blame - src/icmp/net_db.h
SourceFormat Enforcement
[thirdparty/squid.git] / src / icmp / net_db.h
CommitLineData
bbc27441 1/*
4ac4a490 2 * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
bbc27441
AJ
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
71787d05
AJ
9#ifndef ICMP_NET_DB_H
10#define ICMP_NET_DB_H
11
5c78cfe4 12#include "hash.h"
5c51bffb 13#include "ip/forward.h"
3c670b50 14#include "mem/forward.h"
5c78cfe4 15
e0bd1c91 16class CachePeer;
001d55dc
FC
17class HttpRequest;
18class netdbEntry;
19class StoreEntry;
5c51bffb 20class URL;
b7ac5457 21
1b2f0924
FC
22class net_db_name
23{
3c670b50
AJ
24 MEMPROXY_CLASS(net_db_name);
25
5c78cfe4 26public:
3c670b50
AJ
27 net_db_name(const char *name, netdbEntry *);
28 ~net_db_name() {xfree(hash.key);}
29
5c78cfe4
FC
30 hash_link hash; /* must be first */
31 net_db_name *next;
32 netdbEntry *net_db_entry;
33};
34
001d55dc 35// POD
1b2f0924
FC
36class net_db_peer
37{
5c78cfe4
FC
38public:
39 const char *peername;
40 double hops;
41 double rtt;
42 time_t expires;
43};
44
1b2f0924
FC
45class netdbEntry
46{
1a7cfe02
AJ
47 MEMPROXY_CLASS(netdbEntry);
48
5c78cfe4 49public:
1a7cfe02
AJ
50 netdbEntry() { *network = 0; }
51
5c78cfe4
FC
52 hash_link hash; /* must be first */
53 char network[MAX_IPSTRLEN];
1a7cfe02
AJ
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;
5c78cfe4 65};
71787d05 66
001d55dc 67void netdbInit(void);
71787d05 68
001d55dc
FC
69void netdbHandlePingReply(const Ip::Address &from, int hops, int rtt);
70void netdbPingSite(const char *hostname);
59a09b98 71void netdbDump(StoreEntry *);
71787d05 72
001d55dc
FC
73void netdbFreeMemory(void);
74int netdbHostHops(const char *host);
75int netdbHostRtt(const char *host);
5c51bffb 76void netdbUpdatePeer(const URL &, CachePeer * e, int rtt, int hops);
71787d05 77
001d55dc
FC
78void netdbDeleteAddrNetwork(Ip::Address &addr);
79void netdbBinaryExchange(StoreEntry *);
80void netdbExchangeStart(void *);
71787d05 81
001d55dc
FC
82void netdbExchangeUpdatePeer(Ip::Address &, CachePeer *, double, double);
83CachePeer *netdbClosestParent(HttpRequest *);
84void netdbHostData(const char *host, int *samp, int *rtt, int *hops);
71787d05 85
71787d05 86#endif /* ICMP_NET_DB_H */
f53969cc 87