ua_session_manager.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #ifndef UA_SESSION_MANAGER_H_
  2. #define UA_SESSION_MANAGER_H_
  3. #include "ua_server.h"
  4. #include "ua_util.h"
  5. #include "ua_session.h"
  6. typedef struct UA_SessionManager {
  7. LIST_HEAD(session_list, session_list_entry) sessions; // doubly-linked list of sessions
  8. UA_UInt32 maxSessionCount;
  9. UA_Int32 lastSessionId;
  10. UA_UInt32 currentSessionCount;
  11. UA_DateTime maxSessionLifeTime;
  12. UA_DateTime sessionTimeout;
  13. } UA_SessionManager;
  14. UA_StatusCode UA_SessionManager_init(UA_SessionManager *sessionManager, UA_UInt32 maxSessionCount,
  15. UA_UInt32 sessionLifetime, UA_UInt32 startSessionId);
  16. void UA_SessionManager_deleteMembers(UA_SessionManager *sessionManager);
  17. UA_StatusCode UA_SessionManager_createSession(UA_SessionManager *sessionManager,
  18. UA_SecureChannel *channel, UA_Session **session);
  19. UA_StatusCode UA_SessionManager_removeSession(UA_SessionManager *sessionManager,
  20. UA_NodeId *sessionId);
  21. /**
  22. * @brief finds the session which is identified by the sessionId
  23. * @param sessionId the session id is used to identify the unknown session
  24. * @param session the session object is returned if no error occurs
  25. * @return error code
  26. */
  27. UA_StatusCode UA_SessionManager_getSessionById(UA_SessionManager *sessionManager,
  28. UA_NodeId *sessionId, UA_Session **session);
  29. /**
  30. * @param token authentication token which is used to get the session object
  31. * @param session output, session object which is identified by the authentication token
  32. * @return error code
  33. */
  34. UA_StatusCode UA_SessionManager_getSessionByToken(UA_SessionManager *sessionManager,
  35. UA_NodeId *token, UA_Session **session);
  36. //UA_Int32 UA_SessionManager_updateSessions();
  37. //UA_Int32 UA_SessionManager_generateToken(UA_Session session, UA_Int32 requestedLifeTime, SecurityTokenRequestType requestType, UA_ChannelSecurityToken* newToken);
  38. #endif /* UA_SESSION_MANAGER_H_ */