Re: Expressing large integer values in D-Bus APIs

Thiago Macieira <[email protected]>
Newsgroups gmane.comp.freedesktop.dbus
Message-ID <8026072.CPxDdr5TTs@tjmaciei-mobl1>
On segunda-feira, 17 de julho de 2017 12:12:09 PDT Andy Grover wrote:
> Hi all,
> 
> If we have a large integer value that might exceed 64 bits, how best to
> expose it on D-Bus? Convert to string? an array of [u64 (high), u64
> (low)]? An array of 16 bytes and specify endianness?
> 
> Another solution (but the most work) would be to add INT/UINT128 basic
> types. Is that within the realm of possibility?

I don't think it is.

I'd recommend you just follow regular "bigint" type marshalling in other 
binary protocols. For example, CBOR[1] sends an array of bytes just long 
enough (no extraneous zero bytes) and, since it's a network protocol, in 
network byte order. The D-Bus header has a big/little flag, but it's not always 
accessible to the application layer, so you may need to choose a single 
endianness.

[1] https://tools.ietf.org/html/rfc7049#section-2.4.2

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center

_______________________________________________
dbus mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dbus
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.