[ns] which functions are called in backened of tcl script

2007-04-26 Thread Anuradha Sehgal

hello

Is there any tutorial or any other document available, that can tell
which functions are called in backend when we run tcl script commands
in ns2.

Thanks
-- 
Anuradha Sehgal



[ns] Regarding ns-simple.tcl script

2007-04-25 Thread Anuradha Sehgal

hello ns users

I have a problem in understanding a tcl script, that i downloaded from
the web site

http://nile.wpi.edu/NS/

its ns-simple.tcl
I added two lines in it that are

-some code here---

$cbr set packet_data_ hello

---some code here

puts Packet Data= [$cbr set packet_data_]

-some code here---

This is running, but my problem is which function or constructor is
called when i set the packet_data_ member variable.

Thanks a lot !!



This is the full version of ns-simple.tcl file


#Create a simulator object
set ns [new Simulator]

#Define different colors for data flows (for NAM)
$ns color 1 Blue
$ns color 2 Red

#Open the NAM trace file
set nf [open out.nam w]
$ns namtrace-all $nf

#Define a 'finish' procedure
proc finish {} {
global ns nf
$ns flush-trace
#Close the NAM trace file
close $nf
#Execute NAM on the trace file
exec nam out.nam 
exit 0
}

#Create four nodes
set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]

#Create links between the nodes
$ns duplex-link $n0 $n2 2Mb 10ms DropTail
$ns duplex-link $n1 $n2 2Mb 10ms DropTail
$ns duplex-link $n2 $n3 1.7Mb 20ms DropTail

#Set Queue Size of link (n2-n3) to 10
$ns queue-limit $n2 $n3 10

#Give node position (for NAM)
$ns duplex-link-op $n0 $n2 orient right-down
$ns duplex-link-op $n1 $n2 orient right-up
$ns duplex-link-op $n2 $n3 orient right

#Monitor the queue for link (n2-n3). (for NAM)
$ns duplex-link-op $n2 $n3 queuePos 0.5


#Setup a TCP connection
set tcp [new Agent/TCP]
$tcp set class_ 2
$ns attach-agent $n0 $tcp
set sink [new Agent/TCPSink]
$ns attach-agent $n3 $sink
$ns connect $tcp $sink
$tcp set fid_ 1

#Setup a FTP over TCP connection
set ftp [new Application/FTP]
$ftp attach-agent $tcp
$ftp set type_ FTP


#Setup a UDP connection
set udp [new Agent/UDP]
$ns attach-agent $n1 $udp
set null [new Agent/Null]
$ns attach-agent $n3 $null
$ns connect $udp $null
$udp set fid_ 2

#Setup a CBR over UDP connection
set cbr [new Application/Traffic/CBR]
$cbr attach-agent $udp
$cbr set type_ CBR
$cbr set packet_size_ 1000
$cbr set rate_ 1mb
$cbr set random_ false
$cbr set packet_data_ hello



#Schedule events for the CBR and FTP agents
$ns at 0.1 $cbr start
$ns at 1.0 $ftp start
$ns at 4.0 $ftp stop
$ns at 4.5 $cbr stop

#Detach tcp and sink agents (not really necessary)
$ns at 4.5 $ns detach-agent $n0 $tcp ; $ns detach-agent $n3 $sink

#Call the finish procedure after 5 seconds of simulation time
$ns at 5.0 finish

#Print CBR packet size and interval
puts CBR packet size = [$cbr set packet_size_]
puts CBR interval = [$cbr set interval_]
puts Packet Data= [$cbr set packet_data_]

#Run the simulation
$ns run





Anuradha Sehgal



[ns] how to create a new packet and set/get data?

2007-04-22 Thread Anuradha Sehgal

hello ns-users

I am using ns-allinone-2.31 installed on cygwin.
I have added some encryption and decryption functions by creating a new
class in ns2.
I have also used it in a script file by calling it from there. Its working
fine. The script file is

#myTcl.tcl
set encdec [new Agent/EncDecOtcl]
$encdec call-my-priv-func2
#end of tcl file=


Now i want to create a new packet and want to call that function from there
so that data get encrypted and decrypted while sending and receiving.
any help will be greatly appreiciated.

Thanks in advance

With best regards,
Anuradha Sehgal


[ns] Errors during running make command

2007-04-18 Thread Anuradha Sehgal

I am new to NS. I am running NS, version ns-allinone-2.31 on cygwin on
Windows XP. Its working fine, ns and nam both are working fine.
However when I was trying the 'make depend' and 'make' commands,
without making any changes, to see if they are working properly or
not, I received the errors shown below while i used the 'make'
command:
===
proxytrace2any.cc: In function 'int main(int, char**)';
proxytrace2any.cc: 112 error: 'IsLittleEndian' undeclared(first use
this function)
proxytrace2any.cc: 112 error (Each undeclared identifier is reported
only once for each function it appears in.)
proxytrace2any.cc: 120 error: 'IsOtherEndian' undeclared(first use
this function)
make[1]: *** [proxytrace2any.o] Error 1
make[1]: Leaving directory
'/cygdrive/c/cygwin/ns-allinone-2.31/ns-2.31/indep-utils/webtrace-conv/dec'

