Initial D-Bus interface
This sets up an initial D-Bus interface without any real functionality.
It doesn't interact with any storage hardware yet.
The yaml files are included temporarily until the
phosphor-dbus-interfaces review is complete:
https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-dbus-interfaces/+/48636
The .clang-tidy file has been removed because clang-tidy can't filter
out the generated files. It should be re-enabled when we no longer need
to generate the D-Bus sources in this repo.
Signed-off-by: John Edward Broadbent <jebr@google.com>
Change-Id: If704e69ef7225257efc7c865424df4421999f62d
Signed-off-by: John Wedig <johnwedig@google.com>
diff --git a/include/estoraged.hpp b/include/estoraged.hpp
new file mode 100644
index 0000000..557c490
--- /dev/null
+++ b/include/estoraged.hpp
@@ -0,0 +1,69 @@
+#pragma once
+
+#include <sdbusplus/bus.hpp>
+#include <sdbusplus/exception.hpp>
+#include <sdbusplus/server/object.hpp>
+#include <xyz/openbmc_project/eStoraged/server.hpp>
+
+#include <string>
+#include <vector>
+
+namespace estoraged
+{
+using eStoragedInherit = sdbusplus::server::object_t<
+ sdbusplus::xyz::openbmc_project::server::eStoraged>;
+
+/** @class eStoraged
+ * @brief eStoraged object to manage a LUKS encrypted storage device.
+ */
+class eStoraged : eStoragedInherit
+{
+ public:
+ eStoraged(sdbusplus::bus::bus& bus, const char* path,
+ const std::string& devPath, const std::string& containerName) :
+ eStoragedInherit(bus, path),
+ devPath(devPath), containerName(containerName)
+ {}
+
+ /** @brief Format the LUKS encrypted device and create empty filesystem.
+ *
+ * @param[in] password - password to set for the LUKS device.
+ */
+ void format(std::vector<uint8_t> password) override;
+
+ /** @brief Erase the contents of the storage device.
+ *
+ * @param[in] password - password for the LUKS device.
+ * @param[in] eraseType - type of erase operation.
+ */
+ void erase(std::vector<uint8_t> password, EraseMethod eraseType) override;
+
+ /** @brief Unmount filesystem and lock the LUKS device.
+ *
+ * @param[in] password - password for the LUKS device.
+ */
+ void lock(std::vector<uint8_t> password) override;
+
+ /** @brief Unlock device and mount the filesystem.
+ *
+ * @param[in] password - password for the LUKS device.
+ */
+ void unlock(std::vector<uint8_t> password) override;
+
+ /** @brief Change the password for the LUKS device.
+ *
+ * @param[in] oldPassword - old password for the LUKS device.
+ * @param[in] newPassword - new password for the LUKS device.
+ */
+ void changePassword(std::vector<uint8_t> oldPassword,
+ std::vector<uint8_t> newPassword) override;
+
+ private:
+ /* Full path of the device file, e.g. /dev/mmcblk0 */
+ std::string devPath;
+
+ /* Name of the LUKS container. */
+ std::string containerName;
+};
+
+} // namespace estoraged