]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/bind9/lib/lwres/man/lwres_packet.docbook
This commit was generated by cvs2svn to compensate for changes in r168463,
[FreeBSD/FreeBSD.git] / contrib / bind9 / lib / lwres / man / lwres_packet.docbook
1 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.0//EN"
2                "http://www.oasis-open.org/docbook/xml/4.0/docbookx.dtd"
3                [<!ENTITY mdash "&#8212;">]>
4 <!--
5  - Copyright (C) 2004, 2005  Internet Systems Consortium, Inc. ("ISC")
6  - Copyright (C) 2000, 2001  Internet Software Consortium.
7  -
8  - Permission to use, copy, modify, and 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_packet.docbook,v 1.6.206.3 2005/05/12 21:36:16 sra Exp $ -->
22
23 <refentry>
24
25 <refentryinfo>
26 <date>Jun 30, 2000</date>
27 </refentryinfo>
28
29 <refmeta>
30 <refentrytitle>lwres_packet</refentrytitle>
31 <manvolnum>3</manvolnum>
32 <refmiscinfo>BIND9</refmiscinfo>
33 </refmeta>
34
35   <docinfo>
36     <copyright>
37       <year>2004</year>
38       <year>2005</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_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 *b</paramdef>
61 <paramdef>lwres_lwpacket_t *pkt</paramdef>
62 </funcprototype>
63 <funcprototype>
64 <funcdef>
65 lwres_result_t
66 <function>lwres_lwpacket_parseheader</function></funcdef>
67 <paramdef>lwres_buffer_t *b</paramdef>
68 <paramdef>lwres_lwpacket_t *pkt</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
80 <programlisting>
81 typedef struct lwres_lwpacket lwres_lwpacket_t;
82
83 struct lwres_lwpacket {
84         lwres_uint32_t          length;
85         lwres_uint16_t          version;
86         lwres_uint16_t          pktflags;
87         lwres_uint32_t          serial;
88         lwres_uint32_t          opcode;
89         lwres_uint32_t          result;
90         lwres_uint32_t          recvlength;
91         lwres_uint16_t          authtype;
92         lwres_uint16_t          authlength;
93 };
94 </programlisting>
95 </para>
96
97 <para>
98 The elements of this structure are:
99 <variablelist>
100 <varlistentry><term><constant>length</constant></term>
101 <listitem>
102 <para>
103 the overall packet length, including the entire packet header.
104 This field is filled in by the lwres_gabn_*() and lwres_gnba_*()
105 calls.
106 </para></listitem></varlistentry>
107 <varlistentry><term><constant>version</constant></term>
108 <listitem>
109 <para>
110 the header format. There is currently only one format,
111 <type>LWRES_LWPACKETVERSION_0</type>.
112
113 This field is filled in by the lwres_gabn_*() and lwres_gnba_*()
114 calls.
115 </para></listitem></varlistentry>
116 <varlistentry><term><constant>pktflags</constant></term>
117 <listitem>
118 <para>
119 library-defined flags for this packet: for instance whether the packet
120 is a request or a reply. Flag values can be set, but not defined by
121 the caller.
122 This field is filled in by the application wit the exception of the
123 LWRES_LWPACKETFLAG_RESPONSE bit, which is set by the library in the
124 lwres_gabn_*() and lwres_gnba_*() calls.
125 </para></listitem></varlistentry>
126 <varlistentry><term><constant>serial</constant></term>
127 <listitem>
128 <para>
129 is set by the requestor and is returned in all replies. If two or more
130 packets from the same source have the same serial number and are from
131 the same source, they are assumed to be duplicates and the latter ones
132 may be dropped.
133 This field must be set by the application.
134 </para></listitem></varlistentry>
135 <varlistentry><term><constant>opcode</constant></term>
136 <listitem>
137 <para>
138 indicates the operation.
139 Opcodes between 0x00000000 and 0x03ffffff are
140 reserved for use by the lightweight resolver library. Opcodes between
141 0x04000000 and 0xffffffff are application defined.
142 This field is filled in by the lwres_gabn_*() and lwres_gnba_*()
143 calls.
144 </para></listitem></varlistentry>
145 <varlistentry><term><constant>result</constant></term>
146 <listitem>
147 <para>
148 is only valid for replies.
149 Results between 0x04000000 and 0xffffffff are application defined.
150 Results between 0x00000000 and 0x03ffffff are reserved for library use.
151 This field is filled in by the lwres_gabn_*() and lwres_gnba_*()
152 calls.
153 </para></listitem></varlistentry>
154 <varlistentry><term><constant>recvlength</constant></term>
155 <listitem>
156 <para>
157 is the maximum buffer size that the receiver can handle on requests
158 and the size of the buffer needed to satisfy a request when the buffer
159 is too large for replies.
160 This field is supplied by the application.
161 </para></listitem></varlistentry>
162 <varlistentry><term><constant>authtype</constant></term>
163 <listitem>
164 <para>
165 defines the packet level authentication that is used.
166 Authorisation types between 0x1000 and 0xffff are application defined
167 and types between 0x0000 and 0x0fff are reserved for library use.
168 Currently these are not used and must be zero.
169 </para></listitem></varlistentry>
170 <varlistentry><term><constant>authlen</constant></term>
171 <listitem>
172 <para>
173 gives the length of the authentication data.
174 Since packet authentication is currently not used, this must be zero.
175 </para></listitem></varlistentry>
176 </variablelist>
177 </para>
178 <para>
179 The following opcodes are currently defined:
180 <variablelist>
181 <varlistentry><term><constant>NOOP</constant></term>
182 <listitem>
183 <para>
184 Success is always returned and the packet contents are echoed.
185 The lwres_noop_*() functions should be used for this type.
186 </para></listitem></varlistentry>
187 <varlistentry><term><constant>GETADDRSBYNAME</constant></term>
188 <listitem>
189 <para>
190 returns all known addresses for a given name.
191 The lwres_gabn_*() functions should be used for this type.
192 </para></listitem></varlistentry>
193 <varlistentry><term><constant>GETNAMEBYADDR</constant></term>
194 <listitem>
195 <para>
196 return the hostname for the given address.
197 The lwres_gnba_*() functions should be used for this type.
198 </para></listitem></varlistentry>
199 </variablelist>
200 </para>
201
202 <para>
203 <function>lwres_lwpacket_renderheader()</function> transfers the
204 contents of lightweight resolver packet structure
205 <type>lwres_lwpacket_t</type> <parameter>*pkt</parameter> in network
206 byte order to the lightweight resolver buffer,
207 <parameter>*b</parameter>.
208 </para>
209
210 <para>
211 <function>lwres_lwpacket_parseheader()</function> performs the
212 converse operation.  It transfers data in network byte order from
213 buffer <parameter>*b</parameter> to resolver packet
214 <parameter>*pkt</parameter>.  The contents of the buffer
215 <parameter>b</parameter> should correspond to a
216 <type>lwres_lwpacket_t</type>.
217 </para>
218
219 </refsect1>
220
221 <refsect1>
222 <title>RETURN VALUES</title>
223 <para> Successful calls to
224 <function>lwres_lwpacket_renderheader()</function> and
225 <function>lwres_lwpacket_parseheader()</function> return
226 <errorcode>LWRES_R_SUCCESS</errorcode>.  If there is insufficient
227 space to copy data between the buffer <parameter>*b</parameter> and
228 lightweight resolver packet <parameter>*pkt</parameter> both functions
229 return <errorcode>LWRES_R_UNEXPECTEDEND</errorcode>.
230 </para>
231
232 </refsect1>
233 </refentry>