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