2 - Copyright (C) 2000, 2001 Internet Software Consortium.
4 - Permission to use, copy, modify, and distribute this software for any
5 - purpose with or without fee is hereby granted, provided that the above
6 - copyright notice and this permission notice appear in all copies.
8 - THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
9 - DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
10 - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
11 - INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
12 - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
13 - FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
14 - NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
15 - WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
23 CONTENT=
"Modular DocBook HTML Stylesheet Version 1.61
44 >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
46 CLASS=
"REFSYNOPSISDIV"
60 CLASS=
"FUNCSYNOPSISINFO"
61 >#include
<lwres/lwres.h
></PRE
67 lwres_nooprequest_render
</CODE
68 >(lwres_context_t *ctx, lwres_nooprequest_t *req, lwres_lwpacket_t *pkt, lwres_buffer_t *b);
</CODE
75 lwres_noopresponse_render
</CODE
76 >(lwres_context_t *ctx, lwres_noopresponse_t *req, lwres_lwpacket_t *pkt, lwres_buffer_t *b);
</CODE
83 lwres_nooprequest_parse
</CODE
84 >(lwres_context_t *ctx, lwres_buffer_t *b, lwres_lwpacket_t *pkt, lwres_nooprequest_t **structp);
</CODE
91 lwres_noopresponse_parse
</CODE
92 >(lwres_context_t *ctx, lwres_buffer_t *b, lwres_lwpacket_t *pkt, lwres_noopresponse_t **structp);
</CODE
99 lwres_noopresponse_free
</CODE
100 >(lwres_context_t *ctx, lwres_noopresponse_t **structp);
</CODE
107 lwres_nooprequest_free
</CODE
108 >(lwres_context_t *ctx, lwres_nooprequest_t **structp);
</CODE
122 >These are low-level routines for creating and parsing
123 lightweight resolver no-op request and response messages.
</P
125 >The no-op message is analogous to a
<B
129 a packet is sent to the resolver daemon and is simply echoed back.
130 The opcode is intended to allow a client to determine if the server is
131 operational or not.
</P
133 >There are four main functions for the no-op opcode.
134 One render function converts a no-op request structure
—
137 >lwres_nooprequest_t
</SPAN
139 to the lighweight resolver's canonical format.
140 It is complemented by a parse function that converts a packet in this
141 canonical format to a no-op request structure.
142 Another render function converts the no-op response structure
—
145 >lwres_noopresponse_t
</SPAN
147 to the canonical format.
148 This is complemented by a parse function which converts a packet in
149 canonical format to a no-op response structure.
</P
151 >These structures are defined in
157 They are shown below.
159 CLASS=
"PROGRAMLISTING"
160 >#define LWRES_OPCODE_NOOP
0x00000000U
163 lwres_uint16_t datalength;
165 } lwres_nooprequest_t;
168 lwres_uint16_t datalength;
170 } lwres_noopresponse_t;
</PRE
172 Although the structures have different types, they are identical.
173 This is because the no-op opcode simply echos whatever data was sent:
174 the response is therefore identical to the request.
</P
178 >lwres_nooprequest_render()
</TT
185 > to convert no-op request structure
191 > to canonical format. The packet header
197 > is initialised and transferred to
209 > are then appended to the buffer in
210 canonical format.
<TT
212 >lwres_noopresponse_render()
</TT
214 performs the same task, except it converts a no-op response structure
217 >lwres_noopresponse_t
</SPAN
218 > to the lightweight resolver's
223 >lwres_nooprequest_parse()
</TT
230 > to convert the contents of packet
238 >lwres_nooprequest_t
</SPAN
240 structure. Buffer
<TT
245 > provides space to be used
246 for storing this structure. When the function succeeds, the resulting
249 >lwres_nooprequest_t
</SPAN
250 > is made available through
259 >lwres_noopresponse_parse()
</TT
263 >lwres_nooprequest_parse()
</TT
267 >lwres_noopresponse_t
</SPAN
272 >lwres_noopresponse_free()
</TT
276 >lwres_nooprequest_free()
</TT
277 > release the memory in
283 > that was allocated to the
286 >lwres_noopresponse_t
</SPAN
289 >lwres_nooprequest_t
</SPAN
291 structures referenced via
<TT
306 >The no-op opcode functions
309 >lwres_nooprequest_render()
</TT
314 >lwres_noopresponse_render()
</TT
318 >lwres_nooprequest_parse()
</TT
323 >lwres_noopresponse_parse()
</TT
328 >LWRES_R_SUCCESS
</SPAN
334 >LWRES_R_NOMEMORY
</SPAN
336 if memory allocation fails.
339 >LWRES_R_UNEXPECTEDEND
</SPAN
341 is returned if the available space in the buffer
348 is too small to accommodate the packet header or the
351 >lwres_nooprequest_t
</SPAN
356 >lwres_noopresponse_t
</SPAN
361 >lwres_nooprequest_parse()
</TT
366 >lwres_noopresponse_parse()
</TT
371 >LWRES_R_UNEXPECTEDEND
</SPAN
373 if the buffer is not empty after decoding the received packet.
374 These functions will return
377 >LWRES_R_FAILURE
</SPAN
384 in the packet header structure
387 >lwres_lwpacket_t
</SPAN
389 indicate that the packet is not a response to an earlier query.
</P
402 CLASS=
"REFENTRYTITLE"