key_data.h File Reference
`#include "db_object.h"`
`#include "key_data_ext.h"`
`#include "zone_db.h"`
`#include "hsm_key.h"`

Go to the source code of this file.

## Data Structures

struct | key_data
struct | key_data_list

## Typedefs

typedef struct key_data | key_data_t
typedef struct key_data_list | key_data_list_t
typedef enum key_data_role | key_data_role_t
typedef enum key_data_ds_at_parent | key_data_ds_at_parent_t

## Enumerations

enum | key_data_role { KEY_DATA_ROLE_INVALID = -1, KEY_DATA_ROLE_KSK = 1, KEY_DATA_ROLE_ZSK = 2, KEY_DATA_ROLE_CSK = 3 }
enum | key_data_ds_at_parent { KEY_DATA_DS_AT_PARENT_INVALID = -1, KEY_DATA_DS_AT_PARENT_UNSUBMITTED = 0, KEY_DATA_DS_AT_PARENT_SUBMIT = 1, KEY_DATA_DS_AT_PARENT_SUBMITTED = 2, KEY_DATA_DS_AT_PARENT_SEEN = 3, KEY_DATA_DS_AT_PARENT_RETRACT = 4, KEY_DATA_DS_AT_PARENT_RETRACTED = 5 }

## Functions

key_data_t * | key_data_new (const db_connection_t *connection)
key_data_t * | key_data_new_copy (const key_data_t *key_data)
void | key_data_free (key_data_t *key_data)
int | key_data_copy (key_data_t *key_data, const key_data_t *key_data_copy)
int | key_data_cmp (const key_data_t *key_data_a, const key_data_t *key_data_b)
int | key_data_from_result (key_data_t *key_data, const db_result_t *result)
const db_value_t * | key_data_id (const key_data_t *key_data)
const db_value_t * | key_data_zone_id (const key_data_t *key_data)
zone_db_t * | key_data_get_zone (const key_data_t *key_data)
const db_value_t * | key_data_hsm_key_id (const key_data_t *key_data)
int | key_data_cache_hsm_key (key_data_t *key_data)
const hsm_key_t * | key_data_hsm_key (const key_data_t *key_data)
hsm_key_t * | key_data_get_hsm_key (const key_data_t *key_data)
unsigned int | key_data_algorithm (const key_data_t *key_data)
unsigned int | key_data_inception (const key_data_t *key_data)
key_data_role_t | key_data_role (const key_data_t *key_data)
const char * | key_data_role_text (const key_data_t *key_data)
unsigned int | key_data_introducing (const key_data_t *key_data)
unsigned int | key_data_active_zsk (const key_data_t *key_data)
unsigned int | key_data_publish (const key_data_t *key_data)
unsigned int | key_data_active_ksk (const key_data_t *key_data)
key_data_ds_at_parent_t | key_data_ds_at_parent (const key_data_t *key_data)
unsigned int | key_data_keytag (const key_data_t *key_data)
unsigned int | key_data_minimize (const key_data_t *key_data)
key_state_list_t * | key_data_key_state_list (key_data_t *key_data)
int | key_data_retrieve_key_state_list (key_data_t *key_data)
int | key_data_set_zone_id (key_data_t *key_data, const db_value_t *zone_id)
int | key_data_set_hsm_key_id (key_data_t *key_data, const db_value_t *hsm_key_id)
int | key_data_set_algorithm (key_data_t *key_data, unsigned int algorithm)
int | key_data_set_inception (key_data_t *key_data, unsigned int inception)
int | key_data_set_role (key_data_t *key_data, key_data_role_t role)
int | key_data_set_introducing (key_data_t *key_data, unsigned int introducing)
int | key_data_set_active_zsk (key_data_t *key_data, unsigned int active_zsk)
int | key_data_set_publish (key_data_t *key_data, unsigned int publish)
int | key_data_set_active_ksk (key_data_t *key_data, unsigned int active_ksk)
int | key_data_set_ds_at_parent (key_data_t *key_data, key_data_ds_at_parent_t ds_at_parent)
int | key_data_set_keytag (key_data_t *key_data, unsigned int keytag)
int | key_data_set_minimize (key_data_t *key_data, unsigned int minimize)
db_clause_t * | key_data_zone_id_clause (db_clause_list_t *clause_list, const db_value_t *zone_id)
db_clause_t * | key_data_hsm_key_id_clause (db_clause_list_t *clause_list, const db_value_t *hsm_key_id)
db_clause_t * | key_data_role_clause (db_clause_list_t *clause_list, key_data_role_t role)
db_clause_t * | key_data_ds_at_parent_clause (db_clause_list_t *clause_list, key_data_ds_at_parent_t ds_at_parent)
db_clause_t * | key_data_keytag_clause (db_clause_list_t *clause_list, unsigned int keytag)
int | key_data_create (key_data_t *key_data)
int | key_data_get_by_id (key_data_t *key_data, const db_value_t *id)
int | key_data_update (key_data_t *key_data)
int | key_data_delete (key_data_t *key_data)
int | key_data_count (key_data_t *key_data, db_clause_list_t *clause_list, size_t *count)
key_data_list_t * | key_data_list_new (const db_connection_t *connection)
key_data_list_t * | key_data_list_new_copy (const key_data_list_t *key_data_copy)
int | key_data_list_object_store (key_data_list_t *key_data_list)
void | key_data_list_free (key_data_list_t *key_data_list)
int | key_data_list_copy (key_data_list_t *key_data_list, const key_data_list_t *from_key_data_list)
int | key_data_list_get (key_data_list_t *key_data_list)
key_data_list_t * | key_data_list_new_get (const db_connection_t *connection)
int | key_data_list_get_by_clauses (key_data_list_t *key_data_list, const db_clause_list_t *clause_list)
key_data_list_t * | key_data_list_new_get_by_clauses (const db_connection_t *connection, const db_clause_list_t *clause_list)
int | key_data_list_get_by_zone_id (key_data_list_t *key_data_list, const db_value_t *zone_id)
key_data_list_t * | key_data_list_new_get_by_zone_id (const db_connection_t *connection, const db_value_t *zone_id)
const key_data_t * | key_data_list_begin (key_data_list_t *key_data_list)
key_data_t * | key_data_list_get_begin (key_data_list_t *key_data_list)
const key_data_t * | key_data_list_next (key_data_list_t *key_data_list)
key_data_t * | key_data_list_get_next (key_data_list_t *key_data_list)
size_t | key_data_list_size (key_data_list_t *key_data_list)
key_data_t * | key_data_new_get_by_hsm_key_id (const db_connection_t *connection, const db_value_t *hsm_key_id)
int | key_data_get_by_hsm_key_id (key_data_t *key_data, const db_value_t *hsm_key_id)

