PEL: Pass FFDC files into PEL

In the case where an OpenBMC event log was created with the
'createWithFFDCFiles' D-Bus method, there needs to be UserData PEL
sections created with the contents of these files.

This commit passes these files into the PEL constructor, which then does
the creating.  If any of this would cause the PEL size to go over 16KB,
then that section will be trimmed so it fits in the 16KB, and no more
additional sections will be added.

The function that actually reads the FFDC file and creates the UserData
section is stubbed out and will be implemented in a future commit.

Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: Id27802c91326381a4b80fbe78ab62471cefe0286
diff --git a/extensions/openpower-pels/pel.hpp b/extensions/openpower-pels/pel.hpp
index 0475c1c..abcb673 100644
--- a/extensions/openpower-pels/pel.hpp
+++ b/extensions/openpower-pels/pel.hpp
@@ -6,6 +6,7 @@
 #include "registry.hpp"
 #include "src.hpp"
 #include "user_data.hpp"
+#include "user_data_formats.hpp"
 #include "user_header.hpp"
 
 #include <memory>
@@ -16,6 +17,19 @@
 namespace pels
 {
 
+/**
+ * @brief Contains information about an FFDC file.
+ */
+struct PelFFDCfile
+{
+    UserDataFormat format;
+    uint8_t subType;
+    uint8_t version;
+    int fd;
+};
+
+using PelFFDC = std::vector<PelFFDCfile>;
+
 /** @class PEL
  *
  * @brief This class represents a specific event log format referred to as a
@@ -87,11 +101,12 @@
      * @param[in] timestamp - Timestamp from the event log
      * @param[in] severity - Severity from the event log
      * @param[in] additionalData - The AdditionalData contents
+     * @param[in] ffdcFiles - FFCD files that go into UserData sections
      * @param[in] dataIface - The data interface object
      */
     PEL(const openpower::pels::message::Entry& entry, uint32_t obmcLogID,
         uint64_t timestamp, phosphor::logging::Entry::Level severity,
-        const AdditionalData& additionalData,
+        const AdditionalData& additionalData, const PelFFDC& ffdcFiles,
         const DataInterfaceBase& dataIface);
 
     /**
@@ -359,6 +374,16 @@
 std::unique_ptr<UserData>
     makeSysInfoUserDataSection(const AdditionalData& ad,
                                const DataInterfaceBase& dataIface);
+
+/**
+ * @brief Create a UserData section that contains the data in the file
+ *        pointed to by the file descriptor passed in.
+ *
+ * @param[in] componentID - The component ID of the PEL creator
+ * @param[in] file - The FFDC file information
+ */
+std::unique_ptr<UserData> makeFFDCuserDataSection(uint16_t componentID,
+                                                  const PelFFDCfile& file);
 } // namespace util
 
 } // namespace pels