ns2.35下gpsr协议移植
2016-04-06 18:10
323 查看
一、下载gpsr协议源码,在~/ns-allinone-2.35/ns-2.35下解压,得到gpsr文件夹。
源码地址:点击打开链接
7个为协议实现文件:
gpsr_packet.h: definition of packets of different type used by thisimplementaion
gpsr_neighbor.h : definition of the neighbor listof each node used by this gpsr implementation
including the planaringprocedure
(both GG and RNG)
gpsr_neighbor.cc : theimplementation of the neighbor list class
gpsr.h : thedefinition of functions of GPSR routing agent of thisimplementation
gpsr.cc : the implementation of the GPSR routingagent
gpsr_sinklist.h: definition used for scenarios withmultiple sinks
gpsr_sinklist.cc:implementation of gpsr_sinklist.cc
以下4个文件为仿真所需文件
gpsr.tcl: the node and agent creation functions used by simultionconfiguration
in wireless-gpsr.tcl
wireless-gpsr.tcl : thesimulation configuration
grid-deploy10x10.tcl: 100 nodes in a 200x200 meter area
cbr100.tcl: node 99 sends cbr traffic on UDP to node 0
二、修改packet.h
进入~/ns-allinone-2.35/ns-2.35/common文件夹,打开packet.h文件,增加一行:
staticconst packet_t PT_GPSR = 73
三、修改trace/cmu-trace.cc
进入~/ns-allinone-2.35/ns-2.35/trace,打开cmu-trace.cc文件。
在65行左右增加一行:
#include<gpsr/gpsr_packet.h>
在voidCMUTrace::format(Packet
*p, const char *why){}中第1460行左右增加2行:
casePT_GPSR:
break;
四、修改priqueue.cc
进入~/ns-allinone-2.35/ns-2.35/queue文件夹,打开priqueue.cc文件。
在voidPriQueue::rece(Packet
*p, Handler *h){}中第95行附近增加一行:
casePT_GPSR:
五、修改ns-packet.tcl、ns-lib.tcl
在~/ns-allinone-2.35/ns-2.35/tcl/lib文件夹,打开ns-packet.tcl文件。
在setprotolist{}中174行附近加入一行
GPSR
六、修改Makefile
在~/ns-allinone-2.35/ns-2.35,打开Makefile
在OBJ_CC=的最后加入<
a8d3
br />
gpsr/gpsr_neighbor.ogpsr/gpsr_sinklist.o gpsr/gpsr.o \
注意:每个【.o】后均有一个空格,包括最后一个【gpsr.o】
如果需要加入调试信息,则在CCOPT=
-Wall 加上-g,如下:
CCOPT= -g -Wall
七、重新编译
cd ~/ns-allinone-2.35/ns-2.35/common
touch packet.cc
cd ..
make clean
make 注意:()
源码地址:点击打开链接
7个为协议实现文件:
gpsr_packet.h: definition of packets of different type used by thisimplementaion
gpsr_neighbor.h : definition of the neighbor listof each node used by this gpsr implementation
including the planaringprocedure
(both GG and RNG)
gpsr_neighbor.cc : theimplementation of the neighbor list class
gpsr.h : thedefinition of functions of GPSR routing agent of thisimplementation
gpsr.cc : the implementation of the GPSR routingagent
gpsr_sinklist.h: definition used for scenarios withmultiple sinks
gpsr_sinklist.cc:implementation of gpsr_sinklist.cc
以下4个文件为仿真所需文件
gpsr.tcl: the node and agent creation functions used by simultionconfiguration
in wireless-gpsr.tcl
wireless-gpsr.tcl : thesimulation configuration
grid-deploy10x10.tcl: 100 nodes in a 200x200 meter area
cbr100.tcl: node 99 sends cbr traffic on UDP to node 0
二、修改packet.h
进入~/ns-allinone-2.35/ns-2.35/common文件夹,打开packet.h文件,增加一行:
staticconst packet_t PT_GPSR = 73
三、修改trace/cmu-trace.cc
进入~/ns-allinone-2.35/ns-2.35/trace,打开cmu-trace.cc文件。
在65行左右增加一行:
#include<gpsr/gpsr_packet.h>
在voidCMUTrace::format(Packet
*p, const char *why){}中第1460行左右增加2行:
casePT_GPSR:
break;
四、修改priqueue.cc
进入~/ns-allinone-2.35/ns-2.35/queue文件夹,打开priqueue.cc文件。
在voidPriQueue::rece(Packet
*p, Handler *h){}中第95行附近增加一行:
casePT_GPSR:
五、修改ns-packet.tcl、ns-lib.tcl
在~/ns-allinone-2.35/ns-2.35/tcl/lib文件夹,打开ns-packet.tcl文件。
在setprotolist{}中174行附近加入一行
GPSR
六、修改Makefile
在~/ns-allinone-2.35/ns-2.35,打开Makefile
在OBJ_CC=的最后加入<
a8d3
br />
gpsr/gpsr_neighbor.ogpsr/gpsr_sinklist.o gpsr/gpsr.o \
注意:每个【.o】后均有一个空格,包括最后一个【gpsr.o】
如果需要加入调试信息,则在CCOPT=
-Wall 加上-g,如下:
CCOPT= -g -Wall
七、重新编译
cd ~/ns-allinone-2.35/ns-2.35/common
touch packet.cc
cd ..
make clean
make 注意:()
八、 运行仿真
相关文章推荐
- 策略模式
- 将studio中的library引进eclipse里
- android greenDao SQLite数据库操作工具类使用
- SQLServer设置大小写敏感
- 需求用例分析之三:补充规约
- 关键路径算法
- LayoutInflater两个inflate方法的区别
- 笔试练习三
- java.io.FileNotFoundException: URL [jndi:/localhost/myBlogSys/WEB-INF/classes/] cannot be resolved t
- mongoDB window平台安装MongoDB
- VI nagios
- [MUI框架]-滑动侧边栏-webview模式
- TextView+ScrollView显示大量文本(小说)
- 基于Http协议的Android网络编程
- OPRNGL之渲染过程大概梳理
- php 使用GD库压缩图片,添加文字图片水印
- 串口初始化
- /proc/sysrq-trigger文件的功能
- Android酷炫实用的开源框架(UI框架)
- webservice开发