lwres_gnba.docbook revision c651f15b30f1dae5cc2f00878fb5da5b3a35a468
f743002678eb67b99bbc29fee116b65d9530fec0wrowe<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN">
a34684a59b60a4173c25035d0c627ef17e6dc215rpluem - Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC")
1337c7673efc1f80f634139fbad7cbb98a0dc657ylavic - Copyright (C) 2000, 2001 Internet Software Consortium.
1337c7673efc1f80f634139fbad7cbb98a0dc657ylavic - Permission to use, copy, modify, and distribute this software for any
1337c7673efc1f80f634139fbad7cbb98a0dc657ylavic - purpose with or without fee is hereby granted, provided that the above
4da61833a1cbbca94094f9653fd970582b97a72etrawick - copyright notice and this permission notice appear in all copies.
4da61833a1cbbca94094f9653fd970582b97a72etrawick - THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
4da61833a1cbbca94094f9653fd970582b97a72etrawick - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
4da61833a1cbbca94094f9653fd970582b97a72etrawick - AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
4789804be088bcd86ae637a29cdb7fda25169521jailletc - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
4789804be088bcd86ae637a29cdb7fda25169521jailletc - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
4789804be088bcd86ae637a29cdb7fda25169521jailletc - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
4789804be088bcd86ae637a29cdb7fda25169521jailletc - PERFORMANCE OF THIS SOFTWARE.
e50c3026198fd496f183cda4c32a202925476778covener<!-- $Id: lwres_gnba.docbook,v 1.6 2005/04/07 03:50:03 marka Exp $ -->
6c3b9cebb551140fbb25d58bae08b539b3802133ylavic<refentryinfo>
4f29b65ab4b547ad5dbe506e2d0ff5d12ead9247ylavic</refentryinfo>
69301145375a889e7e37caf7cc7321ac0f91801erpluem<refnamediv>
d58a848a016d401b965111e50ef829e1641f7834minfrin<refpurpose>lightweight resolver getnamebyaddress message handling</refpurpose>
2e6f4d654c96c98b761fb012fd25c5d5b1558c44sf</refnamediv>
2e6f4d654c96c98b761fb012fd25c5d5b1558c44sf<refsynopsisdiv>
17e6c95f3b22d18acdf8380fb26a8d0e10c80767ylavic<funcsynopsis>
17e6c95f3b22d18acdf8380fb26a8d0e10c80767ylavic<funcsynopsisinfo>
17e6c95f3b22d18acdf8380fb26a8d0e10c80767ylavic</funcsynopsisinfo>
e8bd80a4bb88199d2f9a24a50345688e52d9c116ylavic<funcprototype>
330e16bea8fe9cace4de90c349750c03dfb1fe64ylaviclwres_result_t
330e16bea8fe9cace4de90c349750c03dfb1fe64ylavic<paramdef>lwres_context_t *<parameter>ctx</parameter></paramdef>
330e16bea8fe9cace4de90c349750c03dfb1fe64ylavic<paramdef>lwres_gnbarequest_t *<parameter>req</parameter></paramdef>
330e16bea8fe9cace4de90c349750c03dfb1fe64ylavic<paramdef>lwres_lwpacket_t *<parameter>pkt</parameter></paramdef>
330e16bea8fe9cace4de90c349750c03dfb1fe64ylavic<paramdef>lwres_buffer_t *<parameter>b</parameter></paramdef>
d7205b1a86c51c27b71a2c458dc453fd53a261c1covener</funcprototype>
d7205b1a86c51c27b71a2c458dc453fd53a261c1covener<funcprototype>
d7205b1a86c51c27b71a2c458dc453fd53a261c1covenerlwres_result_t
5d1ba75b8794925e67591c209085a49279791de9covener</funcprototype>
032982212dbcc7c3cce95bf89c503bb56e185ac7kbrand<funcprototype>
032982212dbcc7c3cce95bf89c503bb56e185ac7kbrandlwres_result_t
032982212dbcc7c3cce95bf89c503bb56e185ac7kbrand<function>lwres_gnbarequest_parse</function></funcdef>
45a10d38e6051fd7bdf9d742aaae633d97ff02abjailletc</funcprototype>
f7317ff316c2b141feea31bddb74d5d3fa1584edjorton<funcprototype>
2165214331e4afafca4048f66f303d0253d7b001covenerlwres_result_t
a34684a59b60a4173c25035d0c627ef17e6dc215rpluem<function>lwres_gnbaresponse_parse</function></funcdef>
fa7ed98b9dc94c5845cf845aea0a44ecacd290c9humbedooh</funcprototype>
fa7ed98b9dc94c5845cf845aea0a44ecacd290c9humbedooh<funcprototype>
09c87c777bed1655621bb20e1c46cb6b1a63279dcovener</funcprototype>
6502b7b32f980cc2093bb3ebce37e5e4dc68fba4ylavic<funcprototype>
e6b4bd1113567627ab6bb6c6a7105e1e01a7d889jailletc</funcprototype>
e6b4bd1113567627ab6bb6c6a7105e1e01a7d889jailletc</funcsynopsis>
e466c40e1801982602ee0200c9e8b61cc148742djailletc</refsynopsisdiv>
04983e3bd1754764eec7d6bb772fe3b0bf391771jortonThese are low-level routines for creating and parsing
15890c9306ba98f6fc243e15a3c4778ddc7d773erpluemlightweight resolver address-to-name lookup request and
15660979a30d251681463de2e0584853890082accovenerresponse messages.
49dacedb6c387b786b7911082ff35121a45f414bcovenerThere are four main functions for the getnamebyaddr opcode.
cfd9415521847b2f9394fad04fb701cfb955f503rjungOne render function converts a getnamebyaddr request structure —
cfd9415521847b2f9394fad04fb701cfb955f503rjungto the lightweight resolver's canonical format.
28c31fb73c1264bd1d0ff932573677030b024c7dwroweIt is complemented by a parse function that converts a packet in this
28c31fb73c1264bd1d0ff932573677030b024c7dwrowecanonical format to a getnamebyaddr request structure.
28c31fb73c1264bd1d0ff932573677030b024c7dwroweAnother render function converts the getnamebyaddr response structure —
28c31fb73c1264bd1d0ff932573677030b024c7dwroweto the canonical format.
8491e0600f69b0405e156ea8a419653c065c645bcovenerThis is complemented by a parse function which converts a packet in
63b9f1f5880391261705f696d7d65507bbe9ace3covenercanonical format to a getnamebyaddr response structure.
49dacedb6c387b786b7911082ff35121a45f414bcovenerThese structures are defined in
49dacedb6c387b786b7911082ff35121a45f414bcovenerThey are shown below.
49dacedb6c387b786b7911082ff35121a45f414bcovener<programlisting>
3c990331fc6702119e4f5b8ba9eae3021aea5265jim#define LWRES_OPCODE_GETNAMEBYADDR 0x00010002U
3c990331fc6702119e4f5b8ba9eae3021aea5265jimtypedef struct {
3c990331fc6702119e4f5b8ba9eae3021aea5265jim lwres_uint32_t flags;
fc42512879dd0504532f52fe5d0d0383dda96a1eniq lwres_addr_t addr;
fc42512879dd0504532f52fe5d0d0383dda96a1eniq} lwres_gnbarequest_t;
0451df5dc50fa5d8b3e07d92ee6a92e36a1181a5niqtypedef struct {
0451df5dc50fa5d8b3e07d92ee6a92e36a1181a5niq lwres_uint32_t flags;
0451df5dc50fa5d8b3e07d92ee6a92e36a1181a5niq lwres_uint16_t naliases;
da0442c0440caef34706e2c2f3af05cb65921cc0jailletc char *realname;
983528026996668ea295be95aedb9c7a346af470ylavic char **aliases;
da0442c0440caef34706e2c2f3af05cb65921cc0jailletc lwres_uint16_t realnamelen;
da0442c0440caef34706e2c2f3af05cb65921cc0jailletc lwres_uint16_t *aliaslen;
06b8f183140c8e02e0974e938a05078b511d1603covener void *base;
06b8f183140c8e02e0974e938a05078b511d1603covener size_t baselen;
06b8f183140c8e02e0974e938a05078b511d1603covener} lwres_gnbaresponse_t;
15890c9306ba98f6fc243e15a3c4778ddc7d773erpluem</programlisting>
259878293a997ff49f5ddfc53d3739cbdc25444ecoveneruses resolver context
b54b024c06a19926832d77d40ba35ad8c41e4d3dminfrinto convert getnamebyaddr request structure
b54b024c06a19926832d77d40ba35ad8c41e4d3dminfrinto canonical format.
65967d05f839dbf27cf91d91fa79585eeae19660minfrinThe packet header structure
65967d05f839dbf27cf91d91fa79585eeae19660minfrinis initialised and transferred to
8152945ae46857b170cb227e79bb799f4fc7710dminfrinThe contents of
8152945ae46857b170cb227e79bb799f4fc7710dminfrinare then appended to the buffer in canonical format.
75f5c2db254c0167a0e396254460de09b775d203trawickperforms the same task, except it converts a getnamebyaddr response structure
4f0358189bfa57b8e75bd6b94db264302a8f336amrumphto the lightweight resolver's canonical format.
5716f9c6daa92dde5f2f9d11ed63f7c9549c223atrawickuses context
5716f9c6daa92dde5f2f9d11ed63f7c9549c223atrawickto convert the contents of packet
54d750a84a175d8e338880514d440773eb986b50covenerprovides space to be used for storing this structure.
54d750a84a175d8e338880514d440773eb986b50covenerWhen the function succeeds, the resulting
54d750a84a175d8e338880514d440773eb986b50coveneris made available through
4e30ef014533a7e93c92d88306291f5e49c9692ftrawickoffers the same semantics as
5f066f496cd9f20a2a701255bc67d44e7cb46daetrawickexcept it yields a
1b988c41ee505962781d110a3e4c2c90f1ea0aa4covenerrelease the memory in resolver context
1b988c41ee505962781d110a3e4c2c90f1ea0aa4covenerthat was allocated to the
f06e7c4b1bce6b6491e5de0b7998d3f5696b293dchrisdstructures referenced via
f06e7c4b1bce6b6491e5de0b7998d3f5696b293dchrisdAny memory associated with ancillary buffers and strings for those
179565be4043d7e5f9161aa75271fa0a001866d9covenerstructures is also discarded.
fce4949fb0b309a5744afcd503c6ed2d35621ee2covenerThe getnamebyaddr opcode functions
efe780dcf13b2b95effabf897d694d8f23feac74trawickif memory allocation fails.
fe83f60b41477b14a37edcfcd1f7f5c5a1ebfe44minfrinis returned if the available space in the buffer
993d1261a278d7322bccef219101220b7b4fb8c5jkaluzais too small to accommodate the packet header or the
135ddda3a989215d2bedbcf1529bfb269c3eda23niqwill return
001a44c352f89c9ec332ffd3e0a6927dcd19432chumbedoohif the buffer is not empty after decoding the received packet.
001a44c352f89c9ec332ffd3e0a6927dcd19432chumbedoohThese functions will return
cc5a4a08dc9783fcbc52ce86f11e01c281a43810minfrinin the packet header structure
9b0076ddd1103e5fa9c1f9bafde4b06ce244fbaecovenerindicate that the packet is not a response to an earlier query.
56589be3d7a3e9343370df240010c6928cc78b39jkaluza<citerefentry>
77ca16c5676da23155311e13cee61e7eaba9fa3ejailletc</citerefentry>.