Expressing large integer values in D-Bus APIs

Thiago Macieira thiago at kde.org
Mon Jul 17 22:34:08 UTC 2017


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



More information about the dbus mailing list