|
IBR-DTN
1.0.0
|
#include <NativeSession.h>

Public Types | |
| enum | RegisterIndex { REG1 = 0, REG2 = 1 } |
Public Member Functions | |
| NativeSession (NativeSessionCallback *session_cb, NativeSerializerCallback *serializer_cb) | |
| NativeSession (NativeSessionCallback *session_cb, NativeSerializerCallback *serializer_cb, const std::string &handle) | |
| virtual | ~NativeSession () |
| void | destroy () throw () |
| const dtn::data::EID & | getNodeEID () const throw () |
| void | setEndpoint (const std::string &suffix) throw (NativeSessionException) |
| void | resetEndpoint () throw () |
| void | addEndpoint (const std::string &suffix) throw (NativeSessionException) |
| void | removeEndpoint (const std::string &suffix) throw (NativeSessionException) |
| void | addRegistration (const dtn::data::EID &eid) throw (NativeSessionException) |
| void | removeRegistration (const dtn::data::EID &eid) throw (NativeSessionException) |
| void | clearRegistration () throw () |
| std::vector< std::string > | getSubscriptions () throw () |
| void | next (RegisterIndex ri) throw (BundleNotFoundException) |
| void | load (RegisterIndex ri, const dtn::data::BundleID &id) throw (BundleNotFoundException) |
| void | get (RegisterIndex ri) throw () |
| void | getInfo (RegisterIndex ri) throw () |
| void | free (RegisterIndex ri) throw (BundleNotFoundException) |
| void | clear (RegisterIndex ri) throw () |
| void | delivered (const dtn::data::BundleID &id) const throw (BundleNotFoundException) |
| dtn::data::BundleID | send (RegisterIndex ri) throw () |
| void | put (RegisterIndex ri, const dtn::data::Bundle &b) throw () |
| void | put (RegisterIndex ri, const dtn::data::PrimaryBlock &b) throw () |
| void | write (RegisterIndex ri, const char *buf, const size_t len, const size_t offset=std::string::npos) throw () |
| void | read (RegisterIndex ri, char *buf, size_t &len, const size_t offset=0) throw () |
| void | receive () throw (NativeSessionException) |
| const std::string & | getHandle () const |
Definition at line 85 of file NativeSession.h.
| Enumerator | |
|---|---|
| REG1 | |
| REG2 | |
Definition at line 89 of file NativeSession.h.
| dtn::api::NativeSession::NativeSession | ( | NativeSessionCallback * | session_cb, |
| NativeSerializerCallback * | serializer_cb | ||
| ) |
Constructor of the native session
| cb | A callback object for notifications. May be NULL. |
Definition at line 43 of file NativeSession.cpp.
References dtn::core::EventDispatcher< E >::add(), and dtn::api::Registration::getDefaultEID().

| dtn::api::NativeSession::NativeSession | ( | NativeSessionCallback * | session_cb, |
| NativeSerializerCallback * | serializer_cb, | ||
| const std::string & | handle | ||
| ) |
Constructor of the native session
| cb | A callback object for notifications. May be NULL. |
Definition at line 55 of file NativeSession.cpp.
References dtn::core::EventDispatcher< E >::add(), and dtn::api::Registration::getDefaultEID().

|
virtual |
Destructor
Definition at line 67 of file NativeSession.cpp.
| void dtn::api::NativeSession::addEndpoint | ( | const std::string & | suffix | ) | |
| throw | ( | NativeSessionException | |||
| ) | |||||
Add an application endpoint suffix to the registration
Definition at line 144 of file NativeSession.cpp.
References dtn::core::BundleCore::local, and dtn::data::EID::setApplication().

