zone_db.c File Reference
`#include "zone_db.h"`
`#include "db_error.h"`
`#include <string.h>`

Go to the source code of this file.

## Functions

zone_db_t * | zone_db_new (const db_connection_t *connection)
zone_db_t * | zone_db_new_copy (const zone_db_t *zone)
void | zone_db_free (zone_db_t *zone)
int | zone_db_copy (zone_db_t *zone, const zone_db_t *zone_copy)
int | zone_db_from_result (zone_db_t *zone, const db_result_t *result)
const db_value_t * | zone_db_id (const zone_db_t *zone)
const db_value_t * | zone_db_policy_id (const zone_db_t *zone)
policy_t * | zone_db_get_policy (const zone_db_t *zone)
const char * | zone_db_name (const zone_db_t *zone)
unsigned int | zone_db_signconf_needs_writing (const zone_db_t *zone)
const char * | zone_db_signconf_path (const zone_db_t *zone)
int | zone_db_next_change (const zone_db_t *zone)
unsigned int | zone_db_ttl_end_ds (const zone_db_t *zone)
unsigned int | zone_db_ttl_end_dk (const zone_db_t *zone)
unsigned int | zone_db_ttl_end_rs (const zone_db_t *zone)
unsigned int | zone_db_roll_ksk_now (const zone_db_t *zone)
unsigned int | zone_db_roll_zsk_now (const zone_db_t *zone)
unsigned int | zone_db_roll_csk_now (const zone_db_t *zone)
const char * | zone_db_input_adapter_type (const zone_db_t *zone)
const char * | zone_db_input_adapter_uri (const zone_db_t *zone)
const char * | zone_db_output_adapter_type (const zone_db_t *zone)
const char * | zone_db_output_adapter_uri (const zone_db_t *zone)
unsigned int | zone_db_next_ksk_roll (const zone_db_t *zone)
unsigned int | zone_db_next_zsk_roll (const zone_db_t *zone)
unsigned int | zone_db_next_csk_roll (const zone_db_t *zone)
int | zone_db_set_policy_id (zone_db_t *zone, const db_value_t *policy_id)
int | zone_db_set_name (zone_db_t *zone, const char *name_text)
int | zone_db_set_signconf_needs_writing (zone_db_t *zone, unsigned int signconf_needs_writing)
int | zone_db_set_signconf_path (zone_db_t *zone, const char *signconf_path_text)
int | zone_db_set_next_change (zone_db_t *zone, int next_change)
int | zone_db_set_ttl_end_ds (zone_db_t *zone, unsigned int ttl_end_ds)
int | zone_db_set_ttl_end_dk (zone_db_t *zone, unsigned int ttl_end_dk)
int | zone_db_set_ttl_end_rs (zone_db_t *zone, unsigned int ttl_end_rs)
int | zone_db_set_roll_ksk_now (zone_db_t *zone, unsigned int roll_ksk_now)
int | zone_db_set_roll_zsk_now (zone_db_t *zone, unsigned int roll_zsk_now)
int | zone_db_set_roll_csk_now (zone_db_t *zone, unsigned int roll_csk_now)
int | zone_db_set_input_adapter_type (zone_db_t *zone, const char *input_adapter_type_text)
int | zone_db_set_input_adapter_uri (zone_db_t *zone, const char *input_adapter_uri_text)
int | zone_db_set_output_adapter_type (zone_db_t *zone, const char *output_adapter_type_text)
int | zone_db_set_output_adapter_uri (zone_db_t *zone, const char *output_adapter_uri_text)
int | zone_db_set_next_ksk_roll (zone_db_t *zone, unsigned int next_ksk_roll)
int | zone_db_set_next_zsk_roll (zone_db_t *zone, unsigned int next_zsk_roll)
int | zone_db_set_next_csk_roll (zone_db_t *zone, unsigned int next_csk_roll)
db_clause_t * | zone_db_policy_id_clause (db_clause_list_t *clause_list, const db_value_t *policy_id)
int | zone_db_create (zone_db_t *zone)
int | zone_db_get_by_id (zone_db_t *zone, const db_value_t *id)
int | zone_db_get_by_name (zone_db_t *zone, const char *name)
zone_db_t * | zone_db_new_get_by_name (const db_connection_t *connection, const char *name)
int | zone_db_update (zone_db_t *zone)
int | zone_db_delete (zone_db_t *zone)
int | zone_db_count (zone_db_t *zone, db_clause_list_t *clause_list, size_t *count)
zone_list_db_t * | zone_list_db_new (const db_connection_t *connection)
zone_list_db_t * | zone_list_db_new_copy (const zone_list_db_t *from_zone_list)
int | zone_list_db_object_store (zone_list_db_t *zone_list)
void | zone_list_db_free (zone_list_db_t *zone_list)
int | zone_list_db_copy (zone_list_db_t *zone_list, const zone_list_db_t *from_zone_list)
int | zone_list_db_get (zone_list_db_t *zone_list)
zone_list_db_t * | zone_list_db_new_get (const db_connection_t *connection)
int | zone_list_db_get_by_clauses (zone_list_db_t *zone_list, const db_clause_list_t *clause_list)
int | zone_list_db_get_by_policy_id (zone_list_db_t *zone_list, const db_value_t *policy_id)
zone_list_db_t * | zone_list_db_new_get_by_policy_id (const db_connection_t *connection, const db_value_t *policy_id)
const zone_db_t * | zone_list_db_begin (zone_list_db_t *zone_list)
const zone_db_t * | zone_list_db_next (zone_list_db_t *zone_list)
zone_db_t * | zone_list_db_get_next (zone_list_db_t *zone_list)
size_t | zone_list_db_size (zone_list_db_t *zone_list)

## Function Documentation

## zone_db_copy()

