Castalia OMNET++ 中的 CTP 协议

CTP protocol in Castalia OMNET++

当我使用 CTP make Castalia-3.2 https://code.google.com/p/ctp-castalia/ 时出现此错误。我有 omnetpp-4.6。

命令 - omnetpp 工作正常。我能够 运行 像 dyna 这样的例子。

Castalia-3.2 在未集成 CTP 时也能正常工作。

当我集成CTP时,Castalia - make报错(最后提到)。

我遵循了 CTP 协议提供的 Readme.txt。

1) Copy CtpTest in CASTALIA_HOME/Simulations
2) Copy ctpTestingApplication CASTALIA_HOME/src/node/application/
3) Copy ctpNoe in CASTALIA_HOME/src/node/communication/routing/
4) Copy cc2420Mac in CASTALIA_HOME/src/node/communication/mac/
5) make clean
6) ./makemake
7) make

你能告诉我我做错了什么吗?

  In file included from src/node/communication/mac/cc2420Mac/CC2420Mac.h:108:0,
             from src/node/communication/mac/cc2420Mac/CC2420Mac.cc:104:
    src/node/communication/mac/cc2420Mac/TosEnvironment.h:11:17: error: conflicting declaration ‘typedef uint8_t error_t’
      typedef uint8_t error_t;
             ^
     In file included from /usr/include/c++/4.8/cerrno:41:0,
             from /usr/include/c++/4.8/ext/string_conversions.h:44,
             from /usr/include/c++/4.8/bits/basic_string.h:2815,
             from /usr/include/c++/4.8/string:52,
             from /usr/include/c++/4.8/stdexcept:39,
             from /usr/include/c++/4.8/array:38,
             from /usr/include/c++/4.8/tuple:39,
             from /usr/include/c++/4.8/bits/stl_map.h:63,
             from /usr/include/c++/4.8/map:61,
             from src/node/communication/mac/VirtualMac.h:19,
             from src/node/communication/mac/cc2420Mac/CC2420Mac.h:106,
             from src/node/communication/mac/cc2420Mac/CC2420Mac.cc:104:
 /usr/include/errno.h:68:13: error: ‘error_t’ has a previous declaration as ‘typedef int error_t’
 typedef int error_t;
         ^
In file included from /usr/include/asm-generic/errno.h:4:0,
             from /usr/include/x86_64-linux-gnu/asm/errno.h:1,
             from /usr/include/linux/errno.h:1,
             from /usr/include/x86_64-linux-gnu/bits/errno.h:24,
             from /usr/include/errno.h:35,
             from /usr/include/c++/4.8/cerrno:41,
             from /usr/include/c++/4.8/ext/string_conversions.h:44,
             from /usr/include/c++/4.8/bits/basic_string.h:2815,
             from /usr/include/c++/4.8/string:52,
             from /usr/include/c++/4.8/stdexcept:39,
             from /usr/include/c++/4.8/array:38,
             from /usr/include/c++/4.8/tuple:39,
             from /usr/include/c++/4.8/bits/stl_map.h:63,
             from /usr/include/c++/4.8/map:61,
             from src/node/communication/mac/VirtualMac.h:19,
             from src/node/communication/mac/cc2420Mac/CC2420Mac.h:106,
             from src/node/communication/mac/cc2420Mac/CC2420Mac.cc:104:

src/node/communication/mac/cc2420Mac/TosEnvironment.h:23:5: error: expected identifier before numeric constant
 EBUSY = 3,
 ^
  src/node/communication/mac/cc2420Mac/TosEnvironment.h:23:5: error:     expected ‘}’ before numeric constant

 src/node/communication/mac/cc2420Mac/TosEnvironment.h:23:5: error:    expected unqualified-id before numeric constant
 In file included from src/node/communication/mac/cc2420Mac/CC2420Mac.h:108:0,
             from src/node/communication/mac/cc2420Mac/CC2420Mac.cc:104:

src/node/communication/mac/cc2420Mac/TosEnvironment.h:28:1: error: expected declaration before ‘}’ token

};
^

网站上的 issue tracker 有一些问题已经解决,与 make 有关。

其中一个修复建议如下:

  • in CtpTestingApplication.cc and CtpTestingApplication.h
  • replace ApplicationGenericDataPacket with ApplicationPacket in CtpTestingApplication.cc
  • comment out the whole update_packets_received() method
  • delete declareOutput("My Stats", SN) ; from the update_ddr_perSN() method and put declareOutput("My Stats") ; at the startup() method

  • in mac/cc2420Mac/CC2420Mac.cc

  • replace instances of getRoutingInteractionControl() with getNetMacInfoExchange()
  • replace getMacInteractionControl() with getMacRadioInfoExchange()
  • swap RSSI with LQI in the right hand side of the assignments (little bug in the original code)

Optional, depends on platform (I had to do it for my Mac OSX)

  • in mac/cc2420Mac/TosEnvironment.h AND in routing/ctpNoe/components/TosEnvironment.h:79 line 79 replace 0x100000000 with 0xffffffff

  • in routing/ctpNoe/components/CtpForwardingEngine.cc

  • replace line 1080 netPkt->getNetMacInfoExchange().source = selfAddress.c_str() ; // ok with
    netPkt->setSource(selfAddress.c_str()) ; // ok
  • replace instances of getRoutingInteractionControl() with getNetMacInfoExchange() (lines 213, 1053, 1081)

  • in routing/ctpNoe/components/CtpRoutingEngine.cc AND routing/ctpNoe/components/DualBuffer.cc AND routing/ctpNoe/components/LinkEstimator.cc

  • replace instances of getRoutingInteractionControl() with getNetMacInfoExchange()

PS:可能是由于使用OMNET 4.6 引入的问题。较低版本 (4.2) 可能更适用于 Castalia