+static adns_status addr_submit(adns_query parent, adns_query *query_r,
+ vbuf *qumsg_vb, int id, unsigned want,
+ adns_queryflags flags, struct timeval now,
+ qcontext *ctx) {
+ /* This is effectively a substitute for adns__internal_submit, intended for
+ * the case where the caller (possibly) only wants a subset of the
+ * available record types. The memory management and callback rules are
+ * the same as for adns__internal_submit.
+ *
+ * Some differences: the query is linked onto the parent's children list
+ * before exit (though the parent's state is not changed, and it is not
+ * linked into the childw list queue); and we fiddle with the `tinfo'
+ * portion of the context structure (yes, modifying *ctx), since this is,
+ * in fact, the main purpose of this function.
+ */
+
+ adns_state ads= parent->ads;
+ adns_query qu;
+ adns_status err;
+ adns_rrtype type= ((adns_r_addr & adns_rrt_reprmask) |
+ (parent->answer->type & ~adns_rrt_reprmask));
+
+ ctx->tinfo.addr.want= want;
+ ctx->tinfo.addr.have= 0;
+ err= adns__internal_submit(ads, &qu, adns__findtype(adns_r_addr),
+ type, qumsg_vb, id, flags, now, ctx);
+ if (err) return err;
+
+ qu->parent= parent;
+ LIST_LINK_TAIL_PART(parent->children, qu, siblings.);
+ *query_r= qu;
+ return adns_s_ok;
+}
+