[ndnSIM] Adding a new field to Data packet in ndn-cxx

Spyridon (Spyros) Mastorakis spiros.mastorakis at gmail.com
Tue Jul 21 19:49:11 PDT 2015


Hi Natalya,

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).

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.

Let me know if you need anything else.

--
Spyridon (Spyros) Mastorakis
Personal Website: http://cs.ucla.edu/~mastorakis/
Internet Research Laboratory
PhD Computer Science
UCLA




> On Jul 21, 2015, at 12:49 PM, rozhnova.natalya at gmail.com wrote:
> 
> [Sorry for multiple reception]
> 
> Hi all,
> 
> I'm using the last version of ndn-cxx and ndnSIM and would like to add a new field to Data packet.
> The steps I'm following (that what I used to successfully modify Interest packets):
> 1. I added my field to tlv.hpp
> 2. I created a variable in data.hpp
> 3. I created the get and set functions
> 4. I modified wireEncode and wireDecode and put my new field between signature and content respecting the reverse encoding.
> 
> I compile and run the library as follows:
> ./waf configure --enable-shared --disable-static (I don't do it every time, I cite it here just to show everything I've done)
> ./waf
> sudo ./waf install
> 
> Then I run any scenario, suppose it is ndn-simple.cpp
> 
> And I get the following error:
> 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.
> 
> in debug mode I get:
> 
> (gdb) bt
> #0  0x00007fffeae1f107 in __GI_raise (sig=sig at entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
> #1  0x00007fffeae204e8 in __GI_abort () at abort.c:89
> #2  0x00007fffeae620fd in __malloc_assert (
>    assertion=assertion at 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 at entry=0x7fffeaf4c005 "malloc.c", line=line at entry=2372, function=function at entry=0x7fffeaf4c383 <__func__.11292> "sysmalloc") at malloc.c:293
> #3  0x00007fffeae64de0 in sysmalloc (av=0x7fffeb18d620 <main_arena>, nb=4112) at malloc.c:2369
> #4  _int_malloc (av=0x7fffeb18d620 <main_arena>, bytes=4096) at malloc.c:3800
> #5  0x00007fffeae66070 in __GI___libc_malloc (bytes=4096) at malloc.c:2891
> #6  0x00007fffeb711d78 in operator new(unsigned long) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
> #7  0x00007ffff587c868 in __gnu_cxx::new_allocator<char>::allocate (this=0x7fffffffbb37, __n=4096) at /usr/include/c++/4.9/ext/new_allocator.h:104
> #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
> #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
> #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=..., 
>    buffer_size=4096, pback_size=4) at /usr/include/boost/iostreams/detail/streambuf/indirect_streambuf.hpp:183
> #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, 
>    pback_size=-1) at /usr/include/boost/iostreams/stream_buffer.hpp:106
> #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, 
>    pback_size=-1) at /usr/include/boost/iostreams/stream_buffer.hpp:94
> #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)
>    at /usr/include/boost/iostreams/stream.hpp:143
> #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)
>    at /usr/include/boost/iostreams/stream.hpp:128
> #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
> #16 0x00007ffff58c1cd3 in ndn::io::load<ndn::IdentityCertificate> (is=..., encoding=ndn::io::BASE_64) at /usr/local/include/ndn-cxx/util/io.hpp:65
> 
> It's already being two days that I don't understand what's wrong... Can anybody help me please?
> 
> thanks in advance,
> Best,
> Natalya
> 
> _______________________________________________
> ndnSIM mailing list
> ndnSIM at lists.cs.ucla.edu
> http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim





More information about the ndnSIM mailing list