1 .\" Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
2 .\" Copyright (C) 2000, 2001 Internet Software Consortium.
4 .\" Permission to use, copy, modify, and distribute this software for any
5 .\" purpose with or without fee is hereby granted, provided that the above
6 .\" copyright notice and this permission notice appear in all copies.
8 .\" THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
9 .\" REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
10 .\" AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
11 .\" INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12 .\" LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
13 .\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14 .\" PERFORMANCE OF THIS SOFTWARE.
16 .\" $Id: lwres_gabn.3,v 1.13.2.2 2004/03/15 04:45:01 marka Exp $
18 .TH "LWRES_GABN" "3" "Jun 30, 2000" "BIND9" ""
20 lwres_gabnrequest_render, lwres_gabnresponse_render, lwres_gabnrequest_parse, lwres_gabnresponse_parse, lwres_gabnresponse_free, lwres_gabnrequest_free \- lightweight resolver getaddrbyname message handling
22 \fB#include <lwres/lwres.h>
26 lwres_gabnrequest_render(lwres_context_t *ctx, lwres_gabnrequest_t *req, lwres_lwpacket_t *pkt, lwres_buffer_t *b);
31 lwres_gabnresponse_render(lwres_context_t *ctx, lwres_gabnresponse_t *req, lwres_lwpacket_t *pkt, lwres_buffer_t *b);
36 lwres_gabnrequest_parse(lwres_context_t *ctx, lwres_buffer_t *b, lwres_lwpacket_t *pkt, lwres_gabnrequest_t **structp);
41 lwres_gabnresponse_parse(lwres_context_t *ctx, lwres_buffer_t *b, lwres_lwpacket_t *pkt, lwres_gabnresponse_t **structp);
46 lwres_gabnresponse_free(lwres_context_t *ctx, lwres_gabnresponse_t **structp);
51 lwres_gabnrequest_free(lwres_context_t *ctx, lwres_gabnrequest_t **structp);
56 These are low-level routines for creating and parsing
57 lightweight resolver name-to-address lookup request and
60 There are four main functions for the getaddrbyname opcode.
61 One render function converts a getaddrbyname request structure \(em
62 \fBlwres_gabnrequest_t\fR \(em
63 to the lighweight resolver's canonical format.
64 It is complemented by a parse function that converts a packet in this
65 canonical format to a getaddrbyname request structure.
66 Another render function converts the getaddrbyname response structure \(em
67 \fBlwres_gabnresponse_t\fR \(em
68 to the canonical format.
69 This is complemented by a parse function which converts a packet in
70 canonical format to a getaddrbyname response structure.
72 These structures are defined in
73 \fI<lwres/lwres.h>\fR.
77 #define LWRES_OPCODE_GETADDRSBYNAME 0x00010001U
79 typedef struct lwres_addr lwres_addr_t;
80 typedef LWRES_LIST(lwres_addr_t) lwres_addrlist_t;
84 lwres_uint32_t addrtypes;
85 lwres_uint16_t namelen;
87 } lwres_gabnrequest_t;
91 lwres_uint16_t naliases;
92 lwres_uint16_t naddrs;
95 lwres_uint16_t realnamelen;
96 lwres_uint16_t *aliaslen;
97 lwres_addrlist_t addrs;
100 } lwres_gabnresponse_t;
104 \fBlwres_gabnrequest_render()\fR
105 uses resolver context
107 to convert getaddrbyname request structure
110 The packet header structure
112 is initialised and transferred to
117 are then appended to the buffer in canonical format.
118 \fBlwres_gabnresponse_render()\fR
119 performs the same task, except it converts a getaddrbyname response structure
120 \fBlwres_gabnresponse_t\fR
121 to the lightweight resolver's canonical format.
123 \fBlwres_gabnrequest_parse()\fR
126 to convert the contents of packet
129 \fBlwres_gabnrequest_t\fR
133 provides space to be used for storing this structure.
134 When the function succeeds, the resulting
135 \fBlwres_gabnrequest_t\fR
136 is made available through
138 \fBlwres_gabnresponse_parse()\fR
139 offers the same semantics as
140 \fBlwres_gabnrequest_parse()\fR
142 \fBlwres_gabnresponse_t\fR
145 \fBlwres_gabnresponse_free()\fR
147 \fBlwres_gabnrequest_free()\fR
148 release the memory in resolver context
150 that was allocated to the
151 \fBlwres_gabnresponse_t\fR
153 \fBlwres_gabnrequest_t\fR
154 structures referenced via
156 Any memory associated with ancillary buffers and strings for those
157 structures is also discarded.
160 The getaddrbyname opcode functions
161 \fBlwres_gabnrequest_render()\fR,
162 \fBlwres_gabnresponse_render()\fR
163 \fBlwres_gabnrequest_parse()\fR
165 \fBlwres_gabnresponse_parse()\fR
171 if memory allocation fails.
172 LWRES_R_UNEXPECTEDEND
173 is returned if the available space in the buffer
175 is too small to accommodate the packet header or the
176 \fBlwres_gabnrequest_t\fR
178 \fBlwres_gabnresponse_t\fR
180 \fBlwres_gabnrequest_parse()\fR
182 \fBlwres_gabnresponse_parse()\fR
184 LWRES_R_UNEXPECTEDEND
185 if the buffer is not empty after decoding the received packet.
186 These functions will return
190 in the packet header structure
191 \fBlwres_lwpacket_t\fR
192 indicate that the packet is not a response to an earlier query.
195 \fBlwres_packet\fR(3)