106N/A<!
DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN">
106N/A - Copyright (C) 2000, 2001 Internet Software Consortium. 106N/A - Permission to use, copy, modify, and distribute this software for any 106N/A - purpose with or without fee is hereby granted, provided that the above 106N/A - copyright notice and this permission notice appear in all copies. 106N/A - THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM 106N/A - DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL 106N/A - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL 106N/A - INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, 106N/A - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING 106N/A - FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, 106N/A - NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 106N/A - WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 106N/A<
date>Jun 30, 2000</
date>
106N/A<
refentrytitle>lwres_gnba</
refentrytitle>
106N/A<
manvolnum>3</
manvolnum>
618N/A<
refmiscinfo>BIND9</
refmiscinfo>
844N/A<
refname>lwres_gnbarequest_render</
refname>
106N/A<
refname>lwres_gnbaresponse_render</
refname>
106N/A<
refname>lwres_gnbarequest_parse</
refname>
106N/A<
refname>lwres_gnbaresponse_parse</
refname>
106N/A<
refname>lwres_gnbaresponse_free</
refname>
106N/A<
refname>lwres_gnbarequest_free</
refname>
106N/A<
refpurpose>lightweight resolver getnamebyaddress message handling</
refpurpose>
247N/A<
function>lwres_gnbarequest_render</
function>
247N/A<
paramdef>lwres_context_t *<
parameter>ctx</
parameter></
paramdef>
247N/A<
paramdef>lwres_gnbarequest_t *<
parameter>req</
parameter></
paramdef>
247N/A<
paramdef>lwres_lwpacket_t *<
parameter>pkt</
parameter></
paramdef>
106N/A<
paramdef>lwres_buffer_t *<
parameter>b</
parameter></
paramdef>
<
function>lwres_gnbaresponse_render</
function>
<
paramdef>lwres_context_t *ctx</
paramdef>
<
paramdef>lwres_gnbaresponse_t *req</
paramdef>
<
paramdef>lwres_lwpacket_t *pkt</
paramdef>
<
paramdef>lwres_buffer_t *b</
paramdef>
<
function>lwres_gnbarequest_parse</
function></
funcdef>
<
paramdef>lwres_context_t *ctx</
paramdef>
<
paramdef>lwres_buffer_t *b</
paramdef>
<
paramdef>lwres_lwpacket_t *pkt</
paramdef>
<
paramdef>lwres_gnbarequest_t **structp</
paramdef>
<
function>lwres_gnbaresponse_parse</
function></
funcdef>
<
paramdef>lwres_context_t *ctx</
paramdef>
<
paramdef>lwres_buffer_t *b</
paramdef>
<
paramdef>lwres_lwpacket_t *pkt</
paramdef>
<
paramdef>lwres_gnbaresponse_t **structp</
paramdef>
<
function>lwres_gnbaresponse_free</
function>
<
paramdef>lwres_context_t *ctx</
paramdef>
<
paramdef>lwres_gnbaresponse_t **structp</
paramdef>
<
function>lwres_gnbarequest_free</
function></
funcdef>
<
paramdef>lwres_context_t *ctx</
paramdef>
<
paramdef>lwres_gnbarequest_t **structp</
paramdef>
<
title>DESCRIPTION</
title>
These are low-level routines for creating and parsing
lightweight resolver address-to-name lookup request and
There are four main functions for the getnamebyaddr opcode.
One render function converts a getnamebyaddr request structure —
<
type>lwres_gnbarequest_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 getnamebyaddr request structure.
Another render function converts the getnamebyaddr response structure —
<
type>lwres_gnbaresponse_t</
type>
This is complemented by a parse function which converts a packet in
canonical format to a getnamebyaddr response structure.
These structures are defined in
#define LWRES_OPCODE_GETNAMEBYADDR 0x00010002U
lwres_uint16_t realnamelen;
lwres_uint16_t *aliaslen;
<
function>lwres_gnbarequest_render()</
function>
to convert getnamebyaddr request structure
The packet header structure
is initialised and transferred to
are then appended to the buffer in canonical format.
<
function>lwres_gnbaresponse_render()</
function>
performs the same task, except it converts a getnamebyaddr response structure
<
type>lwres_gnbaresponse_t</
type>
to the lightweight resolver's canonical format.
<
function>lwres_gnbarequest_parse()</
function>
to convert the contents of packet
<
type>lwres_gnbarequest_t</
type>
provides space to be used for storing this structure.
When the function succeeds, the resulting
<
type>lwres_gnbarequest_t</
type>
is made available through
<
varname>*structp</
varname>.
<
function>lwres_gnbaresponse_parse()</
function>
offers the same semantics as
<
function>lwres_gnbarequest_parse()</
function>
<
type>lwres_gnbaresponse_t</
type>
<
function>lwres_gnbaresponse_free()</
function>
<
function>lwres_gnbarequest_free()</
function>
release the memory in resolver context
that was allocated to the
<
type>lwres_gnbaresponse_t</
type>
<
type>lwres_gnbarequest_t</
type>
structures referenced via
<
varname>structp</
varname>.
Any memory associated with ancillary buffers and strings for those
structures is also discarded.
<
title>RETURN VALUES</
title>
The getnamebyaddr opcode functions
<
function>lwres_gnbarequest_render()</
function>,
<
function>lwres_gnbaresponse_render()</
function>
<
function>lwres_gnbarequest_parse()</
function>
<
function>lwres_gnbaresponse_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_gnbarequest_t</
type>
<
type>lwres_gnbaresponse_t</
type>
<
function>lwres_gnbarequest_parse()</
function>
<
function>lwres_gnbaresponse_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>
<
structfield>pktflags</
structfield>
in the packet header structure
<
type>lwres_lwpacket_t</
type>
indicate that the packet is not a response to an earlier query.
<
refentrytitle>lwres_packet</
refentrytitle>