This commit is contained in:
orignal 2014-01-03 21:24:20 -05:00
parent 4f9a977022
commit 4f1f08b805
6 changed files with 78 additions and 0 deletions

View file

@ -57,7 +57,26 @@ namespace data
IdentHash CalculateIdentHash (const Identity& identity);
Keys CreateRandomKeys ();
// kademlia
struct RoutingKey
{
uint8_t hash[32];
};
struct XORMetric
{
uint8_t metric[32];
void SetMin () { memset (metric, 0, 32); };
void SetMax () { memset (metric, 0xFF, 32); };
bool operator< (const XORMetric& other) const { return memcmp (metric, other.metric, 32) < 0; };
};
RoutingKey CreateRoutingKey (const IdentHash& ident);
XORMetric operator^(const RoutingKey& key1, const RoutingKey& key2);
// destination for delivery instuctions
class RoutingDestination
{
public: