BSL v0.0.0 - 0.g33cf081
AMMOS Bundle Protocol Security Library (BSL)
Loading...
Searching...
No Matches
SecResult.c File Reference

Implementation of a RFC9172 Result. More...

#include "SecResult.h"
+ Include dependency graph for SecResult.c:

Functions

void BSL_SecResult_Init (BSL_SecResult_t *self)
 Initialize to a default empty state.
 
void BSL_SecResult_InitSet (BSL_SecResult_t *self, const BSL_SecResult_t *src)
 Initialize to a copy of another value.
 
void BSL_SecResult_Deinit (BSL_SecResult_t *self)
 De-initialize a result.
 
int BSL_SecResult_InitFull (BSL_SecResult_t *self, uint64_t result_id, uint64_t context_id, uint64_t target_block_num, const BSL_Data_t *content)
 Initialize and populate a pre-allocated result.
 
void BSL_SecResult_Set (BSL_SecResult_t *self, const BSL_SecResult_t *src)
 Overwrite with a copy of another value.
 
bool BSL_SecResult_IsConsistent (const BSL_SecResult_t *self)
 Return true when internal invariant checks pass.
 
int BSL_SecResult_GetAsBytestr (const BSL_SecResult_t *self, BSL_Data_t *out)
 Retrieve byte string value of result.
 
size_t BSL_SecResult_Sizeof (void)
 Returns size in bytes of BSL_SecResult_s.
 

Detailed Description

Implementation of a RFC9172 Result.

Function Documentation

◆ BSL_SecResult_Deinit()

void BSL_SecResult_Deinit ( BSL_SecResult_t *  self)

De-initialize a result.

Parameters
[in,out]selfThe object to deinitialize.

Referenced by BSL_AbsSecBlock_DecodeFromCBOR().

◆ BSL_SecResult_GetAsBytestr()

int BSL_SecResult_GetAsBytestr ( const BSL_SecResult_t *  self,
BSL_Data_t out 
)

Retrieve byte string value of result.

Todo:
Clarify whether result contains copy or view of content
Parameters
[in]selfThis Security Parameter
[out]outPointer to data struct which will be made a view onto this parameter value.
Returns
Negative on error.

References BSL_Data_InitView(), and BSL_SecResult_IsConsistent().

Referenced by BSL_AbsSecBlock_EncodeToCBOR(), test_RFC9173_AppendixA_Example1_BIB_Source(), and test_RFC9173_AppendixA_Example2_BCB_Source().

◆ BSL_SecResult_Init()

void BSL_SecResult_Init ( BSL_SecResult_t *  self)

Initialize to a default empty state.

Parameters
[out]selfThe object to initialize.

Referenced by BSL_SecResult_InitSet().

◆ BSL_SecResult_InitFull()

int BSL_SecResult_InitFull ( BSL_SecResult_t *  self,
uint64_t  result_id,
uint64_t  context_id,
uint64_t  target_block_num,
const BSL_Data_t content 
)

Initialize and populate a pre-allocated result.

Parameters
[out]selfNon-NULL pointer to uninitialized result.
[in]result_idResult ID of corresponding result bytestring, meaning dependent on security context.
[in]context_idID of security context.
[in]target_block_numTarget of the given security result, included here for convenience.
[in]contentRead-only view to data containing the bytes of the security result, which is copied out of here.
Returns
0 on success, negative on error

References BSL_SecResult_IsConsistent(), BSL_SUCCESS, BSL_Data_t::len, and BSL_Data_t::ptr.

Referenced by BSL_AbsSecBlock_DecodeFromCBOR().

◆ BSL_SecResult_InitSet()

void BSL_SecResult_InitSet ( BSL_SecResult_t *  self,
const BSL_SecResult_t *  src 
)

Initialize to a copy of another value.

Parameters
[out]selfThe object to initialize.
[in]srcThe source of the copy.

References BSL_SecResult_Init(), and BSL_SecResult_Set().

◆ BSL_SecResult_IsConsistent()

bool BSL_SecResult_IsConsistent ( const BSL_SecResult_t *  self)

Return true when internal invariant checks pass.

Parameters
selfThis security result

Referenced by BSL_SecOutcome_AppendResult(), BSL_SecResult_GetAsBytestr(), and BSL_SecResult_InitFull().

◆ BSL_SecResult_Set()

void BSL_SecResult_Set ( BSL_SecResult_t *  self,
const BSL_SecResult_t *  src 
)

Overwrite with a copy of another value.

Parameters
[in,out]selfThe object to overwrite.
[in]srcThe source of the copy.

Referenced by BSL_SecResult_InitSet().