summaryrefslogtreecommitdiffstats
path: root/lib/lwres/man/lwres_getnameinfo.html
blob: 03eb4a6de2ed798946d4d67f41ce8c37b676021c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--
 - Copyright (C) 2000, 2001, 2004, 2005, 2007, 2014-2016, 2018, 2019 Internet Systems Consortium, Inc. ("ISC")
 - 
 - This Source Code Form is subject to the terms of the Mozilla Public
 - License, v. 2.0. If a copy of the MPL was not distributed with this
 - file, You can obtain one at http://mozilla.org/MPL/2.0/.
-->
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>lwres_getnameinfo</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry">
<a name="id-1"></a><div class="titlepage"></div>
  
  

  

  

  <div class="refnamediv">
<h2>Name</h2>
<p>
    lwres_getnameinfo
     &#8212; lightweight resolver socket address structure to hostname and
      service name
    
  </p>
</div>
  <div class="refsynopsisdiv">
<h2>Synopsis</h2>
    <div class="funcsynopsis">
<pre class="funcsynopsisinfo">#include &lt;lwres/netdb.h&gt;</pre>
<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;">
<tr>
<td><code class="funcdef">
int
<b class="fsfunc">lwres_getnameinfo</b>(</code></td>
<td>const struct sockaddr *<var class="pdparam">sa</var>, </td>
</tr>
<tr>
<td></td>
<td>size_t <var class="pdparam">salen</var>, </td>
</tr>
<tr>
<td></td>
<td>char *<var class="pdparam">host</var>, </td>
</tr>
<tr>
<td></td>
<td>size_t <var class="pdparam">hostlen</var>, </td>
</tr>
<tr>
<td></td>
<td>char *<var class="pdparam">serv</var>, </td>
</tr>
<tr>
<td></td>
<td>size_t <var class="pdparam">servlen</var>, </td>
</tr>
<tr>
<td></td>
<td>int <var class="pdparam">flags</var><code>)</code>;</td>
</tr>
</table>
<div class="funcprototype-spacer"></div>
</div>
  </div>

  <div class="refsection">
<a name="id-1.7"></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.
      <code class="function">lwres_getnameinfo()</code> returns the
      hostname for the
      <span class="type">struct sockaddr</span> <em class="parameter"><code>sa</code></em> which
      is
      <em class="parameter"><code>salen</code></em> bytes long.  The hostname is of
      length
      <em class="parameter"><code>hostlen</code></em> and is returned via
      <em class="parameter"><code>*host.</code></em> The maximum length of the
      hostname is
      1025 bytes: <code class="constant">NI_MAXHOST</code>.
    </p>

    <p> The name of the service associated with the port number in
      <em class="parameter"><code>sa</code></em> is returned in <em class="parameter"><code>*serv.</code></em>
      It is <em class="parameter"><code>servlen</code></em> bytes long.  The
      maximum length
      of the service name is <code class="constant">NI_MAXSERV</code> - 32
      bytes.
    </p>

    <p>
       The <em class="parameter"><code>flags</code></em> argument sets the
      following
      bits:
      </p>
<div class="variablelist"><dl class="variablelist">
<dt><span class="term"><code class="constant">NI_NOFQDN</code></span></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><span class="term"><code class="constant">NI_NUMERICHOST</code></span></dt>
<dd>
            <p>
              Return the address in numeric form, as if calling inet_ntop(),
              instead of a host name.
            </p>
          </dd>
<dt><span class="term"><code class="constant">NI_NAMEREQD</code></span></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><span class="term"><code class="constant">NI_NUMERICSERV</code></span></dt>
<dd>
            <p>
              The service name is returned as a digit string representing the
              port number.
            </p>
          </dd>
<dt><span class="term"><code class="constant">NI_DGRAM</code></span></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>
    </p>
  </div>

  <div class="refsection">
<a name="id-1.8"></a><h2>RETURN VALUES</h2>

    <p><code class="function">lwres_getnameinfo()</code>
      returns 0 on success or a non-zero error code if an error occurs.
    </p>
  </div>
  <div class="refsection">
<a name="id-1.9"></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="refsection">
<a name="id-1.10"></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>
</div></body>
</html>