@@ -49,7 +49,7 @@ extern "C" {
49
49
50
50
51
51
#define UV_VERSION_MAJOR 0
52
- #define UV_VERSION_MINOR 8
52
+ #define UV_VERSION_MINOR 9
53
53
54
54
55
55
#include <stdint.h> /* int64_t */
@@ -181,7 +181,7 @@ typedef enum {
181
181
} uv_req_type ;
182
182
183
183
184
-
184
+ /* Handle types. */
185
185
typedef struct uv_loop_s uv_loop_t ;
186
186
typedef struct uv_ares_task_s uv_ares_task_t ;
187
187
typedef struct uv_err_s uv_err_t ;
@@ -197,23 +197,25 @@ typedef struct uv_prepare_s uv_prepare_t;
197
197
typedef struct uv_check_s uv_check_t ;
198
198
typedef struct uv_idle_s uv_idle_t ;
199
199
typedef struct uv_async_s uv_async_t ;
200
- typedef struct uv_getaddrinfo_s uv_getaddrinfo_t ;
201
200
typedef 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. */
206
205
typedef struct uv_req_s uv_req_t ;
206
+ typedef struct uv_getaddrinfo_s uv_getaddrinfo_t ;
207
207
typedef struct uv_shutdown_s uv_shutdown_t ;
208
208
typedef struct uv_write_s uv_write_t ;
209
209
typedef struct uv_connect_s uv_connect_t ;
210
210
typedef struct uv_udp_send_s uv_udp_send_t ;
211
211
typedef 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 ;
215
212
typedef struct uv_work_s uv_work_t ;
216
213
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
+
217
219
218
220
/*
219
221
* 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);
298
300
typedef void (* uv_prepare_cb )(uv_prepare_t * handle , int status );
299
301
typedef void (* uv_check_cb )(uv_check_t * handle , int status );
300
302
typedef 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 );
303
303
typedef 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 );
304
305
typedef void (* uv_fs_cb )(uv_fs_t * req );
305
306
typedef void (* uv_work_cb )(uv_work_t * req );
306
307
typedef 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 );
308
311
309
312
/*
310
313
* This will be called repeatedly after the uv_fs_event_t is initialized.
@@ -1156,19 +1159,33 @@ struct uv_getaddrinfo_s {
1156
1159
/*
1157
1160
* Asynchronous getaddrinfo(3).
1158
1161
*
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.
1162
1166
*
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.
1165
1168
*
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.
1167
1178
*/
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 );
1171
1185
1186
+ /*
1187
+ * Free the struct addrinfo. Passing NULL is allowed and is a no-op.
1188
+ */
1172
1189
UV_EXTERN void uv_freeaddrinfo (struct addrinfo * ai );
1173
1190
1174
1191
/* uv_spawn() options */
@@ -1709,15 +1726,21 @@ UV_EXTERN int uv_thread_join(uv_thread_t *tid);
1709
1726
1710
1727
/* the presence of these unions force similar struct layout */
1711
1728
union uv_any_handle {
1729
+ uv_handle_t handle ;
1730
+ uv_stream_t stream ;
1712
1731
uv_tcp_t tcp ;
1713
1732
uv_pipe_t pipe ;
1714
1733
uv_prepare_t prepare ;
1715
1734
uv_check_t check ;
1716
1735
uv_idle_t idle ;
1717
1736
uv_async_t async ;
1718
1737
uv_timer_t timer ;
1719
- uv_getaddrinfo_t getaddrinfo ;
1720
1738
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 ;
1721
1744
};
1722
1745
1723
1746
union uv_any_req {
@@ -1727,6 +1750,8 @@ union uv_any_req {
1727
1750
uv_shutdown_t shutdown ;
1728
1751
uv_fs_t fs_req ;
1729
1752
uv_work_t work_req ;
1753
+ uv_udp_send_t udp_send_req ;
1754
+ uv_getaddrinfo_t getaddrinfo_req ;
1730
1755
};
1731
1756
1732
1757
0 commit comments