o Dynamic update function
-3. CENTRAL structures
+3. Central structures
-nlnetlabs.nl. 600 IN MX 10 open.nlnetlabs.nl.
- \ \ \ \ \_ _/
- _owner _ttl _klass _type \_ rdf[] _/
+nlnetlabs.nl. 600 IN MX 10 open.nlnetlabs.nl.
+ \ \ \ \ \_ _/
+ _owner _ttl _klass _type \_ rdf[] _/
(rdf) (uint16_t) (rr_class) (rr_type)
- 10 := rdf[0]
- open.nlnetlabs.nl. := rdf[1]
+ 10 := rdf[0]
+ open.nlnetlabs.nl. := rdf[1]
* rdf structure:
The LHS is put in a rdf structure, which is a normal rdf but always has the
\section central_structures Central structures
- - \ref ldns_pkt A DNS Packet, that can contain a qeury, answers, and additional information.
+ - \ref ldns_pkt A DNS Packet, which can contain a qeury, answers, and additional information.
- \ref ldns_rr A Resource Record, which holds a bit of information about a specific domain name.
- \ref ldns_rdf 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.
- \ref ldns_rr_list A list of resource records
A DNS Resource record looks like this:
<pre>
-nlnetlabs.nl. 600 IN MX 10 open.nlnetlabs.nl.
- \ \ \ \ \ /
- owner ttl class type \ rdf[] /
+nlnetlabs.nl. 600 IN MX 10 open.nlnetlabs.nl.
+ \ \ \ \ \ /
+ owner ttl class type \ rdf[] /
(rdf) (uint16_t) (rr_class) (rr_type)
- 10 := rdf[0]
- open.nlnetlabs.nl. := rdf[1]
+ 10 := rdf[0]
+ open.nlnetlabs.nl. := rdf[1]
</pre>
* Owner:
The owner name is put in an \c ldns_rdf structure, which is a normal rdata field but always
has the type LDNS_RDF_TYPE_DNAME.
-An \ref ldns_rdf structure has 3 members; the size, the type is carrying and a void *
+An \ref 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).
- rdf[1] (open.nlnetlabs.nl.)
* RR list structure:
-An RR list structure is simply structure with a counter
+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.
-* RR set structure
-An RR set structure is an RR list structure, but its accessor
+* RRset structure
+An RRset structure is an RR list structure, but its accessor
function checks if the \c ldns_rr structures in there are:
- from the same type
- have the same TTL
- The \c ldns_resolver structure keeps a list of nameservers, and can perform queries for us
- An \c ldns_rdf is a basic data type of dns, the RDATA. See \ref overview for a description about the building blocks of DNS.
- \c domain will contain the name the user specifies when calling the program
+ In this case, \c domain will be used to store the name the user specifies when calling the program
- An \c ldns_pkt is a DNS packet, for instance a complete query, or an answer
- The \c ldns_rr_list structure contains a list of DNS Resource Records (RRs). In this case, we will store the MX records we find in the list.
- \c ldns_status is the basic type for status messages in ldns. Most functions will return a value of this type.
\skipline ldns_resolver_query
\until )
+ The last argument contains flags to influence the type of query the
+ resolver structure sends. In this case, we want the nameserver to use
+ recursion, so that we'll get the final answer. Therefore, we specify the
+ \ref LDNS_RD (Recursion Desired) flag.
+
This should return a packet if everything goes well.
We get all RRs of type MX from the answer packet and store them in our list: