]> CyberLeo.Net >> Repos - FreeBSD/releng/8.1.git/blob - contrib/bind9/lib/lwres/man/lwres_noop.docbook
Copy stable/8 to releng/8.1 in preparation for 8.1-RC1.
[FreeBSD/releng/8.1.git] / contrib / bind9 / lib / lwres / man / lwres_noop.docbook
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 "&#8212;">]>
4 <!--
5  - Copyright (C) 2004, 2005, 2007  Internet Systems Consortium, Inc. ("ISC")
6  - Copyright (C) 2000, 2001  Internet Software Consortium.
7  -
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.
11  -
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.
19 -->
20
21 <!-- $Id: lwres_noop.docbook,v 1.11 2007/06/18 23:47:51 tbox Exp $ -->
22 <refentry>
23
24   <refentryinfo>
25     <date>Jun 30, 2000</date>
26   </refentryinfo>
27
28   <refmeta>
29     <refentrytitle>lwres_noop</refentrytitle>
30     <manvolnum>3</manvolnum>
31     <refmiscinfo>BIND9</refmiscinfo>
32   </refmeta>
33
34   <docinfo>
35     <copyright>
36       <year>2004</year>
37       <year>2005</year>
38       <year>2007</year>
39       <holder>Internet Systems Consortium, Inc. ("ISC")</holder>
40     </copyright>
41     <copyright>
42       <year>2000</year>
43       <year>2001</year>
44       <holder>Internet Software Consortium.</holder>
45     </copyright>
46   </docinfo>
47
48   <refnamediv>
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>
56   </refnamediv>
57   <refsynopsisdiv>
58     <funcsynopsis>
59 <funcsynopsisinfo>
60 #include &lt;lwres/lwres.h&gt;</funcsynopsisinfo>
61 <funcprototype>
62         <funcdef>
63 lwres_result_t
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>
69         </funcprototype>
70 <funcprototype>
71         <funcdef>
72 lwres_result_t
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>
78         </funcprototype>
79 <funcprototype>
80         <funcdef>
81 lwres_result_t
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>
87         </funcprototype>
88 <funcprototype>
89         <funcdef>
90 lwres_result_t
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>
96         </funcprototype>
97 <funcprototype>
98         <funcdef>
99 void
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>
103         </funcprototype>
104 <funcprototype>
105         <funcdef>
106 void
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>
110       </funcprototype>
111 </funcsynopsis>
112   </refsynopsisdiv>
113   <refsect1>
114     <title>DESCRIPTION</title>
115     <para>
116       These are low-level routines for creating and parsing
117       lightweight resolver no-op request and response messages.
118     </para>
119     <para>
120       The no-op message is analogous to a <command>ping</command>
121       packet:
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
124       operational or not.
125     </para>
126     <para>
127       There are four main functions for the no-op opcode.
128       One render function converts a no-op request structure &mdash;
129       <type>lwres_nooprequest_t</type> &mdash;
130       to the lighweight 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 &mdash;
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.
138     </para>
139     <para>
140       These structures are defined in
141       <filename>lwres/lwres.h</filename>.
142
143       They are shown below.
144     </para>
145     <para><programlisting>
146 #define LWRES_OPCODE_NOOP       0x00000000U
147 </programlisting>
148     </para>
149     <para><programlisting>
150 typedef struct {
151         lwres_uint16_t  datalength;
152         unsigned char   *data;
153 } lwres_nooprequest_t;
154 </programlisting>
155     </para>
156     <para><programlisting>
157 typedef struct {
158         lwres_uint16_t  datalength;
159         unsigned char   *data;
160 } lwres_noopresponse_t;
161 </programlisting>
162     </para>
163     <para>
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.
167     </para>
168
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
176       canonical format.
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
180       canonical format.
181     </para>
182
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.
194     </para>
195
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>.
202     </para>
203
204   </refsect1>
205   <refsect1>
206     <title>RETURN VALUES</title>
207     <para>
208       The no-op opcode functions
209       <function>lwres_nooprequest_render()</function>,
210
211       <function>lwres_noopresponse_render()</function>
212       <function>lwres_nooprequest_parse()</function>
213       and
214       <function>lwres_noopresponse_parse()</function>
215       all return
216       <errorcode>LWRES_R_SUCCESS</errorcode>
217       on success.
218       They return
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>
226       and
227       <type>lwres_noopresponse_t</type>
228       structures.
229       <function>lwres_nooprequest_parse()</function>
230       and
231       <function>lwres_noopresponse_parse()</function>
232       will return
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>
237       if
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.
242     </para>
243   </refsect1>
244   <refsect1>
245     <title>SEE ALSO</title>
246     <para><citerefentry>
247         <refentrytitle>lwres_packet</refentrytitle><manvolnum>3</manvolnum>
248       </citerefentry>
249     </para>
250   </refsect1>
251 </refentry><!--
252  - Local variables:
253  - mode: sgml
254  - End:
255 -->