]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - contrib/unbound/daemon/cachedump.h
- Copy stable/10@285827 to releng/10.2 in preparation for 10.2-RC1
[FreeBSD/releng/10.2.git] / contrib / unbound / daemon / cachedump.h
1 /*
2  * daemon/cachedump.h - dump the cache to text format.
3  *
4  * Copyright (c) 2008, NLnet Labs. All rights reserved.
5  *
6  * This software is open source.
7  * 
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  * 
12  * Redistributions of source code must retain the above copyright notice,
13  * this list of conditions and the following disclaimer.
14  * 
15  * Redistributions in binary form must reproduce the above copyright notice,
16  * this list of conditions and the following disclaimer in the documentation
17  * and/or other materials provided with the distribution.
18  * 
19  * Neither the name of the NLNET LABS nor the names of its contributors may
20  * be used to endorse or promote products derived from this software without
21  * specific prior written permission.
22  * 
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27  * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
29  * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
30  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
31  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
32  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34  */
35
36 /**
37  * \file
38  *
39  * This file contains functions to read and write the cache(s)
40  * to text format.
41  *
42  * The format of the file is as follows:
43  * [RRset cache]
44  * [Message cache]
45  * EOF          -- fixed string "EOF" before end of the file.
46  *
47  * The RRset cache is:
48  * START_RRSET_CACHE
49  * [rrset]*
50  * END_RRSET_CACHE
51  *
52  * rrset is:
53  * ;rrset [nsec_apex] TTL rr_count rrsig_count trust security
54  * resource records, one per line, in zonefile format
55  * rrsig records, one per line, in zonefile format
56  * If the text conversion fails, BADRR is printed on the line.
57  *
58  * The Message cache is:
59  * START_MSG_CACHE
60  * [msg]*
61  * END_MSG_CACHE
62  *
63  * msg is:
64  * msg name class type flags qdcount ttl security an ns ar
65  * list of rrset references, one per line. If conversion fails, BADREF
66  * reference is:
67  * name class type flags
68  *
69  * Expired cache entries are not printed.
70  */
71
72 #ifndef DAEMON_DUMPCACHE_H
73 #define DAEMON_DUMPCACHE_H
74 struct worker;
75
76 /**
77  * Dump cache(s) to text
78  * @param ssl: to print to
79  * @param worker: worker that is available (buffers, etc) and has 
80  *      ptrs to the caches.
81  * @return false on ssl print error.
82  */
83 int dump_cache(SSL* ssl, struct worker* worker);
84
85 /**
86  * Load cache(s) from text 
87  * @param ssl: to read from 
88  * @param worker: worker that is available (buffers, etc) and has 
89  *      ptrs to the caches.
90  * @return false on ssl error.
91  */
92 int load_cache(SSL* ssl, struct worker* worker);
93
94 /**
95  * Print the delegation used to lookup for this name.
96  * @param ssl: to read from 
97  * @param worker: worker that is available (buffers, etc) and has 
98  *      ptrs to the caches.
99  * @param nm: name to lookup
100  * @param nmlen: length of name.
101  * @param nmlabs: labels in name.
102  * @return false on ssl error.
103  */
104 int print_deleg_lookup(SSL* ssl, struct worker* worker, uint8_t* nm,
105         size_t nmlen, int nmlabs);
106
107 #endif /* DAEMON_DUMPCACHE_H */