2 - Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC")
3 - Copyright (C) 2000, 2001 Internet Software Consortium.
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.
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.
17 <!-- $Id: lwres_noop.html,v 1.7.2.1.4.11 2006/06/29 13:02:31 marka Exp $ -->
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">
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">
28 <p>lwres_nooprequest_render, lwres_noopresponse_render, lwres_nooprequest_parse, lwres_noopresponse_parse, lwres_noopresponse_free, lwres_nooprequest_free — lightweight resolver no-op message handling</p>
30 <div class="refsynopsisdiv">
32 <div class="funcsynopsis">
33 <pre class="funcsynopsisinfo">
34 #include <lwres/lwres.h></pre>
35 <table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em">
37 <td><code class="funcdef">
39 <b class="fsfunc">lwres_nooprequest_render</b>(</code></td>
65 <table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em">
67 <td><code class="funcdef">
69 <b class="fsfunc">lwres_noopresponse_render</b>(</code></td>
95 <table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em">
97 <td><code class="funcdef">
99 <b class="fsfunc">lwres_nooprequest_parse</b>(</code></td>
125 <table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em">
127 <td><code class="funcdef">
129 <b class="fsfunc">lwres_noopresponse_parse</b>(</code></td>
155 <table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em">
157 <td><code class="funcdef">
159 <b class="fsfunc">lwres_noopresponse_free</b>(</code></td>
175 <table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0">
177 <td><code class="funcdef">
179 <b class="fsfunc">lwres_nooprequest_free</b>(</code></td>
197 <div class="refsect1" lang="en">
198 <a name="id2549528"></a><h2>DESCRIPTION</h2>
200 These are low-level routines for creating and parsing
201 lightweight resolver no-op request and response messages.
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
210 There are four main functions for the no-op opcode.
211 One render function converts a no-op request structure —
212 <span class="type">lwres_nooprequest_t</span> —
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 —
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.
223 These structures are defined in
224 <code class="filename">lwres/lwres.h</code>.
226 They are shown below.
228 <pre class="programlisting">
229 #define LWRES_OPCODE_NOOP 0x00000000U
232 lwres_uint16_t datalength;
234 } lwres_nooprequest_t;
237 lwres_uint16_t datalength;
239 } lwres_noopresponse_t;
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.
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
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.
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>.
278 <div class="refsect1" lang="en">
279 <a name="id2549797"></a><h2>RETURN VALUES</h2>
281 The no-op opcode functions
282 <code class="function">lwres_nooprequest_render()</code>,
284 <code class="function">lwres_noopresponse_render()</code>
285 <code class="function">lwres_nooprequest_parse()</code>
287 <code class="function">lwres_noopresponse_parse()</code>
289 <span class="errorcode">LWRES_R_SUCCESS</span>
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>
300 <span class="type">lwres_noopresponse_t</span>
302 <code class="function">lwres_nooprequest_parse()</code>
304 <code class="function">lwres_noopresponse_parse()</code>
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>
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.
317 <div class="refsect1" lang="en">
318 <a name="id2549861"></a><h2>SEE ALSO</h2>
320 <span class="citerefentry"><span class="refentrytitle">lwres_packet</span>(3