1 /* Copyright (c) 2012-2018. The SimGrid Team.
2 * All rights reserved. */
4 /* This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package. */
7 #ifndef _KADEMLIA_ROUTING_TABLE_HPP
8 #define _KADEMLIA_ROUTING_TABLE_HPP
9 #include "s4u-dht-kademlia.hpp"
14 /* Routing table bucket */
16 unsigned int id_; // bucket id
18 std::deque<unsigned int> nodes; // Nodes in the bucket.
19 unsigned int getId() { return id_; }
20 explicit Bucket(unsigned int id) : id_(id) {}
24 /* Node routing table */
26 unsigned int id_; // node id of the client's routing table
28 Bucket** buckets; // Node bucket list - 160 sized.
29 explicit RoutingTable(unsigned int node_id);
30 RoutingTable(const RoutingTable&) = delete;
31 RoutingTable& operator=(const RoutingTable&) = delete;
34 Bucket* findBucket(unsigned int id);
35 bool contains(unsigned int node_id);