[ns] How to access mac layer in c++ of ns2

Daniel Dekst dolkoff at yahoo.com.cn
Thu Oct 16 06:17:08 PDT 2008


Hi,
   
  Thanks a lot. I recall this. But I never use it because I don't know who is the uptarget_ of who. Using debug, it seems every leayer will go to trace so I wonder whether uptarget_ of mac is trace or link.  Do you have any experience ? So we only need to follow the structure of Chapter 16, is that right?
   
  Best,
  Pei

ÀîÒµ <leeyee.seu at gmail.com> дµÀ£º
  Hi,

When you created a node in otcl, mac layer and other components are
fixed together(both in otcl and C++). If you want to access MAC layer
in C++, you simply use a pointer uptarget_* or downtarget_* in the
layer where you want to do this. For example you want to do this in
PHY layer, you just:
uptarget_->xxxx

You may want to refer to the overview diagram provided in NS manual
chapter 16. I'm new to NS, hope this helps!

2008/10/16 Daniel Dekst :
>
>
> Hi, everyone,
>
> I know how to access physical layer since Class Node provides a variable ifhead_ for list of phys.
> So
> WirelessPhy* physicalLayer = (WirelessPhy*)(node_->ifhead()).lh_first;
> works.
>
> But it does not provide list of mac, thus can I access mac layer similar as above?
> I know tcl may work by calling mac layer and then again use tcl to return the desired value, but is there any method to access it directly using c++?
>
> Best,
> Pei
>
> Pei Huang, Ph.D. student
> Dept. of Computer Science and Engineering
> Michigan State University
> http://dekst.awardspace.com
>
>



-- 
Best regards,
Li Ye


       
---------------------------------
 ÑÅ»¢ÓÊÏ䣬ÄúµÄÖÕÉúÓÊÏ䣡


More information about the Ns-users mailing list