====== DTN ====== ===== Topics ===== * intro: dtn, olsrd. * Scenario alarm. * integration dtn olsrd. not exact which dtn implementation but must dtn2 compatible --> later argument the choice bytewalla in thesis. * devices android, infrastructure node. * Contribute to community ===== Application (Introduction) ===== ==== Outlines ==== * Motivation * Focus & contribution * Related work * Outline of the thesis. ==== Materials ==== * sentinel app. * Disaster Rescue: A para medic or group of para medic collect patient information. This info can't be communicated immediately with central be cause there is no network coverage. This information is however exchanged between the mobile devices on the field. When one of these have uplink connection, it will transfer these info to central for analysis. * Distributed environment sensing: radiation leak monitoring, environmental measurement. * ===== Technical challenges (Problem statement) ===== ==== Outlines ==== * abc ==== Materials ==== * Transfering. * Communication stack. ===== Part x ===== ===== References ===== ==== relating ideas ==== * Windows Asynchronous Message Queue. * http://www.netlab.tkk.fi/u/jo/dtn/index.html (interesting part: DTN for mobile adhoc network). * http://www.dtnrg.org/docs/papers/ * Delay robustness in cooperative control (Multi agent, Delay tolerant, network) TU-bib 5250-16 * Book on DTN: http://www.amazon.com/dp/1596930632. * Wildlife tracking. ==== Arche & protocols ==== * ref Implementation DTN2 - http://www.dtnrg.org/docs/papers/demmer-irb-tr-04-020.pdf * Integration DTN & AODV - http://www.netlab.tkk.fi/u/jo/papers/2006-chants-dtn-aodv.pdf ==== Reference implementation ==== * DakNet. * DTN2 www.dtnrg.org * ByteWalla: Java (Android) porting from DTN2. * http://dtnblog.wordpress.com/category/dtn-development/ * ByteWalla source: https://svn1.ssvl.kth.se/repos/bytewalla/ (User Name: guest, password: guest). * Summary of dtn implementation: http://www.dtnrg.org/wiki/Code ===== Delivery ===== ==== Primary objectives ==== * dtn-olsr integration. * olsrd control app: start/stop statistic. * dtn control app: bundle list, link dump... * showcase: data transfer, chat app, photos transfer. ==== Secondary objectives ==== * ==== Programming resources ==== * http://www.codexperiments.com/android/2010/05/android-introduction-part-2-setting-up-your-environment/ * http://www.crystax.net/en/android/ndk * http://sourceware.org/autobook/autobook/autobook_24.html#SEC24 ===== Ideas ===== * DTN service broadcast through olsrd: dtn service register its service with olsrd. client capability (management)... services like tourist guide... car to car.. ===== Experiments ===== ===== Project plan ===== ^ Task ^ Subtask ^ Desc ^ Start ^ End ^ Remark ^ | Adhoc network | | | unknown | unknown | | |::: | start adhoc | run modprobe/ip from app(fishmesh) | | | | |::: | fine tune adhoc app | | | | | ||||||| | DTN | | setup dtn network | unknown | unknown | | |::: | Study DTN2 code | | | | | |::: | Study Bytewalla code | | | | | |:::|||||| |::: | Test dtn android/laptop/alix | | | | [[todo:dtn_notes#DTN|notes]] | |::: | get ibr-dtn to work with dtn2 | | | | [[todo:dtn_notes#DTN|notes]] | |::: | port ibrdtn for android | | 15 jan 2012 | 18 feb 2012 | [[todo:dtn_notes#Port ibrdtn for android|notes]] . Android-ndk-r7 can't compile ibrdtn source. Continue with bytewalla 5| |::: | Setup DTN network with bytewalla, dtn2. | setup scenario with bytewalla and dtn2 i) topology ii) write test app for dtn2 & bytewalla iii) study bytewalla 5 middleware | 20 feb 2012 | 27 feb 2012 | | |::: | --- compile and run dtn2 | | 21 feb 2012 | 23 feb 2012 | Notes: Compile and run dtn2 | | Sample dtn app | --- | | 24 feb 2012 | 28 feb 2012 | -=High=- | |::: | --- Android dtn app dtnchat | | 24 feb 2012| 26 Mar 2012| see implementation note on this page. | |::: | --- c++ dtn app dtnchat | | 24 feb 2012| 1 Mar 2012 | NA | |::: | --- Android dtn demo app wiht Foto functionalities | | --| -- | NA | ||||||| | Broadcast dtn discovery info with olsr | --- | | -- | -- | -= pri. objective =- | |::: | Olsrd plugin to get dtn discovery info | | 07 Apr 2012 | 30 May 2012 | NA | |::: | dtn plugin to send discovery info to olsrd | | 07 Apr 2012 | 15 Apr 2012 | NA | |::: | bytewalla OlsrDiscovery to exchange discovery info with olsrd | | 07 Jun 2012 | -- | NA | ||||||| | Control & status app/widgets | --- | | -- | -- | -= pri. objective =- | |::: | --- tentative: integrate with bytewall or write own app with wlan, olsr, dtn control | | --| -- | NA | ||||||| | dtn routing with olsrd | | | | | sec. objective | ||||||| ====== 6.x Notes ====== ===== 5.x pending tasks ===== === TODOs === * 16 May: test discovers some bugs * bytewalla does not get eid from config xml. it takes eid from config.xml at compile time. * use dtnchat with different eid then bytewalla's eid --> no delayed receive possible. * integration: analyze link update mechanism. conv layer posts link event to Bundledaemon. Contact Bundle Daemon directly for matters conerning routing decision. * chatapp: Data serialization, message encoding. * dtn2: Send/recv discovery on multiple interface (dtn2, bytewalla). * dtn2: auto detect and react to network events (iface up/down, ip changes). * bytewalla: Change to EID in config file takes not effect. === Done === * Chat client gets EID from DTN Daemon: SharePreferences accross applications. * Child activity can't call unbindService(): uses getApplicationContext().unbindservice(...). * Registration multiple DTN Apps. * Olsrd not broadcast on network: worked with nexus s 2. April. * Test with Adhoc network: bytewalla (and dtn2?) broadcasts discovery on 255.255.255.255. This addr doesn't work on android. fix bytewalla to broadcast on x.x.255.255 for local link. *On linux, when local link is used there is no default route (0.0.0.0). Adding default route will make ip broadcast works: route add default wlan0 or route add 0.0.0.0 wlan0 ===== 5.x Integration DTN Olsrd ===== ==== 4.x dtn neighbour json message ==== === representing a dtn node in json string === * sender_name: eid * conv_layer * ip * cl_type: tcp/udp * inet_addr * inet_port is in network byte order * inteval * bonjour * cl_type: bonjour * bt * cl_type: bt * geo * long * lat { "nodes": [ {"sender_name": "dtn:\/\/tdfed.dtn", "conv_layers": [ {"cl_type": "tcp", "inteval": 30, "inet_addr": "0.0.0.0", "inet_port": 52241, "name_len": 15}, {"cl_type": "tcp", "inteval": 30, "inet_addr": "0.0.0.0", "inet_port": 52241, "name_len": 15}], "geo": {"lat": 999, "long": 999}}] } ==== 4.x DTN2 OlsrDiscovery ==== === 3.x Adding OlsrDiscovery to DTN2 source === * Adding OlsrDiscovery.cc to autoconf's source list 'servlib/Makefile' under 'DISCOVERY_SRCS'. * OlsrdDiscovery uses json-c so add json-c lib and include to compile flags in 'System.make'. SYS_CFLAGS = -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 24 SYS_EXTLIB_CFLAGS = -I/usr/include/xercesc-2.7.0 -I/usr/include/json 25 SYS_EXTLIB_LDFLAGS = -ldl -lm -ltcl8.5 -lexpat -L/usr/lib64/xerces-c-2.7.0 -lxerces-c -lz -ldb-4.8 -lpthread -ljson ** System.make will be overwritten ** when rerun ./configure. It's better to make these configuration with autotools: TODO. ==== 4.x Olsrd dtndisc plugin ==== === 3.x understanding olsrd plugin === ** research **: Linux netlink routing. Olsrd has a plugin parser. A plugin registers its socket with olsrd together with an action-function. The sockets are checked for read/write/error events with select() in the scheduler. If en event exist for a registered socket, the action-function is called. If a plugin plays server socket role and wants to keep the connection with client, it should register the client socket with olsrd. When a server socket is registerd with olsrd, it is only put in fd_set when a client call connect(). Checking read/write on server socket will return '0'. ===== 5.x Setup DTN netowkr with bytewalla, dtn2 ===== ==== 4.x Compile and run dtn2 linux ==== Compile oasys: * Try running ./build-configure.sh to regenerate new configure script with system's autotools. * on Fedora: fix configure script where xerces-c support is checked by setting correct path to xerces-c-2.70 (/usr/lib/xercesc-27): 1) edit $oasys/aclocal/xerces-c.ac to check for correct path of xercesc-27. 2) run ./build-configure to generate new configure file. 3) run ./configure --with--xerces-c=xercesc-2.7.0. ___NOTE___: currently the path is hardcoded in aclocal/xerces-c.ac. On Sat, Dec 3, 2011 at 10:16 PM, Elwyn Davies wrote: Hi. It appears that the Oasys configure system does not barf if given an installation of Xerces-C++ Verion 3.x. Since Oasys requires Version 2.x.y of Xerces-C++ where x >= 6, but will not compile/link with version 3.x, aclocal/xerces-c.ac should detect versions equal to or higher than 3.0.0 and throw an error. A suitable patch is attached. If you apply this to oasys/aclocal/xerces-c.ac , it is necessary to run oasys/build-configure.sh to remake oasys/aclocal.m4 and the configure script. This in turn assumes that you have the autoconf tools package installed. The Sourceforge repository normally contains updated versions of aclocal.m4, the configure script, etc. Commiserations to Gokul Nath who has been struggling with this problem today. Compile dtn2: ***Note: Using xerces-270. Dirnames for include and lib are not consistent. Correct configure files accordingly: /usr/include/xercesc-2.7.0/ /usr/lib/xerces-c-2.7.0/ <-- xerces(-)c-2.7.0 === 3.x libdb version === There is problem with libdb 5.2: can not init berkeley database. Set libdb's version in System.make to use ver 4.8 24 SYS_EXTLIB_CFLAGS = -I/usr/include/xercesc-2.7.0 25 SYS_EXTLIB_LDFLAGS = -ldl -lm -ltcl8.5 -L/usr/lib/xerces-c-2.7.0 -lxerces-c -lreadline -lz -ldb-4.8 -lpthrea d -ljson 26 ... DB_ENV->memp_stat interface... can't initialize berkeleydb: -1000 ==== 4.x Compile and run olsrd android ==== === 3.x cross compile olsrd for android === Configure make/Makefile.android to crosscompile olsrd: 30 PREFIX ?= /data/local 31 SBINDIR = $(PREFIX)/bin 32 ETCDIR = $(PREFIX)/etc 33 LIBDIR = $(PREFIX)/lib 34 DOCDIR = 35 MANDIR = 36 37 SRCS += $(wildcard src/linux/*.c src/unix/*.c) 38 HDRS += $(wildcard src/linux/*.h src/unix/*.h) 39 40 CPPFLAGS += -Dlinux -DLINUX_NETLINK_ROUTING 41 CPPFLAGS += -Dandroid -DANDROID 42 43 # bionic libc: missing declaration 44 CPPFLAGS += -DINET_ADDRSTRLEN=16 45 # bionic libc: missing declarations 46 CPPFLAGS += -D'IPTOS_PREC(tos)=((tos)&0xe0)' 47 CPPFLAGS += -D'IPTOS_TOS(tos)=((tos)&0x1e)' 48 CPPFLAGS += -DOLSRD_GLOBAL_CONF_FILE=\"$(CFGFILE)\" 49 50 # Compilation flags from build/toolchains/arm-eabi-4.2.1/setup.mk 51 CPPFLAGS += \ 52 -march=armv5te -mtune=xscale \ 53 -msoft-float -fpic \ 54 -mthumb-interwork \ 55 -ffunction-sections \ 56 -funwind-tables \ 57 -fstack-protector \ 58 -fno-short-enums \ 59 -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ \ 60 -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ 61 ifeq ($(DEBUG),0) 62 CPPFLAGS += \ 63 -fomit-frame-pointer \ 64 -fstrict-aliasing \ 65 -funswitch-loops \ 30 PREFIX ?= /data/local 31 SBINDIR = $(PREFIX)/bin 32 ETCDIR = $(PREFIX)/etc 33 LIBDIR = $(PREFIX)/lib 34 DOCDIR = 35 MANDIR = 36 37 SRCS += $(wildcard src/linux/*.c src/unix/*.c) 38 HDRS += $(wildcard src/linux/*.h src/unix/*.h) 39 40 CPPFLAGS += -Dlinux -DLINUX_NETLINK_ROUTING 41 CPPFLAGS += -Dandroid -DANDROID 42 43 # bionic libc: missing declaration 44 CPPFLAGS += -DINET_ADDRSTRLEN=16 45 # bionic libc: missing declarations 46 CPPFLAGS += -D'IPTOS_PREC(tos)=((tos)&0xe0)' 47 CPPFLAGS += -D'IPTOS_TOS(tos)=((tos)&0x1e)' 48 CPPFLAGS += -DOLSRD_GLOBAL_CONF_FILE=\"$(CFGFILE)\" 49 50 # Compilation flags from build/toolchains/arm-eabi-4.2.1/setup.mk 51 CPPFLAGS += \ 52 -march=armv5te -mtune=xscale \ 53 -msoft-float -fpic \ 54 -mthumb-interwork \ 55 -ffunction-sections \ 56 -funwind-tables \ 57 -fstack-protector \ 58 -fno-short-enums \ 59 -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ \ 60 -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ 61 ifeq ($(DEBUG),0) 62 CPPFLAGS += \ 63 -fomit-frame-pointer \ 64 -fstrict-aliasing \ 65 -funswitch-loops \ 30 PREFIX ?= /data/local 31 SBINDIR = $(PREFIX)/bin 32 ETCDIR = $(PREFIX)/etc 33 LIBDIR = $(PREFIX)/lib 34 DOCDIR = 35 MANDIR = 36 37 SRCS += $(wildcard src/linux/*.c src/unix/*.c) 38 HDRS += $(wildcard src/linux/*.h src/unix/*.h) 39 40 CPPFLAGS += -Dlinux -DLINUX_NETLINK_ROUTING 41 CPPFLAGS += -Dandroid -DANDROID 42 43 # bionic libc: missing declaration 44 CPPFLAGS += -DINET_ADDRSTRLEN=16 45 # bionic libc: missing declarations 46 CPPFLAGS += -D'IPTOS_PREC(tos)=((tos)&0xe0)' 47 CPPFLAGS += -D'IPTOS_TOS(tos)=((tos)&0x1e)' 48 CPPFLAGS += -DOLSRD_GLOBAL_CONF_FILE=\"$(CFGFILE)\" 49 50 # Compilation flags from build/toolchains/arm-eabi-4.2.1/setup.mk 51 CPPFLAGS += \ 52 -march=armv5te -mtune=xscale \ 53 -msoft-float -fpic \ 54 -mthumb-interwork \ 55 -ffunction-sections \ 56 -funwind-tables \ 57 -fstack-protector \ 58 -fno-short-enums \ 59 -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ \ 60 -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ 61 ifeq ($(DEBUG),0) 62 CPPFLAGS += \ 63 -fomit-frame-pointer \ 64 -fstrict-aliasing \ 65 -funswitch-loops \ 66 -finline-limit=300 67 else 68 CPPFLAGS += \ 69 -fno-omit-frame-pointer \ 70 -fno-strict-aliasing 71 endif 72 73 PLUGIN_SONAME ?= $(PLUGIN_NAME) 74 PLUGIN_FULLNAME ?= $(PLUGIN_NAME).so.$(PLUGIN_VER) 75 INSTALL_LIB = install -D -m 755 $(PLUGIN_FULLNAME) $(LIBDIR)/$(PLUGIN_FULLNAME); \ 76 /sbin/ldconfig -n $(LIBDIR) 77 UNINSTALL_LIB = rm -f $(LIBDIR)/$(PLUGIN_FULLNAME); \ 78 /sbin/ldconfig -n $(LIBDIR) 79 80 ifdef OLSRD_PLUGIN 81 GENERATE_PIC = true 82 endif 83 84 ifdef GENERATE_PIC 85 CFLAGS += -fPIC 86 LDFLAGS += -fPIC 87 endif 88 89 #NDK = /opt/android-ndk-r4b 90 NDK = /home/td/devfs/opt/android-ndk-r7-crystax-4 91 NDK_ARCH = $(NDK)/platforms/android-8/arch-arm 92 93 ifneq ($(shell uname -m),armv6l) 94 # You are not compiling with Debian direct on the phone 95 CURRENT_SYSTEM = $(shell uname -s | tr A-Z a-z) 96 #CROSS_COMPILE = $(NDK)/build/prebuilt/$(CURRENT_SYSTEM)-x86/arm-eabi-4.2.1/bin/arm-eabi- 97 CROSS_COMPILE = $(NDK)/toolchains/arm-linux-androideabi-4.4.3/prebuilt/$(CURRENT_SYSTEM)-x86/ bin/arm-linux-androideabi- 98 CC = $(CROSS_COMPILE)gcc 99 ifeq ($(DEBUG),0) 100 STRIP = $(CROSS_COMPILE)strip 101 endif 102 endif 103 104 CFLAGS += -I$(NDK_ARCH)/usr/include 105 CFLAGS += -I$(TOPDIR)/android 106 CFLAGS += -I$(NDK)/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/lib/gcc/arm-linu x-androideabi/4.4.3/include 107 108 LDFLAGS += -nostartfiles -nodefaultlibs -nostdlib -Bdynamic 109 LDFLAGS += -Wl,--dynamic-linker -Wl,/system/bin/linker 110 LDFLAGS += -L$(NDK_ARCH)/usr/lib 111 LDFLAGS += -L$(NDK)/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/lib/gcc/arm-lin ux-androideabi/4.4.3/ 112 LDFLAGS += -Wl,-rpath-link -Wl,$(NDK_ARCH)/usr/lib 113 LDFLAGS += -llog 114 115 # __mb_sb_limit localeconv 116 ifdef OLSRD_PLUGIN 117 #LDFLAGS += -L$(NDK)/sources/crystax/libs/armeabi-v7a/4.4.3 118 #LDFLAGS += -lcrystax_shared 119 endif 120 121 ifndef OLSRD_PLUGIN 122 LDFLAGS += $(NDK_ARCH)/usr/lib/crtbegin_dynamic.o 123 endif 124 125 LIBS += $(NDK)/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/lib/gcc/arm-linux-an droideabi/4.4.3/libgcc_eh.a 126 LIBS += -Wl,-lc -Wl,-lm -Wl,-lgcc 127 ifndef OLSRD_PLUGIN 128 LIBS += $(NDK_ARCH)/usr/lib/crtend_android.o 129 endif 130 OS_LIB_DYNLOAD = -ldl 131 132 # Local Variables: 133 # mode: makefile 134 # End: compile olsrd: make OS="android" Directly compile jansson src together with olsrd src does not work. Compile a jansson .so using android maker and use it as ext lib when compile olsrd for android. Download jansson-android src: https://github.com/julienr/jansson-android.git Compile it. If there is problem with NDK's awk file, rename it to something else. Host's awk will be used instead. Configure lib/dtndisc/Makefile: 39 OLSRD_PLUGIN = true 40 PLUGIN_NAME = olsrd_dtndisc 41 PLUGIN_VER = 0.1 42 43 TOPDIR = ../.. 44 include $(TOPDIR)/Makefile.inc 45 46 #LIBS += -ljson 47 ifeq ($(OS),android) 48 #JSONSRC = $(wildcard src/jansson/src/*.c *.c) 49 #CFLAGS += -I./src/jansson/src 50 #JSONSRC = $(wildcard src/jansson-android/jni/*.c *.c) 51 CFLAGS += -I./src/jansson-android/jni 52 LDFLAGS += -L./libs/armeabi 53 LIBS += -ljansson 54 else 55 JSONSRC = $(wildcard src/json-c/*.c *.c) 56 CFLAGS += -I./src/json-c 57 endif 58 59 OBJS += $(JSONSRC:%.c=%.o) 60 default_target: $(PLUGIN_FULLNAME) 61 62 $(PLUGIN_FULLNAME): $(OBJS) version-script.txt 63 @echo "[LD] $@" 64 @$(CC) $(LDFLAGS) -o $(PLUGIN_FULLNAME) $(OBJS) $(LIBS) 65 66 install: $(PLUGIN_FULLNAME) 67 $(STRIP) $(PLUGIN_FULLNAME) 68 $(INSTALL_LIB) 69 70 uninstall: 71 $(UNINSTALL_LIB) 72 73 clean: 74 rm -f $(OBJS) $(SRCS:%.c=%.d) $(PLUGIN_FULLNAME) ===== 5.x Sample dtn app ===== ==== 4.x Android DTN chat ==== === 3.x Binding with Bytewalla === Bytewalla use local Binding mechanism to allow applications access to DTN functionalities. Upon binding with DTNService, a DTNAPIBinder is returned to client app. With this Binder, client app can register with DTNDaemon and send, receive DTN messages. The drawback of this is that application must be local to Bytewalla app. It's not possible for an independent app to communicate with Bytewalla this way. Other ways of IPC within Android Platform is to use Messenger or AIDL. For this simple application Messenger is prefered over a full AIDL implementation. On Bytewalla side, a Service called DTNAPIService is implemented. On one hand, DTNAPIService is locally bound with DTNService so it is able to act as a client to DTNService. On the other hand, DTNAPIService communicate with an independent application wishing to send messages over DTN network. Messenger is the Mechanism that realize the communication with client app. Message semantic and protocol are defined in an external package called BytewallaApplib. === 3.x DTNAPIService Message Handler === === Client app Message Handler === ==== Message Factory ==== Message: dst, src, content, bundlespec info. ==== Sending message ==== === Client app sends message ===