+/* From setup.c: */
+
+void adns__vdiag(adns_state ads, adns_initflags prevent, const char *pfx,
+ int serv, const char *fmt, va_list al);
+void adns__debug(adns_state ads, int serv, const char *fmt, ...) PRINTFFORMAT(2,3);
+void adns__warn(adns_state ads, int serv, const char *fmt, ...) PRINTFFORMAT(2,3);
+void adns__diag(adns_state ads, int serv, const char *fmt, ...) PRINTFFORMAT(2,3);
+
+/* From submit.c: */
+
+void adns__query_fail(adns_state ads, adns_query qu, adns_status stat);
+
+/* From query.c: */
+
+void adns__quproc_tosend(adns_state ads, adns_query qu, struct timeval now) {
+
+/* Useful static inline functions: */
+
+static inline void timevaladd(struct timeval *tv_io, long ms) {
+ struct timeval tmp;
+ assert(ms>=0);
+ tmp= *tv_io;
+ tmp.tv_usec += (ms%1000)*1000;
+ tmp.tv_sec += ms/1000;
+ if (tmp.tv_usec >= 1000) { tmp.tv_sec++; tmp.tv_usec -= 1000; }
+ *tv_io= tmp;
+}
+
+static inline int ctype_whitespace(int c) { return c==' ' || c=='\n' || c=='\t'; }
+static inline int ctype_digit(int c) { return c>='0' && c<='9'; }
+
+/* Useful macros */
+
+#define LIST_UNLINK_PART(list,node,part) \
+ do { \
+ if ((node)->back) (node)->back->part next= (node)->part next; \
+ else (list).head= (node)->part next; \
+ if ((node)->next) (node)->next->part back= (node)->part back; \
+ else (list).tail= (node)->part back; \
+ } while(0)
+
+#define LIST_LINK_TAIL_PART(list,node,part) \
+ do { \
+ (node)->part back= 0; \
+ (node)->part next= (list).tail; \
+ if ((list).tail) (list).tail->part back= (node); else (list).part head= (node); \
+ (list).tail= (node); \
+ } while(0)
+
+#define LIST_UNLINK(list,node) LIST_UNLINK_PART(list,node,)
+#define LIST_LINK_TAIL_PART(list,node) LIST_LINK_TAIL(list,node,)
+