lwres_getrrsetbyname.html revision 83217b5fdc70ea66fedf2ab3e9b9169c2b8a200a
<!--
- Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC")
- Copyright (C) 2000, 2001 Internet Software Consortium
-
- Permission to use, copy, modify, and distribute this software for any
- purpose with or without fee is hereby granted, provided that the above
- copyright notice and this permission notice appear in all copies.
-
- THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- PERFORMANCE OF THIS SOFTWARE.
-->
<!-- $Id: lwres_getrrsetbyname.html,v 1.13 2005/05/12 23:54:37 sra Exp $ -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>lwres_getrrsetbyname</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.68.1">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en">
<a name="id2456694"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2>Name</h2>
<p>lwres_getrrsetbyname, lwres_freerrset &#8212; retrieve DNS records</p>
</div>
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
<div class="funcsynopsis">
<pre class="funcsynopsisinfo">#include &lt;lwres/netdb.h&gt;</pre>
<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em">
<tr>
<td><code class="funcdef">
int
<b class="fsfunc">lwres_getrrsetbyname</b>(</code></td>
<td>const char *�</td>
<td>
<var class="pdparam">hostname</var>, </td>
</tr>
<tr>
<td>�</td>
<td>unsigned int �</td>
<td>
<var class="pdparam">rdclass</var>, </td>
</tr>
<tr>
<td>�</td>
<td>unsigned int �</td>
<td>
<var class="pdparam">rdtype</var>, </td>
</tr>
<tr>
<td>�</td>
<td>unsigned int �</td>
<td>
<var class="pdparam">flags</var>, </td>
</tr>
<tr>
<td>�</td>
<td>struct rrsetinfo **�</td>
<td>
<var class="pdparam">res</var><code>)</code>;</td>
</tr>
</table>
<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"><tr>
<td><code class="funcdef">
void
<b class="fsfunc">lwres_freerrset</b>(</code></td>
<td>struct rrsetinfo *�</td>
<td>
<var class="pdparam">rrset</var><code>)</code>;</td>
</tr></table>
</div>
<p>
The following structures are used:
</p>
<pre class="programlisting">
struct rdatainfo {
unsigned int rdi_length; /* length of data */
unsigned char *rdi_data; /* record data */
};
</pre>
<p>
</p>
<pre class="programlisting">
struct rrsetinfo {
unsigned int rri_flags; /* RRSET_VALIDATED... */
unsigned int rri_rdclass; /* class number */
unsigned int rri_rdtype; /* RR type number */
unsigned int rri_ttl; /* time to live */
unsigned int rri_nrdatas; /* size of rdatas array */
unsigned int rri_nsigs; /* size of sigs array */
char *rri_name; /* canonical name */
struct rdatainfo *rri_rdatas; /* individual records */
struct rdatainfo *rri_sigs; /* individual signatures */
};
</pre>
<p>
</p>
</div>
<div class="refsect1" lang="en">
<a name="id2514102"></a><h2>DESCRIPTION</h2>
<p><code class="function">lwres_getrrsetbyname()</code>
gets a set of resource records associated with a
<em class="parameter"><code>hostname</code></em>, <em class="parameter"><code>class</code></em>,
and <em class="parameter"><code>type</code></em>.
<em class="parameter"><code>hostname</code></em> is a pointer a to
null-terminated string. The <em class="parameter"><code>flags</code></em> field
is currently unused and must be zero.
</p>
<p>
After a successful call to
<code class="function">lwres_getrrsetbyname()</code>,
<em class="parameter"><code>*res</code></em> is a pointer to an
<span class="type">rrsetinfo</span> structure, containing a list of one or
more <span class="type">rdatainfo</span> structures containing resource
records and potentially another list of <span class="type">rdatainfo</span>
structures containing SIG resource records associated with those
records. The members <code class="constant">rri_rdclass</code> and
<code class="constant">rri_rdtype</code> are copied from the parameters.
<code class="constant">rri_ttl</code> and <code class="constant">rri_name</code>
are properties of the obtained rrset. The resource records
contained in <code class="constant">rri_rdatas</code> and
<code class="constant">rri_sigs</code> are in uncompressed DNS wire
format. Properties of the rdataset are represented in the
<code class="constant">rri_flags</code> bitfield. If the RRSET_VALIDATED
bit is set, the data has been DNSSEC validated and the
signatures verified.
</p>
<p>
All of the information returned by
<code class="function">lwres_getrrsetbyname()</code> is dynamically
allocated: the <code class="constant">rrsetinfo</code> and
<code class="constant">rdatainfo</code> structures, and the canonical
host name strings pointed to by the
<code class="constant">rrsetinfo</code>structure.
Memory allocated for the dynamically allocated structures
created by a successful call to
<code class="function">lwres_getrrsetbyname()</code> is released by
<code class="function">lwres_freerrset()</code>.
<em class="parameter"><code>rrset</code></em> is a pointer to a <span class="type">struct
rrset</span> created by a call to
<code class="function">lwres_getrrsetbyname()</code>.
</p>
<p></p>
</div>
<div class="refsect1" lang="en">
<a name="id2514350"></a><h2>RETURN VALUES</h2>
<p><code class="function">lwres_getrrsetbyname()</code>
returns zero on success, and one of the following error codes if
an error occurred:
</p>
<div class="variablelist"><dl>
<dt><span class="term"><code class="constant">ERRSET_NONAME</code></span></dt>
<dd><p>
the name does not exist
</p></dd>
<dt><span class="term"><code class="constant">ERRSET_NODATA</code></span></dt>
<dd><p>
the name exists, but does not have data of the desired type
</p></dd>
<dt><span class="term"><code class="constant">ERRSET_NOMEMORY</code></span></dt>
<dd><p>
memory could not be allocated
</p></dd>
<dt><span class="term"><code class="constant">ERRSET_INVAL</code></span></dt>
<dd><p>
a parameter is invalid
</p></dd>
<dt><span class="term"><code class="constant">ERRSET_FAIL</code></span></dt>
<dd><p>
other failure
</p></dd>
<dt><span class="term"><code class="constant"></code></span></dt>
<dd><p></p></dd>
</dl></div>
<p>
</p>
</div>
<div class="refsect1" lang="en">
<a name="id2514451"></a><h2>SEE ALSO</h2>
<p><span class="citerefentry"><span class="refentrytitle">lwres</span>(3)</span>.
</p>
</div>
</div></body>
</html>