93 Commits
Author SHA1 Message Date
Chad Attermann 392363c1b0 Added another missing header for Linux builds 2026-03-06 17:40:55 -07:00
Chad Attermann 491fbd034e Fixed unit test failures in Linux. 2026-03-06 17:25:41 -07:00
Chad Attermann c69087ba40 Merge pull request #31 from attermann/psram_allocator
Introduces a flexible two-class allocator architecture (RNS_DEFAULT_ALLOCATOR and RNS_CONTAINER_ALLOCATOR) supporting heap, PSRAM, and TLSF pool variants for fine-grained control over embedded memory layout.

New Memory.h/cpp with ContainerAllocator, heap/PSRAM/pool allocator types, and heap stats reporting
IdentityTable and PathTable now use ContainerAllocator
Replaced RNS_USE_TLSF/RNS_USE_ALLOCATOR/RNS_USE_PSRAM flags with per-class allocator flags (RNS_DEFAULT_ALLOCATOR, RNS_CONTAINER_ALLOCATOR)
Added ESP32 PSRAM allocator support (RNS_PSRAM_ALLOCATOR, RNS_PSRAM_POOL_ALLOCATOR)
Added Transport::get_path()/remove_path() helpers
Added loop callback (set_loop_callback) to enable more responsive app during long operations (like clean_cache)
Aded guard against re-entrancy to clean_cache()
Added callback option to list_directory() to avoid heap allocation
Added OOM auto-restart (ESP.restart/NVIC_SystemReset) in Interface send/receive and Reticulum loop.
Renamed setLogCallback to set_log_callback
Made Link/Identity static members private
Added native14 env to CI and platformio.ini
Bumped version to 0.2.10
2026-03-06 17:10:37 -07:00
Chad Attermann 4d6f0b9de2 Added dual-class PSRAM/TLSF allocator system and refactored memory management
Introduces a flexible two-class allocator architecture (RNS_DEFAULT_ALLOCATOR and RNS_CONTAINER_ALLOCATOR) supporting heap, PSRAM, and TLSF pool variants for fine-grained control over embedded memory layout.