## Variables

const db_enum_t | key_data_enum_set_role []
const db_enum_t | key_data_enum_set_ds_at_parent []

## Typedef Documentation

## key_data_ds_at_parent_t

typedef enum key_data_ds_at_parent key_data_ds_at_parent_t

## key_data_list_t

typedef struct key_data_list key_data_list_t

Definition at line 38 of file key_data.h.

## key_data_role_t

typedef enum key_data_role key_data_role_t

## key_data_t

typedef struct key_data key_data_t

Definition at line 37 of file key_data.h.

## Enumeration Type Documentation

## key_data_ds_at_parent

enum key_data_ds_at_parent

Enumerator
KEY_DATA_DS_AT_PARENT_INVALID |
KEY_DATA_DS_AT_PARENT_UNSUBMITTED |
KEY_DATA_DS_AT_PARENT_SUBMIT |
KEY_DATA_DS_AT_PARENT_SUBMITTED |
KEY_DATA_DS_AT_PARENT_SEEN |
KEY_DATA_DS_AT_PARENT_RETRACT |
KEY_DATA_DS_AT_PARENT_RETRACTED |

Definition at line 48 of file key_data.h.

## key_data_role

enum key_data_role

Enumerator
KEY_DATA_ROLE_INVALID |
KEY_DATA_ROLE_KSK |
KEY_DATA_ROLE_ZSK |
KEY_DATA_ROLE_CSK |

Definition at line 40 of file key_data.h.

## Function Documentation

## key_data_active_ksk()

unsigned int key_data_active_ksk | ( | const key_data_t * | key_data | ) |

Get the active_ksk of a key data object. Undefined behavior if `key_data` is NULL.

Parameters

  [in] | key_data | a key_data_t pointer.

Returns
  an unsigned integer.

Definition at line 751 of file key_data.c.

References key_data::active_ksk.

## key_data_active_zsk()

unsigned int key_data_active_zsk | ( | const key_data_t * | key_data | ) |

Get the active_zsk of a key data object. Undefined behavior if `key_data` is NULL.

Parameters

  [in] | key_data | a key_data_t pointer.

Returns
  an unsigned integer.

Definition at line 735 of file key_data.c.

References key_data::active_zsk.

## key_data_algorithm()

unsigned int key_data_algorithm | ( | const key_data_t * | key_data | ) |

Get the algorithm of a key data object. Undefined behavior if `key_data` is NULL.

Parameters

  [in] | key_data | a key_data_t pointer.

