源码地址:点击打开链接
7个为协议实现文件:
gpsr_packet.h : definition of packets of different type used by this implementaion
gpsr_neighbor.h : definition of the neighbor list of each node used by this gpsr implementation including the planaring procedure (both GG and RNG)
gpsr_neighbor.cc : the implementation of the neighbor list class
gpsr.h : the definition of functions of GPSR routing agent of this implementation
gpsr.cc : the implementation of the GPSR routing agent
gpsr_sinklist.h: definition used for scenarios with multiple sinks
gpsr_sinklist.cc: implementation of gpsr_sinklist.cc
以上4个文件为仿真所需文件
gpsr.tcl : the node and agent creation functions used by simultion configuration in wireless-gpsr.tclcbr100.tcl : node 99 sends cbr traffic on UDP to node 0
进入~/ns-allinone-2.35/ns-2.35/common文件夹, 打开packet.h文件,增加一行:
static const packet_t PT_GPSR = 73
关键代码如图:
static const packet_t PT_GPSR = 73; // insert new packet types here static packet_t PT_NTYPE = 74; // This MUST be the LAST one
进入~/ns-allinone-2.35/ns-2.35/trace,打开cmu-trace.cc文件。
在65行左右增加一行:
#include <gpsr/gpsr_packet.h>
关键代码如图:
#include <mdart/mdart_function.h> #include <gpsr/gpsr_packet.h> #include <cmu-trace.h>
关键代码如图:
case PT_PING: break; case PT_GPSR: break; default:
case PT_GPSR:
关键代码如图:
case PT_AOMDV: case PT_GPSR: case PT_MDART:
GPSR
关键代码如图:
Diffusion # diffusion/diffusion.cc GPSR IMEP # Internet MANET Encapsulation Protocol, for ad-hoc networks
gpsr/gpsr_neighbor.o gpsr/gpsr_sinklist.o gpsr/gpsr.o \
关键代码如图:
wpan/p802_15_4trace.o wpan/p802_15_4transac.o \ apps/pbc.o \ gpsr/gpsr_neighbor.o gpsr/gpsr_sinklist.o gpsr/gpsr.o \ $(OBJ_STL)
CCOPT = -g -Wall
cd ~/ns-allinone-2.35/ns-2.35/common touch packet.cc cd .. make clean make
ns wireless_gpsr.tcl
搜索
复制