2 <!ENTITY mdash "—">]>
4 - Copyright (C) 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC")
5 - Copyright (C) 2000, 2001 Internet Software Consortium.
7 - Permission to use, copy, modify, and/or distribute this software for any
8 - purpose with or without fee is hereby granted, provided that the above
9 - copyright notice and this permission notice appear in all copies.
11 - THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
12 - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
13 - AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
14 - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15 - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
16 - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17 - PERFORMANCE OF THIS SOFTWARE.
20 <!-- Converted by db4-upgrade version 1.0 -->
21 <refentry xmlns="http://docbook.org/ns/docbook" version="5.0">
23 <date>2007-06-18</date>
26 <corpname>ISC</corpname>
27 <corpauthor>Internet Systems Consortium, Inc.</corpauthor>
31 <refentrytitle>lwres_noop</refentrytitle>
32 <manvolnum>3</manvolnum>
33 <refmiscinfo>BIND9</refmiscinfo>
43 <holder>Internet Systems Consortium, Inc. ("ISC")</holder>
48 <holder>Internet Software Consortium.</holder>
53 <refname>lwres_nooprequest_render</refname>
54 <refname>lwres_noopresponse_render</refname>
55 <refname>lwres_nooprequest_parse</refname>
56 <refname>lwres_noopresponse_parse</refname>
57 <refname>lwres_noopresponse_free</refname>
58 <refname>lwres_nooprequest_free</refname>
59 <refpurpose>lightweight resolver no-op message handling</refpurpose>
64 #include <lwres/lwres.h></funcsynopsisinfo>
68 <function>lwres_nooprequest_render</function></funcdef>
69 <paramdef>lwres_context_t *<parameter>ctx</parameter></paramdef>
70 <paramdef>lwres_nooprequest_t *<parameter>req</parameter></paramdef>
71 <paramdef>lwres_lwpacket_t *<parameter>pkt</parameter></paramdef>
72 <paramdef>lwres_buffer_t *<parameter>b</parameter></paramdef>
77 <function>lwres_noopresponse_render</function></funcdef>
78 <paramdef>lwres_context_t *<parameter>ctx</parameter></paramdef>
79 <paramdef>lwres_noopresponse_t *<parameter>req</parameter></paramdef>
80 <paramdef>lwres_lwpacket_t *<parameter>pkt</parameter></paramdef>
81 <paramdef>lwres_buffer_t *<parameter>b</parameter></paramdef>
86 <function>lwres_nooprequest_parse</function></funcdef>
87 <paramdef>lwres_context_t *<parameter>ctx</parameter></paramdef>
88 <paramdef>lwres_buffer_t *<parameter>b</parameter></paramdef>
89 <paramdef>lwres_lwpacket_t *<parameter>pkt</parameter></paramdef>
90 <paramdef>lwres_nooprequest_t **<parameter>structp</parameter></paramdef>
95 <function>lwres_noopresponse_parse</function></funcdef>
96 <paramdef>lwres_context_t *<parameter>ctx</parameter></paramdef>
97 <paramdef>lwres_buffer_t *<parameter>b</parameter></paramdef>
98 <paramdef>lwres_lwpacket_t *<parameter>pkt</parameter></paramdef>
99 <paramdef>lwres_noopresponse_t **<parameter>structp</parameter></paramdef>
104 <function>lwres_noopresponse_free</function></funcdef>
105 <paramdef>lwres_context_t *<parameter>ctx</parameter></paramdef>
106 <paramdef>lwres_noopresponse_t **<parameter>structp</parameter></paramdef>
111 <function>lwres_nooprequest_free</function></funcdef>
112 <paramdef>lwres_context_t *<parameter>ctx</parameter></paramdef>
113 <paramdef>lwres_nooprequest_t **<parameter>structp</parameter></paramdef>
117 <refsection><info><title>DESCRIPTION</title></info>
120 These are low-level routines for creating and parsing
121 lightweight resolver no-op request and response messages.
124 The no-op message is analogous to a <command>ping</command>
126 a packet is sent to the resolver daemon and is simply echoed back.
127 The opcode is intended to allow a client to determine if the server is
131 There are four main functions for the no-op opcode.
132 One render function converts a no-op request structure —
133 <type>lwres_nooprequest_t</type> —
134 to the lightweight resolver's canonical format.
135 It is complemented by a parse function that converts a packet in this
136 canonical format to a no-op request structure.
137 Another render function converts the no-op response structure —
138 <type>lwres_noopresponse_t</type>
139 to the canonical format.
140 This is complemented by a parse function which converts a packet in
141 canonical format to a no-op response structure.
144 These structures are defined in
145 <filename>lwres/lwres.h</filename>.
147 They are shown below.
149 <para><programlisting>
150 #define LWRES_OPCODE_NOOP 0x00000000U
153 <para><programlisting>
155 lwres_uint16_t datalength;
157 } lwres_nooprequest_t;
160 <para><programlisting>
162 lwres_uint16_t datalength;
164 } lwres_noopresponse_t;
168 Although the structures have different types, they are identical.
169 This is because the no-op opcode simply echos whatever data was sent:
170 the response is therefore identical to the request.
173 <para><function>lwres_nooprequest_render()</function>
174 uses resolver context <parameter>ctx</parameter> to convert
175 no-op request structure <parameter>req</parameter> to canonical
176 format. The packet header structure <parameter>pkt</parameter>
177 is initialised and transferred to buffer
178 <parameter>b</parameter>. The contents of
179 <parameter>*req</parameter> are then appended to the buffer in
181 <function>lwres_noopresponse_render()</function> performs the
182 same task, except it converts a no-op response structure
183 <type>lwres_noopresponse_t</type> to the lightweight resolver's
187 <para><function>lwres_nooprequest_parse()</function>
188 uses context <parameter>ctx</parameter> to convert the contents
189 of packet <parameter>pkt</parameter> to a
190 <type>lwres_nooprequest_t</type> structure. Buffer
191 <parameter>b</parameter> provides space to be used for storing
192 this structure. When the function succeeds, the resulting
193 <type>lwres_nooprequest_t</type> is made available through
194 <parameter>*structp</parameter>.
195 <function>lwres_noopresponse_parse()</function> offers the same
196 semantics as <function>lwres_nooprequest_parse()</function>
197 except it yields a <type>lwres_noopresponse_t</type> structure.
200 <para><function>lwres_noopresponse_free()</function>
201 and <function>lwres_nooprequest_free()</function> release the
202 memory in resolver context <parameter>ctx</parameter> that was
203 allocated to the <type>lwres_noopresponse_t</type> or
204 <type>lwres_nooprequest_t</type> structures referenced via
205 <parameter>structp</parameter>.
209 <refsection><info><title>RETURN VALUES</title></info>
212 The no-op opcode functions
213 <function>lwres_nooprequest_render()</function>,
215 <function>lwres_noopresponse_render()</function>
216 <function>lwres_nooprequest_parse()</function>
218 <function>lwres_noopresponse_parse()</function>
220 <errorcode>LWRES_R_SUCCESS</errorcode>
223 <errorcode>LWRES_R_NOMEMORY</errorcode>
224 if memory allocation fails.
225 <errorcode>LWRES_R_UNEXPECTEDEND</errorcode>
226 is returned if the available space in the buffer
227 <parameter>b</parameter>
228 is too small to accommodate the packet header or the
229 <type>lwres_nooprequest_t</type>
231 <type>lwres_noopresponse_t</type>
233 <function>lwres_nooprequest_parse()</function>
235 <function>lwres_noopresponse_parse()</function>
237 <errorcode>LWRES_R_UNEXPECTEDEND</errorcode>
238 if the buffer is not empty after decoding the received packet.
239 These functions will return
240 <errorcode>LWRES_R_FAILURE</errorcode>
242 <constant>pktflags</constant>
243 in the packet header structure
244 <type>lwres_lwpacket_t</type>
245 indicate that the packet is not a response to an earlier query.
248 <refsection><info><title>SEE ALSO</title></info>
251 <refentrytitle>lwres_packet</refentrytitle><manvolnum>3</manvolnum>