netipmid: Manage and expose session object
Session (RMCP+) is managed by net-ipmid directly, but
session commands has to be supported in both LAN & other
session-less interfaces. In order to make session commands
to work in other interfaces, session objects must be
exposed as D-Bus objects, so that ipmi-providers can
query the same.
Tested:
1. Verified that RMCP+ session are perfectly working
2. Verified RMCP+ session establishment fails for wrong
password
3. Verified that session privilege level are maintained
and access are restricted accordingly
4. Verified session timeout and sessions are destroyed
accordingly after timeout
5. verified max session count working behavior
6. verified ipmi-providers responding with proper response for this
(or D-Bus objects are exposed correctly during session creation,
session deletion,session update,
(like privilege, - say even set session privilege level command)
7.Session objects are created dynamically.
Change-Id: I78a8449359877ef6cc4cd8161d8c67e6e54eb52b
Signed-off-by: Suryakanth Sekar <suryakanth.sekar@linux.intel.com>
diff --git a/sessions_manager.hpp b/sessions_manager.hpp
index 9fd38b1..f9c00b5 100644
--- a/sessions_manager.hpp
+++ b/sessions_manager.hpp
@@ -2,6 +2,8 @@
#include "session.hpp"
+#include <ipmid/api.hpp>
+#include <ipmid/sessiondef.hpp>
#include <map>
#include <memory>
#include <mutex>
@@ -15,10 +17,6 @@
RC_SESSION_ID,
};
-constexpr size_t SESSION_ZERO = 0;
-constexpr size_t MAX_SESSIONLESS_COUNT = 1;
-constexpr size_t MAX_SESSION_COUNT = 15;
-
/**
* @class Manager
*
@@ -82,20 +80,35 @@
std::shared_ptr<Session>
getSession(SessionID sessionID,
RetrieveOption option = RetrieveOption::BMC_SESSION_ID);
+ uint8_t getActiveSessionCount() const;
+ uint8_t getSessionHandle(SessionID bmcSessionID) const;
+ uint8_t storeSessionHandle(SessionID bmcSessionID);
+ uint32_t getSessionIDbyHandle(uint8_t sessionHandle) const;
+
+ void managerInit(const std::string& channel);
+
+ uint8_t getNetworkInstance(void);
private:
+ //+1 for session, as 0 is reserved for sessionless command
+ std::array<uint32_t, session::maxSessionCountPerChannel + 1>
+ sessionHandleMap = {0};
+
/**
* @brief Session Manager keeps the session objects as a sorted
* associative container with Session ID as the unique key
*/
SessionMap sessionsMap;
-
+ std::unique_ptr<sdbusplus::server::manager::manager> objManager = nullptr;
+ std::string chName{}; // Channel Name
+ uint8_t ipmiNetworkInstance;
/**
* @brief Clean Session Stale Entries
*
* Removes the inactive sessions entries from the Session Map
*/
void cleanStaleEntries();
+ void setNetworkInstance(void);
};
} // namespace session