BSL v0.0.0 - 0.geda3e66
AMMOS Bundle Protocol Security Library (BSL)
|
Implementation of a RFC9172 Parameter. More...
#include "SecParam.h"
Functions | |
size_t | BSL_SecParam_Sizeof (void) |
Return size of BSL_SecParam_s struct type. | |
int | BSL_SecParam_InitStr (BSL_SecParam_t *self, uint64_t param_id, const char *value) |
int | BSL_SecParam_InitBytestr (BSL_SecParam_t *self, uint64_t param_id, BSL_Data_t value) |
Initialize as a parameter containing a bytestring. | |
int | BSL_SecParam_InitInt64 (BSL_SecParam_t *self, uint64_t param_id, uint64_t value) |
Initialize as a parameter containing an integer as a value. | |
int | BSL_SecParam_IsInt64 (const BSL_SecParam_t *self) |
Returns true when the value type is an integer. | |
uint64_t | BSL_SecParam_GetAsUInt64 (const BSL_SecParam_t *self) |
Retrieve integer value of result when this result type is integer. | |
int | BSL_SecParam_GetAsBytestr (const BSL_SecParam_t *self, BSL_Data_t *result) |
Retrieve bytestring value of result when security parameter type is bytestring. | |
uint64_t | BSL_SecParam_GetId (const BSL_SecParam_t *self) |
Get parameter ID of this param. | |
bool | BSL_SecParam_IsConsistent (const BSL_SecParam_t *self) |
Return true if invariant conditions pass. | |
bool | BSL_SecParam_IsParamIDOutput (uint64_t param_id) |
Indicates true when this parameter is NOT an implementation-specific security parameter. | |
Implementation of a RFC9172 Parameter.
int BSL_SecParam_GetAsBytestr | ( | const BSL_SecParam_t * | self, |
BSL_Data_t * | result | ||
) |
Retrieve bytestring value of result when security parameter type is bytestring.
WARNING: Always check type before using.
[in] | self | This Security Parameter |
[in,out] | result | Pointer to pre-allocated data into which the bytestring is copied. |
References BSL_Data_InitView(), and BSL_SecParam_IsConsistent().
Referenced by BSL_AbsSecBlock_EncodeToCBOR(), and BSLX_BIB_InitFromSecOper().
uint64_t BSL_SecParam_GetAsUInt64 | ( | const BSL_SecParam_t * | self | ) |
Retrieve integer value of result when this result type is integer.
[in] | self | This Security Parameter |
References BSL_SECPARAM_TYPE_INT64.
Referenced by BSL_AbsSecBlock_EncodeToCBOR(), and BSLX_BIB_InitFromSecOper().
uint64_t BSL_SecParam_GetId | ( | const BSL_SecParam_t * | self | ) |
Get parameter ID of this param.
[in] | self | This BPSec Param type |
References BSL_SecParam_IsConsistent().
Referenced by BSLX_BIB_InitFromSecOper().
int BSL_SecParam_InitBytestr | ( | BSL_SecParam_t * | self, |
uint64_t | param_id, | ||
BSL_Data_t | value | ||
) |
Initialize as a parameter containing a bytestring.
[in,out] | self | This Security Parameter |
[in] | param_id | ID of the parameter |
[in] | value | View of bytes, which get copied into this Security Parameter. |
References BSL_SECPARAM_TYPE_BYTESTR, BSL_SUCCESS, BSL_Data_t::len, and BSL_Data_t::ptr.
Referenced by BSL_AbsSecBlock_DecodeFromCBOR().
int BSL_SecParam_InitInt64 | ( | BSL_SecParam_t * | self, |
uint64_t | param_id, | ||
uint64_t | value | ||
) |
Initialize as a parameter containing an integer as a value.
[in,out] | self | This Security Parameter |
[in] | param_id | ID of the parameter |
[in] | value | View of bytes, which get copied into this Security Parameter. |
References BSL_SECPARAM_TYPE_INT64, and BSL_SUCCESS.
Referenced by BSL_AbsSecBlock_DecodeFromCBOR().
int BSL_SecParam_InitStr | ( | BSL_SecParam_t * | self, |
uint64_t | param_id, | ||
const char * | value | ||
) |
[in,out] | self | This Security Parameter |
[in] | param_id | ID of the parameter |
[in] | value | text string of the parameter, copied into self |
References BSL_SUCCESS.
bool BSL_SecParam_IsConsistent | ( | const BSL_SecParam_t * | self | ) |
Return true if invariant conditions pass.
[in] | self | This security parameter |
References BSL_SECPARAM_TYPE_INT64, and BSL_SECPARAM_TYPE_UNKNOWN.
Referenced by BSL_SecOper_AppendParam(), BSL_SecOutcome_AppendParam(), BSL_SecParam_GetAsBytestr(), BSL_SecParam_GetId(), and BSLP_PolicyRule_AddParam().
int BSL_SecParam_IsInt64 | ( | const BSL_SecParam_t * | self | ) |
Returns true when the value type is an integer.
[in] | self | This Security Parameter |
References BSL_SECPARAM_TYPE_INT64.
Referenced by BSL_AbsSecBlock_EncodeToCBOR(), and BSLX_BIB_InitFromSecOper().
bool BSL_SecParam_IsParamIDOutput | ( | uint64_t | param_id | ) |
Indicates true when this parameter is NOT an implementation-specific security parameter.
param_id | ID of the parameter |
References BSL_SECPARAM_TYPE_INT_STARTINDEX.