int zone_db_copy | ( | zone_db_t * | zone,
|  | const zone_db_t * | zone_copy )

Copy the content of a zone object.

Parameters

  [in] | zone | a zone_db_t pointer.
  [in] | zone_copy | a zone_db_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 365 of file zone_db.c.

References zone_db::associated_policy_id, DB_ERROR_UNKNOWN, DB_OK, db_value_copy(), zone_db::id, zone_db::input_adapter_type, zone_db::input_adapter_uri, zone_db::key_data_list, key_data_list_free(), key_data_list_new_copy(), zone_db::key_dependency_list, key_dependency_list_free(), key_dependency_list_new_copy(), zone_db::name, zone_db::next_change, zone_db::next_csk_roll, zone_db::next_ksk_roll, zone_db::next_zsk_roll, zone_db::output_adapter_type, zone_db::output_adapter_uri, policy_free(), zone_db::policy_id, policy_new_copy(), zone_db::private_policy_id, zone_db::rev, zone_db::roll_csk_now, zone_db::roll_ksk_now, zone_db::roll_zsk_now, zone_db::signconf_needs_writing, zone_db::signconf_path, zone_db::ttl_end_dk, zone_db::ttl_end_ds, and zone_db::ttl_end_rs.

Referenced by key_data_get_zone(), zone_db_new_copy(), and zone_list_db_get_next().

## zone_db_count()

int zone_db_count | ( | zone_db_t * | zone,
|  | db_clause_list_t * | clause_list,
|  | size_t * | count )

Count the number of zone objects in the database, if a selection of objects should be counted then it can be limited by a database clause list otherwise all objects are counted.

Parameters

  [in] | zone | a zone_db_t pointer.
  [in] | clause_list | a db_clause_list_t pointer or NULL if all objects.
  [out] | count | a size_t pointer to where the count should be stored. should be counted.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 1930 of file zone_db.c.

References DB_ERROR_UNKNOWN, db_object_count(), and zone_db::dbo.

Referenced by hsm_key_factory_generate().

## zone_db_create()

int zone_db_create | ( | zone_db_t * | zone | ) |

Create a zone object in the database.

Parameters

  [in] | zone | a zone_db_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 1206 of file zone_db.c.

References DB_ERROR_UNKNOWN, db_object_create(), db_object_field_free(), db_object_field_list_add(), db_object_field_list_free(), db_object_field_list_new(), db_object_field_new(), db_object_field_set_name(), db_object_field_set_type(), DB_TYPE_ANY, DB_TYPE_INT32, DB_TYPE_TEXT, DB_TYPE_UINT32, db_value_copy(), db_value_from_int32(), db_value_from_text(), db_value_from_uint32(), db_value_not_empty(), db_value_set_free(), db_value_set_get(), db_value_set_new(), zone_db::dbo, zone_db::id, zone_db::input_adapter_type, zone_db::input_adapter_uri, zone_db::name, zone_db::next_change, zone_db::next_csk_roll, zone_db::next_ksk_roll, zone_db::next_zsk_roll, zone_db::output_adapter_type, zone_db::output_adapter_uri, zone_db::policy_id, zone_db::rev, zone_db::roll_csk_now, zone_db::roll_ksk_now, zone_db::roll_zsk_now, zone_db::signconf_needs_writing, zone_db::signconf_path, zone_db::ttl_end_dk, zone_db::ttl_end_ds, and zone_db::ttl_end_rs.

Referenced by zonelist_import().

## zone_db_delete()

int zone_db_delete | ( | zone_db_t * | zone | ) |

Delete a zone object from the database.

Parameters

  [in] | zone | a zone_db_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 1884 of file zone_db.c.

References DB_CLAUSE_EQUAL, db_clause_free(), db_clause_get_value(), db_clause_list_add(), db_clause_list_free(), db_clause_list_new(), db_clause_new(), db_clause_set_field(), db_clause_set_type(), DB_ERROR_UNKNOWN, db_object_delete(), db_value_copy(), db_value_not_empty(), zone_db::dbo, zone_db::id, and zone_db::rev.

Referenced by zonelist_import().

## zone_db_free()

void zone_db_free | ( | zone_db_t * | zone | ) |

Delete a zone object, this does not delete it from the database.

Parameters

  [in] | zone | a zone_db_t pointer.

Definition at line 325 of file zone_db.c.

References db_object_free(), db_value_reset(), zone_db::dbo, zone_db::id, zone_db::input_adapter_type, zone_db::input_adapter_uri, zone_db::key_data_list, key_data_list_free(), zone_db::key_dependency_list, key_dependency_list_free(), zone_db::name, zone_db::output_adapter_type, zone_db::output_adapter_uri, policy_free(), zone_db::policy_id, zone_db::private_policy_id, zone_db::rev, and zone_db::signconf_path.

Referenced by change_keys_from_to(), hsm_key_factory_generate(), key_data_copy(), key_data_free(), key_data_get_zone(), key_dependency_copy(), key_dependency_free(), perform_hsmkey_import(), perform_keydata_import(), perform_keystate_import(), run_ds_cmd(), signconf_export_all(), signconf_export_zone(), zone_db_ext_zonename_from_id(), zone_db_new_copy(), zone_db_new_get_by_name(), zone_list_db_copy(), zone_list_db_free(), zone_list_db_get(), zone_list_db_get_by_clauses(), zone_list_db_get_by_policy_id(), zone_list_db_get_next(), and zonelist_import().

## zone_db_from_result()

int zone_db_from_result | ( | zone_db_t * | zone,
|  | const db_result_t * | result )

Set the content of a zone object based on a database result.

Parameters

  [in] | zone | a zone_db_t pointer.
  [in] | result | a db_result_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 662 of file zone_db.c.

