25 #include <net/address.h>
26 #include <util/ptrmap.h>
27 #include <util/constants.h>
28 #include <util/array.h>
36 const bt::Uint32 MAX_ITEM_AGE = 30 * 60 * 1000;
49 DBItem(
const DBItem & item);
53 bool expired(bt::TimeStamp now)
const;
63 bt::Uint32
pack(bt::Uint8* buf)
const;
65 DBItem & operator = (
const DBItem & item);
68 bt::TimeStamp time_stamp;
71 typedef QList<DBItem> DBItemList;
102 void sample(
const dht::Key & key, DBItemList & dbl, bt::Uint32 max_entries, bt::Uint32 ip_version);
109 void expire(bt::TimeStamp now);
135 QMap<dht::Key, bt::TimeStamp> tokens;
void sample(const dht::Key &key, DBItemList &dbl, bt::Uint32 max_entries, bt::Uint32 ip_version)
bool checkToken(const dht::Key &token, const net::Address &addr)
void insert(const dht::Key &key)
Insert an empty item (only if it isn't already in the DB)
Key in the distributed hash table.
dht::Key genToken(const net::Address &addr)
bool expired(bt::TimeStamp now) const
See if the item is expired.
void expire(bt::TimeStamp now)
bt::Uint32 pack(bt::Uint8 *buf) const
bool contains(const dht::Key &key) const
Test whether or not the DB contains a key.
const net::Address & getAddress() const
Get the address of an item.
void store(const dht::Key &key, const DBItem &dbi)