Data Structures | Typedefs | Functions

/build/buildd-opendnssec_1.3.2-1~bpo60+1-sparc-g2IJWF/opendnssec-1.3.2/signer/src/signer/zonedata.h File Reference

#include "config.h"
#include "adapter/adapter.h"
#include "daemon/worker.h"
#include "scheduler/fifoq.h"
#include "shared/allocator.h"
#include "shared/status.h"
#include "signer/denial.h"
#include "signer/domain.h"
#include "signer/keys.h"
#include "signer/signconf.h"
#include "signer/stats.h"
#include "signer/nsec3params.h"
#include <ldns/ldns.h>
#include <stdio.h>
Include dependency graph for zonedata.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  zonedata_struct

Typedefs

typedef struct zonedata_struct zonedata_type

Functions

void zonedata_init_denial (zonedata_type *zd)
zonedata_typezonedata_create (allocator_type *allocator)
ods_status zonedata_recover (zonedata_type *zd, FILE *fd)
domain_typezonedata_lookup_domain (zonedata_type *zd, ldns_rdf *name)
domain_typezonedata_add_domain (zonedata_type *zd, domain_type *domain)
domain_typezonedata_del_domain (zonedata_type *zd, domain_type *domain)
denial_typezonedata_lookup_denial (zonedata_type *zd, ldns_rdf *name)
ods_status zonedata_add_denial (zonedata_type *zd, domain_type *domain, ldns_rdf *apex, nsec3params_type *nsec3params)
denial_typezonedata_del_denial (zonedata_type *zd, denial_type *denial)
ods_status zonedata_examine (zonedata_type *zd, ldns_rdf *apex, adapter_mode mode)
ods_status zonedata_diff (zonedata_type *zd, keylist_type *kl)
ods_status zonedata_commit (zonedata_type *zd)
void zonedata_rollback (zonedata_type *zd)
ods_status zonedata_entize (zonedata_type *zd, ldns_rdf *apex)
ods_status zonedata_nsecify (zonedata_type *zd, ldns_rr_class klass, uint32_t ttl, uint32_t *num_added)
ods_status zonedata_nsecify3 (zonedata_type *zd, ldns_rr_class klass, uint32_t ttl, nsec3params_type *nsec3params, uint32_t *num_added)
ods_status zonedata_update_serial (zonedata_type *zd, signconf_type *sc)
ods_status zonedata_queue (zonedata_type *zd, fifoq_type *q, worker_type *worker)
void zonedata_wipe_denial (zonedata_type *zd)
void zonedata_cleanup_chain (zonedata_type *zd)
void zonedata_cleanup (zonedata_type *zd)
void zonedata_backup (FILE *fd, zonedata_type *zd)
ods_status zonedata_print (FILE *fd, zonedata_type *zd)
void log_rdf (ldns_rdf *rdf, const char *pre, int level)

Typedef Documentation

Zone data. Zone data.

Definition at line 58 of file zonedata.h.


Function Documentation

void log_rdf ( ldns_rdf *  rdf,
const char *  pre,
int  level 
)

Log RDF.

Parameters:
[in] rdf RDF
[in] pre string to log before RDF
[in] level log level

Log RDF.

Definition at line 55 of file zonedata.c.

References ods_log_debug(), ods_log_deeebug(), ods_log_error(), ods_log_get_level(), ods_log_info(), ods_log_verbose(), and ods_log_warning().

Referenced by zonedata_add_denial(), zonedata_add_domain(), zonedata_del_denial(), zonedata_del_domain(), zonedata_nsecify(), and zonedata_nsecify3().

ods_status zonedata_add_denial ( zonedata_type zd,
domain_type domain,
ldns_rdf *  apex,
nsec3params_type nsec3params 
)

Add denial of existence data point to zone data.

Parameters:
[in] zd zone data
[in] domain corresponding domain
[in] apex apex
[in] nsec3params NSEC3 parameters
Returns:
ods_status status

Add denial of existence data point to the zone data.

Definition at line 486 of file zonedata.c.

