Ns3DevIntro
From Iptechwiki
Here is a list of steps that we suggest to follow in order to get started with ns-3 development.
Contents |
Before we start
Operating system
If possible, it is much easier to just have a PC with linux installed. We know that both Ubuntu and Fedora work like a charm with ns-3. If you don't know which one to choose, go for ubuntu.
Make sure you installed all the required packages.
In any case, we expect that the majority of linux distribution will work with ns-3 without significant problems.
If you really can't move away from windows, then you can use a virtual machine. Here's a tutorial for this.
Mercurial
It is technically possible download the ns-3 code as a tarball, and work with it, but we strongly advise against that. If you are going to modify/develop ns-3 code, sooner or later you would probably like to update to a new ns-3 release, and doing that with tarballs is a waste of time. Mercurial is the way to go. There are mercurial repositories for stable ns-3 releases, so you get exactly the same code you would get with tarballs, with the benefit of a version control system (e.g., updating to a new ns-3 release becomes very easy). Furthermore, only with mercurial you can follow ns-3-dev, i.e., the cutting-edge develpment version, as well as the several experimental branches that are out there.
So just learn how to use mercurial. There are tons of tutorial on mercurial, we suggest this one. We especially like its Subversion reeducation section for SVN users. Believe what they say, it's true!
Editor
If you don't have any prior preference about the editor to use for ns-3 development, we recommend Eclipse.
You need a particular Eclipse configuration in order to be able to build ns-3. We wrote a document explaining how to setup Eclipse for this purpose.
Alternative, you can also read the Eclipse howto on the ns-3 wiki.
ns-3 tutorial
Follow this tutorial to get a first grasp on ns-3 from a user perspective. http://www.nsnam.org/docs/tutorial.html
Getting into development
Coding style
First, make sure you carefully read the ns-3 coding style specification. And remember to follow it afterwards!
Also learn how to use the check-style.py script. Try running:
utils/check-style.py --help
to learn how to automatically fix the indentation of your code.
Development HOWTOs
We suggest to try out the following HOWTOs in order to get familiar with ns-3 development:
- How to create a new protocol header
- How to create a new device model (channel + PHY + MAC)
- How to create a new application
More HOWTOs here:
