2N/A - Copyright (C) 2000, 2001 Internet Software Consortium. 2N/A - Permission to use, copy, modify, and distribute this software for any 2N/A - purpose with or without fee is hereby granted, provided that the above 2N/A - copyright notice and this permission notice appear in all copies. 2N/A - THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM 2N/A - DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL 2N/A - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL 2N/A - INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, 2N/A - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING 2N/A - FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, 2N/A - NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 2N/A - WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 2N/ACONTENT="Modular DocBook HTML Stylesheet Version 1.61 2N/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 2N/ACLASS="REFSYNOPSISDIV" 2N/ACLASS="FUNCSYNOPSISINFO" 2N/Alwres_gabnrequest_render</
CODE 2N/A>(lwres_context_t *ctx, lwres_gabnrequest_t *req, lwres_lwpacket_t *pkt, lwres_buffer_t *b);</
CODE 2N/Alwres_gabnresponse_render</
CODE 2N/A>(lwres_context_t *ctx, lwres_gabnresponse_t *req, lwres_lwpacket_t *pkt, lwres_buffer_t *b);</
CODE 2N/Alwres_gabnrequest_parse</
CODE 2N/A>(lwres_context_t *ctx, lwres_buffer_t *b, lwres_lwpacket_t *pkt, lwres_gabnrequest_t **structp);</
CODE 2N/Alwres_gabnresponse_parse</
CODE 2N/A>(lwres_context_t *ctx, lwres_buffer_t *b, lwres_lwpacket_t *pkt, lwres_gabnresponse_t **structp);</
CODE 2N/Alwres_gabnresponse_free</
CODE 2N/A>(lwres_context_t *ctx, lwres_gabnresponse_t **structp);</
CODE 2N/Alwres_gabnrequest_free</
CODE 2N/A>(lwres_context_t *ctx, lwres_gabnrequest_t **structp);</
CODE 2N/A>These are low-level routines for creating and parsing
2N/Alightweight resolver name-to-address lookup request and
2N/Aresponse messages.</
P 2N/A>There are four main functions for the getaddrbyname opcode.
2N/AOne render function converts a getaddrbyname request structure —
2N/A>lwres_gabnrequest_t</
SPAN 2N/Ato the lighweight resolver's canonical format.
2N/AIt is complemented by a parse function that converts a packet in this
2N/Acanonical format to a getaddrbyname request structure.
2N/AAnother render function converts the getaddrbyname response structure —
2N/A>lwres_gabnresponse_t</
SPAN 2N/Ato the canonical format.
2N/AThis is complemented by a parse function which converts a packet in
2N/Acanonical format to a getaddrbyname response structure.</
P 2N/A>These structures are defined in
2N/AThey are shown below.
2N/ACLASS="PROGRAMLISTING" 2N/A>#define LWRES_OPCODE_GETADDRSBYNAME 0x00010001U
2N/Atypedef struct lwres_addr lwres_addr_t;
2N/Atypedef LWRES_LIST(lwres_addr_t) lwres_addrlist_t;
2N/A lwres_uint32_t flags;
2N/A lwres_uint32_t addrtypes;
2N/A lwres_uint16_t namelen;
2N/A} lwres_gabnrequest_t;
2N/A lwres_uint32_t flags;
2N/A lwres_uint16_t naliases;
2N/A lwres_uint16_t naddrs;
2N/A lwres_uint16_t realnamelen;
2N/A lwres_uint16_t *aliaslen;
2N/A lwres_addrlist_t addrs;
2N/A} lwres_gabnresponse_t;</
PRE 2N/A>lwres_gabnrequest_render()</
TT 2N/Auses resolver context
2N/Ato convert getaddrbyname request structure
2N/AThe packet header structure
2N/Ais initialised and transferred to
2N/Aare then appended to the buffer in canonical format.
2N/A>lwres_gabnresponse_render()</
TT 2N/Aperforms the same task, except it converts a getaddrbyname response structure
2N/A>lwres_gabnresponse_t</
SPAN 2N/Ato the lightweight resolver's canonical format.</
P 2N/A>lwres_gabnrequest_parse()</
TT 2N/Ato convert the contents of packet
2N/A>lwres_gabnrequest_t</
SPAN 2N/Aprovides space to be used for storing this structure.
2N/AWhen the function succeeds, the resulting
2N/A>lwres_gabnrequest_t</
SPAN 2N/Ais made available through
2N/A>lwres_gabnresponse_parse()</
TT 2N/Aoffers the same semantics as
2N/A>lwres_gabnrequest_parse()</
TT 2N/A>lwres_gabnresponse_t</
SPAN 2N/A>lwres_gabnresponse_free()</
TT 2N/A>lwres_gabnrequest_free()</
TT 2N/Arelease the memory in resolver context
2N/Athat was allocated to the
2N/A>lwres_gabnresponse_t</
SPAN 2N/A>lwres_gabnrequest_t</
SPAN 2N/Astructures referenced via
2N/AAny memory associated with ancillary buffers and strings for those
2N/Astructures is also discarded.</
P 2N/A>The getaddrbyname opcode functions
2N/A>lwres_gabnrequest_render()</
TT 2N/A>lwres_gabnresponse_render()</
TT 2N/A>lwres_gabnrequest_parse()</
TT 2N/A>lwres_gabnresponse_parse()</
TT 2N/A>LWRES_R_SUCCESS</
SPAN 2N/A>LWRES_R_NOMEMORY</
SPAN 2N/Aif memory allocation fails.
2N/A>LWRES_R_UNEXPECTEDEND</
SPAN 2N/Ais returned if the available space in the buffer
2N/Ais too small to accommodate the packet header or the
2N/A>lwres_gabnrequest_t</
SPAN 2N/A>lwres_gabnresponse_t</
SPAN 2N/A>lwres_gabnrequest_parse()</
TT 2N/A>lwres_gabnresponse_parse()</
TT 2N/A>LWRES_R_UNEXPECTEDEND</
SPAN 2N/Aif the buffer is not empty after decoding the received packet.
2N/AThese functions will return
2N/A>LWRES_R_FAILURE</
SPAN 2N/Ain the packet header structure
2N/A>lwres_lwpacket_t</
SPAN 2N/Aindicate that the packet is not a response to an earlier query.</
P 2N/ACLASS="REFENTRYTITLE"