1 /*	$NetBSD: rdataset.h,v 1.9 2015/07/08 17:28:59 christos Exp $	*/
2 
3 /*
4  * Copyright (C) 2004-2012, 2014  Internet Systems Consortium, Inc. ("ISC")
5  * Copyright (C) 1999-2003  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: rdataset.h,v 1.72 2011/06/08 22:13:51 each Exp  */
21 
22 #ifndef DNS_RDATASET_H
23 #define DNS_RDATASET_H 1
24 
25 /*****
26  ***** Module Info
27  *****/
28 
29 /*! \file dns/rdataset.h
30  * \brief
31  * A DNS rdataset is a handle that can be associated with a collection of
32  * rdata all having a common owner name, class, and type.
33  *
34  * The dns_rdataset_t type is like a "virtual class".  To actually use
35  * rdatasets, an implementation of the method suite (e.g. "slabbed rdata") is
36  * required.
37  *
38  * XXX <more> XXX
39  *
40  * MP:
41  *\li	Clients of this module must impose any required synchronization.
42  *
43  * Reliability:
44  *\li	No anticipated impact.
45  *
46  * Resources:
47  *\li	TBS
48  *
49  * Security:
50  *\li	No anticipated impact.
51  *
52  * Standards:
53  *\li	None.
54  */
55 
56 #include <isc/lang.h>
57 #include <isc/magic.h>
58 #include <isc/stdtime.h>
59 
60 #include <dns/types.h>
61 #include <dns/rdatastruct.h>
62 
63 ISC_LANG_BEGINDECLS
64 
65 typedef enum {
66 	dns_rdatasetadditional_fromauth,
67 	dns_rdatasetadditional_fromcache,
68 	dns_rdatasetadditional_fromglue
69 } dns_rdatasetadditional_t;
70 
71 typedef struct dns_rdatasetmethods {
72 	void			(*disassociate)(dns_rdataset_t *rdataset);
73 	isc_result_t		(*first)(dns_rdataset_t *rdataset);
74 	isc_result_t		(*next)(dns_rdataset_t *rdataset);
75 	void			(*current)(dns_rdataset_t *rdataset,
76 					   dns_rdata_t *rdata);
77 	void			(*clone)(dns_rdataset_t *source,
78 					 dns_rdataset_t *target);
79 	unsigned int		(*count)(dns_rdataset_t *rdataset);
80 	isc_result_t		(*addnoqname)(dns_rdataset_t *rdataset,
81 					      dns_name_t *name);
82 	isc_result_t		(*getnoqname)(dns_rdataset_t *rdataset,
83 					      dns_name_t *name,
84 					      dns_rdataset_t *neg,
85 					      dns_rdataset_t *negsig);
86 	isc_result_t		(*addclosest)(dns_rdataset_t *rdataset,
87 					      dns_name_t *name);
88 	isc_result_t		(*getclosest)(dns_rdataset_t *rdataset,
89 					      dns_name_t *name,
90 					      dns_rdataset_t *neg,
91 					      dns_rdataset_t *negsig);
92 	isc_result_t		(*getadditional)(dns_rdataset_t *rdataset,
93 						 dns_rdatasetadditional_t type,
94 						 dns_rdatatype_t qtype,
95 						 dns_acache_t *acache,
96 						 dns_zone_t **zonep,
97 						 dns_db_t **dbp,
98 						 dns_dbversion_t **versionp,
99 						 dns_dbnode_t **nodep,
100 						 dns_name_t *fname,
101 						 dns_message_t *msg,
102 						 isc_stdtime_t now);
103 	isc_result_t		(*setadditional)(dns_rdataset_t *rdataset,
104 						 dns_rdatasetadditional_t type,
105 						 dns_rdatatype_t qtype,
106 						 dns_acache_t *acache,
107 						 dns_zone_t *zone,
108 						 dns_db_t *db,
109 						 dns_dbversion_t *version,
110 						 dns_dbnode_t *node,
111 						 dns_name_t *fname);
112 	isc_result_t		(*putadditional)(dns_acache_t *acache,
113 						 dns_rdataset_t *rdataset,
114 						 dns_rdatasetadditional_t type,
115 						 dns_rdatatype_t qtype);
116 	void			(*settrust)(dns_rdataset_t *rdataset,
117 					    dns_trust_t trust);
118 	void			(*expire)(dns_rdataset_t *rdataset);
119 	void			(*clearprefetch)(dns_rdataset_t *rdataset);
120 } dns_rdatasetmethods_t;
121 
122 #define DNS_RDATASET_MAGIC	       ISC_MAGIC('D','N','S','R')
123 #define DNS_RDATASET_VALID(set)	       ISC_MAGIC_VALID(set, DNS_RDATASET_MAGIC)
124 
125 /*%
126  * Direct use of this structure by clients is strongly discouraged, except
127  * for the 'link' field which may be used however the client wishes.  The
128  * 'private', 'current', and 'index' fields MUST NOT be changed by clients.
129  * rdataset implementations may change any of the fields.
130  */
131 struct dns_rdataset {
132 	unsigned int			magic;		/* XXX ? */
133 	dns_rdatasetmethods_t *		methods;
134 	ISC_LINK(dns_rdataset_t)	link;
135 	/*
136 	 * XXX do we need these, or should they be retrieved by methods?
137 	 * Leaning towards the latter, since they are not frequently required
138 	 * once you have the rdataset.
139 	 */
140 	dns_rdataclass_t		rdclass;
141 	dns_rdatatype_t			type;
142 	dns_ttl_t			ttl;
143 	dns_trust_t			trust;
144 	dns_rdatatype_t			covers;
145 	/*
146 	 * attributes
147 	 */
148 	unsigned int			attributes;
149 	/*%
150 	 * the counter provides the starting point in the "cyclic" order.
151 	 * The value ISC_UINT32_MAX has a special meaning of "picking up a
152 	 * random value." in order to take care of databases that do not
153 	 * increment the counter.
154 	 */
155 	isc_uint32_t			count;
156 	/*
157 	 * This RRSIG RRset should be re-generated around this time.
158 	 * Only valid if DNS_RDATASETATTR_RESIGN is set in attributes.
159 	 */
160 	isc_stdtime_t			resign;
161 	/*@{*/
162 	/*%
163 	 * These are for use by the rdataset implementation, and MUST NOT
164 	 * be changed by clients.
165 	 */
166 	void *				private1;
167 	void *				private2;
168 	void *				private3;
169 	unsigned int			privateuint4;
170 	void *				private5;
171 	void *				private6;
172 	void *				private7;
173 	/*@}*/
174 
175 };
176 
177 /*!
178  * \def DNS_RDATASETATTR_RENDERED
179  *	Used by message.c to indicate that the rdataset was rendered.
180  *
181  * \def DNS_RDATASETATTR_TTLADJUSTED
182  *	Used by message.c to indicate that the rdataset's rdata had differing
183  *	TTL values, and the rdataset->ttl holds the smallest.
184  *
185  * \def DNS_RDATASETATTR_LOADORDER
186  *	Output the RRset in load order.
187  */
188 
189 #define DNS_RDATASETATTR_QUESTION	0x00000001
190 #define DNS_RDATASETATTR_RENDERED	0x00000002	/*%< Used by message.c */
191 #define DNS_RDATASETATTR_ANSWERED	0x00000004	/*%< Used by server. */
192 #define DNS_RDATASETATTR_CACHE		0x00000008	/*%< Used by resolver. */
193 #define DNS_RDATASETATTR_ANSWER		0x00000010	/*%< Used by resolver. */
194 #define DNS_RDATASETATTR_ANSWERSIG	0x00000020	/*%< Used by resolver. */
195 #define DNS_RDATASETATTR_EXTERNAL	0x00000040	/*%< Used by resolver. */
196 #define DNS_RDATASETATTR_NCACHE		0x00000080	/*%< Used by resolver. */
197 #define DNS_RDATASETATTR_CHAINING	0x00000100	/*%< Used by resolver. */
198 #define DNS_RDATASETATTR_TTLADJUSTED	0x00000200	/*%< Used by message.c */
199 #define DNS_RDATASETATTR_FIXEDORDER	0x00000400
200 #define DNS_RDATASETATTR_RANDOMIZE	0x00000800
201 #define DNS_RDATASETATTR_CHASE		0x00001000	/*%< Used by resolver. */
202 #define DNS_RDATASETATTR_NXDOMAIN	0x00002000
203 #define DNS_RDATASETATTR_NOQNAME	0x00004000
204 #define DNS_RDATASETATTR_CHECKNAMES	0x00008000	/*%< Used by resolver. */
205 #define DNS_RDATASETATTR_REQUIRED	0x00010000
206 #define DNS_RDATASETATTR_REQUIREDGLUE	DNS_RDATASETATTR_REQUIRED
207 #define DNS_RDATASETATTR_LOADORDER	0x00020000
208 #define DNS_RDATASETATTR_RESIGN		0x00040000
209 #define DNS_RDATASETATTR_CLOSEST	0x00080000
210 #define DNS_RDATASETATTR_OPTOUT		0x00100000	/*%< OPTOUT proof */
211 #define DNS_RDATASETATTR_NEGATIVE	0x00200000
212 #define DNS_RDATASETATTR_PREFETCH	0x00400000
213 
214 /*%
215  * _OMITDNSSEC:
216  * 	Omit DNSSEC records when rendering ncache records.
217  */
218 #define DNS_RDATASETTOWIRE_OMITDNSSEC	0x0001
219 
220 void
221 dns_rdataset_init(dns_rdataset_t *rdataset);
222 /*%<
223  * Make 'rdataset' a valid, disassociated rdataset.
224  *
225  * Requires:
226  *\li	'rdataset' is not NULL.
227  *
228  * Ensures:
229  *\li	'rdataset' is a valid, disassociated rdataset.
230  */
231 
232 void
233 dns_rdataset_invalidate(dns_rdataset_t *rdataset);
234 /*%<
235  * Invalidate 'rdataset'.
236  *
237  * Requires:
238  *\li	'rdataset' is a valid, disassociated rdataset.
239  *
240  * Ensures:
241  *\li	If assertion checking is enabled, future attempts to use 'rdataset'
242  *	without initializing it will cause an assertion failure.
243  */
244 
245 void
246 dns_rdataset_disassociate(dns_rdataset_t *rdataset);
247 /*%<
248  * Disassociate 'rdataset' from its rdata, allowing it to be reused.
249  *
250  * Notes:
251  *\li	The client must ensure it has no references to rdata in the rdataset
252  *	before disassociating.
253  *
254  * Requires:
255  *\li	'rdataset' is a valid, associated rdataset.
256  *
257  * Ensures:
258  *\li	'rdataset' is a valid, disassociated rdataset.
259  */
260 
261 isc_boolean_t
262 dns_rdataset_isassociated(dns_rdataset_t *rdataset);
263 /*%<
264  * Is 'rdataset' associated?
265  *
266  * Requires:
267  *\li	'rdataset' is a valid rdataset.
268  *
269  * Returns:
270  *\li	#ISC_TRUE			'rdataset' is associated.
271  *\li	#ISC_FALSE			'rdataset' is not associated.
272  */
273 
274 void
275 dns_rdataset_makequestion(dns_rdataset_t *rdataset, dns_rdataclass_t rdclass,
276 			  dns_rdatatype_t type);
277 /*%<
278  * Make 'rdataset' a valid, associated, question rdataset, with a
279  * question class of 'rdclass' and type 'type'.
280  *
281  * Notes:
282  *\li	Question rdatasets have a class and type, but no rdata.
283  *
284  * Requires:
285  *\li	'rdataset' is a valid, disassociated rdataset.
286  *
287  * Ensures:
288  *\li	'rdataset' is a valid, associated, question rdataset.
289  */
290 
291 void
292 dns_rdataset_clone(dns_rdataset_t *source, dns_rdataset_t *target);
293 /*%<
294  * Make 'target' refer to the same rdataset as 'source'.
295  *
296  * Requires:
297  *\li	'source' is a valid, associated rdataset.
298  *
299  *\li	'target' is a valid, dissociated rdataset.
300  *
301  * Ensures:
302  *\li	'target' references the same rdataset as 'source'.
303  */
304 
305 unsigned int
306 dns_rdataset_count(dns_rdataset_t *rdataset);
307 /*%<
308  * Return the number of records in 'rdataset'.
309  *
310  * Requires:
311  *\li	'rdataset' is a valid, associated rdataset.
312  *
313  * Returns:
314  *\li	The number of records in 'rdataset'.
315  */
316 
317 isc_result_t
318 dns_rdataset_first(dns_rdataset_t *rdataset);
319 /*%<
320  * Move the rdata cursor to the first rdata in the rdataset (if any).
321  *
322  * Requires:
323  *\li	'rdataset' is a valid, associated rdataset.
324  *
325  * Returns:
326  *\li	#ISC_R_SUCCESS
327  *\li	#ISC_R_NOMORE			There are no rdata in the set.
328  */
329 
330 isc_result_t
331 dns_rdataset_next(dns_rdataset_t *rdataset);
332 /*%<
333  * Move the rdata cursor to the next rdata in the rdataset (if any).
334  *
335  * Requires:
336  *\li	'rdataset' is a valid, associated rdataset.
337  *
338  * Returns:
339  *\li	#ISC_R_SUCCESS
340  *\li	#ISC_R_NOMORE			There are no more rdata in the set.
341  */
342 
343 void
344 dns_rdataset_current(dns_rdataset_t *rdataset, dns_rdata_t *rdata);
345 /*%<
346  * Make 'rdata' refer to the current rdata.
347  *
348  * Notes:
349  *
350  *\li	The data returned in 'rdata' is valid for the life of the
351  *	rdataset; in particular, subsequent changes in the cursor position
352  *	do not invalidate 'rdata'.
353  *
354  * Requires:
355  *\li	'rdataset' is a valid, associated rdataset.
356  *
357  *\li	The rdata cursor of 'rdataset' is at a valid location (i.e. the
358  *	result of last call to a cursor movement command was ISC_R_SUCCESS).
359  *
360  * Ensures:
361  *\li	'rdata' refers to the rdata at the rdata cursor location of
362  *\li	'rdataset'.
363  */
364 
365 isc_result_t
366 dns_rdataset_totext(dns_rdataset_t *rdataset,
367 		    dns_name_t *owner_name,
368 		    isc_boolean_t omit_final_dot,
369 		    isc_boolean_t question,
370 		    isc_buffer_t *target);
371 /*%<
372  * Convert 'rdataset' to text format, storing the result in 'target'.
373  *
374  * Notes:
375  *\li	The rdata cursor position will be changed.
376  *
377  *\li	The 'question' flag should normally be #ISC_FALSE.  If it is
378  *	#ISC_TRUE, the TTL and rdata fields are not printed.  This is
379  *	for use when printing an rdata representing a question section.
380  *
381  *\li	This interface is deprecated; use dns_master_rdatasettottext()
382  * 	and/or dns_master_questiontotext() instead.
383  *
384  * Requires:
385  *\li	'rdataset' is a valid rdataset.
386  *
387  *\li	'rdataset' is not empty.
388  */
389 
390 isc_result_t
391 dns_rdataset_towire(dns_rdataset_t *rdataset,
392 		    dns_name_t *owner_name,
393 		    dns_compress_t *cctx,
394 		    isc_buffer_t *target,
395 		    unsigned int options,
396 		    unsigned int *countp);
397 /*%<
398  * Convert 'rdataset' to wire format, compressing names as specified
399  * in 'cctx', and storing the result in 'target'.
400  *
401  * Notes:
402  *\li	The rdata cursor position will be changed.
403  *
404  *\li	The number of RRs added to target will be added to *countp.
405  *
406  * Requires:
407  *\li	'rdataset' is a valid rdataset.
408  *
409  *\li	'rdataset' is not empty.
410  *
411  *\li	'countp' is a valid pointer.
412  *
413  * Ensures:
414  *\li	On a return of ISC_R_SUCCESS, 'target' contains a wire format
415  *	for the data contained in 'rdataset'.  Any error return leaves
416  *	the buffer unchanged.
417  *
418  *\li	*countp has been incremented by the number of RRs added to
419  *	target.
420  *
421  * Returns:
422  *\li	#ISC_R_SUCCESS		- all ok
423  *\li	#ISC_R_NOSPACE		- 'target' doesn't have enough room
424  *
425  *\li	Any error returned by dns_rdata_towire(), dns_rdataset_next(),
426  *	dns_name_towire().
427  */
428 
429 isc_result_t
430 dns_rdataset_towiresorted(dns_rdataset_t *rdataset,
431 			  const dns_name_t *owner_name,
432 			  dns_compress_t *cctx,
433 			  isc_buffer_t *target,
434 			  dns_rdatasetorderfunc_t order,
435 			  const void *order_arg,
436 			  unsigned int options,
437 			  unsigned int *countp);
438 /*%<
439  * Like dns_rdataset_towire(), but sorting the rdatasets according to
440  * the integer value returned by 'order' when called with the rdataset
441  * and 'order_arg' as arguments.
442  *
443  * Requires:
444  *\li	All the requirements of dns_rdataset_towire(), and
445  *	that order_arg is NULL if and only if order is NULL.
446  */
447 
448 isc_result_t
449 dns_rdataset_towirepartial(dns_rdataset_t *rdataset,
450 			   const dns_name_t *owner_name,
451 			   dns_compress_t *cctx,
452 			   isc_buffer_t *target,
453 			   dns_rdatasetorderfunc_t order,
454 			   const void *order_arg,
455 			   unsigned int options,
456 			   unsigned int *countp,
457 			   void **state);
458 /*%<
459  * Like dns_rdataset_towiresorted() except that a partial rdataset
460  * may be written.
461  *
462  * Requires:
463  *\li	All the requirements of dns_rdataset_towiresorted().
464  *	If 'state' is non NULL then the current position in the
465  *	rdataset will be remembered if the rdataset in not
466  *	completely written and should be passed on on subsequent
467  *	calls (NOT CURRENTLY IMPLEMENTED).
468  *
469  * Returns:
470  *\li	#ISC_R_SUCCESS if all of the records were written.
471  *\li	#ISC_R_NOSPACE if unable to fit in all of the records. *countp
472  *		      will be updated to reflect the number of records
473  *		      written.
474  */
475 
476 isc_result_t
477 dns_rdataset_additionaldata(dns_rdataset_t *rdataset,
478 			    dns_additionaldatafunc_t add, void *arg);
479 /*%<
480  * For each rdata in rdataset, call 'add' for each name and type in the
481  * rdata which is subject to additional section processing.
482  *
483  * Requires:
484  *
485  *\li	'rdataset' is a valid, non-question rdataset.
486  *
487  *\li	'add' is a valid dns_additionaldatafunc_t
488  *
489  * Ensures:
490  *
491  *\li	If successful, dns_rdata_additionaldata() will have been called for
492  *	each rdata in 'rdataset'.
493  *
494  *\li	If a call to dns_rdata_additionaldata() is not successful, the
495  *	result returned will be the result of dns_rdataset_additionaldata().
496  *
497  * Returns:
498  *
499  *\li	#ISC_R_SUCCESS
500  *
501  *\li	Any error that dns_rdata_additionaldata() can return.
502  */
503 
504 isc_result_t
505 dns_rdataset_getnoqname(dns_rdataset_t *rdataset, dns_name_t *name,
506 			dns_rdataset_t *neg, dns_rdataset_t *negsig);
507 /*%<
508  * Return the noqname proof for this record.
509  *
510  * Requires:
511  *\li	'rdataset' to be valid and #DNS_RDATASETATTR_NOQNAME to be set.
512  *\li	'name' to be valid.
513  *\li	'neg' and 'negsig' to be valid and not associated.
514  */
515 
516 isc_result_t
517 dns_rdataset_addnoqname(dns_rdataset_t *rdataset, dns_name_t *name);
518 /*%<
519  * Associate a noqname proof with this record.
520  * Sets #DNS_RDATASETATTR_NOQNAME if successful.
521  * Adjusts the 'rdataset->ttl' to minimum of the 'rdataset->ttl' and
522  * the 'nsec'/'nsec3' and 'rrsig(nsec)'/'rrsig(nsec3)' ttl.
523  *
524  * Requires:
525  *\li	'rdataset' to be valid and #DNS_RDATASETATTR_NOQNAME to be set.
526  *\li	'name' to be valid and have NSEC or NSEC3 and associated RRSIG
527  *	 rdatasets.
528  */
529 
530 isc_result_t
531 dns_rdataset_getclosest(dns_rdataset_t *rdataset, dns_name_t *name,
532 			dns_rdataset_t *nsec, dns_rdataset_t *nsecsig);
533 /*%<
534  * Return the closest encloser for this record.
535  *
536  * Requires:
537  *\li	'rdataset' to be valid and #DNS_RDATASETATTR_CLOSEST to be set.
538  *\li	'name' to be valid.
539  *\li	'nsec' and 'nsecsig' to be valid and not associated.
540  */
541 
542 isc_result_t
543 dns_rdataset_addclosest(dns_rdataset_t *rdataset, dns_name_t *name);
544 /*%<
545  * Associate a closest encloset proof with this record.
546  * Sets #DNS_RDATASETATTR_CLOSEST if successful.
547  * Adjusts the 'rdataset->ttl' to minimum of the 'rdataset->ttl' and
548  * the 'nsec' and 'rrsig(nsec)' ttl.
549  *
550  * Requires:
551  *\li	'rdataset' to be valid and #DNS_RDATASETATTR_CLOSEST to be set.
552  *\li	'name' to be valid and have NSEC3 and RRSIG(NSEC3) rdatasets.
553  */
554 
555 isc_result_t
556 dns_rdataset_getadditional(dns_rdataset_t *rdataset,
557 			   dns_rdatasetadditional_t type,
558 			   dns_rdatatype_t qtype,
559 			   dns_acache_t *acache,
560 			   dns_zone_t **zonep,
561 			   dns_db_t **dbp,
562 			   dns_dbversion_t **versionp,
563 			   dns_dbnode_t **nodep,
564 			   dns_name_t *fname,
565 			   dns_message_t *msg,
566 			   isc_stdtime_t now);
567 /*%<
568  * Get cached additional information from the DB node for a particular
569  * 'rdataset.'  'type' is one of dns_rdatasetadditional_fromauth,
570  * dns_rdatasetadditional_fromcache, and dns_rdatasetadditional_fromglue,
571  * which specifies the origin of the information.  'qtype' is intended to
572  * be used for specifying a particular rdata type in the cached information.
573  *
574  * Requires:
575  * \li	'rdataset' is a valid rdataset.
576  * \li	'acache' can be NULL, in which case this function will simply return
577  * 	ISC_R_FAILURE.
578  * \li	For the other pointers, see dns_acache_getentry().
579  *
580  * Ensures:
581  * \li	See dns_acache_getentry().
582  *
583  * Returns:
584  * \li	#ISC_R_SUCCESS
585  * \li	#ISC_R_FAILURE	- additional information caching is not supported.
586  * \li	#ISC_R_NOTFOUND	- the corresponding DB node has not cached additional
587  *			  information for 'rdataset.'
588  * \li	Any error that dns_acache_getentry() can return.
589  */
590 
591 isc_result_t
592 dns_rdataset_setadditional(dns_rdataset_t *rdataset,
593 			   dns_rdatasetadditional_t type,
594 			   dns_rdatatype_t qtype,
595 			   dns_acache_t *acache,
596 			   dns_zone_t *zone,
597 			   dns_db_t *db,
598 			   dns_dbversion_t *version,
599 			   dns_dbnode_t *node,
600 			   dns_name_t *fname);
601 /*%<
602  * Set cached additional information to the DB node for a particular
603  * 'rdataset.'  See dns_rdataset_getadditional for the semantics of 'type'
604  * and 'qtype'.
605  *
606  * Requires:
607  * \li	'rdataset' is a valid rdataset.
608  * \li	'acache' can be NULL, in which case this function will simply return
609  *	ISC_R_FAILURE.
610  * \li	For the other pointers, see dns_acache_setentry().
611  *
612  * Ensures:
613  * \li	See dns_acache_setentry().
614  *
615  * Returns:
616  * \li	#ISC_R_SUCCESS
617  * \li	#ISC_R_FAILURE	- additional information caching is not supported.
618  * \li	#ISC_R_NOMEMORY
619  * \li	Any error that dns_acache_setentry() can return.
620  */
621 
622 isc_result_t
623 dns_rdataset_putadditional(dns_acache_t *acache,
624 			   dns_rdataset_t *rdataset,
625 			   dns_rdatasetadditional_t type,
626 			   dns_rdatatype_t qtype);
627 /*%<
628  * Discard cached additional information stored in the DB node for a particular
629  * 'rdataset.'  See dns_rdataset_getadditional for the semantics of 'type'
630  * and 'qtype'.
631  *
632  * Requires:
633  * \li	'rdataset' is a valid rdataset.
634  * \li	'acache' can be NULL, in which case this function will simply return
635  *	ISC_R_FAILURE.
636  *
637  * Ensures:
638  * \li	See dns_acache_cancelentry().
639  *
640  * Returns:
641  * \li	#ISC_R_SUCCESS
642  * \li	#ISC_R_FAILURE	- additional information caching is not supported.
643  * \li	#ISC_R_NOTFOUND	- the corresponding DB node has not cached additional
644  *			  information for 'rdataset.'
645  */
646 
647 void
648 dns_rdataset_settrust(dns_rdataset_t *rdataset, dns_trust_t trust);
649 /*%<
650  * Set the trust of the 'rdataset' to trust in any in the backing database.
651  * The local trust level of 'rdataset' is also set.
652  */
653 
654 void
655 dns_rdataset_expire(dns_rdataset_t *rdataset);
656 /*%<
657  * Mark the rdataset to be expired in the backing database.
658  */
659 
660 void
661 dns_rdataset_clearprefetch(dns_rdataset_t *rdataset);
662 /*%<
663  * Clear the PREFETCH attribute for the given rdataset in the
664  * underlying database.
665  *
666  * In the cache database, this signals that the rdataset is not
667  * eligible to be prefetched when the TTL is close to expiring.
668  * It has no function in other databases.
669  */
670 
671 void
672 dns_rdataset_trimttl(dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset,
673 		     dns_rdata_rrsig_t *rrsig, isc_stdtime_t now,
674 		     isc_boolean_t acceptexpired);
675 /*%<
676  * Trim the ttl of 'rdataset' and 'sigrdataset' so that they will expire
677  * at or before 'rrsig->expiretime'.  If 'acceptexpired' is true and the
678  * signature has expired or will expire in the next 120 seconds, limit
679  * the ttl to be no more than 120 seconds.
680  *
681  * The ttl is further limited by the original ttl as stored in 'rrsig'
682  * and the original ttl values of 'rdataset' and 'sigrdataset'.
683  *
684  * Requires:
685  * \li	'rdataset' is a valid rdataset.
686  * \li	'sigrdataset' is a valid rdataset.
687  * \li	'rrsig' is non NULL.
688  */
689 
690 const char *
691 dns_trust_totext(dns_trust_t trust);
692 /*%<
693  * Display trust in textual form.
694  */
695 
696 ISC_LANG_ENDDECLS
697 
698 #endif /* DNS_RDATASET_H */
699