Dear all:
    Hi,I'm very sorry to disturb you. Now I also have some questions which need
your help. 
Question:
     I try to add one code into ns-mobilenode.tcl,which is given as below:
        #
        # Mac Layer
        #
        $mac netif $netif
        $mac up-target $ll
         $mac ifq $ifq        ///my code that I add

When I run the tcl,there is a error,like this:

$ ns si-error-dsr.tcl 

    (_o21 cmd line 1)
    invoked from within
"_o21 cmd ifq _o22"
    invoked from within
"catch "$self cmd $args" ret"
    invoked from within
"if [catch "$self cmd $args" ret] {
set cls [$self info class]
global errorInfo
set savedInfo $errorInfo
error "error when calling class $cls: $args" $..."
    (procedure "_o21" line 2)
    (SplitObject unknown line 2)
    invoked from within
"$mac ifq $ifq"
    (procedure "_o14" line 86)
    (Object next line 86)
    invoked from within
"_o14 next _o12 _o13 LL Mac/802_11 CMUPriQueue 50 Phy/WirelessPhy
Antenna/OmniAntenna _o10 {} {} {}"
    ("eval" body line 1)
    invoked from within
"eval $self next $args"
    (procedure "_o14" line 2)
    (SRNodeNew add-interface line 2)
    invoked from within
"$node add-interface $chan $propInstance_ $llType_ $macType_  $ifqType_ $ifqlen_
$phyType_ $antType_ $topoInstance_  $inerrProc_ $outerrProc_ $FECProc_"
    (procedure "_o3" line 72)
    (Simulator create-wireless-node line 72)
    invoked from within
"_o3 create-wireless-node"
    ("eval" body line 1)
    invoked from within
"eval $self create-wireless-node $args"
  (procedure "_o3" line 14)
    (Simulator node line 14)
    invoked from within
"$ns_ node"
    ("for" body line 2)
    invoked from within
"for {set i 0} {$i < $val(nn) } {incr i} {
                set node_($i) [$ns_ node]
                #set rt($i) [$node_($i) agent 255]
                #$rt($i) installTap [$node_($i) set ifq_(..."
    (file "si-error-dsr.tcl" line 72)

Can you please help me and explain to me why this error occur?...Thank you!!!
#########################################################################
Another question:
I find that ns-mobilenode.tcl (I don't alter it) contains many codes which 
include
DSR codes,I give them as below:
#####
Class SRNodeNew -superclass Node/MobileNode

SRNodeNew instproc init args {
        $self instvar dsr_agent_ dmux_ entry_point_ address_

        set ns [Simulator instance]

        eval $self next $args   ;# parent class constructor

        if {$dmux_ == "" } {
                # Use the default mash and shift
                set dmux_ [new Classifier/Port]
        }
        set dsr_agent_ [new Agent/DSRAgent]

        # setup address (supports hier-address) for dsragent
        $dsr_agent_ addr $address_
        $dsr_agent_ node $self
        if [Simulator set mobile_ip_] {
                $dsr_agent_ port-dmux [$self set dmux_]
        }
        # set up IP address
        $self addr $address_
        
        if { [Simulator set RouterTrace_] == "ON" } {
                # Recv Target
                set rcvT [$self mobility-trace Recv "RTR"]
                set namfp [$ns get-nam-traceall]
                if {  $namfp != "" } {
                        $rcvT namattach $namfp
                }
                $rcvT target $dsr_agent_
                set entry_point_ $rcvT  
        } else {
                # Recv Target
                set entry_point_ $dsr_agent_
        }

        $self set ragent_ $dsr_agent_
        $dsr_agent_ target $dmux_

        # packets to the DSR port should be dropped, since we've
        # already handled them in the DSRAgent at the entry.
        set nullAgent_ [$ns set nullAgent_]
        $dmux_ install [Node set rtagent_port_] $nullAgent_

        # SRNodes don't use the IP addr classifier.  The DSRAgent should
        # be the entry point
        $self instvar classifier_
        set classifier_ "srnode made illegal use of classifier_"

        return $self
}

SRNodeNew instproc start-dsr {} {
        $self instvar dsr_agent_
        $dsr_agent_ startdsr
}

SRNodeNew instproc entry {} {
        $self instvar entry_point_
        return $entry_point_
}

SRNodeNew instproc add-interface args {
        eval $self next $args

        $self instvar dsr_agent_ ll_ mac_ ifq_

        set ns [Simulator instance]
        $dsr_agent_ mac-addr [$mac_(0) id]

        if { [Simulator set RouterTrace_] == "ON" } {
                # Send Target
                set sndT [$self mobility-trace Send "RTR"]
                set namfp [$ns get-nam-traceall]
                if {$namfp != "" } {
                        $sndT namattach $namfp
                }
                $sndT target $ll_(0)
                $dsr_agent_ add-ll $sndT $ifq_(0)
        } else {
                # Send Target
                $dsr_agent_ add-ll $ll_(0) $ifq_(0)
        }
        # setup promiscuous tap into mac layer
        $dsr_agent_ install-tap $mac_(0)
}

SRNodeNew instproc reset args {
        $self instvar dsr_agent_
        eval $self next $args
        $dsr_agent_ reset
}
#####
   can you tell me what's the meaning of"$dsr_agent_ add-ll $ll_(0) $ifq_(0)"? 
Do
these codes above only for DSR protocol? I add tcl files:

### 
set dsr_agent_ [new Agent/DSRAgent]
$dsr_agent_ bryan-test
$dsr_agent_ add-ll $ll_(0) $ifq_(0)
###
and the DSRagent.cc code are:

else if (argc == 4)
    {
      if (strcasecmp(argv[1], "add-ll") == 0) 
        {
          if( (obj = TclObject::lookup(argv[2])) == 0) {
            fprintf(stderr, "DSRAgent: %s lookup of %s failed\n", argv[1],
                    argv[2]);
            return TCL_ERROR;
          }
          ll = (NsObject*) obj;
          if( (obj = TclObject::lookup(argv[3])) == 0) {
            fprintf(stderr, "DSRAgent: %s lookup of %s failed\n", argv[1],
                    argv[3]);
            return TCL_ERROR;
          }     
         ifq = (CMUPriQueue *) obj;       
          return TCL_OK;
        }
    }

  But when I run the tcl file,it also produce one error,as below:
$ ns si-error-dsr.tcl 
INITIALIZE THE LIST xListHead
can't read "ll_(0)": no such variable
    while executing
"$dsr_agent_ add-ll $ll_(0) $ifq_(0)"
    (file "si-error-dsr.tcl" line 80)

   I need your help!!!Can you please help me and explain to me why
these errors occur?... 
   In DSRagent.cc,what's the meaning of "ifq->prq_length()"? When I want to 
printf
this,the value of "ifq->prq_length()" is always zero. Why?
    Thanks in advance for your help!
    Best 
wishes!


Reply via email to