zone.h File Reference
`#include "config.h"`
`#include <ldns/ldns.h>`
`#include "adapter/adapter.h"`
`#include "scheduler/schedule.h"`
`#include "locks.h"`
`#include "status.h"`
`#include "signer/ixfr.h"`
`#include "signer/namedb.h"`
`#include "signer/signconf.h"`
`#include "signer/stats.h"`
`#include "signer/rrset.h"`
`#include "wire/buffer.h"`
`#include "wire/notify.h"`
`#include "wire/xfrd.h"`
`#include "datastructure.h"`
`#include "daemon/engine.h"`

Go to the source code of this file.

## Data Structures

struct | zone_struct

## Typedefs

typedef enum zone_zl_status_enum | zone_zl_status
typedef struct zone_struct | zone_type

## Enumerations

enum | zone_zl_status_enum { ZONE_ZL_OK = 0 , ZONE_ZL_ADDED , ZONE_ZL_UPDATED , ZONE_ZL_REMOVED }

## Functions

zone_type * | zone_create (char *name, ldns_rr_class klass)
ods_status | zone_load_signconf (zone_type *zone, signconf_type **new_signconf)
ods_status | zone_reschedule_task (zone_type *zone, schedule_type *taskq, task_id what)
ods_status | zone_publish_dnskeys (zone_type *zone, int skip_hsm_access)
void | zone_rollback_dnskeys (zone_type *zone)
ods_status | zone_publish_nsec3param (zone_type *zone)
void | zone_rollback_nsec3param (zone_type *zone)
ods_status | zone_prepare_keys (zone_type *zone)
ods_status | zone_update_serial (zone_type *zone)
rrset_type * | zone_lookup_rrset (zone_type *zone, ldns_rdf *owner, ldns_rr_type type)
ods_status | zone_add_rr (zone_type *zone, ldns_rr *rr, int do_stats)
ods_status | zone_del_rr (zone_type *zone, ldns_rr *rr, int do_stats)
ods_status | zone_del_nsec3params (zone_type *zone)
void | zone_merge (zone_type *z1, zone_type *z2)
void | zone_cleanup (zone_type *zone)
ods_status | zone_backup2 (zone_type *zone, time_t nextResign)
ods_status | zone_recover2 (engine_type *engine, zone_type *zone)

## Typedef Documentation

## zone_type

typedef struct zone_struct zone_type

Definition at line 41 of file zone.h.

## zone_zl_status

typedef enum zone_zl_status_enum zone_zl_status

Definition at line 39 of file zone.h.

## Enumeration Type Documentation

## zone_zl_status_enum

enum zone_zl_status_enum

Enumerator
ZONE_ZL_OK |
ZONE_ZL_ADDED |
ZONE_ZL_UPDATED |
ZONE_ZL_REMOVED |

Definition at line 33 of file zone.h.

## Function Documentation

## zone_add_rr()

ods_status zone_add_rr | ( | zone_type * | zone,
|  | ldns_rr * | rr,
|  | int | do_stats )

extern

Add RR.

Parameters

  [in] | zone | zone
  [in] | rr | rr
  [in] | do_stats | true if we need to maintain statistics

Returns
  ods_status status ODS_STATUS_OK: rr to be added to zone ODS_STATUS_UNCHANGED: rr not added to zone, rr already exists other: rr not added to zone, error occurred

Add RR.

Definition at line 529 of file zone.c.

References zone_struct::apex, zone_struct::db, domain_struct::dname, domain_add_rrset(), domain_lookup_rrset(), rr_struct::is_added, domain_struct::is_apex, rr_struct::is_removed, zone_struct::name, namedb_add_domain(), namedb_domain_entize(), namedb_lookup_domain(), rr_struct::rr, rrset_add_rr(), rrset_create(), rrset_lookup_rr(), rrset_lookup_ttl(), zone_struct::signconf, stats_struct::sort_count, zone_struct::stats, and domain_struct::zone.

Referenced by zone_publish_dnskeys(), and zone_publish_nsec3param().

## zone_backup2()

ods_status zone_backup2 | ( | zone_type * | zone,
|  | time_t | nextResign )

extern

Backup zone.

Parameters

  [in] | zone | corresponding zone

Returns
  ods_status status

Backup zone.

Backup zone

