<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Feb 9, 2016, at 9:24 AM, Carl Zu <<a href="mailto:carlzu8@gmail.com" class="">carlzu8@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" style="font-family: Menlo-Regular; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class="gmail_extra"><div class="gmail_quote">On Tue, Feb 9, 2016 at 2:34 AM, Alex Afanasyev<span class="Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:aa@cs.ucla.edu" target="_blank" class="">aa@cs.ucla.edu</a>></span><span class="Apple-converted-space"> </span>wrote:<br class=""><blockquote style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;" class="gmail_quote"><span class=""><br class="">> On Feb 8, 2016, at 3:10 PM, Carl Zu <<a href="mailto:carlzu8@gmail.com" class="">carlzu8@gmail.com</a>> wrote:<br class="">><br class=""></span><span class="">> I think lack of documentation is a problem...<br class="">><br class="">> I wanted to write some bytes in the interest message in ndnSIM. In ns3, thanks to their documentation, one can easily understand that in order to write some bytes, he should serialize a header.<br class="">><br class="">> For doing the same thing in ndnSIM, I have had the impression that I should use "block". Moreover, It looks as though an interest message is a set of TLVs (based on the explanation in the NDN project website). So probably if I like to write eight bytes as four pieces of two-byte data, I should write four TLVs. But indeed, there are many constructors in block.hpp, and it's just about looking at one code after another to understand each of them due to lack of documentation...<br class=""><br class=""></span>Hi Carl,<br class=""><br class="">I think you're looking into a slightly wrong place.  If you want to extend Interest, you need first define your own TLV (which type to use and specific content).  For simple things you don't need to define your own class, you can simply store the actual value in some standard type, say char[8].  After doing so, the only part remain is to update serialization/deserialization methods of interest.cpp which are called  wireEncode and wireDecode.<br class=""><br class="">I will agree that there is limited documentation, but there are many examples of this encoding.<br class=""><br class=""></blockquote><div class="">Hi guys,</div><div class=""><br class=""></div><div class="">thanks a lot for your replies.</div><div class=""><br class=""></div><div class="">Alex, could you please mention more precisely to which examples you are referring?</div></div></div></div></div></blockquote><div><br class=""></div><div>Hi Carl,</div><div><br class=""></div><div>I meant wireEncode/wireDecode methods of data structures implemented in ndn-cxx (Data, Interest, MetaInfo, etc.).</div><div><br class=""></div><div>--</div><div>Alex</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" style="font-family: Menlo-Regular; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class="gmail_extra"><div class="gmail_quote"><div class=""><br class=""></div><div class="">Thank you.</div><div class="">C</div><blockquote style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;" class="gmail_quote">add variable to keep your data (and getter/setter methods when needed):<br class=""><br class="">   <span class="Apple-converted-space"> </span>char m_myValue[8];<br class=""><br class="">Add the following to the wireEncode (note that encoding is done in reverse order):<br class=""><br class="">   <span class="Apple-converted-space"> </span>totalLength += encoder.prependByteArrayBlock(<YOUR_TYPE>, m_myValue, 8);<br class=""><br class="">And the following to the wireDecode:<br class=""><br class="">     <span class="Apple-converted-space"> </span>val = m_wire.find(<YOUR_TYPE>);<br class="">     <span class="Apple-converted-space"> </span>if (val != m_wire.elements_end()) {<br class="">         memcpy(m_myValue, val->value(), val->value_size());<br class="">     <span class="Apple-converted-space"> </span>else<br class="">         memset(m_myValue, 0, 8);<br class=""><br class="">---<br class="">Alex <br class=""></blockquote><blockquote style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;" class="gmail_quote"><span class="">><br class="">> Can someone please give some guidance ???.<br class="">><br class="">> thanks and rgds.<br class="">> C<br class=""></span>> _______________________________________________<br class="">> ndnSIM mailing list<br class="">><span class="Apple-converted-space"> </span><a href="mailto:ndnSIM@lists.cs.ucla.edu" class="">ndnSIM@lists.cs.ucla.edu</a><br class="">><span class="Apple-converted-space"> </span><a href="http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim" rel="noreferrer" target="_blank" class="">http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim</a></blockquote></div></div></div></div></blockquote></div><br class=""></body></html>