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