Hi,
I'd like to add support for userspace TCP/IP stacks to c-ares.
To do this, I'd like to make the following changes:
1. make ares_socket_t a struct wrapping either an int or a WIN32 SOCKET
type; any operations on ares_socket_t (close, sendmsg, etc.) will be
forwarded to helper functions that extract the fd and call the library
function; for example
int ares_socket_close(ares_socket_t s)
{
return sclose(s.fd);
}
the purpose of this step is to make sure any access to socket is handled
by a ship layer.
2. add a way to configure function pointers for all the ares_socket_*()
functions, with defaults calling to the existing code, and change the
ares_socket_*() functions to call these function pointers.
Ordinary users would see no change. Userspace TCP/IP stacks would
configure the function pointers to point to their own thunks, typically
looking up the fd in a map, extracting their own socket object from it,
and applying the relevant operation.
Would such a change be acceptable to c-ares?
Avi