lwres_getnameinfo.html revision e3f6b4d2195b2fcd28f769452d460d1b35f1952a
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync<!--
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - Copyright (C) 2000, 2001 Internet Software Consortium.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync -
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - Permission to use, copy, modify, and distribute this software for any
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - purpose with or without fee is hereby granted, provided that the above
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - copyright notice and this permission notice appear in all copies.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync -
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync - PERFORMANCE OF THIS SOFTWARE.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync-->
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync<HTML
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync><HEAD
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync><TITLE
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync>lwres_getnameinfo</TITLE
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync><META
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncNAME="GENERATOR"
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncCONTENT="Modular DocBook HTML Stylesheet Version 1.73
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync"></HEAD
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync><BODY
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncCLASS="REFENTRY"
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncBGCOLOR="#FFFFFF"
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncTEXT="#000000"
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncLINK="#0000FF"
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncVLINK="#840084"
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncALINK="#0000FF"
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync><H1
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync><A
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncNAME="AEN1"
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync>lwres_getnameinfo</A
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync></H1
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync><DIV
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncCLASS="REFNAMEDIV"
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync><A
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncNAME="AEN8"
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync></A
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync><H2
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync>Name</H2
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync>lwres_getnameinfo&nbsp;--&nbsp;lightweight resolver socket address structure to hostname and service name</DIV
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync><DIV
CLASS="REFSYNOPSISDIV"
><A
NAME="AEN11"
></A
><H2
>Synopsis</H2
><DIV
CLASS="FUNCSYNOPSIS"
><A
NAME="AEN12"
></A
><P
></P
><PRE
CLASS="FUNCSYNOPSISINFO"
>#include &lt;lwres/netdb.h&gt;</PRE
><P
><CODE
><CODE
CLASS="FUNCDEF"
>int
lwres_getnameinfo</CODE
>(const struct sockaddr *sa, size_t salen, char *host, size_t hostlen, char *serv, size_t servlen, int flags);</CODE
></P
><P
></P
></DIV
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN24"
></A
><H2
>DESCRIPTION</H2
><P
> This function is equivalent to the <SPAN
CLASS="CITEREFENTRY"
><SPAN
CLASS="REFENTRYTITLE"
>getnameinfo</SPAN
>(3)</SPAN
> function defined in RFC2133.
<TT
CLASS="FUNCTION"
>lwres_getnameinfo()</TT
> returns the hostname for the
<SPAN
CLASS="TYPE"
>struct sockaddr</SPAN
> <TT
CLASS="PARAMETER"
><I
>sa</I
></TT
> which is
<TT
CLASS="PARAMETER"
><I
>salen</I
></TT
> bytes long. The hostname is of length
<TT
CLASS="PARAMETER"
><I
>hostlen</I
></TT
> and is returned via
<TT
CLASS="PARAMETER"
><I
>*host.</I
></TT
> The maximum length of the hostname is
1025 bytes: <TT
CLASS="CONSTANT"
>NI_MAXHOST</TT
>.</P
><P
> The name of the service associated with the port number in
<TT
CLASS="PARAMETER"
><I
>sa</I
></TT
> is returned in <TT
CLASS="PARAMETER"
><I
>*serv.</I
></TT
>
It is <TT
CLASS="PARAMETER"
><I
>servlen</I
></TT
> bytes long. The maximum length
of the service name is <TT
CLASS="CONSTANT"
>NI_MAXSERV</TT
> - 32 bytes.</P
><P
> The <TT
CLASS="PARAMETER"
><I
>flags</I
></TT
> argument sets the following
bits:
<P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
><TT
CLASS="CONSTANT"
>NI_NOFQDN</TT
></DT
><DD
><P
>A fully qualified domain name is not required for local hosts.
The local part of the fully qualified domain name is returned instead.</P
></DD
><DT
><TT
CLASS="CONSTANT"
>NI_NUMERICHOST</TT
></DT
><DD
><P
>Return the address in numeric form, as if calling inet_ntop(),
instead of a host name.</P
></DD
><DT
><TT
CLASS="CONSTANT"
>NI_NAMEREQD</TT
></DT
><DD
><P
>A name is required. If the hostname cannot be found in the DNS and
this flag is set, a non-zero error code is returned.
If the hostname is not found and the flag is not set, the
address is returned in numeric form.</P
></DD
><DT
><TT
CLASS="CONSTANT"
>NI_NUMERICSERV</TT
></DT
><DD
><P
>The service name is returned as a digit string representing the port number.</P
></DD
><DT
><TT
CLASS="CONSTANT"
>NI_DGRAM</TT
></DT
><DD
><P
>Specifies that the service being looked up is a datagram
service, and causes getservbyport() to be called with a second
argument of "udp" instead of its default of "tcp". This is required
for the few ports (512-514) that have different services for UDP and
TCP.</P
></DD
></DL
></DIV
></P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN70"
></A
><H2
>RETURN VALUES</H2
><P
><TT
CLASS="FUNCTION"
>lwres_getnameinfo()</TT
>
returns 0 on success or a non-zero error code if an error occurs.</P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN74"
></A
><H2
>SEE ALSO</H2
><P
><SPAN
CLASS="CITEREFENTRY"
><SPAN
CLASS="REFENTRYTITLE"
>RFC2133</SPAN
></SPAN
>,
<SPAN
CLASS="CITEREFENTRY"
><SPAN
CLASS="REFENTRYTITLE"
>getservbyport</SPAN
>(3)</SPAN
>,
<SPAN
CLASS="CITEREFENTRY"
><SPAN
CLASS="REFENTRYTITLE"
>lwres</SPAN
>(3)</SPAN
>,
<SPAN
CLASS="CITEREFENTRY"
><SPAN
CLASS="REFENTRYTITLE"
>lwres_getnameinfo</SPAN
>(3)</SPAN
>,
<SPAN
CLASS="CITEREFENTRY"
><SPAN
CLASS="REFENTRYTITLE"
>lwres_getnamebyaddr</SPAN
>(3)</SPAN
>.
<SPAN
CLASS="CITEREFENTRY"
><SPAN
CLASS="REFENTRYTITLE"
>lwres_net_ntop</SPAN
>(3)</SPAN
>.</P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN94"
></A
><H2
>BUGS</H2
><P
>RFC2133 fails to define what the nonzero return values of
<SPAN
CLASS="CITEREFENTRY"
><SPAN
CLASS="REFENTRYTITLE"
>getnameinfo</SPAN
>(3)</SPAN
>
are.</P
></DIV
></BODY
></HTML
>