Merge from vendor branch GCC:
[dragonfly.git] / contrib / bind-9.3 / lib / lwres / man / lwres_gnba.html
1 <!--
2  - Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC")
3  - Copyright (C) 2000, 2001 Internet Software Consortium.
4  - 
5  - Permission to use, copy, modify, and 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: lwres_gnba.html,v 1.6.2.1.4.9 2005/10/13 02:33:57 marka Exp $ -->
18 <html>
19 <head>
20 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
21 <title>lwres_gnba</title>
22 <meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
23 </head>
24 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en">
25 <a name="id2463721"></a><div class="titlepage"></div>
26 <div class="refnamediv">
27 <h2>Name</h2>
28 <p>lwres_gnbarequest_render, lwres_gnbaresponse_render, lwres_gnbarequest_parse, lwres_gnbaresponse_parse, lwres_gnbaresponse_free, lwres_gnbarequest_free &#8212; lightweight resolver getnamebyaddress message handling</p>
29 </div>
30 <div class="refsynopsisdiv">
31 <h2>Synopsis</h2>
32 <div class="funcsynopsis">
33 <pre class="funcsynopsisinfo">
34 #include &lt;lwres/lwres.h&gt;
35 </pre>
36 <table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em">
37 <tr>
38 <td><code class="funcdef">
39 lwres_result_t
40 <b class="fsfunc">lwres_gnbarequest_render</b>
41 (</code></td>
42 <td>lwres_context_t * </td>
43 <td>
44 <var class="pdparam">ctx</var>, </td>
45 </tr>
46 <tr>
47 <td> </td>
48 <td>lwres_gnbarequest_t * </td>
49 <td>
50 <var class="pdparam">req</var>, </td>
51 </tr>
52 <tr>
53 <td> </td>
54 <td>lwres_lwpacket_t * </td>
55 <td>
56 <var class="pdparam">pkt</var>, </td>
57 </tr>
58 <tr>
59 <td> </td>
60 <td>lwres_buffer_t * </td>
61 <td>
62 <var class="pdparam">b</var><code>)</code>;</td>
63 </tr>
64 </table>
65 <table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em">
66 <tr>
67 <td><code class="funcdef">
68 lwres_result_t
69 <b class="fsfunc">lwres_gnbaresponse_render</b>
70 (</code></td>
71 <td> </td>
72 <td>, </td>
73 </tr>
74 <tr>
75 <td> </td>
76 <td> </td>
77 <td>, </td>
78 </tr>
79 <tr>
80 <td> </td>
81 <td> </td>
82 <td>, </td>
83 </tr>
84 <tr>
85 <td> </td>
86 <td> </td>
87 <td>
88 <code>)</code>;</td>
89 </tr>
90 </table>
91 <table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em">
92 <tr>
93 <td><code class="funcdef">
94 lwres_result_t
95 <b class="fsfunc">lwres_gnbarequest_parse</b>(</code></td>
96 <td> </td>
97 <td>, </td>
98 </tr>
99 <tr>
100 <td> </td>
101 <td> </td>
102 <td>, </td>
103 </tr>
104 <tr>
105 <td> </td>
106 <td> </td>
107 <td>, </td>
108 </tr>
109 <tr>
110 <td> </td>
111 <td> </td>
112 <td>
113 <code>)</code>;</td>
114 </tr>
115 </table>
116 <table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em">
117 <tr>
118 <td><code class="funcdef">
119 lwres_result_t
120 <b class="fsfunc">lwres_gnbaresponse_parse</b>(</code></td>
121 <td> </td>
122 <td>, </td>
123 </tr>
124 <tr>
125 <td> </td>
126 <td> </td>
127 <td>, </td>
128 </tr>
129 <tr>
130 <td> </td>
131 <td> </td>
132 <td>, </td>
133 </tr>
134 <tr>
135 <td> </td>
136 <td> </td>
137 <td>
138 <code>)</code>;</td>
139 </tr>
140 </table>
141 <table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em">
142 <tr>
143 <td><code class="funcdef">
144 void
145 <b class="fsfunc">lwres_gnbaresponse_free</b>
146 (</code></td>
147 <td> </td>
148 <td>, </td>
149 </tr>
150 <tr>
151 <td> </td>
152 <td> </td>
153 <td>
154 <code>)</code>;</td>
155 </tr>
156 </table>
157 <table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0">
158 <tr>
159 <td><code class="funcdef">
160 void
161 <b class="fsfunc">lwres_gnbarequest_free</b>(</code></td>
162 <td> </td>
163 <td>, </td>
164 </tr>
165 <tr>
166 <td> </td>
167 <td> </td>
168 <td>
169 <code>)</code>;</td>
170 </tr>
171 </table>
172 </div>
173 </div>
174 <div class="refsect1" lang="en">
175 <a name="id2525975"></a><h2>DESCRIPTION</h2>
176 <p>
177 These are low-level routines for creating and parsing
178 lightweight resolver address-to-name lookup request and 
179 response messages.
180 </p>
181 <p>
182 There are four main functions for the getnamebyaddr opcode.
183 One render function converts a getnamebyaddr request structure &#8212;
184 <span class="type">lwres_gnbarequest_t</span> &#8212;
185 to the lightweight resolver's canonical format.
186 It is complemented by a parse function that converts a packet in this
187 canonical format to a getnamebyaddr request structure.
188 Another render function converts the getnamebyaddr response structure &#8212;
189 <span class="type">lwres_gnbaresponse_t</span>
190 to the canonical format.
191 This is complemented by a parse function which converts a packet in
192 canonical format to a getnamebyaddr response structure.
193 </p>
194 <p>
195 These structures are defined in
196 <code class="filename">lwres/lwres.h</code>.
197 They are shown below.
198 </p>
199 <pre class="programlisting">
200 #define LWRES_OPCODE_GETNAMEBYADDR      0x00010002U
201
202 typedef struct {
203         lwres_uint32_t  flags;
204         lwres_addr_t    addr;
205 } lwres_gnbarequest_t;
206
207 typedef struct {
208         lwres_uint32_t  flags;
209         lwres_uint16_t  naliases;
210         char           *realname;
211         char          **aliases;
212         lwres_uint16_t  realnamelen;
213         lwres_uint16_t *aliaslen;
214         void           *base;
215         size_t          baselen;
216 } lwres_gnbaresponse_t;
217 </pre>
218 <p>
219 </p>
220 <p>
221 <code class="function">lwres_gnbarequest_render()</code>
222 uses resolver context
223 <code class="varname">ctx</code>
224 to convert getnamebyaddr request structure
225 <code class="varname">req</code>
226 to canonical format.
227 The packet header structure
228 <code class="varname">pkt</code>
229 is initialised and transferred to
230 buffer
231 <code class="varname">b</code>.
232 The contents of
233 <code class="varname">*req</code>
234 are then appended to the buffer in canonical format.
235 <code class="function">lwres_gnbaresponse_render()</code>
236 performs the same task, except it converts a getnamebyaddr response structure
237 <span class="type">lwres_gnbaresponse_t</span>
238 to the lightweight resolver's canonical format.
239 </p>
240 <p>
241 <code class="function">lwres_gnbarequest_parse()</code>
242 uses context
243 <code class="varname">ctx</code>
244 to convert the contents of packet
245 <code class="varname">pkt</code>
246 to a
247 <span class="type">lwres_gnbarequest_t</span>
248 structure.
249 Buffer
250 <code class="varname">b</code>
251 provides space to be used for storing this structure.
252 When the function succeeds, the resulting
253 <span class="type">lwres_gnbarequest_t</span>
254 is made available through
255 <code class="varname">*structp</code>.
256 <code class="function">lwres_gnbaresponse_parse()</code>
257 offers the same semantics as
258 <code class="function">lwres_gnbarequest_parse()</code>
259 except it yields a
260 <span class="type">lwres_gnbaresponse_t</span>
261 structure.
262 </p>
263 <p>
264 <code class="function">lwres_gnbaresponse_free()</code>
265 and
266 <code class="function">lwres_gnbarequest_free()</code>
267 release the memory in resolver context
268 <code class="varname">ctx</code>
269 that was allocated to the
270 <span class="type">lwres_gnbaresponse_t</span>
271 or
272 <span class="type">lwres_gnbarequest_t</span>
273 structures referenced via
274 <code class="varname">structp</code>.
275 Any memory associated with ancillary buffers and strings for those
276 structures is also discarded.
277 </p>
278 </div>
279 <div class="refsect1" lang="en">
280 <a name="id2526100"></a><h2>RETURN VALUES</h2>
281 <p>
282 The getnamebyaddr opcode functions
283 <code class="function">lwres_gnbarequest_render()</code>,
284 <code class="function">lwres_gnbaresponse_render()</code>
285 <code class="function">lwres_gnbarequest_parse()</code>
286 and
287 <code class="function">lwres_gnbaresponse_parse()</code>
288 all return
289 <span class="errorcode">LWRES_R_SUCCESS</span>
290 on success.
291 They return
292 <span class="errorcode">LWRES_R_NOMEMORY</span>
293 if memory allocation fails.
294 <span class="errorcode">LWRES_R_UNEXPECTEDEND</span>
295 is returned if the available space in the buffer
296 <code class="varname">b</code>
297 is too small to accommodate the packet header or the
298 <span class="type">lwres_gnbarequest_t</span>
299 and
300 <span class="type">lwres_gnbaresponse_t</span>
301 structures.
302 <code class="function">lwres_gnbarequest_parse()</code>
303 and
304 <code class="function">lwres_gnbaresponse_parse()</code>
305 will return
306 <span class="errorcode">LWRES_R_UNEXPECTEDEND</span>
307 if the buffer is not empty after decoding the received packet.
308 These functions will return
309 <span class="errorcode">LWRES_R_FAILURE</span>
310 if
311 <em class="structfield"><code>pktflags</code></em>
312 in the packet header structure
313 <span class="type">lwres_lwpacket_t</span>
314 indicate that the packet is not a response to an earlier query.
315 </p>
316 </div>
317 <div class="refsect1" lang="en">
318 <a name="id2526165"></a><h2>SEE ALSO</h2>
319 <p>
320 <span class="citerefentry"><span class="refentrytitle">lwres_packet</span>(3)</span>.
321 </p>
322 </div>
323 </div></body>
324 </html>