The following image shows the various modules of libdns and their functionality.
The actual structure definitions are named ldns_struct_<name>
which are all typedeffed to ldns_<name>
A DNS Resource record looks like this:
nlnetlabs.nl. 600 IN MX 10 open.nlnetlabs.nl. \ \ \ \ \ / owner ttl class type \ rdf[] / (rdf) (uint32_t) (rr_class) (rr_type) 10 := rdf[0] open.nlnetlabs.nl. := rdf[1]
Owner: The owner name is put in an ldns_rdf
structure, which is a normal rdata field but always has the type LDNS_RDF_TYPE_DNAME.
An ldns_rdf structure has 3 members; the size, the type of rdata and a void * pointer to the data. The data is always in uncompressed wireformat.
The RSH (rdata) is put in an array of rdf's (in this case 2).
The entire resource record is put in a RR structure, which has the fields described above (under the RR):
RR list structure: An RR list structure is simply a structure with a counter and an array of RR structures. Different kinds of RR's can be grouped together this way.
RRset structure: An RRset structure is an RR list structure, but its accessor function checks if the ldns_rr
structures in there are:
This is the RFC definition of an RRset.
pkt structure: A pkt structure consists out of a header structure where packet specific flags are kept, TC, RD, IP from the server which sent the packet, etc. Further more it is divided in 4 sections: question, authority, answer and additional.
All four sections have the type RRlist that simply hold a list of RR's
As the WIRE module takes care of the compression/decompression it needs a buffer which holds all the binary DNS data. All functions will operate on such a buffer to extract specific information which is then stored in RR structures.
The resolver module always returns a pkt structure. Either with the answer or a SERVFAIL pkt.
The exact function-call parameters have not yet been decided on.
Also the resolver module will need to access some of the to_wire and from_wire function to creates ldn_pkt's from the data it receives (arrow not drawn).
Convert to and from strings. This module could be used to read in a zone file (list of RRs) and convert the text strings to the format used by ldns. Or the other way around.
The resolver module will get a packet and will mold it so that it can be sent off to a nameserver. It might need to interface with the wire module (arrow not drawn).
OS/network calls will be used here. The Net module is the only part of the library where the underlying OS matters.
Any client program will have access to
The DNSSEC types are handled in the RR module, but the crypto routines are contained in this module. This module will depend on OpenSSL for the crypto routines.