1 /*
2  * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
3  *
4  * This Source Code Form is subject to the terms of the Mozilla Public
5  * License, v. 2.0. If a copy of the MPL was not distributed with this
6  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7  *
8  * See the COPYRIGHT file distributed with this work for additional
9  * information regarding copyright ownership.
10  */
11 
12 #ifndef DNS_RDATALIST_H
13 #define DNS_RDATALIST_H 1
14 
15 /*****
16 ***** Module Info
17 *****/
18 
19 /*! \file dns/rdatalist.h
20  * \brief
21  * A DNS rdatalist is a list of rdata of a common type and class.
22  *
23  * MP:
24  *\li	Clients of this module must impose any required synchronization.
25  *
26  * Reliability:
27  *\li	No anticipated impact.
28  *
29  * Resources:
30  *\li	TBS
31  *
32  * Security:
33  *\li	No anticipated impact.
34  *
35  * Standards:
36  *\li	None.
37  */
38 
39 #include <isc/lang.h>
40 
41 #include <dns/types.h>
42 
43 /*%
44  * Clients may use this type directly.
45  */
46 struct dns_rdatalist {
47 	dns_rdataclass_t rdclass;
48 	dns_rdatatype_t	 type;
49 	dns_rdatatype_t	 covers;
50 	dns_ttl_t	 ttl;
51 	ISC_LIST(dns_rdata_t) rdata;
52 	ISC_LINK(dns_rdatalist_t) link;
53 	/*%<
54 	 * Case vector.  If the bit is set then the corresponding
55 	 * character in the owner name needs to be AND'd with 0x20,
56 	 * rendering that character upper case.
57 	 */
58 	unsigned char upper[32];
59 };
60 
61 ISC_LANG_BEGINDECLS
62 
63 void
64 dns_rdatalist_init(dns_rdatalist_t *rdatalist);
65 /*%<
66  * Initialize rdatalist.
67  *
68  * Ensures:
69  *\li	All fields of rdatalist have been initialized to their default
70  *	values.
71  */
72 
73 isc_result_t
74 dns_rdatalist_tordataset(dns_rdatalist_t *rdatalist, dns_rdataset_t *rdataset);
75 /*%<
76  * Make 'rdataset' refer to the rdata in 'rdatalist'.
77  *
78  * Note:
79  *\li	The caller must ensure that 'rdatalist' remains valid and unchanged
80  *	while 'rdataset' is associated with it.
81  *
82  * Requires:
83  *
84  *\li	'rdatalist' is a valid rdatalist.
85  *
86  *\li	'rdataset' is a valid rdataset that is not currently associated with
87  *	any rdata.
88  *
89  * Ensures,
90  *	on success,
91  *
92  *\li		'rdataset' is associated with the rdata in rdatalist.
93  *
94  * Returns:
95  *\li	#ISC_R_SUCCESS
96  */
97 
98 isc_result_t
99 dns_rdatalist_fromrdataset(dns_rdataset_t *  rdataset,
100 			   dns_rdatalist_t **rdatalist);
101 /*%<
102  * Point 'rdatalist' to the rdatalist in 'rdataset'.
103  *
104  * Requires:
105  *
106  *\li	'rdatalist' is a pointer to a NULL dns_rdatalist_t pointer.
107  *
108  *\li	'rdataset' is a valid rdataset associated with an rdatalist.
109  *
110  * Ensures,
111  *	on success,
112  *
113  *\li		'rdatalist' is pointed to the rdatalist in rdataset.
114  *
115  * Returns:
116  *\li	#ISC_R_SUCCESS
117  */
118 
119 ISC_LANG_ENDDECLS
120 
121 #endif /* DNS_RDATALIST_H */
122