博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
NS2 - TORA协议修正
阅读量:4099 次
发布时间:2019-05-25

本文共 940 字,大约阅读时间需要 3 分钟。

问题描述

NS2.35中自带了经典的TORA路由协议,但是无法正常运行,需要对其C++源文件进行修改。

TORA修改

需要修改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/

你可能感兴趣的文章
iOS开发支付集成之微信支付
查看>>
浅谈JavaScript--声明提升
查看>>
React非嵌套组件通信
查看>>
Websocket 使用指南
查看>>
浏览器兼容性问题解决方案 · 总结
查看>>
一个很棒的Flutter学习资源列表
查看>>
为什么你应该放弃React老的Context API用新的Context API
查看>>
Koa2初体验
查看>>
Koa 2 初体验(二)
查看>>
Koa2框架原理解析和实现
查看>>
C++模板
查看>>
【C#】如何实现一个迭代器
查看>>
【C#】利用Conditional属性完成编译忽略
查看>>
【Unity】微信登录后将头像存为bytes,将bytes读取成sprite图片
查看>>
【Unity】使用GPS定位经纬度
查看>>
最小费用流 Bellman-Ford与Dijkstra 模板
查看>>
zookeeper(3)---zookeeper API的简单使用(增删改查操作)
查看>>
zookeeper(4)---监听器Watcher
查看>>
mapReduce(3)---入门示例WordCount
查看>>
hbase(3)---shell操作
查看>>