2 - Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
3 - Copyright (C) 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.
18 <!-- $Id: lwres_noop.html,v 1.7.2.2 2004/03/15 04:45:04 marka Exp $ -->
26 CONTENT="Modular DocBook HTML Stylesheet Version 1.73
47 >lwres_nooprequest_render, lwres_noopresponse_render, lwres_nooprequest_parse, lwres_noopresponse_parse, lwres_noopresponse_free, lwres_nooprequest_free -- lightweight resolver no-op message handling</DIV
49 CLASS="REFSYNOPSISDIV"
63 CLASS="FUNCSYNOPSISINFO"
64 >#include <lwres/lwres.h></PRE
70 lwres_nooprequest_render</CODE
71 >(lwres_context_t *ctx, lwres_nooprequest_t *req, lwres_lwpacket_t *pkt, lwres_buffer_t *b);</CODE
78 lwres_noopresponse_render</CODE
79 >(lwres_context_t *ctx, lwres_noopresponse_t *req, lwres_lwpacket_t *pkt, lwres_buffer_t *b);</CODE
86 lwres_nooprequest_parse</CODE
87 >(lwres_context_t *ctx, lwres_buffer_t *b, lwres_lwpacket_t *pkt, lwres_nooprequest_t **structp);</CODE
94 lwres_noopresponse_parse</CODE
95 >(lwres_context_t *ctx, lwres_buffer_t *b, lwres_lwpacket_t *pkt, lwres_noopresponse_t **structp);</CODE
102 lwres_noopresponse_free</CODE
103 >(lwres_context_t *ctx, lwres_noopresponse_t **structp);</CODE
110 lwres_nooprequest_free</CODE
111 >(lwres_context_t *ctx, lwres_nooprequest_t **structp);</CODE
125 >These are low-level routines for creating and parsing
126 lightweight resolver no-op request and response messages.</P
128 >The no-op message is analogous to a <B
132 a packet is sent to the resolver daemon and is simply echoed back.
133 The opcode is intended to allow a client to determine if the server is
134 operational or not.</P
136 >There are four main functions for the no-op opcode.
137 One render function converts a no-op request structure —
140 >lwres_nooprequest_t</SPAN
142 to the lighweight resolver's canonical format.
143 It is complemented by a parse function that converts a packet in this
144 canonical format to a no-op request structure.
145 Another render function converts the no-op response structure —
148 >lwres_noopresponse_t</SPAN
150 to the canonical format.
151 This is complemented by a parse function which converts a packet in
152 canonical format to a no-op response structure.</P
154 >These structures are defined in
160 They are shown below.
162 CLASS="PROGRAMLISTING"
163 >#define LWRES_OPCODE_NOOP 0x00000000U
166 lwres_uint16_t datalength;
168 } lwres_nooprequest_t;
171 lwres_uint16_t datalength;
173 } lwres_noopresponse_t;</PRE
175 Although the structures have different types, they are identical.
176 This is because the no-op opcode simply echos whatever data was sent:
177 the response is therefore identical to the request.</P
181 >lwres_nooprequest_render()</TT
188 > to convert no-op request structure
194 > to canonical format. The packet header
200 > is initialised and transferred to
212 > are then appended to the buffer in
213 canonical format. <TT
215 >lwres_noopresponse_render()</TT
217 performs the same task, except it converts a no-op response structure
220 >lwres_noopresponse_t</SPAN
221 > to the lightweight resolver's
226 >lwres_nooprequest_parse()</TT
233 > to convert the contents of packet
241 >lwres_nooprequest_t</SPAN
243 structure. Buffer <TT
248 > provides space to be used
249 for storing this structure. When the function succeeds, the resulting
252 >lwres_nooprequest_t</SPAN
253 > is made available through
262 >lwres_noopresponse_parse()</TT
266 >lwres_nooprequest_parse()</TT
270 >lwres_noopresponse_t</SPAN
275 >lwres_noopresponse_free()</TT
279 >lwres_nooprequest_free()</TT
280 > release the memory in
286 > that was allocated to the
289 >lwres_noopresponse_t</SPAN
292 >lwres_nooprequest_t</SPAN
294 structures referenced via <TT
309 >The no-op opcode functions
312 >lwres_nooprequest_render()</TT
317 >lwres_noopresponse_render()</TT
321 >lwres_nooprequest_parse()</TT
326 >lwres_noopresponse_parse()</TT
331 >LWRES_R_SUCCESS</SPAN
337 >LWRES_R_NOMEMORY</SPAN
339 if memory allocation fails.
342 >LWRES_R_UNEXPECTEDEND</SPAN
344 is returned if the available space in the buffer
351 is too small to accommodate the packet header or the
354 >lwres_nooprequest_t</SPAN
359 >lwres_noopresponse_t</SPAN
364 >lwres_nooprequest_parse()</TT
369 >lwres_noopresponse_parse()</TT
374 >LWRES_R_UNEXPECTEDEND</SPAN
376 if the buffer is not empty after decoding the received packet.
377 These functions will return
380 >LWRES_R_FAILURE</SPAN
387 in the packet header structure
390 >lwres_lwpacket_t</SPAN
392 indicate that the packet is not a response to an earlier query.</P
405 CLASS="REFENTRYTITLE"