buffer: Implement "readEntryHeader"

Add struct QueueEntryHeader along with it.

Tested: Unit Tested

Signed-off-by: Brandon Kim <brandonkim@google.com>
Change-Id: Icbfe8d39db4242664794d8c65a84488aeffd23a6
diff --git a/src/buffer.cpp b/src/buffer.cpp
index 0b6f460..87d9fa2 100644
--- a/src/buffer.cpp
+++ b/src/buffer.cpp
@@ -160,4 +160,14 @@
     return bytesRead;
 }
 
+struct QueueEntryHeader BufferImpl::readEntryHeader(size_t offset)
+{
+    size_t headerSize = sizeof(struct QueueEntryHeader);
+    // wraparonudRead will throw if it did not read all the bytes, let it
+    // propagate up the stack
+    std::vector<uint8_t> bytesRead = wraparoundRead(offset, headerSize);
+
+    return *reinterpret_cast<struct QueueEntryHeader*>(bytesRead.data());
+}
+
 } // namespace bios_bmc_smm_error_logger