Implement the Client create interface
This commit also implement the D-Bus service which would be
used for snmp client configuration and would add the
snmp manager/trap receiver D-Bus objects under
namespace /xyz/openbmc_project/network/snmp/manager/
It implements the delete interface for SNMP client D-Bus Object.
Resolves openbmc/openbmc#3057
Change-Id: I0df7b1475f81325b9ac497c1fb350c3f62329686
Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
diff --git a/snmp_client.hpp b/snmp_client.hpp
new file mode 100644
index 0000000..5b27f1b
--- /dev/null
+++ b/snmp_client.hpp
@@ -0,0 +1,60 @@
+#pragma once
+
+#include "xyz/openbmc_project/Network/Client/server.hpp"
+#include "xyz/openbmc_project/Object/Delete/server.hpp"
+
+#include <sdbusplus/bus.hpp>
+#include <sdbusplus/server/object.hpp>
+
+#include <string>
+
+namespace phosphor
+{
+namespace network
+{
+namespace snmp
+{
+
+class ConfManager;
+
+using Ifaces = sdbusplus::server::object::object<
+ sdbusplus::xyz::openbmc_project::Network::server::Client,
+ sdbusplus::xyz::openbmc_project::Object::server::Delete>;
+
+/** @class Client
+ * @brief represents the snmp client configuration
+ * @details A concrete implementation for the
+ * xyz.openbmc_project.Network.Client Dbus interface.
+ */
+class Client : public Ifaces
+{
+ public:
+ Client() = delete;
+ Client(const Client &) = delete;
+ Client &operator=(const Client &) = delete;
+ Client(Client &&) = delete;
+ Client &operator=(Client &&) = delete;
+ virtual ~Client() = default;
+
+ /** @brief Constructor to put object onto bus at a dbus path.
+ * @param[in] bus - Bus to attach to.
+ * @param[in] objPath - Path to attach at.
+ * @param[in] parent - Parent D-bus Object.
+ * @param[in] address - IPaddress/Hostname.
+ * @param[in] port - network port.
+ */
+ Client(sdbusplus::bus::bus &bus, const char *objPath, ConfManager &parent,
+ const std::string &address, uint16_t port);
+
+ /** @brief Delete this d-bus object.
+ */
+ void delete_() override;
+
+ private:
+ /** @brief Parent D-Bus Object. */
+ ConfManager &parent;
+};
+
+} // namespace snmp
+} // namespace network
+} // namespace phosphor