2 - Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC")
3 - Copyright (C) 2000, 2001 Internet Software Consortium.
5 - Permission to use, copy, modify, and/or 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.25.214.1 2009/07/11 01:43:34 tbox 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.71.1">
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">
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>
40 <td>lwres_context_t *
</td>
42 <var class=
"pdparam">ctx
</var>,
</td>
46 <td>lwres_nooprequest_t *
</td>
48 <var class=
"pdparam">req
</var>,
</td>
52 <td>lwres_lwpacket_t *
</td>
54 <var class=
"pdparam">pkt
</var>,
</td>
58 <td>lwres_buffer_t *
</td>
60 <var class=
"pdparam">b
</var><code>)
</code>;
</td>
63 <table border=
"0" summary=
"Function synopsis" cellspacing=
"0" cellpadding=
"0" style=
"padding-bottom: 1em">
65 <td><code class=
"funcdef">
67 <b class=
"fsfunc">lwres_noopresponse_render
</b>(
</code></td>
68 <td>lwres_context_t *
</td>
70 <var class=
"pdparam">ctx
</var>,
</td>
74 <td>lwres_noopresponse_t *
</td>
76 <var class=
"pdparam">req
</var>,
</td>
80 <td>lwres_lwpacket_t *
</td>
82 <var class=
"pdparam">pkt
</var>,
</td>
86 <td>lwres_buffer_t *
</td>
88 <var class=
"pdparam">b
</var><code>)
</code>;
</td>
91 <table border=
"0" summary=
"Function synopsis" cellspacing=
"0" cellpadding=
"0" style=
"padding-bottom: 1em">
93 <td><code class=
"funcdef">
95 <b class=
"fsfunc">lwres_nooprequest_parse
</b>(
</code></td>
96 <td>lwres_context_t *
</td>
98 <var class=
"pdparam">ctx
</var>,
</td>
102 <td>lwres_buffer_t *
</td>
104 <var class=
"pdparam">b
</var>,
</td>
108 <td>lwres_lwpacket_t *
</td>
110 <var class=
"pdparam">pkt
</var>,
</td>
114 <td>lwres_nooprequest_t **
</td>
116 <var class=
"pdparam">structp
</var><code>)
</code>;
</td>
119 <table border=
"0" summary=
"Function synopsis" cellspacing=
"0" cellpadding=
"0" style=
"padding-bottom: 1em">
121 <td><code class=
"funcdef">
123 <b class=
"fsfunc">lwres_noopresponse_parse
</b>(
</code></td>
124 <td>lwres_context_t *
</td>
126 <var class=
"pdparam">ctx
</var>,
</td>
130 <td>lwres_buffer_t *
</td>
132 <var class=
"pdparam">b
</var>,
</td>
136 <td>lwres_lwpacket_t *
</td>
138 <var class=
"pdparam">pkt
</var>,
</td>
142 <td>lwres_noopresponse_t **
</td>
144 <var class=
"pdparam">structp
</var><code>)
</code>;
</td>
147 <table border=
"0" summary=
"Function synopsis" cellspacing=
"0" cellpadding=
"0" style=
"padding-bottom: 1em">
149 <td><code class=
"funcdef">
151 <b class=
"fsfunc">lwres_noopresponse_free
</b>(
</code></td>
152 <td>lwres_context_t *
</td>
154 <var class=
"pdparam">ctx
</var>,
</td>
158 <td>lwres_noopresponse_t **
</td>
160 <var class=
"pdparam">structp
</var><code>)
</code>;
</td>
163 <table border=
"0" summary=
"Function synopsis" cellspacing=
"0" cellpadding=
"0">
165 <td><code class=
"funcdef">
167 <b class=
"fsfunc">lwres_nooprequest_free
</b>(
</code></td>
168 <td>lwres_context_t *
</td>
170 <var class=
"pdparam">ctx
</var>,
</td>
174 <td>lwres_nooprequest_t **
</td>
176 <var class=
"pdparam">structp
</var><code>)
</code>;
</td>
181 <div class=
"refsect1" lang=
"en">
182 <a name=
"id2543522"></a><h2>DESCRIPTION
</h2>
184 These are low-level routines for creating and parsing
185 lightweight resolver no-op request and response messages.
188 The no-op message is analogous to a
<span><strong class=
"command">ping
</strong></span>
190 a packet is sent to the resolver daemon and is simply echoed back.
191 The opcode is intended to allow a client to determine if the server is
195 There are four main functions for the no-op opcode.
196 One render function converts a no-op request structure
—
197 <span class=
"type">lwres_nooprequest_t
</span> —
198 to the lighweight resolver's canonical format.
199 It is complemented by a parse function that converts a packet in this
200 canonical format to a no-op request structure.
201 Another render function converts the no-op response structure
—
202 <span class=
"type">lwres_noopresponse_t
</span>
203 to the canonical format.
204 This is complemented by a parse function which converts a packet in
205 canonical format to a no-op response structure.
208 These structures are defined in
209 <code class=
"filename">lwres/lwres.h
</code>.
211 They are shown below.
213 <pre class=
"programlisting">
214 #define LWRES_OPCODE_NOOP
0x00000000U
218 <pre class=
"programlisting">
220 lwres_uint16_t datalength;
222 } lwres_nooprequest_t;
226 <pre class=
"programlisting">
228 lwres_uint16_t datalength;
230 } lwres_noopresponse_t;
235 Although the structures have different types, they are identical.
236 This is because the no-op opcode simply echos whatever data was sent:
237 the response is therefore identical to the request.
239 <p><code class=
"function">lwres_nooprequest_render()
</code>
240 uses resolver context
<em class=
"parameter"><code>ctx
</code></em> to convert
241 no-op request structure
<em class=
"parameter"><code>req
</code></em> to canonical
242 format. The packet header structure
<em class=
"parameter"><code>pkt
</code></em>
243 is initialised and transferred to buffer
244 <em class=
"parameter"><code>b
</code></em>. The contents of
245 <em class=
"parameter"><code>*req
</code></em> are then appended to the buffer in
247 <code class=
"function">lwres_noopresponse_render()
</code> performs the
248 same task, except it converts a no-op response structure
249 <span class=
"type">lwres_noopresponse_t
</span> to the lightweight resolver's
252 <p><code class=
"function">lwres_nooprequest_parse()
</code>
253 uses context
<em class=
"parameter"><code>ctx
</code></em> to convert the contents
254 of packet
<em class=
"parameter"><code>pkt
</code></em> to a
255 <span class=
"type">lwres_nooprequest_t
</span> structure. Buffer
256 <em class=
"parameter"><code>b
</code></em> provides space to be used for storing
257 this structure. When the function succeeds, the resulting
258 <span class=
"type">lwres_nooprequest_t
</span> is made available through
259 <em class=
"parameter"><code>*structp
</code></em>.
260 <code class=
"function">lwres_noopresponse_parse()
</code> offers the same
261 semantics as
<code class=
"function">lwres_nooprequest_parse()
</code>
262 except it yields a
<span class=
"type">lwres_noopresponse_t
</span> structure.
264 <p><code class=
"function">lwres_noopresponse_free()
</code>
265 and
<code class=
"function">lwres_nooprequest_free()
</code> release the
266 memory in resolver context
<em class=
"parameter"><code>ctx
</code></em> that was
267 allocated to the
<span class=
"type">lwres_noopresponse_t
</span> or
268 <span class=
"type">lwres_nooprequest_t
</span> structures referenced via
269 <em class=
"parameter"><code>structp
</code></em>.
272 <div class=
"refsect1" lang=
"en">
273 <a name=
"id2543672"></a><h2>RETURN VALUES
</h2>
275 The no-op opcode functions
276 <code class=
"function">lwres_nooprequest_render()
</code>,
278 <code class=
"function">lwres_noopresponse_render()
</code>
279 <code class=
"function">lwres_nooprequest_parse()
</code>
281 <code class=
"function">lwres_noopresponse_parse()
</code>
283 <span class=
"errorcode">LWRES_R_SUCCESS
</span>
286 <span class=
"errorcode">LWRES_R_NOMEMORY
</span>
287 if memory allocation fails.
288 <span class=
"errorcode">LWRES_R_UNEXPECTEDEND
</span>
289 is returned if the available space in the buffer
290 <em class=
"parameter"><code>b
</code></em>
291 is too small to accommodate the packet header or the
292 <span class=
"type">lwres_nooprequest_t
</span>
294 <span class=
"type">lwres_noopresponse_t
</span>
296 <code class=
"function">lwres_nooprequest_parse()
</code>
298 <code class=
"function">lwres_noopresponse_parse()
</code>
300 <span class=
"errorcode">LWRES_R_UNEXPECTEDEND
</span>
301 if the buffer is not empty after decoding the received packet.
302 These functions will return
303 <span class=
"errorcode">LWRES_R_FAILURE
</span>
305 <code class=
"constant">pktflags
</code>
306 in the packet header structure
307 <span class=
"type">lwres_lwpacket_t
</span>
308 indicate that the packet is not a response to an earlier query.
311 <div class=
"refsect1" lang=
"en">
312 <a name=
"id2543738"></a><h2>SEE ALSO
</h2>
313 <p><span class=
"citerefentry"><span class=
"refentrytitle">lwres_packet
</span>(
3)
</span>