2 - Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
3 - Copyright (C) 2001 Internet Software Consortium.
5 - Permission to use, copy, modify, and distribute this software for any
6 - purpose with or without fee is hereby granted, provided that the above
7 - copyright notice and this permission notice appear in all copies.
9 - THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10 - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11 - AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12 - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13 - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14 - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15 - PERFORMANCE OF THIS SOFTWARE.
18 <!-- $Id: lwres_gabn.html,v 1.6.2.2 2004/03/15 04:45:01 marka Exp $ -->
26 CONTENT="Modular DocBook HTML Stylesheet Version 1.73
47 >lwres_gabnrequest_render, lwres_gabnresponse_render, lwres_gabnrequest_parse, lwres_gabnresponse_parse, lwres_gabnresponse_free, lwres_gabnrequest_free -- lightweight resolver getaddrbyname message handling</DIV
49 CLASS="REFSYNOPSISDIV"
63 CLASS="FUNCSYNOPSISINFO"
64 >#include <lwres/lwres.h></PRE
70 lwres_gabnrequest_render</CODE
71 >(lwres_context_t *ctx, lwres_gabnrequest_t *req, lwres_lwpacket_t *pkt, lwres_buffer_t *b);</CODE
78 lwres_gabnresponse_render</CODE
79 >(lwres_context_t *ctx, lwres_gabnresponse_t *req, lwres_lwpacket_t *pkt, lwres_buffer_t *b);</CODE
86 lwres_gabnrequest_parse</CODE
87 >(lwres_context_t *ctx, lwres_buffer_t *b, lwres_lwpacket_t *pkt, lwres_gabnrequest_t **structp);</CODE
94 lwres_gabnresponse_parse</CODE
95 >(lwres_context_t *ctx, lwres_buffer_t *b, lwres_lwpacket_t *pkt, lwres_gabnresponse_t **structp);</CODE
102 lwres_gabnresponse_free</CODE
103 >(lwres_context_t *ctx, lwres_gabnresponse_t **structp);</CODE
110 lwres_gabnrequest_free</CODE
111 >(lwres_context_t *ctx, lwres_gabnrequest_t **structp);</CODE
125 >These are low-level routines for creating and parsing
126 lightweight resolver name-to-address lookup request and
127 response messages.</P
129 >There are four main functions for the getaddrbyname opcode.
130 One render function converts a getaddrbyname request structure —
133 >lwres_gabnrequest_t</SPAN
135 to the lighweight resolver's canonical format.
136 It is complemented by a parse function that converts a packet in this
137 canonical format to a getaddrbyname request structure.
138 Another render function converts the getaddrbyname response structure —
141 >lwres_gabnresponse_t</SPAN
143 to the canonical format.
144 This is complemented by a parse function which converts a packet in
145 canonical format to a getaddrbyname response structure.</P
147 >These structures are defined in
150 ><lwres/lwres.h></TT
152 They are shown below.
154 CLASS="PROGRAMLISTING"
155 >#define LWRES_OPCODE_GETADDRSBYNAME 0x00010001U
157 typedef struct lwres_addr lwres_addr_t;
158 typedef LWRES_LIST(lwres_addr_t) lwres_addrlist_t;
161 lwres_uint32_t flags;
162 lwres_uint32_t addrtypes;
163 lwres_uint16_t namelen;
165 } lwres_gabnrequest_t;
168 lwres_uint32_t flags;
169 lwres_uint16_t naliases;
170 lwres_uint16_t naddrs;
173 lwres_uint16_t realnamelen;
174 lwres_uint16_t *aliaslen;
175 lwres_addrlist_t addrs;
178 } lwres_gabnresponse_t;</PRE
183 >lwres_gabnrequest_render()</TT
185 uses resolver context
192 to convert getaddrbyname request structure
200 The packet header structure
207 is initialised and transferred to
223 are then appended to the buffer in canonical format.
226 >lwres_gabnresponse_render()</TT
228 performs the same task, except it converts a getaddrbyname response structure
231 >lwres_gabnresponse_t</SPAN
233 to the lightweight resolver's canonical format.</P
237 >lwres_gabnrequest_parse()</TT
246 to convert the contents of packet
256 >lwres_gabnrequest_t</SPAN
266 provides space to be used for storing this structure.
267 When the function succeeds, the resulting
270 >lwres_gabnrequest_t</SPAN
272 is made available through
282 >lwres_gabnresponse_parse()</TT
284 offers the same semantics as
287 >lwres_gabnrequest_parse()</TT
292 >lwres_gabnresponse_t</SPAN
298 >lwres_gabnresponse_free()</TT
303 >lwres_gabnrequest_free()</TT
305 release the memory in resolver context
312 that was allocated to the
315 >lwres_gabnresponse_t</SPAN
320 >lwres_gabnrequest_t</SPAN
322 structures referenced via
330 Any memory associated with ancillary buffers and strings for those
331 structures is also discarded.</P
341 >The getaddrbyname opcode functions
344 >lwres_gabnrequest_render()</TT
348 >lwres_gabnresponse_render()</TT
352 >lwres_gabnrequest_parse()</TT
357 >lwres_gabnresponse_parse()</TT
362 >LWRES_R_SUCCESS</SPAN
368 >LWRES_R_NOMEMORY</SPAN
370 if memory allocation fails.
373 >LWRES_R_UNEXPECTEDEND</SPAN
375 is returned if the available space in the buffer
382 is too small to accommodate the packet header or the
385 >lwres_gabnrequest_t</SPAN
390 >lwres_gabnresponse_t</SPAN
395 >lwres_gabnrequest_parse()</TT
400 >lwres_gabnresponse_parse()</TT
405 >LWRES_R_UNEXPECTEDEND</SPAN
407 if the buffer is not empty after decoding the received packet.
408 These functions will return
411 >LWRES_R_FAILURE</SPAN
420 in the packet header structure
423 >lwres_lwpacket_t</SPAN
425 indicate that the packet is not a response to an earlier query.</P
438 CLASS="REFENTRYTITLE"