[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ns] Passing objects to interpreter
I donno if you can get a node down... but one way you can get a link down
at a given time would be to
$ns rtmodel-at [$ns now] down $from $to
Tcl &tcl = Tcl::instance();
tcl.evalf("set ns [Simulator instance];\n$ns rtmodel-at [$ns now] down
%s %s", fromnode->name(), tonode->name());
If you don't have the object references to the nodes, but only have the
its node id you could use
tcl.evalf("set ns [Simulator instance];\n$ns rtmodel-at [$ns now] down
[$ns set Node_(%d)] [$ns set Node_(%d)]", fromnodeId, toNodeId);
hope that is what you wanted.
Pls. correct me/ if there is another better way lemme know coz
something like this is what I use most of the times.
Regards,
Sudhin.
On Tue, 20 Mar 2001, Prasad V. Boddupalli
wrote:
> Hi,
> I am trying out alternate routing strategies in ns. I want to a link
> down if the no if packets sent over that link crosses a certain threshold.
> So, I changed the datastructure in the classifier and had the following
> code in classifier.cc.
>
>
> NsObject* Classifier::find(Packet* p)
> {
> NsObject* node = NULL;
> int cl = classify(p);
>
> if (cl < 0 || cl >= nslot_ || (node = slot_[cl].next_hop) == 0) {
> if (default_target_) return default_target_;
> ......... removed some code ........
> }
>
> slot_[cl].no_pkts++;
> if (slot_[cl].no_pkts == THRESHOLD) {
>
> ---> char cmd[] = "$node down";
> ---> Tcl &tcl = Tcl::instance();
>
> ---> tcl.evalf("%s down", node->name());
> }
> return (node);
> }
>
> However I am unable to pass the link object to the interpreter (from
> C++) so that the instproc "down" is invoked on that link. How I can do
> that ? I didn't completely get this interface between the compiled and the
> interpreted hierarchy. Can someone help me out ?
>
>
> thanks,
> Prasad Boddupalli.
>
>
>
****************** Sudhindra Suresh Bengeri ********************
Graduate Research Assistant | Home: |
to Dr. George N. Rouskas | 2110, Gorman St., |
EGRC 454H, Computer Sci. dept.| Raleigh, NC - 27606 |
NCSU, Raleigh, NC 27695 | Ph. (919) 852-1961 |
(919)515-3655(P) / 515-7925(F)
My web projection: http://www4.ncsu.edu/~ssbenger