[ndnSIM] Cache according to hopcount
Alex Afanasyev
alexander.afanasyev at ucla.edu
Sun Jul 21 10:39:24 PDT 2013
Hi!
ndnSIM tracks the hop count in complimentary packet tag structure FwHopCountTag. To create a policy, you will need to create a new "policy" header file (e.g., similar to lru-policy) and in insert method put something like this:
...
inline bool
insert (typename parent_trie::iterator item)
{
Ptr<const Packet> pkt = item->payload ()->GetPacket ();
FwHopCountTag tag;
pkt->PeekPacketTag (tag);
if (tag.Get () == 3)
{
policy_container::push_back (*item);
return true;
}
else
{
return false;
}
}
...
---
Alex
On Jul 21, 2013, at 2:19 AM, 陈胜蓝 <blindeafer at 163.com> wrote:
> Hi All,
> I would like to implement a hopcount-based cache policy,it is that each node will cache a content with a particular hopcount number,such as 3.Before a content is going to be sent,the hopcount of a content will be set to be 0 if it is cached,
> If I would modify the OnData() function?How can I implement the policy?
> Thank you
>
> Beat regards.
>
>
> _______________________________________________
> ndnSIM mailing list
> ndnSIM at lists.cs.ucla.edu
> http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20130721/f4d45cf7/attachment.html>
More information about the ndnSIM
mailing list