ua_connection.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #ifndef OPCUA_CONNECTIONHELPER_H_
  2. #define OPCUA_CONNECTIONHELPER_H_
  3. #include "opcua.h"
  4. #include "ua_stackInternalTypes.h"
  5. #include "ua_application.h"
  6. enum UA_MessageType
  7. {
  8. UA_MESSAGETYPE_HEL = 0x48454C, // H E L
  9. UA_MESSAGETYPE_ACK = 0x41434B, // A C k
  10. UA_MESSAGETYPE_ERR = 0x455151, // E R R
  11. UA_MESSAGETYPE_OPN = 0x4F504E, // O P N
  12. UA_MESSAGETYPE_MSG = 0x4D5347, // M S G
  13. UA_MESSAGETYPE_CLO = 0x434C4F // C L O
  14. };
  15. enum connectionState
  16. {
  17. connectionState_CLOSED,
  18. connectionState_OPENING,
  19. connectionState_ESTABLISHED,
  20. connectionState_CLOSE,
  21. };
  22. typedef struct
  23. {
  24. UA_UInt32 secureChannelId;
  25. UA_SymmetricAlgorithmSecurityHeader tokenId;
  26. UA_DateTime createdAt;
  27. UA_Int32 revisedLifetime;
  28. }SL_ChannelSecurityToken;
  29. typedef struct
  30. {
  31. UA_UInt32 protocolVersion;
  32. UA_UInt32 sendBufferSize;
  33. UA_UInt32 recvBufferSize;
  34. UA_UInt32 maxMessageSize;
  35. UA_UInt32 maxChunkCount;
  36. }TL_buffer;
  37. /* Transport Layer Connection */
  38. struct T_UA_TL_connection; // forward declaration
  39. typedef UA_Int32 (*UA_TL_writer)(struct T_UA_TL_connection* c, UA_ByteString* msg);
  40. typedef struct T_UA_TL_connection
  41. {
  42. UA_Int32 connectionHandle;
  43. UA_UInt32 connectionState;
  44. TL_buffer localConf;
  45. UA_TL_writer writerCallback;
  46. TL_buffer remoteConf;
  47. UA_String localEndpointUrl;
  48. UA_String remoteEndpointUrl;
  49. struct T_SL_Channel* secureChannel;
  50. } UA_TL_connection;
  51. struct UA_Session {
  52. UA_Int32 dummy;
  53. UA_Application *application;
  54. }
  55. /* Secure Layer Channel */
  56. typedef struct T_SL_Channel
  57. {
  58. UA_String secureChannelId;
  59. UA_TL_connection* tlConnection;
  60. UA_Session *session; // equals UA_Null iff no session is active
  61. UA_AsymmetricAlgorithmSecurityHeader remoteAsymAlgSettings;
  62. UA_AsymmetricAlgorithmSecurityHeader localAsymAlgSettings;
  63. UA_SequenceHeader sequenceHeader;
  64. UA_UInt32 securityMode;
  65. UA_ByteString remoteNonce;
  66. UA_ByteString localNonce;
  67. UA_UInt32 connectionState;
  68. SL_ChannelSecurityToken securityToken;
  69. UA_UInt32 requestId; // request Id of the current request
  70. } UA_SL_Channel;
  71. #endif /* OPCUA_CONNECTIONHELPER_H_ */