message: Add wrappers for sd_bus_get_xxx
At the moment only signal arguments are accessible in signal
messages. Key information such as the path of the object emitting
the signal are in the message headers, so provide access to those
as well.
Change-Id: I25bc18c21cd4c3d66cad4cf38235469d5092d364
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/sdbusplus/message.hpp b/sdbusplus/message.hpp
index 8c9414e..21d3eb3 100644
--- a/sdbusplus/message.hpp
+++ b/sdbusplus/message.hpp
@@ -109,6 +109,51 @@
return sd_bus_message_get_signature(_msg.get(), true);
}
+ /** @brief Get the path of a message.
+ *
+ * @return A [weak] pointer to the path of the message.
+ */
+ const char* get_path()
+ {
+ return sd_bus_message_get_path(_msg.get());
+ }
+
+ /** @brief Get the interface of a message.
+ *
+ * @return A [weak] pointer to the interface of the message.
+ */
+ const char* get_interface()
+ {
+ return sd_bus_message_get_interface(_msg.get());
+ }
+
+ /** @brief Get the member of a message.
+ *
+ * @return A [weak] pointer to the member of the message.
+ */
+ const char* get_member()
+ {
+ return sd_bus_message_get_member(_msg.get());
+ }
+
+ /** @brief Get the destination of a message.
+ *
+ * @return A [weak] pointer to the destination of the message.
+ */
+ const char* get_destination()
+ {
+ return sd_bus_message_get_destination(_msg.get());
+ }
+
+ /** @brief Get the sender of a message.
+ *
+ * @return A [weak] pointer to the sender of the message.
+ */
+ const char* get_sender()
+ {
+ return sd_bus_message_get_sender(_msg.get());
+ }
+
/** @brief Check if message is a method error.
*
* @return True - if message is a method error.