chiark / gitweb /
src/query.c: Export adns__cancel_children.
[adns.git] / src / internal.h
index baf2a295a76643277d0a0bf04808f77166c2e4c1..552db151b7ff495da637c416324c743fd7dd2c21 100644 (file)
@@ -229,6 +229,7 @@ adns_status adns__ckl_hostname(adns_state ads, adns_queryflags flags,
 
 typedef struct allocnode {
   struct allocnode *next, *back;
+  size_t sz;
 } allocnode;
 
 union maxalign {
@@ -350,6 +351,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 +360,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 +573,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<nudp.
+ */
+
 void adns__query_send(adns_query qu, struct timeval now);
 /* Query must be in state tosend/NONE; it will be moved to a new state,
  * and no further processing can be done on it for now.
@@ -644,8 +658,7 @@ void *adns__alloc_preserved(adns_query qu, size_t sz);
  *  answer->cname and answer->owner are _preserved.
  */
 
-void adns__transfer_interim(adns_query from, adns_query to,
-                           void *block, size_t sz);
+void adns__transfer_interim(adns_query from, adns_query to, void *block);
 /* Transfers an interim allocation from one query to another, so that
  * the `to' query will have room for the data when we get to makefinal
  * and so that the free will happen when the `to' query is freed
@@ -659,6 +672,10 @@ void adns__transfer_interim(adns_query from, adns_query to,
  * TTLs get inherited by their parents.
  */
 
+void adns__free_interim(adns_query qu, void *p);
+/* Forget about a block allocated by adns__alloc_interim.
+ */
+
 void *adns__alloc_mine(adns_query qu, size_t sz);
 /* Like _interim, but does not record the length for later
  * copying into the answer.  This just ensures that the memory
@@ -682,6 +699,7 @@ void adns__reset_preserved(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);
 
 /* From reply.c: */