NS2 Notebook: Multi-channel Multi-interface Simulation in NS2 (2.29)

Back to Index


2. Modifications in tcl/lib/ns-mobilenode.tcl

Node/MobileNode instproc add-target-rtagent { agent port } {

  ......

  if { [Simulator set RouterTrace_] == "ON" } {
    #
    # Send Target
    #

    if {$newapi != ""} {
      #Multi-channel Multi-interface
      #set sndT [$self mobility-trace Send "RTR"] ;#original
      set sndT1 [$self mobility-trace Send "RTR"]
      set sndT2 [$self mobility-trace Send "RTR"]
      set sndT3 [$self mobility-trace Send "RTR"]
      set sndT4 [$self mobility-trace Send "RTR"]
      set sndT5 [$self mobility-trace Send "RTR"]

    } else {
      #Multi-channel Multi-interface
      #set sndT [cmu-trace Send "RTR" $self] ;#original

      set sndT1 [cmu-trace Send "RTR" $self]
      set sndT2 [cmu-trace Send "RTR" $self]
      set sndT3 [cmu-trace Send "RTR" $self]
      set sndT4 [cmu-trace Send "RTR" $self]
      set sndT5 [cmu-trace Send "RTR" $self]

    }


    if { $namfp != "" } {
      #Multi-channel Multi-interface
      #$sndT namattach $namfp ;#original

      $sndT1 namattach $namfp
      $sndT2 namattach $namfp
      $sndT3 namattach $namfp
      $sndT4 namattach $namfp
      $sndT5 namattach $namfp

    }


    if { $newapi == "ON" } {
      $agent target $imep_(0)
      $imep_(0) sendtarget $sndT
      # second tracer to see the actual
      # types of tora packets before imep packs them

      if { [info exists toraDebug_] && $toraDebug_ == "ON"} {
      set sndT2 [$self mobility-trace Send "TRP"]
      $sndT2 target $imep_(0)
      $agent target $sndT2
      }
    } else { ;# no IMEP
      #Multi-channel Multi-interface
      #$agent target $sndT ;#original

      $agent down-target-1 $sndT1
      $agent down-target-2 $sndT2
      $agent down-target-3 $sndT3
      $agent down-target-4 $sndT4
      $agent down-target-5 $sndT5

    }


    #Multi-channel Multi-interface
    #$sndT target [$self set ll_(0)] ;#original

    $sndT1 target [$self set ll_(0)]
    $sndT2 target [$self set ll_(1)]
    $sndT3 target [$self set ll_(2)]
    $sndT4 target [$self set ll_(3)]
    $sndT5 target [$self set ll_(4)]

    ......

  } else {
    #
    # Send Target
    #

    # if tora is used
    if { $newapi == "ON" } {
      $agent target $imep_(0)
      # second tracer to see the actual
      # types of tora packets before imep packs them

      if { [info exists toraDebug_] && $toraDebug_ == "ON"} {
      set sndT2 [$self mobility-trace Send "TRP"]
      $sndT2 target $imep_(0)
      $agent target $sndT2
      }
      $imep_(0) sendtarget [$self set ll_(0)]

    } else { ;# no IMEP
      #Multi-channel Multi-interface
      #$agent target [$self set ll_(0)] ;#original

      $agent down-target-1 [$self set ll_(0)]
      $agent down-target-2 [$self set ll_(1)]
      $agent down-target-3 [$self set ll_(2)]
      $agent down-target-4 [$self set ll_(3)]
      $agent down-target-5 [$self set ll_(4)]

    }

  ......

}

 
© Copyright 2008. All rights reserved. Powered by Free Site Templates