Merge from vendor branch BIND:
[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.5 2005/10/13 02:33:52 marka Exp $
17 .\"
18 .hy 0
19 .ad l
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_GABN" "3" "Jun 30, 2000" "BIND9" "BIND9"
25 .\" disable hyphenation
26 .nh
27 .\" disable justification (adjust text to left margin only)
28 .ad l
29 .SH "NAME"
30 lwres_gabnrequest_render, lwres_gabnresponse_render, lwres_gabnrequest_parse, lwres_gabnresponse_parse, lwres_gabnresponse_free, lwres_gabnrequest_free \- lightweight resolver getaddrbyname message handling
31 .SH "SYNOPSIS"
32 .nf
33 #include <lwres/lwres.h>
34 .fi
35 .HP 40
36 \fBlwres_result_t\ \fBlwres_gabnrequest_render\fR\fR\fB(\fR\fBlwres_context_t\ *ctx\fR\fB, \fR\fBlwres_gabnrequest_t\ *req\fR\fB, \fR\fBlwres_lwpacket_t\ *pkt\fR\fB, \fR\fBlwres_buffer_t\ *b\fR\fB);\fR
37 .HP 41
38 \fBlwres_result_t\ \fBlwres_gabnresponse_render\fR\fR\fB(\fR\fBlwres_context_t\ *ctx\fR\fB, \fR\fBlwres_gabnresponse_t\ *req\fR\fB, \fR\fBlwres_lwpacket_t\ *pkt\fR\fB, \fR\fBlwres_buffer_t\ *b\fR\fB);\fR
39 .HP 39
40 \fBlwres_result_t\ \fBlwres_gabnrequest_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_gabnrequest_t\ **structp\fR\fB);\fR
41 .HP 40
42 \fBlwres_result_t\ \fBlwres_gabnresponse_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_gabnresponse_t\ **structp\fR\fB);\fR
43 .HP 29
44 \fBvoid\ \fBlwres_gabnresponse_free\fR\fR\fB(\fR\fBlwres_context_t\ *ctx\fR\fB, \fR\fBlwres_gabnresponse_t\ **structp\fR\fB);\fR
45 .HP 28
46 \fBvoid\ \fBlwres_gabnrequest_free\fR\fR\fB(\fR\fBlwres_context_t\ *ctx\fR\fB, \fR\fBlwres_gabnrequest_t\ **structp\fR\fB);\fR
47 .SH "DESCRIPTION"
48 .PP
49 These are low\-level routines for creating and parsing lightweight resolver name\-to\-address lookup request and response messages.
50 .PP
51 There are four main functions for the getaddrbyname opcode. One render function converts a getaddrbyname request structure \(em
52 \fBlwres_gabnrequest_t\fR
53 \(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
54 \fBlwres_gabnresponse_t\fR
55 \(em to the canonical format. This is complemented by a parse function which converts a packet in canonical format to a getaddrbyname response structure.
56 .PP
57 These structures are defined in
58 \fI<lwres/lwres.h>\fR. They are shown below.
59 .sp
60 .nf
61 #define LWRES_OPCODE_GETADDRSBYNAME     0x00010001U
62 typedef struct lwres_addr lwres_addr_t;
63 typedef LWRES_LIST(lwres_addr_t) lwres_addrlist_t;
64 typedef struct {
65         lwres_uint32_t  flags;
66         lwres_uint32_t  addrtypes;
67         lwres_uint16_t  namelen;
68         char           *name;
69 } lwres_gabnrequest_t;
70 typedef struct {
71         lwres_uint32_t          flags;
72         lwres_uint16_t          naliases;
73         lwres_uint16_t          naddrs;
74         char                   *realname;
75         char                  **aliases;
76         lwres_uint16_t          realnamelen;
77         lwres_uint16_t         *aliaslen;
78         lwres_addrlist_t        addrs;
79         void                   *base;
80         size_t                  baselen;
81 } lwres_gabnresponse_t;
82 .fi
83 .sp
84 .PP
85 \fBlwres_gabnrequest_render()\fR
86 uses resolver context
87 \fIctx\fR
88 to convert getaddrbyname request structure
89 \fIreq\fR
90 to canonical format. The packet header structure
91 \fIpkt\fR
92 is initialised and transferred to buffer
93 \fIb\fR. The contents of
94 \fI*req\fR
95 are then appended to the buffer in canonical format.
96 \fBlwres_gabnresponse_render()\fR
97 performs the same task, except it converts a getaddrbyname response structure
98 \fBlwres_gabnresponse_t\fR
99 to the lightweight resolver's canonical format.
100 .PP
101 \fBlwres_gabnrequest_parse()\fR
102 uses context
103 \fIctx\fR
104 to convert the contents of packet
105 \fIpkt\fR
106 to a
107 \fBlwres_gabnrequest_t\fR
108 structure. Buffer
109 \fIb\fR
110 provides space to be used for storing this structure. When the function succeeds, the resulting
111 \fBlwres_gabnrequest_t\fR
112 is made available through
113 \fI*structp\fR.
114 \fBlwres_gabnresponse_parse()\fR
115 offers the same semantics as
116 \fBlwres_gabnrequest_parse()\fR
117 except it yields a
118 \fBlwres_gabnresponse_t\fR
119 structure.
120 .PP
121 \fBlwres_gabnresponse_free()\fR
122 and
123 \fBlwres_gabnrequest_free()\fR
124 release the memory in resolver context
125 \fIctx\fR
126 that was allocated to the
127 \fBlwres_gabnresponse_t\fR
128 or
129 \fBlwres_gabnrequest_t\fR
130 structures referenced via
131 \fIstructp\fR. Any memory associated with ancillary buffers and strings for those structures is also discarded.
132 .SH "RETURN VALUES"
133 .PP
134 The getaddrbyname opcode functions
135 \fBlwres_gabnrequest_render()\fR,
136 \fBlwres_gabnresponse_render()\fR\fBlwres_gabnrequest_parse()\fR
137 and
138 \fBlwres_gabnresponse_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_gabnrequest_t\fR
149 and
150 \fBlwres_gabnresponse_t\fR
151 structures.
152 \fBlwres_gabnrequest_parse()\fR
153 and
154 \fBlwres_gabnresponse_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 )