157N/A - Copyright (C) 2000, 2001 Internet Software Consortium. 0N/A - Permission to use, copy, modify, and distribute this software for any 0N/A - purpose with or without fee is hereby granted, provided that the above 0N/A - copyright notice and this permission notice appear in all copies. 0N/A - THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM 157N/A - DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL 0N/A - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL 0N/A - INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, 0N/A - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING 0N/A - FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, 0N/A - NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 0N/A - WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 0N/A>lwres_resutil</
TITLE 157N/ACONTENT="Modular DocBook HTML Stylesheet Version 1.61 0N/A>lwres_string_parse, lwres_addr_parse, lwres_getaddrsbyname, lwres_getnamebyaddr -- lightweight resolver utility functions</
DIV 0N/ACLASS="REFSYNOPSISDIV" 0N/ACLASS="FUNCSYNOPSISINFO" 0N/Alwres_string_parse</
CODE 0N/A>(lwres_buffer_t *b, char **c, lwres_uint16_t *len);</
CODE 0N/Alwres_addr_parse</
CODE 0N/A>(lwres_buffer_t *b, lwres_addr_t *addr);</
CODE 0N/Alwres_getaddrsbyname</
CODE 0N/A>(lwres_context_t *ctx, const char *name, lwres_uint32_t addrtypes, lwres_gabnresponse_t **structp);</
CODE 0N/Alwres_getnamebyaddr</
CODE 0N/A>(lwres_context_t *ctx, lwres_uint32_t addrtype, lwres_uint16_t addrlen, const unsigned char *addr, lwres_gnbaresponse_t **structp);</
CODE 0N/A>lwres_string_parse()</
TT 0N/Aretrieves a DNS-encoded string starting the current pointer of
0N/Alightweight resolver buffer
0N/AWhen the function returns, the address of the first byte of the
0N/Aencoded string is returned via
0N/Aand the length of that string is given by
0N/AThe buffer's current pointer is advanced to point at the character
0N/Afollowing the string length, the encoded string, and the trailing
0N/A>lwres_string_parse()</
TT 0N/Ahas an assertion check that
0N/A>lwres_addr_parse()</
TT 0N/Aextracts 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