分类: 网络与安全
2013-04-27 10:13:16
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.