Returns
  an unsigned integer.

Definition at line 687 of file key_data.c.

References key_data::algorithm.

## key_data_cache_hsm_key()

int key_data_cache_hsm_key | ( | key_data_t * | key_data | ) |

Cache the hsm_key_id object related to a key data object.

Parameters

  [in] | key_data | a key_data_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 615 of file key_data.c.

References key_data::associated_hsm_key_id, DB_ERROR_UNKNOWN, db_object_connection(), DB_OK, key_data::dbo, hsm_key_free(), hsm_key_get_by_id(), key_data::hsm_key_id, hsm_key_new(), and key_data::private_hsm_key_id.

## key_data_cmp()

int key_data_cmp | ( | const key_data_t * | key_data_a,
|  | const key_data_t * | key_data_b
| ) |  |

Compare two key data objects and return less than, equal to, or greater than zero if A is found, respectively, to be less than, to match, or be greater than B.

Parameters

  [in] | key_data_a | a key_data_t pointer.
  [in] | key_data_b | a key_data_t pointer.

Returns
  less than, equal to, or greater than zero if A is found, respectively, to be less than, to match, or be greater than B.

Definition at line 402 of file key_data.c.

References key_data::active_ksk, key_data::active_zsk, key_data::algorithm, db_value_cmp(), key_data::ds_at_parent, key_data::hsm_key_id, key_data::inception, key_data::introducing, key_data::keytag, key_data::minimize, key_data::publish, key_data::role, key_data::should_revoke, key_data::standby, and key_data::zone_id.

## key_data_copy()

int key_data_copy | ( | key_data_t * | key_data,
|  | const key_data_t * | key_data_copy
| ) |  |

Copy the content of a key data object.

Parameters

  [in] | key_data | a key_data_t pointer.
  [in] | key_data_copy | a key_data_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 326 of file key_data.c.

References key_data::active_ksk, key_data::active_zsk, key_data::algorithm, key_data::associated_hsm_key_id, key_data::associated_zone_id, DB_ERROR_UNKNOWN, DB_OK, db_value_copy(), key_data::ds_at_parent, hsm_key_free(), key_data::hsm_key_id, hsm_key_new_copy(), key_data::id, key_data::inception, key_data::introducing, key_data::key_state_list, key_state_list_free(), key_state_list_new_copy(), key_data::keytag, key_data::minimize, key_data::private_hsm_key_id, key_data::private_zone_id, key_data::publish, key_data::rev, key_data::role, key_data::should_revoke, key_data::standby, zone_db_free(), zone_db_new_copy(), and key_data::zone_id.

Referenced by key_data_new_copy(), and key_dependency_get_from_key_data().

## key_data_count()

int key_data_count | ( | key_data_t * | key_data,
|  | db_clause_list_t * | clause_list,
|  | size_t * | count
| ) |  |

Count the number of key data 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] | key_data | a key_data_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 1633 of file key_data.c.

## key_data_create()

int key_data_create | ( | key_data_t * | key_data | ) |

Create a key data object in the database.

Parameters

  [in] | key_data | a key_data_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 1093 of file key_data.c.

## key_data_delete()

int key_data_delete | ( | key_data_t * | key_data | ) |

Delete a key data object from the database.

Parameters

  [in] | key_data | a key_data_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 1587 of file key_data.c.

## key_data_ds_at_parent()

key_data_ds_at_parent_t key_data_ds_at_parent | ( | const key_data_t * | key_data | ) |

Get the ds_at_parent of a key data object.

Parameters

  [in] | key_data | a key_data_t pointer.

Returns
  a key_data_ds_at_parent_t which may be KEY_DATA_DS_AT_PARENT_INVALID on error or if no ds_at_parent has been set.

Definition at line 759 of file key_data.c.

References key_data::ds_at_parent, and KEY_DATA_DS_AT_PARENT_INVALID.

## key_data_ds_at_parent_clause()

db_clause_t* key_data_ds_at_parent_clause | ( | db_clause_list_t * | clause_list,
|  | key_data_ds_at_parent_t | ds_at_parent
| ) |  |

Create a clause for ds_at_parent of a key data 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] | ds_at_parent | a key_data_ds_at_parent_t.

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

Definition at line 1051 of file key_data.c.

## key_data_free()

void key_data_free | ( | key_data_t * | key_data | ) |

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

Parameters

  [in] | key_data | a key_data_t pointer.

Definition at line 304 of file key_data.c.

References db_object_free(), db_value_reset(), key_data::dbo, hsm_key_free(), key_data::hsm_key_id, key_data::id, key_data::key_state_list, key_state_list_free(), key_data::private_hsm_key_id, key_data::private_zone_id, key_data::rev, zone_db_free(), and key_data::zone_id.

