Frequently Asked Questions.

 

Question 1) How can I debug C++ code in ns?
Answer) You can use gdb to debug c++ code. Type "gdb ns" to initiate debugger. Set break points at the place where you want to debug and run tcl by typing "run your_tcl_file" in gdb mode. Please make sure that you recompile your c++ code with -g option. Otherwise you won't see any symbol in gdb. Just put "-g" next to "CCOPT = -g" and recompile. gdb is already installed on most computers.

Question 2) How can I debug Tcl code in ns then?
Answer) You have to install Tcl debugger first. For this, see Question3). After installation, you can put "debug 1" in your tcl code to make ns stop on the point. Then you will see gdb-like interaction. You can use "n" for next, "s" for step into.. and so on.. Please refer to Tcl debugger manual for more information.

Question 3) Show me how to install Tck debugger.
Answer) First download debugger, Install the program in a directory parallel to ns-2. Unlike expect, described in the tcl-debug documentation, it does not support the -D flag. To enter the debugger, add the lines "debug 1" to your script at the appropriate location. Then change your Makefile in C++ directory to include it as following.

add "-DHAVE_LIBTCLDBG" to DEFINE
add "-Ipath_to_your_tcl_debugger_directory" to INCLUDES
add "-Lpath_to_your_tcl_debugger_directory -ltcldbg" to LIB

Then remove tclAppInit.o file from your directory and recompile it.

Question 4) I haven't figure out how I am suposed to use all that in the implementation of the Home and foreign agents with the tunneling to make MIP work with CIP. Can you give us some hints or something?
Answer) Look at the procedure "attach-encap" and "attach-decap" in lib/ns-wireless-mip.tcl. You need to modify this procedure to use for CIP code since CIP code use flat routing and these procedure are based on hierarchical routing scheme.
You should understand how this agent is installed with Classifier so that the incoming packet can be delivered to your agent. Basically when you call "install" with agent you created in Tcl, this call is handled by c++ command function in classifier.cc to create routing table.Please look at the manual for detail information.
The mip.cc file is corresponding c++ code for encapsulator and decapsulator.

Question 5) How about Agent Advertisement Message?. Where can I find example of it?
Answer) Look at the code where "Agent/MIPBS" is created in lib/ns-wireless-mip.tcl. This module keeps sending out advertisement message to mobile host. Corresponding c++ code is mip-reg.cc.

Question 6) We used cipInit.tcl for the midterm simulation(Cellular IP). What should we use as a source code for Mobile IP simulation?
Answer) Same code(cipInit.tcl)

Question 7) Can we use cip-sample.tcl as the basis to create wireless access network or should we use wireless3.tcl(which does not work for some reason)? You referred us to some c++ files, should we just look at them and understand it or write some new functions and procedures? What kind of programming is required for this project: c++ ,tcl or both
Answer) wireless3.tcl is just reference for your project. It is better to build MIP functionality on top of CIP code(cipInit.tcl and cip-sample.tcl). I believe that you need to modify the example source code(C++, Tcl) of MIP to use with CIP.

Question 8) I am trying to get the MIP model to work with a flat address space and I can't seem to get it to work. It looks like the attach-encap and attach-decap code in the ns-wireless-mip.tcl already support flat routing because there is a check "if [Simulator set EnableHierRt] {" that uses the node mask and node shift if it is not hierarchical addressing.
Answer) If you try to change routing scheme of MIP to flat routing to test MIP, it doesn't work even if there is some code checking whether it is flat routing scheme. MIP supports only hierarchical routing scheme. What I mean by "change" in Question 4 is that you need to take this code and modify the some value such as mask shift, port, target of encapsulator and decapsultor to plug in CIP classifier.

Question 9).How do we make a node know that it is a HA or FA? In wireless3.tcl, the node is configured with the -mobileIP flag ON to activate the mobile IP related functions, so when you do a "set HA ..." or "set FA ..." it is easy to configure a node to be a HA or a FA. However, in the CIP code, we cannot use the -mobileIP flag. In CIP when we create a node as "set n0 [$ns cipNode]" how can we configure this node to be a HA or a FA also? Any hints?
Answer) "set HA" or "set FA" has nothing to do with choosing the home area. You have to set its HA address when MH is created.

