IBR-DTNSuite
0.12
|
#include <Node.h>
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, CONN_EMAIL = 12 } |
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< URI > | get (Node::Protocol proto) const |
std::list< URI > | get (Node::Type type) const |
std::list< URI > | get (Node::Type type, Node::Protocol proto) const |
std::list< Node::URI > | getAll () const |
std::set< Node::Type > | getTypes () const |
std::list< Attribute > | get (const std::string &name) const |
const dtn::data::EID & | getEID () const |
bool | expire () |
bool | operator== (const Node &other) const |
bool | operator< (const Node &other) const |
bool | operator== (const dtn::data::EID &other) const |
const Node & | operator+= (const Node &other) |
const Node & | operator-= (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 &) |
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 |
dtn::core::Node::Node | ( | const dtn::data::EID & | id) |
void dtn::core::Node::add | ( | const URI & | u) |
Add a URI to this node.
u |
Definition at line 280 of file Node.cpp.
Referenced by dtn::net::ConnectionManager::add(), dtn::daemon::NativeDaemon::addConnection(), dtn::net::TCPConnection::connect(), dtn_dht_handle_lookup_result(), dtn::net::P2PDialupExtension::fireConnected(), dtn::net::P2PDialupExtension::fireDisconnected(), dtn::net::P2PDialupExtension::fireDiscovered(), dtn::daemon::Configuration::Network::load(), operator+=(), and dtn::daemon::NativeDaemon::removeConnection().
void dtn::core::Node::clear | ( | ) |
Clear all URIs & Attributes contained in this node.
Definition at line 302 of file Node.cpp.
Referenced by dtn::net::TCPConnection::connect().
bool dtn::core::Node::doConnectImmediately | ( | ) | const |
Definition at line 516 of file Node.cpp.
Referenced by dtn::net::ConnectionManager::raiseEvent().
bool dtn::core::Node::expire | ( | ) |
remove expired service descriptors
Definition at line 415 of file Node.cpp.
References dtn::core::Node::URI::expire, dtn::core::Node::Attribute::expire, and dtn::utils::Clock::getTime().
|
static |
Definition at line 231 of file Node.cpp.
References CONN_BLUETOOTH, CONN_DGRAM_ETHERNET, CONN_DGRAM_LOWPAN, CONN_DGRAM_UDP, CONN_FILE, CONN_HTTP, CONN_LOWPAN, CONN_P2P_BT, CONN_P2P_WIFI, CONN_TCPIP, CONN_UDPIP, CONN_UNDEFINED, and CONN_UNSUPPORTED.
std::list< Node::URI > dtn::core::Node::get | ( | Node::Protocol | proto) | const |
Returns a list of URIs matching the given protocol
proto |
Definition at line 325 of file Node.cpp.
References dtn::core::compare_uri_priority(), and isAvailable().
Referenced by dtn::net::ConnectionManager::add(), dtn::net::TCPConnection::connect(), dtn::net::LOWPANConvergenceLayer::queue(), dtn::net::UDPConvergenceLayer::queue(), dtn::net::DatagramConvergenceLayer::queue(), and dtn::net::EMailConvergenceLayer::queue().
std::list< Node::URI > dtn::core::Node::get | ( | Node::Type | type) | const |
Definition at line 342 of file Node.cpp.
References dtn::core::compare_uri_priority().
std::list< Node::URI > dtn::core::Node::get | ( | Node::Type | type, |
Node::Protocol | proto | ||
) | const |
Definition at line 359 of file Node.cpp.
References dtn::core::compare_uri_priority(), and isAvailable().
std::list< Node::Attribute > dtn::core::Node::get | ( | const std::string & | name) | const |
get a list of attributes match the given name
name |
Definition at line 395 of file Node.cpp.
References dtn::core::compare_attr_priority().
std::list< Node::URI > dtn::core::Node::getAll | ( | ) | const |
Returns a ordered list of all available URIs
Definition at line 372 of file Node.cpp.
References dtn::core::compare_uri_priority(), and isAvailable().
Referenced by dtn::net::ConnectionManager::add(), and dtn::daemon::NativeDaemon::getInfo().
const dtn::data::EID & dtn::core::Node::getEID | ( | ) | const |
Return the EID of this node.
Definition at line 406 of file Node.cpp.
Referenced by dtn::net::ConnectionManager::add(), dtn::net::ConnectionManager::discovered(), dtn_dht_handle_lookup_result(), dtn::routing::NeighborRoutingExtension::eventBundleQueued(), dtn::routing::FloodRoutingExtension::eventBundleQueued(), dtn::routing::EpidemicRoutingExtension::eventBundleQueued(), dtn::routing::ProphetRoutingExtension::eventBundleQueued(), dtn::net::ConnectionEvent::getMessage(), dtn::daemon::NativeDaemon::getNeighbors(), dtn::net::ConnectionManager::isNeighbor(), dtn::daemon::Configuration::Network::load(), dtn::net::TCPConnection::match(), dtn::net::DatagramConvergenceLayer::queue(), dtn::net::EMailConvergenceLayer::queue(), dtn::api::EventConnection::raiseEvent(), dtn::routing::NodeHandshakeExtension::raiseEvent(), dtn::routing::BaseRouter::raiseEvent(), dtn::dht::DHTNameService::raiseEvent(), dtn::daemon::NativeDaemon::raiseEvent(), dtn::net::ConnectionManager::remove(), dtn::net::EMailSmtpService::run(), and toString().
std::set< Node::Type > dtn::core::Node::getTypes | ( | ) | const |
bool dtn::core::Node::has | ( | Node::Protocol | proto) | const |
Check if the protocol is available for this node.
proto |
Definition at line 262 of file Node.cpp.
Referenced by dtn::net::ConnectionManager::add(), and dtn::net::FileConvergenceLayer::raiseEvent().
bool dtn::core::Node::has | ( | const std::string & | name) | const |
bool dtn::core::Node::hasDialup | ( | ) | const |
Definition at line 526 of file Node.cpp.
References NODE_P2P_DIALUP, and dtn::core::Node::URI::type.
bool dtn::core::Node::isAnnounced | ( | ) | const |
Definition at line 590 of file Node.cpp.
Referenced by dtn::net::ConnectionManager::add().
bool dtn::core::Node::isAvailable | ( | ) | const |
Definition at line 537 of file Node.cpp.
References dtn::core::BundleCore::getInstance(), NODE_CONNECTED, NODE_DISCOVERED, NODE_P2P_DIALUP, NODE_STATIC_LOCAL, and dtn::core::Node::URI::type.
Referenced by dtn::net::ConnectionManager::add(), get(), getAll(), dtn::net::ConnectionManager::getNeighbor(), dtn::net::ConnectionManager::getNeighbors(), and dtn::net::ConnectionManager::isNeighbor().
bool dtn::core::Node::operator< | ( | const Node & | other) | const |
bool dtn::core::Node::operator== | ( | const Node & | other) | const |
bool dtn::core::Node::operator== | ( | const dtn::data::EID & | other) | const |
void dtn::core::Node::remove | ( | const URI & | u) |
Remove a given URI of the node.
proto |
Definition at line 292 of file Node.cpp.
Referenced by dtn::net::ConnectionManager::add().
void dtn::core::Node::setAnnounced | ( | bool | val) |
Mark this node as announced or not
Definition at line 585 of file Node.cpp.
Referenced by dtn::net::ConnectionManager::add().
void dtn::core::Node::setConnectImmediately | ( | bool | val) |
Definition at line 521 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 308 of file Node.cpp.
Referenced by dtn::net::ConnectionManager::add(), and dtn::net::ConnectionManager::remove().
|
static |
Definition at line 152 of file Node.cpp.
References NODE_CONNECTED, NODE_DHT_DISCOVERED, NODE_DISCOVERED, NODE_P2P_DIALUP, NODE_STATIC_GLOBAL, NODE_STATIC_LOCAL, and NODE_UNAVAILABLE.
Referenced by dtn::net::TCPConnection::connect(), and dtn::net::TCPConvergenceLayer::queue().
|
static |
Definition at line 181 of file Node.cpp.
References CONN_BLUETOOTH, CONN_DGRAM_ETHERNET, CONN_DGRAM_LOWPAN, CONN_DGRAM_UDP, CONN_EMAIL, CONN_FILE, CONN_HTTP, CONN_LOWPAN, CONN_P2P_BT, CONN_P2P_WIFI, CONN_TCPIP, CONN_UDPIP, CONN_UNDEFINED, and CONN_UNSUPPORTED.
std::string dtn::core::Node::toString | ( | ) | const |
Definition at line 510 of file Node.cpp.
References getEID(), and dtn::data::EID::getString().
Referenced by dtn::net::UDPConvergenceLayer::getStats(), dtn::net::DatagramConvergenceLayer::getStats(), dtn::net::TCPConvergenceLayer::getStats(), and dtn::core::operator<<().
|
friend |