Merge from vendor branch GDB:
[dragonfly.git] / contrib / bind-9.2.4rc7 / lib / lwres / man / lwres_getrrsetbyname.3
1 .\" Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
2 .\" Copyright (C) 2000, 2001  Internet Software Consortium.
3 .\"
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.
7 .\"
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.
15 .\"
16 .\" $Id: lwres_getrrsetbyname.3,v 1.11.2.2 2004/03/15 04:45:03 marka Exp $
17 .\"
18 .TH "LWRES_GETRRSETBYNAME" "3" "Oct 18, 2000" "BIND9" ""
19 .SH NAME
20 lwres_getrrsetbyname, lwres_freerrset \- retrieve DNS records
21 .SH SYNOPSIS
22 \fB#include <lwres/netdb.h>
23 .sp
24 .na
25 int
26 lwres_getrrsetbyname(const char *hostname, unsigned int rdclass, unsigned int rdtype, unsigned int flags, struct rrsetinfo **res);
27 .ad
28 .sp
29 .na
30 void
31 lwres_freerrset(struct rrsetinfo *rrset);
32 .ad
33 \fR
34 .PP
35 The following structures are used:
36 .sp
37 .nf
38 struct  rdatainfo {
39         unsigned int            rdi_length;     /* length of data */
40         unsigned char           *rdi_data;      /* record data */
41 };
42
43 struct  rrsetinfo {
44         unsigned int            rri_flags;      /* RRSET_VALIDATED... */
45         unsigned int            rri_rdclass;    /* class number */
46         unsigned int            rri_rdtype;     /* RR type number */
47         unsigned int            rri_ttl;        /* time to live */
48         unsigned int            rri_nrdatas;    /* size of rdatas array */
49         unsigned int            rri_nsigs;      /* size of sigs array */
50         char                    *rri_name;      /* canonical name */
51         struct rdatainfo        *rri_rdatas;    /* individual records */
52         struct rdatainfo        *rri_sigs;      /* individual signatures */
53 };
54 .sp
55 .fi
56 .SH "DESCRIPTION"
57 .PP
58 \fBlwres_getrrsetbyname()\fR
59 gets a set of resource records associated with a
60 \fIhostname\fR,
61 \fIclass\fR,
62 and
63 \fItype\fR.
64 \fIhostname\fR
65 is
66 a pointer a to null-terminated string. The
67 \fIflags\fR
68 field is currently unused and must be zero.
69 .PP
70 After a successful call to
71 \fBlwres_getrrsetbyname()\fR,
72 \fI*res\fR
73 is a pointer to an
74 \fBrrsetinfo\fR
75 structure, containing a list of one or more
76 \fBrdatainfo\fR
77 structures containing resource records and potentially another list of
78 \fBrdatainfo\fR
79 structures containing SIG resource records
80 associated with those records.
81 The members
82 rri_rdclass
83 and
84 rri_rdtype
85 are copied from the parameters.
86 rri_ttl
87 and
88 rri_name
89 are properties of the obtained rrset.
90 The resource records contained in
91 rri_rdatas
92 and
93 rri_sigs
94 are in uncompressed DNS wire format.
95 Properties of the rdataset are represented in the
96 rri_flags
97 bitfield. If the RRSET_VALIDATED bit is set, the data has been DNSSEC
98 validated and the signatures verified. 
99 .PP
100 All of the information returned by
101 \fBlwres_getrrsetbyname()\fR
102 is dynamically allocated: the
103 rrsetinfo
104 and
105 rdatainfo
106 structures,
107 and the canonical host name strings pointed to by the
108 rrsetinfostructure.
109 Memory allocated for the dynamically allocated structures created by
110 a successful call to
111 \fBlwres_getrrsetbyname()\fR
112 is released by
113 \fBlwres_freerrset()\fR.
114 \fIrrset\fR
115 is a pointer to a
116 \fBstruct rrset\fR
117 created by a call to
118 \fBlwres_getrrsetbyname()\fR.
119 .PP
120 .SH "RETURN VALUES"
121 .PP
122 \fBlwres_getrrsetbyname()\fR
123 returns zero on success, and one of the following error
124 codes if an error occurred:
125 .TP
126 \fBERRSET_NONAME\fR
127 the name does not exist
128 .TP
129 \fBERRSET_NODATA\fR
130 the name exists, but does not have data of the desired type
131 .TP
132 \fBERRSET_NOMEMORY\fR
133 memory could not be allocated
134 .TP
135 \fBERRSET_INVAL\fR
136 a parameter is invalid
137 .TP
138 \fBERRSET_FAIL\fR
139 other failure
140 .TP
141 \fB\fR
142 .SH "SEE ALSO"
143 .PP
144 \fBlwres\fR(3).