policy_key.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 __policy_key_h
#define __policy_key_h
#include "db_object.h"
struct policy_key;
struct policy_key_list;
typedef struct policy_key policy_key_t;
typedef struct policy_key_list policy_key_list_t;
typedef enum policy_key_role {
POLICY_KEY_ROLE_INVALID = -1,
POLICY_KEY_ROLE_KSK = 1,
POLICY_KEY_ROLE_ZSK = 2,
POLICY_KEY_ROLE_CSK = 3
} policy_key_role_t;
extern const db_enum_t policy_key_enum_set_role[];
#include "policy_key_ext.h"
#include "policy.h"
struct policy_key {
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;
policy_key_role_t role;
unsigned int algorithm;
unsigned int bits;
unsigned int lifetime;
char* repository;
unsigned int standby;
unsigned int manual_rollover;
unsigned int rfc5011;
unsigned int minimize;
};
policy_key_t* policy_key_new(const db_connection_t* connection);
policy_key_t* policy_key_new_copy(const policy_key_t* policy_key);
void policy_key_free(policy_key_t* policy_key);
void policy_key_reset(policy_key_t* policy_key);
int policy_key_copy(policy_key_t* policy_key, const policy_key_t* policy_key_copy);
int policy_key_cmp(const policy_key_t* policy_key_a, const policy_key_t* policy_key_b);
int policy_key_from_result(policy_key_t* policy_key, const db_result_t* result);
const db_value_t* policy_key_policy_id(const policy_key_t* policy_key);
const policy_t* policy_key_policy(const policy_key_t* policy_key);
policy_t* policy_key_get_policy(const policy_key_t* policy_key);
policy_key_role_t policy_key_role(const policy_key_t* policy_key);
const char* policy_key_role_text(const policy_key_t* policy_key);
unsigned int policy_key_algorithm(const policy_key_t* policy_key);
unsigned int policy_key_bits(const policy_key_t* policy_key);
unsigned int policy_key_lifetime(const policy_key_t* policy_key);
const char* policy_key_repository(const policy_key_t* policy_key);
int policy_key_standby(const policy_key_t* policy_key);
unsigned int policy_key_manual_rollover(const policy_key_t* policy_key);
unsigned int policy_key_rfc5011(const policy_key_t* policy_key);
unsigned int policy_key_minimize(const policy_key_t* policy_key);
int policy_key_set_policy_id(policy_key_t* policy_key, const db_value_t* policy_id);
int policy_key_set_role(policy_key_t* policy_key, policy_key_role_t role);
int policy_key_set_algorithm(policy_key_t* policy_key, unsigned int algorithm);
int policy_key_set_bits(policy_key_t* policy_key, unsigned int bits);
int policy_key_set_lifetime(policy_key_t* policy_key, unsigned int lifetime);
int policy_key_set_repository(policy_key_t* policy_key, const char* repository_text);
int policy_key_set_standby(policy_key_t* policy_key, unsigned int standby);
int policy_key_set_manual_rollover(policy_key_t* policy_key, unsigned int manual_rollover);
int policy_key_set_rfc5011(policy_key_t* policy_key, unsigned int rfc5011);
int policy_key_set_minimize(policy_key_t* policy_key, unsigned int minimize);
int policy_key_create(policy_key_t* policy_key);
int policy_key_get_by_id(policy_key_t* policy_key, const db_value_t* id);
int policy_key_delete(policy_key_t* policy_key);
struct policy_key_list {
db_object_t* dbo;
db_result_list_t* result_list;
const db_result_t* result;
policy_key_t* policy_key;
int object_store;
policy_key_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;
};
policy_key_list_t* policy_key_list_new(const db_connection_t* connection);
policy_key_list_t* policy_key_list_new_copy(const policy_key_list_t* policy_key_copy);
int policy_key_list_object_store(policy_key_list_t* policy_key_list);
void policy_key_list_free(policy_key_list_t* policy_key_list);
int policy_key_list_copy(policy_key_list_t* policy_key_list, const policy_key_list_t* from_policy_key_list);
int policy_key_list_get_by_clauses(policy_key_list_t* policy_key_list, const db_clause_list_t* clause_list);
int policy_key_list_get_by_policy_id(policy_key_list_t* policy_key_list, const db_value_t* policy_id);
policy_key_list_t* policy_key_list_new_get_by_policy_id(const db_connection_t* connection, const db_value_t* policy_id);
const policy_key_t* policy_key_list_begin(policy_key_list_t* policy_key_list);
const policy_key_t* policy_key_list_next(policy_key_list_t* policy_key_list);
policy_key_t* policy_key_list_get_next(policy_key_list_t* policy_key_list);
size_t policy_key_list_size(policy_key_list_t* policy_key_list);
policy_key_t * policy_key_new_get_by_policyid_and_role (const db_connection_t* connection, const db_value_t* policyid, const policy_key_role_t role);
int policy_key_get_by_policyid_and_role(policy_key_t* policy_key, const db_value_t* policyid , const policy_key_role_t role);
#endif
policy_key_from_result
int policy_key_from_result(policy_key_t *policy_key, const db_result_t *result)
Definition: policy_key.c:426
policy_key_free
void policy_key_free(policy_key_t *policy_key)
Definition: policy_key.c:246
policy_key_new_copy
policy_key_t * policy_key_new_copy(const policy_key_t *policy_key)
Definition: policy_key.c:227
policy_list
Definition: policy.h:733
policy_key_list::object_list_position
size_t object_list_position
Definition: policy_key.h:330
policy_key_list_free
void policy_key_list_free(policy_key_list_t *policy_key_list)
Definition: policy_key.c:1006
policy_key_get_policy
policy_t * policy_key_get_policy(const policy_key_t *policy_key)
policy_key_create
int policy_key_create(policy_key_t *policy_key)
Definition: policy_key.c:702
policy_key::standby
unsigned int standby
Definition: policy_key.h:66
policy_key_algorithm
unsigned int policy_key_algorithm(const policy_key_t *policy_key)
Definition: policy_key.c:510
policy_key::manual_rollover
unsigned int manual_rollover
Definition: policy_key.h:67
policy_key_delete
int policy_key_delete(policy_key_t *policy_key)
Definition: policy_key.c:913
policy_key::algorithm
unsigned int algorithm
Definition: policy_key.h:62
policy_key_cmp
int policy_key_cmp(const policy_key_t *policy_key_a, const policy_key_t *policy_key_b)
Definition: policy_key.c:359
policy_key::id
db_value_t id
Definition: policy_key.h:56
policy_key::rev
db_value_t rev
Definition: policy_key.h:57
policy_key_new_get_by_policyid_and_role
policy_key_t * policy_key_new_get_by_policyid_and_role(const db_connection_t *connection, const db_value_t *policyid, const policy_key_role_t role)
Definition: policy_key.c:1562
policy_key_policy_id
const db_value_t * policy_key_policy_id(const policy_key_t *policy_key)
Definition: policy_key.c:478
db_object
Definition: db_object.h:201
policy_key_ext.h
policy_key_set_repository
int policy_key_set_repository(policy_key_t *policy_key, const char *repository_text)
Definition: policy_key.c:640
policy_key_list_new_copy
policy_key_list_t * policy_key_list_new_copy(const policy_key_list_t *policy_key_copy)
Definition: policy_key.c:977
policy_key_list_object_store
int policy_key_list_object_store(policy_key_list_t *policy_key_list)
Definition: policy_key.c:996
policy_key_copy
int policy_key_copy(policy_key_t *policy_key, const policy_key_t *policy_key_copy)
Definition: policy_key.c:289
db_clause_list
Definition: db_clause.h:226
policy_key_minimize
unsigned int policy_key_minimize(const policy_key_t *policy_key)
Definition: policy_key.c:566
policy_key_list::associated_fetch
int associated_fetch
Definition: policy_key.h:332
policy_key_set_role
int policy_key_set_role(policy_key_t *policy_key, policy_key_role_t role)
Definition: policy_key.c:593
policy_key_list::object_list
policy_key_t ** object_list
Definition: policy_key.h:328
policy_key_list::policy_key
policy_key_t * policy_key
Definition: policy_key.h:326
policy_key_list_begin
const policy_key_t * policy_key_list_begin(policy_key_list_t *policy_key_list)
Definition: policy_key.c:1322
db_result_list
Definition: db_result.h:114
policy_key::associated_policy_id
const policy_t * associated_policy_id
Definition: policy_key.h:59
db_value
Definition: db_value.h:48
POLICY_KEY_ROLE_CSK
Definition: policy_key.h:44
policy_key_list
Definition: policy_key.h:322
policy_key_policy
const policy_t * policy_key_policy(const policy_key_t *policy_key)
policy_key_set_manual_rollover
int policy_key_set_manual_rollover(policy_key_t *policy_key, unsigned int manual_rollover)
Definition: policy_key.c:672
POLICY_KEY_ROLE_ZSK
Definition: policy_key.h:43
policy_key_list::policy_id_list
policy_list_t * policy_id_list
Definition: policy_key.h:333
policy_key_rfc5011
unsigned int policy_key_rfc5011(const policy_key_t *policy_key)
Definition: policy_key.c:558
policy_key_set_lifetime
int policy_key_set_lifetime(policy_key_t *policy_key, unsigned int lifetime)
Definition: policy_key.c:630
policy_key_set_standby
int policy_key_set_standby(policy_key_t *policy_key, unsigned int standby)
Definition: policy_key.c:662
policy_key_list::object_list_size
size_t object_list_size
Definition: policy_key.h:329
policy_key_set_bits
int policy_key_set_bits(policy_key_t *policy_key, unsigned int bits)
Definition: policy_key.c:620
policy.h
POLICY_KEY_ROLE_KSK
Definition: policy_key.h:42
policy_key::lifetime
unsigned int lifetime
Definition: policy_key.h:64
policy_key_list::object_list_first
int object_list_first
Definition: policy_key.h:331
policy_key
Definition: policy_key.h:54
POLICY_KEY_ROLE_INVALID
Definition: policy_key.h:41
policy_key_repository
const char * policy_key_repository(const policy_key_t *policy_key)
Definition: policy_key.c:534
policy_key_list_size
size_t policy_key_list_size(policy_key_list_t *policy_key_list)
Definition: policy_key.c:1480
policy_key_list::object_store
int object_store
Definition: policy_key.h:327
policy_key_manual_rollover
unsigned int policy_key_manual_rollover(const policy_key_t *policy_key)
Definition: policy_key.c:550
db_result
Definition: db_result.h:56
policy_key::repository
char * repository
Definition: policy_key.h:65
policy_key_list::result
const db_result_t * result
Definition: policy_key.h:325
policy_key_set_minimize
int policy_key_set_minimize(policy_key_t *policy_key, unsigned int minimize)
Definition: policy_key.c:692
policy_key_set_algorithm
int policy_key_set_algorithm(policy_key_t *policy_key, unsigned int algorithm)
Definition: policy_key.c:606
policy_key_enum_set_role
const db_enum_t policy_key_enum_set_role[]
Definition: policy_key.c:36
policy_key_get_by_id
int policy_key_get_by_id(policy_key_t *policy_key, const db_value_t *id)
Definition: policy_key.c:860
policy_key_bits
unsigned int policy_key_bits(const policy_key_t *policy_key)
Definition: policy_key.c:518
policy_key_set_rfc5011
int policy_key_set_rfc5011(policy_key_t *policy_key, unsigned int rfc5011)
Definition: policy_key.c:682
policy_key::minimize
unsigned int minimize
Definition: policy_key.h:69
policy_key_list_get_next
policy_key_t * policy_key_list_get_next(policy_key_list_t *policy_key_list)
Definition: policy_key.c:1444
policy_key_list_get_by_clauses
int policy_key_list_get_by_clauses(policy_key_list_t *policy_key_list, const db_clause_list_t *clause_list)
Definition: policy_key.c:1194
policy_key_new
policy_key_t * policy_key_new(const db_connection_t *connection)
Definition: policy_key.c:209
db_object.h
policy_key_role_text
const char * policy_key_role_text(const policy_key_t *policy_key)
Definition: policy_key.c:494
policy
Definition: policy.h:60
policy_key_reset
void policy_key_reset(policy_key_t *policy_key)
Definition: policy_key.c:264
policy_key::dbo
db_object_t * dbo
Definition: policy_key.h:55
db_connection
Definition: db_connection.h:46
policy_key_list::result_list
db_result_list_t * result_list
Definition: policy_key.h:324
db_enum
Definition: db_enum.h:38
policy_key_set_policy_id
int policy_key_set_policy_id(policy_key_t *policy_key, const db_value_t *policy_id)
Definition: policy_key.c:574
policy_key::private_policy_id
policy_t * private_policy_id
Definition: policy_key.h:60
policy_key_list_get_by_policy_id
int policy_key_list_get_by_policy_id(policy_key_list_t *policy_key_list, const db_value_t *policy_id)
Definition: policy_key.c:1236
policy_key::bits
unsigned int bits
Definition: policy_key.h:63
policy_key_list_new
policy_key_list_t * policy_key_list_new(const db_connection_t *connection)
Definition: policy_key.c:963
policy_key_role
policy_key_role
Definition: policy_key.h:40
policy_key_standby
int policy_key_standby(const policy_key_t *policy_key)
Definition: policy_key.c:542
policy_key_role_t
enum policy_key_role policy_key_role_t
policy_key_get_by_policyid_and_role
int policy_key_get_by_policyid_and_role(policy_key_t *policy_key, const db_value_t *policyid, const policy_key_role_t role)
Definition: policy_key.c:1498
policy_key::rfc5011
unsigned int rfc5011
Definition: policy_key.h:68
policy_key_lifetime
unsigned int policy_key_lifetime(const policy_key_t *policy_key)
Definition: policy_key.c:526
policy_key_list_new_get_by_policy_id
policy_key_list_t * policy_key_list_new_get_by_policy_id(const db_connection_t *connection, const db_value_t *policy_id)
Definition: policy_key.c:1299
policy_key::role
policy_key_role_t role
Definition: policy_key.h:61
policy_key_list::dbo
db_object_t * dbo
Definition: policy_key.h:323
policy_key::policy_id
db_value_t policy_id
Definition: policy_key.h:58
policy_key_list_next
const policy_key_t * policy_key_list_next(policy_key_list_t *policy_key_list)
Definition: policy_key.c:1378
policy_key_list_copy
int policy_key_list_copy(policy_key_list_t *policy_key_list, const policy_key_list_t *from_policy_key_list)
Definition: policy_key.c:1034