Files
sics/nwatch.h
Douglas Clowes 2de2a0394d Add generic network watcher with timers task.
r1484 | dcl | 2007-02-15 07:48:02 +1100 (Thu, 15 Feb 2007) | 2 lines
2012-11-15 12:58:50 +11:00

34 lines
963 B
C

/*
* 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 uSec,
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 */