Referenced by key_data_list_copy(), key_data_list_free(), key_data_list_get(), key_data_new_copy(), key_data_new_get_by_hsm_key_id(), key_dependency_copy(), key_dependency_free(), key_dependency_get_from_key_data(), key_state_copy(), and key_state_free().

## key_data_from_result()

int key_data_from_result | ( | key_data_t * | key_data,
|  | const db_result_t * | result
| ) |  |

Set the content of a key data object based on a database result.

Parameters

  [in] | key_data | a key_data_t pointer.
  [in] | result | a db_result_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 477 of file key_data.c.

## key_data_get_by_hsm_key_id()

int key_data_get_by_hsm_key_id | ( | key_data_t * | key_data,
|  | const db_value_t * | hsm_key_id
| ) |  |

Definition at line 2479 of file key_data.c.

Referenced by key_data_new_get_by_hsm_key_id().

## key_data_get_by_id()

int key_data_get_by_id | ( | key_data_t * | key_data,
|  | const db_value_t * | id
| ) |  |

Get a key data object from the database by a id specified in `id`.

Parameters

  [in] | key_data | a key_data_t pointer.
  [in] | id | a db_value_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 1296 of file key_data.c.

Referenced by key_dependency_get_from_key_data().

## key_data_get_hsm_key()

hsm_key_t* key_data_get_hsm_key | ( | const key_data_t * | key_data | ) |

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

Parameters

  [in] | key_data | a key_data_t pointer.

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

Definition at line 649 of file key_data.c.

References key_data::associated_hsm_key_id, db_object_connection(), db_value_not_empty(), key_data::dbo, hsm_key_copy(), hsm_key_free(), hsm_key_get_by_id(), key_data::hsm_key_id, hsm_key_id(), hsm_key_new(), and key_data::private_hsm_key_id.

## key_data_get_zone()

zone_db_t* key_data_get_zone | ( | const key_data_t * | key_data | ) |

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

Parameters

  [in] | key_data | a key_data_t pointer.

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

Definition at line 569 of file key_data.c.

References key_data::associated_zone_id, db_object_connection(), db_value_not_empty(), key_data::dbo, key_data::private_zone_id, zone_db_copy(), zone_db_free(), zone_db_get_by_id(), zone_db_new(), and key_data::zone_id.

## key_data_hsm_key()

const hsm_key_t* key_data_hsm_key | ( | const key_data_t * | key_data | ) |

Get the hsm_key_id object related to a key data object.

Parameters

  [in] | key_data | a key_data_t pointer.

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

Definition at line 638 of file key_data.c.

References key_data::associated_hsm_key_id, and key_data::private_hsm_key_id.

Referenced by key_data_cached_hsm_key().

## key_data_hsm_key_id()

const db_value_t* key_data_hsm_key_id | ( | const key_data_t * | key_data | ) |

Get the hsm_key_id of a key data object.

Parameters

  [in] | key_data | a key_data_t pointer.

Returns
  a db_value_t pointer or NULL on error.

Definition at line 607 of file key_data.c.

References key_data::hsm_key_id.

## key_data_hsm_key_id_clause()

db_clause_t* key_data_hsm_key_id_clause | ( | db_clause_list_t * | clause_list,
|  | const db_value_t * | hsm_key_id
| ) |  |

Create a clause for hsm_key_id of a key data 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] | hsm_key_id | a db_value_t pointer.

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

Definition at line 1003 of file key_data.c.

## key_data_id()

const db_value_t* key_data_id | ( | const key_data_t * | key_data | ) |

Get the id of a key data object.

Parameters

  [in] | key_data | a key_data_t pointer.

Returns
  a db_value_t pointer or NULL on error.

Definition at line 553 of file key_data.c.

References key_data::id.

## key_data_inception()

unsigned int key_data_inception | ( | const key_data_t * | key_data | ) |

Get the inception of a key data object. Undefined behavior if `key_data` is NULL.

Parameters

  [in] | key_data | a key_data_t pointer.

Returns
  an unsigned integer.

Definition at line 695 of file key_data.c.

References key_data::inception.

## key_data_introducing()

unsigned int key_data_introducing | ( | const key_data_t * | key_data | ) |

Get the introducing of a key data object. Undefined behavior if `key_data` is NULL.

Parameters

  [in] | key_data | a key_data_t pointer.

Returns
  an unsigned integer.

Definition at line 727 of file key_data.c.

References key_data::introducing.

## key_data_key_state_list()

