1 .\" $OpenBSD: getrrsetbyname.3,v 1.4 2001/08/08 16:28:43 jakob Exp $
3 .\" Copyright (C) 2000, 2001 Internet Software Consortium.
5 .\" Permission to use, copy, modify, and distribute this software for any
6 .\" purpose with or without fee is hereby granted, provided that the above
7 .\" copyright notice and this permission notice appear in all copies.
9 .\" THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
10 .\" DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
11 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
12 .\" INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
13 .\" INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
14 .\" FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
15 .\" NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
16 .\" WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
23 .Nd retrieve DNS records
25 .Fd #include <netdb.h>
27 .Fn getrrsetbyname "const char *hostname" "unsigned int rdclass" \
28 "unsigned int rdtype" "unsigned int flags" "struct rrsetinfo **res"
30 .Fn freerrset "struct rrsetinfo **rrset"
33 gets a set of resource records associated with a
39 is a pointer a to null-terminated string.
42 field is currently unused and must be zero.
44 After a successful call to
49 structure, containing a list of one or more
51 structures containing resource records and potentially another list of
53 structures containing SIG resource records associated with those records.
58 are copied from the parameters.
62 are properties of the obtained rrset.
63 The resource records contained in
67 are in uncompressed DNS wire format.
68 Properties of the rdataset are represented in the
72 bit is set, the data has been DNSSEC
73 validated and the signatures verified.
75 The following structures are used:
78 unsigned int rdi_length; /* length of data */
79 unsigned char *rdi_data; /* record data */
83 unsigned int rri_flags; /* RRSET_VALIDATED ... */
84 unsigned int rri_rdclass; /* class number */
85 unsigned int rri_rdtype; /* RR type number */
86 unsigned int rri_ttl; /* time to live */
87 unsigned int rri_nrdatas; /* size of rdatas array */
88 unsigned int rri_nsigs; /* size of sigs array */
89 char *rri_name; /* canonical name */
90 struct rdatainfo *rri_rdatas; /* individual records */
91 struct rdatainfo *rri_sigs; /* individual signatures */
95 All of the information returned by
97 is dynamically allocated: the
102 and the canonical host name strings pointed to by the
103 .Li rrsetinfostructure.
104 Memory allocated for the dynamically allocated structures created by
115 If the EDNS0 option is activated in
118 will request DNSSEC authentication using the EDNS0 DNSSEC OK (DO) bit.
121 returns zero on success, and one of the following error
122 codes if an error occurred:
124 .Bl -tag -width ERRSET_NOMEMORY -compact
126 the name does not exist
128 the name exists, but does not have data of the desired type
129 .It Dv ERRSET_NOMEMORY
130 memory could not be allocated
132 a parameter is invalid
142 .Aq jakob@openbsd.org
147 The API first appeared in ISC BIND version 9.
151 should be returned in uncompressed wire format.
152 Currently, the data is in compressed format and the caller can't
153 uncompress since it doesn't have the full message.
159 is set if the AD (autenticated data) bit in the DNS answer is
162 be trusted unless the transport between the nameserver and the resolver
163 is secure (e.g. IPsec, trusted network, loopback communication).