CatapultServer  v0.5.0.1 (Elephant)
NodePingUtils.h
Go to the documentation of this file.
1 
21 #pragma once
22 #include "catapult/ionet/Node.h"
23 
24 namespace catapult {
25  namespace ionet {
26  class NodeContainerView;
27  struct Packet;
28  }
29 }
30 
31 namespace catapult { namespace nodediscovery {
32 
34  bool TryParseNodePacket(const ionet::Packet& packet, ionet::Node& node);
35 
37  bool TryParseNodesPacket(const ionet::Packet& packet, ionet::NodeSet& nodes);
38 
40  bool IsNodeCompatible(const ionet::Node& node, model::NetworkIdentifier networkIdentifier, const Key& identityKey);
41 
43  ionet::NodeSet SelectUnknownNodes(const ionet::NodeContainerView& view, const ionet::NodeSet& nodes);
44 }}
CATAPULT_LOG
#define CATAPULT_LOG(SEV)
Writes a log entry to the default logger with SEV severity.
Definition: Logging.h:340
catapult::nodediscovery::TryParseNodesPacket
bool TryParseNodesPacket(const ionet::Packet &packet, ionet::NodeSet &nodes)
Tries to parse packet into nodes.
Definition: NodePingUtils.cpp:39
catapult::ionet::UnpackNode
Node UnpackNode(const NetworkNode &networkNode)
Unpacks a network node (networkNode) into a node model.
Definition: NetworkNode.cpp:59
PacketEntityUtils.h
catapult::ionet::Packet
A packet header with a data payload.
Definition: Packet.h:32
catapult::ionet::Node::identityKey
const Key & identityKey() const
Gets the unique identifier (a public key).
Definition: Node.cpp:60
colorPrint.warning
def warning(*args)
Definition: colorPrint.py:10
catapult::nodediscovery::IsNodeCompatible
bool IsNodeCompatible(const ionet::Node &node, model::NetworkIdentifier networkIdentifier, const Key &identityKey)
Determines if node is compatible with expected network (networkIdentifier) and identity (identityKey)...
Definition: NodePingUtils.cpp:52
catapult::ionet::Packet::Data
uint8_t * Data()
Returns a non-const pointer to data contained in this packet.
Definition: Packet.h:35
catapult::ionet::PacketHeader::Size
uint32_t Size
Size of the packet.
Definition: PacketHeader.h:32
catapult::ionet::NodeContainerView::contains
bool contains(const Key &identityKey) const
Returns true if the node with identityKey is in the container, false otherwise.
Definition: NodeContainer.cpp:80
catapult::ionet::PacketHeader
A packet header that all transferable information is expected to have.
Definition: PacketHeader.h:30
catapult::ionet::NodeContainerView
A read only view on top of node container.
Definition: NodeContainer.h:39
catapult::ionet::CalculatePacketDataSize
size_t CalculatePacketDataSize(const Packet &packet)
Calculates the data size of packet.
Definition: PacketEntityUtils.h:29
catapult::nodediscovery::TryParseNodePacket
bool TryParseNodePacket(const ionet::Packet &packet, ionet::Node &node)
Tries to parse packet into node.
Definition: NodePingUtils.cpp:28
catapult::ionet::NodeSet
std::unordered_set< Node, NodeHasher > NodeSet
A set of nodes.
Definition: Node.h:128
Node.h
NodeContainer.h
NetworkNode.h
catapult::model::NetworkIdentifier
NetworkIdentifier
Possible network identifiers.
Definition: NetworkInfo.h:45
catapult::ionet::Node::metadata
const NodeMetadata & metadata() const
Gets tne metadata.
Definition: Node.cpp:68
Node
ionet::Node Node
Definition: PacketWriters.cpp:45
catapult
Definition: AddressExtractionExtension.cpp:28
NodePingUtils.h
catapult::utils::ByteArray
Base class for wrappers of byte array types, to provide some type-safety.
Definition: ByteArray.h:29
catapult::ionet::Node
A node in the catapult network.
Definition: Node.h:82
catapult::ionet::NodeMetadata::NetworkIdentifier
model::NetworkIdentifier NetworkIdentifier
Network identifier.
Definition: Node.h:69
catapult::Key
utils::ByteArray< Key_Size, Key_tag > Key
Definition: src/catapult/types.h:41
catapult::nodediscovery::SelectUnknownNodes
ionet::NodeSet SelectUnknownNodes(const ionet::NodeContainerView &view, const ionet::NodeSet &nodes)
Filters nodes by returning all nodes not contained in view.
Definition: NodePingUtils.cpp:56