VPD ECC support

Added methods/interfaces to create ECC and verify the data using ECC

Tested: tested some of the EEPROMS on Rainier simics
root@rainier:/tmp# ./ipz-read-vpd --file /sys/devices/platform/ahb/ahb:apb/ahb:apb:bus@1e78a000/1e78a480.i2c-bus/i2c-8/8-0050/8-00500/nvmem
PASSED
root@rainier:/tmp# ./ipz-read-vpd --file /sys/devices/platform/ahb/ahb:apb/ahb:apb:bus@1e78a000/1e78a400.i2c-bus/i2c-7/7-0050/7-00500/nvmem
PASSED
root@rainier:/tmp# ./ipz-read-vpd --file /sys/devices/platform/ahb/ahb:apb/ahb:apb:bus@1e78a000/1e78a480.i2c-bus/i2c-8/8-0051/8-00510/nvmem
PASSED
root@rainier:/tmp# ./ipz-read-vpd --file /sys/devices/platform/ahb/ahb:apb/ahb:apb:bus@1e78a000/1e78a400.i2c-bus/i2c-7/7-0051/7-00510/nvmem
PASSED
root@rainier:/tmp# ./ipz-read-vpd --file /sys/devices/platform/ahb/ahb:apb/ahb:apb:bus@1e78a000/1e78a080.i2c-bus/i2c-0/0-0051/0-00510/nvmem
PASSED

Signed-off-by: Alpana Kumari <alpankum@in.ibm.com>
Change-Id: I863327f504c2dfa468d5ceadce10250292a968b7
diff --git a/impl.hpp b/impl.hpp
index 525ae7a..8d3b59e 100644
--- a/impl.hpp
+++ b/impl.hpp
@@ -35,6 +35,22 @@
 
 } // namespace internal
 
+namespace
+{
+
+using RecordId = uint8_t;
+using RecordOffset = uint16_t;
+using RecordSize = uint16_t;
+using RecordType = uint16_t;
+using RecordLength = uint16_t;
+using KwSize = uint8_t;
+using PoundKwSize = uint16_t;
+using ECCOffset = uint16_t;
+using ECCLength = uint16_t;
+using LE2ByteData = uint16_t;
+
+} // namespace
+
 /** @class Impl
  *  @brief Implements parser for VPD
  *
@@ -129,6 +145,28 @@
     /** @brief Checks if the VHDR record is present in the VPD */
     void checkHeader() const;
 
+    /** @brief Checks the ECC for VHDR Record.
+     *  @returns Success(0) OR corrupted data(-1)
+     */
+    int vhdrEccCheck() const;
+
+    /** @brief Checks the ECC for VTOC Record.
+     *  @returns Success(0) OR corrupted data(-1)
+     */
+    int vtocEccCheck() const;
+
+    /** @brief Checks the ECC for the given record.
+     *
+     * @param[in] iterator - iterator pointing to a record in the VPD
+     * @returns Success(0) OR corrupted data(-1)
+     */
+    int recordEccCheck(Binary::const_iterator iterator) const;
+
+    /** @brief This interface collects Offset of VTOC
+     *  @returns VTOC Offset
+     */
+    RecordOffset getVtocOffset() const;
+
     /** @brief VPD in binary format */
     Binary vpd;