To implement the Temporally-Ordered Routing Algorithm (TORA) in OMNeT++ has numerous steps that contains to setup a simulation then familiarize the TORA protocol and it generate the protocol modules then incorporate them with the INET framework, and validate the implementation.
Here is the detailed procedure to implement through this process;
Step-by-Step Implementation:
Step 1: Set Up OMNeT++ and INET Framework
Step 2: Understand TORA Protocol
TORA is a distributed routing protocol planned for mobile ad hoc networks (MANETs). A Key concept includes:
Step 3: Create the TORA Protocol Module
Define the Module in .ned File
Create a .ned file for the TORA protocol module.
ned
simple TORA
{
parameters:
double helloInterval @unit(s) = default(1s);
double routeTimeout @unit(s) = default(30s);
gates:
input fromNetworkLayer;
output toNetworkLayer;
input fromMacLayer;
output toMacLayer;
}
Implement the Module in C++
Create the corresponding .cc and .h files.
TORA.h
#ifndef __TORA_H_
#define __TORA_H_
#include <omnetpp.h>
#include “inet/networklayer/contract/IRoutingTable.h”
#include “inet/networklayer/common/L3AddressResolver.h”
#include “inet/networklayer/ipv4/IPv4Datagram.h”
#include <map>
using namespace omnetpp;
using namespace inet;
class TORA : public cSimpleModule
{
private:
double helloInterval;
double routeTimeout;
IRoutingTable *routingTable;
cMessage *helloMsg;
cMessage *routeTimeoutMsg;
std::map<L3Address, double> height; // Height metric for TORA
std::map<L3Address, L3Address> routes; // Routing table
protected:
virtual void initialize() override;
virtual void handleMessage(cMessage *msg) override;
void sendHello();
void processHello(cMessage *msg);
void sendRouteRequest();
void processRouteRequest(cMessage *msg);
void sendRouteUpdate();
void processRouteUpdate(cMessage *msg);
void sendRouteClear();
void processRouteClear(cMessage *msg);
public:
TORA();
virtual ~TORA();
};
#endif
TORA.cc
#include “TORA.h”
Define_Module(TORA);
TORA::TORA()
{
helloMsg = nullptr;
routeTimeoutMsg = nullptr;
}
TORA::~TORA()
{
cancelAndDelete(helloMsg);
cancelAndDelete(routeTimeoutMsg);
}
void TORA::initialize()
{
helloInterval = par(“helloInterval”);
routeTimeout = par(“routeTimeout”);
routingTable = getModuleFromPar<IRoutingTable>(par(“routingTableModule”), this);
helloMsg = new cMessage(“sendHello”);
routeTimeoutMsg = new cMessage(“routeTimeout”);
scheduleAt(simTime() + helloInterval, helloMsg);
scheduleAt(simTime() + routeTimeout, routeTimeoutMsg);
}
void TORA::handleMessage(cMessage *msg)
{
if (msg == helloMsg)
{
sendHello();
scheduleAt(simTime() + helloInterval, helloMsg);
}
else if (msg == routeTimeoutMsg)
{
sendRouteClear();
scheduleAt(simTime() + routeTimeout, routeTimeoutMsg);
}
else if (strcmp(msg->getName(), “RouteRequest”) == 0)
{
processRouteRequest(msg);
}
else if (strcmp(msg->getName(), “RouteUpdate”) == 0)
{
processRouteUpdate(msg);
}
else if (strcmp(msg->getName(), “RouteClear”) == 0)
{
processRouteClear(msg);
}
else if (strcmp(msg->getName(), “Hello”) == 0)
{
processHello(msg);
}
else
{
// Handle other messages
}
}
void TORA::sendHello()
{
cMessage *hello = new cMessage(“Hello”);
send(hello, “toNetworkLayer”);
}
void TORA::processHello(cMessage *msg)
{
// Implement processing of Hello message
delete msg;
}
void TORA::sendRouteRequest()
{
cMessage *routeRequest = new cMessage(“RouteRequest”);
// Implement Route Request details and send
send(routeRequest, “toNetworkLayer”);
}
void TORA::processRouteRequest(cMessage *msg)
{
// Implement processing of Route Request message
delete msg;
}
void TORA::sendRouteUpdate()
{
cMessage *routeUpdate = new cMessage(“RouteUpdate”);
// Implement Route Update details and send
send(routeUpdate, “toNetworkLayer”);
}
void TORA::processRouteUpdate(cMessage *msg)
{
// Implement processing of Route Update message
delete msg;
}
void TORA::sendRouteClear()
{
cMessage *routeClear = new cMessage(“RouteClear”);
// Implement Route Clear details and send
send(routeClear, “toNetworkLayer”);
}
void TORA::processRouteClear(cMessage *msg)
{
// Implement processing of Route Clear message
delete msg;
}
Step 4: Integrate with Simulation Model
Incorporate with TORA module inside a network simulation model.
Network Configuration .ned File
network TORANetwork
{
submodules:
host1: StandardHost {
parameters:
@display(“p=100,100”);
}
host2: StandardHost {
parameters:
@display(“p=300,100”);
}
// Add more hosts as needed
connections:
host1.pppg++ <–> { @display(“m=100,100”); } <–> host2.pppg++;
}
omnetpp.ini Configuration
network = TORANetwork
*.host*.pppg[*].queue.typename = “DropTailQueue”
*.host*.ipv4.routingTable = “inet.networklayer.routing.manet.Router”
*.host*.networkLayer.networkProtocol.typename = “IPv4NetworkLayer”
*.host*.transportLayer.tcp.typename = “Tcp”
*.host*.transportLayer.udp.typename = “Udp”
*.host*.application[*].typename = “UdpBasicApp”
*.host*.application[*].destAddresses = “host1” // Set destination as needed
*.host*.application[*].destPort = 2000
*.host*.application[*].startTime = uniform(0s, 10s)
*.host*.application[*].sendInterval = uniform(1s, 2s)
*.host*.application[*].packetLength = 512B
*.host*.app[0].typename = “TORA”
Step 5: Test and Debug
In the above setup are the complete procedures to how to setup the simulation and how to execute the TPRA protocol in OMNET++ simulator. We plan to elaborate additional information about how the TORA protocol will perform in other simulation tool.
We work on all TORA protocol and it generate the protocol modules as per your reasech work, so get best project ideas and simulation results from us.