[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ns] forwarding mcast packets
> Hi,
>
> > > [snip]
> > >
> > > Then I do a lookup on the node name using TclObject::lookup() and then I
> > > call recv(pkt) on the reference returned.
> >
> >
> > You may want to take a more careful look at the classifier. What slot_[]
> > returns is the next hop link HEAD, instead of the next hop node. A packet
> > can only be forwarded from the ns object it is at to an object the current
> > object targets (i.e., directly connected to). Hope this helps.
> >
>
> So basically, what you are telling me is to forward on a link, node directly
> on a node!?
>
> Actually I tried this. But when I (in C++) do a TclObject::lookup(oif) I get
> a null pointer back - it can't find the link :-(
>
> The OTcl reference name I'm doing the lookup on should be ok. I tried doing:
>
> [$link info class]
>
> on it in Otcl, which responded with "SimpleLink".
>
That's right. [$link info class] just returns the class name of the object $link, which is exactly "SimpleLink". I think the way of doing look up should be like this:
Suppose you define a link in your tcl script as follows:
set link01 [$ns link $n0 $n1]
and you want to get the object of this link in C++, then you can do this:
Tcl& tcl = Tcl::instance();
TclObject* theLink = tcl.lookup("link01");
If you want to get the link head, similarly,
set linkhead [$link01 head]
and
tcl.lookup("linkhead");
I am pretty new to ns too. I hope this works.
Good luck,
Jerry
> Does anyone have an idea of why TclObject::lookup() does not find the object
> for my link?
>
> Regards, Per
>
>