📄 infoseek.html
字号:
<html>
<head>
<title>Where to Find What?</title>
</head>
<body background="parchment.gif" tppabs="http://nile.wpi.edu/NS/Icons/parchment.gif" text="#000000" link="#0000FF"
vlink="#000080" alink="#FF0000">
<br>
<center><h2>Where to Find What?</h2></center>
<br><br>
<dl>
<p>Before going into a discussion of how to extend NS, let's briefly examine what information is stored in which directory or file. Figure 17 shows a part of the directory structure of the simulator if you installed it using the ns-allinone-2.1b package. </p>
<p align="center"><img src="fig17.gif" tppabs="http://nile.wpi.edu/NS/Figure/fig17.gif"><br><br>
<b>Figure 17.</b> NS Directory Structure</p>
<p>Among the sub-directories of ns-allinone-2.1b, <font color=RED>ns-2</font> is the place that has all of the simulator implementations (either in C++ or in OTcl), validation test OTcl scripts and example OTcl scripts. Within this directory, all OTcl codes and test/example scripts are located under a sub-directory called <font color=BLUE>tcl</font>, and most of C++ code, which implements event scheduler and basic network component object classes, except the WWW related ones, are located in the main level. For example, if you want to see the implementation of the UDP agent, you should go to "ns-allinone-2.1b/ns-2" directory, and open up "udp.h", "udp.cc" and the files that contain the implementation of ancestor classes of UDP as needed. For the class hierarchy of network components, refer to <a href="components.html#fig6" tppabs="http://nile.wpi.edu/NS/components.html#fig6">Figure 6</a> in the "Network Components" section. From now on, it is assumed that you are already in "ns-allinone-2.1b" directory.
</p>
<p>The <font color=BLUE>tcl</font> directory has sub-directories, among which the <font color=RED>lib</font> directory that contains OTcl source codes for the most basic and essential parts of the NS implementation (agent, node, link, packet, address, routing, and etc.) is the place one as a user or as a developer will visit the most. Note that the OTcl source codes for LAN, Web, and Multicast implementations are located in separate subdirectories of <font color=BLUE>tcl</font>. Following is a partial list of files in "ns-2/tcl/lib" directory. </p>
</dl>
<ul>
<li><font color=RED>ns-lib.tcl</font>: The simulator class and most of its member function definitions except for LAN, Web, and Multicast related ones are located here. If you want to know which member functions of the Simulator object class are available and how they work, this is a place to look. <br> </li>
<li><font color=RED>ns-default.tcl</font>: The default values for configurable parameters for various network components are located here. Since most of network components are implemented in C++, the configurable parameters are actually C++ variables made available to OTcl via an OTcl linkage function, <font color=GREEN>bind</font>(<i>C++_variable_name</i>, <i>OTcl_variable_name</i>). How to make OTcl linkages from C++ code is described in the next section.<br> </li>
<li><font color=RED>ns-packet.tcl</font>: The packet header format initialization implementation is located here. When you create a new packet header, you should register the header in this file to make the packet header initialization process to include your header into the header stack format and give you the offset of your header in the stack. A new header creating example is shown in "Add New Application and Agent" section.<br> </li>
<li><font color=RED>other OTcl files</font>: Other OTcl files in this directory, contain OTcl implementation of compound network objects or the front end (control part) of network objects in C++. The FTP application is entirely implemented in OTcl and the source code is located in "ns-source.tcl".<br> </li>
</ul>
<dl>
<p>Two sub-directories of <font color=BLUE>tcl</font> that might be interesting for a user who wants to know how to design a specific simulation are <font color=BLUE>ex</font> and <font color=BLUE>test</font>. The former directory contains various example simulation scripts and the latter contains simulation scripts that validate the NS installed in your machine by running various simulations and comparing the results with the expected results.
</p>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -