Difference between revisions of "SOCIS2013BundleProtocolProject"

From Nsnam
Jump to: navigation, search
(Usage)
 
(6 intermediate revisions by the same user not shown)
Line 24: Line 24:
 
The rectangle area represents the main classes of BP in NS-3.  
 
The rectangle area represents the main classes of BP in NS-3.  
  
# BundleProtocol class implements several BP APIs to applications, such as Register (), Open (), Bind () and so on. Applications can use these APIs to transmit bundles between bundle nodes.
+
# BundleProtocol class implements several BP APIs to applications, such as Register (), Open (), Bind () and so on. Applications can use these APIs to transmit bundles between bundle nodes. The name and functions of these APIs are referenced from a Linux bundle protocol implementation -- [http://www.dtnrg.org/wiki/Code DTN2]. The other functions implemented in the BundleProtocol class include bundle fragmentation and aggregation, bundle storage and registration storage;
# BpClaProtocol class is a pure abstract class for convergence layer adaptor (CLA). For each transport layer protocol, a new CLA class needs to be inherited from BpClaProtocol. In the existing version, only BpTcpClaProtocol is implemented. It uses TCP socket in the transport layer to transmit bundles.
+
# BpClaProtocol class is a pure abstract class for convergence layer adaptor (CLA). For each transport layer protocol, a new CLA class needs to be inherited from BpClaProtocol. In the existing implementation, only BpTcpClaProtocol is implemented. It uses TCP socket in the transport layer to transmit bundles;
# BpRoutingProtocol class is a pure abstract class, which defines the APIs of bundle routing protocol. In the existing version, only BpStaticRoutingProtocol is implemented, which uses a static map between local endpoint id and internet socket address.
+
# BpRoutingProtocol class is a pure abstract class, which defines the APIs of bundle routing protocol. In the existing implementation, only BpStaticRoutingProtocol is implemented, which uses a static map between local endpoint id and internet socket address.
  
In the existing implementation, multiple bundles can be transmitted between two bundle nodes, which are connected directly by p2p link.
+
In addition to above three core classes, the NS-3 bundle protocol model also includes classes:
 +
 
 +
# BundleProtocolHelper and BundleProtocolContainer classes, which are implemented to facilitate users to create a bundle node. Then endpoint id data structure is supported at a BpEndpointId class;
 +
# BpEndpointId, which implements the endpoint id data structure for bundle protocol;
 +
# BpHeader, which implements the primary bundle header in RFC 5050.
 +
# BpPayloadHeader, which implements the bundle payload header in RFC 5050.
  
 
= Bundle protocol APIs =
 
= Bundle protocol APIs =
In this section, we introduce BP APIs supported by BP in NS-3.  
+
Bundle protocol APIs are called by applications.
  
 
== Open () ==
 
== Open () ==
Line 46: Line 51:
  
 
== Send () ==
 
== Send () ==
Send a bundle from the source endpoint id to the destination endpoint id. The bundle will be stored in the persistent bundle storage in BundleProtocol first. When the first bundle is sent by the source endpoint id, the BpClaProtocol establishes the transport layer connection with peer bundle node. Once the transport layer connection is available, the BpClaProtocol will retrieve the bundle in a FIFO order from the storage and then send it.
+
This method is called by applications to send a application data unit (ADU) from the source endpoint id to the destination endpoint id. If the ADU size is larger than the bundle size, ADU is divided into several bundles while each bundle includes a primary bundle header and a bundle payload header. The bundle will be stored in the persistent bundle storage in BundleProtocol first. Then the BpClaProtocol establishes the transport layer connection with peer bundle node. Once the transport layer connection is available, the BpClaProtocol will retrieve and send the bundle by a FIFO order from the storage.  
  
 
== Receive () ==
 
== Receive () ==
Applications can use this API to get bundles stored from storage in a FIFO order.
+
Application can use this API to get bundles stored from storage in a FIFO order. The bundle headers are removed before forwarding bundles to the application.
  
 
== BuildBpEndpointId () ==
 
== BuildBpEndpointId () ==
Build an endpoint id for a registration. In BP of NS-3, each registration has a unique endpoint id. a BundleProtocol calss can be served for multiple registrations in a bundle node.
+
Build an endpoint id based on scheme and ssp strings. In BP of NS-3, each registration has a unique endpoint id. a BundleProtocol calss can be served for multiple registrations in a bundle node.
 +
 
 +
== SetBpEndpointId () ==
 +
Users build an endpoint id and set the endpoint id to the bundle protocol.
  
 
=Usage=
 
=Usage=
  
 
An example script in src/bundle-protocol/examples is created to show the usage of these APIs. In this section, we show a sample code for registering an application in a bundle node to send bundles.
 
