ua_securechannel.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #ifndef UA_SECURECHANNEL_H_
  2. #define UA_SECURECHANNEL_H_
  3. #include "queue.h"
  4. #include "ua_types_generated.h"
  5. #include "ua_transport_generated.h"
  6. #include "ua_connection.h"
  7. /**
  8. * @ingroup communication
  9. *
  10. * @{
  11. */
  12. struct UA_Session;
  13. typedef struct UA_Session UA_Session;
  14. struct SessionEntry {
  15. LIST_ENTRY(SessionEntry) pointers;
  16. UA_Session *session; // Just a pointer. The session is held in the session manager or the client
  17. };
  18. struct UA_SecureChannel {
  19. UA_MessageSecurityMode securityMode;
  20. UA_ChannelSecurityToken securityToken; // the channelId is contained in the securityToken
  21. UA_AsymmetricAlgorithmSecurityHeader clientAsymAlgSettings;
  22. UA_AsymmetricAlgorithmSecurityHeader serverAsymAlgSettings;
  23. UA_ByteString clientNonce;
  24. UA_ByteString serverNonce;
  25. UA_UInt32 requestId;
  26. UA_UInt32 sequenceNumber;
  27. UA_Connection *connection;
  28. LIST_HEAD(session_pointerlist, SessionEntry) sessions;
  29. };
  30. void UA_SecureChannel_init(UA_SecureChannel *channel);
  31. void UA_SecureChannel_deleteMembersCleanup(UA_SecureChannel *channel);
  32. UA_StatusCode UA_SecureChannel_generateNonce(UA_ByteString *nonce);
  33. UA_StatusCode UA_SecureChannel_updateRequestId(UA_SecureChannel *channel, UA_UInt32 requestId);
  34. UA_StatusCode UA_SecureChannel_updateSequenceNumber(UA_SecureChannel *channel, UA_UInt32 sequenceNumber);
  35. void UA_SecureChannel_attachSession(UA_SecureChannel *channel, UA_Session *session);
  36. void UA_SecureChannel_detachSession(UA_SecureChannel *channel, UA_Session *session);
  37. UA_Session * UA_SecureChannel_getSession(UA_SecureChannel *channel, UA_NodeId *token);
  38. /** @} */
  39. #endif /* UA_SECURECHANNEL_H_ */