summaryrefslogtreecommitdiffstats
path: root/lib/lwres/man/lwres_packet.3
blob: d13f10726e084e6bb50a85ece6242b2d16017b0a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
.\" Copyright (C) 2000, 2001, 2004, 2005, 2007, 2014-2016, 2018, 2019 Internet Systems Consortium, Inc. ("ISC")
.\" 
.\" This Source Code Form is subject to the terms of the Mozilla Public
.\" License, v. 2.0. If a copy of the MPL was not distributed with this
.\" file, You can obtain one at http://mozilla.org/MPL/2.0/.
.\"
.hy 0
.ad l
'\" t
.\"     Title: lwres_packet
.\"    Author: 
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
.\"      Date: 2007-06-18
.\"    Manual: BIND9
.\"    Source: ISC
.\"  Language: English
.\"
.TH "LWRES_PACKET" "3" "2007\-06\-18" "ISC" "BIND9"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
lwres_lwpacket_renderheader, lwres_lwpacket_parseheader \- lightweight resolver packet handling functions
.SH "SYNOPSIS"
.sp
.ft B
.nf
#include <lwres/lwpacket\&.h>
.fi
.ft
.HP \w'lwres_result_t\ lwres_lwpacket_renderheader('u
.BI "lwres_result_t lwres_lwpacket_renderheader(lwres_buffer_t\ *" "b" ", lwres_lwpacket_t\ *" "pkt" ");"
.HP \w'lwres_result_t\ lwres_lwpacket_parseheader('u
.BI "lwres_result_t lwres_lwpacket_parseheader(lwres_buffer_t\ *" "b" ", lwres_lwpacket_t\ *" "pkt" ");"
.SH "DESCRIPTION"
.PP
These functions rely on a
\fBstruct lwres_lwpacket\fR
which is defined in
lwres/lwpacket\&.h\&.
.PP
.if n \{\
.RS 4
.\}
.nf
typedef struct lwres_lwpacket lwres_lwpacket_t;
.fi
.if n \{\
.RE
.\}
.PP
.if n \{\
.RS 4
.\}
.nf
struct lwres_lwpacket {
        uint32_t          length;
        uint16_t          version;
        uint16_t          pktflags;
        uint32_t          serial;
        uint32_t          opcode;
        uint32_t          result;
        uint32_t          recvlength;
        uint16_t          authtype;
        uint16_t          authlength;
};
.fi
.if n \{\
.RE
.\}
.PP
The elements of this structure are:
.PP
\fBlength\fR
.RS 4
the overall packet length, including the entire packet header\&. This field is filled in by the lwres_gabn_*() and lwres_gnba_*() calls\&.
.RE
.PP
\fBversion\fR
.RS 4
the header format\&. There is currently only one format,
\fBLWRES_LWPACKETVERSION_0\fR\&. This field is filled in by the lwres_gabn_*() and lwres_gnba_*() calls\&.
.RE
.PP
\fBpktflags\fR
.RS 4
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\&.
.RE
.PP
\fBserial\fR
.RS 4
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\&.
.RE
.PP
\fBopcode\fR
.RS 4
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\&.
.RE
.PP
\fBresult\fR
.RS 4
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\&.
.RE
.PP
\fBrecvlength\fR
.RS 4
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\&.
.RE
.PP
\fBauthtype\fR
.RS 4
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\&.
.RE
.PP
\fBauthlen\fR
.RS 4
gives the length of the authentication data\&. Since packet authentication is currently not used, this must be zero\&.
.RE
.PP
The following opcodes are currently defined:
.PP
\fBNOOP\fR
.RS 4
Success is always returned and the packet contents are echoed\&. The lwres_noop_*() functions should be used for this type\&.
.RE
.PP
\fBGETADDRSBYNAME\fR
.RS 4
returns all known addresses for a given name\&. The lwres_gabn_*() functions should be used for this type\&.
.RE
.PP
\fBGETNAMEBYADDR\fR
.RS 4
return the hostname for the given address\&. The lwres_gnba_*() functions should be used for this type\&.
.RE
.PP
\fBlwres_lwpacket_renderheader()\fR
transfers the contents of lightweight resolver packet structure
\fBlwres_lwpacket_t\fR\fI*pkt\fR
in network byte order to the lightweight resolver buffer,
\fI*b\fR\&.
.PP
\fBlwres_lwpacket_parseheader()\fR
performs the converse operation\&. It transfers data in network byte order from buffer
\fI*b\fR
to resolver packet
\fI*pkt\fR\&. The contents of the buffer
\fIb\fR
should correspond to a
\fBlwres_lwpacket_t\fR\&.
.SH "RETURN VALUES"
.PP
Successful calls to
\fBlwres_lwpacket_renderheader()\fR
and
\fBlwres_lwpacket_parseheader()\fR
return
\fBLWRES_R_SUCCESS\fR\&. If there is insufficient space to copy data between the buffer
\fI*b\fR
and lightweight resolver packet
\fI*pkt\fR
both functions return
\fBLWRES_R_UNEXPECTEDEND\fR\&.
.SH "AUTHOR"
.PP
\fBInternet Systems Consortium, Inc\&.\fR
.SH "COPYRIGHT"
.br
Copyright \(co 2000, 2001, 2004, 2005, 2007, 2014-2016, 2018, 2019 Internet Systems Consortium, Inc. ("ISC")
.br