message: new_method_return for method-call replies
Change-Id: I1c9a1960f4f0cc904ca1534a33e4e433ed8e1649
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/sdbusplus/message.hpp b/sdbusplus/message.hpp
index 1d60c81..a3a07ed 100644
--- a/sdbusplus/message.hpp
+++ b/sdbusplus/message.hpp
@@ -108,6 +108,18 @@
return sd_bus_message_is_method_call(_msg.get(), interface, method);
}
+ /** @brief Create a 'method_return' type message from an existing message.
+ *
+ * @return method-return message.
+ */
+ message new_method_return()
+ {
+ msgp_t reply = nullptr;
+ sd_bus_message_new_method_return(this->get(), &reply);
+
+ return message(reply);
+ }
+
friend struct sdbusplus::bus::bus;
private: