Calls to functions in the classes present in the model folder

51 views
Skip to first unread message

Nitya Kulkarni

unread,
Oct 18, 2014, 2:05:48 PM10/18/14
to ns-3-...@googlegroups.com
Hello!
I wanted to know where are the function calls specified for the functions defined in classes of model folder in ns3 ... 
I am currently working on implementation of ETX metric for HWMP (mesh module). So I am not getting where are the function calls for HwmpProtocol.cc..

Thank You.

Tommaso Pecorella

unread,
Oct 19, 2014, 11:31:46 AM10/19/14
to ns-3-...@googlegroups.com
Hi,

I'm sorry but I can't understand. The functions declaration is in the .h, the definition is in the .cc... like for any C++ program.
Some functions may be declared as pure virtual, and then it's the subclass to define them. But again, also this is normal C++ behaviour.
What is your specific issue ?

Cheers,

T.

Nitya Kulkarni

unread,
Oct 19, 2014, 12:15:22 PM10/19/14
to ns-3-...@googlegroups.com

Ya... where are those functions called? Say for example there is a function defined in hwmpProtocol.cc named ReceivePreq . So where is it called? How that particular function gets executed or gets invoked?

--
You received this message because you are subscribed to a topic in the Google Groups "ns-3-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ns-3-users/CEqJcSiU_Es/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ns-3-users+...@googlegroups.com.
To post to this group, send email to ns-3-...@googlegroups.com.
Visit this group at http://groups.google.com/group/ns-3-users.
For more options, visit https://groups.google.com/d/optout.

Tommaso Pecorella

unread,
Oct 20, 2014, 2:08:08 AM10/20/14
to ns-3-...@googlegroups.com
May I suggest to use a modern editor like Eclipse, NetBeans or, at least, stuff like VIM with proper extensions ? That would definitely help. They all have nice functions to find where a function is called.
Alternatively, use grep.

Happy hunting,

T.

Nitya Kulkarni

unread,
Oct 20, 2014, 9:47:17 PM10/20/14
to ns-3-...@googlegroups.com
Ok Thank you... :)

pdbarnes

unread,
Jan 29, 2015, 5:09:56 PM1/29/15
to ns-3-...@googlegroups.com
On Sunday, October 19, 2014 at 9:15:22 AM UTC-7, Nitya Kulkarni wrote:

Say for example there is a function defined in hwmpProtocol.cc named ReceivePreq . So where is it called? How that particular function gets executed or gets invoked?

Hello Nitya,

In addition to Tommaso's suggestions (modern editor or IDE), for many functions you can just use the Doxygen API documentation.  At the bottom of most function description are a couple of items to look at (this is a snippet from HwmpProtocol::PeerLinkStatus):

References ns3::dot11s::HwmpRtable::GetUnreachableDestinations()InitiatePathError()m_rtable, and MakePathError().

Referenced by ns3::Dot11sStack::InstallStack().

 Here is the call graph for this function:

 Here is the caller graph for this function:


The "References…" list and "Here is the call graph..." show similar information:  what this function uses in its implementation.

The "Referenced by…" list and "Here is the caller graph…" also show similar information:  who calls this function.

In both cases the list shows only direct calls/callers; the graph typically shows a greater depth than the list.

You asked specifically how the function gets called, so you want to look at the caller list/graph.  In some cases Doxygen can't figure that out, so lists nothing.  (It could be called only as a ns3::Callback, so the symbol doesn't appear explicitly at the call site in the code.)  ReceivePreq is one of these cases.  

Another approach that can help especially in these cases is using an emacs tags file, which you can read more about on the emacs wiki and in the emacs manual.  You probably don't want to add the entire repo directory tree to the tags file, because you'll get a lot of uninteresting hits from the build, bindings and doc directories.  I have a shell function retag which essentially does this:

local srcs="examples scratch src utils";
find $srcs -name "*.h" -o -name "*.cc" | xargs etags -a;

Hopefully some of these resources will be helpful.

Sorry to be following up so long after your original post.
Peter


 

Nitya Kulkarni

unread,
Jan 29, 2015, 9:52:29 PM1/29/15
to ns-3-...@googlegroups.com

Thank you for your suggestions. I will look into them.

--

Samet Tonyalı

unread,
Nov 13, 2016, 11:25:30 PM11/13/16
to ns-3-users
Hi Nitya,

I need to use ETX metric in HWMP as you needed two years ago. Were you able to implement it? I really appreciate it if you help me about this.

Thank you in advance,
Samet
Reply all
Reply to author
Forward
0 new messages