MFAPI
 All Files Functions Macros Pages
Functions
mfapi.h File Reference

MobilityFirst's API. More...

Go to the source code of this file.

Functions

int mfopen (struct Handle *h, const char *profile, mfflag_t opts, const int src_GUID)
 
int mfsend (struct Handle *h, void *buffer, u_int size, const int dst_GUID, mfflag_t opts)
 
int mfrecv (struct Handle *h, int *sGUID, void *buffer, u_int size, const int *src_GUID, const int n_GUID)
 
int mfrecv_blk (struct Handle *h, int *sGUID, void *buffer, u_int size, const int *src_GUID, const int n_GUID)
 
int mfattach (struct Handle *h, const int *GUIDs, const int nGUID)
 
int mfdetach (struct Handle *h, const int *GUIDs, const int nGUID)
 
int mfget (struct Handle *h, void *request, u_int bufSize, void *buffer, u_int size, const char *opts)
 
int mfdo_get (struct Handle *h, const int *dst_GUID, void *request, u_int size)
 
int mfget_response (struct Handle *h, void *buffer, u_int size, const char *opts)
 
int mfclose (struct Handle *h)
 

Detailed Description

MobilityFirst's API.

Author
wontoniii (bronz.nosp@m.ino@.nosp@m.winla.nosp@m.b.ru.nosp@m.tgers.nosp@m..edu), czhang
Date
July, 2011 C/C++ MobilityFirst API. Used to communicate with MobilityFirst's network protocol stack

Function Documentation

int mfattach ( struct Handle *  h,
const int *  GUIDs,
const int  nGUID 
)

The attach function provides the functionalities to add additional GUIDs at the the one originally identified during the open call. GUID-set represents the set of GUIDs that the application wants to add at the set that it is listening at.

Parameters
hHandle of the socket
GUIDsarray of GUIDs to attach
nGUIDnumber of GUIDs in the array
Returns
0 if completed succesfully, an error code otherwise
int mfclose ( struct Handle *  h)

The close function shall close the session initiated with an open call and clear the resources that were allocated.

Parameters
hHandle of the socket
Returns
0 if the socket was closed succesfully, an error code otherwise
int mfdetach ( struct Handle *  h,
const int *  GUIDs,
const int  nGUID 
)

The detach function shall provide a way of removing GUIDs form the one originally identified during the open call or the ones added through the use of "attach". GUID-set represents the set of GUIDs that the application wants to remove from the set that it is listening at.

Parameters
hHandle of the socket
GUIDsGUIDs array of GUIDs to detach
nGUIDnumber of GUIDs in the array
Returns
0 if completed succesfully, an error code otherwise
int mfopen ( struct Handle *  h,
const char *  profile,
mfflag_t  opts,
const int  src_GUID 
)

The open function shall define the initialization of a communication session between the application layer and the underneath layers. On doing so the system is informed of the intent of the application and can choose the appropriate transportation service and initialize the needed resources.

Parameters
hHandle of the socket
profileDescriptive element (a string) that informs the system about the intent of the application
optsis optional are additional parameters that can be provided to request additional services expressed as flags. If no value is provided, the system will make the initialization based on the sole Profile
src_GUIDis optional and represents the set of GUIDs that the application is willing of listening at. If no value is provided, the system should select the system default GUID identifier for the application.
Returns
0 if the socket was opened succesfully, an error code otherwise (look at error.h for error definitions)
int mfrecv ( struct Handle *  h,
int *  sGUID,
void *  buffer,
u_int  size,
const int *  src_GUID,
const int  n_GUID 
)

The recv operation shall write into the buffer passed the oldest not read message received. If no message is available then returns an error

Parameters
hHandle of the socket
sGUIDpointer to GUID. If pointer is not NULL it will be written the GUID of the sender of the received message.
bufferBuffer used to pass the message to the application
optsSize of the provided buffer
src_GUIDArray of source GUIDs to listen messages from. If NULL, any GUID is considered.
n_GUIDNumber of GUIDs passed with src_GUID
Returns
The number of passed bytes if succesfully exectued, an error code otherwise
int mfrecv_blk ( struct Handle *  h,
int *  sGUID,
void *  buffer,
u_int  size,
const int *  src_GUID,
const int  n_GUID 
)

The recv operation shall write into the buffer passed the oldest not read message received. If no message is available then waits for a new message to be received.

Parameters
hHandle of the socket
sGUIDpointer to GUID. If pointer is not NULL it will be written the GUID of the sender of the received message.
bufferBuffer used to pass the message to the application
optsSize of the provided buffer
src_GUIDArray of source GUIDs to listen messages from. If NULL, any GUID is considered.
n_GUIDNumber of GUIDs passed with src_GUID
Returns
The number of passed bytes if succesfully exectued, an error code otherwise
int mfsend ( struct Handle *  h,
void *  buffer,
u_int  size,
const int  dst_GUID,
mfflag_t  opts 
)

The send operation shall send data to a destination GUID as messages with no size limits except for the ones defined by system resources. The way the message is delivered to the entity defined by the GUID is determined by the session characteristics defined during the open call and eventually by additional service options.

Parameters
hHandle of the socket
bufferData message to be sent
sizeSize of the message to be sent (smaller or equal to the size of buffer)
dst_GUIDDestination GUID
optsAdditional service options used to determine how the message is delivered expressed as flags
Returns
The number of sent bytes if succesfully executed, an error code otherwise
API Wiki
MobilityFirst Project