Merge from vendor branch GDB:
[dragonfly.git] / contrib / bind-9.3 / lib / lwres / man / lwres_gnba.3
1 .\" Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC")
2 .\" Copyright (C) 2000, 2001 Internet Software Consortium.
3 .\" 
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.
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.13.2.1.8.6 2006/06/29 13:02:31 marka Exp $
17 .\"
18 .hy 0
19 .ad l
20 .\"     Title: lwres_gnba
21 .\"    Author: 
22 .\" Generator: DocBook XSL Stylesheets v1.70.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 .sp
63 .RS 3n
64 .nf
65 #define LWRES_OPCODE_GETNAMEBYADDR      0x00010002U
66 typedef struct {
67         lwres_uint32_t  flags;
68         lwres_addr_t    addr;
69 } lwres_gnbarequest_t;
70 typedef struct {
71         lwres_uint32_t  flags;
72         lwres_uint16_t  naliases;
73         char           *realname;
74         char          **aliases;
75         lwres_uint16_t  realnamelen;
76         lwres_uint16_t *aliaslen;
77         void           *base;
78         size_t          baselen;
79 } lwres_gnbaresponse_t;
80 .fi
81 .RE
82 .sp
83 .PP
84 \fBlwres_gnbarequest_render()\fR
85 uses resolver context
86 \fIctx\fR
87 to convert getnamebyaddr request structure
88 \fIreq\fR
89 to canonical format. The packet header structure
90 \fIpkt\fR
91 is initialised and transferred to buffer
92 \fIb\fR. The contents of
93 \fI*req\fR
94 are then appended to the buffer in canonical format.
95 \fBlwres_gnbaresponse_render()\fR
96 performs the same task, except it converts a getnamebyaddr response structure
97 \fBlwres_gnbaresponse_t\fR
98 to the lightweight resolver's canonical format.
99 .PP
100 \fBlwres_gnbarequest_parse()\fR
101 uses context
102 \fIctx\fR
103 to convert the contents of packet
104 \fIpkt\fR
105 to a
106 \fBlwres_gnbarequest_t\fR
107 structure. Buffer
108 \fIb\fR
109 provides space to be used for storing this structure. When the function succeeds, the resulting
110 \fBlwres_gnbarequest_t\fR
111 is made available through
112 \fI*structp\fR.
113 \fBlwres_gnbaresponse_parse()\fR
114 offers the same semantics as
115 \fBlwres_gnbarequest_parse()\fR
116 except it yields a
117 \fBlwres_gnbaresponse_t\fR
118 structure.
119 .PP
120 \fBlwres_gnbaresponse_free()\fR
121 and
122 \fBlwres_gnbarequest_free()\fR
123 release the memory in resolver context
124 \fIctx\fR
125 that was allocated to the
126 \fBlwres_gnbaresponse_t\fR
127 or
128 \fBlwres_gnbarequest_t\fR
129 structures referenced via
130 \fIstructp\fR. Any memory associated with ancillary buffers and strings for those structures is also discarded.
131 .SH "RETURN VALUES"
132 .PP
133 The getnamebyaddr opcode functions
134 \fBlwres_gnbarequest_render()\fR,
135 \fBlwres_gnbaresponse_render()\fR
136 \fBlwres_gnbarequest_parse()\fR
137 and
138 \fBlwres_gnbaresponse_parse()\fR
139 all return
140 \fBLWRES_R_SUCCESS\fR
141 on success. They return
142 \fBLWRES_R_NOMEMORY\fR
143 if memory allocation fails.
144 \fBLWRES_R_UNEXPECTEDEND\fR
145 is returned if the available space in the buffer
146 \fIb\fR
147 is too small to accommodate the packet header or the
148 \fBlwres_gnbarequest_t\fR
149 and
150 \fBlwres_gnbaresponse_t\fR
151 structures.
152 \fBlwres_gnbarequest_parse()\fR
153 and
154 \fBlwres_gnbaresponse_parse()\fR
155 will return
156 \fBLWRES_R_UNEXPECTEDEND\fR
157 if the buffer is not empty after decoding the received packet. These functions will return
158 \fBLWRES_R_FAILURE\fR
159 if
160 pktflags
161 in the packet header structure
162 \fBlwres_lwpacket_t\fR
163 indicate that the packet is not a response to an earlier query.
164 .SH "SEE ALSO"
165 .PP
166 \fBlwres_packet\fR(3).
167 .SH "COPYRIGHT"
168 Copyright \(co 2004, 2005 Internet Systems Consortium, Inc. ("ISC")