ua_session_manager.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /* This Source Code Form is subject to the terms of the Mozilla Public
  2. * License, v. 2.0. If a copy of the MPL was not distributed with this
  3. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  4. #ifndef UA_SESSION_MANAGER_H_
  5. #define UA_SESSION_MANAGER_H_
  6. #ifdef __cplusplus
  7. extern "C" {
  8. #endif
  9. #include "queue.h"
  10. #include "ua_server.h"
  11. #include "ua_util.h"
  12. #include "ua_session.h"
  13. typedef struct session_list_entry {
  14. LIST_ENTRY(session_list_entry) pointers;
  15. UA_Session session;
  16. } session_list_entry;
  17. typedef struct UA_SessionManager {
  18. LIST_HEAD(session_list, session_list_entry) sessions; // doubly-linked list of sessions
  19. UA_UInt32 currentSessionCount;
  20. UA_Server *server;
  21. } UA_SessionManager;
  22. UA_StatusCode
  23. UA_SessionManager_init(UA_SessionManager *sm, UA_Server *server);
  24. /* Deletes all sessions */
  25. void UA_SessionManager_deleteMembers(UA_SessionManager *sm);
  26. /* Deletes all sessions that have timed out. Deletion is implemented via a
  27. * delayed callback. So all currently scheduled jobs with a pointer to the
  28. * session can complete. */
  29. void UA_SessionManager_cleanupTimedOut(UA_SessionManager *sm,
  30. UA_DateTime nowMonotonic);
  31. UA_StatusCode
  32. UA_SessionManager_createSession(UA_SessionManager *sm, UA_SecureChannel *channel,
  33. const UA_CreateSessionRequest *request, UA_Session **session);
  34. UA_StatusCode
  35. UA_SessionManager_removeSession(UA_SessionManager *sm, const UA_NodeId *token);
  36. UA_Session *
  37. UA_SessionManager_getSession(UA_SessionManager *sm, const UA_NodeId *token);
  38. #ifdef __cplusplus
  39. } // extern "C"
  40. #endif
  41. #endif /* UA_SESSION_MANAGER_H_ */