RMCP+ login support with privilege
Implementation of RMCP login support with appropriate
privilege level.
Unit Test:
1. Verified that user is able to login without any issues
2. Privilege of the user is minimum of requested, user & channel
3. Unable to set higher privilege using Set session commands
Change-Id: I5e9ef21dfc1f1b50aa815562a3a65d90c434877c
Signed-off-by: Richard Marian Thomaiyar <richard.marian.thomaiyar@linux.intel.com>
diff --git a/session.hpp b/session.hpp
index f3dc2ae..bf136e3 100644
--- a/session.hpp
+++ b/session.hpp
@@ -43,6 +43,10 @@
// Seconds of inactivity allowed when session is active
constexpr auto SESSION_INACTIVITY_TIMEOUT = 60s;
+// Mask to get only the privilege from requested maximum privlege (RAKP message
+// 1)
+constexpr uint8_t reqMaxPrivMask = 0xF;
+
/**
* @struct SequenceNumbers Session Sequence Numbers
*
@@ -261,12 +265,12 @@
/**
* @brief Session's Current Privilege Level
*/
- Privilege curPrivLevel;
+ Privilege curPrivLevel = Privilege::CALLBACK;
/**
- * @brief Session's Maximum Privilege Level
+ * @brief Session's Requested Maximum Privilege Level
*/
- Privilege maxPrivLevel = Privilege::CALLBACK;
+ uint8_t reqMaxPrivLevel;
SequenceNumbers sequenceNums; // Session Sequence Numbers
State state = State::INACTIVE; // Session State
@@ -274,6 +278,7 @@
/** @brief Socket channel for communicating with the remote client.*/
std::shared_ptr<udpsocket::Channel> channelPtr;
+ uint8_t chNum;
private:
SessionID bmcSessionID = 0; // BMC Session ID