155N/A - Copyright (C) 2001 Internet Software Consortium. 155N/A - Permission to use, copy, modify, and distribute this software for any 155N/A - purpose with or without fee is hereby granted, provided that the above 155N/A - copyright notice and this permission notice appear in all copies. 155N/A - THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM 155N/A - DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL 155N/A - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL 155N/A - INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, 155N/A - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING 155N/A - FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, 155N/A - NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 155N/A - WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 485N/ACONTENT="Modular DocBook HTML Stylesheet Version 1.61 215N/A>lwres_gabnrequest_render, lwres_gabnresponse_render, lwres_gabnrequest_parse, lwres_gabnresponse_parse, lwres_gabnresponse_free, lwres_gabnrequest_free -- lightweight resolver getaddrbyname message handling</
DIV 155N/ACLASS="FUNCSYNOPSISINFO" 155N/Alwres_gabnrequest_render</
CODE 155N/A>(lwres_context_t *ctx, lwres_gabnrequest_t *req, lwres_lwpacket_t *pkt, lwres_buffer_t *b);</
CODE 155N/Alwres_gabnresponse_render</
CODE 155N/A>(lwres_context_t *ctx, lwres_gabnresponse_t *req, lwres_lwpacket_t *pkt, lwres_buffer_t *b);</
CODE 155N/Alwres_gabnrequest_parse</
CODE 155N/A>(lwres_context_t *ctx, lwres_buffer_t *b, lwres_lwpacket_t *pkt, lwres_gabnrequest_t **structp);</
CODE 155N/Alwres_gabnresponse_parse</
CODE 155N/A>(lwres_context_t *ctx, lwres_buffer_t *b, lwres_lwpacket_t *pkt, lwres_gabnresponse_t **structp);</
CODE 155N/Alwres_gabnresponse_free</
CODE 155N/A>(lwres_context_t *ctx, lwres_gabnresponse_t **structp);</
CODE 155N/Alwres_gabnrequest_free</
CODE 155N/A>(lwres_context_t *ctx, lwres_gabnrequest_t **structp);</
CODE 181N/A>These are low-level routines for creating and parsing
181N/Alightweight resolver name-to-address lookup request and
>There are four main functions for the getaddrbyname opcode.
One render function converts a getaddrbyname request structure —
>lwres_gabnrequest_t</
SPANto the lighweight 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 —
>lwres_gabnresponse_t</
SPANThis is complemented by a parse function which converts a packet in
canonical format to a getaddrbyname response structure.</
P>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;
} lwres_gabnresponse_t;</
PRE>lwres_gabnrequest_render()</
TTto convert getaddrbyname request structure
The packet header structure
is initialised and transferred to
are then appended to the buffer in canonical format.
>lwres_gabnresponse_render()</
TTperforms the same task, except it converts a getaddrbyname response structure
>lwres_gabnresponse_t</
SPANto the lightweight resolver's canonical format.</
P>lwres_gabnrequest_parse()</
TTto convert the contents of packet
>lwres_gabnrequest_t</
SPANprovides space to be used for storing this structure.
When the function succeeds, the resulting
>lwres_gabnrequest_t</
SPANis made available through
>lwres_gabnresponse_parse()</
TToffers the same semantics as
>lwres_gabnrequest_parse()</
TT>lwres_gabnresponse_t</
SPAN>lwres_gabnresponse_free()</
TT>lwres_gabnrequest_free()</
TTrelease the memory in resolver context
that was allocated to the
>lwres_gabnresponse_t</
SPAN>lwres_gabnrequest_t</
SPANstructures referenced via
Any memory associated with ancillary buffers and strings for those
structures is also discarded.</
P>The getaddrbyname opcode functions
>lwres_gabnrequest_render()</
TT>lwres_gabnresponse_render()</
TT>lwres_gabnrequest_parse()</
TT>lwres_gabnresponse_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_gabnrequest_t</
SPAN>lwres_gabnresponse_t</
SPAN>lwres_gabnrequest_parse()</
TT>lwres_gabnresponse_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