BMC RR: check whether the Host is running

This commit checks whether Host is up by sending a request to
Host when pldmd starts up. This does not differentiate the case
when there is a bmc RR or pldmd restarted.

Updates the Host condition accordingly.

Initiates a PDR exchange if Host is running.

Change-Id: I630b342f5f9cc62530e0274f46357d238e92d0c9
Signed-off-by: sampmisr <sampmisr@gmail.com>
diff --git a/host-bmc/host_pdr_handler.hpp b/host-bmc/host_pdr_handler.hpp
index 2e0d331..96c0226 100644
--- a/host-bmc/host_pdr_handler.hpp
+++ b/host-bmc/host_pdr_handler.hpp
@@ -144,13 +144,6 @@
     void parseStateSensorPDRs(const PDRList& stateSensorPDRs,
                               const TLPDRMap& tlpdrInfo);
 
-  private:
-    /** @brief deferred function to fetch PDR from Host, scheduled to work on
-     *  the event loop. The PDR exchg with the host is async.
-     *  @param[in] source - sdeventplus event source
-     */
-    void _fetchPDR(sdeventplus::source::EventBase& source);
-
     /** @brief this function sends a GetPDR request to Host firmware.
      *  And processes the PDRs based on type
      *
@@ -158,6 +151,21 @@
      */
     void getHostPDR(uint32_t nextRecordHandle = 0);
 
+    /** @brief set the Host state when pldmd starts
+     */
+    void setHostState();
+
+    /** @brief check whether Host is running when pldmd starts
+     */
+    bool isHostUp();
+
+  private:
+    /** @brief deferred function to fetch PDR from Host, scheduled to work on
+     *  the event loop. The PDR exchg with the host is async.
+     *  @param[in] source - sdeventplus event source
+     */
+    void _fetchPDR(sdeventplus::source::EventBase& source);
+
     /** @brief Merge host firmware's entity association PDRs into BMC's
      *  @details A merge operation involves adding a pldm_entity under the
      *  appropriate parent, and updating container ids.
@@ -239,6 +247,13 @@
      */
     HostStateSensorMap sensorMap;
     bool verbose;
+
+    /** @brief whether response received from Host */
+    bool responseReceived;
+    /** @brief whether timed out waiting for a response from Host */
+    bool timeOut;
+    /** @brief request message instance id */
+    uint8_t insId;
 };
 
 } // namespace pldm