Refactor: Handler expands TID parameter

Adding tid as a parameter to each handler so that the handler
can know the message sent from which device

Tested:
- Unit Tests passed.

Change-Id: Ida37bf61146d2f59ea11ebc7bf009f7837ed496d
Signed-off-by: Delphine CC Chiu <Delphine_CC_Chiu@wiwynn.com>
diff --git a/pldmd/handler.hpp b/pldmd/handler.hpp
index cfa95eb..b742519 100644
--- a/pldmd/handler.hpp
+++ b/pldmd/handler.hpp
@@ -17,8 +17,8 @@
 
 using Response = std::vector<uint8_t>;
 class CmdHandler;
-using HandlerFunc =
-    std::function<Response(const pldm_msg* request, size_t reqMsgLen)>;
+using HandlerFunc = std::function<Response(
+    pldm_tid_t tid, const pldm_msg* request, size_t reqMsgLen)>;
 
 class CmdHandler
 {
@@ -27,15 +27,16 @@
 
     /** @brief Invoke a PLDM command handler
      *
+     *  @param[in] tid - PLDM request TID
      *  @param[in] pldmCommand - PLDM command code
      *  @param[in] request - PLDM request message
      *  @param[in] reqMsgLen - PLDM request message size
      *  @return PLDM response message
      */
-    Response handle(Command pldmCommand, const pldm_msg* request,
-                    size_t reqMsgLen)
+    Response handle(pldm_tid_t tid, Command pldmCommand,
+                    const pldm_msg* request, size_t reqMsgLen)
     {
-        return handlers.at(pldmCommand)(request, reqMsgLen);
+        return handlers.at(pldmCommand)(tid, request, reqMsgLen);
     }
 
     /** @brief Create a response message containing only cc
diff --git a/pldmd/invoker.hpp b/pldmd/invoker.hpp
index 9903e7f..ddfb99d 100644
--- a/pldmd/invoker.hpp
+++ b/pldmd/invoker.hpp
@@ -30,16 +30,18 @@
 
     /** @brief Invoke a PLDM command handler
      *
+     *  @param[in] tid - PLDM request TID
      *  @param[in] pldmType - PLDM type code
      *  @param[in] pldmCommand - PLDM command code
      *  @param[in] request - PLDM request message
      *  @param[in] reqMsgLen - PLDM request message size
      *  @return PLDM response message
      */
-    Response handle(Type pldmType, Command pldmCommand, const pldm_msg* request,
-                    size_t reqMsgLen)
+    Response handle(pldm_tid_t tid, Type pldmType, Command pldmCommand,
+                    const pldm_msg* request, size_t reqMsgLen)
     {
-        return handlers.at(pldmType)->handle(pldmCommand, request, reqMsgLen);
+        return handlers.at(pldmType)->handle(tid, pldmCommand, request,
+                                             reqMsgLen);
     }
 
   private:
diff --git a/pldmd/pldmd.cpp b/pldmd/pldmd.cpp
index a85157f..c1ba345 100644
--- a/pldmd/pldmd.cpp
+++ b/pldmd/pldmd.cpp
@@ -107,7 +107,7 @@
         {
             if (hdrFields.pldm_type != PLDM_FWUP)
             {
-                response = invoker.handle(hdrFields.pldm_type,
+                response = invoker.handle(tid, hdrFields.pldm_type,
                                           hdrFields.command, request,
                                           requestLen);
             }