ua_session.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #ifndef UA_SESSION_H_
  2. #define UA_SESSION_H_
  3. #include "ua_types.h"
  4. #include "ua_securechannel.h"
  5. #include "queue.h"
  6. #ifdef ENABLESUBSCRIPTIONS
  7. #include "server/ua_subscription_manager.h"
  8. #endif
  9. /**
  10. * @ingroup communication
  11. *
  12. * @{
  13. */
  14. struct ContinuationPointEntry {
  15. LIST_ENTRY(ContinuationPointEntry) pointers;
  16. UA_ByteString identifier;
  17. UA_BrowseDescription browseDescription;
  18. UA_Int32 continuationIndex;
  19. UA_UInt32 maxReferences;
  20. };
  21. struct UA_Session {
  22. UA_ApplicationDescription clientDescription;
  23. UA_Boolean activated;
  24. UA_String sessionName;
  25. UA_NodeId authenticationToken;
  26. UA_NodeId sessionId;
  27. UA_UInt32 maxRequestMessageSize;
  28. UA_UInt32 maxResponseMessageSize;
  29. UA_Int64 timeout;
  30. UA_DateTime validTill;
  31. #ifdef ENABLESUBSCRIPTIONS
  32. UA_SubscriptionManager subscriptionManager;
  33. #endif
  34. UA_SecureChannel *channel;
  35. LIST_HEAD(ContinuationPointList, ContinuationPointEntry) continuationPoints;
  36. };
  37. extern UA_Session anonymousSession; ///< If anonymous access is allowed, this session is used internally (Session ID: 0)
  38. extern UA_Session adminSession; ///< Local access to the services (for startup and maintenance) uses this Session with all possible access rights (Session ID: 1)
  39. void UA_Session_init(UA_Session *session);
  40. void UA_Session_deleteMembers(UA_Session *session);
  41. /** If any activity on a session happens, the timeout must be extended */
  42. UA_StatusCode UA_Session_updateLifetime(UA_Session *session);
  43. /** Set up the point in time till the session is valid */
  44. UA_StatusCode UA_Session_setExpirationDate(UA_Session *session);
  45. /** Gets the sessions pending lifetime (calculated from the timeout which was set) */
  46. UA_StatusCode UA_Session_getPendingLifetime(UA_Session *session, UA_Double *pendingLifetime);
  47. void UA_Session_detachSecureChannel(UA_Session *session);
  48. /** @} */
  49. #endif /* UA_SESSION_H_ */