9aa46066128045491b1d507b15e558866dd6c44c
[dragonfly.git] / contrib / bind-9.5.2 / lib / lwres / man / lwres_gnba.3
1 .\" Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC")
2 .\" Copyright (C) 2000, 2001 Internet Software Consortium.
3 .\" 
4 .\" Permission to use, copy, modify, and/or 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.
7 .\" 
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.
15 .\"
16 .\" $Id: lwres_gnba.3,v 1.27.214.1 2009/07/11 01:43:31 tbox Exp $
17 .\"
18 .hy 0
19 .ad l
20 .\"     Title: lwres_gnba
21 .\"    Author: 
22 .\" Generator: DocBook XSL Stylesheets v1.71.1 <http://docbook.sf.net/>
23 .\"      Date: Jun 30, 2000
24 .\"    Manual: BIND9
25 .\"    Source: BIND9
26 .\"
27 .TH "LWRES_GNBA" "3" "Jun 30, 2000" "BIND9" "BIND9"
28 .\" disable hyphenation
29 .nh
30 .\" disable justification (adjust text to left margin only)
31 .ad l
32 .SH "NAME"
33 lwres_gnbarequest_render, lwres_gnbaresponse_render, lwres_gnbarequest_parse, lwres_gnbaresponse_parse, lwres_gnbaresponse_free, lwres_gnbarequest_free \- lightweight resolver getnamebyaddress message handling
34 .SH "SYNOPSIS"
35 .nf
36 #include <lwres/lwres.h>
37 .fi
38 .HP 40
39 .BI "lwres_result_t lwres_gnbarequest_render(lwres_context_t\ *" "ctx" ", lwres_gnbarequest_t\ *" "req" ", lwres_lwpacket_t\ *" "pkt" ", lwres_buffer_t\ *" "b" ");"
40 .HP 41
41 .BI "lwres_result_t lwres_gnbaresponse_render(lwres_context_t\ *" "ctx" ", lwres_gnbaresponse_t\ *" "req" ", lwres_lwpacket_t\ *" "pkt" ", lwres_buffer_t\ *" "b" ");"
42 .HP 39
43 .BI "lwres_result_t lwres_gnbarequest_parse(lwres_context_t\ *" "ctx" ", lwres_buffer_t\ *" "b" ", lwres_lwpacket_t\ *" "pkt" ", lwres_gnbarequest_t\ **" "structp" ");"
44 .HP 40
45 .BI "lwres_result_t lwres_gnbaresponse_parse(lwres_context_t\ *" "ctx" ", lwres_buffer_t\ *" "b" ", lwres_lwpacket_t\ *" "pkt" ", lwres_gnbaresponse_t\ **" "structp" ");"
46 .HP 29
47 .BI "void lwres_gnbaresponse_free(lwres_context_t\ *" "ctx" ", lwres_gnbaresponse_t\ **" "structp" ");"
48 .HP 28
49 .BI "void lwres_gnbarequest_free(lwres_context_t\ *" "ctx" ", lwres_gnbarequest_t\ **" "structp" ");"
50 .SH "DESCRIPTION"
51 .PP
52 These are low\-level routines for creating and parsing lightweight resolver address\-to\-name lookup request and response messages.
53 .PP
54 There are four main functions for the getnamebyaddr opcode. One render function converts a getnamebyaddr request structure \(em
55 \fBlwres_gnbarequest_t\fR
56 \(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
57 \fBlwres_gnbaresponse_t\fR
58 to the canonical format. This is complemented by a parse function which converts a packet in canonical format to a getnamebyaddr response structure.
59 .PP
60 These structures are defined in
61 \fIlwres/lwres.h\fR. They are shown below.
62 .PP
63 .RS 4
64 .nf
65 #define LWRES_OPCODE_GETNAMEBYADDR      0x00010002U
66 .fi
67 .RE
68 .sp
69 .PP
70 .RS 4
71 .nf
72 typedef struct {
73         lwres_uint32_t  flags;
74         lwres_addr_t    addr;
75 } lwres_gnbarequest_t;
76 .fi
77 .RE
78 .sp
79 .PP
80 .RS 4
81 .nf
82 typedef struct {
83         lwres_uint32_t  flags;
84         lwres_uint16_t  naliases;
85         char           *realname;
86         char          **aliases;
87         lwres_uint16_t  realnamelen;
88         lwres_uint16_t *aliaslen;
89         void           *base;
90         size_t          baselen;
91 } lwres_gnbaresponse_t;
92 .fi
93 .RE
94 .sp
95 .PP
96 \fBlwres_gnbarequest_render()\fR
97 uses resolver context
98 \fIctx\fR
99 to convert getnamebyaddr request structure
100 \fIreq\fR
101 to canonical format. The packet header structure
102 \fIpkt\fR
103 is initialised and transferred to buffer
104 \fIb\fR. The contents of
105 \fI*req\fR
106 are then appended to the buffer in canonical format.
107 \fBlwres_gnbaresponse_render()\fR
108 performs the same task, except it converts a getnamebyaddr response structure
109 \fBlwres_gnbaresponse_t\fR
110 to the lightweight resolver's canonical format.
111 .PP
112 \fBlwres_gnbarequest_parse()\fR
113 uses context
114 \fIctx\fR
115 to convert the contents of packet
116 \fIpkt\fR
117 to a
118 \fBlwres_gnbarequest_t\fR
119 structure. Buffer
120 \fIb\fR
121 provides space to be used for storing this structure. When the function succeeds, the resulting
122 \fBlwres_gnbarequest_t\fR
123 is made available through
124 \fI*structp\fR.
125 \fBlwres_gnbaresponse_parse()\fR
126 offers the same semantics as
127 \fBlwres_gnbarequest_parse()\fR
128 except it yields a
129 \fBlwres_gnbaresponse_t\fR
130 structure.
131 .PP
132 \fBlwres_gnbaresponse_free()\fR
133 and
134 \fBlwres_gnbarequest_free()\fR
135 release the memory in resolver context
136 \fIctx\fR
137 that was allocated to the
138 \fBlwres_gnbaresponse_t\fR
139 or
140 \fBlwres_gnbarequest_t\fR
141 structures referenced via
142 \fIstructp\fR. Any memory associated with ancillary buffers and strings for those structures is also discarded.
143 .SH "RETURN VALUES"
144 .PP
145 The getnamebyaddr opcode functions
146 \fBlwres_gnbarequest_render()\fR,
147 \fBlwres_gnbaresponse_render()\fR
148 \fBlwres_gnbarequest_parse()\fR
149 and
150 \fBlwres_gnbaresponse_parse()\fR
151 all return
152 \fBLWRES_R_SUCCESS\fR
153 on success. They return
154 \fBLWRES_R_NOMEMORY\fR
155 if memory allocation fails.
156 \fBLWRES_R_UNEXPECTEDEND\fR
157 is returned if the available space in the buffer
158 \fIb\fR
159 is too small to accommodate the packet header or the
160 \fBlwres_gnbarequest_t\fR
161 and
162 \fBlwres_gnbaresponse_t\fR
163 structures.
164 \fBlwres_gnbarequest_parse()\fR
165 and
166 \fBlwres_gnbaresponse_parse()\fR
167 will return
168 \fBLWRES_R_UNEXPECTEDEND\fR
169 if the buffer is not empty after decoding the received packet. These functions will return
170 \fBLWRES_R_FAILURE\fR
171 if
172 pktflags
173 in the packet header structure
174 \fBlwres_lwpacket_t\fR
175 indicate that the packet is not a response to an earlier query.
176 .SH "SEE ALSO"
177 .PP
178 \fBlwres_packet\fR(3).
179 .SH "COPYRIGHT"
180 Copyright \(co 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC")
181 .br
182 Copyright \(co 2000, 2001 Internet Software Consortium.
183 .br