key_state_list_t* key_data_key_state_list | ( | key_data_t * | key_data | ) |

Get the key_state objects related to a key data object.

Parameters

  [in] | key_data | a key_data_t pointer.

Returns
  a key_state_list_t pointer or NULL on error.

Definition at line 783 of file key_data.c.

References key_data::dbo, key_data_retrieve_key_state_list(), and key_data::key_state_list.

## key_data_keytag()

unsigned int key_data_keytag | ( | const key_data_t * | key_data | ) |

Get the keytag of a key data object. Undefined behavior if `key_data` is NULL.

Parameters

  [in] | key_data | a key_data_t pointer.

Returns
  an unsigned integer.

Definition at line 767 of file key_data.c.

References key_data::keytag.

## key_data_keytag_clause()

db_clause_t* key_data_keytag_clause | ( | db_clause_list_t * | clause_list,
|  | unsigned int | keytag
| ) |  |

Create a clause for keytag of a key data 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] | keytag | an unsigned integer.

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

Definition at line 1072 of file key_data.c.

## key_data_list_begin()

const key_data_t* key_data_list_begin | ( | key_data_list_t * | key_data_list | ) |

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

Parameters

  [in] | key_data_list | a key_data_list_t pointer.

Returns
  a key_data_t pointer or NULL on error or if there are no key data objects in the key data object list.

Definition at line 2267 of file key_data.c.

## key_data_list_copy()

int key_data_list_copy | ( | key_data_list_t * | key_data_list,
|  | const key_data_list_t * | from_key_data_list
| ) |  |

Copy the content of another key data object list.

Parameters

  [in] | key_data_list | a key_data_list_t pointer.
  [in] | from_key_data_list | a key_data_list_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 1725 of file key_data.c.

References key_data_list::associated_fetch, DB_ERROR_UNKNOWN, DB_OK, db_result_list_free(), db_result_list_new_copy(), key_data_list::hsm_key_id_list, hsm_key_list_new_copy(), key_data_free(), key_data_new_copy(), key_data_list::object_list, key_data_list::object_list_first, key_data_list::object_list_position, key_data_list::object_list_size, key_data_list::object_store, key_data_list::result_list, key_data_list::zone_id_list, and zone_list_db_new_copy().

Referenced by key_data_list_new_copy().

## key_data_list_free()

void key_data_list_free | ( | key_data_list_t * | key_data_list | ) |

Delete a key data object list.

Parameters

  [in] | key_data_list | a key_data_list_t pointer.

Definition at line 1694 of file key_data.c.

References db_object_free(), db_result_list_free(), key_data_list::dbo, key_data_list::hsm_key_id_list, hsm_key_list_free(), key_data_list::key_data, key_data_free(), key_data_list::object_list, key_data_list::object_list_size, key_data_list::result_list, key_data_list::zone_id_list, and zone_list_db_free().

Referenced by key_data_list_new_copy(), key_data_list_new_get(), key_data_list_new_get_by_zone_id(), key_dependency_list_free(), key_state_list_free(), zone_db_copy(), and zone_db_free().

## key_data_list_get()

int key_data_list_get | ( | key_data_list_t * | key_data_list | ) |

Get all key data objects.

Parameters

  [in] | key_data_list | a key_data_list_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 2063 of file key_data.c.

References key_data_list::associated_fetch, DB_ERROR_UNKNOWN, db_object_read(), db_result_list_fetch_all(), db_result_list_free(), key_data_list::dbo, key_data_free(), key_data_list::object_list, key_data_list::object_list_first, key_data_list::object_list_size, and key_data_list::result_list.

Referenced by key_data_list_new_get().

## key_data_list_get_begin()

key_data_t* key_data_list_get_begin | ( | key_data_list_t * | key_data_list | ) |

Get the first key data object in a key data object list and reset the position of the list. The caller will be given ownership of this object and is responsible for freeing it.

Parameters

  [in] | key_data_list | a key_data_list_t pointer.

Returns
  a key_data_t pointer or NULL on error or if there are no key data objects in the key data object list.

Definition at line 2323 of file key_data.c.

## key_data_list_get_by_clauses()

int key_data_list_get_by_clauses | ( | key_data_list_t * | key_data_list,
|  | const db_clause_list_t * | clause_list
| ) |  |

Get key data objects from the database by a clause list.

Parameters

  [in] | key_data_list | a key_data_list_t pointer.
  [in] | clause_list | a db_clause_list_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 2119 of file key_data.c.

## key_data_list_get_by_zone_id()

int key_data_list_get_by_zone_id | ( | key_data_list_t * | key_data_list,
|  | const db_value_t * | zone_id
| ) |  |

