<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></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="">a step-by-step solution varies, therefore I can only help with some general guidelines:</div><div class=""><br class=""></div><div class="">1) Add the desired attribute to the Interest/Data class.</div><div class=""><br class=""></div><div class="">2) Encode and decode the attribute (modify the wireEncode and wireDecode classes respectively). The NDN packet encoding follows a TLV format that stands for Type Length Value, therefore, you have to use the API provided by ndn-cxx to:</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">   </span>a) define a new type for the field you want to add: <a href="https://github.com/named-data-ndnSIM/ndn-cxx/blob/ndn-cxx-0.5.0-17-g99832d4-ndnSIM/src/encoding/tlv.hpp" class="">https://github.com/named-data-ndnSIM/ndn-cxx/blob/ndn-cxx-0.5.0-17-g99832d4-ndnSIM/src/encoding/tlv.hpp</a></div><div class=""><span class="Apple-tab-span" style="white-space:pre">      </span></div><div class=""><span class="Apple-tab-span" style="white-space:pre">  </span>b) for the length and value fields, encode/decode your field using the appropriate format (non negative integer, string block, etc.). Use the block helpers to do that: <a href="https://github.com/named-data-ndnSIM/ndn-cxx/blob/ndn-cxx-0.5.0-17-g99832d4-ndnSIM/src/encoding/block-helpers.cpp" class="">https://github.com/named-data-ndnSIM/ndn-cxx/blob/ndn-cxx-0.5.0-17-g99832d4-ndnSIM/src/encoding/block-helpers.cpp</a></div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>c) Pointer to the NDN TLV packet format: <a href="http://named-data.net/doc/NDN-TLV/current/" class="">http://named-data.net/doc/NDN-TLV/current/</a></div><div class=""><br class=""></div><div class="">3) If you want to modify a field on a hop by hop basis, the best way to do that would be to define a new Link Protocol (LP) field instead of directly modifying the Interest/Data classes. I have done that for the hopCount of data packets and the way to do that for any new LP field is similar:</div><div class=""><br class=""></div><div class=""><a href="https://github.com/named-data-ndnSIM/NFD/commit/d0abae38024a6aecf6f956f4bbea36f4a9ff6d6f" class="">https://github.com/named-data-ndnSIM/NFD/commit/d0abae38024a6aecf6f956f4bbea36f4a9ff6d6f</a></div><div class=""><a href="https://github.com/named-data-ndnSIM/ndn-cxx/commit/4692ba80cf1dcf07acbbaba8a134ea22481dd457" class="">https://github.com/named-data-ndnSIM/ndn-cxx/commit/4692ba80cf1dcf07acbbaba8a134ea22481dd457</a></div><div class=""><a href="https://github.com/named-data-ndnSIM/ndn-cxx/commit/e53204419c51356dab70e0e5450ff5dcf587827a" class="">https://github.com/named-data-ndnSIM/ndn-cxx/commit/e53204419c51356dab70e0e5450ff5dcf587827a</a></div><div class=""><a href="https://github.com/named-data-ndnSIM/ndnSIM/commit/73df9f587e1c16c4f67a0053fe29b68f523ff138" class="">https://github.com/named-data-ndnSIM/ndnSIM/commit/73df9f587e1c16c4f67a0053fe29b68f523ff138</a></div><div class=""><br class=""></div><div class="">Hope that this helps,</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 Mar 28, 2017, at 8:14 AM, 呂建德 <<a href="mailto:v0918732669@gmail.com" class="">v0918732669@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Hi<div class=""><br class=""></div><div class="">I also had the same problem , and happened that<font size="4" class=""> "TLV length doesn't match buffer length".</font></div><div class=""><font size="4" class=""><br class=""></font></div><div class="">I add the length of my value to the "totallength" , and it pops up that messages.</div><div class=""><br class=""></div><div class="">Anyone knows how to fixed it step by step , I will appreciate very much </div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">2017-03-28 17:19 GMT+08:00 lahmer ilyas <span dir="ltr" class=""><<a href="mailto:ilyaslahmer93@gmail.com" target="_blank" class="">ilyaslahmer93@gmail.com</a>></span>:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">






<div style="line-height: 1.5; border-width: 0px; margin: 12px; font-family: 微软雅黑; font-size: 10.5pt;" marginheight="0" marginwidth="0" class=""><div class="">Hi, I had the same problem, but I added a string rather than int in the interest. My solution was to recreate the interest at each hop with the new string value. I don't know why but this fixed the problem.<br class=""><br class=""><br class=""><br class=""></div>
<div class="">Sent from <a href="http://www.bluemail.me/r" target="_blank" class="">BlueMail</a><br class=""><br class=""></div>
<div class="gmail_quote"><span class="">On Mar 28, 2017, at 3:26 AM, gc199211 <<a href="mailto:gc199211@mail.ustc.edu.cn" target="_blank" class="">gc199211@mail.ustc.edu.cn</a>> wrote:</span><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="">
<u class=""></u>
<div class=""> </div>
<div class="">Hi sir :<br class="">     I find  out that my last 
email is incomplete in maillist, so I  finish it  and send 
again.  </div>
<div class="">     I am  trying to add  hop information in 
Interest recently on <strong class="">ndnSIM 2.2</strong>. Here is my code.</div>
<div class="">1). I add a private member variable  which is named 
hop in ndnSIM/ndn-cxx/src/interest.h </div>
<div class="">            
private:</div>
<div class="">                         
 Name m_name;</div>
