BSL v0.0.0
AMMOS Bundle Protocol Security Library (BSL)
|
Implementation of a RFC9172 Parameter. More...
#include "SecParam.h"
Go to the source code of this file.
Functions | |
size_t | BSL_SecParam_Sizeof (void) |
Return size of BSL_SecParam_t struct type. | |
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 paramter. | |
Implementation of a RFC9172 Parameter.
Definition in file SecParam.c.
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.
self | This Security Parameter |
result | Pointer to pre-allocated data into which the bytestring is copied. |
Definition at line 77 of file SecParam.c.
References BSL_SecParam_s::_bytelen, BSL_SecParam_s::_bytes, BSL_Data_InitView(), and BSL_SecParam_IsConsistent().
Referenced by BSLX_BIB_InitFromSecOper().
uint64_t BSL_SecParam_GetAsUInt64 | ( | const BSL_SecParam_t * | self | ) |
Retrieve integer value of result when this result type is integer.
WARNING: Always check using BSL_SecParam_IsInt64 first.
self | This Security Parameter |
Definition at line 69 of file SecParam.c.
References BSL_SecParam_s::_type, BSL_SecParam_s::_uint_value, and BSL_SECPARAM_TYPE_INT64.
Referenced by 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 |
Definition at line 85 of file SecParam.c.
References BSL_SecParam_IsConsistent(), and BSL_SecParam_s::param_id.
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.
self[in,out] | This Security Paramter |
param_id[in] | ID of the parameter |
value[in] | View of bytes, which get copied into this Security Parameter. |
Definition at line 34 of file SecParam.c.
References BSL_SecParam_s::_bytelen, BSL_SecParam_s::_bytes, BSL_SecParam_s::_type, BSL_SECPARAM_TYPE_BYTESTR, BSL_SUCCESS, BSL_Data_s::len, BSL_SecParam_s::param_id, and BSL_Data_s::ptr.
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.
self | This Security Paramter |
param_id | ID of the parameter |
value | View of bytes, which get copied into this Security Parameter. |
Definition at line 51 of file SecParam.c.
References BSL_SecParam_s::_type, BSL_SecParam_s::_uint_value, BSL_SECPARAM_TYPE_INT64, BSL_SUCCESS, and BSL_SecParam_s::param_id.
bool BSL_SecParam_IsConsistent | ( | const BSL_SecParam_t * | self | ) |
Return true if invariant conditions pass.
self | This security parameter |
Definition at line 92 of file SecParam.c.
References BSL_SecParam_s::_bytelen, BSL_SecParam_s::_bytes, BSL_SecParam_s::_type, BSL_SecParam_s::_uint_value, BSL_SECPARAM_TYPE_BYTESTR, BSL_SECPARAM_TYPE_INT64, BSL_SECPARAM_TYPE_UNKNOWN, and BSL_SecParam_s::param_id.
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.
self | This Security Parameter |
Definition at line 63 of file SecParam.c.
References BSL_SecParam_s::_type, and BSL_SECPARAM_TYPE_INT64.
Referenced by BSLX_BIB_InitFromSecOper().
bool BSL_SecParam_IsParamIDOutput | ( | uint64_t | param_id | ) |
Indicates true when this parameter is NOT an implementation-specific security paramter.
param_id | ID of the parameter |
Definition at line 111 of file SecParam.c.
References BSL_SECPARAM_TYPE_INT_STARTINDEX.
size_t BSL_SecParam_Sizeof | ( | void | ) |
Return size of BSL_SecParam_t struct type.
Definition at line 29 of file SecParam.c.
Referenced by BSLP_PolicyRule_AddParam(), BSLP_PolicyRule_EvaluateAsSecOper(), and BSLP_PolicyRule_Init().