IBR-DTNSuite  0.10
dtn::core::Node Class Reference

#include <Node.h>

Collaboration diagram for dtn::core::Node:
Collaboration graph

Classes

class  Attribute
 
class  URI
 

Public Types

enum  Protocol {
  CONN_UNSUPPORTED = -1, CONN_UNDEFINED = 0, CONN_TCPIP = 1, CONN_UDPIP = 2,
  CONN_LOWPAN = 3, CONN_BLUETOOTH = 4, CONN_HTTP = 5, CONN_FILE = 6,
  CONN_DGRAM_UDP = 7, CONN_DGRAM_LOWPAN = 8, CONN_DGRAM_ETHERNET = 9, CONN_P2P_WIFI = 10,
  CONN_P2P_BT = 11
}
 
enum  Type {
  NODE_UNAVAILABLE = 0, NODE_CONNECTED = 1, NODE_DISCOVERED = 2, NODE_STATIC_GLOBAL = 3,
  NODE_STATIC_LOCAL = 4, NODE_DHT_DISCOVERED = 5, NODE_P2P_DIALUP = 6
}
 

Public Member Functions

 Node (const dtn::data::EID &id)
 
 Node ()
 
virtual ~Node ()
 
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 ()
 
dtn::data::Size size () const
 
std::list< URIget (Node::Protocol proto) const
 
std::list< URIget (Node::Type type) const
 
std::list< URIget (Node::Type type, Node::Protocol proto) const
 
std::list< Node::URIgetAll () const
 
std::set< Node::TypegetTypes () const
 
std::list< Attributeget (const std::string &name) const
 
const dtn::data::EIDgetEID () const
 
bool expire ()
 
bool operator== (const Node &other) const
 
bool operator< (const Node &other) const
 
bool operator== (const dtn::data::EID &other) const
 
const Nodeoperator+= (const Node &other)
 
const Nodeoperator-= (const Node &other)
 
std::string toString () const
 
bool doConnectImmediately () const
 
void setConnectImmediately (bool val)
 
bool hasDialup () const
 
bool isAvailable () const
 
bool isAnnounced () const
 
void setAnnounced (bool val)
 

Static Public Member Functions

static std::string toString (const Node::Type type)
 
static std::string toString (const Node::Protocol proto)
 
static Node::Protocol fromProtocolString (const std::string &protocol)
 

Friends

std::ostream & operator<< (std::ostream &, const Node &)
 

Detailed Description

A Node instance holds all informations of a neighboring node.

Definition at line 43 of file Node.h.

Member Enumeration Documentation

Enumerator
CONN_UNSUPPORTED 
CONN_UNDEFINED 
CONN_TCPIP 
CONN_UDPIP 
CONN_LOWPAN 
CONN_BLUETOOTH 
CONN_HTTP 
CONN_FILE 
CONN_DGRAM_UDP 
CONN_DGRAM_LOWPAN 
CONN_DGRAM_ETHERNET 
CONN_P2P_WIFI 
CONN_P2P_BT 

Definition at line 46 of file Node.h.

Specify a node type. FLOATING is a node, if it's not statically reachable. STATIC is used for static nodes with are permanently reachable. DHT_DISCOVERED is used for a node, learned by a dht lookup

Enumerator
NODE_UNAVAILABLE 
NODE_CONNECTED 
NODE_DISCOVERED 
NODE_STATIC_GLOBAL 
NODE_STATIC_LOCAL 
NODE_DHT_DISCOVERED 
NODE_P2P_DIALUP 

Definition at line 69 of file Node.h.

Constructor & Destructor Documentation

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

constructor

Parameters
typeset the node type
See Also
NoteType

Definition at line 143 of file Node.cpp.

dtn::core::Node::Node ( )

Definition at line 138 of file Node.cpp.

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

destructor

Definition at line 148 of file Node.cpp.

Member Function Documentation

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

Definition at line 283 of file Node.cpp.

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

Clear all URIs & Attributes contained in this node.

Definition at line 299 of file Node.cpp.

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

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

Definition at line 513 of file Node.cpp.

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

bool dtn::core::Node::expire ( )

remove expired service descriptors

Returns
True, if all attributes are gone

Definition at line 412 of file Node.cpp.

References dtn::core::Node::URI::expire, dtn::core::Node::Attribute::expire, and dtn::utils::Clock::getTime().

Here is the call graph for this function:

Node::Protocol dtn::core::Node::fromProtocolString ( const std::string &  protocol)
static
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 322 of file Node.cpp.

References dtn::core::compare_uri_priority(), and isAvailable().

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

Here is the call graph for this function:

std::list< Node::URI > dtn::core::Node::get ( Node::Type  type) const

Definition at line 339 of file Node.cpp.

References dtn::core::compare_uri_priority().

Here is the call graph for this function:

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

Definition at line 356 of file Node.cpp.

References dtn::core::compare_uri_priority(), and isAvailable().

Here is the call graph for this function:

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

References dtn::core::compare_attr_priority().

Here is the call graph for this function:

std::list< Node::URI > dtn::core::Node::getAll ( ) const

Returns a ordered list of all available URIs

Definition at line 369 of file Node.cpp.

References dtn::core::compare_uri_priority(), and isAvailable().

Referenced by dtn::daemon::NativeDaemon::getInfo().

Here is the call graph for this function:

std::set< Node::Type > dtn::core::Node::getTypes ( ) const

Returns a set of all available types

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

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

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

Definition at line 268 of file Node.cpp.

bool dtn::core::Node::hasDialup ( ) const
Returns
true, if there is at least one dial-up connection

Definition at line 523 of file Node.cpp.

References NODE_P2P_DIALUP, and dtn::core::Node::URI::type.

bool dtn::core::Node::isAnnounced ( ) const
Returns
true, if this node has been announced before

Definition at line 587 of file Node.cpp.

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

bool dtn::core::Node::isAvailable ( ) const
const Node & dtn::core::Node::operator+= ( const Node other)

Definition at line 456 of file Node.cpp.

References add().

Here is the call graph for this function:

const Node & dtn::core::Node::operator-= ( const Node other)

Definition at line 473 of file Node.cpp.

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

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

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

Definition at line 490 of file Node.cpp.

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

Remove a given URI of the node.

Parameters
proto

Definition at line 289 of file Node.cpp.

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

Definition at line 294 of file Node.cpp.

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

Mark this node as announced or not

Definition at line 582 of file Node.cpp.

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

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

Definition at line 518 of file Node.cpp.

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

dtn::data::Size dtn::core::Node::size ( ) const

Get the number of entries (URI + Attributes)

Definition at line 305 of file Node.cpp.

Referenced by dtn::net::ConnectionManager::add(), and dtn::net::ConnectionManager::remove().

std::string dtn::core::Node::toString ( const Node::Type  type)
static
std::string dtn::core::Node::toString ( const Node::Protocol  proto)
static
std::string dtn::core::Node::toString ( ) const

Definition at line 507 of file Node.cpp.

References getEID(), and dtn::data::EID::getString().

Referenced by dtn::daemon::NativeDaemon::getStats(), and dtn::core::operator<<().

Here is the call graph for this function:

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  stream,
const Node node 
)
friend

Definition at line 592 of file Node.cpp.


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