1 /* Copyright (c) 2012-2022. 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_ANSWER_HPP_
8 #define _KADEMLIA_ANSWER_HPP_
11 #include "routing_table.hpp"
15 /* Node query answer. contains the elements closest to the id given. */
17 unsigned int destination_id_;
18 std::vector<std::pair<unsigned int, unsigned int>> nodes_;
21 explicit Answer(unsigned int destination_id) : destination_id_(destination_id) {}
22 unsigned int getDestinationId() const { return destination_id_; }
23 size_t getSize() const { return nodes_.size(); }
24 const std::vector<std::pair<unsigned int, unsigned int>>& getNodes() const { return nodes_; }
26 unsigned int merge(const Answer* a);
28 bool destinationFound() const;
29 void addBucket(const kademlia::Bucket* bucket);
31 } // namespace kademlia