BSL v0.0.0
AMMOS Bundle Protocol Security Library (BSL)
Loading...
Searching...
No Matches
bsl_mock_bpa.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2025 The Johns Hopkins University Applied Physics
3 * Laboratory LLC.
4 *
5 * This file is part of the Bundle Protocol Security Library (BSL).
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 * This work was performed for the Jet Propulsion Laboratory, California
18 * Institute of Technology, sponsored by the United States Government under
19 * the prime contract 80NM0018D0004 between the Caltech and NASA under
20 * subcontract 1700763.
21 */
22
27#ifndef BSL_MOCK_BPA_H_
28#define BSL_MOCK_BPA_H_
29
30#include <BPSecLib_Public.h>
31#include <BPSecLib_Private.h>
32
33#include <m-deque.h>
34#include <m-dict.h>
35#include <m-string.h>
36
37#include <inttypes.h>
38
39#ifdef __cplusplus
40extern "C" {
41#endif
42
44{
45 uint64_t bundle_creation_time;
46 uint64_t seq_num;
48
50{
51 uint64_t version;
52 uint64_t flags;
53 uint64_t crc_type;
54 BSL_HostEID_t dest_eid;
55 BSL_HostEID_t src_node_id;
56 BSL_HostEID_t report_to_eid;
58 uint64_t lifetime;
59 uint64_t frag_offset;
60 uint64_t adu_length;
61 uint8_t *cbor;
62 size_t cbor_len;
64
66{
67 uint64_t blk_type;
68 uint64_t blk_num;
69 uint64_t flags;
70 uint64_t crc_type;
71 void *btsd;
72 size_t btsd_len;
74
75#define MockBPA_BUNDLE_MAXBLOCKS (10)
76typedef struct MockBPA_Bundle_s
77{
78 uint64_t id;
79 MockBPA_PrimaryBlock_t primary_block;
80 MockBPA_CanonicalBlock_t blocks[MockBPA_BUNDLE_MAXBLOCKS];
81 size_t block_count;
83
84int MockBPA_Bundle_Deinit(MockBPA_Bundle_t *bundle_ref);
85
86int MockBPA_GetBundleMetadata(const BSL_BundleRef_t *bundle_ref, BSL_PrimaryBlock_t *result_primary_block);
87int MockBPA_GetBlockNums(const BSL_BundleRef_t *bundle_ref, size_t block_id_array_capacity,
88 uint64_t block_id_array_result[block_id_array_capacity], size_t *result_count);
89int MockBPA_GetBlockMetadata(const BSL_BundleRef_t *bundle_ref, uint64_t block_num,
90 BSL_CanonicalBlock_t *result_canonical_block);
91int MockBPA_ReallocBTSD(BSL_BundleRef_t *bundle_ref, uint64_t block_num, size_t bytesize);
92int MockBPA_CreateBlock(BSL_BundleRef_t *bundle_ref, uint64_t block_type_code, uint64_t *result_block_num);
93int MockBPA_RemoveBlock(BSL_BundleRef_t *bundle_ref, uint64_t block_num);
94
98int bsl_mock_bpa_init(void);
99
102void bsl_mock_bpa_deinit(void);
103
104#ifdef __cplusplus
105} // extern C
106#endif
107
108#endif // BSL_MOCK_BPA_H_
Single entry-point include file for all of the BPSec Lib (BSL) frontend API.
Single entry-point include file for all of the "Public" BPSec Lib (BSL) frontend API.
void bsl_mock_bpa_deinit(void)
Clean up the mock BPA for the current process.
int bsl_mock_bpa_init(void)
Register this mock BPA for the current process.
Reference to a Bundle owned and stored in the host BPA.
Structure containing parsed Canonical Block fields.
Opaque pointer to BPA-specific Endpoint ID storage.
Contains Bundle Primary Block fields and metadata.