Chinaunix首页 | 论坛 | 博客
  • 博客访问: 537514
  • 博文数量: 126
  • 博客积分: 2071
  • 博客等级: 大尉
  • 技术积分: 1522
  • 用 户 组: 普通用户
  • 注册时间: 2010-08-24 16:09
文章分类
文章存档

2013年(8)

2012年(37)

2011年(80)

2010年(1)

分类: LINUX

2012-11-11 15:04:36

General Architecture of a mobile node in ns-2:

 

the relationship of MAC could be found in ns-mobilenode.tcl. The source code:

........
#
# The following setups up link layer, mac layer, network interface
# and physical layer structures for the mobile node.
#
Node/MobileNode instproc add-interface { channel pmodel lltype mactype \
qtype qlen iftype anttype topo inerrproc outerrproc fecproc} {
$self instvar arptable_ nifs_ netif_ mac_ ifq_ ll_ imep_ inerr_ outerr_ fec_

.......
#
# Link Layer
#
$ll arptable $arptable_
$ll mac $mac $ll down-target $ifq if {$imepflag == "ON" } { $imep recvtarget [$self entry] $imep sendtarget $ll $ll up-target $imep } else { $ll up-target [$self entry] } # # Interface Queue # $ifq target $mac $ifq set limit_ $qlen if {$imepflag != ""} { set drpT [$self mobility-trace Drop "IFQ"] } else { set drpT [cmu-trace Drop "IFQ" $self] } $ifq drop-target $drpT if { $namfp != "" } { $drpT namattach $namfp } # Mac Layer # $mac netif $netif
$mac up-target $ll
if {$outerr == "" && $fec == ""} { $mac down-target $netif } elseif {$outerr != "" && $fec == ""} { $mac down-target $outerr $outerr target $netif } elseif {$outerr == "" && $fec != ""} { $mac down-target $fec $fec down-target $netif } else { $mac down-target $fec $fec down-target $outerr $err target $netif }

Actually, from top to down path, the structure is  ll  --->  ifq ----> mac ---> netif . for packets going up, it is netif ---> mac --->ll. Thus, ifq is only used for down path of . however, a scheduler is also only useful to handle outgoing packets. Thus, if we want to implement a scheduler, we have to use something to replace this "ifq" and remake the interface in tcl script.

阅读(649) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~