[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ns] node_ base Agent class
Hi everyone!
I am fairly new to the C++/OTcl linkage part of ns and I am trying to get a full
grip on part VII in the turorial (A new protoco for ns). Here are two things
that I don't fully get.
Agent/Ping instproc recv {from rtt} {
$self instvar node_
puts "node [$node_ id] received ping answer from \
$from with round-trip-time $rtt ms."
}
Where does the instance variable node_ come from? In the tutorial it says that
it is a member variable of the base class for Agent. I can't find a reference to
it in any of the code. I have checked many source files, including Agent.cc and
Agent.c. Do anyone have any ideas?
Here is another part that troubles me:
sprintf(out, "%s recv %d %3.1f", name(),
hdrip->src_.addr_ >> Address::instance().NodeShift_[1],
(Scheduler::instance().clock()-hdr->send_time) * 1000);
What is the method name()? It clearly should be a metod which executes the recv
proc mentioned above. But how does it operate?
Also, what is the Address::instance stuff doing? Some sort conversion from
internal node source address to an tcl address?
I would really appreciate your help,
/Anders