|
BSL v1.0.0 - 16.g9d98179
AMMOS Bundle Protocol Security Library (BSL)
|
Definitions for bundle and block decoding. More...
#include "decode.h"#include "agent.h"#include "crc.h"#include <BPSecLib_Public.h>#include <BPSecLib_Private.h>#include <qcbor/qcbor_spiffy_decode.h>
Include dependency graph for decode.c:Functions | |
| int | bsl_mock_decode_eid (const BSL_Data_t *encoded_bytes, BSL_HostEID_t *eid) |
| Decode a single EID. | |
| int | bsl_mock_decode_eid_from_ctx (QCBORDecodeContext *dec, BSL_HostEID_t *eid) |
| Decode a single EID from a QCBOR Decode Context. | |
| int | bsl_mock_decode_primary (QCBORDecodeContext *dec, MockBPA_PrimaryBlock_t *blk) |
| Encode primary block to a CBOR bytestring. | |
| int | bsl_mock_decode_canonical (QCBORDecodeContext *dec, MockBPA_CanonicalBlock_t *blk) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| int | bsl_mock_decode_bundle (QCBORDecodeContext *dec, MockBPA_Bundle_t *bundle) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
Definitions for bundle and block decoding.
| int bsl_mock_decode_bundle | ( | QCBORDecodeContext * | dec, |
| MockBPA_Bundle_t * | bundle | ||
| ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
References MockBPA_CanonicalBlock_t::blk_num, MockBPA_Bundle_t::blocks, MockBPA_Bundle_t::blocks_num, BSL_CHKERR1, BSL_LOG_DEBUG, BSL_LOG_ERR, BSL_LOG_WARNING, bsl_mock_decode_canonical(), bsl_mock_decode_primary(), and MockBPA_Bundle_t::primary_block.
Referenced by LLVMFuzzerTestOneInput(), mock_bpa_decode(), and test_bsl_loopback_bundle().
| int bsl_mock_decode_canonical | ( | QCBORDecodeContext * | dec, |
| MockBPA_CanonicalBlock_t * | blk | ||
| ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
References ASSERT_ARG_NONNULL, MockBPA_CanonicalBlock_t::blk_num, MockBPA_CanonicalBlock_t::blk_type, BSL_BUNDLECRCTYPE_16, BSL_BUNDLECRCTYPE_32, BSL_CHKERR1, BSL_free(), BSL_malloc(), MockBPA_CanonicalBlock_t::btsd, MockBPA_CanonicalBlock_t::btsd_len, MockBPA_CanonicalBlock_t::crc_type, MockBPA_CanonicalBlock_t::flags, and mock_bpa_crc_check().
Referenced by bsl_mock_decode_bundle().
| int bsl_mock_decode_eid | ( | const BSL_Data_t * | encoded_bytes, |
| BSL_HostEID_t * | eid | ||
| ) |
Decode a single EID.
Matches the signature for the BSL_HostDescriptors_t::eid_from_cbor function.
| [in] | dec | The encoded bytes to be decoded. |
| [in,out] | eid | The EID value. The struct must already be initialized. |
References bsl_mock_eid_t::as_ipn, bsl_mock_eid_t::as_raw, ASSERT_ARG_NONNULL, bsl_eid_ipn_ssp_t::auth_num, BSL_Data_CopyFrom(), BSL_Data_Init(), bsl_mock_eid_deinit(), bsl_mock_eid_init(), BSL_MOCK_EID_IPN, buf, BSL_HostEID_t::handle, BSL_Data_t::len, bsl_eid_ipn_ssp_t::ncomp, bsl_eid_ipn_ssp_t::node_num, BSL_Data_t::ptr, bsl_mock_eid_t::scheme, bsl_mock_eid_t::ssp, and bsl_eid_ipn_ssp_t::svc_num.
Referenced by bsl_mock_decode_eid_from_ctx(), and MockBPA_Agent_Descriptors().
| int bsl_mock_decode_eid_from_ctx | ( | QCBORDecodeContext * | dec, |
| BSL_HostEID_t * | eid | ||
| ) |
Decode a single EID from a QCBOR Decode Context.
| [in] | dec | QCBOR Decode Context. |
| [in,out] | eid | The EID Value. |
References BSL_Data_Deinit(), BSL_Data_InitView(), bsl_mock_decode_eid(), and BSL_Data_t::len.
Referenced by bsl_mock_decode_primary(), and test_bsl_loopback_eid().
| int bsl_mock_decode_primary | ( | QCBORDecodeContext * | dec, |
| MockBPA_PrimaryBlock_t * | blk | ||
| ) |
Encode primary block to a CBOR bytestring.
| [in] | dec | The decoder. |
| [in,out] | blk | The primary block structure to decode into. The struct must already be initialized. |
References MockBPA_PrimaryBlock_t::adu_length, BSL_BUNDLE_IS_FRAGMENT, BSL_BUNDLECRCTYPE_16, BSL_BUNDLECRCTYPE_32, BSL_CHKERR1, BSL_Data_InitBuffer(), bsl_mock_decode_eid_from_ctx(), buf, MockBPA_CreationTimestamp_t::bundle_creation_time, MockBPA_PrimaryBlock_t::crc_type, MockBPA_PrimaryBlock_t::dest_eid, MockBPA_PrimaryBlock_t::encoded, MockBPA_PrimaryBlock_t::flags, MockBPA_PrimaryBlock_t::frag_offset, BSL_Data_t::len, MockBPA_PrimaryBlock_t::lifetime, mock_bpa_crc_check(), MockBPA_EID_Init(), BSL_Data_t::ptr, MockBPA_PrimaryBlock_t::report_to_eid, MockBPA_CreationTimestamp_t::seq_num, MockBPA_PrimaryBlock_t::src_node_id, MockBPA_PrimaryBlock_t::timestamp, and MockBPA_PrimaryBlock_t::version.
Referenced by bsl_mock_decode_bundle().