<div dir="ltr"><div><div>Hi Spyridon,<br><br></div>Thanks for your reply. I was sure about what I'm doing but didn't get the things work... Finally, I should return to the previous version of ndn-cxx 0.3.1 and implement my field there. That works perfectly. I don't know what did the authors change in the version 0.3.3 that makes impossible to add a field to data packet in the same way as in version 0.3.1... <br>A little advice and demand from customer side: that would be great if the authors could add a short tutorial on how to add a custom field to a packet (like it was in ndnSIM 1.0 on adding custom strategies etc., very useful and clear) in order to let people work with the implementation in a correct way and do not look for how to hack the things.<br><br></div><div>Best,</div><div>Natalya<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-07-22 4:49 GMT+02:00 Spyridon (Spyros) Mastorakis <span dir="ltr"><<a href="mailto:spiros.mastorakis@gmail.com" target="_blank">spiros.mastorakis@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Natalya,<br>
<br>
it is hard to say what is wrong by just looking the output in debug mode. I suspect, though, that something is wrong in the wireEncode and wireDecode methods (this is a common place that developers’ bugs occur).<br>
<br>
If I were you, I would try to slightly modify or extend the ndn-cxx unit-tests of the Data class. Then I would configure ndn-cxx including the --with-tests flag and compile it. Finally, I would check if I could pass the unit tests. I think that the unit tests would help you resolve the issue.<br>
<br>
Let me know if you need anything else.<br>
<br>
--<br>
Spyridon (Spyros) Mastorakis<br>
Personal Website: <a href="http://cs.ucla.edu/~mastorakis/" rel="noreferrer" target="_blank">http://cs.ucla.edu/~mastorakis/</a><br>
Internet Research Laboratory<br>
PhD Computer Science<br>
UCLA<br>
<div><div class="h5"><br>
<br>
<br>
<br>
> On Jul 21, 2015, at 12:49 PM, <a href="mailto:rozhnova.natalya@gmail.com">rozhnova.natalya@gmail.com</a> wrote:<br>
><br>
> [Sorry for multiple reception]<br>
><br>
> Hi all,<br>
><br>
> I'm using the last version of ndn-cxx and ndnSIM and would like to add a new field to Data packet.<br>
> The steps I'm following (that what I used to successfully modify Interest packets):<br>
> 1. I added my field to tlv.hpp<br>
> 2. I created a variable in data.hpp<br>
> 3. I created the get and set functions<br>
> 4. I modified wireEncode and wireDecode and put my new field between signature and content respecting the reverse encoding.<br>
><br>
> I compile and run the library as follows:<br>
> ./waf configure --enable-shared --disable-static (I don't do it every time, I cite it here just to show everything I've done)<br>
> ./waf<br>
> sudo ./waf install<br>
><br>
> Then I run any scenario, suppose it is ndn-simple.cpp<br>
><br>
> And I get the following error:<br>
> ns3-dev-ndn-simple-debug: malloc.c:2372: sysmalloc: Assertion `(old_top == (((mbinptr) (((char *) &((av)->bins[((1) - 1) * 2])) - __builtin_offsetof (struct malloc_chunk, fd)))) && old_size == 0) || ((unsigned long) (old_size) >= (unsigned long)((((__builtin_offsetof (struct malloc_chunk, fd_nextsize))+((2 *(sizeof(size_t))) - 1)) & ~((2 *(sizeof(size_t))) - 1))) && ((old_top)->size & 0x1) && ((unsigned long) old_end & pagemask) == 0)' failed.<br>
><br>
> in debug mode I get:<br>
><br>
> (gdb) bt<br>
> #0  0x00007fffeae1f107 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56<br>
> #1  0x00007fffeae204e8 in __GI_abort () at abort.c:89<br>
> #2  0x00007fffeae620fd in __malloc_assert (<br>
>    assertion=assertion@entry=0x7fffeaf50518 "(old_top == (((mbinptr) (((char *) &((av)->bins[((1) - 1) * 2])) - __builtin_offsetof (struct malloc_chunk, fd)))) && old_size == 0) || ((unsigned long) (old_size) >= (unsigned long)((((__builtin_offs"..., file=file@entry=0x7fffeaf4c005 "malloc.c", line=line@entry=2372, function=function@entry=0x7fffeaf4c383 <__func__.11292> "sysmalloc") at malloc.c:293<br>
> #3  0x00007fffeae64de0 in sysmalloc (av=0x7fffeb18d620 <main_arena>, nb=4112) at malloc.c:2369<br>
> #4  _int_malloc (av=0x7fffeb18d620 <main_arena>, bytes=4096) at malloc.c:3800<br>
> #5  0x00007fffeae66070 in __GI___libc_malloc (bytes=4096) at malloc.c:2891<br>
> #6  0x00007fffeb711d78 in operator new(unsigned long) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6<br>
> #7  0x00007ffff587c868 in __gnu_cxx::new_allocator<char>::allocate (this=0x7fffffffbb37, __n=4096) at /usr/include/c++/4.9/ext/new_allocator.h:104<br>
> #8  0x00007ffff58cc735 in boost::iostreams::detail::basic_buffer<char, std::allocator<char> >::basic_buffer (this=0x7fffffffbb70, buffer_size=4096) at /usr/include/boost/iostreams/detail/buffer.hpp:146<br>
> #9  0x00007ffff58cb7c5 in boost::iostreams::detail::basic_buffer<char, std::allocator<char> >::resize (this=0x7fffffffbf28, buffer_size=4096) at /usr/include/boost/iostreams/detail/buffer.hpp:162<br>
> #10 0x00007ffff58ca431 in boost::iostreams::detail::indirect_streambuf<ndn::iostreams::buffer_append_device, std::char_traits<char>, std::allocator<char>, boost::iostreams::output>::open (this=0x7fffffffbec8, t=...,<br>
>    buffer_size=4096, pback_size=4) at /usr/include/boost/iostreams/detail/streambuf/indirect_streambuf.hpp:183<br>
> #11 0x00007ffff58c8534 in boost::iostreams::stream_buffer<ndn::iostreams::buffer_append_device, std::char_traits<char>, std::allocator<char>, boost::iostreams::output>::open_impl (this=0x7fffffffbec8, t=..., buffer_size=-1,<br>
>    pback_size=-1) at /usr/include/boost/iostreams/stream_buffer.hpp:106<br>
> #12 0x00007ffff58c63b6 in boost::iostreams::stream_buffer<ndn::iostreams::buffer_append_device, std::char_traits<char>, std::allocator<char>, boost::iostreams::output>::open (this=0x7fffffffbec8, t=..., buffer_size=-1,<br>
>    pback_size=-1) at /usr/include/boost/iostreams/stream_buffer.hpp:94<br>
> #13 0x00007ffff58c38ff in boost::iostreams::stream<ndn::iostreams::buffer_append_device, std::char_traits<char>, std::allocator<char> >::open_impl (this=0x7fffffffbec0, dev=..., buffer_size=-1, pback_size=-1)<br>
>    at /usr/include/boost/iostreams/stream.hpp:143<br>
> #14 0x00007ffff58c0bc0 in boost::iostreams::stream<ndn::iostreams::buffer_append_device, std::char_traits<char>, std::allocator<char> >::open (this=0x7fffffffbec0, t=..., buffer_size=-1, pback_size=-1)<br>
>    at /usr/include/boost/iostreams/stream.hpp:128<br>
> #15 0x00007ffff58bdad2 in ndn::OBufferStream::OBufferStream (this=0x7fffffffbec0, __in_chrg=<optimized out>, __vtt_parm=<optimized out>) at /usr/local/include/ndn-cxx/encoding/buffer-stream.hpp:89<br>
> #16 0x00007ffff58c1cd3 in ndn::io::load<ndn::IdentityCertificate> (is=..., encoding=ndn::io::BASE_64) at /usr/local/include/ndn-cxx/util/io.hpp:65<br>
><br>
> It's already being two days that I don't understand what's wrong... Can anybody help me please?<br>
><br>
> thanks in advance,<br>
> Best,<br>
> Natalya<br>
><br>
</div></div>> _______________________________________________<br>
> ndnSIM mailing list<br>
> <a href="mailto:ndnSIM@lists.cs.ucla.edu">ndnSIM@lists.cs.ucla.edu</a><br>
> <a href="http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim" rel="noreferrer" target="_blank">http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim</a><br>
<br>
</blockquote></div><br></div>