IBR-DTNSuite 0.6

dtn::core::Node Class Reference

#include <Node.h>

Collaboration diagram for dtn::core::Node:

List of all members.

Classes

class  Attribute
class  URI

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 (const dtn::data::EID &id, Node::Type type=NODE_PERMANENT, unsigned int rtt=2700)
virtual ~Node ()
Node::Type getType () const
void setType (Node::Type type)
bool has (Node::Protocol proto) const
bool has (const std::string &name) const
void add (const URI &u)
void add (const Attribute &attr)
void remove (const URI &u)
void remove (const Attribute &attr)
void clear ()
std::list< URIget (Node::Protocol proto) const
std::list< Attributeget (const std::string &name) const
void setDescription (std::string description)
std::string getDescription () 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 23 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 38 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 31 of file Node.h.


Constructor & Destructor Documentation

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

constructor

Parameters:
typeset the node type
See also:
NoteType

Definition at line 95 of file Node.cpp.

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

Definition at line 100 of file Node.cpp.

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

destructor

Definition at line 106 of file Node.cpp.


Member Function Documentation

void dtn::core::Node::add ( const URI u)

Add a URI to this node.

Parameters:
u

Definition at line 184 of file Node.cpp.

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

void dtn::core::Node::add ( const Attribute attr)

Definition at line 189 of file Node.cpp.

void dtn::core::Node::clear ( )

Clear all URIs & Attributes contained in this node.

Definition at line 204 of file Node.cpp.

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

Decrement the timeout by <step>.

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

Definition at line 265 of file Node.cpp.

References NODE_PERMANENT.

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

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

Definition at line 292 of file Node.cpp.

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

std::list< Node::URI > dtn::core::Node::get ( Node::Protocol  proto) const

Returns a list of URIs matching the given protocol

Parameters:
proto
Returns:

Definition at line 210 of file Node.cpp.

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

std::list< Node::Attribute > dtn::core::Node::get ( const std::string &  name) const

get a list of attributes match the given name

Parameters:
name
Returns:

Definition at line 220 of file Node.cpp.

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

Get the assigned description for the node.

Returns:
The description.

Definition at line 235 of file Node.cpp.

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 260 of file Node.cpp.

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

Get the current timeout.

Returns:
The timeout in seconds.

Definition at line 255 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 156 of file Node.cpp.

Referenced by toString().

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

Definition at line 110 of file Node.cpp.

References NODE_CONNECTED, NODE_FLOATING, and NODE_PERMANENT.

Referenced by toString().

bool dtn::core::Node::has ( const std::string &  name) const

Definition at line 175 of file Node.cpp.

bool dtn::core::Node::has ( Node::Protocol  proto) const

Check if the protocol is available for this node.

Parameters:
proto
Returns:

Definition at line 166 of file Node.cpp.

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

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

Definition at line 279 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:
nodeA other node to compare.
Returns:
true, if the given node is equal to this node.

Definition at line 274 of file Node.cpp.

void dtn::core::Node::remove ( const Attribute attr)

Definition at line 199 of file Node.cpp.

void dtn::core::Node::remove ( const URI u)

Remove a given URI of the node.

Parameters:
proto

Definition at line 194 of file Node.cpp.

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

Definition at line 297 of file Node.cpp.

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

void dtn::core::Node::setDescription ( std::string  description)

Definition at line 230 of file Node.cpp.

void dtn::core::Node::setEID ( const dtn::data::EID id)

Set the EID of this Node

Parameters:
idThe EID to set.

Definition at line 240 of file Node.cpp.

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

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:
timeoutThe timeout in seconds.

Definition at line 250 of file Node.cpp.

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

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

Definition at line 161 of file Node.cpp.

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

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