lwres_resutil.html revision 8de7014e56565605a51898a2a33a8b08fd3f1e57
94bd918b63001277f1b28ae4581645f8a835688fBob Halley<!--
d4ef65050feac78554addf6e16a06c6e2e0bd331Brian Wellington - Copyright (C) 2000, 2001 Internet Software Consortium.
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews -
d4ef65050feac78554addf6e16a06c6e2e0bd331Brian Wellington - Permission to use, copy, modify, and distribute this software for any
d4ef65050feac78554addf6e16a06c6e2e0bd331Brian Wellington - purpose with or without fee is hereby granted, provided that the above
d4ef65050feac78554addf6e16a06c6e2e0bd331Brian Wellington - copyright notice and this permission notice appear in all copies.
d4ef65050feac78554addf6e16a06c6e2e0bd331Brian Wellington -
d4ef65050feac78554addf6e16a06c6e2e0bd331Brian Wellington - THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
d4ef65050feac78554addf6e16a06c6e2e0bd331Brian Wellington - DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews - INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews - FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews - NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews - WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews-->
d4ef65050feac78554addf6e16a06c6e2e0bd331Brian Wellington<HTML
d4ef65050feac78554addf6e16a06c6e2e0bd331Brian Wellington><HEAD
7389e8330d62a059b8923fb8ca6f933caeb559d9Mark Andrews><TITLE
94bd918b63001277f1b28ae4581645f8a835688fBob Halley>lwres_resutil</TITLE
94bd918b63001277f1b28ae4581645f8a835688fBob Halley><META
94bd918b63001277f1b28ae4581645f8a835688fBob HalleyNAME="GENERATOR"
94bd918b63001277f1b28ae4581645f8a835688fBob HalleyCONTENT="Modular DocBook HTML Stylesheet Version 1.61
94bd918b63001277f1b28ae4581645f8a835688fBob Halley"></HEAD
94bd918b63001277f1b28ae4581645f8a835688fBob Halley><BODY
94bd918b63001277f1b28ae4581645f8a835688fBob HalleyCLASS="REFENTRY"
94bd918b63001277f1b28ae4581645f8a835688fBob HalleyBGCOLOR="#FFFFFF"
94bd918b63001277f1b28ae4581645f8a835688fBob HalleyTEXT="#000000"
94bd918b63001277f1b28ae4581645f8a835688fBob HalleyLINK="#0000FF"
94bd918b63001277f1b28ae4581645f8a835688fBob HalleyVLINK="#840084"
94bd918b63001277f1b28ae4581645f8a835688fBob HalleyALINK="#0000FF"
94bd918b63001277f1b28ae4581645f8a835688fBob Halley><H1
94bd918b63001277f1b28ae4581645f8a835688fBob Halley><A
94bd918b63001277f1b28ae4581645f8a835688fBob HalleyNAME="AEN1"
94bd918b63001277f1b28ae4581645f8a835688fBob Halley>lwres_resutil</A
94bd918b63001277f1b28ae4581645f8a835688fBob Halley></H1
94bd918b63001277f1b28ae4581645f8a835688fBob Halley><DIV
94bd918b63001277f1b28ae4581645f8a835688fBob HalleyCLASS="REFNAMEDIV"
94bd918b63001277f1b28ae4581645f8a835688fBob Halley><A
94bd918b63001277f1b28ae4581645f8a835688fBob HalleyNAME="AEN8"
94bd918b63001277f1b28ae4581645f8a835688fBob Halley></A
94bd918b63001277f1b28ae4581645f8a835688fBob Halley><H2
94bd918b63001277f1b28ae4581645f8a835688fBob Halley>Name</H2
94bd918b63001277f1b28ae4581645f8a835688fBob Halley>lwres_string_parse, lwres_addr_parse, lwres_getaddrsbyname, lwres_getnamebyaddr&nbsp;--&nbsp;lightweight resolver utility functions</DIV
94bd918b63001277f1b28ae4581645f8a835688fBob Halley><DIV
94bd918b63001277f1b28ae4581645f8a835688fBob HalleyCLASS="REFSYNOPSISDIV"
94bd918b63001277f1b28ae4581645f8a835688fBob Halley><A
94bd918b63001277f1b28ae4581645f8a835688fBob HalleyNAME="AEN14"
94bd918b63001277f1b28ae4581645f8a835688fBob Halley></A
94bd918b63001277f1b28ae4581645f8a835688fBob Halley><H2
94bd918b63001277f1b28ae4581645f8a835688fBob Halley>Synopsis</H2
94bd918b63001277f1b28ae4581645f8a835688fBob Halley><DIV
94bd918b63001277f1b28ae4581645f8a835688fBob HalleyCLASS="FUNCSYNOPSIS"
94bd918b63001277f1b28ae4581645f8a835688fBob Halley><A
94bd918b63001277f1b28ae4581645f8a835688fBob HalleyNAME="AEN15"
94bd918b63001277f1b28ae4581645f8a835688fBob Halley></A
94bd918b63001277f1b28ae4581645f8a835688fBob Halley><P
94bd918b63001277f1b28ae4581645f8a835688fBob Halley></P
94bd918b63001277f1b28ae4581645f8a835688fBob Halley><PRE
94bd918b63001277f1b28ae4581645f8a835688fBob HalleyCLASS="FUNCSYNOPSISINFO"
94bd918b63001277f1b28ae4581645f8a835688fBob Halley>#include &lt;lwres/lwres.h&gt;</PRE
94bd918b63001277f1b28ae4581645f8a835688fBob Halley><P
94bd918b63001277f1b28ae4581645f8a835688fBob Halley><CODE
94bd918b63001277f1b28ae4581645f8a835688fBob Halley><CODE
94bd918b63001277f1b28ae4581645f8a835688fBob HalleyCLASS="FUNCDEF"
94bd918b63001277f1b28ae4581645f8a835688fBob Halley>lwres_result_t
94bd918b63001277f1b28ae4581645f8a835688fBob Halleylwres_string_parse</CODE
94bd918b63001277f1b28ae4581645f8a835688fBob Halley>(lwres_buffer_t *b, char **c, lwres_uint16_t *len);</CODE
94bd918b63001277f1b28ae4581645f8a835688fBob Halley></P
94bd918b63001277f1b28ae4581645f8a835688fBob Halley><P
94bd918b63001277f1b28ae4581645f8a835688fBob Halley><CODE
94bd918b63001277f1b28ae4581645f8a835688fBob Halley><CODE
94bd918b63001277f1b28ae4581645f8a835688fBob HalleyCLASS="FUNCDEF"
94bd918b63001277f1b28ae4581645f8a835688fBob Halley>lwres_result_t
94bd918b63001277f1b28ae4581645f8a835688fBob Halleylwres_addr_parse</CODE
94bd918b63001277f1b28ae4581645f8a835688fBob Halley>(lwres_buffer_t *b, lwres_addr_t *addr);</CODE
94bd918b63001277f1b28ae4581645f8a835688fBob Halley></P
94bd918b63001277f1b28ae4581645f8a835688fBob Halley><P
94bd918b63001277f1b28ae4581645f8a835688fBob Halley><CODE
94bd918b63001277f1b28ae4581645f8a835688fBob Halley><CODE
94bd918b63001277f1b28ae4581645f8a835688fBob HalleyCLASS="FUNCDEF"
94bd918b63001277f1b28ae4581645f8a835688fBob Halley>lwres_result_t
94bd918b63001277f1b28ae4581645f8a835688fBob Halleylwres_getaddrsbyname</CODE
94bd918b63001277f1b28ae4581645f8a835688fBob Halley>(lwres_context_t *ctx, const char *name, lwres_uint32_t addrtypes, lwres_gabnresponse_t **structp);</CODE
94bd918b63001277f1b28ae4581645f8a835688fBob Halley></P
94bd918b63001277f1b28ae4581645f8a835688fBob Halley><P
94bd918b63001277f1b28ae4581645f8a835688fBob Halley><CODE
94bd918b63001277f1b28ae4581645f8a835688fBob Halley><CODE
7389e8330d62a059b8923fb8ca6f933caeb559d9Mark AndrewsCLASS="FUNCDEF"
7389e8330d62a059b8923fb8ca6f933caeb559d9Mark Andrews>lwres_result_t
7389e8330d62a059b8923fb8ca6f933caeb559d9Mark Andrewslwres_getnamebyaddr</CODE
7389e8330d62a059b8923fb8ca6f933caeb559d9Mark Andrews>(lwres_context_t *ctx, lwres_uint32_t addrtype, lwres_uint16_t addrlen, const unsigned char *addr, lwres_gnbaresponse_t **structp);</CODE
7389e8330d62a059b8923fb8ca6f933caeb559d9Mark Andrews></P
7389e8330d62a059b8923fb8ca6f933caeb559d9Mark Andrews><P
7389e8330d62a059b8923fb8ca6f933caeb559d9Mark Andrews></P
7389e8330d62a059b8923fb8ca6f933caeb559d9Mark Andrews></DIV
7389e8330d62a059b8923fb8ca6f933caeb559d9Mark Andrews></DIV
94bd918b63001277f1b28ae4581645f8a835688fBob Halley><DIV
94bd918b63001277f1b28ae4581645f8a835688fBob HalleyCLASS="REFSECT1"
94bd918b63001277f1b28ae4581645f8a835688fBob Halley><A
94bd918b63001277f1b28ae4581645f8a835688fBob HalleyNAME="AEN43"
94bd918b63001277f1b28ae4581645f8a835688fBob Halley></A
94bd918b63001277f1b28ae4581645f8a835688fBob Halley><H2
94bd918b63001277f1b28ae4581645f8a835688fBob Halley>DESCRIPTION</H2
94bd918b63001277f1b28ae4581645f8a835688fBob Halley><P
94bd918b63001277f1b28ae4581645f8a835688fBob Halley><TT
94bd918b63001277f1b28ae4581645f8a835688fBob HalleyCLASS="FUNCTION"
94bd918b63001277f1b28ae4581645f8a835688fBob Halley>lwres_string_parse()</TT
94bd918b63001277f1b28ae4581645f8a835688fBob Halley>
f8644da8d948dbc973f6dd4c94a79774e16ec07bDavid Lawrenceretrieves a DNS-encoded string starting the current pointer of
94bd918b63001277f1b28ae4581645f8a835688fBob Halleylightweight resolver buffer
94bd918b63001277f1b28ae4581645f8a835688fBob Halley<TT
94bd918b63001277f1b28ae4581645f8a835688fBob HalleyCLASS="PARAMETER"
94bd918b63001277f1b28ae4581645f8a835688fBob Halley><I
94bd918b63001277f1b28ae4581645f8a835688fBob Halley>b</I
94bd918b63001277f1b28ae4581645f8a835688fBob Halley></TT
94bd918b63001277f1b28ae4581645f8a835688fBob Halley>:
94bd918b63001277f1b28ae4581645f8a835688fBob Halley
94bd918b63001277f1b28ae4581645f8a835688fBob Halleyi.e.
94bd918b63001277f1b28ae4581645f8a835688fBob Halley<TT
94bd918b63001277f1b28ae4581645f8a835688fBob HalleyCLASS="CONSTANT"
94bd918b63001277f1b28ae4581645f8a835688fBob Halley>b-&gt;current</TT
94bd918b63001277f1b28ae4581645f8a835688fBob Halley>.
7389e8330d62a059b8923fb8ca6f933caeb559d9Mark Andrews
94bd918b63001277f1b28ae4581645f8a835688fBob HalleyWhen the function returns, the address of the first byte of the
94bd918b63001277f1b28ae4581645f8a835688fBob Halleyencoded string is returned via
94bd918b63001277f1b28ae4581645f8a835688fBob Halley<TT
94bd918b63001277f1b28ae4581645f8a835688fBob HalleyCLASS="PARAMETER"
94bd918b63001277f1b28ae4581645f8a835688fBob Halley><I
94bd918b63001277f1b28ae4581645f8a835688fBob Halley>*c</I
94bd918b63001277f1b28ae4581645f8a835688fBob Halley></TT
94bd918b63001277f1b28ae4581645f8a835688fBob Halley>
7389e8330d62a059b8923fb8ca6f933caeb559d9Mark Andrewsand the length of that string is given by
7389e8330d62a059b8923fb8ca6f933caeb559d9Mark Andrews<TT
7389e8330d62a059b8923fb8ca6f933caeb559d9Mark AndrewsCLASS="PARAMETER"
7389e8330d62a059b8923fb8ca6f933caeb559d9Mark Andrews><I
7389e8330d62a059b8923fb8ca6f933caeb559d9Mark Andrews>*len</I
94bd918b63001277f1b28ae4581645f8a835688fBob Halley></TT
94bd918b63001277f1b28ae4581645f8a835688fBob Halley>.
7389e8330d62a059b8923fb8ca6f933caeb559d9Mark Andrews
94bd918b63001277f1b28ae4581645f8a835688fBob HalleyThe buffer's current pointer is advanced to point at the character
7389e8330d62a059b8923fb8ca6f933caeb559d9Mark Andrewsfollowing the string length, the encoded string, and the trailing
7389e8330d62a059b8923fb8ca6f933caeb559d9Mark Andrews<SPAN
7389e8330d62a059b8923fb8ca6f933caeb559d9Mark AndrewsCLASS="TYPE"
7389e8330d62a059b8923fb8ca6f933caeb559d9Mark Andrews>NULL</SPAN
7389e8330d62a059b8923fb8ca6f933caeb559d9Mark Andrews>
94bd918b63001277f1b28ae4581645f8a835688fBob Halleycharacter.
94bd918b63001277f1b28ae4581645f8a835688fBob Halley<TT
94bd918b63001277f1b28ae4581645f8a835688fBob HalleyCLASS="FUNCTION"
94bd918b63001277f1b28ae4581645f8a835688fBob Halley>lwres_string_parse()</TT
94bd918b63001277f1b28ae4581645f8a835688fBob Halley>
94bd918b63001277f1b28ae4581645f8a835688fBob Halleyhas an assertion check that
94bd918b63001277f1b28ae4581645f8a835688fBob Halley<TT
94bd918b63001277f1b28ae4581645f8a835688fBob HalleyCLASS="PARAMETER"
94bd918b63001277f1b28ae4581645f8a835688fBob Halley><I
94bd918b63001277f1b28ae4581645f8a835688fBob Halley>b</I
94bd918b63001277f1b28ae4581645f8a835688fBob Halley></TT
7389e8330d62a059b8923fb8ca6f933caeb559d9Mark Andrews>
7389e8330d62a059b8923fb8ca6f933caeb559d9Mark Andrewsis not
7389e8330d62a059b8923fb8ca6f933caeb559d9Mark Andrews<SPAN
7389e8330d62a059b8923fb8ca6f933caeb559d9Mark AndrewsCLASS="TYPE"
94bd918b63001277f1b28ae4581645f8a835688fBob Halley>NULL</SPAN
f8644da8d948dbc973f6dd4c94a79774e16ec07bDavid Lawrence>.&#13;</P
94bd918b63001277f1b28ae4581645f8a835688fBob Halley><P
94bd918b63001277f1b28ae4581645f8a835688fBob Halley><TT
f8644da8d948dbc973f6dd4c94a79774e16ec07bDavid LawrenceCLASS="FUNCTION"
94bd918b63001277f1b28ae4581645f8a835688fBob Halley>lwres_addr_parse()</TT
94bd918b63001277f1b28ae4581645f8a835688fBob Halley>
f8644da8d948dbc973f6dd4c94a79774e16ec07bDavid Lawrenceextracts an address from the buffer
f8644da8d948dbc973f6dd4c94a79774e16ec07bDavid Lawrence<TT
f8644da8d948dbc973f6dd4c94a79774e16ec07bDavid LawrenceCLASS="PARAMETER"
f8644da8d948dbc973f6dd4c94a79774e16ec07bDavid Lawrence><I
f8644da8d948dbc973f6dd4c94a79774e16ec07bDavid Lawrence>b</I
94bd918b63001277f1b28ae4581645f8a835688fBob Halley></TT
94bd918b63001277f1b28ae4581645f8a835688fBob Halley>.
f8644da8d948dbc973f6dd4c94a79774e16ec07bDavid Lawrence
94bd918b63001277f1b28ae4581645f8a835688fBob HalleyIt checks that
94bd918b63001277f1b28ae4581645f8a835688fBob Halley<TT
f8644da8d948dbc973f6dd4c94a79774e16ec07bDavid LawrenceCLASS="PARAMETER"
94bd918b63001277f1b28ae4581645f8a835688fBob Halley><I
94bd918b63001277f1b28ae4581645f8a835688fBob Halley>addr</I
94bd918b63001277f1b28ae4581645f8a835688fBob Halley></TT
94bd918b63001277f1b28ae4581645f8a835688fBob Halley>
94bd918b63001277f1b28ae4581645f8a835688fBob Halleyis not null.
94bd918b63001277f1b28ae4581645f8a835688fBob HalleyThe buffer's current pointer
94bd918b63001277f1b28ae4581645f8a835688fBob Halley<TT
94bd918b63001277f1b28ae4581645f8a835688fBob HalleyCLASS="CONSTANT"
94bd918b63001277f1b28ae4581645f8a835688fBob Halley>b-&gt;current</TT
94bd918b63001277f1b28ae4581645f8a835688fBob Halley>
94bd918b63001277f1b28ae4581645f8a835688fBob Halleyis presumed to point at an encoded address: the address preceded by a
94bd918b63001277f1b28ae4581645f8a835688fBob Halley32-bit protocol family identifier and a 16-bit length field.
94bd918b63001277f1b28ae4581645f8a835688fBob HalleyThe encoded address is copied to
94bd918b63001277f1b28ae4581645f8a835688fBob Halley<TT
94bd918b63001277f1b28ae4581645f8a835688fBob HalleyCLASS="CONSTANT"
94bd918b63001277f1b28ae4581645f8a835688fBob Halley>addr-&gt;address</TT
94bd918b63001277f1b28ae4581645f8a835688fBob Halley>
94bd918b63001277f1b28ae4581645f8a835688fBob Halleyand
94bd918b63001277f1b28ae4581645f8a835688fBob Halley<TT
94bd918b63001277f1b28ae4581645f8a835688fBob HalleyCLASS="CONSTANT"
94bd918b63001277f1b28ae4581645f8a835688fBob Halley>addr-&gt;length</TT
94bd918b63001277f1b28ae4581645f8a835688fBob Halley>
f8644da8d948dbc973f6dd4c94a79774e16ec07bDavid Lawrenceindicates the size in bytes of the address that was copied.
94bd918b63001277f1b28ae4581645f8a835688fBob Halley<TT
94bd918b63001277f1b28ae4581645f8a835688fBob HalleyCLASS="CONSTANT"
94bd918b63001277f1b28ae4581645f8a835688fBob Halley>b-&gt;current</TT
94bd918b63001277f1b28ae4581645f8a835688fBob Halley>
94bd918b63001277f1b28ae4581645f8a835688fBob Halleyis advanced to point at the next byte of available data in the buffer
94bd918b63001277f1b28ae4581645f8a835688fBob Halleyfollowing the encoded address.</P
94bd918b63001277f1b28ae4581645f8a835688fBob Halley><P
94bd918b63001277f1b28ae4581645f8a835688fBob Halley><TT
94bd918b63001277f1b28ae4581645f8a835688fBob HalleyCLASS="FUNCTION"
94bd918b63001277f1b28ae4581645f8a835688fBob Halley>lwres_getaddrsbyname()</TT
94bd918b63001277f1b28ae4581645f8a835688fBob Halley>
94bd918b63001277f1b28ae4581645f8a835688fBob Halleyand
94bd918b63001277f1b28ae4581645f8a835688fBob Halley<TT
17cb8353e999e3294e6619613f401af3f7b1540cMark AndrewsCLASS="FUNCTION"
94bd918b63001277f1b28ae4581645f8a835688fBob Halley>lwres_getnamebyaddr()</TT
94bd918b63001277f1b28ae4581645f8a835688fBob Halley>
94bd918b63001277f1b28ae4581645f8a835688fBob Halleyuse the
94bd918b63001277f1b28ae4581645f8a835688fBob Halley<SPAN
94bd918b63001277f1b28ae4581645f8a835688fBob HalleyCLASS="TYPE"
94bd918b63001277f1b28ae4581645f8a835688fBob Halley>lwres_gnbaresponse_t</SPAN
94bd918b63001277f1b28ae4581645f8a835688fBob Halley>
94bd918b63001277f1b28ae4581645f8a835688fBob Halleystructure defined below:
94bd918b63001277f1b28ae4581645f8a835688fBob Halley<PRE
94bd918b63001277f1b28ae4581645f8a835688fBob HalleyCLASS="PROGRAMLISTING"
94bd918b63001277f1b28ae4581645f8a835688fBob Halley>typedef struct {
lwres_uint32_t flags;
lwres_uint16_t naliases;
lwres_uint16_t naddrs;
char *realname;
char **aliases;
lwres_uint16_t realnamelen;
lwres_uint16_t *aliaslen;
lwres_addrlist_t addrs;
void *base;
size_t baselen;
} lwres_gabnresponse_t;</PRE
>
The contents of this structure are not manipulated directly but
they are controlled through the
<SPAN
CLASS="CITEREFENTRY"
><SPAN
CLASS="REFENTRYTITLE"
>lwres_gabn</SPAN
>(3)</SPAN
>
functions.</P
><P
>The lightweight resolver uses
<TT
CLASS="FUNCTION"
>lwres_getaddrsbyname()</TT
>
to perform foward lookups.
Hostname
<TT
CLASS="PARAMETER"
><I
>name</I
></TT
>
is looked up using the resolver context
<TT
CLASS="PARAMETER"
><I
>ctx</I
></TT
>
for memory allocation.
<TT
CLASS="PARAMETER"
><I
>addrtypes</I
></TT
>
is a bitmask indicating which type of addresses are to be looked up.
Current values for this bitmask are
<SPAN
CLASS="TYPE"
>LWRES_ADDRTYPE_V4</SPAN
>
for IPv4 addresses and
<SPAN
CLASS="TYPE"
>LWRES_ADDRTYPE_V6</SPAN
>
for IPv6 addresses.
Results of the lookup are returned in
<TT
CLASS="PARAMETER"
><I
>*structp</I
></TT
>.
<TT
CLASS="FUNCTION"
>lwres_getaddrsbyname()</TT
>
checks that its pointer arguments are not
<SPAN
CLASS="TYPE"
>NULL</SPAN
>
and that
<TT
CLASS="PARAMETER"
><I
>addrtypes</I
></TT
>
is non-zero.</P
><P
><TT
CLASS="FUNCTION"
>lwres_getnamebyaddr()</TT
>
performs reverse lookups.
Resolver context
<TT
CLASS="PARAMETER"
><I
>ctx</I
></TT
>
is used for memory allocation.
The address type is indicated by
<TT
CLASS="PARAMETER"
><I
>addrtype</I
></TT
>:
<SPAN
CLASS="TYPE"
>LWRES_ADDRTYPE_V4</SPAN
>
or
<SPAN
CLASS="TYPE"
>LWRES_ADDRTYPE_V6</SPAN
>.
The address to be looked up is given by
<TT
CLASS="PARAMETER"
><I
>addr</I
></TT
>
and its length is
<TT
CLASS="PARAMETER"
><I
>addrlen</I
></TT
>
bytes.
The result of the function call is made available through
<TT
CLASS="PARAMETER"
><I
>*structp</I
></TT
>.
Like
<TT
CLASS="FUNCTION"
>lwres_getaddrsbyname()</TT
>,
<TT
CLASS="FUNCTION"
>lwres_getnamebyaddr()</TT
>
uses assertion checking to ensure its pointer arguments are not
<SPAN
CLASS="TYPE"
>NULL</SPAN
>
and
<TT
CLASS="PARAMETER"
><I
>addrtype</I
></TT
>
is not zero.
<TT
CLASS="FUNCTION"
>lwres_getaddrsbyname()</TT
>
also checks that
<TT
CLASS="PARAMETER"
><I
>addrlen</I
></TT
>
is non-zero.</P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN97"
></A
><H2
>RETURN VALUES</H2
><P
>Successful calls to
<TT
CLASS="FUNCTION"
>lwres_string_parse()</TT
>
and
<TT
CLASS="FUNCTION"
>lwres_addr_parse()</TT
>
return
<SPAN
CLASS="ERRORCODE"
>LWRES_R_SUCCESS.</SPAN
>
Both functions return
<SPAN
CLASS="ERRORCODE"
>LWRES_R_FAILURE</SPAN
>
if the buffer is corrupt or
<SPAN
CLASS="ERRORCODE"
>LWRES_R_UNEXPECTEDEND</SPAN
>
if the buffer has less space than expected for the components of the
encoded string or address.</P
><P
><TT
CLASS="FUNCTION"
>lwres_getaddrsbyname()</TT
>
returns
<SPAN
CLASS="ERRORCODE"
>LWRES_R_SUCCESS</SPAN
>
on success and it returns
<SPAN
CLASS="ERRORCODE"
>LWRES_R_NOTFOUND</SPAN
>
if the hostname
<TT
CLASS="PARAMETER"
><I
>name</I
></TT
>
could not be found.</P
><P
><SPAN
CLASS="ERRORCODE"
>LWRES_R_SUCCESS</SPAN
>
is returned by a successful call to
<TT
CLASS="FUNCTION"
>lwres_getnamebyaddr()</TT
>.&#13;</P
><P
>Both
<TT
CLASS="FUNCTION"
>lwres_getaddrsbyname()</TT
>
and
<TT
CLASS="FUNCTION"
>lwres_getnamebyaddr()</TT
>
return
<SPAN
CLASS="ERRORCODE"
>LWRES_R_NOMEMORY</SPAN
>
when memory allocation requests fail and
<SPAN
CLASS="ERRORCODE"
>LWRES_R_UNEXPECTEDEND</SPAN
>
if the buffers used for sending queries and receiving replies are too
small.</P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN118"
></A
><H2
>SEE ALSO</H2
><P
><SPAN
CLASS="CITEREFENTRY"
><SPAN
CLASS="REFENTRYTITLE"
>lwres_buffer</SPAN
>(3)</SPAN
>,
<SPAN
CLASS="CITEREFENTRY"
><SPAN
CLASS="REFENTRYTITLE"
>lwres_gabn</SPAN
>(3)</SPAN
>.</P
></DIV
></BODY
></HTML
>