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