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