Merge from vendor branch CVS:
[dragonfly.git] / contrib / bind-9.2.4rc7 / lib / lwres / man / lwres_packet.3
1 .\" Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
2 .\" Copyright (C) 2000, 2001  Internet Software Consortium.
3 .\"
4 .\" Permission to use, copy, modify, and distribute this software for any
5 .\" purpose with or without fee is hereby granted, provided that the above
6 .\" copyright notice and this permission notice appear in all copies.
7 .\"
8 .\" THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
9 .\" REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
10 .\" AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
11 .\" INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12 .\" LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
13 .\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14 .\" PERFORMANCE OF THIS SOFTWARE.
15 .\"
16 .\" $Id: lwres_packet.3,v 1.15.2.2 2004/03/15 04:45:04 marka Exp $
17 .\"
18 .TH "LWRES_PACKET" "3" "Jun 30, 2000" "BIND9" ""
19 .SH NAME
20 lwres_lwpacket_renderheader, lwres_lwpacket_parseheader \- lightweight resolver packet handling functions
21 .SH SYNOPSIS
22 \fB#include <lwres/lwpacket.h>
23 .sp
24 .na
25 lwres_result_t
26 lwres_lwpacket_renderheader(lwres_buffer_t *b, lwres_lwpacket_t *pkt);
27 .ad
28 .sp
29 .na
30 lwres_result_t
31 lwres_lwpacket_parseheader(lwres_buffer_t *b, lwres_lwpacket_t *pkt);
32 .ad
33 \fR
34 .SH "DESCRIPTION"
35 .PP
36 These functions rely on a
37 \fBstruct lwres_lwpacket\fR
38 which is defined in
39 \fIlwres/lwpacket.h\fR.
40 .sp
41 .nf
42 typedef struct lwres_lwpacket lwres_lwpacket_t;
43
44 struct lwres_lwpacket {
45         lwres_uint32_t          length;
46         lwres_uint16_t          version;
47         lwres_uint16_t          pktflags;
48         lwres_uint32_t          serial;
49         lwres_uint32_t          opcode;
50         lwres_uint32_t          result;
51         lwres_uint32_t          recvlength;
52         lwres_uint16_t          authtype;
53         lwres_uint16_t          authlength;
54 };
55 .sp
56 .fi
57 .PP
58 The elements of this structure are:
59 .TP
60 \fBlength\fR
61 the overall packet length, including the entire packet header.
62 This field is filled in by the lwres_gabn_*() and lwres_gnba_*()
63 calls.
64 .TP
65 \fBversion\fR
66 the header format. There is currently only one format,
67 \fBLWRES_LWPACKETVERSION_0\fR.
68 This field is filled in by the lwres_gabn_*() and lwres_gnba_*()
69 calls.
70 .TP
71 \fBpktflags\fR
72 library-defined flags for this packet: for instance whether the packet
73 is a request or a reply. Flag values can be set, but not defined by
74 the caller.
75 This field is filled in by the application wit the exception of the
76 LWRES_LWPACKETFLAG_RESPONSE bit, which is set by the library in the
77 lwres_gabn_*() and lwres_gnba_*() calls.
78 .TP
79 \fBserial\fR
80 is set by the requestor and is returned in all replies. If two or more
81 packets from the same source have the same serial number and are from
82 the same source, they are assumed to be duplicates and the latter ones
83 may be dropped.
84 This field must be set by the application.
85 .TP
86 \fBopcode\fR
87 indicates the operation.
88 Opcodes between 0x00000000 and 0x03ffffff are
89 reserved for use by the lightweight resolver library. Opcodes between
90 0x04000000 and 0xffffffff are application defined.
91 This field is filled in by the lwres_gabn_*() and lwres_gnba_*()
92 calls.
93 .TP
94 \fBresult\fR
95 is only valid for replies.
96 Results between 0x04000000 and 0xffffffff are application defined.
97 Results between 0x00000000 and 0x03ffffff are reserved for library use.
98 This field is filled in by the lwres_gabn_*() and lwres_gnba_*()
99 calls.
100 .TP
101 \fBrecvlength\fR
102 is the maximum buffer size that the receiver can handle on requests
103 and the size of the buffer needed to satisfy a request when the buffer
104 is too large for replies.
105 This field is supplied by the application.
106 .TP
107 \fBauthtype\fR
108 defines the packet level authentication that is used.
109 Authorisation types between 0x1000 and 0xffff are application defined
110 and types between 0x0000 and 0x0fff are reserved for library use.
111 Currently these are not used and must be zero.
112 .TP
113 \fBauthlen\fR
114 gives the length of the authentication data.
115 Since packet authentication is currently not used, this must be zero.
116 .PP
117 The following opcodes are currently defined:
118 .TP
119 \fBNOOP\fR
120 Success is always returned and the packet contents are echoed.
121 The lwres_noop_*() functions should be used for this type.
122 .TP
123 \fBGETADDRSBYNAME\fR
124 returns all known addresses for a given name.
125 The lwres_gabn_*() functions should be used for this type.
126 .TP
127 \fBGETNAMEBYADDR\fR
128 return the hostname for the given address.
129 The lwres_gnba_*() functions should be used for this type.
130 .PP
131 \fBlwres_lwpacket_renderheader()\fR transfers the
132 contents of lightweight resolver packet structure
133 \fBlwres_lwpacket_t\fR \fI*pkt\fR in network
134 byte order to the lightweight resolver buffer,
135 \fI*b\fR.
136 .PP
137 \fBlwres_lwpacket_parseheader()\fR performs the
138 converse operation. It transfers data in network byte order from
139 buffer \fI*b\fR to resolver packet
140 \fI*pkt\fR. The contents of the buffer
141 \fIb\fR should correspond to a
142 \fBlwres_lwpacket_t\fR.
143 .SH "RETURN VALUES"
144 .PP
145 Successful calls to
146 \fBlwres_lwpacket_renderheader()\fR and
147 \fBlwres_lwpacket_parseheader()\fR return
148 LWRES_R_SUCCESS. If there is insufficient
149 space to copy data between the buffer \fI*b\fR and
150 lightweight resolver packet \fI*pkt\fR both functions
151 return LWRES_R_UNEXPECTEDEND.