70N/A - Copyright (C) 2000, 2001 Internet Software Consortium. 70N/A - Permission to use, copy, modify, and distribute this software for any 70N/A - purpose with or without fee is hereby granted, provided that the above 70N/A - copyright notice and this permission notice appear in all copies. 70N/A - THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM 70N/A - DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL 70N/A - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL 70N/A - INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, 70N/A - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING 70N/A - FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, 70N/A - NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 70N/A - WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 70N/A>lwres_resutil</
TITLE 70N/ACONTENT="Modular DocBook HTML Stylesheet Version 1.61 90N/A>lwres_string_parse, lwres_addr_parse, lwres_getaddrsbyname, lwres_getnamebyaddr -- lightweight resolver utility functions</
DIV 70N/ACLASS="FUNCSYNOPSIS" 98N/ACLASS="FUNCSYNOPSISINFO" 70N/Alwres_string_parse</
CODE 70N/A>(lwres_buffer_t *b, char **c, lwres_uint16_t *len);</
CODE 70N/Alwres_addr_parse</
CODE 70N/A>(lwres_buffer_t *b, lwres_addr_t *addr);</
CODE lwres_getaddrsbyname</
CODE>(lwres_context_t *ctx, const char *name, lwres_uint32_t addrtypes, lwres_gabnresponse_t **structp);</
CODElwres_getnamebyaddr</
CODE>(lwres_context_t *ctx, lwres_uint32_t addrtype, lwres_uint16_t addrlen, const unsigned char *addr, lwres_gnbaresponse_t **structp);</
CODE>lwres_string_parse()</
TT> retrieves a DNS-encoded
string starting the current pointer of lightweight resolver buffer
When the function returns, the address of the first byte of the
encoded string is returned via <
TTlength of that string is given by <
TTbuffer's current pointer is advanced to point at the character
following the string length, the encoded string, and the trailing
>lwres_string_parse()</
TT> has an assertion check that
> extracts an address from the
> is not null. The buffer's current pointer
> is presumed to point at an encoded
address: the address preceded by a 32-bit protocol family identifier
and a 16-bit length field. The encoded address is copied to
> indicates the size in bytes of
the address that was copied. <
TTadvanced to point at the next byte of available data in the buffer
following the encoded address.</
P>lwres_getaddrsbyname()</
TT>lwres_getnamebyaddr()</
TT>lwres_gnbaresponse_t</
SPAN lwres_uint16_t realnamelen;
lwres_uint16_t *aliaslen;
} lwres_gabnresponse_t;</
PREThe contents of this structure are not manipulated directly but
they are controlled through the
>The lightweight resolver uses
>lwres_getaddrsbyname()</
TT> to perform foward lookups.
> is looked up using the resolver
> is a bitmask indicating which type of
addresses are to be looked up. Current values for this bitmask are
> for IPv6 addresses. Results of the
lookup are returned in <
TT>lwres_getaddrsbyname()</
TT> checks that its pointer
>lwres_getnamebyaddr()</
TT> performs reverse lookups.
allocation. The address type is indicated by
>. The address to be looked up is given
> bytes. The result of the function call
is made available through <
TT>lwres_getaddrsbyname()</
TT>lwres_getnamebyaddr()</
TT> uses assertion checking to
ensure its pointer arguments are not <
SPAN>lwres_getaddrsbyname()</
TT>lwres_string_parse()</
TTif the buffer is corrupt or
>LWRES_R_UNEXPECTEDEND</
SPANif the buffer has less space than expected for the components of the
encoded string or address.</
P>lwres_getaddrsbyname()</
TTon success and it returns
is returned by a successful call to
>lwres_getnamebyaddr()</
TT>lwres_getaddrsbyname()</
TT>lwres_getnamebyaddr()</
TTwhen memory allocation requests fail and
>LWRES_R_UNEXPECTEDEND</
SPANif the buffers used for sending queries and receiving replies are too