Problem in retransmitting the data packet at routing protocol

69 views
Skip to first unread message

Naveen Kumar Gupta

unread,
May 12, 2018, 1:52:36 AM5/12/18
to OMNeT++ Users
Hello All,
               I am working on a wireless routing protocol. I have created a Queue at every node. In this queue, every node kept packet which it already transmitted. If packet is not transmitted by nexthop then previous node will retransmit the packet after timeout. The problem is that when node is trying to retransmitt the packet by calling postRotingHook in handle function to retransmit then it is not doing anything. This postRoutingHook is created locally so it is not actually sending the packet. So how to connect this packet with network for retransmission?

Example: Suppose We have 3 nodes A, B and C. A is source, B is intermediate and C is destination. Node A sent a packet initially. Now node B will forward it to node C. At this time node A will overhear this packet and it will cancel the timer and delete this packet from its Queue. (in normal condition)

suppose node B could not forward the packet because of some reason then node A should retransmit the packet after time out. I am unable to achieve this functionality.

My Programming scenario is:
I have modified GPSR protocol. Where header file have definition of these 5 INetfilterHooks methods. I didn't use any control packet e.g. request, response, beacon etc. I am directly dealing with data packet which contains some control information. I have implemented my logic in datagramPreRoutingHook() method (when data is received from lower layer) and  datagramLocalOutHook() method (when data is received from upper layer).

  source node(at network layer) rceives packet from upper layer at IPv4.cc using handlePacketFromHL() ->datagramLocalOutHook(datagram, destIE, nextHopAddr) == INetfilter::IHook::ACCEPT) when it calls datagramLocalOutHook(datagram, destIE, nextHopAddr) then control goes to my routing protocol. It makes necessary changes, Adds source, destination address, creates options and keeps the packet in Queue (for retransmission by scheduling timer) then return ACCEP. Then control again goes to IPv4.cc.

After this process, if time out occurs at my protocol then I am unable to send packet to IPv4.cc. I called postRoutingHook to retransmit the packet then it simly return ACCEPT (as defined in header file) and does nothing. I have tried to call some methods of IPv4.cc by making object of IPv4 in my protocol but these methods are protected so I couldn't access these methods.
I tried with making some public methods of IPv4.cc but it is giving error at further stage.
I have tried to make the object of INetfilter::IHook for calling its postRoutingHook() but is also providing error as object of abstract class can not be created.

Please Help,
Thanks

Ishu Sharma

unread,
May 12, 2018, 2:26:59 AM5/12/18
to OMNeT++ Users
Hi...

One module of my thesis work includes the same work/scenario as mentioned by you. Can you guide me about storing multiple paths in the routing table for the same destination?

Regards
Ishu

Alfonso Ariza Quintana

unread,
May 14, 2018, 3:53:40 AM5/14/18
to omn...@googlegroups.com

Usually, you need to register the hook. Have you checked that the post routing hook is registered in the IP module?

--
You received this message because you are subscribed to the Google Groups "OMNeT++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to omnetpp+u...@googlegroups.com.
Visit this group at https://groups.google.com/group/omnetpp.
For more options, visit https://groups.google.com/d/optout.

Naveen Kumar Gupta

unread,
May 14, 2018, 10:19:09 AM5/14/18
to OMNeT++ Users
Thanks for your reply.

I have already register the hook by including in my protocol.

        string networkProtocolModule = default("^.networkLayer.ip");  // It is defined in my ned file

       these two line in initialization function of initialization function of my protocol (similar to GPSR)
        networkProtocol = getModuleFromPar<INetfilter>(par("networkProtocolModule"), this);
        networkProtocol->registerHook(0, this);
But it is not working.

I have solved this retransmission problem in another way:
1. Declare a function    virtual void retransmitDatagram(INetworkDatagram *datagram, const InterfaceEntry *outIE, L3Address& nextHopAddr) = 0;
 in /networklayer/contract/inetfilter.h
2. Defined the function virtual void retransmitDatagram(INetworkDatagram *datagram, const InterfaceEntry *outIE, L3Address& nextHopAddr) override;
in /networklayer/generic/GenericNetworkprotocol.h, /networklayer/IPv4/IPv4.h and /networklayer/ipv6/ipv6.h
3. Given the proper body of funvtion in Ipv4.cc
void IPv4::retransmitDatagram(INetworkDatagram *datagram, const InterfaceEntry *outIE, L3Address& nextHopAddr) 
{
    Enter_Method("retransmitDatagram()");
fragmentAndSend(dynamic_cast<IPv4Datagram *>(datagram)->dup(), outIE, nextHopAddr.toIPv4());
return;
}

4. called this method from my protocol after time expiration using networkProtocol->retransmitDatagram(pos->pkt, outputInterfaceEntry, nextHop);

Now it is working.

P.S. 
Is this solution correct or not? Please comment on my solution. or advise me some other solution

Thanks,

Alfonso Ariza Quintana

unread,
May 14, 2018, 11:15:51 AM5/14/18
to omn...@googlegroups.com

You have registered the hook like prerouting (0 is prerouting).

 

If you want post routing

 

networkProtocol->registerHook(INetfilter:: IHook:: POSTROUTING, this);

 

Enviado desde Correo para Windows 10

 


Naveen Kumar Gupta

unread,
May 14, 2018, 11:03:48 PM5/14/18
to OMNeT++ Users
Thank you Alfonso Ariza Quintana.

To unsubscribe from this group and stop receiving emails from it, send an email to omnetpp+unsubscribe@googlegroups.com.
Visit this group at
https://groups.google.com/group/omnetpp.
For more options, visit
https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages