IBR-DTNSuite
0.8
|
#include <APIClient.h>
This is an abstract class is the base for any API connection to a IBR-DTN daemon. It uses an existing I/O stream to communicate bidirectional with the daemon.
For asynchronous reception of bundle this class contains a thread which deals the receiving part of the communication and calls the received() methods which should be overwritten.
Definition at line 29 of file APIClient.h.
Definition at line 32 of file APIClient.h.
dtn::api::APIClient::APIClient | ( | ibrcommon::tcpstream & | stream | ) |
Definition at line 28 of file APIClient.cpp.
dtn::api::APIClient::~APIClient | ( | ) | [virtual] |
Virtual destructor for this class.
Definition at line 33 of file APIClient.cpp.
APIClient::Message dtn::api::APIClient::__get_message | ( | ) | [protected] |
Definition at line 44 of file APIClient.cpp.
References _stream.
Referenced by __get_return(), and wait().
int dtn::api::APIClient::__get_return | ( | ) | [protected, virtual] |
Definition at line 60 of file APIClient.cpp.
References __get_message(), _get_busy, _notify_queue, _queue_cond, _status_queue, dtn::api::APIClient::Message::code, ibrcommon::Conditional::signal(), and ibrcommon::Conditional::wait().
Referenced by get(), getSubscriptions(), notify_delivered(), register_clear(), register_free(), register_get(), register_put(), register_send(), register_store(), setEndpoint(), subscribe(), and unsubscribe().
void dtn::api::APIClient::connect | ( | ) |
dtn::api::Bundle dtn::api::APIClient::get | ( | dtn::data::BundleID & | id | ) | [virtual] |
get a specific bundle
bundle |
Definition at line 163 of file APIClient.cpp.
References __get_return(), _stream, API_STATUS_NOT_FOUND, API_STATUS_OK, and register_get().
Referenced by main().
dtn::api::Bundle dtn::api::APIClient::get | ( | ) | [virtual] |
Get the next bundle in the queue
Definition at line 189 of file APIClient.cpp.
References __get_return(), _stream, API_STATUS_NOT_FOUND, API_STATUS_OK, and register_get().
std::list< dtn::data::EID > dtn::api::APIClient::getSubscriptions | ( | ) |
Definition at line 134 of file APIClient.cpp.
References __get_return(), _stream, and API_STATUS_OK.
void dtn::api::APIClient::notify_delivered | ( | const dtn::api::Bundle & | b | ) |
notify the daemon about a delivered bundle
id |
Definition at line 214 of file APIClient.cpp.
References dtn::api::Bundle::_b.
Referenced by main().
void dtn::api::APIClient::notify_delivered | ( | const dtn::data::BundleID & | id | ) |
Definition at line 220 of file APIClient.cpp.
References __get_return(), _stream, API_STATUS_NOT_FOUND, and API_STATUS_OK.
dtn::data::BundleID dtn::api::APIClient::readBundleID | ( | const std::string & | data | ) | [static, protected] |
Definition at line 399 of file APIClient.cpp.
References dtn::utils::Utils::tokenize().
void dtn::api::APIClient::register_clear | ( | ) | [protected, virtual] |
Definition at line 325 of file APIClient.cpp.
References __get_return(), _stream, and API_STATUS_OK.
void dtn::api::APIClient::register_free | ( | ) | [protected, virtual] |
Definition at line 339 of file APIClient.cpp.
References __get_return(), _stream, and API_STATUS_OK.
dtn::data::Bundle dtn::api::APIClient::register_get | ( | ) | [protected, virtual] |
Definition at line 381 of file APIClient.cpp.
References __get_return(), _stream, and API_STATUS_OK.
Referenced by get().
void dtn::api::APIClient::register_put | ( | const dtn::data::Bundle & | bundle | ) | [protected, virtual] |
upload a bundle into the register
bundle |
Definition at line 294 of file APIClient.cpp.
References __get_return(), _stream, API_STATUS_CONTINUE, API_STATUS_NOT_ACCEPTABLE, and API_STATUS_OK.
Referenced by send().
void dtn::api::APIClient::register_send | ( | ) | [protected, virtual] |
Definition at line 367 of file APIClient.cpp.
References __get_return(), _stream, and API_STATUS_OK.
Referenced by send().
void dtn::api::APIClient::register_store | ( | ) | [protected, virtual] |
Definition at line 353 of file APIClient.cpp.
References __get_return(), _stream, and API_STATUS_OK.
void dtn::api::APIClient::send | ( | const dtn::api::Bundle & | bundle | ) | [virtual] |
Send a bundle to the daemon
bundle |
Definition at line 208 of file APIClient.cpp.
References dtn::api::Bundle::_b, register_put(), and register_send().
void dtn::api::APIClient::setEndpoint | ( | const std::string & | endpoint | ) |
set an application endpoint identifier
endpoint |
Definition at line 104 of file APIClient.cpp.
References __get_return(), _stream, and API_STATUS_ACCEPTED.
Referenced by main().
void dtn::api::APIClient::subscribe | ( | const dtn::data::EID & | eid | ) |
add subscription of a group EID
eid |
Definition at line 114 of file APIClient.cpp.
References __get_return(), _stream, API_STATUS_ACCEPTED, and dtn::data::EID::getString().
void dtn::api::APIClient::unblock_wait | ( | ) |
abort all wait() calls
Definition at line 288 of file APIClient.cpp.
References _queue_cond, and ibrcommon::Conditional::abort().
Referenced by term().
void dtn::api::APIClient::unsubscribe | ( | const dtn::data::EID & | eid | ) |
remove subscription of a group EID
eid |
Definition at line 124 of file APIClient.cpp.
References __get_return(), _stream, API_STATUS_ACCEPTED, and dtn::data::EID::getString().
wait for a notify
Definition at line 244 of file APIClient.cpp.
References __get_message(), _get_busy, _notify_queue, _queue_cond, _status_queue, dtn::api::APIClient::Message::code, ibrcommon::Conditional::signal(), and ibrcommon::Conditional::wait().
Referenced by main().
bool dtn::api::APIClient::_get_busy [protected] |
Definition at line 162 of file APIClient.h.
Referenced by __get_return(), and wait().
std::queue<Message> dtn::api::APIClient::_notify_queue [protected] |
Definition at line 163 of file APIClient.h.
Referenced by __get_return(), and wait().
Definition at line 161 of file APIClient.h.
Referenced by __get_return(), unblock_wait(), and wait().
std::queue<Message> dtn::api::APIClient::_status_queue [protected] |
Definition at line 164 of file APIClient.h.
Referenced by __get_return(), and wait().
ibrcommon::tcpstream& dtn::api::APIClient::_stream [protected] |
Definition at line 158 of file APIClient.h.
Referenced by __get_message(), connect(), get(), getSubscriptions(), notify_delivered(), register_clear(), register_free(), register_get(), register_put(), register_send(), register_store(), setEndpoint(), subscribe(), and unsubscribe().