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