BIOS: Implement attribute table with type string

Construct attribute table with type string based on string table.

Tested:
Following are the tables constructed from the sample json file present at
"test/bios_jsons/

$ hexdump -C stringTable
00000000  00 00 07 00 41 6c 6c 6f  77 65 64 01 00 10 00 43  |....Allowed....C|
00000010  6f 64 65 55 70 64 61 74  65 50 6f 6c 69 63 79 02  |odeUpdatePolicy.|
00000020  00 0a 00 43 6f 6e 63 75  72 72 65 6e 74 03 00 0a  |...Concurrent...|
00000030  00 44 69 73 72 75 70 74  69 76 65 04 00 0a 00 46  |.Disruptive....F|
00000040  57 42 6f 6f 74 53 69 64  65 05 00 0f 00 48 4d 43  |WBootSide....HMC|
00000050  4d 61 6e 61 67 65 64 53  74 61 74 65 06 00 10 00  |ManagedState....|
00000060  49 6e 62 61 6e 64 43 6f  64 65 55 70 64 61 74 65  |InbandCodeUpdate|
00000070  07 00 0a 00 4e 6f 74 41  6c 6c 6f 77 65 64 08 00  |....NotAllowed..|
00000080  03 00 4f 66 66 09 00 02  00 4f 6e 0a 00 04 00 50  |..Off....On....P|
00000090  65 72 6d 0b 00 04 00 54  65 6d 70 0c 00 0c 00 73  |erm....Temp....s|
000000a0  74 72 5f 65 78 61 6d 70  6c 65 31 0d 00 0c 00 73  |tr_example1....s|
000000b0  74 72 5f 65 78 61 6d 70  6c 65 32 0e 00 0c 00 73  |tr_example2....s|
000000c0  74 72 5f 65 78 61 6d 70  6c 65 33 00 6c 11 89 d4  |tr_example3.l...|

$ hexdump -C attributeTable
00000000  00 00 00 01 00 02 02 00  03 00 01 00 01 00 00 04  |................|
00000010  00 02 0a 00 0b 00 01 00  02 00 00 05 00 02 08 00  |................|
00000020  09 00 01 01 03 00 00 06  00 02 00 00 07 00 01 00  |................|
00000030  04 00 01 0c 00 01 01 00  64 00 03 00 61 62 63 05  |........d...abc.|
00000040  00 01 0d 00 02 00 00 64  00 00 00 06 00 01 0e 00  |.......d........|
00000050  00 01 00 64 00 02 00 65  66 00 00 00 72 ef 0c 2a  |...d...ef...r..*|

Change-Id: I272c59b96b5aa14571d01eeeaccd504ca7ac168b
Signed-off-by: Carol Wang <wangkair@cn.ibm.com>
diff --git a/libpldmresponder/bios_parser.hpp b/libpldmresponder/bios_parser.hpp
index 1f13f94..2edbc95 100644
--- a/libpldmresponder/bios_parser.hpp
+++ b/libpldmresponder/bios_parser.hpp
@@ -89,4 +89,50 @@
 
 } // namespace bios_enum
 
+namespace bios_string
+{
+
+/** @brief Parse the JSON file specific to BIOSString and
+ *         BIOSStringReadOnly types and populate the data structure for
+ *         the corresponding possible values and the default value. Setup the
+ *         data structure to lookup the current value of the BIOS string
+ *         attribute. JSON is parsed once and the information is cached.
+ *
+ *  @param[in] dirPath - directory path where all the BIOS configuration JSON
+ *                      exist
+ *
+ *  @return 0 for success and negative return code for failure
+ */
+int setupValueLookup(const char* dirPath);
+
+using AttrName = std::string;
+using IsReadOnly = bool;
+using StrType = uint8_t;
+using MinStrLen = uint16_t;
+using MaxStrLen = uint16_t;
+using DefaultStrLen = uint16_t;
+using DefaultStr = std::string;
+using AttrValuesMap =
+    std::map<AttrName, std::tuple<IsReadOnly, StrType, MinStrLen, MaxStrLen,
+                                  DefaultStrLen, DefaultStr>>;
+/* attrTableSize is the sum of fixed length of members which construct a string
+ * attribute table, including attr_handle(uint16_t), attr_type(uint8_t),
+ * string_handle(uint16_t), strType(uint8_t), minStrLen(uint16_t),
+ * MaxStrLen(uint16_t), DefaultStrLen(uint16_t) */
+constexpr auto attrTableSize = 12;
+static_assert(attrTableSize == sizeof(uint16_t) + sizeof(uint8_t) +
+                                   sizeof(uint16_t) + sizeof(uint8_t) +
+                                   sizeof(uint16_t) + sizeof(uint16_t) +
+                                   sizeof(uint16_t));
+
+/** @brief Get the string related values and the default values for the
+ *         BIOSString and BIOSStringReadOnly types
+ *
+ *  @return information needed to build the BIOS attribute table specific to
+ *         BIOSString and BIOSStringReadOnly types
+ */
+const AttrValuesMap& getValues();
+
+} // namespace bios_string
+
 } // namespace bios_parser