[Olsr-dev] rfc5444_reader documentation
Benjamin Valentin
(spam-protected)
Tue Jul 16 04:21:57 CEST 2013
Am Fri, 12 Jul 2013 08:46:39 +0200
schrieb Henning Rogge <(spam-protected)>:
> Hi,
>
> I took your example code, cleaned it up a little bit and added it to
> the repository in the example section. Hope you will find it easy to
> read.
>
> The main issue with your code was that your reader part declared a
> "message TVL type 2" as mandatory for your callback, but your writer
> added the "message TLV type 0" and "message TLV type 1". Because of
> this the callback was never called.
>
> The reader guarantees that the 'mandatory" TLVs are present when the
> block_callback() function pointer is called. Otherwise it will call
> the block_callback_failed_constraints() function pointer.
>
> Henning
Thank you a lot, the example really helped understanding how the
reader/writer is supposed to be used. I think it'd probably be helpful
to also add addresses with addresstlvs to the example (patch attached)
because I didn't find how they were handled obvious either.
I've then build a small 'virtual network' thing where multiple virtual
nodes can send each other rfc5444 messages. So I had to put all state
of the 'nodes' in a struct for each, but this didn't work with
rfc5444_writer_content_provider - _message_content_provider.creator is
required by the rfc5444_writer_add_address() but the addAddresses()
callback only gets a rfc5444_writer*, the
rfc5444_writer_content_provider is expected to be a local variable. [1]
As a result, addresses don't get added to the packages when the same
rfc5444_writer_content_provider gets used multiple times.
Benjamin
[1]
https://github.com/benpicco/virtual_network/blob/master/node/writer.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-add-addresses-with-addrtlvs.patch
Type: text/x-patch
Size: 6241 bytes
Desc: not available
URL: <http://lists.olsr.org/pipermail/olsr-dev/attachments/20130716/429b4a5c/attachment.bin>
More information about the Olsr-dev
mailing list