43 #include <sys/socket.h>
48 #include <semaphore.h>
50 #include <sys/syscall.h>
56 #include <sys/endian.h>
57 #include <sys/types.h>
60 #include <include/mfflags.h>
67 #warning "Compiling for android"
69 #warning "Compiling for android < 2.3.3"
70 #define SER_PATH "/data/mfdemo/mfstack"
71 #define CLI_PATH "/data/mfdemo/" //+ 5(pid)
72 #define SER_DATA_PATH "/data/mfdemo/data" //+ 5 (pid)
73 #define CLI_DATA_PATH "/data/mfdemo/client" //+ 5(pid)
75 #warning "Compiling for android > 2.3.3"
76 #define SER_PATH "/sdcard/mfdemo/mfstack"
77 #define CLI_PATH "/sdcard/mfdemo/"
78 #define SER_DATA_PATH "/sdcard/mfdemo/data"
79 #define CLI_DATA_PATH "/sdcard/mfdemo/client"
82 #warning "Compiling for linux"
83 #define SER_PATH "/data/mfdemo/mfstack"
84 #define CLI_PATH "/data/mfdemo/"
85 #define SER_DATA_PATH "/data/mfdemo/data"
86 #define CLI_DATA_PATH "/data/mfdemo/client"
89 #define MAX_PAYLOAD_SIZE 1024
91 #define MAX_CHUNK_SIZE 1024 //number of packets
92 #define MAX_CHUNK_LEN MAX_PAYLOAD_SIZE*MAX_CHUNK_SIZE-ROUTE_HEADER_LEN-TRANS_HEADER_LEN-NEXT_HEADER_RESERVED_SIZE
96 #define ROUTE_HEADER_LEN 60
97 #define NEXT_HEADER_RESERVED_SIZE 60
98 #define TRANS_HEADER_LEN 28
99 #define FIRST_PAYLOAD_SIZE (MAX_PAYLOAD_SIZE-ROUTE_HEADER_LEN-TRANS_HEADER_LEN - NEXT_HEADER_RESERVED_SIZE)
110 MSG_TYPE_SEND_COMPLETE,
114 MSG_TYPE_CLOSE_REPLY,
116 MSG_TYPE_ATTACH_REPLY,
118 MSG_TYPE_DETACH_REPLY,
119 MSG_TYPE_AFTER_CLOSE,
128 struct WaitingTIDs *next;
139 struct WaitingTIDs *first;
140 struct WaitingTIDs *garbage;
151 char profile[LEN_PROF];
156 struct MsgOpenReply {
170 struct MsgSendReply {
177 struct MsgSendComplete {
191 struct MsgRecvReply {
204 u_int GUIDs[MAX_ATTACH];
208 struct MsgAttachReply {
219 u_int GUIDs[MAX_ATTACH];
223 struct MsgDetachReply {
236 struct MsgCloseReply {
243 struct MsgAfterClose{
249 int mfopen(
struct Handle *h,
const char *profile, mfflag_t opts,
const int src_GUID);
250 int mfsend(
struct Handle *h,
void *buffer, u_int size,
const int dst_GUID, mfflag_t opts);
251 int mfrecv(
struct Handle *h,
int *sGUID,
void *buffer, u_int size,
const int *src_GUID,
const int n_GUID);
252 int mfrecv_blk(
struct Handle *h,
int *sGUID,
void *buffer, u_int size,
const int *src_GUID,
const int n_GUID);
253 int mfattach(
struct Handle *h,
const int *GUIDs,
const int nGUID);
254 int mfdetach(
struct Handle *h,
const int *GUIDs,
const int nGUID);
256 int mfget(
struct Handle *h,
void *request, u_int bufSize,
void *buffer, u_int size,
const char *opts);
257 int mfdo_get(
struct Handle *h,
const int *dst_GUID,
void *request, u_int size);
258 int mfget_response(
struct Handle *h,
void *buffer, u_int size,
const char *opts);
Define possible errors occurring in MobilityFirst's API and stack.
int mfattach(struct Handle *h, const int *GUIDs, const int nGUID)
Definition: mfapi.c:563
int mfrecv_blk(struct Handle *h, int *sGUID, void *buffer, u_int size, const int *src_GUID, const int n_GUID)
Definition: mfapi.c:534
int mfsend(struct Handle *h, void *buffer, u_int size, const int dst_GUID, mfflag_t opts)
Definition: mfapi.c:416
int mfopen(struct Handle *h, const char *profile, mfflag_t opts, const int src_GUID)
Definition: mfapi.c:276
int mfrecv(struct Handle *h, int *sGUID, void *buffer, u_int size, const int *src_GUID, const int n_GUID)
Definition: mfapi.c:549
int mfclose(struct Handle *h)
Definition: mfapi.c:622
int mfdetach(struct Handle *h, const int *GUIDs, const int nGUID)
Definition: mfapi.c:594