RTRlib
|
The spki_table is an abstract data structure to organize the received Router Key PDUs from a RPKI-RTR cache server. More...
Data Structures | |
struct | spki_record |
spki_record. More... | |
Macros | |
#define | SKI_SIZE 20 |
#define | SPKI_SIZE 91 |
Typedefs | |
typedef void(* | spki_update_fp) (struct spki_table *spki_table, const struct spki_record record, const bool added) |
A function pointer that is called if an record was added to the spki_table or was removed from the spki_table. | |
Enumerations | |
enum | spki_rtvals { SPKI_SUCCESS = 0 , SPKI_ERROR = -1 , SPKI_DUPLICATE_RECORD = -2 , SPKI_RECORD_NOT_FOUND = -3 } |
Possible return values for some spki_table_ functions. More... | |
Functions | |
void | spki_table_init (struct spki_table *spki_table, spki_update_fp update_fp) |
Initializes the spki_table struct. | |
void | spki_table_free (struct spki_table *spki_table) |
Frees the memory associated with the spki_table. | |
void | spki_table_free_without_notify (struct spki_table *spki_table) |
Frees the memory associated with the spki_table without calling the update callback. | |
int | spki_table_add_entry (struct spki_table *spki_table, struct spki_record *spki_record) |
Adds a spki_record to a spki_table. | |
int | spki_table_get_all (struct spki_table *spki_table, uint32_t asn, uint8_t *ski, struct spki_record **result, unsigned int *result_size) |
Returns all spki_record whose ASN and SKI matches. | |
int | spki_table_search_by_ski (struct spki_table *spki_table, uint8_t *ski, struct spki_record **result, unsigned int *result_size) |
Returns all spki_record whose SKI number matches the given one. | |
int | spki_table_remove_entry (struct spki_table *spki_table, struct spki_record *spki_record) |
Removes spki_record from spki_table. | |
int | spki_table_src_remove (struct spki_table *spki_table, const struct rtr_socket *socket) |
Removes all entries in the spki_table that match the passed socket_id. | |
int | spki_table_copy_except_socket (struct spki_table *src, struct spki_table *dest, struct rtr_socket *socket) |
Copy spki table except entries from the given socket. | |
void | spki_table_notify_diff (struct spki_table *new_table, struct spki_table *old_table, const struct rtr_socket *socket) |
Notify client about changes between two spki tables regarding one specific socket. | |
void | spki_table_swap (struct spki_table *a, struct spki_table *b) |
tommy_hashlin and tommy_list of the argument tables | |
The spki_table is an abstract data structure to organize the received Router Key PDUs from a RPKI-RTR cache server.
#define SKI_SIZE 20 |
#include <rtrlib/spki/spkitable.h>
#define SPKI_SIZE 91 |
#include <rtrlib/spki/spkitable.h>
typedef void(* spki_update_fp) (struct spki_table *spki_table, const struct spki_record record, const bool added) |
#include <rtrlib/spki/spkitable.h>
A function pointer that is called if an record was added to the spki_table or was removed from the spki_table.
spki_table | which was updated. |
record | spki_record that was modified. |
added | True if the record was added, false if the record was removed. |
enum spki_rtvals |
#include <rtrlib/spki/spkitable_private.h>
Possible return values for some spki_table_ functions.
Enumerator | |
---|---|
SPKI_SUCCESS | Operation was successful. |
SPKI_ERROR | Error occurred. |
SPKI_DUPLICATE_RECORD | The supplied spki_record already exists in the spki_table. |
SPKI_RECORD_NOT_FOUND | spki_record wasn't found in the spki_table. |
int spki_table_add_entry | ( | struct spki_table * | spki_table, |
struct spki_record * | spki_record | ||
) |
#include <rtrlib/spki/spkitable_private.h>
Adds a spki_record to a spki_table.
[in] | spki_table | spki_table to use. |
[in] | spki_record | spki_record that will be added. |
int spki_table_copy_except_socket | ( | struct spki_table * | src, |
struct spki_table * | dest, | ||
struct rtr_socket * | socket | ||
) |
#include <rtrlib/spki/spkitable_private.h>
Copy spki table except entries from the given socket.
[in] | src | source table |
[in] | dest | target table |
[in] | socket | socket which entries should not be copied |
void spki_table_free | ( | struct spki_table * | spki_table | ) |
#include <rtrlib/spki/spkitable_private.h>
Frees the memory associated with the spki_table.
[in] | spki_table | spki_table that will be initialized. |
void spki_table_free_without_notify | ( | struct spki_table * | spki_table | ) |
#include <rtrlib/spki/spkitable_private.h>
Frees the memory associated with the spki_table without calling the update callback.
[in] | spki_table | spki_table that will be initialized. |
int spki_table_get_all | ( | struct spki_table * | spki_table, |
uint32_t | asn, | ||
uint8_t * | ski, | ||
struct spki_record ** | result, | ||
unsigned int * | result_size | ||
) |
#include <rtrlib/spki/spkitable_private.h>
Returns all spki_record whose ASN and SKI matches.
[in] | spki_table | spki_table to use |
[in] | asn | the AS number |
[in] | ski | the 20 byte field which contains the SKI to search for |
[out] | result | the result array. NULL if no records could be found |
[out] | result_size | elment count of the result array |
void spki_table_init | ( | struct spki_table * | spki_table, |
spki_update_fp | update_fp | ||
) |
#include <rtrlib/spki/spkitable_private.h>
Initializes the spki_table struct.
[in] | spki_table | spki_table that will be initialized. |
[in] | update_fp | Pointer to update function |
void spki_table_notify_diff | ( | struct spki_table * | new_table, |
struct spki_table * | old_table, | ||
const struct rtr_socket * | socket | ||
) |
#include <rtrlib/spki/spkitable_private.h>
Notify client about changes between two spki tables regarding one specific socket.
old_table will be modified and should probably be freed after calling this function
[in] | new_table | |
[in] | old_table | |
[in] | socket | socket which entries should be diffed |
int spki_table_remove_entry | ( | struct spki_table * | spki_table, |
struct spki_record * | spki_record | ||
) |
#include <rtrlib/spki/spkitable_private.h>
Removes spki_record from spki_table.
spki_table | spki_table to use |
spki_record | spki_record to remove; |
int spki_table_search_by_ski | ( | struct spki_table * | spki_table, |
uint8_t * | ski, | ||
struct spki_record ** | result, | ||
unsigned int * | result_size | ||
) |
#include <rtrlib/spki/spkitable_private.h>
Returns all spki_record whose SKI number matches the given one.
[in] | spki_table | spki_table to use |
[in] | ski | the 20 byte field which contains the SKI to search for |
[out] | result | the result array. NULL if no records could be found |
[out] | result_size | elment count of the result array |
int spki_table_src_remove | ( | struct spki_table * | spki_table, |
const struct rtr_socket * | socket | ||
) |
#include <rtrlib/spki/spkitable_private.h>
Removes all entries in the spki_table that match the passed socket_id.
[in] | spki_table | spki_table to use. |
[in] | socket | origin socket of the record |
void spki_table_swap | ( | struct spki_table * | a, |
struct spki_table * | b | ||
) |
#include <rtrlib/spki/spkitable_private.h>
tommy_hashlin and tommy_list of the argument tables
[in] | a | |
[in] | b |