1 <!-- Copyright (C) 2003 Red Hat, Inc. -->
2 <!-- This material may be distributed only subject to the terms -->
3 <!-- and conditions set forth in the Open Publication License, v1.0 -->
4 <!-- or later (the latest version is presently available at -->
5 <!-- http://www.opencontent.org/openpub/). -->
6 <!-- Distribution of the work or derivative of the work in any -->
7 <!-- standard (paper) book form is prohibited unless prior -->
8 <!-- permission is obtained from the copyright holder. -->
12 >getrrsetbyname</TITLE
13 ><meta name="MSSmartTagsPreventParsing" content="TRUE">
16 CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
19 TITLE="eCos Reference Manual"
20 HREF="ecos-ref.html"><LINK
22 TITLE="TCP/IP Library Reference"
23 HREF="tcpip-library-reference.html"><LINK
26 HREF="net-common-tcpip-manpages-getprotoent.html"><LINK
29 HREF="net-common-tcpip-manpages-getservent.html"></HEAD
40 SUMMARY="Header navigation table"
49 >eCos Reference Manual</TH
57 HREF="net-common-tcpip-manpages-getprotoent.html"
65 >Chapter 38. TCP/IP Library Reference</TD
71 HREF="net-common-tcpip-manpages-getservent.html"
85 NAME="NET-COMMON-TCPIP-MANPAGES-GETRRSETBYNAME">getrrsetbyname</H1
94 >GETRRSETBYNAME(3) System Library Functions Manual GETRRSETBYNAME(3)
97 getrrsetbyname - retrieve DNS records
100 #include <netdb.h>
103 getrrsetbyname(const char *hostname, unsigned int rdclass,
104 unsigned int rdtype, unsigned int flags, struct rrsetinfo **res);
107 freerrset(struct rrsetinfo **rrset);
110 getrrsetbyname() gets a set of resource records associated with a
111 hostname, class and type. hostname is a pointer a to null-terminated
112 string. The flags field is currently unused and must be zero.
114 After a successful call to getrrsetbyname(), *res is a pointer to an
115 rrsetinfo structure, containing a list of one or more rdatainfo struc-
116 tures containing resource records and potentially another list of
117 rdatainfo structures containing SIG resource records associated with
118 those records. The members rri_rdclass and rri_rdtype are copied from
119 the parameters. rri_ttl and rri_name are properties of the obtained
120 rrset. The resource records contained in rri_rdatas and rri_sigs are in
121 uncompressed DNS wire format. Properties of the rdataset are represented
122 in the rri_flags bitfield. If the RRSET_VALIDATED bit is set, the data
123 has been DNSSEC validated and the signatures verified.
125 The following structures are used:
128 unsigned int rdi_length; /* length of data */
129 unsigned char *rdi_data; /* record data */
133 unsigned int rri_flags; /* RRSET_VALIDATED ... */
134 unsigned int rri_rdclass; /* class number */
135 unsigned int rri_rdtype; /* RR type number */
136 unsigned int rri_ttl; /* time to live */
137 unsigned int rri_nrdatas; /* size of rdatas array */
138 unsigned int rri_nsigs; /* size of sigs array */
139 char *rri_name; /* canonical name */
140 struct rdatainfo *rri_rdatas; /* individual records */
141 struct rdatainfo *rri_sigs; /* individual signatures */
144 All of the information returned by getrrsetbyname() is dynamically allo-
145 cated: the rrsetinfo and rdatainfo structures, and the canonical host
146 name strings pointed to by the rrsetinfostructure. Memory allocated for
147 the dynamically allocated structures created by a successful call to
148 getrrsetbyname() is released by freerrset(). rrset is a pointer to a
149 struct rrset created by a call to getrrsetbyname().
151 If the EDNS0 option is activated in resolv.conf(3), getrrsetbyname() will
152 request DNSSEC authentication using the EDNS0 DNSSEC OK (DO) bit.
155 getrrsetbyname() returns zero on success, and one of the following error
156 codes if an error occurred:
158 ERRSET_NONAME the name does not exist
159 ERRSET_NODATA the name exists, but does not have data of the desired
161 ERRSET_NOMEMORY memory could not be allocated
162 ERRSET_INVAL a parameter is invalid
163 ERRSET_FAIL other failure
166 resolver(3), resolv.conf(5), named(8)
169 Jakob Schlyter <jakob@openbsd.org>
172 getrrsetbyname() first appeared in OpenBSD 3.0. The API first appeared
173 in ISC BIND version 9.
176 The data in *rdi_data should be returned in uncompressed wire format.
177 Currently, the data is in compressed format and the caller can't uncom-
178 press since it doesn't have the full message.
181 The RRSET_VALIDATED flag in rri_flags is set if the AD (autenticated
182 data) bit in the DNS answer is set. This flag should not be trusted
183 unless the transport between the nameserver and the resolver is secure
184 (e.g. IPsec, trusted network, loopback communication).
197 SUMMARY="Footer navigation table"
208 HREF="net-common-tcpip-manpages-getprotoent.html"
226 HREF="net-common-tcpip-manpages-getservent.html"
242 HREF="tcpip-library-reference.html"