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/Makefile.am b/Makefile.am
index d1a6ec7..5ed3eec 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -9,7 +9,6 @@
auth_algo.hpp \
auth_algo.cpp \
session.hpp \
- session.cpp \
sessions_manager.hpp \
sessions_manager.cpp \
message_parsers.hpp \
diff --git a/session.cpp b/session.cpp
deleted file mode 100644
index 9668ef2..0000000
--- a/session.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-#include "session.hpp"
-
-#include "endian.hpp"
-
-#include <ctime>
-
-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;
- }
- break;
- case State::ACTIVE:
- if (elapsedSeconds < SESSION_INACTIVITY_TIMEOUT)
- {
- return true;
- }
- break;
- default:
- return false;
- }
-
- return false;
-}
-
-} // namespace session
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