BSL v0.0.0
AMMOS Bundle Protocol Security Library (BSL)
|
Implementation of the host BPA and its callback functions. More...
#include <BPSecLib_Private.h>
Go to the source code of this file.
Functions | |
int | BSL_HostDescriptors_Set (BSL_HostDescriptors_t desc) |
Set the BPA descriptor (callbacks) for this process. | |
int | BSL_BundleCtx_GetBundleMetadata (const BSL_BundleRef_t *bundle, BSL_PrimaryBlock_t *result_primary_block) |
Calls the host interface to get a bundle primary block information.abort. | |
int | BSL_BundleCtx_GetBlockMetadata (const BSL_BundleRef_t *bundle, uint64_t block_num, BSL_CanonicalBlock_t *result_block) |
Returns information about the bundle Canonical block. | |
int | BSL_BundleCtx_GetBlockIds (const BSL_BundleRef_t *bundle, size_t array_count, uint64_t block_ids_array[array_count], size_t *result_count) |
Returns an array in which each element contains the id of the corresponding block.abort. | |
int | BSL_BundleCtx_CreateBlock (BSL_BundleRef_t *bundle, uint64_t block_type_code, uint64_t *block_num) |
Request the creation of a new block of a given type in the bundle. | |
int | BSL_BundleCtx_RemoveBlock (BSL_BundleRef_t *bundle, uint64_t block_num) |
Requests the removal of a block from a bundle. | |
int | BSL_BundleCtx_ReallocBTSD (BSL_BundleRef_t *bundle, uint64_t block_num, size_t bytesize) |
Requests the re-allocation of a block's BTSD, useful for BCB. | |
void | BSL_HostDescriptors_Get (BSL_HostDescriptors_t *desc) |
Copy the BPA descriptor for this process. | |
int | BSL_HostEID_Init (BSL_HostEID_t *eid) |
Initialize an abstract EID. | |
void | BSL_HostEID_Deinit (BSL_HostEID_t *eid) |
De-initialize an abstract EID. | |
int | BSL_Host_GetSecSrcEID (BSL_HostEID_t *eid) |
Get the local EID used when this node is a security source. | |
int | BSL_HostEID_EncodeToCBOR (const BSL_HostEID_t *eid, void *user_data) |
Encode a EID into a CBOR sequence. | |
int | BSL_HostEID_DecodeFromCBOR (BSL_HostEID_t *eid, void *decoder) |
Load an EID from CBOR. | |
int | BSL_HostEID_DecodeFromText (BSL_HostEID_t *eid, const char *text) |
Decode an EID from its text form. | |
int | BSL_HostEIDPattern_Init (BSL_HostEIDPattern_t *pat) |
Initialize an abstract EID Pattern. | |
void | BSL_HostEIDPattern_Deinit (BSL_HostEIDPattern_t *pat) |
De-initialize an abstract EID Pattern. | |
int | BSL_HostEIDPattern_DecodeFromText (BSL_HostEIDPattern_t *pat, const char *text) |
Decode an EID Pattern from its text form. | |
bool | BSL_HostEIDPattern_IsMatch (const BSL_HostEIDPattern_t *pat, const BSL_HostEID_t *eid) |
Determine if an EID Pattern matches a specific EID. | |
Variables | |
static BSL_HostDescriptors_t | HostDescriptorTable = { 0 } |
Implementation of the host BPA and its callback functions.
Definition in file HostInterface.c.
int BSL_BundleCtx_CreateBlock | ( | BSL_BundleRef_t * | bundle, |
uint64_t | block_type_code, | ||
uint64_t * | block_num | ||
) |
Request the creation of a new block of a given type in the bundle.
[in] | bundle | Context bundle |
[in] | block_type_code | The type of block to be created (e.g, 1 means payload) |
[out] | block_num | Pointer to integer containing the number of the block just created.abort |
Definition at line 96 of file HostInterface.c.
References BSL_HostDescriptors_t::block_create_fn, BSL_ERR_HOST_CALLBACK_FAILED, and BSL_SUCCESS.
int BSL_BundleCtx_GetBlockIds | ( | const BSL_BundleRef_t * | bundle, |
size_t | array_count, | ||
uint64_t | block_ids_array[array_count], | ||
size_t * | result_count | ||
) |
Returns an array in which each element contains the id of the corresponding block.abort.
[in] | bundle | Bundle context |
[in] | array_count | Number of elements in block_id_index_array |
[out] | block_id_index_array | Array of array_count elements for results |
[out] | result_count | Contains the number of elements put into the array |
Definition at line 82 of file HostInterface.c.
References BSL_ERR_HOST_CALLBACK_FAILED, BSL_SUCCESS, and BSL_HostDescriptors_t::bundle_get_block_ids.
Referenced by BSL_API_QuerySecurity().
int BSL_BundleCtx_GetBlockMetadata | ( | const BSL_BundleRef_t * | bundle, |
uint64_t | block_num, | ||
BSL_CanonicalBlock_t * | result_block | ||
) |
Returns information about the bundle Canonical block.
[in] | bundle | Context bundle |
[in] | block_num | The number of the bundle canonical block we seek information on |
[out] | result_block | Pointer to allocated memory which contains the results of the query. |
Definition at line 69 of file HostInterface.c.
References BSL_HostDescriptors_t::block_metadata_fn, BSL_ERR_HOST_CALLBACK_FAILED, and BSL_SUCCESS.
Referenced by BSL_API_QuerySecurity().
int BSL_BundleCtx_GetBundleMetadata | ( | const BSL_BundleRef_t * | bundle, |
BSL_PrimaryBlock_t * | result_primary_block | ||
) |
Calls the host interface to get a bundle primary block information.abort.
[in] | bundle | Bundle context |
[out] | result_primary_block | Non-null pointer to result which gets populated on a zero return code. |
Definition at line 57 of file HostInterface.c.
References BSL_ERR_HOST_CALLBACK_FAILED, BSL_SUCCESS, and BSL_HostDescriptors_t::bundle_metadata_fn.
Referenced by BSL_API_ApplySecurity(), BSL_API_QuerySecurity(), BSLP_PolicyRule_EvaluateAsSecOper(), and BSLP_QueryPolicy().
int BSL_BundleCtx_ReallocBTSD | ( | BSL_BundleRef_t * | bundle, |
uint64_t | block_num, | ||
size_t | bytesize | ||
) |
Requests the re-allocation of a block's BTSD, useful for BCB.
[in] | bundle | Context bundle |
[in] | block_num | Number of block requesting re-allocated of BTSD |
[in] | bytesize | Size of new BTSD |
Definition at line 117 of file HostInterface.c.
References BSL_HostDescriptors_t::block_realloc_btsd_fn, BSL_HostDescriptors_t::block_remove_fn, BSL_ERR_HOST_CALLBACK_FAILED, and BSL_SUCCESS.
int BSL_BundleCtx_RemoveBlock | ( | BSL_BundleRef_t * | bundle, |
uint64_t | block_num | ||
) |
Requests the removal of a block from a bundle.
[in] | bundle | Context bundle |
[in] | block_num | Block number to be removed |
Definition at line 108 of file HostInterface.c.
References BSL_HostDescriptors_t::block_remove_fn, BSL_ERR_HOST_CALLBACK_FAILED, and BSL_SUCCESS.
Referenced by BSL_API_ApplySecurity().
int BSL_Host_GetSecSrcEID | ( | BSL_HostEID_t * | eid | ) |
Get the local EID used when this node is a security source.
[out] | eid | The EID to write into. This must already be initialized. |
Definition at line 147 of file HostInterface.c.
References BSL_HostDescriptors_t::get_host_eid_fn, and BSL_HostDescriptors_t::user_data.
void BSL_HostDescriptors_Get | ( | BSL_HostDescriptors_t * | desc | ) |
Copy the BPA descriptor for this process.
[out] | desc | The descriptor to copy into. |
Definition at line 127 of file HostInterface.c.
Referenced by bsl_mock_bpa_deinit().
int BSL_HostDescriptors_Set | ( | BSL_HostDescriptors_t | desc | ) |
Set the BPA descriptor (callbacks) for this process.
desc | The descriptor to use for future BPA functions. |
Definition at line 31 of file HostInterface.c.
References BSL_HostDescriptors_t::block_create_fn, BSL_HostDescriptors_t::block_metadata_fn, BSL_HostDescriptors_t::block_realloc_btsd_fn, BSL_HostDescriptors_t::block_remove_fn, BSL_SUCCESS, BSL_HostDescriptors_t::bundle_get_block_ids, BSL_HostDescriptors_t::bundle_metadata_fn, BSL_HostDescriptors_t::eid_deinit, BSL_HostDescriptors_t::eid_from_cbor, BSL_HostDescriptors_t::eid_from_text, BSL_HostDescriptors_t::eid_init, BSL_HostDescriptors_t::eidpat_deinit, BSL_HostDescriptors_t::eidpat_from_text, BSL_HostDescriptors_t::eidpat_init, BSL_HostDescriptors_t::eidpat_match, and BSL_HostDescriptors_t::get_host_eid_fn.
Referenced by bsl_mock_bpa_deinit(), and bsl_mock_bpa_init().
int BSL_HostEID_DecodeFromCBOR | ( | BSL_HostEID_t * | eid, |
void * | decoder | ||
) |
Load an EID from CBOR.
[in,out] | eid | This eid |
[in] | CBOR | decoder context |
Definition at line 161 of file HostInterface.c.
References BSL_HostDescriptors_t::eid_from_cbor, and BSL_HostEID_s::handle.
int BSL_HostEID_DecodeFromText | ( | BSL_HostEID_t * | eid, |
const char * | text | ||
) |
Decode an EID from its text form.
[out] | eid | The EID to write into. This must already be initialized. |
[in] | text | The text to read from, which must be non-null. |
Definition at line 171 of file HostInterface.c.
References BSL_HostDescriptors_t::eid_from_text, and BSL_HostDescriptors_t::user_data.
void BSL_HostEID_Deinit | ( | BSL_HostEID_t * | eid | ) |
De-initialize an abstract EID.
[in,out] | eid | The object to de-initialize. |
Definition at line 140 of file HostInterface.c.
References BSL_HostDescriptors_t::eid_deinit, and BSL_HostDescriptors_t::user_data.
int BSL_HostEID_EncodeToCBOR | ( | const BSL_HostEID_t * | eid, |
void * | user_data | ||
) |
Encode a EID into a CBOR sequence.
Definition at line 154 of file HostInterface.c.
References BSL_HostDescriptors_t::eid_to_cbor.
int BSL_HostEID_Init | ( | BSL_HostEID_t * | eid | ) |
Initialize an abstract EID.
[out] | eid | The object to initialize. |
Definition at line 133 of file HostInterface.c.
References BSL_HostDescriptors_t::eid_init, and BSL_HostDescriptors_t::user_data.
int BSL_HostEIDPattern_DecodeFromText | ( | BSL_HostEIDPattern_t * | pat, |
const char * | text | ||
) |
Decode an EID Pattern from its text form.
[out] | pat | The pattern to write into. This must already be initialized. |
[in] | text | The text to read from, which must be non-null. |
Definition at line 196 of file HostInterface.c.
References BSL_HostDescriptors_t::eidpat_from_text, and BSL_HostDescriptors_t::user_data.
void BSL_HostEIDPattern_Deinit | ( | BSL_HostEIDPattern_t * | pat | ) |
De-initialize an abstract EID Pattern.
[in,out] | pat | The object to de-initialize. |
Definition at line 190 of file HostInterface.c.
References BSL_HostDescriptors_t::eidpat_deinit, and BSL_HostDescriptors_t::user_data.
int BSL_HostEIDPattern_Init | ( | BSL_HostEIDPattern_t * | pat | ) |
Initialize an abstract EID Pattern.
[out] | pat | The object to initialize. |
Definition at line 183 of file HostInterface.c.
References BSL_HostDescriptors_t::eidpat_init, and BSL_HostDescriptors_t::user_data.
bool BSL_HostEIDPattern_IsMatch | ( | const BSL_HostEIDPattern_t * | pat, |
const BSL_HostEID_t * | eid | ||
) |
Determine if an EID Pattern matches a specific EID.
[in] | pat | The pattern to compare. |
[in] | eid | The EID to compare. |
Definition at line 205 of file HostInterface.c.
References BSL_HostDescriptors_t::eidpat_match, and BSL_HostDescriptors_t::user_data.
Referenced by BSLP_PolicyPredicate_IsMatch().
|
static |
Definition at line 29 of file HostInterface.c.