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_gnba.html,v 1.6.2.2 2004/03/15 04:45:03 marka Exp $ -->
26 CONTENT=
"Modular DocBook HTML Stylesheet Version 1.73
47 >lwres_gnbarequest_render, lwres_gnbaresponse_render, lwres_gnbarequest_parse, lwres_gnbaresponse_parse, lwres_gnbaresponse_free, lwres_gnbarequest_free
--
lightweight resolver getnamebyaddress message handling
</DIV
49 CLASS=
"REFSYNOPSISDIV"
63 CLASS=
"FUNCSYNOPSISINFO"
64 >#include
<lwres/lwres.h
></PRE
70 lwres_gnbarequest_render
</CODE
71 >(lwres_context_t *ctx, lwres_gnbarequest_t *req, lwres_lwpacket_t *pkt, lwres_buffer_t *b);
</CODE
78 lwres_gnbaresponse_render
</CODE
79 >(lwres_context_t *ctx, lwres_gnbaresponse_t *req, lwres_lwpacket_t *pkt, lwres_buffer_t *b);
</CODE
86 lwres_gnbarequest_parse
</CODE
87 >(lwres_context_t *ctx, lwres_buffer_t *b, lwres_lwpacket_t *pkt, lwres_gnbarequest_t **structp);
</CODE
94 lwres_gnbaresponse_parse
</CODE
95 >(lwres_context_t *ctx, lwres_buffer_t *b, lwres_lwpacket_t *pkt, lwres_gnbaresponse_t **structp);
</CODE
102 lwres_gnbaresponse_free
</CODE
103 >(lwres_context_t *ctx, lwres_gnbaresponse_t **structp);
</CODE
110 lwres_gnbarequest_free
</CODE
111 >(lwres_context_t *ctx, lwres_gnbarequest_t **structp);
</CODE
125 >These are low-level routines for creating and parsing
126 lightweight resolver address-to-name lookup request and
127 response messages.
</P
129 >There are four main functions for the getnamebyaddr opcode.
130 One render function converts a getnamebyaddr request structure
—
133 >lwres_gnbarequest_t
</SPAN
135 to the lightweight resolver's canonical format.
136 It is complemented by a parse function that converts a packet in this
137 canonical format to a getnamebyaddr request structure.
138 Another render function converts the getnamebyaddr response structure
—
141 >lwres_gnbaresponse_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 getnamebyaddr response structure.
</P
147 >These structures are defined in
152 They are shown below.
154 CLASS=
"PROGRAMLISTING"
155 >#define LWRES_OPCODE_GETNAMEBYADDR
0x00010002U
158 lwres_uint32_t flags;
160 } lwres_gnbarequest_t;
163 lwres_uint32_t flags;
164 lwres_uint16_t naliases;
167 lwres_uint16_t realnamelen;
168 lwres_uint16_t *aliaslen;
171 } lwres_gnbaresponse_t;
</PRE
176 >lwres_gnbarequest_render()
</TT
178 uses resolver context
183 to convert getnamebyaddr request structure
189 The packet header structure
194 is initialised and transferred to
205 are then appended to the buffer in canonical format.
208 >lwres_gnbaresponse_render()
</TT
210 performs the same task, except it converts a getnamebyaddr response structure
213 >lwres_gnbaresponse_t
</SPAN
215 to the lightweight resolver's canonical format.
</P
219 >lwres_gnbarequest_parse()
</TT
226 to convert the contents of packet
234 >lwres_gnbarequest_t
</SPAN
242 provides space to be used for storing this structure.
243 When the function succeeds, the resulting
246 >lwres_gnbarequest_t
</SPAN
248 is made available through
255 >lwres_gnbaresponse_parse()
</TT
257 offers the same semantics as
260 >lwres_gnbarequest_parse()
</TT
265 >lwres_gnbaresponse_t
</SPAN
271 >lwres_gnbaresponse_free()
</TT
276 >lwres_gnbarequest_free()
</TT
278 release the memory in resolver context
283 that was allocated to the
286 >lwres_gnbaresponse_t
</SPAN
291 >lwres_gnbarequest_t
</SPAN
293 structures referenced via
298 Any memory associated with ancillary buffers and strings for those
299 structures is also discarded.
</P
309 >The getnamebyaddr opcode functions
312 >lwres_gnbarequest_render()
</TT
316 >lwres_gnbaresponse_render()
</TT
320 >lwres_gnbarequest_parse()
</TT
325 >lwres_gnbaresponse_parse()
</TT
330 >LWRES_R_SUCCESS
</SPAN
336 >LWRES_R_NOMEMORY
</SPAN
338 if memory allocation fails.
341 >LWRES_R_UNEXPECTEDEND
</SPAN
343 is returned if the available space in the buffer
348 is too small to accommodate the packet header or the
351 >lwres_gnbarequest_t
</SPAN
356 >lwres_gnbaresponse_t
</SPAN
361 >lwres_gnbarequest_parse()
</TT
366 >lwres_gnbaresponse_parse()
</TT
371 >LWRES_R_UNEXPECTEDEND
</SPAN
373 if the buffer is not empty after decoding the received packet.
374 These functions will return
377 >LWRES_R_FAILURE
</SPAN
386 in the packet header structure
389 >lwres_lwpacket_t
</SPAN
391 indicate that the packet is not a response to an earlier query.
</P
404 CLASS=
"REFENTRYTITLE"