ua_session.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #ifndef UA_SESSION_H_
  2. #define UA_SESSION_H_
  3. #include "queue.h"
  4. #include "ua_types.h"
  5. #include "ua_securechannel.h"
  6. #include "ua_server.h"
  7. #define MAXCONTINUATIONPOINTS 5
  8. struct ContinuationPointEntry {
  9. LIST_ENTRY(ContinuationPointEntry) pointers;
  10. UA_ByteString identifier;
  11. UA_BrowseDescription browseDescription;
  12. UA_UInt32 continuationIndex;
  13. UA_UInt32 maxReferences;
  14. };
  15. struct UA_Subscription;
  16. typedef struct UA_Subscription UA_Subscription;
  17. struct UA_Session {
  18. UA_ApplicationDescription clientDescription;
  19. UA_Boolean activated;
  20. UA_String sessionName;
  21. UA_NodeId authenticationToken;
  22. UA_NodeId sessionId;
  23. UA_UInt32 maxRequestMessageSize;
  24. UA_UInt32 maxResponseMessageSize;
  25. UA_Double timeout; // [ms]
  26. UA_DateTime validTill;
  27. UA_SecureChannel *channel;
  28. UA_UInt16 availableContinuationPoints;
  29. LIST_HEAD(ContinuationPointList, ContinuationPointEntry) continuationPoints;
  30. #ifdef UA_ENABLE_SUBSCRIPTIONS
  31. UA_UInt32 lastSubscriptionID;
  32. LIST_HEAD(UA_ListOfUASubscriptions, UA_Subscription) serverSubscriptions;
  33. #endif
  34. };
  35. /* Local access to the services (for startup and maintenance) uses this Session
  36. * with all possible access rights (Session ID: 1) */
  37. extern UA_Session adminSession;
  38. void UA_Session_init(UA_Session *session);
  39. void UA_Session_deleteMembersCleanup(UA_Session *session, UA_Server *server);
  40. /* If any activity on a session happens, the timeout is extended */
  41. void UA_Session_updateLifetime(UA_Session *session);
  42. #ifdef UA_ENABLE_SUBSCRIPTIONS
  43. void UA_Session_addSubscription(UA_Session *session, UA_Subscription *newSubscription);
  44. UA_Subscription *
  45. UA_Session_getSubscriptionByID(UA_Session *session, UA_UInt32 subscriptionID);
  46. UA_StatusCode
  47. UA_Session_deleteMonitoredItem(UA_Session *session, UA_UInt32 subscriptionID,
  48. UA_UInt32 monitoredItemID);
  49. UA_StatusCode
  50. UA_Session_deleteSubscription(UA_Server *server, UA_Session *session,
  51. UA_UInt32 subscriptionID);
  52. UA_UInt32
  53. UA_Session_getUniqueSubscriptionID(UA_Session *session);
  54. #endif
  55. #endif /* UA_SESSION_H_ */