X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/adns/blobdiff_plain/6239fc5b39f0055dbc53ccbfc80148824a811beb..ff225555f031392f24b2f88a496ee4ddd6d5a12f:/src/internal.h diff --git a/src/internal.h b/src/internal.h index baf2a29..f25fe9c 100644 --- a/src/internal.h +++ b/src/internal.h @@ -350,6 +350,8 @@ struct adns__query { struct query_queue { adns_query head, tail; }; +#define MAXUDP 2 + struct adns__state { adns_initflags iflags; adns_logcallbackfn *logfn; @@ -357,7 +359,9 @@ struct adns__state { int configerrno; struct query_queue udpw, tcpw, childw, output; adns_query forallnext; - int nextid, udpsocket, tcpsocket; + int nextid, tcpsocket; + struct udpsocket { int af; int fd; } udpsocket[MAXUDP]; + int nudp; vbuf tcpsend, tcprecv; int nservers, nsortlist, nsearchlist, searchndots, tcpserver, tcprecv_skip; enum adns__tcpstate { @@ -568,6 +572,15 @@ void adns__querysend_tcp(adns_query qu, struct timeval now); * might be broken, but no reconnect will be attempted. */ +struct udpsocket *adns__udpsocket_by_af(adns_state ads, int af); +/* Find the UDP socket structure in ads which has the given address family. + * Return null if there isn't one. + * + * This is used during initialization, so ads is only partially filled in. + * The requirements are that nudp is set, and that udpsocket[i].af are + * defined for 0<=i