<span style="line-height: 16.8px;">Hi Junxiao,</span><div style="line-height: 16.8px;"><br></div><div style="line-height: 16.8px;">Many thanks for the reply.</div><div style="line-height: 16.8px;"><br></div><div style="line-height: 16.8px;">I learned that I can attach ns3 packet tags to deliver message just after I sent the first email, but I didn't understand why ndn tag could not do the same thing, so thanks again for the explanation for ndn tag, now I understand that. But I still got something to figure out:</div><div style="line-height: 16.8px;"><br></div><div style="line-height: 16.8px;">1.Since the feature is pending removal in the next ndnSIM release, how can I encode information in packet or data, can you give me some usual/common methods to do so.</div><div style="line-height: 16.8px;"><br></div><div style="line-height: 16.8px;">2.You mentioned encoding information in part of Name or Content, Consumer requests content by name, if I changed its name, will it be correctly consumed ?</div><div style="line-height: 16.8px;"><br></div><div style="line-height: 16.8px;">3.I got this code in Producer::OnInterest: </div><div style="line-height: 16.8px;">  data->setContent(make_shared< ::ndn::Buffer>(m_<wbr>virtualPayloadSize)); </wbr></div><div style="line-height: 16.8px;"> It seems the producer makes a virtual content and adds it to data's payload, how can I add information to content? </div><div style="line-height: 16.8px;"><br></div><div style="line-height: 16.8px;">Can you give me some advice to deal with the above?</div><div style="line-height: 16.8px;"><br></div><div style="line-height: 16.8px;">Thanks~</div><div style="line-height: 16.8px;"><br></div><div style="line-height: 16.8px;">Jiebo Chen</div><br><br><blockquote name="replyContent" class="ReferenceQuote" style="padding-left:5px;margin-left:5px;border-left:#b6b6b6 2px solid;margin-right:0">-----原始邮件-----<br>
<b>发件人:</b><span id="rc_from">"Junxiao Shi" <shijunxiao@email.arizona.edu></span><br>
<b>发送时间:</b><span id="rc_senttime">2016-11-01 21:45:06 (星期二)</span><br>
<b>收件人:</b> "cjb0725@mail.ustc.edu.cn" <cjb0725@mail.ustc.edu.cn><br>
<b>抄送:</b> ndnsim <ndnsim@lists.cs.ucla.edu><br>
<b>主题:</b> RE: How to Use Tag in ndnSIM 2.1<br><br><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" target="_blank">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" target="_blank">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></blockquote><br><span>--<br>陈劼博<div>中国科学技术大学自动化系</div><div><a href="mailto:cjb0725@mail.ustc.edu.cn" target="_blank">cjb0725@mail.ustc.edu.cn</a></div></span>