2011-03-28 10:17:52 +00:00
|
|
|
#ifndef OL_UNIX_H
|
|
|
|
|
#define OL_UNIX_H
|
|
|
|
|
|
|
|
|
|
#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-03-23 12:56:06 +00:00
|
|
|
/**
|
|
|
|
|
* Note can be cast to io_vec.
|
|
|
|
|
*/
|
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;
|
|
|
|
|
} ol_buf;
|
|
|
|
|
|
|
|
|
|
|
2011-03-28 08:55:29 +00:00
|
|
|
|
|
|
|
|
typedef struct {
|
2011-03-28 10:17:52 +00:00
|
|
|
int local;
|
2011-03-31 16:02:07 +00:00
|
|
|
ol_connect_cb connect_cb;
|
2011-03-29 23:40:27 +00:00
|
|
|
ngx_queue_t read_reqs;
|
2011-03-31 04:36:52 +00:00
|
|
|
ol_buf* read_bufs;
|
|
|
|
|
int read_bufcnt;
|
2011-03-28 08:55:29 +00:00
|
|
|
} ol_req_private;
|
|
|
|
|
|
|
|
|
|
|
2011-03-24 03:40:55 +00:00
|
|
|
typedef struct {
|
2011-03-23 12:56:06 +00:00
|
|
|
int fd;
|
|
|
|
|
|
2011-03-29 17:08:45 +00:00
|
|
|
ol_err err;
|
|
|
|
|
|
2011-03-23 12:56:06 +00:00
|
|
|
ol_read_cb read_cb;
|
|
|
|
|
ol_close_cb close_cb;
|
2011-03-28 10:17:52 +00:00
|
|
|
|
|
|
|
|
ol_req *connect_req;
|
2011-03-24 03:40:55 +00:00
|
|
|
|
|
|
|
|
ev_io read_watcher;
|
|
|
|
|
ev_io write_watcher;
|
2011-03-23 12:56:06 +00:00
|
|
|
|
2011-03-28 10:17:52 +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-03-28 08:55:29 +00:00
|
|
|
} ol_handle_private;
|
2011-03-28 10:17:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* OL_UNIX_H */
|