Merge from vendor branch GDB:
[dragonfly.git] / contrib / bind-9.3 / lib / lwres / man / lwres_gabn.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_gabn.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_gabn
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_GABN" "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_gabnrequest_render, lwres_gabnresponse_render, lwres_gabnrequest_parse, lwres_gabnresponse_parse, lwres_gabnresponse_free, lwres_gabnrequest_free \- lightweight resolver getaddrbyname message handling
34 .SH "SYNOPSIS"
35 .nf
36 #include <lwres/lwres.h>
37 .fi
38 .HP 40
39 .BI "lwres_result_t lwres_gabnrequest_render(lwres_context_t\ *ctx, lwres_gabnrequest_t\ *req, lwres_lwpacket_t\ *pkt, lwres_buffer_t\ *b);"
40 .HP 41
41 .BI "lwres_result_t lwres_gabnresponse_render(lwres_context_t\ *ctx, lwres_gabnresponse_t\ *req, lwres_lwpacket_t\ *pkt, lwres_buffer_t\ *b);"
42 .HP 39
43 .BI "lwres_result_t lwres_gabnrequest_parse(lwres_context_t\ *ctx, lwres_buffer_t\ *b, lwres_lwpacket_t\ *pkt, lwres_gabnrequest_t\ **structp);"
44 .HP 40
45 .BI "lwres_result_t lwres_gabnresponse_parse(lwres_context_t\ *ctx, lwres_buffer_t\ *b, lwres_lwpacket_t\ *pkt, lwres_gabnresponse_t\ **structp);"
46 .HP 29
47 .BI "void lwres_gabnresponse_free(lwres_context_t\ *ctx, lwres_gabnresponse_t\ **structp);"
48 .HP 28
49 .BI "void lwres_gabnrequest_free(lwres_context_t\ *ctx, lwres_gabnrequest_t\ **structp);"
50 .SH "DESCRIPTION"
51 .PP
52 These are low\-level routines for creating and parsing lightweight resolver name\-to\-address lookup request and response messages.
53 .PP
54 There are four main functions for the getaddrbyname opcode. One render function converts a getaddrbyname request structure \(em
55 \fBlwres_gabnrequest_t\fR
56 \(em to the lighweight resolver's canonical format. It is complemented by a parse function that converts a packet in this canonical format to a getaddrbyname request structure. Another render function converts the getaddrbyname response structure \(em
57 \fBlwres_gabnresponse_t\fR
58 \(em to the canonical format. This is complemented by a parse function which converts a packet in canonical format to a getaddrbyname response structure.
59 .PP
60 These structures are defined in
61 \fI<lwres/lwres.h>\fR. They are shown below.
62 .sp
63 .RS 3n
64 .nf
65 #define LWRES_OPCODE_GETADDRSBYNAME     0x00010001U
66 typedef struct lwres_addr lwres_addr_t;
67 typedef LWRES_LIST(lwres_addr_t) lwres_addrlist_t;
68 typedef struct {
69         lwres_uint32_t  flags;
70         lwres_uint32_t  addrtypes;
71         lwres_uint16_t  namelen;
72         char           *name;
73 } lwres_gabnrequest_t;
74 typedef struct {
75         lwres_uint32_t          flags;
76         lwres_uint16_t          naliases;
77         lwres_uint16_t          naddrs;
78         char                   *realname;
79         char                  **aliases;
80         lwres_uint16_t          realnamelen;
81         lwres_uint16_t         *aliaslen;
82         lwres_addrlist_t        addrs;
83         void                   *base;
84         size_t                  baselen;
85 } lwres_gabnresponse_t;
86 .fi
87 .RE
88 .sp
89 .PP
90 \fBlwres_gabnrequest_render()\fR
91 uses resolver context
92 \fIctx\fR
93 to convert getaddrbyname request structure
94 \fIreq\fR
95 to canonical format. The packet header structure
96 \fIpkt\fR
97 is initialised and transferred to buffer
98 \fIb\fR. The contents of
99 \fI*req\fR
100 are then appended to the buffer in canonical format.
101 \fBlwres_gabnresponse_render()\fR
102 performs the same task, except it converts a getaddrbyname response structure
103 \fBlwres_gabnresponse_t\fR
104 to the lightweight resolver's canonical format.
105 .PP
106 \fBlwres_gabnrequest_parse()\fR
107 uses context
108 \fIctx\fR
109 to convert the contents of packet
110 \fIpkt\fR
111 to a
112 \fBlwres_gabnrequest_t\fR
113 structure. Buffer
114 \fIb\fR
115 provides space to be used for storing this structure. When the function succeeds, the resulting
116 \fBlwres_gabnrequest_t\fR
117 is made available through
118 \fI*structp\fR.
119 \fBlwres_gabnresponse_parse()\fR
120 offers the same semantics as
121 \fBlwres_gabnrequest_parse()\fR
122 except it yields a
123 \fBlwres_gabnresponse_t\fR
124 structure.
125 .PP
126 \fBlwres_gabnresponse_free()\fR
127 and
128 \fBlwres_gabnrequest_free()\fR
129 release the memory in resolver context
130 \fIctx\fR
131 that was allocated to the
132 \fBlwres_gabnresponse_t\fR
133 or
134 \fBlwres_gabnrequest_t\fR
135 structures referenced via
136 \fIstructp\fR. Any memory associated with ancillary buffers and strings for those structures is also discarded.
137 .SH "RETURN VALUES"
138 .PP
139 The getaddrbyname opcode functions
140 \fBlwres_gabnrequest_render()\fR,
141 \fBlwres_gabnresponse_render()\fR
142 \fBlwres_gabnrequest_parse()\fR
143 and
144 \fBlwres_gabnresponse_parse()\fR
145 all return
146 \fBLWRES_R_SUCCESS\fR
147 on success. They return
148 \fBLWRES_R_NOMEMORY\fR
149 if memory allocation fails.
150 \fBLWRES_R_UNEXPECTEDEND\fR
151 is returned if the available space in the buffer
152 \fIb\fR
153 is too small to accommodate the packet header or the
154 \fBlwres_gabnrequest_t\fR
155 and
156 \fBlwres_gabnresponse_t\fR
157 structures.
158 \fBlwres_gabnrequest_parse()\fR
159 and
160 \fBlwres_gabnresponse_parse()\fR
161 will return
162 \fBLWRES_R_UNEXPECTEDEND\fR
163 if the buffer is not empty after decoding the received packet. These functions will return
164 \fBLWRES_R_FAILURE\fR
165 if
166 pktflags
167 in the packet header structure
168 \fBlwres_lwpacket_t\fR
169 indicate that the packet is not a response to an earlier query.
170 .SH "SEE ALSO"
171 .PP
172 \fBlwres_packet\fR(3 )
173 .SH "COPYRIGHT"
174 Copyright \(co 2004, 2005 Internet Systems Consortium, Inc. ("ISC")