Get key data objects from the database by a zone_id specified in `zone_id`.

Parameters

  [in] | key_data_list | a key_data_list_t pointer.
  [in] | zone_id | a db_value_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 2181 of file key_data.c.

Referenced by key_data_list_new_get_by_zone_id().

## key_data_list_get_next()

key_data_t* key_data_list_get_next | ( | key_data_list_t * | key_data_list | ) |

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

Parameters

  [in] | key_data_list | a key_data_list_t pointer.

Returns
  a key_data_t pointer or NULL on error or if there are no more key data objects in the key data object list.

Definition at line 2425 of file key_data.c.

## key_data_list_new()

key_data_list_t* key_data_list_new | ( | const db_connection_t * | connection | ) |

Create a new key data object list.

Parameters

  [in] | connection | a db_connection_t pointer.

Returns
  a key_data_list_t pointer or NULL on error.

Definition at line 1651 of file key_data.c.

References key_data_list::dbo.

Referenced by key_data_list_new_copy(), key_data_list_new_get(), and key_data_list_new_get_by_zone_id().

## key_data_list_new_copy()

key_data_list_t* key_data_list_new_copy | ( | const key_data_list_t * | key_data_copy | ) |

Create a new key data object list that is a copy of another.

Parameters

  [in] | key_data_list | a key_data_list_t pointer.

Returns
  a key_data_list_t pointer or NULL on error.

Definition at line 1665 of file key_data.c.

References db_object_connection(), key_data_list::dbo, key_data_list_copy(), key_data_list_free(), and key_data_list_new().

Referenced by key_dependency_list_copy(), key_state_list_copy(), and zone_db_copy().

## key_data_list_new_get()

key_data_list_t* key_data_list_new_get | ( | const db_connection_t * | connection | ) |

Get a new list with all key data objects.

Parameters

  [in] | connection | a db_connection_t pointer.

Returns
  a key_data_list_t pointer or NULL on error.

Definition at line 2102 of file key_data.c.

References key_data_list_free(), key_data_list_get(), and key_data_list_new().

## key_data_list_new_get_by_clauses()

key_data_list_t* key_data_list_new_get_by_clauses | ( | const db_connection_t * | connection,
|  | const db_clause_list_t * | clause_list
| ) |  |

Get a new list of key data objects from the database by a clause list.

Parameters

  [in] | connection | a db_connection_t pointer.
  [in] | clause_list | a db_clause_list_t pointer.

Returns
  a key_data_list_t pointer or NULL on error.

Definition at line 2161 of file key_data.c.

## key_data_list_new_get_by_zone_id()

key_data_list_t* key_data_list_new_get_by_zone_id | ( | const db_connection_t * | connection,
|  | const db_value_t * | zone_id
| ) |  |

Get a new list of key data objects from the database by a zone_id specified in `zone_id`.

Parameters

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

Returns
  a key_data_list_t pointer or NULL on error.

Definition at line 2244 of file key_data.c.

References db_value_not_empty(), key_data_list_free(), key_data_list_get_by_zone_id(), and key_data_list_new().

Referenced by zone_db_get_keys().

## key_data_list_next()

const key_data_t* key_data_list_next | ( | key_data_list_t * | key_data_list | ) |

Get the next key data object in a key data 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] | key_data_list | a key_data_list_t pointer.

Returns
  a key_data_t pointer or NULL on error or if there are no more key data objects in the key data object list.

Definition at line 2359 of file key_data.c.

## key_data_list_object_store()

int key_data_list_object_store | ( | key_data_list_t * | key_data_list | ) |

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] | key_data_list | a key_data_list_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 1684 of file key_data.c.

References DB_ERROR_UNKNOWN, DB_OK, and key_data_list::object_store.

## key_data_list_size()

size_t key_data_list_size | ( | key_data_list_t * | key_data_list | ) |

Get the size of a key data object list.

Parameters

  [in] | key_data_list | a key_data_list_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 2461 of file key_data.c.

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

## key_data_minimize()

unsigned int key_data_minimize | ( | const key_data_t * | key_data | ) |

Get the minimize of a key data object. Undefined behavior if `key_data` is NULL.

Parameters

  [in] | key_data | a key_data_t pointer.

Returns
  an unsigned integer.

Definition at line 775 of file key_data.c.

References key_data::minimize.

## key_data_new()

key_data_t* key_data_new | ( | const db_connection_t * | connection | ) |

Create a new key data object.

Parameters

  [in] | connection | a db_connection_t pointer.

Returns
  a key_data_t pointer or NULL on error.

Definition at line 264 of file key_data.c.

