53 HostDescriptorTable = desc;
59 CHK_ARG_NONNULL(bundle);
60 CHK_ARG_NONNULL(result_primary_block);
64 memset(result_primary_block, 0,
sizeof(*result_primary_block));
72 CHK_ARG_NONNULL(bundle);
73 CHK_ARG_NONNULL(result_block);
74 CHK_ARG_EXPR(block_num > 0);
77 memset(result_block, 0,
sizeof(*result_block));
78 int result = HostDescriptorTable.
block_metadata_fn(bundle, block_num, result_block);
85 CHK_ARG_NONNULL(bundle);
86 CHK_ARG_EXPR(array_count > 0);
87 CHK_ARG_NONNULL(block_ids_array);
88 CHK_ARG_NONNULL(result_count);
92 int returncode = HostDescriptorTable.
bundle_get_block_ids(bundle, array_count, block_ids_array, result_count);
98 CHK_ARG_NONNULL(bundle);
99 CHK_ARG_EXPR(block_type_code > 0);
100 CHK_ARG_NONNULL(block_num);
104 int result = HostDescriptorTable.
block_create_fn(bundle, block_type_code, block_num);
110 CHK_ARG_NONNULL(bundle);
111 CHK_ARG_EXPR(block_num > 0);
119 CHK_ARG_NONNULL(bundle);
120 CHK_ARG_EXPR(block_num > 0);
121 CHK_ARG_EXPR(bytesize > 0);
129 ASSERT_ARG_NONNULL(desc);
130 *desc = HostDescriptorTable;
135 CHK_ARG_NONNULL(eid);
136 CHK_PRECONDITION(HostDescriptorTable.
eid_init != NULL);
142 ASSERT_ARG_NONNULL(eid);
143 ASSERT_PRECONDITION(HostDescriptorTable.
eid_deinit != NULL);
149 CHK_ARG_NONNULL(eid);
156 CHK_ARG_NONNULL(eid);
157 CHK_ARG_NONNULL(user_data);
158 return HostDescriptorTable.
eid_to_cbor(user_data, eid);
163 CHK_ARG_NONNULL(eid);
164 CHK_ARG_NONNULL(decoder);
166 CHK_PRECONDITION(eid->
handle != NULL);
173 CHK_ARG_NONNULL(eid);
174 CHK_ARG_NONNULL(text);
177 CHK_PRECONDITION(strlen(text) < 100);
185 CHK_ARG_NONNULL(pat);
192 ASSERT_ARG_NONNULL(pat);
198 CHK_ARG_NONNULL(pat);
199 CHK_ARG_NONNULL(text);
200 CHK_ARG_EXPR(strlen(text) < 100);
207 ASSERT_ARG_NONNULL(pat);
208 ASSERT_ARG_NONNULL(eid);
Single entry-point include file for all of the BPSec Lib (BSL) frontend API.
@ BSL_SUCCESS
Placeholder for non-error code.
@ BSL_ERR_HOST_CALLBACK_FAILED
Callback to the host BPA returned a non-zero code.
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_Host_GetSecSrcEID(BSL_HostEID_t *eid)
Get the local EID used when this node is a security source.
int BSL_HostDescriptors_Set(BSL_HostDescriptors_t desc)
Set the BPA descriptor (callbacks) for this process.
int BSL_HostEID_DecodeFromCBOR(BSL_HostEID_t *eid, void *decoder)
Load an EID from CBOR.
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....
int BSL_HostEID_EncodeToCBOR(const BSL_HostEID_t *eid, void *user_data)
Encode a EID into a CBOR sequence.
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.
void BSL_HostDescriptors_Get(BSL_HostDescriptors_t *desc)
Copy the BPA descriptor for this process.
bool BSL_HostEIDPattern_IsMatch(const BSL_HostEIDPattern_t *pat, const BSL_HostEID_t *eid)
Determine if an EID Pattern matches a specific EID.
void BSL_HostEIDPattern_Deinit(BSL_HostEIDPattern_t *pat)
De-initialize an abstract EID Pattern.
int BSL_HostEID_Init(BSL_HostEID_t *eid)
Initialize an abstract EID.
int BSL_HostEIDPattern_Init(BSL_HostEIDPattern_t *pat)
Initialize an abstract EID Pattern.
int BSL_HostEID_DecodeFromText(BSL_HostEID_t *eid, const char *text)
Decode an EID from its text form.
int BSL_HostEIDPattern_DecodeFromText(BSL_HostEIDPattern_t *pat, const char *text)
Decode an EID Pattern from its text form.
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.
int BSL_BundleCtx_RemoveBlock(BSL_BundleRef_t *bundle, uint64_t block_num)
Requests the removal of a block from a bundle.
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.
void BSL_HostEID_Deinit(BSL_HostEID_t *eid)
De-initialize an abstract EID.
Reference to a Bundle owned and stored in the host BPA.
Structure containing parsed Canonical Block fields.
int(* block_remove_fn)(BSL_BundleRef_t *bundle_ref, uint64_t block_num)
Host BPA function to remove a given canonical block from the bundle.
void(* eidpat_deinit)(BSL_HostEIDPattern_t *pat, void *user_data)
Host BPA function to deinit an EID pattern type.
int(* block_create_fn)(BSL_BundleRef_t *bundle_ref, uint64_t block_type_code, uint64_t *result_block_num)
Host BPA function to create a new canonical block with the given type, returning result in the output...
int(* block_metadata_fn)(const BSL_BundleRef_t *bundle_ref, uint64_t block_num, BSL_CanonicalBlock_t *result_block)
Host BPA function to populate a Canonical Block struct for a given block number.
int(* eid_to_cbor)(void *encoder, const BSL_HostEID_t *eid)
Host BPA function to encode an EID to CBOR.
int(* block_realloc_btsd_fn)(BSL_BundleRef_t *bundle_ref, uint64_t block_num, size_t bytesize)
Host BPA function to reallocate a canonical block's BTSD, keeping existing data in-place.
int(* eid_init)(void *user_data, BSL_HostEID_t *result)
Host BPA function to initialize/allocate an EID type.
int(* get_host_eid_fn)(const void *user_data, BSL_HostEID_t *result)
Host BPA function to get its current EID.
int(* eidpat_from_text)(BSL_HostEIDPattern_t *pat, const char *text, void *user_data)
Host BPA function to parse an EID pattern from a C-string.
int(* bundle_get_block_ids)(const BSL_BundleRef_t *bundle_ref, size_t array_count, uint64_t array_block_ids[array_count], size_t *result_count)
Host BPA function to populate a pre-allocated array with canonical block IDs.
int(* eid_from_cbor)(void *encoder, BSL_HostEID_t *eid)
Host BPA function to decode an EID from a CBOR context.
int(* eid_from_text)(BSL_HostEID_t *eid, const char *text, void *user_data)
Host BPA function to parse an EID from a C-string.
void(* eid_deinit)(void *user_data, BSL_HostEID_t *eid)
Host BPA function to deinit/free an EID type.
int(* bundle_metadata_fn)(const BSL_BundleRef_t *bundle_ref, BSL_PrimaryBlock_t *result_primary_block)
Host BPA function to populate a Primary Block struct.
bool(* eidpat_match)(const BSL_HostEIDPattern_t *pat, const BSL_HostEID_t *eid, void *user_data)
Host BPA function that returns true if the given EID matched an EID pattern.
void * user_data
User data pointer for callbacks.
int(* eidpat_init)(BSL_HostEIDPattern_t *pat, void *user_data)
Host BPA function to initialize an EID pattern type.
Reference to a EID pattern owned and stored in the BPA.
Opaque pointer to BPA-specific Endpoint ID storage.
void * handle
Opaque pointer for BPA backend to use.
Contains Bundle Primary Block fields and metadata.