* new CLI commands: region, region load, region save, region get, region allow

This commit is contained in:
Scott Powell 2025-11-03 22:53:14 +11:00
parent f797744f7c
commit ecd30f4d36
5 changed files with 219 additions and 22 deletions

View file

@ -24,20 +24,24 @@ class RegionMap {
RegionEntry regions[MAX_REGION_ENTRIES];
RegionEntry wildcard;
public:
RegionMap(TransportKeyStore& store) : _store(&store) {
next_id = 1; num_regions = 0;
wildcard.id = wildcard.parent = 0;
wildcard.flags = REGION_ALLOW_FLOOD; // default behaviour, allow flood
}
void load(FILESYSTEM* _fs);
void save(FILESYSTEM* _fs);
void printChildRegions(int indent, const RegionEntry* parent, Stream& out) const;
RegionEntry* putRegion(const char* name, uint16_t parent_id);
public:
RegionMap(TransportKeyStore& store);
bool load(FILESYSTEM* _fs);
bool save(FILESYSTEM* _fs);
RegionEntry* putRegion(const char* name, uint16_t parent_id, uint16_t id = 0);
RegionEntry* findMatch(mesh::Packet* packet, uint8_t mask);
RegionEntry& getWildcard() { return wildcard; }
RegionEntry* findByName(const char* name);
RegionEntry* findByNamePrefix(const char* prefix);
RegionEntry* findById(uint16_t id);
bool removeRegion(const RegionEntry& region);
bool clear();
void resetFrom(const RegionMap& src) { num_regions = 0; next_id = src.next_id; }
int getCount() const { return num_regions; }
void exportTo(Stream& out) const;
};