/* * N E T W A T C H E R * * This module watches network connections for sockets becoming readable or * writeable and invokes callbacks. It also provides a timer mechanism. * * Douglas Clowes, February 2007 * */ #ifndef SICSNETWATCHER #define SICSNETWATCHER #define DFC_NWATCH 1 #define nwatch_read 1 #define nwatch_write 2 /* the callback function */ typedef int (*pNWCallback)(void* context, int mode); /* the timer methods */ typedef struct __netwatchtimer *pNWTimer; int NetWatchRegisterTimer(pNWTimer* handle, int mSec, pNWCallback callback, void* context); int NetWatchRemoveTimer(pNWTimer handle); /* the socket methods */ typedef struct __netwatchcontext *pNWContext; int NetWatchRegisterCallback(pNWContext* handle, int iSocket, pNWCallback callback, void* context); int NetWatchRemoveCallback(pNWContext handle); int NetWatchGetMode(pNWContext handle); int NetWatchSetMode(pNWContext handle, int mode); #endif /* SICSNETWATCHER */