Backup signconf

Backup NSEC3 parameters

Backup keylist

Backup domains and stuff

Done

Definition at line 1040 of file zone.c.

References zone_struct::db, namedb_struct::inbserial, namedb_struct::intserial, keylist_backup(), signconf_struct::keys, zone_struct::klass, zone_struct::name, namedb_backup2(), signconf_struct::nsec3_algo, signconf_struct::nsec3_iterations, signconf_struct::nsec3_optout, signconf_struct::nsec3_salt, signconf_struct::nsec3params, nsec3params_backup(), namedb_struct::outserial, nsec3params_struct::rr, zone_struct::signconf, and signconf_backup().

Referenced by do_writezone().

## zone_cleanup()

void zone_cleanup | ( | zone_type * | zone | ) |

extern

Clean up zone.

Parameters

  [in] | zone | zone

Clean up zone.

Definition at line 759 of file zone.c.

References adapter_cleanup(), zone_struct::adinbound, zone_struct::adoutbound, zone_struct::apex, zone_struct::db, zone_struct::ixfr, ixfr_cleanup(), zone_struct::name, namedb_cleanup(), zone_struct::notify, zone_struct::notify_args, notify_cleanup(), zone_struct::notify_command, zone_struct::policy_name, zone_struct::rrstore, zone_struct::signconf, signconf_cleanup(), zone_struct::signconf_filename, zone_struct::stats, stats_cleanup(), zone_struct::xfr_lock, zone_struct::xfrd, xfrd_cleanup(), and zone_struct::zone_lock.

Referenced by engine_update_zones(), parse_zonelist_zones(), zone_create(), zonelist_add_zone(), and zonelist_lookup_zone_by_name().

## zone_create()

zone_type * zone_create | ( | char * | name,
|  | ldns_rr_class | klass )

extern

Create a new zone.

Parameters

  [in] | name | zone name
  [in] | klass | zone class

Returns
  zone_type* zone

Create a new zone.

Definition at line 55 of file zone.c.

References zone_struct::adinbound, zone_struct::adoutbound, zone_struct::apex, zone_struct::db, zone_struct::default_ttl, zone_struct::ixfr, ixfr_create(), zone_struct::klass, zone_struct::name, namedb_create(), zone_struct::notify, zone_struct::notify_args, zone_struct::notify_command, zone_struct::notify_ns, zone_struct::policy_name, rrset_store_initialize(), zone_struct::rrstore, zone_struct::signconf, signconf_create(), zone_struct::signconf_filename, zone_struct::stats, stats_create(), zone_struct::xfr_lock, zone_struct::xfrd, zone_struct::zl_status, zone_cleanup(), zone_struct::zone_lock, ZONE_ZL_OK, and zone_struct::zoneconfigvalid.

Referenced by parse_zonelist_zones(), and zonelist_lookup_zone_by_name().

## zone_del_nsec3params()

ods_status zone_del_nsec3params | ( | zone_type * | zone | ) |

extern

Remove all NSEC3PARAM RRs from the zone

Returns
  ODS_STATUS_UNCHANGED or ODS_STATUS_OK

Delete NSEC3PARAM RRs.

Marks all NSEC3PARAM records as removed.

Definition at line 655 of file zone.c.

References zone_struct::apex, zone_struct::db, domain_lookup_rrset(), rr_struct::is_removed, zone_struct::name, namedb_lookup_domain(), rrset_struct::rr_count, and rrset_struct::rrs.

Referenced by zone_publish_nsec3param().

## zone_del_rr()

ods_status zone_del_rr | ( | zone_type * | zone,
|  | ldns_rr * | rr,
|  | int | do_stats )

extern

Delete RR.

Parameters

  [in] | zone | zone
  [in] | rr | rr
  [in] | do_stats | true if we need to maintain statistics

Returns
  ods_status status ODS_STATUS_OK: rr to be removed from zone ODS_STATUS_UNCHANGED: rr not removed from zone, rr does not exist other: rr not removed from zone, error occurred

Delete RR.

Definition at line 611 of file zone.c.

References zone_struct::db, domain_lookup_rrset(), rr_struct::is_added, rr_struct::is_removed, zone_struct::name, namedb_lookup_domain(), rrset_lookup_rr(), zone_struct::signconf, stats_struct::sort_count, and zone_struct::stats.

