Chinaunix

标题: ns2.27 下添加cbrp [打印本页]

作者: yangyanjun185    时间: 2008-04-02 23:49
标题: ns2.27 下添加cbrp


文件:
totals-cbrp.rar
大小:
7KB
下载:
下载
ns2.27下添加cbrp协议


No:1    tcl\lib下面的ns-packet.tcl,修改115行,添加CBRP
     foreach prot {
                         CBRP……
                       }
    这是添加包头名字

No:2   修改\ns-allinone-2.27\ns-2.27\common下面的packet.h,增加包类型的定义。在enum packet_t中添加一项表示新增的包类型,名字为PT_CBRP,然后在class p_info类的p_info()构造函数中增加一行给出新增包类型的名字:
     name_[PT_CBRP]= "CBRP";

No:3  修改makefile和makefile.in两个文件,在OBJ_CC 中添加如下条目:
  cbrp/cbrpagent.o cbrp/ntable.o cbrp/hdr_cbrp.o \
ps:要先改makefile.in后改makefile,要不然会编译错误,说~.in is newer than ~.
还需修改

No:4引用的
在\ns-allinone-2.27\ns-2.27\empweb\scripts目录下,添加totals-cbrp.pl这个文件,这个步骤是我参考maillist得来的,具体原因目前未知,希望高手指点。原贴地址为:
     
http://mailman.isi.edu/pipermail/ns-users/2004-May/042275.html


No:5 修改trace/cmu-trace.h和cmu-trace.cc文件

No:6 在编译协议的时候会报错,但从网上查到说不影响结果,还是改了好啊,在indep-utils\webtrace-conv\dec\proxytrace2any.cc的main函数前,添加两条语句
extern int IsLittleEndian(void);
extern void ToOtherEndian(TEntry *e ) ;

No:7  参考柯老师的tcl/lib/ns-lib.tcl
1:  Simulator instproc create-wireless-node args {
2:      # ...
3:      switch -exact $routingAgent_ {
4:          Protoname {
5:              set ragent [$self create-protoname-agent $node]
6:          }
7:          # ...
8:      }
9:      # ...
10: }
tcl/lib/ns-lib.tcl
1: Simulator instproc create-protoname-agent { node } {
2:         # Create Protoname routing agent
3:         set ragent [new Agent/Protoname [$node node-addr]]
4:         $self at 0.0 "$ragent start"
5:         $node set ragent_ $ragent
6:         return $ragent
7: }
在ns-2.30下的Makefile文件中加入-g选项:CCOPT=-g -Wall
其中-Wall是原有的,加入-g这个是为了以后调试的时候,可以显示出详细的调试信息。
差不多就改这些了,然后make clean, make depend, make。


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/54616/showart_515812.html




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2