LoRaMesher Library  0.0.5
A LoRa Mesh library for the IoT
RoutingTableService.h
1#ifndef _LORAMESHER_ROUTING_TABLE_SERVICE_H
2#define _LORAMESHER_ROUTING_TABLE_SERVICE_H
3
4#include <Arduino.h>
5
6#include "ArduinoLog.h"
7
8
9#include "utilities/LinkedQueue.hpp"
10
11#include "entities/routingTable/RouteNode.h"
12
13#include "entities/routingTable/NetworkNode.h"
14
15#include "entities/packets/RoutePacket.h"
16
17#include "BuildOptions.h"
18
19#include "services/WiFiService.h"
20
26public:
27
32 static LM_LinkedList<RouteNode>* routingTableList;
33
38 static void printRoutingTable();
39
46
53 static RouteNode* findNode(uint16_t address);
54
62 static bool hasAddressRoutingTable(uint16_t address);
63
70 static uint16_t getNextHop(uint16_t dst);
71
78 static uint8_t getNumberOfHops(uint16_t address);
79
85 static size_t routingTableSize();
86
92 static void processRoute(RoutePacket* p);
93
94
99 static void manageTimeoutRoutingTable();
100
101private:
102
109 static void processRoute(uint16_t via, NetworkNode* node);
110
116 static void resetTimeoutRoutingNode(RouteNode* node);
117
124 static void addNodeToRoutingTable(NetworkNode* node, uint16_t via);
125
126};
127
128#endif
Network Node.
Definition: NetworkNode.h:12
Route Node.
Definition: RouteNode.h:12
Routing Table Service.
Definition: RoutingTableService.h:25
static RouteNode * findNode(uint16_t address)
Find the node that contains the address.
Definition: RoutingTableService.cpp:7
static bool hasAddressRoutingTable(uint16_t address)
Returns if address is inside the routing table.
Definition: RoutingTableService.cpp:26
static NetworkNode * getAllNetworkNodes()
Get the All Network Nodes that are inside the routing table.
Definition: RoutingTableService.cpp:107
static uint16_t getNextHop(uint16_t dst)
Get the Next Hop address.
Definition: RoutingTableService.cpp:31
static size_t routingTableSize()
Returns the routing table size.
Definition: RoutingTableService.cpp:3
static void processRoute(RoutePacket *p)
Process the network packet.
Definition: RoutingTableService.cpp:49
static void manageTimeoutRoutingTable()
Checks all the routing entries for a route timeout and remove the entry.
Definition: RoutingTableService.cpp:156
static uint8_t getNumberOfHops(uint16_t address)
Get the Number Of Hops of the address inside the routing table.
Definition: RoutingTableService.cpp:40
static LM_LinkedList< RouteNode > * routingTableList
Routing table List.
Definition: RoutingTableService.h:32
static void printRoutingTable()
Prints the actual routing table in the log.
Definition: RoutingTableService.cpp:133