## zone_load_signconf()

ods_status zone_load_signconf | ( | zone_type * | zone,
|  | signconf_type ** | new_signconf )

extern

Load signer configuration for zone.

Parameters

  [in] | zone | zone
  [out] | new_signconf | new signer configuration

Returns
  ods_status status ODS_STATUS_OK: new signer configuration loaded ODS_STATUS_UNCHANGED: signer configuration has not changed other: signer configuration not loaded, error occurred

Load signer configuration for zone.

Definition at line 133 of file zone.c.

References signconf_struct::last_modified, zone_struct::name, zone_struct::signconf, zone_struct::signconf_filename, and signconf_update().

Referenced by tools_signconf().

## zone_lookup_rrset()

rrset_type * zone_lookup_rrset | ( | zone_type * | zone,
|  | ldns_rdf * | owner,
|  | ldns_rr_type | type )

extern

Lookup RRset.

Parameters

  [in] | zone | zone
  [in] | owner | RRset owner
  [in] | type | RRtype

Returns
  rrset_type* RRset, if found

Lookup RRset.

Definition at line 510 of file zone.c.

References zone_struct::db, domain_lookup_rrset(), and namedb_lookup_domain().

Referenced by adapi_printaxfr(), adapi_printixfr(), backup_read_namedb(), zone_publish_dnskeys(), zone_rollback_dnskeys(), zone_rollback_nsec3param(), and zone_update_serial().

## zone_merge()

void zone_merge | ( | zone_type * | z1,
|  | zone_type * | z2 )

extern

Merge zones. Values that are merged:

- policy name
- signconf filename
- input and output adapter

Parameters

  [in] | z1 | zone
  [in] | z2 | zone with new values

Merge zones.

Definition at line 694 of file zone.c.

References adapter_compare(), zone_struct::adinbound, zone_struct::adoutbound, zone_struct::name, zone_struct::policy_name, zone_struct::signconf_filename, zone_struct::zl_status, and ZONE_ZL_UPDATED.

## zone_prepare_keys()

ods_status zone_prepare_keys | ( | zone_type * | zone | ) |

extern

Prepare keys for signing.

Parameters

  [in] | zone | zone

Returns
  ods_status status

Prepare keys for signing.

Definition at line 393 of file zone.c.

References zone_struct::apex, keylist_struct::count, zone_struct::db, signconf_struct::dnskey_signature, keylist_struct::keys, signconf_struct::keys, key_struct::ksk, lhsm_get_key(), zone_struct::name, key_struct::params, key_struct::publish, zone_struct::signconf, and key_struct::zsk.

Referenced by do_signzone().

## zone_publish_dnskeys()

ods_status zone_publish_dnskeys | ( | zone_type * | zone,
|  | int | skip_hsm_access )

extern

Publish the keys as indicated by the signer configuration.

Parameters

  [in] | zone | zone

Returns
  ods_status status

Publish the keys as indicated by the signer configuration.

Definition at line 186 of file zone.c.

References zone_struct::apex, keylist_struct::count, zone_struct::db, zone_struct::default_ttl, key_struct::dnskey, signconf_struct::dnskey_ttl, keylist_struct::keys, signconf_struct::keys, zone_struct::klass, lhsm_get_key(), key_struct::locator, zone_struct::name, key_struct::publish, key_struct::resourcerecord, rr_struct::rr, rrset_getliteralrr(), rrset_lookup_rr(), zone_struct::signconf, zone_add_rr(), and zone_lookup_rrset().

Referenced by tools_input(), and zone_recover2().

## zone_publish_nsec3param()

ods_status zone_publish_nsec3param | ( | zone_type * | zone | ) |

extern

Publish the NSEC3 parameters as indicated by the signer configuration.

Parameters

  [in] | zone | zone

Returns
  ods_status status

Publish the NSEC3 parameters as indicated by the signer configuration.

Always set bit 7 of the flags to zero, according to rfc5155 section 11

Definition at line 306 of file zone.c.

References nsec3params_struct::algorithm, zone_struct::apex, zone_struct::db, nsec3params_struct::iterations, zone_struct::klass, zone_struct::name, signconf_struct::nsec3param_ttl, signconf_struct::nsec3params, signconf_struct::nsec_type, nsec3params_struct::rr, nsec3params_struct::salt_data, nsec3params_struct::salt_len, zone_struct::signconf, zone_add_rr(), and zone_del_nsec3params().

