RTRlib
Loading...
Searching...
No Matches
Subject Public Key Info table

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
 

Detailed Description

The spki_table is an abstract data structure to organize the received Router Key PDUs from a RPKI-RTR cache server.

Macro Definition Documentation

◆ SKI_SIZE

#define SKI_SIZE   20

◆ SPKI_SIZE

#define SPKI_SIZE   91

Typedef Documentation

◆ spki_update_fp

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.

Parameters
spki_tablewhich was updated.
recordspki_record that was modified.
addedTrue if the record was added, false if the record was removed.

Enumeration Type Documentation

◆ 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.

Function Documentation

◆ spki_table_add_entry()

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.

Parameters
[in]spki_tablespki_table to use.
[in]spki_recordspki_record that will be added.
Returns
SPKI_SUCCESS On success.
SPKI_ERROR On error.
SPKI_DUPLICATE_RECORD If an identical spki_record already exists

◆ spki_table_copy_except_socket()

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.

Parameters
[in]srcsource table
[in]desttarget table
[in]socketsocket which entries should not be copied
Returns
SPKI_SUCCESS On success.
SPKI_ERROR On error.

◆ spki_table_free()

void spki_table_free ( struct spki_table spki_table)

#include <rtrlib/spki/spkitable_private.h>

Frees the memory associated with the spki_table.

Parameters
[in]spki_tablespki_table that will be initialized.

◆ spki_table_free_without_notify()

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.

Parameters
[in]spki_tablespki_table that will be initialized.

◆ spki_table_get_all()

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.

Parameters
[in]spki_tablespki_table to use
[in]asnthe AS number
[in]skithe 20 byte field which contains the SKI to search for
[out]resultthe result array. NULL if no records could be found
[out]result_sizeelment count of the result array
Returns
SPKI_SUCCESS On success
SPKI_ERROR On error

◆ spki_table_init()

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.

Parameters
[in]spki_tablespki_table that will be initialized.
[in]update_fpPointer to update function

◆ spki_table_notify_diff()

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

Parameters
[in]new_table
[in]old_table
[in]socketsocket which entries should be diffed

◆ spki_table_remove_entry()

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.

Parameters
spki_tablespki_table to use
spki_recordspki_record to remove;
Returns
SPKI_SUCCESS On success
SPKI_ERROR On error
SPKI_RECORD_NOT_FOUND On record not found

◆ spki_table_search_by_ski()

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.

Parameters
[in]spki_tablespki_table to use
[in]skithe 20 byte field which contains the SKI to search for
[out]resultthe result array. NULL if no records could be found
[out]result_sizeelment count of the result array
Returns
SPKI_SUCCESS On success
SPKI_ERROR On error

◆ spki_table_src_remove()

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.

Parameters
[in]spki_tablespki_table to use.
[in]socketorigin socket of the record
Returns
SPKI_SUCCESS On success.
SPKI_ERROR On error.

◆ spki_table_swap()

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

Parameters
[in]a
[in]b