Question 10) Do we have to implement the sending of SOLICIATION messages from the MH to the FA or should we just rely on the AGENT ADVERTISMENT messages sent by the FA to the MH ?
Answer) You don't have to send SOLICITATION. but if you do you will get extra points.

Question 11) The existing cellular IP only allows ONE GW to be defined at any one time. How are we meant to make 2 for the second part of the project without having to completely re-write the code???
Answer) You don't need to rewrite whole code. Just changing code to differentiate two gateway is enough.

Question 12) What is LMP and RMP?
Answer) Sorry.. These are old terminology. LMP is page-update cache and RMP is route-update cache. These are routing table created by control packet and used to forward packet to downlink.

Question 13) I have attached the Agent/MIPBS agents to the HA and the FA and the Agent/MIPMH to the mobile node. The problem is the MIPBS and MIPMH agents send out broadcast messages and the cipcode does not know how to handle broadcast messages?
Answer) In MIP, broadcasting a packet is handled in DSR agent if destination address is -1. In Cellular IP, there is no DSR agent. If you want to broadcast message, you need to use the rouing table created by control packet sent from mobile and send packet based on this.

Question 14) The problem I have is the portMask is set to 0x3. That is only 4 ports (agents) can be attached to a demux. In the MakeMob routine already 4 ports have been used(Cbr2, TCP source, TCP sink and CBR). I need an additional port to attach the MIPMH agent.
Answer) You can extend this portMask. But to make it simple, You can remove one of tcp source or sink that are pre-assigned to the portdmux.

Question 15) I was having problem of creating TCP traffic to the MH. I created a TCP source and the try to connect it with the tcpsnk_ that already created in the MH using "$ns connect $tcp [$MH set tcpsnk_]"
Answer) You have to specify the agent address and port number.
If tcp source is mobile, do the following
[$mymobile set tcpsrc_] set dst_addr_ [$tcpsnk set agent_addr]
[$mynode set tcpsnk_] set dst_addr_ [[$mymoible set tcpsrc_] set agent_addr_]

If tcp sink is mobile host, you have to specify the port number at tcp sink too. Here is the example
[$mymobile set tcpsnk_] set dst_addr_ [$tcpsrc set agent_addr_]
[$mymobile set tcpsnk_] set dst_port_ [$tcpsrc set agent_port_]

Question 16) I think I am totally lost. I don't know what I should do. Please help :(
Answer) Well.. most important thing is to create your Encapsulator and Decapsulator Agent first.
Here is some example code that I wrote

Node instproc attach-myencap {} {
$self instvar encap_ address_
set encap_ [new MIPEncapsulator]
set mask 0x7fffffff
set shift 0
set nodeaddr [expr ($address_ & [Simulator set NodeMask_(1)]) << [Simulator set NodeShift_(1)]
$encap_ set port 1
$encap_ target [$self entry]
$encap_ node_ $self
}

Node instproc attach-mydecap {} {
$self instvar decap_ dmux_ agents_
set decap_ [new Classifier/Addr/MIPDecapsulator]
lappend agents_ $decap_
set mask 0x7fffffff
set shift 0
if {[expr [llength $agents_] - 1]> $mask} {
error "\# of agents attached to node $self exceeds port-field length of $mask bits\n"
}
# you can choose port number. here 3 is picked.
$dmux_ install 3 $decap_

}

If you look at the encapsulator procedure above, it is not installed to address classifier nor to port classifier. This encapsultor needs to be installed to address classifier when HA get MIP Registration Request.from mobile host so that All the packet addressed to mobile host can be processed at this Encapsulator agent first and forwarded to proper FA.(why address classifier? instead of port classifier?; I haven't looked at MIP code but I think it is more natural to use address classifier since all packets should be encapulated regardless of port number ) Then what you shoud do is to set the detination address of encapsulated packet. so that the decapsulator agent in FA can receive the this packet.