Example Application: TinyKeyMan

  1. Node Configuration
  2. Code Generation
  3. Updating Makefile
  4. Build
  5. Run

 

  1. Node Configuration

#include "gen/cTinyKeyMan_TinyOSModule.h"
#include "gen/cTinyKeyMan_Main.h"

   cTinyKeyMan_Main *m = new cTinyKeyMan_Main(this,main,"Main",getIndex());
   m->StdControl_init();
   m->StdControl_start();
 
  1. Code Generation

NesCT is going to build all the classes in gen directory. Replace "cp" with "copy" and slash (/) with backslash (\) for windows operating system at the following instructions.


[root@sinan tictoc]# cd components/
[root@sinan components]# cp TinyKeyMan.nc ../Application.nc
[root@sinan components]# cd ..
[root@sinan tictoc]# ./nesct.exe Application.nc

done.
 

  1. Updating Makefile

  Type makemake.bat/makemake.sh to create new Makefile for Win32/Linux.
  1. Build

Type "make" to build the binary.


[root@sinan tictoc]# make
g++ -c -g -fpermissive -fPIC -DWITH_NETBUILDER -w -DTOSNODES=1000 -DLINUX -DPLATFORM_OMNETPP -I./include -I/root/projects/tinyos-1.x/tos/interfaces -I./include_tos -I/opt/omnetpp-3.2/include simstart.cc
g++ tictoc1_n.o debug.o simstart.o tinyos.o tinyosmain.o tossim.o txc1.o -g -L/opt/omnetpp-3.2/lib -lenvir -lcmdenv -lsim_std -lnedxml -lxml2 -ldl -lstdc++ -lpthread -o tictoc
echo>.tstamp

  1. Run

Let's enable all debug options for demonstration purposes. Use "export" keyword for linux and "set" keyword for windows to change environment variable. You should see an output similar to this in TK window. "set DBG=all" for this case.

                           

[root@sinan tictoc]# export DBG=usr1,usr2,usr3
[root@sinan tictoc]# ./tictoc
DBG: layout done in 0 secs, 41 iterations (0 sec/iter)
[1] 0:0:0.97656250:node 1 Send Success !
[2] 0:0:0.97656250:node 2 received message from 1. type1: request to establish common key!
[2] 0:0:0.97656250:same= 0
[2] 0:0:0.97656250:node2 send answer to node1.
[2] 0:0:0.97656250:node 2 Send Success !
[1] 0:0:0.97656250:node 1 received answer from node 2. type3: have no same poly_id !
[1] 0:0:0.97656250:node 1 broadcast message.
[1] 0:0:0.97656250:node 1 Send Success !
[0] 0:0:0.97656250:node0 received message type4: request to establish path key!
[0] 0:0:0.97656250:sames=0, samed=0
[3] 0:0:0.97656250:node3 received message type4: request to establish path key!
[3] 0:0:0.97656250:same poly_id= 16
[3] 0:0:0.97656250:same poly_id= 24
[3] 0:0:0.97656250:sames=1, samed=1
[3] 0:0:0.97656250:random key=2E7F 1EC3 7FBB BD4B
[3] 0:0:0.97656250:node3 send answer to node1.
[3] 0:0:0.97656250:node 3 Send Success !
[1] 0:0:0.97656250:node1 received path key from node3. type5
[1] 0:0:0.97656250:find poly_id= 16
[1] 0:0:0.97656250:keys= 5BE3 9933 8DC1 533A
[1] 0:0:0.97656250:key=2E7F 1EC3 7FBB BD4B
[1] 0:0:0.97656250:node1 send answer to node2.
[1] 0:0:0.97656250:------RESULT:node_s1 and node_d2 have established key
[1] 0:0:0.97656250:------RESULT:key=2E7F 1EC3 7FBB BD4B
[1] 0:0:0.97656250:node 1 Send Success !
[2] 0:0:0.97656250:node2 received path key from node1. type6
[2] 0:0:0.97656250:find poly_id= 24
[2] 0:0:0.97656250:keyd= 395D B984 3E1E AF06
[2] 0:0:0.97656250:key=2E7F 1EC3 7FBB BD4B
[2] 0:0:0.97656250:------RESULT:node_s2 and node_d1 have established key
[2] 0:0:0.97656250:------RESULT:key=2E7F 1EC3 7FBB BD4B
Total memory consumption of node 0 is : 2306
Radio Sent: 0


Why can't the nodes establish keys ?

The reason why these nodes cannot establish pairwise keys is that they don't share common polynomial id. The polynomial id is generated randomly. Since we usually test many nodes, it is more possible they have common polynomial id or at least they can find a path to establish pairwise keys. It maybe better you simulate more nodes.



                               

 


This project has been supported by Featherlight project at University of Twente, the Netherlands and European Embedded WiseNt project at Yeditepe University.