RTRlib
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Data Structures | Macros | Typedefs | Enumerations | Functions
Subject Public Key Info table

Data Structures

struct  spki_record
 

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)
 

Enumerations

enum  spki_rtvals { SPKI_SUCCESS = 0, SPKI_ERROR = -1, SPKI_DUPLICATE_RECORD = -2, SPKI_RECORD_NOT_FOUND = -3 }
 

Functions

int spki_table_add_entry (struct spki_table *spki_table, struct spki_record *spki_record)
 
void spki_table_free (struct spki_table *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)
 
void spki_table_init (struct spki_table *spki_table, spki_update_fp update_fp)
 
int spki_table_remove_entry (struct spki_table *spki_table, struct spki_record *spki_record)
 
int spki_table_search_by_ski (struct spki_table *spki_table, uint8_t *ski, struct spki_record **result, unsigned int *result_size)
 
int spki_table_src_remove (struct spki_table *spki_table, const struct rtr_socket *socket)
 

Detailed Description

Typedef Documentation

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.

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

Possible return values for some spki_table_ functions.

Enumerator
SPKI_SUCCESS 

Operation was successfull.

SPKI_ERROR 

Error occured.

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

int spki_table_add_entry ( struct spki_table *  spki_table,
struct spki_record spki_record 
)

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
void spki_table_free ( struct spki_table *  spki_table)

Frees the memory associcated with the spki_table.

Parameters
[in]spki_tablespki_table that will be initialized.

Referenced by rtr_mgr_free(), and rtr_mgr_init().

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.

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

Referenced by rtr_mgr_get_spki().

void spki_table_init ( struct spki_table *  spki_table,
spki_update_fp  update_fp 
)

Initializes the spki_table struct.

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

Referenced by rtr_mgr_init().

int spki_table_remove_entry ( struct spki_table *  spki_table,
struct spki_record spki_record 
)

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

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

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