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_resutil.3,v 1.14.2.1.8.5 2005/10/13 02:33:54 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_RESUTIL" "3" "Jun 30, 2000" "BIND9" "BIND9"
25 .\" disable hyphenation
27 .\" disable justification (adjust text to left margin only)
30 lwres_string_parse, lwres_addr_parse, lwres_getaddrsbyname, lwres_getnamebyaddr \- lightweight resolver utility functions
33 #include <lwres/lwres.h>
36 \fBlwres_result_t\ \fBlwres_string_parse\fR\fR\fB(\fR\fBlwres_buffer_t\ *b\fR\fB, \fR\fBchar\ **c\fR\fB, \fR\fBlwres_uint16_t\ *len\fR\fB);\fR
38 \fBlwres_result_t\ \fBlwres_addr_parse\fR\fR\fB(\fR\fBlwres_buffer_t\ *b\fR\fB, \fR\fBlwres_addr_t\ *addr\fR\fB);\fR
40 \fBlwres_result_t\ \fBlwres_getaddrsbyname\fR\fR\fB(\fR\fBlwres_context_t\ *ctx\fR\fB, \fR\fBconst\ char\ *name\fR\fB, \fR\fBlwres_uint32_t\ addrtypes\fR\fB, \fR\fBlwres_gabnresponse_t\ **structp\fR\fB);\fR
42 \fBlwres_result_t\ \fBlwres_getnamebyaddr\fR\fR\fB(\fR\fBlwres_context_t\ *ctx\fR\fB, \fR\fBlwres_uint32_t\ addrtype\fR\fB, \fR\fBlwres_uint16_t\ addrlen\fR\fB, \fR\fBconst\ unsigned\ char\ *addr\fR\fB, \fR\fBlwres_gnbaresponse_t\ **structp\fR\fB);\fR
45 \fBlwres_string_parse()\fR
46 retrieves a DNS\-encoded string starting the current pointer of lightweight resolver buffer
48 \fBb\->current\fR. When the function returns, the address of the first byte of the encoded string is returned via
50 and the length of that string is given by
51 \fI*len\fR. The buffer's current pointer is advanced to point at the character following the string length, the encoded string, and the trailing
55 \fBlwres_addr_parse()\fR
56 extracts an address from the buffer
57 \fIb\fR. The buffer's current pointer
59 is presumed to point at an encoded address: the address preceded by a 32\-bit protocol family identifier and a 16\-bit length field. The encoded address is copied to
63 indicates the size in bytes of the address that was copied.
65 is advanced to point at the next byte of available data in the buffer following the encoded address.
67 \fBlwres_getaddrsbyname()\fR
69 \fBlwres_getnamebyaddr()\fR
71 \fBlwres_gnbaresponse_t\fR
72 structure defined below:
77 lwres_uint16_t naliases;
78 lwres_uint16_t naddrs;
81 lwres_uint16_t realnamelen;
82 lwres_uint16_t *aliaslen;
83 lwres_addrlist_t addrs;
86 } lwres_gabnresponse_t;
89 The contents of this structure are not manipulated directly but they are controlled through the
93 The lightweight resolver uses
94 \fBlwres_getaddrsbyname()\fR
95 to perform foward lookups. Hostname
97 is looked up using the resolver context
99 for memory allocation.
101 is a bitmask indicating which type of addresses are to be looked up. Current values for this bitmask are
102 \fBLWRES_ADDRTYPE_V4\fR
103 for IPv4 addresses and
104 \fBLWRES_ADDRTYPE_V6\fR
105 for IPv6 addresses. Results of the lookup are returned in
108 \fBlwres_getnamebyaddr()\fR
109 performs reverse lookups. Resolver context
111 is used for memory allocation. The address type is indicated by
113 \fBLWRES_ADDRTYPE_V4\fR
115 \fBLWRES_ADDRTYPE_V6\fR. The address to be looked up is given by
119 bytes. The result of the function call is made available through
124 \fBlwres_string_parse()\fR
126 \fBlwres_addr_parse()\fR
128 \fBLWRES_R_SUCCESS.\fR
129 Both functions return
130 \fBLWRES_R_FAILURE\fR
131 if the buffer is corrupt or
132 \fBLWRES_R_UNEXPECTEDEND\fR
133 if the buffer has less space than expected for the components of the encoded string or address.
135 \fBlwres_getaddrsbyname()\fR
137 \fBLWRES_R_SUCCESS\fR
138 on success and it returns
139 \fBLWRES_R_NOTFOUND\fR
144 \fBLWRES_R_SUCCESS\fR
145 is returned by a successful call to
146 \fBlwres_getnamebyaddr()\fR.
149 \fBlwres_getaddrsbyname()\fR
151 \fBlwres_getnamebyaddr()\fR
153 \fBLWRES_R_NOMEMORY\fR
154 when memory allocation requests fail and
155 \fBLWRES_R_UNEXPECTEDEND\fR
156 if the buffers used for sending queries and receiving replies are too small.
159 \fBlwres_buffer\fR(3),