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;
63 bt::Uint32
pack(bt::Uint8* buf)
const;
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);
135 QMap<QByteArray, bt::TimeStamp> tokens;
void sample(const dht::Key &key, DBItemList &dbl, bt::Uint32 max_entries, bt::Uint32 ip_version)
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.
QByteArray 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.
bool checkToken(const QByteArray &token, const net::Address &addr)
void store(const dht::Key &key, const DBItem &dbi)