ua_stack_session.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /*
  2. * ua_stack_session.h
  3. *
  4. * Created on: 05.06.2014
  5. * Author: root
  6. */
  7. #ifndef UA_STACK_SESSION_H_
  8. #define UA_STACK_SESSION_H_
  9. #include "ua_stack_channel.h"
  10. typedef struct UA_SessionStruct *UA_Session;
  11. typedef UA_Int32(*UA_Session_idProvider)(UA_NodeId *newSessionId);
  12. /**
  13. * @brief creates a session object
  14. * @param newSession
  15. * @return error code
  16. */
  17. UA_Int32 UA_Session_new(UA_Session **newSession);
  18. /**
  19. * @brief inits a session object
  20. * @param session
  21. * @param sessionName
  22. * @param requestedSessionTimeout
  23. * @param maxRequestMessageSize
  24. * @param maxResponseMessageSize
  25. * @param idProvider
  26. * @param timeout
  27. * @return error code
  28. */
  29. UA_Int32 UA_Session_init(UA_Session session, UA_String *sessionName, UA_Double requestedSessionTimeout,
  30. UA_UInt32 maxRequestMessageSize,
  31. UA_UInt32 maxResponseMessageSize,
  32. UA_Session_idProvider idProvider,
  33. UA_Int64 timeout);
  34. UA_Int32 UA_Session_delete(UA_Session *session);
  35. /**
  36. * @brief compares two session objects
  37. * @param session1
  38. * @param session2
  39. * @return UA_TRUE if it is the same session, UA_FALSE else
  40. */
  41. UA_Boolean UA_Session_compare(UA_Session session1, UA_Session session2);
  42. /**
  43. * @brief compares two sessions by their authentication token
  44. * @param session
  45. * @param token
  46. * @return UA_EQUAL if the session token matches the session UA_NOT_EQUAL
  47. */
  48. UA_Boolean UA_Session_compareByToken(UA_Session session, UA_NodeId *token);
  49. /**
  50. * @brief compares two sessions by their session id
  51. * @param session
  52. * @param sessionId
  53. * @return UA_EQUAL if the session identifier matches the session UA_NOT_EQUAL
  54. */
  55. UA_Boolean UA_Session_compareById(UA_Session session, UA_NodeId *sessionId);
  56. /**
  57. * @brief binds a channel to a session
  58. * @param session
  59. * @param channel
  60. * @return error code
  61. */
  62. UA_Int32 UA_Session_bind(UA_Session session, SL_Channel channel);
  63. /**
  64. * @brief checks if the given channel is related to the session
  65. * @param session
  66. * @param channel
  67. * @return UA_TRUE if there is a relation between session and given channel
  68. */
  69. UA_Boolean UA_Session_verifyChannel(UA_Session session, SL_Channel channel);
  70. /**
  71. * @brief If any activity on a session happens, the timeout must be extended
  72. * @param session
  73. * @return error code
  74. */
  75. UA_Int32 UA_Session_updateLifetime(UA_Session session);
  76. /**
  77. * @brief Gets the session identifier (UA_NodeId)
  78. * @param session session from which the identifier should be returned
  79. * @param sessionId return value
  80. * @return error code
  81. */
  82. UA_Int32 UA_Session_getId(UA_Session session, UA_NodeId *sessionId);
  83. /**
  84. * @brief Gets the session authentication token
  85. * @param session session from which the token should be returned
  86. * @param authenticationToken return value
  87. * @return error code
  88. */
  89. UA_Int32 UA_Session_getToken(UA_Session session, UA_NodeId *authenticationToken);
  90. /**
  91. * @brief Gets the channel on which the session is currently running
  92. * @param session session from which the channel should be returned
  93. * @param channel return value
  94. * @return
  95. */
  96. UA_Int32 UA_Session_getChannel(UA_Session session, SL_Channel *channel);
  97. /**
  98. * @brief Gets the sessions pending lifetime (calculated from the timeout which was set)
  99. * @param session session from which the lifetime should be returned
  100. * @param pendingLifetime return value
  101. * @return error code
  102. */
  103. UA_Int32 UA_Session_getPendingLifetime(UA_Session session,UA_Double *pendingLifetime);
  104. /**
  105. * @brief Gets the pointer to the application
  106. * @param session session from which the application pointer should be returned
  107. * @param application return value
  108. * @return error code
  109. */
  110. UA_Int32 UA_Session_getApplicationPointer(UA_Session session, Application** application);
  111. /**
  112. * @brief Sets the application pointer to the application
  113. * @param session session of which the application pointer should be set
  114. * @param application return value
  115. * @return error code
  116. */
  117. UA_Int32 UA_Session_setApplicationPointer(UA_Session session, Application* application);
  118. #endif /* UA_STACK_SESSION_H_ */