Public Types | Public Member Functions | Static Public Member Functions

dtn::core::Node Class Reference

#include <Node.h>

Collaboration diagram for dtn::core::Node:
Collaboration graph
[legend]

List of all members.

Public Types

enum  Type { NODE_FLOATING = 0, NODE_PERMANENT = 1, NODE_CONNECTED = 2 }
enum  Protocol {
  CONN_UNSUPPORTED = -1, CONN_UNDEFINED = 0, CONN_UDPIP = 1, CONN_TCPIP = 2,
  CONN_ZIGBEE = 3, CONN_BLUETOOTH = 4, CONN_HTTP = 5
}

Public Member Functions

 Node (Node::Type type=NODE_PERMANENT, unsigned int rtt=2700)
 Node (dtn::data::EID id, Node::Protocol proto=CONN_UNDEFINED, Node::Type type=NODE_PERMANENT, unsigned int rtt=2700)
virtual ~Node ()
Node::Type getType () const
void setType (Node::Type type)
void setProtocol (Node::Protocol protocol)
Node::Protocol getProtocol () const
void setAddress (std::string address)
std::string getAddress () const
void setPort (unsigned int port)
unsigned int getPort () const
void setDescription (std::string description)
std::string getDescription () const
void setURI (std::string uri)
std::string getURI () const
void setEID (const dtn::data::EID &id)
const dtn::data::EIDgetEID () const
void setTimeout (int timeout)
int getTimeout () const
unsigned int getRoundTripTime () const
bool decrementTimeout (int step)
bool operator== (const Node &other) const
bool operator< (const Node &other) const
std::string toString () const
bool doConnectImmediately () const
void setConnectImmediately (bool val)

Static Public Member Functions

static std::string getTypeName (Node::Type type)
static std::string getProtocolName (Node::Protocol proto)

Detailed Description

A Node instance holds all informations of a neighboring node.

Definition at line 20 of file Node.h.


Member Enumeration Documentation

Enumerator:
CONN_UNSUPPORTED 
CONN_UNDEFINED 
CONN_UDPIP 
CONN_TCPIP 
CONN_ZIGBEE 
CONN_BLUETOOTH 
CONN_HTTP 

Definition at line 35 of file Node.h.

Specify a node type. FLOATING is a node, if it's not statically reachable. PERMANENT is used for static nodes with are permanently reachable.

Enumerator:
NODE_FLOATING 
NODE_PERMANENT 
NODE_CONNECTED 

Definition at line 28 of file Node.h.


Constructor & Destructor Documentation

dtn::core::Node::Node ( Node::Type  type = NODE_PERMANENT,
unsigned int  rtt = 2700 
)

constructor

Parameters:
type set the node type
See also:
NoteType

Definition at line 13 of file Node.cpp.

dtn::core::Node::Node ( dtn::data::EID  id,
Node::Protocol  proto = CONN_UNDEFINED,
Node::Type  type = NODE_PERMANENT,
unsigned int  rtt = 2700 
)

Definition at line 18 of file Node.cpp.

dtn::core::Node::~Node (  )  [virtual]

destructor

Definition at line 24 of file Node.cpp.


Member Function Documentation

bool dtn::core::Node::decrementTimeout ( int  step  ) 

Decrement the timeout by <step>.

Parameters:
step Decrement the timeout by this value.
Returns:
false, if the timeout steps below zero. Timeout is reached.

Definition at line 160 of file Node.cpp.

References NODE_PERMANENT.

Referenced by dtn::net::ConnectionManager::check_discovered().

bool dtn::core::Node::doConnectImmediately (  )  const

Definition at line 194 of file Node.cpp.

Referenced by dtn::net::ConnectionManager::raiseEvent().

string dtn::core::Node::getAddress (  )  const

Get the address of the node.

Returns:
The address of the node. (e.g. 10.0.0.1 for IP)

Definition at line 99 of file Node.cpp.

Referenced by dtn::net::UDPConvergenceLayer::queue(), dtn::net::LOWPANConvergenceLayer::queue(), dtn::net::TCPConnection::setup(), and toString().

string dtn::core::Node::getDescription (  )  const

Get the assigned description for the node.

Returns:
The description.

Definition at line 119 of file Node.cpp.

const dtn::data::EID & dtn::core::Node::getEID (  )  const
unsigned int dtn::core::Node::getPort (  )  const
Node::Protocol dtn::core::Node::getProtocol (  )  const
std::string dtn::core::Node::getProtocolName ( Node::Protocol  proto  )  [static]
unsigned int dtn::core::Node::getRoundTripTime (  )  const

Get the roundtrip time for this contact

Definition at line 155 of file Node.cpp.

int dtn::core::Node::getTimeout (  )  const

Get the current timeout.

Returns:
The timeout in seconds.

Definition at line 150 of file Node.cpp.

Node::Type dtn::core::Node::getType (  )  const

get the node type.

Returns:
The type of the node.
See also:
NoteType

Definition at line 74 of file Node.cpp.

Referenced by toString().

std::string dtn::core::Node::getTypeName ( Node::Type  type  )  [static]

Definition at line 28 of file Node.cpp.

References NODE_CONNECTED, NODE_FLOATING, and NODE_PERMANENT.

Referenced by toString().

string dtn::core::Node::getURI (  )  const
bool dtn::core::Node::operator< ( const Node other  )  const

Definition at line 174 of file Node.cpp.

bool dtn::core::Node::operator== ( const Node other  )  const

Compare this node to another one. Two nodes are equal if the uri and address of both nodes are equal.

Parameters:
node A other node to compare.
Returns:
true, if the given node is equal to this node.

Definition at line 169 of file Node.cpp.

void dtn::core::Node::setAddress ( std::string  address  ) 

Set the address of the node.

Parameters:
address The address of the node. (e.g. 10.0.0.1 for IP)

Referenced by dtn::daemon::Configuration::Network::load(), and dtn::net::DiscoveryAgent::received().

void dtn::core::Node::setConnectImmediately ( bool  val  ) 

Definition at line 199 of file Node.cpp.

Referenced by dtn::daemon::Configuration::Network::load().

void dtn::core::Node::setDescription ( std::string  description  ) 
void dtn::core::Node::setEID ( const dtn::data::EID id  ) 

Set the EID of this Node

Parameters:
id The EID to set.

Definition at line 135 of file Node.cpp.

Referenced by dtn::net::TCPConnection::eventConnectionUp().

void dtn::core::Node::setPort ( unsigned int  port  ) 
void dtn::core::Node::setProtocol ( Node::Protocol  protocol  ) 
void dtn::core::Node::setTimeout ( int  timeout  ) 

Set the timeout of the node. This is only relevant if the node is of type FLOATING. The node get expired if the timeout if count to zero.

Parameters:
timeout The timeout in seconds.

Definition at line 145 of file Node.cpp.

Referenced by dtn::net::DiscoveryAgent::received().

void dtn::core::Node::setType ( Node::Type  type  ) 

Definition at line 79 of file Node.cpp.

void dtn::core::Node::setURI ( std::string  uri  ) 

Set the URI (EID) of the node.

Parameters:
uri The URI of the node.

Referenced by dtn::daemon::Configuration::Network::load(), and dtn::net::DiscoveryAgent::received().

std::string dtn::core::Node::toString (  )  const

Definition at line 188 of file Node.cpp.

References getAddress(), getPort(), getProtocol(), getProtocolName(), getType(), getTypeName(), and getURI().

Referenced by dtn::net::ConnectionManager::queue().

Here is the call graph for this function:


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