--- a/src/server/public/nsapi.h Tue Jan 24 23:19:48 2017 +0100 +++ b/src/server/public/nsapi.h Wed Jan 25 19:19:47 2017 +0100 @@ -602,6 +602,28 @@ }; +// nsapi ext begin + +#define EVENT_POLLIN 0x1 +#define EVENT_POLLOUT 0x2 + +typedef struct EventHandler EventHandler; +typedef struct Event Event; + +typedef int(*eventfunc)(EventHandler*, Event*); + +struct Event { + eventfunc fn; + eventfunc finish; + void *cookie; + intptr_t object; + int events; + int error; +}; + +// nsapi ext end + + typedef void* CONDVAR; typedef void *COUNTING_SEMAPHORE; typedef void* CRITICAL; @@ -681,6 +703,8 @@ struct in_addr iaddr; pool_handle_t *pool; + + EventHandler *ev; /* event handler instance (new) */ void *clauth; /* v2 ACL client authentication information */ struct Session *next; @@ -1525,6 +1549,12 @@ threadpool_job* threadpool_get_job(threadpool_t *pool); void threadpool_run(threadpool_t *pool, job_callback_f func, void *data); +int ev_pollin(EventHandler *h, int fd, Event *event); + +int ev_pollout(EventHandler *h, int fd, Event *event); + +int evt_send(EventHandler *h, Event *event); + // assert void ws_log_assert(const char *file, const char *func, int line);