]>
Commit | Line | Data |
---|---|---|
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 | 16 | class CachePeer; |
001d55dc FC |
17 | class HttpRequest; |
18 | class netdbEntry; | |
19 | class StoreEntry; | |
5c51bffb | 20 | class URL; |
b7ac5457 | 21 | |
1b2f0924 FC |
22 | class net_db_name |
23 | { | |
3c670b50 AJ |
24 | MEMPROXY_CLASS(net_db_name); |
25 | ||
5c78cfe4 | 26 | public: |
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 |
36 | class net_db_peer |
37 | { | |
5c78cfe4 FC |
38 | public: |
39 | const char *peername; | |
40 | double hops; | |
41 | double rtt; | |
42 | time_t expires; | |
43 | }; | |
44 | ||
1b2f0924 FC |
45 | class netdbEntry |
46 | { | |
1a7cfe02 AJ |
47 | MEMPROXY_CLASS(netdbEntry); |
48 | ||
5c78cfe4 | 49 | public: |
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 | 67 | void netdbInit(void); |
71787d05 | 68 | |
001d55dc FC |
69 | void netdbHandlePingReply(const Ip::Address &from, int hops, int rtt); |
70 | void netdbPingSite(const char *hostname); | |
59a09b98 | 71 | void netdbDump(StoreEntry *); |
71787d05 | 72 | |
001d55dc FC |
73 | void netdbFreeMemory(void); |
74 | int netdbHostHops(const char *host); | |
75 | int netdbHostRtt(const char *host); | |
5c51bffb | 76 | void netdbUpdatePeer(const URL &, CachePeer * e, int rtt, int hops); |
71787d05 | 77 | |
001d55dc FC |
78 | void netdbDeleteAddrNetwork(Ip::Address &addr); |
79 | void netdbBinaryExchange(StoreEntry *); | |
80 | void netdbExchangeStart(void *); | |
71787d05 | 81 | |
001d55dc FC |
82 | void netdbExchangeUpdatePeer(Ip::Address &, CachePeer *, double, double); |
83 | CachePeer *netdbClosestParent(HttpRequest *); | |
84 | void netdbHostData(const char *host, int *samp, int *rtt, int *hops); | |
71787d05 | 85 | |
71787d05 | 86 | #endif /* ICMP_NET_DB_H */ |
f53969cc | 87 |