Sunday, June 5, 2016

Introduction

Purpose of This Document

        This document gives readers the comprehensive information of DTN from its architectures to how to implement its functions. The document also try to explain all technical term in informal language so that all readers can understand the document and apply it easily.

Scope of the Project

        The first phase of this project is to install, run, and demos the implementation of DTN. The next phase is understand the architecture of DTN. The third phase is apply DTN in practical environment by writing one application or module to demonstrate how to use DTN. The final phase is improve DTN by optimizing it.

Definition, Acronyms, Abbreviation

DTN - Delay Tolerant Networking
CGR - Contact Graph Routing
TCP/IP - Transmission Control Protocol/Internet Protocol

Description

        Space communication is one of the challenges in deep space exploration missions. With long transmission time, long delay and the low rate of continuity in space connectivity, the possibility of losing data on space communication link is very high. One of the ways to reduce data loss rate is to hold the data or, in other word, keep a copy of data in the sender’s storage and wait for the next available transmission. This does not only waste time, the very valuable memory and storage resources but also increase the limited level of energy use in a space device. These characteristics of space communication results to the difficulty of using the existing on-Earth communication techniques and protocols such as TCP/IP which needs short delay, continuous connectivity and only stores network information at end nodes. With these issues of space communication, Delay Tolerant Networking (DTN) is structured and designed to resolve the problems. Instead of knowing only network’s topology and a list of all known connections between nodes like TCP/IP, DTN also needs additional information and features such as speed of each connection and each node’s storage capacity which allows DTN network to hold data if the next hop is not available.
        Contact Graph Routing (CGR) is one of the routing space method that is used in DTN with the goal of increasing the probability of bundle delivery and reducing the delivery delay. CGR algorithm computes an effective path to route data through a dynamic topology basing on the complete knowledge network information. The complete accurate state network information is extracted from space flight communication operations, and with this advance, CGR can compute a routing path using the perfect information instead of discovering the network via dialogue. However, routing basing on the perfect information is not always a good approach for future and deep space exploration which needs high data rate, highly automated, and the flexibility of adapting to imperfect knowledge network system. Increasing the capacity of CGR to work in various information level network system does not only lead to a united DTN routing approach but also increases the speed of space network development by applying divide and conquer strategy to decompose the network into regions and using an appropriate method for each regions of the network. Furthermore, because of using knowledge of future connectivity, the contact graph data can grow very quickly. Enhancing the processing efficiency of CGR and reducing the complexity of the route computation will allow CGR adapt to future space network complexities as well.

DTN2 Installation

        This installation is performed on Ubuntu 14.04.3 LTS with GNU/Linux 3.19.0-47-generic 0x86_64.
Before installing dtn2.2.9, we need to install tk, tcl, oasys, and gcc. Ubuntu has gcc built-in, so we need only to install tk, tcl, and oasys.

Download and Install TCL

$ wget http://downloads.sourceforge.net/project/tcl/Tcl/8.5.19/tk8.5.19-src.tar.gz
$ wget http://downloads.sourceforge.net/project/tcl/Tcl/8.5.19/tcl8.5.19-src.tar.gz
Uncompress TCL
$ tar -zxvf tcl8.5.19-src.tar.gz
Change home directory to tcl8.5.19/unix, and then run the following commands:
$ ./configure
$ make
$ sudo make install
$ make test

Download and Install TK

Installing TK at the first time will have an error that the system does not find X11, so we need to install it first.
$ sudo apt-get install libx11-dev
Uncompress TK
$ tar -zxvf tk8.5.19-src.tar.gz
Change home directory to tk8.5.19/unix, and then run the following commands
$ ./configure
$ make
$ sudo make install

Download and install oasys-1.6.0

$ wget http://downloads.sourceforge.net/project/dtn/oasys/oasys-1.6.0/oasys-1.6.0.tgz
$ tar xvzf oasys-1.6.0.tgz
Go to oasys folder then type the following commands
$ sudo apt-get install g++
$ ./configure --without-db
$ make
$ sudo make install

