Getting started with coding

Contents

Windows note

For Windows users it is recommended to compile and install everything inside a MinGW + MSYS environment.

The environment

Most developers are using Code::Blocks as their editor. In the Mercurial repository you'll find a Code::Blocks project file. However, you'll need to compile and run Net Responsibility in a regular terminal. This is because several steps in the installation process don't run if built and run through Code::Blocks. There is no need to use Code::Blocks, since you're able to edit any file in your favorite text editor.

Get all libraries

POCO

Net Responsibility heavily relies on the POCO C++ libraries. The first thing to do is download and install Poco. Note that the version needs to be 1.4 or later. Start by downloading the complete edition. Unpack it and open a terminal. Use cd to go to the directory you unpacked Poco to. There you configure, compile and install. The procedure should look like this:

cd poco-*
./configure --shared --no-tests --no-samples
make
sudo make install

More information on installing Poco may be found here in this tutorial.

Libpcap

When you've installed the Poco libs, you also need libpcap. Many systems either have it installed by default, or provide packages for libpcap. Note that you'll need the developer's package. It is usually called libpcap-dev.

Mercurial and BitBucket: Joining the development team

We use the Mecurial distributed version control system (DVCS) to manage our code development, and we host our code repository (repo) at BitBucket. In order to contribute to development, you will need to have Mercurial installed on your system and have a BitBucket account (individual, not team). If you are unfamiliar with Mercurial, this basic tutorial will help you get started with it. If you're new to BitBucket, you will find this guide helpful. For those interested in a graphical interface, we recommend TortoiseHG.

One of the advantages of a DVCS like Mercurial is an easy and reliable system for creating branches off of the main repo and then later submitting those changes back to the main repo, which provides more freedom and flexibility in development. An advantage of BitBucket is that you can also fork a repo, which also gives more flexibility. We recommend that NR developers use BitBucket to fork a repo, and then clone that forked repo to their systems to serve as a local repo. To create a fork, log in to BitBucket, go to the NR repo page, click on the 'Fork' button, and enter the necessary information, etc. to complete the process. Once you've done that, here is a sample of the terminal command you would use (from within the desired directory) to clone your new fork to your local system (you will need to replace <path/to/forked/repo> with whatever the path is to your forked repo on BitBucket):

hg clone <path/to/forked/repo>

If you are on the BitBucket page of your forked repo, you can also just click on the 'Clone' button and copy the command from the window that opens.

Compile Net Responsibility

Once you have your own local repo, you can compile NR itself by running this make-chain:

cd /local/repo/directory
autoreconf -i
./configure
make
sudo make install

In the last step you will also be prompted to type your NR username and password, if it's the first time you install. Note that you'll need autoreconf and libtool installed.

If you got this far Net Responsibility should be installed. As an initial test of a successful installation, when running "ps -ef|grep net-responsibility" you should get an output line similar to "net-responsibility —daemon". If you need to do further testing, see this guide.

Understanding the program structure

The program's structure is described in another guide. It is recommended to read it to understand the concepts and different steps Net Responsibility is built around.

Where to start digging

Now you're ready for the fun part — the coding. The two main areas to lay your hands on are bugs and feature requests. You'll find both of these in our issue tracker. Grab a bug that sounds interesting and provide a solution, or see if there's any feature requests you'd like to implement. If you'd rather work on something that is not listed, please create a new issue about it, and a note that you're working on it. When you try to access the issue tracker, your browser may display a security warning. You can safely ignore this and grant a permanent security exception. For more info, see this FAQ entry. Anyone can view the contents of the issue tracker, but in order to create a new issue you will need to sign in with your NR user login information. The first time you do this, you may need to give some basic additional information in order to gain access. Also, even if you're already logged in to the general NR website itself, you may still need to log in to the issue tracker area of the website.

Submit source code changes

When you've created a solution or implemented a new feature, you don't want to keep it for yourself, do you? One of the best things with open source projects is the ability to contribute. For more information about how to submit your changes, see the Repository Management guide.