+/* From addrfam.c: */
+
+extern int adns__addrs_equal_raw(const struct sockaddr *a,
+ int bf, const void *b);
+/* Returns nonzero a's family is bf and a's protocol address field
+ * refers to the same protocol address as that stored at ba.
+ */
+
+extern int adns__addrs_equal(const adns_sockaddr *a,
+ const adns_sockaddr *b);
+/* Returns nonzero if the two refer to the same protocol address
+ * (disregarding port, IPv6 scope, etc).
+ */
+
+extern int adns__sockaddrs_equal(const struct sockaddr *sa,
+ const struct sockaddr *sb);
+/* Return nonzero if the two socket addresses are equal (in all significant
+ * respects).
+ */
+
+extern int adns__addr_width(int af);
+/* Return the width of addresses of family af, in bits. */
+
+extern void adns__prefix_mask(adns_sockaddr *sa, int len);
+/* Stores in sa's protocol address field an address mask for address
+ * family af, whose first len bits are set and the remainder are
+ * clear. On entry, sa's af field must be set. This is what you want
+ * for converting a prefix length into a netmask.
+ */
+
+extern int adns__guess_prefix_length(const adns_sockaddr *addr);
+/* Given a network base address, guess the appropriate prefix length based on
+ * the appropriate rules for the address family (e.g., for IPv4, this uses
+ * the old address classes).
+ */
+
+extern int adns__addr_matches(int af, const void *addr,
+ const adns_sockaddr *base,
+ const adns_sockaddr *mask);
+/* Return nonzero if the protocol address specified by af and addr
+ * lies within the network specified by base and mask.
+ */
+
+extern void adns__addr_inject(const void *a, adns_sockaddr *sa);
+/* Injects the protocol address *a into the socket adress sa. Assumes
+ * that sa->sa_family is already set correctly.
+ */
+
+extern const void *adns__sockaddr_addr(const struct sockaddr *sa);
+/* Returns the address of the protocol address field in sa.
+ */
+
+char *adns__sockaddr_ntoa(const struct sockaddr *sa, char *buf);
+/* Converts sa to a string, and writes it to buf, which must be at
+ * least ADNS_ADDR2TEXT_BUFLEN bytes long (unchecked). Returns buf;
+ * can't fail.
+ */
+
+extern int adns__make_reverse_domain(const struct sockaddr *sa,
+ const char *zone,
+ char **buf_io, size_t bufsz,
+ char **buf_free_r);
+/* Construct a reverse domain string, given a socket address and a parent
+ * zone. If zone is null, then use the standard reverse-lookup zone for the
+ * address family. If the length of the resulting string is no larger than
+ * bufsz, then the result is stored starting at *buf_io; otherwise a new
+ * buffer is allocated is used, and a pointer to it is stored in both *buf_io
+ * and *buf_free_r (the latter of which should be null on entry). If
+ * something goes wrong, then an errno value is returned: ENOSYS if the
+ * address family of sa isn't recognized, or ENOMEM if the attempt to
+ * allocate an output buffer failed.
+ */
+
+extern bool adns__revparse_label(struct revparse_state *rps, int labnum,
+ const char *dgram,
+ int labstart, int lablen);
+/* Parse a label in a reverse-domain name, given its index labnum (starting
+ * from zero), a pointer to its contents (which need not be null-terminated),
+ * and its length. The state in *rps is initialized implicitly when labnum
+ * is zero.
+ *
+ * Returns 1 if the parse is proceeding successfully, 0 if the domain
+ * name is definitely invalid and the parse must be abandoned.
+ */
+
+extern bool adns__revparse_done(struct revparse_state *rps,
+ const char *dgram, int nlabels,
+ adns_rrtype *rrtype_r, adns_sockaddr *addr_r);
+/* Finishes parsing a reverse-domain name, given the total number of
+ * labels in the name. On success, fills in the af and protocol
+ * address in *addr_r, and the forward query type in *rrtype_r
+ * (because that turns out to be useful). Returns 1 if the parse
+ * was successful.
+ */
+