Download and install DTN2

$ wget http://downloads.sourceforge.net/project/dtn/DTN2/dtn-2.9.0/dtn-2.9.0.tgz
$ tar xvzf dtn-2.9.0.tgz
Go to the uncompressed folder dtn-2.9.0
$ ./configure --disable-edp --disable-ecl
$ make
$ sudo make install
$ make test

Download and install Berkeley DB and SQLite3

        This is just options. In order to install SQLite3, we just type sqlite3 in terminal. If the OS did not have this yet, it will show the command that is used to install the SQLite3.
In order to install Berkeley DB, typing
$ sudo apt-get install libdb6.0-dev

Configuration and Testing

Staring dtnd and sending a ping

I use hostname home-world, and the user directory  /home/home. You can use pwd command to check the user directory and hostname command to check the hostname.
from home directory
$ mkdir dtn
$ cd dtn
$ cp ~/dtn-2.9.0/daemon/dtn.conf .
$ mkdir db bundles
Open the file dtn.conf in ~/dtn folder and then modify it.





$ dtn-2.0.0/daemon/dtnd -c ~/dtn/dtn.conf --init-db
$ dtn-2.0.0/daemon/dtnd -c ~/dtn/dtn.conf
Open new terminal and run the command
$ cd dtn-2.0.0/apps/dtnping
$ ./dtnping localhost

Send and Receive Message Using dtnsend and dtnrecv

dtnsend is used to create a bundle and send it across DTN
dtnrecv picks up bundle ONLY  on local node. dtnrecv can know local eid for the local dtnd by asking local server. dtnrecv continues to run until Ctrl-C.
$ dtn-2.0.0/daemon/dtnd -c ~/dtn/dtn.conf
Open new terminal and run the command
$ cd ./dtn-2.9.0/apps
$ dtnsend -s dtn://home-world.dtn/me -d dtn://home-world.dtn/testing -t m -p "testing"
send a message (type)  with payload string data "testing" to destination from source
Check: come back to terminal which is running daemon dtn
dtn% bundle list
$ cd ~/dtn/bundles
$ vi bundle_884.dat
$ cd ~/dtn-2.9.0/apps
$ dtnrecv dtn://home-world.dtn/testing
Ctrl-C to exit
dtn% bundle list
It shows nothing. The server held the bundle and wait util  the delivery of bundle to the endpoint completes (difference from TCP and UDP which never keep track packets).
File is copied into bundle folder when using dtnd even though the file is big. 

Set Up for Two Computers with DTN2 Communicate to Each Other

Currently cannot do that because we don't have many PC for that. The temporary solution is using virtual machine.
We will come back this configuratiion later.

List of Commands in dtnd Daemon

After running dtnd daemon, we can interact and configure the daemon by using its commands. One of the commands is bundle list that we used so far (dtn% bundle list) . To learn all the present commands, use help command like


dtn% help bundle

 bundleconsole     debugdiscovery ecla gettimeofday
 helpinterface link log param prophet
 quitregistration route shutdown storage test

Architecture of DTN2

  1. Bundle router and bundle forwarder
  2. Convergence layers
         like drivers in OS
  3. Persistent store
         hold contents during store-and-forward process
  4. Fragmentation module
         divide bundle fragments and combine them back
  5. Contact manager
         keep track information of past/current/future connection/performance
  6. Management Interface
         signal to bundle router
  7. Console/Config
         terminals and module of testing/debugging
  8. Application IPC/Registration module
         talk with router by message

DTN2 API and Utility Functions

  • open a new connection to the router
  • close an open dtn handle
  • get/set the error associated with the given handle
  • build a local endpoitn id
  • create/remove a dtn registration
  • check/modify for an existing registration
  • associate a registration with the current ipc channel
  • explicitly remove an association from the current ipc handle
  • send a bundle
  • cancel a bundle transmission
  • blocking receive for a bundle
  • blocking query for new subsribers on a session
  • return a file descriptor for the given handle
  • begin a polling period for incoming bundles
  • cancel a polling interval
  • copy the contents of one eid into another
  • parse a string into an endpoint id structure
  • set the value of the given payload structure
  • free dynamic storage
  • return a string version of a status report reason code

