d6fa26d0adaec6c910115be34fe7a5a5f402c14fMark Andrews<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
5347c0fcb04eaea19d9f39795646239f487c6207Tinderbox User - Copyright (C) 2000, 2001, 2004, 2005, 2007, 2014-2016 Internet Systems Consortium, Inc. ("ISC")
5347c0fcb04eaea19d9f39795646239f487c6207Tinderbox User - This Source Code Form is subject to the terms of the Mozilla Public
5347c0fcb04eaea19d9f39795646239f487c6207Tinderbox User - License, v. 2.0. If a copy of the MPL was not distributed with this
5347c0fcb04eaea19d9f39795646239f487c6207Tinderbox User - file, You can obtain one at http://mozilla.org/MPL/2.0/.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry">
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User<a name="id-1"></a><div class="titlepage"></div>
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User lwres_getrrsetbyname,
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User lwres_freerrset
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User — retrieve DNS records
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein<pre class="funcsynopsisinfo">#include <lwres/netdb.h></pre>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;">
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein<b class="fsfunc">lwres_getrrsetbyname</b>(</code></td>
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox User<td>const char *<var class="pdparam">hostname</var>, </td>
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox User<td>unsigned int <var class="pdparam">rdclass</var>, </td>
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox User<td>unsigned int <var class="pdparam">rdtype</var>, </td>
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox User<td>unsigned int <var class="pdparam">flags</var>, </td>
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox User<td>struct rrsetinfo **<var class="pdparam">res</var><code>)</code>;</td>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr>
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein<b class="fsfunc">lwres_freerrset</b>(</code></td>
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox User<td>struct rrsetinfo *<var class="pdparam">rrset</var><code>)</code>;</td>
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein The following structures are used:
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinstruct rdatainfo {
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson unsigned int rdi_length; /* length of data */
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson unsigned char *rdi_data; /* record data */
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafssonstruct rrsetinfo {
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson unsigned int rri_flags; /* RRSET_VALIDATED... */
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson unsigned int rri_rdclass; /* class number */
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson unsigned int rri_rdtype; /* RR type number */
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson unsigned int rri_ttl; /* time to live */
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson unsigned int rri_nrdatas; /* size of rdatas array */
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson unsigned int rri_nsigs; /* size of sigs array */
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson char *rri_name; /* canonical name */
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson struct rdatainfo *rri_rdatas; /* individual records */
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson struct rdatainfo *rri_sigs; /* individual signatures */
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User <p><code class="function">lwres_getrrsetbyname()</code>
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein gets a set of resource records associated with a
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein <em class="parameter"><code>hostname</code></em>, <em class="parameter"><code>class</code></em>,
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein and <em class="parameter"><code>type</code></em>.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein <em class="parameter"><code>hostname</code></em> is a pointer a to
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein null-terminated string. The <em class="parameter"><code>flags</code></em> field
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein is currently unused and must be zero.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein After a successful call to
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein <code class="function">lwres_getrrsetbyname()</code>,
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein <em class="parameter"><code>*res</code></em> is a pointer to an
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein <span class="type">rrsetinfo</span> structure, containing a list of one or
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein more <span class="type">rdatainfo</span> structures containing resource
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein records and potentially another list of <span class="type">rdatainfo</span>
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein structures containing SIG resource records associated with those
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein records. The members <code class="constant">rri_rdclass</code> and
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein <code class="constant">rri_rdtype</code> are copied from the parameters.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein <code class="constant">rri_ttl</code> and <code class="constant">rri_name</code>
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein are properties of the obtained rrset. The resource records
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein contained in <code class="constant">rri_rdatas</code> and
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein <code class="constant">rri_sigs</code> are in uncompressed DNS wire
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein format. Properties of the rdataset are represented in the
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein <code class="constant">rri_flags</code> bitfield. If the RRSET_VALIDATED
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein bit is set, the data has been DNSSEC validated and the
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein signatures verified.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein All of the information returned by
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein <code class="function">lwres_getrrsetbyname()</code> is dynamically
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein allocated: the <code class="constant">rrsetinfo</code> and
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein <code class="constant">rdatainfo</code> structures, and the canonical
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein host name strings pointed to by the
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein <code class="constant">rrsetinfo</code>structure.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein Memory allocated for the dynamically allocated structures
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein created by a successful call to
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein <code class="function">lwres_getrrsetbyname()</code> is released by
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein <code class="function">lwres_freerrset()</code>.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein <em class="parameter"><code>rrset</code></em> is a pointer to a <span class="type">struct
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein rrset</span> created by a call to
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein <code class="function">lwres_getrrsetbyname()</code>.
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User <p><code class="function">lwres_getrrsetbyname()</code>
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein returns zero on success, and one of the following error codes if
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein an error occurred:
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User<div class="variablelist"><dl class="variablelist">
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein<dt><span class="term"><code class="constant">ERRSET_NONAME</code></span></dt>
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein the name does not exist
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein<dt><span class="term"><code class="constant">ERRSET_NODATA</code></span></dt>
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein the name exists, but does not have data of the desired type
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein<dt><span class="term"><code class="constant">ERRSET_NOMEMORY</code></span></dt>
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein memory could not be allocated
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein<dt><span class="term"><code class="constant">ERRSET_INVAL</code></span></dt>
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein a parameter is invalid
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein<dt><span class="term"><code class="constant">ERRSET_FAIL</code></span></dt>
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein other failure
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein<dt><span class="term"><code class="constant"></code></span></dt>