Subject: ares_getsocks() ?

ares_getsocks() ?

From: Daniel Stenberg <daniel_at_haxx.se>
Date: 2005-12-20

Hi

For my 'hiper' work with libcurl, I've been forced to add a new function to
c-ares that extracts the sockets and for what action we should wait for, a
little like ares_fds() but more generic.

Currently it works like described below, but I'm all ears for feedback:

#define ARES_GETSOCK_MAXNUM 16 /* ares_getsock() can return info about this
                                   many sockets */
#define ARES_GETSOCK_READABLE(bits,num) (bits & (1<< (num)))
#define ARES_GETSOCK_WRITABLE(bits,num) (bits & (1 << ((num) + \
                                          ARES_GETSOCK_MAXNUM)))

int ares_getsock(ares_channel channel, int *socks, int numsocks);

The function returns a bitmask for what action to wait for on what sockets,
and it fills in the socket array passed to it in the 'socks' pointer (that
holds numsocks socket entries).

This allows the function to return action for up to 16 sockets.

-- 
   c-ares -- my preferred DNS asynch resolver library
Received on Tue Dec 20 10:16:55 2005