2 .\" Copyright (C) 2000, 2001 Internet Software Consortium.
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.
8 .\" THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
9 .\" DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
10 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
11 .\" INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
12 .\" INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
13 .\" FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
14 .\" NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
15 .\" WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 .TH "LWRES_GABN" "3" "Jun 30, 2000" "BIND9" ""
19 lwres_gabnrequest_render, lwres_gabnresponse_render, lwres_gabnrequest_parse, lwres_gabnresponse_parse, lwres_gabnresponse_free, lwres_gabnrequest_free \- lightweight resolver getaddrbyname message handling
21 \fB#include <lwres/lwres.h>
25 lwres_gabnrequest_render(lwres_context_t *ctx, lwres_gabnrequest_t *req, lwres_lwpacket_t *pkt, lwres_buffer_t *b);
30 lwres_gabnresponse_render(lwres_context_t *ctx, lwres_gabnresponse_t *req, lwres_lwpacket_t *pkt, lwres_buffer_t *b);
35 lwres_gabnrequest_parse(lwres_context_t *ctx, lwres_buffer_t *b, lwres_lwpacket_t *pkt, lwres_gabnrequest_t **structp);
40 lwres_gabnresponse_parse(lwres_context_t *ctx, lwres_buffer_t *b, lwres_lwpacket_t *pkt, lwres_gabnresponse_t **structp);
45 lwres_gabnresponse_free(lwres_context_t *ctx, lwres_gabnresponse_t **structp);
50 lwres_gabnrequest_free(lwres_context_t *ctx, lwres_gabnrequest_t **structp);
54 These are low-level routines for creating and parsing
55 lightweight resolver name-to-address lookup request and
58 There are four main functions for the getaddrbyname opcode.
59 One render function converts a getaddrbyname request structure \(em
60 \fBlwres_gabnrequest_t\fR \(em
61 to the lighweight resolver's canonical format.
62 It is complemented by a parse function that converts a packet in this
63 canonical format to a getaddrbyname request structure.
64 Another render function converts the getaddrbyname response structure \(em
65 \fBlwres_gabnresponse_t\fR \(em
66 to the canonical format.
67 This is complemented by a parse function which converts a packet in
68 canonical format to a getaddrbyname response structure.
70 These structures are defined in
71 \fI<lwres/lwres.h>\fR.
75 #define LWRES_OPCODE_GETADDRSBYNAME 0x00010001U
77 typedef struct lwres_addr lwres_addr_t;
78 typedef LWRES_LIST(lwres_addr_t) lwres_addrlist_t;
82 lwres_uint32_t addrtypes;
83 lwres_uint16_t namelen;
85 } lwres_gabnrequest_t;
89 lwres_uint16_t naliases;
90 lwres_uint16_t naddrs;
93 lwres_uint16_t realnamelen;
94 lwres_uint16_t *aliaslen;
95 lwres_addrlist_t addrs;
98 } lwres_gabnresponse_t;
102 \fBlwres_gabnrequest_render()\fR
103 uses resolver context
105 to convert getaddrbyname request structure
108 The packet header structure
110 is initialised and transferred to
115 are then appended to the buffer in canonical format.
116 \fBlwres_gabnresponse_render()\fR
117 performs the same task, except it converts a getaddrbyname response structure
118 \fBlwres_gabnresponse_t\fR
119 to the lightweight resolver's canonical format.
121 \fBlwres_gabnrequest_parse()\fR
124 to convert the contents of packet
127 \fBlwres_gabnrequest_t\fR
131 provides space to be used for storing this structure.
132 When the function succeeds, the resulting
133 \fBlwres_gabnrequest_t\fR
134 is made available through
136 \fBlwres_gabnresponse_parse()\fR
137 offers the same semantics as
138 \fBlwres_gabnrequest_parse()\fR
140 \fBlwres_gabnresponse_t\fR
143 \fBlwres_gabnresponse_free()\fR
145 \fBlwres_gabnrequest_free()\fR
146 release the memory in resolver context
148 that was allocated to the
149 \fBlwres_gabnresponse_t\fR
151 \fBlwres_gabnrequest_t\fR
152 structures referenced via
154 Any memory associated with ancillary buffers and strings for those
155 structures is also discarded.
158 The getaddrbyname opcode functions
159 \fBlwres_gabnrequest_render()\fR,
160 \fBlwres_gabnresponse_render()\fR
161 \fBlwres_gabnrequest_parse()\fR
163 \fBlwres_gabnresponse_parse()\fR
169 if memory allocation fails.
170 LWRES_R_UNEXPECTEDEND
171 is returned if the available space in the buffer
173 is too small to accommodate the packet header or the
174 \fBlwres_gabnrequest_t\fR
176 \fBlwres_gabnresponse_t\fR
178 \fBlwres_gabnrequest_parse()\fR
180 \fBlwres_gabnresponse_parse()\fR
182 LWRES_R_UNEXPECTEDEND
183 if the buffer is not empty after decoding the received packet.
184 These functions will return
188 in the packet header structure
189 \fBlwres_lwpacket_t\fR
190 indicate that the packet is not a response to an earlier query.
193 \fBlwres_packet\fR(3)