lwres_getrrsetbyname.html revision d6fa26d0adaec6c910115be34fe7a5a5f402c14f
b886b04d8d2b085cbf3e1bf4442dee87f43ba5e4Tinderbox User<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
7a2a1b8b14fc804ac80612d7b98064095e445be5Automatic Updater - Copyright (C) 2000, 2001, 2004, 2005, 2007, 2014-2016 Internet Systems Consortium, Inc. ("ISC")
1167fc7904c5f0a472f8df207ac46dd52c7f1ec8Automatic Updater - This Source Code Form is subject to the terms of the Mozilla Public
0c39b3ed9409ecb277d5e32fa763a4e4d6598df8Automatic Updater - License, v. 2.0. If a copy of the MPL was not distributed with this
46da3117812814a29432a8d9a9ccf8acdbfdadceAutomatic Updater - file, You can obtain one at http://mozilla.org/MPL/2.0/.
3349f0044fda807e1fd6681c833d3593a22dad86Tinderbox User<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
b253dcf9668f95e141bce9556dc88e30d3305a1dTinderbox User<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
710bce1a85c96e85ca1a90471382055acd29d51fTinderbox User<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry">
1ac49378a458420bc685293d12e567d7222d17b6Tinderbox User<a name="id-1"></a><div class="titlepage"></div>
e130ab53e992670e2a2ecf043976ac09f21358d1Automatic Updater<p>lwres_getrrsetbyname, lwres_freerrset — retrieve DNS records</p>
89623368b8f662d458d9964b923050f33c5f75b0Tinderbox User<pre class="funcsynopsisinfo">#include <lwres/netdb.h></pre>
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;">
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafsson<b class="fsfunc">lwres_getrrsetbyname</b>(</code></td>
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater<td>const char *<var class="pdparam">hostname</var>, </td>
b886b04d8d2b085cbf3e1bf4442dee87f43ba5e4Tinderbox User<td>unsigned int <var class="pdparam">rdclass</var>, </td>
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater<td>unsigned int <var class="pdparam">rdtype</var>, </td>
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater<td>unsigned int <var class="pdparam">flags</var>, </td>
aa9c561961e9d877946ebaa8795fa2be054ab7bfEvan Hunt<td>struct rrsetinfo **<var class="pdparam">res</var><code>)</code>;</td>
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr>
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater<b class="fsfunc">lwres_freerrset</b>(</code></td>
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater<td>struct rrsetinfo *<var class="pdparam">rrset</var><code>)</code>;</td>
eabc9c3c07cd956d3c436bd7614cb162dabdda76Mark Andrews The following structures are used:
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrewsstruct rdatainfo {
6fe48fb46e53ffc37542853a1edb74cb481b7d94Automatic Updater unsigned int rdi_length; /* length of data */
8e9f3b69914ee02a80b87c97b1f8093edb3e9ae0Automatic Updater unsigned char *rdi_data; /* record data */
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrewsstruct rrsetinfo {
ec7751119a08c6a7250f3187beed69a8b836d349Tinderbox User unsigned int rri_flags; /* RRSET_VALIDATED... */
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews unsigned int rri_rdclass; /* class number */
114f7780384371121918624ae2c80ecfce545683Tinderbox User unsigned int rri_rdtype; /* RR type number */
693c4232dfdffaff672197d4b9fea944c64cf80aAutomatic Updater unsigned int rri_ttl; /* time to live */
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews unsigned int rri_nrdatas; /* size of rdatas array */
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater unsigned int rri_nsigs; /* size of sigs array */
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafsson char *rri_name; /* canonical name */
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater struct rdatainfo *rri_rdatas; /* individual records */
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater struct rdatainfo *rri_sigs; /* individual signatures */
b886b04d8d2b085cbf3e1bf4442dee87f43ba5e4Tinderbox User<p><code class="function">lwres_getrrsetbyname()</code>
b871c7156eb037d41f53828c6fcb9cc876128962Mark Andrews gets a set of resource records associated with a
78f3ed4bc2fcd3d270bfd599804f3b27a1db4d91Mark Andrews <em class="parameter"><code>hostname</code></em>, <em class="parameter"><code>class</code></em>,
3349f0044fda807e1fd6681c833d3593a22dad86Tinderbox User and <em class="parameter"><code>type</code></em>.
3349f0044fda807e1fd6681c833d3593a22dad86Tinderbox User <em class="parameter"><code>hostname</code></em> is a pointer a to
78f3ed4bc2fcd3d270bfd599804f3b27a1db4d91Mark Andrews null-terminated string. The <em class="parameter"><code>flags</code></em> field
2a31bd531072824ef252c18303859d6af7451b00Francis Dupont is currently unused and must be zero.
2a31bd531072824ef252c18303859d6af7451b00Francis Dupont After a successful call to
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews <code class="function">lwres_getrrsetbyname()</code>,
3349f0044fda807e1fd6681c833d3593a22dad86Tinderbox User <em class="parameter"><code>*res</code></em> is a pointer to an
3349f0044fda807e1fd6681c833d3593a22dad86Tinderbox User <span class="type">rrsetinfo</span> structure, containing a list of one or
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews more <span class="type">rdatainfo</span> structures containing resource
78f3ed4bc2fcd3d270bfd599804f3b27a1db4d91Mark Andrews records and potentially another list of <span class="type">rdatainfo</span>
24bf1e02f03577db0feb50b80238c4150c96d05dAutomatic Updater structures containing SIG resource records associated with those
24bf1e02f03577db0feb50b80238c4150c96d05dAutomatic Updater records. The members <code class="constant">rri_rdclass</code> and
78f3ed4bc2fcd3d270bfd599804f3b27a1db4d91Mark Andrews <code class="constant">rri_rdtype</code> are copied from the parameters.
78f3ed4bc2fcd3d270bfd599804f3b27a1db4d91Mark Andrews <code class="constant">rri_ttl</code> and <code class="constant">rri_name</code>
7500521cecdff3c00e594ec41d3a17292332ffbcTinderbox User are properties of the obtained rrset. The resource records
a308b69ac66fadf66863484f301314d6e6a3f1d2Automatic Updater contained in <code class="constant">rri_rdatas</code> and
78f3ed4bc2fcd3d270bfd599804f3b27a1db4d91Mark Andrews <code class="constant">rri_sigs</code> are in uncompressed DNS wire
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews format. Properties of the rdataset are represented in the
a01aa536188bb3535dfc1107a623e6355a8e6b7cMark Andrews <code class="constant">rri_flags</code> bitfield. If the RRSET_VALIDATED
89623368b8f662d458d9964b923050f33c5f75b0Tinderbox User bit is set, the data has been DNSSEC validated and the
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews signatures verified.
b871c7156eb037d41f53828c6fcb9cc876128962Mark Andrews All of the information returned by
01a5c5503482fb3ba52088bf0178a7213273bf96Mark Andrews <code class="function">lwres_getrrsetbyname()</code> is dynamically
b871c7156eb037d41f53828c6fcb9cc876128962Mark Andrews allocated: the <code class="constant">rrsetinfo</code> and
b871c7156eb037d41f53828c6fcb9cc876128962Mark Andrews <code class="constant">rdatainfo</code> structures, and the canonical
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater host name strings pointed to by the
cdfc81e048bd34c1d628380247bda6b80a89e20eAutomatic Updater <code class="constant">rrsetinfo</code>structure.
fe80a4909bf62b602feaf246866e9d29f7654194Automatic Updater Memory allocated for the dynamically allocated structures
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater created by a successful call to
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater <code class="function">lwres_getrrsetbyname()</code> is released by
fe80a4909bf62b602feaf246866e9d29f7654194Automatic Updater <code class="function">lwres_freerrset()</code>.
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater <em class="parameter"><code>rrset</code></em> is a pointer to a <span class="type">struct
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafsson rrset</span> created by a call to
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater <code class="function">lwres_getrrsetbyname()</code>.
dd65eb1efb40b1c47d57963192bfc54873b219beAutomatic Updater<a name="id-1.8"></a><h2>RETURN VALUES</h2>
133e6d43fa82e80d3798be4de00f4540f485ec6cAutomatic Updater<p><code class="function">lwres_getrrsetbyname()</code>
133e6d43fa82e80d3798be4de00f4540f485ec6cAutomatic Updater returns zero on success, and one of the following error codes if
133e6d43fa82e80d3798be4de00f4540f485ec6cAutomatic Updater an error occurred:
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafsson<div class="variablelist"><dl class="variablelist">
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater<dt><span class="term"><code class="constant">ERRSET_NONAME</code></span></dt>
710bce1a85c96e85ca1a90471382055acd29d51fTinderbox User the name does not exist
1368e4b34cef64604c874fcc40201c78e548714cTinderbox User<dt><span class="term"><code class="constant">ERRSET_NODATA</code></span></dt>
710bce1a85c96e85ca1a90471382055acd29d51fTinderbox User the name exists, but does not have data of the desired type
8f2c45a35dd8c40bcc9caba8f7d40ce64fc27bcdAutomatic Updater<dt><span class="term"><code class="constant">ERRSET_NOMEMORY</code></span></dt>
8f2c45a35dd8c40bcc9caba8f7d40ce64fc27bcdAutomatic Updater memory could not be allocated
710bce1a85c96e85ca1a90471382055acd29d51fTinderbox User<dt><span class="term"><code class="constant">ERRSET_INVAL</code></span></dt>
8711e5c73ca872d59810760af0332194cbdd619bAutomatic Updater a parameter is invalid
8f2c45a35dd8c40bcc9caba8f7d40ce64fc27bcdAutomatic Updater<dt><span class="term"><code class="constant">ERRSET_FAIL</code></span></dt>
e85565067cf73f8cc21ee29b11761659f1d47ee9Automatic Updater<dt><span class="term"><code class="constant"></code></span></dt>
59528addd704f8d5757b54e540520f74e588a7c7Automatic Updater<p><span class="citerefentry"><span class="refentrytitle">lwres</span>(3)</span>.