mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-04-20 22:13:47 +00:00
Merge 5266ffcaf3 into dee3e26ac0
This commit is contained in:
commit
80dfa37b47
2 changed files with 432 additions and 0 deletions
|
|
@ -61,6 +61,21 @@ struct RepeaterStats {
|
|||
#define MAX_CLIENTS 32
|
||||
#endif
|
||||
|
||||
#define MAX_PATH_PREFIX_LEN 4
|
||||
#define MAX_BLACKLIST_ENTRIES 16
|
||||
#define MAX_CHAN_NAME_FILTERS 8
|
||||
|
||||
struct BlacklistEntry {
|
||||
uint8_t len; // 0 = empty slot
|
||||
uint8_t prefix[MAX_PATH_PREFIX_LEN];
|
||||
};
|
||||
|
||||
struct ChanNameFilter {
|
||||
uint8_t hash[PATH_HASH_SIZE];
|
||||
uint8_t secret[PUB_KEY_SIZE];
|
||||
char name[32];
|
||||
};
|
||||
|
||||
struct NeighbourInfo {
|
||||
mesh::Identity id;
|
||||
uint32_t advert_timestamp;
|
||||
|
|
@ -103,6 +118,10 @@ class MyMesh : public mesh::Mesh, public CommonCLICallbacks {
|
|||
unsigned long pending_discover_until;
|
||||
bool region_load_active;
|
||||
unsigned long dirty_contacts_expiry;
|
||||
BlacklistEntry _path_blacklist[MAX_BLACKLIST_ENTRIES];
|
||||
BlacklistEntry _chan_blacklist[MAX_BLACKLIST_ENTRIES];
|
||||
ChanNameFilter _chan_name_filters[MAX_CHAN_NAME_FILTERS];
|
||||
int _num_chan_name_filters;
|
||||
#if MAX_NEIGHBOURS
|
||||
NeighbourInfo neighbours[MAX_NEIGHBOURS];
|
||||
#endif
|
||||
|
|
@ -130,6 +149,20 @@ class MyMesh : public mesh::Mesh, public CommonCLICallbacks {
|
|||
File openAppend(const char* fname);
|
||||
bool isLooped(const mesh::Packet* packet, const uint8_t max_counters[]);
|
||||
|
||||
bool isPathBlacklisted(const mesh::Packet* packet) const;
|
||||
bool isChanBlacklisted(const mesh::Packet* packet) const;
|
||||
void loadBlacklist(const char* fname, BlacklistEntry* list);
|
||||
void saveBlacklist(const char* fname, const BlacklistEntry* list);
|
||||
bool addToBlacklist(BlacklistEntry* list, const uint8_t* prefix, uint8_t len);
|
||||
bool removeFromBlacklist(BlacklistEntry* list, const uint8_t* prefix, uint8_t len);
|
||||
void formatBlacklist(const BlacklistEntry* list, char* reply);
|
||||
void deriveChanNameFilter(ChanNameFilter& entry, const char* name);
|
||||
bool addChanNameFilter(const char* name);
|
||||
bool removeChanNameFilter(const char* name);
|
||||
void loadChanBlacklist(const char* fname);
|
||||
void saveChanBlacklist(const char* fname);
|
||||
void formatChanBlacklist(char* reply);
|
||||
|
||||
protected:
|
||||
float getAirtimeBudgetFactor() const override {
|
||||
return _prefs.airtime_factor;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue