<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body><div><div style="font-family: Calibri,sans-serif; font-size: 11pt;">Hi Jiebo<br><br>TagHost can only be used with subclass of ndn::Tag, not ns-3 tag.<br>ndn::Tag can only be used to pass information between components of the same software. Once a Data is encoded, the Tag isn't part of wire encoding, and thus will not reappear on the next node when the wire encoding is decoded again. Likewise, Tag will be lost when a packet goes between NFD and a local application, which also traverses a face.<br><br>ndnSIM 2.2 and below allows passing ns-3 packet tags between nodes. This feature is pending removal in the next ndnSIM release.<br>You should really encode information as part of wire encoding, such as in part of Name or Content, instead of relying on Tag.<br><br>Yours, Junxiao</div></div><div dir="ltr"><hr><span style="font-family: Calibri,sans-serif; font-size: 11pt; font-weight: bold;">From: </span><span style="font-family: Calibri,sans-serif; font-size: 11pt;"><a href="mailto:cjb0725@mail.ustc.edu.cn">cjb0725@mail.ustc.edu.cn</a></span><br><span style="font-family: Calibri,sans-serif; font-size: 11pt; font-weight: bold;">Sent: </span><span style="font-family: Calibri,sans-serif; font-size: 11pt;">‎11/‎1/‎2016 3:47</span><br><span style="font-family: Calibri,sans-serif; font-size: 11pt; font-weight: bold;">To: </span><span style="font-family: Calibri,sans-serif; font-size: 11pt;"><a href="mailto:shijunxiao@email.arizona.edu">shijunxiao@email.arizona.edu</a></span><br><span style="font-family: Calibri,sans-serif; font-size: 11pt; font-weight: bold;">Subject: </span><span style="font-family: Calibri,sans-serif; font-size: 11pt;">How to Use Tag in ndnSIM 2.1</span><br><br></div>Hi junxiao,<div>  I'm a postgraduate in <span style="line-height: 16.8px;">University of Science and Technology of China, and a beginer for ndnSIM. </span></div><div>  I found that the class Data is inherited from tag-host, so I wrote a MyTag inhrited from ns3::ndn::Tag, and there's only an Integer in MyTag, and I added it to data, but once the data was send to next node, I got nullptr when the function getTag<ns3::ndn::MyTag>() was called.</div><div><br></div><div>-------------------------------------------------------------------------------</div><div>ns-3/src/ndnSIM/NFD/daemon/fw/forwarder.cpp   void <span style="line-height: 1.2;">Forwarder::onIncomingData(Face& inFace, const Data& data)</span></div><div><br><div>shared_ptr<ns3::ndn::MyTag> mytag_ptr = data.getTag<ns3::ndn::MyTag>();</div><div>    if(mytag_ptr == nullptr){</div><div>      std::cout<<"forwarder: onIncomingData: mytag_ptr = null"<<std::endl;</div><div>    }</div><div>    else{</div><div>      int tag = mytag_ptr->get();</div><div>      std::cout<<"forwarder: onIncomingData: mytag = "<<tag<<std::endl;</div><div>      if(tag > 0){</div><div>        mytag_ptr->decrement();  </div><div>        std::cout<<"forwarder: onIncomingData: after dec :mytag = "<<mytag_ptr->get()<<std::endl;</div><div><br></div><div>        if (m_csFromNdnSim == nullptr)</div><div>          m_cs.insert(*dataCopyWithoutPacket);</div><div>        else</div><div>          m_csFromNdnSim->Add(dataCopyWithoutPacket);</div><div>      }</div><div>      data.setTag(mytag_ptr);</div><div>    }</div><div>-------------------------------------------------------------------------------</div><div>I got "<span style="line-height: 16.8px;">forwarder: onIncomingData: mytag_ptr = null" using ndn-simple. Part of the result below:</span></div><div><span style="line-height: 16.8px;">-------------------------------------------------------------------------------</span></div><div><div>producer:  mytag = 2</div><div>producer:  setTag </div><div>node(2) responding with Data: /prefix/%FE%1D</div><div>onIncomingData face=258 data=/prefix/%FE%1D</div><div>forwarder: onIncomingData: mytag = 2</div><div>forwarder: onIncomingData: after dec :mytag = 1</div><div>onOutgoingData: face: 256; data:/prefix/%FE%1D</div><div>onOutgoingData: tag: 1</div><div>onIncomingData face=257 data=/prefix/%FE%1D</div><div>forwarder: onIncomingData: mytag_ptr = null</div><div>onOutgoingData: face: 256; data:/prefix/%FE%1D</div><div>onOutgoingData: tagptr=null: </div><div>onIncomingData face=256 data=/prefix/%FE%1D</div><div>forwarder: onIncomingData: mytag_ptr = null</div><div>onOutgoingData: face: 258; data:/prefix/%FE%1D</div><div>onOutgoingData: tagptr=null: </div><div>App::OnData:/prefix/%FE%1D</div><div style="line-height: 16.8px;">------------------------------------------------------------------------------</div><div style="line-height: 16.8px;"><pre style="line-height: normal; white-space: pre-wrap; -ms-word-wrap: break-word;">Please kindly let me get your guidance how can I get this correctly.

<div style="text-align: right;"><br></div><div style="text-align: right;"><span style="font-family: 宋体, arial, Verdana, sans-serif;">With Best Regards.</span></div><div style="text-align: right;"><span style="font-family: 宋体, arial, Verdana, sans-serif;">Chen Jiebo</span></div></pre></div><span style="line-height: 1.2;">-----------------------------------------------</span></div><span>University of Science and Technology of China<div>Department of Automation</div><div><a href="mailto:cjb0725@mail.ustc.edu.cn" target="_blank">cjb0725@mail.ustc.edu.cn</a></div></span></div></body></html>