An example script in src/bundle-protocol/examples is created to show the usage of these APIs. In this section, we show a sample code for registering an application in a bundle node to send bundles.
 
+
   
    Ptr<BundleProtocol> sender = CreateObject<BundleProtocol> ();  // create a bundle protocol
+
  BpEndpointId eidSender ("dtn", "node0");   // build an endpoint id
    sender->Open (nodes.Get (0)); // install this bundle protocol in a node and install cla into this bundle protocol
+
  BundleProtocolHelper bpSender (eidSender); // create a bundle protocol helper
    BpEndpointId src = sender->BuildBpEndpointId ("dtn","node0"); // get an endpoint id: dtn:node0
+
  bpSender.SetRoutingProtocol (route);       // set the bundle routing protocol
    struct registerInfo info; // create registration information
+
  bpSender.SetRegisterInfo (info);            // set the registration information
    info.lifetime = 10;
+
  BundleProtocolContainer senders = bpSender.Install (nodes.Get (0));  // the bundle protocol helper calls
    info.state = false;
+
                                                                        // following BP APIs: Open (),  
    sender->Register (src, info); // register this endpoint id to the bundle protocol
+
                                                                        // SetBpEndpointId (), Register (), Bind ();
    sender->Bind (src);            // set the registration of endpoint id src to active state.  
+
  Ptr<BundleProtocol> sender = senders.Get (0);
                                  // So far, the sender can receive bundles from other nodes.
+
    sender->SetRoutingProtocol (routing); // set the routing protocol for this bundle node
+
 
     sender->Send (packet, src, dst);      // send the packet from endpoint id src to endpoint id dst.  
 
     sender->Send (packet, src, dst);      // send the packet from endpoint id src to endpoint id dst.  
 
                                           // The src and dst will be transferred into internet socket address
 
                                           // The src and dst will be transferred into internet socket address
Line 76: Line 82:
 
* S1: functions to make sure the bundle can be sent from sender to receiver, node structure, send/receive/forward, static routing, naming syntax.  
 
* S1: functions to make sure the bundle can be sent from sender to receiver, node structure, send/receive/forward, static routing, naming syntax.  
 
* S2: control functions for custody transfer, custody signal in AA.  
 
* S2: control functions for custody transfer, custody signal in AA.  
* S3: error control signals: bundle status report.
 
 
= Milestones  =
 
This project aims to achieve following milestones:
 
# Send and receive a single bundle between two directly connected bundle nodes.
 
# Send and receive multiple bundles between two directly connected bundle nodes.
 
# Custody support
 
  
 
= Plan =
 
= Plan =

Latest revision as of 20:11, 8 December 2013

Bundle Protocol

  • Student: Dizhi Zhou
  • Mentors: : Tommaso Pecorella, Luca Simone Ronga
  • Abstract: this project aims to implement the bundle protocol (BP) in NS-3 which includes the bundle node structure and basic function of BP protocol. It is designed to support BP in IETF and CCSDS standard. First, the bundle node is the node installing bundle layer between application layer and transport layer in NS-3. The bundle node structure in this project is designed to be easily run on varied transport layer protocols and provides a unified socket interface to applications. Second, the basic functions of BP protocol are divided into three parts in this project: bundle transmission operations, custody signal support and bundle status report support(optional). This project also includes the test suites and documentations in BP.
  • Code: the code can be found in here
  • About me: I'm a Ph.D. student in the University of New Brunswick, Canada. My research interests include Multipath TCP (MPTCP) in cooperative wireless network and network simulation. You can find more information about my research in website or LinkedIn.

Protocol structure

In NS-3, the bundle protocol (BP) can be seen as a special application, which provides transport layer services to other applications in a delay-tolerant network. The structure of BP in NS-3 is shown below:

        applications
             |
     -----------------------------------------
    |        |                                |
    |  BundleProtocol                         |
    |        |                                |
    |  BpClaProtocol   ---- BpRoutingProtocol |
    |        |                                |
     -----------------------------------------
             |
          Sockets                              

The rectangle area represents the main classes of BP in NS-3.

  1. BundleProtocol class implements several BP APIs to applications, such as Register (), Open (), Bind () and so on. Applications can use these APIs to transmit bundles between bundle nodes. The name and functions of these APIs are referenced from a Linux bundle protocol implementation -- DTN2. The other functions implemented in the BundleProtocol class include bundle fragmentation and aggregation, bundle storage and registration storage;
  2. BpClaProtocol class is a pure abstract class for convergence layer adaptor (CLA). For each transport layer protocol, a new CLA class needs to be inherited from BpClaProtocol. In the existing implementation, only BpTcpClaProtocol is implemented. It uses TCP socket in the transport layer to transmit bundles;
  3. BpRoutingProtocol class is a pure abstract class, which defines the APIs of bundle routing protocol. In the existing implementation, only BpStaticRoutingProtocol is implemented, which uses a static map between local endpoint id and internet socket address.

