cleanup virtual inheritence for Router/Reliable/Flooding/DSR

This commit is contained in:
geeksville
2020-05-23 09:24:22 -07:00
parent 8e2e154cdd
commit c9cb293bf2
7 changed files with 96 additions and 69 deletions

View File

@@ -67,14 +67,12 @@ class Router
virtual ErrorCode send(MeshPacket *p);
/**
* Called from loop()
* Handle any packet that is received by an interface on this node.
* Note: some packets may merely being passed through this node and will be forwarded elsewhere.
* Should this incoming filter be dropped?
*
* Note: this packet will never be called for messages sent/generated by this node.
* Note: this method will free the provided packet.
* Called immedately on receiption, before any further processing.
* @return true to abandon the packet
*/
virtual void handleReceived(MeshPacket *p);
virtual bool shouldFilterReceived(const MeshPacket *p) { return false; }
/**
* Every (non duplicate) packet this node receives will be passed through this method. This allows subclasses to
@@ -88,6 +86,27 @@ class Router
* @return true for success, false for corrupt packet.
*/
bool perhapsDecode(MeshPacket *p);
private:
/**
* Called from loop()
* Handle any packet that is received by an interface on this node.
* Note: some packets may merely being passed through this node and will be forwarded elsewhere.
*
* Note: this packet will never be called for messages sent/generated by this node.
* Note: this method will free the provided packet.
*/
void perhapsHandleReceived(MeshPacket *p);
/**
* Called from perhapsHandleReceived() - allows subclass message delivery behavior.
* Handle any packet that is received by an interface on this node.
* Note: some packets may merely being passed through this node and will be forwarded elsewhere.
*
* Note: this packet will never be called for messages sent/generated by this node.
* Note: this method will free the provided packet.
*/
void handleReceived(MeshPacket *p);
};
extern Router &router;