netipmid: make session a header-only situation
The Session class is a fairly simple class, no need for an external cpp
file; make it all header-only and allow the compiler to do its job.
Change-Id: Ibbe7e963762926ec04c75ab187a5b8045de851f4
Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
diff --git a/session.hpp b/session.hpp
index 338a815..4ba3fa6 100644
--- a/session.hpp
+++ b/session.hpp
@@ -231,7 +231,31 @@
* transaction time is compared against the session inactivity timeout.
*
*/
- bool isSessionActive();
+ bool 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;
+ }
+ break;
+ case State::ACTIVE:
+ if (elapsedSeconds < SESSION_INACTIVITY_TIMEOUT)
+ {
+ return true;
+ }
+ break;
+ default:
+ return false;
+ }
+ return false;
+ }
/**
* @brief Session's Current Privilege Level