Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ endif()
option(RNS_BUILD_TESTS "Build Unity test suites under test/" ON)
option(RNS_BUILD_EXAMPLES "Build native example applications" ON)
option(RNS_BUILD_INTEROP "Build interop senders under test_interop/" ON)
option(RNS_USE_FS "Enable filesystem persistence" ON)
option(RNS_PERSIST_PATHS "Persist path table to storage" ON)
option(RNS_USE_FS "Enable filesystem persistence" ON)
option(RNS_PERSIST_PATHS "Persist path table to storage" ON)
option(RNS_USE_PROVISIONING "Auto-start Provisioning subsystem from Reticulum::start()" ON)
option(RNS_DEBUG_MEMORY "Enable memory/heap/metrics debug logging" OFF)
option(RNS_SANITIZE "Build with AddressSanitizer + frame pointers" OFF)

Expand Down Expand Up @@ -125,6 +126,9 @@ endif()
if(RNS_PERSIST_PATHS)
target_compile_definitions(microReticulum PUBLIC RNS_PERSIST_PATHS)
endif()
if(RNS_USE_PROVISIONING)
target_compile_definitions(microReticulum PUBLIC RNS_USE_PROVISIONING)
endif()
if(RNS_DEBUG_MEMORY)
target_compile_definitions(microReticulum PUBLIC
RNS_DEBUG_HEAP RNS_DEBUG_MEMORY RNS_DEBUG_METRICS RNS_DEBUG_PATHSTORE)
Expand Down
42 changes: 27 additions & 15 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,20 @@
; https://docs.platformio.org/page/projectconf.html

[platformio]
default_envs = native14
default_envs =
native17
ttgo-lora32-v21
ttgo-t-beam
lilygo_tbeam_supreme
heltec_wifi_lora_32_V4
wiscore_rak4631

[env]
build_unflags =
-std=gnu++11
-fno-exceptions
build_flags =
-std=gnu++17
-fexceptions
-Wall
;-Wextra
Expand All @@ -29,6 +37,7 @@ build_flags =
-DRNS_DEBUG_PATHSTORE
-DRNS_USE_FS
-DRNS_PERSIST_PATHS
-DRNS_USE_PROVISIONING
-DUSTORE_USE_UNIVERSALFS
lib_deps =
ArduinoJson@^7.4.2
Expand All @@ -42,7 +51,6 @@ test_build_src = true
platform = native
build_flags =
${env.build_flags}
-std=gnu++11
-DNATIVE
lib_deps =
${env.lib_deps}
Expand All @@ -54,19 +62,33 @@ lib_compat_mode = off
platform = native
build_flags =
${env.build_flags}
-std=gnu++11
-DNATIVE
lib_deps =
${env.lib_deps}
microStore=symlink://../microStore
; Following required to force-include libraries that are marked arduino-only
lib_compat_mode = off

[env:native14]
[env:native11]
platform = native
build_unflags =
${env.build_unflags}
-std=gnu++17
build_flags =
${env.build_flags}
-std=gnu++11
-DNATIVE
lib_deps =
${env.lib_deps}
https://github.com/attermann/microStore.git
; Following required to force-include libraries that are marked arduino-only
lib_compat_mode = off

[env:native14]
platform = native
build_unflags =
${env.build_unflags}
-std=gnu++17
build_flags =
${env.build_flags}
-std=gnu++14
Expand All @@ -81,10 +103,8 @@ lib_compat_mode = off
platform = native
build_unflags =
${env.build_unflags}
-std=gnu++11
build_flags =
${env.build_flags}
-std=gnu++17
-DNATIVE
lib_deps =
${env.lib_deps}
Expand All @@ -96,7 +116,7 @@ lib_compat_mode = off
platform = native
build_unflags =
${env.build_unflags}
-std=gnu++11
-std=gnu++17
build_flags =
${env.build_flags}
-std=gnu++20
Expand All @@ -111,11 +131,8 @@ lib_compat_mode = off
platform = native
build_unflags =
${env.build_unflags}
-std=gnu++11
build_flags =
${env.build_flags}
;-std=gnu++11
-std=gnu++17
-DNATIVE
; CBA TEST
;-fsanitize=address
Expand Down Expand Up @@ -150,11 +167,9 @@ monitor_speed = 115200
upload_speed = 460800
build_unflags =
${env.build_unflags}
-std=gnu++11
;-fno-rtti
build_flags =
${env.build_flags}
-std=gnu++17
lib_deps =
${env.lib_deps}
https://github.com/attermann/microStore.git
Expand All @@ -166,10 +181,8 @@ board = ttgo-lora32-v21
board_build.partitions = no_ota.csv
build_unflags =
${env:embedded.build_unflags}
-std=gnu++11
build_flags =
${env:embedded.build_flags}
-std=gnu++17
-DBOARD_ESP32
-DMSGPACK_USE_BOOST=OFF
lib_deps =
Expand Down Expand Up @@ -264,7 +277,6 @@ lib_deps =
platform = native
build_flags =
${env.build_flags}
-std=gnu++11
-DNATIVE
lib_deps =
${env.lib_deps}
Expand Down
80 changes: 80 additions & 0 deletions src/Provisioning/BuiltinNamespaces.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/*
* Copyright (c) 2026 Chad Attermann
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*/

#include "Provisioning.h"
#include "Ids.h"

#include "../Reticulum.h"
#include "../Transport.h"

namespace RNS { namespace Provisioning {

// Idempotent: re-calling does nothing because Registry rejects duplicate
// namespace ids. Called automatically from Manager::begin().
void register_builtin_namespaces(Manager& p) {

// reticulum
if (!p.registry().find(Ns::Reticulum::Id)) {
p.register_namespace("reticulum", Ns::Reticulum::Id)
.field_bool("transport_enabled", Ns::Reticulum::Field::TransportEnabled,
FF_LIVE_APPLY, Reticulum::transport_enabled(),
[](const Value& v) { Reticulum::transport_enabled(v.as_bool()); return true; })
.field_bool("link_mtu_discovery", Ns::Reticulum::Field::LinkMtuDiscovery,
FF_REBOOT_REQUIRED, Reticulum::link_mtu_discovery(),
[](const Value& v) { Reticulum::link_mtu_discovery(v.as_bool()); return true; })
.field_bool("remote_management_enabled", Ns::Reticulum::Field::RemoteManagementEnabled,
FF_LIVE_APPLY, Reticulum::remote_management_enabled(),
[](const Value& v) { Reticulum::remote_management_enabled(v.as_bool()); return true; })
.field_bool("probe_destination_enabled", Ns::Reticulum::Field::ProbeDestinationEnabled,
FF_LIVE_APPLY, Reticulum::probe_destination_enabled(),
[](const Value& v) { Reticulum::probe_destination_enabled(v.as_bool()); return true; })
.field_int("persist_interval", Ns::Reticulum::Field::PersistInterval,
FF_LIVE_APPLY, (int64_t)Reticulum::persist_interval(), 30, 86400,
[](const Value& v) { Reticulum::persist_interval((uint16_t)v.as_int()); return true; })
.field_int("clean_interval", Ns::Reticulum::Field::CleanInterval,
FF_LIVE_APPLY, (int64_t)Reticulum::clean_interval(), 60, 86400,
[](const Value& v) { Reticulum::clean_interval((uint16_t)v.as_int()); return true; })
.end();
}

// transport
if (!p.registry().find(Ns::Transport::Id)) {
p.register_namespace("transport", Ns::Transport::Id)
.field_int("path_table_maxsize", Ns::Transport::Field::PathTableMaxsize,
FF_LIVE_APPLY, (int64_t)RNS::Transport::path_table_maxsize(), 1, 65535,
[](const Value& v) { RNS::Transport::path_table_maxsize((uint16_t)v.as_int()); return true; })
.field_int("announce_table_maxsize", Ns::Transport::Field::AnnounceTableMaxsize,
FF_LIVE_APPLY, (int64_t)RNS::Transport::announce_table_maxsize(), 1, 65535,
[](const Value& v) { RNS::Transport::announce_table_maxsize((uint16_t)v.as_int()); return true; })
.field_int("hashlist_maxsize", Ns::Transport::Field::HashlistMaxsize,
FF_LIVE_APPLY, (int64_t)RNS::Transport::hashlist_maxsize(), 1, 65535,
[](const Value& v) { RNS::Transport::hashlist_maxsize((uint16_t)v.as_int()); return true; })
.field_int("max_pr_tags", Ns::Transport::Field::MaxPrTags,
FF_LIVE_APPLY, (int64_t)RNS::Transport::max_pr_tags(), 1, 65535,
[](const Value& v) { RNS::Transport::max_pr_tags((uint16_t)v.as_int()); return true; })
.field_int("path_table_maxpersist", Ns::Transport::Field::PathTableMaxpersist,
FF_LIVE_APPLY, (int64_t)RNS::Transport::path_table_maxpersist(), 1, 65535,
[](const Value& v) { RNS::Transport::path_table_maxpersist((uint16_t)v.as_int()); return true; })
.end();
}

// Note: an "identity" built-in namespace (id 3) was prototyped earlier
// but dropped because the library has no canonical identity to expose.
// Apps that want to surface an identity-like field should register
// their own namespace using an id in the 100-199 (official-app) or
// 200+ (vendor) range. Id 3 is permanently reserved.

}

} }
Loading
Loading