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