10#include <RHReliableDatagram.h>
13#define RH_DEFAULT_MAX_HOPS 30
16#define RH_ROUTING_TABLE_SIZE 10
19#define RH_ROUTER_ERROR_NONE 0
20#define RH_ROUTER_ERROR_INVALID_LENGTH 1
21#define RH_ROUTER_ERROR_NO_ROUTE 2
22#define RH_ROUTER_ERROR_TIMEOUT 3
23#define RH_ROUTER_ERROR_NO_REPLY 4
24#define RH_ROUTER_ERROR_UNABLE_TO_DELIVER 5
28#define RH_ROUTER_MAX_MESSAGE_LEN (RH_MAX_MESSAGE_LEN - sizeof(RHRouter::RoutedMessageHeader))
152 uint8_t data[RH_ROUTER_MAX_MESSAGE_LEN];
201 void addRouteTo(uint8_t dest, uint8_t next_hop, uint8_t state =
Valid);
250 uint8_t
sendtoWait(uint8_t* buf, uint8_t len, uint8_t dest, uint8_t flags = 0);
266 uint8_t
sendtoFromSourceWait(uint8_t* buf, uint8_t len, uint8_t dest, uint8_t source, uint8_t flags = 0);
289 bool recvfromAck(uint8_t* buf, uint8_t* len, uint8_t* source = NULL, uint8_t* dest = NULL, uint8_t*
id = NULL, uint8_t* flags = NULL, uint8_t* hops = NULL);
304 bool recvfromAckTimeout(uint8_t* buf, uint8_t* len, uint16_t timeout, uint8_t* source = NULL, uint8_t* dest = NULL, uint8_t*
id = NULL, uint8_t* flags = NULL, uint8_t* hops = NULL);
uint8_t thisAddress()
Definition RHDatagram.cpp:77
Abstract base class for a RadioHead driver.
Definition RHGenericDriver.h:42
RHDatagram subclass for sending addressed, acknowledged, retransmitted datagrams.
Definition RHReliableDatagram.h:96
RHReliableDatagram subclass for sending addressed, optionally acknowledged datagrams multi-hop routed...
Definition RHRouter.h:134
uint8_t sendtoFromSourceWait(uint8_t *buf, uint8_t len, uint8_t dest, uint8_t source, uint8_t flags=0)
Definition RHRouter.cpp:208
void printRoutingTable()
Definition RHRouter.cpp:153
uint8_t _lastE2ESequenceNumber
Definition RHRouter.h:328
void clearRoutingTable()
Definition RHRouter.cpp:193
void setIsaRouter(bool isa_router)
Definition RHRouter.cpp:45
bool recvfromAckTimeout(uint8_t *buf, uint8_t *len, uint16_t timeout, uint8_t *source=NULL, uint8_t *dest=NULL, uint8_t *id=NULL, uint8_t *flags=NULL, uint8_t *hops=NULL)
Definition RHRouter.cpp:344
uint8_t _max_hops
Definition RHRouter.h:332
bool deleteRouteTo(uint8_t dest)
Definition RHRouter.cpp:171
bool recvfromAck(uint8_t *buf, uint8_t *len, uint8_t *source=NULL, uint8_t *dest=NULL, uint8_t *id=NULL, uint8_t *flags=NULL, uint8_t *hops=NULL)
Definition RHRouter.cpp:253
uint8_t sendtoWait(uint8_t *buf, uint8_t len, uint8_t dest, uint8_t flags=0)
Definition RHRouter.cpp:201
void setMaxHops(uint8_t max_hops)
Definition RHRouter.cpp:39
void addRouteTo(uint8_t dest, uint8_t next_hop, uint8_t state=Valid)
Definition RHRouter.cpp:50
void retireOldestRoute()
Definition RHRouter.cpp:186
virtual uint8_t route(RoutedMessage *message, uint8_t messageLen)
Definition RHRouter.cpp:225
void deleteRoute(uint8_t index)
Definition RHRouter.cpp:144
RouteState
Values for the possible states for routes.
Definition RHRouter.h:157
@ Discovering
Discovering a route (not currently used)
Definition RHRouter.h:159
@ Valid
Route is valid.
Definition RHRouter.h:160
@ Invalid
No valid route is known.
Definition RHRouter.h:158
virtual void peekAtMessage(RoutedMessage *message, uint8_t messageLen)
Definition RHRouter.cpp:245
bool getNextValidRoutingTableEntry(RoutingTableEntry *RTE_p, int *lastIndex_p)
Definition RHRouter.cpp:105
bool _isa_router
Flag to set if packets are forwarded or not.
Definition RHRouter.h:335
RoutingTableEntry * getRouteTo(uint8_t dest)
Definition RHRouter.cpp:93
bool init()
Definition RHRouter.cpp:30
Defines the structure of a RHRouter message.
Definition RHRouter.h:150
RoutedMessageHeader header
end-to-end delivery header
Definition RHRouter.h:151
Defines an entry in the routing table.
Definition RHRouter.h:165
uint8_t next_hop
Send via this next hop address.
Definition RHRouter.h:167
uint8_t state
State of this route, one of RouteState.
Definition RHRouter.h:168
uint8_t dest
Destination node address.
Definition RHRouter.h:166