335N/A<!ENTITY mdash "—">]>
335N/A - Copyright (C) 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") 335N/A - Copyright (C) 2000, 2001 Internet Software Consortium. 335N/A - Permission to use, copy, modify, and/or distribute this software for any 335N/A - purpose with or without fee is hereby granted, provided that the above 335N/A - copyright notice and this permission notice appear in all copies. 335N/A - THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH 335N/A - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 335N/A - AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, 335N/A - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 335N/A - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 335N/A - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 335N/A - PERFORMANCE OF THIS SOFTWARE. 335N/A<!-- Converted by db4-upgrade version 1.0 --> 335N/A <
date>2007-06-18</
date>
335N/A <
corpname>ISC</
corpname>
335N/A <
corpauthor>Internet Systems Consortium, Inc.</
corpauthor>
335N/A <
refentrytitle>lwres_gabn</
refentrytitle>
618N/A <
manvolnum>3</
manvolnum>
1273N/A <
refmiscinfo>BIND9</
refmiscinfo>
335N/A <
holder>Internet Systems Consortium, Inc. ("ISC")</
holder>
335N/A <
holder>Internet Software Consortium.</
holder>
796N/A <
refname>lwres_gabnrequest_render</
refname>
335N/A <
refname>lwres_gabnresponse_render</
refname>
335N/A <
refname>lwres_gabnrequest_parse</
refname>
335N/A <
refname>lwres_gabnresponse_parse</
refname>
335N/A <
refname>lwres_gabnresponse_free</
refname>
335N/A <
refname>lwres_gabnrequest_free</
refname>
335N/A <
refpurpose>lightweight resolver getaddrbyname message handling</
refpurpose>
<
function>lwres_gabnrequest_render</
function></
funcdef>
<
paramdef>lwres_context_t *<
parameter>ctx</
parameter></
paramdef>
<
paramdef>lwres_gabnrequest_t *<
parameter>req</
parameter></
paramdef>
<
paramdef>lwres_lwpacket_t *<
parameter>pkt</
parameter></
paramdef>
<
paramdef>lwres_buffer_t *<
parameter>b</
parameter></
paramdef>
<
function>lwres_gabnresponse_render</
function></
funcdef>
<
paramdef>lwres_context_t *<
parameter>ctx</
parameter></
paramdef>
<
paramdef>lwres_gabnresponse_t *<
parameter>req</
parameter></
paramdef>
<
paramdef>lwres_lwpacket_t *<
parameter>pkt</
parameter></
paramdef>
<
paramdef>lwres_buffer_t *<
parameter>b</
parameter></
paramdef>
<
function>lwres_gabnrequest_parse</
function></
funcdef>
<
paramdef>lwres_context_t *<
parameter>ctx</
parameter></
paramdef>
<
paramdef>lwres_buffer_t *<
parameter>b</
parameter></
paramdef>
<
paramdef>lwres_lwpacket_t *<
parameter>pkt</
parameter></
paramdef>
<
paramdef>lwres_gabnrequest_t **<
parameter>structp</
parameter></
paramdef>
<
function>lwres_gabnresponse_parse</
function></
funcdef>
<
paramdef>lwres_context_t *<
parameter>ctx</
parameter></
paramdef>
<
paramdef>lwres_buffer_t *<
parameter>b</
parameter></
paramdef>
<
paramdef>lwres_lwpacket_t *<
parameter>pkt</
parameter></
paramdef>
<
paramdef>lwres_gabnresponse_t **<
parameter>structp</
parameter></
paramdef>
<
function>lwres_gabnresponse_free</
function></
funcdef>
<
paramdef>lwres_context_t *<
parameter>ctx</
parameter></
paramdef>
<
paramdef>lwres_gabnresponse_t **<
parameter>structp</
parameter></
paramdef>
<
function>lwres_gabnrequest_free</
function></
funcdef>
<
paramdef>lwres_context_t *<
parameter>ctx</
parameter></
paramdef>
<
paramdef>lwres_gabnrequest_t **<
parameter>structp</
parameter></
paramdef>
<
refsection><
info><
title>DESCRIPTION</
title></
info>
These are low-level routines for creating and parsing
lightweight resolver name-to-address lookup request and
There are four main functions for the getaddrbyname opcode.
One render function converts a getaddrbyname request structure —
<
type>lwres_gabnrequest_t</
type> —
to the lightweight resolver's canonical format.
It is complemented by a parse function that converts a packet in this
canonical format to a getaddrbyname request structure.
Another render function converts the getaddrbyname response structure
— <
type>lwres_gabnresponse_t</
type> —
This is complemented by a parse function which converts a packet in
canonical format to a getaddrbyname response structure.
These structures are defined in
#define LWRES_OPCODE_GETADDRSBYNAME 0x00010001U
typedef struct lwres_addr lwres_addr_t;
typedef LWRES_LIST(lwres_addr_t) lwres_addrlist_t;
lwres_uint32_t addrtypes;
lwres_uint16_t realnamelen;
lwres_uint16_t *aliaslen;
<
para><
function>lwres_gabnrequest_render()</
function>
uses resolver context <
parameter>ctx</
parameter> to convert
getaddrbyname request structure <
parameter>req</
parameter> to
canonical format. The packet header structure
<
parameter>pkt</
parameter> is initialised and transferred to
buffer <
parameter>b</
parameter>.
The contents of <
parameter>*req</
parameter> are then appended to
the buffer in canonical format.
<
function>lwres_gabnresponse_render()</
function> performs the
same task, except it converts a getaddrbyname response structure
<
type>lwres_gabnresponse_t</
type> to the lightweight resolver's
<
para><
function>lwres_gabnrequest_parse()</
function>
uses context <
parameter>ctx</
parameter> to convert the contents
of packet <
parameter>pkt</
parameter> to a
<
type>lwres_gabnrequest_t</
type> structure. Buffer
<
parameter>b</
parameter> provides space to be used for storing
this structure. When the function succeeds, the resulting
<
type>lwres_gabnrequest_t</
type> is made available through
<
parameter>*structp</
parameter>.
<
function>lwres_gabnresponse_parse()</
function> offers the same
semantics as <
function>lwres_gabnrequest_parse()</
function>
except it yields a <
type>lwres_gabnresponse_t</
type> structure.
<
para><
function>lwres_gabnresponse_free()</
function>
and <
function>lwres_gabnrequest_free()</
function> release the
memory in resolver context <
parameter>ctx</
parameter> that was
allocated to the <
type>lwres_gabnresponse_t</
type> or
<
type>lwres_gabnrequest_t</
type> structures referenced via
<
parameter>structp</
parameter>.
Any memory associated with ancillary buffers and strings for
those structures is also discarded.
<
refsection><
info><
title>RETURN VALUES</
title></
info>
The getaddrbyname opcode functions
<
function>lwres_gabnrequest_render()</
function>,
<
function>lwres_gabnresponse_render()</
function>
<
function>lwres_gabnrequest_parse()</
function>
<
function>lwres_gabnresponse_parse()</
function>
<
errorcode>LWRES_R_SUCCESS</
errorcode>
<
errorcode>LWRES_R_NOMEMORY</
errorcode>
if memory allocation fails.
<
errorcode>LWRES_R_UNEXPECTEDEND</
errorcode>
is returned if the available space in the buffer
is too small to accommodate the packet header or the
<
type>lwres_gabnrequest_t</
type>
<
type>lwres_gabnresponse_t</
type>
<
function>lwres_gabnrequest_parse()</
function>
<
function>lwres_gabnresponse_parse()</
function>
<
errorcode>LWRES_R_UNEXPECTEDEND</
errorcode>
if the buffer is not empty after decoding the received packet.
These functions will return
<
errorcode>LWRES_R_FAILURE</
errorcode>
<
varname remap="structfield">pktflags</
varname>
in the packet header structure
<
type>lwres_lwpacket_t</
type>
indicate that the packet is not a response to an earlier query.
<
refsection><
info><
title>SEE ALSO</
title></
info>
<
refentrytitle>lwres_packet</
refentrytitle><
manvolnum>3</
manvolnum>