lwres_gnba.html revision ea94d370123a5892f6c47a97f21d1b28d44bb168
6fe48fb46e53ffc37542853a1edb74cb481b7d94Automatic Updater - Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC")
229ea4644b3a7d9c7fdaa43888e7f55ba01e2ee3Automatic Updater - Copyright (C) 2000, 2001 Internet Software Consortium.
1167fc7904c5f0a472f8df207ac46dd52c7f1ec8Automatic Updater - Permission to use, copy, modify, and/or distribute this software for any
0c39b3ed9409ecb277d5e32fa763a4e4d6598df8Automatic Updater - purpose with or without fee is hereby granted, provided that the above
46da3117812814a29432a8d9a9ccf8acdbfdadceAutomatic Updater - copyright notice and this permission notice appear in all copies.
0519188c8e1ae76978fc4e0f799620cd36eba07aAutomatic Updater - THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
79b273c187a4aa1016a62181983dfdd0521681aeMark Andrews - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
90ff38a0d8deaf5f9c2aa5916d99b2e572d28738Automatic Updater - AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
ac4e70ff8955669341f435bc0a734a17c01af124Mark Andrews - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
6c6a121295b30772cbf3dd75a51fb9d883051a0eAutomatic Updater - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington - PERFORMANCE OF THIS SOFTWARE.
e130ab53e992670e2a2ecf043976ac09f21358d1Automatic Updater<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews<meta name="generator" content="DocBook XSL Stylesheets V1.71.1">
e171a4137c6ba348957e61b7c4c3541493c0da02Automatic Updater<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en">
831f79c4310a7d38fc3475ccfff531b2b2535641Automatic Updater<a name="id2476274"></a><div class="titlepage"></div>
efb0e886f18894a1d2489f1ad74ad14b579e11c7Mark Andrews<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>
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em">
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington<var class="pdparam">b</var><code>)</code>;</td>
6fe48fb46e53ffc37542853a1edb74cb481b7d94Automatic Updater<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em">
78f3ed4bc2fcd3d270bfd599804f3b27a1db4d91Mark Andrews<var class="pdparam">b</var><code>)</code>;</td>
78f3ed4bc2fcd3d270bfd599804f3b27a1db4d91Mark Andrews<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em">
2a31bd531072824ef252c18303859d6af7451b00Francis Dupont<b class="fsfunc">lwres_gnbarequest_parse</b>(</code></td>
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater<var class="pdparam">structp</var><code>)</code>;</td>
f2770f6b39a9b2a98afb7a11ed105f73f1570c1eAutomatic Updater<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em">
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafsson<b class="fsfunc">lwres_gnbaresponse_parse</b>(</code></td>
8ccd7da886e93cd490fcb6f4c4e98a6514f35820Automatic Updater<var class="pdparam">structp</var><code>)</code>;</td>
d145b64cacc8d9cda51f9924ec70cd4661c3e2cfAutomatic Updater<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em">
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater<b class="fsfunc">lwres_gnbaresponse_free</b>
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater<var class="pdparam">structp</var><code>)</code>;</td>
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0">
19b3dc94bce93fa76bd7e066f9298630dbc9dcb4Automatic Updater<b class="fsfunc">lwres_gnbarequest_free</b>(</code></td>
71bd43eebd9d6e42dbcae62b730f5b6508d5acd8Automatic Updater<var class="pdparam">structp</var><code>)</code>;</td>
bbb069be941f649228760edcc241122933c066d2Automatic Updater<a name="id2543527"></a><h2>DESCRIPTION</h2>
4cda4fd158d6ded5586bacea8c388445d99611eaAutomatic Updater These are low-level routines for creating and parsing
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews lightweight resolver address-to-name lookup request and
9cd5eb6fe0f26d65724b99216cb31dcdd12e4afdAutomatic Updater response messages.
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater There are four main functions for the getnamebyaddr opcode.
8711e5c73ca872d59810760af0332194cbdd619bAutomatic Updater One render function converts a getnamebyaddr request structure —
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews <span class="type">lwres_gnbarequest_t</span> —
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews to the lightweight resolver's canonical format.
765c97d56ccddc9d7904c7d9ff2e2d825d9687e4Automatic Updater It is complemented by a parse function that converts a packet in this
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews canonical format to a getnamebyaddr request structure.
cafd3a2b9974fe0a4ab95e0289746062bd958d68Automatic Updater Another render function converts the getnamebyaddr response structure
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater <span class="type">lwres_gnbaresponse_t</span>
3f616e6f846be57b1717c6beaba0f74de9d5a7c6Automatic Updater to the canonical format.
229ea4644b3a7d9c7fdaa43888e7f55ba01e2ee3Automatic Updater This is complemented by a parse function which converts a packet in
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater canonical format to a getnamebyaddr response structure.
3e5340279d8875d136a4dd815cccad0044aa2644Automatic Updater These structures are defined in
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington <code class="filename">lwres/lwres.h</code>.
8711e5c73ca872d59810760af0332194cbdd619bAutomatic Updater They are shown below.
930f6069e5aa157cf6987cdafd412f5757a5a558Automatic Updater#define LWRES_OPCODE_GETNAMEBYADDR 0x00010002U
c3fd32ed29e9e419bb56583f4272a506773b1ea0Automatic Updatertypedef struct {
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafsson lwres_uint32_t flags;
c3fd32ed29e9e419bb56583f4272a506773b1ea0Automatic Updater lwres_addr_t addr;
c3fd32ed29e9e419bb56583f4272a506773b1ea0Automatic Updater} lwres_gnbarequest_t;
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updatertypedef struct {
3857cb6fcabeb79d85de4b3e3e4ab99912b701f8Mark Andrews lwres_uint32_t flags;
572cb2c1c931f6bc6a4a019c103ae88239b0eb96Automatic Updater lwres_uint16_t naliases;
7858b0168b866c0c2878fc4ea31fb5e581c1a6a9Automatic Updater char *realname;
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews char **aliases;
9174e44c14b1cb91a651fa1dc29470438c246ab9Automatic Updater lwres_uint16_t realnamelen;
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafsson lwres_uint16_t *aliaslen;
56e7dc0c24b04210dcbffb180a9e35644fb820daAutomatic Updater size_t baselen;
7d12a6b412fe47e6d6582923fd6954ab8cd0baebAutomatic Updater} lwres_gnbaresponse_t;
0b57424d28c9a67018107133f9fbc0a7dcf057e2Mark Andrews<p><code class="function">lwres_gnbarequest_render()</code>
ca35524ce2b57e6f1b261d23565d1288a355d12fAutomatic Updater uses resolver context <code class="varname">ctx</code> to convert
78f3ed4bc2fcd3d270bfd599804f3b27a1db4d91Mark Andrews getnamebyaddr request structure <code class="varname">req</code> to
b109432c3a939bff66a463be86c371bd88efe3aaAutomatic Updater canonical format. The packet header structure
7d12a6b412fe47e6d6582923fd6954ab8cd0baebAutomatic Updater <code class="varname">pkt</code> is initialised and transferred to buffer
78f3ed4bc2fcd3d270bfd599804f3b27a1db4d91Mark Andrews <code class="varname">b</code>. The contents of <code class="varname">*req</code>
78f3ed4bc2fcd3d270bfd599804f3b27a1db4d91Mark Andrews are then appended to the buffer in canonical format.
3351ccbd5c1961404044f8273d54dad405f53960Mark Andrews <code class="function">lwres_gnbaresponse_render()</code> performs the
7d12a6b412fe47e6d6582923fd6954ab8cd0baebAutomatic Updater same task, except it converts a getnamebyaddr response structure
78f3ed4bc2fcd3d270bfd599804f3b27a1db4d91Mark Andrews <span class="type">lwres_gnbaresponse_t</span> to the lightweight resolver's
78f3ed4bc2fcd3d270bfd599804f3b27a1db4d91Mark Andrews canonical format.
7d12a6b412fe47e6d6582923fd6954ab8cd0baebAutomatic Updater<p><code class="function">lwres_gnbarequest_parse()</code>
78f3ed4bc2fcd3d270bfd599804f3b27a1db4d91Mark Andrews uses context <code class="varname">ctx</code> to convert the contents of
7d12a6b412fe47e6d6582923fd6954ab8cd0baebAutomatic Updater <span class="type">lwres_gnbarequest_t</span> structure. Buffer
0b57424d28c9a67018107133f9fbc0a7dcf057e2Mark Andrews <code class="varname">b</code> provides space to be used for storing this
e8fc8c884b44371784805e1e0d3100da403dd3f1Automatic Updater structure. When the function succeeds, the resulting
e8fc8c884b44371784805e1e0d3100da403dd3f1Automatic Updater <span class="type">lwres_gnbarequest_t</span> is made available through
e8fc8c884b44371784805e1e0d3100da403dd3f1Automatic Updater <code class="function">lwres_gnbaresponse_parse()</code> offers the same
e8fc8c884b44371784805e1e0d3100da403dd3f1Automatic Updater semantics as <code class="function">lwres_gnbarequest_parse()</code>
e8fc8c884b44371784805e1e0d3100da403dd3f1Automatic Updater except it yields a <span class="type">lwres_gnbaresponse_t</span> structure.
e8fc8c884b44371784805e1e0d3100da403dd3f1Automatic Updater<p><code class="function">lwres_gnbaresponse_free()</code>
e8fc8c884b44371784805e1e0d3100da403dd3f1Automatic Updater and <code class="function">lwres_gnbarequest_free()</code> release the
7d12a6b412fe47e6d6582923fd6954ab8cd0baebAutomatic Updater memory in resolver context <code class="varname">ctx</code> that was
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington allocated to the <span class="type">lwres_gnbaresponse_t</span> or
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater <span class="type">lwres_gnbarequest_t</span> structures referenced via
59528addd704f8d5757b54e540520f74e588a7c7Automatic Updater <code class="varname">structp</code>. Any memory associated with
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews ancillary buffers and strings for those structures is also
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews The getnamebyaddr opcode functions
06f5acb11f1c32228d93eefd1eb841dbfb1c7f4dAutomatic Updater <code class="function">lwres_gnbarequest_render()</code>,
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater <code class="function">lwres_gnbaresponse_render()</code>
7f79131f9a8e804b93c57f3c679065cce878b726Automatic Updater <code class="function">lwres_gnbarequest_parse()</code>
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafsson <code class="function">lwres_gnbaresponse_parse()</code>
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington <span class="errorcode">LWRES_R_NOMEMORY</span>
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington if memory allocation fails.
b13d89bd89878137c81b36a36596cca3920f27a4Automatic Updater <span class="errorcode">LWRES_R_UNEXPECTEDEND</span>
5ecad47f69b3fd945472ab2900a9ff826a7ce2f6Automatic Updater is returned if the available space in the buffer
b13d89bd89878137c81b36a36596cca3920f27a4Automatic Updater is too small to accommodate the packet header or the
b13d89bd89878137c81b36a36596cca3920f27a4Automatic Updater <span class="type">lwres_gnbarequest_t</span>
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater <span class="type">lwres_gnbaresponse_t</span>
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater <code class="function">lwres_gnbarequest_parse()</code>
d6317350b1180aa4517f2e8a92fa8fbcbf904ad8Automatic Updater <code class="function">lwres_gnbaresponse_parse()</code>
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington <span class="errorcode">LWRES_R_UNEXPECTEDEND</span>
665ba746c0585088d0c314dcfc4671aa2c7b2dc1Automatic Updater if the buffer is not empty after decoding the received packet.
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington These functions will return
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington <span class="errorcode">LWRES_R_FAILURE</span>
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington <em class="structfield"><code>pktflags</code></em>
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington in the packet header structure
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington indicate that the packet is not a response to an earlier query.
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington<p><span class="citerefentry"><span class="refentrytitle">lwres_packet</span>(3)</span>.