- New Memory.h/cpp with ContainerAllocator<T>, heap/PSRAM/pool allocator types, and heap stats reporting
- IdentityTable and PathTable now use ContainerAllocator
- Replaced RNS_USE_TLSF/RNS_USE_ALLOCATOR/RNS_USE_PSRAM flags with per-class allocator flags (RNS_DEFAULT_ALLOCATOR, RNS_CONTAINER_ALLOCATOR)
- Added ESP32 PSRAM allocator support (RNS_PSRAM_ALLOCATOR, RNS_PSRAM_POOL_ALLOCATOR)
- Added Transport::get_path()/remove_path() helpers
- Added loop callback (set_loop_callback) to enable more responsive app during long operations (like clean_cache)
- Aded guard against re-entrancy to clean_cache()
- Added callback option to list_directory() to avoid heap allocation
- Added OOM auto-restart (ESP.restart/NVIC_SystemReset) in Interface send/receive and Reticulum loop.
- Renamed setLogCallback to set_log_callback
- Made Link/Identity static members private
- Added native14 env to CI and platformio.ini
- Bumped version to 0.2.10
2026-03-06 16:43:04 -07:00
Chad Attermann 49ccbc2827 Major bug fixes and performance enhancements
- Fixed bug in path table loading from flash storage wherein the raw
(packed) announce packet associated with each path entry was not being
unpacked prior to use.
- Fixed bug in path table entry announce packet loading where critical
changes to the announce packet (like hops increment) was being
overwriteen each time packet was re-loaded from cache.
- Optimized path table entries to lazy-load both announce packet and
receive interface so that memory is consumed by these structures until
if/when the path is actually used.
- Updated several global timers and sizes to match new RNS 1.x values.
- Bumped version to 0.2.9
2026-03-03 17:53:06 -07:00
Chad Attermann a968fdfc64 Bumped version to 0.2.8 2026-03-01 18:29:47 -07:00
Chad Attermann 9da37b29ac Added RNS 1.x Link MTU handling to Transport 2026-03-01 18:22:09 -07:00
Chad Attermann 89dce2c73b Merge pull request #30 from O11v3r/master
Fixed LINKREQUEST
2026-03-01 14:02:55 -07:00
Chad Attermann 9289da1a19 Bump to version 0.2.7. 2026-03-01 12:45:35 -07:00
Chad Attermann d670dd00d3 Merge pull request #29 from attermann/log_opt
Replace string-concatenation logging with printf-style F-variants
2026-03-01 12:32:55 -07:00
Chad Attermann 448695ca7a Merge pull request #28 from O11v3r/master
Fixed link compatibility with Reticulum python implementation
2026-03-01 12:13:43 -07:00
Chad Attermann 79b75bbd4e Replace string-concatenation logging with printf-style F-variants
Converted log calls across src/, examples/, and test/ to use DEBUGF/TRACEF/ERRORF/etc. macros instead of std::string + operator+. This eliminates temporary heap allocations on every log call, which matters on memory-constrained MCUs.
2026-03-01 10:59:33 -07:00
Chad Attermann 3babdc001d Merge pull request #27 from attermann/memory_bugs
Add announce table culling, fix use-after-free, and refactor build/log
2026-02-28 20:03:15 -07:00
Chad Attermann e86481e121 Add announce table culling, fix use-after-free, and refactor build/log
- Add cull_announce_table() with OOM-safe min_element fallback, matching pattern from cull_path_table() and cull_known_destinations()
- Call cull immediately after every announce/path/known-destination insert
- Fix use-after-free: guard announce_entry access with announce_erased flag
- remove_path() now also deletes cached packet files
- Path table insert now removes existing entry first to prevent duplicates
- Rename env:mcu -> env:embedded; add env:native_debug and heltec_wifi_lora_32_V4
- Make TLSF buffer size configurable via RNS_TLSF_BUFFER_SIZE macro
- Refactor log macros to unified RNS::log() path; add doHeadLog with callback support
- Prefix all bad_alloc error messages with "bad_alloc -" for easier grepping
2026-02-28 19:54:15 -07:00
Chad Attermann 086aac87b5 Bumped version to 0.2.6 2026-02-27 13:25:40 -07:00
Chad Attermann c40adfb4ec Merge pull request #25 from attermann/oom_fix
OOM hardening and memory tuning
2026-02-27 13:14:38 -07:00
Chad Attermann b0681fe33f Additional defines for tuning memory usage
Added more defines for setting storage and persistence limits:
- RNS_RATE_TIMESTAMPS_MAX
- RNS_RANDOM_BLOBS_PERSIST_MAX
- RNS_RANDOM_BLOBS_MAX
2026-02-27 13:05:14 -07:00
Chad Attermann f5a23a5a56 Add OOM hardening across Transport, Identity, Destination, and Packet
- Transport::inbound(): pre-emptive cull before destination-table insert;
  try/catch around insert for explicit OOM diagnostics
- Transport::jobs(): split stale-entry culling into 5 independent
  per-phase try/catch blocks so a failure in one phase doesn't abort
  the others; reserve() before push_back loops in each phase
- cull_path_table()/cull_known_destinations(): std::min_element fallback
  when sort-index allocation fails, breaking the cull-OOM-still-full loop
- Identity::remember(): wrapped _known_destinations.insert in try/catch
  for explicit OOM diagnostic logging
- Destination::announce(): outer try/catch covers all OOM-prone ops
  (Bytes concat, sign, Packet ctor, send); inner _path_responses.insert
  catch preserved for degraded-mode behavior
- Packet::unpack(): dedicated std::bad_alloc catch returns false cleanly
- Type.h: MAX_RECEIPTS and MAX_QUEUED_ANNOUNCES now overridable at
  compile time via RNS_RECEIPTS_MAX / RNS_QUEUED_ANNOUNCES_MAX
- Transport.h: hashlist_maxsize and max_pr_tags exposed as runtime
  accessors for dynamic capacity tuning
