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_gnba</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_gnbarequest_render</refname>
54 <refname>lwres_gnbaresponse_render</refname>
55 <refname>lwres_gnbarequest_parse</refname>
56 <refname>lwres_gnbaresponse_parse</refname>
57 <refname>lwres_gnbaresponse_free</refname>
58 <refname>lwres_gnbarequest_free</refname>
59 <refpurpose>lightweight resolver getnamebyaddress message handling</refpurpose>
66 #include <lwres/lwres.h>
72 <function>lwres_gnbarequest_render</function>
74 <paramdef>lwres_context_t *<parameter>ctx</parameter></paramdef>
75 <paramdef>lwres_gnbarequest_t *<parameter>req</parameter></paramdef>
76 <paramdef>lwres_lwpacket_t *<parameter>pkt</parameter></paramdef>
77 <paramdef>lwres_buffer_t *<parameter>b</parameter></paramdef>
83 <function>lwres_gnbaresponse_render</function>
85 <paramdef>lwres_context_t *<parameter>ctx</parameter></paramdef>
86 <paramdef>lwres_gnbaresponse_t *<parameter>req</parameter></paramdef>
87 <paramdef>lwres_lwpacket_t *<parameter>pkt</parameter></paramdef>
88 <paramdef>lwres_buffer_t *<parameter>b</parameter></paramdef>
93 <function>lwres_gnbarequest_parse</function></funcdef>
94 <paramdef>lwres_context_t *<parameter>ctx</parameter></paramdef>
95 <paramdef>lwres_buffer_t *<parameter>b</parameter></paramdef>
96 <paramdef>lwres_lwpacket_t *<parameter>pkt</parameter></paramdef>
97 <paramdef>lwres_gnbarequest_t **<parameter>structp</parameter></paramdef>
102 <function>lwres_gnbaresponse_parse</function></funcdef>
103 <paramdef>lwres_context_t *<parameter>ctx</parameter></paramdef>
104 <paramdef>lwres_buffer_t *<parameter>b</parameter></paramdef>
105 <paramdef>lwres_lwpacket_t *<parameter>pkt</parameter></paramdef>
106 <paramdef>lwres_gnbaresponse_t **<parameter>structp</parameter></paramdef>
112 <function>lwres_gnbaresponse_free</function>
114 <paramdef>lwres_context_t *<parameter>ctx</parameter></paramdef>
115 <paramdef>lwres_gnbaresponse_t **<parameter>structp</parameter></paramdef>
120 <function>lwres_gnbarequest_free</function></funcdef>
121 <paramdef>lwres_context_t *<parameter>ctx</parameter></paramdef>
122 <paramdef>lwres_gnbarequest_t **<parameter>structp</parameter></paramdef>
128 <refsection><info><title>DESCRIPTION</title></info>
131 These are low-level routines for creating and parsing
132 lightweight resolver address-to-name lookup request and
136 There are four main functions for the getnamebyaddr opcode.
137 One render function converts a getnamebyaddr request structure —
138 <type>lwres_gnbarequest_t</type> —
139 to the lightweight resolver's canonical format.
140 It is complemented by a parse function that converts a packet in this
141 canonical format to a getnamebyaddr request structure.
142 Another render function converts the getnamebyaddr response structure
144 <type>lwres_gnbaresponse_t</type>
145 to the canonical format.
146 This is complemented by a parse function which converts a packet in
147 canonical format to a getnamebyaddr response structure.
150 These structures are defined in
151 <filename>lwres/lwres.h</filename>.
152 They are shown below.
154 <para><programlisting>
155 #define LWRES_OPCODE_GETNAMEBYADDR 0x00010002U
158 <para><programlisting>
160 lwres_uint32_t flags;
162 } lwres_gnbarequest_t;
165 <para><programlisting>
167 lwres_uint32_t flags;
168 lwres_uint16_t naliases;
171 lwres_uint16_t realnamelen;
172 lwres_uint16_t *aliaslen;
175 } lwres_gnbaresponse_t;
179 <para><function>lwres_gnbarequest_render()</function>
180 uses resolver context <varname>ctx</varname> to convert
181 getnamebyaddr request structure <varname>req</varname> to
182 canonical format. The packet header structure
183 <varname>pkt</varname> is initialised and transferred to buffer
184 <varname>b</varname>. The contents of <varname>*req</varname>
185 are then appended to the buffer in canonical format.
186 <function>lwres_gnbaresponse_render()</function> performs the
187 same task, except it converts a getnamebyaddr response structure
188 <type>lwres_gnbaresponse_t</type> to the lightweight resolver's
192 <para><function>lwres_gnbarequest_parse()</function>
193 uses context <varname>ctx</varname> to convert the contents of
194 packet <varname>pkt</varname> to a
195 <type>lwres_gnbarequest_t</type> structure. Buffer
196 <varname>b</varname> provides space to be used for storing this
197 structure. When the function succeeds, the resulting
198 <type>lwres_gnbarequest_t</type> is made available through
199 <varname>*structp</varname>.
200 <function>lwres_gnbaresponse_parse()</function> offers the same
201 semantics as <function>lwres_gnbarequest_parse()</function>
202 except it yields a <type>lwres_gnbaresponse_t</type> structure.
205 <para><function>lwres_gnbaresponse_free()</function>
206 and <function>lwres_gnbarequest_free()</function> release the
207 memory in resolver context <varname>ctx</varname> that was
208 allocated to the <type>lwres_gnbaresponse_t</type> or
209 <type>lwres_gnbarequest_t</type> structures referenced via
210 <varname>structp</varname>. Any memory associated with
211 ancillary buffers and strings for those structures is also
216 <refsection><info><title>RETURN VALUES</title></info>
219 The getnamebyaddr opcode functions
220 <function>lwres_gnbarequest_render()</function>,
221 <function>lwres_gnbaresponse_render()</function>
222 <function>lwres_gnbarequest_parse()</function>
224 <function>lwres_gnbaresponse_parse()</function>
226 <errorcode>LWRES_R_SUCCESS</errorcode>
229 <errorcode>LWRES_R_NOMEMORY</errorcode>
230 if memory allocation fails.
231 <errorcode>LWRES_R_UNEXPECTEDEND</errorcode>
232 is returned if the available space in the buffer
234 is too small to accommodate the packet header or the
235 <type>lwres_gnbarequest_t</type>
237 <type>lwres_gnbaresponse_t</type>
239 <function>lwres_gnbarequest_parse()</function>
241 <function>lwres_gnbaresponse_parse()</function>
243 <errorcode>LWRES_R_UNEXPECTEDEND</errorcode>
244 if the buffer is not empty after decoding the received packet.
245 These functions will return
246 <errorcode>LWRES_R_FAILURE</errorcode>
248 <varname remap="structfield">pktflags</varname>
249 in the packet header structure
250 <type>lwres_lwpacket_t</type>
251 indicate that the packet is not a response to an earlier query.
254 <refsection><info><title>SEE ALSO</title></info>
257 <refentrytitle>lwres_packet</refentrytitle><manvolnum>3</manvolnum>