OMNET++ Calculate hop count in UDPBasicBurst

879 views
Skip to first unread message

Carlos González Juárez

unread,
Feb 13, 2012, 6:59:31 AM2/13/12
to omnetpp
Hello,

I need to implement a hop count in UDPBasicBurst. I have seen is an
example Tictoc referring to this, but I can not deploy UDPBasicBurst.

I am doing a network AODV and using RWP how a pattern movement and
that is why I want to know the number of hops that the packets are to
reach the destination.

Has anyone ever done? Or know how to do?

Thank you very much,

Alfonso Ariza Quintana

unread,
Feb 13, 2012, 11:53:07 AM2/13/12
to omn...@googlegroups.com
you can't, UDPBasicBurst use UDP and the UDP packets don't transport
information about the number of hops. This information can be extracted from
the routing tables. If you really need this information it's a bit complex,
you need to open the application packets in the IPv4 module.

-----Mensaje original-----
From: Carlos González Juárez
Sent: Monday, February 13, 2012 12:59 PM
To: omnetpp
Subject: [Omnetpp-l] OMNET++ Calculate hop count in UDPBasicBurst

Hello,

Thank you very much,

--
Sent from the OMNeT++ mailing list. To configure your membership,
visit http://groups.google.com/group/omnetpp

Carlos González Juárez

unread,
Feb 15, 2012, 9:51:08 AM2/15/12
to omnetpp
Thank you for your advice. I managed to put the information about hop
count in an external file using the TTL in the ip.cc

On 13 feb, 17:53, Alfonso Ariza Quintana <aariza...@hotmail.com>
wrote:

Christian R

unread,
May 22, 2012, 5:24:08 AM5/22/12
to omn...@googlegroups.com


Alfonso Ariza Quintana wrote:
you can't, UDPBasicBurst use UDP and the UDP packets don't transport
information about the number of hops. This information can be extracted from
the routing tables. If you really need this information it's a bit complex,
you need to open the application packets in the IPv4 module.

Actually it may be possible to calculate the hop count in UDPBasicBurst. However, I am not sure if my solution is correct and would appreciate any comments on it as I sometimes experience some unexpeted results.

The UDP packets contain control information of type UDPDataIndication and UDPDataIndication inlcudes a field ttl_var. In UDPBasicBurst::processPacket() I did the following:

 cObject *ctrl = pk->getControlInfo();
 if (dynamic_cast<UDPDataIndication *>(ctrl)!=NULL) {
 UDPDataIndication *udpCtrl = (UDPDataIndication *)ctrl;
 short hopCnt = 32 - udpCtrl->getTtl(); // travelled hops of IP packet

Actually I don't know where the initial TTL is set but it seems to be always initialized with a value of 32. I ran some simple simulations with 2 and 3 node networks and the hop count seems to be basically correct.

However, there might be a problem:
In an other scenario, including 25 mobile nodes on a 400x300 area (transmission range about 100m). I used AODV, BATMAN, DYMO and OLSR as routing protocol. For all protocols the mean hop count is around 1,5. For DYMO and BATMAN the maximum hop count in all simulations is <=7, which seams very reasonable to me. However, for OLSR and BATMAN there are simulation runs where some packets have a maximum hop count of 25 up to 31. So the calculation of the hop count may be wrong (i.e., initial TTL is not always 32 or it is somehow re-initialized to another value along the path). Such high values could also be caused by routing loops produced by OLSR and BATMAN.

So I have two questions: Could anyone confirm the calculation shown above? Did anyone else experience routing loops in OLSR and BATMAN?

Greetings, Christian

Alfonso Ariza Quintana

unread,
May 22, 2012, 10:29:22 AM5/22/12
to omn...@googlegroups.com

it can work, by default is set to 32 in the file IPv4.ned

 

The proactive protocols can offer sometimes very strange results in very high congested network, I have done some test in a square network and some times, the route to connect to a neighbor node is across the rest of the network because the node has lost a hello message.

Shezi A

unread,
Jul 30, 2012, 11:01:02 AM7/30/12
to omn...@googlegroups.com
Dear Christian, 

I am using the INETMANET framework to perform PDR and latency analysis on multi hop routing protocols.
I tried to employ your way to calculate hop count. However, I am not able to find which header file corresponds to UDPDataIndication. Hence it gives me, "Type 'UDPDataIndication' could not be resolved" error.
Could you please shed some light on it..

Thanks in advance. 

Regards,
Shezi

Alfonso Ariza Quintana

unread,
Jul 31, 2012, 3:19:46 AM7/31/12
to omn...@googlegroups.com
 
transport/contract/UDPControlInfo.msg
 
but the TTL is set in the UDPDataIndication  control info yet.
--
Message has been deleted

Shaikha Al-Khuder

unread,
Jan 31, 2016, 2:02:22 PM1/31/16
to OMNeT++ Users
Thanks for the lines. Though I used WATCH() to see the value of the hopCounter, it's always 0...

Any Suggestions?

Alfonso Ariza Quintana

unread,
Feb 1, 2016, 4:21:17 AM2/1/16
to omn...@googlegroups.com

check the routing tables in the routingtable module, the cost of the route is the number of hops


Date: Sun, 31 Jan 2016 11:02:21 -0800
From: cpe....@gmail.com
To: omn...@googlegroups.com
Subject: Re: [Omnetpp-l] OMNET++ Calculate hop count in UDPBasicBurst
--
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.

Alfonso Ariza Quintana

unread,
Feb 1, 2016, 4:22:36 AM2/1/16
to omn...@googlegroups.com
this code is for inet 2, in inet 3 the controlInfo has changed


Date: Sun, 31 Jan 2016 10:49:06 -0800
From: cpe....@gmail.com
To: omn...@googlegroups.com
Subject: Re: [Omnetpp-l] OMNET++ Calculate hop count in UDPBasicBurst

I'm getting an error when I add the same lines you wrote.

Multiple markers at this line

- use of undeclared identifier 'ctrl'; did you mean 

'try'?

- 'cObject' does not refer to a value

- expected expression


Any suggestions?


On Tuesday, May 22, 2012 at 12:24:08 PM UTC+3, Christian R wrote:

Shaikha B.Al-Khuder

unread,
Feb 1, 2016, 7:16:24 AM2/1/16
to omn...@googlegroups.com
I'm sorry this was a silly mistake of mine.
I wrote a line before that I forgot to comment using (//).

Thank you for taking the time to read this,
Engr. Shaikha B.Al-Khuder
You received this message because you are subscribed to a topic in the Google Groups "OMNeT++ Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/omnetpp/iGT4fbAuYYk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to omnetpp+u...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages