本文共 940 字,大约阅读时间需要 3 分钟。
NS2.35中自带了经典的TORA路由协议,但是无法正常运行,需要对其C++源文件进行修改。
需要修改3个C++源文件:ns/ns-2.35/tora/tora.h, ns/ns-2.35/tora/tora.cc, ns/ns-2.35/imep/imep.cc
(1) 修改 ns/ns-2.35/tora/tora.h
添加头文件:
#include
在最后添加:
//added for the port -dmux, for passing packets up to agentsprotected: PortClassifier *dmux_;
(2) 修改 ns/ns-2.35/tora/tora.cc
在 int toraAgent::command(int argc, const charconst argv) 函数的最后一个 else if 后 添加:
else if (strcmp(argv[1], "port-dmux") == 0) { dmux_ = (PortClassifier *)TclObject::lookup(argv[2]); if (dmux_ == 0) { fprintf (stderr, "%s: %s lookup of %s failed\n", __FILE__, argv[1], argv[2]); return TCL_ERROR; } return TCL_OK;}
(3) 修改 ns/ns-2.35/imep/imep.cc
将 void imepAgent::handlerReXmitTimer() 函数中的 rexmitTimer.start(rexat - CURRENT_TIME); 替换为:
if (rexat-CURRENT_TIME<0.000001) // Preventing eternal loop. rexmitTimer.start(0.000001);else rexmitTimer.start(rexat - CURRENT_TIME);
如果没有修改 可能会出现死循环。
转载地址:http://pqrii.baihongyu.com/