Use the hop_limit field of MeshPacket to limit max delivery depth in

the mesh.
This commit is contained in:
geeksville
2020-05-18 17:35:23 -07:00
parent 53c3d9baa2
commit 26d3ef529e
9 changed files with 51 additions and 33 deletions

View File

@@ -14,6 +14,15 @@ typedef uint8_t PacketId; // A packet sequence number
#define ERRNO_NO_INTERFACES 33
#define ERRNO_UNKNOWN 32 // pick something that doesn't conflict with RH_ROUTER_ERROR_UNABLE_TO_DELIVER
/**
* the max number of hops a message can pass through, used as the default max for hop_limit in MeshPacket.
*
* We reserve 3 bits in the header so this could be up to 7, but given the high range of lora and typical usecases, keeping
* maxhops to 3 should be fine for a while. This also serves to prevent routing/flooding attempts to be attempted for
* too long.
**/
#define HOP_MAX 3
typedef int ErrorCode;
/// Alloc and free packets to our global, ISR safe pool