..
make[1]: Leaving directory
'/cygdrive/c/cygwin/ns-allinone-2.31/ns-2.31/indep-utils/webtrace-conv/ucb'

=
I do not understand why this error is appearing.
I will really appreiciate any help regarding this.

With regards,
Anuradha Sehgal



[ns] adding global variables in ns2

2007-04-15 Thread Anuradha Sehgal

I am working with NS-2.31 installed in cygwin.
I want to add some global variables in NS-2 or more specifically in
packet.h/packet.cc files.
I have tried it in packet.h, by simply adding it as we normally do in
C, but it gives errors like

multiple definition of my_var
first defined here  etc

here my_var is variable that i declared globally

Is there some different way of doing this, may be i am following wrong way
any help will be appreciated

thanks,
Anuradha Sehgal



[ns] Query about errors during running make command

2007-04-12 Thread Anuradha Sehgal

hello everyone

I am using ns-allinone-2.31 that i installed on cygwin.
I am trying to add encryption and decryption in ns2.
The encryption and decryption code that i am trying to put in
../ns-2.31/common/packet.h running well when i use gcc, CC or g++. I
mean it do not complain for any thing. But the problem is when i run
the make command to recompile ns2, it gives three strange errors and a
lots of warnings.
The three errors are:

error:expected primary-expression before int.
error:expected ; before int
error::non-lvalue in assignment

why these errors are occuring??
I checked the code, but there is no problem, moreover its compiling
and running sucessfully if i use gcc, CC, g++(and in turbo c also).
Is make comamnd is using some older compiler? If so how can i remove
these errors?

its urgent, please reply soon

Thanks in advance,

Anuradha Sehgal


[ns] adding encryption/decryption in ns2

2007-04-12 Thread Anuradha Sehgal

hello everyone

I am using ns-allinone-2.31 that i installed on cygwin.
I am trying to add encryption and decryption in ns2.
The encryption and decryption code that i am trying to put in
../ns-2.31/common/packet.h running well when i use gcc, CC or g++. I
mean it do not complain for any thing. But the problem is when i run
the make command to recompile ns2, it gives three strange errors and a
lots of warnings.
The three errors are:

error:expected primary-expression before int.
error:expected ; before int
error::non-lvalue in assignment

why these errors are occuring??
I checked the code, but there is no problem, moreover its compiling
and running sucessfully if i use gcc, CC, g++(and in turbo c also).
Is make comamnd is using some older compiler? If so how can i remove
these errors?

its urgent, please reply soon

Thanks in advance,

Anuradha Sehgal


[ns] problems during running make command

2007-04-12 Thread Anuradha Sehgal

Hello everone

I am using ns-allinone-2.31 that i installed on cygwin.
I am trying to add encryption and decryption in ns2.
The encryption and decryption code that i am trying to put in
../ns-2.31/common/packet.h running well when i use gcc, CC or g++. I
mean it do not complain for any thing. But the problem is when i run
the make command to recompile ns2, it gives three strange errors and a
lots of warnings.
The three errors are:

error:expected primary-expression before int.
error:expected ; before int
error::non-lvalue in assignment

why these errors are occuring??
I checked the code, but there is no problem, moreover its compiling
and running sucessfully if i use gcc, CC, g++(and in turbo c also).
Is make comamnd is using some older compiler? If so how can i remove
these errors?

its urgent, please reply soon

Thanks in advance,

-- 
Anuradha Sehgal


[ns] problems during running make command

2007-04-11 Thread Anuradha Sehgal

Hello

I am using ns-allinone-2.31 that i installed on cygwin.
I am trying to add encryption and decryption in ns2.
The encryption and decryption code that i am trying to put in
../ns-2.31/common/packet.h running well when i use gcc, CC or g++. I
mean it do not complain for any thing. But the problem is when i run
the make command to recompile ns2, it gives three strange errors and a
lots of warnings.
The three errors are:

error:expected primary-expression before int.
error:expected ; before int
error::non-lvalue in assignment

why these errors are occuring??
I checked the code, but there is no problem, moreover its compiling
and running sucessfully if i use gcc, CC, g++(and in turbo c also).
Is make comamnd is using some older compiler? If so how can i remove
these errors?

its urgent, please reply soon

Thanks in advance,

Anuradha Sehgal


[ns] Regarding linking c++ code in ns2

2006-11-29 Thread Anuradha Sehgal

Dear Sir/Madam,

i m facing the probelm of linking c++ code in ns2.
i have installed ns2 that is working correctly..but now how to run c++ code
in it..please do help me..its really very urgent..
please reply soon..thanks in advance...


sincerely,
Anuradha Sehgal