Merge branch 'vendor/GMP' into gcc441
[dragonfly.git] / contrib / bind-9.3 / lib / lwres / man / lwres_packet.html
1 <!--
2  - Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC")
3  - Copyright (C) 2000, 2001 Internet Software Consortium.
4  - 
5  - Permission to use, copy, modify, and distribute this software for any
6  - purpose with or without fee is hereby granted, provided that the above
7  - copyright notice and this permission notice appear in all copies.
8  - 
9  - THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10  - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11  - AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12  - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13  - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14  - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15  - PERFORMANCE OF THIS SOFTWARE.
16 -->
17 <!-- $Id: lwres_packet.html,v 1.8.2.1.4.12 2006/06/29 13:02:31 marka Exp $ -->
18 <html>
19 <head>
20 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
21 <title>lwres_packet</title>
22 <meta name="generator" content="DocBook XSL Stylesheets V1.70.1">
23 </head>
24 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en">
25 <a name="id2482688"></a><div class="titlepage"></div>
26 <div class="refnamediv">
27 <h2>Name</h2>
28 <p>lwres_lwpacket_renderheader, lwres_lwpacket_parseheader &#8212; lightweight resolver packet handling functions</p>
29 </div>
30 <div class="refsynopsisdiv">
31 <h2>Synopsis</h2>
32 <div class="funcsynopsis">
33 <pre class="funcsynopsisinfo">#include &lt;lwres/lwpacket.h&gt;</pre>
34 <table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em">
35 <tr>
36 <td><code class="funcdef">
37 lwres_result_t
38 <b class="fsfunc">lwres_lwpacket_renderheader</b>(</code></td>
39 <td> </td>
40 <td>, </td>
41 </tr>
42 <tr>
43 <td> </td>
44 <td> </td>
45 <td>, </td>
46 </tr>
47 <tr>
48 <td> </td>
49 <td> </td>
50 <td>
51 <code>)</code>;</td>
52 </tr>
53 </table>
54 <table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0">
55 <tr>
56 <td><code class="funcdef">
57 lwres_result_t
58 <b class="fsfunc">lwres_lwpacket_parseheader</b>(</code></td>
59 <td> </td>
60 <td>, </td>
61 </tr>
62 <tr>
63 <td> </td>
64 <td> </td>
65 <td>, </td>
66 </tr>
67 <tr>
68 <td> </td>
69 <td> </td>
70 <td>
71 <code>)</code>;</td>
72 </tr>
73 </table>
74 </div>
75 </div>
76 <div class="refsect1" lang="en">
77 <a name="id2549430"></a><h2>DESCRIPTION</h2>
78 <p>
79 These functions rely on a
80 <span class="type">struct lwres_lwpacket</span>
81 which is defined in
82 <code class="filename">lwres/lwpacket.h</code>.
83
84 </p>
85 <pre class="programlisting">
86 typedef struct lwres_lwpacket lwres_lwpacket_t;
87
88 struct lwres_lwpacket {
89         lwres_uint32_t          length;
90         lwres_uint16_t          version;
91         lwres_uint16_t          pktflags;
92         lwres_uint32_t          serial;
93         lwres_uint32_t          opcode;
94         lwres_uint32_t          result;
95         lwres_uint32_t          recvlength;
96         lwres_uint16_t          authtype;
97         lwres_uint16_t          authlength;
98 };
99 </pre>
100 <p>
101 </p>
102 <p>
103 The elements of this structure are:
104 </p>
105 <div class="variablelist"><dl>
106 <dt><span class="term"><code class="constant">length</code></span></dt>
107 <dd><p>
108 the overall packet length, including the entire packet header.
109 This field is filled in by the lwres_gabn_*() and lwres_gnba_*()
110 calls.
111 </p></dd>
112 <dt><span class="term"><code class="constant">version</code></span></dt>
113 <dd><p>
114 the header format. There is currently only one format,
115 <span class="type">LWRES_LWPACKETVERSION_0</span>.
116
117 This field is filled in by the lwres_gabn_*() and lwres_gnba_*()
118 calls.
119 </p></dd>
120 <dt><span class="term"><code class="constant">pktflags</code></span></dt>
121 <dd><p>
122 library-defined flags for this packet: for instance whether the packet
123 is a request or a reply. Flag values can be set, but not defined by
124 the caller.
125 This field is filled in by the application wit the exception of the
126 LWRES_LWPACKETFLAG_RESPONSE bit, which is set by the library in the
127 lwres_gabn_*() and lwres_gnba_*() calls.
128 </p></dd>
129 <dt><span class="term"><code class="constant">serial</code></span></dt>
130 <dd><p>
131 is set by the requestor and is returned in all replies. If two or more
132 packets from the same source have the same serial number and are from
133 the same source, they are assumed to be duplicates and the latter ones
134 may be dropped.
135 This field must be set by the application.
136 </p></dd>
137 <dt><span class="term"><code class="constant">opcode</code></span></dt>
138 <dd><p>
139 indicates the operation.
140 Opcodes between 0x00000000 and 0x03ffffff are
141 reserved for use by the lightweight resolver library. Opcodes between
142 0x04000000 and 0xffffffff are application defined.
143 This field is filled in by the lwres_gabn_*() and lwres_gnba_*()
144 calls.
145 </p></dd>
146 <dt><span class="term"><code class="constant">result</code></span></dt>
147 <dd><p>
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 </p></dd>
154 <dt><span class="term"><code class="constant">recvlength</code></span></dt>
155 <dd><p>
156 is the maximum buffer size that the receiver can handle on requests
157 and the size of the buffer needed to satisfy a request when the buffer
158 is too large for replies.
159 This field is supplied by the application.
160 </p></dd>
161 <dt><span class="term"><code class="constant">authtype</code></span></dt>
162 <dd><p>
163 defines the packet level authentication that is used.
164 Authorisation types between 0x1000 and 0xffff are application defined
165 and types between 0x0000 and 0x0fff are reserved for library use.
166 Currently these are not used and must be zero.
167 </p></dd>
168 <dt><span class="term"><code class="constant">authlen</code></span></dt>
169 <dd><p>
170 gives the length of the authentication data.
171 Since packet authentication is currently not used, this must be zero.
172 </p></dd>
173 </dl></div>
174 <p>
175 </p>
176 <p>
177 The following opcodes are currently defined:
178 </p>
179 <div class="variablelist"><dl>
180 <dt><span class="term"><code class="constant">NOOP</code></span></dt>
181 <dd><p>
182 Success is always returned and the packet contents are echoed.
183 The lwres_noop_*() functions should be used for this type.
184 </p></dd>
185 <dt><span class="term"><code class="constant">GETADDRSBYNAME</code></span></dt>
186 <dd><p>
187 returns all known addresses for a given name.
188 The lwres_gabn_*() functions should be used for this type.
189 </p></dd>
190 <dt><span class="term"><code class="constant">GETNAMEBYADDR</code></span></dt>
191 <dd><p>
192 return the hostname for the given address.
193 The lwres_gnba_*() functions should be used for this type.
194 </p></dd>
195 </dl></div>
196 <p>
197 </p>
198 <p>
199 <code class="function">lwres_lwpacket_renderheader()</code> transfers the
200 contents of lightweight resolver packet structure
201 <span class="type">lwres_lwpacket_t</span> <em class="parameter"><code>*pkt</code></em> in network
202 byte order to the lightweight resolver buffer,
203 <em class="parameter"><code>*b</code></em>.
204 </p>
205 <p>
206 <code class="function">lwres_lwpacket_parseheader()</code> performs the
207 converse operation.  It transfers data in network byte order from
208 buffer <em class="parameter"><code>*b</code></em> to resolver packet
209 <em class="parameter"><code>*pkt</code></em>.  The contents of the buffer
210 <em class="parameter"><code>b</code></em> should correspond to a
211 <span class="type">lwres_lwpacket_t</span>.
212 </p>
213 </div>
214 <div class="refsect1" lang="en">
215 <a name="id2549769"></a><h2>RETURN VALUES</h2>
216 <p> Successful calls to
217 <code class="function">lwres_lwpacket_renderheader()</code> and
218 <code class="function">lwres_lwpacket_parseheader()</code> return
219 <span class="errorcode">LWRES_R_SUCCESS</span>.  If there is insufficient
220 space to copy data between the buffer <em class="parameter"><code>*b</code></em> and
221 lightweight resolver packet <em class="parameter"><code>*pkt</code></em> both functions
222 return <span class="errorcode">LWRES_R_UNEXPECTEDEND</span>.
223 </p>
224 </div>
225 </div></body>
226 </html>