IBR-DTNSuite 0.6

ibrdtn/ibrdtn/api/CApi.cpp File Reference

#include "ibrdtn/api/dtn_api.h"
#include "ibrcommon/net/tcpclient.h"
#include "ibrdtn/api/Client.h"
#include "ibrdtn/api/StringBundle.h"
#include <string.h>
#include <cstdarg>
#include <unistd.h>
Include dependency graph for CApi.cpp:

Go to the source code of this file.

Functions

int32_t dtn_register_endpoint (char *ep, void(*process_bundle)(const void *data, uint32_t size), void(*status_callback)(struct dtn_notification info))
void dtn_close_endpoint (DTN_EP ep)
void dtn_write (DTN_EP ep, const void *data, uint32_t length)
int32_t dtn_read (DTN_EP ep, void *buf, uint32_t length)
void dtn_endpoint_set_option (DTN_EP ep, uint16_t option,...)
void dtn_send_bundle (int32_t ep, char *dst_uri, char *data, uint32_t length)
void dtn_hithere ()

Function Documentation

void dtn_close_endpoint ( DTN_EP  ep)

Close dtn endpoint

Definition at line 251 of file CApi.cpp.

References MAX_DTN_FDS.

Referenced by bundle_received().

void dtn_endpoint_set_option ( DTN_EP  ep,
uint16_t  option,
  ... 
)

Set options for this dtn socket

Definition at line 289 of file CApi.cpp.

References DTN_OPTION_DSTEID, DTN_OPTION_FLUSH, DTN_OPTION_TXCHUNKSIZE, and MAX_DTN_FDS.

Referenced by main().

void dtn_hithere ( )

Test stuff

Definition at line 323 of file CApi.cpp.

Referenced by main().

int32_t dtn_read ( DTN_EP  ep,
void *  buf,
uint32_t  length 
)

Blocking read. This can only be used if the process_bundle callback was NULL in register_endpoint. Returns number of bytes read, or <0 if shit happened

Definition at line 277 of file CApi.cpp.

References MAX_DTN_FDS.

Referenced by main().

int32_t dtn_register_endpoint ( char *  ep,
void(*)(const void *data, uint32_t size)  process_bundle,
void(*)(struct dtn_notification info)  status_callback 
)

Register an endpoint on local device.Tries to grab dtn://<this_nodes_address>/<ep> Returns DTN endpoint descriptor on success, or a vlaue <0 if shit happens If receive and notification callbacks are given, they'll be called in case of received data (all data has to fit in RAM in this case) or notifications. Access to process_bundle und dtn_notification is serialized, no need t make them reentrant

Definition at line 235 of file CApi.cpp.

References MAX_DTN_FDS.

Referenced by main().

void dtn_send_bundle ( int32_t  dtnd,
char *  dst_uri,
char *  data,
uint32_t  length 
)

stateless fire&forget send method. No acks, all data has to reside in RAM when intermixing send_bundle calls with calls to the dtn_write() API dtn_send_bundle will be transmitted out-of-band, i.e. if there is still data in

Definition at line 315 of file CApi.cpp.

References MAX_DTN_FDS.

Referenced by main().

void dtn_write ( DTN_EP  ep,
const void *  data,
uint32_t  length 
)

Send data to DTN_OPTION_DSTEID, data is buffered and will be transmitted if at least DTN_OPTION_TXCHUNKSIZE bytes of data have been written

Definition at line 265 of file CApi.cpp.

References MAX_DTN_FDS.

Referenced by main().