1<!-- 2 - Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") 3 - Copyright (C) 2000, 2001 Internet Software Consortium. 4 - 5 - Permission to use, copy, modify, and/or distribute this software for any 6 - purpose with or without fee is hereby granted, provided that the above 7 - copyright notice and this permission notice appear in all copies. 8 - 9 - THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH 10 - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 11 - AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, 12 - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 13 - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 14 - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 15 - PERFORMANCE OF THIS SOFTWARE. 16--> 17<!-- $Id$ --> 18<html> 19<head> 20<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> 21<title>lwres_getnameinfo</title> 22<meta name="generator" content="DocBook XSL Stylesheets V1.71.1"> 23</head> 24<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en"> 25<a name="id2476275"></a><div class="titlepage"></div> 26<div class="refnamediv"> 27<h2>Name</h2> 28<p>lwres_getnameinfo — lightweight resolver socket address structure to hostname and 29 service name 30 </p> 31</div> 32<div class="refsynopsisdiv"> 33<h2>Synopsis</h2> 34<div class="funcsynopsis"> 35<pre class="funcsynopsisinfo">#include <lwres/netdb.h></pre> 36<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"> 37<tr> 38<td><code class="funcdef"> 39int 40<b class="fsfunc">lwres_getnameinfo</b>(</code></td> 41<td>const struct sockaddr *�</td> 42<td> 43<var class="pdparam">sa</var>, </td> 44</tr> 45<tr> 46<td>�</td> 47<td>size_t �</td> 48<td> 49<var class="pdparam">salen</var>, </td> 50</tr> 51<tr> 52<td>�</td> 53<td>char *�</td> 54<td> 55<var class="pdparam">host</var>, </td> 56</tr> 57<tr> 58<td>�</td> 59<td>size_t �</td> 60<td> 61<var class="pdparam">hostlen</var>, </td> 62</tr> 63<tr> 64<td>�</td> 65<td>char *�</td> 66<td> 67<var class="pdparam">serv</var>, </td> 68</tr> 69<tr> 70<td>�</td> 71<td>size_t �</td> 72<td> 73<var class="pdparam">servlen</var>, </td> 74</tr> 75<tr> 76<td>�</td> 77<td>int �</td> 78<td> 79<var class="pdparam">flags</var><code>)</code>;</td> 80</tr> 81</table> 82</div> 83</div> 84<div class="refsect1" lang="en"> 85<a name="id2543394"></a><h2>DESCRIPTION</h2> 86<p> 87 This function is equivalent to the 88 <span class="citerefentry"><span class="refentrytitle">getnameinfo</span>(3)</span> function defined in RFC2133. 89 <code class="function">lwres_getnameinfo()</code> returns the 90 hostname for the 91 <span class="type">struct sockaddr</span> <em class="parameter"><code>sa</code></em> which 92 is 93 <em class="parameter"><code>salen</code></em> bytes long. The hostname is of 94 length 95 <em class="parameter"><code>hostlen</code></em> and is returned via 96 <em class="parameter"><code>*host.</code></em> The maximum length of the 97 hostname is 98 1025 bytes: <code class="constant">NI_MAXHOST</code>. 99 </p> 100<p> The name of the service associated with the port number in 101 <em class="parameter"><code>sa</code></em> is returned in <em class="parameter"><code>*serv.</code></em> 102 It is <em class="parameter"><code>servlen</code></em> bytes long. The 103 maximum length 104 of the service name is <code class="constant">NI_MAXSERV</code> - 32 105 bytes. 106 </p> 107<p> 108 The <em class="parameter"><code>flags</code></em> argument sets the 109 following 110 bits: 111 </p> 112<div class="variablelist"><dl> 113<dt><span class="term"><code class="constant">NI_NOFQDN</code></span></dt> 114<dd><p> 115 A fully qualified domain name is not required for local hosts. 116 The local part of the fully qualified domain name is returned 117 instead. 118 </p></dd> 119<dt><span class="term"><code class="constant">NI_NUMERICHOST</code></span></dt> 120<dd><p> 121 Return the address in numeric form, as if calling inet_ntop(), 122 instead of a host name. 123 </p></dd> 124<dt><span class="term"><code class="constant">NI_NAMEREQD</code></span></dt> 125<dd><p> 126 A name is required. If the hostname cannot be found in the DNS 127 and 128 this flag is set, a non-zero error code is returned. 129 If the hostname is not found and the flag is not set, the 130 address is returned in numeric form. 131 </p></dd> 132<dt><span class="term"><code class="constant">NI_NUMERICSERV</code></span></dt> 133<dd><p> 134 The service name is returned as a digit string representing the 135 port number. 136 </p></dd> 137<dt><span class="term"><code class="constant">NI_DGRAM</code></span></dt> 138<dd><p> 139 Specifies that the service being looked up is a datagram 140 service, and causes getservbyport() to be called with a second 141 argument of "udp" instead of its default of "tcp". This is 142 required 143 for the few ports (512-514) that have different services for UDP 144 and 145 TCP. 146 </p></dd> 147</dl></div> 148<p> 149 </p> 150</div> 151<div class="refsect1" lang="en"> 152<a name="id2543536"></a><h2>RETURN VALUES</h2> 153<p><code class="function">lwres_getnameinfo()</code> 154 returns 0 on success or a non-zero error code if an error occurs. 155 </p> 156</div> 157<div class="refsect1" lang="en"> 158<a name="id2543547"></a><h2>SEE ALSO</h2> 159<p><span class="citerefentry"><span class="refentrytitle">RFC2133</span></span>, 160 <span class="citerefentry"><span class="refentrytitle">getservbyport</span>(3)</span>, 161 <span class="citerefentry"><span class="refentrytitle">lwres</span>(3)</span>, 162 <span class="citerefentry"><span class="refentrytitle">lwres_getnameinfo</span>(3)</span>, 163 <span class="citerefentry"><span class="refentrytitle">lwres_getnamebyaddr</span>(3)</span>. 164 <span class="citerefentry"><span class="refentrytitle">lwres_net_ntop</span>(3)</span>. 165 </p> 166</div> 167<div class="refsect1" lang="en"> 168<a name="id2543605"></a><h2>BUGS</h2> 169<p> 170 RFC2133 fails to define what the nonzero return values of 171 <span class="citerefentry"><span class="refentrytitle">getnameinfo</span>(3)</span> 172 are. 173 </p> 174</div> 175</div></body> 176</html> 177