libuv/uv-unix.h

82 lines
2.3 KiB
C
Raw Normal View History

/* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
2011-05-12 02:56:33 +00:00
#ifndef UV_UNIX_H
#define UV_UNIX_H
2011-03-28 10:17:52 +00:00
#include "ngx-queue.h"
#include "ev/ev.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-05-13 14:15:02 +00:00
} uv_buf_t;
2011-03-23 12:56:06 +00:00
2011-05-12 02:56:33 +00:00
#define uv_req_private_fields \
int write_index; \
ev_timer timer; \
ngx_queue_t queue; \
2011-05-13 14:15:02 +00:00
uv_buf_t* bufs; \
int bufcnt;
2011-03-28 10:17:52 +00:00
2011-03-24 03:40:55 +00:00
/* TODO: union or classes please! */
2011-05-12 02:56:33 +00:00
#define uv_handle_private_fields \
2011-04-10 21:59:41 +00:00
int fd; \
2011-04-15 17:26:51 +00:00
int flags; \
ev_idle next_watcher; \
2011-05-12 02:56:33 +00:00
/* UV_TCP */ \
2011-05-08 02:14:13 +00:00
int delayed_error; \
2011-05-12 02:56:33 +00:00
uv_read_cb read_cb; \
uv_accept_cb accept_cb; \
2011-04-15 08:11:13 +00:00
int accepted_fd; \
2011-05-12 02:56:33 +00:00
uv_req_t *connect_req; \
uv_req_t *shutdown_req; \
2011-04-10 21:59:41 +00:00
ev_io read_watcher; \
ev_io write_watcher; \
ngx_queue_t write_queue; \
2011-05-12 02:56:33 +00:00
/* UV_PREPARE */ \
ev_prepare prepare_watcher; \
2011-05-12 02:56:33 +00:00
uv_loop_cb prepare_cb; \
/* UV_CHECK */ \
ev_check check_watcher; \
2011-05-12 02:56:33 +00:00
uv_loop_cb check_cb; \
/* UV_IDLE */ \
ev_idle idle_watcher; \
2011-05-12 02:56:33 +00:00
uv_loop_cb idle_cb; \
/* UV_ASYNC */ \
ev_async async_watcher; \
uv_loop_cb async_cb; \
/* UV_TIMER */ \
ev_timer timer_watcher; \
uv_loop_cb timer_cb;
2011-03-28 10:17:52 +00:00
2011-05-12 02:56:33 +00:00
#endif /* UV_UNIX_H */