message: pack: add variant support

Add variant support to allow return of mutliple specific
types. Also change types to const as this is required by
the visitor and these could have been const all along.

Tested: Added unit test and used in oem provider

Change-Id: I5cb056c15d4813b9eee58eecb707664477d019d9
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/test/message/pack.cpp b/test/message/pack.cpp
index 60459ed..b3957cc 100644
--- a/test/message/pack.cpp
+++ b/test/message/pack.cpp
@@ -265,6 +265,21 @@
     ASSERT_EQ(p.raw, k);
 }
 
+TEST(PackAdvanced, VariantArray)
+{
+    ipmi::message::Payload p;
+    std::variant<std::array<uint8_t, 2>, uint32_t> variant;
+    auto data = std::array<uint8_t, 2>{2, 4};
+    variant = data;
+
+    p.pack(variant);
+    ASSERT_EQ(p.size(), sizeof(data));
+
+    // check that the bytes were correctly packed packed (LSB first)
+    std::vector<uint8_t> k = {2, 4};
+    ASSERT_EQ(p.raw, k);
+}
+
 TEST(PackAdvanced, BoolsnBitfieldsnFixedIntsOhMy)
 {
     // each element will be added, filling the low-order bits first