| void dtn::api::NativeSession::addRegistration | ( | const dtn::data::EID & | eid | ) | |
| throw | ( | NativeSessionException | |||
| ) | |||||
Add an endpoint identifier to the registration (commonly used for group endpoints)
Definition at line 178 of file NativeSession.cpp.
| void dtn::api::NativeSession::clear | ( | RegisterIndex | ri | ) | |
| throw | ( | ||||
| ) | |||||
Clear the local register
Definition at line 305 of file NativeSession.cpp.
| void dtn::api::NativeSession::clearRegistration | ( | ) | ||
| throw | ( | |||
| ) | ||||
Removes all registrations and reset the default endpoint to the unique registration identifier
Definition at line 208 of file NativeSession.cpp.
References dtn::api::Registration::getSubscriptions(), resetEndpoint(), and dtn::api::Registration::unsubscribe().

| void dtn::api::NativeSession::delivered | ( | const dtn::data::BundleID & | id | ) | const |
| throw | ( | BundleNotFoundException | |||
| ) | |||||
Mark the bundle with the given ID as delivered.
Definition at line 310 of file NativeSession.cpp.
References dtn::core::BundleCore::getInstance(), dtn::core::BundleCore::getStorage(), dtn::storage::BundleStorage::info(), and dtn::data::BundleID::toString().

| void dtn::api::NativeSession::destroy | ( | ) | ||
| throw | ( | |||
| ) | ||||
Destroy this session and block until this process is done
Definition at line 79 of file NativeSession.cpp.
References dtn::api::Registration::abort(), and dtn::core::EventDispatcher< E >::remove().

| void dtn::api::NativeSession::free | ( | RegisterIndex | ri | ) | |
| throw | ( | BundleNotFoundException | |||
| ) | |||||
Delete the bundle in the local register from the storage
Definition at line 295 of file NativeSession.cpp.
References dtn::core::BundleCore::getInstance(), dtn::core::BundleCore::getStorage(), and dtn::storage::BundleStorage::remove().

| void dtn::api::NativeSession::get | ( | RegisterIndex | ri | ) | |
| throw | ( | ||||
| ) | |||||
Return the bundle in the register using the given callback
Definition at line 269 of file NativeSession.cpp.
References dtn::api::NativeSerializer::BUNDLE_FULL.
| const std::string & dtn::api::NativeSession::getHandle | ( | ) | const |
Return the handle of this session
Definition at line 492 of file NativeSession.cpp.
References dtn::api::Registration::getHandle().

| void dtn::api::NativeSession::getInfo | ( | RegisterIndex | ri | ) | |
| throw | ( | ||||
| ) | |||||
Return the bundle skeleton in the register using the given callback
Definition at line 282 of file NativeSession.cpp.
References dtn::api::NativeSerializer::BUNDLE_INFO.
| const dtn::data::EID & dtn::api::NativeSession::getNodeEID | ( | ) | const | |
| throw | ( | |||
| ) | ||||
Returns the node EID of this device
Definition at line 87 of file NativeSession.cpp.
References dtn::core::BundleCore::local.
| std::vector< std::string > dtn::api::NativeSession::getSubscriptions | ( | ) | ||
| throw | ( | |||
| ) | ||||
Retrieve all registered endpoints
Definition at line 223 of file NativeSession.cpp.
References dtn::api::Registration::getSubscriptions().

| void dtn::api::NativeSession::load | ( | RegisterIndex | ri, |
| const dtn::data::BundleID & | id | ||
| ) | |||
| throw | ( | BundleNotFoundException | |
| ) | |||
Load a bundle into the local register
Definition at line 247 of file NativeSession.cpp.
References dtn::storage::BundleStorage::get(), dtn::core::BundleCore::getInstance(), dtn::core::BundleCore::getStorage(), and dtn::core::BundleCore::processBlocks().

| void dtn::api::NativeSession::next | ( | RegisterIndex | ri | ) | |
| throw | ( | BundleNotFoundException | |||
| ) | |||||
Loads the next bundle in the queue into the local register
Definition at line 233 of file NativeSession.cpp.
References dtn::data::BundleID::toString().

