OpenDNSSEC-signer 1.2.1

/build/buildd-opendnssec_1.2.1.dfsg-1-ia64-j6OroR/opendnssec-1.2.1.dfsg/signer/src/signer/domain.h

Go to the documentation of this file.
00001 /*
00002  * $Id: domain.h 4523 2011-03-03 12:48:18Z 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_DOMAIN_H
00035 #define SIGNER_DOMAIN_H
00036 
00037 #include "config.h"
00038 #include "signer/denial.h"
00039 #include "signer/hsm.h"
00040 #include "signer/nsec3params.h"
00041 #include "signer/rrset.h"
00042 #include "signer/signconf.h"
00043 #include "signer/stats.h"
00044 
00045 #include <ldns/ldns.h>
00046 #include <time.h>
00047 
00048 #define DOMAIN_STATUS_NONE      0 /* initial domain status */
00049 #define DOMAIN_STATUS_APEX      1 /* apex of the zone */
00050 #define DOMAIN_STATUS_AUTH      2 /* authoritative domain */
00051 #define DOMAIN_STATUS_NS        3 /* unsigned delegation */
00052 #define DOMAIN_STATUS_DS        4 /* signed delegation */
00053 #define DOMAIN_STATUS_ENT_AUTH  5 /* empty non-terminal to authoritative data */
00054 #define DOMAIN_STATUS_ENT_NS    6 /* empty non-terminal to unsigned delegation */
00055 #define DOMAIN_STATUS_ENT_GLUE  7 /* empty non-terminal to occluded data */
00056 #define DOMAIN_STATUS_OCCLUDED  8 /* occluded data (glue) */
00057 #define DOMAIN_STATUS_HASH      9 /* hashed domain */
00058 
00059 #define SE_NSEC_RDATA_NXT          0
00060 #define SE_NSEC_RDATA_BITMAP       1
00061 #define SE_NSEC3_RDATA_NSEC3PARAMS 4
00062 #define SE_NSEC3_RDATA_NXT         4
00063 #define SE_NSEC3_RDATA_BITMAP      5
00064 
00069 typedef struct domain_struct domain_type;
00070 struct domain_struct {
00071     ldns_rdf* name;
00072     domain_type* parent;
00073     denial_type* denial;
00074     ldns_rbtree_t* rrsets;
00075     size_t subdomain_count;
00076     size_t subdomain_auth;
00077     int domain_status;
00078     int initialized;
00079     uint32_t internal_serial;
00080     uint32_t outbound_serial;
00081 };
00082 
00089 domain_type* domain_create(ldns_rdf* dname);
00090 
00099 domain_type* domain_recover_from_backup(FILE* fd, int* curnxt, int* curbm);
00100 
00108 rrset_type* domain_lookup_rrset(domain_type* domain, ldns_rr_type type);
00109 
00118 rrset_type* domain_add_rrset(domain_type* domain, rrset_type* rrset, int recover);
00119 
00128 rrset_type* domain_del_rrset(domain_type* domain, rrset_type* rrset, int recover);
00129 
00136 int domain_count_rrset(domain_type* domain);
00137 
00146 int domain_examine_data_exists(domain_type* domain, ldns_rr_type rrtype,
00147     int skip_glue);
00148 
00156 int domain_examine_ns_rdata(domain_type* domain, ldns_rdf* nsdname);
00157 
00164 int domain_examine_valid_zonecut(domain_type* domain);
00165 
00173 int domain_examine_rrset_is_alone(domain_type* domain, ldns_rr_type rrtype);
00174 
00182 int domain_examine_rrset_is_singleton(domain_type* domain, ldns_rr_type rrtype);
00183 
00191 int domain_update(domain_type* domain, uint32_t serial);
00192 
00198 void domain_cancel_update(domain_type* domain);
00199 
00205 void domain_update_status(domain_type* domain);
00206 
00219 int domain_sign(hsm_ctx_t* ctx, domain_type* domain, ldns_rdf* owner,
00220     signconf_type* sc, time_t signtime, uint32_t serial, stats_type* stats);
00221 
00229 int domain_add_rr(domain_type* domain, ldns_rr* rr);
00230 
00238 int domain_recover_rr_from_backup(domain_type* domain, ldns_rr* rr);
00239 
00250 int domain_recover_rrsig_from_backup(domain_type* domain, ldns_rr* rrsig,
00251     ldns_rr_type type_covered, const char* locator, uint32_t flags);
00252 
00260 int domain_del_rr(domain_type* domain, ldns_rr* rr);
00261 
00268 int domain_del_rrs(domain_type* domain);
00269 
00275 void domain_cleanup(domain_type* domain);
00276 
00283 void domain_print(FILE* fd, domain_type* domain);
00284 
00291 void domain_print_nsec(FILE* fd, domain_type* domain);
00292 
00299 void domain_print_rrsig(FILE* fd, domain_type* domain);
00300 
00301 #endif /* SIGNER_DOMAIN_H */