Remove building with NOCRYPTO option
[minix.git] / external / bsd / bind / dist / lib / lwres / man / lwres_packet.docbook
blobb9462635023be1d87293bc94555a1b9507c94b66
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, 2014  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 -->
21 <refentry>
23   <refentryinfo>
24     <date>June 18, 2007</date>
25   </refentryinfo>
27   <refmeta>
28     <refentrytitle>lwres_packet</refentrytitle>
29     <manvolnum>3</manvolnum>
30     <refmiscinfo>BIND9</refmiscinfo>
31   </refmeta>
33   <docinfo>
34     <copyright>
35       <year>2004</year>
36       <year>2005</year>
37       <year>2007</year>
38       <year>2014</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>
48   <refnamediv>
49     <refname>lwres_lwpacket_renderheader</refname>
50     <refname>lwres_lwpacket_parseheader</refname>
51     <refpurpose>lightweight resolver packet handling functions</refpurpose>
52   </refnamediv>
53   <refsynopsisdiv>
54     <funcsynopsis>
55 <funcsynopsisinfo>#include &lt;lwres/lwpacket.h&gt;</funcsynopsisinfo>
56 <funcprototype>
57         <funcdef>
58 lwres_result_t
59 <function>lwres_lwpacket_renderheader</function></funcdef>
60         <paramdef>lwres_buffer_t *<parameter>b</parameter></paramdef>
61         <paramdef>lwres_lwpacket_t *<parameter>pkt</parameter></paramdef>
62         </funcprototype>
63 <funcprototype>
64         <funcdef>
65 lwres_result_t
66 <function>lwres_lwpacket_parseheader</function></funcdef>
67         <paramdef>lwres_buffer_t *<parameter>b</parameter></paramdef>
68         <paramdef>lwres_lwpacket_t *<parameter>pkt</parameter></paramdef>
69       </funcprototype>
70 </funcsynopsis>
71   </refsynopsisdiv>
72   <refsect1>
73     <title>DESCRIPTION</title>
74     <para>
75       These functions rely on a
76       <type>struct lwres_lwpacket</type>
77       which is defined in
78       <filename>lwres/lwpacket.h</filename>.
79     </para>
81     <para><programlisting>
82 typedef struct lwres_lwpacket lwres_lwpacket_t;
83       </programlisting>
84     </para>
85     <para><programlisting>
86 struct lwres_lwpacket {
87         lwres_uint32_t          length;
88         lwres_uint16_t          version;
89         lwres_uint16_t          pktflags;
90         lwres_uint32_t          serial;
91         lwres_uint32_t          opcode;
92         lwres_uint32_t          result;
93         lwres_uint32_t          recvlength;
94         lwres_uint16_t          authtype;
95         lwres_uint16_t          authlength;
97 </programlisting>
98     </para>
100     <para>
101       The elements of this structure are:
102       <variablelist>
103         <varlistentry>
104           <term><constant>length</constant></term>
105           <listitem>
106             <para>
107               the overall packet length, including the entire packet header.
108               This field is filled in by the lwres_gabn_*() and lwres_gnba_*()
109               calls.
110             </para>
111           </listitem>
112         </varlistentry>
113         <varlistentry>
114           <term><constant>version</constant></term>
115           <listitem>
116             <para>
117               the header format. There is currently only one format,
118               <type>LWRES_LWPACKETVERSION_0</type>.
120               This field is filled in by the lwres_gabn_*() and lwres_gnba_*()
121               calls.
122             </para>
123           </listitem>
124         </varlistentry>
125         <varlistentry>
126           <term><constant>pktflags</constant></term>
127           <listitem>
128             <para>
129               library-defined flags for this packet: for instance whether the
130               packet
131               is a request or a reply. Flag values can be set, but not defined
132               by
133               the caller.
134               This field is filled in by the application wit the exception of
135               the
136               LWRES_LWPACKETFLAG_RESPONSE bit, which is set by the library in
137               the
138               lwres_gabn_*() and lwres_gnba_*() calls.
139             </para>
140           </listitem>
141         </varlistentry>
142         <varlistentry>
143           <term><constant>serial</constant></term>
144           <listitem>
145             <para>
146               is set by the requestor and is returned in all replies. If two
147               or more
148               packets from the same source have the same serial number and are
149               from
150               the same source, they are assumed to be duplicates and the
151               latter ones
152               may be dropped.
153               This field must be set by the application.
154             </para>
155           </listitem>
156         </varlistentry>
157         <varlistentry>
158           <term><constant>opcode</constant></term>
159           <listitem>
160             <para>
161               indicates the operation.
162               Opcodes between 0x00000000 and 0x03ffffff are
163               reserved for use by the lightweight resolver library. Opcodes
164               between
165               0x04000000 and 0xffffffff are application defined.
166               This field is filled in by the lwres_gabn_*() and lwres_gnba_*()
167               calls.
168             </para>
169           </listitem>
170         </varlistentry>
171         <varlistentry>
172           <term><constant>result</constant></term>
173           <listitem>
174             <para>
175               is only valid for replies.
176               Results between 0x04000000 and 0xffffffff are application
177               defined.
178               Results between 0x00000000 and 0x03ffffff are reserved for
179               library use.
180               This field is filled in by the lwres_gabn_*() and lwres_gnba_*()
181               calls.
182             </para>
183           </listitem>
184         </varlistentry>
185         <varlistentry>
186           <term><constant>recvlength</constant></term>
187           <listitem>
188             <para>
189               is the maximum buffer size that the receiver can handle on
190               requests
191               and the size of the buffer needed to satisfy a request when the
192               buffer
193               is too large for replies.
194               This field is supplied by the application.
195             </para>
196           </listitem>
197         </varlistentry>
198         <varlistentry>
199           <term><constant>authtype</constant></term>
200           <listitem>
201             <para>
202               defines the packet level authentication that is used.
203               Authorisation types between 0x1000 and 0xffff are application
204               defined
205               and types between 0x0000 and 0x0fff are reserved for library
206               use.
207               Currently these are not used and must be zero.
208             </para>
209           </listitem>
210         </varlistentry>
211         <varlistentry>
212           <term><constant>authlen</constant></term>
213           <listitem>
214             <para>
215               gives the length of the authentication data.
216               Since packet authentication is currently not used, this must be
217               zero.
218             </para>
219           </listitem>
220         </varlistentry>
221       </variablelist>
222     </para>
223     <para>
224       The following opcodes are currently defined:
225       <variablelist>
226         <varlistentry>
227           <term><constant>NOOP</constant></term>
228           <listitem>
229             <para>
230               Success is always returned and the packet contents are echoed.
231               The lwres_noop_*() functions should be used for this type.
232             </para>
233           </listitem>
234         </varlistentry>
235         <varlistentry>
236           <term><constant>GETADDRSBYNAME</constant></term>
237           <listitem>
238             <para>
239               returns all known addresses for a given name.
240               The lwres_gabn_*() functions should be used for this type.
241             </para>
242           </listitem>
243         </varlistentry>
244         <varlistentry>
245           <term><constant>GETNAMEBYADDR</constant></term>
246           <listitem>
247             <para>
248               return the hostname for the given address.
249               The lwres_gnba_*() functions should be used for this type.
250             </para>
251           </listitem>
252         </varlistentry>
253       </variablelist>
254     </para>
256     <para><function>lwres_lwpacket_renderheader()</function>
257       transfers the contents of lightweight resolver packet structure
258       <type>lwres_lwpacket_t</type> <parameter>*pkt</parameter> in
259       network byte order to the lightweight resolver buffer,
260       <parameter>*b</parameter>.
261     </para>
263     <para><function>lwres_lwpacket_parseheader()</function>
264       performs the converse operation.  It transfers data in network
265       byte order from buffer <parameter>*b</parameter> to resolver
266       packet <parameter>*pkt</parameter>.  The contents of the buffer
267       <parameter>b</parameter> should correspond to a
268       <type>lwres_lwpacket_t</type>.
269     </para>
271   </refsect1>
273   <refsect1>
274     <title>RETURN VALUES</title>
275     <para>
276       Successful calls to
277       <function>lwres_lwpacket_renderheader()</function> and
278       <function>lwres_lwpacket_parseheader()</function> return
279       <errorcode>LWRES_R_SUCCESS</errorcode>.  If there is insufficient
280       space to copy data between the buffer <parameter>*b</parameter> and
281       lightweight resolver packet <parameter>*pkt</parameter> both
282       functions
283       return <errorcode>LWRES_R_UNEXPECTEDEND</errorcode>.
284     </para>
286   </refsect1>
287 </refentry><!--
288  - Local variables:
289  - mode: sgml
290  - End: