1 .\" Copyright (C) 2004, 2005 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.1.8.5 2005/10/13 02:33:53 marka Exp $
20 .\" ** You probably do not want to edit this file directly **
21 .\" It was generated using the DocBook XSL Stylesheets (version 1.69.1).
22 .\" Instead of manually editing it, you probably should edit the DocBook XML
23 .\" source for it and then use the DocBook XSL Stylesheets to regenerate it.
24 .TH "LWRES_GNBA" "3" "Jun 30, 2000" "BIND9" "BIND9"
25 .\" disable hyphenation
27 .\" disable justification (adjust text to left margin only)
30 lwres_gnbarequest_render, lwres_gnbaresponse_render, lwres_gnbarequest_parse, lwres_gnbaresponse_parse, lwres_gnbaresponse_free, lwres_gnbarequest_free \- lightweight resolver getnamebyaddress message handling
33 #include <lwres/lwres.h>
36 \fBlwres_result_t\ \fBlwres_gnbarequest_render\fR\fR\fB(\fR\fBlwres_context_t\ *\fR\fB\fIctx\fR\fR\fB, \fR\fBlwres_gnbarequest_t\ *\fR\fB\fIreq\fR\fR\fB, \fR\fBlwres_lwpacket_t\ *\fR\fB\fIpkt\fR\fR\fB, \fR\fBlwres_buffer_t\ *\fR\fB\fIb\fR\fR\fB);\fR
38 \fBlwres_result_t\ \fBlwres_gnbaresponse_render\fR\fR\fB(\fR\fBlwres_context_t\ *ctx\fR\fB, \fR\fBlwres_gnbaresponse_t\ *req\fR\fB, \fR\fBlwres_lwpacket_t\ *pkt\fR\fB, \fR\fBlwres_buffer_t\ *b\fR\fB);\fR
40 \fBlwres_result_t\ \fBlwres_gnbarequest_parse\fR\fR\fB(\fR\fBlwres_context_t\ *ctx\fR\fB, \fR\fBlwres_buffer_t\ *b\fR\fB, \fR\fBlwres_lwpacket_t\ *pkt\fR\fB, \fR\fBlwres_gnbarequest_t\ **structp\fR\fB);\fR
42 \fBlwres_result_t\ \fBlwres_gnbaresponse_parse\fR\fR\fB(\fR\fBlwres_context_t\ *ctx\fR\fB, \fR\fBlwres_buffer_t\ *b\fR\fB, \fR\fBlwres_lwpacket_t\ *pkt\fR\fB, \fR\fBlwres_gnbaresponse_t\ **structp\fR\fB);\fR
44 \fBvoid\ \fBlwres_gnbaresponse_free\fR\fR\fB(\fR\fBlwres_context_t\ *ctx\fR\fB, \fR\fBlwres_gnbaresponse_t\ **structp\fR\fB);\fR
46 \fBvoid\ \fBlwres_gnbarequest_free\fR\fR\fB(\fR\fBlwres_context_t\ *ctx\fR\fB, \fR\fBlwres_gnbarequest_t\ **structp\fR\fB);\fR
49 These are low\-level routines for creating and parsing lightweight resolver address\-to\-name lookup request and response messages.
51 There are four main functions for the getnamebyaddr opcode. One render function converts a getnamebyaddr request structure \(em
52 \fBlwres_gnbarequest_t\fR
53 \(em to the lightweight resolver's canonical format. It is complemented by a parse function that converts a packet in this canonical format to a getnamebyaddr request structure. Another render function converts the getnamebyaddr response structure \(em
54 \fBlwres_gnbaresponse_t\fR
55 to the canonical format. This is complemented by a parse function which converts a packet in canonical format to a getnamebyaddr response structure.
57 These structures are defined in
58 \fIlwres/lwres.h\fR. They are shown below.
61 #define LWRES_OPCODE_GETNAMEBYADDR 0x00010002U
65 } lwres_gnbarequest_t;
68 lwres_uint16_t naliases;
71 lwres_uint16_t realnamelen;
72 lwres_uint16_t *aliaslen;
75 } lwres_gnbaresponse_t;
79 \fBlwres_gnbarequest_render()\fR
82 to convert getnamebyaddr request structure
84 to canonical format. The packet header structure
86 is initialised and transferred to buffer
87 \fIb\fR. The contents of
89 are then appended to the buffer in canonical format.
90 \fBlwres_gnbaresponse_render()\fR
91 performs the same task, except it converts a getnamebyaddr response structure
92 \fBlwres_gnbaresponse_t\fR
93 to the lightweight resolver's canonical format.
95 \fBlwres_gnbarequest_parse()\fR
98 to convert the contents of packet
101 \fBlwres_gnbarequest_t\fR
104 provides space to be used for storing this structure. When the function succeeds, the resulting
105 \fBlwres_gnbarequest_t\fR
106 is made available through
108 \fBlwres_gnbaresponse_parse()\fR
109 offers the same semantics as
110 \fBlwres_gnbarequest_parse()\fR
112 \fBlwres_gnbaresponse_t\fR
115 \fBlwres_gnbaresponse_free()\fR
117 \fBlwres_gnbarequest_free()\fR
118 release the memory in resolver context
120 that was allocated to the
121 \fBlwres_gnbaresponse_t\fR
123 \fBlwres_gnbarequest_t\fR
124 structures referenced via
125 \fIstructp\fR. Any memory associated with ancillary buffers and strings for those structures is also discarded.
128 The getnamebyaddr opcode functions
129 \fBlwres_gnbarequest_render()\fR,
130 \fBlwres_gnbaresponse_render()\fR\fBlwres_gnbarequest_parse()\fR
132 \fBlwres_gnbaresponse_parse()\fR
134 \fBLWRES_R_SUCCESS\fR
135 on success. They return
136 \fBLWRES_R_NOMEMORY\fR
137 if memory allocation fails.
138 \fBLWRES_R_UNEXPECTEDEND\fR
139 is returned if the available space in the buffer
141 is too small to accommodate the packet header or the
142 \fBlwres_gnbarequest_t\fR
144 \fBlwres_gnbaresponse_t\fR
146 \fBlwres_gnbarequest_parse()\fR
148 \fBlwres_gnbaresponse_parse()\fR
150 \fBLWRES_R_UNEXPECTEDEND\fR
151 if the buffer is not empty after decoding the received packet. These functions will return
152 \fBLWRES_R_FAILURE\fR
155 in the packet header structure
156 \fBlwres_lwpacket_t\fR
157 indicate that the packet is not a response to an earlier query.
160 \fBlwres_packet\fR(3).