BSL v1.0.0 - 3.g740079a
AMMOS Bundle Protocol Security Library (BSL)
Loading...
Searching...
No Matches
decode.c File Reference

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.
 

Detailed Description

Definitions for bundle and block decoding.

Function Documentation

◆ bsl_mock_decode_eid()

int bsl_mock_decode_eid ( const BSL_Data_t encoded_bytes,
BSL_HostEID_t eid 
)

◆ bsl_mock_decode_eid_from_ctx()

int bsl_mock_decode_eid_from_ctx ( QCBORDecodeContext *  dec,
BSL_HostEID_t eid 
)

Decode a single EID from a QCBOR Decode Context.

Parameters
[in]decQCBOR Decode Context.
[in,out]eidThe EID Value.

References BSL_Data_Deinit(), BSL_Data_InitView(), bsl_mock_decode_eid(), and BSL_Data_t::len.

Referenced by bsl_mock_decode_primary().

◆ bsl_mock_decode_primary()

int bsl_mock_decode_primary ( QCBORDecodeContext *  dec,
MockBPA_PrimaryBlock_t blk 
)

Encode primary block to a CBOR bytestring.

Parameters
[in]decThe decoder.
[in,out]blkThe primary block structure to decode into. The struct must already be initialized.
Returns
0 if successful

References BSL_BUNDLE_IS_FRAGMENT, BSL_BUNDLECRCTYPE_16, BSL_BUNDLECRCTYPE_32, BSL_Data_InitBuffer(), bsl_mock_decode_eid_from_ctx(), CHKERR1, MockBPA_PrimaryBlock_t::encoded, BSL_Data_t::len, mock_bpa_crc_check(), MockBPA_EID_Init(), and BSL_Data_t::ptr.

Referenced by bsl_mock_decode_bundle().