In addition to above three core classes, the NS-3 bundle protocol model also includes classes:

  1. BundleProtocolHelper and BundleProtocolContainer classes, which are implemented to facilitate users to create a bundle node. Then endpoint id data structure is supported at a BpEndpointId class;
  2. BpEndpointId, which implements the endpoint id data structure for bundle protocol;
  3. BpHeader, which implements the primary bundle header in RFC 5050.
  4. BpPayloadHeader, which implements the bundle payload header in RFC 5050.

Bundle protocol APIs

Bundle protocol APIs are called by applications.

Open ()

The Open () API installs the BundleProtocol and BpClaProtocol classes into a bundle node. Open () is always the first API needed to be called.

Register ()

Register () API adds an entry in the persistent registration storage. A registration in BP is identified by an endpoint id, which can be get by BuildBpEndpointId () API. If the state field in the register information is "true" (active state), which means that this application desires to receive bundles, Register () triggers the BpClaProtocol to enable a transport layer connection to receive packet (e.g., listen state in TCP).

Unregister ()

Unregister () triggers the convergence layer(CLA) to disable the transport layer to receive packets. For example, BpTcpClaProtocol will be called by Unregister to close the tcp connection.

Bind ()

Bind () APIs set the registration state of the local endpoint id to "true". If the state in Register () is "true" already, Bind () does nothing in this case.

Send ()

This method is called by applications to send a application data unit (ADU) from the source endpoint id to the destination endpoint id. If the ADU size is larger than the bundle size, ADU is divided into several bundles while each bundle includes a primary bundle header and a bundle payload header. The bundle will be stored in the persistent bundle storage in BundleProtocol first. Then the BpClaProtocol establishes the transport layer connection with peer bundle node. Once the transport layer connection is available, the BpClaProtocol will retrieve and send the bundle by a FIFO order from the storage.

Receive ()

Application can use this API to get bundles stored from storage in a FIFO order. The bundle headers are removed before forwarding bundles to the application.

BuildBpEndpointId ()

Build an endpoint id based on scheme and ssp strings. In BP of NS-3, each registration has a unique endpoint id. a BundleProtocol calss can be served for multiple registrations in a bundle node.

SetBpEndpointId ()

Users build an endpoint id and set the endpoint id to the bundle protocol.

Usage

An example script in src/bundle-protocol/examples is created to show the usage of these APIs. In this section, we show a sample code for registering an application in a bundle node to send bundles.

  BpEndpointId eidSender ("dtn", "node0");    // build an endpoint id
  BundleProtocolHelper bpSender (eidSender);  // create a bundle protocol helper
  bpSender.SetRoutingProtocol (route);        // set the bundle routing protocol
  bpSender.SetRegisterInfo (info);            // set the registration information
  BundleProtocolContainer senders = bpSender.Install (nodes.Get (0));  // the bundle protocol helper calls 
                                                                       // following BP APIs: Open (), 
                                                                       // SetBpEndpointId (), Register (), Bind (); 
  Ptr<BundleProtocol> sender = senders.Get (0);
   sender->Send (packet, src, dst);      // send the packet from endpoint id src to endpoint id dst. 
                                         // The src and dst will be transferred into internet socket address
                                         // based on bundle routing protocol.

Approach

I divide the functions in this project into three parts:

  • S1: functions to make sure the bundle can be sent from sender to receiver, node structure, send/receive/forward, static routing, naming syntax.
  • S2: control functions for custody transfer, custody signal in AA.

Plan

12 weeks from Sep.4 to Nov.24:

  • Week1: node structure: the class relationship in NS-3.
  • Week2: node structure: the class relationship in NS-3.
  • Week3: send and receive without forwarding procedure (two bundle nodes case).
  • Week4: send and receive with forwarding procedure (three or more bundle nodes case, forward immediately, not custody transfer scheme).
  • Week5: send and receive with forwarding procedure (three or more bundle nodes case, forward immediately, not custody transfer scheme).
  • Week6: write test code and documentation for S1.
  • Week7: custody signal support (store-and-forward, custody transfer).
  • Week8: custody signal support (store-and-forward, custody transfer).
  • Week8: write test code and documentation for S2.
  • Week9: bundle status support* Week10: bundle status support.
  • Week11: write test code and documentation for S3.
  • Week12: wrap up.

Acknowledgement

I would like to express my special thanks of gratitude to Tommaso Pecorella and Tom Henderson, also thanks of Lalith Suresh and Luca Simone Ronga. Thanks for their valuable comments and helps on my work. Thanks for all mentors in NS-3 community to give me this opportunity in SOCIS project.