PEL: Save AdditionalData in a UserData section

Save the contents of the AdditionalData OpenBMC event log property as
JSON in a UserData PEL section.

For example, if the AdditionalData property, which is an array of
strings, looks like:
    ["KEY1=VALUE1", "KEY=VALUE2"]

Then the data stored as ASCII text in the UserData section is:
    {"KEY1":"VALUE1","KEY2":"VALUE2"}

If one of the keys is "ESEL", then that entry is removed from the
UserData output as that contains a full raw PEL from the host sent down
as ASCII text.

Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: Ia6ffabb39fdb4315ec2152744414e44f7d2ec4aa
diff --git a/extensions/openpower-pels/pel.hpp b/extensions/openpower-pels/pel.hpp
index bc857e2..f63cfdd 100644
--- a/extensions/openpower-pels/pel.hpp
+++ b/extensions/openpower-pels/pel.hpp
@@ -5,6 +5,7 @@
 #include "private_header.hpp"
 #include "registry.hpp"
 #include "src.hpp"
+#include "user_data.hpp"
 #include "user_header.hpp"
 
 #include <memory>
@@ -249,5 +250,20 @@
     std::vector<std::unique_ptr<Section>> _optionalSections;
 };
 
+namespace util
+{
+
+/**
+ * @brief Create a UserData section containing the AdditionalData
+ *        contents as a JSON string.
+ *
+ * @param[in] ad - The AdditionalData contents
+ *
+ * @return std::unique_ptr<UserData> - The section
+ */
+std::unique_ptr<UserData> makeADUserDataSection(const AdditionalData& ad);
+
+} // namespace util
+
 } // namespace pels
 } // namespace openpower