From 638d0666d37f94ed91cf5cf20e7adddce3d47015 Mon Sep 17 00:00:00 2001 From: Tom Joseph Date: Tue, 10 Jan 2017 16:02:07 +0530 Subject: Session data modified to handle integrity algo Change-Id: I3ebc8f2e1599b01e3cfb89c2ab17651d549a7ca1 Signed-off-by: Tom Joseph --- session.hpp | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'session.hpp') diff --git a/session.hpp b/session.hpp index 390d305..29e3340 100644 --- a/session.hpp +++ b/session.hpp @@ -8,6 +8,7 @@ #include #include "auth_algo.hpp" +#include "integrity_algo.hpp" #include "endian.hpp" #include "socket_channel.hpp" @@ -142,6 +143,35 @@ class Session authAlgoInterface = std::move(inAuthAlgo); } + /* + * @brief Get Session's Integrity Algorithm + * + * @return pointer to the integrity algorithm + */ + auto getIntegrityAlgo() const + { + if(integrityAlgoInterface) + { + return integrityAlgoInterface.get(); + } + else + { + throw std::runtime_error("Integrity Algorithm Empty"); + } + } + + /* + * @brief Set Session's Integrity Algorithm + * + * @param[in] integrityAlgo - unique pointer to integrity algorithm + * instance + */ + void setIntegrityAlgo( + std::unique_ptr&& integrityAlgo) + { + integrityAlgoInterface = std::move(integrityAlgo); + } + void updateLastTransactionTime() { lastTime = std::chrono::steady_clock::now(); @@ -178,6 +208,10 @@ class Session // Authentication Algorithm Interface for the Session std::unique_ptr authAlgoInterface; + // Integrity Algorithm Interface for the Session + std::unique_ptr integrityAlgoInterface = + nullptr; + // Last Transaction Time decltype(std::chrono::steady_clock::now()) lastTime; }; -- cgit v1.2.1