To implement the TORA routing in OMNeT++, we have numerous steps to follow. Basically the TORA is a complex task as it encompasses numerous components that contain the route creation, route maintenance, and route erasure. The term the Temporally-Ordered Routing Algorithm (TORA) is a highly adaptive, loop-free, and distributed routing protocol that planned for mobile ad hoc networks (MANETs) and it is specifically appropriate for networks where the topology changes recurrently. TORA is based on the concept of directed acyclic graphs (DAGs) rooted at the destination, which supports to guarantee that packets flow in a loop-free manner towards the destination.
The given below is the step-by-procedures on how to implement TORA in OMNeT++ using the INET framework.
Step-by-Step Implementation:
Step 1: Set Up OMNeT++ and INET Framework
Step 2: Create a New OMNeT++ Project
Step 3: Define the Network Topology
Example:
network TORANetwork
{
submodules:
host[4]: StandardHost {
@display(“p=100,200;i=block/host”);
}
connections allowunconnected:
host[0].ethg++ <–> AdhocWirelessNic <–> host[1].ethg++;
host[1].ethg++ <–> AdhocWirelessNic <–> host[2].ethg++;
host[2].ethg++ <–> AdhocWirelessNic <–> host[3].ethg++;
host[3].ethg++ <–> AdhocWirelessNic <–> host[0].ethg++;
}
Step 4: Implement the TORA Routing Protocol
Since INET does not offer a ready-made execution of TORA, we need execute it from scratch. Here’s how we can approach it:
Example (in NED):
simple TORA
{
parameters:
@display(“i=block/routing”);
gates:
inout lowerLayerIn[];
inout lowerLayerOut[];
}
Example (C++ implementation):
#include “inet/common/INETDefs.h”
#include “inet/networklayer/contract/IRoutingTable.h”
#include “inet/networklayer/ipv4/IPv4RoutingTable.h”
#include “inet/networklayer/ipv4/IPv4Route.h”
#include “inet/networklayer/common/L3Address.h”
class TORA : public cSimpleModule
{
private:
IRoutingTable *inetRoutingTable;
std::map<L3Address, int> heights; // Heights for destinations
protected:
virtual void initialize() override;
virtual void handleMessage(cMessage *msg) override;
void createRoute(const L3Address& destAddr);
void maintainRoute(const L3Address& destAddr);
void eraseRoute(const L3Address& destAddr);
void forwardPacket(cPacket *packet, const L3Address& destAddr);
};
Define_Module(TORA);
void TORA::initialize() {
inetRoutingTable = getModuleFromPar<IRoutingTable>(par(“routingTableModule”), this);
// Initialize TORA-specific variables
}
void TORA::handleMessage(cMessage *msg) {
cPacket *packet = check_and_cast<cPacket *>(msg);
L3Address destAddr = packet->getContextPointer(); // Assuming the packet contains the destination address in its context
if (/* condition to check if route exists */) {
forwardPacket(packet, destAddr);
} else {
createRoute(destAddr);
forwardPacket(packet, destAddr);
}
}
void TORA::createRoute(const L3Address& destAddr) {
// Implement the route creation process in TORA
// Establish a directed acyclic graph (DAG) towards the destination
heights[destAddr] = 0; // Example: Set initial height
}
void TORA::maintainRoute(const L3Address& destAddr) {
// Implement the route maintenance process in TORA
// Adjust the DAG based on network topology changes
}
void TORA::eraseRoute(const L3Address& destAddr) {
// Implement the route erasure process in TORA
// Remove the DAG associated with the destination
heights.erase(destAddr);
}
void TORA::forwardPacket(cPacket *packet, const L3Address& destAddr) {
// Forward the packet towards the destination based on the current DAG
// Choose the neighbor with the smallest height that is lower than the current node’s height
int currentHeight = heights[inetRoutingTable->getRouterId()];
int nextHop = -1;
// Find the next hop
for (int i = 0; i < gateSize(“lowerLayerOut”); i++) {
int neighborHeight = /* get neighbor’s height */;
if (neighborHeight < currentHeight) {
nextHop = i;
break;
}
}
if (nextHop != -1) {
send(packet, “lowerLayerOut”, nextHop);
} else {
delete packet; // Drop the packet if no suitable next hop is found
}
}
Step 5: Set Up the Simulation
Example:
network = TORANetwork
sim-time-limit = 100s
**.scalar-recording = true
**.vector-recording = true
# Configure TORA routing protocol
**.host*.ipv4.routingTable.routingProtocol = “TORA”
Step 6: Run the Simulation
Step 7: Analyse the Results
Step 8: Refine and Optimize the Implementation
As we discussed earlier about how the TORA routing will perform in OMNeT++ simulator tool and we help to provide further information about how the TORA routing will adapt in diverse scenarios. You can get help with the Temporally Ordered Routing Algorithm in OMNeT++ from our developers. Just send us your project details, and we will provide guidance on topics and steps to execute.