ccn-lite
ccn-lite copied to clipboard
issue in ccnl_mkSimpleContent
Hi,
I've encountered an issue while using ccnl_mkContentObject
. Basically, the pointer to the content (returned via the function) does not match the content I've passed to the function. I've started to narrow it down and basically there seems to be something wrong with
315 c_p->content = c_p->buf->data + dataoffset;
Unfortunately, copy/paste in my VM setup does not work, but I basically provided my own local producer function which in turn calls ccnl_mkSimpleContent
. The following screenshot depicts an interest /foo/bar
which triggers the call of my local producer which tries to create content. The content is set to "RIOT!" (meaning no matter which name you pass via an interest, it will always create a corresponding NDO containing a "RIOT!" string).
What you notice is that the offset is 25
while the actual content is at offset 18
. Speaking again about the listing above, the data in c_p->content
is not pointing to actual data I've passed to ccnl_mkSimpleContent
.
First, am I missing something? Second, can somebody confirm this behaviour?
TIA
I've uploaded the code for this example over here.
In order to compile your example I had to apply some changes: https://gist.github.com/OlegHahm/5c6034994e324f6c2769c00fc6802f7a and build with WERROR=0
.
Since there seems to be no documentation on ccnl_mkSimpleContent()
it's hard to tell what the parameter payoffset
is supposed to contain. However, it seems that it is set to the offset within the ccnl_buf_s
struct, not the actual data buffer (buf->data
).
So, yes, I can confirm the behavior. Yes, it is confusing. No, I have no idea what was the intentions (if any) behind that.
I can also confirm the behavior, but I have no idea, why it is like it is. Christian implemented that.
So we can agree that It is pointing to the wrong position in the buffer and make it a bug?
Yes, I think so