[Olsr-dev] Serialize and Deserialize message

Airton Ishimori (spam-protected)
Fri Mar 26 15:57:05 CET 2010


Ok, so for exemple,  I can create a variable

uint32_t mst;
....
//This time is millisecond, right? for exemple, 2 ms?
mst = GETTIMESTAMP(0);
....
mst = htols(mst);

and so sent from socket?


On Fri, Mar 26, 2010 at 11:40, Henning Rogge <(spam-protected)> wrote:

> Am Freitag 26 März 2010 15:28:54 schrieb Airton Ishimori:
> > Hey,
> >
> > In the last times, I have problem with olsrd execution, but this problem
> is
> > solucioned. Thanks the all peoples that help me.
> How was the problem resolved ?
>
> > But now, I am have other challenge. How to serialize and deserialize
> > message in C to sent inside the network? Most specifically, int (size 32
> > bit and 16 bit) and float type?
> For int/short just use "htonl/htons" for serialization and "ntohl/ntohs"
> for
> deserialization. I would NOT try to serialize floating points, that can be
> a
> real pain. OLSRd use a format defined in the RFC to encode vtimes into a
> single byte value.
>
> > Another question, the olsrd works with time in ms or seconds? and both
> > works with float type or int type?
> Olsrd works with an internal circular time (based on gettimesofday())
> measured
> in milliseconds. The scheduler makes sure that the time will only step
> forward
> and not backward.
>
> Henning
>
> --
> 1) You can't win.
> 2) You can't break even.
> 3) You can't leave the game.
> — The Laws of Thermodynamics, summarized
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.olsr.org/pipermail/olsr-dev/attachments/20100326/8620409d/attachment.html>


More information about the Olsr-dev mailing list