]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - 6/contrib/bind9/lib/lwres/man/lwres_gabn.html
Clone Kip's Xen on stable/6 tree so that I can work on improving FreeBSD/amd64
[FreeBSD/FreeBSD.git] / 6 / contrib / bind9 / lib / lwres / man / lwres_gabn.html
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 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.14 2007/01/30 00:11:48 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.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_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>
56 <code>)</code>;</td>
57 </tr>
58 </table>
59 <table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em">
60 <tr>
61 <td><code class="funcdef">
62 lwres_result_t
63 <b class="fsfunc">lwres_gabnresponse_render</b>(</code></td>
64 <td> </td>
65 <td>, </td>
66 </tr>
67 <tr>
68 <td> </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>
81 <code>)</code>;</td>
82 </tr>
83 </table>
84 <table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em">
85 <tr>
86 <td><code class="funcdef">
87 lwres_result_t
88 <b class="fsfunc">lwres_gabnrequest_parse</b>(</code></td>
89 <td> </td>
90 <td>, </td>
91 </tr>
92 <tr>
93 <td> </td>
94 <td> </td>
95 <td>, </td>
96 </tr>
97 <tr>
98 <td> </td>
99 <td> </td>
100 <td>, </td>
101 </tr>
102 <tr>
103 <td> </td>
104 <td> </td>
105 <td>
106 <code>)</code>;</td>
107 </tr>
108 </table>
109 <table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em">
110 <tr>
111 <td><code class="funcdef">
112 lwres_result_t
113 <b class="fsfunc">lwres_gabnresponse_parse</b>(</code></td>
114 <td> </td>
115 <td>, </td>
116 </tr>
117 <tr>
118 <td> </td>
119 <td> </td>
120 <td>, </td>
121 </tr>
122 <tr>
123 <td> </td>
124 <td> </td>
125 <td>, </td>
126 </tr>
127 <tr>
128 <td> </td>
129 <td> </td>
130 <td>
131 <code>)</code>;</td>
132 </tr>
133 </table>
134 <table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em">
135 <tr>
136 <td><code class="funcdef">
137 void
138 <b class="fsfunc">lwres_gabnresponse_free</b>(</code></td>
139 <td> </td>
140 <td>, </td>
141 </tr>
142 <tr>
143 <td> </td>
144 <td> </td>
145 <td>
146 <code>)</code>;</td>
147 </tr>
148 </table>
149 <table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0">
150 <tr>
151 <td><code class="funcdef">
152 void
153 <b class="fsfunc">lwres_gabnrequest_free</b>(</code></td>
154 <td> </td>
155 <td>, </td>
156 </tr>
157 <tr>
158 <td> </td>
159 <td> </td>
160 <td>
161 <code>)</code>;</td>
162 </tr>
163 </table>
164 </div>
165 </div>
166 <div class="refsect1" lang="en">
167 <a name="id2543469"></a><h2>DESCRIPTION</h2>
168 <p>
169 These are low-level routines for creating and parsing
170 lightweight resolver name-to-address lookup request and 
171 response messages.
172 </p>
173 <p>
174 There are four main functions for the getaddrbyname opcode.
175 One render function converts a getaddrbyname request structure &#8212;
176 <span class="type">lwres_gabnrequest_t</span> &#8212;
177 to the lighweight resolver's canonical format.
178 It is complemented by a parse function that converts a packet in this
179 canonical format to a getaddrbyname request structure.
180 Another render function converts the getaddrbyname response structure &#8212;
181 <span class="type">lwres_gabnresponse_t</span> &#8212;
182 to the canonical format.
183 This is complemented by a parse function which converts a packet in
184 canonical format to a getaddrbyname response structure.
185 </p>
186 <p>
187 These structures are defined in
188 <code class="filename">&lt;lwres/lwres.h&gt;</code>.
189 They are shown below.
190 </p>
191 <pre class="programlisting">
192 #define LWRES_OPCODE_GETADDRSBYNAME     0x00010001U
193
194 typedef struct lwres_addr lwres_addr_t;
195 typedef LWRES_LIST(lwres_addr_t) lwres_addrlist_t;
196
197 typedef struct {
198         lwres_uint32_t  flags;
199         lwres_uint32_t  addrtypes;
200         lwres_uint16_t  namelen;
201         char           *name;
202 } lwres_gabnrequest_t;
203
204 typedef struct {
205         lwres_uint32_t          flags;
206         lwres_uint16_t          naliases;
207         lwres_uint16_t          naddrs;
208         char                   *realname;
209         char                  **aliases;
210         lwres_uint16_t          realnamelen;
211         lwres_uint16_t         *aliaslen;
212         lwres_addrlist_t        addrs;
213         void                   *base;
214         size_t                  baselen;
215 } lwres_gabnresponse_t;
216 </pre>
217 <p>
218 </p>
219 <p>
220 <code class="function">lwres_gabnrequest_render()</code>
221 uses resolver context
222 <em class="parameter"><code>ctx</code></em>
223 to convert getaddrbyname request structure
224 <em class="parameter"><code>req</code></em>
225 to canonical format.
226 The packet header structure
227 <em class="parameter"><code>pkt</code></em>
228 is initialised and transferred to
229 buffer
230 <em class="parameter"><code>b</code></em>.
231
232 The contents of
233 <em class="parameter"><code>*req</code></em>
234 are then appended to the buffer in canonical format.
235 <code class="function">lwres_gabnresponse_render()</code>
236 performs the same task, except it converts a getaddrbyname response structure
237 <span class="type">lwres_gabnresponse_t</span>
238 to the lightweight resolver's canonical format.
239 </p>
240 <p>
241 <code class="function">lwres_gabnrequest_parse()</code>
242 uses context
243 <em class="parameter"><code>ctx</code></em>
244 to convert the contents of packet
245 <em class="parameter"><code>pkt</code></em>
246 to a
247 <span class="type">lwres_gabnrequest_t</span>
248 structure.
249 Buffer
250 <em class="parameter"><code>b</code></em>
251 provides space to be used for storing this structure.
252 When the function succeeds, the resulting
253 <span class="type">lwres_gabnrequest_t</span>
254 is made available through
255 <em class="parameter"><code>*structp</code></em>.
256
257 <code class="function">lwres_gabnresponse_parse()</code>
258 offers the same semantics as
259 <code class="function">lwres_gabnrequest_parse()</code>
260 except it yields a
261 <span class="type">lwres_gabnresponse_t</span>
262 structure.
263 </p>
264 <p>
265 <code class="function">lwres_gabnresponse_free()</code>
266 and
267 <code class="function">lwres_gabnrequest_free()</code>
268 release the memory in resolver context
269 <em class="parameter"><code>ctx</code></em>
270 that was allocated to the
271 <span class="type">lwres_gabnresponse_t</span>
272 or
273 <span class="type">lwres_gabnrequest_t</span>
274 structures referenced via
275 <em class="parameter"><code>structp</code></em>.
276
277 Any memory associated with ancillary buffers and strings for those
278 structures is also discarded.
279 </p>
280 </div>
281 <div class="refsect1" lang="en">
282 <a name="id2543593"></a><h2>RETURN VALUES</h2>
283 <p>
284 The getaddrbyname opcode functions
285 <code class="function">lwres_gabnrequest_render()</code>, 
286 <code class="function">lwres_gabnresponse_render()</code>
287 <code class="function">lwres_gabnrequest_parse()</code>
288 and
289 <code class="function">lwres_gabnresponse_parse()</code>
290 all return
291 <span class="errorcode">LWRES_R_SUCCESS</span>
292 on success.
293 They return
294 <span class="errorcode">LWRES_R_NOMEMORY</span>
295 if memory allocation fails.
296 <span class="errorcode">LWRES_R_UNEXPECTEDEND</span>
297 is returned if the available space in the buffer
298 <em class="parameter"><code>b</code></em>
299 is too small to accommodate the packet header or the
300 <span class="type">lwres_gabnrequest_t</span>
301 and
302 <span class="type">lwres_gabnresponse_t</span>
303 structures.
304 <code class="function">lwres_gabnrequest_parse()</code>
305 and
306 <code class="function">lwres_gabnresponse_parse()</code>
307 will return
308 <span class="errorcode">LWRES_R_UNEXPECTEDEND</span>
309 if the buffer is not empty after decoding the received packet.
310 These functions will return
311 <span class="errorcode">LWRES_R_FAILURE</span>
312 if
313 <em class="structfield"><code>pktflags</code></em>
314 in the packet header structure
315 <span class="type">lwres_lwpacket_t</span>
316 indicate that the packet is not a response to an earlier query.
317 </p>
318 </div>
319 <div class="refsect1" lang="en">
320 <a name="id2543658"></a><h2>SEE ALSO</h2>
321 <p>
322 <span class="citerefentry"><span class="refentrytitle">lwres_packet</span>(3
323 )</span>
324 </p>
325 </div>
326 </div></body>
327 </html>