[ndnSIM] In content-store-impl.hpp (add method) trying to get the hopCount field in Data Packet

Amir Ibrahim a.ibrahim at fci-cu.edu.eg
Wed Apr 26 12:50:15 PDT 2017

Dear ndnSim users and experts,
           I'm trying to modify the caching strategy in a way that requires
accessing the hopCount field in the data packet.

Below is my trial to access the hopCount field in data packet:

in  content-store-impl.hpp (add method):

template<class Policy>
ContentStoreImpl<Policy>::Add(shared_ptr<const Data> data)
  NS_LOG_FUNCTION(this << data->getName());

  int TSB = 0;
  auto TSBTag = data->getTag<lp::HopCountTag>();
  if (TSBTag != nullptr) {
   TSB = *TSBTag;
  std::cout<<"in CS Impl, found HopCount = "<<TSB<<" \n";

  Ptr<entry> newEntry = Create<entry>(this, data);
  std::pair<typename super::iterator, bool> result =
super::insert(data->getName(), newEntry);

  if (result.first != super::end()) {
    if (result.second) {

      std::cout<<"inside contentStoreImpl, new entry is added"<<"\n";
      return true;
    else {
      // should we do anything?
      // update payload? add new payload?
      return false;
    return false; // cannot insert entry

The problem is that, the pointer (TSBTag) is always null.

Is there any clue why is this happening? any suggestions how to get the hop
count field of data packet from within the content-store-impl.hpp Add

Amir I. Mohamad
Assistant Lecturer
Faculty of Computers & Information
IT Dept. Cairo University


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20170426/e932dc55/attachment.html>

More information about the ndnSIM mailing list