buffer: Implement "readEntry"
readEntry reads the entryHeader to figure out how much of the buffer to
read for the entry.
Tested: Unit tested
Signed-off-by: Brandon Kim <brandonkim@google.com>
Change-Id: I390e77c088439c74d100ef4b4cb35e746facd495
diff --git a/include/buffer.hpp b/include/buffer.hpp
index d199a94..240845c 100644
--- a/include/buffer.hpp
+++ b/include/buffer.hpp
@@ -17,6 +17,10 @@
using boost::endian::little_uint32_t;
using boost::endian::little_uint64_t;
+// EntryPair.first = QueueEntryHeader
+// EntryPair.second = Error entry in vector of bytes
+using EntryPair = std::pair<struct QueueEntryHeader, std::vector<uint8_t>>;
+
struct CircularBufferHeader
{
little_uint32_t bmcInterfaceVersion; // Offset 0x0
@@ -124,6 +128,14 @@
* @return the entry header
*/
virtual struct QueueEntryHeader readEntryHeader(size_t offset) = 0;
+
+ /**
+ * Read the queue entry from the error log queue
+ *
+ * @param[in] offset - offset to read from
+ * @return entry header and entry pair read from buffer
+ */
+ virtual EntryPair readEntry(size_t offset) = 0;
};
/**
@@ -146,6 +158,7 @@
wraparoundRead(const uint32_t offset, const uint32_t length,
const uint32_t additionalBoundaryCheck = 0) override;
struct QueueEntryHeader readEntryHeader(size_t offset) override;
+ EntryPair readEntry(size_t offset) override;
private:
/** @brief The Error log queue starts after the UE region, which is where