140N/A - Copyright (C) 2000, 2001 Internet Software Consortium. 140N/A - Permission to use, copy, modify, and distribute this software for any 140N/A - purpose with or without fee is hereby granted, provided that the above 140N/A - copyright notice and this permission notice appear in all copies. 140N/A - THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM 140N/A - DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL 140N/A - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL 140N/A - INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, 140N/A - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING 140N/A - FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, 140N/A - NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 140N/A - WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 710N/ACONTENT="Modular DocBook HTML Stylesheet Version 1.61 140N/A>lwres_string_parse, lwres_addr_parse, lwres_getaddrsbyname, lwres_getnamebyaddr -- lightweight resolver utility functions</
DIV >(lwres_buffer_t *b, char **c, lwres_uint16_t *len);</
CODE>(lwres_buffer_t *b, lwres_addr_t *addr);</
CODElwres_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()</
TTretrieves 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
and the length of that string is given by
The buffer's current pointer is advanced to point at the character
following the string length, the encoded string, and the trailing
>lwres_string_parse()</
TThas an assertion check that
extracts an address from the buffer
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.
is advanced 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()</
TTto perform foward lookups.
is looked up using the resolver context
is a bitmask indicating which type of addresses are to be looked up.
Current values for this bitmask are
Results of the lookup are returned in
>lwres_getaddrsbyname()</
TTchecks that its pointer arguments are not
>lwres_getnamebyaddr()</
TTperforms reverse lookups.
is used for memory allocation.
The address type is indicated by
The address to be looked up is given by
The result of the function call is made available through
>lwres_getaddrsbyname()</
TT>lwres_getnamebyaddr()</
TTuses assertion checking to ensure its pointer arguments are not
>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