|
BSL v1.1.1 - 19.g31939de
AMMOS Bundle Protocol Security Library (BSL)
|
Definition of an (id, value) pair container. More...
#include "IdValPair.h"
Include dependency graph for IdValPair.c:Functions | |
| size_t | BSL_IdValPair_Sizeof (void) |
| Return size of BSL_IdValPair_s struct type. | |
| void | BSL_IdValPair_Init (BSL_IdValPair_t *self) |
| Initialize to a default empty state. | |
| void | BSL_IdValPair_InitSet (BSL_IdValPair_t *self, const BSL_IdValPair_t *src) |
| Initialize to a copy of another value. | |
| void | BSL_IdValPair_Deinit (BSL_IdValPair_t *self) |
| De-initialize a parameter. | |
| void | BSL_IdValPair_Set (BSL_IdValPair_t *self, const BSL_IdValPair_t *src) |
| Overwrite with a copy of another value. | |
| void | BSL_IdValPair_Move (BSL_IdValPair_t *self, BSL_IdValPair_t *src) |
| Move from another value. | |
| void | BSL_IdValPair_SetTextstr (BSL_IdValPair_t *self, uint64_t param_id, const char *value) |
| Initialize as a parameter containing a byte string with a null-terminated text value. | |
| bool | BSL_IdValPair_IsTextstr (const BSL_IdValPair_t *self) |
| Returns true when the value type is a text string. | |
| void | BSL_IdValPair_SetBytestr (BSL_IdValPair_t *self, uint64_t param_id, BSL_Data_t value) |
| Initialize as a parameter containing a bytestring. | |
| void | BSL_IdValPair_SetInt64 (BSL_IdValPair_t *self, uint64_t param_id, uint64_t value) |
| Set to an signed integer value. | |
| bool | BSL_IdValPair_IsInt64 (const BSL_IdValPair_t *self) |
| Returns true when the value type is an integer. | |
| int | BSL_IdValPair_GetAsInt64 (const BSL_IdValPair_t *self, int64_t *out) |
| Retrieve integer value of result when this result type is integer. | |
| bool | BSL_IdValPair_IsBytestr (const BSL_IdValPair_t *self) |
| Returns true when the value type is a byte string. | |
| int | BSL_IdValPair_GetAsBytestr (const BSL_IdValPair_t *self, BSL_Data_t *out) |
| Retrieve byte string value of a parameter. | |
| int | BSL_IdValPair_GetAsTextstr (const BSL_IdValPair_t *self, const char **out) |
| Retrieve bytestring value of result when security parameter type is bytestring. | |
| void | BSL_IdValPair_SetRaw (BSL_IdValPair_t *self, uint64_t param_id, const void *ptr, size_t len) |
| Initialize as a parameter containing raw encoded content. | |
| uint64_t | BSL_IdValPair_GetId (const BSL_IdValPair_t *self) |
| Get parameter ID of this param. | |
| bool | BSL_IdValPair_IsConsistent (const BSL_IdValPair_t *self) |
| Return true if invariant conditions pass. | |
Definition of an (id, value) pair container.
| void BSL_IdValPair_Deinit | ( | BSL_IdValPair_t * | self | ) |
De-initialize a parameter.
| [in,out] | self | The object to deinitialize. |
References ASSERT_ARG_NONNULL, BSL_IDVALPAIR_TYPE_BYTESTR, BSL_IDVALPAIR_TYPE_INT64, BSL_IDVALPAIR_TYPE_RAW, BSL_IDVALPAIR_TYPE_TEXTSTR, and BSL_IDVALPAIR_TYPE_UNKNOWN.
Referenced by _tearDown(), BCBTestContext_Deinit(), BIBTestContext_Deinit(), BSL_IdValPair_Move(), BSL_IdValPair_Set(), BSL_IdValPair_SetBytestr(), BSL_IdValPair_SetInt64(), BSL_IdValPair_SetRaw(), BSL_IdValPair_SetTextstr(), BSLP_InitParams_Deinit(), PublicInterfaceTestCtx_deinit(), and test_SecurityContext_BIB_Verifier_Failure().
| int BSL_IdValPair_GetAsBytestr | ( | const BSL_IdValPair_t * | self, |
| BSL_Data_t * | out | ||
| ) |
Retrieve byte string value of a parameter.
| [in] | self | This Security Parameter |
| [out] | out | Pointer to optional struct which will be made a view onto this parameter value. That view must not outlive this pair instance. |
References BSL_Data_InitView(), BSL_IdValPair_IsConsistent(), BSL_IDVALPAIR_TYPE_BYTESTR, BSL_SUCCESS, CHK_PRECONDITION, and CHK_PROPERTY.
Referenced by BSL_IdValPair_Encode(), BSL_IdValPair_Print(), BSLX_BCB_Execute(), BSLX_BCB_GetOptions(), BSLX_BIB_Execute(), BSLX_BIB_InitFromSecOper(), test_RFC9173_AppendixA_Example1_BIB_Source(), test_RFC9173_AppendixA_Example2_BCB_Source(), and test_sec_source_keywrap().
| int BSL_IdValPair_GetAsInt64 | ( | const BSL_IdValPair_t * | self, |
| int64_t * | out | ||
| ) |
Retrieve integer value of result when this result type is integer.
| [in] | self | This Security Parameter |
| [out] | out | The optional value |
References ASSERT_ARG_NONNULL, ASSERT_PRECONDITION, BSL_IDVALPAIR_TYPE_INT64, and BSL_SUCCESS.
Referenced by BSL_IdValPair_Encode(), BSLX_BCB_Execute(), BSLX_BCB_GetOptions(), BSLX_BIB_Execute(), and BSLX_BIB_InitFromSecOper().
| int BSL_IdValPair_GetAsTextstr | ( | const BSL_IdValPair_t * | self, |
| const char ** | out | ||
| ) |
Retrieve bytestring value of result when security parameter type is bytestring.
| [in] | self | This Security Parameter |
| [in,out] | out | Pointer to optional string pointer for view onto this parameter value. |
References BSL_IdValPair_IsConsistent(), BSL_IDVALPAIR_TYPE_TEXTSTR, BSL_SUCCESS, CHK_PRECONDITION, and CHK_PROPERTY.
Referenced by BSL_IdValPair_Print(), BSLX_BCB_GetOptions(), and BSLX_BIB_InitFromSecOper().
| uint64_t BSL_IdValPair_GetId | ( | const BSL_IdValPair_t * | self | ) |
Get parameter ID of this param.
| [in] | self | This BPSec Param type |
References ASSERT_PRECONDITION, and BSL_IdValPair_IsConsistent().
Referenced by BSLX_BCB_GetOptions(), BSLX_BIB_InitFromSecOper(), and test_SecurityContext_BIB_Verifier_Failure().
| void BSL_IdValPair_Init | ( | BSL_IdValPair_t * | self | ) |
Initialize to a default empty state.
| [out] | self | The object to initialize. |
References ASSERT_ARG_NONNULL, and BSL_IDVALPAIR_TYPE_UNKNOWN.
Referenced by _setUp(), BCBTestContext_Init(), BIBTestContext_Init(), BSL_IdValPair_InitSet(), BSL_TestUtils_GetRFC9173_A1Params(), BSLP_InitParams_Init(), and PublicInterfaceTestCtx_init().
| void BSL_IdValPair_InitSet | ( | BSL_IdValPair_t * | self, |
| const BSL_IdValPair_t * | src | ||
| ) |
Initialize to a copy of another value.
| [out] | self | The object to initialize. |
| [in] | src | The source of the copy. |
References BSL_IdValPair_Init(), and BSL_IdValPair_Set().
| bool BSL_IdValPair_IsBytestr | ( | const BSL_IdValPair_t * | self | ) |
Returns true when the value type is a byte string.
| [in] | self | This Security Parameter |
References BSL_IDVALPAIR_TYPE_BYTESTR, and CHK_AS_BOOL.
Referenced by BSL_IdValPair_Encode(), BSL_IdValPair_Print(), and BSLX_BIB_Execute().
| bool BSL_IdValPair_IsConsistent | ( | const BSL_IdValPair_t * | self | ) |
Return true if invariant conditions pass.
| [in] | self | This security parameter |
References BSL_IDVALPAIR_TYPE_TEXTSTR, BSL_IDVALPAIR_TYPE_UNKNOWN, and CHK_AS_BOOL.
Referenced by BSL_IdValPair_GetAsBytestr(), BSL_IdValPair_GetAsTextstr(), BSL_IdValPair_GetId(), BSL_SecOper_AppendOption(), and BSL_SecOper_AppendParam().
| bool BSL_IdValPair_IsInt64 | ( | const BSL_IdValPair_t * | self | ) |
Returns true when the value type is an integer.
| [in] | self | This Security Parameter |
References BSL_IDVALPAIR_TYPE_INT64, and CHK_AS_BOOL.
Referenced by BSL_IdValPair_Encode(), and BSL_IdValPair_Print().
| bool BSL_IdValPair_IsTextstr | ( | const BSL_IdValPair_t * | self | ) |
Returns true when the value type is a text string.
| [in] | self | This Security Parameter |
References BSL_IDVALPAIR_TYPE_TEXTSTR, and CHK_AS_BOOL.
Referenced by BSL_IdValPair_Print().
| void BSL_IdValPair_Move | ( | BSL_IdValPair_t * | self, |
| BSL_IdValPair_t * | src | ||
| ) |
Move from another value.
The other value is left deinitialized.
| [in,out] | self | The object to overwrite. |
| [in] | src | The source of the copy. |
References ASSERT_ARG_NONNULL, BSL_IdValPair_Deinit(), BSL_IDVALPAIR_TYPE_BYTESTR, BSL_IDVALPAIR_TYPE_INT64, BSL_IDVALPAIR_TYPE_RAW, BSL_IDVALPAIR_TYPE_TEXTSTR, and BSL_IDVALPAIR_TYPE_UNKNOWN.
Referenced by test_MultiplePolicyProviders(), and test_PolicyProvider_Inspect_RFC9173_BIB().
| void BSL_IdValPair_Set | ( | BSL_IdValPair_t * | self, |
| const BSL_IdValPair_t * | src | ||
| ) |
Overwrite with a copy of another value.
| [in,out] | self | The object to overwrite. |
| [in] | src | The source of the copy. |
References ASSERT_ARG_NONNULL, BSL_IdValPair_Deinit(), BSL_IDVALPAIR_TYPE_BYTESTR, BSL_IDVALPAIR_TYPE_INT64, BSL_IDVALPAIR_TYPE_RAW, BSL_IDVALPAIR_TYPE_TEXTSTR, and BSL_IDVALPAIR_TYPE_UNKNOWN.
Referenced by _setUp(), BSL_IdValPair_InitSet(), BSLP_RegisterPolicyFromBitstring(), BSLP_RegisterPolicyFromJSON(), and setUp().
| void BSL_IdValPair_SetBytestr | ( | BSL_IdValPair_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 ASSERT_ARG_NONNULL, BSL_IdValPair_Deinit(), BSL_IDVALPAIR_TYPE_BYTESTR, BSL_Data_t::len, and BSL_Data_t::ptr.
Referenced by BSL_IdValPair_Decode(), BSLX_BCB_Execute(), BSLX_BIB_Execute(), and setUp().
| void BSL_IdValPair_SetInt64 | ( | BSL_IdValPair_t * | self, |
| uint64_t | param_id, | ||
| uint64_t | value | ||
| ) |
Set to an signed integer value.
| [in,out] | self | This Security Parameter |
| [in] | param_id | ID of the parameter |
| [in] | value | The value to use. |
References ASSERT_ARG_NONNULL, BSL_IdValPair_Deinit(), and BSL_IDVALPAIR_TYPE_INT64.
Referenced by _setUp(), BSL_IdValPair_Decode(), BSL_TestUtils_GetRFC9173_A1Params(), BSL_TestUtils_InitBCB_Appendix2(), BSL_TestUtils_InitBIB_AppendixA1(), BSLP_RegisterPolicyFromBitstring(), BSLP_RegisterPolicyFromJSON(), BSLX_BCB_Execute(), BSLX_BIB_Execute(), setUp(), test_RFC9173_AppendixA_Example3_Acceptor(), test_RFC9173_AppendixA_Example3_Source(), test_RFC9173_AppendixA_Example4_Acceptor(), test_RFC9173_AppendixA_Example4_Source(), test_sec_accept_keyunwrap(), and test_sec_source_keywrap().
| void BSL_IdValPair_SetRaw | ( | BSL_IdValPair_t * | self, |
| uint64_t | param_id, | ||
| const void * | ptr, | ||
| size_t | len | ||
| ) |
Initialize as a parameter containing raw encoded content.
| [in,out] | self | This Security Parameter |
| [in] | param_id | ID of the parameter |
| [in] | ptr | The stat of the data. |
| len | The length to copy. |
References ASSERT_ARG_NONNULL, BSL_IdValPair_Deinit(), and BSL_IDVALPAIR_TYPE_RAW.
Referenced by BSL_IdValPair_Decode().
| void BSL_IdValPair_SetTextstr | ( | BSL_IdValPair_t * | self, |
| uint64_t | param_id, | ||
| const char * | value | ||
| ) |
Initialize as a parameter containing a byte string with a null-terminated text 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 ASSERT_ARG_NONNULL, BSL_IdValPair_Deinit(), and BSL_IDVALPAIR_TYPE_TEXTSTR.
Referenced by _setUp(), BSL_TestUtils_GetRFC9173_A1Params(), BSL_TestUtils_InitBCB_Appendix2(), BSL_TestUtils_InitBIB_AppendixA1(), BSLP_RegisterPolicyFromBitstring(), BSLP_RegisterPolicyFromJSON(), setUp(), test_RFC9173_AppendixA_Example3_Acceptor(), test_RFC9173_AppendixA_Example3_Source(), test_RFC9173_AppendixA_Example4_Acceptor(), test_RFC9173_AppendixA_Example4_Source(), test_sec_accept_keyunwrap(), test_sec_source_keywrap(), and test_SecurityContext_BIB_Verifier_Failure().
| size_t BSL_IdValPair_Sizeof | ( | void | ) |
Return size of BSL_IdValPair_s struct type.
Referenced by BSLP_InitParams_Init().