firmware: add a session lookup map

Add a session lookup map for use in session-based commands to retrieve
the session structure, which holds pointers to the handlers for copying
from and writing to.

Add two persistent Session objects to the firmware handler, since we
only will ever have two sessions at a time.  An active image and an
active hash.

Change-Id: Ib0029f693266fa3df961275bae5c61b205cfa42d
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/firmware_handler.hpp b/firmware_handler.hpp
index fc66847..0c3092b 100644
--- a/firmware_handler.hpp
+++ b/firmware_handler.hpp
@@ -5,6 +5,7 @@
 
 #include <blobs-ipmid/blobs.hpp>
 #include <cstdint>
+#include <map>
 #include <memory>
 #include <string>
 #include <vector>
@@ -62,7 +63,8 @@
                         const std::vector<DataHandlerPack>& transports,
                         std::uint16_t bitmask) :
         handlers(firmwares),
-        blobIDs(blobs), transports(transports), bitmask(bitmask)
+        blobIDs(blobs), transports(transports), bitmask(bitmask), activeImage(),
+        activeHash(), lookup()
     {
     }
     ~FirmwareBlobHandler() = default;
@@ -105,6 +107,15 @@
     /** The bits set indicate what transport mechanisms are supported. */
     std::uint16_t bitmask;
 
+    /** Active image session. */
+    Session activeImage;
+
+    /** Active hash session. */
+    Session activeHash;
+
+    /** A quick method for looking up a session's mechanisms and details. */
+    std::map<std::uint16_t, Session*> lookup;
+
     /** Temporary variable to track whether a blob is open. */
     bool fileOpen = false;
 };