The DTN Reference Implementation - Delay Tolerant Networking ...
The DTN Reference Implementation - Delay Tolerant Networking ...
The DTN Reference Implementation - Delay Tolerant Networking ...
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
<strong>The</strong> <strong>DTN</strong> <strong>Reference</strong><br />
<strong>Implementation</strong><br />
Michael Demmer<br />
IETF <strong>DTN</strong>RG Meeting - March 9, 2005
<strong>Implementation</strong> Overview<br />
• Written primarily in C++<br />
– ~22,000 non-comment lines of C++ (~5,000 C)<br />
– 10K in generic system support classes (oasys)<br />
– 189 individual classes<br />
– Multithreaded (pthreads), mutex, spin lock<br />
– STL for data structures (string, list, hashtable, …)<br />
• Emphasize clarity, cleanliness, flexibility<br />
• Ported to Linux, Solaris, Win32 (Cygwin),<br />
Linux on PDA (ARM), FreeBSD, Mac OSX<br />
(Source line statistics generated using David A. Wheeler's 'SLOCCount’)<br />
3/13/05 <strong>DTN</strong> <strong>Reference</strong> <strong>Implementation</strong> 2
Bundle Daemon (dtnd) Components<br />
API Server<br />
Contact<br />
Manager<br />
TCP<br />
UDP<br />
Sneakernet<br />
Convergence Layers<br />
Tcl Console /<br />
Configuration<br />
Event Queue<br />
Bundle<br />
Daemon<br />
Fragmentation<br />
Manager<br />
Persistent Store<br />
Bundle<br />
Router<br />
3/13/05 <strong>DTN</strong> <strong>Reference</strong> <strong>Implementation</strong> 3<br />
dtnd<br />
Bundle Actions<br />
= Thread
Bundle Daemon Components<br />
• Bundle Daemon: core event queue and dispatcher<br />
• Bundle Router: all “smarts” in the system, effects<br />
policies via a the Bundle Actions interface<br />
• API Server: handler for application IPC interface<br />
• Convergence Layers: transport-specific mechanism<br />
for transmitting bundles to a next-hop<br />
• Contact Manager: service for detecting connection<br />
opportunities with neighbors<br />
• Fragmentation Manager: proactive and reactive<br />
fragmentation, maintains reassembly buffers<br />
• Persistent Store: object database abstraction for<br />
durable storage, uses Berkeley DB or SQL backends<br />
3/13/05 <strong>DTN</strong> <strong>Reference</strong> <strong>Implementation</strong> 4
Bundle Daemon Events<br />
API Server<br />
Contact<br />
Manager<br />
TCP<br />
UDP<br />
Sneakernet<br />
Convergence Layers<br />
Tcl Console /<br />
Configuration<br />
Event Queue<br />
Bundle<br />
Daemon<br />
Fragmentation<br />
Manager<br />
Persistent Store<br />
Bundle<br />
Router<br />
3/13/05 <strong>DTN</strong> <strong>Reference</strong> <strong>Implementation</strong> 5<br />
dtnd<br />
Bundle Actions<br />
All events (e.g. bundle arrival,<br />
contact disruption, reassembly<br />
completed, etc.) posted to<br />
the daemon event queue.<br />
= Thread
Bundle Router Actions<br />
API Server<br />
Contact<br />
Manager<br />
TCP<br />
UDP<br />
Sneakernet<br />
Convergence Layers<br />
Tcl Console /<br />
Configuration<br />
Event Queue<br />
Bundle<br />
Daemon<br />
Fragmentation<br />
Manager<br />
Persistent Store<br />
Bundle<br />
Router<br />
3/13/05 <strong>DTN</strong> <strong>Reference</strong> <strong>Implementation</strong> 6<br />
dtnd<br />
Bundle Actions<br />
Events are then forwarded to<br />
the router, which responds<br />
with a set of actions that are<br />
dispatched to components.<br />
= Thread
Bundle Router<br />
• Not just traditional routing – all<br />
“policy” decisions in the daemon<br />
– e.g: where / when to send bundles, whether to<br />
accept custody, apply fragmentation, store<br />
bundles, etc…<br />
– Insulated by event/action interface<br />
– Multiple implementations, chosen at config<br />
• Why this design?<br />
– Believe routing is the hardest problem, may need<br />
all events<br />
– Easier to change policies if consolidated in one<br />
place<br />
3/13/05 <strong>DTN</strong> <strong>Reference</strong> <strong>Implementation</strong> 7
Evaluation<br />
HOP<br />
E2E<br />
user<br />
kernel<br />
user<br />
kernel<br />
user<br />
kernel<br />
• Approaches compared (both e2e and hop):<br />
– SFTP (simple ftp-like TCP app) – kernel IP or ‘plug proxy’<br />
– MAIL (Sendmail, no ckpoint/restart) both end to end and<br />
– <strong>DTN</strong> (store-and-forward with restart) hop configurations<br />
user<br />
kernel<br />
• Compare robustness to interruption / link errors<br />
• Link up/down patterns: aligned, shifted, sequential, random<br />
3/13/05 <strong>DTN</strong> <strong>Reference</strong> <strong>Implementation</strong> 8
<strong>DTN</strong> Overhead – No Disruptions<br />
<strong>DTN</strong> does best of any for small msgs, modest overhead overall<br />
3/13/05 <strong>DTN</strong> <strong>Reference</strong> <strong>Implementation</strong> 9
Interruption Tolerance<br />
Zero throughput for e2e<br />
Note zero<br />
throughput for all<br />
E2E cases<br />
Up/down 1m/3min; 40KB messages; shift: 10s<br />
3/13/05 <strong>DTN</strong> <strong>Reference</strong> <strong>Implementation</strong> 10
Simulator Framework<br />
• <strong>Implementation</strong> also includes basics of a discrete<br />
event simulator for prototyping and testing<br />
– TCL based simulation script to generate contact schedules, test<br />
traffic patterns, link bandwidth / delay, etc. 1<br />
• Uses the same events and abstractions<br />
– Implemented via a SimConvergenceLayer, Bundle Payload option<br />
for no data, modified event queue, and SimBundleActions<br />
– Other core classes and architecture are unmodified<br />
– Allows testing of the whole code base except convergence layers<br />
• Key characteristic is that to the router, there is no<br />
distinction between simulation or deployment<br />
1 not all planned simulation features are yet implemented<br />
3/13/05 <strong>DTN</strong> <strong>Reference</strong> <strong>Implementation</strong> 11
Current Status<br />
• Basic system operational and (fairly) stable<br />
– Primitives for in-memory and on-disk Bundle management<br />
– Extensible naming and addressing framework<br />
– Next-hop taxonomy of peers, links, contacts<br />
– TCP and UDP convergence layers (with pending ID specs)<br />
– Implemented (mostly) Bundling protocol v3<br />
– Berkeley db and sql storage implementations<br />
– “Sockets-like” application interface<br />
– Sample applications: dtnping, dtnsend, dtnrecv, dtncp<br />
– Proactive and reactive fragmentation and reassembly<br />
3/13/05 <strong>DTN</strong> <strong>Reference</strong> <strong>Implementation</strong> 12
Major ToDo Items<br />
Bundle<br />
Router<br />
Bundle<br />
Management<br />
API Server<br />
Convergence<br />
Layers<br />
Contact<br />
Manager<br />
Simulator<br />
−Split into Bundle Engine / Bundle Router<br />
−Implement a non-static routing protocol<br />
−Implement Bundle expirations<br />
−Custody transfer, delivery status notification<br />
−Class of Service based forwarding decisions<br />
−Improve error reporting and robustness<br />
−Change from loopback UDP to TCP<br />
−Handle application disconnection<br />
−Some more ad-hoc protocol (e.g. raw 802.11)<br />
−More non-traditional networking (e.g. USB key)<br />
−Multicast or broadcast based peer discovery<br />
−Scheduled links and contacts<br />
−Complete implementation<br />
3/13/05 <strong>DTN</strong> <strong>Reference</strong> <strong>Implementation</strong> 13
<strong>Implementation</strong> Details<br />
• ISO Stack View<br />
• Example Event / Action Flow<br />
• Naming / Address Families<br />
• Bundle Class Representation<br />
• Bundle Consumers (next hop)<br />
• Bundle Lists<br />
• Convergence Layer API<br />
• Persistent Storage Interface<br />
3/13/05 <strong>DTN</strong> <strong>Reference</strong> <strong>Implementation</strong> 14
ISO Stack View<br />
Application<br />
IPC<br />
Bundle<br />
Bundle Daemon<br />
Presentation Bundle Protocol<br />
Transport<br />
Sneakernet<br />
(in progress)<br />
<strong>DTN</strong> Application<br />
XDR<br />
UDP<br />
Embedded Application<br />
TCP UDP<br />
to/from<br />
next hop<br />
<strong>DTN</strong>2<br />
socket-like API<br />
(plan to change to TCP)<br />
Embedded<br />
Application<br />
Application can also run the<br />
daemon code as a thread.<br />
3/13/05 <strong>DTN</strong> <strong>Reference</strong> <strong>Implementation</strong> 15
Example Event / Action Flow<br />
User configures a new<br />
ONDEMAND TCP link<br />
and a route for the link.<br />
event: LINK_CREATED<br />
event: LINK_AVAILABLE<br />
Router adds link to<br />
route table.<br />
TCPCL interface accept()’s<br />
a new connection and<br />
constructs a new bundle<br />
from the wire.<br />
event: BUNDLE_ARRIVED<br />
Router matches the link in<br />
the route table as the only<br />
next hop for the bundle.<br />
action: STORE_ADD<br />
action: OPEN_LINK<br />
Database stores the bundle.<br />
TCPCL resolves the destination<br />
admin string and establishes a<br />
connection to the next hop.<br />
event: CONTACT_UP<br />
Router checks the link, finds<br />
a pending bundle, moves<br />
the bundle to the contact.<br />
action: ENQUEUE_BUNDLE<br />
TCP Connection thread picks<br />
bundle off contact queue,<br />
sends it to the next hop.<br />
Router checks bundle<br />
mappings and finds<br />
no other destinations<br />
action: STORE_DEL<br />
Database removes<br />
the bundle.<br />
3/13/05 <strong>DTN</strong> <strong>Reference</strong> <strong>Implementation</strong> 16<br />
event: BUNDLE_TRANSMITTED<br />
Disruption occurs on the<br />
connection, TCPCL times<br />
out on a keepalive message<br />
event: CONTACT_DOWN<br />
event: LINK_UNAVAILABLE<br />
Router checks queues for<br />
any bundles that need to be<br />
re-routed to other links.
Bundle Router Events<br />
BUNDLE_RECEIVED // New bundle arrival<br />
BUNDLE_TRANSMITTED // Bundle or fragment successfully sent<br />
BUNDLE_EXPIRED // Bundle expired<br />
BUNDLE_FORWARD_TIMEOUT // A Mapping timed out<br />
CONTACT_UP // Contact is up<br />
CONTACT_DOWN // Contact abnormally terminated<br />
LINK_CREATED // Link is created into the system<br />
LINK_DELETED // Link is deleted from the system<br />
LINK_AVAILABLE // Link is available<br />
LINK_UNAVAILABLE // Link is unavailable<br />
REGISTRATION_ADDED // New registration arrived<br />
REGISTRATION_REMOVED // Registration removed<br />
REGISTRATION_EXPIRED // Registration expired<br />
REASSEMBLY_COMPLETED // Reassembly complete<br />
ROUTE_ADD // Add a new entry to the route table<br />
ROUTE_DEL // Remove an entry from the route table<br />
3/13/05 <strong>DTN</strong> <strong>Reference</strong> <strong>Implementation</strong> 17
Bundle Action Interface<br />
enqueue_bundle(Bundle* bundle, BundleConsumer* nexthop,<br />
bundle_fwd_action_t fwdaction,<br />
int mapping_grp, u_int32_t expiration,<br />
RouterInfo* router_info)<br />
dequeue_bundle(Bundle* bundle, BundleConsumer* nexthop)<br />
move_contents(BundleConsumer* source,<br />
BundleConsumer* dest)<br />
store_add(Bundle* bundle)<br />
store_del(Bundle* bundle)<br />
open_link(Link* link)<br />
close_link(Link* link)<br />
3/13/05 <strong>DTN</strong> <strong>Reference</strong> <strong>Implementation</strong> 18
Naming / Address Families<br />
URI (scheme:scheme-specific-part)<br />
bundles:///<br />
Bundle Destination<br />
“dns-style”<br />
string<br />
Local Interface (admin only)<br />
RouteTable (destination pattern)<br />
RouteTable (next hop)<br />
RouteTable (default pattern)<br />
address<br />
family (AF)<br />
Examples<br />
bundles://internet.dtn/host://test.dtnrg.org/myapp1<br />
host://0.0.0.0:5000<br />
bundles://dtnrg.org/smtp://*@dtnrg.org/*<br />
bundles://some_region/host://xyz.dtnrg.org:5000<br />
bundles://*/*<br />
internet<br />
fixed<br />
smtp 1<br />
wildcard<br />
Admin String Format<br />
host://:/demux<br />
0x0102<br />
smtp://@/demux<br />
* or */* or *:*<br />
3/13/05 <strong>DTN</strong> <strong>Reference</strong> <strong>Implementation</strong> 19<br />
AF<br />
1 smtp addressing has not actually been implemented (yet)
Naming / Address Families (2)<br />
- tuple: string<br />
- region: string<br />
- admin: string<br />
- proto: string<br />
parse(string)<br />
valid()<br />
BundleTuple<br />
- family: AddressFamily<br />
compare(tuple)<br />
BundleTuplePattern<br />
match(tuple)<br />
AddressFamily<br />
- schema: string<br />
validate(admin_str)<br />
resolve(admin_str)<br />
match(admin_str, pattern)<br />
InternetAddressFamily<br />
FixedAddressFamily WildcardAddressFamily<br />
• AF abstraction allows essentially any<br />
format for admin strings<br />
• BundlePattern class implements AFspecific<br />
wildcard matching<br />
3/13/05 <strong>DTN</strong> <strong>Reference</strong> <strong>Implementation</strong> 20
serialize()<br />
Bundle Class Representation<br />
SerializableObject<br />
Bundle<br />
- source: BundleTuple<br />
- destination: BundleTuple<br />
- custodian: BundleTuple<br />
- reply-to: BundleTuple<br />
- payload: BundlePayload<br />
- mappings: BundleMappings<br />
- priority: int<br />
- custody_req: boolean<br />
- return_rcpt: boolean<br />
- creation_ts: timestamp_t<br />
- refcount: int<br />
…<br />
add_ref(), del_ref()<br />
add_mapping(), del_mapping()<br />
• Bundle Metadata always in memory<br />
– <strong>Reference</strong>-counted C++ object for safety<br />
• Various fields “parsed” from the<br />
wire format into member variables<br />
– BundleProtocol class to convert to and from<br />
– Object serialization layer for synchronizing<br />
with the database<br />
• BundlePayload abstraction<br />
– Manages on-disk representation of payload<br />
– Methods for read_data(), write_data()<br />
– For small bundles, keeps in-memory copy<br />
3/13/05 <strong>DTN</strong> <strong>Reference</strong> <strong>Implementation</strong> 21
Bundle Consumers<br />
BundleConsumer<br />
next_hop: string<br />
bundle_list: BundleList<br />
enqueue_bundle(Bundle*)<br />
dequeue_bundle(Bundle*)<br />
Contact Link Peer Registration<br />
OndemandLink ScheduledLink<br />
OpportunisticLink<br />
• Routing can return any consumer as a valid next-hop<br />
link0: Scheduled, UDP<br />
link1: Opportunistic, SneakerNet<br />
link2: OnDemand, TCP<br />
– virtual override of enqueue_bundle to implement different abstractions<br />
• Allows router to use most-natural expression of an algorithm<br />
– enqueue bundle on peer implies send on next contact on any link to the peer<br />
peer0<br />
peer1<br />
a next-hop dtn daemon<br />
3/13/05 <strong>DTN</strong> <strong>Reference</strong> <strong>Implementation</strong> 22<br />
peer<br />
link<br />
contact<br />
registration<br />
means to communicate with a peer<br />
created when link is “open”<br />
locally attached application
Bundle Lists / Bundle Mappings<br />
Bundle Lists<br />
bundle_list: Pending Bundles<br />
list_position: 1<br />
op: NONE<br />
bundle_list: Contact 1<br />
list_position: 2<br />
op: FORWARD_ONCE<br />
group id: 0x10<br />
timeout: 1097563442.125245<br />
bundle_list: Contact 2<br />
list_position: 1<br />
op: FORWARD_ONCE<br />
group id: 0x10<br />
timeout: 1097553431.324565<br />
BundleMappings<br />
Pending Bundles Contact 1 Contact 2<br />
Bundle 1 Bundle 2 Bundle 3<br />
3/13/05 <strong>DTN</strong> <strong>Reference</strong> <strong>Implementation</strong> 23
Convergence Layer API<br />
add_interface(Interface)<br />
add_link(Link, argc, argv)<br />
open_contact(Contact)<br />
send_bundles(Contact)<br />
del_interface(), del_link(), close_contact()<br />
Convergence Layer API<br />
create a new ingress point for bundle arrivals<br />
prepare the given link for transmission<br />
open a connection for the given contact<br />
try to send bundles queued on the given contact<br />
remove the given interface/link/contact<br />
• Though the abstraction is intended to be general, to date only<br />
two functional implementations (TCP and UDP)<br />
– API may (will likely) need to be extended to account for other transports<br />
• Other things of note:<br />
– May add an MTU (e.g. UDP limited to 16K max bundle)<br />
– Likely need abstractions for neighbor discovery, peer identification, etc.<br />
3/13/05 <strong>DTN</strong> <strong>Reference</strong> <strong>Implementation</strong> 24
Persistent Storage Interface<br />
BundleStore<br />
store:<br />
PersistentStore<br />
load()<br />
add(Bundle*)<br />
del(int)<br />
get(int)<br />
update(Bundle*)<br />
BerkeleyDBBundleStore<br />
RegistrationStore<br />
store: PersistentStore<br />
load()<br />
add(Registration*)<br />
del(int)<br />
get(int)<br />
update(Registration*<br />
)<br />
SQLBundleStore<br />
• Several layers of abstraction for<br />
implementation transparency<br />
store:<br />
PersistentStore<br />
load()<br />
GlobalStore<br />
next_bundleid()<br />
next_regid()<br />
update()<br />
• Easy to extend with new storage types<br />
(e.g. routing state) or storage<br />
implementations<br />
load()<br />
add(int, SerializableObject*)<br />
del(int)<br />
get(int)<br />
BerkeleyDBStore<br />
PersistentStore<br />
update(int,<br />
SerializableObject*)<br />
SQLStore<br />
impl:<br />
SQL<strong>Implementation</strong><br />
SQL<strong>Implementation</strong><br />
PostgresSQLImpl MYSQLImpl<br />
3/13/05 <strong>DTN</strong> <strong>Reference</strong> <strong>Implementation</strong> 25
Persistent Storage Interface (2)<br />
• SerializableObject interface allows a single function<br />
to define marshal / unmarshal for all DB types<br />
int Bundle::Serialize(SerializeAction* a) {<br />
}<br />
a->process(“bundleid”, &bundleid_);<br />
a->process(“source”, &source_);<br />
a->process(“dest”, &dest_);<br />
a->process(“priority”, &priority_);<br />
a->process(“custreq”, &cust_req_);<br />
a->process(“return_rcpt”, &return_rcpt_);<br />
// ...<br />
• Adding a new DB implementation requires<br />
implementing a handful of functions for different<br />
basic types (int, string, etc)<br />
– Berkeley DB implementation packs fields into a byte array<br />
– SQL implementations generate an update command e.g.<br />
update bundles set custreq = true where bundleid = 10<br />
3/13/05 <strong>DTN</strong> <strong>Reference</strong> <strong>Implementation</strong> 26