[ndnSIM] In content-store-impl.hpp (add method) trying to get the hopCount field in Data Packet
Spyridon (Spyros) Mastorakis
mastorakis at cs.ucla.edu
Wed Apr 26 18:31:34 PDT 2017
Hi,
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.
Thanks,
Spyridon (Spyros) Mastorakis
Personal Website: http://cs.ucla.edu/~mastorakis/ <http://cs.ucla.edu/~mastorakis/>
Internet Research Laboratory
Computer Science Department
UCLA
> On Apr 26, 2017, at 1:13 PM, Amir Ibrahim <a.ibrahim at fci-cu.edu.eg> wrote:
>
> I found the reason:
>
> in the NFD/fw/forwarder.cpp
>
> the hopCount field is removed before calling content-store-impl Add() method.
> void
> Forwarder::onIncomingData(Face& inFace, const Data& data)
> {
> // receive Data
> NFD_LOG_DEBUG("onIncomingData face=" << inFace.getId() << " data=" << data.getName());
> data.setTag(make_shared<lp::IncomingFaceIdTag>(inFace.getId()));
> ++m_counters.nInData;
>
> // /localhost scope control
> bool isViolatingLocalhost = inFace.getScope() == ndn::nfd::FACE_SCOPE_NON_LOCAL &&
> scope_prefix::LOCALHOST.isPrefixOf(data.getName());
> if (isViolatingLocalhost) {
> NFD_LOG_DEBUG("onIncomingData face=" << inFace.getId() <<
> " data=" << data.getName() << " violates /localhost");
> // (drop)
> return;
> }
>
> // PIT match
> pit::DataMatchResult pitMatches = m_pit.findAllDataMatches(data);
> if (pitMatches.begin() == pitMatches.end()) {
> // goto Data unsolicited pipeline
> this->onDataUnsolicited(inFace, data);
> return;
> }
>
> shared_ptr<Data> dataCopyWithoutTag = make_shared<Data>(data);
> dataCopyWithoutTag->removeTag<lp::HopCountTag>();
>
> // CS insert
> if (m_csFromNdnSim == nullptr)
> m_cs.insert(*dataCopyWithoutTag);
> else
> m_csFromNdnSim->Add(dataCopyWithoutTag);
>
>
>
> My question is why is the hopCount field removed?
>
> On Wed, Apr 26, 2017 at 3:50 PM, Amir Ibrahim <a.ibrahim at fci-cu.edu.eg <mailto:a.ibrahim at fci-cu.edu.eg>> wrote:
> 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>
> bool
> 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) {
> newEntry->SetTrie(result.first);
>
> m_didAddEntry(newEntry);
> std::cout<<"inside contentStoreImpl, new entry is added"<<"\n";
> return true;
> }
> else {
> // should we do anything?
> // update payload? add new payload?
> return false;
> }
> }
> else
> 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 method.
>
> --
> Regards
> Amir I. Mohamad
> Assistant Lecturer
> Faculty of Computers & Information
> IT Dept. Cairo University
>
>
>
> --
> Regards
> 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/a0f25c88/attachment-0001.html>
More information about the ndnSIM
mailing list