Build Simple Examples

Hello World Without Argument

in apps folder, create a subfolder called helloworld, then create a file named helloworld.c


$ mkdir /dtn-2.9.0/apps/helloworld
$ cd ~/dtn-2.9.0/apps/helloworld
$ touch helloworld.c
using vim or any editor to edit the content of the helloworld.c
    #include<stdio.h>
main()
{
    printf("Hello World\n");
    return 0;
}
open the apps/Makefile and add the additional information for helloworld program.
OTHER_APPS :=                \
    dtnmoteproxy/dtnmoteproxy    \
    dtntest/dtntest            \
    dtntunnel/dtntunnel        \
    dtnperf/dtnperf-client        \
    tca_admin/tca_admin        \
    dtnsend/dtnsend            \
    dtnsource/dtnsource        \
    num2sdnv/sdnv2num        \
    helloworld/helloworld    \
Then recompile the dtn by using make command. It will compile the new helloworld program.
$ cd ~/dtn-2.9.0
$ make
$ ~/dtn-2.9.0/apps/helloworld

Hello World With Argument

We can modify helloworld.c the code to receive arguments and output arguments.
#include<stdio.h>

int main(int argc, const char** argv)
{
    int i  = 0;
    printf("Hello World\n");
    printf("Number of argument: %d\n", argc);
    for(; i < argc; i++)
    {
        printf("the %dth argument is %s\n", i+1, argv[i]);
    }
    return 0;
}
Then recompile the dtn by using make command. It will compile the new helloworld program.
$ cd ~/dtn-2.9.0
$ make
$ ~/dtn-2.9.0/apps/helloworld

Hello World With Options

We can modify helloworld.c the code to receive options and arguments.
#include<stdio.h>
#include <getopt.h>
#include "dtn_types.h"

const char *progname;

int expiration = 30;
int wait_after_done = 0;
char replyto_eid_str[DTN_MAX_ENDPOINT_ID] = "";
char register_eid_str[DTN_MAX_ENDPOINT_ID] = "";

void usage()
{
    fprintf(stderr, "usage: %s [-o output] [-i input] [-c number of argument] [-l list of argument]\n",
            progname);
    exit(1);
}
void doOptions(int argc, const char **argv);
void input(int argc, const char** argv);
void output(int argc, const char** argv);
void numberOfArgument(int argc, const char** argv);
void listOfArgument(int argc, const char** argv);


int main(int argc, const char** argv)
{
    doOptions(argc, argv);
    return 0;

}

void doOptions(int argc, const char **argv)
{
    int c;
    progname = argv[0];
    while ( (c=getopt(argc, (char **) argv, "o:i:h:l:c:")) !=EOF ) {
        switch (c) {
        case 'i':
            input(argc,argv);
            break;
        case 'o':
            output(argc,argv);
            break;   
        case 'c':
            numberOfArgument(argc,argv);
            break;
        case 'l':
           listOfArgument(argc,argv);
            break;
        case 'h':
            usage();
            break;
        default:
            break;
        }
    }

}
void input(int argc, const char** argv)
{
    int i  = 0;
    for(; i < argc; i++)
    {
        printf("the %dth input is %s\n", i+1, argv[i]);
    }
   
}
void output(int argc, const char** argv)
{
    printf("output\n");
}
void numberOfArgument(int argc, const char** argv)
{
    printf("Number of argument: %d\n", argc);
}

void listOfArgument(int argc, const char** argv)
{
    input(argc,argv);
}
Then recompile the dtn by using make command. It will compile the new helloworld program.
$ cd ~/dtn-2.9.0
$ make
$ cd ~/dtn-2.9.0/apps/helloworld
          $ ./helloworld -h
          $ ./helloworld -c hello world
          $ ./helloworld -i hello
          $ ./helloworld -o world
          $ ./helloworld -l hello world

Continue.