ns的网络功能实体结构及类结构内容摘要:

Module/xxx在 register函数中都会 new一个 classifier Node instproc installentry { module clsfr {hook } } { $self instvar classifier_ mod_assoc_ hook_assoc_ if [info exists classifier_] { if [info exists mod_assoc_($classifier_)] { $self unregistermodule $mod_assoc_($classifier_) unset mod_assoc_($classifier_) } Connect the new classifier to the existing classifier chain, if there is any. if [info exists hook_assoc_($classifier_)] { if { $hook == target } { $clsfr target $hook_assoc($classifier_) } elseif { $hook != } { $clsfr install $hook $hook_assoc_($classifier_) } set hook_assoc_($clsfr) $hook_assoc_($classifier_) unset hook_assoc_($classifier_) } } set mod_assoc_($clsfr) $module set classifier_ $clsfr } 保存最后一次调用时的clsfr module列表,以 classifier为索引 classifier列表,以 classifier为索引 RtModule instproc register { node } { Attach to node and register routing notifications $self attachnode $node $node routenotify $self $node portnotify $self } 进入到 rtmodule的c++代码中,把该节点的指针交给rtmodule的一个变量 Node instproc routenotify { module } { $self instvar rtnotif_ if {$rtnotif_ == } { set rtnotif_ $module } else { $rtnotif_ routenotify $module } $module cmd routenotify $self } RtModule instproc routenotify { module } { $self instvar next_rtm_ if {$next_rtm_ == } { set next_rtm_ $module } else { $next_rtm_ routenotify $module } } 把 rtmoudule构成链表 Node instproc portnotify { module } { $self instvar ptnotif_ lappend ptnotif_ $module } Node RtModule/Base Classifier/Hash/Dest mod_assoc_(_o13)=_o12 classifier_ entry_ 红色是Node的变量 表示对象之间的联系纽带 数据包的传输 set n1 [$ns node] _o11 _o11 info class Node _o12 info class RtModule/Base _o13 info class Classifier/Hash/Dest set n2 [$ns node] _o14 _o14 info class Node _o15 info class RtModule/Base _o16 info class Classifier/Hash/Dest _o17 info class invalid mand name _o17 while executing _o17 info class 路由模块,如果要加入策略路由的话,或者自己开发路由协议,需要自己开发这个模块。 其实该模块的功能是计算路由,而执行路由是由 Classifier进行的 路由的执行 启动过程 3☆ • $ns duplexlink $n0 $n1 1Mb 10ms DropTail tcl/lib/ Simulator instproc duplexlink { n1 n2 bw delay type args } { $self instvar link_ set i1 [$n1 id] set i2 [$n2 id] if [info exists link_($i1:$i2)] { $self removenamlinkconfig $i1 $i2 } eval $self simplexlink $n1 $n2 $bw $delay $type $args eval $self simplexlink $n2 $n1 $bw $delay $type $args Modified by GFR for nixvector routing if { [Simulator set nixrouting] } { Inform nodes of neighbors $n1 setneighbor [$n2 id] $n2 setneighbor [$n1 id] } } $ns duplexlink $n1 $n2 1Mb 10ms DropTail _o17 info class Queue/DropTail _o18 info class SimpleLink _o19 info class Connector _o20 info class Connector _o21 info class DelayLink _o22 i。
阅读剩余 0%
本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。 用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。