SOLA
Loading...
Searching...
No Matches
Public Member Functions | Friends | List of all members
minhton::NodeInfo Class Reference

#include <node_info.h>

Public Member Functions

 NodeInfo (uint32_t level, uint32_t number, uint16_t fanout)
 
 NodeInfo (uint32_t level, uint32_t number, uint16_t fanout, const std::string &address, uint16_t port)
 
minhton::LogicalNodeInfo getLogicalNodeInfo () const
 
void setLogicalNodeInfo (const minhton::LogicalNodeInfo &l_node_info)
 
minhton::PhysicalNodeInfo getPhysicalNodeInfo () const
 
void setPhysicalNodeInfo (const minhton::PhysicalNodeInfo &p_node_info)
 
std::string getString () const
 
bool isInitialized () const
 
void setPosition (uint32_t level, uint32_t number)
 Helper method, which sets the position for the internal LogicalNodeInfo object.
 
void setPosition (LogicalNodeInfo other)
 Helper method, which sets the position for the internal LogicalNodeInfo object.
 
void setFanout (uint16_t fanout)
 Helper method, which sets the fanout for the internal LogicalNodeInfo object.
 
uint32_t getLevel () const
 
uint32_t getNumber () const
 
uint16_t getFanout () const
 
NodeStatus getStatus () const
 
void setStatus (NodeStatus status)
 sets the status of the node
 
bool isValidPeer () const
 
void setPort (uint16_t port)
 Helper method, which sets the port for PhysicalNodeInfo.
 
void setAddress (const std::string &address)
 Helper method, which sets the address for PhysicalNodeInfo.
 
uint16_t getPort () const
 
std::string getAddress () const
 
uint32_t getAddressValue () const
 
 SERIALIZE (l_node_info_, p_node_info_)
 

Friends

bool operator== (const minhton::NodeInfo &n1, const minhton::NodeInfo &n2)
 
bool operator!= (const minhton::NodeInfo &n1, const minhton::NodeInfo &n2)
 
bool operator< (const minhton::NodeInfo &n1, const minhton::NodeInfo &n2)
 
bool operator<= (const minhton::NodeInfo &n1, const minhton::NodeInfo &n2)
 
bool operator> (const minhton::NodeInfo &n1, const minhton::NodeInfo &n2)
 
bool operator>= (const minhton::NodeInfo &n1, const minhton::NodeInfo &n2)
 

Detailed Description

A NodeInfo is based on a LogicalNodeInfo and PhysicalNodeInfo. These two classes build the core of a node in our peer2peer network

Constructor & Destructor Documentation

◆ NodeInfo() [1/2]

minhton::NodeInfo::NodeInfo ( uint32_t  level,
uint32_t  number,
uint16_t  fanout 
)

Constructing an initialized NodeInfo object with the given information.

Parameters
levelvalid level of a MINHTON m-ary tree
numbervalid number of a MINHTON m-ary tree
fanoutvalid port of a MINHTON m-ary tree

◆ NodeInfo() [2/2]

minhton::NodeInfo::NodeInfo ( uint32_t  level,
uint32_t  number,
uint16_t  fanout,
const std::string &  address,
uint16_t  port 
)

Constructing an initialized NodeInfo object with the given information.

Parameters
levelvalid level of a MINHTON m-ary tree
numbervalid number of a MINHTON m-ary tree
fanoutvalid port of a MINHTON m-ary tree
addressvalid IPv4 address string
uint16_tvalid network port

Member Function Documentation

◆ getAddress()

std::string minhton::NodeInfo::getAddress ( ) const
Returns
the address of PhysicalNodeInfo

◆ getAddressValue()

uint32_t minhton::NodeInfo::getAddressValue ( ) const
Returns
a unique number representing the ip address of PhysicalNodeInfo

◆ getFanout()

uint16_t minhton::NodeInfo::getFanout ( ) const
Returns
the fanout of LogicalNodeInfo

◆ getLevel()

uint32_t minhton::NodeInfo::getLevel ( ) const
Returns
the level of LogicalNodeInfo

◆ getLogicalNodeInfo()

LogicalNodeInfo minhton::NodeInfo::getLogicalNodeInfo ( ) const
Returns
A LogicalNodeInfo, which represents the position (Level/Number) of a peer within the p2p network

◆ getNumber()

uint32_t minhton::NodeInfo::getNumber ( ) const
Returns
the number of LogicalNodeInfo

◆ getPhysicalNodeInfo()

PhysicalNodeInfo minhton::NodeInfo::getPhysicalNodeInfo ( ) const
Returns
A PhysicalNodeInfo, which represents the remote host, by having a IPv4/IPv6 IP address and a port

◆ getPort()

uint16_t minhton::NodeInfo::getPort ( ) const
Returns
the port of PhysicalNodeInfo

◆ getStatus()

NodeStatus minhton::NodeInfo::getStatus ( ) const
Returns
the status of the node

◆ isInitialized()

bool minhton::NodeInfo::isInitialized ( ) const

Returns the current state of the node if the node is properly initialized. If a node is initialized, it exists. This method depends on initialized state of the LogicalNodeInfo and PhysicalNodeInfo

Typical usage:

bool isInitialized() const
Definition node_info.cpp:37
Returns
true if the node is proper initialized, otherwise false

◆ isValidPeer()

bool minhton::NodeInfo::isValidPeer ( ) const
Returns
true if the node consists of an actual known peer, otherwise false

◆ setLogicalNodeInfo()

void minhton::NodeInfo::setLogicalNodeInfo ( const minhton::LogicalNodeInfo l_node_info)

Sets the LogicalNodeInfo within the NodeInfo object

Parameters
l_node_infovalid LogicalNodeInfo instance

◆ setPhysicalNodeInfo()

void minhton::NodeInfo::setPhysicalNodeInfo ( const minhton::PhysicalNodeInfo p_node_info)

Sets the PhysicalNodeInfo within the NodeInfo object

Parameters
p_node_infovalid LogicalNodeInfo instance

The documentation for this class was generated from the following files: