IVGCVSW-4595 Add IFileOnlyPacketHandlers to file only profiling connection

Change-Id: Ib49a8cbbf323da4109cdab9750e6c4d276e484b7
Signed-off-by: Jim Flynn <jim.flynn@arm.com>
diff --git a/src/profiling/ProfilingUtils.cpp b/src/profiling/ProfilingUtils.cpp
index fc70856..6d2565c 100644
--- a/src/profiling/ProfilingUtils.cpp
+++ b/src/profiling/ProfilingUtils.cpp
@@ -5,6 +5,8 @@
 
 #include "ProfilingUtils.hpp"
 
+#include "common/include/ProfilingException.hpp"
+
 #include <armnn/Version.hpp>
 
 #include <WallClockTimer.hpp>
@@ -1052,6 +1054,33 @@
     return static_cast<uint64_t>(timestamp.count());
 }
 
+Packet ReceivePacket(const unsigned char* buffer, uint32_t length)
+{
+    if (buffer == nullptr)
+    {
+        throw armnnProfiling::ProfilingException("data buffer is nullptr");
+    }
+    if (length < 8)
+    {
+        throw armnnProfiling::ProfilingException("length of data buffer is less than 8");
+    }
+
+    uint32_t metadataIdentifier = 0;
+    std::memcpy(&metadataIdentifier, buffer, sizeof(metadataIdentifier));
+
+    uint32_t dataLength = 0;
+    std::memcpy(&dataLength, buffer + 4u, sizeof(dataLength));
+
+    std::unique_ptr<unsigned char[]> packetData;
+    if (dataLength > 0)
+    {
+        packetData = std::make_unique<unsigned char[]>(dataLength);
+        std::memcpy(packetData.get(), buffer + 8u, dataLength);
+    }
+
+    return Packet(metadataIdentifier, dataLength, packetData);
+}
+
 } // namespace profiling
 
 } // namespace armnn