IBR-DTNSuite  0.8
ibrdtn/ibrdtn/api/dtn_api.h File Reference
#include <inttypes.h>
Include dependency graph for dtn_api.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  dtn_notification

Defines

#define DTN_NOTIFIY_SHUTDOWN   1
#define DTN_NOTIFIY_ACK   2
#define DTN_NOTIFY_NACK   3
#define DTN_NOTIFY_TOOBIG   4
#define DTN_OPTION_TXCHUNKSIZE   1
#define DTN_OPTION_DSTEID   2
#define DTN_OPTION_FLUSH   3
#define MAX_DTN_FDS   4
#define dtn_flush(ep)   dtn_endpoint_set_option(ep, DTN_OPTION_FLUSH)
#define KBYTE(x)   x*1024
#define MBYTE(x)   x*1024*1024

Typedefs

typedef int32_t DTN_EP

Functions

void dtn_hithere ()
DTN_EP dtn_register_endpoint (char *ep, void(*process_bundle)(const void *data, uint32_t size), void(*status_callback)(struct dtn_notification info))
void dtn_send_bundle (int32_t dtnd, char *dst_uri, char *data, uint32_t length)
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_close_endpoint (DTN_EP ep)
void dtn_endpoint_set_option (DTN_EP ep, uint16_t option,...)

Define Documentation

#define dtn_flush (   ep)    dtn_endpoint_set_option(ep, DTN_OPTION_FLUSH)

Definition at line 90 of file dtn_api.h.

Referenced by main().

#define DTN_NOTIFIY_ACK   2

Definition at line 28 of file dtn_api.h.

#define DTN_NOTIFIY_SHUTDOWN   1

Valid notifications

Definition at line 27 of file dtn_api.h.

#define DTN_NOTIFY_NACK   3

Definition at line 29 of file dtn_api.h.

#define DTN_NOTIFY_TOOBIG   4

Definition at line 30 of file dtn_api.h.

#define DTN_OPTION_DSTEID   2

you have to set a destination EID before dtn_write() can be used

Definition at line 37 of file dtn_api.h.

Referenced by main().

#define DTN_OPTION_FLUSH   3

Forces flushing of the tx buffer

Definition at line 40 of file dtn_api.h.

#define DTN_OPTION_TXCHUNKSIZE   1

Allow to set the bundlesize when using "dtn_write" API. Every DTN_OPTION_CHUNKSIZE bytes a new bundle is created Resetting TX_CHUNKSIZE forces flushing of current tx_buffer

Definition at line 34 of file dtn_api.h.

#define KBYTE (   x)    x*1024

Definition at line 94 of file dtn_api.h.

#define MAX_DTN_FDS   4

Maximum number of endpoints per process. DO NOT CHANGE ATM (see impl why)

Definition at line 43 of file dtn_api.h.

#define MBYTE (   x)    x*1024*1024

Definition at line 95 of file dtn_api.h.


Typedef Documentation

typedef int32_t DTN_EP

DTN endpoint descriptor (like filedescriptor)

Definition at line 52 of file dtn_api.h.


Function Documentation

void dtn_close_endpoint ( DTN_EP  ep)

Close dtn endpoint

Referenced by bundle_received().

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

Set options for this dtn socket

Referenced by main().

void dtn_hithere ( )

Test stuff

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

Referenced by main().

DTN_EP 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

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

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

Referenced by main().