-static char *inet6_rev_mkname(const struct sockaddr *sa, char *buf)
-{
- const unsigned char *a = CSIN6(sa)->sin6_addr.s6_addr + 16;
- unsigned c, y;
- int i, j;
+static const struct revparse_domain {
+ int af; /* address family */
+ int nrevlab; /* n of reverse-address labels */
+ adns_rrtype rrtype; /* forward-lookup type */
+
+ int (*rev_parsecomp)(const char *p, size_t n);
+ /* parse a single component from a label; return the integer value, or -1
+ * if it was unintelligible.
+ */
+
+ void (*rev_mkaddr)(union gen_addr *addr, const byte *ipv);
+ /* write out the parsed address from a vector of parsed components */
+
+ const char *const tail[3]; /* tail label names */
+} revparse_domains[NREVDOMAINS] = {
+ { AF_INET, 4, adns_r_a, inet_rev_parsecomp, inet_rev_mkaddr,
+ { DNS_INADDR_ARPA, 0 } },
+ { AF_INET6, 32, adns_r_aaaa, inet6_rev_parsecomp, inet6_rev_mkaddr,
+ { DNS_IP6_ARPA, 0 } },
+};