Merge from vendor branch LESS:
[dragonfly.git] / contrib / bind-9.3 / lib / lwres / man / lwres_packet.3
1 .\" Copyright (C) 2004, 2005 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.1.8.5 2005/10/13 02:33:54 marka Exp $
17 .\"
18 .hy 0
19 .ad l
20 .\" ** You probably do not want to edit this file directly **
21 .\" It was generated using the DocBook XSL Stylesheets (version 1.69.1).
22 .\" Instead of manually editing it, you probably should edit the DocBook XML
23 .\" source for it and then use the DocBook XSL Stylesheets to regenerate it.
24 .TH "LWRES_PACKET" "3" "Jun 30, 2000" "BIND9" "BIND9"
25 .\" disable hyphenation
26 .nh
27 .\" disable justification (adjust text to left margin only)
28 .ad l
29 .SH "NAME"
30 lwres_lwpacket_renderheader, lwres_lwpacket_parseheader \- lightweight resolver packet handling functions
31 .SH "SYNOPSIS"
32 .nf
33 #include <lwres/lwpacket.h>
34 .fi
35 .HP 43
36 \fBlwres_result_t\ \fBlwres_lwpacket_renderheader\fR\fR\fB(\fR\fBlwres_buffer_t\ *b\fR\fB, \fR\fBlwres_lwpacket_t\ *pkt\fR\fB);\fR
37 .HP 42
38 \fBlwres_result_t\ \fBlwres_lwpacket_parseheader\fR\fR\fB(\fR\fBlwres_buffer_t\ *b\fR\fB, \fR\fBlwres_lwpacket_t\ *pkt\fR\fB);\fR
39 .SH "DESCRIPTION"
40 .PP
41 These functions rely on a
42 \fBstruct lwres_lwpacket\fR
43 which is defined in
44 \fIlwres/lwpacket.h\fR.
45 .sp
46 .nf
47 typedef struct lwres_lwpacket lwres_lwpacket_t;
48 struct lwres_lwpacket {
49         lwres_uint32_t          length;
50         lwres_uint16_t          version;
51         lwres_uint16_t          pktflags;
52         lwres_uint32_t          serial;
53         lwres_uint32_t          opcode;
54         lwres_uint32_t          result;
55         lwres_uint32_t          recvlength;
56         lwres_uint16_t          authtype;
57         lwres_uint16_t          authlength;
58 };
59 .fi
60 .sp
61 .PP
62 The elements of this structure are:
63 .TP
64 \fBlength\fR
65 the overall packet length, including the entire packet header. This field is filled in by the lwres_gabn_*() and lwres_gnba_*() calls.
66 .TP
67 \fBversion\fR
68 the header format. There is currently only one format,
69 \fBLWRES_LWPACKETVERSION_0\fR. This field is filled in by the lwres_gabn_*() and lwres_gnba_*() calls.
70 .TP
71 \fBpktflags\fR
72 library\-defined flags for this packet: for instance whether the packet is a request or a reply. Flag values can be set, but not defined by the caller. This field is filled in by the application wit the exception of the LWRES_LWPACKETFLAG_RESPONSE bit, which is set by the library in the lwres_gabn_*() and lwres_gnba_*() calls.
73 .TP
74 \fBserial\fR
75 is set by the requestor and is returned in all replies. If two or more packets from the same source have the same serial number and are from the same source, they are assumed to be duplicates and the latter ones may be dropped. This field must be set by the application.
76 .TP
77 \fBopcode\fR
78 indicates the operation. Opcodes between 0x00000000 and 0x03ffffff are reserved for use by the lightweight resolver library. Opcodes between 0x04000000 and 0xffffffff are application defined. This field is filled in by the lwres_gabn_*() and lwres_gnba_*() calls.
79 .TP
80 \fBresult\fR
81 is only valid for replies. Results between 0x04000000 and 0xffffffff are application defined. Results between 0x00000000 and 0x03ffffff are reserved for library use. This field is filled in by the lwres_gabn_*() and lwres_gnba_*() calls.
82 .TP
83 \fBrecvlength\fR
84 is the maximum buffer size that the receiver can handle on requests and the size of the buffer needed to satisfy a request when the buffer is too large for replies. This field is supplied by the application.
85 .TP
86 \fBauthtype\fR
87 defines the packet level authentication that is used. Authorisation types between 0x1000 and 0xffff are application defined and types between 0x0000 and 0x0fff are reserved for library use. Currently these are not used and must be zero.
88 .TP
89 \fBauthlen\fR
90 gives the length of the authentication data. Since packet authentication is currently not used, this must be zero.
91 .PP
92 The following opcodes are currently defined:
93 .TP
94 \fBNOOP\fR
95 Success is always returned and the packet contents are echoed. The lwres_noop_*() functions should be used for this type.
96 .TP
97 \fBGETADDRSBYNAME\fR
98 returns all known addresses for a given name. The lwres_gabn_*() functions should be used for this type.
99 .TP
100 \fBGETNAMEBYADDR\fR
101 return the hostname for the given address. The lwres_gnba_*() functions should be used for this type.
102 .PP
103 \fBlwres_lwpacket_renderheader()\fR
104 transfers the contents of lightweight resolver packet structure
105 \fBlwres_lwpacket_t\fR\fI*pkt\fR
106 in network byte order to the lightweight resolver buffer,
107 \fI*b\fR.
108 .PP
109 \fBlwres_lwpacket_parseheader()\fR
110 performs the converse operation. It transfers data in network byte order from buffer
111 \fI*b\fR
112 to resolver packet
113 \fI*pkt\fR. The contents of the buffer
114 \fIb\fR
115 should correspond to a
116 \fBlwres_lwpacket_t\fR.
117 .SH "RETURN VALUES"
118 .PP
119 Successful calls to
120 \fBlwres_lwpacket_renderheader()\fR
121 and
122 \fBlwres_lwpacket_parseheader()\fR
123 return
124 \fBLWRES_R_SUCCESS\fR. If there is insufficient space to copy data between the buffer
125 \fI*b\fR
126 and lightweight resolver packet
127 \fI*pkt\fR
128 both functions return
129 \fBLWRES_R_UNEXPECTEDEND\fR.