| [Top] | [Contents] | [Index] | [ ? ] |
For a pdf version of this tutorial, see http://www.nsnam.org/docs/tutorial.pdf.
This is an ns-3 tutorial.
Primary documentation for the ns-3 project is available in
four forms:
This document is written in GNU Texinfo and is to be maintained in revision
control on the ns-3 code server. Both PDF and HTML versions should
be available on the server. Changes to the document should be discussed on
the ns-developers@isi.edu mailing list.
This software is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
| 1. Introduction | ||
| 2. Resources | ||
| 3. Getting Started | ||
| 4. Conceptual Overview | ||
| 5. Tweaking ns-3 | ||
| 6. Building Topologies |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| 1.1 For ns-2 Users | ||
| 1.2 Contributing | ||
| 1.3 Tutorial Organization |
The ns-3 simulator is a discrete-event network simulator targeted
primarily for research and educational use. The
ns-3 project,
started in 2006, is an open-source project developing ns-3.
Primary documentation for the ns-3 project is available in four
forms:
The purpose of this tutorial is to introduce new ns-3 users to the
system in a structured way. It is sometimes difficult for new users to
glean essential information from detailed manuals and to convert this
information into working simulations. In this tutorial, we will build
several example simulations, introducing and explaining key concepts and
features as we go.
As the tutorial unfolds, we will introduce the full ns-3 documentation and provide pointers to source code for those interested in delving deeper into the workings of the system.
A few key points are worth noting at the onset:
ns-3 is a new simulator that does not support the ns-2 APIs. Some
models from ns-2 have already been ported from ns-2 to ns-3. The project will
continue to maintain ns-2 while ns-3 is being built, and will study transition
and integration mechanisms.
Ns-3 is open-source, and the project strives to maintain an
open environment for researchers to contribute and share their software.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
For those familiar with ns-2, the most visible outward change when moving to
ns-3 is the choice of scripting language. Ns-2 is
scripted in OTcl and results of simulations can be visualized using the
Network Animator nam. It is not possible to run a simulation
in ns-2 purely from C++ (i.e., as a main() program without any OTcl).
Moreover, some components of ns-2 are written in C++ and others in OTcl.
In ns-3, the simulator is written entirely in C++, with optional
Python bindings. Simulation scripts can therefore be written in C++
or in Python. The results of some simulations can be visualized by
nam, but new animators are under development. Since ns-3
generates pcap packet trace files, other utilities can be used to
analyze traces as well.
In this tutorial, we will first concentrate on scripting
directly in C++ and interpreting results via ascii trace files.
But there are similarities as well (both, for example, are based on C++ objects, and some code from ns-2 has already been ported to ns-3). We will try to highlight differences between ns-2 and ns-3 as we proceed in this tutorial.
A question that we often hear is "Should I still use ns-2 or move to ns-3?" The answer is that it depends. ns-3 does not have all of the models that ns-2 currently has, but on the other hand, ns-3 does have new capabilities (such as handling multiple interfaces on nodes correctly, use of IP addressing and more alignment with Internet protocols and designs, more detailed 802.11 models, etc.). ns-2 models can usually be ported to ns-3 (a porting guide is under development). There is active development on multiple fronts for ns-3. The ns-3 developers believe (and certain early users have proven) that ns-3 is ready for active use, and should be an attractive alternative for users looking to start new simulation projects.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Ns-3 is a research and educational simulator, by and for the
research community. It will rely on the ongoing contributions of the
community to develop new models, debug or maintain existing ones, and share
results. There are a few policies that we hope will encourage people to
contribute to ns-3 like they have for ns-2:
src/contrib directory (we will host your contributed code);
Ns-3 developers will gladly help potential contributors to get
started with the simulator (please contact one of us).
We realize that if you are reading this document, contributing back to the project is probably not your foremost concern at this point, but we want you to be aware that contributing is in the spirit of the project and that even the act of dropping us a note about your early experience with ns-3 (e.g. "this tutorial section was not clear..."), reports of stale documentation, etc. are much appreciated.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The tutorial assumes that new users might initially follow a path such as the following:
As a result, we have tried to organize the tutorial along the above broad sequences of events.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| 2.1 The Web | ||
| 2.2 Mercurial | ||
| 2.3 Waf | ||
| 2.4 Development Environment | ||
| 2.5 Socket Programming |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
There are several important resources of which any ns-3 user must be
aware. The main web site is located at http://www.nsnam.org and
provides access to basic information about the ns-3 system. Detailed
documentation is available through the main web site at
http://www.nsnam.org/documents.html. You can also find documents
relating to the system architecture from this page.
There is a Wiki that complements the main ns-3 web site which you will find at http://www.nsnam.org/wiki/. You will find user and developer FAQs there, as well as troubleshooting guides, third-party contributed code, papers, etc.
The source code may be found and browsed at http://code.nsnam.org/.
There you will find the current development tree in the repository named
ns-3-dev. Past releases and experimental repositories of the core
developers may also be found there.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Complex software systems need some way to manage the organization and changes to the underlying code and documentation. There are many ways to perform this feat, and you may have heard of some of the systems that are currently used to do this. The Concurrent Version System (CVS) is probably the most well known.
The ns-3 project uses Mercurial as its source code management system.
Although you do not need to know much about Mercurial in order to complete
this tutorial, we recommend becoming familiar with Mercurial and using it
to access the source code. Mercurial has a web site at
http://www.selenic.com/mercurial/,
from which you can get binary or source releases of this Software
Configuration Management (SCM) system. Selenic (the developer of Mercurial)
also provides a tutorial at
http://www.selenic.com/mercurial/wiki/index.cgi/Tutorial/,
and a QuickStart guide at
http://www.selenic.com/mercurial/wiki/index.cgi/QuickStart/.
You can also find vital information about using Mercurial and ns-3
on the main ns-3 web site.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Once you have source code downloaded to your local system, you will need
to compile that source to produce usable programs. Just as in the case of
source code management, there are many tools available to perform this
function. Probably the most well known of these tools is make. Along
with being the most well known, make is probably the most difficult to
use in a very large and highly configurable system. Because of this, many
alternatives have been developed. Recently these systems have been developed
using the Python language.
The build system Waf is used on the ns-3 project. It is one
of the new generation of Python-based build systems. You will not need to
understand any Python to build the existing ns-3 system, and will
only have to understand a tiny and intuitively obvious subset of Python in
order to extend the system in most cases.
For those interested in the gory details of Waf, the main web site can be found at http://freehackers.org/~tnagy/waf.html.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
As mentioned above, scripting in ns-3 is done in C++ or Python. As of ns-3.2, most of the ns-3 API is available in Python, but the models are written in C++ in either case. A working knowledge of C++ and object-oriented concepts is assumed in this document. We will take some time to review some of the more advanced concepts or possibly unfamiliar language features, idioms and design patterns as they appear. We don't want this tutorial to devolve into a C++ tutorial, though, so we do expect a basic command of the language. There are an almost unimaginable number of sources of information on C++ available on the web or in print.
If you are new to C++, you may want to find a tutorial- or cookbook-based book or web site and work through at least the basic features of the language before proceeding. For instance, this tutorial.
The ns-3 system uses several components of the GNU “toolchain”
for development. A
software toolchain is the set of programming tools available in the given
environment. For a quick review of what is included in the GNU toolchain see,
http://en.wikipedia.org/wiki/GNU_toolchain. ns-3 uses gcc,
GNU binutils, and gdb. However, we do not use the GNU build system,
either make or autotools, using Waf instead.
Typically an ns-3 author will work in Linux or a Linux-like
environment. For those running under Windows, there do exist environments
which simulate the Linux environment to various degrees. The ns-3
project supports development in the Cygwin environment for
these users. See http://www.cygwin.com/
for details on downloading (MinGW is presently not supported).
Cygwin provides many of the popular Linux system commands.
It can, however, sometimes be problematic due to the way it actually does its
emulation, and sometimes interactions with other Windows software can cause
problems.
If you do use Cygwin or MinGW; and use Logitech products, we will save you quite a bit of heartburn right off the bat and encourage you to take a look at the MinGW FAQ.
Search for “Logitech” and read the FAQ entry, “why does make often
crash creating a sh.exe.stackdump file when I try to compile my source code.”
Believe it or not, the Logitech Process Monitor insinuates itself into
every DLL in the system when it is running. It can cause your Cygwin or
MinGW DLLs to die in mysterious ways and often prevents debuggers from
running. Beware of Logitech software when using Cygwin.
Another alternative to Cygwin is to install a virtual machine environment such as VMware server and install a Linux virtual machine.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
We will assume a basic facility with the Berkeley Sockets API in the examples used in this tutorial. If you are new to sockets, we recommend reviewing the API and some common usage cases. For a good overview of programming TCP/IP sockets we recommend Practical TCP/IP Sockets in C, Donahoo and Calvert.
There is an associated web site that includes source for the examples in the book, which you can find at: http://cs.baylor.edu/~donahoo/practical/CSockets/.
If you understand the first four chapters of the book (or for those who do not have access to a copy of the book, the echo clients and servers shown in the website above) you will be in good shape to understand the tutorial. There is a similar book on Multicast Sockets, Multicast Sockets, Makofske and Almeroth. that covers material you may need to understand if you look at the multicast examples in the distribution.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| 3.1 Downloading ns-3 | ||
| 3.2 Building ns-3 | ||
| 3.3 Testing ns-3 | ||
| 3.4 Running a Script |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
From this point forward, we are going to assume that the reader is working in
Linux or a Linux emulation environment (Linux, Cygwin, etc.) and has the GNU
toolchain installed and verified. We are also going to assume that you have
Mercurial and Waf installed and running on the target system as described in
the Getting Started section of the ns-3 web site:
http://www.nsnam.org/getting_started.html.
The ns-3 code is available in Mercurial repositories on the server
code.nsnam.org. You can download a tarball release at
http://www.nsnam.org/releases/, or you can work with repositories
using Mercurial.
If you go to the following link: http://code.nsnam.org/,
you will see a number of repositories. Many are the private repositories of
the ns-3 development team. The repositories of interest to you will
be prefixed with “ns-3”. The current development snapshot (unreleased)
of ns-3 may be found at: http://code.nsnam.org/ns-3-dev/.
Official releases of ns-3 will be numbered as ns-3.<release>
with any required hotfixes added as minor release numbers. For example, a
second hotfix to a hypothetical release nine of ns-3 would be
numbered ns-3.9.2.
The current development snapshot (unreleased) of ns-3 may be found
at: http://code.nsnam.org/ns-3-dev/. The developers attempt to keep
this repository in a consistent, working state but it is a development area
with unreleased code present, so you may want to consider staying with an
official release if you do not need newly-introduced features.
Since the release numbers are going to be changing, I will stick with the more constant ns-3-dev here in the tutorial, but you can replace the string “ns-3-dev” with your choice of release (e.g., ns-3.2) in the text below. You can find the latest version of the code either by inspection of the repository list or by going to the “Getting Started” web page and looking for the latest release identifier.
One practice is to create a directory called repos in one's home
directory under which one can keep local Mercurial repositories.
Hint: we will assume you do this later in the tutorial. If you adopt
that approach, you can get a copy of the development version of
ns-3 by typing the following into your Linux shell (assuming you
have installed Mercurial):
cd mkdir repos cd repos hg clone http://code.nanam.org/ns-3-dev
As the hg (Mercurial) command executes, you should see something like the following,
destination directory: ns-3-dev requesting all changes adding changesets adding manifests adding file changes added 3276 changesets with 12301 changes to 1353 files 594 files updated, 0 files merged, 0 files removed, 0 files unresolved
After the clone command completes, you should have a directory called
ns-3-dev under your ~/repos directory, the contents of which should
look something like the following:
AUTHORS examples/ README samples/ utils/ waf.bat* build/ LICENSE regression/ scratch/ VERSION wscript doc/ ns3/ RELEASE_NOTES src/ waf*
Similarly, if working from a released version instead, you can simply
cd mkdir repos wget http://www.nsnam.org/releases/ns-3.2.tar.bz2 bunzip2 ns-3.2.tar.bz2 tar xvf ns-3.2.tar
You are now ready to build the ns-3 distribution.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
We use Waf to build the ns-3 project. The first thing you will need
to do is to configure the build. For reasons that will become clear later,
we are going to work with debug builds in the tutorial. To explain to Waf
that it should do debug builds you will need to execute the following command,
./waf -d debug configure
This runs Waf out of the local directory (which is provided as a convenience for you). As the build system checks for various dependencies you should see output that looks similar to the following,
Checking for program g++ : ok /usr/bin/g++ Checking for compiler version : ok Version 4.0.1 Checking for program cpp : ok /usr/bin/cpp Checking for program ar : ok /usr/bin/ar Checking for program ranlib : ok /usr/bin/ranlib Checking for compiler could create programs : ok Checking for compiler could create shared libs : ok Checking for compiler could create static libs : ok Checking for flags -O2 -DNDEBUG : ok Checking for flags -g -DDEBUG : ok Checking for flags -g3 -O0 -DDEBUG : ok Checking for flags -Wall : ok Checking for g++ : ok Checking for -Wno-error=deprecated-declarations compilation flag support : no Checking for header stdlib.h : ok Checking for header stdlib.h : ok Checking for header signal.h : ok Checking for library rt : not found Checking for header pthread.h : ok Checking for high precision time implementation: 128-bit integer Checking for header stdint.h : ok Checking for header inttypes.h : ok Checking for header sys/inttypes.h : not found Checking for package gtk+-2.0 >= 2.12 : not found Checking for library sqlite3 : ok Checking for package goocanvas gthread-2.0 : not found Checking for program python : ok /usr/local/bin/python Checking for Python version >= 2.3 : ok 2.4.3 Checking for library python2.4 : not found Checking for library python2.4 : not found Checking for library python24 : not found Checking for program python2.4-config : not found Checking for header Python.h : not found Checking for program diff : ok /usr/bin/diff Checking for program hg : ok /opt/local/bin/hg ---- Summary of optional NS-3 features: Threading Primitives : enabled Real Time Simulator : enabled GtkConfigStore : not enabled (library 'gtk+-2.0 >= 2.12' not found) SQlite stats data output : enabled Network Simulation Cradle : not enabled (--enable-nsc configure option not given) Python Bindings : not enabled (Python development headers not found.) Configuration finished successfully; project is now ready to build.
Note the trailing portion of the above output. Some ns-3 options are not enabled by default or require support from the underlying system. For instance, to enable Python bindings, Python development headers must be installed on the host machine, and they were not found in the above example, so Python scripting will not be supported in the resulting build. For this tutorial, we will focus on the non-optional pieces of ns-3.
The build system is now configured and you can build the debug versions of
the ns-3 programs by simply typing,
./waf
(Hint: if you have a multicore machine, use the "-j JOBS" option to speed up your build, where JOBS is the number of cores) You will see many Waf status messages displayed as the system compiles. The most important is the last one:
Compilation finished successfully
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
You can run the unit tests of the ns-3 distribution by running the
“check” command,
./waf check
You should see a report from each unit test that executes indicating that the test has passed.
~/repos/ns-3-dev > ./waf check Entering directory `/home/craigdo/repos/ns-3-dev/build' Compilation finished successfully PASS AddressHelper PASS Wifi PASS DcfManager ... PASS Object PASS Ptr PASS Callback ~/repos/ns-3-dev >
This command is typically run by users to quickly verify that an
ns-3 distribution has built correctly.
You can also run our regression test suite to ensure that your distribution and tool chain have produced binaries that generate output that is identical to reference output files stored in a central location. To run the regression tests, you provide Waf with the regression flag.
./waf --regression
Waf will verify that the current files in the ns-3 distribution are
built and will then look for trace files in the aforementioned centralized
location. If your tool chain includes Mercurial, the regression tests will
be downloaded from a repository at code.nsnam.org. If you do not have
Mercurial installed, the reference traces will be downloaded from a tarball
located in the releases section of www.nsnam.org. The particular name
of the reference trace location is built from the ns-3 version
located in the VERSION file, so don't change that string yourself unless you
know what you are doing. (Warning: The ns-3.2 release requires you
to be online when you run regression tests because it synchronizes the
trace directory with an online repository).
Once the reference traces are downloaded to your local machine, Waf will run a number of tests that generate what we call trace files. The content of these trace files are compared with the reference traces just downloaded. If they are identical, the regression tests report a PASS status. If the regression tests pass, you should see something like,
~/repos/ns-3-dev > ./waf --regression Entering directory `/home/craigdo/repos/ns-3-dev/build' Compilation finished successfully ========== Running Regression Tests ========== Synchronizing reference traces using Mercurial. Pulling http://code.nsnam.org/ns-3-dev-ref-traces from repo. Skipping csma-bridge: Python bindings not available. SKIP test-csma-bridge PASS test-csma-broadcast PASS test-csma-multicast PASS test-csma-one-subnet PASS test-csma-packet-socket PASS test-realtime-udp-echo PASS test-simple-error-model PASS test-simple-global-routing PASS test-simple-point-to-point-olsr PASS test-tcp-large-transfer PASS test-udp-echo PASS test-wifi-wired-bridging ~/repos/ns-3-dev >
If a regression tests fails you will see a FAIL indication along with a pointer to the offending trace file and its associated reference trace file along with a suggestion on diff parameters and options in order to see what has gone awry. Python regression tests will be SKIPped if Python bindings are not built.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
We typically run scripts under the control of Waf. This allows the build
system to ensure that the shared library paths are set correctly and that
the libraries are available at run time. To run a program, simply use the
--run option in Waf. Let's run the ns-3 equivalent of the
ubiquitous hello world program by typing the following:
./waf --run hello-simulator
Waf first checks to make sure that the program is built correctly and executes a build if required. Waf then then executes the program, which produces the following output.
Hello Simulator
Congratulations. You are now an ns-3 user.
If you want to run programs under another tool such as gdb or valgrind, see this wiki entry.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| 4.1 Key Abstractions | ||
| 4.2 A First ns-3 Script |
The first thing we need to do before actually starting to look at or write
ns-3 code is to explain a few core concepts and abstractions in the
system. Much of this may appear transparently obvious to some, but we
recommend taking the time to read through this section just to ensure you
are starting on a firm foundation.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In this section, we'll review some terms that are commonly used in
networking, but have a specific meaning in ns-3.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In Internet jargon, a computing device that connects to a network is called
a host or sometimes an end system. Because ns-3 is a
network simulator, not specifically an Internet simulator, we
intentionally do not use the term host since it is closely associated with
the Internet and its protocols. Instead, we use a more generic term also
used by other simulators that originates in Graph Theory — the node.
In ns-3 the basic computing device abstraction is called the
node. This abstraction is represented in C++ by the class Node. The
Node class provides methods for managing the representations of
computing devices in simulations.
You should think of a Node as a computer to which you will add
functionality. One adds things like applications, protocol stacks and
peripheral cards with their associated drivers to enable the computer to do
useful work. We use the same basic model in ns-3.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Typically, computer software is divided into two broad classes. System Software organizes various computer resources such as memory, processor cycles, disk, network, etc., according to some computing model. System software usually does not use those resources to complete tasks that directly benefit a user. A user would typically run an application that acquires and uses the resources controlled by the system software to accomplish some goal.
Often, the line of separation between system and application software is made
at the privilege level change that happens in operating system traps.
In ns-3 there is no real concept of operating system and especially
no concept of privilege levels or system calls. We do, however, have the
idea of an application. Just as software applications run on computers to
perform tasks in the “real world,” ns-3 applications run on
ns-3 Nodes to drive simulations in the simulated world.
In ns-3 the basic abstraction for a user program that generates some
activity to be simulated is the application. This abstraction is represented
in C++ by the class Application. The Application class provides
methods for managing the representations of our version of user-level
applications in simulations. Developers are expected to specialize the
Application class in the object-oriented programming sense to create new
applications. In this tutorial, we will use specializations of class
Application called UdpEchoClientApplication and
UdpEchoServerApplication. As you might expect, these applications
compose a client/server application set used to generate and echo simulated
network packets
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In the real world, one can connect a computer to a network. Often the media
over which data flows in these netowrks are called channels. When
you connect your Ethernet cable to the plug in the wall, you are connecting
your computer to an Ethernet communication channel. In the simulated world
of ns-3, one connects a Node to an object representing a
communication channel. Here the basic communication subnetwork abstraction
is called the channel and is represented in C++ by the class Channel.
The Channel class provides methods for managing communication
subnetwork objects and connecting nodes to them. Channels may also be
specialized by developers in the object oriented programming sense. A
Channel specialization may model something as simple as a wire. The
specialized Channel can also model things as complicated as a large
Ethernet switch, or three-dimensional space full of obstructions in the case
of wireless networks.
We will use specialized versions of the Channel called
CsmaChannel, PointToPointChannel and WifiChannel in this
tutorial. The CsmaChannel, for example, models a version of a
communication subnetwork that implements a carrier sense multiple
access communication medium. This gives us Ethernet-like functionality.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
It used to be the case that if you wanted to connect a computers to a network, you had to buy a specific kind of network cable and a hardware device called (in PC terminology) a peripheral card that needed to be installed in your computer. If the peripheral card implemented some networking function, theys were called Network Interface Cards, or NICs. Today most computers come with the network interface hardware built in and users don't see these building blocks.
A NIC will not work without a software driver to control the hardware. In Unix (or Linux), a piece of peripheral hardware is classified as a device. Devices are controlled using device drivers, and network devices (NICs) are controlled using network device drivers collectively known as net devices. In Unix and Linux you refer to these net devices by names such as eth0.
In ns-3 the net device abstraction covers both the software
driver and the simulated hardware. A net device is “installed” in a
Node in order to enable the Node to communicate with other
Nodes in the simulation via Channels. Just as in a real
computer, a Node may be connected to more than one Channel via
multiple NetDevices.
The net device abstraction is represented in C++ by the class NetDevice.
The NetDevice class provides methods for managing connections to
Node and Channel objects; and may be specialized by developers
in the object-oriented programming sense. We will use the several specialized
versions of the NetDevice called CsmaNetDevice,
PointToPointNetDevice, and WifiNetDevice in this tutorial.
Just as an Ethernet NIC is designed to work with an Ethernet network, the
CsmaNetDevice is designed to work with a CsmaChannel; the
PointToPointNetDevice is designed to work with a
PointToPointChannel and a WifiNetNevice is designed to work with
a WifiChannel.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In a real network, you will find host computers with added (or built-in)
NICs. In ns-3 we would say that you will find Nodes with
attached NetDevices. In a large simulated network you will need to
arrange many connections between Nodes, NetDevices and
Channels.
Since connecting NetDevices to Nodes, NetDevices
to Channels, assigning IP addresses, etc., are such common tasks
in ns-3, we provide what we call topology helpers to make
this as easy as possible. For example, it may take many distinct
ns-3 core operations to create a NetDevice, add a MAC address,
install that net device on a Node, configure the node's protocol stack,
and then connect the NetDevice to a Channel. Even more
operations would be required to connect multiple devices onto multipoint
channels and then to connect individual networks together into internetworks.
We provide topology helper objects that combine those many distinct operations
into an easy to use model for your convenience.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
If you downloaded the system as was suggested above, you will have a release
of ns-3 in a directory called repos under your home
directory. Change into that release directory, and you should find a
directory structure something like the following:
AUTHORS examples/ README samples/ utils/ waf.bat* build/ LICENSE regression/ scratch/ VERSION wscript doc/ ns3/ RELEASE_NOTES src/ waf*
Change into the examples directory. You should see a file named
first.cc located there. This is a script that will create a simple
point-to-point link between two nodes and echo a single packet between the
nodes. Let's take a look at that script line by line, so go ahead and open
first.cc in your favorite editor.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The first line in the file is an emacs mode line. This tells emacs about the formatting conventions (coding style) we use in our source code.
/* -*- Mode:C++; c-file-style:''gnu''; indent-tabs-mode:nil; -*- */
This is always a somewhat controversial subject, so we might as well get it
out of the way immediately. The ns-3 project, like most large
projects, has adopted a coding style to which all contributed code must
adhere. If you want to contribute your code to the project, you will
eventually have to conform to the ns-3 coding standard as described
in the file doc/codingstd.txt or shown on the project web page
here.
We recommend that you, well, just get used to the look and feel of ns-3
code and adopt this standard whenever you are working with our code. All of
the development team and contributors have done so with various amounts of
grumbling. The emacs mode line above makes it easier to get the formatting
correct if you use the emacs editor.
The ns-3 simulator is licensed using the GNU General Public
License. You will see the appropriate GNU legalese at the head of every file
in the ns-3 distribution. Often you will see a copyright notice for
one of the institutions involved in the ns-3 project above the GPL
text and an author listed below.
/* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation; * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The code proper starts with a number of include statements.
#include "ns3/core-module.h" #include "ns3/simulator-module.h" #include "ns3/node-module.h" #include "ns3/helper-module.h"
To help our high-level script users deal with the large number of include files present in the system, we group includes according to relatively large modules. We provide a single include file that will recursively load all of the include files used in each module. Rather than having to look up exactly what header you need, and possibly have to get a number of dependencies right, we give you the ability to load a group of files at a large granularity. This is not the most efficient approach but it certainly makes writing scripts much easier.
Each of the ns-3 include files is placed in a directory called
ns3 (under the build directory) during the build process to help avoid
include file name collisions. The ns3/core-module.h file corresponds
to the ns-3 module you will find in the directory src/core in your
downloaded release distribution. If you list this directory you will find a
large number of header files. When you do a build, Waf will place public
header files in an ns3 directory under the appropriate
build/debug or build/optimized directory depending on your
configuration. Waf will also automatically generate a module include file to
load all of the public header files.
Since you are, of course, following this tutorial religiously, you will already have done a
./waf -d debug configure
in order to configure the project to perform debug builds. You will also have done a
./waf
to build the project. So now if you look in the directory
build/debug/ns-3 you will find the four module include files shown
above. You can take a look at the contents of these files and find that they
do include all of the public include files in their respective modules.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The next line in the first.cc script is a namespace declaration.
using namespace ns3;
The ns-3 project is implemented in a C++ namespace called
ns3. This groups all ns-3-related declarations in a scope
outside the global namespace, which we hope will help with integration with
other code. The C++ using statement introduces the ns-3
namespace into the current (global) declarative region. This is a fancy way
of saying that after this declaration, you will not have to type ns3::
scope resolution operator before all of the ns-3 code in order to use
it. If you are unfamiliar with namespaces, please consult almost any C++
tutorial and compare the ns3 namespace and usage here with instances of
the std namespace and the using namespace std; statements you
will often find in discussions of cout and streams.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The next line of the script is the following,
NS_LOG_COMPONENT_DEFINE ("FirstScriptExample");
We will use this statement as a convenient place to talk about our Doxygen documentation system. If you look at the project web site, ns-3 project, you will find a link to “APIs (Doxygen)” in the navigation bar. If you select this link, you will be taken to our documentation page.
Along the left side, you will find a graphical representation of the structure
of the documentation. A good place to start is the NS-3 Modules
“book.” If you expand Modules you will see a list of ns-3
module documentation. The concept of module here ties directly into the
module include files discussed above. It turns out that the ns-3
logging subsystem is part of the core module, so go ahead and expand
that documentation node. Now, expand the Debugging book and then
select the Logging page.
You should now be looking at the Doxygen documentation for the Logging module.
In the list of #defines at the top of the page you will see the entry
for NS_LOG_COMPONENT_DEFINE. Before jumping in, it would probably be
good to look for the “Detailed Description” of the logging module to get a
feel for the overall operation. You can either scroll down or select the
“More...” link under the collaboration diagram to do this.
Once you have a general idea of what is going on, go ahead and take a look at
the specific NS_LOG_COMPONENT_DEFINE documentation. I won't duplicate
the documentation here, but to summarize, this line declares a logging
component called FirstScriptExample that allows you to enable and
disable console message logging by reference to the name.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The next lines of the script you will find are,
int
main (int argc, char *argv[])
{
This is just the declaration of the main function of your program (script).
Just as in any C++ program, you need to define a main function that will be
the first function run. There is nothing at all special here. Your
ns-3 script is just a C++ program.
The next two lines of the script are used to enable two logging components that are built into the Echo Client and Echo Server applications:
LogComponentEnable("UdpEchoClientApplication", LOG_LEVEL_INFO);
LogComponentEnable("UdpEchoServerApplication", LOG_LEVEL_INFO);
If you have read over the Logging component documentation you will have seen that there are a number of levels of logging verbosity/detail that you can enable on each component. These two lines of code enable debug logging at the INFO level for echo clients and servers. This will result in the application printing out messages as packets are sent and received during the simulation.
Now we will get directly to the business of creating a topology and running a simulation. We use the topology helper objects to make this job as easy as possible.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The next two lines of code in our script will actually create the
ns-3 Node objects that will represent the computers in the
simulation.
NodeContainer nodes;
nodes.Create (2);
Let's find the documentation for the NodeContainer class before we
continue. Another way to get into the documentation for a given class is via
the Classes tab in the Doxygen pages. If you still have the Doxygen
handy, just scroll up to the top of the page and select the Classes
tab. You should see a new set of tabs appear, one of which is
Class List. Under that tab you will see a list of all of the
ns-3 classes. Scroll down, looking for ns3::NodeContainer.
When you find the class, go ahead and select it to go to the documentation for
the class.
You may recall that one of our key abstractions is the Node. This
represents a computer to which we are going to add things like protocol stacks,
applications and peripheral cards. The NodeContainer topology helper
provides a convenient way to create, manage and access any Node objects
that we create in order to run a simulation. The first line above just
declares a NodeContainer which we call nodes. The second line calls the
Create method on the nodes object and asks the container to
create two nodes. As described in the Doxygen, the container calls down into
the ns-3 system proper to create two Node objects and stores
pointers to those objects internally.
The nodes as they stand in the script do nothing. The next step in constructing a topology is to connect our nodes together into a network. The simplest form of network we support is a single point-to-point link between two nodes. We'll construct one of those links here.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
We are constructing a point to point link, and, in a pattern which will become
quite familiar to you, we use a topology helper object to do the low-level
work required to put the link together. Recall that two of our key
abstractions are the NetDevice and the Channel. In the real
world, these terms correspond roughly to peripheral cards and network cables.
Typically these two things are intimately tied together and one cannot expect
to interchange, for example, Ethernet devices and wireless channels. Our
Topology Helpers follow this intimate coupling and therefore you will use a
single PointToPointHelper to configure and connect ns-3
PointToPointNetDevice and PointToPointChannel objects in this
script.
The next three lines in the script are,
PointToPointHelper pointToPoint;
pointToPoint.SetDeviceAttribute ("DataRate", StringValue ("5Mbps"));
pointToPoint.SetChannelAttribute ("Delay", StringValue ("2ms"));
The first line
PointToPointHelper pointToPoint;
instantiates a PointToPointHelper object on the stack. From a
high-level perspective the next line,
pointToPoint.SetDeviceAttribute ("DataRate", StringValue ("5Mbps"));
tells the PointToPointHelper object to use the value “5mbps”
(five megabits per second) as the “DataRate” when it creates a
PointToPointNetDevice object.
From a more detailed perspective, the string “DataRate” corresponds
to what we call an Attribute of the PointToPointNetDevice.
If you look at the Doxygen for class ns3::PointToPointNetDevice and
find the documentation for the GetTypeId method, you will find a list
of Attributes defined for the device. Among these is the “DataRate”
attribute. Most user-visible ns-3 objects have similar lists of
attributes. We use this mechanism to easily configure simulations without
recompiling as you will see in a following section.
Similar to the “DataRate” on the PointToPointNetDevice you will find a
“Delay” attribute associated with the PointToPointChannel. The
final line,
pointToPoint.SetChannelAttribute ("Delay", StringValue ("2ms"));
tells the PointToPointHelper to use the value “2ms” (two milliseconds)
as the value of the transmission delay of every point to point channel it
subsequently creates.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
At this point in the script, we have a NodeContainer that contains
two nodes. We have a PointToPointHelper that is primed and ready to
make PointToPointNetDevices and wire PointToPointChannel objects
between them. Just as we used the NodeContainer topology helper object
to create the Nodes for our simulation, we will ask the
PointToPointHelper to do the work involved in creating, configuring and
installing our devices for us. We will need to have a list of all of the
NetDevice objects that are created, so we use a NetDeviceContainer to hold
them just as we used a NodeContainer to hold the nodes we created. The
following two lines of code,
NetDeviceContainer devices;
devices = pointToPoint.Install (nodes);
will finish configuring the devices and channel. The first line declares the
device container mentioned above and the second does the heavy lifting. The
Install method of the PointToPointHelper takes a
NodeContainer as a parameter. Internally, a NetDeviceContainer
is created. For each node in the NodeContainer (there must be exactly
two for a point-to-point link) a PointToPointNetDevice is created and
saved in the device container. A PointToPointChannel is created and
the two PointToPointNetDevices are attached. When objects are created
by the PointToPointHelper, the attributes previously set in the helper
are used to initialize the corresponding attributes in the created objects.
After executing the the pointToPoint.Install (nodes) call we will have
two nodes, each with an installed point-to-point net device and a
point-to-point channel between them. Both devices will be configured to
transmit data at five megabits per second over the channel which has a two
millisecond transmission delay.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
We now have nodes and devices configured, but we don't have any protocol stacks installed on our nodes. The next two lines of code will take care of that.
InternetStackHelper stack;
stack.Install (nodes);
The InternetStackHelper is a topology helper that is to internet stacks
what the PointToPointHelper is to point-to-point net devices. The
Install method takes a NodeContainer as a parameter. When it is
executed, it will install an Internet Stack (TCP, UDP, IP, etc.) on each of
the nodes in the node container.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Next we need to associate the devices on our nodes with IP addresses. We provide a topology helper to manage the allocation of IP addresses. The only user-visible API is to set the base IP address and network mask to use when performing the actual address allocation (which is done at a lower level inside the helper).
The next two lines of code in our example script, first.cc,
Ipv4AddressHelper address;
address.SetBase ("10.1.1.0", "255.255.255.0");
declare an address helper object and tell it that it should begin allocating IP
addresses from the network 10.1.1.0 using the mask 255.255.255.0 to define
the allocatable bits. By default the addresses allocated will start at one
and increase monotonically, so the first address allocated from this base will
be 10.1.1.1, followed by 10.1.1.2, etc. The low level ns-3 system
actually remembers all of the IP addresses allocated and will generate a
fatal error if you accidentally cause the same address to be generated twice
(which is a very hard to debug error, by the way).
The next line of code,
Ipv4InterfaceContainer interfaces = address.Assign (devices);
performs the actual address assignment. In ns-3 we make the
association between an IP address and a device using an Ipv4Interface
object. Just as we sometimes need a list of net devices created by a helper
for future reference we sometimes need a list of Ipv4Interface objects.
The Ipv4InterfaceContainer provides this functionality.
Now we have a point-to-point network built, with stacks installed and IP addresses assigned. What we need at this point are applications to generate traffic.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Another one of the core abstractions of the ns-3 system is the
Application. In this script we use two specializations of the core
ns-3 class Application called UdpEchoServerApplication
and UdpEchoClientApplication. Just as we have in our previous
explanations, we use helper objects to help configure and manage the
underlying objects. Here, we use UdpEchoServerHelper and
UdpEchoClientHelper objects to make our lives easier.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The following lines of code in our example script, first.cc, are used
to set up a UDP echo server application on one of the nodes we have previously
created.
UdpEchoServerHelper echoServer (9);
ApplicationContainer serverApps = echoServer.Install (nodes.Get (1));
serverApps.Start (Seconds (1.0));
serverApps.Stop (Seconds (10.0));
The first line of code in the above snippet declares the
UdpEchoServerHelper. As usual, this isn't the application itself, it
is an object used to help us create the actual applications. One of our
conventions is to place required attributes in the helper constructor. In this
case, the helper can't do anything useful unless it is provided with a port
number that the client also knows about. Rather than just picking one and
hoping it all works out, we require the port number as a parameter to the
constructor. The constructor, in turn, simply does a SetAttribute
with the passed value. You can, if desired, set the “Port” attribute to
another value later.
Similar to many other helper objects, the UdpEchoServerHelper object
has an Install method. It is the execution of this method that actually
causes the underlying echo server application to be instantiated and attached
to a node. Interestingly, the Install method takes a
NodeContainter as a parameter just as the other Install methods
we have seen. This is actually what is passed to the method even though it
doesn't look so in this case. There is a C++ implicit conversion at
work here.
We now see that echoServer.Install is going to install a
UdpEchoServerApplication on the node found at index number one of the
NodeContainer we used to manage our nodes. Install will return
a container that holds pointers to all of the applications (one in this case
since we passed a NodeContainer containing one node) created by the
helper.
Applications require a time to “start” generating traffic and may take an
optional time to “stop.” We provide both. These times are set using the
ApplicationContainer methods Start and Stop. These
methods take Time parameters. In this case, we use an explicit C++
conversion sequence to take the C++ double 1.0 and convert it to an
ns-3 Time object using a Seconds cast. The two lines,
serverApps.Start (Seconds (1.0));
serverApps.Stop (Seconds (10.0));
will cause the echo server application to Start (enable itself) at one
second into the simulation and to Stop (disable itself) at ten seconds
into the simulation. By virtue of the fact that we have implicilty declared
a simulation event (the application stop event) to be executed at ten seconds,
the simulation will last at least ten seconds.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The echo client application is set up in a method substantially similar to
that for the server. There is an underlying UdpEchoClientApplication
that is managed by an UdpEchoClientHelper.
UdpEchoClientHelper echoClient (interfaces.GetAddress (1), 9);
echoClient.SetAttribute ("MaxPackets", UintegerValue (1));
echoClient.SetAttribute ("Interval", TimeValue (Seconds (1.)));
echoClient.SetAttribute ("PacketSize", UintegerValue (1024));
ApplicationContainer clientApps = echoClient.Install (nodes.Get (0));
clientApps.Start (Seconds (2.0));
clientApps.Stop (Seconds (10.0));
For the echo client, however, we need to set five different attributes. The
first two attributes are set during construction of the
UdpEchoClientHelper. We pass parameters that are used (internally to
the helper) to set the “RemoteAddress” and “RemotePort” attributes in
accordance with our convention to make required attributes parameters in the
helper constructors.
Recall that we used an Ipv4InterfaceContainer to keep track of the IP
addresses we assigned to our devices. The zeroth interface in the
interfaces container is going to coorespond to the IP address of the
zeroth node in the nodes container. The first interface in the
interfaces container cooresponds to the IP address of the first node
in the nodes container. So, in the first line of code (from above), we
are creating the helper and telling it so set the remote address of the client
to be the IP address assigned to the node on which the server resides. We
also tell it to arrange to send packets to port nine.
The “MaxPackets” attribute tells the client the maximum number of packets we allow it to send during the simulation. The “Interval” attribute tells the client how long to wait between packets, and the “PacketSize” attribute tells the client how large its packet payloads should be. With this particular combination of attributes, we are telling the client to send one 1024-byte packet.
Just as in the case of the echo server, we tell the echo client to Start
and Stop, but here we start the client one second after the server is
enabled (at two seconds into the simulation).
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
What we need to do at this point is to actually run the simulation. This is
done using the global function Simulator::Run.
Simulator::Run ();
When we previously called the methods,
serverApps.Start (Seconds (1.0));
serverApps.Stop (Seconds (10.0));
...
clientApps.Start (Seconds (2.0));
clientApps.Stop (Seconds (10.0));
we actually scheduled events in the simulator at 1.0 seconds, 2.0 seconds and
10.0 seconds. When Simulator::Run is called, the system will begin
looking through the list of scheduled events and executing them. First it
will run the event at 1.0 seconds, which will enable the echo server
application. Then it will run the event scheduled for t=2.0 seconds which
will start the echo client application. The start event implementation in
the echo client application will begin the data transfer phase of the
simulation by sending a packet to the server.
The act of sending the packet to the server will trigger a chain of events that will be automatically scheduled behind the scenes and which will perform the mechanics of the packet echo according to the various timing parameters that we have set in the script.
Eventually, since we only send one packet, the chain of events triggered by
that single client echo request will taper off and the simulation will go
idle. Once this happens, the remaining events will be the Stop events
for the server and the client. When these events are executed, there are
no further events to process and Simulator::Run returns. The simulation
is complete.
All that remains is to clean up. This is done by calling the global function
Simulator::Destroy. As the helper functions (or low level
ns-3 code) executed, they arranged it so that hooks were inserted in
the simulator to destroy all of the objects that were created. You did not
have to keep track of any of these objects yourself — all you had to do
was to call Simulator::Destroy and exit. The ns-3 system
took care of the hard part for you. The remaining lines of our first
ns-3 script, first.cc, do just that:
Simulator::Destroy ();
return 0;
}
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
We have made it trivial to build your simple scripts. All you have to do is
to drop your script into the scratch directory and it will automatically be
built if you run Waf. Let's try it. Copy examples/first.cc into
the scratch directory.
~/repos/ns-3-dev > cp examples/first.cc scratch/
and then build it using waf,
~/repos/ns-3-dev > ./waf Entering directory `/home/craigdo/repos/ns-3-dev/build' [467/511] cxx: scratch/first.cc -> build/debug/scratch/first_1.o [468/511] cxx: scratch/multiple-sources/simple-main.cc -> build/debug/scratch/multiple-sources/simple-main_2.o [469/511] cxx: scratch/multiple-sources/simple-simulation.cc -> build/debug/scratch/multiple-sources/simple-simulation_2.o [470/511] cxx: scratch/simple.cc -> build/debug/scratch/simple_3.o [508/511] cxx_link: build/debug/scratch/first_1.o -> build/debug/scratch/first Compilation finished successfully ~/repos/ns-3-dev >
You can now run the example (note that if you build your program in the scratch directory you must run it out of the scratch direcory):
~/repos/ns-3-dev > ./waf --run scratch/first Entering directory `/home/craigdo/repos/ns-3-dev/build' Compilation finished successfully Sent 1024 bytes to 10.1.1.2 Received 1024 bytes from 10.1.1.1 Received 1024 bytes from 10.1.1.2 ~/repos/ns-3-dev >
Here you see that the build system checks to make sure that the file has been build and then runs it. You see the logging component on the echo client indicate that it has sent one 1024 byte packet to the Echo Server on 10.1.1.2. You also see the logging component on the echo server say that it has received the 1024 bytes from 10.1.1.1. The echo server silently echoes the packet and you see the echo client log that it has received its packet back from the server.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Now that you have used some of the ns-3 helpers you may want to
have a look at some of the source code that implements that functionality.
The most recent code can be browsed on our web server at the following link:
http://code.nsnam.org/?sort=lastchange. If you click on the bold
repository names on the left of the page, you will see changelogs for
these repositories, and links to the manifest. From the manifest
links, one can browse the source tree.
The top-level directory for one of our repositories will look something like:
drwxr-xr-x [up] drwxr-xr-x doc manifest drwxr-xr-x examples manifest drwxr-xr-x ns3 manifest drwxr-xr-x regression manifest drwxr-xr-x samples manifest drwxr-xr-x scratch manifest drwxr-xr-x src manifest drwxr-xr-x tutorial manifest drwxr-xr-x utils manifest -rw-r--r-- 135 .hgignore file | revisions | annotate -rw-r--r-- 891 .hgtags file | revisions | annotate -rw-r--r-- 441 AUTHORS file | revisions | annotate -rw-r--r-- 17987 LICENSE file | revisions | annotate -rw-r--r-- 4948 README file | revisions | annotate -rw-r--r-- 4917 RELEASE_NOTES file | revisions | annotate -rw-r--r-- 7 VERSION file | revisions | annotate -rwxr-xr-x 99143 waf file | revisions | annotate -rwxr-xr-x 28 waf.bat file | revisions | annotate -rw-r--r-- 30584 wscript file | revisions | annotate
The source code is mainly in the src directory. You can view source
code by clicking on the manifest link to the right of the directory
name. If you click on the manifest link to the right of the src
directory you will find a subdirectory. If you click on the manifest
link next to the core subdirectory in under src, you will find
a list of files. The first file you will find is assert.h. If you
click on the file link, you will be sent to the source file for
assert.h.
Our example scripts are in the examples directory. The source code for
the helpers we have used in this chapter can be found in the
src/helpers directory.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| 5.1 Using the Logging Module | ||
| 5.2 Using Command Line Arguments | ||
| 5.3 Using the Tracing System |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [ |