CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
Loading...
Searching...
No Matches
ExtFeatureName.h
Go to the documentation of this file.
1
9
10#pragma once
11
12#include <cstddef>
13
14namespace cdc::plugin_manager {
15
17inline constexpr size_t EXT_FEATURE_NAME_MAX = 33;
18
20inline constexpr size_t EXT_FEATURE_MAX_PER_PLUGIN = 4;
21
27inline bool isValidExtFeatureName(const char* name)
28{
29 if (!name || !name[0]) return false;
30 if (name[0] < 'a' || name[0] > 'z') return false;
31 size_t len = 0;
32 for (const char* p = name; *p; ++p) {
33 if (++len >= EXT_FEATURE_NAME_MAX) return false;
34 const char c = *p;
35 const bool ok = (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || c == '_';
36 if (!ok) return false;
37 }
38 return true;
39}
40
41} // namespace cdc::plugin_manager
char name[cdc::hal::ISecureElement::RMEM_NAME_LEN]
constexpr size_t EXT_FEATURE_MAX_PER_PLUGIN
Maximum number of provides entries a single plugin manifest may declare.
constexpr size_t EXT_FEATURE_NAME_MAX
Maximum external-feature name length including the trailing NUL.
bool isValidExtFeatureName(const char *name)
True if name is a well-formed external-feature name.