|
IBR-DTNSuite 0.6
|
#include <inttypes.h>
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 dtn_flush | ( | ep | ) | dtn_endpoint_set_option(ep, DTN_OPTION_FLUSH) |
| #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 dtn_endpoint_set_option(), and main().
| #define DTN_OPTION_FLUSH 3 |
Forces flushing of the tx buffer
Definition at line 40 of file dtn_api.h.
Referenced by dtn_endpoint_set_option().
| #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.
Referenced by dtn_endpoint_set_option().
| #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.
Referenced by dtn_close_endpoint(), dtn_endpoint_set_option(), dtn_read(), dtn_register_endpoint(), dtn_send_bundle(), and dtn_write().
| typedef int32_t DTN_EP |
| 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().
| 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().
| 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
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().