X-Git-Url: https://git.distorted.org.uk/~mdw/adns/blobdiff_plain/fd5ac923aa5886e4e3fbdddbdcd5b8cb69b06318..42938084fac274dfa1c07ef15ebb4d1028edd2dd:/src/internal.h diff --git a/src/internal.h b/src/internal.h index 13740b2..4144ec1 100644 --- a/src/internal.h +++ b/src/internal.h @@ -42,6 +42,7 @@ typedef unsigned char byte; #include +#define ADNS_FEATURE_MANYAF #include "adns.h" #include "dlist.h" @@ -109,6 +110,11 @@ typedef enum { rcode_refused } dns_rcode; +enum { + adns__qf_addr_answer= 0x01000000,/* addr query received an answer */ + adns__qf_addr_cname = 0x02000000 /* addr subquery performed on cname */ +}; + /* Shared data structures */ typedef struct { @@ -151,6 +157,9 @@ typedef struct { adns_rrtype rev_rrtype; struct af_addr addr; } ptr; + struct { + unsigned want, have; + } addr; } tinfo; /* type-specific state for the query itself: zero-init if you * don't know better. */ @@ -319,6 +328,10 @@ struct adns__query { * Queries in state tcpw/tcpw have been sent (or are in the to-send buffer) * iff the tcp connection is in state server_ok. * + * Internal queries (from adns__submit_internal) end up on intdone + * instead of output, and the callbacks are made on the way out of + * adns, to avoid reentrancy hazards. + * * +------------------------+ * START -----> | tosend/NONE | * +------------------------+ @@ -364,7 +377,7 @@ struct adns__state { adns_logcallbackfn *logfn; void *logfndata; int configerrno; - struct query_queue udpw, tcpw, childw, output; + struct query_queue udpw, tcpw, childw, output, intdone; adns_query forallnext; int nextid, tcpsocket; struct udpsocket { int af; int fd; } udpsocket[MAXUDP]; @@ -704,13 +717,18 @@ void adns__reset_preserved(adns_query qu); * in a datagram and discover that we need to retry the query. */ +void adns__cancel(adns_query qu); void adns__query_done(adns_query qu); void adns__query_fail(adns_query qu, adns_status stat); void adns__cancel_children(adns_query qu); void adns__returning(adns_state ads, adns_query qu); /* Must be called before returning from adns any time that we have - * progressed (including made, finished or destroyed) queries. */ + * progressed (including made, finished or destroyed) queries. + * + * Might reenter adns via internal query callbacks, so + * external-faciing functions which call adns__returning should + * normally be avoided in internal code. */ /* From reply.c: */