[ndnSIM] Getting hop count
Alex Afanasyev
aa at CS.UCLA.EDU
Fri Feb 26 00:26:52 PST 2016
> On Feb 25, 2016, at 12:36 PM, Fabio Campioni <fcampioni at algomau.ca> wrote:
>
> I am trying to get the hop count from a packet in a custom content
> store implementation policy I am working on, in the latest version of
> ndnSIM (2.1).
>
> I have created my own policy_traits struct based on the ones already
> present. I have also instantiated a ContentStoreImpl class with the new
> policy traits. In the insert method, I have the following code:
>
> Ptr<const Packet> pkt = item->payload()->GetPacket();
> FwHopCountTag tag;
> pkg->PeekPacketTag(tag);
Hi Fabio,
It's a little bit more complicated than that:
payload() corresponds to ns3::ndn::cs::Entry (model/cs/ndn-content-store.hpp). You need to call GetData(), and then try to get the tag (it may not exist).
auto data = item->payload()->GetData();
auto dataTag = data->typename getTag<Ns3PacketTag>();
if (dataTag == nullptr) {
// data has never been transferred over NetDeviceChannel (e.g., from app)
return;
}
FwHopCountTag tag;
bool hasTag = dataTag->getPacket()->PeekPacketTag(tag);
...
---
Alex
>
> However, when compiling, I get an error message:
>
> ../src/ndnSIM/model/cs/../../utils/trie/hop-policy.hpp:105:60: error:
> ‘class
> ns3::ndn::cs::EntryImpl<ns3::ndn::cs::ContentStoreImpl<ns3::ndn::ndnSIM
> ::hop_policy_traits> >’ has no member named ‘GetPacket’
> Ptr<const Packet> pkt = item->payload()->GetPacket();
>
> I have even made sure to include "ndn-fw-hop-count-tag.hpp" in the
> file, but it still has not made any difference. Not sure if that method
> has been depreciated or if I am overseeing something. If anyone has any
> advice I would greatly appreciate it. Thank you.
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 841 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20160226/186f3c35/attachment.bin>
More information about the ndnSIM
mailing list