References denial_struct::bitmap_changed, domain_struct::denial, zonedata_struct::denial_chain, denial_cleanup(), denial_create(), domain_struct::dname, denial_struct::domain, log_rdf(), denial_struct::nxt_changed, ods_log_assert, ods_log_error(), and zonedata_lookup_denial().

Referenced by zonedata_nsecify(), and zonedata_nsecify3().

domain_type* zonedata_add_domain ( zonedata_type zd,
domain_type domain 
)

Add domain to zone data.

Parameters:
[in] zd zone data
[in] domain domain to add
Returns:
domain_type* added domain

Add a domain to the zone data.

Definition at line 325 of file zonedata.c.

References domain_struct::dname, zonedata_struct::domains, log_rdf(), ods_log_assert, and ods_log_error().

Referenced by zone_add_rr().

void zonedata_backup ( FILE *  fd,
zonedata_type zd 
)

Backup zone data.

Parameters:
[in] fd output file descriptor
[in] zd zone data

Backup zone data.

Definition at line 1545 of file zonedata.c.

References domain_backup(), and zonedata_struct::domains.

Referenced by zone_backup().

void zonedata_cleanup ( zonedata_type zd  ) 

Clean up zone data.

Parameters:
[in] zd zone data to cleanup

Clean up zone data.

Definition at line 1525 of file zonedata.c.

References zonedata_struct::allocator, allocator_deallocate(), and zonedata_cleanup_chain().

Referenced by zone_cleanup(), and zone_recover().

void zonedata_cleanup_chain ( zonedata_type zd  ) 

Clean up denial of existence chain.

Parameters:
[in] zd zone data

Clean up denial of existence chain.

Definition at line 1509 of file zonedata.c.

References zonedata_struct::denial_chain.

Referenced by zone_load_signconf(), and zonedata_cleanup().

ods_status zonedata_commit ( zonedata_type zd  ) 

Commit updates to zone data.

Parameters:
[in] zd zone data
Returns:
ods_status status

Commit updates to zone data.

Definition at line 684 of file zonedata.c.

References domain_struct::dname, domain_commit(), domain_count_rrset(), zonedata_struct::domains, ods_log_warning(), ODS_STATUS_OK, and zonedata_del_domain().

Referenced by tools_input(), and zone_recover().

zonedata_type* zonedata_create ( allocator_type allocator  ) 

Create empty zone data.

Parameters:
[in] allocator memory allocator
Returns:
zonedata_type* empty zone data tree

Create empty zone data..

Definition at line 165 of file zonedata.c.

References zonedata_struct::allocator, allocator_alloc(), zonedata_struct::default_ttl, zonedata_struct::inbound_serial, zonedata_struct::initialized, zonedata_struct::internal_serial, ods_log_assert, ods_log_error(), zonedata_struct::outbound_serial, and zonedata_init_denial().

Referenced by zone_create(), and zone_recover().

denial_type* zonedata_del_denial ( zonedata_type zd,
denial_type denial 
)

Delete denial of existence data point from zone data.

Parameters:
[in] zd zone data
[in] denial denial of existence data point
Returns:
denial_type* denial of existence data point if failed

Delete denial of existence data point from the zone data.

Definition at line 629 of file zonedata.c.

References zonedata_struct::denial_chain, log_rdf(), ods_log_assert, ods_log_error(), and denial_struct::owner.

Referenced by zonedata_del_domain(), zonedata_nsecify(), and zonedata_nsecify3().

domain_type* zonedata_del_domain ( zonedata_type zd,
domain_type domain 
)

Delete domain from zone data.

Parameters:
[in] zd zone data
[in] domain domain to delete
Returns:
domain_type* domain if failed

Delete domain from the zone data.

Definition at line 386 of file zonedata.c.

References domain_struct::denial, domain_struct::dname, zonedata_struct::domains, log_rdf(), ods_log_assert, ods_log_error(), and zonedata_del_denial().

Referenced by zonedata_commit().

ods_status zonedata_diff ( zonedata_type zd,
keylist_type kl 
)

Calculate differences at the zonedata between current and new RRsets.

Parameters:
[in] zd zone data
[in] kl current key list
Returns:
ods_status status

Calculate differences at the zonedata between current and new RRsets.

