]>
Commit | Line | Data |
---|---|---|
71787d05 AJ |
1 | #ifndef ICMP_NET_DB_H |
2 | #define ICMP_NET_DB_H | |
3 | ||
5c78cfe4 FC |
4 | #include "CachePeer.h" |
5 | #include "hash.h" | |
6 | ||
63bd4bf7 A |
7 | namespace Ip |
8 | { | |
9 | class Address; | |
b7ac5457 AJ |
10 | }; |
11 | ||
71787d05 AJ |
12 | class StoreEntry; |
13 | class HttpRequest; | |
5c78cfe4 FC |
14 | class netdbEntry; |
15 | ||
16 | class net_db_name { | |
17 | public: | |
18 | hash_link hash; /* must be first */ | |
19 | net_db_name *next; | |
20 | netdbEntry *net_db_entry; | |
21 | }; | |
22 | ||
23 | class net_db_peer { | |
24 | public: | |
25 | const char *peername; | |
26 | double hops; | |
27 | double rtt; | |
28 | time_t expires; | |
29 | }; | |
30 | ||
31 | class netdbEntry { | |
32 | public: | |
33 | hash_link hash; /* must be first */ | |
34 | char network[MAX_IPSTRLEN]; | |
35 | int pings_sent; | |
36 | int pings_recv; | |
37 | double hops; | |
38 | double rtt; | |
39 | time_t next_ping_time; | |
40 | time_t last_use_time; | |
41 | int link_count; | |
42 | net_db_name *hosts; | |
43 | net_db_peer *peers; | |
44 | int n_peers_alloc; | |
45 | int n_peers; | |
46 | }; | |
71787d05 | 47 | |
5c78cfe4 | 48 | extern void netdbInit(void); |
71787d05 | 49 | |
5c78cfe4 FC |
50 | extern void netdbHandlePingReply(const Ip::Address &from, int hops, int rtt); |
51 | extern void netdbPingSite(const char *hostname); | |
59a09b98 | 52 | void netdbDump(StoreEntry *); |
71787d05 | 53 | |
5c78cfe4 FC |
54 | extern void netdbFreeMemory(void); |
55 | extern int netdbHostHops(const char *host); | |
56 | extern int netdbHostRtt(const char *host); | |
57 | extern void netdbUpdatePeer(HttpRequest *, CachePeer * e, int rtt, int hops); | |
71787d05 | 58 | |
5c78cfe4 FC |
59 | extern void netdbDeleteAddrNetwork(Ip::Address &addr); |
60 | extern void netdbBinaryExchange(StoreEntry *); | |
61 | extern void netdbExchangeStart(void *); | |
71787d05 | 62 | |
5c78cfe4 FC |
63 | extern void netdbExchangeUpdatePeer(Ip::Address &, CachePeer *, double, double); |
64 | extern CachePeer *netdbClosestParent(HttpRequest *); | |
65 | extern void netdbHostData(const char *host, int *samp, int *rtt, int *hops); | |
71787d05 | 66 | |
71787d05 | 67 | #endif /* ICMP_NET_DB_H */ |