IBR-DTNSuite  0.8
dtn::api::APIClient Class Reference

#include <APIClient.h>

Collaboration diagram for dtn::api::APIClient:

List of all members.

Classes

class  Message

Public Types

enum  STATUS_CODES {
  API_STATUS_CONTINUE = 100, API_STATUS_OK = 200, API_STATUS_CREATED = 201, API_STATUS_ACCEPTED = 202,
  API_STATUS_FOUND = 302, API_STATUS_BAD_REQUEST = 400, API_STATUS_UNAUTHORIZED = 401, API_STATUS_FORBIDDEN = 403,
  API_STATUS_NOT_FOUND = 404, API_STATUS_NOT_ALLOWED = 405, API_STATUS_NOT_ACCEPTABLE = 406, API_STATUS_CONFLICT = 409,
  API_STATUS_INTERNAL_ERROR = 500, API_STATUS_NOT_IMPLEMENTED = 501, API_STATUS_SERVICE_UNAVAILABLE = 503, API_STATUS_VERSION_NOT_SUPPORTED = 505,
  API_STATUS_NOTIFY_COMMON = 600, API_STATUS_NOTIFY_NEIGHBOR = 601, API_STATUS_NOTIFY_BUNDLE = 602
}

Public Member Functions

 APIClient (ibrcommon::tcpstream &stream)
virtual ~APIClient ()
void connect ()
void setEndpoint (const std::string &endpoint)
void subscribe (const dtn::data::EID &eid)
void unsubscribe (const dtn::data::EID &eid)
std::list< dtn::data::EIDgetSubscriptions ()
virtual dtn::api::Bundle get (dtn::data::BundleID &id)
virtual dtn::api::Bundle get ()
virtual void send (const dtn::api::Bundle &bundle)
Message wait ()
void unblock_wait ()
void notify_delivered (const dtn::api::Bundle &b)
void notify_delivered (const dtn::data::BundleID &id)

Protected Member Functions

virtual void register_put (const dtn::data::Bundle &bundle)
virtual void register_clear ()
virtual void register_free ()
virtual void register_store ()
virtual void register_send ()
virtual dtn::data::Bundle register_get ()
virtual int __get_return ()
Message __get_message ()

Static Protected Member Functions

static dtn::data::BundleID readBundleID (const std::string &data)

Protected Attributes

ibrcommon::tcpstream_stream
ibrcommon::Conditional _queue_cond
bool _get_busy
std::queue< Message_notify_queue
std::queue< Message_status_queue

Detailed Description

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.


Member Enumeration Documentation

Enumerator:
API_STATUS_CONTINUE 
API_STATUS_OK 
API_STATUS_CREATED 
API_STATUS_ACCEPTED 
API_STATUS_FOUND 
API_STATUS_BAD_REQUEST 
API_STATUS_UNAUTHORIZED 
API_STATUS_FORBIDDEN 
API_STATUS_NOT_FOUND 
API_STATUS_NOT_ALLOWED 
API_STATUS_NOT_ACCEPTABLE 
API_STATUS_CONFLICT 
API_STATUS_INTERNAL_ERROR 
API_STATUS_NOT_IMPLEMENTED 
API_STATUS_SERVICE_UNAVAILABLE 
API_STATUS_VERSION_NOT_SUPPORTED 
API_STATUS_NOTIFY_COMMON 
API_STATUS_NOTIFY_NEIGHBOR 
API_STATUS_NOTIFY_BUNDLE 

Definition at line 32 of file APIClient.h.


Constructor & Destructor Documentation

Definition at line 28 of file APIClient.cpp.

Virtual destructor for this class.

Definition at line 33 of file APIClient.cpp.


Member Function Documentation

Definition at line 44 of file APIClient.cpp.

References _stream.

Referenced by __get_return(), and wait().

Definition at line 37 of file APIClient.cpp.

References _stream.

Referenced by main().

get a specific bundle

Parameters:
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().

Here is the call graph for this function:

Get the next bundle in the queue

Returns:

Definition at line 189 of file APIClient.cpp.

References __get_return(), _stream, API_STATUS_NOT_FOUND, API_STATUS_OK, and register_get().

Here is the call graph for this function:

Returns:
a list of subscriptions

Definition at line 134 of file APIClient.cpp.

References __get_return(), _stream, and API_STATUS_OK.

Here is the call graph for this function:

notify the daemon about a delivered bundle

Parameters:
id

Definition at line 214 of file APIClient.cpp.

References dtn::api::Bundle::_b.

Referenced by main().

Definition at line 220 of file APIClient.cpp.

References __get_return(), _stream, API_STATUS_NOT_FOUND, and API_STATUS_OK.

Here is the call graph for this function:

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().

Here is the call graph for this function:

void dtn::api::APIClient::register_clear ( ) [protected, virtual]

Definition at line 325 of file APIClient.cpp.

References __get_return(), _stream, and API_STATUS_OK.

Here is the call graph for this function:

void dtn::api::APIClient::register_free ( ) [protected, virtual]

Definition at line 339 of file APIClient.cpp.

References __get_return(), _stream, and API_STATUS_OK.

Here is the call graph for this function:

Definition at line 381 of file APIClient.cpp.

References __get_return(), _stream, and API_STATUS_OK.

Referenced by get().

Here is the call graph for this function:

void dtn::api::APIClient::register_put ( const dtn::data::Bundle bundle) [protected, virtual]

upload a bundle into the register

Parameters:
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().

Here is the call graph for this function:

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().

Here is the call graph for this function:

void dtn::api::APIClient::register_store ( ) [protected, virtual]

Definition at line 353 of file APIClient.cpp.

References __get_return(), _stream, and API_STATUS_OK.

Here is the call graph for this function:

void dtn::api::APIClient::send ( const dtn::api::Bundle bundle) [virtual]

Send a bundle to the daemon

Parameters:
bundle

Definition at line 208 of file APIClient.cpp.

References dtn::api::Bundle::_b, register_put(), and register_send().

Here is the call graph for this function:

void dtn::api::APIClient::setEndpoint ( const std::string &  endpoint)

set an application endpoint identifier

Parameters:
endpoint

Definition at line 104 of file APIClient.cpp.

References __get_return(), _stream, and API_STATUS_ACCEPTED.

Referenced by main().

Here is the call graph for this function:

add subscription of a group EID

Parameters:
eid

Definition at line 114 of file APIClient.cpp.

References __get_return(), _stream, API_STATUS_ACCEPTED, and dtn::data::EID::getString().

Here is the call graph for this function:

abort all wait() calls

Definition at line 288 of file APIClient.cpp.

References _queue_cond, and ibrcommon::Conditional::abort().

Referenced by term().

Here is the call graph for this function:

remove subscription of a group EID

Parameters:
eid

Definition at line 124 of file APIClient.cpp.

References __get_return(), _stream, API_STATUS_ACCEPTED, and dtn::data::EID::getString().

Here is the call graph for this function:


Member Data Documentation

Definition at line 162 of file APIClient.h.

Referenced by __get_return(), and wait().

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().

Definition at line 164 of file APIClient.h.

Referenced by __get_return(), and wait().


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