@@ -49,7 +49,7 @@ extern "C" {
4949
5050
5151#define UV_VERSION_MAJOR 0
52- #define UV_VERSION_MINOR 8
52+ #define UV_VERSION_MINOR 9
5353
5454
5555#include <stdint.h> /* int64_t */
@@ -181,7 +181,7 @@ typedef enum {
181181} uv_req_type ;
182182
183183
184-
184+ /* Handle types. */
185185typedef struct uv_loop_s uv_loop_t ;
186186typedef struct uv_ares_task_s uv_ares_task_t ;
187187typedef struct uv_err_s uv_err_t ;
@@ -197,23 +197,25 @@ typedef struct uv_prepare_s uv_prepare_t;
197197typedef struct uv_check_s uv_check_t ;
198198typedef struct uv_idle_s uv_idle_t ;
199199typedef struct uv_async_s uv_async_t ;
200- typedef struct uv_getaddrinfo_s uv_getaddrinfo_t ;
201200typedef struct uv_process_s uv_process_t ;
202- typedef struct uv_counters_s uv_counters_t ;
203- typedef struct uv_cpu_info_s uv_cpu_info_t ;
204- typedef struct uv_interface_address_s uv_interface_address_t ;
205- /* Request types */
201+ typedef struct uv_fs_event_s uv_fs_event_t ;
202+ typedef struct uv_fs_poll_s uv_fs_poll_t ;
203+
204+ /* Request types. */
206205typedef struct uv_req_s uv_req_t ;
206+ typedef struct uv_getaddrinfo_s uv_getaddrinfo_t ;
207207typedef struct uv_shutdown_s uv_shutdown_t ;
208208typedef struct uv_write_s uv_write_t ;
209209typedef struct uv_connect_s uv_connect_t ;
210210typedef struct uv_udp_send_s uv_udp_send_t ;
211211typedef struct uv_fs_s uv_fs_t ;
212- /* uv_fs_event_t is a subclass of uv_handle_t. */
213- typedef struct uv_fs_event_s uv_fs_event_t ;
214- typedef struct uv_fs_poll_s uv_fs_poll_t ;
215212typedef struct uv_work_s uv_work_t ;
216213
214+ /* None of the above. */
215+ typedef struct uv_counters_s uv_counters_t ;
216+ typedef struct uv_cpu_info_s uv_cpu_info_t ;
217+ typedef struct uv_interface_address_s uv_interface_address_t ;
218+
217219
218220/*
219221 * This function must be called before any other functions in libuv.
@@ -298,13 +300,14 @@ typedef void (*uv_async_cb)(uv_async_t* handle, int status);
298300typedef void (* uv_prepare_cb )(uv_prepare_t * handle , int status );
299301typedef void (* uv_check_cb )(uv_check_t * handle , int status );
300302typedef void (* uv_idle_cb )(uv_idle_t * handle , int status );
301- typedef void (* uv_getaddrinfo_cb )(uv_getaddrinfo_t * handle , int status ,
302- struct addrinfo * res );
303303typedef void (* uv_exit_cb )(uv_process_t * , int exit_status , int term_signal );
304+ typedef void (* uv_walk_cb )(uv_handle_t * handle , void * arg );
304305typedef void (* uv_fs_cb )(uv_fs_t * req );
305306typedef void (* uv_work_cb )(uv_work_t * req );
306307typedef void (* uv_after_work_cb )(uv_work_t * req );
307- typedef void (* uv_walk_cb )(uv_handle_t * handle , void * arg );
308+ typedef void (* uv_getaddrinfo_cb )(uv_getaddrinfo_t * req ,
309+ int status ,
310+ struct addrinfo * res );
308311
309312/*
310313* This will be called repeatedly after the uv_fs_event_t is initialized.
@@ -1156,19 +1159,33 @@ struct uv_getaddrinfo_s {
11561159/*
11571160 * Asynchronous getaddrinfo(3).
11581161 *
1159- * Return code 0 means that request is accepted and callback will be called
1160- * with result. Other return codes mean that there will not be a callback.
1161- * Input arguments may be released after return from this call.
1162+ * Either node or service may be NULL but not both.
1163+ *
1164+ * hints is a pointer to a struct addrinfo with additional address type
1165+ * constraints, or NULL. Consult `man -s 3 getaddrinfo` for details.
11621166 *
1163- * uv_freeaddrinfo() must be called after completion to free the addrinfo
1164- * structure.
1167+ * Returns 0 on success, -1 on error. Call uv_last_error() to get the error.
11651168 *
1166- * On error NXDOMAIN the status code will be non-zero and UV_ENOENT returned.
1169+ * If successful, your callback gets called sometime in the future with the
1170+ * lookup result, which is either:
1171+ *
1172+ * a) status == 0, the res argument points to a valid struct addrinfo, or
1173+ * b) status == -1, the res argument is NULL.
1174+ *
1175+ * On NXDOMAIN, the status code is -1 and uv_last_error() returns UV_ENOENT.
1176+ *
1177+ * Call uv_freeaddrinfo() to free the addrinfo structure.
11671178 */
1168- UV_EXTERN int uv_getaddrinfo (uv_loop_t * , uv_getaddrinfo_t * handle ,
1169- uv_getaddrinfo_cb getaddrinfo_cb , const char * node , const char * service ,
1170- const struct addrinfo * hints );
1179+ UV_EXTERN int uv_getaddrinfo (uv_loop_t * loop ,
1180+ uv_getaddrinfo_t * req ,
1181+ uv_getaddrinfo_cb getaddrinfo_cb ,
1182+ const char * node ,
1183+ const char * service ,
1184+ const struct addrinfo * hints );
11711185
1186+ /*
1187+ * Free the struct addrinfo. Passing NULL is allowed and is a no-op.
1188+ */
11721189UV_EXTERN void uv_freeaddrinfo (struct addrinfo * ai );
11731190
11741191/* uv_spawn() options */
@@ -1709,15 +1726,21 @@ UV_EXTERN int uv_thread_join(uv_thread_t *tid);
17091726
17101727/* the presence of these unions force similar struct layout */
17111728union uv_any_handle {
1729+ uv_handle_t handle ;
1730+ uv_stream_t stream ;
17121731 uv_tcp_t tcp ;
17131732 uv_pipe_t pipe ;
17141733 uv_prepare_t prepare ;
17151734 uv_check_t check ;
17161735 uv_idle_t idle ;
17171736 uv_async_t async ;
17181737 uv_timer_t timer ;
1719- uv_getaddrinfo_t getaddrinfo ;
17201738 uv_fs_event_t fs_event ;
1739+ uv_fs_poll_t fs_poll ;
1740+ uv_poll_t poll ;
1741+ uv_process_t process ;
1742+ uv_tty_t tty ;
1743+ uv_udp_t udp ;
17211744};
17221745
17231746union uv_any_req {
@@ -1727,6 +1750,8 @@ union uv_any_req {
17271750 uv_shutdown_t shutdown ;
17281751 uv_fs_t fs_req ;
17291752 uv_work_t work_req ;
1753+ uv_udp_send_t udp_send_req ;
1754+ uv_getaddrinfo_t getaddrinfo_req ;
17301755};
17311756
17321757
0 commit comments