diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2013-09-03 00:42:59 +0200 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2013-09-03 01:17:58 +0200 |
commit | ed8d97f572fab15025da0c762e5edfbcbe45f425 (patch) | |
tree | ca92b0ac08b5ebc14848883e4cba4e1edc9dd46b /deps/uv/include/uv.h | |
parent | 185c515c9febf2229ed2ac76bfdd0c767ea7fd43 (diff) | |
download | android-node-v8-ed8d97f572fab15025da0c762e5edfbcbe45f425.tar.gz android-node-v8-ed8d97f572fab15025da0c762e5edfbcbe45f425.tar.bz2 android-node-v8-ed8d97f572fab15025da0c762e5edfbcbe45f425.zip |
uv: upgrade to v0.11.12
* upgrade deps/uv/ to v0.11.12.
* update files in src/ after a libuv API change.
Diffstat (limited to 'deps/uv/include/uv.h')
-rw-r--r-- | deps/uv/include/uv.h | 101 |
1 files changed, 66 insertions, 35 deletions
diff --git a/deps/uv/include/uv.h b/deps/uv/include/uv.h index 5700f9413a..fcef08bb76 100644 --- a/deps/uv/include/uv.h +++ b/deps/uv/include/uv.h @@ -338,7 +338,7 @@ UV_EXTERN int uv_backend_timeout(const uv_loop_t*); /* - * Should return a buffer that libuv can use to read data into. + * Should prepare a buffer that libuv can use to read data into. * * `suggested_size` is a hint. Returning a buffer that is smaller is perfectly * okay as long as `buf.len > 0`. @@ -349,7 +349,9 @@ UV_EXTERN int uv_backend_timeout(const uv_loop_t*); * Note that returning a zero-length buffer does not stop the handle, call * uv_read_stop() or uv_udp_recv_stop() for that. */ -typedef uv_buf_t (*uv_alloc_cb)(uv_handle_t* handle, size_t suggested_size); +typedef void (*uv_alloc_cb)(uv_handle_t* handle, + size_t suggested_size, + uv_buf_t* buf); /* * `nread` is > 0 if there is data available, 0 if libuv is done reading for @@ -359,18 +361,22 @@ typedef uv_buf_t (*uv_alloc_cb)(uv_handle_t* handle, size_t suggested_size); * Trying to read from the stream again is undefined. * * The callee is responsible for freeing the buffer, libuv does not reuse it. - * The buffer may be a null buffer (where buf.base=NULL and buf.len=0) on EOF - * or error. + * The buffer may be a null buffer (where buf->base=NULL and buf->len=0) on + * EOF or error. */ -typedef void (*uv_read_cb)(uv_stream_t* stream, ssize_t nread, uv_buf_t buf); +typedef void (*uv_read_cb)(uv_stream_t* stream, + ssize_t nread, + const uv_buf_t* buf); /* * Just like the uv_read_cb except that if the pending parameter is true * then you can use uv_accept() to pull the new handle into the process. * If no handle is pending then pending will be UV_UNKNOWN_HANDLE. */ -typedef void (*uv_read2_cb)(uv_pipe_t* pipe, ssize_t nread, uv_buf_t buf, - uv_handle_type pending); +typedef void (*uv_read2_cb)(uv_pipe_t* pipe, + ssize_t nread, + const uv_buf_t* buf, + uv_handle_type pending); typedef void (*uv_write_cb)(uv_write_t* req, int status); typedef void (*uv_connect_cb)(uv_connect_t* req, int status); @@ -648,8 +654,11 @@ UV_EXTERN int uv_read2_start(uv_stream_t*, uv_alloc_cb alloc_cb, * uv_write(&req2, stream, b, 2); * */ -UV_EXTERN int uv_write(uv_write_t* req, uv_stream_t* handle, - uv_buf_t bufs[], int bufcnt, uv_write_cb cb); +UV_EXTERN int uv_write(uv_write_t* req, + uv_stream_t* handle, + const uv_buf_t bufs[], + unsigned int nbufs, + uv_write_cb cb); /* * Extended write function for sending handles over a pipe. The pipe must be @@ -658,8 +667,12 @@ UV_EXTERN int uv_write(uv_write_t* req, uv_stream_t* handle, * (listening or connected state). Bound sockets or pipes will be assumed to * be servers. */ -UV_EXTERN int uv_write2(uv_write_t* req, uv_stream_t* handle, uv_buf_t bufs[], - int bufcnt, uv_stream_t* send_handle, uv_write_cb cb); +UV_EXTERN int uv_write2(uv_write_t* req, + uv_stream_t* handle, + const uv_buf_t bufs[], + unsigned int nbufs, + uv_stream_t* send_handle, + uv_write_cb cb); /* uv_write_t is a subclass of uv_req_t */ struct uv_write_s { @@ -753,8 +766,9 @@ UV_EXTERN int uv_tcp_keepalive(uv_tcp_t* handle, */ UV_EXTERN int uv_tcp_simultaneous_accepts(uv_tcp_t* handle, int enable); -UV_EXTERN int uv_tcp_bind(uv_tcp_t* handle, struct sockaddr_in); -UV_EXTERN int uv_tcp_bind6(uv_tcp_t* handle, struct sockaddr_in6); +UV_EXTERN int uv_tcp_bind(uv_tcp_t* handle, const struct sockaddr_in* addr); +UV_EXTERN int uv_tcp_bind6(uv_tcp_t* handle, const struct sockaddr_in6* addr); + UV_EXTERN int uv_tcp_getsockname(uv_tcp_t* handle, struct sockaddr* name, int* namelen); UV_EXTERN int uv_tcp_getpeername(uv_tcp_t* handle, struct sockaddr* name, @@ -766,10 +780,15 @@ UV_EXTERN int uv_tcp_getpeername(uv_tcp_t* handle, struct sockaddr* name, * initialized TCP handle and an uninitialized uv_connect_t*. The callback * will be made when the connection is established. */ -UV_EXTERN int uv_tcp_connect(uv_connect_t* req, uv_tcp_t* handle, - struct sockaddr_in address, uv_connect_cb cb); -UV_EXTERN int uv_tcp_connect6(uv_connect_t* req, uv_tcp_t* handle, - struct sockaddr_in6 address, uv_connect_cb cb); +UV_EXTERN int uv_tcp_connect(uv_connect_t* req, + uv_tcp_t* handle, + const struct sockaddr_in* addr, + uv_connect_cb cb); + +UV_EXTERN int uv_tcp_connect6(uv_connect_t* req, + uv_tcp_t* handle, + const struct sockaddr_in6* addr, + uv_connect_cb cb); /* uv_connect_t is a subclass of uv_req_t */ struct uv_connect_s { @@ -814,8 +833,11 @@ typedef void (*uv_udp_send_cb)(uv_udp_send_t* req, int status); * flags One or more OR'ed UV_UDP_* constants. * Right now only UV_UDP_PARTIAL is used. */ -typedef void (*uv_udp_recv_cb)(uv_udp_t* handle, ssize_t nread, uv_buf_t buf, - struct sockaddr* addr, unsigned flags); +typedef void (*uv_udp_recv_cb)(uv_udp_t* handle, + ssize_t nread, + const uv_buf_t* buf, + const struct sockaddr* addr, + unsigned flags); /* uv_udp_t is a subclass of uv_handle_t */ struct uv_udp_s { @@ -875,8 +897,9 @@ UV_EXTERN int uv_udp_open(uv_udp_t* handle, uv_os_sock_t sock); * This behavior is something of an anomaly and may be replaced by an explicit * opt-in mechanism in future versions of libuv. */ -UV_EXTERN int uv_udp_bind(uv_udp_t* handle, struct sockaddr_in addr, - unsigned flags); +UV_EXTERN int uv_udp_bind(uv_udp_t* handle, + const struct sockaddr_in* addr, + unsigned flags); /* * Bind to a IPv6 address and port. @@ -889,8 +912,9 @@ UV_EXTERN int uv_udp_bind(uv_udp_t* handle, struct sockaddr_in addr, * Returns: * 0 on success, or an error code < 0 on failure. */ -UV_EXTERN int uv_udp_bind6(uv_udp_t* handle, struct sockaddr_in6 addr, - unsigned flags); +UV_EXTERN int uv_udp_bind6(uv_udp_t* handle, + const struct sockaddr_in6* addr, + unsigned flags); UV_EXTERN int uv_udp_getsockname(uv_udp_t* handle, struct sockaddr* name, int* namelen); @@ -974,16 +998,19 @@ UV_EXTERN int uv_udp_set_ttl(uv_udp_t* handle, int ttl); * req UDP request handle. Need not be initialized. * handle UDP handle. Should have been initialized with `uv_udp_init`. * bufs List of buffers to send. - * bufcnt Number of buffers in `bufs`. + * nbufs Number of buffers in `bufs`. * addr Address of the remote peer. See `uv_ip4_addr`. * send_cb Callback to invoke when the data has been sent out. * * Returns: * 0 on success, or an error code < 0 on failure. */ -UV_EXTERN int uv_udp_send(uv_udp_send_t* req, uv_udp_t* handle, - uv_buf_t bufs[], int bufcnt, struct sockaddr_in addr, - uv_udp_send_cb send_cb); +UV_EXTERN int uv_udp_send(uv_udp_send_t* req, + uv_udp_t* handle, + const uv_buf_t bufs[], + unsigned int nbufs, + const struct sockaddr_in* addr, + uv_udp_send_cb send_cb); /* * Send data. If the socket has not previously been bound with `uv_udp_bind6`, @@ -993,16 +1020,19 @@ UV_EXTERN int uv_udp_send(uv_udp_send_t* req, uv_udp_t* handle, * req UDP request handle. Need not be initialized. * handle UDP handle. Should have been initialized with `uv_udp_init`. * bufs List of buffers to send. - * bufcnt Number of buffers in `bufs`. + * nbufs Number of buffers in `bufs`. * addr Address of the remote peer. See `uv_ip6_addr`. * send_cb Callback to invoke when the data has been sent out. * * Returns: * 0 on success, or an error code < 0 on failure. */ -UV_EXTERN int uv_udp_send6(uv_udp_send_t* req, uv_udp_t* handle, - uv_buf_t bufs[], int bufcnt, struct sockaddr_in6 addr, - uv_udp_send_cb send_cb); +UV_EXTERN int uv_udp_send6(uv_udp_send_t* req, + uv_udp_t* handle, + const uv_buf_t bufs[], + unsigned int nbufs, + const struct sockaddr_in6* addr, + uv_udp_send_cb send_cb); /* * Receive data. If the socket has not previously been bound with `uv_udp_bind` @@ -1479,8 +1509,9 @@ struct uv_process_s { }; /* Initializes uv_process_t and starts the process. */ -UV_EXTERN int uv_spawn(uv_loop_t*, uv_process_t*, - uv_process_options_t options); +UV_EXTERN int uv_spawn(uv_loop_t* loop, + uv_process_t* handle, + const uv_process_options_t* options); /* @@ -1872,8 +1903,8 @@ UV_EXTERN int uv_fs_event_init(uv_loop_t* loop, uv_fs_event_t* handle, /* Utility */ /* Convert string ip addresses to binary structures */ -UV_EXTERN struct sockaddr_in uv_ip4_addr(const char* ip, int port); -UV_EXTERN struct sockaddr_in6 uv_ip6_addr(const char* ip, int port); +UV_EXTERN int uv_ip4_addr(const char* ip, int port, struct sockaddr_in* addr); +UV_EXTERN int uv_ip6_addr(const char* ip, int port, struct sockaddr_in6* addr); /* Convert binary addresses to strings */ UV_EXTERN int uv_ip4_name(struct sockaddr_in* src, char* dst, size_t size); |