Entry: Link to phosphor-dbus-interfaces

Link to libphosphor_dbus.so so that the Entry
code is auto-generated.

Change-Id: I845d083456a1094a49f773b3ec64240d4515b3ac
Signed-off-by: Adriana Kobylak <anoo@linux.vnet.ibm.com>
diff --git a/Makefile.am b/Makefile.am
index 479c086..d0189de 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -14,7 +14,6 @@
 	xyz.openbmc_project.Logging.Internal.Manager.cpp \
 	log_manager.cpp \
 	log_manager_main.cpp \
-	xyz.openbmc_project.Logging.Entry.cpp \
 	elog_entry.cpp
 
 # Be sure to build needed files before compiling
@@ -27,8 +26,14 @@
 # systemd required for journal interfaces
 logging_test_LDFLAGS = $(SYSTEMD_LIBS) $(SDBUSPLUS_LIBS)
 logging_test_CXXFLAGS = $(SYSTEMD_CFLAGS) $(SDBUSPLUS_CFLAGS)
-phosphor_log_manager_LDFLAGS = $(SYSTEMD_LIBS) $(SDBUSPLUS_LIBS)
-phosphor_log_manager_CXXFLAGS = $(SYSTEMD_CFLAGS) $(SDBUSPLUS_CFLAGS)
+phosphor_log_manager_LDFLAGS = \
+		$(SYSTEMD_LIBS) \
+		$(SDBUSPLUS_LIBS) \
+		$(PHOSPHOR_DBUS_INTERFACES_LIBS)
+phosphor_log_manager_CXXFLAGS = \
+		$(SYSTEMD_CFLAGS) \
+		$(SDBUSPLUS_CFLAGS) \
+		$(PHOSPHOR_DBUS_INTERFACES_CFLAGS)
 
 ELOG_MAKO ?= elog-gen-template.mako.hpp
 LOOKUP_MAKO ?= elog-lookup-template.mako.cpp
diff --git a/configure.ac b/configure.ac
index d668d7a..01423ed 100644
--- a/configure.ac
+++ b/configure.ac
@@ -25,6 +25,8 @@
 PKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 221])
 PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus],,
     AC_MSG_ERROR(["Requires sdbusplus package."]))
+PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [phosphor-dbus-interfaces],,\
+    AC_MSG_ERROR(["Requires phosphor-dbus-interfaces package."]))
 
 AC_CHECK_HEADER(systemd/sd-journal.h, ,[AC_MSG_ERROR([Could not find \
 systemd/sd-journal.h...systemd developement package required])])
