To implement the Hybrid Wireless Mesh Protocol (HWMP) in OMNeT++ needs to accepting HWMP’s operation and forming a component that can put on its performance. This protocol is a routing protocol for wireless mesh networks, clear as slice of the IEEE 802.11s ordinary. Get in touch with us for project performance we provide you support in simulation part for your project. The following procedure is help to implementing HWMP in OMNeT++ by using the INET framework.
Step-by-Step Implementation:
Step 1: Set Up OMNeT++ and INET Framework
Step 2: Understand HWMP Protocol
HWMP chains on-demand and proactive routing fundamentals:
Step 3: Create the HWMP Protocol Module
Define the Module in .ned File
To make a .ned file for the HWMP protocol module.
simple HWMP
{
parameters:
@display(“i=block/cogwheel”);
double proactiveInterval @unit(s) = default(5s); // Interval for proactive PREQ messages
gates:
input fromNetworkLayer;
output toNetworkLayer;
input fromMacLayer;
output toMacLayer;
}
Implement the Module in C++
To form the corresponding .cc and .h files.
HWMP.h
#ifndef __HWMP_H_
#define __HWMP_H_
#include <omnetpp.h>
#include “inet/networklayer/contract/IRoutingTable.h”
#include “inet/common/INETDefs.h”
#include “inet/networklayer/common/L3AddressResolver.h”
#include <map>
#include <set>
using namespace omnetpp;
using namespace inet;
class HWMP : public cSimpleModule
{
private:
double proactiveInterval;
IRoutingTable *routingTable;
cMessage *proactiveMsg;
std::map<L3Address, L3Address> routeTable; // Maps destination to next hop
std::map<L3Address, int> metricTable; // Stores path metrics
protected:
virtual void initialize() override;
virtual void handleMessage(cMessage *msg) override;
void sendProactivePREQ();
void processProactivePREQ(cMessage *msg);
void sendRREQ(L3Address destAddr);
void processRREQ(cMessage *msg);
void sendRREP(L3Address destAddr);
void processRREP(cMessage *msg);
void processRERR(cMessage *msg);
public:
HWMP();
virtual ~HWMP();
};
#endif
HWMP.cc
#include “HWMP.h”
Define_Module(HWMP);
HWMP::HWMP()
{
proactiveMsg = nullptr;
}
HWMP::~HWMP()
{
cancelAndDelete(proactiveMsg);
}
void HWMP::initialize()
{
proactiveInterval = par(“proactiveInterval”);
routingTable = getModuleFromPar<IRoutingTable>(par(“routingTableModule”), this);
proactiveMsg = new cMessage(“sendProactivePREQ”);
scheduleAt(simTime() + proactiveInterval, proactiveMsg);
}
void HWMP::handleMessage(cMessage *msg)
{
if (msg == proactiveMsg)
{
sendProactivePREQ();
scheduleAt(simTime() + proactiveInterval, proactiveMsg);
}
else if (strcmp(msg->getName(), “ProactivePREQ”) == 0)
{
processProactivePREQ(msg);
}
else if (strcmp(msg->getName(), “RREQ”) == 0)
{
processRREQ(msg);
}
else if (strcmp(msg->getName(), “RREP”) == 0)
{
processRREP(msg);
}
else if (strcmp(msg->getName(), “RERR”) == 0)
{
processRERR(msg);
}
else if (dynamic_cast<cPacket *>(msg))
{
// Handle incoming data packets
L3Address dest = L3AddressResolver().resolve(msg->par(“destAddr”).stringValue());
if (routeTable.find(dest) != routeTable.end())
{
// Forward the packet to the next hop
send(msg, “toMacLayer”);
}
else
{
// Drop the packet if no route found
delete msg;
}
}
else
{
// Handle other messages
}
}
void HWMP::sendProactivePREQ()
{
cMessage *preq = new cMessage(“ProactivePREQ”);
send(preq, “toMacLayer”);
}
void HWMP::processProactivePREQ(cMessage *msg)
{
// Process received proactive PREQ message
delete msg;
}
void HWMP::sendRREQ(L3Address destAddr)
{
cMessage *rreq = new cMessage(“RREQ”);
rreq->addPar(“destAddr”) = destAddr.str().c_str();
send(rreq, “toMacLayer”);
}
void HWMP::processRREQ(cMessage *msg)
{
// Implement processing of RREQ message
L3Address srcAddr = L3AddressResolver().resolve(msg->par(“srcAddr”).stringValue());
L3Address destAddr = L3AddressResolver().resolve(msg->par(“destAddr”).stringValue());
if (routeTable.find(destAddr) != routeTable.end())
{
sendRREP(destAddr);
}
else
{
// Forward the RREQ
send(msg, “toMacLayer”);
}
}
void HWMP::sendRREP(L3Address destAddr)
{
cMessage *rrep = new cMessage(“RREP”);
rrep->addPar(“destAddr”) = destAddr.str().c_str();
send(rrep, “toMacLayer”);
}
void HWMP::processRREP(cMessage *msg)
{
// Implement processing of RREP message
L3Address destAddr = L3AddressResolver().resolve(msg->par(“destAddr”).stringValue());
L3Address nextHop = L3AddressResolver().resolve(msg->par(“nextHop”).stringValue());
int metric = msg->par(“metric”).intValue();
routeTable[destAddr] = nextHop;
metricTable[destAddr] = metric;
delete msg;
}
void HWMP::processRERR(cMessage *msg)
{
// Implement processing of RERR message
L3Address destAddr = L3AddressResolver().resolve(msg->par(“destAddr”).stringValue());
routeTable.erase(destAddr);
metricTable.erase(destAddr);
delete msg;
}
Step 4: Integrate with Simulation Model
Integrate the HWMP module into a network simulation model.
Network Configuration .ned File
network HWMPNetwork
{
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 = HWMPNetwork
*.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 = “HWMP”
Step 5: Test and Debug
Finally, we have provided the step-by-step procedure to execute the HWMP protocol and understand how it forward the packets using this protocol and INET framework in the OMNeT++.