<div dir="ltr">I found the reason:<div><br></div><div>in the NFD/fw/forwarder.cpp</div><div><br></div><div>the hopCount field is removed before calling content-store-impl Add() method.</div><div><div>void</div><div>Forwarder::onIncomingData(Face& inFace, const Data& data)</div><div>{</div><div> // receive Data</div><div> NFD_LOG_DEBUG("onIncomingData face=" << inFace.getId() << " data=" << data.getName());</div><div> data.setTag(make_shared<lp::IncomingFaceIdTag>(inFace.getId()));</div><div> ++m_counters.nInData;</div><div><br></div><div> // /localhost scope control</div><div> bool isViolatingLocalhost = inFace.getScope() == ndn::nfd::FACE_SCOPE_NON_LOCAL &&</div><div> scope_prefix::LOCALHOST.isPrefixOf(data.getName());</div><div> if (isViolatingLocalhost) {</div><div> NFD_LOG_DEBUG("onIncomingData face=" << inFace.getId() <<</div><div> " data=" << data.getName() << " violates /localhost");</div><div> // (drop)</div><div> return;</div><div> }</div><div><br></div><div> // PIT match</div><div> pit::DataMatchResult pitMatches = m_pit.findAllDataMatches(data);</div><div> if (pitMatches.begin() == pitMatches.end()) {</div><div> // goto Data unsolicited pipeline</div><div> this->onDataUnsolicited(inFace, data);</div><div> return;</div><div> }</div><div><br></div><div> shared_ptr<Data> dataCopyWithoutTag = make_shared<Data>(data);</div><div> dataCopyWithoutTag-><span style="background-color:rgb(249,203,156)">removeTag</span><lp::HopCountTag>();</div><div><br></div><div> // CS insert</div><div> if (m_csFromNdnSim == nullptr)</div><div> m_cs.insert(*dataCopyWithoutTag);</div><div> else</div><div> m_csFromNdnSim->Add(dataCopyWithoutTag);</div></div><div><br></div><div><br></div><div><br></div><div>My question is why is the hopCount field removed?</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Apr 26, 2017 at 3:50 PM, Amir Ibrahim <span dir="ltr"><<a href="mailto:a.ibrahim@fci-cu.edu.eg" target="_blank">a.ibrahim@fci-cu.edu.eg</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Dear ndnSim users and experts,<div> I'm trying to modify the caching strategy in a way that requires accessing the hopCount field in the data packet.</div><div><br></div><div>Below is my trial to access the hopCount field in data packet:</div><div><br></div><div>in content-store-impl.hpp (add method):</div><div><br></div><div><div>template<class Policy></div><div>bool</div><div>ContentStoreImpl<Policy>::Add(<wbr>shared_ptr<const Data> data)</div><div>{</div><div> NS_LOG_FUNCTION(this << data->getName());</div><div><br></div><div> int TSB = 0;</div><div> auto TSBTag = data->getTag<lp::HopCountTag>(<wbr>);</div><div> if (TSBTag != nullptr) {</div><div> <span class="m_-8304152128996570649gmail-Apple-tab-span" style="white-space:pre-wrap"> </span> TSB = *TSBTag;</div><div> }</div><div> std::cout<<"in CS Impl, found HopCount = "<<TSB<<" \n";</div><div><br></div><div> Ptr<entry> newEntry = Create<entry>(this, data);</div><div> std::pair<typename super::iterator, bool> result = super::insert(data->getName(), newEntry);</div><div><br></div><div> if (result.first != super::end()) {</div><div> if (result.second) {</div><div> newEntry->SetTrie(result.<wbr>first);</div><div><br></div><div> m_didAddEntry(newEntry);</div><div> std::cout<<"inside contentStoreImpl, new entry is added"<<"\n";</div><div> return true;</div><div> }</div><div> else {</div><div> // should we do anything?</div><div> // update payload? add new payload?</div><div> return false;</div><div> }</div><div> }</div><div> else</div><div> return false; // cannot insert entry</div><div>}</div><div><br></div><div>The problem is that, the pointer (TSBTag) is always null.</div><div><br></div><div>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 method.</div><span class="HOEnZb"><font color="#888888"><div><br></div>-- <br><div class="m_-8304152128996570649gmail_signature"><div dir="ltr"> Regards<br>Amir I. Mohamad<br>Assistant Lecturer <br>Faculty of Computers & Information<br>IT Dept. Cairo University</div></div>
</font></span></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"> Regards<br>Amir I. Mohamad<br>Assistant Lecturer <br>Faculty of Computers & Information<br>IT Dept. Cairo University</div></div>
</div>
<br>
<br>