469N/A - Copyright (C) 2000, 2001 Internet Software Consortium. 469N/A - Permission to use, copy, modify, and distribute this software for any 911N/A - purpose with or without fee is hereby granted, provided that the above 761N/A - copyright notice and this permission notice appear in all copies. 469N/A - THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM 469N/A - DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL 469N/A - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL 469N/A - INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, 469N/A - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING 469N/A - FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, 469N/A - NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 469N/A - WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 469N/ACONTENT="Modular DocBook HTML Stylesheet Version 1.61 911N/A>lwres_gnbarequest_render, lwres_gnbaresponse_render, lwres_gnbarequest_parse, lwres_gnbaresponse_parse, lwres_gnbaresponse_free, lwres_gnbarequest_free -- lightweight resolver getnamebyaddress message handling</
DIV 469N/ACLASS="FUNCSYNOPSISINFO" lwres_gnbarequest_render</
CODE>(lwres_context_t *ctx, lwres_gnbarequest_t *req, lwres_lwpacket_t *pkt, lwres_buffer_t *b);</
CODElwres_gnbaresponse_render</
CODE>(lwres_context_t *ctx, lwres_gnbaresponse_t *req, lwres_lwpacket_t *pkt, lwres_buffer_t *b);</
CODElwres_gnbarequest_parse</
CODE>(lwres_context_t *ctx, lwres_buffer_t *b, lwres_lwpacket_t *pkt, lwres_gnbarequest_t **structp);</
CODElwres_gnbaresponse_parse</
CODE>(lwres_context_t *ctx, lwres_buffer_t *b, lwres_lwpacket_t *pkt, lwres_gnbaresponse_t **structp);</
CODElwres_gnbaresponse_free</
CODE>(lwres_context_t *ctx, lwres_gnbaresponse_t **structp);</
CODElwres_gnbarequest_free</
CODE>(lwres_context_t *ctx, lwres_gnbarequest_t **structp);</
CODE>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 —
>lwres_gnbarequest_t</
SPANto 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 —
>lwres_gnbaresponse_t</
SPANThis is complemented by a parse function which converts a packet in
canonical format to a getnamebyaddr response structure.</
P>These structures are defined in
>#define LWRES_OPCODE_GETNAMEBYADDR 0x00010002U
lwres_uint16_t realnamelen;
lwres_uint16_t *aliaslen;
} lwres_gnbaresponse_t;</
PRE>lwres_gnbarequest_render()</
TTto convert getnamebyaddr request structure
The packet header structure
is initialised and transferred to
are then appended to the buffer in canonical format.
>lwres_gnbaresponse_render()</
TTperforms the same task, except it converts a getnamebyaddr response structure
>lwres_gnbaresponse_t</
SPANto the lightweight resolver's canonical format.</
P>lwres_gnbarequest_parse()</
TTto convert the contents of packet
>lwres_gnbarequest_t</
SPANprovides space to be used for storing this structure.
When the function succeeds, the resulting
>lwres_gnbarequest_t</
SPANis made available through
>lwres_gnbaresponse_parse()</
TToffers the same semantics as
>lwres_gnbarequest_parse()</
TT>lwres_gnbaresponse_t</
SPAN>lwres_gnbaresponse_free()</
TT>lwres_gnbarequest_free()</
TTrelease the memory in resolver context
that was allocated to the
>lwres_gnbaresponse_t</
SPAN>lwres_gnbarequest_t</
SPANstructures referenced via
Any memory associated with ancillary buffers and strings for those
structures is also discarded.</
P>The getnamebyaddr opcode functions
>lwres_gnbarequest_render()</
TT>lwres_gnbaresponse_render()</
TT>lwres_gnbarequest_parse()</
TT>lwres_gnbaresponse_parse()</
TTif memory allocation fails.
>LWRES_R_UNEXPECTEDEND</
SPANis returned if the available space in the buffer
is too small to accommodate the packet header or the
>lwres_gnbarequest_t</
SPAN>lwres_gnbaresponse_t</
SPAN>lwres_gnbarequest_parse()</
TT>lwres_gnbaresponse_parse()</
TT>LWRES_R_UNEXPECTEDEND</
SPANif the buffer is not empty after decoding the received packet.
These functions will return
in the packet header structure
indicate that the packet is not a response to an earlier query.</
P