key_state.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_state_h
#define __key_state_h
#include "db_object.h"
struct key_state;
struct key_state_list;
typedef struct key_state key_state_t;
typedef struct key_state_list key_state_list_t;
typedef enum key_state_type {
KEY_STATE_TYPE_INVALID = -1,
KEY_STATE_TYPE_DS = 0,
KEY_STATE_TYPE_RRSIG = 1,
KEY_STATE_TYPE_DNSKEY = 2,
KEY_STATE_TYPE_RRSIGDNSKEY = 3
} key_state_type_t;
extern const db_enum_t key_state_enum_set_type[];
typedef enum key_state_state {
KEY_STATE_STATE_INVALID = -1,
KEY_STATE_STATE_HIDDEN = 0,
KEY_STATE_STATE_RUMOURED = 1,
KEY_STATE_STATE_OMNIPRESENT = 2,
KEY_STATE_STATE_UNRETENTIVE = 3,
KEY_STATE_STATE_NA = 4
} key_state_state_t;
extern const db_enum_t key_state_enum_set_state[];
#include "key_state_ext.h"
#include "key_data.h"
struct key_state {
db_object_t* dbo;
db_value_t id;
db_value_t rev;
db_value_t key_data_id;
const key_data_t* associated_key_data_id;
key_data_t* private_key_data_id;
key_state_type_t type;
key_state_state_t state;
unsigned int last_change;
unsigned int minimize;
unsigned int ttl;
};
extern key_state_t* key_state_new(const db_connection_t* connection);
extern key_state_t* key_state_new_copy(const key_state_t* key_state);
extern void key_state_free(key_state_t* key_state);
extern int key_state_copy(key_state_t* key_state, const key_state_t* key_state_copy);
extern int key_state_from_result(key_state_t* key_state, const db_result_t* result);
extern const db_value_t* key_state_key_data_id(const key_state_t* key_state);
extern key_state_type_t key_state_type(const key_state_t* key_state);
extern const char* key_state_type_text(const key_state_t* key_state);
extern key_state_state_t key_state_state(const key_state_t* key_state);
extern const char* key_state_state_text(const key_state_t* key_state);
extern unsigned int key_state_last_change(const key_state_t* key_state);
extern unsigned int key_state_minimize(const key_state_t* key_state);
extern unsigned int key_state_ttl(const key_state_t* key_state);
extern int key_state_set_key_data_id(key_state_t* key_state, const db_value_t* key_data_id);
extern int key_state_set_type(key_state_t* key_state, key_state_type_t type);
extern int key_state_set_state(key_state_t* key_state, key_state_state_t state);
extern int key_state_set_last_change(key_state_t* key_state, unsigned int last_change);
extern int key_state_set_minimize(key_state_t* key_state, unsigned int minimize);
extern int key_state_set_ttl(key_state_t* key_state, unsigned int ttl);
extern db_clause_t* key_state_key_data_id_clause(db_clause_list_t* clause_list, const db_value_t* key_data_id);
extern int key_state_create(key_state_t* key_state);
extern int key_state_get_by_id(key_state_t* key_state, const db_value_t* id);
extern int key_state_update(key_state_t* key_state);
extern int key_state_delete(const key_state_t* key_state);
struct key_state_list {
db_object_t* dbo;
db_result_list_t* result_list;
const db_result_t* result;
key_state_t* key_state;
int object_store;
key_state_t** object_list;
size_t object_list_size;
size_t object_list_position;
int object_list_first;
int associated_fetch;
key_data_list_t* key_data_id_list;
};
extern key_state_list_t* key_state_list_new(const db_connection_t* connection);
extern key_state_list_t* key_state_list_new_copy(const key_state_list_t* key_state_copy);
extern int key_state_list_object_store(key_state_list_t* key_state_list);
extern void key_state_list_free(key_state_list_t* key_state_list);
extern int key_state_list_copy(key_state_list_t* key_state_list, const key_state_list_t* from_key_state_list);
extern int key_state_list_get_by_clauses(key_state_list_t* key_state_list, const db_clause_list_t* clause_list);
extern int key_state_list_get_by_key_data_id(key_state_list_t* key_state_list, const db_value_t* key_data_id);
extern key_state_list_t* key_state_list_new_get_by_key_data_id(const db_connection_t* connection, const db_value_t* key_data_id);
extern const key_state_t* key_state_list_begin(key_state_list_t* key_state_list);
extern key_state_t* key_state_list_get_begin(key_state_list_t* key_state_list);
extern const key_state_t* key_state_list_next(key_state_list_t* key_state_list);
extern key_state_t* key_state_list_get_next(key_state_list_t* key_state_list);
#endif
db_object.h
key_data_id
const db_value_t * key_data_id(const key_data_t *key_data)
Definition key_data.c:553
key_data.h
key_state_minimize
unsigned int key_state_minimize(const key_state_t *key_state)
Definition key_state.c:401
key_state_list_get_next
key_state_t * key_state_list_get_next(key_state_list_t *key_state_list)
Definition key_state.c:1398
key_state_list_get_begin
key_state_t * key_state_list_get_begin(key_state_list_t *key_state_list)
Definition key_state.c:1296
key_state_set_minimize
int key_state_set_minimize(key_state_t *key_state, unsigned int minimize)
Definition key_state.c:472
key_state_key_data_id_clause
db_clause_t * key_state_key_data_id_clause(db_clause_list_t *clause_list, const db_value_t *key_data_id)
Definition key_state.c:492
key_state_delete
int key_state_delete(const key_state_t *key_state)
Definition key_state.c:831
key_state_state_text
const char * key_state_state_text(const key_state_t *key_state)
Definition key_state.c:377
key_state_new_copy
key_state_t * key_state_new_copy(const key_state_t *key_state)
Definition key_state.c:195
key_state_new
key_state_t * key_state_new(const db_connection_t *connection)
Definition key_state.c:176
key_state_state_t
enum key_state_state key_state_state_t
key_state_ttl
unsigned int key_state_ttl(const key_state_t *key_state)
Definition key_state.c:409
key_state_list_new
key_state_list_t * key_state_list_new(const db_connection_t *connection)
Definition key_state.c:881
key_state_set_ttl
int key_state_set_ttl(key_state_t *key_state, unsigned int ttl)
Definition key_state.c:482
key_state_free
void key_state_free(key_state_t *key_state)
Definition key_state.c:214
key_state_get_by_id
int key_state_get_by_id(key_state_t *key_state, const db_value_t *id)
Definition key_state.c:631
key_state_set_last_change
int key_state_set_last_change(key_state_t *key_state, unsigned int last_change)
Definition key_state.c:462
key_state_set_type
int key_state_set_type(key_state_t *key_state, key_state_type_t type)
Definition key_state.c:436
key_state_list_object_store
int key_state_list_object_store(key_state_list_t *key_state_list)
Definition key_state.c:914
key_state_key_data_id
const db_value_t * key_state_key_data_id(const key_state_t *key_state)
Definition key_state.c:337
key_state_create
int key_state_create(key_state_t *key_state)
Definition key_state.c:519
key_state_type_t
enum key_state_type key_state_type_t
key_state_list_new_get_by_key_data_id
key_state_list_t * key_state_list_new_get_by_key_data_id(const db_connection_t *connection, const db_value_t *key_data_id)
Definition key_state.c:1217
key_state_list_new_copy
key_state_list_t * key_state_list_new_copy(const key_state_list_t *key_state_copy)
Definition key_state.c:895
key_state_list_free
void key_state_list_free(key_state_list_t *key_state_list)
Definition key_state.c:924
key_state_copy
int key_state_copy(key_state_t *key_state, const key_state_t *key_state_copy)
Definition key_state.c:229
key_state_enum_set_type
const db_enum_t key_state_enum_set_type[]
Definition key_state.c:36
key_state_enum_set_state
const db_enum_t key_state_enum_set_state[]
Definition key_state.c:44
key_state_list_begin
const key_state_t * key_state_list_begin(key_state_list_t *key_state_list)
Definition key_state.c:1240
key_state_type_text
const char * key_state_type_text(const key_state_t *key_state)
Definition key_state.c:353
key_state_set_key_data_id
int key_state_set_key_data_id(key_state_t *key_state, const db_value_t *key_data_id)
Definition key_state.c:417
key_state_list_get_by_clauses
int key_state_list_get_by_clauses(key_state_list_t *key_state_list, const db_clause_list_t *clause_list)
Definition key_state.c:1112
key_state_from_result
int key_state_from_result(key_state_t *key_state, const db_result_t *result)
Definition key_state.c:270
key_state_list_next
const key_state_t * key_state_list_next(key_state_list_t *key_state_list)
Definition key_state.c:1332
key_state_list_get_by_key_data_id
int key_state_list_get_by_key_data_id(key_state_list_t *key_state_list, const db_value_t *key_data_id)
Definition key_state.c:1154
key_state_type
key_state_type
Definition key_state.h:40
KEY_STATE_TYPE_DNSKEY
@ KEY_STATE_TYPE_DNSKEY
Definition key_state.h:44
KEY_STATE_TYPE_RRSIG
@ KEY_STATE_TYPE_RRSIG
Definition key_state.h:43
KEY_STATE_TYPE_INVALID
@ KEY_STATE_TYPE_INVALID
Definition key_state.h:41
KEY_STATE_TYPE_DS
@ KEY_STATE_TYPE_DS
Definition key_state.h:42
KEY_STATE_TYPE_RRSIGDNSKEY
@ KEY_STATE_TYPE_RRSIGDNSKEY
Definition key_state.h:45
key_state_list_copy
int key_state_list_copy(key_state_list_t *key_state_list, const key_state_list_t *from_key_state_list)
Definition key_state.c:952
key_state_last_change
unsigned int key_state_last_change(const key_state_t *key_state)
Definition key_state.c:393
key_state_state
key_state_state
Definition key_state.h:49
KEY_STATE_STATE_NA
@ KEY_STATE_STATE_NA
Definition key_state.h:55
KEY_STATE_STATE_OMNIPRESENT
@ KEY_STATE_STATE_OMNIPRESENT
Definition key_state.h:53
KEY_STATE_STATE_HIDDEN
@ KEY_STATE_STATE_HIDDEN
Definition key_state.h:51
KEY_STATE_STATE_INVALID
@ KEY_STATE_STATE_INVALID
Definition key_state.h:50
KEY_STATE_STATE_RUMOURED
@ KEY_STATE_STATE_RUMOURED
Definition key_state.h:52
KEY_STATE_STATE_UNRETENTIVE
@ KEY_STATE_STATE_UNRETENTIVE
Definition key_state.h:54
key_state_set_state
int key_state_set_state(key_state_t *key_state, key_state_state_t state)
Definition key_state.c:449
key_state_update
int key_state_update(key_state_t *key_state)
Definition key_state.c:684
key_state_ext.h
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
key_data_list
Definition key_data.h:479
key_data
Definition key_data.h:68
key_state_list
Definition key_state.h:262
key_state_list::object_list_size
size_t object_list_size
Definition key_state.h:269
key_state_list::result
const db_result_t * result
Definition key_state.h:265
key_state_list::object_store
int object_store
Definition key_state.h:267
key_state_list::object_list_position
size_t object_list_position
Definition key_state.h:270
key_state_list::associated_fetch
int associated_fetch
Definition key_state.h:272
key_state_list::key_data_id_list
key_data_list_t * key_data_id_list
Definition key_state.h:273
key_state_list::key_state
key_state_t * key_state
Definition key_state.h:266
key_state_list::dbo
db_object_t * dbo
Definition key_state.h:263
key_state_list::object_list_first
int object_list_first
Definition key_state.h:271
key_state_list::result_list
db_result_list_t * result_list
Definition key_state.h:264
key_state_list::object_list
key_state_t ** object_list
Definition key_state.h:268
key_state
Definition key_state.h:65
key_state::rev
db_value_t rev
Definition key_state.h:68
key_state::associated_key_data_id
const key_data_t * associated_key_data_id
Definition key_state.h:70
key_state::ttl
unsigned int ttl
Definition key_state.h:76
key_state::type
key_state_type_t type
Definition key_state.h:72
key_state::private_key_data_id
key_data_t * private_key_data_id
Definition key_state.h:71
key_state::id
db_value_t id
Definition key_state.h:67
key_state::key_data_id
db_value_t key_data_id
Definition key_state.h:69
key_state::minimize
unsigned int minimize
Definition key_state.h:75
key_state::state
key_state_state_t state
Definition key_state.h:73
key_state::last_change
unsigned int last_change
Definition key_state.h:74
key_state::dbo
db_object_t * dbo
Definition key_state.h:66