References DB_ERROR_UNKNOWN, DB_OK, db_result_value_set(), db_value_copy(), db_value_reset(), db_value_set_at(), db_value_set_size(), db_value_to_int32(), db_value_to_text(), db_value_to_uint32(), zone_db::id, zone_db::input_adapter_type, zone_db::input_adapter_uri, zone_db::name, zone_db::next_change, zone_db::next_csk_roll, zone_db::next_ksk_roll, zone_db::next_zsk_roll, zone_db::output_adapter_type, zone_db::output_adapter_uri, zone_db::policy_id, zone_db::rev, zone_db::roll_csk_now, zone_db::roll_ksk_now, zone_db::roll_zsk_now, zone_db::signconf_needs_writing, zone_db::signconf_path, zone_db::ttl_end_dk, zone_db::ttl_end_ds, and zone_db::ttl_end_rs.

Referenced by zone_db_get_by_id(), zone_db_get_by_name(), zone_list_db_begin(), zone_list_db_get_next(), and zone_list_db_next().

## zone_db_get_by_id()

int zone_db_get_by_id | ( | zone_db_t * | zone,
|  | const db_value_t * | id )

Get a zone object from the database by a id specified in id.

Parameters

  [in] | zone | a zone_db_t pointer.
  [in] | id | a db_value_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 1466 of file zone_db.c.

References DB_CLAUSE_EQUAL, db_clause_free(), db_clause_get_value(), db_clause_list_add(), db_clause_list_free(), db_clause_list_new(), db_clause_new(), db_clause_set_field(), db_clause_set_type(), DB_ERROR_UNKNOWN, db_object_read(), DB_OK, db_result_list_free(), db_result_list_next(), db_value_copy(), db_value_not_empty(), zone_db::dbo, and zone_db_from_result().

Referenced by key_data_get_zone(), and zone_db_ext_zonename_from_id().

## zone_db_get_by_name()

int zone_db_get_by_name | ( | zone_db_t * | zone,
|  | const char * | name )

Get a zone object from the database by a name specified in name.

Parameters

  [in] | zone | a zone_db_t pointer.
  [in] | name | a character pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 1519 of file zone_db.c.

References DB_CLAUSE_EQUAL, db_clause_free(), db_clause_get_value(), db_clause_list_add(), db_clause_list_free(), db_clause_list_new(), db_clause_new(), db_clause_set_field(), db_clause_set_type(), DB_ERROR_UNKNOWN, db_object_read(), DB_OK, db_result_list_free(), db_result_list_next(), db_value_from_text(), zone_db::dbo, and zone_db_from_result().

Referenced by run_ds_cmd(), zone_db_new_get_by_name(), and zonelist_import().

## zone_db_get_policy()

policy_t * zone_db_get_policy | ( | const zone_db_t * | zone | ) |

Get the policy_id object related to a zone object. The caller will be given ownership of this object and is responsible for freeing it.

Parameters

  [in] | zone | a zone_db_t pointer.

Returns
  a policy_t pointer or NULL on error or if no object could be found.

Definition at line 744 of file zone_db.c.

References zone_db::associated_policy_id, db_object_connection(), db_value_not_empty(), zone_db::dbo, policy_copy(), policy_free(), policy_get_by_id(), policy_id(), zone_db::policy_id, policy_new(), and zone_db::private_policy_id.

Referenced by signconf_export_all(), signconf_export_zone(), and zonelist_export().

## zone_db_id()

const db_value_t * zone_db_id | ( | const zone_db_t * | zone | ) |

Get the id of a zone object.

Parameters

  [in] | zone | a zone_db_t pointer.

Returns
  a db_value_t pointer or NULL on error.

Definition at line 728 of file zone_db.c.

References zone_db::id.

Referenced by perform_keydata_import(), and zonelist_import().

## zone_db_input_adapter_type()

const char * zone_db_input_adapter_type | ( | const zone_db_t * | zone | ) |

Get the input_adapter_type of a zone object.

Parameters

  [in] | zone | a zone_db_t pointer.

Returns
  a character pointer or NULL on error or if no input_adapter_type has been set.

Definition at line 862 of file zone_db.c.

References zone_db::input_adapter_type.

Referenced by zonelist_export(), and zonelist_import().

## zone_db_input_adapter_uri()

const char * zone_db_input_adapter_uri | ( | const zone_db_t * | zone | ) |

Get the input_adapter_uri of a zone object.

Parameters

  [in] | zone | a zone_db_t pointer.

Returns
  a character pointer or NULL on error or if no input_adapter_uri has been set.

Definition at line 870 of file zone_db.c.

References zone_db::input_adapter_uri.

Referenced by zonelist_export(), and zonelist_import().

## zone_db_name()

const char * zone_db_name | ( | const zone_db_t * | zone | ) |

Get the name of a zone object.

Parameters

  [in] | zone | a zone_db_t pointer.

Returns
  a character pointer or NULL on error or if no name has been set.

Definition at line 782 of file zone_db.c.

References zone_db::name.

Referenced by removeDeadKeysNow(), signconf_task_flush_all(), signconf_task_flush_policy(), update(), zone_db_ext_zonename_from_id(), zonelist_export(), and zonelist_import().

## zone_db_new()

zone_db_t * zone_db_new | ( | const db_connection_t * | connection | ) |

Create a new zone object.

Parameters

  [in] | connection | a db_connection_t pointer.

Returns
  a zone_db_t pointer or NULL on error.

Definition at line 287 of file zone_db.c.

References db_value_reset(), zone_db::dbo, zone_db::id, zone_db::input_adapter_type, zone_db::output_adapter_type, zone_db::policy_id, and zone_db::rev.

