ua_securechannel.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #ifndef UA_SECURECHANNEL_H_
  2. #define UA_SECURECHANNEL_H_
  3. #include "queue.h"
  4. #include "ua_types.h"
  5. #include "ua_transport_generated.h"
  6. #include "ua_connection_internal.h"
  7. struct UA_Session;
  8. typedef struct UA_Session UA_Session;
  9. struct SessionEntry {
  10. LIST_ENTRY(SessionEntry) pointers;
  11. UA_Session *session; // Just a pointer. The session is held in the session manager or the client
  12. };
  13. struct ChunkEntry {
  14. LIST_ENTRY(ChunkEntry) pointers;
  15. UA_UInt32 requestId;
  16. UA_Boolean invalid_message;
  17. UA_ByteString bytes;
  18. };
  19. struct UA_SecureChannel {
  20. UA_MessageSecurityMode securityMode;
  21. UA_ChannelSecurityToken securityToken; // the channelId is contained in the securityToken
  22. UA_ChannelSecurityToken nextSecurityToken; // the channelId is contained in the securityToken
  23. UA_AsymmetricAlgorithmSecurityHeader clientAsymAlgSettings;
  24. UA_AsymmetricAlgorithmSecurityHeader serverAsymAlgSettings;
  25. UA_ByteString clientNonce;
  26. UA_ByteString serverNonce;
  27. UA_UInt32 sequenceNumber;
  28. UA_Connection *connection;
  29. LIST_HEAD(session_pointerlist, SessionEntry) sessions;
  30. LIST_HEAD(chunk_pointerlist, ChunkEntry) chunks;
  31. };
  32. void UA_SecureChannel_init(UA_SecureChannel *channel);
  33. void UA_SecureChannel_deleteMembersCleanup(UA_SecureChannel *channel);
  34. UA_StatusCode UA_SecureChannel_generateNonce(UA_ByteString *nonce);
  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. UA_StatusCode UA_SecureChannel_sendBinaryMessage(UA_SecureChannel *channel, UA_UInt32 requestId,
  39. const void *content, const UA_DataType *contentType);
  40. void UA_SecureChannel_revolveTokens(UA_SecureChannel *channel);
  41. #endif /* UA_SECURECHANNEL_H_ */