-static adns_query allocquery(adns_state ads, const char *owner, int ol,
- int qml, int id, adns_rrtype type,
- adns_queryflags flags, void *context) {
+#include <sys/time.h>
+
+#include "internal.h"
+
+int adns__internal_submit(adns_state ads, adns_query *query_r,
+ adns_rrtype type, char *query_dgram, int query_len,
+ adns_queryflags flags, struct timeval now,
+ adns_status failstat, const qcontext *ctx) {
+ /* Submits a query (for internal use, called during external submits).
+ *
+ * The new query is returned in *query_r, or we return adns_s_nomemory.
+ *
+ * The query datagram should already have been assembled; memory for it
+ * is taken over by this routine whether it succeeds or fails.
+ *
+ * If failstat is nonzero then if we are successful in creating the query
+ * it is immediately failed with code failstat (but _submit still succeds).
+ *
+ * ctx is copied byte-for-byte into the query.
+ */