Referenced by hsm_key_factory_generate(), key_data_get_zone(), run_ds_cmd(), zone_db_ext_zonename_from_id(), zone_db_new_copy(), zone_db_new_get_by_name(), zone_list_db_begin(), zone_list_db_get_next(), zone_list_db_next(), and zonelist_import().

## zone_db_new_copy()

zone_db_t * zone_db_new_copy | ( | const zone_db_t * | zone | ) |

Create a new zone object that is a copy of another zone object.

Parameters

  [in] | zone | a zone_db_t pointer.

Returns
  a zone_db_t pointer or NULL on error.

Definition at line 306 of file zone_db.c.

References db_object_connection(), zone_db::dbo, zone_db_copy(), zone_db_free(), and zone_db_new().

Referenced by key_data_copy(), key_dependency_copy(), removeDeadKeysNow(), and zone_list_db_copy().

## zone_db_new_get_by_name()

zone_db_t * zone_db_new_get_by_name | ( | const db_connection_t * | connection,
|  | const char * | name )

Get a new zone object from the database by a name specified in name.

Parameters

  [in] | connection | a db_connection_t pointer.
  [in] | name | a character pointer.

Returns
  a zone_db_t pointer or NULL on error or if it does not exist.

Definition at line 1569 of file zone_db.c.

References zone_db_free(), zone_db_get_by_name(), and zone_db_new().

Referenced by change_keys_from_to(), perform_hsmkey_import(), perform_keydata_import(), perform_keystate_import(), and signconf_export_zone().

## zone_db_next_change()

int zone_db_next_change | ( | const zone_db_t * | zone | ) |

Get the next_change of a zone object. Undefined behavior if zone is NULL.

Parameters

  [in] | zone | a zone_db_t pointer.

Returns
  an integer.

Definition at line 806 of file zone_db.c.

References zone_db::next_change.

## zone_db_next_csk_roll()

unsigned int zone_db_next_csk_roll | ( | const zone_db_t * | zone | ) |

Get the next_csk_roll of a zone object. Undefined behavior if zone is NULL.

Parameters

  [in] | zone | a zone_db_t pointer.

Returns
  an unsigned integer.

Definition at line 910 of file zone_db.c.

References zone_db::next_csk_roll.

Referenced by update().

## zone_db_next_ksk_roll()

unsigned int zone_db_next_ksk_roll | ( | const zone_db_t * | zone | ) |

Get the next_ksk_roll of a zone object. Undefined behavior if zone is NULL.

Parameters

  [in] | zone | a zone_db_t pointer.

Returns
  an unsigned integer.

Definition at line 894 of file zone_db.c.

References zone_db::next_ksk_roll.

Referenced by update().

## zone_db_next_zsk_roll()

unsigned int zone_db_next_zsk_roll | ( | const zone_db_t * | zone | ) |

Get the next_zsk_roll of a zone object. Undefined behavior if zone is NULL.

Parameters

  [in] | zone | a zone_db_t pointer.

Returns
  an unsigned integer.

Definition at line 902 of file zone_db.c.

References zone_db::next_zsk_roll.

## zone_db_output_adapter_type()

const char * zone_db_output_adapter_type | ( | const zone_db_t * | zone | ) |

Get the output_adapter_type of a zone object.

Parameters

  [in] | zone | a zone_db_t pointer.

Returns
  a character pointer or NULL on error or if no output_adapter_type has been set.

Definition at line 878 of file zone_db.c.

References zone_db::output_adapter_type.

Referenced by zonelist_export().

## zone_db_output_adapter_uri()

const char * zone_db_output_adapter_uri | ( | const zone_db_t * | zone | ) |

Get the output_adapter_uri of a zone object.

Parameters

  [in] | zone | a zone_db_t pointer.

Returns
  a character pointer or NULL on error or if no output_adapter_uri has been set.

Definition at line 886 of file zone_db.c.

References zone_db::output_adapter_uri.

Referenced by zonelist_export().

## zone_db_policy_id()

const db_value_t * zone_db_policy_id | ( | const zone_db_t * | zone | ) |

Get the policy_id of a zone object.

Parameters

  [in] | zone | a zone_db_t pointer.

Returns
  a db_value_t pointer or NULL on error.

Definition at line 736 of file zone_db.c.

References zone_db::policy_id.

Referenced by perform_hsmkey_import(), perform_keystate_import(), signconf_export_all(), and zonelist_export().

## zone_db_policy_id_clause()

db_clause_t * zone_db_policy_id_clause | ( | db_clause_list_t * | clause_list,
|  | const db_value_t * | policy_id )

Create a clause for policy_id of a zone object and add it to a database clause list. The clause operator is set to DB_CLAUSE_OPERATOR_AND and the clause type is set to DB_CLAUSE_EQUAL, if you want to change these you can do it with the returned db_clause_t pointer.

Parameters

  [in] | clause_list | db_clause_list_t pointer.
  [in] | policy_id | a db_value_t pointer.

Returns
  a db_clause_t pointer to the added clause or NULL on error.

Definition at line 1179 of file zone_db.c.

References DB_CLAUSE_EQUAL, db_clause_free(), db_clause_get_value(), db_clause_list_add(), db_clause_new(), DB_CLAUSE_OPERATOR_AND, db_clause_set_field(), db_clause_set_operator(), db_clause_set_type(), db_value_copy(), db_value_not_empty(), and policy_id().

Referenced by hsm_key_factory_generate(), and policy_retrieve_zone_list().

## zone_db_roll_csk_now()

unsigned int zone_db_roll_csk_now | ( | const zone_db_t * | zone | ) |

Get the roll_csk_now of a zone object. Undefined behavior if zone is NULL.

Parameters

  [in] | zone | a zone_db_t pointer.

Returns
  an unsigned integer.

Definition at line 854 of file zone_db.c.

