[ns] Mac - Link layer
vsantu88 at gmail.com
Sat Jul 18 22:00:52 PDT 2009
> Thanks for the reply. That raises an other Question. Once the node, say
> node_(0), parameters are declared using node-config, how to get the
> objects/handles for Phy, Channel, Mac, etc., so that we can enter into
> WirelessPhy::command using the node_(0)'s handles.
Handles for Phy, Mac are already defined once the node is configured using
node-config and declared with "$ns Node_(0) [new node]". We just have to
bring them to local scope. To get the handle for Phy, say for Node_(0), once
the node is defined, do:
set Netif_0 [$Node_(0) set netif_(0)]
Note that the variable netif_ is a array and hence we use "netif_(0)" to get
the handle for the first Network Interface. "netif_(1)" and "netif(2)" ..
can be similarly used for Second and Third Network Interfaces, if the node
was configured with multiple interfaces. To get the handle for
Similarly, the handles for Mac, Interface Queue can be gotten from
set Mac_0 [$Node_(0) set mac_(0)]
set Ifq_0 [$Node_(0) ifq_(0)]
Like netif_, mac_ and ifq_ are also arrays facilitating multiple interfaces.
Once the handles are brought to local scope, we can use any command that is
defined in their respective source files, like for WirelessPhy we can use
"$Netif_0 NodeOff" to switch off the node to deactivate the Network
Look in the procedure "Node/MobileNode instproc add-interface" in the file
ns-mobilenode.tcl for the definitions of netif_ , mac_ , ifq_ and more.
More information about the Ns-users