1 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
2 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"
3 [<!ENTITY mdash "—">]>
5 - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC")
6 - Copyright (C) 2000, 2001 Internet Software Consortium.
8 - Permission to use, copy, modify, and/or distribute this software for any
9 - purpose with or without fee is hereby granted, provided that the above
10 - copyright notice and this permission notice appear in all copies.
12 - THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
13 - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
14 - AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
15 - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
16 - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
17 - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
18 - PERFORMANCE OF THIS SOFTWARE.
24 <date>June 18, 2007</date>
28 <refentrytitle>lwres_noop</refentrytitle>
29 <manvolnum>3</manvolnum>
30 <refmiscinfo>BIND9</refmiscinfo>
39 <holder>Internet Systems Consortium, Inc. ("ISC")</holder>
44 <holder>Internet Software Consortium.</holder>
49 <refname>lwres_nooprequest_render</refname>
50 <refname>lwres_noopresponse_render</refname>
51 <refname>lwres_nooprequest_parse</refname>
52 <refname>lwres_noopresponse_parse</refname>
53 <refname>lwres_noopresponse_free</refname>
54 <refname>lwres_nooprequest_free</refname>
55 <refpurpose>lightweight resolver no-op message handling</refpurpose>
60 #include <lwres/lwres.h></funcsynopsisinfo>
64 <function>lwres_nooprequest_render</function></funcdef>
65 <paramdef>lwres_context_t *<parameter>ctx</parameter></paramdef>
66 <paramdef>lwres_nooprequest_t *<parameter>req</parameter></paramdef>
67 <paramdef>lwres_lwpacket_t *<parameter>pkt</parameter></paramdef>
68 <paramdef>lwres_buffer_t *<parameter>b</parameter></paramdef>
73 <function>lwres_noopresponse_render</function></funcdef>
74 <paramdef>lwres_context_t *<parameter>ctx</parameter></paramdef>
75 <paramdef>lwres_noopresponse_t *<parameter>req</parameter></paramdef>
76 <paramdef>lwres_lwpacket_t *<parameter>pkt</parameter></paramdef>
77 <paramdef>lwres_buffer_t *<parameter>b</parameter></paramdef>
82 <function>lwres_nooprequest_parse</function></funcdef>
83 <paramdef>lwres_context_t *<parameter>ctx</parameter></paramdef>
84 <paramdef>lwres_buffer_t *<parameter>b</parameter></paramdef>
85 <paramdef>lwres_lwpacket_t *<parameter>pkt</parameter></paramdef>
86 <paramdef>lwres_nooprequest_t **<parameter>structp</parameter></paramdef>
91 <function>lwres_noopresponse_parse</function></funcdef>
92 <paramdef>lwres_context_t *<parameter>ctx</parameter></paramdef>
93 <paramdef>lwres_buffer_t *<parameter>b</parameter></paramdef>
94 <paramdef>lwres_lwpacket_t *<parameter>pkt</parameter></paramdef>
95 <paramdef>lwres_noopresponse_t **<parameter>structp</parameter></paramdef>
100 <function>lwres_noopresponse_free</function></funcdef>
101 <paramdef>lwres_context_t *<parameter>ctx</parameter></paramdef>
102 <paramdef>lwres_noopresponse_t **<parameter>structp</parameter></paramdef>
107 <function>lwres_nooprequest_free</function></funcdef>
108 <paramdef>lwres_context_t *<parameter>ctx</parameter></paramdef>
109 <paramdef>lwres_nooprequest_t **<parameter>structp</parameter></paramdef>
114 <title>DESCRIPTION</title>
116 These are low-level routines for creating and parsing
117 lightweight resolver no-op request and response messages.
120 The no-op message is analogous to a <command>ping</command>
122 a packet is sent to the resolver daemon and is simply echoed back.
123 The opcode is intended to allow a client to determine if the server is
127 There are four main functions for the no-op opcode.
128 One render function converts a no-op request structure —
129 <type>lwres_nooprequest_t</type> —
130 to the lightweight resolver's canonical format.
131 It is complemented by a parse function that converts a packet in this
132 canonical format to a no-op request structure.
133 Another render function converts the no-op response structure —
134 <type>lwres_noopresponse_t</type>
135 to the canonical format.
136 This is complemented by a parse function which converts a packet in
137 canonical format to a no-op response structure.
140 These structures are defined in
141 <filename>lwres/lwres.h</filename>.
143 They are shown below.
145 <para><programlisting>
146 #define LWRES_OPCODE_NOOP 0x00000000U
149 <para><programlisting>
151 lwres_uint16_t datalength;
153 } lwres_nooprequest_t;
156 <para><programlisting>
158 lwres_uint16_t datalength;
160 } lwres_noopresponse_t;
164 Although the structures have different types, they are identical.
165 This is because the no-op opcode simply echos whatever data was sent:
166 the response is therefore identical to the request.
169 <para><function>lwres_nooprequest_render()</function>
170 uses resolver context <parameter>ctx</parameter> to convert
171 no-op request structure <parameter>req</parameter> to canonical
172 format. The packet header structure <parameter>pkt</parameter>
173 is initialised and transferred to buffer
174 <parameter>b</parameter>. The contents of
175 <parameter>*req</parameter> are then appended to the buffer in
177 <function>lwres_noopresponse_render()</function> performs the
178 same task, except it converts a no-op response structure
179 <type>lwres_noopresponse_t</type> to the lightweight resolver's
183 <para><function>lwres_nooprequest_parse()</function>
184 uses context <parameter>ctx</parameter> to convert the contents
185 of packet <parameter>pkt</parameter> to a
186 <type>lwres_nooprequest_t</type> structure. Buffer
187 <parameter>b</parameter> provides space to be used for storing
188 this structure. When the function succeeds, the resulting
189 <type>lwres_nooprequest_t</type> is made available through
190 <parameter>*structp</parameter>.
191 <function>lwres_noopresponse_parse()</function> offers the same
192 semantics as <function>lwres_nooprequest_parse()</function>
193 except it yields a <type>lwres_noopresponse_t</type> structure.
196 <para><function>lwres_noopresponse_free()</function>
197 and <function>lwres_nooprequest_free()</function> release the
198 memory in resolver context <parameter>ctx</parameter> that was
199 allocated to the <type>lwres_noopresponse_t</type> or
200 <type>lwres_nooprequest_t</type> structures referenced via
201 <parameter>structp</parameter>.
206 <title>RETURN VALUES</title>
208 The no-op opcode functions
209 <function>lwres_nooprequest_render()</function>,
211 <function>lwres_noopresponse_render()</function>
212 <function>lwres_nooprequest_parse()</function>
214 <function>lwres_noopresponse_parse()</function>
216 <errorcode>LWRES_R_SUCCESS</errorcode>
219 <errorcode>LWRES_R_NOMEMORY</errorcode>
220 if memory allocation fails.
221 <errorcode>LWRES_R_UNEXPECTEDEND</errorcode>
222 is returned if the available space in the buffer
223 <parameter>b</parameter>
224 is too small to accommodate the packet header or the
225 <type>lwres_nooprequest_t</type>
227 <type>lwres_noopresponse_t</type>
229 <function>lwres_nooprequest_parse()</function>
231 <function>lwres_noopresponse_parse()</function>
233 <errorcode>LWRES_R_UNEXPECTEDEND</errorcode>
234 if the buffer is not empty after decoding the received packet.
235 These functions will return
236 <errorcode>LWRES_R_FAILURE</errorcode>
238 <constant>pktflags</constant>
239 in the packet header structure
240 <type>lwres_lwpacket_t</type>
241 indicate that the packet is not a response to an earlier query.
245 <title>SEE ALSO</title>
247 <refentrytitle>lwres_packet</refentrytitle><manvolnum>3</manvolnum>