References zone_db::roll_csk_now.

## zone_db_roll_ksk_now()

unsigned int zone_db_roll_ksk_now | ( | const zone_db_t * | zone | ) |

Get the roll_ksk_now of a zone object. Undefined behavior if zone is NULL.

Parameters

  [in] | zone | a zone_db_t pointer.

Returns
  an unsigned integer.

Definition at line 838 of file zone_db.c.

References zone_db::roll_ksk_now.

## zone_db_roll_zsk_now()

unsigned int zone_db_roll_zsk_now | ( | const zone_db_t * | zone | ) |

Get the roll_zsk_now of a zone object. Undefined behavior if zone is NULL.

Parameters

  [in] | zone | a zone_db_t pointer.

Returns
  an unsigned integer.

Definition at line 846 of file zone_db.c.

References zone_db::roll_zsk_now.

## zone_db_set_input_adapter_type()

int zone_db_set_input_adapter_type | ( | zone_db_t * | zone,
|  | const char * | input_adapter_type_text )

Set the input_adapter_type of a zone object.

Parameters

  [in] | zone | a zone_db_t pointer.
  [in] | input_adapter_type_text | a character pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 1061 of file zone_db.c.

References DB_ERROR_UNKNOWN, DB_OK, and zone_db::input_adapter_type.

## zone_db_set_input_adapter_uri()

int zone_db_set_input_adapter_uri | ( | zone_db_t * | zone,
|  | const char * | input_adapter_uri_text )

Set the input_adapter_uri of a zone object.

Parameters

  [in] | zone | a zone_db_t pointer.
  [in] | input_adapter_uri_text | a character pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 1083 of file zone_db.c.

References DB_ERROR_UNKNOWN, DB_OK, and zone_db::input_adapter_uri.

## zone_db_set_name()

int zone_db_set_name | ( | zone_db_t * | zone,
|  | const char * | name_text )

Set the name of a zone object.

Parameters

  [in] | zone | a zone_db_t pointer.
  [in] | name_text | a character pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 937 of file zone_db.c.

References DB_ERROR_UNKNOWN, DB_OK, and zone_db::name.

## zone_db_set_next_change()

int zone_db_set_next_change | ( | zone_db_t * | zone,
|  | int | next_change )

Set the next_change of a zone object.

Parameters

  [in] | zone | a zone_db_t pointer.
  [in] | next_change | an integer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 991 of file zone_db.c.

References DB_ERROR_UNKNOWN, DB_OK, and zone_db::next_change.

## zone_db_set_next_csk_roll()

int zone_db_set_next_csk_roll | ( | zone_db_t * | zone,
|  | unsigned int | next_csk_roll )

Set the next_csk_roll of a zone object.

Parameters

  [in] | zone | a zone_db_t pointer.
  [in] | next_csk_roll | an unsigned integer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 1169 of file zone_db.c.

References DB_ERROR_UNKNOWN, DB_OK, and zone_db::next_csk_roll.

## zone_db_set_next_ksk_roll()

int zone_db_set_next_ksk_roll | ( | zone_db_t * | zone,
|  | unsigned int | next_ksk_roll )

Set the next_ksk_roll of a zone object.

Parameters

  [in] | zone | a zone_db_t pointer.
  [in] | next_ksk_roll | an unsigned integer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 1149 of file zone_db.c.

References DB_ERROR_UNKNOWN, DB_OK, and zone_db::next_ksk_roll.

## zone_db_set_next_zsk_roll()

int zone_db_set_next_zsk_roll | ( | zone_db_t * | zone,
|  | unsigned int | next_zsk_roll )

Set the next_zsk_roll of a zone object.

Parameters

  [in] | zone | a zone_db_t pointer.
  [in] | next_zsk_roll | an unsigned integer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 1159 of file zone_db.c.

References DB_ERROR_UNKNOWN, DB_OK, and zone_db::next_zsk_roll.

## zone_db_set_output_adapter_type()

int zone_db_set_output_adapter_type | ( | zone_db_t * | zone,
|  | const char * | output_adapter_type_text )

Set the output_adapter_type of a zone object.

Parameters

  [in] | zone | a zone_db_t pointer.
  [in] | output_adapter_type_text | a character pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 1105 of file zone_db.c.

References DB_ERROR_UNKNOWN, DB_OK, and zone_db::output_adapter_type.

## zone_db_set_output_adapter_uri()

int zone_db_set_output_adapter_uri | ( | zone_db_t * | zone,
|  | const char * | output_adapter_uri_text )

Set the output_adapter_uri of a zone object.

Parameters

  [in] | zone | a zone_db_t pointer.
  [in] | output_adapter_uri_text | a character pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 1127 of file zone_db.c.

References DB_ERROR_UNKNOWN, DB_OK, and zone_db::output_adapter_uri.

## zone_db_set_policy_id()

int zone_db_set_policy_id | ( | zone_db_t * | zone,
|  | const db_value_t * | policy_id )

Set the policy_id of a zone object. If this fails the original value may have been lost.

Parameters

  [in] | zone | a zone_db_t pointer.
  [in] | policy_id | a db_value_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 918 of file zone_db.c.

References DB_ERROR_UNKNOWN, DB_OK, db_value_copy(), db_value_not_empty(), db_value_reset(), policy_id(), and zone_db::policy_id.

## zone_db_set_roll_csk_now()

int zone_db_set_roll_csk_now | ( | zone_db_t * | zone,
|  | unsigned int | roll_csk_now )

Set the roll_csk_now of a zone object.

Parameters

  [in] | zone | a zone_db_t pointer.
  [in] | roll_csk_now | an unsigned integer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 1051 of file zone_db.c.

References DB_ERROR_UNKNOWN, DB_OK, and zone_db::roll_csk_now.

