2 - Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
3 - Copyright (C) 2001 Internet Software Consortium.
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.
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.
18 <!-- $Id: lwres_packet.html,v 1.8.2.2 2004/03/15 04:45:04 marka Exp $ -->
26 CONTENT="Modular DocBook HTML Stylesheet Version 1.73
47 >lwres_lwpacket_renderheader, lwres_lwpacket_parseheader -- lightweight resolver packet handling functions</DIV
49 CLASS="REFSYNOPSISDIV"
63 CLASS="FUNCSYNOPSISINFO"
64 >#include <lwres/lwpacket.h></PRE
70 lwres_lwpacket_renderheader</CODE
71 >(lwres_buffer_t *b, lwres_lwpacket_t *pkt);</CODE
78 lwres_lwpacket_parseheader</CODE
79 >(lwres_buffer_t *b, lwres_lwpacket_t *pkt);</CODE
93 >These functions rely on a
96 >struct lwres_lwpacket</SPAN
101 >lwres/lwpacket.h</TT
105 CLASS="PROGRAMLISTING"
106 >typedef struct lwres_lwpacket lwres_lwpacket_t;
108 struct lwres_lwpacket {
109 lwres_uint32_t length;
110 lwres_uint16_t version;
111 lwres_uint16_t pktflags;
112 lwres_uint32_t serial;
113 lwres_uint32_t opcode;
114 lwres_uint32_t result;
115 lwres_uint32_t recvlength;
116 lwres_uint16_t authtype;
117 lwres_uint16_t authlength;
121 >The elements of this structure are:
134 >the overall packet length, including the entire packet header.
135 This field is filled in by the lwres_gabn_*() and lwres_gnba_*()
145 >the header format. There is currently only one format,
148 >LWRES_LWPACKETVERSION_0</SPAN
151 This field is filled in by the lwres_gabn_*() and lwres_gnba_*()
161 >library-defined flags for this packet: for instance whether the packet
162 is a request or a reply. Flag values can be set, but not defined by
164 This field is filled in by the application wit the exception of the
165 LWRES_LWPACKETFLAG_RESPONSE bit, which is set by the library in the
166 lwres_gabn_*() and lwres_gnba_*() calls.</P
175 >is set by the requestor and is returned in all replies. If two or more
176 packets from the same source have the same serial number and are from
177 the same source, they are assumed to be duplicates and the latter ones
179 This field must be set by the application.</P
188 >indicates the operation.
189 Opcodes between 0x00000000 and 0x03ffffff are
190 reserved for use by the lightweight resolver library. Opcodes between
191 0x04000000 and 0xffffffff are application defined.
192 This field is filled in by the lwres_gabn_*() and lwres_gnba_*()
202 >is only valid for replies.
203 Results between 0x04000000 and 0xffffffff are application defined.
204 Results between 0x00000000 and 0x03ffffff are reserved for library use.
205 This field is filled in by the lwres_gabn_*() and lwres_gnba_*()
215 >is the maximum buffer size that the receiver can handle on requests
216 and the size of the buffer needed to satisfy a request when the buffer
217 is too large for replies.
218 This field is supplied by the application.</P
227 >defines the packet level authentication that is used.
228 Authorisation types between 0x1000 and 0xffff are application defined
229 and types between 0x0000 and 0x0fff are reserved for library use.
230 Currently these are not used and must be zero.</P
239 >gives the length of the authentication data.
240 Since packet authentication is currently not used, this must be zero.</P
246 >The following opcodes are currently defined:
259 >Success is always returned and the packet contents are echoed.
260 The lwres_noop_*() functions should be used for this type.</P
269 >returns all known addresses for a given name.
270 The lwres_gabn_*() functions should be used for this type.</P
279 >return the hostname for the given address.
280 The lwres_gnba_*() functions should be used for this type.</P
288 >lwres_lwpacket_renderheader()</TT
290 contents of lightweight resolver packet structure
293 >lwres_lwpacket_t</SPAN
300 byte order to the lightweight resolver buffer,
310 >lwres_lwpacket_parseheader()</TT
312 converse operation. It transfers data in network byte order from
324 >. The contents of the buffer
330 > should correspond to a
333 >lwres_lwpacket_t</SPAN
344 > Successful calls to
347 >lwres_lwpacket_renderheader()</TT
351 >lwres_lwpacket_parseheader()</TT
355 >LWRES_R_SUCCESS</SPAN
356 >. If there is insufficient
357 space to copy data between the buffer <TT
363 lightweight resolver packet <TT
371 >LWRES_R_UNEXPECTEDEND</SPAN