|
38 | 38 | require it! */
|
39 | 39 | #if defined(_AIX) || defined(__NOVELL_LIBC__) || defined(__NetBSD__) || \
|
40 | 40 | defined(__minix) || defined(__SYMBIAN32__) || defined(__INTEGRITY) || \
|
41 |
| - defined(ANDROID) || defined(__ANDROID__) || defined(__OpenBSD__) |
| 41 | + defined(ANDROID) || defined(__ANDROID__) || defined(__OpenBSD__) || \ |
| 42 | + defined(__QNXNTO__) |
42 | 43 | #include <sys/select.h>
|
43 | 44 | #endif
|
44 | 45 | #if (defined(NETWARE) && !defined(__NOVELL_LIBC__))
|
@@ -356,6 +357,27 @@ CARES_EXTERN void ares_set_socket_configure_callback(ares_channel channel,
|
356 | 357 | CARES_EXTERN int ares_set_sortlist(ares_channel channel,
|
357 | 358 | const char *sortstr);
|
358 | 359 |
|
| 360 | +/* |
| 361 | + * Virtual function set to have user-managed socket IO. |
| 362 | + * Note that all functions need to be defined, and when |
| 363 | + * set, the library will not do any bind nor set any |
| 364 | + * socket options, assuming the client handles these |
| 365 | + * through either socket creation or the |
| 366 | + * ares_sock_config_callback call. |
| 367 | + */ |
| 368 | +struct iovec; |
| 369 | +struct ares_socket_functions { |
| 370 | + ares_socket_t(*asocket)(int, int, int, void *); |
| 371 | + int(*aclose)(ares_socket_t, void *); |
| 372 | + int(*aconnect)(ares_socket_t, const struct sockaddr *, ares_socklen_t, void *); |
| 373 | + ares_ssize_t(*arecvfrom)(ares_socket_t, void *, size_t, int, struct sockaddr *, ares_socklen_t *, void *); |
| 374 | + ares_ssize_t(*asendv)(ares_socket_t, const struct iovec *, int, void *); |
| 375 | +}; |
| 376 | + |
| 377 | +CARES_EXTERN void ares_set_socket_functions(ares_channel channel, |
| 378 | + const struct ares_socket_functions * funcs, |
| 379 | + void *user_data); |
| 380 | + |
359 | 381 | CARES_EXTERN void ares_send(ares_channel channel,
|
360 | 382 | const unsigned char *qbuf,
|
361 | 383 | int qlen,
|
|
0 commit comments