[ndnSIM] Missing HopCountTag in Data Packets
Susmit
susmit.shannigrahi at gmail.com
Wed Feb 8 11:59:46 PST 2017
Hi All,
I have an ndnSIM topology with one producer, multiple consumers and
intermediate nodes. I am trying to get the hop count for incoming
data packets at the consumers.
Below are the code and the trace for a single Interest packet.
I confirmed that I am getting data from a different node (node 64)
than the consumer (node 54), so the reply is not from local
cache/local producer.
This is my code for consumer::onData
________________________ Code ______________________________________
void
onData(const ndn::Interest& interest, const ndn::Data& data)
{
auto ID = ns3::Simulator::GetContext();
auto now = ns3::Simulator::Now().To(ns3::Time::S);
int hopCount = 0;
auto hopCountTag = data.getTag<ndn::lp::HopCountTag>();
if (hopCountTag != nullptr) {
hopCount = *hopCountTag;
std::cout << "Hop count: " << *hopCountTag << std::endl;
}
else {
std::cout << "Packet tag doesn't exist for " <<
data.getName() << std::endl;
}
std::cout << "Time: " << now << ",node:" << ID << "
Consumer:onData" << ",Data Name " << data.getName() << ",Hop Count
" << hopCount << std::endl;
..............
}
__________________________ Trace ____________________________________
1. Scheduling /cmip5/app/zg_Amon_EC-EARTH_rcp45_r6i1p1_200601-205012.nc/%00%00
at node 54 at time 1446227878 nonce 1495198176
2. Time: +1.44622787799999999995,node:54, Consumer:delayedInterest,
Interest Name /cmip5/app/zg_Amon_EC-EARTH_rcp45_r6i1p1_200601-205012.nc/%00%00
3. Time :+1.44635877299999999996 node:64, Producer::OnInterest,
Received interest:
/cmip5/app/zg_Amon_EC-EARTH_rcp45_r6i1p1_200601-205012.nc/%00%00 Nonce
: 1495198176
4. Packet tag doesn't exist for
/cmip5/app/zg_Amon_EC-EARTH_rcp45_r6i1p1_200601-205012.nc/%00%00/1495198176
5. Time: +1.57473100799999999997,node:54, Consumer:onData, Data Name
/cmip5/app/zg_Amon_EC-EARTH_rcp45_r6i1p1_200601-205012.nc/%00%00/1495198176,Hop
Count 0
I am not sure if I am missing something.
Thanks for your help.
--
Regards,
Susmit.
More information about the ndnSIM
mailing list