<div dir="ltr">Hi Runtong<div><br></div><div>Spyros has given the right way to do it. I'll address why the two snippets are wrong.</div><div><br></div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><p>Ptr<nfd::Pit> pit = node->GetObject<nfd::Pit> ();</p></blockquote><div>In <a href="https://www.nsnam.org/docs/release/3.25/manual/html/object-model.html">ns-3 object model</a>, ObjectBase::GetObject can return an object aggregated into the current object, or cast the current object as a subclass type. nfd::Pit is not aggregated into the node, so this does not work.</div><div>If ndnSIM is designed ground-up following ns-3 principles, nfd::Pit should be aggregated. But nfd::Pit is imported from NFD codebase that is not designed for ns-3, so that it's not aggregated.</div><div><br></div><div>ns3::ndn::L3Protocol, as mentioned in Spyros's answer, is aggregated into the node, and serves as an entrypoint to access NFD's objects.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><p>Ptr<nfd::pit::Entry> entry = node->GetObject<nfd::pit::<wbr>Entry> ();</p></blockquote><div>ns-3 object model allows only one instance of each object to be aggregated. Since each node has multiple Interest Table entries, it's wrong to aggregate the entry.</div></div><div>Similarly, a ns3::NetDevice is not aggregated into a ns3::Node.</div><div><br></div><div>Yours, Junxiao</div></div>