## zone_db_set_roll_ksk_now()

int zone_db_set_roll_ksk_now | ( | zone_db_t * | zone,
|  | unsigned int | roll_ksk_now )

Set the roll_ksk_now of a zone object.

Parameters

  [in] | zone | a zone_db_t pointer.
  [in] | roll_ksk_now | an unsigned integer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 1031 of file zone_db.c.

References DB_ERROR_UNKNOWN, DB_OK, and zone_db::roll_ksk_now.

## zone_db_set_roll_zsk_now()

int zone_db_set_roll_zsk_now | ( | zone_db_t * | zone,
|  | unsigned int | roll_zsk_now )

Set the roll_zsk_now of a zone object.

Parameters

  [in] | zone | a zone_db_t pointer.
  [in] | roll_zsk_now | an unsigned integer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 1041 of file zone_db.c.

References DB_ERROR_UNKNOWN, DB_OK, and zone_db::roll_zsk_now.

## zone_db_set_signconf_needs_writing()

int zone_db_set_signconf_needs_writing | ( | zone_db_t * | zone,
|  | unsigned int | signconf_needs_writing )

Set the signconf_needs_writing of a zone object.

Parameters

  [in] | zone | a zone_db_t pointer.
  [in] | signconf_needs_writing | an unsigned integer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 959 of file zone_db.c.

References DB_ERROR_UNKNOWN, DB_OK, and zone_db::signconf_needs_writing.

## zone_db_set_signconf_path()

int zone_db_set_signconf_path | ( | zone_db_t * | zone,
|  | const char * | signconf_path_text )

Set the signconf_path of a zone object.

Parameters

  [in] | zone | a zone_db_t pointer.
  [in] | signconf_path_text | a character pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 969 of file zone_db.c.

References DB_ERROR_UNKNOWN, DB_OK, and zone_db::signconf_path.

## zone_db_set_ttl_end_dk()

int zone_db_set_ttl_end_dk | ( | zone_db_t * | zone,
|  | unsigned int | ttl_end_dk )

Set the ttl_end_dk of a zone object.

Parameters

  [in] | zone | a zone_db_t pointer.
  [in] | ttl_end_dk | an unsigned integer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 1011 of file zone_db.c.

References DB_ERROR_UNKNOWN, DB_OK, and zone_db::ttl_end_dk.

## zone_db_set_ttl_end_ds()

int zone_db_set_ttl_end_ds | ( | zone_db_t * | zone,
|  | unsigned int | ttl_end_ds )

Set the ttl_end_ds of a zone object.

Parameters

  [in] | zone | a zone_db_t pointer.
  [in] | ttl_end_ds | an unsigned integer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 1001 of file zone_db.c.

References DB_ERROR_UNKNOWN, DB_OK, and zone_db::ttl_end_ds.

## zone_db_set_ttl_end_rs()

int zone_db_set_ttl_end_rs | ( | zone_db_t * | zone,
|  | unsigned int | ttl_end_rs )

Set the ttl_end_rs of a zone object.

Parameters

  [in] | zone | a zone_db_t pointer.
  [in] | ttl_end_rs | an unsigned integer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 1021 of file zone_db.c.

References DB_ERROR_UNKNOWN, DB_OK, and zone_db::ttl_end_rs.

## zone_db_signconf_needs_writing()

unsigned int zone_db_signconf_needs_writing | ( | const zone_db_t * | zone | ) |

Get the signconf_needs_writing of a zone object. Undefined behavior if zone is NULL.

Parameters

  [in] | zone | a zone_db_t pointer.

Returns
  an unsigned integer.

Definition at line 790 of file zone_db.c.

References zone_db::signconf_needs_writing.

## zone_db_signconf_path()

const char * zone_db_signconf_path | ( | const zone_db_t * | zone | ) |

Get the signconf_path of a zone object.

Parameters

  [in] | zone | a zone_db_t pointer.

Returns
  a character pointer or NULL on error or if no signconf_path has been set.

Definition at line 798 of file zone_db.c.

References zone_db::signconf_path.

Referenced by zonelist_export().

## zone_db_ttl_end_dk()

unsigned int zone_db_ttl_end_dk | ( | const zone_db_t * | zone | ) |

Get the ttl_end_dk of a zone object. Undefined behavior if zone is NULL.

Parameters

  [in] | zone | a zone_db_t pointer.

Returns
  an unsigned integer.

Definition at line 822 of file zone_db.c.

References zone_db::ttl_end_dk.

## zone_db_ttl_end_ds()

unsigned int zone_db_ttl_end_ds | ( | const zone_db_t * | zone | ) |

Get the ttl_end_ds of a zone object. Undefined behavior if zone is NULL.

Parameters

  [in] | zone | a zone_db_t pointer.

Returns
  an unsigned integer.

Definition at line 814 of file zone_db.c.

References zone_db::ttl_end_ds.

## zone_db_ttl_end_rs()

unsigned int zone_db_ttl_end_rs | ( | const zone_db_t * | zone | ) |

Get the ttl_end_rs of a zone object. Undefined behavior if zone is NULL.

Parameters

  [in] | zone | a zone_db_t pointer.

Returns
  an unsigned integer.

Definition at line 830 of file zone_db.c.

References zone_db::ttl_end_rs.

## zone_db_update()

int zone_db_update | ( | zone_db_t * | zone | ) |

Update a zone object in the database.

Parameters

  [in] | zone | a zone_db_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 1589 of file zone_db.c.

