[Portland] Transport mechanism
Lubos Lunak
l.lunak at suse.cz
Thu Mar 2 18:40:26 EET 2006
On Thursday 02 March 2006 14:02, nf2 wrote:
> Lubos Lunak wrote:
> > - Wire format: As already said above, it can be pretty simple. Message
> > can be { int id; int seq; int length; char rest[ length ]; }. The actual
> > body can be mostly marshalled as memcpy( buf, &foo, sizeof( foo )),
> > variable length stuff like strings can be again { int length; char data[
> > length ]; }, arrays similarly, maps can be { int count; X key1, Y value1,
> > X key2, Y
> > value2, .... }. String encoding utf8.
>
> Yes. For the types you are currently using (int, bool, string,
> stringlist) i think this model will suffice.
>
> Nevertheless LVariant has the following advantages:
>
> + It can send key/value maps containing values of different types. Even
> nested containers. That's where the type-information is necessary on the
> wire.
> + The binary data is easier to debug (becauce of the type-information)
> + The LVariant wire protocol is easy to standardize.
> + Serialization/Unserialization is quite convenient, cause it's running
> recursively.
...
> Just an example how to serizalize an array of two strings and one int
> into a buffer:
How exactly does one create an array containing two strings and one int in C?
Assuming you actually meant a struct then given that the marshalling code has
to know the format of the data, it can be simply done manually as well. The
same reason for it working recursively even manually (and dead-simple with
C++'s templates).
> > The int seq is there to handle parallel operations, e.g. for two
> > download operations one needs to be able to tell which of the operations
> > actually finished.
>
> Hmm. Or just open another connection for parallel operations...
It seems like an overkill to have a separate connection for every async
operation.
--
Lubos Lunak
KDE developer
---------------------------------------------------------------------
SuSE CR, s.r.o. e-mail: l.lunak at suse.cz , l.lunak at kde.org
Drahobejlova 27 tel: +420 2 9654 2373
190 00 Praha 9 fax: +420 2 9654 2374
Czech Republic http://www.suse.cz/
More information about the Portland
mailing list