MirBSD manpage: freerrset(3), getrrsetbyname(3)

GETRRSETBYNAME(3)          BSD Programmer's Manual           GETRRSETBYNAME(3)


     freerrset, getrrsetbyname - retrieve DNS records


     #include <netdb.h>

     getrrsetbyname(const char *hostname, unsigned int rdclass,
             unsigned int rdtype, unsigned int flags, struct rrsetinfo **res);

     freerrset(struct rrsetinfo *rrset);


     getrrsetbyname() gets a set of resource records associated with a
     hostname, rdclass, and rdtype. hostname is a pointer to a NUL-terminated
     string. The flags field is currently unused and must be zero.

     After a successful call to getrrsetbyname(), *res is a pointer to an
     rrsetinfo structure, containing a list of one or more rdatainfo struc-
     tures containing resource records and potentially another list of
     rdatainfo structures containing SIG resource records associated with
     those records. The members rri_rdclass and rri_rdtype are copied from the
     parameters. rri_ttl and rri_name are properties of the obtained rrset.
     The resource records contained in rri_rdatas and rri_sigs are in un-
     compressed DNS wire format. Properties of the rdataset are represented in
     the rri_flags bitfield. If the RRSET_VALIDATED bit is set, the data has
     been DNSSEC validated and the signatures verified.

     The following structures are used:

           struct  rdatainfo {
                   unsigned int    rdi_length;     /* length of data */
                   unsigned char   *rdi_data;      /* record data */

           struct  rrsetinfo {
                   unsigned int     rri_flags;     /* RRSET_VALIDATED ... */
                   unsigned int     rri_rdclass;   /* class number */
                   unsigned int     rri_rdtype;    /* RR type number */
                   unsigned int     rri_ttl;       /* time to live */
                   unsigned int     rri_nrdatas;   /* size of rdatas array */
                   unsigned int     rri_nsigs;     /* size of sigs array */
                   char             *rri_name;     /* canonical name */
                   struct rdatainfo *rri_rdatas;   /* individual records */
                   struct rdatainfo *rri_sigs;     /* individual signatures */

     All of the information returned by getrrsetbyname() is dynamically allo-
     cated: the rrsetinfo and rdatainfo structures, and the canonical host
     name strings pointed to by the rrsetinfo structure. Memory allocated for
     the dynamically allocated structures created by a successful call to
     getrrsetbyname() is released by freerrset(). rrset is a pointer to a
     struct rrsetinfo created by a call to getrrsetbyname().

     If the EDNS0 option is activated in resolv.conf(5), getrrsetbyname() will
     request DNSSEC authentication using the EDNS0 DNSSEC OK (DO) bit.


     getrrsetbyname() returns zero on success, and one of the following error
     codes if an error occurred:

     [ERRSET_NONAME]  The name does not exist.

     [ERRSET_NODATA]  The name exists, but does not have data of the desired

                      Memory could not be allocated.

     [ERRSET_INVAL]   A parameter is invalid.

     [ERRSET_FAIL]    Other failure.


     resolver(3), resolv.conf(5), named(8)


     getrrsetbyname() first appeared in OpenBSD 3.0. The API first appeared in
     ISC BIND version 9.


     Jakob Schlyter <jakob@openbsd.org>


     The RRSET_VALIDATED flag in rri_flags is set if the AD (authenticated
     data) bit in the DNS answer is set. This flag should not be trusted un-
     less the transport between the nameserver and the resolver is secure
     (e.g. IPsec, trusted network, loopback communication).


     The data in *rdi_data should be returned in uncompressed wire format.
     Currently, the data is in compressed format and the caller can't un-
     compress since it doesn't have the full message.

MirBSD #10-current             October 18, 2000                              1

Generated on 2022-12-24 01:00:14 by $MirOS: src/scripts/roff2htm,v 1.113 2022/12/21 23:14:31 tg Exp $ — This product includes material provided by mirabilos.

These manual pages and other documentation are copyrighted by their respective writers; their sources are available at the project’s CVSweb, AnonCVS and other mirrors. The rest is Copyright © 2002–2022 MirBSD.

This manual page’s HTML representation is supposed to be valid XHTML/1.1; if not, please send a bug report — diffs preferred.

Kontakt / Impressum & Datenschutzerklärung