References key_data::dbo.

Referenced by key_data_new_copy(), key_data_new_get_by_hsm_key_id(), and key_dependency_get_from_key_data().

## key_data_new_copy()

key_data_t* key_data_new_copy | ( | const key_data_t * | key_data | ) |

Create a new key data object that is a copy of another key data object.

Parameters

  [in] | key_data | a key_data_t pointer.

Returns
  a key_data_t pointer or NULL on error.

Definition at line 285 of file key_data.c.

References db_object_connection(), key_data::dbo, key_data_copy(), key_data_free(), and key_data_new().

Referenced by key_data_list_copy(), key_dependency_copy(), and key_state_copy().

## key_data_new_get_by_hsm_key_id()

key_data_t* key_data_new_get_by_hsm_key_id | ( | const db_connection_t * | connection,
|  | const db_value_t * | hsm_key_id
| ) |  |

Definition at line 2530 of file key_data.c.

References key_data_free(), key_data_get_by_hsm_key_id(), and key_data_new().

## key_data_publish()

unsigned int key_data_publish | ( | const key_data_t * | key_data | ) |

Get the publish of a key data object. Undefined behavior if `key_data` is NULL.

Parameters

  [in] | key_data | a key_data_t pointer.

Returns
  an unsigned integer.

Definition at line 743 of file key_data.c.

References key_data::publish.

## key_data_retrieve_key_state_list()

int key_data_retrieve_key_state_list | ( | key_data_t * | key_data | ) |

Retrieve key_state objects related to a key data object. Use key_data_key_state_list() to get the list afterwards. This will refetch objects if already retrieved.

Parameters

  [in] | key_data | a key_data_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 801 of file key_data.c.

Referenced by key_data_cache_key_states(), and key_data_key_state_list().

## key_data_role()

key_data_role_t key_data_role | ( | const key_data_t * | key_data | ) |

Get the role of a key data object.

Parameters

  [in] | key_data | a key_data_t pointer.

Returns
  a key_data_role_t which may be KEY_DATA_ROLE_INVALID on error or if no role has been set.

Definition at line 703 of file key_data.c.

References KEY_DATA_ROLE_INVALID, and key_data::role.

## key_data_role_clause()

db_clause_t* key_data_role_clause | ( | db_clause_list_t * | clause_list,
|  | key_data_role_t | role
| ) |  |

Create a clause for role of a key data 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] | role | a key_data_role_t.

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

Definition at line 1030 of file key_data.c.

## key_data_role_text()

const char* key_data_role_text | ( | const key_data_t * | key_data | ) |

Get the role as text of a key data object.

Parameters

  [in] | key_data | a key_data_t pointer.

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

Definition at line 711 of file key_data.c.

## key_data_set_active_ksk()

int key_data_set_active_ksk | ( | key_data_t * | key_data,
|  | unsigned int | active_ksk
| ) |  |

Set the active_ksk of a key data object.

Parameters

  [in] | key_data | a key_data_t pointer.
  [in] | active_ksk | an unsigned integer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 933 of file key_data.c.

References key_data::active_ksk, DB_ERROR_UNKNOWN, and DB_OK.

## key_data_set_active_zsk()

int key_data_set_active_zsk | ( | key_data_t * | key_data,
|  | unsigned int | active_zsk
| ) |  |

Set the active_zsk of a key data object.

Parameters

  [in] | key_data | a key_data_t pointer.
  [in] | active_zsk | an unsigned integer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 913 of file key_data.c.

References key_data::active_zsk, DB_ERROR_UNKNOWN, and DB_OK.

## key_data_set_algorithm()

int key_data_set_algorithm | ( | key_data_t * | key_data,
|  | unsigned int | algorithm
| ) |  |

Set the algorithm of a key data object.

Parameters

  [in] | key_data | a key_data_t pointer.
  [in] | algorithm | an unsigned integer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 870 of file key_data.c.

References key_data::algorithm, DB_ERROR_UNKNOWN, and DB_OK.

## key_data_set_ds_at_parent()

int key_data_set_ds_at_parent | ( | key_data_t * | key_data,
|  | key_data_ds_at_parent_t | ds_at_parent
| ) |  |

Set the ds_at_parent of a key data object.

Parameters

  [in] | key_data | a key_data_t pointer.
  [in] | ds_at_parent | a key_data_ds_at_parent_t.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 943 of file key_data.c.

References DB_ERROR_UNKNOWN, DB_OK, ds_at_parent, key_data::ds_at_parent, and KEY_DATA_DS_AT_PARENT_INVALID.

## key_data_set_hsm_key_id()

