lwres_getnameinfo.html revision 4a14ce5ba00ab7bc55c99ffdcf59c7a4ab902721
0N/A<!--
431N/A - Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC")
0N/A - Copyright (C) 2000, 2001 Internet Software Consortium.
0N/A -
0N/A - Permission to use, copy, modify, and/or 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 -
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-->
0N/A<!-- $Id: lwres_getnameinfo.html,v 1.24 2009/07/11 01:12:46 tbox Exp $ -->
0N/A<html>
0N/A<head>
0N/A<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
0N/A<title>lwres_getnameinfo</title>
0N/A<meta name="generator" content="DocBook XSL Stylesheets V1.71.1">
0N/A</head>
0N/A<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en">
0N/A<a name="id2476275"></a><div class="titlepage"></div>
0N/A<div class="refnamediv">
0N/A<h2>Name</h2>
0N/A<p>lwres_getnameinfo &#8212; lightweight resolver socket address structure to hostname and
0N/A service name
0N/A </p>
0N/A</div>
0N/A<div class="refsynopsisdiv">
0N/A<h2>Synopsis</h2>
547N/A<div class="funcsynopsis">
0N/A<pre class="funcsynopsisinfo">#include &lt;lwres/netdb.h&gt;</pre>
0N/A<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0">
0N/A<tr>
0N/A<td><code class="funcdef">
0N/Aint
0N/A<b class="fsfunc">lwres_getnameinfo</b>(</code></td>
0N/A<td>const struct sockaddr *�</td>
0N/A<td>
0N/A<var class="pdparam">sa</var>, </td>
0N/A</tr>
0N/A<tr>
0N/A<td>�</td>
0N/A<td>size_t �</td>
0N/A<td>
0N/A<var class="pdparam">salen</var>, </td>
0N/A</tr>
0N/A<tr>
0N/A<td>�</td>
0N/A<td>char *�</td>
0N/A<td>
0N/A<var class="pdparam">host</var>, </td>
0N/A</tr>
0N/A<tr>
0N/A<td>�</td>
547N/A<td>size_t �</td>
547N/A<td>
547N/A<var class="pdparam">hostlen</var>, </td>
547N/A</tr>
547N/A<tr>
547N/A<td>�</td>
547N/A<td>char *�</td>
547N/A<td>
547N/A<var class="pdparam">serv</var>, </td>
547N/A</tr>
547N/A<tr>
547N/A<td>�</td>
547N/A<td>size_t �</td>
547N/A<td>
547N/A<var class="pdparam">servlen</var>, </td>
547N/A</tr>
547N/A<tr>
547N/A<td>�</td>
547N/A<td>int �</td>
547N/A<td>
547N/A<var class="pdparam">flags</var><code>)</code>;</td>
547N/A</tr>
547N/A</table>
547N/A</div>
547N/A</div>
547N/A<div class="refsect1" lang="en">
547N/A<a name="id2543393"></a><h2>DESCRIPTION</h2>
547N/A<p>
547N/A This function is equivalent to the
547N/A <span class="citerefentry"><span class="refentrytitle">getnameinfo</span>(3)</span> function defined in RFC2133.
547N/A <code class="function">lwres_getnameinfo()</code> returns the
547N/A hostname for the
547N/A <span class="type">struct sockaddr</span> <em class="parameter"><code>sa</code></em> which
547N/A is
547N/A <em class="parameter"><code>salen</code></em> bytes long. The hostname is of
547N/A length
547N/A <em class="parameter"><code>hostlen</code></em> and is returned via
547N/A <em class="parameter"><code>*host.</code></em> The maximum length of the
547N/A hostname is
547N/A 1025 bytes: <code class="constant">NI_MAXHOST</code>.
547N/A </p>
547N/A<p> The name of the service associated with the port number in
547N/A <em class="parameter"><code>sa</code></em> is returned in <em class="parameter"><code>*serv.</code></em>
547N/A It is <em class="parameter"><code>servlen</code></em> bytes long. The
547N/A maximum length
547N/A of the service name is <code class="constant">NI_MAXSERV</code> - 32
547N/A bytes.
547N/A </p>
547N/A<p>
547N/A The <em class="parameter"><code>flags</code></em> argument sets the
547N/A following
547N/A bits:
547N/A </p>
547N/A<div class="variablelist"><dl>
547N/A<dt><span class="term"><code class="constant">NI_NOFQDN</code></span></dt>
547N/A<dd><p>
547N/A A fully qualified domain name is not required for local hosts.
547N/A The local part of the fully qualified domain name is returned
547N/A instead.
547N/A </p></dd>
547N/A<dt><span class="term"><code class="constant">NI_NUMERICHOST</code></span></dt>
547N/A<dd><p>
547N/A Return the address in numeric form, as if calling inet_ntop(),
547N/A instead of a host name.
547N/A </p></dd>
547N/A<dt><span class="term"><code class="constant">NI_NAMEREQD</code></span></dt>
547N/A<dd><p>
547N/A A name is required. If the hostname cannot be found in the DNS
547N/A and
547N/A this flag is set, a non-zero error code is returned.
547N/A If the hostname is not found and the flag is not set, the
547N/A address is returned in numeric form.
547N/A </p></dd>
547N/A<dt><span class="term"><code class="constant">NI_NUMERICSERV</code></span></dt>
547N/A<dd><p>
547N/A The service name is returned as a digit string representing the
547N/A port number.
547N/A </p></dd>
547N/A<dt><span class="term"><code class="constant">NI_DGRAM</code></span></dt>
547N/A<dd><p>
547N/A Specifies that the service being looked up is a datagram
547N/A service, and causes getservbyport() to be called with a second
547N/A argument of "udp" instead of its default of "tcp". This is
547N/A required
547N/A for the few ports (512-514) that have different services for UDP
547N/A and
547N/A TCP.
547N/A </p></dd>
547N/A</dl></div>
547N/A<p>
547N/A </p>
547N/A</div>
547N/A<div class="refsect1" lang="en">
547N/A<a name="id2543534"></a><h2>RETURN VALUES</h2>
547N/A<p><code class="function">lwres_getnameinfo()</code>
547N/A returns 0 on success or a non-zero error code if an error occurs.
547N/A </p>
547N/A</div>
547N/A<div class="refsect1" lang="en">
547N/A<a name="id2543546"></a><h2>SEE ALSO</h2>
547N/A<p><span class="citerefentry"><span class="refentrytitle">RFC2133</span></span>,
547N/A <span class="citerefentry"><span class="refentrytitle">getservbyport</span>(3)</span>,
547N/A <span class="citerefentry"><span class="refentrytitle">lwres</span>(3)</span>,
547N/A <span class="citerefentry"><span class="refentrytitle">lwres_getnameinfo</span>(3)</span>,
547N/A <span class="citerefentry"><span class="refentrytitle">lwres_getnamebyaddr</span>(3)</span>.
547N/A <span class="citerefentry"><span class="refentrytitle">lwres_net_ntop</span>(3)</span>.
547N/A </p>
547N/A</div>
547N/A<div class="refsect1" lang="en">
547N/A<a name="id2543604"></a><h2>BUGS</h2>
547N/A<p>
547N/A RFC2133 fails to define what the nonzero return values of
547N/A <span class="citerefentry"><span class="refentrytitle">getnameinfo</span>(3)</span>
547N/A are.
547N/A </p>
547N/A</div>
547N/A</div></body>
547N/A</html>
547N/A