<div>Thank you very much, Alex! That is really helpful information !</div><div>š</div><div>--</div><div>Natalya </div><div>š</div><div>13.12.2012, 06:31, "Alex Afanasyev" <alexander.afanasyev@ucla.edu>:</div><blockquote type="cite"><p>Quick thing. Don't forget to check that netDeviceFace returned by DynamicCast is no 0, otherwise you'll get in trouble with segfaults.<br /><br />As for the queue. There are two options. šns-3 style and c++-style.<br /><br />(1) ns-3 style<br />==============<br />ns-3 allows you to access to many internal variables using so called attributes, without accessing implementation class. šFor netdevice example, you can access to queue using the following:<br /><br />PointerValue txQueueAttribute;<br />nd->GetAttribute ("TxQueue", txQueueAttribute); <br />/** // or this, more safer way<br />š* bool ok = nd->GetAttributeFailSafe ("TxQueue", txQueueAttribute);<br />š* if (!ok) { /* something wrong */ }<br />**/<br /><br />Ptr<Queue> txQueue = txQueueAttribute.Get<Queue> ();<br />if (txQueue == 0) { /*something wrong*/ }<br /><br />...<br /><br />(2) c++ style<br />Alternative and more C++ way is to make another dynamic cast on NetDevice object:<br /><br />Ptr<PointToPointNetDevice> p2pNd = DynamicCast<PointToPointNetDevice> (nd);<br />...<br />and do the rest. <br /><br />The small disadvantage of the second approach is that it requires exact knowledge of the class you're casting to, that is, you need to include "point-to-point-net-device.h" header.<br /><br /><br />---<br />Alex<br /><br />On Dec 12, 2012, at 2:43 PM, Natalya Rozhnova <<a href="mailto:natalya.rozhnova@lip6.fr">natalya.rozhnova@lip6.fr</a>> wrote:</p><blockquote>šHi Alex!<br /><br />šThanks for your reply!<br />šThat's what I thought to do, but one thing was disturbing me.<br />šI tried so this :<br />šPtr<NetDeviceFace> netDeviceFace = DynamicCast<NetDeviceFace> (inFace);<br />šPtr<NetDevice> nd = netDeviceFace->GetNetDevice ();<br /><br />šThen, I presume to use the function GetQueue() which is in PointToPointNetDevice class and not virtual function of base NetDevice object.<br />ššSo I'm just confused how to get the p2p device after getting the NetDevice object...<br /><br />šThanks,<br />šNatalya<br /><br />š13.12.2012, 04:55, "Alex Afanasyev" <<a href="mailto:alexander.afanasyev@ucla.edu">alexander.afanasyev@ucla.edu</a>>:<br /><blockquote>šHi, Natalya!<br /><br />šIt is easy, but would take a couple of steps. <br /><br />šFirst, you need to figure out what from which type of face you have received a packet (as it could be an application face, which doesn't have a queue). šThis could be done using DynamicCast call, like in <a href="https://github.com/NDN-Routing/ndnSIM/blob/master/model/ndn-l3-protocol.cc#L229">https://github.com/NDN-Routing/ndnSIM/blob/master/model/ndn-l3-protocol.cc#L229</a>.<br /><br />šSecond, you will need to get netdevice pointer from the NetDeviceFace using GetNetDevice method (<a href="http://ndnsim.net/doxygen/classns3_1_1ndn_1_1_net_device_face.html#ae5ee510df5ba24c4a1aa94343302bb46">http://ndnsim.net/doxygen/classns3_1_1ndn_1_1_net_device_face.html#ae5ee510df5ba24c4a1aa94343302bb46</a>).<br /><br />šFinally, you can access queue and other NetDevice attributes in a standard NS-3 way.<br /><br />š---<br />šAlex<br /><br />šOn Dec 12, 2012, at 1:46 PM, Natalya Rozhnova <<a href="mailto:natalya.rozhnova@lip6.fr">natalya.rozhnova@lip6.fr</a>> wrote:<br /><br />ššHi everyone,<br /><br />ššI'm trying to access to the output queue from m_forwardingStrategy::OnInterest(...) and OnData(...) functions. I need to access to the output queue installed on the interface from where the router just received a packet.<br />ššLike:<br />šš+-----+<br />šš| R šššš|->out<br />šš| ššššššš|<br />šš+-----+<-in<br /><br />ššWhat I'm actually trying to do is : when the router receives an Interest (or Data) packet on the Interface "in", I'd like to access to the queue instaled on interface "out" and to put there some values.<br />ššHow I could access to this queue correctly?<br /><br />ššThanks in advance!<br />ššBest,<br />ššNatalya</blockquote>š_______________________________________________<br />šndnSIM mailing list<br />š<a href="mailto:ndnSIM@lists.cs.ucla.edu">ndnSIM@lists.cs.ucla.edu</a><br />š<a href="http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim">http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim</a></blockquote><p>š</p></blockquote>