diff options
author | Daniel Stenberg <daniel@haxx.se> | 2006-05-03 06:11:44 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2006-05-03 06:11:44 +0000 |
commit | 22e34b53e493e7f94036182ad2c6764bdc3ac5fb (patch) | |
tree | 3ae220ae061f6814386fd2650007147c9c485d9c /ares_private.h | |
parent | 772811b915392014886d2361bcfe58e9655edf7f (diff) | |
download | c-ares-22e34b53e493e7f94036182ad2c6764bdc3ac5fb.tar.gz c-ares-22e34b53e493e7f94036182ad2c6764bdc3ac5fb.tar.bz2 c-ares-22e34b53e493e7f94036182ad2c6764bdc3ac5fb.zip |
Nick Mathewson added the ARES_OPT_SOCK_STATE_CB option that when set makes
c-ares call a callback on socket state changes. A better way than the
ares_getsock() to get full control over the socket state.
Diffstat (limited to 'ares_private.h')
-rw-r--r-- | ares_private.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/ares_private.h b/ares_private.h index df51266..8d5af08 100644 --- a/ares_private.h +++ b/ares_private.h @@ -176,13 +176,22 @@ struct ares_channeldata { /* Active queries */ struct query *queries; + + ares_sock_state_cb sock_state_cb; + void *sock_state_cb_data; }; void ares__send_query(ares_channel channel, struct query *query, time_t now); -void ares__close_sockets(struct server_state *server); +void ares__close_sockets(ares_channel channel, struct server_state *server); int ares__get_hostent(FILE *fp, int family, struct hostent **host); int ares__read_line(FILE *fp, char **buf, int *bufsize); +#define SOCK_STATE_CALLBACK(c, s, r, w) \ + do { \ + if ((c)->sock_state_cb) \ + (c)->sock_state_cb((c)->sock_state_cb_data, (s), (r), (w)); \ + } while (0) + #ifdef CURLDEBUG /* This is low-level hard-hacking memory leak tracking and similar. Using the libcurl lowlevel code from within library is ugly and only works when |