Re: [ns] How to Drop Packets From a Particular Sender

2009-03-13 Thread Mats Folke

Hi!

Wouldn't it be kind of dangerous to drop the packet using the first method 
described? The packet would jsut disappear and the logs would not be 
consistent. I would recommend using the latter method

drop(p)

instead. This makes the logging consistent and almost all objects I've come 
across where I would like to drop packets have been Connector objects.

Best regards,
Mats Folke

Teerawat Issariyakul wrote:
 Hi,
 
 Suppose you have a pointer p. You can drop the packet by executing
 
 
 Packet::free(p)
 
 Also the packet *p can be dropped from within the Connector object
 by invoking function drop as follows:
 
 drop(p);
 
 
 Note that drop(p) is a function of class Connector, and therefore
 must be invoked from within the scope of class Connector.
 
 I posted how to drop a a packet in the following blog:
 
 http://t-issariyakul.blogspot.com/2009/03/ns2-dropping-packet.html
 
 For more information about Connector and Packet, see Chapters 5 and 8,
 respectively, in the following book from Springer:
 
 T. Issaraiyakul and E. Hossain, Introduction to Network Simulator
 NS2, Springer 2008.
 http://www.springer.com/engineering/signals/book/978-0-387-71759-3
 
 You may also find the following website useful:
 http://www.ece.ubc.ca/~teerawat/NS2.htm
 
 On 3/13/2009, muralikrishna g muralikrishn...@gmail.com wrote:
 
 
 Hi to all..
 
 i am using ns-2.33, here in my work i have to drop packets from a
 particular sender, i am planing to drop packets depending on the
 sender node_id 
 
 please help me regarding this..
 
 by
 
 Muralikrishna Gaddam (muralikrishn...@gmail.com)



-- 
Mats Folke, M.Sc., Lic.Eng.
Research Engineer

Ericsson AB Office: +46 10 7171385
Ericsson Research   Fax: +46 920 99621
P.O. Box 920Mobile: +46 76 1271385
SE-971 28 LuleƄ
Sweden



Re: [ns] How to Drop Packets From a Particular Sender

2009-03-13 Thread Teerawat Issariyakul


Hi Mats,

I agree with you. In fact, function drop(p) will check whether the packet
is in used before dropping it. But the function drop(p) only exists for
an NsObject. Objects not derived from class NsObject may not define this
function.

If you guys would like to use Packet::free(p), you are responsible for
consistency check. Failing to do so may result in errors like
segmentation fault.

Best,
Teerawat

On 3/13/2009, Mats Folke mats.fo...@ericsson.com wrote:


Hi!

Wouldn't it be kind of dangerous to drop the packet using the first method 
described? The packet would jsut disappear and the logs would not be 
consistent. I would recommend using the latter method

drop(p)

instead. This makes the logging consistent and almost all objects I've come 
across where I would like to drop packets have been Connector objects.

Best regards,
Mats Folke

Teerawat Issariyakul wrote:
 Hi,
 
 Suppose you have a pointer p. You can drop the packet by executing
 
 
 Packet::free(p)
 
 Also the packet *p can be dropped from within the Connector object
 by invoking function drop as follows:
 
 drop(p);
 
 
 Note that drop(p) is a function of class Connector, and therefore
 must be invoked from within the scope of class Connector.
 
 I posted how to drop a a packet in the following blog:
 
 http://t-issariyakul.blogspot.com/2009/03/ns2-dropping-packet.html
 
 For more information about Connector and Packet, see Chapters 5 and 8,
 respectively, in the following book from Springer:
 
 T. Issaraiyakul and E. Hossain, Introduction to Network Simulator
 NS2, Springer 2008.
 http://www.springer.com/engineering/signals/book/978-0-387-71759-3
 
 You may also find the following website useful:
 http://www.ece.ubc.ca/~teerawat/NS2.htm
 
 On 3/13/2009, muralikrishna g muralikrishn...@gmail.com wrote:
 
 
 Hi to all..
 
 i am using ns-2.33, here in my work i have to drop packets from a
 particular sender, i am planing to drop packets depending on the
 sender node_id 
 
 please help me regarding this..
 
 by
 
 Muralikrishna Gaddam (muralikrishn...@gmail.com)



-- 
Mats Folke, M.Sc., Lic.Eng.
Research Engineer

Ericsson AB Office: +46 10 7171385
Ericsson Research   Fax: +46 920 99621
P.O. Box 920Mobile: +46 76 1271385
SE-971 28 LuleƄ
Sweden