1 /*	$NetBSD: rdatalist.h,v 1.4 2014/12/10 04:37:58 christos Exp $	*/
2 
3 /*
4  * Copyright (C) 2004-2008  Internet Systems Consortium, Inc. ("ISC")
5  * Copyright (C) 1999-2001  Internet Software Consortium.
6  *
7  * Permission to use, copy, modify, and/or distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
12  * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
13  * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
14  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
16  * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 /* Id: rdatalist.h,v 1.22 2008/04/03 06:09:05 tbox Exp  */
21 
22 #ifndef DNS_RDATALIST_H
23 #define DNS_RDATALIST_H 1
24 
25 /*****
26  ***** Module Info
27  *****/
28 
29 /*! \file dns/rdatalist.h
30  * \brief
31  * A DNS rdatalist is a list of rdata of a common type and class.
32  *
33  * MP:
34  *\li	Clients of this module must impose any required synchronization.
35  *
36  * Reliability:
37  *\li	No anticipated impact.
38  *
39  * Resources:
40  *\li	TBS
41  *
42  * Security:
43  *\li	No anticipated impact.
44  *
45  * Standards:
46  *\li	None.
47  */
48 
49 #include <isc/lang.h>
50 
51 #include <dns/types.h>
52 
53 /*%
54  * Clients may use this type directly.
55  */
56 struct dns_rdatalist {
57 	dns_rdataclass_t		rdclass;
58 	dns_rdatatype_t			type;
59 	dns_rdatatype_t			covers;
60 	dns_ttl_t			ttl;
61 	ISC_LIST(dns_rdata_t)		rdata;
62 	ISC_LINK(dns_rdatalist_t)	link;
63 };
64 
65 ISC_LANG_BEGINDECLS
66 
67 void
68 dns_rdatalist_init(dns_rdatalist_t *rdatalist);
69 /*%<
70  * Initialize rdatalist.
71  *
72  * Ensures:
73  *\li	All fields of rdatalist have been initialized to their default
74  *	values.
75  */
76 
77 isc_result_t
78 dns_rdatalist_tordataset(dns_rdatalist_t *rdatalist,
79 			 dns_rdataset_t *rdataset);
80 /*%<
81  * Make 'rdataset' refer to the rdata in 'rdatalist'.
82  *
83  * Note:
84  *\li	The caller must ensure that 'rdatalist' remains valid and unchanged
85  *	while 'rdataset' is associated with it.
86  *
87  * Requires:
88  *
89  *\li	'rdatalist' is a valid rdatalist.
90  *
91  *\li	'rdataset' is a valid rdataset that is not currently associated with
92  *	any rdata.
93  *
94  * Ensures,
95  *	on success,
96  *
97  *\li		'rdataset' is associated with the rdata in rdatalist.
98  *
99  * Returns:
100  *\li	#ISC_R_SUCCESS
101  */
102 
103 isc_result_t
104 dns_rdatalist_fromrdataset(dns_rdataset_t *rdataset,
105 			   dns_rdatalist_t **rdatalist);
106 /*%<
107  * Point 'rdatalist' to the rdatalist in 'rdataset'.
108  *
109  * Requires:
110  *
111  *\li	'rdatalist' is a pointer to a NULL dns_rdatalist_t pointer.
112  *
113  *\li	'rdataset' is a valid rdataset associated with an rdatalist.
114  *
115  * Ensures,
116  *	on success,
117  *
118  *\li		'rdatalist' is pointed to the rdatalist in rdataset.
119  *
120  * Returns:
121  *\li	#ISC_R_SUCCESS
122  */
123 
124 ISC_LANG_ENDDECLS
125 
126 #endif /* DNS_RDATALIST_H */
127