NS2 - TORA协议修正

问题描述

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 <classifier/classifier-port.h>

在最后添加:

//added for the port -dmux, for passing packets up to agents
protected:
	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);

注意

如果没有修改 imep.cc 可能会出现死循环。

  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值