IBR-DTNSuite  0.8
ibrdtn/ibrdtn/api/dtn_api.h
Go to the documentation of this file.
00001 
00006 #ifndef __DTN_API_H__
00007 #define __DTN_API_H__
00008 
00009 
00010 #ifdef __cplusplus
00011 extern "C" {
00012 #endif
00013 
00014 #include <inttypes.h>
00015 
00016 
00017 
00018 
00020 struct dtn_notification  {
00021     uint16_t status;
00022     uint32_t data;
00023 };
00024 
00025 
00027 #define DTN_NOTIFIY_SHUTDOWN     1    //DTN Endpoint will be unavbailable in the future
00028 #define DTN_NOTIFIY_ACK          2
00029 #define DTN_NOTIFY_NACK          3
00030 #define DTN_NOTIFY_TOOBIG        4   //bundle to big for callback mode
00031 
00034 #define DTN_OPTION_TXCHUNKSIZE  1
00035 
00037 #define DTN_OPTION_DSTEID       2 
00038 
00040 #define DTN_OPTION_FLUSH        3
00041 
00043 #define MAX_DTN_FDS     4
00044 
00045 
00046 
00047 
00048 
00049 
00050 
00052 typedef int32_t DTN_EP;
00053 
00054 
00056 void dtn_hithere();
00057 
00058 
00065 DTN_EP dtn_register_endpoint(char *ep, void (*process_bundle)(const void * data, uint32_t size), void (*status_callback)(struct dtn_notification info));
00066 
00067 
00072 void dtn_send_bundle(int32_t dtnd , char *dst_uri, char *data, uint32_t length);
00073 
00074 
00077 void dtn_write(DTN_EP ep, const void *data, uint32_t length);
00078 
00082 int32_t dtn_read(DTN_EP ep, void *buf, uint32_t length);
00083 
00085 void dtn_close_endpoint(DTN_EP ep);
00086 
00088 void dtn_endpoint_set_option(DTN_EP ep, uint16_t option, ...);
00089 
00090 #define dtn_flush(ep)  dtn_endpoint_set_option(ep, DTN_OPTION_FLUSH)
00091 
00092 
00093 
00094 #define KBYTE(x) x*1024
00095 #define MBYTE(x) x*1024*1024
00096 
00097 
00098 
00099 #ifdef __cplusplus
00100 }
00101 #endif
00102 
00103 
00104 #endif