libpldmresponder: Implement SetBIOSTable

Register the setBIOSTable method and set separately string table,
attribute table, and attribute value table.
When the attribute value table is set, the corresponding D-Bus
property value needs to updated.

Tested:
test with JSON:
https://gist.github.com/lxwinspur/2afffff2e445fddf90dfed6eceef4014

~# pldmtool raw -d 0x80 0x03 0x02 0x00 0x00 0x00 0x00 0x05 0x00 0x00 0x00 0x03 0x00 0x4c 0x65 0x64 0x01 0x00 0x03 0x00 0x4f 0x66 0x66 0x02 0x00 0x02 0x00 0x4f 0x6e 0x23 0x4d 0x50 0x09
Request Message:
08 01 80 03 02 00 00 00 00 05 00 00 00 03 00 4c 65 64 01 00 03 00 4f 66 66 02 00 02 00 4f 6e 23 4d 50 09
Response Message:
08 01 00 03 02 00 00 00 00 00

~# pldmtool raw -d 0x80 0x03 0x02 0x00 0x00 0x00 0x00 0x05 0x01 0x00 0x00 0x00 0x00 0x00 0x02 0x02 0x00 0x01 0x00 0x01 0x01 0xff 0x10 0x22 0x77
Request Message:
08 01 80 03 02 00 00 00 00 05 01 00 00 00 00 00 02 02 00 01 00 01 01 ff 10 22 77
Response Message:
08 01 00 03 02 00 00 00 00 00

~# pldmtool raw -d 0x80 0x03 0x02 0x00 0x00 0x00 0x00 0x05 0x02 0x00 0x00 0x00 0x01 0x01 0x00 0x00 0x00 0xbc 0x91 0xfe 0xe0
Request Message:
08 01 80 03 02 00 00 00 00 05 02 00 00 00 01 01 00 00 00 bc 91 fe e0
Response Message:
08 01 00 03 02 00 00 00 00 00

~# pldmtool bios GetBIOSTable -t 0
PLDM StringTable:
BIOSStringHandle : BIOSString
0 : Led
1 : Off
2 : On

~# pldmtool bios GetBIOSTable -t 1
PLDM AttributeTable:
AttributeHandle: 0, AttributeNameHandle: 0(Led)
	AttributeType: BIOSEnumeration
	NumberOfPossibleValues: 2
		PossibleValueStringHandle[0] = 2(On)
		PossibleValueStringHandle[1] = 1(Off)
	NumberOfDefaultValues: 1
		DefaultValueStringHandleIndex[0] = 1, StringHandle = 1(Off)

~# pldmtool bios GetBIOSTable -t 2
PLDM AttributeValueTable:
AttributeHandle: 0
	AttributeType: BIOSEnumeration
	NumberOfCurrentValues: 1
	CurrentValueStringHandleIndex[0] = 1, StringHandle = Off

Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: I0ff88961afdfe0835c9fd0b56e37f7ed75f2fb45
diff --git a/libpldmresponder/bios_config.hpp b/libpldmresponder/bios_config.hpp
index 430798f..8782640 100644
--- a/libpldmresponder/bios_config.hpp
+++ b/libpldmresponder/bios_config.hpp
@@ -22,6 +22,32 @@
 namespace bios
 {
 
+enum class BoundType
+{
+    LowerBound,
+    UpperBound,
+    ScalarIncrement,
+    MinStringLength,
+    MaxStringLength,
+    OneOf
+};
+
+using AttributeName = std::string;
+using AttributeType = std::string;
+using ReadonlyStatus = bool;
+using DisplayName = std::string;
+using Description = std::string;
+using MenuPath = std::string;
+using CurrentValue = std::variant<int64_t, std::string>;
+using DefaultValue = std::variant<int64_t, std::string>;
+using OptionString = std::string;
+using OptionValue = std::variant<int64_t, std::string>;
+using Option = std::vector<std::tuple<OptionString, OptionValue>>;
+using BIOSTableObj =
+    std::tuple<AttributeType, ReadonlyStatus, DisplayName, Description,
+               MenuPath, CurrentValue, DefaultValue, Option>;
+using BaseBIOSTable = std::map<AttributeName, BIOSTableObj>;
+
 /** @class BIOSConfig
  *  @brief Manager BIOS Attributes
  */
@@ -62,10 +88,21 @@
      */
     std::optional<Table> getBIOSTable(pldm_bios_table_types tableType);
 
+    /** @brief set BIOS table
+     *  @param[in] tableType - Indicates what table is being transferred
+     *             {BIOSStringTable=0x0, BIOSAttributeTable=0x1,
+     *              BIOSAttributeValueTable=0x2}
+     *  @param[in] table - table data
+     *  @return pldm_completion_codes
+     */
+    int setBIOSTable(uint8_t tableType, const Table& table);
+
   private:
     const fs::path jsonDir;
     const fs::path tableDir;
     DBusHandler* const dbusHandler;
+    bool isUpdateProperty;
+    BaseBIOSTable baseBIOSTableMaps;
 
     // vector persists all attributes
     using BIOSAttributes = std::vector<std::unique_ptr<BIOSAttribute>>;
@@ -167,6 +204,22 @@
     int checkAttrValueToUpdate(
         const pldm_bios_attr_val_table_entry* attrValueEntry,
         const pldm_bios_attr_table_entry* attrEntry, Table& stringTable);
+
+    /** @brief Check the attribute table
+     *  @param[in] table - The table
+     *  @return pldm_completion_codes
+     */
+    int checkAttributeTable(const Table& table);
+
+    /** @brief Check the attribute value table
+     *  @param[in] table - The table
+     *  @return pldm_completion_codes
+     */
+    int checkAttributeValueTable(const Table& table);
+
+    /** @brief Update the BaseBIOSTable property of the D-Bus interface
+     */
+    void updateBaseBIOSTableProperty();
 };
 
 } // namespace bios