summaryrefslogtreecommitdiffstats
path: root/xyz/openbmc_project/Logging
diff options
context:
space:
mode:
authorAdriana Kobylak <anoo@us.ibm.com>2017-01-24 12:30:15 -0600
committerAdriana Kobylak <anoo@us.ibm.com>2017-01-30 12:57:25 -0600
commit88d7cf8da4a7213e4f91d3eca35ec6a2fd8f9ca0 (patch)
tree9d3a907abd251debf41c1af553c69badb67e34b5 /xyz/openbmc_project/Logging
parent7298dc2320ff8b18b16acfb66a06c328c786dd87 (diff)
downloadphosphor-logging-88d7cf8da4a7213e4f91d3eca35ec6a2fd8f9ca0.tar.gz
phosphor-logging-88d7cf8da4a7213e4f91d3eca35ec6a2fd8f9ca0.zip
logging: Create Entry dbus interface
Implement the generated code to create an error/event entry dbus object. Change-Id: I881636fe3e8de680d9a15fff1fe933d5e22eed06 Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
Diffstat (limited to 'xyz/openbmc_project/Logging')
-rw-r--r--xyz/openbmc_project/Logging/Entry/server.hpp146
1 files changed, 146 insertions, 0 deletions
diff --git a/xyz/openbmc_project/Logging/Entry/server.hpp b/xyz/openbmc_project/Logging/Entry/server.hpp
new file mode 100644
index 0000000..e35a7b3
--- /dev/null
+++ b/xyz/openbmc_project/Logging/Entry/server.hpp
@@ -0,0 +1,146 @@
+#pragma once
+#include <tuple>
+#include <systemd/sd-bus.h>
+#include <sdbusplus/server.hpp>
+
+namespace sdbusplus
+{
+namespace xyz
+{
+namespace openbmc_project
+{
+namespace Logging
+{
+namespace server
+{
+
+class Entry
+{
+ public:
+ /* Define all of the basic class operations:
+ * Not allowed:
+ * - Default constructor to avoid nullptrs.
+ * - Copy operations due to internal unique_ptr.
+ * - Move operations due to 'this' being registered as the
+ * 'context' with sdbus.
+ * Allowed:
+ * - Destructor.
+ */
+ Entry() = delete;
+ Entry(const Entry&) = delete;
+ Entry& operator=(const Entry&) = delete;
+ Entry(Entry&&) = delete;
+ Entry& operator=(Entry&&) = delete;
+ virtual ~Entry() = default;
+
+ /** @brief Constructor to put object onto bus at a dbus path.
+ * @param[in] bus - Bus to attach to.
+ * @param[in] path - Path to attach at.
+ */
+ Entry(bus::bus& bus, const char* path);
+
+ enum class Level
+ {
+ Emergency,
+ Alert,
+ Critical,
+ Error,
+ Warning,
+ Notice,
+ Informational,
+ Debug,
+ };
+
+
+
+ /** Get value of Id */
+ virtual uint32_t id() const;
+ /** Set value of Id */
+ virtual uint32_t id(uint32_t value);
+ /** Get value of Severity */
+ virtual Level severity() const;
+ /** Set value of Severity */
+ virtual Level severity(Level value);
+ /** Get value of Message */
+ virtual std::string message() const;
+ /** Set value of Message */
+ virtual std::string message(std::string value);
+ /** Get value of AdditionalData */
+ virtual std::vector<std::string> additionalData() const;
+ /** Set value of AdditionalData */
+ virtual std::vector<std::string> additionalData(std::vector<std::string> value);
+
+ /** @brief Convert a string to an appropriate enum value.
+ * @param[in] s - The string to convert in the form of
+ * "xyz.openbmc_project.Logging.Entry.<value name>"
+ * @return - The enum value.
+ */
+ static Level convertLevelFromString(std::string& s);
+
+ private:
+
+ /** @brief sd-bus callback for get-property 'Id' */
+ static int _callback_get_Id(
+ sd_bus*, const char*, const char*, const char*,
+ sd_bus_message*, void*, sd_bus_error*);
+ /** @brief sd-bus callback for set-property 'Id' */
+ static int _callback_set_Id(
+ sd_bus*, const char*, const char*, const char*,
+ sd_bus_message*, void*, sd_bus_error*);
+
+ /** @brief sd-bus callback for get-property 'Severity' */
+ static int _callback_get_Severity(
+ sd_bus*, const char*, const char*, const char*,
+ sd_bus_message*, void*, sd_bus_error*);
+ /** @brief sd-bus callback for set-property 'Severity' */
+ static int _callback_set_Severity(
+ sd_bus*, const char*, const char*, const char*,
+ sd_bus_message*, void*, sd_bus_error*);
+
+ /** @brief sd-bus callback for get-property 'Message' */
+ static int _callback_get_Message(
+ sd_bus*, const char*, const char*, const char*,
+ sd_bus_message*, void*, sd_bus_error*);
+ /** @brief sd-bus callback for set-property 'Message' */
+ static int _callback_set_Message(
+ sd_bus*, const char*, const char*, const char*,
+ sd_bus_message*, void*, sd_bus_error*);
+
+ /** @brief sd-bus callback for get-property 'AdditionalData' */
+ static int _callback_get_AdditionalData(
+ sd_bus*, const char*, const char*, const char*,
+ sd_bus_message*, void*, sd_bus_error*);
+ /** @brief sd-bus callback for set-property 'AdditionalData' */
+ static int _callback_set_AdditionalData(
+ sd_bus*, const char*, const char*, const char*,
+ sd_bus_message*, void*, sd_bus_error*);
+
+
+ static constexpr auto _interface = "xyz.openbmc_project.Logging.Entry";
+ static const vtable::vtable_t _vtable[];
+ sdbusplus::server::interface::interface
+ _xyz_openbmc_project_Logging_Entry_interface;
+
+ uint32_t _id{};
+ Level _severity{};
+ std::string _message{};
+ std::vector<std::string> _additionalData{};
+
+};
+
+/* Specialization of sdbusplus::server::bindings::details::convertForMessage
+ * for enum-type Entry::Level.
+ *
+ * This converts from the enum to a constant c-string representing the enum.
+ *
+ * @param[in] e - Enum value to convert.
+ * @return C-string representing the name for the enum value.
+ */
+std::string convertForMessage(Entry::Level e);
+
+} // namespace server
+} // namespace Logging
+} // namespace openbmc_project
+} // namespace xyz
+} // namespace sdbusplus
+
OpenPOWER on IntegriCloud