| void dtn::api::NativeSession::put | ( | RegisterIndex | ri, |
| const dtn::data::Bundle & | b | ||
| ) | |||
| throw | ( | ||
| ) | |||
Copy the given bundle into the local register
Definition at line 333 of file NativeSession.cpp.
| void dtn::api::NativeSession::put | ( | RegisterIndex | ri, |
| const dtn::data::PrimaryBlock & | b | ||
| ) | |||
| throw | ( | ||
| ) | |||
Copy the PrimaryBlock into the local register
Definition at line 339 of file NativeSession.cpp.
| void dtn::api::NativeSession::read | ( | RegisterIndex | ri, |
| char * | buf, | ||
| size_t & | len, | ||
| const size_t | offset = 0 |
||
| ) | |||
| throw | ( | ||
| ) | |||
Read max. <len> bytes from the payload block in the bundle. If there is no payload block available the read method will set len = 0 and return. Otherwise the len variable contains the number of bytes written into buf.
| ri | Index to tell which bundle register to use. |
| buf | Buffer to put the data into. |
| len | The size of the buf array. After the call it contains the number of bytes in the buffer. |
| offset | Start here to read. |
Definition at line 386 of file NativeSession.cpp.
References dtn::data::PayloadBlock::getBLOB().

| void dtn::api::NativeSession::receive | ( | ) | ||
| throw | ( | NativeSessionException | ||
| ) | ||||
Receives one bundle and returns. If there is no bundle this call will block until a bundle is available or destroy() has been called.
Definition at line 424 of file NativeSession.cpp.
References dtn::data::PrimaryBlock::APPDATA_IS_ADMRECORD, dtn::api::Registration::delivered(), dtn::api::Registration::receiveMetaBundle(), and dtn::api::Registration::wait_for_bundle().

| void dtn::api::NativeSession::removeEndpoint | ( | const std::string & | suffix | ) | |
| throw | ( | NativeSessionException | |||
| ) | |||||
Remove an application endpoint suffix from the registration
Definition at line 161 of file NativeSession.cpp.
References dtn::core::BundleCore::local, and dtn::data::EID::setApplication().

| void dtn::api::NativeSession::removeRegistration | ( | const dtn::data::EID & | eid | ) | |
| throw | ( | NativeSessionException | |||
| ) | |||||
Remove an endpoint identifier from the registration
Definition at line 193 of file NativeSession.cpp.
| void dtn::api::NativeSession::resetEndpoint | ( | ) | ||
| throw | ( | |||
| ) | ||||
Resets the default endpoint to the unique registration identifier
Definition at line 135 of file NativeSession.cpp.
References dtn::api::Registration::getDefaultEID(), dtn::data::EID::getString(), dtn::api::Registration::subscribe(), and dtn::api::Registration::unsubscribe().
Referenced by clearRegistration().

| dtn::data::BundleID dtn::api::NativeSession::send | ( | RegisterIndex | ri | ) | |
| throw | ( | ||||
| ) | |||||
Send the bundle in the local register
Definition at line 323 of file NativeSession.cpp.
References dtn::api::Registration::processIncomingBundle().

| void dtn::api::NativeSession::setEndpoint | ( | const std::string & | suffix | ) | |
| throw | ( | NativeSessionException | |||
| ) | |||||
Set the default application endpoint suffix of this registration
Definition at line 113 of file NativeSession.cpp.
| void dtn::api::NativeSession::write | ( | RegisterIndex | ri, |
| const char * | buf, | ||
| const size_t | len, | ||
| const size_t | offset = std::string::npos |
||
| ) | |||
| throw | ( | ||
| ) | |||
Write byte into the payload block of the bundle in the register. If there is no payload block, this method will append a new one at the end of all blocks.
| ri | Index to tell which bundle register to use. |
| buf | Buffer to copy. |
| len | The number of bytes to copy. |
| offset | Start here to write. |
Definition at line 348 of file NativeSession.cpp.
References dtn::data::PayloadBlock::getBLOB().
