OpenDNSSEC-signer
1.3.4
|
00001 /* 00002 * $Id: zonedata.h 4574 2011-03-16 09:21:02Z matthijs $ 00003 * 00004 * Copyright (c) 2009 NLNet Labs. All rights reserved. 00005 * 00006 * Redistribution and use in source and binary forms, with or without 00007 * modification, are permitted provided that the following conditions 00008 * are met: 00009 * 1. Redistributions of source code must retain the above copyright 00010 * notice, this list of conditions and the following disclaimer. 00011 * 2. Redistributions in binary form must reproduce the above copyright 00012 * notice, this list of conditions and the following disclaimer in the 00013 * documentation and/or other materials provided with the distribution. 00014 * 00015 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 00016 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00017 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00018 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 00019 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00020 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 00021 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00022 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 00023 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 00024 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 00025 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00026 * 00027 */ 00028 00034 #ifndef SIGNER_ZONEDATA_H 00035 #define SIGNER_ZONEDATA_H 00036 00037 #include "config.h" 00038 #include "adapter/adapter.h" 00039 #include "daemon/worker.h" 00040 #include "scheduler/fifoq.h" 00041 #include "shared/allocator.h" 00042 #include "shared/status.h" 00043 #include "signer/denial.h" 00044 #include "signer/domain.h" 00045 #include "signer/keys.h" 00046 #include "signer/signconf.h" 00047 #include "signer/stats.h" 00048 #include "signer/nsec3params.h" 00049 00050 #include <ldns/ldns.h> 00051 #include <stdio.h> 00052 00053 00058 typedef struct zonedata_struct zonedata_type; 00059 struct zonedata_struct { 00060 allocator_type* allocator; 00061 ldns_rbtree_t* domains; 00062 ldns_rbtree_t* denial_chain; 00063 int initialized; 00064 uint32_t default_ttl; /* fallback ttl */ 00065 uint32_t inbound_serial; /* last seen inbound soa serial */ 00066 uint32_t internal_serial; /* latest internal soa serial */ 00067 uint32_t outbound_serial; /* last written outbound soa serial */ 00068 }; 00069 00075 void zonedata_init_denial(zonedata_type* zd); 00076 00083 zonedata_type* zonedata_create(allocator_type* allocator); 00084 00092 ods_status zonedata_recover(zonedata_type* zd, FILE* fd); 00093 00101 /* 00102 int zonedata_recover_rr_from_backup(zonedata_type* zd, ldns_rr* rr); 00103 */ 00104 00114 /* 00115 int zonedata_recover_rrsig_from_backup(zonedata_type* zd, ldns_rr* rrsig, 00116 const char* locator, uint32_t flags); 00117 */ 00118 00126 domain_type* zonedata_lookup_domain(zonedata_type* zd, ldns_rdf* name); 00127 00135 domain_type* zonedata_add_domain(zonedata_type* zd, domain_type* domain); 00136 00144 domain_type* zonedata_del_domain(zonedata_type* zd, domain_type* domain); 00145 00153 denial_type* zonedata_lookup_denial(zonedata_type* zd, ldns_rdf* name); 00154 00164 ods_status zonedata_add_denial(zonedata_type* zd, domain_type* domain, 00165 ldns_rdf* apex, nsec3params_type* nsec3params); 00166 00174 denial_type* zonedata_del_denial(zonedata_type* zd, denial_type* denial); 00175 00184 ods_status zonedata_examine(zonedata_type* zd, ldns_rdf* apex, 00185 adapter_mode mode); 00186 00194 ods_status zonedata_diff(zonedata_type* zd, keylist_type* kl); 00195 00202 ods_status zonedata_commit(zonedata_type* zd); 00203 00209 void zonedata_rollback(zonedata_type* zd); 00210 00218 ods_status zonedata_entize(zonedata_type* zd, ldns_rdf* apex); 00219 00229 ods_status zonedata_nsecify(zonedata_type* zd, ldns_rr_class klass, 00230 uint32_t ttl, uint32_t* num_added); 00231 00242 ods_status zonedata_nsecify3(zonedata_type* zd, ldns_rr_class klass, 00243 uint32_t ttl, nsec3params_type* nsec3params, uint32_t* num_added); 00244 00252 ods_status zonedata_update_serial(zonedata_type* zd, signconf_type* sc); 00253 00262 ods_status zonedata_queue(zonedata_type* zd, fifoq_type* q, 00263 worker_type* worker); 00264 00270 void zonedata_wipe_denial(zonedata_type* zd); 00271 00277 void zonedata_cleanup_chain(zonedata_type* zd); 00278 00284 void zonedata_cleanup(zonedata_type* zd); 00285 00292 void zonedata_backup(FILE* fd, zonedata_type* zd); 00293 00301 ods_status zonedata_print(FILE* fd, zonedata_type* zd); 00302 00310 void log_rdf(ldns_rdf* rdf, const char* pre, int level); 00311 00312 #endif /* SIGNER_ZONEDATA_H */