Merge from vendor branch BZIP:
[dragonfly.git] / contrib / bind-9.3 / lib / lwres / man / lwres_noop.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_noop.html,v 1.7.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_noop</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_nooprequest_render, lwres_noopresponse_render, lwres_nooprequest_parse, lwres_noopresponse_parse, lwres_noopresponse_free, lwres_nooprequest_free &#8212; lightweight resolver no-op 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;</pre>
35 <table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em">
36 <tr>
37 <td><code class="funcdef">
38 lwres_result_t
39 <b class="fsfunc">lwres_nooprequest_render</b>(</code></td>
40 <td> </td>
41 <td>, </td>
42 </tr>
43 <tr>
44 <td> </td>
45 <td> </td>
46 <td>, </td>
47 </tr>
48 <tr>
49 <td> </td>
50 <td> </td>
51 <td>, </td>
52 </tr>
53 <tr>
54 <td> </td>
55 <td> </td>
56 <td>, </td>
57 </tr>
58 <tr>
59 <td> </td>
60 <td> </td>
61 <td>
62 <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_noopresponse_render</b>(</code></td>
70 <td> </td>
71 <td>, </td>
72 </tr>
73 <tr>
74 <td> </td>
75 <td> </td>
76 <td>, </td>
77 </tr>
78 <tr>
79 <td> </td>
80 <td> </td>
81 <td>, </td>
82 </tr>
83 <tr>
84 <td> </td>
85 <td> </td>
86 <td>, </td>
87 </tr>
88 <tr>
89 <td> </td>
90 <td> </td>
91 <td>
92 <code>)</code>;</td>
93 </tr>
94 </table>
95 <table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em">
96 <tr>
97 <td><code class="funcdef">
98 lwres_result_t
99 <b class="fsfunc">lwres_nooprequest_parse</b>(</code></td>
100 <td> </td>
101 <td>, </td>
102 </tr>
103 <tr>
104 <td> </td>
105 <td> </td>
106 <td>, </td>
107 </tr>
108 <tr>
109 <td> </td>
110 <td> </td>
111 <td>, </td>
112 </tr>
113 <tr>
114 <td> </td>
115 <td> </td>
116 <td>, </td>
117 </tr>
118 <tr>
119 <td> </td>
120 <td> </td>
121 <td>
122 <code>)</code>;</td>
123 </tr>
124 </table>
125 <table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em">
126 <tr>
127 <td><code class="funcdef">
128 lwres_result_t
129 <b class="fsfunc">lwres_noopresponse_parse</b>(</code></td>
130 <td> </td>
131 <td>, </td>
132 </tr>
133 <tr>
134 <td> </td>
135 <td> </td>
136 <td>, </td>
137 </tr>
138 <tr>
139 <td> </td>
140 <td> </td>
141 <td>, </td>
142 </tr>
143 <tr>
144 <td> </td>
145 <td> </td>
146 <td>, </td>
147 </tr>
148 <tr>
149 <td> </td>
150 <td> </td>
151 <td>
152 <code>)</code>;</td>
153 </tr>
154 </table>
155 <table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em">
156 <tr>
157 <td><code class="funcdef">
158 void
159 <b class="fsfunc">lwres_noopresponse_free</b>(</code></td>
160 <td> </td>
161 <td>, </td>
162 </tr>
163 <tr>
164 <td> </td>
165 <td> </td>
166 <td>, </td>
167 </tr>
168 <tr>
169 <td> </td>
170 <td> </td>
171 <td>
172 <code>)</code>;</td>
173 </tr>
174 </table>
175 <table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0">
176 <tr>
177 <td><code class="funcdef">
178 void
179 <b class="fsfunc">lwres_nooprequest_free</b>(</code></td>
180 <td> </td>
181 <td>, </td>
182 </tr>
183 <tr>
184 <td> </td>
185 <td> </td>
186 <td>, </td>
187 </tr>
188 <tr>
189 <td> </td>
190 <td> </td>
191 <td>
192 <code>)</code>;</td>
193 </tr>
194 </table>
195 </div>
196 </div>
197 <div class="refsect1" lang="en">
198 <a name="id2549528"></a><h2>DESCRIPTION</h2>
199 <p>
200 These are low-level routines for creating and parsing
201 lightweight resolver no-op request and response messages.
202 </p>
203 <p>
204 The no-op message is analogous to a <span><strong class="command">ping</strong></span> packet: 
205 a packet is sent to the resolver daemon and is simply echoed back.
206 The opcode is intended to allow a client to determine if the server is
207 operational or not.
208 </p>
209 <p>
210 There are four main functions for the no-op opcode.
211 One render function converts a no-op request structure &#8212;
212 <span class="type">lwres_nooprequest_t</span> &#8212;
213 to the lighweight resolver's canonical format.
214 It is complemented by a parse function that converts a packet in this
215 canonical format to a no-op request structure.
216 Another render function converts the no-op response structure &#8212;
217 <span class="type">lwres_noopresponse_t</span>
218 to the canonical format.
219 This is complemented by a parse function which converts a packet in
220 canonical format to a no-op response structure.
221 </p>
222 <p>
223 These structures are defined in
224 <code class="filename">lwres/lwres.h</code>.
225
226 They are shown below.
227 </p>
228 <pre class="programlisting">
229 #define LWRES_OPCODE_NOOP       0x00000000U
230
231 typedef struct {
232         lwres_uint16_t  datalength;
233         unsigned char   *data;
234 } lwres_nooprequest_t;
235
236 typedef struct {
237         lwres_uint16_t  datalength;
238         unsigned char   *data;
239 } lwres_noopresponse_t;
240 </pre>
241 <p>
242 Although the structures have different types, they are identical.
243 This is because the no-op opcode simply echos whatever data was sent:
244 the response is therefore identical to the request.
245 </p>
246 <p>
247 <code class="function">lwres_nooprequest_render()</code> uses resolver
248 context <em class="parameter"><code>ctx</code></em> to convert no-op request structure
249 <em class="parameter"><code>req</code></em> to canonical format.  The packet header
250 structure <em class="parameter"><code>pkt</code></em> is initialised and transferred to
251 buffer <em class="parameter"><code>b</code></em>.  The contents of
252 <em class="parameter"><code>*req</code></em> are then appended to the buffer in
253 canonical format.  <code class="function">lwres_noopresponse_render()</code>
254 performs the same task, except it converts a no-op response structure
255 <span class="type">lwres_noopresponse_t</span> to the lightweight resolver's
256 canonical format.
257 </p>
258 <p>
259 <code class="function">lwres_nooprequest_parse()</code> uses context
260 <em class="parameter"><code>ctx</code></em> to convert the contents of packet
261 <em class="parameter"><code>pkt</code></em> to a <span class="type">lwres_nooprequest_t</span>
262 structure.  Buffer <em class="parameter"><code>b</code></em> provides space to be used
263 for storing this structure.  When the function succeeds, the resulting
264 <span class="type">lwres_nooprequest_t</span> is made available through
265 <em class="parameter"><code>*structp</code></em>.
266 <code class="function">lwres_noopresponse_parse()</code> offers the same
267 semantics as <code class="function">lwres_nooprequest_parse()</code> except it
268 yields a <span class="type">lwres_noopresponse_t</span> structure.
269 </p>
270 <p>
271 <code class="function">lwres_noopresponse_free()</code> and
272 <code class="function">lwres_nooprequest_free()</code> release the memory in
273 resolver context <em class="parameter"><code>ctx</code></em> that was allocated to the
274 <span class="type">lwres_noopresponse_t</span> or <span class="type">lwres_nooprequest_t</span>
275 structures referenced via <em class="parameter"><code>structp</code></em>.
276 </p>
277 </div>
278 <div class="refsect1" lang="en">
279 <a name="id2549797"></a><h2>RETURN VALUES</h2>
280 <p>
281 The no-op opcode functions
282 <code class="function">lwres_nooprequest_render()</code>,
283
284 <code class="function">lwres_noopresponse_render()</code>
285 <code class="function">lwres_nooprequest_parse()</code>
286 and
287 <code class="function">lwres_noopresponse_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 <em class="parameter"><code>b</code></em>
297 is too small to accommodate the packet header or the
298 <span class="type">lwres_nooprequest_t</span>
299 and
300 <span class="type">lwres_noopresponse_t</span>
301 structures.
302 <code class="function">lwres_nooprequest_parse()</code>
303 and
304 <code class="function">lwres_noopresponse_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 <code class="constant">pktflags</code>
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="id2549861"></a><h2>SEE ALSO</h2>
319 <p>
320 <span class="citerefentry"><span class="refentrytitle">lwres_packet</span>(3
321 )</span>
322 </p>
323 </div>
324 </div></body>
325 </html>