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

Re: [ns] relating packets and nodes!



*all* headers are accessible from a packet. So you can grab the ip header in the 
tcp::recv method and access the info you need. for example :

hdr_ip *iph=hdr_ip::access(p);
int src_ = ((iph->src() >> 8) & 0xff);
int dst_ = ((iph->dst() >> 8) & 0xff);

please note this might not be the best way of doing it. i suggest you grep for 
hdr_ip in the source files, to see more example.

>Date: Wed, 9 Aug 2000 10:42:41 -0400
>From: Sowmya Manjanatha <[email protected]>
>To: Haobo Yu <[email protected]>
>cc: [email protected]
>Subject: Re: [ns] relating packets and nodes!
>MIME-Version: 1.0
>
>
>Hi Haobu,
>
>Thanks for the info.  Yeah, I am trying to find the src_
>and dst_.  But I want to be able to find this in the 
>"recv" method of TcpAgent because I am trying to analyze
>what the packet experiences in the network from the time
>it leaves the source and reaches the destination.
>
>Well, the "hdr_ip" structure is not being used anywhere in
>the Packet class.  So, how do you determine which source
>sent this packet by just analyzing the contents of the packet??
>
>Thanks in advance for the information,
>Sowmya.
>
>
>
>
>*******************************************************************************
>
>    Sowmya Manjanatha : University of New Hampshire
>    Major             : Computer Science      
>    *********************************************** 
>
>    email        : [email protected]
>
>    Call me at   : (978)-689-8860 (res)
>                   (603)-862-4626 (unh)
>
>*******************************************************************************
>
>On Tue, 8 Aug 2000, Haobo Yu wrote:
>
>> do you mean src_ and dst_ in ip header? pls take a look in related section
>> in the ns manual, or ip.h for the source.
>> 
>> On Wed, 9 Aug 2000, Sowmya Manjanatha wrote:
>> 
>> > Date: Wed, 9 Aug 2000 00:15:26 -0400
>> > From: Sowmya Manjanatha <[email protected]>
>> > To: [email protected]
>> > Subject: [ns] relating packets and nodes!
>> > 
>> > 
>> > Hi all,
>> > 
>> > How do you figure out which node in the configuration does a packet
>> > belong to when it reaches the "TcpAgent::recv" method ??
>> > 
>> > I tried to look into the Packet class but couldn't find the source
>> > and destination pertinent to that packet from that.  Where is this
>> > information coded in NS?
>> > 
>> > Any suggestions or hints will be greatly appreciated.
>> > 
>> > Thanks,
>> > Sowmya.
>> > 
>> > 
>> > 
>> > 
>> > 
>> > 
>> > 
*******************************************************************************
>> > 
>> >     Sowmya Manjanatha : University of New Hampshire
>> >     Major             : Computer Science      
>> >     *********************************************** 
>> > 
>> >     email        : [email protected]
>> > 
>> >     Call me at   : (978)-689-8860 (res)
>> >                    (603)-862-4626 (unh)
>> > 
>> > 
*******************************************************************************
>> > 
>> > 
>> 
>> 

Tarik