Omnet Dsr Code

Omnet Dsr Code (Dynamic source routing) protocol is also a simple and efficient routing protocol. DSR omnet code allows network model completely to be self organizing and also self-configuring, without any predefined infrastructure.

Architecture of DSR routing protocol:
Architecture of DSR routing protocol:

Characteristics of DSR routing protocol:

  • With the optimization available it’s also a good choice for an ad hoc network.
  • Uses source routing.
  • Provides loop-free routes.
  • Supports unidirectional links and also asymmetric routes.
  • DSR protocol method also used in manet projects.
  • Route replay message also from another host process.

Advantages of DSR routing protocol:

  • Guaranteed loop free routing
  • Nodes can able also to store multiple paths to destination
  • Support also for use in networks containing unidirectional links
  • Use of only “soft state” routing
  • Rapid discovery when routes also in network change etc.

Sample Output Video of program using Omnet++ DSR Code.

Sample Dynamic source Routing Protocol using Omnet++

void DSRPkt::getCostVector(EtxCost &cost, int &size) 
{    if (size<=0 || costVectorSize==0)
    {        size = 0;
        return;    }
    if ((unsigned int) size>costVectorSize)
    {        memcpy(&cost, costVector, sizeof(EtxCost)*costVectorSize);
        size = costVectorSize;
    }    else
    {
        memcpy(&cost, costVector, sizeof(EtxCost)*size);
    }}
void DSRPkt::setCostVector(EtxCost &cost, int size)
{    if (costVectorSize>0)
    {        setBitLength(getBitLength()-(costVectorSize*SIZE_COST_BITS));
        delete [] costVector;
        costVector = NULL;
        costVectorSize = 0;
    }    if (size>0)
    {
        costVector = new EtxCost[size];
        costVectorSize = size;
        memcpy(costVector, &cost, sizeof(EtxCost)*size);
        setBitLength(getBitLength()+(costVectorSize*SIZE_COST_BITS));
    }}