0N/A - Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") 0N/A - Copyright (C) 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 ISC DISCLAIMS ALL WARRANTIES WITH 0N/A - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 0N/A - AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, 0N/A - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 0N/A - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 0N/A - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 0N/A - PERFORMANCE OF THIS SOFTWARE. 0N/A>lwres_resutil</
TITLE 0N/ACONTENT="Modular DocBook HTML Stylesheet Version 1.73 0N/A>lwres_string_parse, lwres_addr_parse, lwres_getaddrsbyname, lwres_getnamebyaddr -- lightweight resolver utility functions</
DIV 0N/ACLASS="REFSYNOPSISDIV" 951N/ACLASS="FUNCSYNOPSISINFO" 3000N/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/A>(lwres_context_t *ctx, const char *name, lwres_uint32_t addrtypes, lwres_gabnresponse_t **structp);</
CODE 3000N/A>(lwres_context_t *ctx, lwres_uint32_t addrtype, lwres_uint16_t addrlen, const unsigned char *addr, lwres_gnbaresponse_t **structp);</
CODE 0N/A> retrieves a DNS-encoded
801N/Astring starting the current pointer of lightweight resolver buffer
801N/AWhen the function returns, the address of the first byte of the
3291N/Aencoded string is returned via <
TT 3845N/Alength of that string is given by <
TT 3845N/Abuffer's current pointer is advanced to point at the character
3845N/Afollowing the string length, the encoded string, and the trailing
0N/A>lwres_addr_parse()</
TT 0N/A> extracts an address from the
801N/A>. The buffer's current pointer
0N/A> is presumed to point at an encoded
3291N/Aaddress: the address preceded by a 32-bit protocol family identifier
0N/Aand a 16-bit length field. The encoded address is copied to
0N/A>addr->address</
TT 0N/A> indicates the size in bytes of
0N/Athe address that was copied. <
TT 3000N/Aadvanced to point at the next byte of available data in the buffer
3291N/Afollowing the encoded address.</
P 0N/A>lwres_getnamebyaddr()</
TT 3000N/A lwres_uint16_t realnamelen;
3000N/A} lwres_gabnresponse_t;</
PRE 801N/AThe contents of this structure are not manipulated directly but
3000N/Athey are controlled through the
3000N/A>The lightweight resolver uses
0N/A>lwres_getaddrsbyname()</
TT 3000N/A> to perform foward lookups.
3000N/A> is looked up using the resolver
3000N/A> is a bitmask indicating which type of
3000N/Aaddresses are to be looked up. Current values for this bitmask are
3000N/A> for IPv6 addresses. Results of the
801N/A>lwres_getnamebyaddr()</
TT 0N/A> performs reverse lookups.
3845N/Aallocation. The address type is indicated by
3000N/A>. The address to be looked up is given
3000N/A> bytes. The result of the function call
3000N/Ais made available through <
TT 0N/ABoth functions return
0N/A>LWRES_R_FAILURE</
SPAN 3000N/A>LWRES_R_UNEXPECTEDEND</
SPAN 3000N/Aif the buffer has less space than expected for the components of the
3000N/Aencoded string or address.</
P 3000N/Ais returned by a successful call to
3000N/Awhen memory allocation requests fail and
3000N/A>LWRES_R_UNEXPECTEDEND</
SPAN 3291N/Aif the buffers used for sending queries and receiving replies are too