[ndnSIM] Print Queue length

Amin Karami amin at ac.upc.edu
Wed Dec 4 02:35:31 PST 2013

Hi Alex,
I am going to print Queue length in a specific interface of a router. I 
wrote below function:

void PeriodicStatsPrinter (Ptr<Node> node, Time next)
Ptr<ndn::Pit> pit = node->GetObject<ndn::Pit> ();
Ptr<Channel> CH = node->GetDevice(2)->GetChannel(); \\ 2nd interface of 
the node
Ptr<NetDevice> toDev = CH->GetDevice (1); \\ access to its queue
PointerValue txQueue;
toDev->GetAttribute ("TxQueue", txQueue);
std::cout << Simulator::Now ().ToDouble (Time::S) << "\t"
<< Names::FindName (node) << "\t"
<< "Max Packets of Queue: " << txQueue.Get<DropTailQueue> 
()->m_maxPackets << "\n";

1- But, i faced with this error:
../scratch/RTT/RTT.cc: In function ‘void 
PeriodicStatsPrinter(ns3::Ptr<ns3::Node>, ns3::Time)’:
../scratch/RTT/RTT.cc:44:6: error: expected primary-expression before 
‘<<’ token
./ns3/drop-tail-queue.h:68:12: error: ‘uint32_t 
ns3::DropTailQueue::m_maxPackets’ is private
../scratch/RTT/RTT.cc:44:58: error: within this context

2- Could i define two Queue lengths for a specific interface in routers? 
from inside and outside of a link. Or both should be equal?


More information about the ndnSIM mailing list