24#include "mock_bpa_ctr.h"
28static const size_t SMALLBUF_SIZE = 1024;
69 for (
size_t i = 0; i < bundle->block_count; i++)
71 free(bundle->blocks[i].btsd);
75 QCBORDecodeContext decoder;
76 QCBORDecode_Init(&decoder, (UsefulBufC) { ctr->
encoded.
ptr, ctr->
encoded.
len }, QCBOR_DECODE_MODE_NORMAL);
81 if (QCBORDecode_Finish(&decoder))
95 QCBOREncodeContext encoder;
98 uint8_t smallbuf[SMALLBUF_SIZE];
99 QCBOREncode_Init(&encoder, (UsefulBuf) { smallbuf,
sizeof(smallbuf) });
105 if (QCBOR_SUCCESS != QCBOREncode_FinishGetSize(&encoder, &needlen))
110 if (needlen < SMALLBUF_SIZE)
129 if (QCBOR_SUCCESS != QCBOREncode_Finish(&encoder, &
final))
Single entry-point include file for all of the BPSec Lib (BSL) frontend API.
#define CHKVOID(cond)
Return from void functions if condition fails.
#define BSL_LOG_INFO(...)
This is an overloaded member function, provided for convenience. It differs from the above function o...
#define CHKERR1(cond)
Return the error value 1 if condition fails.
int BSL_Data_Resize(BSL_Data_t *data, size_t len)
Resize the data, copying if necessary.
void BSL_Data_InitMove(BSL_Data_t *data, BSL_Data_t *src)
This is an overloaded member function, provided for convenience. It differs from the above function o...
int BSL_Data_Deinit(BSL_Data_t *data)
De-initialize a data struct, freeing if necessary.
int BSL_Data_CopyFrom(BSL_Data_t *data, size_t len, BSL_DataConstPtr_t src)
Set an initialized data struct to a given size.
int BSL_Data_Init(BSL_Data_t *data)
Initialize an empty data struct.
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 o...
Declarations for bundle and block decoding.
int bsl_mock_encode_bundle(QCBOREncodeContext *enc, const MockBPA_Bundle_t *bundle)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Declarations for bundle and block encoding.
void * data
Opaque pointer, not used by the BSL.
size_t len
Size of the data buffer.
BSL_DataPtr_t ptr
Pointer to the front of the buffer.
Concrete definition of library context.
A container for encoded and decoded bundle data.
BSL_Data_t encoded
Encoded PDU.
BSL_BundleRef_t bundle_ref
The decoded bundle.