diff --git a/xyz.openbmc_project.Logging.Entry.cpp b/xyz.openbmc_project.Logging.Entry.cpp
deleted file mode 100644
index cdf91f5..0000000
--- a/xyz.openbmc_project.Logging.Entry.cpp
+++ /dev/null
@@ -1,400 +0,0 @@
-#include <algorithm>
-#include <sdbusplus/server.hpp>
-#include <sdbusplus/exception.hpp>
-#include <xyz/openbmc_project/Logging/Entry/server.hpp>
-
-namespace sdbusplus
-{
-namespace xyz
-{
-namespace openbmc_project
-{
-namespace Logging
-{
-namespace server
-{
-
-Entry::Entry(bus::bus& bus, const char* path)
-        : _xyz_openbmc_project_Logging_Entry_interface(
-                bus, path, _interface, _vtable, this)
-{
-}
-
-
-
-auto Entry::id() const ->
-        uint32_t
-{
-    return _id;
-}
-
-int Entry::_callback_get_Id(
-        sd_bus* bus, const char* path, const char* interface,
-        const char* property, sd_bus_message* reply, void* context,
-        sd_bus_error* error)
-{
-    using sdbusplus::server::binding::details::convertForMessage;
-
-    try
-    {
-        auto m = message::message(sd_bus_message_ref(reply));
-
-        auto o = static_cast<Entry*>(context);
-        m.append(convertForMessage(o->id()));
-    }
-    catch(sdbusplus::internal_exception_t& e)
-    {
-        sd_bus_error_set_const(error, e.name(), e.description());
-        return -EINVAL;
-    }
-
-    return true;
-}
-
-auto Entry::id(uint32_t value) ->
-        uint32_t
-{
-    if (_id != value)
-    {
-        _id = value;
-        _xyz_openbmc_project_Logging_Entry_interface.property_changed("Id");
-    }
-
-    return _id;
-}
-
-int Entry::_callback_set_Id(
-        sd_bus* bus, const char* path, const char* interface,
-        const char* property, sd_bus_message* value, void* context,
-        sd_bus_error* error)
-{
-    try
-    {
-        auto m = message::message(sd_bus_message_ref(value));
-
-        auto o = static_cast<Entry*>(context);
-
-        uint32_t v{};
-        m.read(v);
-        o->id(v);
-    }
-    catch(sdbusplus::internal_exception_t& e)
-    {
-        sd_bus_error_set_const(error, e.name(), e.description());
-        return -EINVAL;
-    }
-
-    return true;
-}
-
-namespace details
-{
-namespace Entry
-{
-static const auto _property_Id =
-    utility::tuple_to_array(message::types::type_id<
-            uint32_t>());
-}
-}
-auto Entry::severity() const ->
-        Level
-{
-    return _severity;
-}
-
-int Entry::_callback_get_Severity(
-        sd_bus* bus, const char* path, const char* interface,
-        const char* property, sd_bus_message* reply, void* context,
-        sd_bus_error* error)
-{
-    using sdbusplus::server::binding::details::convertForMessage;
-
-    try
-    {
-        auto m = message::message(sd_bus_message_ref(reply));
-
-        auto o = static_cast<Entry*>(context);
-        m.append(convertForMessage(o->severity()));
-    }
-    catch(sdbusplus::internal_exception_t& e)
-    {
-        sd_bus_error_set_const(error, e.name(), e.description());
-        return -EINVAL;
-    }
-
-    return true;
-}
-
-auto Entry::severity(Level value) ->
-        Level
-{
-    if (_severity != value)
-    {
-        _severity = value;
-        _xyz_openbmc_project_Logging_Entry_interface.property_changed("Severity");
-    }
-
-    return _severity;
-}
-
-int Entry::_callback_set_Severity(
-        sd_bus* bus, const char* path, const char* interface,
-        const char* property, sd_bus_message* value, void* context,
-        sd_bus_error* error)
-{
-    try
-    {
-        auto m = message::message(sd_bus_message_ref(value));
-
-        auto o = static_cast<Entry*>(context);
-
-        std::string v{};
-        m.read(v);
-        o->severity(convertLevelFromString(v));
-    }
-    catch(sdbusplus::internal_exception_t& e)
-    {
-        sd_bus_error_set_const(error, e.name(), e.description());
-        return -EINVAL;
-    }
-
-    return true;
-}
-
-namespace details
-{
-namespace Entry
-{
-static const auto _property_Severity =
-    utility::tuple_to_array(message::types::type_id<
-            std::string>());
-}
-}
-auto Entry::message() const ->
-        std::string
-{
-    return _message;
-}
-
-int Entry::_callback_get_Message(
-        sd_bus* bus, const char* path, const char* interface,
-        const char* property, sd_bus_message* reply, void* context,
-        sd_bus_error* error)
-{
-    using sdbusplus::server::binding::details::convertForMessage;
-
-    try
-    {
-        auto m = message::message(sd_bus_message_ref(reply));
-
-        auto o = static_cast<Entry*>(context);
-        m.append(convertForMessage(o->message()));
-    }
-    catch(sdbusplus::internal_exception_t& e)
-    {
-        sd_bus_error_set_const(error, e.name(), e.description());
-        return -EINVAL;
-    }
-
-    return true;
-}
-
-auto Entry::message(std::string value) ->
-        std::string
-{
-    if (_message != value)
-    {
-        _message = value;
-        _xyz_openbmc_project_Logging_Entry_interface.property_changed("Message");
-    }
-
-    return _message;
-}
-
-int Entry::_callback_set_Message(
-        sd_bus* bus, const char* path, const char* interface,
-        const char* property, sd_bus_message* value, void* context,
-        sd_bus_error* error)
-{
-    try
-    {
-        auto m = message::message(sd_bus_message_ref(value));
-
-        auto o = static_cast<Entry*>(context);
-
-        std::string v{};
-        m.read(v);
-        o->message(v);
-    }
-    catch(sdbusplus::internal_exception_t& e)
-    {
-        sd_bus_error_set_const(error, e.name(), e.description());
-        return -EINVAL;
-    }
-
-    return true;
-}
-
-namespace details
-{
-namespace Entry
-{
-static const auto _property_Message =
-    utility::tuple_to_array(message::types::type_id<
-            std::string>());
-}
-}
-auto Entry::additionalData() const ->
-        std::vector<std::string>
-{
-    return _additionalData;
-}
-
-int Entry::_callback_get_AdditionalData(
-        sd_bus* bus, const char* path, const char* interface,
-        const char* property, sd_bus_message* reply, void* context,
-        sd_bus_error* error)
-{
-    using sdbusplus::server::binding::details::convertForMessage;
-
-    try
-    {
-        auto m = message::message(sd_bus_message_ref(reply));
-
-        auto o = static_cast<Entry*>(context);
-        m.append(convertForMessage(o->additionalData()));
-    }
-    catch(sdbusplus::internal_exception_t& e)
-    {
-        sd_bus_error_set_const(error, e.name(), e.description());
-        return -EINVAL;
-    }
-
-    return true;
-}
-
-auto Entry::additionalData(std::vector<std::string> value) ->
-        std::vector<std::string>
-{
-    if (_additionalData != value)
-    {
-        _additionalData = value;
-        _xyz_openbmc_project_Logging_Entry_interface.property_changed("AdditionalData");
-    }
-
-    return _additionalData;
-}
-
-int Entry::_callback_set_AdditionalData(
-        sd_bus* bus, const char* path, const char* interface,
-        const char* property, sd_bus_message* value, void* context,
-        sd_bus_error* error)
-{
-    try
-    {
-        auto m = message::message(sd_bus_message_ref(value));
-
-        auto o = static_cast<Entry*>(context);
-
-        std::vector<std::string> v{};
-        m.read(v);
-        o->additionalData(v);
-    }
-    catch(sdbusplus::internal_exception_t& e)
-    {
-        sd_bus_error_set_const(error, e.name(), e.description());
-        return -EINVAL;
-    }
-
-    return true;
-}
-
-namespace details
-{
-namespace Entry
-{
-static const auto _property_AdditionalData =
-    utility::tuple_to_array(message::types::type_id<
-            std::vector<std::string>>());
-}
-}
-
-
-namespace
-{
-/** String to enum mapping for Entry::Level */
-static const std::tuple<const char*, Entry::Level> mappingEntryLevel[] =
-        {
-            std::make_tuple( "xyz.openbmc_project.Logging.Entry.Level.Emergency",                 Entry::Level::Emergency ),
-            std::make_tuple( "xyz.openbmc_project.Logging.Entry.Level.Alert",                 Entry::Level::Alert ),
-            std::make_tuple( "xyz.openbmc_project.Logging.Entry.Level.Critical",                 Entry::Level::Critical ),
-            std::make_tuple( "xyz.openbmc_project.Logging.Entry.Level.Error",                 Entry::Level::Error ),
-            std::make_tuple( "xyz.openbmc_project.Logging.Entry.Level.Warning",                 Entry::Level::Warning ),
-            std::make_tuple( "xyz.openbmc_project.Logging.Entry.Level.Notice",                 Entry::Level::Notice ),
-            std::make_tuple( "xyz.openbmc_project.Logging.Entry.Level.Informational",                 Entry::Level::Informational ),
-            std::make_tuple( "xyz.openbmc_project.Logging.Entry.Level.Debug",                 Entry::Level::Debug ),
-        };
-
-} // anonymous namespace
-
-auto Entry::convertLevelFromString(std::string& s) ->
-        Level
-{
-    auto i = std::find_if(
-            std::begin(mappingEntryLevel),
-            std::end(mappingEntryLevel),
-            [&s](auto& e){ return 0 == strcmp(s.c_str(), std::get<0>(e)); } );
-    if (std::end(mappingEntryLevel) == i)
-    {
-        throw sdbusplus::exception::InvalidEnumString();
-    }
-    else
-    {
-        return std::get<1>(*i);
-    }
-}
-
-std::string convertForMessage(Entry::Level v)
-{
-    auto i = std::find_if(
-            std::begin(mappingEntryLevel),
-            std::end(mappingEntryLevel),
-            [v](auto& e){ return v == std::get<1>(e); });
-    return std::get<0>(*i);
-}
-
-const vtable::vtable_t Entry::_vtable[] = {
-    vtable::start(),
-    vtable::property("Id",
-                     details::Entry::_property_Id
-                        .data(),
-                     _callback_get_Id,
-                     _callback_set_Id,
-                     vtable::property_::emits_change),
-    vtable::property("Severity",
-                     details::Entry::_property_Severity
-                        .data(),
-                     _callback_get_Severity,
-                     _callback_set_Severity,
-                     vtable::property_::emits_change),
-    vtable::property("Message",
-                     details::Entry::_property_Message
-                        .data(),
-                     _callback_get_Message,
-                     _callback_set_Message,
-                     vtable::property_::emits_change),
-    vtable::property("AdditionalData",
-                     details::Entry::_property_AdditionalData
-                        .data(),
-                     _callback_get_AdditionalData,
-                     _callback_set_AdditionalData,
-                     vtable::property_::emits_change),
-    vtable::end()
-};
-
-} // namespace server
-} // namespace Logging
-} // namespace openbmc_project
-} // namespace xyz
-} // namespace sdbusplus
-
diff --git a/xyz/openbmc_project/Logging/Entry/server.hpp b/xyz/openbmc_project/Logging/Entry/server.hpp
deleted file mode 100644
index e35a7b3..0000000
--- a/xyz/openbmc_project/Logging/Entry/server.hpp
+++ /dev/null
@@ -1,146 +0,0 @@
-#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
-