1LWRES_PACKET(3)                      BIND9                     LWRES_PACKET(3)
2
3
4

NAME

6       lwres_lwpacket_renderheader, lwres_lwpacket_parseheader - lightweight
7       resolver packet handling functions
8

SYNOPSIS

10       #include <lwres/lwpacket.h>
11
12       lwres_result_t lwres_lwpacket_renderheader(lwres_buffer_t *b,
13                                                  lwres_lwpacket_t *pkt);
14
15       lwres_result_t lwres_lwpacket_parseheader(lwres_buffer_t *b,
16                                                 lwres_lwpacket_t *pkt);
17

DESCRIPTION

19       These functions rely on a struct lwres_lwpacket which is defined in
20       lwres/lwpacket.h.
21
22           typedef struct lwres_lwpacket lwres_lwpacket_t;
23
24           struct lwres_lwpacket {
25                   lwres_uint32_t          length;
26                   lwres_uint16_t          version;
27                   lwres_uint16_t          pktflags;
28                   lwres_uint32_t          serial;
29                   lwres_uint32_t          opcode;
30                   lwres_uint32_t          result;
31                   lwres_uint32_t          recvlength;
32                   lwres_uint16_t          authtype;
33                   lwres_uint16_t          authlength;
34           };
35
36       The elements of this structure are:
37
38       length
39           the overall packet length, including the entire packet header. This
40           field is filled in by the lwres_gabn_*() and lwres_gnba_*() calls.
41
42       version
43           the header format. There is currently only one format,
44           LWRES_LWPACKETVERSION_0. This field is filled in by the
45           lwres_gabn_*() and lwres_gnba_*() calls.
46
47       pktflags
48           library-defined flags for this packet: for instance whether the
49           packet is a request or a reply. Flag values can be set, but not
50           defined by the caller. This field is filled in by the application
51           wit the exception of the LWRES_LWPACKETFLAG_RESPONSE bit, which is
52           set by the library in the lwres_gabn_*() and lwres_gnba_*() calls.
53
54       serial
55           is set by the requestor and is returned in all replies. If two or
56           more packets from the same source have the same serial number and
57           are from the same source, they are assumed to be duplicates and the
58           latter ones may be dropped. This field must be set by the
59           application.
60
61       opcode
62           indicates the operation. Opcodes between 0x00000000 and 0x03ffffff
63           are reserved for use by the lightweight resolver library. Opcodes
64           between 0x04000000 and 0xffffffff are application defined. This
65           field is filled in by the lwres_gabn_*() and lwres_gnba_*() calls.
66
67       result
68           is only valid for replies. Results between 0x04000000 and
69           0xffffffff are application defined. Results between 0x00000000 and
70           0x03ffffff are reserved for library use. This field is filled in by
71           the lwres_gabn_*() and lwres_gnba_*() calls.
72
73       recvlength
74           is the maximum buffer size that the receiver can handle on requests
75           and the size of the buffer needed to satisfy a request when the
76           buffer is too large for replies. This field is supplied by the
77           application.
78
79       authtype
80           defines the packet level authentication that is used. Authorisation
81           types between 0x1000 and 0xffff are application defined and types
82           between 0x0000 and 0x0fff are reserved for library use. Currently
83           these are not used and must be zero.
84
85       authlen
86           gives the length of the authentication data. Since packet
87           authentication is currently not used, this must be zero.
88
89       The following opcodes are currently defined:
90
91       NOOP
92           Success is always returned and the packet contents are echoed. The
93           lwres_noop_*() functions should be used for this type.
94
95       GETADDRSBYNAME
96           returns all known addresses for a given name. The lwres_gabn_*()
97           functions should be used for this type.
98
99       GETNAMEBYADDR
100           return the hostname for the given address. The lwres_gnba_*()
101           functions should be used for this type.
102
103       lwres_lwpacket_renderheader() transfers the contents of lightweight
104       resolver packet structure lwres_lwpacket_t*pkt in network byte order to
105       the lightweight resolver buffer, *b.
106
107       lwres_lwpacket_parseheader() performs the converse operation. It
108       transfers data in network byte order from buffer *b to resolver packet
109       *pkt. The contents of the buffer b should correspond to a
110       lwres_lwpacket_t.
111

RETURN VALUES

113       Successful calls to lwres_lwpacket_renderheader() and
114       lwres_lwpacket_parseheader() return LWRES_R_SUCCESS. If there is
115       insufficient space to copy data between the buffer *b and lightweight
116       resolver packet *pkt both functions return LWRES_R_UNEXPECTEDEND.
117

AUTHOR

119       Internet Systems Consortium, Inc.
120
122       Copyright © 2000, 2001, 2004, 2005, 2007, 2014-2016, 2018 Internet
123       Systems Consortium, Inc. ("ISC")
124
125
126
127ISC                               2007-06-18                   LWRES_PACKET(3)
Impressum