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_gnba.3,v 1.13.2.2 2004/03/15 04:45:03 marka Exp $
18 .TH "LWRES_GNBA" "3" "Jun 30, 2000" "BIND9" ""
20 lwres_gnbarequest_render, lwres_gnbaresponse_render, lwres_gnbarequest_parse, lwres_gnbaresponse_parse, lwres_gnbaresponse_free, lwres_gnbarequest_free \- lightweight resolver getnamebyaddress message handling
22 \fB#include <lwres/lwres.h>
26 lwres_gnbarequest_render(lwres_context_t *\fIctx\fB, lwres_gnbarequest_t *\fIreq\fB, lwres_lwpacket_t *\fIpkt\fB, lwres_buffer_t *\fIb\fB);
31 lwres_gnbaresponse_render(lwres_context_t *ctx, lwres_gnbaresponse_t *req, lwres_lwpacket_t *pkt, lwres_buffer_t *b);
36 lwres_gnbarequest_parse(lwres_context_t *ctx, lwres_buffer_t *b, lwres_lwpacket_t *pkt, lwres_gnbarequest_t **structp);
41 lwres_gnbaresponse_parse(lwres_context_t *ctx, lwres_buffer_t *b, lwres_lwpacket_t *pkt, lwres_gnbaresponse_t **structp);
46 lwres_gnbaresponse_free(lwres_context_t *ctx, lwres_gnbaresponse_t **structp);
51 lwres_gnbarequest_free(lwres_context_t *ctx, lwres_gnbarequest_t **structp);
56 These are low-level routines for creating and parsing
57 lightweight resolver address-to-name lookup request and
60 There are four main functions for the getnamebyaddr opcode.
61 One render function converts a getnamebyaddr request structure \(em
62 \fBlwres_gnbarequest_t\fR \(em
63 to the lightweight resolver's canonical format.
64 It is complemented by a parse function that converts a packet in this
65 canonical format to a getnamebyaddr request structure.
66 Another render function converts the getnamebyaddr response structure \(em
67 \fBlwres_gnbaresponse_t\fR
68 to the canonical format.
69 This is complemented by a parse function which converts a packet in
70 canonical format to a getnamebyaddr response structure.
72 These structures are defined in
77 #define LWRES_OPCODE_GETNAMEBYADDR 0x00010002U
82 } lwres_gnbarequest_t;
86 lwres_uint16_t naliases;
89 lwres_uint16_t realnamelen;
90 lwres_uint16_t *aliaslen;
93 } lwres_gnbaresponse_t;
97 \fBlwres_gnbarequest_render()\fR
100 to convert getnamebyaddr request structure
103 The packet header structure
105 is initialised and transferred to
110 are then appended to the buffer in canonical format.
111 \fBlwres_gnbaresponse_render()\fR
112 performs the same task, except it converts a getnamebyaddr response structure
113 \fBlwres_gnbaresponse_t\fR
114 to the lightweight resolver's canonical format.
116 \fBlwres_gnbarequest_parse()\fR
119 to convert the contents of packet
122 \fBlwres_gnbarequest_t\fR
126 provides space to be used for storing this structure.
127 When the function succeeds, the resulting
128 \fBlwres_gnbarequest_t\fR
129 is made available through
131 \fBlwres_gnbaresponse_parse()\fR
132 offers the same semantics as
133 \fBlwres_gnbarequest_parse()\fR
135 \fBlwres_gnbaresponse_t\fR
138 \fBlwres_gnbaresponse_free()\fR
140 \fBlwres_gnbarequest_free()\fR
141 release the memory in resolver context
143 that was allocated to the
144 \fBlwres_gnbaresponse_t\fR
146 \fBlwres_gnbarequest_t\fR
147 structures referenced via
149 Any memory associated with ancillary buffers and strings for those
150 structures is also discarded.
153 The getnamebyaddr opcode functions
154 \fBlwres_gnbarequest_render()\fR,
155 \fBlwres_gnbaresponse_render()\fR
156 \fBlwres_gnbarequest_parse()\fR
158 \fBlwres_gnbaresponse_parse()\fR
164 if memory allocation fails.
165 LWRES_R_UNEXPECTEDEND
166 is returned if the available space in the buffer
168 is too small to accommodate the packet header or the
169 \fBlwres_gnbarequest_t\fR
171 \fBlwres_gnbaresponse_t\fR
173 \fBlwres_gnbarequest_parse()\fR
175 \fBlwres_gnbaresponse_parse()\fR
177 LWRES_R_UNEXPECTEDEND
178 if the buffer is not empty after decoding the received packet.
179 These functions will return
183 in the packet header structure
184 \fBlwres_lwpacket_t\fR
185 indicate that the packet is not a response to an earlier query.
188 \fBlwres_packet\fR(3).