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;
};
extern policy_key_t* policy_key_new(const db_connection_t* connection);
extern policy_key_t* policy_key_new_copy(const policy_key_t* policy_key);
extern void policy_key_free(policy_key_t* policy_key);
extern void policy_key_reset(policy_key_t* policy_key);
extern int policy_key_copy(policy_key_t* policy_key, const policy_key_t* policy_key_copy);
extern int policy_key_cmp(const policy_key_t* policy_key_a, const policy_key_t* policy_key_b);
extern int policy_key_from_result(policy_key_t* policy_key, const db_result_t* result);
extern const db_value_t* policy_key_policy_id(const policy_key_t* policy_key);
extern const policy_t* policy_key_policy(const policy_key_t* policy_key);
extern policy_t* policy_key_get_policy(const policy_key_t* policy_key);
extern policy_key_role_t policy_key_role(const policy_key_t* policy_key);
extern const char* policy_key_role_text(const policy_key_t* policy_key);
extern unsigned int policy_key_algorithm(const policy_key_t* policy_key);
extern unsigned int policy_key_bits(const policy_key_t* policy_key);
extern unsigned int policy_key_lifetime(const policy_key_t* policy_key);
extern const char* policy_key_repository(const policy_key_t* policy_key);
extern int policy_key_standby(const policy_key_t* policy_key);
extern unsigned int policy_key_manual_rollover(const policy_key_t* policy_key);
extern unsigned int policy_key_rfc5011(const policy_key_t* policy_key);
extern unsigned int policy_key_minimize(const policy_key_t* policy_key);
extern int policy_key_set_policy_id(policy_key_t* policy_key, const db_value_t* policy_id);
extern int policy_key_set_role(policy_key_t* policy_key, policy_key_role_t role);
extern int policy_key_set_algorithm(policy_key_t* policy_key, unsigned int algorithm);
extern int policy_key_set_bits(policy_key_t* policy_key, unsigned int bits);
extern int policy_key_set_lifetime(policy_key_t* policy_key, unsigned int lifetime);
extern int policy_key_set_repository(policy_key_t* policy_key, const char* repository_text);
extern int policy_key_set_standby(policy_key_t* policy_key, unsigned int standby);
extern int policy_key_set_manual_rollover(policy_key_t* policy_key, unsigned int manual_rollover);
extern int policy_key_set_rfc5011(policy_key_t* policy_key, unsigned int rfc5011);
extern int policy_key_set_minimize(policy_key_t* policy_key, unsigned int minimize);
extern int policy_key_create(policy_key_t* policy_key);
extern int policy_key_get_by_id(policy_key_t* policy_key, const db_value_t* id);
extern 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;
};
extern policy_key_list_t* policy_key_list_new(const db_connection_t* connection);
extern policy_key_list_t* policy_key_list_new_copy(const policy_key_list_t* policy_key_copy);
extern int policy_key_list_object_store(policy_key_list_t* policy_key_list);
extern void policy_key_list_free(policy_key_list_t* policy_key_list);
extern int policy_key_list_copy(policy_key_list_t* policy_key_list, const policy_key_list_t* from_policy_key_list);
extern int policy_key_list_get_by_clauses(policy_key_list_t* policy_key_list, const db_clause_list_t* clause_list);
extern int policy_key_list_get_by_policy_id(policy_key_list_t* policy_key_list, const db_value_t* policy_id);
extern policy_key_list_t* policy_key_list_new_get_by_policy_id(const db_connection_t* connection, const db_value_t* policy_id);
extern const policy_key_t* policy_key_list_begin(policy_key_list_t* policy_key_list);
extern const policy_key_t* policy_key_list_next(policy_key_list_t* policy_key_list);
extern policy_key_t* policy_key_list_get_next(policy_key_list_t* policy_key_list);
extern size_t policy_key_list_size(policy_key_list_t* policy_key_list);
extern 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);
extern 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
db_clause_list_t
struct db_clause_list db_clause_list_t
Definition db_clause.h:110
db_connection_t
struct db_connection db_connection_t
Definition db_connection.h:34
db_enum_t
struct db_enum db_enum_t
db_object.h
db_object_t
struct db_object db_object_t
Definition db_object.h:36
db_result_t
struct db_result db_result_t
Definition db_result.h:35
db_result_list_t
struct db_result_list db_result_list_t
Definition db_result.h:36
db_value_t
struct db_value db_value_t
Definition db_value.h:35
policy_id
const db_value_t * policy_id(const policy_t *policy)
Definition policy.c:805
policy.h
policy_t
struct policy policy_t
Definition policy.h:37
policy_list_t
struct policy_list policy_list_t
Definition policy.h:38
policy_key_enum_set_role
const db_enum_t policy_key_enum_set_role[]
Definition policy_key.c:36
policy_key_copy
int policy_key_copy(policy_key_t *policy_key, const policy_key_t *policy_key_copy)
Definition policy_key.c:289
policy_key_set_minimize
int policy_key_set_minimize(policy_key_t *policy_key, unsigned int minimize)
Definition policy_key.c:692
policy_key_list_size
size_t policy_key_list_size(policy_key_list_t *policy_key_list)
Definition policy_key.c:1480
policy_key_policy
const policy_t * policy_key_policy(const policy_key_t *policy_key)
policy_key_reset
void policy_key_reset(policy_key_t *policy_key)
Definition policy_key.c:264
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_set_standby
int policy_key_set_standby(policy_key_t *policy_key, unsigned int standby)
Definition policy_key.c:662
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_set_bits
int policy_key_set_bits(policy_key_t *policy_key, unsigned int bits)
Definition policy_key.c:620
policy_key_t
struct policy_key policy_key_t
Definition policy_key.h:37
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_minimize
unsigned int policy_key_minimize(const policy_key_t *policy_key)
Definition policy_key.c:566
policy_key_role
policy_key_role
Definition policy_key.h:40
POLICY_KEY_ROLE_KSK
@ POLICY_KEY_ROLE_KSK
Definition policy_key.h:42
POLICY_KEY_ROLE_CSK
@ POLICY_KEY_ROLE_CSK
Definition policy_key.h:44
POLICY_KEY_ROLE_ZSK
@ POLICY_KEY_ROLE_ZSK
Definition policy_key.h:43
POLICY_KEY_ROLE_INVALID
@ POLICY_KEY_ROLE_INVALID
Definition policy_key.h:41
policy_key_lifetime
unsigned int policy_key_lifetime(const policy_key_t *policy_key)
Definition policy_key.c:526
policy_key_new
policy_key_t * policy_key_new(const db_connection_t *connection)
Definition policy_key.c:209
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_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_list_begin
const policy_key_t * policy_key_list_begin(policy_key_list_t *policy_key_list)
Definition policy_key.c:1322
policy_key_manual_rollover
unsigned int policy_key_manual_rollover(const policy_key_t *policy_key)
Definition policy_key.c:550
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_copy
int policy_key_copy(policy_key_t *policy_key, const policy_key_t *policy_key_copy)
Definition policy_key.c:289
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_delete
int policy_key_delete(policy_key_t *policy_key)
Definition policy_key.c:913
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_get_policy
policy_t * policy_key_get_policy(const policy_key_t *policy_key)
policy_key_policy_id
const db_value_t * policy_key_policy_id(const policy_key_t *policy_key)
Definition policy_key.c:478
policy_key_list_new
policy_key_list_t * policy_key_list_new(const db_connection_t *connection)
Definition policy_key.c:963
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_set_rfc5011
int policy_key_set_rfc5011(policy_key_t *policy_key, unsigned int rfc5011)
Definition policy_key.c:682
policy_key_new_copy
policy_key_t * policy_key_new_copy(const policy_key_t *policy_key)
Definition policy_key.c:227
policy_key_set_algorithm
int policy_key_set_algorithm(policy_key_t *policy_key, unsigned int algorithm)
Definition policy_key.c:606
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_set_lifetime
int policy_key_set_lifetime(policy_key_t *policy_key, unsigned int lifetime)
Definition policy_key.c:630
policy_key_repository
const char * policy_key_repository(const policy_key_t *policy_key)
Definition policy_key.c:534
policy_key_role_t
enum policy_key_role policy_key_role_t
policy_key_list_free
void policy_key_list_free(policy_key_list_t *policy_key_list)
Definition policy_key.c:1006
policy_key_role_text
const char * policy_key_role_text(const policy_key_t *policy_key)
Definition policy_key.c:494
policy_key_free
void policy_key_free(policy_key_t *policy_key)
Definition policy_key.c:246
policy_key_list_t
struct policy_key_list policy_key_list_t
Definition policy_key.h:38
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
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_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_from_result
int policy_key_from_result(policy_key_t *policy_key, const db_result_t *result)
Definition policy_key.c:426
policy_key_algorithm
unsigned int policy_key_algorithm(const policy_key_t *policy_key)
Definition policy_key.c:510
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_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_create
int policy_key_create(policy_key_t *policy_key)
Definition policy_key.c:702
policy_key_rfc5011
unsigned int policy_key_rfc5011(const policy_key_t *policy_key)
Definition policy_key.c:558
policy_key_bits
unsigned int policy_key_bits(const policy_key_t *policy_key)
Definition policy_key.c:518
policy_key_standby
int policy_key_standby(const policy_key_t *policy_key)
Definition policy_key.c:542
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_ext.h
policy_key_list
Definition policy_key.h:322
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::object_store
int object_store
Definition policy_key.h:327
policy_key_list::result_list
db_result_list_t * result_list
Definition policy_key.h:324
policy_key_list::object_list_position
size_t object_list_position
Definition policy_key.h:330
policy_key_list::object_list_size
size_t object_list_size
Definition policy_key.h:329
policy_key_list::policy_id_list
policy_list_t * policy_id_list
Definition policy_key.h:333
policy_key_list::object_list_first
int object_list_first
Definition policy_key.h:331
policy_key_list::associated_fetch
int associated_fetch
Definition policy_key.h:332
policy_key_list::dbo
db_object_t * dbo
Definition policy_key.h:323
policy_key_list::result
const db_result_t * result
Definition policy_key.h:325
policy_key
Definition policy_key.h:54
policy_key::standby
unsigned int standby
Definition policy_key.h:66
policy_key::associated_policy_id
const policy_t * associated_policy_id
Definition policy_key.h:59
policy_key::policy_id
db_value_t policy_id
Definition policy_key.h:58
policy_key::rfc5011
unsigned int rfc5011
Definition policy_key.h:68
policy_key::role
policy_key_role_t role
Definition policy_key.h:61
policy_key::rev
db_value_t rev
Definition policy_key.h:57
policy_key::private_policy_id
policy_t * private_policy_id
Definition policy_key.h:60
policy_key::minimize
unsigned int minimize
Definition policy_key.h:69
policy_key::id
db_value_t id
Definition policy_key.h:56
policy_key::bits
unsigned int bits
Definition policy_key.h:63
policy_key::lifetime
unsigned int lifetime
Definition policy_key.h:64
policy_key::dbo
db_object_t * dbo
Definition policy_key.h:55
policy_key::algorithm
unsigned int algorithm
Definition policy_key.h:62
policy_key::repository
char * repository
Definition policy_key.h:65
policy_key::manual_rollover
unsigned int manual_rollover
Definition policy_key.h:67