1 /* Copyright (c) 2012-2019. 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"
15 /* Routing table bucket */
17 unsigned int id_; // bucket id
19 std::deque<unsigned int> nodes; // Nodes in the bucket.
20 unsigned int getId() const { return id_; }
21 explicit Bucket(unsigned int id) : id_(id) {}
24 /* Node routing table */
26 unsigned int id_; // node id of the client's routing table
28 std::vector<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;
33 Bucket* findBucket(unsigned int id);
34 bool contains(unsigned int node_id);