lols7小组赛赛制:使用Source Insight 查看和分析NS2代码

来源:百度文库 编辑:偶看新闻 时间:2024/05/04 13:05:00

NS2的核心组件主要是使用C++语言编写的,并通过OTCL机制为仿真脚本提供调用界面。 使用NS2做网络协议和网络性能分析、测量方面的工作,一般需要熟练做到以下两方面:
    (1) 能熟练编写TCL脚本,设定合适的网络场景对自己感兴趣的协议进行测试;
    (2) 掌握NS2下协议编写和修改的过程, 能够读懂相关协议的代码,具备调试能力,并能够修改协议。
     在此,我将简单介绍如何使用Source Insight这一款软件查看NS2中的代码。
  
1. Source Insight   
   Trial Version  User Manual
   Introduction

2. 将.cc 文件添加到Source Insight中:

   1) “Options”     --> “Document Options” 

   2) “Document Options” : 

         "Document Type" 列表中 选择 "C++ Source File" 选项    -->       Add “;*.cc” in “File filter”     -->   “Close” 


3. 将.tcl文件添加到Source Insight中:
     1)  Download tcl language file from:http://www.sourceinsight.com/public/languages/TCL.CLF

     2)   “Options” Menu --> “Preferences”   --> “Languages”  

     3)    In “Languages” Tab:

            Click “import”    --> Select “TCL.CLF”    --> Select “TCL” in “Language” --> Click “Doc Types…” Button in “Languages”   --> “Document Options” 

      4)   In “Document Options” Dialog:

            Click “Add Type…”  -->  Type “tcl” as Document Type Name --> Type “*.tcl” in “File filter” --> Select “TCL” in “Language” Droplist   -->  Select "Include when adding to projects" Checkbox   --> Click “Close” Button


4. 导入 NS2 源代码

     1)  Click "Project" Menu --> New Project --> Type “NS2” as the project name --> Click “OK” Button --> Click “OK” Button in “New Project Setting” Dialog --> “Add and Remove Project Files” Dialog

    2)  In “Add and Remove Project Files” Dialog:

        Select the NS2 source code file folder --> Click “Add All” Button --> Select “Recursively add lower sub-directories” --> Click “OK” Button --> Click “OK” for importing source code --> Click “Close” Button in “Add and Remove Project Files” Dialog

    (以上两步即完成了将NS2代码导入到Source Insight中,其他的分析技巧请参考使用手册).

    还可以选择其他软件:Source Navigator   Source Navigator NG  KDevelop 、 Eclipse for C++

摘自:http://blogold.chinaunix.net/u3/105477/showart_2355097.html