ua_securechannel.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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_ChannelSecurityToken nextSecurityToken; // the channelId is contained in the securityToken
  22. UA_AsymmetricAlgorithmSecurityHeader clientAsymAlgSettings;
  23. UA_AsymmetricAlgorithmSecurityHeader serverAsymAlgSettings;
  24. UA_ByteString clientNonce;
  25. UA_ByteString serverNonce;
  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. void UA_SecureChannel_attachSession(UA_SecureChannel *channel, UA_Session *session);
  34. void UA_SecureChannel_detachSession(UA_SecureChannel *channel, UA_Session *session);
  35. UA_Session * UA_SecureChannel_getSession(UA_SecureChannel *channel, UA_NodeId *token);
  36. UA_StatusCode UA_SecureChannel_sendBinaryMessage(UA_SecureChannel *channel, UA_UInt32 requestId,
  37. const void *content, const UA_DataType *contentType);
  38. void UA_SecureChannel_revolveTokens(UA_SecureChannel *channel);
  39. /** @} */
  40. #endif /* UA_SECURECHANNEL_H_ */