2 <!ENTITY mdash "—">]>
4 - Copyright (C) 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC")
5 - Copyright (C) 2000, 2001 Internet Software Consortium.
7 - Permission to use, copy, modify, and/or distribute this software for any
8 - purpose with or without fee is hereby granted, provided that the above
9 - copyright notice and this permission notice appear in all copies.
11 - THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
12 - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
13 - AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
14 - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15 - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
16 - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17 - PERFORMANCE OF THIS SOFTWARE.
20 <!-- Converted by db4-upgrade version 1.0 -->
21 <refentry xmlns="http://docbook.org/ns/docbook" version="5.0">
23 <date>2007-06-18</date>
26 <corpname>ISC</corpname>
27 <corpauthor>Internet Systems Consortium, Inc.</corpauthor>
31 <refentrytitle>lwres_gabn</refentrytitle>
32 <manvolnum>3</manvolnum>
33 <refmiscinfo>BIND9</refmiscinfo>
43 <holder>Internet Systems Consortium, Inc. ("ISC")</holder>
48 <holder>Internet Software Consortium.</holder>
53 <refname>lwres_gabnrequest_render</refname>
54 <refname>lwres_gabnresponse_render</refname>
55 <refname>lwres_gabnrequest_parse</refname>
56 <refname>lwres_gabnresponse_parse</refname>
57 <refname>lwres_gabnresponse_free</refname>
58 <refname>lwres_gabnrequest_free</refname>
59 <refpurpose>lightweight resolver getaddrbyname message handling</refpurpose>
63 <funcsynopsisinfo>#include <lwres/lwres.h></funcsynopsisinfo>
67 <function>lwres_gabnrequest_render</function></funcdef>
68 <paramdef>lwres_context_t *<parameter>ctx</parameter></paramdef>
69 <paramdef>lwres_gabnrequest_t *<parameter>req</parameter></paramdef>
70 <paramdef>lwres_lwpacket_t *<parameter>pkt</parameter></paramdef>
71 <paramdef>lwres_buffer_t *<parameter>b</parameter></paramdef>
76 <function>lwres_gabnresponse_render</function></funcdef>
77 <paramdef>lwres_context_t *<parameter>ctx</parameter></paramdef>
78 <paramdef>lwres_gabnresponse_t *<parameter>req</parameter></paramdef>
79 <paramdef>lwres_lwpacket_t *<parameter>pkt</parameter></paramdef>
80 <paramdef>lwres_buffer_t *<parameter>b</parameter></paramdef>
85 <function>lwres_gabnrequest_parse</function></funcdef>
86 <paramdef>lwres_context_t *<parameter>ctx</parameter></paramdef>
87 <paramdef>lwres_buffer_t *<parameter>b</parameter></paramdef>
88 <paramdef>lwres_lwpacket_t *<parameter>pkt</parameter></paramdef>
89 <paramdef>lwres_gabnrequest_t **<parameter>structp</parameter></paramdef>
94 <function>lwres_gabnresponse_parse</function></funcdef>
95 <paramdef>lwres_context_t *<parameter>ctx</parameter></paramdef>
96 <paramdef>lwres_buffer_t *<parameter>b</parameter></paramdef>
97 <paramdef>lwres_lwpacket_t *<parameter>pkt</parameter></paramdef>
98 <paramdef>lwres_gabnresponse_t **<parameter>structp</parameter></paramdef>
103 <function>lwres_gabnresponse_free</function></funcdef>
104 <paramdef>lwres_context_t *<parameter>ctx</parameter></paramdef>
105 <paramdef>lwres_gabnresponse_t **<parameter>structp</parameter></paramdef>
110 <function>lwres_gabnrequest_free</function></funcdef>
111 <paramdef>lwres_context_t *<parameter>ctx</parameter></paramdef>
112 <paramdef>lwres_gabnrequest_t **<parameter>structp</parameter></paramdef>
116 <refsection><info><title>DESCRIPTION</title></info>
119 These are low-level routines for creating and parsing
120 lightweight resolver name-to-address lookup request and
124 There are four main functions for the getaddrbyname opcode.
125 One render function converts a getaddrbyname request structure —
126 <type>lwres_gabnrequest_t</type> —
127 to the lightweight resolver's canonical format.
128 It is complemented by a parse function that converts a packet in this
129 canonical format to a getaddrbyname request structure.
130 Another render function converts the getaddrbyname response structure
131 — <type>lwres_gabnresponse_t</type> —
132 to the canonical format.
133 This is complemented by a parse function which converts a packet in
134 canonical format to a getaddrbyname response structure.
137 These structures are defined in
138 <filename><lwres/lwres.h></filename>.
139 They are shown below.
141 <para><programlisting>
142 #define LWRES_OPCODE_GETADDRSBYNAME 0x00010001U
145 <para><programlisting>
146 typedef struct lwres_addr lwres_addr_t;
147 typedef LWRES_LIST(lwres_addr_t) lwres_addrlist_t;
150 <para><programlisting>
152 lwres_uint32_t flags;
153 lwres_uint32_t addrtypes;
154 lwres_uint16_t namelen;
156 } lwres_gabnrequest_t;
159 <para><programlisting>
161 lwres_uint32_t flags;
162 lwres_uint16_t naliases;
163 lwres_uint16_t naddrs;
166 lwres_uint16_t realnamelen;
167 lwres_uint16_t *aliaslen;
168 lwres_addrlist_t addrs;
171 } lwres_gabnresponse_t;
175 <para><function>lwres_gabnrequest_render()</function>
176 uses resolver context <parameter>ctx</parameter> to convert
177 getaddrbyname request structure <parameter>req</parameter> to
178 canonical format. The packet header structure
179 <parameter>pkt</parameter> is initialised and transferred to
180 buffer <parameter>b</parameter>.
182 The contents of <parameter>*req</parameter> are then appended to
183 the buffer in canonical format.
184 <function>lwres_gabnresponse_render()</function> performs the
185 same task, except it converts a getaddrbyname response structure
186 <type>lwres_gabnresponse_t</type> to the lightweight resolver's
190 <para><function>lwres_gabnrequest_parse()</function>
191 uses context <parameter>ctx</parameter> to convert the contents
192 of packet <parameter>pkt</parameter> to a
193 <type>lwres_gabnrequest_t</type> structure. Buffer
194 <parameter>b</parameter> provides space to be used for storing
195 this structure. When the function succeeds, the resulting
196 <type>lwres_gabnrequest_t</type> is made available through
197 <parameter>*structp</parameter>.
199 <function>lwres_gabnresponse_parse()</function> offers the same
200 semantics as <function>lwres_gabnrequest_parse()</function>
201 except it yields a <type>lwres_gabnresponse_t</type> structure.
204 <para><function>lwres_gabnresponse_free()</function>
205 and <function>lwres_gabnrequest_free()</function> release the
206 memory in resolver context <parameter>ctx</parameter> that was
207 allocated to the <type>lwres_gabnresponse_t</type> or
208 <type>lwres_gabnrequest_t</type> structures referenced via
209 <parameter>structp</parameter>.
211 Any memory associated with ancillary buffers and strings for
212 those structures is also discarded.
215 <refsection><info><title>RETURN VALUES</title></info>
218 The getaddrbyname opcode functions
219 <function>lwres_gabnrequest_render()</function>,
220 <function>lwres_gabnresponse_render()</function>
221 <function>lwres_gabnrequest_parse()</function>
223 <function>lwres_gabnresponse_parse()</function>
225 <errorcode>LWRES_R_SUCCESS</errorcode>
228 <errorcode>LWRES_R_NOMEMORY</errorcode>
229 if memory allocation fails.
230 <errorcode>LWRES_R_UNEXPECTEDEND</errorcode>
231 is returned if the available space in the buffer
232 <parameter>b</parameter>
233 is too small to accommodate the packet header or the
234 <type>lwres_gabnrequest_t</type>
236 <type>lwres_gabnresponse_t</type>
238 <function>lwres_gabnrequest_parse()</function>
240 <function>lwres_gabnresponse_parse()</function>
242 <errorcode>LWRES_R_UNEXPECTEDEND</errorcode>
243 if the buffer is not empty after decoding the received packet.
244 These functions will return
245 <errorcode>LWRES_R_FAILURE</errorcode>
247 <varname remap="structfield">pktflags</varname>
248 in the packet header structure
249 <type>lwres_lwpacket_t</type>
250 indicate that the packet is not a response to an earlier query.
253 <refsection><info><title>SEE ALSO</title></info>
256 <refentrytitle>lwres_packet</refentrytitle><manvolnum>3</manvolnum>