├── version.txt ├── .gitignore ├── docs ├── doc-src │ ├── docs-clean │ ├── docs-build │ ├── bplib-public-api.doxyfile.in │ ├── bplib-apiguide.doxyfile.in │ ├── bplib-common.doxyfile.in │ ├── default-settings.doxyfile │ ├── generate-public-api-doxyfile.cmake │ └── bplib_walkthroughs.dox ├── old │ ├── diagrams.odg │ ├── bpv7-prototype.pdf │ ├── dtn-storage-simple.png │ ├── dtn-storage-states.odg │ ├── analysis_ic_c1_flow.png │ ├── analysis_ic_c2_flow.png │ ├── bp_api_architecture.png │ ├── analysis_ic_c1_smooth.png │ ├── analysis_ic_c2_smooth.png │ └── ci │ │ └── mem │ │ ├── pandoc-custom-reference-sddd.docx │ │ └── pandoc-tabloid-reference-sddd.docx ├── NOSA GSC-18318-1_0.pdf ├── GSC_18318_Ind_CLA_form_1219.pdf ├── GSC_18318_Corp_CLA_form_1219.pdf ├── bplib-detaildesign.doxyfile.in └── README.md ├── binding └── lua │ ├── analysis │ └── .gitignore │ ├── test │ ├── ut_unittest.lua │ ├── ut_route.lua │ ├── ut_ipn2eid.lua │ ├── ut_memusage.lua │ ├── ut_attributes.lua │ ├── ut_eid2ipn.lua │ ├── test_runner.lua │ ├── ut_open_close.lua │ ├── ut_active_table.lua │ └── ut_bundle_timeout.lua │ └── lua_bplib.h ├── libabi.version ├── CONTRIBUTING.md ├── bpa ├── ct │ ├── CMakeLists.txt │ ├── src │ │ └── bplib_ct.c │ ├── unit-test │ │ ├── bplib_ct_test.c │ │ ├── utilities │ │ │ ├── bplib_ct_test_utils.c │ │ │ └── bplib_ct_test_utils.h │ │ ├── stubs │ │ │ └── bplib_ct_stubs.c │ │ └── CMakeLists.txt │ └── inc │ │ └── bplib_ct.h ├── pdb │ ├── CMakeLists.txt │ ├── unit-test │ │ ├── utilities │ │ │ ├── bplib_pdb_test_utils.c │ │ │ └── bplib_pdb_test_utils.h │ │ └── CMakeLists.txt │ └── src │ │ └── bplib_pdb.c ├── ebp │ ├── CMakeLists.txt │ ├── inc │ │ └── bplib_ebp.h │ └── unit-test │ │ ├── utilities │ │ ├── bplib_ebp_test_utils.h │ │ └── bplib_ebp_test_utils.c │ │ └── CMakeLists.txt ├── bi │ ├── CMakeLists.txt │ └── unit-test │ │ └── utilities │ │ ├── bplib_bi_test_utils.h │ │ └── bplib_bi_test_utils.c ├── stor │ ├── CMakeLists.txt │ ├── unit-test │ │ └── utilities │ │ │ └── bplib_stor_test_utils.h │ └── inc │ │ └── bplib_stor_sql.h └── pi │ ├── CMakeLists.txt │ └── unit-test │ └── utilities │ └── bplib_pi_test_utils.h ├── aa ├── arp │ ├── CMakeLists.txt │ ├── unit-test │ │ ├── utilities │ │ │ ├── bplib_arp_test_utils.c │ │ │ └── bplib_arp_test_utils.h │ │ ├── CMakeLists.txt │ │ ├── stubs │ │ │ └── bplib_arp_stubs.c │ │ └── bplib_arp_test.c │ └── src │ │ └── bplib_arp.c ├── fwp │ ├── CMakeLists.txt │ └── unit-test │ │ ├── utilities │ │ └── bplib_fwp_test_utils.h │ │ └── stubs │ │ └── bplib_fwp_stubs.c ├── as │ ├── CMakeLists.txt │ └── unit-test │ │ └── stubs │ │ └── bplib_as_handlers.h └── nc │ └── CMakeLists.txt ├── ci ├── eid │ ├── CMakeLists.txt │ └── unit-test │ │ ├── utilities │ │ ├── bplib_eid_test_utils.c │ │ └── bplib_eid_test_utils.h │ │ └── CMakeLists.txt ├── em │ ├── CMakeLists.txt │ ├── unit-test │ │ ├── stubs │ │ │ ├── bplib_em_handlers.h │ │ │ ├── bplib_em_stubs.c │ │ │ └── bplib_em_handlers.c │ │ ├── utilities │ │ │ └── bplib_em_test_utils.h │ │ └── CMakeLists.txt │ └── src │ │ └── bplib_em.c ├── pl │ ├── CMakeLists.txt │ ├── unit-test │ │ ├── utilities │ │ │ ├── bplib_pl_test_utils.c │ │ │ └── bplib_pl_test_utils.h │ │ └── CMakeLists.txt │ └── src │ │ └── bplib_pl.c ├── rbt │ ├── CMakeLists.txt │ └── unit-test │ │ ├── bplib_rbt_test.h │ │ ├── utilities │ │ ├── bplib_rbt_test_utils.c │ │ └── bplib_rbt_test_utils.h │ │ └── CMakeLists.txt ├── crc │ ├── CMakeLists.txt │ └── unit-test │ │ ├── utilities │ │ ├── bplib_crc_test_utils.c │ │ └── bplib_crc_test_utils.h │ │ ├── stubs │ │ └── bplib_crc_stubs.c │ │ └── CMakeLists.txt ├── mem │ ├── CMakeLists.txt │ ├── unit-test │ │ ├── utilities │ │ │ ├── bplib_mem_test_utils.c │ │ │ └── bplib_mem_test_utils.h │ │ └── CMakeLists.txt │ ├── inc │ │ └── bplib_std_allocator.h │ └── src │ │ └── bplib_std_allocator.c ├── time │ ├── CMakeLists.txt │ └── unit-test │ │ ├── stubs │ │ ├── bplib_time_handlers.h │ │ └── bplib_time_handlers.c │ │ └── utilities │ │ └── bplib_time_test_utils.h ├── qm │ ├── unit-test │ │ ├── CMakeLists.txt │ │ └── stubs │ │ │ └── bplib_qm_handlers.h │ └── CMakeLists.txt └── cbor │ ├── CMakeLists.txt │ └── unit-test │ └── utilities │ ├── bplib_cbor_test_utils.h │ └── bplib_cbor_test_utils.c ├── version ├── CMakeLists.txt ├── unit-test │ ├── bplib_version_test.c │ ├── utilities │ │ ├── bplib_version_test_utils.c │ │ └── bplib_version_test_utils.h │ ├── stubs │ │ └── bplib_version_stubs.c │ └── CMakeLists.txt ├── inc │ └── bplib_version.h └── src │ └── bplib_version.c ├── RELEASE.sh ├── .github ├── ISSUE_TEMPLATE │ ├── feature_request.md │ └── bug_report.md ├── workflows │ └── static-analysis.yml ├── actions │ ├── setup-qcbor │ │ └── action.yml │ ├── check-coverage │ │ └── action.yml │ └── setup-osal │ │ └── action.yml └── pull_request_template.md ├── cla ├── CMakeLists.txt └── unit-test │ ├── stubs │ ├── bplib_cla_handlers.h │ └── bplib_cla_handlers.c │ └── utilities │ └── bplib_cla_test_utils.h ├── release.mk ├── app ├── inc │ ├── bpcat_fwp.h │ ├── bpcat_nc.h │ ├── bpcat_cla.h │ ├── bpcat_task.h │ └── bpcat_types.h └── CMakeLists.txt ├── ut-functional ├── CMakeLists.txt └── sanity-test.c ├── posix.mk └── inc └── bplib.h /version.txt: -------------------------------------------------------------------------------- 1 | 0.2.2 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | bp.out 3 | .vscode/ 4 | -------------------------------------------------------------------------------- /docs/doc-src/docs-clean: -------------------------------------------------------------------------------- 1 | rm -rf build 2 | 3 | -------------------------------------------------------------------------------- /binding/lua/analysis/.gitignore: -------------------------------------------------------------------------------- 1 | *.csv* 2 | .ipynb_checkpoints/ 3 | -------------------------------------------------------------------------------- /docs/old/diagrams.odg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nasa/bplib/main/docs/old/diagrams.odg -------------------------------------------------------------------------------- /libabi.version: -------------------------------------------------------------------------------- 1 | CODEABI_0.2.2 2 | { 3 | global: *bplib_*; 4 | local: *; 5 | }; 6 | -------------------------------------------------------------------------------- /docs/NOSA GSC-18318-1_0.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nasa/bplib/main/docs/NOSA GSC-18318-1_0.pdf -------------------------------------------------------------------------------- /docs/doc-src/docs-build: -------------------------------------------------------------------------------- 1 | mkdir -p build 2 | cmake -B build 3 | cd build 4 | make bplib-apiguide 5 | 6 | -------------------------------------------------------------------------------- /docs/old/bpv7-prototype.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nasa/bplib/main/docs/old/bpv7-prototype.pdf -------------------------------------------------------------------------------- /docs/old/dtn-storage-simple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nasa/bplib/main/docs/old/dtn-storage-simple.png -------------------------------------------------------------------------------- /docs/old/dtn-storage-states.odg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nasa/bplib/main/docs/old/dtn-storage-states.odg -------------------------------------------------------------------------------- /docs/old/analysis_ic_c1_flow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nasa/bplib/main/docs/old/analysis_ic_c1_flow.png -------------------------------------------------------------------------------- /docs/old/analysis_ic_c2_flow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nasa/bplib/main/docs/old/analysis_ic_c2_flow.png -------------------------------------------------------------------------------- /docs/old/bp_api_architecture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nasa/bplib/main/docs/old/bp_api_architecture.png -------------------------------------------------------------------------------- /docs/GSC_18318_Ind_CLA_form_1219.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nasa/bplib/main/docs/GSC_18318_Ind_CLA_form_1219.pdf -------------------------------------------------------------------------------- /docs/old/analysis_ic_c1_smooth.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nasa/bplib/main/docs/old/analysis_ic_c1_smooth.png -------------------------------------------------------------------------------- /docs/old/analysis_ic_c2_smooth.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nasa/bplib/main/docs/old/analysis_ic_c2_smooth.png -------------------------------------------------------------------------------- /docs/GSC_18318_Corp_CLA_form_1219.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nasa/bplib/main/docs/GSC_18318_Corp_CLA_form_1219.pdf -------------------------------------------------------------------------------- /docs/old/ci/mem/pandoc-custom-reference-sddd.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nasa/bplib/main/docs/old/ci/mem/pandoc-custom-reference-sddd.docx -------------------------------------------------------------------------------- /docs/old/ci/mem/pandoc-tabloid-reference-sddd.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nasa/bplib/main/docs/old/ci/mem/pandoc-tabloid-reference-sddd.docx -------------------------------------------------------------------------------- /docs/doc-src/bplib-public-api.doxyfile.in: -------------------------------------------------------------------------------- 1 | #--------------------------------------------------------------------------- 2 | # BPLib API Documentation Input List (generated from build system) 3 | #--------------------------------------------------------------------------- 4 | 5 | # List of compile definitions from bplib_public_api 6 | PREDEFINED += @BPLIBDOC_PREDEFINED@ 7 | 8 | # List of header files from bplib_public_api 9 | INPUT += @BPLIB_NATIVE_APIGUIDE_SOURCEFILES@ 10 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing Guide 2 | 3 | Please see our [top-level contributing guide](https://github.com/nasa/cFS/blob/main/CONTRIBUTING.md) for more information on how to contribute to cFS components. 4 | 5 | ## Contributor License Agreement (CLA) 6 | 7 | Before we can accept your code contributions we need a signed Contributor License Agreement (CLA). See the [instructions](https://github.com/nasa/cFS/blob/main/CONTRIBUTING.md#contributor-license-agreement-cla) for more information. -------------------------------------------------------------------------------- /docs/doc-src/bplib-apiguide.doxyfile.in: -------------------------------------------------------------------------------- 1 | #--------------------------------------------------------------------------- 2 | # Doxygen Configuration options to generate the "BPLib API Guide" 3 | #--------------------------------------------------------------------------- 4 | 5 | # Common definitions, can be overridden here 6 | @INCLUDE = @BPLIB_NATIVE_COMMON_CFGFILE@ 7 | 8 | PROJECT_NAME = "BPLib API Guide" 9 | WARN_LOGFILE = @BPLIB_NATIVE_LOGFILE@ 10 | -------------------------------------------------------------------------------- /docs/bplib-detaildesign.doxyfile.in: -------------------------------------------------------------------------------- 1 | #--------------------------------------------------------------------------- 2 | # Doxygen Configuration options for mission detailed documentation 3 | #--------------------------------------------------------------------------- 4 | 5 | # Common files 6 | @INCLUDE = @MISSION_BINARY_DIR@/docs/bplib-common.doxyfile 7 | 8 | # All of the BPLib FSW code relevant for a detail design document is under 9 | # bplib. 10 | # Note this will include ALL BPLib layers. 11 | INPUT += @bplib_MISSION_DIR@ 12 | -------------------------------------------------------------------------------- /bpa/ct/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ################################################################## 2 | # 3 | # Bundle Protocol Library (BPLib) CMake build recipe 4 | # 5 | # This is for the CT module 6 | # 7 | ################################################################## 8 | 9 | add_library(bplib_ct OBJECT 10 | src/bplib_ct.c 11 | ) 12 | 13 | target_include_directories(bplib_ct PUBLIC 14 | ${CMAKE_CURRENT_SOURCE_DIR}/inc 15 | $ 16 | ) 17 | 18 | # Add unit tests 19 | if(BPLIB_ENABLE_UNIT_TESTS) 20 | add_subdirectory(unit-test) 21 | endif(BPLIB_ENABLE_UNIT_TESTS) 22 | -------------------------------------------------------------------------------- /aa/arp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ################################################################## 2 | # 3 | # Bundle Protocol Library (BPLib) CMake build recipe 4 | # 5 | # This is for the ARP module 6 | # 7 | ################################################################## 8 | 9 | add_library(bplib_arp OBJECT 10 | src/bplib_arp.c 11 | ) 12 | 13 | target_include_directories(bplib_arp PUBLIC 14 | ${CMAKE_CURRENT_SOURCE_DIR}/inc 15 | $ 16 | ) 17 | 18 | # Add unit tests 19 | if(BPLIB_ENABLE_UNIT_TESTS) 20 | add_subdirectory(unit-test) 21 | endif(BPLIB_ENABLE_UNIT_TESTS) 22 | -------------------------------------------------------------------------------- /bpa/pdb/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ################################################################## 2 | # 3 | # Bundle Protocol Library (BPLib) CMake build recipe 4 | # 5 | # This is for the PDB module 6 | # 7 | ################################################################## 8 | 9 | add_library(bplib_pdb OBJECT 10 | src/bplib_pdb.c 11 | ) 12 | 13 | target_include_directories(bplib_pdb PUBLIC 14 | ${CMAKE_CURRENT_SOURCE_DIR}/inc 15 | $ 16 | ) 17 | 18 | # Add unit tests 19 | if(BPLIB_ENABLE_UNIT_TESTS) 20 | add_subdirectory(unit-test) 21 | endif(BPLIB_ENABLE_UNIT_TESTS) 22 | -------------------------------------------------------------------------------- /ci/eid/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ################################################################## 2 | # 3 | # Bundle Protocol Library (BPLib) CMake build recipe 4 | # 5 | # This is for the EID module 6 | # 7 | ################################################################## 8 | 9 | add_library(bplib_eid OBJECT 10 | src/bplib_eid.c 11 | ) 12 | 13 | target_include_directories(bplib_eid PUBLIC 14 | ${CMAKE_CURRENT_SOURCE_DIR}/inc 15 | $ 16 | ) 17 | 18 | # Add unit tests 19 | if(BPLIB_ENABLE_UNIT_TESTS) 20 | add_subdirectory(unit-test) 21 | endif(BPLIB_ENABLE_UNIT_TESTS) 22 | -------------------------------------------------------------------------------- /version/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ################################################################## 2 | # 3 | # Bundle Protocol Library (BPLib) CMake build recipe 4 | # 5 | # This is for the Version utility 6 | # 7 | ################################################################## 8 | 9 | add_library(bplib_version OBJECT 10 | src/bplib_version.c 11 | ) 12 | 13 | target_include_directories(bplib_version PUBLIC 14 | ${CMAKE_CURRENT_SOURCE_DIR}/inc 15 | $ 16 | ) 17 | 18 | # Add unit tests 19 | if(BPLIB_ENABLE_UNIT_TESTS) 20 | add_subdirectory(unit-test) 21 | endif(BPLIB_ENABLE_UNIT_TESTS) 22 | -------------------------------------------------------------------------------- /binding/lua/test/ut_unittest.lua: -------------------------------------------------------------------------------- 1 | local bplib = require("bplib") 2 | local runner = require("bptest") 3 | local src = runner.srcscript() 4 | 5 | -- Setup -- 6 | 7 | local test = arg[1] or "ALL" 8 | runner.setup(bplib, "RAM") 9 | 10 | -- Test -- 11 | 12 | ----------------------------------------------------------------------- 13 | print(string.format('\n%s: Test 1 - unittest(%s)', src, test)) 14 | local numfails = bplib.unittest(test) 15 | runner.check(numfails == 0, string.format('Failures detected by bplib unittest: %d', numfails)) 16 | 17 | -- Clean Up -- 18 | 19 | runner.cleanup(bplib, store) 20 | 21 | -- Report Results -- 22 | 23 | runner.report(bplib) 24 | 25 | -------------------------------------------------------------------------------- /ci/em/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ################################################################## 2 | # 3 | # Bundle Protocol Library (BPLib) CMake build recipe 4 | # 5 | # This is for the EM module 6 | # 7 | ################################################################## 8 | 9 | add_library(bplib_em OBJECT 10 | src/bplib_em.c 11 | ) 12 | 13 | target_include_directories(bplib_em PUBLIC 14 | ${CMAKE_CURRENT_SOURCE_DIR}/inc 15 | $ 16 | $ 17 | ) 18 | 19 | # Add unit tests 20 | if(BPLIB_ENABLE_UNIT_TESTS) 21 | add_subdirectory(unit-test) 22 | endif(BPLIB_ENABLE_UNIT_TESTS) 23 | -------------------------------------------------------------------------------- /ci/pl/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ################################################################## 2 | # 3 | # Bundle Protocol Library (BPLib) CMake build recipe 4 | # 5 | # This is for the PL module 6 | # 7 | ################################################################## 8 | 9 | add_library(bplib_pl OBJECT 10 | src/bplib_pl.c 11 | ) 12 | 13 | target_include_directories(bplib_pl PUBLIC 14 | ${CMAKE_CURRENT_SOURCE_DIR}/inc 15 | $ 16 | $ 17 | ) 18 | 19 | # Add unit tests 20 | if(BPLIB_ENABLE_UNIT_TESTS) 21 | add_subdirectory(unit-test) 22 | endif(BPLIB_ENABLE_UNIT_TESTS) 23 | -------------------------------------------------------------------------------- /ci/rbt/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ################################################################## 2 | # 3 | # Bundle Protocol Library (BPLib) CMake build recipe 4 | # 5 | # This is for the MEM module 6 | # 7 | ################################################################## 8 | 9 | add_library(bplib_rbt OBJECT 10 | src/bplib_rbt_impl.c 11 | src/bplib_rbt_iterator.c 12 | src/bplib_rbt_api.c 13 | ) 14 | 15 | target_include_directories(bplib_rbt PUBLIC 16 | ${CMAKE_CURRENT_SOURCE_DIR}/inc 17 | $ 18 | ) 19 | 20 | # Add unit tests 21 | if(BPLIB_ENABLE_UNIT_TESTS) 22 | add_subdirectory(unit-test) 23 | endif(BPLIB_ENABLE_UNIT_TESTS) 24 | -------------------------------------------------------------------------------- /ci/crc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ################################################################## 2 | # 3 | # Bundle Protocol Library (BPLib) CMake build recipe 4 | # 5 | # This is for the "crc" submodule, which applies only to the 6 | # bplib_crc build. 7 | # 8 | ################################################################## 9 | 10 | add_library(bplib_crc OBJECT 11 | src/bplib_crc.c 12 | ) 13 | 14 | target_include_directories(bplib_crc PUBLIC 15 | ${CMAKE_CURRENT_SOURCE_DIR}/inc 16 | ${CMAKE_CURRENT_SOURCE_DIR}/src 17 | $ 18 | ) 19 | 20 | # Add unit test subdirectory 21 | if(BPLIB_ENABLE_UNIT_TESTS) 22 | add_subdirectory(unit-test) 23 | endif(BPLIB_ENABLE_UNIT_TESTS) 24 | -------------------------------------------------------------------------------- /RELEASE.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/sh 2 | 3 | # 4 | # Typical version identifier is x.y.z, e.g. 1.0.4 5 | # the version number is then prepended with 'v' for 6 | # the tags annotation in git. 7 | # 8 | VERSION=$1 9 | if git tag -l | grep -w v$VERSION; then 10 | echo Git tag already exists 11 | exit 1 12 | fi 13 | 14 | # 15 | # Clean up any previously attempted archives 16 | # 17 | rm bplib-$VERSION.tar.gz 2> /dev/null 18 | 19 | # 20 | # Update version in local repository 21 | # 22 | echo $VERSION > version.txt 23 | git add version.txt 24 | git commit -m "Version v$VERSION" 25 | 26 | # 27 | # Create tag and acrhive 28 | # 29 | git tag -a v$VERSION -m "version $VERSION" 30 | git archive --format=tar.gz --prefix=bplib/ v$VERSION > bplib-$VERSION.tar.gz 31 | 32 | -------------------------------------------------------------------------------- /ci/mem/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ################################################################## 2 | # 3 | # Bundle Protocol Library (BPLib) CMake build recipe 4 | # 5 | # This is for the MEM module 6 | # 7 | ################################################################## 8 | 9 | add_library(bplib_mem OBJECT 10 | src/bplib_mem.c 11 | src/bplib_ben_allocator.c 12 | #src/bplib_std_allocator.c 13 | ) 14 | 15 | target_include_directories(bplib_mem PUBLIC 16 | ${CMAKE_CURRENT_SOURCE_DIR}/inc 17 | $ 18 | $ 19 | 20 | ) 21 | 22 | # Add unit tests 23 | if(BPLIB_ENABLE_UNIT_TESTS) 24 | add_subdirectory(unit-test) 25 | endif(BPLIB_ENABLE_UNIT_TESTS) 26 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context about the feature request here. 21 | 22 | **Requester Info** 23 | Full name and company/organization if applicable 24 | -------------------------------------------------------------------------------- /ci/time/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ################################################################## 2 | # 3 | # Bundle Protocol Library (BPLib) CMake build recipe 4 | # 5 | # This is for the TIME module 6 | # 7 | ################################################################## 8 | 9 | add_library(bplib_time OBJECT 10 | src/bplib_time.c 11 | src/bplib_time_internal.c 12 | ) 13 | 14 | target_link_libraries(bplib_time osal) 15 | 16 | target_include_directories(bplib_time PUBLIC 17 | ${CMAKE_CURRENT_SOURCE_DIR}/inc 18 | $ 19 | $ 20 | ) 21 | 22 | # Add unit tests 23 | if(BPLIB_ENABLE_UNIT_TESTS) 24 | add_subdirectory(unit-test) 25 | endif(BPLIB_ENABLE_UNIT_TESTS) 26 | -------------------------------------------------------------------------------- /ci/qm/unit-test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ################################################################## 2 | # 3 | # Coverage test build recipe 4 | # 5 | # This CMake file contains the recipe for building the coverage tests. 6 | # It is invoked from the parent directory when unit tests are enabled. 7 | # 8 | ################################################################## 9 | 10 | # Create stubs (for external use) 11 | add_library(bplib_qm_stubs STATIC 12 | stubs/bplib_qm_stubs.c 13 | stubs/bplib_qm_waitqueue_stubs.c 14 | stubs/bplib_qm_handlers.c 15 | ) 16 | 17 | target_include_directories(bplib_qm_stubs PUBLIC 18 | $ 19 | stubs/ 20 | ) 21 | 22 | target_link_libraries(bplib_qm_stubs PUBLIC ut_assert) 23 | -------------------------------------------------------------------------------- /bpa/ebp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ################################################################## 2 | # 3 | # Bundle Protocol Library (BPLib) CMake build recipe 4 | # 5 | # This is for the EBP module 6 | # 7 | ################################################################## 8 | 9 | add_library(bplib_ebp OBJECT 10 | src/bplib_ebp.c 11 | ) 12 | 13 | target_include_directories(bplib_ebp PUBLIC 14 | ${CMAKE_CURRENT_SOURCE_DIR}/inc 15 | $ 16 | $ 17 | $ 18 | $ 19 | ) 20 | 21 | # Add unit tests 22 | if(BPLIB_ENABLE_UNIT_TESTS) 23 | add_subdirectory(unit-test) 24 | endif(BPLIB_ENABLE_UNIT_TESTS) 25 | -------------------------------------------------------------------------------- /docs/doc-src/bplib-common.doxyfile.in: -------------------------------------------------------------------------------- 1 | #--------------------------------------------------------------------------- 2 | # BPLib common setup for including in stand alone or mission documentation 3 | #--------------------------------------------------------------------------- 4 | 5 | # Allow overrides 6 | @INCLUDE_PATH = @MISSION_SOURCE_DIR@ 7 | 8 | # Default settings 9 | @INCLUDE = @BPLIB_NATIVE_DEFAULT_SETTINGS@ 10 | 11 | # Minimum set of source files (includes *.dox, followed by public headers) 12 | INPUT += @BPLIB_NATIVE_APIGUIDE_SOURCEFILES@ 13 | 14 | # Public header list is generated from the interface includes of the bplib_public_api target 15 | @INCLUDE = @CMAKE_BINARY_DIR@/docs/bplib-public-api.doxyfile 16 | 17 | # Strip source dir from path 18 | STRIP_FROM_PATH += @MISSION_SOURCE_DIR@ 19 | -------------------------------------------------------------------------------- /.github/workflows/static-analysis.yml: -------------------------------------------------------------------------------- 1 | # name: Static Analysis 2 | 3 | # Run on pull requests and by dispatch. NOTE: Commented out until errors are fixed 4 | 5 | # on: 6 | # workflow_dispatch: 7 | # pull_request: 8 | 9 | # jobs: 10 | # static-analysis: 11 | # name: Run cppcheck 12 | # uses: nasa/cFS/.github/workflows/static-analysis.yml@main 13 | # with: 14 | # strict-dir-list: 15 | # -Iaa/arp/inc -Iaa/as/inc -Iaa/fwp/inc -Iaa/nc/inc -Ibpa/bi/inc -Ibpa/ct/inc 16 | # -Ibpa/ebp/inc -Ibpa/pdb/inc -Ibpa/pi/inc -Ibpa/stor/inc -Ici/cbor/inc -Ici/em/inc 17 | # -Ici/job/inc -Ici/mem/inc -Ici/pl/inc -Ici/time/inc -Icla/inc -Iinc 18 | # aa/arp/src aa/as/src aa/fwp/src aa/nc/src bpa/bi/src bpa/ct/src 19 | # bpa/ebp/src bpa/pdc/src bpa/pi/src bpa/stor/src ci/cbor/src ci/em/src 20 | # ci/job/src ci/mem/src ci/pl/src ci/time/src cla/src 21 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Code snips** 24 | If applicable, add references to the software. 25 | 26 | **System observed on:** 27 | - Hardware 28 | - OS: [e.g. Linux 4.4] 29 | - Versions [e.g. cFE 6.6, OSAL 4.2, PSP 1.3 for mcp750, any related apps] 30 | 31 | **Additional context** 32 | Add any other context about the problem here. 33 | 34 | **Reporter Info** 35 | Full name and company/organization if applicable 36 | -------------------------------------------------------------------------------- /cla/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ################################################################## 2 | # 3 | # Bundle Protocol Library (BPLib) CMake build recipe 4 | # 5 | # This is for the CLA module 6 | # 7 | ################################################################## 8 | 9 | add_library(bplib_cla OBJECT 10 | src/bplib_cla.c 11 | src/bplib_cla_internal.c 12 | ) 13 | 14 | target_include_directories(bplib_cla PUBLIC 15 | ${CMAKE_CURRENT_SOURCE_DIR}/inc 16 | $ 17 | $ 18 | $ 19 | $ 20 | $ 21 | ) 22 | 23 | # Add unit tests 24 | if(BPLIB_ENABLE_UNIT_TESTS) 25 | add_subdirectory(unit-test) 26 | endif(BPLIB_ENABLE_UNIT_TESTS) 27 | -------------------------------------------------------------------------------- /.github/actions/setup-qcbor/action.yml: -------------------------------------------------------------------------------- 1 | name: Install QCBOR 2 | description: 'Builds and installs QCBOR into the workflow filesystem' 3 | 4 | inputs: 5 | upstream-ref: 6 | description: 'Upstream ref to check out' 7 | default: v1.5.1 8 | upstream-repo: 9 | description: 'Upstream repository to use' 10 | default: laurencelundblade/QCBOR 11 | staging-dir: 12 | description: 'Directory to stage output' 13 | required: true 14 | 15 | runs: 16 | using: 'composite' 17 | steps: 18 | - name: Checkout QCBOR 19 | uses: actions/checkout@v3 20 | with: 21 | repository: ${{ inputs.upstream-repo }} 22 | ref: ${{ inputs.upstream-ref }} 23 | path: qcbor-source 24 | 25 | - name: Build and Install QCBOR 26 | working-directory: qcbor-source 27 | shell: bash 28 | run: cmake -DBUILD_SHARED_LIBS=ON -S . -B build && 29 | cmake --build build && 30 | sudo make install 31 | -------------------------------------------------------------------------------- /bpa/bi/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ################################################################## 2 | # 3 | # Bundle Protocol Library (BPLib) CMake build recipe 4 | # 5 | # This is for the BI module 6 | # 7 | ################################################################## 8 | 9 | add_library(bplib_bi OBJECT 10 | src/bplib_bi.c 11 | ) 12 | 13 | target_include_directories(bplib_bi PUBLIC 14 | ${CMAKE_CURRENT_SOURCE_DIR}/inc 15 | $ 16 | $ 17 | $ 18 | $ 19 | $ 20 | $ 21 | ) 22 | 23 | # Add unit tests 24 | if(BPLIB_ENABLE_UNIT_TESTS) 25 | add_subdirectory(unit-test) 26 | endif(BPLIB_ENABLE_UNIT_TESTS) 27 | -------------------------------------------------------------------------------- /aa/fwp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ################################################################## 2 | # 3 | # Bundle Protocol Library (BPLib) CMake build recipe 4 | # 5 | # This is for the FWP module 6 | # 7 | ################################################################## 8 | 9 | add_library(bplib_fwp OBJECT 10 | src/bplib_fwp.c 11 | ) 12 | 13 | target_include_directories(bplib_fwp PUBLIC 14 | ${CMAKE_CURRENT_SOURCE_DIR}/inc 15 | $ 16 | $ 17 | $ 18 | $ 19 | $ 20 | $ 21 | ) 22 | 23 | # Add unit tests 24 | if(BPLIB_ENABLE_UNIT_TESTS) 25 | add_subdirectory(unit-test) 26 | endif(BPLIB_ENABLE_UNIT_TESTS) 27 | -------------------------------------------------------------------------------- /bpa/stor/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ################################################################## 2 | # 3 | # Bundle Protocol Library (BPLib) CMake build recipe 4 | # 5 | # This is for the STOR module 6 | # 7 | ################################################################## 8 | 9 | add_library(bplib_stor OBJECT 10 | src/bplib_stor.c 11 | src/bplib_stor_sql.c 12 | src/bplib_stor_sql_store.c 13 | src/bplib_stor_sql_load.c 14 | src/bplib_stor_loadbatch.c 15 | ) 16 | 17 | target_include_directories(bplib_stor PUBLIC 18 | ${CMAKE_CURRENT_SOURCE_DIR}/inc 19 | $ 20 | $ 21 | $ 22 | $ 23 | ) 24 | 25 | # Add unit tests 26 | if(BPLIB_ENABLE_UNIT_TESTS) 27 | add_subdirectory(unit-test) 28 | endif(BPLIB_ENABLE_UNIT_TESTS) 29 | -------------------------------------------------------------------------------- /aa/as/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ################################################################## 2 | # 3 | # Bundle Protocol Library (BPLib) CMake build recipe 4 | # 5 | # This is for the Admin Statistics (AS) module 6 | # 7 | ################################################################## 8 | 9 | add_library(bplib_as OBJECT 10 | src/bplib_as.c 11 | src/bplib_as_internal.c 12 | ) 13 | 14 | target_include_directories(bplib_as PUBLIC 15 | ${CMAKE_CURRENT_SOURCE_DIR}/inc 16 | $ 17 | $ 18 | $ 19 | $ 20 | $ 21 | $ 22 | ) 23 | 24 | # Add unit tests 25 | if(BPLIB_ENABLE_UNIT_TESTS) 26 | add_subdirectory(unit-test) 27 | endif(BPLIB_ENABLE_UNIT_TESTS) 28 | -------------------------------------------------------------------------------- /binding/lua/test/ut_route.lua: -------------------------------------------------------------------------------- 1 | local bplib = require("bplib") 2 | local runner = require("bptest") 3 | local bp = require("bp") 4 | local src = runner.srcscript() 5 | 6 | -- Setup -- 7 | 8 | local store = "RAM" 9 | runner.setup(bplib, store) 10 | 11 | local src_node = 4 12 | local src_serv = 3 13 | local dst_node = 72 14 | local dst_serv = 43 15 | 16 | local sender = bplib.open(src_node, src_serv, dst_node, dst_serv, store) 17 | 18 | rc, flags = sender:store("HELLO WORLD", 1000) 19 | runner.check(rc) 20 | rc, bundle, flags = sender:load(1000) 21 | runner.check(rc) 22 | runner.check(bp.check_flags(flags, {})) 23 | 24 | -- Test -- 25 | 26 | ----------------------------------------------------------------------- 27 | print(string.format('%s: Test 1 - nominal', src)) 28 | rc, node, serv = bplib.route(bundle) 29 | runner.check(rc) 30 | runner.check(node == dst_node) 31 | runner.check(serv == dst_serv) 32 | 33 | -- Clean Up -- 34 | 35 | sender:flush() 36 | sender:close() 37 | 38 | runner.cleanup(bplib, store) 39 | 40 | -- Report Results -- 41 | 42 | runner.report(bplib) 43 | 44 | -------------------------------------------------------------------------------- /ci/qm/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ################################################################## 2 | # 3 | # Bundle Protocol Library (BPLib) CMake build recipe 4 | # 5 | # This is for the "Queue Manager (QM)" submodule, which applies only to the 6 | # bplib_stor_qm build. 7 | # 8 | ################################################################## 9 | 10 | add_library(bplib_qm OBJECT 11 | src/bplib_qm.c 12 | src/bplib_qm_job.c 13 | src/bplib_qm_waitqueue.c 14 | ) 15 | 16 | target_include_directories(bplib_qm PUBLIC 17 | ${CMAKE_CURRENT_SOURCE_DIR}/inc 18 | ${CMAKE_CURRENT_SOURCE_DIR}/src 19 | $ 20 | $ 21 | $ 22 | $ 23 | $ 24 | ) 25 | 26 | # Add unit test coverage subdirectory 27 | if(BPLIB_ENABLE_UNIT_TESTS) 28 | add_subdirectory(unit-test) 29 | endif(BPLIB_ENABLE_UNIT_TESTS) 30 | -------------------------------------------------------------------------------- /release.mk: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # File: release.mk 3 | # 4 | # Copyright 2019 United States Government as represented by the 5 | # Administrator of the National Aeronautics and Space Administration. 6 | # All Other Rights Reserved. 7 | # 8 | # This software was created at NASA's Goddard Space Flight Center. 9 | # This software is governed by the NASA Open Source Agreement and may be 10 | # used, distributed and modified only pursuant to the terms of that 11 | # agreement. 12 | # 13 | # Maintainer(s): 14 | # Joe-Paul Swinski, Code 582 NASA GSFC 15 | # 16 | # Note: 17 | # See 'Makefile' in same directory for where this is included 18 | ############################################################################### 19 | 20 | ############################################################################### 21 | ## PLATFORM SPECIFIC OBJECTS 22 | 23 | APP_OBJ += posix.o 24 | 25 | ############################################################################### 26 | ## OPTIONS 27 | 28 | # Optimization Level # 29 | APP_COPT += -O3 30 | 31 | # Disable Asserts # 32 | APP_COPT += -DNDEBUG 33 | -------------------------------------------------------------------------------- /.github/actions/check-coverage/action.yml: -------------------------------------------------------------------------------- 1 | name: Check Coverage Results 2 | description: 'Extracts a summary of the code coverage results' 3 | 4 | inputs: 5 | binary-dir: 6 | description: 'Directory containing binary files' 7 | required: true 8 | source-dir: 9 | description: 'Directory containing source code files' 10 | default: ./source 11 | 12 | runs: 13 | using: 'composite' 14 | steps: 15 | - name: Capture Results 16 | shell: bash 17 | run: lcov 18 | --capture --rc lcov_branch_coverage=1 19 | --include '${{ github.workspace }}/*' 20 | --directory '${{ inputs.binary-dir }}' 21 | --output-file '${{ inputs.binary-dir }}/coverage.info' 22 | 23 | - name: Generate HTML 24 | shell: bash 25 | run: genhtml 26 | '${{ inputs.binary-dir }}/coverage.info' 27 | --branch-coverage 28 | --output-directory '${{ inputs.binary-dir }}/lcov-html' 29 | 30 | - name: Extract Summary 31 | shell: bash 32 | run: xsltproc --html 33 | '${{ inputs.source-dir }}/.github/scripts/lcov-output.xslt' 34 | '${{ inputs.binary-dir }}/lcov-html/index.html' > '${{ inputs.binary-dir }}/lcov-summary.xml' 35 | -------------------------------------------------------------------------------- /bpa/pi/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ################################################################## 2 | # 3 | # Bundle Protocol Library (BPLib) CMake build recipe 4 | # 5 | # This is for the PI module 6 | # 7 | ################################################################## 8 | 9 | add_library(bplib_pi OBJECT 10 | src/bplib_pi.c 11 | ) 12 | 13 | target_include_directories(bplib_pi PUBLIC 14 | ${CMAKE_CURRENT_SOURCE_DIR}/inc 15 | $ 16 | $ 17 | $ 18 | $ 19 | $ 20 | $ 21 | $ 22 | $ 23 | $ 24 | $ 25 | ) 26 | 27 | # Add unit tests 28 | if(BPLIB_ENABLE_UNIT_TESTS) 29 | add_subdirectory(unit-test) 30 | endif(BPLIB_ENABLE_UNIT_TESTS) 31 | -------------------------------------------------------------------------------- /app/inc/bpcat_fwp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | #ifndef BPLIB_BPCAT_FWP_H 21 | #define BPLIB_BPCAT_FWP_H 22 | 23 | #include "bpcat_types.h" 24 | 25 | BPCat_Status_t BPCat_FWP_Init(); 26 | 27 | #endif /* BPLIB_BPCAT_FWP_H */ 28 | -------------------------------------------------------------------------------- /bpa/ct/src/bplib_ct.c: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | 21 | /* 22 | ** Include 23 | */ 24 | 25 | #include "bplib_ct.h" 26 | 27 | 28 | /* 29 | ** Function Definitions 30 | */ 31 | 32 | int BPLib_CT_Init(void) { 33 | return BPLIB_SUCCESS; 34 | } 35 | -------------------------------------------------------------------------------- /app/inc/bpcat_nc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | #ifndef BPLIB_BPCAT_NC_H 21 | #define BPLIB_BPCAT_NC_H 22 | 23 | #include "bpcat_types.h" 24 | #include "bplib.h" 25 | 26 | BPCat_Status_t BPCat_NC_Init(BPLib_NC_ConfigPtrs_t* ConfigPtrs); 27 | 28 | #endif /* BPLIB_BPCAT_NC_H */ 29 | -------------------------------------------------------------------------------- /binding/lua/test/ut_ipn2eid.lua: -------------------------------------------------------------------------------- 1 | local bplib = require("bplib") 2 | local runner = require("bptest") 3 | local src = runner.srcscript() 4 | 5 | -- Setup -- 6 | 7 | runner.setup(bplib, "RAM") 8 | 9 | -- Test -- 10 | 11 | ----------------------------------------------------------------------- 12 | print(string.format('%s: Test 1 - nominal', src)) 13 | rc, eid = bplib.ipn2eid(4, 3) 14 | runner.check('rc == true') 15 | runner.check('eid == "ipn:4.3"') 16 | 17 | ----------------------------------------------------------------------- 18 | print(string.format('%s: Test 2 - nominal', src)) 19 | rc, eid = bplib.ipn2eid(72, 43) 20 | runner.check('rc == true') 21 | runner.check('eid == "ipn:72.43"') 22 | 23 | ----------------------------------------------------------------------- 24 | print(string.format('%s: Test 3 - bad node parameter', src)) 25 | rc, eid = bplib.ipn2eid("seventy two", 43) 26 | runner.check('rc == false') 27 | 28 | ----------------------------------------------------------------------- 29 | print(string.format('%s: Test 4 - bad service parameter', src)) 30 | rc, eid = bplib.ipn2eid(72, "forty three") 31 | runner.check('rc == false') 32 | 33 | -- Clean Up -- 34 | 35 | runner.cleanup(bplib, store) 36 | 37 | -- Report Results -- 38 | 39 | runner.report(bplib) 40 | 41 | -------------------------------------------------------------------------------- /aa/nc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ################################################################## 2 | # 3 | # Bundle Protocol Library (BPLib) CMake build recipe 4 | # 5 | # This is for the NC module 6 | # 7 | ################################################################## 8 | 9 | add_library(bplib_nc OBJECT 10 | src/bplib_nc.c 11 | src/bplib_nc_directives.c 12 | src/bplib_nc_rwlock.c 13 | src/bplib_nc_internal.c 14 | ) 15 | 16 | target_include_directories(bplib_nc PUBLIC 17 | ${CMAKE_CURRENT_SOURCE_DIR}/inc 18 | ${CMAKE_CURRENT_SOURCE_DIR}/src 19 | $ 20 | $ 21 | $ 22 | $ 23 | $ 24 | $ 25 | $ 26 | $ 27 | $ 28 | ) 29 | 30 | # Add unit tests 31 | if(BPLIB_ENABLE_UNIT_TESTS) 32 | add_subdirectory(unit-test) 33 | endif(BPLIB_ENABLE_UNIT_TESTS) 34 | -------------------------------------------------------------------------------- /.github/actions/setup-osal/action.yml: -------------------------------------------------------------------------------- 1 | name: Install OSAL 2 | description: 'Builds and installs NASA OSAL into the workflow filesystem' 3 | 4 | inputs: 5 | upstream-ref: 6 | description: 'Upstream ref to check out' 7 | default: main 8 | upstream-repo: 9 | description: 'Upstream repository to use' 10 | default: nasa/osal 11 | config-options: 12 | description: 'Configuration options to pass to CMake' 13 | default: -DCMAKE_BUILD_TYPE=Release -DOSAL_OMIT_DEPRECATED=TRUE -DENABLE_UNIT_TESTS=TRUE -DOSAL_CONFIG_DEBUG_PERMISSIVE_MODE=ON 14 | staging-dir: 15 | description: 'Directory to stage output' 16 | required: true 17 | 18 | runs: 19 | using: 'composite' 20 | steps: 21 | - name: Checkout OSAL 22 | uses: actions/checkout@v3 23 | with: 24 | repository: ${{ inputs.upstream-repo }} 25 | ref: ${{ inputs.upstream-ref }} 26 | path: osal-source 27 | 28 | - name: Set up OSAL build 29 | shell: bash 30 | run: cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DOSAL_SYSTEM_BSPTYPE=generic-linux ${{ inputs.config-options }} -S osal-source -B osal-build 31 | 32 | - name: Build and Install OSAL 33 | shell: bash 34 | working-directory: osal-build 35 | run: make DESTDIR=${{ inputs.staging-dir }} install 36 | -------------------------------------------------------------------------------- /ut-functional/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ################################################################## 2 | # 3 | # Coverage test build recipe 4 | # 5 | # This CMake file contains the recipe for building the coverage tests. 6 | # It is invoked from the parent directory when unit tests are enabled. 7 | # 8 | ################################################################## 9 | 10 | set(CMAKE_VERBOSE_MAKEFILE ON) 11 | 12 | # Add executable 13 | add_executable(functional-bplib_sanity-testrunner 14 | sanity-test.c 15 | ) 16 | 17 | target_compile_features(functional-bplib_sanity-testrunner PUBLIC c_std_99) 18 | target_compile_options(functional-bplib_sanity-testrunner PUBLIC ${BPLIB_COMMON_COMPILE_OPTIONS}) 19 | 20 | target_include_directories(functional-bplib_sanity-testrunner PUBLIC 21 | $ 22 | ) 23 | 24 | target_link_libraries(functional-bplib_sanity-testrunner PUBLIC 25 | bplib 26 | ut_assert 27 | osal 28 | ) 29 | 30 | add_test(functional-bplib_sanity-testrunner functional-bplib_sanity-testrunner) 31 | 32 | # Install the executables to a staging area for test in cross environments 33 | if (INSTALL_TARGET_LIST) 34 | foreach(TGT ${INSTALL_TARGET_LIST}) 35 | install(TARGETS functional-bplib_sanity-testrunner DESTINATION ${TGT}/${UT_INSTALL_SUBDIR}) 36 | endforeach() 37 | endif() 38 | -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | # BPLib Documentation 2 | 3 | Most official documentation on the GSFC Bundle Protocol v7 implementation can be found at: https://github.com/nasa/bp/tree/main/docs. This directory includes some legal forms, documentation for older versions of bplib, and doxygen source files. 4 | 5 | ## Building Doxygen API Guide 6 | 7 | The BPLib Doxygen Build folder `bplib/docs/doc-src` contains the Doxygen source files for the API Guide. 8 | 9 | The `bplib/CMakeLists.txt` file includes `docs/doc-src` as a subdirectory to prepare the build folder for the `bplibguide` make target. 10 | 11 | The `dtn-cfs/Makefile` has a target `bplibguide` (consistent with the existing `osalguide` for the OSAL API Guide). 12 | 13 | Build dtn-cfs with the usual steps, finishing with: 14 | 15 | ``` 16 | make 17 | make install 18 | ``` 19 | 20 | Then run: 21 | 22 | ``` 23 | make bplibguide 24 | ``` 25 | 26 | There will be many lines of output ending with something similar to this: 27 | 28 | ``` 29 | Patching output file 167/168 30 | Patching output file 168/168 31 | lookup cache used 4435/65536 hits=19708 misses=4546 32 | finished... 33 | BPLib API Guide: file:///home/gskenned/repos/gsfc-dtn/dtn-cfs/build/native/default/apps/bplib/docs/doc-src/html/index.html 34 | Built target bplib-apiguide 35 | ``` 36 | 37 | Open the BPLib API Guide: index.html URL from the make log to view the BPLib API Guide. 38 | -------------------------------------------------------------------------------- /ut-functional/sanity-test.c: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | 21 | /* 22 | ** Include 23 | */ 24 | 25 | 26 | #include 27 | 28 | #include 29 | #include 30 | #include 31 | 32 | #include "bplib_api_types.h" 33 | 34 | void BPLib_Test(void) 35 | { 36 | 37 | } 38 | 39 | void UtTest_Setup(void) 40 | { 41 | UtTest_Add(BPLib_Test, NULL, NULL, "Test stub"); 42 | } 43 | -------------------------------------------------------------------------------- /ci/cbor/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ################################################################## 2 | # 3 | # Bundle Protocol Library (BPLib) CMake build recipe 4 | # 5 | # This is for the CBOR module 6 | # 7 | ################################################################## 8 | 9 | add_library(bplib_cbor OBJECT 10 | src/bplib_cbor_decode_bundle.c 11 | src/bplib_cbor_decode_types.c 12 | src/bplib_cbor_decode_primary.c 13 | src/bplib_cbor_decode_canonical.c 14 | src/bplib_cbor_encode_bundle.c 15 | src/bplib_cbor_encode_primary.c 16 | src/bplib_cbor_encode_extension.c 17 | src/bplib_cbor_encode_payload.c 18 | src/bplib_cbor_encode_types.c 19 | src/bplib_cbor_crc.c 20 | ) 21 | 22 | target_include_directories(bplib_cbor PUBLIC 23 | ${CMAKE_CURRENT_SOURCE_DIR}/inc 24 | ${QCBOR_INCLUDE_DIRS} 25 | $ 26 | $ 27 | $ 28 | $ 29 | $ 30 | $ 31 | $ 32 | ) 33 | 34 | # Add unit tests 35 | if(BPLIB_ENABLE_UNIT_TESTS) 36 | add_subdirectory(unit-test) 37 | endif(BPLIB_ENABLE_UNIT_TESTS) 38 | -------------------------------------------------------------------------------- /ci/crc/unit-test/utilities/bplib_crc_test_utils.c: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | 21 | /* 22 | ** Include 23 | */ 24 | 25 | #include "bplib_crc_test_utils.h" 26 | 27 | 28 | /* 29 | ** Function Definitions 30 | */ 31 | 32 | void BPLib_CRC_Test_Setup(void) 33 | { 34 | /* Initialize test environment to default state for every test */ 35 | UT_ResetState(0); 36 | 37 | } 38 | 39 | void BPLib_CRC_Test_Teardown(void) 40 | { 41 | /* Clean up test environment */ 42 | } 43 | -------------------------------------------------------------------------------- /bpa/ebp/inc/bplib_ebp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | 21 | #ifndef BPLIB_EBP_H 22 | #define BPLIB_EBP_H 23 | 24 | /* 25 | ** Include 26 | */ 27 | 28 | #include "bplib_api_types.h" 29 | #include "bplib_mem.h" 30 | 31 | 32 | /* 33 | ** Exported Functions 34 | */ 35 | 36 | BPLib_Status_t BPLib_EBP_InitializeExtensionBlocks(BPLib_Bundle_t *Bundle, uint32_t ChanId); 37 | 38 | BPLib_Status_t BPLib_EBP_UpdateExtensionBlocks(BPLib_Bundle_t *Bundle); 39 | 40 | #endif /* BPLIB_EBP_H */ 41 | -------------------------------------------------------------------------------- /bpa/ct/unit-test/bplib_ct_test.c: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | 21 | /* 22 | * Include 23 | */ 24 | 25 | #include "bplib_ct_test_utils.h" 26 | 27 | /* 28 | ** Test function for 29 | ** int BPLib_CT_Init() 30 | */ 31 | void Test_BPLib_CT_Init(void) 32 | { 33 | UtAssert_INT32_EQ(BPLib_CT_Init(), BPLIB_SUCCESS); 34 | } 35 | 36 | 37 | void TestBplibCt_Register(void) 38 | { 39 | UtTest_Add(Test_BPLib_CT_Init, BPLib_CT_Test_Setup, BPLib_CT_Test_Teardown, "Test_BPLib_CT_Init"); 40 | } 41 | -------------------------------------------------------------------------------- /ci/rbt/unit-test/bplib_rbt_test.h: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | 21 | #ifndef BPLIB_RBT_TEST_H 22 | #define BPLIB_RBT_TEST_H 23 | 24 | void Test_BPLib_RBT_Setup(void); 25 | void Test_BPLib_RBT_Basics(void); 26 | void Test_BPLib_RBT_Register(void); 27 | void Test_BPLib_RBT_LeafNodeInsertDelete(void); 28 | void Test_BPLib_RBT_NonLeafDelete(void); 29 | void Test_BPLib_RBT_Unique(void); 30 | void Test_BPLib_RBT_NonUnique(void); 31 | void Test_BPLib_RBT_Iterator(void); 32 | 33 | #endif // BPLIB_RBT_TEST_H -------------------------------------------------------------------------------- /app/inc/bpcat_cla.h: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | #ifndef BPLIB_BPCAT_CLA_H 21 | #define BPLIB_BPCAT_CLA_H 22 | 23 | #include "bpcat_types.h" 24 | 25 | BPCat_Status_t BPCat_CLAOutSetup(uint32_t TaskId); 26 | 27 | BPCat_Status_t BPCat_CLAOutTeardown(uint32_t TaskId); 28 | 29 | void* BPCat_CLAOutTaskFunc(); 30 | 31 | BPCat_Status_t BPCat_CLAInSetup(uint32_t TaskId); 32 | 33 | BPCat_Status_t BPCat_CLAOutTeardown(uint32_t TaskId); 34 | 35 | void* BPCat_CLAInTaskFunc(); 36 | 37 | #endif /* BPLIB_BPCAT_CLA_H */ 38 | -------------------------------------------------------------------------------- /ci/time/unit-test/stubs/bplib_time_handlers.h: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | 21 | #ifndef BPLIB_TIME_HANDLERS_H 22 | #define BPLIB_TIME_HANDLERS_H 23 | 24 | /* 25 | ** Include 26 | */ 27 | 28 | #include "utassert.h" 29 | #include "utstubs.h" 30 | #include "uttest.h" 31 | 32 | #include "bplib_time.h" 33 | 34 | /* 35 | ** Function Definitions 36 | */ 37 | 38 | void UT_Handler_BPLib_TIME_GetTimeDelta(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context); 39 | 40 | #endif /* BPLIB_TIME_HANDLERS_H */ 41 | -------------------------------------------------------------------------------- /ci/pl/unit-test/utilities/bplib_pl_test_utils.c: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | 21 | /* 22 | ** Include 23 | */ 24 | 25 | #include "bplib_pl_test_utils.h" 26 | 27 | /* 28 | ** Function Definitions 29 | */ 30 | 31 | void BPLib_PL_Test_Setup(void) 32 | { 33 | /* Initialize test environment to default state for every test */ 34 | UT_ResetState(0); 35 | } 36 | 37 | void BPLib_PL_Test_Teardown(void) 38 | { 39 | /* Clean up test environment */ 40 | } 41 | 42 | void UtTest_Setup(void) 43 | { 44 | TestBplibPl_Register(); 45 | } 46 | -------------------------------------------------------------------------------- /bpa/ct/unit-test/utilities/bplib_ct_test_utils.c: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | 21 | /* 22 | ** Include 23 | */ 24 | 25 | #include "bplib_ct_test_utils.h" 26 | 27 | /* 28 | ** Function Definitions 29 | */ 30 | 31 | void BPLib_CT_Test_Setup(void) 32 | { 33 | /* Initialize test environment to default state for every test */ 34 | UT_ResetState(0); 35 | } 36 | 37 | void BPLib_CT_Test_Teardown(void) 38 | { 39 | /* Clean up test environment */ 40 | } 41 | 42 | void UtTest_Setup(void) 43 | { 44 | TestBplibCt_Register(); 45 | } 46 | -------------------------------------------------------------------------------- /version/unit-test/bplib_version_test.c: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | 21 | /* 22 | * Include 23 | */ 24 | 25 | #include "bplib_version_test_utils.h" 26 | 27 | /* 28 | ** Test function for 29 | ** int BPLib_PrintVersion() 30 | */ 31 | void Test_BPLib_PrintVersion(void) 32 | { 33 | UtAssert_INT32_EQ(BPLib_PrintVersion(), BPLIB_SUCCESS); 34 | } 35 | 36 | 37 | void TestBplibVersion_Register(void) 38 | { 39 | UtTest_Add(Test_BPLib_PrintVersion, BPLib_Version_Test_Setup, BPLib_Version_Test_Teardown, "Test_BPLib_Version_Init"); 40 | } 41 | -------------------------------------------------------------------------------- /aa/arp/unit-test/utilities/bplib_arp_test_utils.c: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | 21 | /* 22 | ** Include 23 | */ 24 | 25 | #include "bplib_arp_test_utils.h" 26 | 27 | /* 28 | ** Function Definitions 29 | */ 30 | 31 | void BPLib_ARP_Test_Setup(void) 32 | { 33 | /* Initialize test environment to default state for every test */ 34 | UT_ResetState(0); 35 | } 36 | 37 | void BPLib_ARP_Test_Teardown(void) 38 | { 39 | /* Clean up test environment */ 40 | } 41 | 42 | void UtTest_Setup(void) 43 | { 44 | TestBplibArp_Register(); 45 | } 46 | -------------------------------------------------------------------------------- /bpa/pdb/unit-test/utilities/bplib_pdb_test_utils.c: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | 21 | /* 22 | ** Include 23 | */ 24 | 25 | #include "bplib_pdb_test_utils.h" 26 | 27 | /* 28 | ** Function Definitions 29 | */ 30 | 31 | void BPLib_PDB_Test_Setup(void) 32 | { 33 | /* Initialize test environment to default state for every test */ 34 | UT_ResetState(0); 35 | } 36 | 37 | void BPLib_PDB_Test_Teardown(void) 38 | { 39 | /* Clean up test environment */ 40 | } 41 | 42 | void UtTest_Setup(void) 43 | { 44 | TestBplibPdb_Register(); 45 | } 46 | -------------------------------------------------------------------------------- /ci/mem/unit-test/utilities/bplib_mem_test_utils.c: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | 21 | /* 22 | ** Include 23 | */ 24 | 25 | #include "bplib_mem_test_utils.h" 26 | 27 | /* 28 | ** Function Definitions 29 | */ 30 | 31 | void BPLib_MEM_Test_Setup(void) 32 | { 33 | /* Initialize test environment to default state for every test */ 34 | UT_ResetState(0); 35 | } 36 | 37 | void BPLib_MEM_Test_Teardown(void) 38 | { 39 | /* Clean up test environment */ 40 | } 41 | 42 | void UtTest_Setup(void) 43 | { 44 | TestBplibMem_Register(); 45 | } 46 | -------------------------------------------------------------------------------- /bpa/ct/unit-test/utilities/bplib_ct_test_utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | 21 | #ifndef BPLIB_CT_TEST_UTILS_H 22 | #define BPLIB_CT_TEST_UTILS_H 23 | 24 | /* 25 | ** Include 26 | */ 27 | 28 | #include "utassert.h" 29 | #include "utstubs.h" 30 | #include "uttest.h" 31 | 32 | #include "bplib_api_types.h" 33 | #include "bplib_ct.h" 34 | 35 | 36 | /* 37 | ** Function Definitions 38 | */ 39 | 40 | void BPLib_CT_Test_Setup(void); 41 | void BPLib_CT_Test_Teardown(void); 42 | 43 | void TestBplibCt_Register(void); 44 | 45 | #endif /* BPLIB_CT_TEST_UTILS_H */ 46 | -------------------------------------------------------------------------------- /aa/arp/unit-test/utilities/bplib_arp_test_utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | 21 | #ifndef BPLIB_ARP_TEST_UTILS_H 22 | #define BPLIB_ARP_TEST_UTILS_H 23 | 24 | /* 25 | ** Include 26 | */ 27 | 28 | #include "utassert.h" 29 | #include "utstubs.h" 30 | #include "uttest.h" 31 | 32 | #include "bplib_api_types.h" 33 | #include "bplib_arp.h" 34 | 35 | 36 | /* 37 | ** Exported Functions 38 | */ 39 | 40 | void BPLib_ARP_Test_Setup(void); 41 | void BPLib_ARP_Test_Teardown(void); 42 | 43 | void TestBplibArp_Register(void); 44 | 45 | #endif /* BPLIB_ARP_TEST_UTILS_H */ 46 | -------------------------------------------------------------------------------- /cla/unit-test/stubs/bplib_cla_handlers.h: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | 21 | #ifndef BPLIB_CLA_HANDLERS_H 22 | #define BPLIB_CLA_HANDLERS_H 23 | 24 | /* ======== */ 25 | /* Includes */ 26 | /* ======== */ 27 | 28 | #include "utassert.h" 29 | #include "utstubs.h" 30 | #include "uttest.h" 31 | 32 | void UT_Handler_BPLib_CLA_GetContactRunState(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context); 33 | void UT_Handler_BPLib_CLA_Egress(void* UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t* Context); 34 | 35 | #endif /* BPLIB_CLA_HANDLERS_H */ -------------------------------------------------------------------------------- /version/unit-test/utilities/bplib_version_test_utils.c: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | 21 | /* 22 | ** Include 23 | */ 24 | 25 | #include "bplib_version_test_utils.h" 26 | 27 | /* 28 | ** Function Definitions 29 | */ 30 | 31 | void BPLib_Version_Test_Setup(void) 32 | { 33 | /* Initialize test environment to default state for every test */ 34 | UT_ResetState(0); 35 | } 36 | 37 | void BPLib_Version_Test_Teardown(void) 38 | { 39 | /* Clean up test environment */ 40 | } 41 | 42 | void UtTest_Setup(void) 43 | { 44 | TestBplibVersion_Register(); 45 | } 46 | -------------------------------------------------------------------------------- /bpa/pdb/unit-test/utilities/bplib_pdb_test_utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | 21 | #ifndef BPLIB_PDB_TEST_UTILS_H 22 | #define BPLIB_PDB_TEST_UTILS_H 23 | 24 | /* 25 | ** Include 26 | */ 27 | 28 | #include "utassert.h" 29 | #include "utstubs.h" 30 | #include "uttest.h" 31 | 32 | #include "bplib_api_types.h" 33 | #include "bplib_pdb.h" 34 | 35 | 36 | /* 37 | ** Function Definitions 38 | */ 39 | 40 | void BPLib_PDB_Test_Setup(void); 41 | void BPLib_PDB_Test_Teardown(void); 42 | 43 | void TestBplibPdb_Register(void); 44 | 45 | #endif /* BPLIB_PDB_TEST_UTILS_H */ 46 | -------------------------------------------------------------------------------- /ci/mem/unit-test/utilities/bplib_mem_test_utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | 21 | #ifndef BPLIB_MEM_TEST_UTILS_H 22 | #define BPLIB_MEM_TEST_UTILS_H 23 | 24 | /* 25 | ** Include 26 | */ 27 | 28 | #include "utassert.h" 29 | #include "utstubs.h" 30 | #include "uttest.h" 31 | 32 | #include "bplib_api_types.h" 33 | #include "bplib_cbor.h" 34 | 35 | 36 | /* 37 | ** Function Definitions 38 | */ 39 | 40 | void BPLib_MEM_Test_Setup(void); 41 | void BPLib_MEM_Test_Teardown(void); 42 | 43 | void TestBplibMem_Register(void); 44 | 45 | #endif /* BPLIB_MEM_TEST_UTILS_H */ 46 | -------------------------------------------------------------------------------- /ci/rbt/unit-test/utilities/bplib_rbt_test_utils.c: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | 21 | /* 22 | ** Include 23 | */ 24 | 25 | #include "../bplib_rbt_test.h" 26 | #include "bplib_rbt_test_utils.h" 27 | 28 | /* 29 | ** Function Definitions 30 | */ 31 | 32 | void BPLib_RBT_Test_Setup(void) 33 | { 34 | /* Initialize test environment to default state for every test */ 35 | UT_ResetState(0); 36 | } 37 | 38 | void BPLib_RBT_Test_Teardown(void) 39 | { 40 | /* Clean up test environment */ 41 | } 42 | 43 | void UtTest_Setup(void) 44 | { 45 | Test_BPLib_RBT_Register(); 46 | } 47 | -------------------------------------------------------------------------------- /ci/pl/unit-test/utilities/bplib_pl_test_utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | 21 | #ifndef BPLIB_PL_TEST_UTILS_H 22 | #define BPLIB_PL_TEST_UTILS_H 23 | 24 | /* 25 | ** Include 26 | */ 27 | 28 | #include "utassert.h" 29 | #include "utstubs.h" 30 | #include "uttest.h" 31 | 32 | #include "bplib_api_types.h" 33 | #include "bplib_pl.h" 34 | #include "bplib_fwp.h" 35 | 36 | 37 | /* 38 | ** Function Definitions 39 | */ 40 | 41 | void BPLib_PL_Test_Setup(void); 42 | void BPLib_PL_Test_Teardown(void); 43 | 44 | void TestBplibPl_Register(void); 45 | 46 | #endif /* BPLIB_PL_TEST_UTILS_H */ 47 | -------------------------------------------------------------------------------- /posix.mk: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # File: posix.mk 3 | # 4 | # Copyright 2019 United States Government as represented by the 5 | # Administrator of the National Aeronautics and Space Administration. 6 | # All Other Rights Reserved. 7 | # 8 | # This software was created at NASA's Goddard Space Flight Center. 9 | # This software is governed by the NASA Open Source Agreement and may be 10 | # used, distributed and modified only pursuant to the terms of that 11 | # agreement. 12 | # 13 | # Maintainer(s): 14 | # Joe-Paul Swinski, Code 582 NASA GSFC 15 | # 16 | # Note: 17 | # See 'Makefile' in same directory for where this is included 18 | ############################################################################### 19 | 20 | ############################################################################### 21 | ## PLATFORM SPECIFIC OBJECTS 22 | 23 | APP_OBJ += posix.o 24 | 25 | ############################################################################### 26 | ## OPTIONS 27 | 28 | # Optimization Level # 29 | APP_COPT += -O0 30 | 31 | # Build Unit Tests # 32 | BUILD_UNITTESTS=1 33 | APP_COPT += -DUNITTESTS 34 | APP_COPT += -DBPLIB_LOCAL_SCOPE="" # removes static designator so that local functions can be unit tested 35 | 36 | # GNU Code Coverage # 37 | APP_COPT += -fprofile-arcs -ftest-coverage 38 | APP_LOPT += -lgcov --coverage 39 | 40 | # Enable Stack Checker # 41 | APP_COPT += -fstack-protector-all 42 | 43 | # Enable Toolchain Specific Checks # 44 | ifeq ($(CC), cc) 45 | APP_COPT += -Wlogical-op 46 | endif 47 | 48 | -------------------------------------------------------------------------------- /binding/lua/lua_bplib.h: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | 21 | #ifndef LUA_BPLIB_H 22 | #define LUA_BPLIB_H 23 | 24 | /****************************************************************************** 25 | INCLUDES 26 | ******************************************************************************/ 27 | 28 | #include 29 | 30 | /****************************************************************************** 31 | EXPORTED FUNCTIONS 32 | ******************************************************************************/ 33 | 34 | int luaopen_bplib(lua_State *L); 35 | 36 | #endif /* LUA_BPLIB_H */ 37 | -------------------------------------------------------------------------------- /version/unit-test/utilities/bplib_version_test_utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | 21 | #ifndef BPLIB_VERSION_TEST_UTILS_H 22 | #define BPLIB_VERSION_TEST_UTILS_H 23 | 24 | /* 25 | ** Include 26 | */ 27 | 28 | #include "utassert.h" 29 | #include "utstubs.h" 30 | #include "uttest.h" 31 | 32 | #include "bplib_api_types.h" 33 | #include "bplib_version.h" 34 | 35 | 36 | /* 37 | ** Function Definitions 38 | */ 39 | 40 | void BPLib_Version_Test_Setup(void); 41 | void BPLib_Version_Test_Teardown(void); 42 | 43 | void TestBplibVersion_Register(void); 44 | 45 | #endif /* BPLIB_VERSION_TEST_UTILS_H */ 46 | -------------------------------------------------------------------------------- /bpa/ct/inc/bplib_ct.h: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | 21 | #ifndef BPLIB_CT_H 22 | #define BPLIB_CT_H 23 | 24 | /* 25 | ** Include 26 | */ 27 | 28 | #include "bplib_api_types.h" 29 | 30 | 31 | /* 32 | ** Exported Functions 33 | */ 34 | 35 | /** 36 | * \brief Custody Transfer initialization 37 | * 38 | * \par Description 39 | * CT initialization function 40 | * 41 | * \par Assumptions, External Events, and Notes: 42 | * None 43 | * 44 | * \return Execution status 45 | * \retval BPLIB_SUCCESS Initialization was successful 46 | */ 47 | int BPLib_CT_Init(void); 48 | 49 | #endif /* BPLIB_CT_H */ 50 | -------------------------------------------------------------------------------- /ci/time/unit-test/stubs/bplib_time_handlers.c: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | 21 | /** 22 | * @file 23 | * 24 | * Handlers for TIME function stubs 25 | */ 26 | 27 | #include "bplib_time_handlers.h" 28 | 29 | void UT_Handler_BPLib_TIME_GetTimeDelta(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) 30 | { 31 | int64_t *Delta = UT_Hook_GetArgValueByName(Context, "Delta", int64_t *); 32 | int32 Status; 33 | 34 | UT_Stub_GetInt32StatusCode(Context, &Status); 35 | 36 | if (Status >= 0) 37 | { 38 | UT_Stub_CopyToLocal(UT_KEY(BPLib_TIME_GetTimeDelta), Delta, sizeof(int64_t *)); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /bpa/ct/unit-test/stubs/bplib_ct_stubs.c: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | 21 | /** 22 | * @file 23 | * 24 | * Auto-Generated stub implementations for functions defined in bplib_ct header 25 | */ 26 | 27 | #include "bplib_ct.h" 28 | #include "utgenstub.h" 29 | 30 | /* 31 | * ---------------------------------------------------- 32 | * Generated stub function for BPLib_CT_Init() 33 | * ---------------------------------------------------- 34 | */ 35 | int BPLib_CT_Init(void) 36 | { 37 | UT_GenStub_SetupReturnBuffer(BPLib_CT_Init, int); 38 | 39 | UT_GenStub_Execute(BPLib_CT_Init, Basic, NULL); 40 | 41 | return UT_GenStub_GetReturnValue(BPLib_CT_Init, int); 42 | } 43 | -------------------------------------------------------------------------------- /docs/doc-src/default-settings.doxyfile: -------------------------------------------------------------------------------- 1 | #--------------------------------------------------------------------------- 2 | # Default Doxygen settings 3 | #--------------------------------------------------------------------------- 4 | 5 | # Common aliases 6 | ALIASES += nonnull="(must not be null)" 7 | ALIASES += nonzero="(must not be zero)" 8 | ALIASES += covtest="(return value only verified in coverage test)" 9 | 10 | # Source options 11 | OPTIMIZE_OUTPUT_FOR_C = YES 12 | 13 | # Build related 14 | EXTRACT_ALL = YES 15 | EXTRACT_PRIVATE = YES 16 | EXTRACT_STATIC = YES 17 | CASE_SENSE_NAMES = NO 18 | GENERATE_TODOLIST = NO 19 | GENERATE_BUGLIST = YES 20 | GENERATE_DEPRECATEDLIST= YES 21 | 22 | # Warnings 23 | WARN_NO_PARAMDOC = YES 24 | 25 | # Matching 26 | FILE_PATTERNS = *.c *.cpp *.cc *.C *.h *.hh *.hpp *.H *.dox *.md 27 | RECURSIVE = YES 28 | 29 | # Source browsing 30 | SOURCE_BROWSER = YES 31 | REFERENCED_BY_RELATION = YES 32 | REFERENCES_RELATION = YES 33 | 34 | # LaTeX output 35 | GENERATE_LATEX = YES 36 | LATEX_CMD_NAME = latex 37 | COMPACT_LATEX = YES 38 | PAPER_TYPE = letter 39 | 40 | # RTF output 41 | COMPACT_RTF = YES 42 | 43 | # Dot tool 44 | CLASS_DIAGRAMS = NO 45 | HAVE_DOT = YES 46 | CLASS_GRAPH = NO 47 | COLLABORATION_GRAPH = NO 48 | INCLUDE_GRAPH = NO 49 | INCLUDED_BY_GRAPH = NO 50 | CALL_GRAPH = YES 51 | GRAPHICAL_HIERARCHY = NO 52 | MAX_DOT_GRAPH_DEPTH = 1000 53 | 54 | # Search engine 55 | SEARCHENGINE = NO 56 | -------------------------------------------------------------------------------- /bpa/bi/unit-test/utilities/bplib_bi_test_utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | 21 | #ifndef BPLIB_BI_TEST_UTILS_H 22 | #define BPLIB_BI_TEST_UTILS_H 23 | 24 | /* 25 | ** Include 26 | */ 27 | 28 | #include "utassert.h" 29 | #include "utstubs.h" 30 | #include "uttest.h" 31 | 32 | #include "bplib_api_types.h" 33 | #include "bplib_bi.h" 34 | #include "bplib_as_handlers.h" 35 | 36 | 37 | /* 38 | ** Global Data 39 | */ 40 | 41 | extern BPLib_Bundle_t DeserializedBundle; 42 | 43 | 44 | /* 45 | ** Function Definitions 46 | */ 47 | 48 | void BPLib_BI_Test_Setup(void); 49 | void BPLib_BI_Test_Teardown(void); 50 | 51 | void TestBplibBi_Register(void); 52 | 53 | #endif /* BPLIB_BI_TEST_UTILS_H */ 54 | -------------------------------------------------------------------------------- /binding/lua/test/ut_memusage.lua: -------------------------------------------------------------------------------- 1 | local bplib = require("bplib") 2 | local runner = require("bptest") 3 | local bp = require("bp") 4 | local rd = runner.rootdir(arg[0]) 5 | local src = runner.srcscript() 6 | 7 | -- Setup -- 8 | 9 | local store = arg[1] or "RAM" 10 | runner.setup(bplib, store) 11 | 12 | local src_node = 4 13 | local src_serv = 3 14 | local dst_node = 72 15 | local dst_serv = 43 16 | 17 | local num_bundles = 128 18 | local timeout = 2 19 | 20 | -- Test -- 21 | 22 | ----------------------------------------------------------------------- 23 | print(string.format('%s/%s: Test 1 - store bundles and close', store, src)) 24 | 25 | start_currmem, start_highmem = bplib.memstat() 26 | print(string.format('Before Open: %8d %8d', start_currmem, start_highmem)) 27 | 28 | -- open channel -- 29 | local sender = bplib.open(src_node, src_serv, dst_node, dst_serv, store) 30 | currmem, highmem = bplib.memstat() 31 | print(string.format('After Open: %8d %8d', currmem, highmem)) 32 | 33 | -- store payloads -- 34 | for i=1,num_bundles do 35 | payload = string.format('HELLO WORLD %d', i) 36 | rc, flags = sender:store(payload, 1000) 37 | end 38 | currmem, highmem = bplib.memstat() 39 | print(string.format('After Store: %8d %8d', currmem, highmem)) 40 | 41 | -- close channel -- 42 | sender:close() 43 | currmem, highmem = bplib.memstat() 44 | print(string.format('After Close: %8d %8d', currmem, highmem)) 45 | 46 | -- check memory usage -- 47 | runner.check(highmem ~= 0, "No memory allocated") 48 | runner.check(currmem == start_currmem, "Memory not cleaned up") 49 | 50 | -- Clean Up -- 51 | 52 | runner.cleanup(bplib, store) 53 | 54 | -- Report Results -- 55 | 56 | runner.report(bplib) 57 | 58 | -------------------------------------------------------------------------------- /ci/rbt/unit-test/utilities/bplib_rbt_test_utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | 21 | #ifndef BPLIB_RBT_TEST_UTILS_H 22 | #define BPLIB_RBT_TEST_UTILS_H 23 | 24 | /* 25 | ** Include 26 | */ 27 | 28 | #include "utassert.h" 29 | #include "utstubs.h" 30 | #include "uttest.h" 31 | 32 | #include "bplib_api_types.h" 33 | #include "bplib_rbt.h" 34 | 35 | /* 36 | ** Macro Definitions 37 | */ 38 | 39 | /* Macro to add test case */ 40 | #define ADD_TEST(test) UtTest_Add(test, BPLib_RBT_Test_Setup, BPLib_RBT_Test_Teardown, #test) 41 | 42 | /* 43 | ** Function Definitions 44 | */ 45 | 46 | void BPLib_RBT_Test_Setup(void); 47 | void BPLib_RBT_Test_Teardown(void); 48 | 49 | #endif /* BPLIB_RBT_TEST_UTILS_H */ 50 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | **Describe the contribution** 2 | A clear and concise description of what the contribution is. 3 | - Include explicitly what issue it addresses [e.g. Fixes #X] 4 | 5 | **Testing performed** 6 | Steps taken to test the contribution: 7 | 1. Build steps '...' 8 | 1. Execution steps '...' 9 | 10 | **Expected behavior changes** 11 | A clear and concise description of how this contribution will change behavior and level of impact. 12 | - API Change: xxx (if applicable) 13 | - Behavior Change: xxx (if applicable) 14 | - Or no impact to behavior 15 | 16 | **System(s) tested on** 17 | - Hardware: [e.g. PC, SP0, MCP750] 18 | - OS: [e.g. Ubuntu 18.04, RTEMS 4.11, VxWorks 6.9] 19 | - Versions: [e.g. cFE 6.6, OSAL 4.2, PSP 1.3 for mcp750, any related apps or tools] 20 | 21 | **Additional context** 22 | Add any other context about the contribution here. 23 | 24 | **Third party code** 25 | If included, identify any third party code and provide text file of license 26 | 27 | **Contributor Info - All information REQUIRED for consideration of pull request** 28 | Full name and company/organization/center of all contributors ("Personal" if individual work) 29 | - If NASA Civil Servant Employee or GSFC Contractor on SES III 30 | - Address/email/phone and contract/task information (if applicable) must be on file 31 | - Else if Company 32 | - **HAND SIGNED** Company CLA must be on file (once per release): [Company CLA](https://github.com/nasa/bplib/blob/main/doc/GSC_18318_Corp_CLA_form_1219.pdf) 33 | - Else if Individual 34 | - **HAND SIGNED** Individual CLA must be on file (once per release): [Individual CLA](https://github.com/nasa/bplib/blob/main/doc/GSC_18318_Ind_CLA_form_1219.pdf) 35 | -------------------------------------------------------------------------------- /ci/crc/unit-test/utilities/bplib_crc_test_utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | 21 | #ifndef BPLIB_CRC_TEST_UTILS_H 22 | #define BPLIB_CRC_TEST_UTILS_H 23 | 24 | /* 25 | ** Include 26 | */ 27 | 28 | #include "utassert.h" 29 | #include "utstubs.h" 30 | #include "uttest.h" 31 | 32 | #include "bplib_api_types.h" 33 | #include "bplib_crc.h" 34 | 35 | 36 | /* 37 | ** Macro Definitions 38 | */ 39 | 40 | /* Macro to add test case */ 41 | #define ADD_TEST(test) UtTest_Add(test, BPLib_CRC_Test_Setup, BPLib_CRC_Test_Teardown, #test) 42 | 43 | /* 44 | ** Function Definitions 45 | */ 46 | 47 | void BPLib_CRC_Test_Setup(void); 48 | void BPLib_CRC_Test_Teardown(void); 49 | 50 | #endif /* BPLIB_CRC_TEST_UTILS_H */ 51 | -------------------------------------------------------------------------------- /version/unit-test/stubs/bplib_version_stubs.c: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | 21 | /** 22 | * @file 23 | * 24 | * Auto-Generated stub implementations for functions defined in bplib_version header 25 | */ 26 | 27 | #include "bplib_version.h" 28 | #include "utgenstub.h" 29 | 30 | /* 31 | * ---------------------------------------------------- 32 | * Generated stub function for BPLib_PrintVersion() 33 | * ---------------------------------------------------- 34 | */ 35 | int BPLib_PrintVersion(void) 36 | { 37 | UT_GenStub_SetupReturnBuffer(BPLib_PrintVersion, int); 38 | 39 | UT_GenStub_Execute(BPLib_PrintVersion, Basic, NULL); 40 | 41 | return UT_GenStub_GetReturnValue(BPLib_PrintVersion, int); 42 | } 43 | -------------------------------------------------------------------------------- /inc/bplib.h: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | 21 | #ifndef BPLIB_H 22 | #define BPLIB_H 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | /* 29 | ** Include 30 | */ 31 | 32 | #include "bplib_api_types.h" 33 | #include "bplib_cfg.h" 34 | 35 | #include "bplib_time.h" 36 | #include "bplib_em.h" 37 | #include "bplib_fwp.h" 38 | #include "bplib_nc.h" 39 | #include "bplib_cla.h" 40 | #include "bplib_pl.h" 41 | #include "bplib_pi.h" 42 | #include "bplib_stor.h" 43 | #include "bplib_as.h" 44 | #include "bplib_arp.h" 45 | #include "bplib_pdb.h" 46 | #include "bplib_qm.h" 47 | #include "bplib_mem.h" 48 | #include "bplib_cbor.h" 49 | 50 | #ifdef __cplusplus 51 | } // extern "C" 52 | #endif 53 | 54 | #endif /* BPLIB_H */ 55 | -------------------------------------------------------------------------------- /app/inc/bpcat_task.h: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | #ifndef BPLIB_BPCAT_TASK_H 21 | #define BPLIB_BPCAT_TASK_H 22 | 23 | #include "bpcat_types.h" 24 | 25 | #include 26 | #include 27 | 28 | typedef struct BPCat_Task 29 | { 30 | void* (*TaskFunc)(BPCat_AppData_t* AppData); 31 | BPCat_Status_t (*TaskSetup)(uint32_t TaskId); 32 | BPCat_Status_t (*TaskTeardown)(uint32_t TaskId); 33 | pthread_t Handle; 34 | uint32_t TaskId; 35 | } BPCat_Task_t; 36 | 37 | 38 | BPCat_Status_t BPCat_TaskInit(BPCat_Task_t* task); 39 | 40 | BPCat_Status_t BPCat_TaskStart(BPCat_Task_t* task, BPCat_AppData_t* AppData); 41 | 42 | BPCat_Status_t BPCat_TaskStop(BPCat_Task_t* task); 43 | 44 | 45 | #endif /* BPLIB_BPCAT_TASK_H */ 46 | -------------------------------------------------------------------------------- /ci/mem/inc/bplib_std_allocator.h: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | 21 | #ifndef BPLIB_MEM_STD_ALLOCATOR_H 22 | #define BPLIB_MEM_STD_ALLOCATOR_H 23 | 24 | #include "bplib_api_types.h" 25 | 26 | typedef struct BPLib_MEM_PoolImpl 27 | { 28 | void* mem; 29 | size_t size; 30 | uint32_t block_size; 31 | } BPLib_MEM_PoolImpl_t; 32 | 33 | BPLib_Status_t BPLib_MEM_PoolImplInit(BPLib_MEM_PoolImpl_t* pool, const void* init_mem, 34 | size_t mem_len, uint32_t block_size); 35 | 36 | void BPLib_MEM_PoolImplDestroy(BPLib_MEM_PoolImpl_t* pool); 37 | 38 | void* BPLib_MEM_PoolImplAlloc(BPLib_MEM_PoolImpl_t* pool); 39 | 40 | void BPLib_MEM_PoolImplFree(BPLib_MEM_PoolImpl_t* pool, void* to_free); 41 | 42 | #endif /* BPLIB_MEM_STD_ALLOCATOR_H */ 43 | -------------------------------------------------------------------------------- /docs/doc-src/generate-public-api-doxyfile.cmake: -------------------------------------------------------------------------------- 1 | ################################################################# 2 | # 3 | # CMake helper script to generate list of header for API guide 4 | # 5 | ################################################################# 6 | 7 | # This helper script is needed to evaluate the "INTERFACE_INCLUDE_DIRECTORIES" and 8 | # "INTERFACE_COMPILE_DEFINITIONS" properties on the bplib_public_api target properly. 9 | # Note that either of these property values may contain generator expressions, and 10 | # thus can only be correctly evaluated in the context of a target command, hence the 11 | # need for this helper script. 12 | # 13 | # The property values are passed in via the command line, and this converts it into 14 | # a doxygen snippet containing of header files and predefined macro values. 15 | 16 | message(STATUS "Generating BPLib API documentation input list") 17 | set(BPLIB_HEADERFILE_LIST) 18 | set(BPLIBDOC_PREDEFINED) 19 | separate_arguments(INCLUDE_DIRECTORIES) 20 | separate_arguments(COMPILE_DEFINITIONS) 21 | foreach(INPUT ${INCLUDE_DIRECTORIES}) 22 | if (IS_DIRECTORY ${INPUT}) 23 | message(STATUS "BPLib API: Scanning directory ${INPUT}") 24 | file(GLOB INPUT "${INPUT}/*.h") 25 | endif() 26 | list(APPEND BPLIB_HEADERFILE_LIST ${INPUT}) 27 | endforeach() 28 | 29 | foreach(HDR ${BPLIB_HEADERFILE_LIST}) 30 | list(APPEND BPLIB_DOC_DEPENDENCY_LIST ${HDR}) 31 | file(TO_NATIVE_PATH "${HDR}" HDR) 32 | string(APPEND BPLIB_NATIVE_APIGUIDE_SOURCEFILES " \\\n ${HDR}") 33 | endforeach() 34 | 35 | foreach(INPUT ${COMPILE_DEFINITIONS}) 36 | string(APPEND BPLIBDOC_PREDEFINED " \\\n ${INPUT}") 37 | endforeach() 38 | 39 | configure_file(${INPUT_TEMPLATE} ${OUTPUT_FILE} @ONLY) 40 | -------------------------------------------------------------------------------- /aa/arp/src/bplib_arp.c: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | 21 | /* 22 | ** Include 23 | */ 24 | 25 | #include "bplib_arp.h" 26 | 27 | 28 | /* 29 | ** Function Definitions 30 | */ 31 | 32 | int BPLib_ARP_Init(void) { 33 | return BPLIB_SUCCESS; 34 | } 35 | 36 | /* Validate CRS table data */ 37 | BPLib_Status_t BPLib_ARP_CRSTblValidateFunc(void *TblData) 38 | { 39 | BPLib_Status_t ReturnCode = BPLIB_SUCCESS; 40 | BPLib_ARP_CRSTable_t *TblDataPtr = (BPLib_ARP_CRSTable_t *)TblData; 41 | 42 | /* Validate data values are within allowed range */ 43 | if (TblDataPtr[0].CRS_Set->SizeTrigger <= 0) 44 | { 45 | /* element is out of range, return an appropriate error code */ 46 | ReturnCode = BPLIB_TABLE_OUT_OF_RANGE_ERR_CODE; 47 | } 48 | 49 | return ReturnCode; 50 | } 51 | -------------------------------------------------------------------------------- /app/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ################################################################## 2 | # 3 | # Bundle Protocol Library (BPLib) Test App CMake build recipe 4 | # 5 | # This file provides various test executables, including bpcat, that 6 | # can be used to initiate or terminate BP/DTN traffic from the 7 | # command line on a simulated node. 8 | # 9 | ################################################################## 10 | 11 | cmake_minimum_required(VERSION 3.5) 12 | project(BPLIB_TEST_APP C) 13 | 14 | # Sanity check: bpcat assumes a POSIX system 15 | # and uses pthread calls. If not POSIX, then 16 | # this tool will not build. 17 | #if (NOT BPLIB_OS_LAYER STREQUAL POSIX) 18 | # message(FATAL_ERROR "BPLib Test applications require POSIX") 19 | #endif() 20 | 21 | set(BPAPP_COMPILE_FEATURES "c_std_99") 22 | set(BPAPP_COMPILE_OPTIONS "$<$:-Wall;-Werror;-g;>") 23 | set(BPAPP_LINK_LIBRARIES bplib) 24 | 25 | add_executable(bpcat 26 | bpcat.c 27 | ${CMAKE_CURRENT_SOURCE_DIR}/src/bpcat_task.c 28 | ${CMAKE_CURRENT_SOURCE_DIR}/src/bpcat_fwp.c 29 | ${CMAKE_CURRENT_SOURCE_DIR}/src/bpcat_nc.c 30 | ${CMAKE_CURRENT_SOURCE_DIR}/src/bpcat_cla.c 31 | ) 32 | target_include_directories(bpcat PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/inc) 33 | 34 | # compile this app as c99 (but this does not impose the same requirement on other users) 35 | target_compile_features(bpcat PRIVATE ${BPAPP_COMPILE_FEATURES}) 36 | 37 | # If using GNU GCC, then also enable full warning reporting 38 | target_compile_options(bpcat PRIVATE ${BPAPP_COMPILE_OPTIONS}) 39 | 40 | # Low level test apps may include "private" headers, whereas higher level tests should not 41 | target_include_directories(bpcat PRIVATE ${BPLIB_PRIVATE_INCLUDE_DIRS}) 42 | 43 | # link with bplib 44 | target_link_libraries(bpcat ${BPAPP_LINK_LIBRARIES}) 45 | -------------------------------------------------------------------------------- /ci/eid/unit-test/utilities/bplib_eid_test_utils.c: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | 21 | /* ======== */ 22 | /* Includes */ 23 | /* ======== */ 24 | 25 | #include "bplib_eid_test_utils.h" 26 | 27 | /* =========== */ 28 | /* Global Data */ 29 | /* =========== */ 30 | 31 | BPLib_EID_t EID_Actual; 32 | BPLib_EID_t EID_Reference; 33 | BPLib_EID_Pattern_t EID_Pattern; 34 | 35 | void BPLib_EID_Test_Setup(void) 36 | { 37 | /* Initialize test environment to default state for every test */ 38 | 39 | memset(&EID_Actual, 0, sizeof(BPLib_EID_t)); 40 | memset(&EID_Reference, 0, sizeof(BPLib_EID_t)); 41 | memset(&EID_Pattern, 0, sizeof(BPLib_EID_Pattern_t)); 42 | 43 | UT_ResetState(0); 44 | } 45 | 46 | void BPLib_EID_Test_Teardown(void) 47 | { 48 | /* Clean up test environment */ 49 | } 50 | 51 | void UtTest_Setup(void) 52 | { 53 | TestBplibEid_Register(); 54 | } -------------------------------------------------------------------------------- /app/inc/bpcat_types.h: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | #ifndef BPLIB_BPCAT_TYPES_H 21 | #define BPLIB_BPCAT_TYPES_H 22 | 23 | #include "bplib.h" 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #define BPCAT_CYCLE_TIME_SECS (1) 31 | 32 | /* Error Codes */ 33 | #define BPCAT_SUCCESS (0L) 34 | #define BPCAT_NULL_PTR_ERR (-1L) 35 | #define BPCAT_FWP_ERR (-2L) 36 | #define BPCAT_SOCKET_ERR (-3L) 37 | #define BPCAT_TASK_INIT_ERR (-4L) 38 | #define BPCAT_NC_INIT_ERR (-5L) 39 | 40 | typedef int BPCat_Status_t; 41 | 42 | typedef struct BPCat_AppData 43 | { 44 | volatile sig_atomic_t Running; 45 | void* PoolMem; 46 | BPLib_Instance_t BPLibInst; 47 | BPLib_NC_ConfigPtrs_t ConfigPtrs; 48 | } BPCat_AppData_t; 49 | 50 | extern BPCat_AppData_t AppData; 51 | 52 | 53 | #endif /* BPLIB_BPCAT_TYPES_H */ 54 | -------------------------------------------------------------------------------- /aa/fwp/unit-test/utilities/bplib_fwp_test_utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | 21 | #ifndef BPLIB_FWP_TEST_UTILS_H 22 | #define BPLIB_FWP_TEST_UTILS_H 23 | 24 | /* ======== */ 25 | /* Includes */ 26 | /* ======== */ 27 | 28 | #include "utassert.h" 29 | #include "utstubs.h" 30 | #include "uttest.h" 31 | 32 | #include "bplib_api_types.h" 33 | #include "bplib_fwp.h" 34 | 35 | #include "bpa_fwp_stubs.h" /* For stub definitions of callbacks */ 36 | 37 | /* =========== */ 38 | /* Global Data */ 39 | /* =========== */ 40 | 41 | extern BPLib_NC_ConfigPtrs_t TestConfigPtrs; 42 | extern BPLib_FWP_ProxyCallbacks_t TestCallbacks; 43 | 44 | /* =================== */ 45 | /* Function Prototypes */ 46 | /* =================== */ 47 | 48 | void BPLib_FWP_Test_Setup(void); 49 | 50 | void BPLib_FWP_Test_Teardown(void); 51 | 52 | void TestBplibFwp_Register(void); 53 | 54 | #endif /* BPLIB_FWP_TEST_UTILS_H */ 55 | -------------------------------------------------------------------------------- /bpa/ebp/unit-test/utilities/bplib_ebp_test_utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | 21 | #ifndef BPLIB_EBP_TEST_UTILS_H 22 | #define BPLIB_EBP_TEST_UTILS_H 23 | 24 | /* 25 | ** Include 26 | */ 27 | 28 | #include "utassert.h" 29 | #include "utstubs.h" 30 | #include "uttest.h" 31 | 32 | #include "bplib_api_types.h" 33 | #include "bplib_ebp.h" 34 | #include "bplib_pi.h" 35 | #include "bplib_nc.h" 36 | 37 | 38 | /* 39 | ** Global Data 40 | */ 41 | 42 | extern BPLib_PI_ChannelTable_t TestChanConfigPtr; 43 | 44 | 45 | /* 46 | ** Macro Definitions 47 | */ 48 | 49 | /* Macro to add test case */ 50 | #define ADD_TEST(test) UtTest_Add(test, BPLib_EBP_Test_Setup, BPLib_EBP_Test_Teardown, #test) 51 | 52 | 53 | /* 54 | ** Function Definitions 55 | */ 56 | 57 | void BPLib_EBP_Test_Setup(void); 58 | void BPLib_EBP_Test_Teardown(void); 59 | 60 | void TestBplibEbp_Register(void); 61 | 62 | #endif /* BPLIB_EBP_TEST_UTILS_H */ 63 | -------------------------------------------------------------------------------- /bpa/ebp/unit-test/utilities/bplib_ebp_test_utils.c: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | 21 | /* 22 | ** Include 23 | */ 24 | 25 | #include "bplib_ebp_test_utils.h" 26 | #include "bplib_time_handlers.h" 27 | 28 | /* 29 | ** Global Data 30 | */ 31 | 32 | BPLib_PI_ChannelTable_t TestChanConfigPtr; 33 | 34 | 35 | /* 36 | ** Function Definitions 37 | */ 38 | 39 | void BPLib_EBP_Test_Setup(void) 40 | { 41 | /* Initialize test environment to default state for every test */ 42 | UT_ResetState(0); 43 | 44 | UT_SetHandlerFunction(UT_KEY(BPLib_TIME_GetTimeDelta), UT_Handler_BPLib_TIME_GetTimeDelta, NULL); 45 | 46 | memset(&TestChanConfigPtr, 0, sizeof(TestChanConfigPtr)); 47 | 48 | BPLib_NC_ConfigPtrs.ChanConfigPtr = &TestChanConfigPtr; 49 | } 50 | 51 | void BPLib_EBP_Test_Teardown(void) 52 | { 53 | /* Clean up test environment */ 54 | } 55 | 56 | void UtTest_Setup(void) 57 | { 58 | TestBplibEbp_Register(); 59 | } 60 | -------------------------------------------------------------------------------- /ci/cbor/unit-test/utilities/bplib_cbor_test_utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | 21 | #ifndef BPLIB_CBOR_TEST_UTILS_H 22 | #define BPLIB_CBOR_TEST_UTILS_H 23 | 24 | /* 25 | ** Include 26 | */ 27 | 28 | #include "utassert.h" 29 | #include "utstubs.h" 30 | #include "uttest.h" 31 | 32 | #include "bplib_api_types.h" 33 | #include "bplib_cbor.h" 34 | #include "bplib_cbor_internal.h" 35 | #include "bplib_crc.h" 36 | 37 | /* 38 | ** Global Data 39 | */ 40 | 41 | extern BPLib_NC_MibPerNodeConfig_t TestMibConfigPnTbl; 42 | 43 | 44 | /* 45 | ** Function Definitions 46 | */ 47 | 48 | void BPLib_CBOR_Test_Setup(void); 49 | void BPLib_CBOR_Test_Teardown(void); 50 | 51 | void TestBplibCborDecode_Register(void); 52 | void TestBplibCborDecodeInternal_Register(void); 53 | 54 | void TestBplibCborEncode_Register(void); 55 | void TestBplibCborEncodePrevNode_Register(void); 56 | void TestBplibCborEncodeInternal_Register(void); 57 | 58 | #endif /* BPLIB_CBOR_TEST_UTILS_H */ 59 | -------------------------------------------------------------------------------- /ci/time/unit-test/utilities/bplib_time_test_utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | 21 | #ifndef BPLIB_TIME_TEST_UTILS_H 22 | #define BPLIB_TIME_TEST_UTILS_H 23 | 24 | /* 25 | ** Include 26 | */ 27 | 28 | #include "utassert.h" 29 | #include "utstubs.h" 30 | #include "uttest.h" 31 | 32 | #include "bplib_api_types.h" 33 | #include "bplib_time.h" 34 | #include "bplib_time_internal.h" 35 | #include "bpa_fwp_stubs.h" 36 | 37 | 38 | /* 39 | ** Macro Definitions 40 | */ 41 | 42 | extern uint16_t TestEpochYear; 43 | 44 | /* 45 | ** Macro Definitions 46 | */ 47 | 48 | /* Macro to add test case */ 49 | #define ADD_TEST(test) UtTest_Add(test, BPLib_TIME_Test_Setup, BPLib_TIME_Test_Teardown, #test) 50 | 51 | /* 52 | ** Function Definitions 53 | */ 54 | 55 | void BPLib_TIME_Test_Setup(void); 56 | void BPLib_TIME_Test_Teardown(void); 57 | 58 | void TestBplibTime_Register(void); 59 | void TestBplibTimeInternal_Register(void); 60 | 61 | #endif /* BPLIB_TIME_TEST_UTILS_H */ 62 | -------------------------------------------------------------------------------- /aa/fwp/unit-test/stubs/bplib_fwp_stubs.c: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | 21 | /** 22 | * @file 23 | * 24 | * Auto-Generated stub implementations for functions defined in bplib_fwp header 25 | */ 26 | 27 | #include "bplib_fwp.h" 28 | #include "utgenstub.h" 29 | 30 | /* =========== */ 31 | /* Global Data */ 32 | /* =========== */ 33 | 34 | BPLib_FWP_ProxyCallbacks_t BPLib_FWP_ProxyCallbacks; 35 | 36 | /* 37 | * ---------------------------------------------------- 38 | * Generated stub function for BPLib_FWP_Init() 39 | * ---------------------------------------------------- 40 | */ 41 | BPLib_Status_t BPLib_FWP_Init(BPLib_FWP_ProxyCallbacks_t *Callbacks) 42 | { 43 | UT_GenStub_SetupReturnBuffer(BPLib_FWP_Init, BPLib_Status_t); 44 | 45 | UT_GenStub_AddParam(BPLib_FWP_Init, BPLib_FWP_ProxyCallbacks_t *, Callbacks); 46 | 47 | UT_GenStub_Execute(BPLib_FWP_Init, Basic, NULL); 48 | 49 | return UT_GenStub_GetReturnValue(BPLib_FWP_Init, BPLib_Status_t); 50 | } 51 | -------------------------------------------------------------------------------- /ci/pl/src/bplib_pl.c: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | 21 | /* 22 | ** Include 23 | */ 24 | 25 | #include "bplib_pl.h" 26 | #include "bplib_fwp.h" 27 | 28 | 29 | /* 30 | ** Function Definitions 31 | */ 32 | 33 | int BPLib_PL_Init(void) { 34 | return BPLIB_SUCCESS; 35 | } 36 | 37 | BPLib_Status_t BPLib_PL_PerfLogEntry(uint32_t PerfLogID) 38 | { 39 | if (BPLib_FWP_ProxyCallbacks.BPA_PERFLOGP_Entry) 40 | { 41 | BPLib_FWP_ProxyCallbacks.BPA_PERFLOGP_Entry(PerfLogID); 42 | } 43 | else 44 | { 45 | return BPLIB_PL_NULL_CALLBACK_ERROR; 46 | } 47 | return BPLIB_SUCCESS; 48 | } 49 | 50 | BPLib_Status_t BPLib_PL_PerfLogExit(uint32_t PerfLogID) 51 | { 52 | if (BPLib_FWP_ProxyCallbacks.BPA_PERFLOGP_Exit) 53 | { 54 | BPLib_FWP_ProxyCallbacks.BPA_PERFLOGP_Exit(PerfLogID); 55 | } 56 | else 57 | { 58 | return BPLIB_PL_NULL_CALLBACK_ERROR; 59 | } 60 | return BPLIB_SUCCESS; 61 | } 62 | -------------------------------------------------------------------------------- /cla/unit-test/utilities/bplib_cla_test_utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | 21 | #ifndef BPLIB_CLA_TEST_UTILS_H 22 | #define BPLIB_CLA_TEST_UTILS_H 23 | 24 | /* ======== */ 25 | /* Includes */ 26 | /* ======== */ 27 | 28 | #include "utassert.h" 29 | #include "utstubs.h" 30 | #include "uttest.h" 31 | 32 | #include "bplib_cla.h" 33 | #include "bplib_api_types.h" 34 | #include "bplib_cla_internal.h" 35 | #include "bplib_qm_handlers.h" 36 | 37 | /* Macro to add test case */ 38 | #define ADD_TEST(test) UtTest_Add(test, BPLib_CLA_Test_Setup, BPLib_CLA_Test_Teardown, #test) 39 | 40 | 41 | /* ==================== */ 42 | /* Function Definitions */ 43 | /* ==================== */ 44 | 45 | void BPLib_CLA_Test_Verify_Event(uint16_t EventNum, int32_t EventID, const char* EventText); 46 | 47 | void BPLib_CLA_Test_Setup(void); 48 | void BPLib_CLA_Test_Teardown(void); 49 | 50 | void TestBplibCla_Register(void); 51 | void TestBplibClaInternal_Register(void); 52 | 53 | #endif /* BPLIB_CLA_TEST_UTILS_H */ 54 | -------------------------------------------------------------------------------- /ci/eid/unit-test/utilities/bplib_eid_test_utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | 21 | #ifndef BPLIB_EID_TEST_UTILS_H 22 | #define BPLIB_EID_TEST_UTILS_H 23 | 24 | /* ======== */ 25 | /* Includes */ 26 | /* ======== */ 27 | 28 | #include "utassert.h" 29 | #include "utstubs.h" 30 | #include "uttest.h" 31 | 32 | #include "bplib_eid.h" 33 | #include "bplib_cfg.h" 34 | 35 | /* =========== */ 36 | /* Global Data */ 37 | /* =========== */ 38 | 39 | extern BPLib_EID_t EID_Actual; 40 | extern BPLib_EID_t EID_Reference; 41 | extern BPLib_EID_Pattern_t EID_Pattern; 42 | 43 | /* ====== */ 44 | /* Macros */ 45 | /* ====== */ 46 | 47 | // Add a test case 48 | #define ADD_TEST(test) UtTest_Add(test, BPLib_EID_Test_Setup, BPLib_EID_Test_Teardown, #test) 49 | 50 | /* ==================== */ 51 | /* Function Definitions */ 52 | /* ==================== */ 53 | 54 | void BPLib_EID_Test_Setup(void); 55 | void BPLib_EID_Test_Teardown(void); 56 | void TestBplibEid_Register(void); 57 | 58 | #endif /* BPLIB_EID_TEST_UTILS_H */ 59 | -------------------------------------------------------------------------------- /bpa/pi/unit-test/utilities/bplib_pi_test_utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | 21 | #ifndef BPLIB_PI_TEST_UTILS_H 22 | #define BPLIB_PI_TEST_UTILS_H 23 | 24 | /* 25 | ** Include 26 | */ 27 | 28 | #include "utassert.h" 29 | #include "utstubs.h" 30 | #include "uttest.h" 31 | 32 | #include "bplib_api_types.h" 33 | #include "bplib_pi.h" 34 | #include "bplib_fwp.h" 35 | #include "bplib_nc.h" 36 | #include "bplib_qm_handlers.h" 37 | #include "bplib_em_handlers.h" 38 | #include "bpa_fwp_stubs.h" /* For ADUP stubs */ 39 | 40 | /* Macro to add test case */ 41 | #define ADD_TEST(test) UtTest_Add(test, BPLib_PI_Test_Setup, BPLib_PI_Test_Teardown, #test) 42 | 43 | 44 | /* 45 | ** Global Data 46 | */ 47 | 48 | extern BPLib_Instance_t BplibInst; 49 | extern uint64_t BPLib_PI_SequenceNums[BPLIB_MAX_NUM_CHANNELS]; 50 | 51 | /* 52 | ** Function Definitions 53 | */ 54 | 55 | void BPLib_PI_Test_Setup(void); 56 | void BPLib_PI_Test_Teardown(void); 57 | 58 | void TestBplibPi_Register(void); 59 | 60 | #endif /* BPLIB_PI_TEST_UTILS_H */ 61 | -------------------------------------------------------------------------------- /binding/lua/test/ut_attributes.lua: -------------------------------------------------------------------------------- 1 | local bplib = require("bplib") 2 | local runner = require("bptest") 3 | local bp = require("bp") 4 | local src = runner.srcscript() 5 | local rd = runner.rootdir(arg[0]) 6 | 7 | -- Setup -- 8 | 9 | store = arg[1] or "RAM" 10 | runner.setup(bplib, store) 11 | 12 | -- Test -- 13 | 14 | ----------------------------------------------------------------------- 15 | print(string.format('%s/%s: Test 1 - lifetime', store, src)) 16 | lifetime = 100 17 | attributes = {lifetime=lifetime} 18 | ch = bplib.open(4, 3, 72, 43, store, attributes) 19 | runner.check(ch ~= nil) 20 | if ch then 21 | rc, d = ch:getopt("LIFETIME") 22 | runner.check(rc == true) 23 | runner.check(d == lifetime, string.format('Failed to set lifetime to %d, value was %d instead\n', lifetime, d)) 24 | ch:close() 25 | end 26 | 27 | ----------------------------------------------------------------------- 28 | print(string.format('%s/%s: Test 2 - active table size', store, src)) 29 | active_table_size = 10 30 | attributes = {active_table_size=active_table_size} 31 | ch = bplib.open(4, 3, 72, 43, store, attributes) 32 | runner.check(ch ~= nil) 33 | if ch then 34 | -- fill table -- 35 | for i=1,active_table_size do 36 | payload = string.format('HELLO WORLD %d', i) 37 | 38 | -- store payload -- 39 | rc, flags = ch:store(payload, 1000) 40 | runner.check(rc) 41 | runner.check(bp.check_flags(flags, {}), "flags set on store") 42 | 43 | -- load bundle -- 44 | rc, bundle, flags = ch:load(1000) 45 | runner.check(rc) 46 | runner.check(bundle ~= nil) 47 | runner.check(bp.check_flags(flags, {}), "flags set on load") 48 | end 49 | 50 | -- full table -- 51 | rc, bundle, flags = ch:load(1000) 52 | runner.check(rc == false) 53 | runner.check(bundle == nil) 54 | runner.check(bp.check_flags(flags, {"activetablewrap"})) 55 | 56 | -- close channel -- 57 | ch:flush() 58 | ch:close() 59 | end 60 | 61 | -- Clean Up -- 62 | 63 | runner.cleanup(bplib, store) 64 | 65 | -- Report Results -- 66 | 67 | runner.report(bplib) 68 | 69 | -------------------------------------------------------------------------------- /cla/unit-test/stubs/bplib_cla_handlers.c: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | 21 | #include "bplib_cla_handlers.h" 22 | #include "bplib_cla.h" 23 | 24 | void UT_Handler_BPLib_CLA_GetContactRunState(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) 25 | { 26 | BPLib_CLA_ContactRunState_t* ReturnState = UT_Hook_GetArgValueByName(Context, "ReturnState", BPLib_CLA_ContactRunState_t*); 27 | int32 Status; 28 | 29 | UT_Stub_GetInt32StatusCode(Context, &Status); 30 | 31 | if (Status >= 0) 32 | { 33 | UT_Stub_CopyToLocal(UT_KEY(BPLib_CLA_GetContactRunState), ReturnState, sizeof(BPLib_CLA_ContactRunState_t*)); 34 | } 35 | } 36 | 37 | void UT_Handler_BPLib_CLA_Egress(void* UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t* Context) 38 | { 39 | size_t* MsgSize = UT_Hook_GetArgValueByName(Context, "Size", size_t*); 40 | int32 Status; 41 | 42 | UT_Stub_GetInt32StatusCode(Context, &Status); 43 | if (Status >= 0) 44 | { 45 | UT_Stub_CopyToLocal(UT_KEY(BPLib_CLA_Egress), MsgSize, sizeof(size_t*)); 46 | } 47 | } -------------------------------------------------------------------------------- /ci/cbor/unit-test/utilities/bplib_cbor_test_utils.c: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | 21 | /* 22 | ** Include 23 | */ 24 | 25 | #include "bplib_cbor_test_utils.h" 26 | #include "bplib_nc.h" 27 | 28 | 29 | /* 30 | ** Global Data 31 | */ 32 | 33 | BPLib_NC_MibPerNodeConfig_t TestMibConfigPnTbl; 34 | 35 | 36 | /* 37 | ** Function Definitions 38 | */ 39 | 40 | void BPLib_CBOR_Test_Setup(void) 41 | { 42 | /* Initialize test environment to default state for every test */ 43 | UT_ResetState(0); 44 | 45 | BPLib_NC_ConfigPtrs.MibPnConfigPtr = &TestMibConfigPnTbl; 46 | 47 | /* Set default max length to something excessively high for most tests */ 48 | TestMibConfigPnTbl.Configs[PARAM_SET_MAX_BUNDLE_LENGTH] = 1000000; 49 | } 50 | 51 | void BPLib_CBOR_Test_Teardown(void) 52 | { 53 | /* Clean up test environment */ 54 | } 55 | 56 | void UtTest_Setup(void) 57 | { 58 | TestBplibCborDecode_Register(); 59 | TestBplibCborDecodeInternal_Register(); 60 | 61 | TestBplibCborEncode_Register(); 62 | TestBplibCborEncodePrevNode_Register(); 63 | TestBplibCborEncodeInternal_Register(); 64 | } 65 | -------------------------------------------------------------------------------- /ci/em/unit-test/stubs/bplib_em_handlers.h: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | 21 | #ifndef BPLIB_EM_HANDLERS_H 22 | #define BPLIB_EM_HANDLERS_H 23 | 24 | /* ======== */ 25 | /* Includes */ 26 | /* ======== */ 27 | 28 | #include "utassert.h" 29 | #include "utstubs.h" 30 | #include "uttest.h" 31 | 32 | #include "bplib_em.h" 33 | 34 | 35 | /* ================= */ 36 | /* Macro Definitions */ 37 | /* ================= */ 38 | 39 | #define UT_MAX_SENDEVENT_DEPTH 80 40 | 41 | /* ================ */ 42 | /* Type Definitions */ 43 | /* ================ */ 44 | 45 | /* Unit test check event hook information */ 46 | typedef struct 47 | { 48 | uint16_t EventID; 49 | BPLib_EM_EventType_t EventType; 50 | char Spec[BPLIB_EM_EXPANDED_EVENT_SIZE]; 51 | } BPLib_EM_SendEvent_context_t; 52 | 53 | 54 | /* =========== */ 55 | /* Global Data */ 56 | /* =========== */ 57 | 58 | extern BPLib_EM_SendEvent_context_t context_BPLib_EM_SendEvent[]; 59 | 60 | 61 | /* ==================== */ 62 | /* Function Definitions */ 63 | /* ==================== */ 64 | 65 | void UT_Handler_BPLib_EM_SendEvent(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context); 66 | 67 | #endif /* BPLIB_EM_HANDLERS_H */ 68 | -------------------------------------------------------------------------------- /ci/mem/src/bplib_std_allocator.c: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | 21 | #include "bplib_std_allocator.h" 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | BPLib_Status_t BPLib_MEM_PoolImplInit(BPLib_MEM_PoolImpl_t* pool, const void* init_mem, 28 | size_t mem_len, uint32_t block_size) 29 | { 30 | if (pool == NULL) 31 | { 32 | return BPLIB_ERROR; 33 | } 34 | if (init_mem != NULL) 35 | { 36 | printf("WARNING: STDALLOC doesn't actually use the init_mem param: It just calls malloc()\n"); 37 | } 38 | 39 | memset(pool, 0, sizeof(BPLib_MEM_PoolImpl_t)); 40 | pool->mem = (void*)init_mem; 41 | pool->size = 0; 42 | pool->block_size = block_size; 43 | return BPLIB_SUCCESS; 44 | } 45 | 46 | void BPLib_MEM_PoolImplDestroy(BPLib_MEM_PoolImpl_t* pool) 47 | { 48 | if (pool == NULL) 49 | { 50 | return; 51 | } 52 | memset(pool, 0, sizeof(BPLib_MEM_PoolImpl_t)); 53 | } 54 | 55 | void* BPLib_MEM_PoolImplAlloc(BPLib_MEM_PoolImpl_t* pool) 56 | { 57 | return malloc(pool->block_size); 58 | } 59 | 60 | void BPLib_MEM_PoolImplFree(BPLib_MEM_PoolImpl_t* pool, void* to_free) 61 | { 62 | free(to_free); 63 | } 64 | -------------------------------------------------------------------------------- /binding/lua/test/ut_eid2ipn.lua: -------------------------------------------------------------------------------- 1 | local bplib = require("bplib") 2 | local runner = require("bptest") 3 | local src = runner.srcscript() 4 | 5 | -- Setup -- 6 | 7 | runner.setup(bplib, "RAM") 8 | 9 | -- Test -- 10 | 11 | ----------------------------------------------------------------------- 12 | print(string.format('%s: Test 1 - nominal', src)) 13 | rc, node, serv = bplib.eid2ipn("ipn:4.3") 14 | runner.check('rc == true') 15 | runner.check('node == 4') 16 | runner.check('serv == 3') 17 | 18 | ----------------------------------------------------------------------- 19 | print(string.format('%s: Test 2 - nominal', src)) 20 | rc, node, serv = bplib.eid2ipn("ipn:72.43") 21 | runner.check('rc == true') 22 | runner.check('node == 72') 23 | runner.check('serv == 43') 24 | 25 | ----------------------------------------------------------------------- 26 | print(string.format('%s: Test 3 - bad schema', src)) 27 | rc, node, serv = bplib.eid2ipn("eid:72.43") 28 | runner.check('rc == false') 29 | 30 | ----------------------------------------------------------------------- 31 | print(string.format('%s: Test 4 - bad node', src)) 32 | rc, node, serv = bplib.eid2ipn("ipn:nasa.43") 33 | runner.check('rc == false') 34 | 35 | ----------------------------------------------------------------------- 36 | print(string.format('%s: Test 5 - bad service', src)) 37 | rc, node, serv = bplib.eid2ipn("ipn:72.nasa") 38 | runner.check('rc == false') 39 | 40 | ----------------------------------------------------------------------- 41 | print(string.format('%s: Test 6 - no schema', src)) 42 | rc, node, serv = bplib.eid2ipn("2343.343") 43 | runner.check('rc == false') 44 | 45 | ----------------------------------------------------------------------- 46 | print(string.format('%s: Test 7 - too short', src)) 47 | rc, node, serv = bplib.eid2ipn("ipn:23") 48 | runner.check('rc == false') 49 | 50 | ----------------------------------------------------------------------- 51 | print(string.format('%s: Test 8 - too long', src)) 52 | eid = "ipn:" 53 | for i=1,64,1 do eid = eid .. "123" end 54 | rc, node, serv = bplib.eid2ipn(eid) 55 | runner.check('rc == false') 56 | 57 | -- Clean Up -- 58 | 59 | runner.cleanup(bplib, store) 60 | 61 | -- Report Results -- 62 | 63 | runner.report(bplib) 64 | 65 | -------------------------------------------------------------------------------- /bpa/stor/unit-test/utilities/bplib_stor_test_utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | 21 | #ifndef BPLIB_STOR_TEST_UTILS_H 22 | #define BPLIB_STOR_TEST_UTILS_H 23 | 24 | /* 25 | ** Include 26 | */ 27 | 28 | #include "utassert.h" 29 | #include "utstubs.h" 30 | #include "uttest.h" 31 | 32 | #include "bplib_api_types.h" 33 | #include "bplib_as_handlers.h" 34 | #include "bplib_stor.h" 35 | #include "bplib_stor_sql.h" 36 | #include "bplib_em_handlers.h" 37 | #include "bplib_qm_handlers.h" 38 | #include "bpa_fwp_stubs.h" 39 | 40 | /* 41 | ** Global Data 42 | */ 43 | 44 | extern BPLib_Instance_t BplibInst; 45 | 46 | /* 47 | ** Helper Utilities 48 | */ 49 | void BPLib_STOR_Test_CreateTestBundle(BPLib_Bundle_t* Bundle); 50 | void BPLib_STOR_Test_FreeTestBundle(BPLib_Bundle_t* Bundle); 51 | 52 | /* 53 | ** Function Definitions 54 | */ 55 | 56 | void BPLib_STOR_Test_Setup(void); 57 | void BPLib_STOR_Test_Teardown(void); 58 | 59 | void BPLib_STOR_Test_SetupOneBundleStored(void); 60 | void BPLib_STOR_Test_TeardownOneBundleStored(void); 61 | 62 | void TestBplib_STOR_Register(void); 63 | void TestBplib_STOR_LoadBatch_Register(void); 64 | void TestBplib_STOR_Load_Register(void); 65 | void TestBplib_STOR_Store_Register(void); 66 | 67 | #endif /* BPLIB_STOR_TEST_UTILS_H */ 68 | -------------------------------------------------------------------------------- /bpa/ct/unit-test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ################################################################## 2 | # 3 | # Coverage test build recipe 4 | # 5 | # This CMake file contains the recipe for building the coverage tests. 6 | # It is invoked from the parent directory when unit tests are enabled. 7 | # 8 | ################################################################## 9 | 10 | # Create stubs (for external use) 11 | add_library(bplib_ct_stubs STATIC 12 | stubs/bplib_ct_stubs.c 13 | ) 14 | 15 | target_include_directories(bplib_ct_stubs PUBLIC 16 | $ 17 | ) 18 | 19 | target_link_libraries(bplib_ct_stubs PUBLIC ut_assert) 20 | 21 | # Create unit test object 22 | add_library(utobj_bplib_ct OBJECT 23 | ../src/bplib_ct.c 24 | ) 25 | 26 | target_compile_definitions(utobj_bplib_ct PRIVATE 27 | $ 28 | $ 29 | ) 30 | 31 | target_compile_options(utobj_bplib_ct PRIVATE 32 | $ 33 | $ 34 | ) 35 | 36 | target_include_directories(utobj_bplib_ct PRIVATE 37 | $ 38 | $ 39 | ) 40 | 41 | # Create test runner executable 42 | add_executable(coverage-bplib_ct-testrunner 43 | utilities/bplib_ct_test_utils.c 44 | bplib_ct_test.c 45 | $ 46 | ) 47 | 48 | target_include_directories(coverage-bplib_ct-testrunner PRIVATE 49 | ../src 50 | utilities/ 51 | ${CMAKE_CURRENT_SOURCE_DIR}/inc 52 | $ 53 | ) 54 | 55 | target_link_libraries(coverage-bplib_ct-testrunner PUBLIC 56 | ut_coverage_link 57 | ut_assert 58 | ) 59 | 60 | add_test(coverage-bplib_ct-testrunner coverage-bplib_ct-testrunner) 61 | 62 | # Install the executables to a staging area for test in cross environments 63 | if (INSTALL_TARGET_LIST) 64 | foreach(TGT ${INSTALL_TARGET_LIST}) 65 | install(TARGETS coverage-bplib_ct-testrunner DESTINATION ${TGT}/${UT_INSTALL_SUBDIR}) 66 | endforeach() 67 | endif() 68 | -------------------------------------------------------------------------------- /binding/lua/test/test_runner.lua: -------------------------------------------------------------------------------- 1 | local bplib = require("bplib") 2 | local runner = require("bptest") 3 | local rd = runner.rootdir(arg[0]) 4 | 5 | --runner.set_exit_on_error(true) 6 | 7 | start_currmem, start_highmem = bplib.memstat() 8 | 9 | -- Run Unit Tests -- 10 | 11 | runner.script(rd .. "ut_open_close.lua", {"RAM"}) 12 | runner.script(rd .. "ut_open_close.lua", {"FILE"}) 13 | runner.script(rd .. "ut_open_close.lua", {"FLASH"}) 14 | runner.script(rd .. "ut_attributes.lua") 15 | runner.script(rd .. "ut_getset_opt.lua") 16 | runner.script(rd .. "ut_eid2ipn.lua") 17 | runner.script(rd .. "ut_ipn2eid.lua") 18 | runner.script(rd .. "ut_route.lua") 19 | runner.script(rd .. "ut_expiration.lua") 20 | runner.script(rd .. "ut_expiration.lua", {"FLASH"}) 21 | runner.script(rd .. "ut_recover.lua", {"FLASH"}) 22 | runner.script(rd .. "ut_memusage.lua", {"RAM"}) 23 | runner.script(rd .. "ut_active_table.lua", {"RAM", "SMALLEST"}) 24 | runner.script(rd .. "ut_active_table.lua", {"RAM", "OLDEST"}) 25 | runner.script(rd .. "ut_active_table.lua", {"FLASH", "SMALLEST"}) 26 | runner.script(rd .. "ut_active_table.lua", {"FLASH", "OLDEST"}) 27 | runner.script(rd .. "ut_bundle_timeout.lua", {"RAM"}) 28 | runner.script(rd .. "ut_bundle_timeout.lua", {"FILE"}) 29 | runner.script(rd .. "ut_bundle_timeout.lua", {"FLASH"}) 30 | runner.script(rd .. "ut_wrap_response.lua", {"RAM"}) 31 | runner.script(rd .. "ut_wrap_response.lua", {"FILE"}) 32 | runner.script(rd .. "ut_wrap_response.lua", {"FLASH"}) 33 | runner.script(rd .. "ut_dacs_continuous.lua", {"RAM"}) 34 | runner.script(rd .. "ut_dacs_continuous.lua", {"FILE"}) 35 | runner.script(rd .. "ut_dacs_continuous.lua", {"FLASH"}) 36 | runner.script(rd .. "ut_dacs_skip.lua", {"RAM"}) 37 | runner.script(rd .. "ut_dacs_skip.lua", {"FILE"}) 38 | runner.script(rd .. "ut_dacs_skip.lua", {"FLASH"}) 39 | runner.script(rd .. "ut_high_loss.lua", {"RAM"}) 40 | runner.script(rd .. "ut_high_loss.lua", {"FILE"}) 41 | runner.script(rd .. "ut_high_loss.lua", {"FLASH", 100}) 42 | runner.script(rd .. "ut_unittest.lua") 43 | 44 | -- Check for Memory Leaks -- 45 | 46 | currmem, highmem = bplib.memstat() 47 | runner.check(currmem == start_currmem, string.format('Memory leak detected: %d!', currmem - start_currmem)) 48 | 49 | -- Report Results -- 50 | 51 | runner.report(bplib) 52 | 53 | -------------------------------------------------------------------------------- /aa/arp/unit-test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ################################################################## 2 | # 3 | # Coverage test build recipe 4 | # 5 | # This CMake file contains the recipe for building the coverage tests. 6 | # It is invoked from the parent directory when unit tests are enabled. 7 | # 8 | ################################################################## 9 | 10 | # Create stubs (for external use) 11 | add_library(bplib_arp_stubs STATIC 12 | stubs/bplib_arp_stubs.c 13 | ) 14 | 15 | target_include_directories(bplib_arp_stubs PUBLIC 16 | $ 17 | ) 18 | 19 | target_link_libraries(bplib_arp_stubs PUBLIC ut_assert) 20 | 21 | # Create unit test object 22 | add_library(utobj_bplib_arp OBJECT 23 | ../src/bplib_arp.c 24 | ) 25 | 26 | target_compile_definitions(utobj_bplib_arp PRIVATE 27 | $ 28 | $ 29 | ) 30 | 31 | target_compile_options(utobj_bplib_arp PRIVATE 32 | $ 33 | $ 34 | ) 35 | 36 | target_include_directories(utobj_bplib_arp PRIVATE 37 | $ 38 | $ 39 | ) 40 | 41 | # Create test runner executable 42 | add_executable(coverage-bplib_arp-testrunner 43 | utilities/bplib_arp_test_utils.c 44 | bplib_arp_test.c 45 | $ 46 | ) 47 | 48 | target_include_directories(coverage-bplib_arp-testrunner PRIVATE 49 | ../src 50 | utilities/ 51 | ${CMAKE_CURRENT_SOURCE_DIR}/inc 52 | $ 53 | ) 54 | 55 | target_link_libraries(coverage-bplib_arp-testrunner PUBLIC 56 | ut_coverage_link 57 | ut_assert 58 | ) 59 | 60 | add_test(coverage-bplib_arp-testrunner coverage-bplib_arp-testrunner) 61 | 62 | # Install the executables to a staging area for test in cross environments 63 | if (INSTALL_TARGET_LIST) 64 | foreach(TGT ${INSTALL_TARGET_LIST}) 65 | install(TARGETS coverage-bplib_arp-testrunner DESTINATION ${TGT}/${UT_INSTALL_SUBDIR}) 66 | endforeach() 67 | endif() 68 | -------------------------------------------------------------------------------- /bpa/pdb/unit-test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ################################################################## 2 | # 3 | # Coverage test build recipe 4 | # 5 | # This CMake file contains the recipe for building the coverage tests. 6 | # It is invoked from the parent directory when unit tests are enabled. 7 | # 8 | ################################################################## 9 | 10 | # Create stubs (for external use) 11 | add_library(bplib_pdb_stubs STATIC 12 | stubs/bplib_pdb_stubs.c 13 | ) 14 | 15 | target_include_directories(bplib_pdb_stubs PUBLIC 16 | $ 17 | ) 18 | 19 | target_link_libraries(bplib_pdb_stubs PUBLIC ut_assert) 20 | 21 | # Create unit test object 22 | add_library(utobj_bplib_pdb OBJECT 23 | ../src/bplib_pdb.c 24 | ) 25 | 26 | target_compile_definitions(utobj_bplib_pdb PRIVATE 27 | $ 28 | $ 29 | ) 30 | 31 | target_compile_options(utobj_bplib_pdb PRIVATE 32 | $ 33 | $ 34 | ) 35 | 36 | target_include_directories(utobj_bplib_pdb PRIVATE 37 | $ 38 | $ 39 | ) 40 | 41 | # Create test runner executable 42 | add_executable(coverage-bplib_pdb-testrunner 43 | utilities/bplib_pdb_test_utils.c 44 | bplib_pdb_test.c 45 | $ 46 | ) 47 | 48 | target_include_directories(coverage-bplib_pdb-testrunner PRIVATE 49 | ../src 50 | utilities/ 51 | ${CMAKE_CURRENT_SOURCE_DIR}/inc 52 | $ 53 | ) 54 | 55 | target_link_libraries(coverage-bplib_pdb-testrunner PUBLIC 56 | ut_coverage_link 57 | ut_assert 58 | ) 59 | 60 | add_test(coverage-bplib_pdb-testrunner coverage-bplib_pdb-testrunner) 61 | 62 | # Install the executables to a staging area for test in cross environments 63 | if (INSTALL_TARGET_LIST) 64 | foreach(TGT ${INSTALL_TARGET_LIST}) 65 | install(TARGETS coverage-bplib_pdb-testrunner DESTINATION ${TGT}/${UT_INSTALL_SUBDIR}) 66 | endforeach() 67 | endif() 68 | -------------------------------------------------------------------------------- /binding/lua/test/ut_open_close.lua: -------------------------------------------------------------------------------- 1 | local bplib = require("bplib") 2 | local runner = require("bptest") 3 | local src = runner.srcscript() 4 | local rd = runner.rootdir(arg[0]) 5 | 6 | -- Setup -- 7 | 8 | store = arg[1] or "RAM" 9 | runner.setup(bplib, store) 10 | 11 | max_channels = 4 12 | ch = {} 13 | 14 | -- Test -- 15 | 16 | ----------------------------------------------------------------------- 17 | print(string.format('%s/%s: Test 1 - nominal', store, src)) 18 | ch[1] = bplib.open(4, 3, 72, 43, store) 19 | runner.check('ch[1]') 20 | ch[1]:close() 21 | 22 | ----------------------------------------------------------------------- 23 | print(string.format('%s/%s: Test 2 - multiple channels', store, src)) 24 | for i=1,max_channels do 25 | ch[i] = bplib.open(4, i, 72, 43, store) 26 | eval = string.format('ch[%d]', i) 27 | runner.check(eval) 28 | end 29 | for i=1,max_channels do 30 | ch[i]:close() 31 | end 32 | 33 | ----------------------------------------------------------------------- 34 | print(string.format('%s/%s: Test 3 - out of order channel create', store, src)) 35 | ch[1] = bplib.open(4, 1, 72, 43, store) 36 | runner.check('ch[1]') 37 | ch[2] = bplib.open(4, 2, 72, 43, store) 38 | runner.check('ch[2]') 39 | ch[3] = bplib.open(4, 3, 72, 43, store) 40 | runner.check('ch[3]') 41 | ch[4] = bplib.open(4, 4, 72, 43, store) 42 | runner.check('ch[4]') 43 | ch[2]:close() 44 | ch[4]:close() 45 | ch[2] = bplib.open(4, 2, 72, 43, store) 46 | runner.check('ch[2]') 47 | ch[4] = bplib.open(4, 4, 72, 43, store) 48 | runner.check('ch[4]') 49 | ch[1]:close() 50 | ch[2]:close() 51 | ch[3]:close() 52 | ch[4]:close() 53 | 54 | ----------------------------------------------------------------------- 55 | print(string.format('%s/%s: Test 4 - closed channel access', store, src)) 56 | ch[1] = bplib.open(4, 1, 72, 43, store) 57 | runner.check('ch[1]') 58 | ch[1]:close() 59 | rc, dstnode = ch[1]:getopt("TIMEOUT") 60 | runner.check('rc == false') 61 | 62 | ----------------------------------------------------------------------- 63 | print(string.format('%s/%s: Test 5 - invalid store', store, src)) 64 | ch[1] = bplib.open(4, 1, 72, 43, "PARSLEY") 65 | runner.check('ch[1] == nil') 66 | 67 | -- Clean Up -- 68 | 69 | runner.cleanup(bplib, store) 70 | 71 | -- Report Results -- 72 | 73 | runner.report(bplib) 74 | 75 | -------------------------------------------------------------------------------- /ci/crc/unit-test/stubs/bplib_crc_stubs.c: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | 21 | /** 22 | * @file 23 | * 24 | * Auto-Generated stub implementations for functions defined in bplib_crc header 25 | */ 26 | 27 | #include "bplib_crc.h" 28 | #include "utgenstub.h" 29 | 30 | /* 31 | * ---------------------------------------------------- 32 | * Generated stub function for BPLib_CRC_Calculate() 33 | * ---------------------------------------------------- 34 | */ 35 | BPLib_CRC_Val_t BPLib_CRC_Calculate(const void *Data, size_t DataLen, BPLib_CRC_Type_t CrcType) 36 | { 37 | UT_GenStub_SetupReturnBuffer(BPLib_CRC_Calculate, BPLib_CRC_Val_t); 38 | 39 | UT_GenStub_AddParam(BPLib_CRC_Calculate, const void *, Data); 40 | UT_GenStub_AddParam(BPLib_CRC_Calculate, size_t, DataLen); 41 | UT_GenStub_AddParam(BPLib_CRC_Calculate, BPLib_CRC_Type_t, CrcType); 42 | 43 | UT_GenStub_Execute(BPLib_CRC_Calculate, Basic, NULL); 44 | 45 | return UT_GenStub_GetReturnValue(BPLib_CRC_Calculate, BPLib_CRC_Val_t); 46 | } 47 | 48 | /* 49 | * ---------------------------------------------------- 50 | * Generated stub function for BPLib_CRC_Init() 51 | * ---------------------------------------------------- 52 | */ 53 | void BPLib_CRC_Init(void) 54 | { 55 | 56 | UT_GenStub_Execute(BPLib_CRC_Init, Basic, NULL); 57 | } 58 | -------------------------------------------------------------------------------- /ci/crc/unit-test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ################################################################## 2 | # 3 | # Coverage test build recipe 4 | # 5 | # This CMake file contains the recipe for building the coverage tests. 6 | # It is invoked from the parent directory when unit tests are enabled. 7 | # 8 | ################################################################## 9 | 10 | # Create stubs (for external use) 11 | add_library(bplib_crc_stubs STATIC 12 | stubs/bplib_crc_stubs.c 13 | ) 14 | 15 | target_include_directories(bplib_crc_stubs PUBLIC 16 | $ 17 | ../src 18 | ) 19 | 20 | target_link_libraries(bplib_crc_stubs PUBLIC ut_assert) 21 | 22 | # Create unit test object 23 | add_library(utobj_bplib_crc OBJECT 24 | ../src/bplib_crc.c 25 | ) 26 | 27 | target_compile_definitions(utobj_bplib_crc PRIVATE 28 | $ 29 | $ 30 | ) 31 | 32 | target_compile_options(utobj_bplib_crc PRIVATE 33 | $ 34 | $ 35 | ) 36 | 37 | target_include_directories(utobj_bplib_crc PRIVATE 38 | $ 39 | $ 40 | ) 41 | 42 | # Create test runner executable 43 | add_executable(coverage-bplib_crc-testrunner 44 | utilities/bplib_crc_test_utils.c 45 | bplib_crc_test.c 46 | $ 47 | ) 48 | 49 | target_include_directories(coverage-bplib_crc-testrunner PRIVATE 50 | ../src 51 | utilities/ 52 | ${CMAKE_CURRENT_SOURCE_DIR}/inc 53 | $ 54 | ) 55 | 56 | target_link_libraries(coverage-bplib_crc-testrunner PUBLIC 57 | ut_coverage_link 58 | ut_assert 59 | ) 60 | 61 | add_test(coverage-bplib_crc-testrunner coverage-bplib_crc-testrunner) 62 | 63 | # Install the executables to a staging area for test in cross environments 64 | if (INSTALL_TARGET_LIST) 65 | foreach(TGT ${INSTALL_TARGET_LIST}) 66 | install(TARGETS coverage-bplib_crc-testrunner DESTINATION ${TGT}/${UT_INSTALL_SUBDIR}) 67 | endforeach() 68 | endif() 69 | -------------------------------------------------------------------------------- /ci/eid/unit-test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ################################################################## 2 | # 3 | # Coverage test build recipe 4 | # 5 | # This CMake file contains the recipe for building the coverage tests. 6 | # It is invoked from the parent directory when unit tests are enabled. 7 | # 8 | ################################################################## 9 | 10 | # Create stubs (for external use) 11 | add_library(bplib_eid_stubs STATIC 12 | stubs/bplib_eid_stubs.c 13 | ) 14 | 15 | target_include_directories(bplib_eid_stubs PUBLIC 16 | $ 17 | stubs/ 18 | ) 19 | 20 | target_link_libraries(bplib_eid_stubs PUBLIC ut_assert) 21 | 22 | # Create unit test object 23 | add_library(utobj_bplib_eid OBJECT 24 | ../src/bplib_eid.c 25 | ) 26 | 27 | target_compile_definitions(utobj_bplib_eid PRIVATE 28 | $ 29 | $ 30 | ) 31 | 32 | target_compile_options(utobj_bplib_eid PRIVATE 33 | $ 34 | $ 35 | ) 36 | 37 | target_include_directories(utobj_bplib_eid PRIVATE 38 | $ 39 | $ 40 | ) 41 | 42 | # Create test runner executable 43 | add_executable(coverage-bplib_eid-testrunner 44 | utilities/bplib_eid_test_utils.c 45 | bplib_eid_test.c 46 | $ 47 | ) 48 | 49 | target_include_directories(coverage-bplib_eid-testrunner PRIVATE 50 | ../src 51 | utilities/ 52 | ${CMAKE_CURRENT_SOURCE_DIR}/inc 53 | $ 54 | ) 55 | 56 | target_link_libraries(coverage-bplib_eid-testrunner PUBLIC 57 | ut_coverage_link 58 | ut_assert 59 | ) 60 | 61 | add_test(coverage-bplib_eid-testrunner coverage-bplib_eid-testrunner) 62 | 63 | # Install the executables to a staging area for test in cross environments 64 | if (INSTALL_TARGET_LIST) 65 | foreach(TGT ${INSTALL_TARGET_LIST}) 66 | install(TARGETS coverage-bplib_eid-testrunner DESTINATION ${TGT}/${UT_INSTALL_SUBDIR}) 67 | endforeach() 68 | endif() 69 | -------------------------------------------------------------------------------- /ci/em/unit-test/stubs/bplib_em_stubs.c: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | 21 | /** 22 | * @file 23 | * 24 | * Auto-Generated stub implementations for functions defined in bplib_em header 25 | */ 26 | 27 | #include "bplib_em.h" 28 | #include "utgenstub.h" 29 | 30 | /* 31 | * ---------------------------------------------------- 32 | * Generated stub function for BPLib_EM_Init() 33 | * ---------------------------------------------------- 34 | */ 35 | BPLib_Status_t BPLib_EM_Init(void) 36 | { 37 | UT_GenStub_SetupReturnBuffer(BPLib_EM_Init, BPLib_Status_t); 38 | 39 | UT_GenStub_Execute(BPLib_EM_Init, Basic, NULL); 40 | 41 | return UT_GenStub_GetReturnValue(BPLib_EM_Init, BPLib_Status_t); 42 | } 43 | 44 | BPLib_Status_t BPLib_EM_SendEvent(uint16_t EventID, BPLib_EM_EventType_t EventType, 45 | char const* Spec, ...) 46 | { 47 | UT_GenStub_SetupReturnBuffer(BPLib_EM_SendEvent, BPLib_Status_t); 48 | 49 | UT_GenStub_AddParam(BPLib_EM_SendEvent, uint16_t, EventID); 50 | UT_GenStub_AddParam(BPLib_EM_SendEvent, BPLib_EM_EventType_t, EventType); 51 | UT_GenStub_AddParam(BPLib_EM_SendEvent, char const*, Spec); 52 | 53 | UT_GenStub_Execute(BPLib_EM_SendEvent, Basic, NULL); 54 | 55 | return UT_GenStub_GetReturnValue(BPLib_EM_SendEvent, BPLib_Status_t); 56 | } -------------------------------------------------------------------------------- /ci/qm/unit-test/stubs/bplib_qm_handlers.h: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | 21 | #ifndef BPLIB_QM_HANDLERS_H 22 | #define BPLIB_QM_HANDLERS_H 23 | 24 | /* 25 | ** Include 26 | */ 27 | 28 | #include "utassert.h" 29 | #include "utstubs.h" 30 | #include "uttest.h" 31 | 32 | #include "bplib_qm.h" 33 | 34 | #define QM_MAX_INCDEC_DEPTH (100u) 35 | 36 | typedef struct 37 | { 38 | BPLib_QM_JobState_t State; 39 | BPLib_Bundle_t* Bundle; 40 | } BPLib_QM_CreateJobContext_t; 41 | 42 | typedef struct 43 | { 44 | BPLib_Bundle_t* Bundle; 45 | } BPLib_QM_WaitQueuePushContext_t; 46 | 47 | /* 48 | ** Global Data 49 | */ 50 | extern BPLib_QM_CreateJobContext_t Context_BPLib_QM_CreateJob[]; 51 | extern BPLib_QM_WaitQueuePushContext_t Context_BPLib_QM_WaitQueueTryPush[]; 52 | 53 | /* 54 | ** Function Definitions 55 | */ 56 | 57 | void UT_Handler_BPLib_QM_WaitQueueTryPull(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context); 58 | 59 | void UT_Handler_BPLib_QM_WaitQueueTryPush(void* UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context); 60 | 61 | void UT_Handler_BPLib_QM_DuctPull(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context); 62 | 63 | void UT_Handler_BPLib_QM_CreateJob(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context); 64 | 65 | #endif /* BPLIB_QM_HANDLERS_H */ 66 | -------------------------------------------------------------------------------- /ci/em/unit-test/utilities/bplib_em_test_utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | 21 | #ifndef BPLIB_EM_TEST_UTILS_H 22 | #define BPLIB_EM_TEST_UTILS_H 23 | 24 | /* ======== */ 25 | /* Includes */ 26 | /* ======== */ 27 | 28 | #include "utassert.h" 29 | #include "utstubs.h" 30 | #include "uttest.h" 31 | 32 | #include "bplib_api_types.h" 33 | #include "bplib_em.h" 34 | #include "bplib_fwp.h" 35 | #include "bpa_fwp_stubs.h" /* For EVP callback stubs */ 36 | 37 | /* ================ */ 38 | /* Type Definitions */ 39 | /* ================ */ 40 | 41 | /* Unit test check event hook information */ 42 | typedef struct 43 | { 44 | uint16_t EventID; 45 | uint16_t EventType; 46 | char Spec[BPLIB_EM_EXPANDED_EVENT_SIZE]; 47 | } BPA_EVP_SendEvent_context_t; 48 | 49 | extern BPA_EVP_SendEvent_context_t context_BPA_EVP_SendEvent; 50 | 51 | extern BPLib_FWP_ProxyCallbacks_t BPLib_FWP_ProxyCallbacks; 52 | 53 | /* ====== */ 54 | /* Macros */ 55 | /* ====== */ 56 | 57 | // Add a test case 58 | #define ADD_TEST(test) UtTest_Add(test, BPLib_EM_Test_Setup, BPLib_EM_Test_Teardown, #test) 59 | 60 | /* ==================== */ 61 | /* Function Definitions */ 62 | /* ==================== */ 63 | 64 | void BPLib_EM_Test_Setup(void); 65 | void BPLib_EM_Test_Teardown(void); 66 | void TestBplibEm_Register(void); 67 | 68 | #endif /* BPLIB_EM_TEST_UTILS_H */ 69 | -------------------------------------------------------------------------------- /aa/as/unit-test/stubs/bplib_as_handlers.h: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | 21 | #ifndef BPLIB_AS_HANDLERS_H 22 | #define BPLIB_AS_HANDLERS_H 23 | 24 | /* ======== */ 25 | /* Includes */ 26 | /* ======== */ 27 | 28 | #include "utassert.h" 29 | #include "utstubs.h" 30 | #include "uttest.h" 31 | 32 | #include "bplib_as.h" 33 | 34 | /* ====== */ 35 | /* Macros */ 36 | /* ====== */ 37 | 38 | #define UT_MAX_INCDEC_DEPTH (50u) 39 | 40 | /* ================ */ 41 | /* Type Definitions */ 42 | /* ================ */ 43 | 44 | /* Unit test increment/decrement hook information */ 45 | typedef struct 46 | { 47 | BPLib_EID_t EID; 48 | BPLib_AS_Counter_t Counter; 49 | uint32_t Amount; 50 | } BPLib_AS_IncrementDecrementContext_t; 51 | 52 | /* =========== */ 53 | /* Global Data */ 54 | /* =========== */ 55 | 56 | extern BPLib_AS_IncrementDecrementContext_t Context_BPLib_AS_Increment[]; 57 | extern BPLib_AS_IncrementDecrementContext_t Context_BPLib_AS_Decrement[]; 58 | 59 | /* ==================== */ 60 | /* Function Definitions */ 61 | /* ==================== */ 62 | 63 | void UT_Handler_BPLib_AS_Increment(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context); 64 | 65 | void UT_Handler_BPLib_AS_Decrement(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context); 66 | 67 | #endif /* BPLIB_AS_HANDLERS_H */ 68 | -------------------------------------------------------------------------------- /aa/arp/unit-test/stubs/bplib_arp_stubs.c: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | 21 | /** 22 | * @file 23 | * 24 | * Auto-Generated stub implementations for functions defined in bplib_arp header 25 | */ 26 | 27 | #include "bplib_arp.h" 28 | #include "utgenstub.h" 29 | 30 | /* 31 | * ---------------------------------------------------- 32 | * Generated stub function for BPLib_ARP_Init() 33 | * ---------------------------------------------------- 34 | */ 35 | int BPLib_ARP_Init(void) 36 | { 37 | UT_GenStub_SetupReturnBuffer(BPLib_ARP_Init, int); 38 | 39 | UT_GenStub_Execute(BPLib_ARP_Init, Basic, NULL); 40 | 41 | return UT_GenStub_GetReturnValue(BPLib_ARP_Init, int); 42 | } 43 | 44 | /* 45 | * ---------------------------------------------------- 46 | * Generated stub function for BPLib_ARP_CRSTblValidateFunc() 47 | * ---------------------------------------------------- 48 | */ 49 | BPLib_Status_t BPLib_ARP_CRSTblValidateFunc(void *TblData) 50 | { 51 | UT_GenStub_SetupReturnBuffer(BPLib_ARP_CRSTblValidateFunc, 52 | BPLib_Status_t); 53 | 54 | UT_GenStub_AddParam(BPLib_ARP_CRSTblValidateFunc, void *, TblData); 55 | 56 | UT_GenStub_Execute(BPLib_ARP_CRSTblValidateFunc, Basic, NULL); 57 | 58 | return UT_GenStub_GetReturnValue(BPLib_ARP_CRSTblValidateFunc, 59 | BPLib_Status_t); 60 | } -------------------------------------------------------------------------------- /ci/pl/unit-test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ################################################################## 2 | # 3 | # Coverage test build recipe 4 | # 5 | # This CMake file contains the recipe for building the coverage tests. 6 | # It is invoked from the parent directory when unit tests are enabled. 7 | # 8 | ################################################################## 9 | 10 | # Create stubs (for external use) 11 | add_library(bplib_pl_stubs STATIC 12 | stubs/bplib_pl_stubs.c 13 | ) 14 | 15 | target_include_directories(bplib_pl_stubs PUBLIC 16 | $ 17 | ) 18 | 19 | target_link_libraries(bplib_pl_stubs PUBLIC ut_assert) 20 | 21 | # Create unit test object 22 | add_library(utobj_bplib_pl OBJECT 23 | ../src/bplib_pl.c 24 | ) 25 | 26 | target_compile_definitions(utobj_bplib_pl PRIVATE 27 | $ 28 | $ 29 | ) 30 | 31 | target_compile_options(utobj_bplib_pl PRIVATE 32 | $ 33 | $ 34 | ) 35 | 36 | target_include_directories(utobj_bplib_pl PRIVATE 37 | $ 38 | $ 39 | ) 40 | 41 | # Create test runner executable 42 | add_executable(coverage-bplib_pl-testrunner 43 | utilities/bplib_pl_test_utils.c 44 | bplib_pl_test.c 45 | $ 46 | ) 47 | 48 | target_include_directories(coverage-bplib_pl-testrunner PRIVATE 49 | ../src 50 | utilities/ 51 | ${CMAKE_CURRENT_SOURCE_DIR}/inc 52 | $ 53 | $ 54 | ) 55 | 56 | target_link_libraries(coverage-bplib_pl-testrunner PUBLIC 57 | ut_coverage_link 58 | ut_assert 59 | bpa_fwp_stubs 60 | ) 61 | 62 | add_test(coverage-bplib_pl-testrunner coverage-bplib_pl-testrunner) 63 | 64 | # Install the executables to a staging area for test in cross environments 65 | if (INSTALL_TARGET_LIST) 66 | foreach(TGT ${INSTALL_TARGET_LIST}) 67 | install(TARGETS coverage-bplib_pl-testrunner DESTINATION ${TGT}/${UT_INSTALL_SUBDIR}) 68 | endforeach() 69 | endif() 70 | -------------------------------------------------------------------------------- /version/inc/bplib_version.h: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | 21 | /** 22 | * @file 23 | * The BPLib header file containing version information 24 | */ 25 | 26 | #ifndef BPLIB_VERSION_H 27 | #define BPLIB_VERSION_H 28 | 29 | /* 30 | * Version Macros, see \ref cfsversions for definitions. 31 | */ 32 | #define BPLIB_MAJOR_VERSION (7u) /*!< @brief Major version number */ 33 | #define BPLIB_MINOR_VERSION (0u) /*!< @brief Minor version number */ 34 | #define BPLIB_REVISION (2u) /*!< @brief Revision version number. Value of 0 indicates a development version.*/ 35 | 36 | /* 37 | * Development Build Macro Definitions 38 | */ 39 | #define BPLIB_BUILD_NUMBER (0u) /*!< Development Build: Number of development builds (not commits) since baseline */ 40 | 41 | /** 42 | * @brief Max Version String length. 43 | * 44 | * Maximum length that a sample_lib version string can be. 45 | * 46 | */ 47 | #define BPLIB_CFG_MAX_VERSION_STR_LEN (256) 48 | 49 | 50 | /************************************************************************* 51 | ** Function Declarations 52 | *************************************************************************/ 53 | 54 | /** 55 | * Library routine to print the version 56 | */ 57 | int BPLib_PrintVersion(void); 58 | 59 | 60 | #endif /* BPLIB_VERSION_H */ 61 | 62 | /************************/ 63 | /* End of File Comment */ 64 | /************************/ 65 | -------------------------------------------------------------------------------- /bpa/stor/inc/bplib_stor_sql.h: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | #ifndef BPLIB_STOR_SQL_H 21 | #define BPLIB_STOR_SQL_H 22 | 23 | #include "bplib_api_types.h" 24 | #include "bplib_mem.h" 25 | #include "bplib_eid.h" 26 | #include "bplib_stor_loadbatch.h" 27 | 28 | #define BPLIB_SQL_MAX_STRLEN 4096 29 | 30 | /* This is a temporary define denoting milliseconds between POSIX and DTN time 31 | ** It is used until a more mature boot-era solution is implemented in BPLIB_TIME 32 | */ 33 | #define BPLIB_STOR_EPOCHOFFSET 946684800000 34 | 35 | BPLib_Status_t BPLib_SQL_Init(BPLib_Instance_t* Inst, const char* DbName); 36 | 37 | BPLib_Status_t BPLib_SQL_Store(BPLib_Instance_t* Inst, size_t *TotalBytesStored); 38 | 39 | BPLib_Status_t BPLib_SQL_DiscardExpired(BPLib_Instance_t* Inst, size_t* NumDiscarded); 40 | 41 | BPLib_Status_t BPLib_SQL_DiscardEgressed(BPLib_Instance_t* Inst, size_t* NumDiscarded); 42 | 43 | BPLib_Status_t BPLib_SQL_FindForEIDs(BPLib_Instance_t* Inst, BPLib_STOR_LoadBatch_t* Batch, 44 | BPLib_EID_Pattern_t *DestEIDs, size_t NumEIDs); 45 | 46 | BPLib_Status_t BPLib_SQL_MarkBatchEgressed(BPLib_Instance_t* Inst, BPLib_STOR_LoadBatch_t* Batch); 47 | 48 | BPLib_Status_t BPLib_SQL_LoadBundle(BPLib_Instance_t* Inst, int64_t BundleID, BPLib_Bundle_t** Bundle); 49 | 50 | BPLib_Status_t BPLib_SQL_GetDbSize(BPLib_Instance_t *Inst, size_t *DbSize); 51 | 52 | #endif /* BPLIB_STOR_SQL_H */ 53 | -------------------------------------------------------------------------------- /version/unit-test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ################################################################## 2 | # 3 | # Coverage test build recipe 4 | # 5 | # This CMake file contains the recipe for building the coverage tests. 6 | # It is invoked from the parent directory when unit tests are enabled. 7 | # 8 | ################################################################## 9 | 10 | # Create stubs (for external use) 11 | add_library(bplib_version_stubs STATIC 12 | stubs/bplib_version_stubs.c 13 | ) 14 | 15 | target_include_directories(bplib_version_stubs PUBLIC 16 | $ 17 | ) 18 | 19 | target_link_libraries(bplib_version_stubs PUBLIC ut_assert ut_osapi_stubs) 20 | 21 | # Create unit test object 22 | add_library(utobj_bplib_version OBJECT 23 | ../src/bplib_version.c 24 | ) 25 | 26 | target_compile_definitions(utobj_bplib_version PRIVATE 27 | $ 28 | $ 29 | ) 30 | 31 | target_compile_options(utobj_bplib_version PRIVATE 32 | $ 33 | $ 34 | ) 35 | 36 | target_include_directories(utobj_bplib_version PRIVATE 37 | $ 38 | $ 39 | ) 40 | 41 | # Create test runner executable 42 | add_executable(coverage-bplib_version-testrunner 43 | utilities/bplib_version_test_utils.c 44 | bplib_version_test.c 45 | $ 46 | ) 47 | 48 | target_include_directories(coverage-bplib_version-testrunner PRIVATE 49 | ../src 50 | utilities/ 51 | ${CMAKE_CURRENT_SOURCE_DIR}/inc 52 | $ 53 | ) 54 | 55 | target_link_libraries(coverage-bplib_version-testrunner PUBLIC 56 | ut_coverage_link 57 | ut_assert 58 | ut_osapi_stubs 59 | ) 60 | 61 | add_test(coverage-bplib_version-testrunner coverage-bplib_version-testrunner) 62 | 63 | # Install the executables to a staging area for test in cross environments 64 | if (INSTALL_TARGET_LIST) 65 | foreach(TGT ${INSTALL_TARGET_LIST}) 66 | install(TARGETS coverage-bplib_version-testrunner DESTINATION ${TGT}/${UT_INSTALL_SUBDIR}) 67 | endforeach() 68 | endif() 69 | -------------------------------------------------------------------------------- /ci/em/unit-test/stubs/bplib_em_handlers.c: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | 21 | /** 22 | * @file 23 | * 24 | * Handlers for EM function stubs 25 | */ 26 | 27 | #include "bplib_em_handlers.h" 28 | 29 | 30 | BPLib_EM_SendEvent_context_t context_BPLib_EM_SendEvent[UT_MAX_SENDEVENT_DEPTH]; 31 | 32 | 33 | void UT_Handler_BPLib_EM_SendEvent(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) 34 | { 35 | uint16 CallCount; 36 | uint16 idx; 37 | 38 | CallCount = UT_GetStubCount(UT_KEY(BPLib_EM_SendEvent)); 39 | 40 | if (CallCount > (sizeof(context_BPLib_EM_SendEvent) / sizeof(context_BPLib_EM_SendEvent[0]))) 41 | { 42 | UtAssert_Failed("BPLib_EM_SendEvent UT depth %u exceeded: %u, increase UT_MAX_SENDEVENT_DEPTH", 43 | UT_MAX_SENDEVENT_DEPTH, CallCount); 44 | } 45 | else 46 | { 47 | idx = CallCount - 1; 48 | context_BPLib_EM_SendEvent[idx].EventID = UT_Hook_GetArgValueByName(Context, "EventID", uint16); 49 | context_BPLib_EM_SendEvent[idx].EventType = UT_Hook_GetArgValueByName(Context, "EventType", BPLib_EM_EventType_t); 50 | 51 | strncpy(context_BPLib_EM_SendEvent[idx].Spec, UT_Hook_GetArgValueByName(Context, "Spec", const char *), 52 | BPLIB_EM_EXPANDED_EVENT_SIZE); 53 | context_BPLib_EM_SendEvent[idx].Spec[BPLIB_EM_EXPANDED_EVENT_SIZE - 1] = '\0'; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /binding/lua/test/ut_active_table.lua: -------------------------------------------------------------------------------- 1 | local bplib = require("bplib") 2 | local runner = require("bptest") 3 | local bp = require("bp") 4 | local src = runner.srcscript() 5 | 6 | -- Setup -- 7 | 8 | local store = arg[1] or "RAM" 9 | runner.setup(bplib, store) 10 | 11 | local retx_order = arg[2] or "SMALLEST" 12 | if retx_order == "SMALLEST" then 13 | retx_order = bp.RETX_SMALLEST_CID 14 | else 15 | retx_order = bp.RETX_OLDEST_BUNDLE 16 | end 17 | 18 | local src_node = 4 19 | local src_serv = 3 20 | local dst_node = 72 21 | local dst_serv = 43 22 | 23 | local num_bundles = 8 24 | local timeout = 1 25 | local cid_reuse = (retx_order == bp.RETX_SMALLEST_CID) and 0 or 1 26 | local attributes = {cid_reuse=cid_reuse, retransmit_order=retx_order, active_table_size=num_bundles, timeout=timeout} 27 | 28 | local sender = bplib.open(src_node, src_serv, dst_node, dst_serv, store, attributes) 29 | 30 | -- Test -- 31 | 32 | ----------------------------------------------------------------------- 33 | print(string.format('%s/%s: Test 1 - walk active bundle', store, src)) 34 | for i=1,num_bundles do 35 | payload = string.format('HELLO WORLD %d', i) 36 | print("Generating... " .. payload) 37 | 38 | -- store payload -- 39 | rc, flags = sender:store(payload, 1000) 40 | runner.check(rc) 41 | runner.check(bp.check_flags(flags, {}), "flags set on store") 42 | 43 | -- load bundle -- 44 | rc, bundle, flags = sender:load(1000) 45 | runner.check(rc) 46 | runner.check(bundle ~= nil) 47 | runner.check(bp.check_flags(flags, {}), "flags set on load") 48 | 49 | -- check payload -- 50 | runner.check(bp.find_payload(bundle, payload), string.format('Error - could not find payload: %s', payload)) 51 | 52 | -- Timed-Out Load 53 | bplib.sleep(timeout + 1) 54 | for j=1,i do 55 | payload = string.format('HELLO WORLD %d', j) 56 | 57 | -- load bundle -- 58 | rc, bundle, flags = sender:load(1000) 59 | runner.check(rc) 60 | runner.check(bundle ~= nil, string.format('Error - failed to load payload: %s', payload)) 61 | runner.check(bp.check_flags(flags, {}), "flags set on load") 62 | 63 | -- check payload -- 64 | if bundle then 65 | runner.check(bp.find_payload(bundle, payload), string.format('Error - could not find payload: %s', payload)) 66 | end 67 | end 68 | end 69 | 70 | -- Clean Up -- 71 | 72 | sender:flush() 73 | sender:close() 74 | 75 | runner.cleanup(bplib, store) 76 | 77 | -- Report Results -- 78 | 79 | runner.report(bplib) 80 | 81 | -------------------------------------------------------------------------------- /bpa/ebp/unit-test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ################################################################## 2 | # 3 | # Coverage test build recipe 4 | # 5 | # This CMake file contains the recipe for building the coverage tests. 6 | # It is invoked from the parent directory when unit tests are enabled. 7 | # 8 | ################################################################## 9 | 10 | # Create stubs (for external use) 11 | add_library(bplib_ebp_stubs STATIC 12 | stubs/bplib_ebp_stubs.c 13 | ) 14 | 15 | target_include_directories(bplib_ebp_stubs PUBLIC 16 | $ 17 | ) 18 | 19 | target_link_libraries(bplib_ebp_stubs PUBLIC ut_assert) 20 | 21 | # Create unit test object 22 | add_library(utobj_bplib_ebp OBJECT 23 | ../src/bplib_ebp.c 24 | ) 25 | 26 | target_compile_definitions(utobj_bplib_ebp PRIVATE 27 | $ 28 | $ 29 | ) 30 | 31 | target_compile_options(utobj_bplib_ebp PRIVATE 32 | $ 33 | $ 34 | ) 35 | 36 | target_include_directories(utobj_bplib_ebp PRIVATE 37 | $ 38 | $ 39 | ) 40 | 41 | # Create test runner executable 42 | add_executable(coverage-bplib_ebp-testrunner 43 | utilities/bplib_ebp_test_utils.c 44 | bplib_ebp_test.c 45 | $ 46 | ) 47 | 48 | target_include_directories(coverage-bplib_ebp-testrunner PRIVATE 49 | ../src 50 | utilities/ 51 | ${CMAKE_CURRENT_SOURCE_DIR}/inc 52 | $ 53 | $ 54 | ) 55 | 56 | target_link_libraries(coverage-bplib_ebp-testrunner PUBLIC 57 | ut_coverage_link 58 | ut_assert 59 | bplib_nc_stubs 60 | bplib_time_stubs 61 | bplib_eid_stubs 62 | ) 63 | 64 | add_test(coverage-bplib_ebp-testrunner coverage-bplib_ebp-testrunner) 65 | 66 | # Install the executables to a staging area for test in cross environments 67 | if (INSTALL_TARGET_LIST) 68 | foreach(TGT ${INSTALL_TARGET_LIST}) 69 | install(TARGETS coverage-bplib_ebp-testrunner DESTINATION ${TGT}/${UT_INSTALL_SUBDIR}) 70 | endforeach() 71 | endif() 72 | -------------------------------------------------------------------------------- /ci/em/unit-test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ################################################################## 2 | # 3 | # Coverage test build recipe 4 | # 5 | # This CMake file contains the recipe for building the coverage tests. 6 | # It is invoked from the parent directory when unit tests are enabled. 7 | # 8 | ################################################################## 9 | 10 | # Create stubs (for external use) 11 | add_library(bplib_em_stubs STATIC 12 | stubs/bplib_em_stubs.c 13 | stubs/bplib_em_handlers.c 14 | ) 15 | 16 | target_include_directories(bplib_em_stubs PUBLIC 17 | $ 18 | stubs/ 19 | ) 20 | 21 | target_link_libraries(bplib_em_stubs PUBLIC ut_assert) 22 | 23 | # Create unit test object 24 | add_library(utobj_bplib_em OBJECT 25 | ../src/bplib_em.c 26 | ) 27 | 28 | target_compile_definitions(utobj_bplib_em PRIVATE 29 | $ 30 | $ 31 | ) 32 | 33 | target_compile_options(utobj_bplib_em PRIVATE 34 | $ 35 | $ 36 | ) 37 | 38 | target_include_directories(utobj_bplib_em PRIVATE 39 | $ 40 | $ 41 | ) 42 | 43 | # Create test runner executable 44 | add_executable(coverage-bplib_em-testrunner 45 | utilities/bplib_em_test_utils.c 46 | bplib_em_test.c 47 | $ 48 | ) 49 | 50 | target_include_directories(coverage-bplib_em-testrunner PRIVATE 51 | ../src 52 | utilities/ 53 | ${CMAKE_CURRENT_SOURCE_DIR}/inc 54 | $ 55 | $ 56 | ) 57 | 58 | target_link_libraries(coverage-bplib_em-testrunner PUBLIC 59 | ut_coverage_link 60 | ut_assert 61 | bplib_fwp_stubs 62 | bpa_fwp_stubs 63 | ) 64 | 65 | add_test(coverage-bplib_em-testrunner coverage-bplib_em-testrunner) 66 | 67 | # Install the executables to a staging area for test in cross environments 68 | if (INSTALL_TARGET_LIST) 69 | foreach(TGT ${INSTALL_TARGET_LIST}) 70 | install(TARGETS coverage-bplib_em-testrunner DESTINATION ${TGT}/${UT_INSTALL_SUBDIR}) 71 | endforeach() 72 | endif() 73 | -------------------------------------------------------------------------------- /version/src/bplib_version.c: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | 21 | /** 22 | * @file 23 | * BPLib Version Utility 24 | */ 25 | 26 | /************************************************************************* 27 | ** Includes 28 | *************************************************************************/ 29 | #include "bplib_api_types.h" 30 | #include "bplib_version.h" 31 | #include "osapi.h" /* for OS_Printf() */ 32 | #include /* for "snprintf()" */ 33 | 34 | /************************************************************************* 35 | ** Private Data Structures 36 | *************************************************************************/ 37 | 38 | 39 | 40 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 41 | /* */ 42 | /* Library Initialization Routine */ 43 | /* */ 44 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 45 | int BPLib_PrintVersion(void) 46 | { 47 | char VersionString[BPLIB_CFG_MAX_VERSION_STR_LEN]; 48 | 49 | (void) snprintf(VersionString, BPLIB_CFG_MAX_VERSION_STR_LEN, "v%u.%u.%u-sprint-%u", 50 | BPLIB_MAJOR_VERSION, 51 | BPLIB_MINOR_VERSION, 52 | BPLIB_REVISION, 53 | BPLIB_BUILD_NUMBER); 54 | 55 | OS_printf("BPLib Version: %s\n", VersionString); 56 | 57 | return BPLIB_SUCCESS; 58 | } 59 | -------------------------------------------------------------------------------- /docs/doc-src/bplib_walkthroughs.dox: -------------------------------------------------------------------------------- 1 | /** 2 | \page bplib_walkthroughs BPLib Code Walkthroughs 3 | 4 | ### BPLib STOR QM Walkthroughs 5 | 6 | #### Walkthrough 1 - Forward Bundles 7 | 8 | Client calls \ref BPLib_STOR_QM_AllocQueueTable to init queue_tbl 9 | and cache 10 | 11 | Client calls \ref BPLib_STOR_QM_CreateRamStorage with cache pool from queue_tbl 12 | 13 | Which calls: 14 | - \ref BPLib_STOR_QM_Attach 15 | - \ref BPLib_STOR_CACHE_Init 16 | to fully initialize cache 17 | 18 | Client calls BPLib_STOR_QM_ClaIngress - which calls: 19 | - \ref BPLib_STOR_QM_GetIntfControlblock - Duct interface 20 | - \ref BPLib_STOR_QM_GenericBundleIngress 21 | - \ref BPLib_STOR_QM_ReleaseIntfControlblock 22 | - \ref BPLib_STOR_QM_SetMaintenanceRequest 23 | 24 | Cache state machine drives bundle and job queues 25 | 26 | Cache state machine calls \ref BPLib_STOR_QM_ClaEgress - which calls: 27 | - \ref BPLib_STOR_QM_SetMaintenanceRequest - last chance for egress 28 | - \ref BPLib_STOR_QM_GetIntfControlblock - Duct interface 29 | - \ref BPLib_STOR_QM_GenericBundleEgress 30 | - \ref BPLib_STOR_QM_ReleaseIntfControlblock 31 | 32 | 33 | #### Walkthrough 2 - QM Alloc and Init 34 | 35 | Client calls \ref BPLib_STOR_QM_AllocQueueTable to init queue_tbl 36 | and cache - which calls: 37 | - \ref calloc - memory alloc currently done in QM so it isn't stubbed. 38 | - \ref BPLib_STOR_CACHE_CreatePool uses MEM for calloc when calloc not in QM. 39 | - \ref BPLib_STOR_CACHE_InitListHead 40 | 41 | #### Walkthrough 3 - Cache Finite State Machine (FSM) 42 | 43 | States: Undefined, Idle, Queue, Delete - for now 44 | 45 | QM calls \ref BPLib_STOR_CACHE_SubqWorkitemInit 46 | 47 | initial state is Idle 48 | 49 | FSM enqueues bundle and changes state to Queue by conditions 50 | - \ref BPLib_STOR_CACHE_FsmStateIdleEval sets state 51 | - \ref BPLib_STOR_CACHE_FsmStateQueueEnter 52 | - \ref BPLib_STOR_CACHE_RefMakeBlock 53 | - \ref BPLib_STOR_CACHE_GetDuct 54 | - \ref BPLib_STOR_QM_DuctTryPush 55 | - (conditionally) \ref BPLib_STOR_CACHE_RecycleBlock 56 | Job scheduler dequeues bundle and calls action function 57 | - \ref BPLib_STOR_CACHE_ActionFunc_t 58 | 59 | FSM evaluates bundle state periodically 60 | - Ref counts, state conditions 61 | - Stay in Queue state or transition to Idle or Delete 62 | - Delete is the only state that transitions to Undefined 63 | 64 | **/ 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /bpa/pdb/src/bplib_pdb.c: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | 21 | /* 22 | ** Include 23 | */ 24 | 25 | #include "bplib_pdb.h" 26 | 27 | 28 | /* 29 | ** Function Definitions 30 | */ 31 | 32 | int BPLib_PDB_Init(void) { 33 | return BPLIB_SUCCESS; 34 | } 35 | 36 | /* Validate Custodian Auth table data */ 37 | BPLib_Status_t BPLib_PDB_CustodianAuthTblValidateFunc(void *TblData) 38 | { 39 | BPLib_Status_t ReturnCode = BPLIB_SUCCESS; 40 | 41 | /* Validate data values are within allowed range */ 42 | 43 | return ReturnCode; 44 | } 45 | 46 | /* Validate Custody Auth table data */ 47 | BPLib_Status_t BPLib_PDB_CustodyAuthTblValidateFunc(void *TblData) 48 | { 49 | BPLib_Status_t ReturnCode = BPLIB_SUCCESS; 50 | 51 | /* Validate data values are within allowed range */ 52 | 53 | return ReturnCode; 54 | } 55 | 56 | /* Validate Report-To Auth table data */ 57 | BPLib_Status_t BPLib_PDB_ReportToAuthTblValidateFunc(void *TblData) 58 | { 59 | BPLib_Status_t ReturnCode = BPLIB_SUCCESS; 60 | 61 | return ReturnCode; 62 | } 63 | 64 | /* Validate Source Auth table data */ 65 | BPLib_Status_t BPLib_PDB_SrcAuthTblValidateFunc(void *TblData) 66 | { 67 | BPLib_Status_t ReturnCode = BPLIB_SUCCESS; 68 | 69 | return ReturnCode; 70 | } 71 | 72 | /* Validate Source Latency table data */ 73 | BPLib_Status_t BPLib_PDB_SrcLatencyTblValidateFunc(void *TblData) 74 | { 75 | BPLib_Status_t ReturnCode = BPLIB_SUCCESS; 76 | 77 | return ReturnCode; 78 | } -------------------------------------------------------------------------------- /ci/mem/unit-test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ################################################################## 2 | # 3 | # Coverage test build recipe 4 | # 5 | # This CMake file contains the recipe for building the coverage tests. 6 | # It is invoked from the parent directory when unit tests are enabled. 7 | # 8 | ################################################################## 9 | 10 | # Create stubs (for external use) 11 | add_library(bplib_mem_stubs STATIC 12 | stubs/bplib_mem_stubs.c 13 | ) 14 | 15 | target_include_directories(bplib_mem_stubs PUBLIC 16 | $ 17 | ) 18 | 19 | target_link_libraries(bplib_mem_stubs PUBLIC ut_assert) 20 | 21 | 22 | # Create unit test object 23 | add_library(utobj_bplib_mem OBJECT 24 | ../src/bplib_mem.c 25 | ../src/bplib_ben_allocator.c 26 | #../src/bplib_std_allocator.c 27 | ) 28 | 29 | target_compile_definitions(utobj_bplib_mem PRIVATE 30 | $ 31 | $ 32 | ) 33 | 34 | target_compile_options(utobj_bplib_mem PRIVATE 35 | $ 36 | $ 37 | ) 38 | 39 | target_include_directories(utobj_bplib_mem PRIVATE 40 | $ 41 | $ 42 | ) 43 | 44 | # Create test runner executable 45 | add_executable(coverage-bplib_mem-testrunner 46 | utilities/bplib_mem_test_utils.c 47 | bplib_mem_test.c 48 | $ 49 | ) 50 | 51 | target_include_directories(coverage-bplib_mem-testrunner PRIVATE 52 | ../src 53 | utilities/ 54 | ${CMAKE_CURRENT_SOURCE_DIR}/inc 55 | $ 56 | $ 57 | ) 58 | 59 | target_link_libraries(coverage-bplib_mem-testrunner PUBLIC 60 | ut_coverage_link 61 | ut_assert 62 | bplib_em_stubs 63 | ) 64 | 65 | add_test(coverage-bplib_mem-testrunner coverage-bplib_mem-testrunner) 66 | 67 | # Install the executables to a staging area for test in cross environments 68 | if (INSTALL_TARGET_LIST) 69 | foreach(TGT ${INSTALL_TARGET_LIST}) 70 | install(TARGETS coverage-bplib_mem-testrunner DESTINATION ${TGT}/${UT_INSTALL_SUBDIR}) 71 | endforeach() 72 | endif() 73 | -------------------------------------------------------------------------------- /bpa/bi/unit-test/utilities/bplib_bi_test_utils.c: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | 21 | /* 22 | ** Include 23 | */ 24 | 25 | #include "bplib_bi_test_utils.h" 26 | #include "bplib_time_handlers.h" 27 | 28 | /* 29 | ** Global Data 30 | */ 31 | 32 | BPLib_Bundle_t DeserializedBundle; 33 | 34 | /* 35 | ** Function Definitions 36 | */ 37 | 38 | void BPLib_BI_Test_Setup(void) 39 | { 40 | /* Initialize test environment to default state for every test */ 41 | UT_ResetState(0); 42 | 43 | memset(&DeserializedBundle, 0, sizeof(DeserializedBundle)); 44 | 45 | DeserializedBundle.blocks.PrimaryBlock.Lifetime = 100000; 46 | DeserializedBundle.blocks.PayloadHeader.BlockType = BPLib_BlockType_Payload; 47 | DeserializedBundle.blocks.ExtBlocks[0].Header.BlockType = BPLib_BlockType_HopCount; 48 | DeserializedBundle.blocks.ExtBlocks[0].Header.BlockNum = 2; 49 | DeserializedBundle.blocks.ExtBlocks[1].Header.BlockType = BPLib_BlockType_Age; 50 | DeserializedBundle.blocks.ExtBlocks[1].Header.BlockNum = 3; 51 | DeserializedBundle.blocks.ExtBlocks[2].Header.BlockType = BPLib_BlockType_PrevNode; 52 | DeserializedBundle.blocks.ExtBlocks[2].Header.BlockNum = 4; 53 | DeserializedBundle.blocks.ExtBlocks[3].Header.BlockType = BPLib_BlockType_Reserved; 54 | 55 | UT_SetHandlerFunction(UT_KEY(BPLib_AS_Increment), UT_Handler_BPLib_AS_Increment, NULL); 56 | } 57 | 58 | void BPLib_BI_Test_Teardown(void) 59 | { 60 | /* Clean up test environment */ 61 | } 62 | 63 | void UtTest_Setup(void) 64 | { 65 | TestBplibBi_Register(); 66 | } 67 | -------------------------------------------------------------------------------- /ci/rbt/unit-test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ################################################################## 2 | # 3 | # Coverage test build recipe 4 | # 5 | # This CMake file contains the recipe for building the coverage tests. 6 | # It is invoked from the parent directory when unit tests are enabled. 7 | # 8 | ################################################################## 9 | 10 | # Create stubs (for external use) 11 | add_library(bplib_rbt_stubs STATIC 12 | stubs/bplib_rbt_stubs.c 13 | ) 14 | 15 | target_include_directories(bplib_rbt_stubs PUBLIC 16 | ../src 17 | $ 18 | $ 19 | ) 20 | 21 | target_link_libraries(bplib_rbt_stubs PUBLIC ut_assert) 22 | 23 | # Create unit test object 24 | add_library(utobj_bplib_rbt OBJECT 25 | ../src/bplib_rbt_impl.c 26 | ../src/bplib_rbt_iterator.c 27 | ../src/bplib_rbt_api.c 28 | ) 29 | 30 | target_compile_definitions(utobj_bplib_rbt PRIVATE 31 | $ 32 | $ 33 | ) 34 | 35 | target_compile_options(utobj_bplib_rbt PRIVATE 36 | $ 37 | $ 38 | ) 39 | 40 | target_include_directories(utobj_bplib_rbt PRIVATE 41 | $ 42 | $ 43 | $ 44 | $ 45 | ) 46 | 47 | # Create test runner executable 48 | add_executable(coverage-bplib_rbt-testrunner 49 | utilities/bplib_rbt_test_utils.c 50 | bplib_rbt_test.c 51 | $ 52 | ) 53 | 54 | target_include_directories(coverage-bplib_rbt-testrunner PRIVATE 55 | ../src 56 | utilities/ 57 | ${CMAKE_CURRENT_SOURCE_DIR}/inc 58 | $ 59 | ) 60 | 61 | target_link_libraries(coverage-bplib_rbt-testrunner PUBLIC 62 | ut_coverage_link 63 | ut_assert 64 | ) 65 | 66 | add_test(coverage-bplib_rbt-testrunner coverage-bplib_rbt-testrunner) 67 | 68 | # Install the executables to a staging area for test in cross environments 69 | if (INSTALL_TARGET_LIST) 70 | foreach(TGT ${INSTALL_TARGET_LIST}) 71 | install(TARGETS coverage-bplib_rbt-testrunner DESTINATION ${TGT}/${UT_INSTALL_SUBDIR}) 72 | endforeach() 73 | endif() 74 | -------------------------------------------------------------------------------- /aa/arp/unit-test/bplib_arp_test.c: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | 21 | /* 22 | ** Include 23 | */ 24 | 25 | #include "bplib_arp_test_utils.h" 26 | 27 | /* 28 | ** Test function for 29 | ** int BPLib_ARP_Init() 30 | */ 31 | void Test_BPLib_ARP_Init(void) 32 | { 33 | UtAssert_INT32_EQ(BPLib_ARP_Init(), BPLIB_SUCCESS); 34 | } 35 | 36 | void Test_BPLib_ARP_CRSTblValidateFunc_Nominal(void) 37 | { 38 | BPLib_ARP_CRSTable_t TestTblData; 39 | memset(&TestTblData, 0, sizeof(TestTblData)); 40 | TestTblData.CRS_Set[0].SizeTrigger = 10; 41 | UtAssert_INT32_EQ((int32) BPLib_ARP_CRSTblValidateFunc(&TestTblData), (int32) BPLIB_SUCCESS); 42 | } 43 | 44 | void Test_BPLib_ARP_CRSTblValidateFunc_Invalid(void) 45 | { 46 | BPLib_ARP_CRSTable_t TestTblData; 47 | memset(&TestTblData, 0, sizeof(TestTblData)); 48 | 49 | /* Error case should return BPLIB_TABLE_OUT_OF_RANGE_ERR_CODE */ 50 | TestTblData.CRS_Set[0].SizeTrigger = 0; 51 | 52 | UtAssert_INT32_EQ(BPLib_ARP_CRSTblValidateFunc(&TestTblData), 53 | BPLIB_TABLE_OUT_OF_RANGE_ERR_CODE); 54 | } 55 | 56 | void TestBplibArp_Register(void) 57 | { 58 | UtTest_Add(Test_BPLib_ARP_Init, BPLib_ARP_Test_Setup, BPLib_ARP_Test_Teardown, "Test_BPLib_ARP_Init"); 59 | UtTest_Add(Test_BPLib_ARP_CRSTblValidateFunc_Nominal, BPLib_ARP_Test_Setup, BPLib_ARP_Test_Teardown, "Test_BPLib_ARP_CRSTblValidateFunc_Nominal"); 60 | UtTest_Add(Test_BPLib_ARP_CRSTblValidateFunc_Invalid, BPLib_ARP_Test_Setup, BPLib_ARP_Test_Teardown, "Test_BPLib_ARP_CRSTblValidateFunc_Invalid"); 61 | } 62 | -------------------------------------------------------------------------------- /binding/lua/test/ut_bundle_timeout.lua: -------------------------------------------------------------------------------- 1 | local bplib = require("bplib") 2 | local runner = require("bptest") 3 | local bp = require("bp") 4 | local rd = runner.rootdir(arg[0]) 5 | local src = runner.srcscript() 6 | 7 | -- Setup -- 8 | 9 | local store = arg[1] or "RAM" 10 | runner.setup(bplib, store) 11 | 12 | local src_node = 4 13 | local src_serv = 3 14 | local dst_node = 72 15 | local dst_serv = 43 16 | 17 | local num_bundles = 10 18 | local timeout = 5 19 | 20 | local sender = bplib.open(src_node, src_serv, dst_node, dst_serv, store) 21 | 22 | rc = sender:setopt("TIMEOUT", timeout) 23 | runner.check(rc) 24 | 25 | -- Test -- 26 | 27 | ----------------------------------------------------------------------- 28 | print(string.format('%s/%s: Test 1 - store bundles', store, src)) 29 | for i=1,num_bundles do 30 | payload = string.format('HELLO WORLD %d', i) 31 | 32 | -- store payload -- 33 | rc, flags = sender:store(payload, 1000) 34 | runner.check(rc) 35 | runner.check(bp.check_flags(flags, {}), "flags set on store") 36 | end 37 | 38 | ----------------------------------------------------------------------- 39 | print(string.format('%s/%s: Test 2 - load bundles', store, src)) 40 | for i=1,num_bundles do 41 | payload = string.format('HELLO WORLD %d', i) 42 | 43 | -- load bundle -- 44 | rc, bundle, flags = sender:load(1000) 45 | runner.check(rc) 46 | runner.check(bundle ~= nil) 47 | runner.check(bp.check_flags(flags, {}), "flags set on load") 48 | runner.check(bp.find_payload(bundle, payload), string.format('Error - wrong payload when checking for %s', payload)) 49 | end 50 | 51 | ----------------------------------------------------------------------- 52 | print(string.format('%s/%s: Test 4 - no bundle', store, src)) 53 | rc, bundle, flags = sender:load(1000) 54 | runner.check(rc == false) 55 | runner.check(bundle == nil) 56 | 57 | ----------------------------------------------------------------------- 58 | print(string.format('%s/%s: Test 5 - timeout bundle', store, src)) 59 | payload = string.format('HELLO WORLD %d', 1) 60 | bplib.sleep(timeout+1) 61 | 62 | -- load timedout bundle -- 63 | rc, bundle, flags = sender:load(1000) 64 | runner.check(rc) 65 | runner.check(bundle ~= nil) 66 | runner.check(bp.check_flags(flags, {}), "flags set on load") 67 | runner.check(bp.find_payload(bundle, payload), string.format('Error - wrong payload when checking for %s', payload)) 68 | 69 | -- Clean Up -- 70 | 71 | sender:flush() 72 | sender:close() 73 | 74 | runner.cleanup(bplib, store) 75 | 76 | -- Report Results -- 77 | 78 | runner.report(bplib) 79 | 80 | -------------------------------------------------------------------------------- /ci/em/src/bplib_em.c: -------------------------------------------------------------------------------- 1 | /* 2 | * NASA Docket No. GSC-19,559-1, and identified as "Delay/Disruption Tolerant Networking 3 | * (DTN) Bundle Protocol (BP) v7 Core Flight System (cFS) Application Build 7.0 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 6 | * file except in compliance with the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. The copyright notice to be 14 | * included in the software is as follows: 15 | * 16 | * Copyright 2025 United States Government as represented by the Administrator of the 17 | * National Aeronautics and Space Administration. All Rights Reserved. 18 | * 19 | */ 20 | 21 | /* ======== */ 22 | /* Includes */ 23 | /* ======== */ 24 | 25 | #include "bplib_em.h" 26 | #include "bplib_fwp.h" 27 | #include 28 | #include 29 | 30 | /* ==================== */ 31 | /* Function Definitions */ 32 | /* ==================== */ 33 | 34 | // Event management initialization 35 | BPLib_Status_t BPLib_EM_Init(void) 36 | { 37 | BPLib_Status_t Status; 38 | 39 | /* Initialize the Status as BPLIB_SUCCESS and 40 | leave open to change under future circumstances */ 41 | Status = BPLIB_SUCCESS; 42 | 43 | BPLib_FWP_ProxyCallbacks.BPA_EVP_Init(); 44 | 45 | return Status; 46 | } 47 | 48 | // Event generation 49 | BPLib_Status_t BPLib_EM_SendEvent(uint16_t EventID, BPLib_EM_EventType_t EventType, char const* Spec, ...) 50 | { 51 | BPLib_Status_t Status; 52 | char ExpandedEventText[BPLIB_EM_EXPANDED_EVENT_SIZE]; 53 | int ExpandedLength; 54 | va_list EventTextArgPtr; 55 | 56 | // Default to success status 57 | Status = BPLIB_SUCCESS; 58 | 59 | // Gather conversion specifiers from remaining arguments 60 | va_start(EventTextArgPtr, Spec); 61 | ExpandedLength = vsnprintf(ExpandedEventText, BPLIB_EM_EXPANDED_EVENT_SIZE, Spec, EventTextArgPtr); 62 | va_end(EventTextArgPtr); 63 | 64 | if (ExpandedLength < 0) 65 | { 66 | Status = BPLIB_EM_EXPANDED_TEXT_ERROR; 67 | } 68 | else 69 | { 70 | BPLib_FWP_ProxyCallbacks.BPA_EVP_SendEvent(EventID, EventType, ExpandedEventText); 71 | } 72 | 73 | return Status; 74 | } 75 | --------------------------------------------------------------------------------