Definition at line 655 of file zonedata.c.

References domain_diff(), zonedata_struct::domains, and ODS_STATUS_OK.

Referenced by adapi_trans_full().

ods_status zonedata_entize ( zonedata_type zd,
ldns_rdf *  apex 
)

Add empty non-terminals to zone data.

Parameters:
[in] zd zone data
[in] apex zone apex
Returns:
ods_status status

Add empty non-terminals to zone data.

Definition at line 912 of file zonedata.c.

References domain_dstatus(), zonedata_struct::domains, ods_log_assert, ods_log_error(), and ODS_STATUS_OK.

Referenced by tools_nsecify(), and zone_recover().

ods_status zonedata_examine ( zonedata_type zd,
ldns_rdf *  apex,
adapter_mode  mode 
)

Examine updates to zone data.

Parameters:
[in] zd zone data
[in] apex apex domain name
[in] mode adapter mode
Returns:
ods_status status

Examine updates to zone data.

Definition at line 1369 of file zonedata.c.

References ADAPTER_FILE, domain_examine_rrset_is_alone(), domain_examine_rrset_is_singleton(), zonedata_struct::domains, and ods_log_assert.

Referenced by zone_examine().

void zonedata_init_denial ( zonedata_type zd  ) 

Initialize denial of existence chain.

Parameters:
[in] zd zone data

Initialize denial of existence chain.

Definition at line 137 of file zonedata.c.

References zonedata_struct::denial_chain.

Referenced by zone_load_signconf(), and zonedata_create().

denial_type* zonedata_lookup_denial ( zonedata_type zd,
ldns_rdf *  dname 
)

Look up denial of existence data point.

Parameters:
[in] zd zone data
[in] name domain name to look for
Returns:
domain_type* domain, if found

Lookup denial of existence data point.

Definition at line 437 of file zonedata.c.

References zonedata_struct::denial_chain.

Referenced by zonedata_add_denial().

domain_type* zonedata_lookup_domain ( zonedata_type zd,
ldns_rdf *  dname 
)

Recover RR from backup.

Parameters:
[in] zd zone data
[in] rr RR to add
Returns:
int 0 on success, 1 on false Recover RRSIG from backup.
Parameters:
[in] zd zone data
[in] rrsig RRSIG to add
[in] locator key locaotor
[in] flags key flags
Returns:
int 0 on success, 1 on false Look up domain.
Parameters:
[in] zd zone data
[in] name domain name to look for
Returns:
domain_type* domain, if found

Lookup domain.

Definition at line 312 of file zonedata.c.

References zonedata_struct::domains.

Referenced by zone_add_rr(), zone_del_rr(), zone_prepare_nsec3(), zone_update_serial(), and zonedata_recover().

ods_status zonedata_nsecify ( zonedata_type zd,
ldns_rr_class  klass,
uint32_t  ttl,
uint32_t *  num_added 
)

Add NSEC records to zone data.

Parameters:
[in] zd zone data
[in] klass zone class
[in] ttl NSEC ttl
[out] num_added number of NSEC RRs added
Returns:
ods_status status

Add NSEC records to zonedata.

Now we have the complete denial of existence chain

Definition at line 954 of file zonedata.c.

References domain_struct::denial, zonedata_struct::denial_chain, denial_nsecify(), domain_struct::dname, domain_count_rrset(), DOMAIN_STATUS_APEX, DOMAIN_STATUS_ENT, DOMAIN_STATUS_NONE, DOMAIN_STATUS_OCCLUDED, zonedata_struct::domains, domain_struct::dstatus, log_rdf(), ods_log_alert(), ods_log_assert, ods_log_error(), ods_log_warning(), ODS_STATUS_OK, zonedata_add_denial(), and zonedata_del_denial().

Referenced by tools_nsecify().

ods_status zonedata_nsecify3 ( zonedata_type zd,
ldns_rr_class  klass,
uint32_t  ttl,
nsec3params_type nsec3params,
uint32_t *  num_added 
)

Add NSEC3 records to zone data.

