zone_db.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 __zone_db_h
#define __zone_db_h
#include "db_object.h"
struct zone_db;
struct zone_list_db;
typedef struct zone_db zone_db_t;
typedef struct zone_list_db zone_list_db_t;
#include "zone_db_ext.h"
#include "policy.h"
struct zone_db {
db_object_t* dbo;
db_value_t id;
db_value_t rev;
db_value_t policy_id;
const policy_t* associated_policy_id;
policy_t* private_policy_id;
char* name;
unsigned int signconf_needs_writing;
char* signconf_path;
int next_change;
unsigned int ttl_end_ds;
unsigned int ttl_end_dk;
unsigned int ttl_end_rs;
unsigned int roll_ksk_now;
unsigned int roll_zsk_now;
unsigned int roll_csk_now;
char* input_adapter_type;
char* input_adapter_uri;
char* output_adapter_type;
char* output_adapter_uri;
unsigned int next_ksk_roll;
unsigned int next_zsk_roll;
unsigned int next_csk_roll;
key_data_list_t* key_data_list;
key_dependency_list_t* key_dependency_list;
};
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);
struct zone_list_db {
db_object_t* dbo;
db_result_list_t* result_list;
const db_result_t* result;
zone_db_t* zone;
int object_store;
zone_db_t** object_list;
size_t object_list_size;
size_t object_list_position;
int object_list_first;
int associated_fetch;
policy_list_t* policy_id_list;
};
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* zone_copy);
int zone_list_db_object_store(zone_list_db_t* zone_list_db);
void zone_list_db_free(zone_list_db_t* zone_list_db);
int zone_list_db_copy(zone_list_db_t* zone_list_db, const zone_list_db_t* from_zone_list_db);
int zone_list_db_get(zone_list_db_t* zone_list_db);
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_db, const db_clause_list_t* clause_list);
int zone_list_db_get_by_policy_id(zone_list_db_t* zone_list_db, 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_db);
const zone_db_t* zone_list_db_next(zone_list_db_t* zone_list_db);
zone_db_t* zone_list_db_get_next(zone_list_db_t* zone_list_db);
size_t zone_list_db_size(zone_list_db_t* zone_list_db);
#endif
zone_db_set_ttl_end_ds
int zone_db_set_ttl_end_ds(zone_db_t *zone, unsigned int ttl_end_ds)
Definition: zone_db.c:1001
policy_list
Definition: policy.h:733
key_data_list
Definition: key_data.h:477
zone_db_set_ttl_end_dk
int zone_db_set_ttl_end_dk(zone_db_t *zone, unsigned int ttl_end_dk)
Definition: zone_db.c:1011
zone_list_db::zone
zone_db_t * zone
Definition: zone_db.h:470
zone_db_output_adapter_uri
const char * zone_db_output_adapter_uri(const zone_db_t *zone)
Definition: zone_db.c:886
zone_db::signconf_path
char * signconf_path
Definition: zone_db.h:55
zone_db::id
db_value_t id
Definition: zone_db.h:48
zone_list_db::object_list_position
size_t object_list_position
Definition: zone_db.h:474
zone_db_set_ttl_end_rs
int zone_db_set_ttl_end_rs(zone_db_t *zone, unsigned int ttl_end_rs)
Definition: zone_db.c:1021
zone_db::ttl_end_ds
unsigned int ttl_end_ds
Definition: zone_db.h:57
db_object
Definition: db_object.h:201
zone_db::name
char * name
Definition: zone_db.h:53
zone_db::next_change
int next_change
Definition: zone_db.h:56
zone_db_set_roll_ksk_now
int zone_db_set_roll_ksk_now(zone_db_t *zone, unsigned int roll_ksk_now)
Definition: zone_db.c:1031
zone_list_db_size
size_t zone_list_db_size(zone_list_db_t *zone_list_db)
Definition: zone_db.c:2705
zone_db_set_signconf_needs_writing
int zone_db_set_signconf_needs_writing(zone_db_t *zone, unsigned int signconf_needs_writing)
Definition: zone_db.c:959
zone_list_db_free
void zone_list_db_free(zone_list_db_t *zone_list_db)
Definition: zone_db.c:1989
zone_db_new
zone_db_t * zone_db_new(const db_connection_t *connection)
Definition: zone_db.c:287
zone_list_db::object_store
int object_store
Definition: zone_db.h:471
db_clause_list
Definition: db_clause.h:226
zone_list_db::object_list
zone_db_t ** object_list
Definition: zone_db.h:472
zone_db_set_input_adapter_uri
int zone_db_set_input_adapter_uri(zone_db_t *zone, const char *input_adapter_uri_text)
Definition: zone_db.c:1083
zone_db::dbo
db_object_t * dbo
Definition: zone_db.h:47
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)
Definition: zone_db.c:2017
zone_db_free
void zone_db_free(zone_db_t *zone)
Definition: zone_db.c:325
zone_list_db_get
int zone_list_db_get(zone_list_db_t *zone_list_db)
Definition: zone_db.c:2363
zone_db::ttl_end_rs
unsigned int ttl_end_rs
Definition: zone_db.h:59
zone_db::rev
db_value_t rev
Definition: zone_db.h:49
zone_list_db::dbo
db_object_t * dbo
Definition: zone_db.h:467
db_result_list
Definition: db_result.h:114
db_value
Definition: db_value.h:48
zone_list_db::policy_id_list
policy_list_t * policy_id_list
Definition: zone_db.h:477
zone_db::private_policy_id
policy_t * private_policy_id
Definition: zone_db.h:52
zone_db::next_ksk_roll
unsigned int next_ksk_roll
Definition: zone_db.h:67
zone_db_signconf_path
const char * zone_db_signconf_path(const zone_db_t *zone)
Definition: zone_db.c:798
zone_db_set_next_csk_roll
int zone_db_set_next_csk_roll(zone_db_t *zone, unsigned int next_csk_roll)
Definition: zone_db.c:1169
zone_list_db::result_list
db_result_list_t * result_list
Definition: zone_db.h:468
db_clause
Definition: db_clause.h:118
zone_db::associated_policy_id
const policy_t * associated_policy_id
Definition: zone_db.h:51
zone_db::next_zsk_roll
unsigned int next_zsk_roll
Definition: zone_db.h:68
zone_db_name
const char * zone_db_name(const zone_db_t *zone)
Definition: zone_db.c:782
zone_db::ttl_end_dk
unsigned int ttl_end_dk
Definition: zone_db.h:58
zone_db_copy
int zone_db_copy(zone_db_t *zone, const zone_db_t *zone_copy)
Definition: zone_db.c:365
zone_db_delete
int zone_db_delete(zone_db_t *zone)
Definition: zone_db.c:1884
zone_list_db_new_copy
zone_list_db_t * zone_list_db_new_copy(const zone_list_db_t *zone_copy)
Definition: zone_db.c:1960
zone_db_output_adapter_type
const char * zone_db_output_adapter_type(const zone_db_t *zone)
Definition: zone_db.c:878
zone_db_ttl_end_dk
unsigned int zone_db_ttl_end_dk(const zone_db_t *zone)
Definition: zone_db.c:822
zone_list_db_object_store
int zone_list_db_object_store(zone_list_db_t *zone_list_db)
Definition: zone_db.c:1979
zone_db
Definition: zone_db.h:46
zone_db::roll_ksk_now
unsigned int roll_ksk_now
Definition: zone_db.h:60
zone_db_get_by_name
int zone_db_get_by_name(zone_db_t *zone, const char *name)
Definition: zone_db.c:1519
policy.h
zone_db::key_data_list
key_data_list_t * key_data_list
Definition: zone_db.h:70
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)
Definition: zone_db.c:2461
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)
Definition: zone_db.c:2524
zone_db_ext.h
zone_db_set_next_ksk_roll
int zone_db_set_next_ksk_roll(zone_db_t *zone, unsigned int next_ksk_roll)
Definition: zone_db.c:1149
zone_db_from_result
int zone_db_from_result(zone_db_t *zone, const db_result_t *result)
Definition: zone_db.c:662
zone_db::next_csk_roll
unsigned int next_csk_roll
Definition: zone_db.h:69
zone_db_next_zsk_roll
unsigned int zone_db_next_zsk_roll(const zone_db_t *zone)
Definition: zone_db.c:902
zone_db::policy_id
db_value_t policy_id
Definition: zone_db.h:50
zone_db::output_adapter_type
char * output_adapter_type
Definition: zone_db.h:65
zone_db::roll_csk_now
unsigned int roll_csk_now
Definition: zone_db.h:62
zone_db_create
int zone_db_create(zone_db_t *zone)
Definition: zone_db.c:1206
zone_db_set_signconf_path
int zone_db_set_signconf_path(zone_db_t *zone, const char *signconf_path_text)
Definition: zone_db.c:969
zone_db_next_ksk_roll
unsigned int zone_db_next_ksk_roll(const zone_db_t *zone)
Definition: zone_db.c:894
zone_list_db
Definition: zone_db.h:466
zone_list_db_get_next
zone_db_t * zone_list_db_get_next(zone_list_db_t *zone_list_db)
Definition: zone_db.c:2669
zone_db_next_change
int zone_db_next_change(const zone_db_t *zone)
Definition: zone_db.c:806
zone_db_policy_id
const db_value_t * zone_db_policy_id(const zone_db_t *zone)
Definition: zone_db.c:736
zone_db_set_output_adapter_uri
int zone_db_set_output_adapter_uri(zone_db_t *zone, const char *output_adapter_uri_text)
Definition: zone_db.c:1127
zone_db_set_name
int zone_db_set_name(zone_db_t *zone, const char *name_text)
Definition: zone_db.c:937
db_result
Definition: db_result.h:56
zone_list_db::object_list_first
int object_list_first
Definition: zone_db.h:475
zone_db_next_csk_roll
unsigned int zone_db_next_csk_roll(const zone_db_t *zone)
Definition: zone_db.c:910
zone_db_set_roll_csk_now
int zone_db_set_roll_csk_now(zone_db_t *zone, unsigned int roll_csk_now)
Definition: zone_db.c:1051
zone_db_roll_csk_now
unsigned int zone_db_roll_csk_now(const zone_db_t *zone)
Definition: zone_db.c:854
zone_list_db_begin
const zone_db_t * zone_list_db_begin(zone_list_db_t *zone_list_db)
Definition: zone_db.c:2547
zone_list_db::object_list_size
size_t object_list_size
Definition: zone_db.h:473
zone_db::input_adapter_type
char * input_adapter_type
Definition: zone_db.h:63
zone_db_set_policy_id
int zone_db_set_policy_id(zone_db_t *zone, const db_value_t *policy_id)
Definition: zone_db.c:918
zone_db::key_dependency_list
key_dependency_list_t * key_dependency_list
Definition: zone_db.h:71
zone_db_get_by_id
int zone_db_get_by_id(zone_db_t *zone, const db_value_t *id)
Definition: zone_db.c:1466
zone_db::input_adapter_uri
char * input_adapter_uri
Definition: zone_db.h:64
zone_db_input_adapter_uri
const char * zone_db_input_adapter_uri(const zone_db_t *zone)
Definition: zone_db.c:870
zone_db_set_next_zsk_roll
int zone_db_set_next_zsk_roll(zone_db_t *zone, unsigned int next_zsk_roll)
Definition: zone_db.c:1159
zone_db_signconf_needs_writing
unsigned int zone_db_signconf_needs_writing(const zone_db_t *zone)
Definition: zone_db.c:790
key_dependency_list
Definition: key_dependency.h:201
zone_db::roll_zsk_now
unsigned int roll_zsk_now
Definition: zone_db.h:61
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)
Definition: zone_db.c:2419
zone_db_ttl_end_rs
unsigned int zone_db_ttl_end_rs(const zone_db_t *zone)
Definition: zone_db.c:830
db_object.h
zone_list_db_new
zone_list_db_t * zone_list_db_new(const db_connection_t *connection)
Definition: zone_db.c:1946
zone_db_set_output_adapter_type
int zone_db_set_output_adapter_type(zone_db_t *zone, const char *output_adapter_type_text)
Definition: zone_db.c:1105
policy
Definition: policy.h:60
db_connection
Definition: db_connection.h:46
zone_list_db::result
const db_result_t * result
Definition: zone_db.h:469
zone_db_id
const db_value_t * zone_db_id(const zone_db_t *zone)
Definition: zone_db.c:728
zone_db_set_roll_zsk_now
int zone_db_set_roll_zsk_now(zone_db_t *zone, unsigned int roll_zsk_now)
Definition: zone_db.c:1041
zone_db_roll_ksk_now
unsigned int zone_db_roll_ksk_now(const zone_db_t *zone)
Definition: zone_db.c:838
zone_db_get_policy
policy_t * zone_db_get_policy(const zone_db_t *zone)
Definition: zone_db.c:744
zone_list_db_next
const zone_db_t * zone_list_db_next(zone_list_db_t *zone_list_db)
Definition: zone_db.c:2603
zone_db_ttl_end_ds
unsigned int zone_db_ttl_end_ds(const zone_db_t *zone)
Definition: zone_db.c:814
zone_db::signconf_needs_writing
unsigned int signconf_needs_writing
Definition: zone_db.h:54
zone_list_db_new_get
zone_list_db_t * zone_list_db_new_get(const db_connection_t *connection)
Definition: zone_db.c:2402
zone_db_new_copy
zone_db_t * zone_db_new_copy(const zone_db_t *zone)
Definition: zone_db.c:306
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)
Definition: zone_db.c:1179
zone_db_set_input_adapter_type
int zone_db_set_input_adapter_type(zone_db_t *zone, const char *input_adapter_type_text)
Definition: zone_db.c:1061
zone_db_set_next_change
int zone_db_set_next_change(zone_db_t *zone, int next_change)
Definition: zone_db.c:991
zone_db_roll_zsk_now
unsigned int zone_db_roll_zsk_now(const zone_db_t *zone)
Definition: zone_db.c:846
zone_db_count
int zone_db_count(zone_db_t *zone, db_clause_list_t *clause_list, size_t *count)
Definition: zone_db.c:1930
zone_db::output_adapter_uri
char * output_adapter_uri
Definition: zone_db.h:66
zone_db_update
int zone_db_update(zone_db_t *zone)
Definition: zone_db.c:1589
zone_list_db::associated_fetch
int associated_fetch
Definition: zone_db.h:476
zone_db_input_adapter_type
const char * zone_db_input_adapter_type(const zone_db_t *zone)
Definition: zone_db.c:862
zone_db_new_get_by_name
zone_db_t * zone_db_new_get_by_name(const db_connection_t *connection, const char *name)
Definition: zone_db.c:1569