summaryrefslogtreecommitdiff
path: root/ares.h
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2007-05-30 12:58:47 +0000
committerDaniel Stenberg <daniel@haxx.se>2007-05-30 12:58:47 +0000
commit8c35c65fc7c746d5803a48151e82e0435c20a84c (patch)
tree1292033b628847625ec96fbf2f431cc1c2c8895e /ares.h
parent557aad7b0271e96ab76a9eaf59dab3f52289ba0e (diff)
downloadc-ares-8c35c65fc7c746d5803a48151e82e0435c20a84c.tar.gz
c-ares-8c35c65fc7c746d5803a48151e82e0435c20a84c.tar.bz2
c-ares-8c35c65fc7c746d5803a48151e82e0435c20a84c.zip
added ares_process_fd() to allow applications to ask for processing on
specific sockets and thus avoiding select() and associated functions/macros. This function will be used by upcoming libcurl releases for this very reason. It also made me export the ares_socket_t type in the public ares.h header file, since ares_process_fd() uses that type for two of the arguments.
Diffstat (limited to 'ares.h')
-rw-r--r--ares.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/ares.h b/ares.h
index 83a1c8e..73fc3e6 100644
--- a/ares.h
+++ b/ares.h
@@ -136,6 +136,22 @@ extern "C" {
#define ARES_GETSOCK_WRITABLE(bits,num) (bits & (1 << ((num) + \
ARES_GETSOCK_MAXNUM)))
+
+/*
+ * Typedef our socket type
+ */
+
+#ifndef ares_socket_typedef
+#ifdef WIN32
+typedef SOCKET ares_socket_t;
+#define ARES_SOCKET_BAD INVALID_SOCKET
+#else
+typedef int ares_socket_t;
+#define ARES_SOCKET_BAD -1
+#endif
+#define ares_socket_typedef
+#endif /* ares_socket_typedef */
+
#ifdef WIN32
typedef void (*ares_sock_state_cb)(void *data,
SOCKET socket,
@@ -200,6 +216,8 @@ int ares_getsock(ares_channel channel, int *socks, int numsocks);
struct timeval *ares_timeout(ares_channel channel, struct timeval *maxtv,
struct timeval *tv);
void ares_process(ares_channel channel, fd_set *read_fds, fd_set *write_fds);
+void ares_process_fd(ares_channel channel, ares_socket_t read_fd,
+ ares_socket_t write_fd);
int ares_mkquery(const char *name, int dnsclass, int type, unsigned short id,
int rd, unsigned char **buf, int *buflen);