Representation of an IPMI session

IPMI session class encapsulates the details regarding an IPMI session.
It includes the details of the remote session id, BMC session id
Cipher suites, session state information.

Change-Id: Iffae0e05f33d1b3aa32cc17e5a3c1368d53c1d38
Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
diff --git a/session.cpp b/session.cpp
new file mode 100644
index 0000000..b80f51a
--- /dev/null
+++ b/session.cpp
@@ -0,0 +1,33 @@
+#include "session.hpp"
+
+#include <ctime>
+
+#include "endian.hpp"
+
+namespace session
+{
+
+bool Session::isSessionActive()
+{
+    auto currentTime = std::chrono::steady_clock::now();
+    auto elapsedSeconds = std::chrono::duration_cast<std::chrono::seconds>
+                          (currentTime - lastTime);
+
+    switch (state)
+    {
+        case State::SETUP_IN_PROGRESS:
+            if (elapsedSeconds < SESSION_SETUP_TIMEOUT)
+            {
+                return true;
+            }
+        case State::ACTIVE:
+            if (elapsedSeconds < SESSION_INACTIVITY_TIMEOUT)
+            {
+                return true;
+            }
+        default:
+            return false;
+    }
+}
+
+} // namespace session