ua_session.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. typedef struct UA_PublishResponseEntry {
  18. SIMPLEQ_ENTRY(UA_PublishResponseEntry) listEntry;
  19. UA_UInt32 requestId;
  20. UA_PublishResponse response;
  21. } UA_PublishResponseEntry;
  22. struct UA_Session {
  23. UA_ApplicationDescription clientDescription;
  24. UA_Boolean activated;
  25. UA_String sessionName;
  26. UA_NodeId authenticationToken;
  27. UA_NodeId sessionId;
  28. UA_UInt32 maxRequestMessageSize;
  29. UA_UInt32 maxResponseMessageSize;
  30. UA_Double timeout; // [ms]
  31. UA_DateTime validTill;
  32. UA_SecureChannel *channel;
  33. UA_UInt16 availableContinuationPoints;
  34. LIST_HEAD(ContinuationPointList, ContinuationPointEntry) continuationPoints;
  35. #ifdef UA_ENABLE_SUBSCRIPTIONS
  36. UA_UInt32 lastSubscriptionID;
  37. LIST_HEAD(UA_ListOfUASubscriptions, UA_Subscription) serverSubscriptions;
  38. SIMPLEQ_HEAD(UA_ListOfQueuedPublishResponses, UA_PublishResponseEntry) responseQueue;
  39. #endif
  40. };
  41. /* Local access to the services (for startup and maintenance) uses this Session
  42. * with all possible access rights (Session ID: 1) */
  43. extern UA_Session adminSession;
  44. void UA_Session_init(UA_Session *session);
  45. void UA_Session_deleteMembersCleanup(UA_Session *session, UA_Server *server);
  46. /* If any activity on a session happens, the timeout is extended */
  47. void UA_Session_updateLifetime(UA_Session *session);
  48. #ifdef UA_ENABLE_SUBSCRIPTIONS
  49. void UA_Session_addSubscription(UA_Session *session, UA_Subscription *newSubscription);
  50. UA_Subscription *
  51. UA_Session_getSubscriptionByID(UA_Session *session, UA_UInt32 subscriptionID);
  52. UA_StatusCode
  53. UA_Session_deleteSubscription(UA_Server *server, UA_Session *session,
  54. UA_UInt32 subscriptionID);
  55. UA_UInt32
  56. UA_Session_getUniqueSubscriptionID(UA_Session *session);
  57. #endif
  58. #endif /* UA_SESSION_H_ */