Castalia OMNET++ 中的 CTP 协议
Posted
技术标签:
【中文标题】Castalia OMNET++ 中的 CTP 协议【英文标题】:CTP protocol in Castalia OMNET++ 【发布时间】:2015-05-05 22:21:38 【问题描述】:当我使用 CTP https://code.google.com/p/ctp-castalia/
make
Castalia-3.2 时出现此错误。我有 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
;
^
【问题讨论】:
请为编译器抱怨的文件和行发布代码 sn-ps。您得到的错误是与声明和初始化相关的编译时错误。但是如果没有 sn-ps 就很难说... 您好,我没有对代码进行任何更改。这是从code.google.com/p/ctp-castalia下载CTP获得的确切代码 当然,但是您应该将代码 sn-ps 放入问题中,以便其他人可以访问它们......并且根据纯粹的常识:如果您没有,没有人会费心为您检查代码不用费心自己添加 【参考方案1】:网站上的issue tracker有一些问题已经解决,与make
有关。
其中一个修复建议如下:
在CtpTestingApplication.cc
和CtpTestingApplication.h
中 在CtpTestingApplication.cc
中将ApplicationGenericDataPacket
替换为ApplicationPacket
注释掉整个update_packets_received()
方法从
update_ddr_perSN()
方法中删除declareOutput("My Stats", SN) ;
并将declareOutput("My Stats") ;
放在startup()
方法中在
将mac/cc2420Mac/CC2420Mac.cc
getRoutingInteractionControl()
的实例替换为getNetMacInfoExchange()
将getMacInteractionControl()
替换为getMacRadioInfoExchange()
在分配的右侧用 LQI 交换 RSSI(原始代码中的小错误)可选,取决于平台(我的 Mac OSX 必须这样做)
在
mac/cc2420Mac/TosEnvironment.h
和routing/ctpNoe/components/TosEnvironment.h:79
第 79 行替换0x100000000
和0xffffffff
在
将第 1080 行routing/ctpNoe/components/CtpForwardingEngine.cc
netPkt->getNetMacInfoExchange().source = selfAddress.c_str() ;
// 好的替换为netPkt->setSource(selfAddress.c_str()) ;
// 好的将
getRoutingInteractionControl()
的实例替换为getNetMacInfoExchange()
(第 213、1053、1081 行)在
将routing/ctpNoe/components/CtpRoutingEngine.cc
ANDrouting/ctpNoe/components/DualBuffer.cc
ANDrouting/ctpNoe/components/LinkEstimator.cc
getRoutingInteractionControl()
的实例替换为getNetMacInfoExchange()
PS:问题可能是由于使用 OMNET 4.6 引起的。较低版本 (4.2) 可能与 Castalia
一起工作更好
【讨论】:
以上是关于Castalia OMNET++ 中的 CTP 协议的主要内容,如果未能解决你的问题,请参考以下文章
安装时 OMNeT++ 和 INET 示例中的参数未分配错误