IBR-DTNSuite
0.8
|
#include <DHTNameService.h>
Public Member Functions | |
DHTNameService () | |
virtual | ~DHTNameService () |
const std::string | getName () const |
void | raiseEvent (const dtn::core::Event *evt) |
void | update (const ibrcommon::vinterface &iface, std::string &name, std::string &data) throw (dtn::net::DiscoveryServiceProvider::NoServiceHereException) |
Protected Member Functions | |
void | __cancellation () |
void | componentUp () |
void | componentRun () |
void | componentDown () |
This Service provides a Lookup service for node and group EIDs in a bittorrent DHT. It is fully event driven. It provides the following mechanisms: Publishes the own EID to the DHT, also as specific neighbour EIDs. Registers for Routing Events to look up automatically for the embedded EIDs in the DHT Adds the found EID with its Convergence Layers as a Node. Adds routes to the neighbour EIDs of the found EID. Uses IPND to announce the DHT name service to local neighbour nodes.
Definition at line 42 of file DHTNameService.h.
Definition at line 29 of file DHTNameService.cpp.
dtn::dht::DHTNameService::~DHTNameService | ( | ) | [virtual] |
Definition at line 35 of file DHTNameService.cpp.
void dtn::dht::DHTNameService::__cancellation | ( | ) | [protected, virtual] |
returns true
Implements dtn::daemon::IndependentComponent.
Definition at line 43 of file DHTNameService.cpp.
void dtn::dht::DHTNameService::componentDown | ( | ) | [protected, virtual] |
Calls the interrupt pipe to exit the main loop. And so ends up the main loop indirectly
Implements dtn::daemon::IndependentComponent.
Definition at line 367 of file DHTNameService.cpp.
References IBRCOMMON_LOGGER_DEBUG, and IBRCOMMON_LOGGER_ENDL.
void dtn::dht::DHTNameService::componentRun | ( | ) | [protected, virtual] |
Runs the bootstrapping method and starts the DHT. Executes the main loop with dtn_dht_periodic. After exiting the main loop, the DHT is shut down.
Implements dtn::daemon::IndependentComponent.
Definition at line 140 of file DHTNameService.cpp.
References dtn::routing::QueueBundleEvent::className, dtn::core::NodeEvent::className, dtn::storage::BundleStorage::getDistinctDestinations(), dtn::core::BundleCore::getInstance(), dtn::daemon::Configuration::getInstance(), dtn::daemon::Configuration::Network::getInterfaces(), dtn::core::BundleCore::getNeighbors(), dtn::daemon::Configuration::getNetwork(), dtn::core::BundleCore::getStorage(), IBRCOMMON_LOGGER, IBRCOMMON_LOGGER_DEBUG, IBRCOMMON_LOGGER_ENDL, dtn::core::BundleCore::local, and ibrcommon::recvfrom().
void dtn::dht::DHTNameService::componentUp | ( | ) | [protected, virtual] |
Reads the configured settings for the DHT and initializes all needed sockets(IPv4&IPv6) for the DHT
Implements dtn::daemon::IndependentComponent.
Definition at line 61 of file DHTNameService.cpp.
References dtn::data::EID::getNode(), dtn::data::EID::getString(), IBRCOMMON_LOGGER, IBRCOMMON_LOGGER_DEBUG, IBRCOMMON_LOGGER_ENDL, and dtn::core::BundleCore::local.
const std::string dtn::dht::DHTNameService::getName | ( | ) | const [virtual] |
Returns the name of this Service: "DHT Naming Service"
Implements dtn::daemon::Component.
Definition at line 39 of file DHTNameService.cpp.
void dtn::dht::DHTNameService::raiseEvent | ( | const dtn::core::Event * | evt | ) | [virtual] |
Handles all incomming Events, for which the Service is registered It is registered for this types of events: dtn::routing::QueueBundleEvent dtn::core::NodeEvent
Implements dtn::core::EventReceiver.
Definition at line 480 of file DHTNameService.cpp.
References dtn::core::NodeEvent::getAction(), dtn::core::Node::getEID(), dtn::core::NodeEvent::getNode(), dtn::data::EID::getNode(), dtn::core::BundleCore::local, dtn::core::NODE_AVAILABLE, dtn::core::NODE_INFO_UPDATED, and dtn::core::NODE_UNAVAILABLE.
void dtn::dht::DHTNameService::update | ( | const ibrcommon::vinterface & | iface, |
std::string & | name, | ||
std::string & | data | ||
) | throw (dtn::net::DiscoveryServiceProvider::NoServiceHereException) [virtual] |
this method updates the given values for discovery service It publishes the port number of the DHT instance
Implements dtn::net::DiscoveryServiceProvider.
Definition at line 721 of file DHTNameService.cpp.