To implement the Fisheye State Routing (FSR) protocol in OMNeT++ encompasses more than a few steps. FSR is an active sending protocol for mobile ad hoc networks (MANETs) that decreases the upstairs of continuing latest routing information by using unalike inform occurrences dependent on the reserve to the terminus.
The following stages is to implement FSR in OMNeT++ by using the INET framework.
Step-by-Step Implementations:
Step 1: Set Up OMNeT++ and INET Framework
Step 2: Understand FSR Protocol
FSR is decreases control upstairs by maintaining accurate information nearby nearby nodes and gradually less accurate information about past nodes. Important features of FSR include:
Step 3: Create the FSR Protocol Module
Define the Module in .ned File
To make a .ned file for the FSR protocol module.
simple FSR
{
parameters:
@display(“i=block/cogwheel”);
double updateInterval @unit(s) = default(1s);
int scopeLevels = default(3); // Number of scope levels
gates:
input fromNetworkLayer;
output toNetworkLayer;
input fromMacLayer;
output toMacLayer;
}
Implement the Module in C++
To build the corresponding .cc and .h files.
FSR.h
#ifndef __FSR_H_
#define __FSR_H_
#include <omnetpp.h>
#include “inet/networklayer/contract/IRoutingTable.h”
#include “inet/networklayer/common/L3AddressResolver.h”
#include “inet/networklayer/ipv4/IPv4Datagram.h”
#include <map>
#include <vector>
using namespace omnetpp;
using namespace inet;
class FSR : public cSimpleModule
{
private:
double updateInterval;
int scopeLevels;
IRoutingTable *routingTable;
cMessage *updateMsg;
std::map<L3Address, std::map<int, std::vector<L3Address>>> neighborTable; // Stores neighbors by scope level
protected:
virtual void initialize() override;
virtual void handleMessage(cMessage *msg) override;
void sendPeriodicUpdate();
void processUpdate(cMessage *msg);
void updateRoutingTable();
public:
FSR();
virtual ~FSR();
};
#endif
FSR.cc
#include “FSR.h”
Define_Module(FSR);
FSR::FSR()
{
updateMsg = nullptr;
}
FSR::~FSR()
{
cancelAndDelete(updateMsg);
}
void FSR::initialize()
{
updateInterval = par(“updateInterval”);
scopeLevels = par(“scopeLevels”);
routingTable = getModuleFromPar<IRoutingTable>(par(“routingTableModule”), this);
updateMsg = new cMessage(“sendPeriodicUpdate”);
scheduleAt(simTime() + updateInterval, updateMsg);
}
void FSR::handleMessage(cMessage *msg)
{
if (msg == updateMsg)
{
sendPeriodicUpdate();
scheduleAt(simTime() + updateInterval, updateMsg);
}
else if (strcmp(msg->getName(), “Update”) == 0)
{
processUpdate(msg);
}
else if (dynamic_cast<cPacket *>(msg))
{
// Handle incoming data packets if necessary
}
else
{
// Handle other messages
}
}
void FSR::sendPeriodicUpdate()
{
for (int scope = 1; scope <= scopeLevels; ++scope)
{
cMessage *update = new cMessage(“Update”);
update->addPar(“scope”) = scope;
// Add neighbor information to the update message
// (e.g., L3Address of neighbors within the current scope)
for (const auto &entry : neighborTable)
{
for (const auto &neighbor : entry.second[scope])
{
update->addPar(neighbor.str().c_str());
}
}
send(update, “toMacLayer”);
}
}
void FSR::processUpdate(cMessage *msg)
{
// Process received update message
int scope = msg->par(“scope”).intValue();
for (int i = 1; i < msg->getParList().size(); ++i)
{
L3Address neighbor = L3AddressResolver().resolve(msg->par(i).stringValue());
neighborTable[neighbor][scope].push_back(neighbor);
}
updateRoutingTable();
delete msg;
}
void FSR::updateRoutingTable()
{
// Update the routing table based on the neighbor information
for (const auto &entry : neighborTable)
{
for (const auto &scopeEntry : entry.second)
{
for (const auto &neighbor : scopeEntry.second)
{
// Update routing table logic
}
}
}
}
Step 4: Integrate with Simulation Model
Join in the FSR module into a network simulation model.
Network Configuration .ned File
network FSRNetwork
{
submodules:
node1: StandardHost {
parameters:
@display(“p=100,100”);
}
node2: StandardHost {
parameters:
@display(“p=300,100”);
}
// Add more nodes as needed
connections:
node1.pppg++ <–> { @display(“m=100,100”); } <–> node2.pppg++;
}
omnetpp.ini Configuration
[General]
network = FSRNetwork
*.node*.pppg[*].queue.typename = “DropTailQueue”
*.node*.ipv4.routingTable = “inet.networklayer.routing.manet.Router”
*.node*.networkLayer.networkProtocol.typename = “IPv4NetworkLayer”
*.node*.transportLayer.tcp.typename = “Tcp”
*.node*.transportLayer.udp.typename = “Udp”
*.node*.application[*].typename = “UdpBasicApp”
*.node*.application[*].destAddresses = “node1” // Set destination as needed
*.node*.application[*].destPort = 2000
*.node*.application[*].startTime = uniform(0s, 10s)
*.node*.application[*].sendInterval = uniform(1s, 2s)
*.node*.application[*].packetLength = 512B
*.node*.app[0].typename = “FSR”
Step 5: Test and Debug
We learn how to implement Fisheye Protocol in OMNeT++ we hope that this detail is more helpful for implementations.
Implementation and simulation of fisheye protocol in OMNeT++ tool are aided by us. We work on all protocol for mobile ad hoc networks (MANETs) so get simulation results from us.