1136 #define ISMCOPY(r) ((r)->method_num == METHOD_COPY) |
1136 #define ISMCOPY(r) ((r)->method_num == METHOD_COPY) |
1137 #define ISMTRACE(r) ((r)->method_num == METHOD_TRACE) |
1137 #define ISMTRACE(r) ((r)->method_num == METHOD_TRACE) |
1138 #define ISMOPTIONS(r) ((r)->method_num == METHOD_OPTIONS) |
1138 #define ISMOPTIONS(r) ((r)->method_num == METHOD_OPTIONS) |
1139 |
1139 |
1140 |
1140 |
1141 // new type |
1141 // new types |
|
1142 typedef struct aiocb_s { |
|
1143 SYS_FILE filedes; |
|
1144 void *buf; |
|
1145 size_t nbytes; |
|
1146 off_t offset; |
|
1147 ssize_t result; |
|
1148 int result_errno; |
|
1149 Event *event; |
|
1150 EventHandler *evhandler; |
|
1151 } aiocb_s; |
|
1152 |
|
1153 |
1142 typedef struct _thread_pool threadpool_t; |
1154 typedef struct _thread_pool threadpool_t; |
1143 typedef struct _threadpool_job threadpool_job; |
1155 typedef struct _threadpool_job threadpool_job; |
1144 typedef void*(*job_callback_f)(void *data); |
1156 typedef void*(*job_callback_f)(void *data); |
1145 |
1157 |
1146 |
1158 |
1317 void net_close(SYS_NETFD fd); |
1329 void net_close(SYS_NETFD fd); |
1318 |
1330 |
1319 // NSAPI extension |
1331 // NSAPI extension |
1320 ssize_t net_printf(SYS_NETFD fd, char *format, ...); |
1332 ssize_t net_printf(SYS_NETFD fd, char *format, ...); |
1321 |
1333 |
|
1334 int net_setnonblock(SYS_NETFD fd, int nonblock); |
|
1335 int net_errno(SYS_NETFD fd); |
1322 |
1336 |
1323 NSAPI_PUBLIC pb_param *INTparam_create(const char *name, const char *value); |
1337 NSAPI_PUBLIC pb_param *INTparam_create(const char *name, const char *value); |
1324 |
1338 |
1325 NSAPI_PUBLIC int INTparam_free(pb_param *pp); |
1339 NSAPI_PUBLIC int INTparam_free(pb_param *pp); |
1326 |
1340 |
1525 NSAPI_PUBLIC int system_fread(SYS_FILE fd, void *buf, int nbyte); |
1539 NSAPI_PUBLIC int system_fread(SYS_FILE fd, void *buf, int nbyte); |
1526 NSAPI_PUBLIC int system_fwrite(SYS_FILE fd, const void *buf, int nbyte); |
1540 NSAPI_PUBLIC int system_fwrite(SYS_FILE fd, const void *buf, int nbyte); |
1527 NSAPI_PUBLIC off_t system_lseek(SYS_FILE fd, off_t offset, int whence); |
1541 NSAPI_PUBLIC off_t system_lseek(SYS_FILE fd, off_t offset, int whence); |
1528 NSAPI_PUBLIC int system_fclose(SYS_FILE fd); |
1542 NSAPI_PUBLIC int system_fclose(SYS_FILE fd); |
1529 |
1543 |
|
1544 NSAPI_PUBLIC int system_aio_read(aiocb_s *aiocb); |
|
1545 NSAPI_PUBLIC int system_aio_write(aiocb_s *aiocb); |
|
1546 |
1530 |
1547 |
1531 int log_ereport(int degree, const char *format, ...); |
1548 int log_ereport(int degree, const char *format, ...); |
1532 int log_ereport_v(int degree, const char *format, va_list args); |
1549 int log_ereport_v(int degree, const char *format, va_list args); |
1533 int log_error(int degree, const char *func, Session *sn, Request *rq, |
1550 int log_error(int degree, const char *func, Session *sn, Request *rq, |
1534 const char *format, ...); |
1551 const char *format, ...); |
1540 NSAPI_PUBLIC int util_errno2status(int errno_value); // new |
1557 NSAPI_PUBLIC int util_errno2status(int errno_value); // new |
1541 #define util_errno2status util_errno2status |
1558 #define util_errno2status util_errno2status |
1542 NSAPI_PUBLIC pblock* util_parse_param(pool_handle_t *pool, char *query); |
1559 NSAPI_PUBLIC pblock* util_parse_param(pool_handle_t *pool, char *query); |
1543 #define util_parse_param util_parse_param |
1560 #define util_parse_param util_parse_param |
1544 |
1561 |
|
1562 void nsapi_function_return(Session *sn, Request *rq, int ret); |
1545 |
1563 |
1546 // threadpool |
1564 // threadpool |
1547 threadpool_t* threadpool_new(int min, int max); |
1565 threadpool_t* threadpool_new(int min, int max); |
1548 void* threadpool_func(void *data); |
1566 void* threadpool_func(void *data); |
1549 threadpool_job* threadpool_get_job(threadpool_t *pool); |
1567 threadpool_job* threadpool_get_job(threadpool_t *pool); |
1550 void threadpool_run(threadpool_t *pool, job_callback_f func, void *data); |
1568 void threadpool_run(threadpool_t *pool, job_callback_f func, void *data); |
1551 |
1569 |
1552 int ev_pollin(EventHandler *h, int fd, Event *event); |
1570 int event_pollin(EventHandler *ev, SYS_NETFD fd, Event *event); |
1553 |
1571 int event_pollout(EventHandler *ev, SYS_NETFD fd, Event *event); |
1554 int ev_pollout(EventHandler *h, int fd, Event *event); |
1572 int event_removepoll(EventHandler *ev, SYS_NETFD fd); |
1555 |
|
1556 int evt_send(EventHandler *h, Event *event); |
|
1557 |
|
1558 |
1573 |
1559 // assert |
1574 // assert |
1560 void ws_log_assert(const char *file, const char *func, int line); |
1575 void ws_log_assert(const char *file, const char *func, int line); |
1561 #ifdef _DEBUG |
1576 #ifdef _DEBUG |
1562 #ifndef __FUNCTION__ |
1577 #ifndef __FUNCTION__ |