33 Impl(MsgReceiveFct recv, MsgMissingFct miss, std::vector<logging::LoggerPtr> logger = {},
34 solanet::UUID uuid = solanet::generateUUID());
37 solanet::UUID publish(
const std::string &topic,
const std::string &msg_content);
39 bool addPeer(
const std::string &topic,
const NodeInfo &info);
41 bool removePeer(
const std::string &topic,
const std::string &ip, uint16_t port);
43 void subscribeTopic(
const std::string &topic,
const NodeInfo &info);
45 bool isSubscribedToTopic(
const std::string &topic)
const;
47 void unsubscribeTopic(
const std::string &topic);
49 NodeInfo getOwnNodeInfo(
const std::string &topic)
const {
return own_node_info_.at(topic); }
51 solanet::UUID getUUID()
const {
return uuid_; }
53 NetworkInfoIPv4 getNetworkInfo()
const {
return network_.getNetworkInfo(); }
68 std::tuple<bool, bool> sendToChildren(
const BroadcastInfo &bc, Level child_down_border);
71 void sendToInlevel(
const BroadcastInfo &bc,
bool other_forwarding_down,
bool send_to_children);
72 void sendToParent(
const BroadcastInfo &bc, Level parent_up_border);
73 std::tuple<uint32_t, uint32_t> sendToAdjacents(
const BroadcastInfo &bc);
76 std::tuple<std::vector<NodeInfo>, std::vector<NodeInfo>> getInlevel(
const BroadcastInfo &bc);
84 const std::set<NodeInfo> &other_peers,
85 std::vector<NodeInfo> &receiver);
93 const std::set<NodeInfo> &other_peers,
94 std::vector<NodeInfo> &receiver);
97 static std::vector<LevelNumber> calculateRRTIntersection(
const BroadcastInfo &bc);
100 std::optional<NatterMinhcast::NodeInfo> getDeeperAdjacent(
const BroadcastInfo &bc)
const;
103 std::optional<NatterMinhcast::NodeInfo> getHigherAdjacent(
const BroadcastInfo &bc)
const;
106 void sendMessage(
const BroadcastInfo &bc,
const NodeInfo &peer, uint32_t up_limit,
107 uint32_t down_limit,
bool inner_forward =
false);
115 static bool hasChildren(LevelNumber node,
const std::set<NodeInfo> &other_peers);
118 static void addRoutingTableToReceiver(LevelNumber own_node,
const std::set<NodeInfo> &other_peers,
119 std::vector<NodeInfo> &receiver);
120 static void addLRT(LevelNumber own_node,
const std::set<NodeInfo> &other_peers,
121 std::vector<NodeInfo> &receiver);
122 static void addRRT(LevelNumber own_node,
const std::set<NodeInfo> &other_peers,
123 std::vector<NodeInfo> &receiver);
127 static void addLeftForwardNodes(LevelNumber own_node, LevelNumber last_node,
128 const std::set<NodeInfo> &other_peers,
129 std::vector<NodeInfo> &receiver);
130 static void addRightForwardNodes(LevelNumber own_node, LevelNumber last_node,
131 const std::set<NodeInfo> &other_peers,
132 std::vector<NodeInfo> &receiver);
135 static void addInnerForwardNodes(
const BroadcastInfo &bc,
const std::set<NodeInfo> &other_peers,
136 std::vector<NodeInfo> &receiver);
138 static void addLeftAndRightmostChildren(LevelNumber node_info,
139 const std::set<NodeInfo> &other_peers,
140 std::vector<NodeInfo> &receiver);
143 template <
typename Compare>
144 static void addFromRoutingTable(
const std::set<LevelNumber> &rt,
145 const std::set<NodeInfo> &other_peers,
146 std::vector<NodeInfo> &receiver, uint32_t boundary, Compare comp);
148 using Topic = std::string;
149 std::unordered_map<Topic, NodeInfo> own_node_info_;
150 std::unordered_map<Topic, std::set<NodeInfo>> other_peers_;
153 MsgReceiveFct msg_recv_callback_;
158 std::set<solanet::UUID> received_messages_;