Cache system GUID in netipmid

GUID is used in the IPMI session setup steps RAKP12 and RAKP34.
The GUID is read from the DBUS property. It is observed that
when the host is booting, reading the GUID takes a significant
delay and the session setup fails with ipmitool. Since GUID doesn't
change for a machine, it is safe to cache GUID in the netipmid and
speed up the session setup.

Resolves openbmc/openbmc#1812
Resolves openbmc/openbmc#2245
Resolves openbmc/openbmc#2246

Change-Id: I78c993b3e5ef8b6764457c8fdb3ecb985b965c0c
Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
diff --git a/command/guid.hpp b/command/guid.hpp
index 622b330..5941ef8 100644
--- a/command/guid.hpp
+++ b/command/guid.hpp
@@ -2,7 +2,7 @@
 
 #include <cstddef>
 #include <vector>
-
+#include <sdbusplus/bus/match.hpp>
 #include "comm_module.hpp"
 
 namespace command
@@ -10,12 +10,26 @@
 
 constexpr size_t BMC_GUID_LEN = 16;
 
+using Guid = std::array<uint8_t, BMC_GUID_LEN>;
+
 /**
  * @brief Get System GUID
  *
  * @return If UUID is successfully read from the Chassis DBUS object, then the
  *         GUID is returned, else a canned GUID is returned
  */
-std::array<uint8_t, BMC_GUID_LEN> getSystemGUID();
+Guid getSystemGUID();
+
+/**
+ *  @brief Register the callback to update the cache when the GUID changes
+ */
+void registerGUIDChangeCallback();
 
 } // namespace command
+
+namespace cache
+{
+
+extern command::Guid guid;
+
+} //namespace cache