2026-02-27 12:53:49 -07:00
Chad Attermann 20a7022241 Bumped version to 0.2.5 2026-02-26 11:38:48 -07:00
Chad Attermann 6d31c9cd2b Merge pull request #20 from DanBeard/fix/bytes-and-transport-bugs
Fix receipt cull logic and bytes edge case.
2026-02-24 13:31:46 -07:00
Chad Attermann d76bfce7ce Update test_main.cpp
Disabled `test_receipt_timeout_callback` test which is currently failing.
2026-02-24 13:24:29 -07:00
Chad Attermann 3c4978f294 WIP: Fixes for link validation and announce retries
Fix for link validation failure when poackets contain new MTU in payload
from RNS 1.0 (courtesy of @jlpoolen).
Optimization of announce re-broadcasts from RNS 1.0.
2026-02-15 09:59:25 -07:00
Chad Attermann 3cc7c2a55d WIP: Added local project support for RAK boards 2026-02-14 11:00:12 -07:00
Chad Attermann cddc86e8c0 WIP: Added support for RNS packet context_flag
Added support for new `context_flag` in RNS packet header that is used
to indicate the use of ratchets.
Note that ratchet support is still missing from the implementation, but
this fix enables received ratchets to be able to handled gracefully.
2026-02-13 22:39:14 -07:00
Chad Attermann 838cede2e1 Incremented library version. 2026-02-09 13:58:25 -07:00
Chad Attermann 27433edb19 Updates for MCU builds broken by previous dev. 2026-02-09 13:52:13 -07:00
Chad Attermann bd9b76f93a Revert "Enabled wiscore_rak4631 env in CI."
This reverts commit 813f6b82ca.
2026-01-21 14:53:36 -07:00
Chad Attermann 0004ca1717 Added build support for LILYGO T-Beam SUPREME 2026-01-21 13:53:37 -07:00
Chad Attermann 813f6b82ca Enabled wiscore_rak4631 env in CI. 2026-01-21 12:45:40 -07:00
Chad Attermann d3429dfbe8 Merge pull request #12 from mofosyne/master
Add CI
2026-01-21 12:42:54 -07:00
Chad Attermann 818782382a Enhance Bytes, fix for Lins, test/example updates
- Added convenience methods to Bytes class
- Fix for logic error in Link class compliments of @cobraPA
- Added unit tests
- Updated example apps
2026-01-21 12:38:13 -07:00
Chad Attermann b8be484624 WIP: Major refactor of unit and integration tests 2025-08-26 21:05:36 -06:00
Chad Attermann fe687d391b WIP: Migrated a few unit tests to Unity 2025-08-26 10:49:37 -06:00
Chad Attermann bac53b9e6d WIP: Integrated Unity test framework. 2025-08-25 14:42:15 -06:00
Chad Attermann b28962aaa9 WIP: Final missing header for Ubuntu build 2025-08-24 21:48:23 -06:00
Chad Attermann 92c9349862 WIP: Added missing headers 2025-08-24 21:42:57 -06:00
Chad Attermann e9cd61f375 WIP: Fixes for linux builds. 2025-08-24 21:33:51 -06:00
Chad Attermann ec31f11eaa Merge pull request #10 from attermann/link_support
Link support
2025-08-24 20:54:48 -06:00
Chad Attermann f155e39cf6 WIP: Minor refactoring of examples. 2025-08-24 20:52:38 -06:00
Chad Attermann 0c902054db WIP: Links working with example app. 2025-08-24 14:26:29 -06:00
Chad Attermann c3edde10e9 WIP: Progress toward Link support with example app 2025-08-23 14:12:13 -06:00
Chad Attermann 11155b5829 WIP: Completed but un-tested port of Link.
Link is now mostly ported from Python but as of yet un-tested.
Refactored Interface.
Orgnanized example apps.
2025-08-21 17:29:26 -06:00
Chad Attermann a89a4bed86 Merge pull request #9 from attermann/master
Merging latest master
2025-08-20 22:09:51 -06:00
Chad Attermann 2deb358def WIP: Updated ecamples and added native main() 2025-08-20 22:05:11 -06:00
Chad Attermann b0011a10ed Updated build
Replaced arduinolibs with dedicated Crypto library repo.
Removed unsupported Heltec Wireless Tracker.
2024-11-03 09:55:55 -07:00
Chad Attermann 2eef30906d Update README.md with updated Roadmap 2024-09-21 09:38:39 -06:00
Chad Attermann a437b04965 WIP: Merging latest into link_support 2024-08-22 19:04:52 -06:00
Chad Attermann aa1b98e465 WIP: Interim update while implementing Links 2024-08-22 19:01:26 -06:00
Chad Attermann fcfda66365 WIP: General improvements in persistence efficiency 2024-08-14 21:59:23 -06:00
Chad Attermann 4a30a0a4b4 WIP: Filesystem support and persistence defines 2024-07-21 17:27:09 -06:00
Chad Attermann 3af5111606 WIP: Logging optimizations and memory management
Changed a few key logs to use printf-style instead of string
concatenation to avoid dynamic memory allocation. Still need to move
all remaining logging over to printf-style.

