Files
firmware/src/modules/RoutingModule.h

38 lines
1.4 KiB
C
Raw Normal View History

2021-02-17 13:06:23 +08:00
#pragma once
2021-03-12 14:10:36 +08:00
#include "Channels.h"
2023-01-21 14:34:29 +01:00
#include "ProtobufModule.h"
2021-02-17 13:06:23 +08:00
/**
* Routing module for router control messages
2021-02-17 13:06:23 +08:00
*/
class RoutingModule : public ProtobufModule<meshtastic_Routing>
2021-02-17 13:06:23 +08:00
{
public:
/** Constructor
* name is for debugging output
*/
2022-02-27 02:21:02 -08:00
RoutingModule();
2021-02-17 13:06:23 +08:00
void sendAckNak(meshtastic_Routing_Error err, NodeNum to, PacketId idFrom, ChannelIndex chIndex, uint8_t hopLimit = 0);
// Given the hopStart and hopLimit upon reception of a request, return the hop limit to use for the response
uint8_t getHopLimitForResponse(uint8_t hopStart, uint8_t hopLimit);
2021-03-12 14:10:36 +08:00
2021-02-17 13:06:23 +08:00
protected:
friend class Router;
/** Called to handle a particular incoming message
@return true if you've guaranteed you've handled this message and no other handlers should be considered for it
*/
virtual bool handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshtastic_Routing *p) override;
2021-02-17 13:06:23 +08:00
/** Messages can be received that have the want_response bit set. If set, this callback will be invoked
* so that subclasses can (optionally) send a response back to the original sender. */
virtual meshtastic_MeshPacket *allocReply() override;
2021-02-17 13:06:23 +08:00
2021-02-23 14:35:34 +08:00
/// Override wantPacket to say we want to see all packets, not just those for our port number
virtual bool wantPacket(const meshtastic_MeshPacket *p) override { return true; }
2021-02-17 13:06:23 +08:00
};
extern RoutingModule *routingModule;