[systemd-devel] sd-bus: get size of array container in D-Bus message
Giacinto Cifelli
gciofono at gmail.com
Wed Aug 2 17:57:11 UTC 2023
On Wed, Aug 2, 2023 at 6:44 PM Stephen Hemminger
<stephen at networkplumber.org> wrote:
>
> On Wed, 02 Aug 2023 06:39:47 +0000
> Stanislav Angelovič <stanislav.angelovic at protonmail.com> wrote:
>
> > Hi folks,
> >
> > I have a quick question: is there a way to get container size when deserializing an array from a D-Bus message (be it an array of trivial or non-trivial D-Bus types)? Say I enter a container with sd_bus_message_enter_container, and then, before reading individual elements, I'd like to get the number of elements in that array in that message (so I can reserve storage on my side, etc.).
> >
> > If not, could such an API function be added?
> >
> > Thanks in advance.
> >
> > Stanislav.
>
> The dbus messsage just an encoding of a byte stream. There is nothing in the byte stream
> that indicates the length.
yes, but the whole message is available locally, it could be parsed on
request, discarding the data, and keeping only the number of elements
in an array.
More information about the systemd-devel
mailing list