[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to know which neighbor send the packet
On Fri, 10 Jul 1998, Gang Xu wrote:
> Hi, George and Chetan,
>
> Thanks for all you helps. I tried both ways tonight.
>
> First, I tried George's way. However, ip_hdr->src() only returns the
> address of the source agent. :-(
>
> I believe Chetan's suggestion is correct, but I still met some problems.
>
> I cann't find 'ifaceGetNode' instproc in ns-node.tcl. I 'grep'ed all the
> Node instproc under ~/tcl/lib and still cann't find it. Then I used
ifaceGetNode is defined in ~/tcl/mcast/ns-mcast.tcl.
I do find the placement of instproc's a little strange - is there a reason
for smearing instproc's of a class all over the place (like "place the
instproc with the functionality that caused it to be defined in the first
place") or was it just "how it happened" (in that case, is there a cleanup
planned sometime?) ? Developers? (If you're ever looking for a vote on
this, I'd vote for putting all instproc's of a class in one file, grouped
by the functionality they support or were required for)
> hdr_cmn to get the iface_. In my recv() method in C++ code, I use
> hdr_cmn* cmnh = (hdr_cmn*)p;
> to get the common header and use
> cmnh->iface()
The usual (and recommended) way to get to a packet header is to use
access(). In this case:
hdr_cmn *cmnh = (hdr_cmn *) p->access(off_cmn_);
iface = cmnh->iface()
-Chetan
> to get the iface_ member data. I think it should return the link on which
> the packet is received. In my otcl code, after I pass the cmnh->iface(), I
> use '[[$link fromNode] id]' and get the following message:
> ns: -o141 recvPack 1 514 0 2202008: invalid command name "2202008"
> while executing
> "$link fromNode"
> ...
>
> Did I miss something here? BTW, I am using ns-allinone.
>
> Thanks again for all your helps!
> Gang
>
> On Thu, 9 Jul 1998, Chetan Rai wrote:
> >
> > On Thu, 9 Jul 1998, George Riley wrote:
> >
> > > I believe you can look in the ip_hdr of the packet, and check the
> > > ip_hdr->src() value, which indicates the node inthe upper 24 bits.
> > > George
> >
> > I think Gang wants to find the neighbouring node thru which the packet
> > was routed - the Node instproc 'ifaceGetNode' returns this node - the
> > incoming interface (required as argument to ifaceGetNode) is in the
> > iface_ data member of the cmn header.
> >
> > -Chetan
> >
> > >
> > >
> > > -George F. Riley ([email protected])
> > > -Grad Student Liaison
> > >
> > >
> > > On Thu, 9 Jul 1998, Gang Xu wrote:
> > >
> > > > Hi,
> > > >
> > > > After a node receives a packet, is it possible to check which neighbor
> > > > sends the packet to it?
> > > >
> > > > Gang Xu
>
> Gang Xu
> ------------------------------------------------------------------
> Department of CS Tel: (205)348-0996(O)
> University of Alabama, Tuscaloosa http://www.eng.ua.edu/~gxu
>
>