dns.c

A recursive, reentrant DNS Resolver
Download

dns.c Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Freeware
  • Price:
  • FREE
  • Publisher Name:
  • William Ahern
  • Publisher web site:
  • http://25thandclement.com/~william/projects/zoned.html

dns.c Tags


dns.c Description

A recursive, reentrant DNS Resolver dns.c is a reentrant, recursive and non-blocking DNS resolver library that resides in a sincle .c file. Also works great as a stub resolver.Core API built around actual DNS packet; as generic as DNS itself. This makes querying and manipulating records other than A, AAAA, and PTR much easier.Restartable record iterators with user-specified sorting. Iterating over MX or SRV records in semantic order (i.e. preference and priority) is as simple as:dns_rr_foreach(&rr, packet, .type = DNS_T_SRV, .sort = &dns_rr_i_order) { ...}Or in a restartable manner:switch (my->state) {case 0: dns_rr_i_init(&my->rr_i); my->rr_i.type = DNS_T_SRV; my->rr_i.sort = &dns_rr_i_order; my->state++;case 1: while (dns_rr_grep(&rr, 1, &my->rr_i, my->packet, &error)) { ... /* return into event loop */ }}Supports "smart" queries. When enabled in the core resolver, queries for NS, MX, and SRV records will always attempt to resolve the RDATA canonical host name into an A record. Hosts which are not in-bailiwick and/or for which the authoritative server does not provide glue are automagically resolved and returned in the answer packet. Supported for both stub and recursive resolver instantiations. "Smart" resolution is also built into the address info (i.e. getaddrinfo()) API.Randomized source ports and QIDs.Non-blocking, re-entrant, iterator-based getaddrinfo() interface: dns_ai_open(), dns_ai_nextent(), dns_ai_close(). Semantically just like getaddrinfo(), but also takes a record type. Iterate over (struct addrinfo) objects even when querying an MX, NS, SRV (et al) host. There is less latency doing "smart" queries this way, since any necessary recursion can be postponed (and in all likelihood won't be necessary, since the first host is likely sufficient). What's New in This Release: · Fix bug where we didn't fallback from "bind" method to "file" method if the recurse flag was disabled. · Search generator may have changed the qname. So, in dns_ai_nextent() canonicalize the qname from the answer, not the qname originally submitted to the resolver.


dns.c Related Software