1 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.0//EN"
2 "http://www.oasis-open.org/docbook/xml/4.0/docbookx.dtd"
3 [<!ENTITY mdash "—">]>
5 - Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC")
6 - Copyright (C) 2000, 2001 Internet Software Consortium.
8 - Permission to use, copy, modify, and distribute this software for any
9 - purpose with or without fee is hereby granted, provided that the above
10 - copyright notice and this permission notice appear in all copies.
12 - THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
13 - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
14 - AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
15 - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
16 - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
17 - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
18 - PERFORMANCE OF THIS SOFTWARE.
21 <!-- $Id: lwres_gabn.docbook,v 1.3.206.3 2005/05/12 21:36:12 sra Exp $ -->
27 <date>Jun 30, 2000</date>
30 <refentrytitle>lwres_gabn</refentrytitle>
31 <manvolnum>3</manvolnum>
32 <refmiscinfo>BIND9</refmiscinfo>
39 <holder>Internet Systems Consortium, Inc. ("ISC")</holder>
44 <holder>Internet Software Consortium.</holder>
49 <refname>lwres_gabnrequest_render</refname>
50 <refname>lwres_gabnresponse_render</refname>
51 <refname>lwres_gabnrequest_parse</refname>
52 <refname>lwres_gabnresponse_parse</refname>
53 <refname>lwres_gabnresponse_free</refname>
54 <refname>lwres_gabnrequest_free</refname>
55 <refpurpose>lightweight resolver getaddrbyname message handling</refpurpose>
59 <funcsynopsisinfo>#include <lwres/lwres.h></funcsynopsisinfo>
63 <function>lwres_gabnrequest_render</function></funcdef>
64 <paramdef>lwres_context_t *ctx</paramdef>
65 <paramdef>lwres_gabnrequest_t *req</paramdef>
66 <paramdef>lwres_lwpacket_t *pkt</paramdef>
67 <paramdef>lwres_buffer_t *b</paramdef>
72 <function>lwres_gabnresponse_render</function></funcdef>
73 <paramdef>lwres_context_t *ctx</paramdef>
74 <paramdef>lwres_gabnresponse_t *req</paramdef>
75 <paramdef>lwres_lwpacket_t *pkt</paramdef>
76 <paramdef>lwres_buffer_t *b</paramdef>
81 <function>lwres_gabnrequest_parse</function></funcdef>
82 <paramdef>lwres_context_t *ctx</paramdef>
83 <paramdef>lwres_buffer_t *b</paramdef>
84 <paramdef>lwres_lwpacket_t *pkt</paramdef>
85 <paramdef>lwres_gabnrequest_t **structp</paramdef>
90 <function>lwres_gabnresponse_parse</function></funcdef>
91 <paramdef>lwres_context_t *ctx</paramdef>
92 <paramdef>lwres_buffer_t *b</paramdef>
93 <paramdef>lwres_lwpacket_t *pkt</paramdef>
94 <paramdef>lwres_gabnresponse_t **structp</paramdef>
99 <function>lwres_gabnresponse_free</function></funcdef>
100 <paramdef>lwres_context_t *ctx</paramdef>
101 <paramdef>lwres_gabnresponse_t **structp</paramdef>
106 <function>lwres_gabnrequest_free</function></funcdef>
107 <paramdef>lwres_context_t *ctx</paramdef>
108 <paramdef>lwres_gabnrequest_t **structp</paramdef>
113 <title>DESCRIPTION</title>
115 These are low-level routines for creating and parsing
116 lightweight resolver name-to-address lookup request and
119 There are four main functions for the getaddrbyname opcode.
120 One render function converts a getaddrbyname request structure —
121 <type>lwres_gabnrequest_t</type> —
122 to the lighweight resolver's canonical format.
123 It is complemented by a parse function that converts a packet in this
124 canonical format to a getaddrbyname request structure.
125 Another render function converts the getaddrbyname response structure —
126 <type>lwres_gabnresponse_t</type> —
127 to the canonical format.
128 This is complemented by a parse function which converts a packet in
129 canonical format to a getaddrbyname response structure.
132 These structures are defined in
133 <filename><lwres/lwres.h></filename>.
134 They are shown below.
136 #define LWRES_OPCODE_GETADDRSBYNAME 0x00010001U
138 typedef struct lwres_addr lwres_addr_t;
139 typedef LWRES_LIST(lwres_addr_t) lwres_addrlist_t;
142 lwres_uint32_t flags;
143 lwres_uint32_t addrtypes;
144 lwres_uint16_t namelen;
146 } lwres_gabnrequest_t;
149 lwres_uint32_t flags;
150 lwres_uint16_t naliases;
151 lwres_uint16_t naddrs;
154 lwres_uint16_t realnamelen;
155 lwres_uint16_t *aliaslen;
156 lwres_addrlist_t addrs;
159 } lwres_gabnresponse_t;
163 <function>lwres_gabnrequest_render()</function>
164 uses resolver context
165 <parameter>ctx</parameter>
166 to convert getaddrbyname request structure
167 <parameter>req</parameter>
169 The packet header structure
170 <parameter>pkt</parameter>
171 is initialised and transferred to
173 <parameter>b</parameter>.
176 <parameter>*req</parameter>
177 are then appended to the buffer in canonical format.
178 <function>lwres_gabnresponse_render()</function>
179 performs the same task, except it converts a getaddrbyname response structure
180 <type>lwres_gabnresponse_t</type>
181 to the lightweight resolver's canonical format.
184 <function>lwres_gabnrequest_parse()</function>
186 <parameter>ctx</parameter>
187 to convert the contents of packet
188 <parameter>pkt</parameter>
190 <type>lwres_gabnrequest_t</type>
193 <parameter>b</parameter>
194 provides space to be used for storing this structure.
195 When the function succeeds, the resulting
196 <type>lwres_gabnrequest_t</type>
197 is made available through
198 <parameter>*structp</parameter>.
200 <function>lwres_gabnresponse_parse()</function>
201 offers the same semantics as
202 <function>lwres_gabnrequest_parse()</function>
204 <type>lwres_gabnresponse_t</type>
208 <function>lwres_gabnresponse_free()</function>
210 <function>lwres_gabnrequest_free()</function>
211 release the memory in resolver context
212 <parameter>ctx</parameter>
213 that was allocated to the
214 <type>lwres_gabnresponse_t</type>
216 <type>lwres_gabnrequest_t</type>
217 structures referenced via
218 <parameter>structp</parameter>.
220 Any memory associated with ancillary buffers and strings for those
221 structures is also discarded.
225 <title>RETURN VALUES</title>
227 The getaddrbyname opcode functions
228 <function>lwres_gabnrequest_render()</function>,
229 <function>lwres_gabnresponse_render()</function>
230 <function>lwres_gabnrequest_parse()</function>
232 <function>lwres_gabnresponse_parse()</function>
234 <errorcode>LWRES_R_SUCCESS</errorcode>
237 <errorcode>LWRES_R_NOMEMORY</errorcode>
238 if memory allocation fails.
239 <errorcode>LWRES_R_UNEXPECTEDEND</errorcode>
240 is returned if the available space in the buffer
241 <parameter>b</parameter>
242 is too small to accommodate the packet header or the
243 <type>lwres_gabnrequest_t</type>
245 <type>lwres_gabnresponse_t</type>
247 <function>lwres_gabnrequest_parse()</function>
249 <function>lwres_gabnresponse_parse()</function>
251 <errorcode>LWRES_R_UNEXPECTEDEND</errorcode>
252 if the buffer is not empty after decoding the received packet.
253 These functions will return
254 <errorcode>LWRES_R_FAILURE</errorcode>
256 <structfield>pktflags</structfield>
257 in the packet header structure
258 <type>lwres_lwpacket_t</type>
259 indicate that the packet is not a response to an earlier query.
263 <title>SEE ALSO</title>
266 <refentrytitle>lwres_packet</refentrytitle><manvolnum>3