2 - Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC")
3 - Copyright (C) 2000, 2001 Internet Software Consortium.
5 - Permission to use, copy, modify, and distribute this software for any
6 - purpose with or without fee is hereby granted, provided that the above
7 - copyright notice and this permission notice appear in all copies.
9 - THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10 - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11 - AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12 - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13 - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14 - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15 - PERFORMANCE OF THIS SOFTWARE.
17 <!-- $Id: lwres_gnba.html,v 1.6.2.1.4.11 2006/06/29 13:02:31 marka Exp $ -->
20 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
21 <title>lwres_gnba</title>
22 <meta name="generator" content="DocBook XSL Stylesheets V1.70.1">
24 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en">
25 <a name="id2482688"></a><div class="titlepage"></div>
26 <div class="refnamediv">
28 <p>lwres_gnbarequest_render, lwres_gnbaresponse_render, lwres_gnbarequest_parse, lwres_gnbaresponse_parse, lwres_gnbaresponse_free, lwres_gnbarequest_free — lightweight resolver getnamebyaddress message handling</p>
30 <div class="refsynopsisdiv">
32 <div class="funcsynopsis">
33 <pre class="funcsynopsisinfo">
34 #include <lwres/lwres.h>
36 <table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em">
38 <td><code class="funcdef">
40 <b class="fsfunc">lwres_gnbarequest_render</b>
44 <var class="pdparam">ctx</var>, </td>
50 <var class="pdparam">ctx</var>, </td>
56 <var class="pdparam">req</var>, </td>
62 <var class="pdparam">pkt</var>, </td>
68 <var class="pdparam">b</var><code>)</code>;</td>
71 <table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em">
73 <td><code class="funcdef">
75 <b class="fsfunc">lwres_gnbaresponse_render</b>
102 <table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em">
104 <td><code class="funcdef">
106 <b class="fsfunc">lwres_gnbarequest_parse</b>(</code></td>
132 <table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em">
134 <td><code class="funcdef">
136 <b class="fsfunc">lwres_gnbaresponse_parse</b>(</code></td>
162 <table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em">
164 <td><code class="funcdef">
166 <b class="fsfunc">lwres_gnbaresponse_free</b>
183 <table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0">
185 <td><code class="funcdef">
187 <b class="fsfunc">lwres_gnbarequest_free</b>(</code></td>
205 <div class="refsect1" lang="en">
206 <a name="id2549540"></a><h2>DESCRIPTION</h2>
208 These are low-level routines for creating and parsing
209 lightweight resolver address-to-name lookup request and
213 There are four main functions for the getnamebyaddr opcode.
214 One render function converts a getnamebyaddr request structure —
215 <span class="type">lwres_gnbarequest_t</span> —
216 to the lightweight resolver's canonical format.
217 It is complemented by a parse function that converts a packet in this
218 canonical format to a getnamebyaddr request structure.
219 Another render function converts the getnamebyaddr response structure —
220 <span class="type">lwres_gnbaresponse_t</span>
221 to the canonical format.
222 This is complemented by a parse function which converts a packet in
223 canonical format to a getnamebyaddr response structure.
226 These structures are defined in
227 <code class="filename">lwres/lwres.h</code>.
228 They are shown below.
230 <pre class="programlisting">
231 #define LWRES_OPCODE_GETNAMEBYADDR 0x00010002U
234 lwres_uint32_t flags;
236 } lwres_gnbarequest_t;
239 lwres_uint32_t flags;
240 lwres_uint16_t naliases;
243 lwres_uint16_t realnamelen;
244 lwres_uint16_t *aliaslen;
247 } lwres_gnbaresponse_t;
252 <code class="function">lwres_gnbarequest_render()</code>
253 uses resolver context
254 <code class="varname">ctx</code>
255 to convert getnamebyaddr request structure
256 <code class="varname">req</code>
258 The packet header structure
259 <code class="varname">pkt</code>
260 is initialised and transferred to
262 <code class="varname">b</code>.
264 <code class="varname">*req</code>
265 are then appended to the buffer in canonical format.
266 <code class="function">lwres_gnbaresponse_render()</code>
267 performs the same task, except it converts a getnamebyaddr response structure
268 <span class="type">lwres_gnbaresponse_t</span>
269 to the lightweight resolver's canonical format.
272 <code class="function">lwres_gnbarequest_parse()</code>
274 <code class="varname">ctx</code>
275 to convert the contents of packet
276 <code class="varname">pkt</code>
278 <span class="type">lwres_gnbarequest_t</span>
281 <code class="varname">b</code>
282 provides space to be used for storing this structure.
283 When the function succeeds, the resulting
284 <span class="type">lwres_gnbarequest_t</span>
285 is made available through
286 <code class="varname">*structp</code>.
287 <code class="function">lwres_gnbaresponse_parse()</code>
288 offers the same semantics as
289 <code class="function">lwres_gnbarequest_parse()</code>
291 <span class="type">lwres_gnbaresponse_t</span>
295 <code class="function">lwres_gnbaresponse_free()</code>
297 <code class="function">lwres_gnbarequest_free()</code>
298 release the memory in resolver context
299 <code class="varname">ctx</code>
300 that was allocated to the
301 <span class="type">lwres_gnbaresponse_t</span>
303 <span class="type">lwres_gnbarequest_t</span>
304 structures referenced via
305 <code class="varname">structp</code>.
306 Any memory associated with ancillary buffers and strings for those
307 structures is also discarded.
310 <div class="refsect1" lang="en">
311 <a name="id2549733"></a><h2>RETURN VALUES</h2>
313 The getnamebyaddr opcode functions
314 <code class="function">lwres_gnbarequest_render()</code>,
315 <code class="function">lwres_gnbaresponse_render()</code>
316 <code class="function">lwres_gnbarequest_parse()</code>
318 <code class="function">lwres_gnbaresponse_parse()</code>
320 <span class="errorcode">LWRES_R_SUCCESS</span>
323 <span class="errorcode">LWRES_R_NOMEMORY</span>
324 if memory allocation fails.
325 <span class="errorcode">LWRES_R_UNEXPECTEDEND</span>
326 is returned if the available space in the buffer
327 <code class="varname">b</code>
328 is too small to accommodate the packet header or the
329 <span class="type">lwres_gnbarequest_t</span>
331 <span class="type">lwres_gnbaresponse_t</span>
333 <code class="function">lwres_gnbarequest_parse()</code>
335 <code class="function">lwres_gnbaresponse_parse()</code>
337 <span class="errorcode">LWRES_R_UNEXPECTEDEND</span>
338 if the buffer is not empty after decoding the received packet.
339 These functions will return
340 <span class="errorcode">LWRES_R_FAILURE</span>
342 <em class="structfield"><code>pktflags</code></em>
343 in the packet header structure
344 <span class="type">lwres_lwpacket_t</span>
345 indicate that the packet is not a response to an earlier query.
348 <div class="refsect1" lang="en">
349 <a name="id2549866"></a><h2>SEE ALSO</h2>
351 <span class="citerefentry"><span class="refentrytitle">lwres_packet</span>(3)</span>.