Parameters:
[in] zd zone data
[in] klass zone class
[in] ttl NSEC3 ttl
[in] nsec3params NSEC3 parameters
[out] num_added number of NSEC3 RRs added
Returns:
ods_status status

Add NSEC3 records to zonedata.

Additionally, for collision detection purposes, optionally create an additional NSEC3 RR corresponding to the original owner name with the asterisk label prepended (i.e., as if a wildcard existed as a child of this owner name) and keep track of this original owner name. Mark this NSEC3 RR as temporary.

pseudo: wildcard_name = *.domain->dname; hashed_ownername = ldns_nsec3_hash_name(domain->dname, nsec3params->algorithm, nsec3params->iterations, nsec3params->salt_len, nsec3params->salt); domain->nsec3_wildcard = denial_create(hashed_ownername);

Now we have the complete denial of existence chain

Definition at line 1046 of file zonedata.c.

References domain_struct::denial, zonedata_struct::denial_chain, denial_nsecify3(), domain_struct::dname, DOMAIN_STATUS_APEX, DOMAIN_STATUS_NONE, DOMAIN_STATUS_NS, DOMAIN_STATUS_OCCLUDED, zonedata_struct::domains, domain_struct::dstatus, nsec3params_struct::flags, log_rdf(), ods_log_alert(), ods_log_assert, ods_log_error(), ODS_STATUS_OK, zonedata_add_denial(), and zonedata_del_denial().

Referenced by tools_nsecify().

ods_status zonedata_print ( FILE *  fd,
zonedata_type zd 
)

Print zone data.

Parameters:
[in] fd output file descriptor
[in] zd zone data
Returns:
ods_status status

Print zone data.

Definition at line 1570 of file zonedata.c.

References domain_print(), zonedata_struct::domains, ods_log_assert, and ods_log_error().

Referenced by zone_print().

ods_status zonedata_queue ( zonedata_type zd,
fifoq_type q,
worker_type worker 
)

Queue all RRsets.

Parameters:
[in] zd zone data
[in] q queue
[in] worker owner of data
Returns:
ods_status status

Queue all RRsets.

Definition at line 1256 of file zonedata.c.

References domain_queue(), zonedata_struct::domains, and ODS_STATUS_OK.

ods_status zonedata_recover ( zonedata_type zd,
FILE *  fd 
)

Recover zone data from backup.

Parameters:
[in] zd zone data
[in] fd backup file descriptor
Returns:
ods_status status

Recover zone data from backup.

Definition at line 200 of file zonedata.c.

References backup_read_check_str(), backup_read_int(), backup_read_str(), domain_struct::denial, zonedata_struct::denial_chain, domain_recover(), ods_log_assert, ods_log_error(), ODS_STATUS_OK, ods_strcmp(), and zonedata_lookup_domain().

Referenced by zone_recover().

void zonedata_rollback ( zonedata_type zd  ) 

Rollback updates from zone data.

Parameters:
[in] zd zone data

Rollback updates from zone data.

Definition at line 738 of file zonedata.c.

References domain_rollback(), and zonedata_struct::domains.

Referenced by tools_input(), zone_load_signconf(), zone_prepare_nsec3(), and zone_publish_dnskeys().

ods_status zonedata_update_serial ( zonedata_type zd,
signconf_type sc 
)

Update the serial.

Parameters:
[in] zd zone data
[in] sc signer configuration
Returns:
ods_status status

Update the serial.

Definition at line 1185 of file zonedata.c.

References DNS_SERIAL_GT, zonedata_struct::inbound_serial, zonedata_struct::initialized, zonedata_struct::internal_serial, ods_log_assert, ods_log_debug(), ods_log_error(), ods_strcmp(), zonedata_struct::outbound_serial, signconf_struct::soa_serial, time_datestamp(), and time_now().

Referenced by zone_update_serial().

void zonedata_wipe_denial ( zonedata_type zd  ) 

Wipe out all NSEC(3) RRsets.

Parameters:
[in] zd zone data

Wipe out all NSEC RRsets.

Definition at line 1418 of file zonedata.c.

References zonedata_struct::denial_chain, denial_struct::rrset, and rrset_cleanup().

Referenced by zone_load_signconf().