2011-04-07 09:02:54 +00:00
|
|
|
#ifndef OIO_UNIX_H
|
|
|
|
|
#define OIO_UNIX_H
|
2011-03-28 10:17:52 +00:00
|
|
|
|
|
|
|
|
#include "ngx-queue.h"
|
|
|
|
|
|
|
|
|
|
#include "ev/ev.h"
|
|
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
#include <sys/socket.h>
|
|
|
|
|
#include <netinet/in.h>
|
|
|
|
|
#include <netinet/tcp.h>
|
|
|
|
|
|
|
|
|
|
|
2011-04-15 17:26:51 +00:00
|
|
|
/* Note: May be cast to struct iovec. See writev(2). */
|
2011-03-24 03:40:55 +00:00
|
|
|
typedef struct {
|
2011-03-28 10:17:52 +00:00
|
|
|
char* base;
|
2011-03-23 12:56:06 +00:00
|
|
|
size_t len;
|
2011-04-07 09:02:54 +00:00
|
|
|
} oio_buf;
|
2011-03-23 12:56:06 +00:00
|
|
|
|
|
|
|
|
|
2011-04-10 21:59:41 +00:00
|
|
|
#define oio_req_private_fields \
|
|
|
|
|
oio_connect_cb connect_cb; \
|
|
|
|
|
ngx_queue_t read_reqs; \
|
|
|
|
|
oio_buf* read_bufs; \
|
2011-04-18 06:41:24 +00:00
|
|
|
ev_timer timer; \
|
2011-03-31 04:36:52 +00:00
|
|
|
int read_bufcnt;
|
2011-03-28 10:17:52 +00:00
|
|
|
|
2011-03-24 03:40:55 +00:00
|
|
|
|
2011-04-10 21:59:41 +00:00
|
|
|
#define oio_handle_private_fields \
|
|
|
|
|
int fd; \
|
2011-04-15 17:26:51 +00:00
|
|
|
int flags; \
|
2011-04-10 21:59:41 +00:00
|
|
|
oio_err err; \
|
|
|
|
|
oio_read_cb read_cb; \
|
|
|
|
|
oio_accept_cb accept_cb; \
|
2011-04-15 08:11:13 +00:00
|
|
|
int accepted_fd; \
|
2011-04-10 21:59:41 +00:00
|
|
|
oio_req *connect_req; \
|
|
|
|
|
ev_io read_watcher; \
|
|
|
|
|
ev_io write_watcher; \
|
2011-04-18 05:49:58 +00:00
|
|
|
ev_idle next_watcher; \
|
2011-04-10 21:59:41 +00:00
|
|
|
ngx_queue_t write_queue; \
|
2011-03-29 23:40:27 +00:00
|
|
|
ngx_queue_t read_reqs;
|
2011-03-28 10:17:52 +00:00
|
|
|
|
|
|
|
|
|
2011-04-07 09:02:54 +00:00
|
|
|
#endif /* OIO_UNIX_H */
|