lwres_gnba.html revision 010a51c427bfb6ab658fc0056955a1a5b69810be
5ae0e2c8b72fa44237edeb37d1945b1c3535ca39Automatic Updater - Copyright (C) 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC")
5ae0e2c8b72fa44237edeb37d1945b1c3535ca39Automatic Updater - Copyright (C) 2000, 2001 Internet Software Consortium.
59dd3b3cd954239d98ef52cd26328856cb6f2975Automatic Updater - Permission to use, copy, modify, and/or distribute this software for any
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater - purpose with or without fee is hereby granted, provided that the above
59dd3b3cd954239d98ef52cd26328856cb6f2975Automatic Updater - copyright notice and this permission notice appear in all copies.
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater - THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
ac4e70ff8955669341f435bc0a734a17c01af124Mark Andrews - AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
5c0fc20d6e59216d9a142409e5fdb498153aeaa5Automatic Updater - PERFORMANCE OF THIS SOFTWARE.
4b2cb1422c7c600fbc13b1cb06a8b4693bc11af8Mark Andrews<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
4b2cb1422c7c600fbc13b1cb06a8b4693bc11af8Mark Andrews<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" title="lwres_gnba">
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews<a name="idp60835536"></a><div class="titlepage"></div>
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews lwres_gnbarequest_render,
fc3576328379e813ccf6b3a6e66d9bb701a79c83Automatic Updater lwres_gnbaresponse_render,
4b2cb1422c7c600fbc13b1cb06a8b4693bc11af8Mark Andrews lwres_gnbarequest_parse,
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews lwres_gnbaresponse_parse,
bbb069be941f649228760edcc241122933c066d2Automatic Updater lwres_gnbaresponse_free,
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews lwres_gnbarequest_free
3098364bcdd7a719fbafa5fc8d2cc9e90e5a5989Automatic Updater — lightweight resolver getnamebyaddress message handling
efb0e886f18894a1d2489f1ad74ad14b579e11c7Mark Andrews<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table">
aa1d397c4736cd86540555193d71e55fa3b37b2aMark Andrewslwres_result_t
aa1d397c4736cd86540555193d71e55fa3b37b2aMark Andrews<td>lwres_context_t *<var class="pdparam">ctx</var>, </td>
2a31bd531072824ef252c18303859d6af7451b00Francis Dupont<td>lwres_gnbarequest_t *<var class="pdparam">req</var>, </td>
6f046a065e5543f8cd7e2f24991c65d2372f4c8dMark Andrews<td>lwres_lwpacket_t *<var class="pdparam">pkt</var>, </td>
a8644ebab678a1de66cbfaabb513651a739958afAutomatic Updater<td>lwres_buffer_t *<var class="pdparam">b</var><code>)</code>;</td>
efb0e886f18894a1d2489f1ad74ad14b579e11c7Mark Andrews<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table">
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafsson<td>lwres_context_t *<var class="pdparam">ctx</var>, </td>
96ea71632887c58a9d00f47eb318bf76b35903c3Mark Andrews<td>lwres_gnbaresponse_t *<var class="pdparam">req</var>, </td>
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater<td>lwres_lwpacket_t *<var class="pdparam">pkt</var>, </td>
19b3dc94bce93fa76bd7e066f9298630dbc9dcb4Automatic Updater<td>lwres_buffer_t *<var class="pdparam">b</var><code>)</code>;</td>
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table">
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater<b class="fsfunc">lwres_gnbarequest_parse</b>(</code></td>
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater<td>lwres_context_t *<var class="pdparam">ctx</var>, </td>
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater<td>lwres_buffer_t *<var class="pdparam">b</var>, </td>
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater<td>lwres_lwpacket_t *<var class="pdparam">pkt</var>, </td>
19b3dc94bce93fa76bd7e066f9298630dbc9dcb4Automatic Updater<td>lwres_gnbarequest_t **<var class="pdparam">structp</var><code>)</code>;</td>
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table">
ea935c46e8261ea10621e5b038426539fe8a7cc5Mark Andrewslwres_result_t
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater<b class="fsfunc">lwres_gnbaresponse_parse</b>(</code></td>
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater<td>lwres_context_t *<var class="pdparam">ctx</var>, </td>
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater<td>lwres_buffer_t *<var class="pdparam">b</var>, </td>
4cda4fd158d6ded5586bacea8c388445d99611eaAutomatic Updater<td>lwres_lwpacket_t *<var class="pdparam">pkt</var>, </td>
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews<td>lwres_gnbaresponse_t **<var class="pdparam">structp</var><code>)</code>;</td>
5ae0e2c8b72fa44237edeb37d1945b1c3535ca39Automatic Updater<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table">
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater<b class="fsfunc">lwres_gnbaresponse_free</b>
5c0fc20d6e59216d9a142409e5fdb498153aeaa5Automatic Updater<td>lwres_context_t *<var class="pdparam">ctx</var>, </td>
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater<td>lwres_gnbaresponse_t **<var class="pdparam">structp</var><code>)</code>;</td>
5c0fc20d6e59216d9a142409e5fdb498153aeaa5Automatic Updater<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table">
00be0f9f61d4c6bf197d000bfa1a6b7e70ea0866Automatic Updater<b class="fsfunc">lwres_gnbarequest_free</b>(</code></td>
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafsson<td>lwres_context_t *<var class="pdparam">ctx</var>, </td>
04eba969cb9a54bbda2896db2067c07b2ac5ba16Automatic Updater<td>lwres_gnbarequest_t **<var class="pdparam">structp</var><code>)</code>;</td>
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafsson<a name="idp60909008"></a><h2>DESCRIPTION</h2>
8ae412a86ed138263796195eed82a4716e7effcbMark Andrews These are low-level routines for creating and parsing
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater lightweight resolver address-to-name lookup request and
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews response messages.
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews There are four main functions for the getnamebyaddr opcode.
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews One render function converts a getnamebyaddr request structure —
56874aef380a64a2c183b7c282c3e7a361d67fa1Automatic Updater <span class="type">lwres_gnbarequest_t</span> —
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater to the lightweight resolver's canonical format.
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews It is complemented by a parse function that converts a packet in this
4b2cb1422c7c600fbc13b1cb06a8b4693bc11af8Mark Andrews canonical format to a getnamebyaddr request structure.
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews Another render function converts the getnamebyaddr response structure
e076d0c88be69de7c190ab924d095e69d2e11f7aAndreas Gustafsson to the canonical format.
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater This is complemented by a parse function which converts a packet in
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater canonical format to a getnamebyaddr response structure.
aa1d397c4736cd86540555193d71e55fa3b37b2aMark Andrews These structures are defined in
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafsson <code class="filename">lwres/lwres.h</code>.
aa1d397c4736cd86540555193d71e55fa3b37b2aMark Andrews They are shown below.
91216cff91b34c9ff6e846dc23f248219cafe660Andreas Gustafsson#define LWRES_OPCODE_GETNAMEBYADDR 0x00010002U
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellingtontypedef struct {
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington lwres_uint32_t flags;
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater lwres_addr_t addr;
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater} lwres_gnbarequest_t;
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updatertypedef struct {
bc0a4c01beede169df81a3ee5b614ed9e82339dbAutomatic Updater lwres_uint32_t flags;
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington lwres_uint16_t naliases;
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater char *realname;
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington char **aliases;
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington lwres_uint16_t realnamelen;
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington lwres_uint16_t *aliaslen;
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington size_t baselen;
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington} lwres_gnbaresponse_t;
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington <p><code class="function">lwres_gnbarequest_render()</code>
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington uses resolver context <code class="varname">ctx</code> to convert
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington getnamebyaddr request structure <code class="varname">req</code> to
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington canonical format. The packet header structure
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington <code class="varname">pkt</code> is initialised and transferred to buffer
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington <code class="varname">b</code>. The contents of <code class="varname">*req</code>
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington are then appended to the buffer in canonical format.
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington <code class="function">lwres_gnbaresponse_render()</code> performs the
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington same task, except it converts a getnamebyaddr response structure
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington <span class="type">lwres_gnbaresponse_t</span> to the lightweight resolver's
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington canonical format.
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington <p><code class="function">lwres_gnbarequest_parse()</code>
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington uses context <code class="varname">ctx</code> to convert the contents of
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington packet <code class="varname">pkt</code> to a
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington <span class="type">lwres_gnbarequest_t</span> structure. Buffer
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington <code class="varname">b</code> provides space to be used for storing this
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington structure. When the function succeeds, the resulting
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington <span class="type">lwres_gnbarequest_t</span> is made available through
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington <code class="function">lwres_gnbaresponse_parse()</code> offers the same
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington semantics as <code class="function">lwres_gnbarequest_parse()</code>
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington except it yields a <span class="type">lwres_gnbaresponse_t</span> structure.
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington <p><code class="function">lwres_gnbaresponse_free()</code>
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington and <code class="function">lwres_gnbarequest_free()</code> release the
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington memory in resolver context <code class="varname">ctx</code> that was
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington allocated to the <span class="type">lwres_gnbaresponse_t</span> or
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington <span class="type">lwres_gnbarequest_t</span> structures referenced via
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington <code class="varname">structp</code>. Any memory associated with
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington ancillary buffers and strings for those structures is also
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington <div class="refsection" title="RETURN VALUES">
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington<a name="idp60928720"></a><h2>RETURN VALUES</h2>
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater The getnamebyaddr opcode functions
0d3490f93bb980fde704055e74c1b508987a5fe4Mark Andrews <code class="function">lwres_gnbarequest_render()</code>,
d4ef65050feac78554addf6e16a06c6e2e0bd331Brian Wellington <code class="function">lwres_gnbaresponse_render()</code>
d4ef65050feac78554addf6e16a06c6e2e0bd331Brian Wellington <code class="function">lwres_gnbarequest_parse()</code>
d4ef65050feac78554addf6e16a06c6e2e0bd331Brian Wellington <code class="function">lwres_gnbaresponse_parse()</code>
d4ef65050feac78554addf6e16a06c6e2e0bd331Brian Wellington <span class="errorcode">LWRES_R_NOMEMORY</span>
aa1d397c4736cd86540555193d71e55fa3b37b2aMark Andrews if memory allocation fails.
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater <span class="errorcode">LWRES_R_UNEXPECTEDEND</span>
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington is returned if the available space in the buffer
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater is too small to accommodate the packet header or the
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington <span class="type">lwres_gnbarequest_t</span>
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington <span class="type">lwres_gnbaresponse_t</span>
81c3cb9b921cda22a5a35fa32ca1bf35797b9a36Automatic Updater <code class="function">lwres_gnbarequest_parse()</code>
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater <code class="function">lwres_gnbaresponse_parse()</code>
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater <span class="errorcode">LWRES_R_UNEXPECTEDEND</span>
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater if the buffer is not empty after decoding the received packet.
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater These functions will return
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater <span class="errorcode">LWRES_R_FAILURE</span>
2d4f33db52cdd5c8bb7cd86b4c5f74205d686646Automatic Updater in the packet header structure
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater <span class="type">lwres_lwpacket_t</span>
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater indicate that the packet is not a response to an earlier query.
ce9cad6bb04869c5e94d9dc721032b25117f9210Automatic Updater<a name="idp60936400"></a><h2>SEE ALSO</h2>
9e3a7b0faf417a10f5f689edf288807b2d5eedc5Brian Wellington <span class="refentrytitle">lwres_packet</span>(3)