key_data.h
Go to the documentation of this file.
/*
* Copyright (c) 2014 Jerry Lundström <lundstrom.jerry@gmail.com>
* Copyright (c) 2014 .SE (The Internet Infrastructure Foundation).
* Copyright (c) 2014 OpenDNSSEC AB (svb)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef __key_data_h
#define __key_data_h
#include "db_object.h"
struct key_data;
struct key_data_list;
typedef struct key_data key_data_t;
typedef struct key_data_list key_data_list_t;
typedef enum key_data_role {
KEY_DATA_ROLE_INVALID = -1,
KEY_DATA_ROLE_KSK = 1,
KEY_DATA_ROLE_ZSK = 2,
KEY_DATA_ROLE_CSK = 3
} key_data_role_t;
extern const db_enum_t key_data_enum_set_role[];
#define KEY_DATA_ROLE_SEP(role) ((role) == KEY_DATA_ROLE_KSK || (role) == KEY_DATA_ROLE_CSK)
typedef 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
} key_data_ds_at_parent_t;
extern const db_enum_t key_data_enum_set_ds_at_parent[];
#include "key_data_ext.h"
#include "zone_db.h"
#include "hsm_key.h"
struct key_data {
db_object_t* dbo;
db_value_t id;
db_value_t rev;
db_value_t zone_id;
const zone_db_t* associated_zone_id;
zone_db_t* private_zone_id;
db_value_t hsm_key_id;
const hsm_key_t* associated_hsm_key_id;
hsm_key_t* private_hsm_key_id;
unsigned int algorithm;
unsigned int inception;
key_data_role_t role;
unsigned int introducing;
unsigned int should_revoke;
unsigned int standby;
unsigned int active_zsk;
unsigned int publish;
unsigned int active_ksk;
key_data_ds_at_parent_t ds_at_parent;
unsigned int keytag;
unsigned int minimize;
key_state_list_t* key_state_list;
};
extern key_data_t* key_data_new(const db_connection_t* connection);
extern key_data_t* key_data_new_copy(const key_data_t* key_data);
extern void key_data_free(key_data_t* key_data);
extern int key_data_copy(key_data_t* key_data, const key_data_t* key_data_copy);
extern int key_data_cmp(const key_data_t* key_data_a, const key_data_t* key_data_b);
extern int key_data_from_result(key_data_t* key_data, const db_result_t* result);
extern const db_value_t* key_data_id(const key_data_t* key_data);
extern const db_value_t* key_data_zone_id(const key_data_t* key_data);
extern zone_db_t* key_data_get_zone(const key_data_t* key_data);
extern const db_value_t* key_data_hsm_key_id(const key_data_t* key_data);
extern int key_data_cache_hsm_key(key_data_t* key_data);
extern const hsm_key_t* key_data_hsm_key(const key_data_t* key_data);
extern hsm_key_t* key_data_get_hsm_key(const key_data_t* key_data);
extern unsigned int key_data_algorithm(const key_data_t* key_data);
extern unsigned int key_data_inception(const key_data_t* key_data);
extern key_data_role_t key_data_role(const key_data_t* key_data);
extern const char* key_data_role_text(const key_data_t* key_data);
extern unsigned int key_data_introducing(const key_data_t* key_data);
extern unsigned int key_data_active_zsk(const key_data_t* key_data);
extern unsigned int key_data_publish(const key_data_t* key_data);
extern unsigned int key_data_active_ksk(const key_data_t* key_data);
extern key_data_ds_at_parent_t key_data_ds_at_parent(const key_data_t* key_data);
extern unsigned int key_data_keytag(const key_data_t* key_data);
extern unsigned int key_data_minimize(const key_data_t* key_data);
extern key_state_list_t* key_data_key_state_list(key_data_t* key_data);
extern int key_data_retrieve_key_state_list(key_data_t* key_data);
extern int key_data_set_zone_id(key_data_t* key_data, const db_value_t* zone_id);
extern int key_data_set_hsm_key_id(key_data_t* key_data, const db_value_t* hsm_key_id);
extern int key_data_set_algorithm(key_data_t* key_data, unsigned int algorithm);
extern int key_data_set_inception(key_data_t* key_data, unsigned int inception);
extern int key_data_set_role(key_data_t* key_data, key_data_role_t role);
extern int key_data_set_introducing(key_data_t* key_data, unsigned int introducing);
extern int key_data_set_active_zsk(key_data_t* key_data, unsigned int active_zsk);
extern int key_data_set_publish(key_data_t* key_data, unsigned int publish);
extern int key_data_set_active_ksk(key_data_t* key_data, unsigned int active_ksk);
extern int key_data_set_ds_at_parent(key_data_t* key_data, key_data_ds_at_parent_t ds_at_parent);
extern int key_data_set_keytag(key_data_t* key_data, unsigned int keytag);
extern int key_data_set_minimize(key_data_t* key_data, unsigned int minimize);
extern db_clause_t* key_data_zone_id_clause(db_clause_list_t* clause_list, const db_value_t* zone_id);
extern db_clause_t* key_data_hsm_key_id_clause(db_clause_list_t* clause_list, const db_value_t* hsm_key_id);
extern db_clause_t* key_data_role_clause(db_clause_list_t* clause_list, key_data_role_t role);
extern db_clause_t* key_data_ds_at_parent_clause(db_clause_list_t* clause_list, key_data_ds_at_parent_t ds_at_parent);
extern db_clause_t* key_data_keytag_clause(db_clause_list_t* clause_list, unsigned int keytag);
extern int key_data_create(key_data_t* key_data);
extern int key_data_get_by_id(key_data_t* key_data, const db_value_t* id);
extern int key_data_update(key_data_t* key_data);
extern int key_data_delete(key_data_t* key_data);
extern int key_data_count(key_data_t* key_data, db_clause_list_t* clause_list, size_t* count);
struct key_data_list {
db_object_t* dbo;
db_result_list_t* result_list;
const db_result_t* result;
key_data_t* key_data;
int object_store;
key_data_t** object_list;
size_t object_list_size;
size_t object_list_position;
int object_list_first;
int associated_fetch;
zone_list_db_t* zone_id_list;
hsm_key_list_t* hsm_key_id_list;
};
extern key_data_list_t* key_data_list_new(const db_connection_t* connection);
extern key_data_list_t* key_data_list_new_copy(const key_data_list_t* key_data_copy);
extern int key_data_list_object_store(key_data_list_t* key_data_list);
extern void key_data_list_free(key_data_list_t* key_data_list);
extern int key_data_list_copy(key_data_list_t* key_data_list, const key_data_list_t* from_key_data_list);
extern int key_data_list_get(key_data_list_t* key_data_list);
extern key_data_list_t* key_data_list_new_get(const db_connection_t* connection);
extern int key_data_list_get_by_clauses(key_data_list_t* key_data_list, const db_clause_list_t* clause_list);
extern key_data_list_t* key_data_list_new_get_by_clauses(const db_connection_t* connection, const db_clause_list_t* clause_list);
extern int key_data_list_get_by_zone_id(key_data_list_t* key_data_list, const db_value_t* zone_id);
extern key_data_list_t* key_data_list_new_get_by_zone_id(const db_connection_t* connection, const db_value_t* zone_id);
extern const key_data_t* key_data_list_begin(key_data_list_t* key_data_list);
extern key_data_t* key_data_list_get_begin(key_data_list_t* key_data_list);
extern const key_data_t* key_data_list_next(key_data_list_t* key_data_list);
extern key_data_t* key_data_list_get_next(key_data_list_t* key_data_list);
extern size_t key_data_list_size(key_data_list_t* key_data_list);
extern key_data_t* key_data_new_get_by_hsm_key_id (const db_connection_t* connection, const db_value_t* hsm_key_id);
extern int key_data_get_by_hsm_key_id (key_data_t* key_data, const db_value_t* hsm_key_id);
#endif
db_object.h
hsm_key_id
const db_value_t * hsm_key_id(const hsm_key_t *hsm_key)
Definition hsm_key.c:504
hsm_key.h
key_data_set_minimize
int key_data_set_minimize(key_data_t *key_data, unsigned int minimize)
Definition key_data.c:966
key_data_cmp
int key_data_cmp(const key_data_t *key_data_a, const key_data_t *key_data_b)
Definition key_data.c:402
key_data_get_zone
zone_db_t * key_data_get_zone(const key_data_t *key_data)
Definition key_data.c:569
key_data_keytag_clause
db_clause_t * key_data_keytag_clause(db_clause_list_t *clause_list, unsigned int keytag)
Definition key_data.c:1072
key_data_active_ksk
unsigned int key_data_active_ksk(const key_data_t *key_data)
Definition key_data.c:751
key_data_id
const db_value_t * key_data_id(const key_data_t *key_data)
Definition key_data.c:553
key_data_enum_set_ds_at_parent
const db_enum_t key_data_enum_set_ds_at_parent[]
Definition key_data.c:43
key_data_list_size
size_t key_data_list_size(key_data_list_t *key_data_list)
Definition key_data.c:2461
key_data_get_by_id
int key_data_get_by_id(key_data_t *key_data, const db_value_t *id)
Definition key_data.c:1296
key_data_update
int key_data_update(key_data_t *key_data)
Definition key_data.c:1349
key_data_delete
int key_data_delete(key_data_t *key_data)
Definition key_data.c:1587
key_data_free
void key_data_free(key_data_t *key_data)
Definition key_data.c:304
key_data_hsm_key
const hsm_key_t * key_data_hsm_key(const key_data_t *key_data)
Definition key_data.c:638
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)
Definition key_data.c:1003
key_data_set_role
int key_data_set_role(key_data_t *key_data, key_data_role_t role)
Definition key_data.c:890
key_data_list_new_get
key_data_list_t * key_data_list_new_get(const db_connection_t *connection)
Definition key_data.c:2102
key_data_get_hsm_key
hsm_key_t * key_data_get_hsm_key(const key_data_t *key_data)
Definition key_data.c:649
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)
Definition key_data.c:2161
key_data_set_introducing
int key_data_set_introducing(key_data_t *key_data, unsigned int introducing)
Definition key_data.c:903
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)
Definition key_data.c:2119
key_data_keytag
unsigned int key_data_keytag(const key_data_t *key_data)
Definition key_data.c:767
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 key_data.c:2479
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 key_data.c:2530
key_data_set_active_zsk
int key_data_set_active_zsk(key_data_t *key_data, unsigned int active_zsk)
Definition key_data.c:913
key_data_set_publish
int key_data_set_publish(key_data_t *key_data, unsigned int publish)
Definition key_data.c:923
key_data_set_zone_id
int key_data_set_zone_id(key_data_t *key_data, const db_value_t *zone_id)
Definition key_data.c:832
key_data_role_text
const char * key_data_role_text(const key_data_t *key_data)
Definition key_data.c:711
key_data_copy
int key_data_copy(key_data_t *key_data, const key_data_t *key_data_copy)
Definition key_data.c:326
key_data_publish
unsigned int key_data_publish(const key_data_t *key_data)
Definition key_data.c:743
key_data_set_algorithm
int key_data_set_algorithm(key_data_t *key_data, unsigned int algorithm)
Definition key_data.c:870
key_data_list_free
void key_data_list_free(key_data_list_t *key_data_list)
Definition key_data.c:1694
key_data_set_inception
int key_data_set_inception(key_data_t *key_data, unsigned int inception)
Definition key_data.c:880
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)
Definition key_data.c:2244
key_data_introducing
unsigned int key_data_introducing(const key_data_t *key_data)
Definition key_data.c:727
key_data_role
key_data_role
Definition key_data.h:40
KEY_DATA_ROLE_ZSK
@ KEY_DATA_ROLE_ZSK
Definition key_data.h:43
KEY_DATA_ROLE_INVALID
@ KEY_DATA_ROLE_INVALID
Definition key_data.h:41
KEY_DATA_ROLE_KSK
@ KEY_DATA_ROLE_KSK
Definition key_data.h:42
KEY_DATA_ROLE_CSK
@ KEY_DATA_ROLE_CSK
Definition key_data.h:44
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)
Definition key_data.c:851
key_data_list_begin
const key_data_t * key_data_list_begin(key_data_list_t *key_data_list)
Definition key_data.c:2267
key_data_inception
unsigned int key_data_inception(const key_data_t *key_data)
Definition key_data.c:695
key_data_active_zsk
unsigned int key_data_active_zsk(const key_data_t *key_data)
Definition key_data.c:735
key_data_list_get_next
key_data_t * key_data_list_get_next(key_data_list_t *key_data_list)
Definition key_data.c:2425
key_data_list_object_store
int key_data_list_object_store(key_data_list_t *key_data_list)
Definition key_data.c:1684
key_data_cache_hsm_key
int key_data_cache_hsm_key(key_data_t *key_data)
Definition key_data.c:615
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)
Definition key_data.c:1051
key_data_hsm_key_id
const db_value_t * key_data_hsm_key_id(const key_data_t *key_data)
Definition key_data.c:607
key_data_set_keytag
int key_data_set_keytag(key_data_t *key_data, unsigned int keytag)
Definition key_data.c:956
key_data_create
int key_data_create(key_data_t *key_data)
Definition key_data.c:1093
key_data_list_get
int key_data_list_get(key_data_list_t *key_data_list)
Definition key_data.c:2063
key_data_enum_set_role
const db_enum_t key_data_enum_set_role[]
Definition key_data.c:36
key_data_list_new_copy
key_data_list_t * key_data_list_new_copy(const key_data_list_t *key_data_copy)
Definition key_data.c:1665
key_data_list_new
key_data_list_t * key_data_list_new(const db_connection_t *connection)
Definition key_data.c:1651
key_data_role_clause
db_clause_t * key_data_role_clause(db_clause_list_t *clause_list, key_data_role_t role)
Definition key_data.c:1030
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)
Definition key_data.c:943
key_data_retrieve_key_state_list
int key_data_retrieve_key_state_list(key_data_t *key_data)
Definition key_data.c:801
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)
Definition key_data.c:2181
key_data_new
key_data_t * key_data_new(const db_connection_t *connection)
Definition key_data.c:264
key_data_key_state_list
key_state_list_t * key_data_key_state_list(key_data_t *key_data)
Definition key_data.c:783
key_data_count
int key_data_count(key_data_t *key_data, db_clause_list_t *clause_list, size_t *count)
Definition key_data.c:1633
key_data_role_t
enum key_data_role key_data_role_t
key_data_ds_at_parent_t
enum key_data_ds_at_parent key_data_ds_at_parent_t
key_data_list_next
const key_data_t * key_data_list_next(key_data_list_t *key_data_list)
Definition key_data.c:2359
key_data_from_result
int key_data_from_result(key_data_t *key_data, const db_result_t *result)
Definition key_data.c:477
key_data_algorithm
unsigned int key_data_algorithm(const key_data_t *key_data)
Definition key_data.c:687
key_data_minimize
unsigned int key_data_minimize(const key_data_t *key_data)
Definition key_data.c:775
key_data_ds_at_parent
key_data_ds_at_parent
Definition key_data.h:50
KEY_DATA_DS_AT_PARENT_SUBMITTED
@ KEY_DATA_DS_AT_PARENT_SUBMITTED
Definition key_data.h:54
KEY_DATA_DS_AT_PARENT_RETRACT
@ KEY_DATA_DS_AT_PARENT_RETRACT
Definition key_data.h:56
KEY_DATA_DS_AT_PARENT_UNSUBMITTED
@ KEY_DATA_DS_AT_PARENT_UNSUBMITTED
Definition key_data.h:52
KEY_DATA_DS_AT_PARENT_SEEN
@ KEY_DATA_DS_AT_PARENT_SEEN
Definition key_data.h:55
KEY_DATA_DS_AT_PARENT_INVALID
@ KEY_DATA_DS_AT_PARENT_INVALID
Definition key_data.h:51
KEY_DATA_DS_AT_PARENT_SUBMIT
@ KEY_DATA_DS_AT_PARENT_SUBMIT
Definition key_data.h:53
KEY_DATA_DS_AT_PARENT_RETRACTED
@ KEY_DATA_DS_AT_PARENT_RETRACTED
Definition key_data.h:57
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)
Definition key_data.c:976
key_data_list_get_begin
key_data_t * key_data_list_get_begin(key_data_list_t *key_data_list)
Definition key_data.c:2323
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)
Definition key_data.c:1725
key_data_set_active_ksk
int key_data_set_active_ksk(key_data_t *key_data, unsigned int active_ksk)
Definition key_data.c:933
key_data_zone_id
const db_value_t * key_data_zone_id(const key_data_t *key_data)
Definition key_data.c:561
key_data_new_copy
key_data_t * key_data_new_copy(const key_data_t *key_data)
Definition key_data.c:285
key_data_ext.h
ds_at_parent
const int ds_at_parent[5]
Definition keystate_import_cmd.c:55
db_clause_list
Definition db_clause.h:226
db_clause
Definition db_clause.h:118
db_connection
Definition db_connection.h:46
db_enum
Definition db_enum.h:38
db_object
Definition db_object.h:201
db_result_list
Definition db_result.h:114
db_result
Definition db_result.h:56
db_value
Definition db_value.h:48
hsm_key_list
Definition hsm_key.h:436
hsm_key
Definition hsm_key.h:79
key_data_list
Definition key_data.h:479
key_data_list::result
const db_result_t * result
Definition key_data.h:482
key_data_list::zone_id_list
zone_list_db_t * zone_id_list
Definition key_data.h:490
key_data_list::associated_fetch
int associated_fetch
Definition key_data.h:489
key_data_list::object_list_position
size_t object_list_position
Definition key_data.h:487
key_data_list::result_list
db_result_list_t * result_list
Definition key_data.h:481
key_data_list::object_list_size
size_t object_list_size
Definition key_data.h:486
key_data_list::object_list_first
int object_list_first
Definition key_data.h:488
key_data_list::hsm_key_id_list
hsm_key_list_t * hsm_key_id_list
Definition key_data.h:491
key_data_list::object_list
key_data_t ** object_list
Definition key_data.h:485
key_data_list::key_data
key_data_t * key_data
Definition key_data.h:483
key_data_list::dbo
db_object_t * dbo
Definition key_data.h:480
key_data_list::object_store
int object_store
Definition key_data.h:484
key_data
Definition key_data.h:68
key_data::private_zone_id
zone_db_t * private_zone_id
Definition key_data.h:74
key_data::associated_zone_id
const zone_db_t * associated_zone_id
Definition key_data.h:73
key_data::algorithm
unsigned int algorithm
Definition key_data.h:78
key_data::key_state_list
key_state_list_t * key_state_list
Definition key_data.h:90
key_data::private_hsm_key_id
hsm_key_t * private_hsm_key_id
Definition key_data.h:77
key_data::associated_hsm_key_id
const hsm_key_t * associated_hsm_key_id
Definition key_data.h:76
key_data::id
db_value_t id
Definition key_data.h:70
key_data::should_revoke
unsigned int should_revoke
Definition key_data.h:82
key_data::active_ksk
unsigned int active_ksk
Definition key_data.h:86
key_data::publish
unsigned int publish
Definition key_data.h:85
key_data::minimize
unsigned int minimize
Definition key_data.h:89
key_data::keytag
unsigned int keytag
Definition key_data.h:88
key_data::active_zsk
unsigned int active_zsk
Definition key_data.h:84
key_data::rev
db_value_t rev
Definition key_data.h:71
key_data::dbo
db_object_t * dbo
Definition key_data.h:69
key_data::standby
unsigned int standby
Definition key_data.h:83
key_data::ds_at_parent
key_data_ds_at_parent_t ds_at_parent
Definition key_data.h:87
key_data::hsm_key_id
db_value_t hsm_key_id
Definition key_data.h:75
key_data::inception
unsigned int inception
Definition key_data.h:79
key_data::role
key_data_role_t role
Definition key_data.h:80
key_data::introducing
unsigned int introducing
Definition key_data.h:81
key_data::zone_id
db_value_t zone_id
Definition key_data.h:72
key_state_list
Definition key_state.h:262
zone_db
Definition zone_db.h:46
zone_list_db
Definition zone_db.h:466
zone_db.h