Merge branch 'vendor/TCPDUMP' (early part)
[dragonfly.git] / contrib / bind-9.3 / lib / dns / include / dns / ncache.h
1 /*
2  * Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
3  * Copyright (C) 1999-2002  Internet Software Consortium.
4  *
5  * Permission to use, copy, modify, and 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: ncache.h,v 1.12.12.5 2004/03/08 09:04:37 marka Exp $ */
19
20 #ifndef DNS_NCACHE_H
21 #define DNS_NCACHE_H 1
22
23 /*****
24  ***** Module Info
25  *****/
26
27 /*
28  * DNS Ncache
29  *
30  * XXX <TBS> XXX
31  *
32  * MP:
33  *      The caller must ensure any required synchronization.
34  *
35  * Reliability:
36  *      No anticipated impact.
37  *
38  * Resources:
39  *      <TBS>
40  *
41  * Security:
42  *      No anticipated impact.
43  *
44  * Standards:
45  *      RFC 2308
46  */
47
48 #include <isc/lang.h>
49 #include <isc/stdtime.h>
50
51 #include <dns/types.h>
52
53 ISC_LANG_BEGINDECLS
54
55 /*
56  * _OMITDNSSEC:
57  *      Omit DNSSEC records when rendering.
58  */
59 #define DNS_NCACHETOWIRE_OMITDNSSEC   0x0001
60
61 isc_result_t
62 dns_ncache_add(dns_message_t *message, dns_db_t *cache, dns_dbnode_t *node,
63                dns_rdatatype_t covers, isc_stdtime_t now, dns_ttl_t maxttl,
64                dns_rdataset_t *addedrdataset);
65 /*
66  * Convert the authority data from 'message' into a negative cache
67  * rdataset, and store it in 'cache' at 'node' with a TTL limited to
68  * 'maxttl'.
69  *
70  * The 'covers' argument is the RR type whose nonexistence we are caching,
71  * or dns_rdatatype_any when caching a NXDOMAIN response.
72  *
73  * Note:
74  *      If 'addedrdataset' is not NULL, then it will be attached to the added
75  *      rdataset.  See dns_db_addrdataset() for more details.
76  *
77  * Requires:
78  *      'message' is a valid message with a properly formatting negative cache
79  *      authority section.
80  *
81  *      The requirements of dns_db_addrdataset() apply to 'cache', 'node',
82  *      'now', and 'addedrdataset'.
83  *
84  * Returns:
85  *      ISC_R_SUCCESS
86  *      ISC_R_NOSPACE
87  *
88  *      Any result code of dns_db_addrdataset() is a possible result code
89  *      of dns_ncache_add().
90  */
91
92 isc_result_t
93 dns_ncache_towire(dns_rdataset_t *rdataset, dns_compress_t *cctx,
94                   isc_buffer_t *target, unsigned int options,
95                   unsigned int *countp);
96 /*
97  * Convert the negative caching rdataset 'rdataset' to wire format,
98  * compressing names as specified in 'cctx', and storing the result in
99  * 'target'.  If 'omit_dnssec' is set, DNSSEC records will not
100  * be added to 'target'.
101  *
102  * Notes:
103  *      The number of RRs added to target will be added to *countp.
104  *
105  * Requires:
106  *      'rdataset' is a valid negative caching rdataset.
107  *
108  *      'rdataset' is not empty.
109  *
110  *      'countp' is a valid pointer.
111  *
112  * Ensures:
113  *      On a return of ISC_R_SUCCESS, 'target' contains a wire format
114  *      for the data contained in 'rdataset'.  Any error return leaves
115  *      the buffer unchanged.
116  *
117  *      *countp has been incremented by the number of RRs added to
118  *      target.
119  *
120  * Returns:
121  *      ISC_R_SUCCESS           - all ok
122  *      ISC_R_NOSPACE           - 'target' doesn't have enough room
123  *
124  *      Any error returned by dns_rdata_towire(), dns_rdataset_next(),
125  *      dns_name_towire().
126  */
127
128 isc_result_t
129 dns_ncache_getrdataset(dns_rdataset_t *ncacherdataset, dns_name_t *name,
130                        dns_rdatatype_t type, dns_rdataset_t *rdataset);
131 /*
132  * Search the negative caching rdataset for an rdataset with the
133  * specified name and type.
134  *
135  * Requires:
136  *      'ncacherdataset' is a valid negative caching rdataset.
137  *
138  *      'ncacherdataset' is not empty.
139  *
140  *      'name' is a valid name.
141  *
142  *      'type' is not SIG, or a meta-RR type.
143  *
144  *      'rdataset' is a valid disassociated rdataset.
145  *
146  * Ensures:
147  *      On a return of ISC_R_SUCCESS, 'rdataset' is bound to the found
148  *      rdataset.
149  *
150  * Returns:
151  *      ISC_R_SUCCESS           - the rdataset was found.
152  *      ISC_R_NOTFOUND          - the rdataset was not found.
153  *
154  */
155
156 ISC_LANG_ENDDECLS
157
158 #endif /* DNS_NCACHE_H */