Hi, A quick question: Is it possible to append contents (the serialized data) of an sd-bus message to another sd-bus message? Conversely, is it possible to extract a part of sd-bus message contents into a separate message?
Details: In the process of creating a method call message, I would like to do this: 1. Create a temporary, empty message A. 2. Serialize data into the message A. 3. Create a method call message B. 4. Serialize some user data into the message B, plus copy the data of the message A into the message B. And send the message B. Analogously, when deserializing data from the message B upon its reception on the server side, I would like to do this: 1. Extract user data from the message B, plus copy selected data into a separate, empty message A. 2. Destroy the message B. 3. In some other context, deserialize real data from the message A. Why am I asking is because we like sd-bus and are building a C++ binding on top of it. We stumbled upon a problem when modelling Variant. The typical flow in such a case is that upon e.g. deserialization, first the Variant instances are created from the message contents, and then at some later phase, users want to extract real data from the Variant. In this phase, our C++ binding would perform the deserialization from that temporry message (message A) that the Variant would hold. For example, if the method call message carries an array of Variants, we first deserialize the message into std::vector<Variant>, where each Variant instance keeps the temporary sd-bus message with the variant data, and when the user asks for a concrete data from that Variant, the deserialization from that temporary message takes place. This is the way it's done in e.g. dbus-c++, the C++ binding for libdbus. libdbus API allows creating "empty" messages, and allows copying the data among messages with the possibility of reading from them at the same time. Is it possible to create an empty message using sd-bus? Regarding copying, we know there's the sd_bus_message_copy function, but once we create the copy message, we cannot read from it later because of the assertion that the message is sealed, which in reality is not. Is there a way to solve this in sd-bus? Perhaps another way than I described? Many thanks in advance for your response! With kind regards, Stan.
_______________________________________________ systemd-devel mailing list firstname.lastname@example.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel