<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>ldns documentation</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> <link href="tabs.css" rel="stylesheet" type="text/css"> </head><body> <div class="logo"> <img src="LogoInGradientBar2-y100.png"/> </div> <!-- Generated by Doxygen 1.7.4 --> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main Page</span></a></li> <li class="current"><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="annotated.html"><span>Data Structures</span></a></li> <li><a href="files.html"><span>Files</span></a></li> <li><a href="dirs.html"><span>Directories</span></a></li> </ul> </div> </div> <div class="header"> <div class="headertitle"> <div class="title">Design </div> </div> </div> <div class="contents"> <div class="textblock"><p>The following image shows the various modules of libdns and their functionality.</p> <div class="image"> <img src="libdnsoverview.png" alt="libdnsoverview.png"/> </div> <h2><a class="anchor" id="central_structures"></a> Central structures</h2> <ul> <li><a class="el" href="packet_8h.html#a6b137fb9a86468d16cf66130db3b9da2">ldns_pkt</a> A DNS Packet, which can contain a query, answers, and additional information.</li> <li><a class="el" href="rr_8h.html#a34d846d44506c86bc94f244445605e98">ldns_rr</a> A Resource Record, which holds a bit of information about a specific domain name.</li> <li><a class="el" href="rdata_8h.html#adb9c97875196c13e6d1996ae0fd17f86">ldns_rdf</a> An RDATA field, every Resource Record contains one or more RDATA fields, depending on the type of RR. These are the 'basic types' of DNS data.</li> <li><a class="el" href="rr_8h.html#a99b7150f3167c5df552095a8f7144f33">ldns_rr_list</a> A list of resource records</li> <li><a class="el" href="zone_8h.html#af8077ee2090d473d6c598fa95c2826b3">ldns_zone</a> A representation of a DNS Zone.</li> </ul> <p>The actual structure definitions are named <code>ldns_struct_<name></code> which are all typedeffed to <code>ldns_<name></code> </p> <p>A DNS Resource record looks like this:</p> <pre> 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] </pre><p>Owner: The owner name is put in an <code>ldns_rdf</code> structure, which is a normal rdata field but always has the type LDNS_RDF_TYPE_DNAME.</p> <p>An <a class="el" href="rdata_8h.html#adb9c97875196c13e6d1996ae0fd17f86">ldns_rdf</a> structure has 3 members; the size, the type of rdata and a void * pointer to the data. The data is always in uncompressed wireformat.</p> <p>The RSH (rdata) is put in an array of rdf's (in this case 2).</p> <p>The entire resource record is put in a RR structure, which has the fields described above (under the RR):</p> <ul> <li>owner (nlnetlabs.nl.)</li> <li>ttl (600)</li> <li>class (LDNS_RR_CLASS_IN: 'IN')</li> <li>type (LDNS_RR_TYPE_MX: 'MX')</li> <li>rd_count (2)</li> <li>rdata_fields[rd_count]<ul> <li>rdf[0] (10)</li> <li>rdf[1] (open.nlnetlabs.nl.)</li> </ul> </li> </ul> <p>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.</p> <p>RRset structure: An RRset structure is an RR list structure, but its accessor function checks if the <code>ldns_rr</code> structures in there are:</p> <ul> <li>from the same type</li> <li>have the same TTL</li> <li>have the same ownername</li> </ul> <p>This is the RFC definition of an RRset.</p> <p>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.</p> <p>All four sections have the type RRlist that simply hold a list of RR's</p> <h2><a class="anchor" id="wire_module"></a> Wire module and central structures Interface</h2> <p>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.</p> <h2><a class="anchor" id="resolver_module"></a> Resolver module and central structures Interface</h2> <p>The resolver module always returns a pkt structure. Either with the answer or a SERVFAIL pkt.</p> <p>The exact function-call parameters have not yet been decided on.</p> <p>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).</p> <h2><a class="anchor" id="str_module"></a> str module and central structures Interface</h2> <p>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.</p> <h2><a class="anchor" id="net_module"></a> Net module and resolver module interface</h2> <p>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).</p> <h2><a class="anchor" id="Net"></a> module and OS/libc interface</h2> <p>OS/network calls will be used here. The Net module is the only part of the library where the underlying OS matters.</p> <h2><a class="anchor" id="Client"></a> program ldns interface</h2> <p>Any client program will have access to</p> <ul> <li>Wire module</li> <li>Central structures</li> <li>Resolver module</li> <li>str module (arrow not drawn in the above figure)</li> </ul> <h2><a class="anchor" id="dnssec_module"></a> DNSSEC module</h2> <p>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. </p> </div></div> <hr class="footer"/><address class="footer"><small>Generated on Wed Jan 11 2012 for ldns by  <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address> </body> </html>