Add repeater flood filters and transport scopes
This commit is contained in:
1 parent
5e030ce77b
commit
09c8aaba9c
25 files changed
+1222
-111
No files matched your search
@@ -2,6 +2,10 @@
|
||||
|
||||
#include <Dispatcher.h>
|
||||
|
||||
// Zero rejects a candidate as unknown/denied; positive values rank eligible
|
||||
// scopes, with larger values preferred when received path lengths are equal.
|
||||
typedef uint8_t (*FloodScopePreference)(const mesh::Packet* packet, void* context);
|
||||
|
||||
class PacketQueue {
|
||||
mesh::Packet** _table;
|
||||
uint8_t* _pri_table;
|
||||
@@ -10,10 +14,15 @@ class PacketQueue {
|
||||
uint32_t _next_schedule;
|
||||
|
||||
void rebuildNextTime();
|
||||
void applyBestFloodTransportScope(mesh::Packet* packet,
|
||||
FloodScopePreference scope_preference,
|
||||
void* scope_preference_context) const;
|
||||
|
||||
public:
|
||||
PacketQueue(int max_entries);
|
||||
mesh::Packet* get(uint32_t now);
|
||||
mesh::Packet* get(uint32_t now, bool resolve_flood_scope = false,
|
||||
FloodScopePreference scope_preference = NULL,
|
||||
void* scope_preference_context = NULL);
|
||||
mesh::Packet* peek(uint32_t now) const;
|
||||
bool add(mesh::Packet* packet, uint8_t priority, uint32_t scheduled_for);
|
||||
int count() const { return _num; }
|
||||
@@ -25,10 +34,17 @@ public:
|
||||
|
||||
class StaticPoolPacketManager : public mesh::PacketManager {
|
||||
PacketQueue unused, send_queue, rx_queue;
|
||||
FloodScopePreference flood_scope_preference;
|
||||
void* flood_scope_preference_context;
|
||||
|
||||
public:
|
||||
StaticPoolPacketManager(int pool_size);
|
||||
|
||||
void setFloodScopePreference(FloodScopePreference preference, void* context) {
|
||||
flood_scope_preference = preference;
|
||||
flood_scope_preference_context = context;
|
||||
}
|
||||
|
||||
mesh::Packet* allocNew() override;
|
||||
void free(mesh::Packet* packet) override;
|
||||
bool queueOutbound(mesh::Packet* packet, uint8_t priority, uint32_t scheduled_for) override;
|
||||
|
||||
Reference in new issue
Block a user