IBR-DTN
1.0.0
|
#include <HTTPConvergenceLayer.h>
Public Member Functions | |
HTTPConvergenceLayer (const std::string &server) | |
virtual | ~HTTPConvergenceLayer () |
dtn::core::Node::Protocol | getDiscoveryProtocol () const |
void | queue (const dtn::core::Node &n, const dtn::net::BundleTransfer &job) |
virtual const std::string | getName () const |
![]() | |
virtual | ~ConvergenceLayer ()=0 |
virtual void | open (const dtn::core::Node &) |
virtual void | resetStats () |
virtual void | getStats (ConvergenceLayer::stats_data &data) const |
![]() | |
IndependentComponent () | |
virtual | ~IndependentComponent () |
virtual void | initialize () throw () |
virtual void | startup () throw () |
virtual void | terminate () throw () |
![]() | |
virtual | ~Component ()=0 |
Protected Member Functions | |
virtual void | componentUp () throw () |
virtual void | componentRun () throw () |
virtual void | componentDown () throw () |
void | __cancellation () throw () |
![]() | |
void | run () throw () |
Additional Inherited Members | |
![]() | |
typedef std::pair< string, string > | stats_pair |
typedef std::map< string, string > | stats_data |
Definition at line 65 of file HTTPConvergenceLayer.h.
dtn::net::HTTPConvergenceLayer::HTTPConvergenceLayer | ( | const std::string & | server | ) |
HTTPConvergenceLayer constructor calls the curl_global_init() method to initialize curl global. Furthermore the attributes _server _push_iob and _running will be set.
server | The server parameter contains the Tomcat-Server URL |
Definition at line 102 of file HTTPConvergenceLayer.cpp.
|
virtual |
HTTPConvergenceLayer destructor, when the destructor is calling it calls the curl_global_cleanup() method to clean curl sessions.
Definition at line 113 of file HTTPConvergenceLayer.cpp.
|
protectedvirtual |
This method is from IndependentComponent interface. It could abort the componentRun() thread on the hard way.
Implements dtn::daemon::IndependentComponent.
Definition at line 414 of file HTTPConvergenceLayer.cpp.
|
protectedvirtual |
This method is from IndependentComponent interface and is called when the IBR-DTN is shutting down. This method trys to stop the DownloadThread and to finalize the iobuffer, for a clean shut down.
Implements dtn::daemon::IndependentComponent.
Definition at line 406 of file HTTPConvergenceLayer.cpp.
|
protectedvirtual |
This method is from IndependentComponent interface. It runs as independent thread. This method is for receving data vom HTTP server. For the receiving the long polling mechanism is used. Curl calls when receiving data the HTTPConvergenceLayer_callback_write() method. There the received data is written in the ibrcommon::iobuffer, where the DownloadThread::run() method evaluate the stream. If the connection aborted, it will wait the CONN_TIMEOUT value and retry to connect until it could connect. When the connection is set up the DownloadThread the iobuffer will be initialize, when disconnecting the iobuffer will finalize.
Implements dtn::daemon::IndependentComponent.
Definition at line 329 of file HTTPConvergenceLayer.cpp.
References dtn::net::CONN_TIMEOUT, dtn::data::EID::getString(), and dtn::core::BundleCore::local.
|
protectedvirtual |
Method from IndependentComponent interface, this method is called before the componentRun() method is called. At time here is nothing to do.
Implements dtn::daemon::IndependentComponent.
Definition at line 313 of file HTTPConvergenceLayer.cpp.
|
virtual |
Method to return protocol type, in this case HTTP.
Implements dtn::net::ConvergenceLayer.
Definition at line 304 of file HTTPConvergenceLayer.cpp.
References dtn::core::Node::CONN_HTTP.
|
virtual |
Get method, returns a string with the name of this class, in this case "HTTPConvergenceLayer"
Implements dtn::daemon::Component.
Definition at line 430 of file HTTPConvergenceLayer.cpp.
|
virtual |
Function to send data to Tomcat Server. This method is from the ConvergenceLayer interface. Everytime a bundle is queued, this method will be called to send the bundle over HTTP. The HTTP transfer is performed in classical request-response principle. For file upload the HTTP PUT method is used. Curl uses the HTTPConvergenceLayer_callback_read() method for reading the bundle content. After a bundle is successfully transfered this method will raise the events for TransferCompletedEvent and the BundleEvent for BUNDLE_FORWARDED.
node | node informations |
job | parameter to get next bundle to send from storage |
Implements dtn::net::ConvergenceLayer.
Definition at line 195 of file HTTPConvergenceLayer.cpp.
References dtn::net::BundleTransfer::abort(), dtn::net::BundleTransfer::complete(), dtn::core::Node::CONN_HTTP, dtn::net::CURL_CONN_OK, dtn::core::BundleCore::filter(), dtn::storage::BundleStorage::get(), dtn::net::BundleTransfer::getBundle(), dtn::core::BundleCore::getInstance(), dtn::core::BundleCore::getStorage(), dtn::data::EID::getString(), dtn::net::HTTP_OK, dtn::core::BundleCore::local, dtn::core::BundleFilter::OUTPUT, dtn::net::TransferAbortedEvent::REASON_BUNDLE_DELETED, dtn::net::TransferAbortedEvent::REASON_REFUSED_BY_FILTER, dtn::core::FilterContext::setBundle(), dtn::core::FilterContext::setProtocol(), and dtn::data::Bundle::size().