1 /*------------------------------------------------------------------------------
2  *
3  * Copyright (c) 2011-2021, EURid vzw. All rights reserved.
4  * The YADIFA TM software product is provided under the BSD 3-clause license:
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  *
10  *        * Redistributions of source code must retain the above copyright
11  *          notice, this list of conditions and the following disclaimer.
12  *        * Redistributions in binary form must reproduce the above copyright
13  *          notice, this list of conditions and the following disclaimer in the
14  *          documentation and/or other materials provided with the distribution.
15  *        * Neither the name of EURid nor the names of its contributors may be
16  *          used to endorse or promote products derived from this software
17  *          without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  *
31  *------------------------------------------------------------------------------
32  *
33  */
34 
35 /** @defgroup config Database configuration
36  *  @ingroup dnsdb
37  *  @brief Database configuration
38  *
39  *  Database configuration #defines
40  *
41  * @{
42  */
43 
44 #ifndef _ZDB_CONFIG_H
45 #define	_ZDB_CONFIG_H
46 
47 #include <dnscore/sys_types.h>
48 
49 #include <dnsdb/zdb-config-features.h>
50 
51 #ifdef	__cplusplus
52 extern "C"
53 {
54 #endif
55 
56 #define DEFAULT_ASSUMED_CPU_COUNT       2
57 
58 /**
59  * Inlines the find operation of the AVLs/BTREEs
60  */
61 
62 #define ZDB_INLINES_AVL_FIND 1
63 
64 /**
65  * Inlines the quick operation of the HTBT
66  */
67 
68 #define ZDB_INLINES_HTBT_FIND 1
69 
70 /**
71  *
72  * Enables or disables the use of openssl for digital signatures.
73  * Disabling this is not fully supported yet. (Not at all actually)
74  *
75  * MANDATORY: 1 (for now)
76  *
77  */
78 
79 
80 #define ZDB_OPENSSL_SUPPORT 1
81 
82 /*
83  * Use the threadpool system instead of the raw threads
84  */
85 
86 #define ZDB_USE_THREADPOOL 1
87 
88 /* Here disable all the DNSSEC related third party libs */
89 #if !ZDB_HAS_DNSSEC_SUPPORT
90       #undef ZDB_OPENSSL_SUPPORT
91       #define ZDB_OPENSSL_SUPPORT 0
92 #endif
93 
94 /**
95  *
96  * Enables or disables caching.
97  *
98  * 0 => global_resource_record field not needed
99  * 1 => global_resource_record field is the cache
100  *
101  */
102 
103 #ifndef ZDB_HAS_RRCACHE_ENABLED
104 //#error "ZDB_HAS_RRCACHE_ENABLED has not been defined"
105 #define ZDB_HAS_RRCACHE_ENABLED 0
106 #endif
107 
108 /**
109  * DEBUG: Ensures that the memory allocated by ZALLOC is trashed.
110  * This is of course to avoid uninitialized memory issues.
111  *
112  * Please disable for production.
113  *
114  * Recommended value: 0
115  */
116 
117 #define DNSCORE_DEBUG_ZALLOC_TRASHMEMORY 0 /*DEBUG*/
118 
119 /**
120  * If the number of items in a dictionnary goes beyond this number, the dictionnary
121  * will change from a balanced tree (AVL) to an hash-table of balanced trees.
122  *
123  * Recommended value: 500000
124  *
125  */
126 
127 #define ZDB_HASHTABLE_THRESHOLD 500000
128 
129 /**
130  *
131  * @note 20141006 edf -- ZDB_RECORDS_MAX_CLASS set to 1 allows several optimisations
132  *
133  * Number of classes [1..n] to support.
134  * Set to 1 to support only the IN class
135  *
136  * Setting this to 1 also enables some code optimizations.
137  *
138  * Please note that the caller is responsible for checking that (qclass>0)&&(qclass<=ZDB_RECORDS_MAX_CLASS)
139  * zdb_query_* does the check but really should not.
140  * It's faster to check that a qclass is in that range or is not "CHaos" or "HeSiod" on the caller's side.
141  * (ie: if ==IN -> query, else if ==CH answer chaos, else answer no match.)
142  *
143  * Recommended value: 1
144  *
145  */
146 
147 #define ZDB_RECORDS_MAX_CLASS   1
148 
149 /**
150  * Previously, readers had to be "stopped" before any write was done into the database.  It's a reasonably fast mechanism.
151  * With the drastic improve of the MT model on kernels > 3.x, the zone can now be explicitly locked by readers.
152  * The first experiments tends to show that the price is minimal.
153  * The lock can still be drastically improved.
154  *
155  * == 0: no lock
156  * != 0: lock
157  *
158  * The locking mechanism itself can be vastly improved
159  */
160 
161 
162 #define ZDB_EXPLICIT_READER_ZONE_LOCK 1
163 
164 /**
165  * The maximum number of loops allowed with a cname.
166  */
167 
168 #define ZDB_CNAME_LOOP_MAX  20
169 
170 /**
171  * The fixed minimum number of file descriptors opened at the same time for journals
172  */
173 
174 #define ZDB_JOURNAL_FD_MIN      4096
175 
176 /**
177  * The fixed maximum number of file descriptors opened at the same time for journals
178  */
179 
180 #define ZDB_JOURNAL_FD_MAX      4096
181 
182 /**
183  * The default maximum number of file descriptors opened at the same time for journals
184  */
185 
186 #define ZDB_JOURNAL_FD_DEFAULT  512
187 
188 /**
189  * How many signatures will be tried initially in the first batch.
190  */
191 
192 #define ZDB_ZONE_MAINTENANCE_LABELS_AT_ONCE_DEFAULT 50    // the initial value for labels processed at once
193 
194 #ifdef	__cplusplus
195 }
196 #endif
197 
198 #endif	/* _ZDB_CONFIG_H */
199 
200 /** @} */
201