References DB_CLAUSE_EQUAL, db_clause_free(), db_clause_get_value(), db_clause_list_add(), db_clause_list_free(), db_clause_list_new(), db_clause_new(), db_clause_set_field(), db_clause_set_type(), DB_ERROR_UNKNOWN, db_object_field_free(), db_object_field_list_add(), db_object_field_list_free(), db_object_field_list_new(), db_object_field_new(), db_object_field_set_name(), db_object_field_set_type(), db_object_update(), DB_TYPE_ANY, DB_TYPE_INT32, DB_TYPE_TEXT, DB_TYPE_UINT32, db_value_copy(), db_value_from_int32(), db_value_from_text(), db_value_from_uint32(), db_value_not_empty(), db_value_set_free(), db_value_set_get(), db_value_set_new(), zone_db::dbo, zone_db::id, zone_db::input_adapter_type, zone_db::input_adapter_uri, zone_db::name, zone_db::next_change, zone_db::next_csk_roll, zone_db::next_ksk_roll, zone_db::next_zsk_roll, zone_db::output_adapter_type, zone_db::output_adapter_uri, zone_db::policy_id, zone_db::rev, zone_db::roll_csk_now, zone_db::roll_ksk_now, zone_db::roll_zsk_now, zone_db::signconf_needs_writing, zone_db::signconf_path, zone_db::ttl_end_dk, zone_db::ttl_end_ds, and zone_db::ttl_end_rs.

Referenced by change_keys_from_to(), and zonelist_import().

## zone_list_db_begin()

const zone_db_t * zone_list_db_begin | ( | zone_list_db_t * | zone_list_db | ) |

Get the first zone object in a zone object list and reset the position of the list.

Parameters

  [in] | zone_list_db | a zone_list_db_t pointer.

Returns
  a zone_db_t pointer or NULL on error or if there are no zone objects in the zone object list.

Definition at line 2547 of file zone_db.c.

References db_object_connection(), db_result_list_begin(), db_result_list_size(), zone_list_db::dbo, zone_list_db::object_list, zone_list_db::object_list_position, zone_list_db::object_list_size, zone_list_db::object_store, zone_list_db::result_list, zone_list_db::zone, zone_db_from_result(), and zone_db_new().

## zone_list_db_copy()

int zone_list_db_copy | ( | zone_list_db_t * | zone_list_db,
|  | const zone_list_db_t * | from_zone_list_db )

Copy the content of another zone object list.

Parameters

  [in] | zone_list_db | a zone_list_db_t pointer.
  [in] | from_zone_list_db | a zone_list_db_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 2017 of file zone_db.c.

References zone_list_db::associated_fetch, DB_ERROR_UNKNOWN, DB_OK, db_result_list_free(), db_result_list_new_copy(), zone_list_db::object_list, zone_list_db::object_list_first, zone_list_db::object_list_position, zone_list_db::object_list_size, zone_list_db::object_store, zone_list_db::policy_id_list, policy_list_new_copy(), zone_list_db::result_list, zone_db_free(), and zone_db_new_copy().

Referenced by zone_list_db_new_copy().

## zone_list_db_free()

void zone_list_db_free | ( | zone_list_db_t * | zone_list_db | ) |

Delete a zone object list.

Parameters

  [in] | zone_list_db | a zone_list_db_t pointer.

Definition at line 1989 of file zone_db.c.

References db_object_free(), db_result_list_free(), zone_list_db::dbo, zone_list_db::object_list, zone_list_db::object_list_size, zone_list_db::policy_id_list, policy_list_free(), zone_list_db::result_list, zone_list_db::zone, and zone_db_free().

Referenced by enforce_task_flush_all(), enforce_task_flush_policy(), key_data_list_free(), key_dependency_list_free(), policy_copy(), policy_free(), policy_import(), policy_retrieve_zone_list(), signconf_export_all(), signconf_task_flush_all(), signconf_task_flush_policy(), zone_list_db_new_copy(), zone_list_db_new_get(), zone_list_db_new_get_by_policy_id(), zonelist_export(), and zonelist_import().

## zone_list_db_get()

int zone_list_db_get | ( | zone_list_db_t * | zone_list_db | ) |

Get all zone objects.

Parameters

  [in] | zone_list_db | a zone_list_db_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 2363 of file zone_db.c.

References zone_list_db::associated_fetch, DB_ERROR_UNKNOWN, db_object_read(), DB_OK, db_result_list_fetch_all(), db_result_list_free(), zone_list_db::dbo, zone_list_db::object_list, zone_list_db::object_list_first, zone_list_db::object_list_size, zone_list_db::result_list, and zone_db_free().

Referenced by signconf_export_all(), signconf_task_flush_all(), zone_list_db_new_get(), and zonelist_export().

## zone_list_db_get_by_clauses()

int zone_list_db_get_by_clauses | ( | zone_list_db_t * | zone_list_db,
|  | const db_clause_list_t * | clause_list )

Get zone objects from the database by a clause list.

Parameters

  [in] | zone_list_db | a zone_list_db_t pointer.
  [in] | clause_list | a db_clause_list_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 2419 of file zone_db.c.

References zone_list_db::associated_fetch, DB_ERROR_UNKNOWN, db_object_read(), DB_OK, db_result_list_fetch_all(), db_result_list_free(), zone_list_db::dbo, zone_list_db::object_list, zone_list_db::object_list_first, zone_list_db::object_list_size, zone_list_db::result_list, and zone_db_free().

Referenced by policy_retrieve_zone_list().

## zone_list_db_get_by_policy_id()

int zone_list_db_get_by_policy_id | ( | zone_list_db_t * | zone_list_db,
|  | const db_value_t * | policy_id )

Get zone objects from the database by a policy_id specified in policy_id.

Parameters

  [in] | zone_list_db | a zone_list_db_t pointer.
  [in] | policy_id | a db_value_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 2461 of file zone_db.c.

