[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ns] Linking C++ and OTcl



Hello,

I have a little problem implementing a new routing agent in ns.
I don't understand how the "at" command of Simulator objects work.


Here are the strange behaviours I noticed :
(suppose 'findRoute' is a command of my Routing Agent that takes two 
parameters and
returns an int )

In a TCL script, I have :
	$ns_ at 3.0 "[$node_(0) set ragent_] findRoute 4 1500"
In this case, everything is OK, except I don't get the return value 
(obviously).

Now, if I type
	$ns_ at 3.0 "puts [[$node_(0) set ragent_] findRoute 4 1500]"
I get the correct result except that findRoute is executed a time 0.0

And when I type
	$ns_ at 3.0 "set route [[$node_(0) set ragent_] findRoute 4 1500]"
there is an error because the interpreter doens'nt know about 'route' variable.

Finally, if I have :
	set route 234
	$ns_ at 3.0 "set route [[$node_(0) set ragent_] findRoute 4 1500]"
the value of  route is still 234 after the execution of the command 
AND findroute
is executed at time 0.0

---

All I vant to do is find a route at a certain time and return a value 
which makes me
able to identify the route later. Is there a way to do this ?
I've been trying to solve this by many ways, but I didn't manage to 
do it. I've searched
the whole Tcl and C++ sources without any success. Please help.

Thanks a lot

Claude.

--