95ecb688 |
1 | adns |
2 | |
3 | Advanced, easy to use, asynchronous-capable DNS client library. |
4 | |
5 | adns is a resolver library for C (and C++) programs. In contrast with |
6 | the existing interfaces, gethostbyname et al and libresolv, it has the |
7 | following features: |
8 | * It is reasonably easy to use for simple programs which just want |
9 | to translate names to addresses, look up MX records, etc. |
10 | * It can be used in an asynchronous, non-blocking, manner. Many |
11 | queries can be handled simultaneously. |
12 | * Responses are decoded automatically into a natural representation |
13 | for a C program - there is no need to deal with DNS packet |
14 | formats. |
15 | * Sanity checking (eg, name syntax checking, reverse/forward |
16 | correspondence, CNAME pointing to CNAME) is performed |
17 | automatically. |
18 | * Time-to-live, CNAME and other similar information is returned in |
19 | an easy-to-use form, without affecting ease-of-use. |
20 | * There is no global state in the library; resolver state is an |
21 | opaque data structure which the client creates explicitly. A |
22 | program can have several instances of the resolver. |
23 | * Errors are reported to the application in a way that distinguishes |
24 | the various causes of failure properly. |
25 | * Understands conventional resolv.conf, but this can overridden by |
26 | environment variables. |
27 | * Flexibility. For example, the application can tell adns to: ignore |
28 | environment variables (for setuid programs), disable sanity checks |
29 | eg to return arbitrary data, override or ignore resolv.conf in |
30 | favour of supplied configuration, change its caching behaviour, |
31 | use a different flow of control model, etc. |
32 | * Believed to be correct ! For example, will correctly back off to |
33 | TCP in case of long replies or queries, or to other nameservers if |
34 | several are available. It has sensible handling of bad responses |
35 | etc. |
36 | |
37 | Forthcoming: |
38 | |
39 | I hope that future versions may also have the following features: |
40 | * The library can be used by threads in a multithreaded program in a |
41 | natural way. It will multiplex many threads' queries through a |
42 | single query socket. |
43 | * Limited caching behaviour. |
44 | * IPv6 support. |
45 | |
46 | (Technical note: adns requires a real nameserver like BIND running on |
47 | the same system or a nearby one, which must be willing to provide |
48 | `recursive service'. I.e., adns is a `stub resolver'. All properly |
49 | configured UN*X and GNU systems will already have such nameserver(s); |
50 | they are usually listed in /etc/resolv.conf.) |