Split DataInterface from pci_handler.hpp
In case we add more data interface in the future, we should be
separating out the DataInterface class from the pci_handler.hpp
Signed-off-by: Brandon Kim <brandonkim@google.com>
Change-Id: I220b293a3daf1f7aa0ef2daf07c2ef48026be8c0
diff --git a/include/data_interface.hpp b/include/data_interface.hpp
new file mode 100644
index 0000000..bf91817
--- /dev/null
+++ b/include/data_interface.hpp
@@ -0,0 +1,46 @@
+#pragma once
+
+#include <cstdint>
+#include <span>
+#include <vector>
+
+namespace bios_bmc_smm_error_logger
+{
+
+/**
+ * Each data transport mechanism must implement the DataInterface.
+ */
+class DataInterface
+{
+ public:
+ virtual ~DataInterface() = default;
+
+ /**
+ * Read bytes from shared buffer (blocking call).
+ *
+ * @param[in] offset - offset to read from
+ * @param[in] length - number of bytes to read
+ * @return the bytes read
+ */
+ virtual std::vector<uint8_t> read(const uint32_t offset,
+ const uint32_t length) = 0;
+
+ /**
+ * Write bytes to shared buffer.
+ *
+ * @param[in] offset - offset to write to
+ * @param[in] bytes - byte vector of data.
+ * @return return the byte length written
+ */
+ virtual uint32_t write(const uint32_t offset,
+ const std::span<const uint8_t> bytes) = 0;
+
+ /**
+ * Getter for Memory Region Size
+ *
+ * @return return Memory Region size allocated
+ */
+ virtual uint32_t getMemoryRegionSize() = 0;
+};
+
+} // namespace bios_bmc_smm_error_logger
diff --git a/include/pci_handler.hpp b/include/pci_handler.hpp
index 98a8cdc..ae7bfdc 100644
--- a/include/pci_handler.hpp
+++ b/include/pci_handler.hpp
@@ -1,5 +1,7 @@
#pragma once
+#include "data_interface.hpp"
+
#include <stdplus/fd/managed.hpp>
#include <stdplus/fd/mmap.hpp>
@@ -12,42 +14,6 @@
{
/**
- * Each data transport mechanism must implement the DataInterface.
- */
-class DataInterface
-{
- public:
- virtual ~DataInterface() = default;
-
- /**
- * Read bytes from shared buffer (blocking call).
- *
- * @param[in] offset - offset to read from
- * @param[in] length - number of bytes to read
- * @return the bytes read
- */
- virtual std::vector<uint8_t> read(const uint32_t offset,
- const uint32_t length) = 0;
-
- /**
- * Write bytes to shared buffer.
- *
- * @param[in] offset - offset to write to
- * @param[in] bytes - byte vector of data.
- * @return return the byte length written
- */
- virtual uint32_t write(const uint32_t offset,
- const std::span<const uint8_t> bytes) = 0;
-
- /**
- * Getter for Memory Region Size
- *
- * @return return Memory Region size allocated
- */
- virtual uint32_t getMemoryRegionSize() = 0;
-};
-
-/**
* Data handler for reading and writing data via the PCI bridge.
*
*/