Referenced by tools_input(), and zone_recover2().

## zone_recover2()

ods_status zone_recover2 | ( | engine_type * | engine,
|  | zone_type * | zone )

extern

Recover zone from backup.

Parameters

  [in] | zone | corresponding zone

Recover zone from backup.

Definition at line 792 of file zone.c.

References backup_read_check_str(), backup_read_duration(), backup_read_int(), backup_read_ixfr(), backup_read_namedb(), backup_read_rr_type(), backup_read_str(), backup_read_time_t(), backup_read_uint32_t(), zone_struct::db, zone_struct::default_ttl, signconf_struct::dnskey_ttl, namedb_struct::have_serial, namedb_struct::inbserial, namedb_struct::intserial, namedb_struct::is_initialized, zone_struct::ixfr, ixfr_cleanup(), ixfr_create(), ixfr_struct::ixfr_lock, ixfr_purge(), key_recover2(), keylist_create(), signconf_struct::keys, zone_struct::klass, signconf_struct::last_modified, zone_struct::name, namedb_cleanup(), namedb_create(), signconf_struct::nsec3_algo, signconf_struct::nsec3_iterations, signconf_struct::nsec3_optout, signconf_struct::nsec3_salt, signconf_struct::nsec3params, nsec3params_create(), signconf_struct::nsec_type, namedb_struct::outserial, signconf_struct::passthrough, signconf_struct::sig_inception_offset, signconf_struct::sig_jitter, signconf_struct::sig_refresh_interval, signconf_struct::sig_resign_interval, signconf_struct::sig_validity_default, signconf_struct::sig_validity_denial, signconf_struct::sig_validity_keyset, zone_struct::signconf, signconf_cleanup(), signconf_create(), signconf_struct::soa_min, signconf_struct::soa_serial, signconf_struct::soa_ttl, zone_struct::stats, stats_clear(), stats_struct::stats_lock, zone_struct::zone_lock, zone_publish_dnskeys(), zone_publish_nsec3param(), and zone_struct::zoneconfigvalid.

## zone_reschedule_task()

ods_status zone_reschedule_task | ( | zone_type * | zone,
|  | schedule_type * | taskq,
|  | task_id | what )

extern

Reschedule task for zone.

Parameters

  [in] | zone | zone
  [in] | taskq | task queue
  [in] | what | new task identifier

Returns
  ods_status status

## zone_rollback_dnskeys()

void zone_rollback_dnskeys | ( | zone_type * | zone | ) |

extern

Unlink DNSKEY RRs.

Parameters

  [in] | zone | zone

Unlink DNSKEY RRs.

Definition at line 279 of file zone.c.

References zone_struct::apex, keylist_struct::count, key_struct::dnskey, keylist_struct::keys, signconf_struct::keys, rrset_lookup_rr(), zone_struct::signconf, and zone_lookup_rrset().

Referenced by tools_input().

## zone_rollback_nsec3param()

void zone_rollback_nsec3param | ( | zone_type * | zone | ) |

extern

Unlink NSEC3PARAM RR.

Parameters

  [in] | zone | zone

Unlink NSEC3PARAM RR.

Definition at line 369 of file zone.c.

References zone_struct::apex, rr_struct::exists, signconf_struct::nsec3params, nsec3params_struct::rr, rr_struct::rr, rrset_lookup_rr(), zone_struct::signconf, and zone_lookup_rrset().

Referenced by tools_input().

## zone_update_serial()

ods_status zone_update_serial | ( | zone_type * | zone | ) |

extern

Update serial.

Parameters

  [in] | zone | zone

Returns
  ods_status status

Update serial.

Definition at line 434 of file zone.c.

References zone_struct::apex, zone_struct::db, namedb_struct::inbserial, namedb_struct::intserial, zone_struct::name, namedb_update_serial(), rr_struct::rr, rrset_struct::rrs, rrset_add_rr(), rrset_diff(), namedb_struct::serial_updated, zone_struct::signconf, signconf_struct::soa_serial, and zone_lookup_rrset().

Referenced by do_signzone().