<div class="">                              <wbr class="">        
......</div>
<div class="">                        
 mutable Block m_wire;</div>
<div class="">                       
   <span style="FONT-SIZE:16pt" class=""><strong class=""><span style="FONT-SIZE:14pt" class=""><span style="FONT-SIZE:16pt" class=""><span style="FONT-SIZE:16pt" class="">int 
hop;</span></span></span></strong> </span>          
// a new private member 
variable                      <wbr class=""> </div>
<div class="">                   </div>
<div class="">2). I increace the value of hop in the 
nfd::Forwarder::<wbr class="">onOutgoingInterest(shared_ptr<<wbr class="">pit::Entry> pitEntry, 
Face& outFace,<span style="COLOR:rgb(96,64,32)" class="m_-8895239626861104905keywordtype">bool  </span>wantNewNonce),so as to caculate the hop 
.</div>
<div class="">  </div>
<div style="FONT-SIZE:16pt" class="">              <span style="FONT-SIZE:10.5pt" class=""><strong class=""><span style="FONT-SIZE:16pt" class=""> int 
tmpHop=interest->getHop();</span></strong></span></div>
<div style="FONT-SIZE:10.5pt" class=""><strong class=""><span style="FONT-SIZE:16pt" class="">               
tmpHop++;</span></strong></div>
<div style="FONT-SIZE:16pt" class=""><span style="FONT-SIZE:10.5pt" class=""><span style="FONT-SIZE:16pt" class=""><strong class=""><span style="FONT-SIZE:16pt" class="">               
interest->setHop(tmpHop);</span></strong> </span>    <wbr class="">   </span>         
</div>
<div align="center" class=""> </div>
<div align="left" class="">Here is my problem,It seems that the hop value is always 0 no 
matter how many nodes it is forwarded.How to solve the problem? I know there is 
a <span style="TEXT-TRANSFORM:none;BACKGROUND-COLOR:rgb(232,232,232);FONT-STYLE:normal;TEXT-INDENT:0px;DISPLAY:inline!important;FONT-FAMILY:'Lucida Grande',Verdana,Geneva,Arial,sans-serif;WHITE-SPACE:normal;FLOAT:none;LETTER-SPACING:normal;COLOR:rgb(50,50,50);FONT-SIZE:13px;FONT-WEIGHT:bold;WORD-SPACING:0px;font-variant-ligatures:normal;font-variant-caps:normal" class="">ns3::ndn::FwHopCountTag 
</span>a to caculate the hop in <span style="TEXT-TRANSFORM:none;BACKGROUND-COLOR:rgb(232,232,232);FONT-STYLE:normal;TEXT-INDENT:0px;DISPLAY:inline!important;FONT-FAMILY:'Lucida Grande',Verdana,Geneva,Arial,sans-serif;WHITE-SPACE:normal;FLOAT:none;LETTER-SPACING:normal;COLOR:rgb(50,50,50);FONT-SIZE:13px;FONT-WEIGHT:bold;WORD-SPACING:0px;font-variant-ligatures:normal;font-variant-caps:normal" class="">ns3::ndn::NetDeviceLinkService</span><wbr class=""> ,But 
I want to caculate the hop value directly in Interest. If it works ,I 
can add other member variable in Interest  which is quite important 
for my research.Thank you very much .</div>
</span><div class="">                              <wbr class="">                              <wbr class="">                              <wbr class="">                              <wbr class="">                              <wbr class="">              !
  &nb
sp;                 </div>
<div style="FONT-FAMILY:Verdana;COLOR:#c0c0c0;FONT-SIZE:10pt" class="">
<div align="left" class="">2016-12-20</div>
<hr style="BORDER-BOTTOM:0px;BORDER-LEFT:0px;WIDTH:122px;HEIGHT:1px;BORDER-TOP:#c0c0c0 1px solid;BORDER-RIGHT:0px" id="m_-8895239626861104905SignNameHR" align="left" class="">
<span id="m_-8895239626861104905_FlashSignName" class="">gc199211</span> </div><u class=""></u><pre class="m_-8895239626861104905blue"><hr class=""></pre></blockquote></div></div></blockquote></div></div></div></blockquote></div><br class=""></div></body></html>