namedb.c File Reference
`#include "config.h"`
`#include "status.h"`
`#include "file.h"`
`#include "log.h"`
`#include "util.h"`
`#include "signer/backup.h"`
`#include "signer/namedb.h"`
`#include "signer/zone.h"`

Go to the source code of this file.

## Functions

void | namedb_init_denials (namedb_type *db)
namedb_type * | namedb_create (void *zone)
ods_status | namedb_update_serial (namedb_type *db, const char *zone_name, const char *format, uint32_t inbound_serial)
ods_status | namedb_domain_entize (namedb_type *db, domain_type *domain, ldns_rdf *apex)
domain_type * | namedb_lookup_domain (namedb_type *db, ldns_rdf *dname)
domain_type * | namedb_add_domain (namedb_type *db, ldns_rdf *dname)
domain_type * | namedb_del_domain (namedb_type *db, domain_type *domain)
denial_type * | namedb_lookup_denial (namedb_type *db, ldns_rdf *dname)
denial_type * | namedb_add_denial (namedb_type *db, ldns_rdf *dname, nsec3params_type *n3p)
denial_type * | namedb_del_denial (namedb_type *db, denial_type *denial)
void | namedb_diff (namedb_type *db, unsigned is_ixfr, unsigned more_coming)
void | namedb_rollback (namedb_type *db, unsigned keepsc)
void | namedb_nsecify (namedb_type *db, uint32_t *num_added)
ods_status | namedb_examine (namedb_type *db)
void | namedb_wipe_denial (namedb_type *db)
void | namedb_export (FILE *fd, namedb_type *db, ods_status *status)
void | namedb_cleanup_denials (namedb_type *db)
void | namedb_cleanup (namedb_type *db)
void | namedb_backup2 (FILE *fd, namedb_type *db)

## Variables

const char * | db_str = "namedb"

## Function Documentation

## namedb_add_denial()

denial_type* namedb_add_denial | ( | namedb_type * | db,
|  | ldns_rdf * | dname,
|  | nsec3params_type * | n3p
| ) |  |

Add denial to namedb.

Definition at line 703 of file namedb.c.

References namedb_struct::denials, and namedb_struct::zone.

## namedb_add_domain()

domain_type* namedb_add_domain | ( | namedb_type * | db,
|  | ldns_rdf * | dname
| ) |  |

Add domain to namedb.

Definition at line 352 of file namedb.c.

References db_str, domain_create(), namedb_struct::domains, and namedb_struct::zone.

Referenced by namedb_domain_entize(), and zone_add_rr().

## namedb_backup2()

void namedb_backup2 | ( | FILE * | fd,
|  | namedb_type * | db
| ) |  |

Backup namedb.

Definition at line 1152 of file namedb.c.

References namedb_struct::denials, domain_backup2(), namedb_struct::domains, denial_struct::rrset, rrset_backup2(), and rrset_print().

Referenced by zone_backup2().

## namedb_cleanup()

void namedb_cleanup | ( | namedb_type * | db | ) |

Clean up namedb.

Definition at line 1131 of file namedb.c.

References namedb_cleanup_denials(), and namedb_struct::zone.

Referenced by zone_cleanup().

## namedb_cleanup_denials()

void namedb_cleanup_denials | ( | namedb_type * | db | ) |

Clean up denials.

Definition at line 1116 of file namedb.c.

References namedb_struct::denials.

Referenced by namedb_cleanup(), and tools_signconf().

## namedb_create()

namedb_type* namedb_create | ( | void * | zone | ) |

Create a new namedb.

Definition at line 121 of file namedb.c.

References db_str, zone_struct::name, and namedb_struct::zone.

## namedb_del_denial()

denial_type* namedb_del_denial | ( | namedb_type * | db,
|  | denial_type * | denial
| ) |  |

Delete denial from namedb

Definition at line 768 of file namedb.c.

References db_str, namedb_struct::denials, denial_struct::dname, denial_struct::domain, log_dname(), denial_struct::node, denial_struct::nxt_changed, rrset_struct::rr_count, and denial_struct::rrset.

## namedb_del_domain()

domain_type* namedb_del_domain | ( | namedb_type * | db,
|  | domain_type * | domain
| ) |  |

Delete domain from namedb

Definition at line 391 of file namedb.c.

