src/server/public/nsapi.h

branch
aio
changeset 172
5580517faafc
parent 159
9ba9f8befa80
child 184
a2a15ad6e4b9
--- a/src/server/public/nsapi.h	Sat Feb 04 16:42:11 2017 +0100
+++ b/src/server/public/nsapi.h	Sat Feb 18 13:27:25 2017 +0100
@@ -1138,7 +1138,19 @@
 #define ISMOPTIONS(r)   ((r)->method_num == METHOD_OPTIONS)
 
 
-// new type
+// new types
+typedef struct aiocb_s {
+    SYS_FILE filedes;
+    void         *buf;
+    size_t       nbytes;
+    off_t        offset;
+    ssize_t      result;
+    int          result_errno;
+    Event        *event;
+    EventHandler *evhandler;
+} aiocb_s;
+
+
 typedef struct _thread_pool       threadpool_t;
 typedef struct  _threadpool_job   threadpool_job;
 typedef void*(*job_callback_f)(void *data);
@@ -1319,6 +1331,8 @@
 // NSAPI extension
 ssize_t net_printf(SYS_NETFD fd, char *format, ...);
 
+int net_setnonblock(SYS_NETFD fd, int nonblock);
+int net_errno(SYS_NETFD fd);
 
 NSAPI_PUBLIC pb_param *INTparam_create(const char *name, const char *value);
 
@@ -1527,6 +1541,9 @@
 NSAPI_PUBLIC off_t system_lseek(SYS_FILE fd, off_t offset, int whence);
 NSAPI_PUBLIC int system_fclose(SYS_FILE fd);
 
+NSAPI_PUBLIC int system_aio_read(aiocb_s *aiocb);
+NSAPI_PUBLIC int system_aio_write(aiocb_s *aiocb);
+
 
 int log_ereport(int degree, const char *format, ...);
 int log_ereport_v(int degree, const char *format, va_list args);
@@ -1542,6 +1559,7 @@
 NSAPI_PUBLIC pblock* util_parse_param(pool_handle_t *pool, char *query);
 #define util_parse_param util_parse_param
 
+void nsapi_function_return(Session *sn, Request *rq, int ret);
 
 // threadpool
 threadpool_t* threadpool_new(int min, int max);
@@ -1549,12 +1567,9 @@
 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);
-
+int event_pollin(EventHandler *ev, SYS_NETFD fd, Event *event);
+int event_pollout(EventHandler *ev, SYS_NETFD fd, Event *event);
+int event_removepoll(EventHandler *ev, SYS_NETFD fd);
 
 // assert
 void ws_log_assert(const char *file, const char *func, int line);

mercurial