1/*
2 * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
3 *
4 * Permission to use, copy, modify, and/or 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
17/* $Id: rdatalist.h,v 1.2 2020/02/13 13:53:01 jsg Exp $ */
18
19#ifndef DNS_RDATALIST_H
20#define DNS_RDATALIST_H 1
21
22/*****
23 ***** Module Info
24 *****/
25
26/*! \file dns/rdatalist.h
27 * \brief
28 * A DNS rdatalist is a list of rdata of a common type and class.
29 *
30 * MP:
31 *\li	Clients of this module must impose any required synchronization.
32 *
33 * Reliability:
34 *\li	No anticipated impact.
35 *
36 * Resources:
37 *\li	TBS
38 *
39 * Security:
40 *\li	No anticipated impact.
41 *
42 * Standards:
43 *\li	None.
44 */
45
46#include <dns/types.h>
47
48/*%
49 * Clients may use this type directly.
50 */
51struct dns_rdatalist {
52	dns_rdataclass_t		rdclass;
53	dns_rdatatype_t			type;
54	dns_rdatatype_t			covers;
55	dns_ttl_t			ttl;
56	ISC_LIST(dns_rdata_t)		rdata;
57	ISC_LINK(dns_rdatalist_t)	link;
58};
59
60void
61dns_rdatalist_init(dns_rdatalist_t *rdatalist);
62/*%<
63 * Initialize rdatalist.
64 *
65 * Ensures:
66 *\li	All fields of rdatalist have been initialized to their default
67 *	values.
68 */
69
70isc_result_t
71dns_rdatalist_tordataset(dns_rdatalist_t *rdatalist,
72			 dns_rdataset_t *rdataset);
73/*%<
74 * Make 'rdataset' refer to the rdata in 'rdatalist'.
75 *
76 * Note:
77 *\li	The caller must ensure that 'rdatalist' remains valid and unchanged
78 *	while 'rdataset' is associated with it.
79 *
80 * Requires:
81 *
82 *\li	'rdatalist' is a valid rdatalist.
83 *
84 *\li	'rdataset' is a valid rdataset that is not currently associated with
85 *	any rdata.
86 *
87 * Ensures,
88 *	on success,
89 *
90 *\li		'rdataset' is associated with the rdata in rdatalist.
91 *
92 * Returns:
93 *\li	#ISC_R_SUCCESS
94 */
95
96isc_result_t
97dns_rdatalist_fromrdataset(dns_rdataset_t *rdataset,
98			   dns_rdatalist_t **rdatalist);
99/*%<
100 * Point 'rdatalist' to the rdatalist in 'rdataset'.
101 *
102 * Requires:
103 *
104 *\li	'rdatalist' is a pointer to a NULL dns_rdatalist_t pointer.
105 *
106 *\li	'rdataset' is a valid rdataset associated with an rdatalist.
107 *
108 * Ensures,
109 *	on success,
110 *
111 *\li		'rdatalist' is pointed to the rdatalist in rdataset.
112 *
113 * Returns:
114 *\li	#ISC_R_SUCCESS
115 */
116
117#endif /* DNS_RDATALIST_H */
118