parser : parse keyword data section

For keywords contained in an OpenPOWER VPD record, read the keyword
data. The data may be raw or encoded in ascii. Return the
resultant data as a string.

Some keywords, such as B1 (MAC address) need to be decoded specially.

Change-Id: I64c16c60dc94e173586b20fb6a92809fbb0ac89e
Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
diff --git a/impl.hpp b/impl.hpp
index 846d34a..42a5c44 100644
--- a/impl.hpp
+++ b/impl.hpp
@@ -9,10 +9,24 @@
 {
 namespace parser
 {
+namespace keyword
+{
+
+/** @brief Encoding scheme of a VPD keyword's data */
+enum class Encoding
+{
+    ASCII, /**< data encoded in ascii */
+    RAW,   /**< raw data */
+    // Keywords needing custom decoding
+    B1     /**< The keyword B1 needs to be decoded specially */
+};
+
+} // namespace keyword
 
 namespace internal
 {
 
+using KeywordInfo = std::tuple<record::Keyword, keyword::Encoding>;
 using OffsetList = std::vector<uint32_t>;
 
 }
@@ -86,6 +100,18 @@
          */
         void processRecord(std::size_t recordOffset);
 
+        /** @brief Read keyword data
+         *
+         *  @param[in] keyword - OpenPOWER VPD keyword
+         *  @param[in] dataLength - Length of data to be read
+         *  @param[in] iterator - iterator pointing to a Keyword's data in
+         *      the VPD
+         *
+         *  @returns keyword data as a string
+         */
+        std::string readKwData(const internal::KeywordInfo& keyword,
+                               std::size_t dataLength,
+                               Binary::const_iterator iterator);
 
         /** @brief Checks if the VHDR record is present in the VPD */
         void checkHeader() const;