关于ns2添加mudp

9 篇文章 0 订阅

今天系统重装,所有得都要重来,上回自己都忘了怎么把mudp那些给弄进去得,找到当初得那个示范网页,一步一步来,发现老是在make clean;make那出问题,郁闷。想了半天,发现那大哥得教程(准备写一个NS2 step by stepNS2 by Step (2)  )写得不对,下面把柯老师得教程补充详细了贴上来,以防自己再忘记,如果有童鞋能看到,也不错

1.      Downloadmudp.cc,mudp.h,mudpsink.cc, and mudpsink.h(我这不带链接)

2.      Create a folder named measure under ns. (for example, ~/ns-allinone-2.28/ns-2.28/measure)(就放在这个路径吧,其他我没有试过)

3.      Put these four files into measure folder.

4.      add sendtime_, pkt_id_ into packet common header. (modify common/packet.h)

struct hdr_cmn {

        enum dir_t { DOWN= -1, NONE= 0, UP= 1 };

        packet_t ptype_;      // packet type (see above)

        int     size_;                // simulated packet size

        int     uid_;         // unique id

        int     error_;              // error flag

        int     errbitcnt_;     // # of corrupted bits jahn

        int     fecsize_;

        double      ts_;           // timestamp: for q-delay measurement

        int     iface_;              // receiving interface (label)

        dir_t direction_;        // direction: 0=none, 1=up, -1=down

       double  sendtime_;          ...

        unsigned long int pkt_id_;(添加得)

        ...

        inline int& addr_type() { return (addr_type_); }

        inline int& num_forwards() { return (num_forwards_); }

        inline int& opt_num_forwards() { return (opt_num_forwards_); }

        //monarch_end

       inline double& sendtime() { return (sendtime_); } // added by smallko(添加得)

   }

 

5.      Add the “measure/mudp.o measure/mudpsink.o “ in the OBJ_CC of Makefile.(路径:ns-allinone-2.2x/ns-2.2x,不是ns~/ns-allinone-2.2x/nam-1.1x/

6.      Add “Agent/mUDP set packetSize_ 1000” in the ns-default.tcl. (ns-default.tcl is under ~/ns-allinone-2.28/ns-2.28/tcl/lib)

7.      make clean ; make(要在路径ns-allinone-2.2x/ns-2.2x下)

就是5和7把我折腾了很久

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值