RF24Gateway - TCP/IP over RF24Network v2.1.1
TMRh20 - Pushing the practical limits of RF24 modules
Loading...
Searching...
No Matches
ESBGateway< mesh_t, network_t, radio_t >::routeStruct Struct Reference

#include <RF24Gateway.h>

Public Attributes

struct in_addr ip
 
struct in_addr mask
 
struct in_addr gw
 

Detailed Description

template<class mesh_t = ESBMesh<ESBNetwork<RF24>, RF24>, class network_t = ESBNetwork<RF24>, class radio_t = RF24>
struct ESBGateway< mesh_t, network_t, radio_t >::routeStruct

If a user has created a file "routing.txt" in the RF24Gateway working directory, it will be loaded
at startup into the routing table. The file should contain standard routing table entries as follows:
IP<space>NetMask<space>Gateway
ie: routing.txt

10.1.4.0 255.255.255.0 10.1.3.33
0.0.0.0 0.0.0.0 10.1.3.34

The first example entry would route all traffic to the 10.1.4.x subnet to 10.1.3.33
All other traffic not destined for the RF24 nodes will use 10.1.3.34 as the gateway

Data can be accessed using standard linux Internet address manipulation routines as follows:

printf("**IP\t\tMask\t\tGateway**\n");
for(int i=0; i<gw.routingTableSize; i++){
printf("%s \t",inet_ntoa(gw.routingStruct[i].ip));//inet_ntoa uses a statically assigned buffer, so the printf calls need to be done separately
printf("%s \t",inet_ntoa(gw.routingStruct[i].mask));
printf("%s\n", inet_ntoa(gw.routingStruct[i].gw));
//std::cout << inet_ntoa(gw.routingStruct[i].ip) << " \t" << inet_ntoa(gw.routingStruct[i].mask) << " \t" << inet_ntoa(gw.routingStruct[i].gw) << std::endl;
}
printf("*****\n");
Users can modify the routing table as desired, but changes made in code will not currently be saved to file

Definition at line 209 of file RF24Gateway.h.

Member Data Documentation

◆ ip

template<class mesh_t = ESBMesh<ESBNetwork<RF24>, RF24>, class network_t = ESBNetwork<RF24>, class radio_t = RF24>
struct in_addr ESBGateway< mesh_t, network_t, radio_t >::routeStruct::ip

Definition at line 211 of file RF24Gateway.h.

◆ mask

template<class mesh_t = ESBMesh<ESBNetwork<RF24>, RF24>, class network_t = ESBNetwork<RF24>, class radio_t = RF24>
struct in_addr ESBGateway< mesh_t, network_t, radio_t >::routeStruct::mask

Definition at line 212 of file RF24Gateway.h.

◆ gw

template<class mesh_t = ESBMesh<ESBNetwork<RF24>, RF24>, class network_t = ESBNetwork<RF24>, class radio_t = RF24>
struct in_addr ESBGateway< mesh_t, network_t, radio_t >::routeStruct::gw

Definition at line 213 of file RF24Gateway.h.