Added option (-DRNS_USE_ALLOCATOR=1) to override new/delete operators for
both allocation metrics and the ability to implement an alternate memory
allocator.

Added option (-DRNS_USE_TLSF=1) to use the alternate TLSF allocator
(must also define RNS_USE_ALLOCATOR). This allocator is well known for
reducing fragmentation and providing constant, O(1)-time allocation
and deallocation for real-time embedded systems.

This TLSF allocator appears to already be the default allocator for
ESP32 boards, but the allocator used by NRF52 is unknown at this time so
the TLSF allocator internal to microReticulum is only being used for
NRF52 boards at this time.

Future memory management improvements will include custom allocators for
long-lived structures like the path table that will segregate them from
the general pool of memory that is constantly cycling, thereby further
reducing fragmentation. It will also allow these structures to use
alternate memory like PSRAM present on T-Beam boards.
2024-07-16 10:40:46 -06:00
Chad Attermann 25741cf235 WIP: More ESP32 memory management 2024-07-03 13:30:05 -06:00
Chad Attermann 36ff1c5f00 WIP: Refactored logging to use macros 2024-07-03 11:30:01 -06:00
Chad Attermann 2d3b3d586f WIP: Improved heap management 2024-07-03 10:57:27 -06:00
Chad Attermann bef8dbc1b0 WIP: Stable memory and flash with limited paths 2024-07-03 06:55:06 -06:00
Chad Attermann 518db13ec8 WIP: Switched to macros for build control of logs 2024-07-01 20:25:46 -06:00
Chad Attermann cc25dbab8f WIP: Major improvements in memory management 2024-07-01 20:12:51 -06:00
Chad Attermann 1c2525b588 WIP: Removed experimental memory check 2024-06-20 16:06:30 -06:00
Chad Attermann ae7b324378 WIP: Improved persistence 2024-06-20 15:37:01 -06:00
Chad Attermann 73795b4286 WIP: Includes support for nRF52 TRNG 2024-06-06 12:55:53 -06:00
Chad Attermann b8b2e6ab7f WIP: Added a little RNG entropy for nrf52 installs 2024-06-05 16:26:08 -06:00
Chad Attermann ef69347ec8 WIP: Added source of Arduino noise to RNG 2024-06-05 00:49:13 -06:00
Chad Attermann f415b5e0b5 WIP: Enhancements to persistence 2024-06-03 08:13:45 -06:00
Chad Attermann 63a16a5391 WIP 2024-05-29 11:43:22 -06:00
Chad Attermann 1b1beab4fa WIP: Work toward removing platform-specifics
Moved LoRa and UDP test code into `examples` folder.
Moved `main.cpp` test app to `examples` folder.
Removed platform-specific filesystem code and replaced with an interface
to be implemeneted by the consumer.
2024-05-26 17:28:51 -06:00
Chad Attermann a6ffe53585 Updates related to repo name change. 2024-02-20 10:23:51 -07:00
Chad Attermann 20fdc168de Update README.md 2024-02-18 17:39:11 -07:00
Chad Attermann 9443f8a3f7 WIP: Changes in support of transport node formware 2024-01-05 14:51:55 -07:00
attermann 03cfb1c03f WIP: More porting and work on persistence
Ported packet PROOFs.
Implemented Transport probe destination.
SPIFFs filesystem checks and formatting when necessary.
2023-12-20 11:52:48 -07:00
attermann 7aac0f4355 WIP: Additional work on transport node support
Added processing for LINKREQUEST and PROOF in Transport. This is
expected to enable transport and repeating of these packets, but support
for local Link and Resources is yet to be implemented.
2023-12-15 09:27:18 -07:00
attermann 162dcff6cd WIP: Continued work of persistence and refactoring 2023-12-11 13:42:20 -07:00
attermann f9a679ffc2 WIP: Initial implementation of persistence
Persistence implemented with the help of the ArduinoJson library using
MessagePack format.
2023-12-05 11:06:49 -07:00
attermann c39e9e7fee WIP: Fixed archictectural flaw with Interfaces
Fixed packet transmit issue caused by fundamental issue of attempting to
send on a copy of an interface which is not properly associated with the
actual method overrides of the derived class (the interface
implementation).
Fix was to use methods in the Object data to callback to the original
(implementation) instance of the object.
General clean-up to remove some early testing code.
2023-12-03 16:43:53 -07:00
attermann 9f0e71bb81 WIP: Exposed Interface mode for setting 2023-12-02 10:14:08 -07:00
attermann 9e0fb02581 WIP: UDPInterface 2023-12-02 09:38:24 -07:00
attermann 5443d30282 WIP: Made UDPInterface configurable 2023-12-02 09:32:51 -07:00
attermann 642486ac7e WIP: Fixes, optimizations, and more Transport
Changed all time references to use decimal seconds to match Python
reference implementation.
Fixed memory issues caused by storing references to objects instead of
copies.
More implementation of Transport logic.
This is the first build that fully implements end-to-end path finding
and routing.
2023-12-02 08:52:45 -07:00
attermann ea7b4603ed WIP: Added super basic UDP interface for testing
Basic UDP interface enabled testing with RNS reference implementation.
Added to basic Transport implementation.
2023-11-26 18:10:46 -07:00
attermann 8d943318a6 WIP: Collection optimizations and Transport
Tested and optimized collections used in Transport.
Additional Transport implementation.
2023-11-21 06:21:03 -07:00
attermann 263f589801 WIP: Refactor pointer/reference style. 2023-11-20 10:51:56 -07:00
attermann d09331ec0e WIP: Optimizations with reference return types. 2023-11-20 10:26:14 -07:00
attermann 9f1602067d WIP: More refactoring to reduce need for headers 2023-11-19 13:17:42 -07:00
attermann 33fda8a7f9 WIP: Refactored to minimize circular dependenies
Moved core class constants and enums into single header Types.h.
Switched form class-specific NoneContructor to single
Type::NoneConstructor.
2023-11-19 11:36:09 -07:00
attermann a2e956eced WIP update
Minimal transport implementation.
2023-11-19 08:51:10 -07:00
Chad Attermann 18ed42b40f Updated README 2023-10-10 14:13:27 -06:00
attermann 8026638a06 WIP update 2023-10-09 10:19:26 -06:00
attermann 2c8006f3a9 WIP update
Finished moving Packet over to implicit sharing.
2023-10-09 09:39:11 -06:00
attermann 59b8e90d1f WIP update
Cleanup.
2023-10-09 08:58:38 -06:00
attermann f9e3a22911 WIP update
Implemented AES.
Implemented AES-CBC.
Implemented HKDF.
Implemented HMAC.
Implemented PKCS7.
Implemented Fernet.
Added extensive logging and successfully tested ability to encrypt and
decrypt a packet.
2023-10-08 23:59:43 -06:00
attermann 4b062aa485 WIP update
Implemented X25519.
2023-10-07 15:03:21 -06:00
attermann 1b919a9489 WIP Update
Cleaned up and organized test functions.
Implemented Ed25519.
2023-10-07 01:03:15 -06:00
attermann eef5f1b326 Initial commit 2023-10-06 17:24:48 -06:00
Chad Attermann d3ea0eedd9 Initial commit 2023-10-06 17:14:50 -06:00