<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi,<div class=""><br class=""></div><div class="">we do that because the data will be inserted to the content store. When this data is retrieved from CS by future requests, it should get a new hop tag initialized to 0, since it was retrieved from CS and not the consumer.</div><div class=""><br class=""></div><div class="">Thanks,</div><div class=""><br class=""><div class="">
<div class=""><div class=""><div class=""><span class="" style="float: none; display: inline !important;">Spyridon (Spyros) Mastorakis</span><br class=""><span class="" style="float: none; display: inline !important;">Personal Website: </span><a href="http://cs.ucla.edu/~mastorakis/" class="">http://cs.ucla.edu/~mastorakis/</a><br class=""><span class="" style="float: none; display: inline !important;">Internet Research Laboratory</span><br class=""><span class="" style="float: none; display: inline !important;">Computer Science Department</span><br class=""><span class="" style="float: none; display: inline !important;">UCLA</span></div></div></div></div><br class=""><div><blockquote type="cite" class=""><div class="">On Apr 26, 2017, at 1:13 PM, Amir Ibrahim <<a href="mailto:a.ibrahim@fci-cu.edu.eg" class="">a.ibrahim@fci-cu.edu.eg</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">I found the reason:<div class=""><br class=""></div><div class="">in the NFD/fw/forwarder.cpp</div><div class=""><br class=""></div><div class="">the hopCount field is removed before calling content-store-impl Add() method.</div><div class=""><div class="">void</div><div class="">Forwarder::onIncomingData(Face& inFace, const Data& data)</div><div class="">{</div><div class="">  // receive Data</div><div class="">  NFD_LOG_DEBUG("onIncomingData face=" << inFace.getId() << " data=" << data.getName());</div><div class="">  data.setTag(make_shared<lp::IncomingFaceIdTag>(inFace.getId()));</div><div class="">  ++m_counters.nInData;</div><div class=""><br class=""></div><div class="">  // /localhost scope control</div><div class="">  bool isViolatingLocalhost = inFace.getScope() == ndn::nfd::FACE_SCOPE_NON_LOCAL &&</div><div class="">                              scope_prefix::LOCALHOST.isPrefixOf(data.getName());</div><div class="">  if (isViolatingLocalhost) {</div><div class="">    NFD_LOG_DEBUG("onIncomingData face=" << inFace.getId() <<</div><div class="">                  " data=" << data.getName() << " violates /localhost");</div><div class="">    // (drop)</div><div class="">    return;</div><div class="">  }</div><div class=""><br class=""></div><div class="">  // PIT match</div><div class="">  pit::DataMatchResult pitMatches = m_pit.findAllDataMatches(data);</div><div class="">  if (pitMatches.begin() == pitMatches.end()) {</div><div class="">    // goto Data unsolicited pipeline</div><div class="">    this->onDataUnsolicited(inFace, data);</div><div class="">    return;</div><div class="">  }</div><div class=""><br class=""></div><div class="">  shared_ptr<Data> dataCopyWithoutTag = make_shared<Data>(data);</div><div class="">  dataCopyWithoutTag-><span style="background-color: rgb(249, 203, 156);" class="">removeTag</span><lp::HopCountTag>();</div><div class=""><br class=""></div><div class="">  // CS insert</div><div class="">  if (m_csFromNdnSim == nullptr)</div><div class="">    m_cs.insert(*dataCopyWithoutTag);</div><div class="">  else</div><div class="">    m_csFromNdnSim->Add(dataCopyWithoutTag);</div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">My question is why is the hopCount field removed?</div></div><div class="gmail_extra" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class=""><div class="gmail_quote">On Wed, Apr 26, 2017 at 3:50 PM, Amir Ibrahim<span class="Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:a.ibrahim@fci-cu.edu.eg" target="_blank" class="">a.ibrahim@fci-cu.edu.eg</a>></span><span class="Apple-converted-space"> </span>wrote:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div dir="ltr" class="">Dear ndnSim users and experts,<div class="">           I'm trying to modify the caching strategy in a way that requires accessing the hopCount field in the data packet.</div><div class=""><br class=""></div><div class="">Below is my trial to access the hopCount field in data packet:</div><div class=""><br class=""></div><div class="">in  content-store-impl.hpp (add method):</div><div class=""><br class=""></div><div class=""><div class="">template<class Policy></div><div class="">bool</div><div class="">ContentStoreImpl<Policy>::Add(<wbr class="">shared_ptr<const Data> data)</div><div class="">{</div><div class=""> <span class="Apple-converted-space"> </span>NS_LOG_FUNCTION(this << data->getName());</div><div class=""><br class=""></div><div class=""> <span class="Apple-converted-space"> </span>int TSB = 0;</div><div class=""> <span class="Apple-converted-space"> </span>auto TSBTag = data->getTag<lp::HopCountTag>(<wbr class="">);</div><div class=""> <span class="Apple-converted-space"> </span>if (TSBTag != nullptr) {</div><div class=""> <span class="Apple-converted-space"> </span><span class="m_-8304152128996570649gmail-Apple-tab-span" style="white-space: pre-wrap;">    </span><span class="Apple-converted-space"> </span> TSB = *TSBTag;</div><div class="">   <span class="Apple-converted-space"> </span>}</div><div class=""> <span class="Apple-converted-space"> </span>std::cout<<"in CS Impl, found HopCount = "<<TSB<<" \n";</div><div class=""><br class=""></div><div class=""> <span class="Apple-converted-space"> </span>Ptr<entry> newEntry = Create<entry>(this, data);</div><div class=""> <span class="Apple-converted-space"> </span>std::pair<typename super::iterator, bool> result = super::insert(data->getName(), newEntry);</div><div class=""><br class=""></div><div class=""> <span class="Apple-converted-space"> </span>if (result.first != super::end()) {</div><div class="">   <span class="Apple-converted-space"> </span>if (result.second) {</div><div class="">     <span class="Apple-converted-space"> </span>newEntry->SetTrie(result.<wbr class="">first);</div><div class=""><br class=""></div><div class="">     <span class="Apple-converted-space"> </span>m_didAddEntry(newEntry);</div><div class="">     <span class="Apple-converted-space"> </span>std::cout<<"inside contentStoreImpl, new entry is added"<<"\n";</div><div class="">     <span class="Apple-converted-space"> </span>return true;</div><div class="">   <span class="Apple-converted-space"> </span>}</div><div class="">   <span class="Apple-converted-space"> </span>else {</div><div class="">     <span class="Apple-converted-space"> </span>// should we do anything?</div><div class="">     <span class="Apple-converted-space"> </span>// update payload? add new payload?</div><div class="">     <span class="Apple-converted-space"> </span>return false;</div><div class="">   <span class="Apple-converted-space"> </span>}</div><div class=""> <span class="Apple-converted-space"> </span>}</div><div class=""> <span class="Apple-converted-space"> </span>else</div><div class="">   <span class="Apple-converted-space"> </span>return false; // cannot insert entry</div><div class="">}</div><div class=""><br class=""></div><div class="">The problem is that, the pointer (TSBTag) is always null.</div><div class=""><br class=""></div><div class="">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" class=""><div class=""><br class=""></div>--<span class="Apple-converted-space"> </span><br class=""><div class="m_-8304152128996570649gmail_signature"><div dir="ltr" class="">  <span class="Apple-converted-space"> </span>Regards<br class="">Amir I. Mohamad<br class="">Assistant Lecturer <br class="">Faculty of Computers & Information<br class="">IT Dept. Cairo University</div></div></font></span></div></div></blockquote></div><br class=""><br clear="all" class=""><div class=""><br class=""></div>--<span class="Apple-converted-space"> </span><br class=""><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr" class="">   Regards<br class="">Amir I. Mohamad<br class="">Assistant Lecturer <br class="">Faculty of Computers & Information<br class="">IT Dept. Cairo University</div></div></div><br class=""></div></blockquote></div><br class=""></div></body></html>