References db_str, domain_struct::denial, domain_struct::dname, namedb_struct::domains, log_dname(), domain_struct::node, and domain_struct::rrsets.

## namedb_diff()

void namedb_diff | ( | namedb_type * | db,
|  | unsigned | is_ixfr,
|  | unsigned | more_coming
| ) |  |

Apply differences in db.

Definition at line 811 of file namedb.c.

References domain_diff(), and namedb_struct::domains.

Referenced by adapi_trans_diff(), and adapi_trans_full().

## namedb_domain_entize()

ods_status namedb_domain_entize | ( | namedb_type * | db,
|  | domain_type * | domain,
|  | ldns_rdf * | apex
| ) |  |

Add empty non-terminals for domain.

RFC5155:

1. If the difference in number of labels between the apex and the original owner name is greater than 1, additional NSEC3 RRs need to be added for every empty non-terminal between the apex and the original owner name.

Definition at line 281 of file namedb.c.

References db_str, domain_struct::dname, namedb_struct::domains, namedb_add_domain(), namedb_lookup_domain(), and domain_struct::parent.

## namedb_examine()

ods_status namedb_examine | ( | namedb_type * | db | ) |

Examine updates to db.

Definition at line 902 of file namedb.c.

References domain_struct::dname, domain_count_rrset_is_added(), domain_lookup_rrset(), namedb_struct::domains, domain_struct::is_apex, log_rrset(), rrset_count_rr_is_added(), and rrset_struct::rrtype.

## namedb_export()

void namedb_export | ( | FILE * | fd,
|  | namedb_type * | db,
|  | ods_status * | status
| ) |  |

Export db to file.

Definition at line 1025 of file namedb.c.

References db_str, domain_print(), and namedb_struct::domains.

## namedb_init_denials()

void namedb_init_denials | ( | namedb_type * | db | ) |

Initialize denials.

Definition at line 95 of file namedb.c.

References namedb_struct::denials.

Referenced by tools_signconf().

## namedb_lookup_denial()

denial_type* namedb_lookup_denial | ( | namedb_type * | db,
|  | ldns_rdf * | dname
| ) |  |

Lookup denial.

Definition at line 424 of file namedb.c.

## namedb_lookup_domain()

domain_type* namedb_lookup_domain | ( | namedb_type * | db,
|  | ldns_rdf * | dname
| ) |  |

Lookup domain.

Definition at line 338 of file namedb.c.

Referenced by namedb_domain_entize(), zone_add_rr(), zone_del_nsec3params(), zone_del_rr(), and zone_lookup_rrset().

## namedb_nsecify()

void namedb_nsecify | ( | namedb_type * | db,
|  | uint32_t * | num_added
| ) |  |

Nsecify db.

Definition at line 872 of file namedb.c.

References denial_nsecify(), and namedb_struct::denials.

Referenced by adapi_trans_diff(), and adapi_trans_full().

## namedb_rollback()

void namedb_rollback | ( | namedb_type * | db,
|  | unsigned | keepsc
| ) |  |

Rollback differences in db.

Definition at line 847 of file namedb.c.

References domain_rollback(), and namedb_struct::domains.

## namedb_update_serial()

ods_status namedb_update_serial | ( | namedb_type * | db,
|  | const char * | zone_name,
|  | const char * | format,
|  | uint32_t | inbound_serial
| ) |  |

Determine new SOA SERIAL.

Definition at line 193 of file namedb.c.

## namedb_wipe_denial()

void namedb_wipe_denial | ( | namedb_type * | db | ) |

Wipe out all NSEC RRsets.

Definition at line 979 of file namedb.c.

References zone_struct::db, db_str, namedb_struct::denials, rr_struct::exists, namedb_struct::is_initialized, zone_struct::ixfr, ixfr_del_rr(), ixfr_struct::ixfr_lock, zone_struct::name, rr_struct::rr, rrset_struct::rr_count, rrset_struct::rrs, denial_struct::rrset, rrset_cleanup(), rrset_del_rr(), rrset_drop_rrsigs(), and namedb_struct::zone.

Referenced by tools_signconf().

## Variable Documentation

## db_str

const char* db_str = "namedb"

Domain name database.

Definition at line 41 of file namedb.c.

Referenced by namedb_add_domain(), namedb_create(), namedb_del_denial(), namedb_del_domain(), namedb_domain_entize(), namedb_export(), and namedb_wipe_denial().