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_gabn.3,v 1.13.2.1.8.5 2005/10/13 02:33:52 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_GABN" "3" "Jun 30, 2000" "BIND9" "BIND9"
25 .\" disable hyphenation
27 .\" disable justification (adjust text to left margin only)
30 lwres_gabnrequest_render, lwres_gabnresponse_render, lwres_gabnrequest_parse, lwres_gabnresponse_parse, lwres_gabnresponse_free, lwres_gabnrequest_free \- lightweight resolver getaddrbyname message handling
33 #include <lwres/lwres.h>
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
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
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
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
44 \fBvoid\ \fBlwres_gabnresponse_free\fR\fR\fB(\fR\fBlwres_context_t\ *ctx\fR\fB, \fR\fBlwres_gabnresponse_t\ **structp\fR\fB);\fR
46 \fBvoid\ \fBlwres_gabnrequest_free\fR\fR\fB(\fR\fBlwres_context_t\ *ctx\fR\fB, \fR\fBlwres_gabnrequest_t\ **structp\fR\fB);\fR
49 These are low\-level routines for creating and parsing lightweight resolver name\-to\-address lookup request and response messages.
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.
57 These structures are defined in
58 \fI<lwres/lwres.h>\fR. They are shown below.
61 #define LWRES_OPCODE_GETADDRSBYNAME 0x00010001U
62 typedef struct lwres_addr lwres_addr_t;
63 typedef LWRES_LIST(lwres_addr_t) lwres_addrlist_t;
66 lwres_uint32_t addrtypes;
67 lwres_uint16_t namelen;
69 } lwres_gabnrequest_t;
72 lwres_uint16_t naliases;
73 lwres_uint16_t naddrs;
76 lwres_uint16_t realnamelen;
77 lwres_uint16_t *aliaslen;
78 lwres_addrlist_t addrs;
81 } lwres_gabnresponse_t;
85 \fBlwres_gabnrequest_render()\fR
88 to convert getaddrbyname request structure
90 to canonical format. The packet header structure
92 is initialised and transferred to buffer
93 \fIb\fR. The contents of
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.
101 \fBlwres_gabnrequest_parse()\fR
104 to convert the contents of packet
107 \fBlwres_gabnrequest_t\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
114 \fBlwres_gabnresponse_parse()\fR
115 offers the same semantics as
116 \fBlwres_gabnrequest_parse()\fR
118 \fBlwres_gabnresponse_t\fR
121 \fBlwres_gabnresponse_free()\fR
123 \fBlwres_gabnrequest_free()\fR
124 release the memory in resolver context
126 that was allocated to the
127 \fBlwres_gabnresponse_t\fR
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.
134 The getaddrbyname opcode functions
135 \fBlwres_gabnrequest_render()\fR,
136 \fBlwres_gabnresponse_render()\fR\fBlwres_gabnrequest_parse()\fR
138 \fBlwres_gabnresponse_parse()\fR
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
147 is too small to accommodate the packet header or the
148 \fBlwres_gabnrequest_t\fR
150 \fBlwres_gabnresponse_t\fR
152 \fBlwres_gabnrequest_parse()\fR
154 \fBlwres_gabnresponse_parse()\fR
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
161 in the packet header structure
162 \fBlwres_lwpacket_t\fR
163 indicate that the packet is not a response to an earlier query.
166 \fBlwres_packet\fR(3 )