manualns2.31+library
TRANSCRIPT
Lorenzo Spadoni 09-feb-2009
Manual for installing NS2.31 + dei80211mr library + Evalvid under Window XP
1
1. CYGWIN INSTALLATION
Cygwin is a Linux emulator in Windows environment. The following
paper will describe the steps to install the emulator:
The first step is to verify the Windows user name
Figure 1 Username check in Windows
In my special scenario as shown in the above Figure, the name is
“Spadoni” (there is no space in the name). If you find that there is a
space in your computer name like “??? ??”, NS2 will complain it and can
not run properly even it is installed. Therefore, please change the name
of your computer first in this situation. The detail steps on how to change
the name of your computer are described as following:
1. Begin by first clicking on the Start Button.
2. Then click on the Run Icon, which will open up the Run Menu for you.
2
3. Type the word “Regedit” into the white area and then click on the OK
button.
4. Click on the plus sign [+] next to HKEY_LOCAL_MACHINE to expand
that section.
5. Then click on the plus sign [+] next to “Software” to expand that
section.
6. Then click on the plus sign [+] next to “Microsoft” to expand that
section.
7. Then click on the plus sign [+] next to “Windows NT” to expand that
section.
8. Then click on the yellow folder entitled “Current Version”. Do not click
on its plus sign [+].
9. Now move over to the right side of the screen and scroll down until
you see “Registered Owner”.
10. Double click directly onto the words Registered Owner and input
your new name, make sure no space there.
11. You need to reboot your computer for the changes to take effect for
Windows XP.
The software is open source, available at http://www.cygwin.com/. The
screenshot of the installation window is shown in Figure 2
3
Figure 2 Cygwin Installation
The following page will allow to you to select the installation method,
select the line “install from internet”. Since our aim is the one to
emulate an entire OS we need to select all the part of the emulated
OS, in particular the gcc [1] compiler and the X terminal [2]. We will
install the entire emulator through a double click on the line “Install
All” .
Figure 3 OS part selection
4
The step shown in Figure 3 is important because by default some part of
the emulated OS are not selected. The most important not included in
the installation by default are gcc compiler and X shell, better know as
bash (Bourne Again Shell, from the name of the creator of the firs shell,
Bourne).
Figure 4 Installation progress
Once the installation process is ended (the average time for the
installation is about 100 minutes). The OS is installed on the PC, it’s
available from the menu, clicking on “Start” (Figure 5).
5
Figure 5 link to the Bash shell in Cygwin
After the lunch of the bash in Cygwin, we will operate in a shell similar to
the Windows prompt. The command are the same of Linux (no more
DOS here!!!). It’s easy find some manual about Linux common command
[3].
Figure 6 Bash shell
6
2 NS-2 + dei80211mr LIBRARY INSTALLATION
The NS-2 simulator is free downloadable at the web address
http://www.isi.edu/nsnam/ns/ns-build.html. We will use for this tutorial the
less recent ns-allinone-2.31. Before the installation of NS-2 we will
implement the dei80211mr module [4] within the NS-2 installation files.
In fact the module must be compiled directly with NS-2.
The directory where decompress the downloaded file of the simulator is
“Cywin_Path\home” (in my specific case is C:\cygwin\home); we can
decompress the file directly from Windows if is installed a program able
to handle the format tar.gz (ex. WinRar, free available) or we can
decompress the file from the bash using the following command:
$ tar xzvf ns-allinone-2.31.tar.gz
Moreover we must lunch the patch that allow to the dei80211mr library to
be installed. The library is available at this link [5].
The command line for set the patch is:
$ patch -p1 < new-patch-dl-ns-2.
The command line will lunch automatically all this subcommand reported
as follow:
patching file ns-allinone-2.31/install
patching file ns-allinone-2.31/ns-2.31/common/main.cc
patching file ns-allinone-2.31/ns-
2.31/common/packet.cc
patching file ns-allinone-2.31/ns-
2.31/common/packet.h
7
patching file ns-allinone-2.31/ns-
2.31/common/ptypes2tcl.cc
patching file ns-allinone-2.31/ns-
2.31/common/tclAppInit.cc
patching file ns-allinone-2.31/ns-2.31/Makefile.in
patching file ns-allinone-2.31/ns-2.31/tcl/lib/ns-
default.tcl
patching file ns-allinone-2.31/ns-2.31/tcl/lib/ns-
lib.tcl
patching file ns-allinone-2.31/ns-2.31/trace/cmu-
trace.cc
patching file ns-allinone-2.31/ns-2.31/trace/cmu-
trace.h
patching file ns-allinone-2.31/tcl8.4.14/unix/tcl.m4
patching file ns-allinone-2.31/tk8.4.14/unix/tcl.m4
The patch will modify some m4 files in the Tcl e Tk folders, then we must
type the command:
$ autoconf
in both directory tcl8.4.14/unix and tk8.4.14/unix.
So:
$ cd ns-allinone-2.31/tcl8.4.14/unix
$ autoconf
$ cd ../../
$ cd tk8.4.14/unix
$ autoconf
8
$ cd ../../
After this operation we must go back to the main directory which contain
all the decompressed file (Figure 7) and lunch the command:
$./install
Figure 7 NS-2 installation command
The installation process will take about 70 minutes.
At the end of the installation process, the bash shell will display some
IMPORTANT string as in Figure 8. We can identify many paths. I
vigorously SUGGEST to take a stamp or a print of this shell using the
button “Stamp” an pasting the screenshot in a doc or bmp editor.
9
Figure 8 Path for set up the Environment Variables and system library
As we can notice in the middle of the screenshot, after the partition line
(---), we can find many paths, in the specific example we have:
/home/Spadoni/ns-allinone-2.31/bin
/home/Spadoni/ns-allinone-2.31/tcl8.4.14/unix
/home/Spadoni/ns-allinone-2.31/tk8.4.14/unix
We must set this path in the Environment Variables path in Windows Xp,
the process is illustrate in Figure 9:
10
Figure 9 Process for add Variable Environment Path in Windows OS
Configure system variables:
“My computer” - “system properties” - “advanced” - “environment
variables system variables” see Figure 9 – “path” - “edit”, use “;” to
separate them.
Type at the end of the field the three path:
/home/Spadoni/ns-allinone-2.31/bin:/home/Spadoni/ns-
allinone-2.31/tcl8.4.14/unix:/home/Spadoni/ns-
allinone-2.31/tk8.4.14/unix
As reported in the final screenshot at the end of the installation process
Figure 8.
11
Figure 10 Adding Environment Variables
The goal is the correct routing of the simulator in the two OS (the real –
Windows – and the emulated – Cygwin –). The last step is the setting of
the system library. For this purpose from the bash shell we must type the
path shown in Figure 8. In my specific case:
$ LD_LIBRARY_PATH =/home/spdoni/ns-allinone-
2.31/otcl-1.1.13
$ LD_LIBRARY_PATH =/home/spdoni/ns-allinone-2.31/lib
$ TCL_LIBRARY_PATH= /home/spdoni/ns-allinone-
2.31/tcl8.4.14/library
After this operation we must restart the system. After the restart from the
bash shell we can type “ns”, if the results is %, everything was set
correctly. For come back from % status type “exit”.
12
Figure 11 Validation process in NS-2
At this point the only thing left is the validation, we can do it typing:
$./validate
We will obtain a screenshot like the one in Figure11; It’s true...it can take
1 to 30 hours to run.
For further advice on the installation process in particular on the
dei80211mr library use this reference [6].
13
2.1 BUGS
Typing the command:
$ startx
It should appear a windows called X as in Figure 12. Through this
window is possible to launch NAM and XGRAPH.
Figure 12 X window
If there are some problem with this procedure, and it will appear some
errors on some missing file.dll, go in the directory C:\cygwin\lib (if
C:\Cygwin is your path), select all the missing file.dll and copy them in
C:\cygwin\usr\X11R6\bin.
If the error persist during the opening of the X Window, type the
following command:
14
$ export DISPLAY=:0.0
Pay attention to this command IS Case Sensitive! At this point typing
$ startx no one can stop you! I suggest you for have some practice to
visit the website http://www.isi.edu/nsnam/ns/tutorial/ and use the
tutorial.
15
3 ADITIONAL MODULES INSTALLATION
As was set up the simulator until now, we can’t effort a complete
simulation for a video streaming over wireless network. For create a
efficient framework to evaluate the video quality for video transmission
over wireless network, we must add some modules more. The main
problems for the simulation are:
a) Representation of the wireless channel and
b) Traffic generated for the simulation.
Following this order we solve this problem using dei802.11mr library,
and myEvalvid module. Both are open source file generated by different
university and free available on internet.
3.1 dei80211mr MODULE As previously mentioned this library extend the NS-2 base. The
implementation of this module is done through a patch as explained in
section 2.
16
3.2 myEVALVID MODULE INSTALLATION
Installing this module require a re-compilation of the entire simulation
software. The first step is downloading the source file available at [7].
This version of EVALVID [8] software must follow a pretty fast iter of
installation.
First of all we must download the source file at [9], they are:
myudp.cc, myudp.h, myudpsink2.cc, myudpsink2.h,
mytraffictrace2.cc
The downloaded file are the five. We must create a folder and call it
“mympeg”, in my specific case:
C:\cygwin\home\ns-allinone-2.31\ns-2.31\mympeg
Now we must modify some source file in NS-2 in order to prepare the
simulator to the new module. In particular we must modify the packet.h
file as follow:
double ts_; // timestamp: for q-delay measurement
int iface_; // receiving interface (label)
dir_t direction_; // direction: 0=none, 1=up, -1=down
// source routing
char src_rt_valid;
double ts_arr_; // Required by Marker of JOBS
//add this three line
int frametype_; // frame type for MPEG video
transmission (Henry)
double sendtime_; // send time (Henry)
unsigned long int frame_pkt_id_;
17
Then we must modify agent.h file:
class Agent : public Connector {
public:
Agent(packet_t pktType);
virtual ~Agent();
void recv(Packet*, Handler*);
......
inline packet_t get_pkttype() { return type_; }
// add this two following lines
inline void set_frametype(int type) { frametype_ = type; } //
(Henry)
inline void set_prio(int prio) { prio_ = prio; } // (Henry)
protected:
int command(int argc, const char*const* argv);
..............
int defttl_; // default ttl for outgoing
pkts
// add the following line
int frametype_; // frame type for MPEG video
transmission
..............
private:
void flushAVar(TracedVar *v);
};
Now we must modify the agent.cc file:
//add the following string
Agent::Agent(packet_t pkttype) :
size_(0), type_(pkttype), frametype_(0),
channel_(0), traceName_(NULL),
oldValueList_(NULL), app_(0), et_(0)
{
}
.......
Agent::initpkt(Packet* p) const{
hdr_cmn* ch = hdr_cmn::access(p);
18
ch->uid() = uidcnt_++;
ch->ptype() = type_;
ch->size() = size_;
ch->timestamp() = Scheduler::instance().clock();
ch->iface() = UNKN_IFACE.value(); // from packet.h (agent is
local)
ch->direction() = hdr_cmn::NONE;
ch->error() = 0; /* pkt not corrupt to start with */
// add the following line
ch->frametype_= frametype_;
.......
Now we must modify the .../tcl/lib/ns-default.tcl file, we must add at the
end of the file the two following lines:
Agent/myUDP set packetSize_ 1000
Tracefile set debug_ 0
Last step: we must modify the MAKEFILE file, in my case I can find it at
C:\cygwin\home\ns-allinone-2.31\ns-2.31 we must add the following line
highlighter in yellow:
# WIN32: uncomment the following line to include specific make
for VC++
# !include <conf/makefile.win>
OBJ_CC = \
mympeg/myudp.o mympeg/myudpsink2.o
mympeg/mytraffictrace2.o \
tools/random.o tools/rng.o tools/ranvar.o common/misc.o
common/timer- handler.o \
common/scheduler.o common/object.o common/packet.o \
The modifying process is done, now we must lunch the bash shell, we
must go in the directory in which NS-2 is saved (in my specific case is
C:\cygwin\home\ns-allinone-2.31\ns-2.31) and re-compile NS-2 in toto.
19
The commands are:
$ make clean
$ male depend
$ make
At the end of the procedure the NS-2 software is ready to work. Be sure
to have downloaded all the file, the source file and the entire tool Evalvid
available at the web address [10].
20
21
Bibliography
[1] Gcc documentation http://gcc.gnu.org/
[2] X terminal http://www.x.org/wiki/
[3] Linux Guide http://linux.html.it/guide/
[4] Library dei80211mr http://www.dei.unipd.it/wdyn/?IDsezione=5091
[5] Patch dei80211mr http://www.dei.unipd.it/wdyn/?IDsezione=3970
[6] Installation guide
http://www.dei.unipd.it/~baldo/ns_dl_patch/Installation.html#SECTION00
042000000000000000
[7] C. Y. Yu, C. H. Ke, R. S. Chen, C. K. Shieh, N. Chilamkurti,
"MyEvalvid_RTP: a Evaluation Framework for More Realistic
Simulations of Multimedia Transmission", International Journal of
Software Engineering and Its Applications, vol. 2, no. 2, pp.21-32, 2008
[8] EvalVid - A Video Quality Evaluation Tool-set
http://www.tkn.tu-berlin.de/research/evalvid/
[9] Source code myEVALVID
http://140.116.72.80/~smallko/ns2/myevalvid2.htm
[10] myEvalvid http://140.116.72.80/~smallko/ns2/myevalvid2.rar