]>
Commit | Line | Data |
---|---|---|
bbc27441 | 1 | /* |
77b1029d | 2 | * Copyright (C) 1996-2020 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 | ||
c8ab5ec6 | 12 | #include "anyp/forward.h" |
5c78cfe4 | 13 | #include "hash.h" |
5c51bffb | 14 | #include "ip/forward.h" |
3c670b50 | 15 | #include "mem/forward.h" |
5c78cfe4 | 16 | |
e0bd1c91 | 17 | class CachePeer; |
001d55dc FC |
18 | class HttpRequest; |
19 | class netdbEntry; | |
cb365059 | 20 | class PeerSelector; |
001d55dc | 21 | class StoreEntry; |
b7ac5457 | 22 | |
4ec218d5 AR |
23 | class net_db_name: |
24 | public hash_link /* must be first */ | |
1b2f0924 | 25 | { |
3c670b50 AJ |
26 | MEMPROXY_CLASS(net_db_name); |
27 | ||
5c78cfe4 | 28 | public: |
3c670b50 | 29 | net_db_name(const char *name, netdbEntry *); |
4ec218d5 | 30 | ~net_db_name() { xfree(key); } |
3c670b50 | 31 | |
5c78cfe4 FC |
32 | net_db_name *next; |
33 | netdbEntry *net_db_entry; | |
34 | }; | |
35 | ||
001d55dc | 36 | // POD |
1b2f0924 FC |
37 | class net_db_peer |
38 | { | |
5c78cfe4 FC |
39 | public: |
40 | const char *peername; | |
41 | double hops; | |
42 | double rtt; | |
43 | time_t expires; | |
44 | }; | |
45 | ||
4ec218d5 AR |
46 | class netdbEntry: |
47 | public hash_link /* must be first */ | |
1b2f0924 | 48 | { |
1a7cfe02 AJ |
49 | MEMPROXY_CLASS(netdbEntry); |
50 | ||
5c78cfe4 | 51 | public: |
1a7cfe02 AJ |
52 | netdbEntry() { *network = 0; } |
53 | ||
5c78cfe4 | 54 | char network[MAX_IPSTRLEN]; |
1a7cfe02 AJ |
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; | |
5c78cfe4 | 66 | }; |
71787d05 | 67 | |
001d55dc | 68 | void netdbInit(void); |
71787d05 | 69 | |
001d55dc FC |
70 | void netdbHandlePingReply(const Ip::Address &from, int hops, int rtt); |
71 | void netdbPingSite(const char *hostname); | |
59a09b98 | 72 | void netdbDump(StoreEntry *); |
71787d05 | 73 | |
001d55dc FC |
74 | void netdbFreeMemory(void); |
75 | int netdbHostHops(const char *host); | |
76 | int netdbHostRtt(const char *host); | |
c8ab5ec6 | 77 | void netdbUpdatePeer(const AnyP::Uri &, CachePeer *, int rtt, int hops); |
71787d05 | 78 | |
001d55dc FC |
79 | void netdbDeleteAddrNetwork(Ip::Address &addr); |
80 | void netdbBinaryExchange(StoreEntry *); | |
81 | void netdbExchangeStart(void *); | |
71787d05 | 82 | |
001d55dc | 83 | void netdbExchangeUpdatePeer(Ip::Address &, CachePeer *, double, double); |
cb365059 | 84 | CachePeer *netdbClosestParent(PeerSelector *); |
001d55dc | 85 | void netdbHostData(const char *host, int *samp, int *rtt, int *hops); |
71787d05 | 86 | |
71787d05 | 87 | #endif /* ICMP_NET_DB_H */ |
f53969cc | 88 |