References zone_list_db::associated_fetch, DB_CLAUSE_EQUAL, db_clause_free(), db_clause_get_value(), db_clause_list_add(), db_clause_list_free(), db_clause_list_new(), db_clause_new(), db_clause_set_field(), db_clause_set_type(), DB_ERROR_UNKNOWN, db_object_read(), DB_OK, db_result_list_fetch_all(), db_result_list_free(), db_value_copy(), db_value_not_empty(), zone_list_db::dbo, zone_list_db::object_list, zone_list_db::object_list_first, zone_list_db::object_list_size, policy_id(), zone_list_db::result_list, and zone_db_free().

Referenced by zone_list_db_new_get_by_policy_id().

## zone_list_db_get_next()

zone_db_t * zone_list_db_get_next | ( | zone_list_db_t * | zone_list_db | ) |

Get the next zone object in a zone object list. The caller will be given ownership of this object and is responsible for freeing it.

Parameters

  [in] | zone_list_db | a zone_list_db_t pointer.

Returns
  a zone_db_t pointer or NULL on error or if there are no more zone objects in the zone object list.

Definition at line 2669 of file zone_db.c.

References db_object_connection(), db_result_list_next(), zone_list_db::dbo, zone_list_db::object_store, zone_list_db::result_list, zone_db_copy(), zone_db_free(), zone_db_from_result(), zone_db_new(), and zone_list_db_next().

Referenced by removeDeadKeysNow(), and signconf_export_all().

## zone_list_db_new()

zone_list_db_t * zone_list_db_new | ( | const db_connection_t * | connection | ) |

Create a new zone object list.

Parameters

  [in] | connection | a db_connection_t pointer.

Returns
  a zone_list_db_t pointer or NULL on error.

Definition at line 1946 of file zone_db.c.

References zone_list_db::dbo.

Referenced by policy_retrieve_zone_list(), signconf_export_all(), signconf_task_flush_all(), zone_list_db_new_copy(), zone_list_db_new_get(), zone_list_db_new_get_by_policy_id(), and zonelist_export().

## zone_list_db_new_copy()

zone_list_db_t * zone_list_db_new_copy | ( | const zone_list_db_t * | zone_copy | ) |

Create a new zone object list that is a copy of another.

Parameters

  [in] | zone_list_db | a zone_list_db_t pointer.

Returns
  a zone_list_db_t pointer or NULL on error.

Definition at line 1960 of file zone_db.c.

References db_object_connection(), zone_list_db::dbo, zone_list_db_copy(), zone_list_db_free(), and zone_list_db_new().

Referenced by key_data_list_copy(), key_dependency_list_copy(), and policy_copy().

## zone_list_db_new_get()

zone_list_db_t * zone_list_db_new_get | ( | const db_connection_t * | connection | ) |

Get a new list with all zone objects.

Parameters

  [in] | connection | a db_connection_t pointer.

Returns
  a zone_list_db_t pointer or NULL on error.

Definition at line 2402 of file zone_db.c.

References zone_list_db_free(), zone_list_db_get(), and zone_list_db_new().

Referenced by enforce_task_flush_all(), and zonelist_import().

## zone_list_db_new_get_by_policy_id()

zone_list_db_t * zone_list_db_new_get_by_policy_id | ( | const db_connection_t * | connection,
|  | const db_value_t * | policy_id )

Get a new list of zone objects from the database by a policy_id specified in policy_id.

Parameters

  [in] | connection | a db_connection_t pointer.
  [in] | policy_id | a db_value_t pointer.

Returns
  a zone_list_db_t pointer or NULL on error.

Definition at line 2524 of file zone_db.c.

References db_value_not_empty(), policy_id(), zone_list_db_free(), zone_list_db_get_by_policy_id(), and zone_list_db_new().

Referenced by enforce_task_flush_policy(), policy_import(), and signconf_task_flush_policy().

## zone_list_db_next()

const zone_db_t * zone_list_db_next | ( | zone_list_db_t * | zone_list_db | ) |

Get the next zone object in a zone object list. Ownership of this object is retained within the list and the object is only valid until the next call to this function.

Parameters

  [in] | zone_list_db | a zone_list_db_t pointer.

Returns
  a zone_db_t pointer or NULL on error or if there are no more zone objects in the zone object list.

Definition at line 2603 of file zone_db.c.

References db_object_connection(), db_result_list_next(), db_result_list_size(), zone_list_db::dbo, zone_list_db::object_list, zone_list_db::object_list_first, zone_list_db::object_list_position, zone_list_db::object_list_size, zone_list_db::object_store, zone_list_db::result_list, zone_list_db::zone, zone_db_from_result(), and zone_db_new().

Referenced by enforce_task_flush_all(), enforce_task_flush_policy(), policy_import(), signconf_task_flush_all(), signconf_task_flush_policy(), zone_list_db_get_next(), zonelist_export(), and zonelist_import().

## zone_list_db_object_store()

int zone_list_db_object_store | ( | zone_list_db_t * | zone_list_db | ) |

Specify that objects should be stored within the list as they are fetch, this is optimal if the list is to be iterated over more then once.

Parameters

  [in] | zone_list_db | a zone_list_db_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 1979 of file zone_db.c.

References DB_ERROR_UNKNOWN, DB_OK, and zone_list_db::object_store.

Referenced by policy_retrieve_zone_list().

## zone_list_db_size()

size_t zone_list_db_size | ( | zone_list_db_t * | zone_list_db | ) |

Get the size of a zone object list.

Parameters

  [in] | zone_list_db | a zone_list_db_t pointer.

Returns
  a size_t with the size of the list or zero on error, if the list is empty or if the backend does not support returning the size.

Definition at line 2705 of file zone_db.c.

References db_result_list_size(), zone_list_db::object_list, zone_list_db::object_list_size, zone_list_db::object_store, and zone_list_db::result_list.

Referenced by removeDeadKeysNow().