int key_data_set_hsm_key_id | ( | key_data_t * | key_data,
|  | const db_value_t * | hsm_key_id
| ) |  |

Set the hsm_key_id of a key data object. If this fails the original value may have been lost.

Parameters

  [in] | key_data | a key_data_t pointer.
  [in] | hsm_key_id | a db_value_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 851 of file key_data.c.

References DB_ERROR_UNKNOWN, DB_OK, db_value_copy(), db_value_not_empty(), db_value_reset(), and key_data::hsm_key_id.

## key_data_set_inception()

int key_data_set_inception | ( | key_data_t * | key_data,
|  | unsigned int | inception
| ) |  |

Set the inception of a key data object.

Parameters

  [in] | key_data | a key_data_t pointer.
  [in] | inception | an unsigned integer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 880 of file key_data.c.

References DB_ERROR_UNKNOWN, DB_OK, and key_data::inception.

## key_data_set_introducing()

int key_data_set_introducing | ( | key_data_t * | key_data,
|  | unsigned int | introducing
| ) |  |

Set the introducing of a key data object.

Parameters

  [in] | key_data | a key_data_t pointer.
  [in] | introducing | an unsigned integer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 903 of file key_data.c.

References DB_ERROR_UNKNOWN, DB_OK, and key_data::introducing.

## key_data_set_keytag()

int key_data_set_keytag | ( | key_data_t * | key_data,
|  | unsigned int | keytag
| ) |  |

Set the keytag of a key data object.

Parameters

  [in] | key_data | a key_data_t pointer.
  [in] | keytag | an unsigned integer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 956 of file key_data.c.

References DB_ERROR_UNKNOWN, DB_OK, and key_data::keytag.

## key_data_set_minimize()

int key_data_set_minimize | ( | key_data_t * | key_data,
|  | unsigned int | minimize
| ) |  |

Set the minimize of a key data object.

Parameters

  [in] | key_data | a key_data_t pointer.
  [in] | minimize | an unsigned integer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 966 of file key_data.c.

References DB_ERROR_UNKNOWN, DB_OK, and key_data::minimize.

## key_data_set_publish()

int key_data_set_publish | ( | key_data_t * | key_data,
|  | unsigned int | publish
| ) |  |

Set the publish of a key data object.

Parameters

  [in] | key_data | a key_data_t pointer.
  [in] | publish | an unsigned integer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 923 of file key_data.c.

References DB_ERROR_UNKNOWN, DB_OK, and key_data::publish.

## key_data_set_role()

int key_data_set_role | ( | key_data_t * | key_data,
|  | key_data_role_t | role
| ) |  |

Set the role of a key data object.

Parameters

  [in] | key_data | a key_data_t pointer.
  [in] | role | a key_data_role_t.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 890 of file key_data.c.

References DB_ERROR_UNKNOWN, DB_OK, KEY_DATA_ROLE_INVALID, and key_data::role.

## key_data_set_zone_id()

int key_data_set_zone_id | ( | key_data_t * | key_data,
|  | const db_value_t * | zone_id
| ) |  |

Set the zone_id of a key data object. If this fails the original value may have been lost.

Parameters

  [in] | key_data | a key_data_t pointer.
  [in] | zone_id | a db_value_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 832 of file key_data.c.

References DB_ERROR_UNKNOWN, DB_OK, db_value_copy(), db_value_not_empty(), db_value_reset(), and key_data::zone_id.

## key_data_update()

int key_data_update | ( | key_data_t * | key_data | ) |

Update a key data object in the database.

Parameters

  [in] | key_data | a key_data_t pointer.

Returns
  DB_ERROR_* on failure, otherwise DB_OK.

Definition at line 1349 of file key_data.c.

## key_data_zone_id()

const db_value_t* key_data_zone_id | ( | const key_data_t * | key_data | ) |

Get the zone_id of a key data object.

Parameters

  [in] | key_data | a key_data_t pointer.

Returns
  a db_value_t pointer or NULL on error.

Definition at line 561 of file key_data.c.

References key_data::zone_id.

## key_data_zone_id_clause()

db_clause_t* key_data_zone_id_clause | ( | db_clause_list_t * | clause_list,
|  | const db_value_t * | zone_id
| ) |  |

Create a clause for zone_id of a key data 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] | zone_id | a db_value_t pointer.

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

Definition at line 976 of file key_data.c.

## Variable Documentation

## key_data_enum_set_ds_at_parent

const db_enum_t key_data_enum_set_ds_at_parent[]

Definition at line 43 of file key_data.c.

## key_data_enum_set_role

const db_enum_t key_data_enum_set_role[]

Definition at line 36 of file key_data.c.