opcua_connectionHelper.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /*
  2. * opcua_connectionHelper.h
  3. *
  4. * Created on: Jan 13, 2014
  5. * Author: opcua
  6. */
  7. #ifndef OPCUA_CONNECTIONHELPER_H_
  8. #define OPCUA_CONNECTIONHELPER_H_
  9. #include "opcua.h"
  10. enum packetType
  11. {
  12. packetType_HEL = 1,
  13. packetType_ACK = 2,
  14. packetType_ERR = 3,
  15. packetType_OPN = 4,
  16. packetType_MSG = 5,
  17. packetType_CLO = 6
  18. };
  19. enum connectionState
  20. {
  21. connectionState_CLOSED,
  22. connectionState_OPENING,
  23. connectionState_ESTABLISHED,
  24. };
  25. typedef struct
  26. {
  27. UA_UInt32 secureChannelId;
  28. UA_UInt32 tokenId;
  29. UA_DateTime createdAt;
  30. UA_Int32 revisedLifetime;
  31. }SL_ChannelSecurityToken;
  32. typedef struct
  33. {
  34. UA_UInt32 protocolVersion;
  35. UA_UInt32 sendBufferSize;
  36. UA_UInt32 recvBufferSize;
  37. UA_UInt32 maxMessageSize;
  38. UA_UInt32 maxChunkCount;
  39. }TL_buffer;
  40. struct TL_connection
  41. {
  42. UA_Int32 socket;
  43. UA_UInt32 connectionState;
  44. TL_buffer remoteConf;
  45. TL_buffer localConf;
  46. UA_String endpointURL;
  47. };
  48. typedef struct
  49. {
  50. UA_ByteString SecurityPolicyUri;
  51. UA_ByteString SenderCertificate;
  52. UA_ByteString ReceiverCertificateThumbprint;
  53. }AsymmetricAlgSecuritySettings;
  54. struct SL_connection
  55. {
  56. AsymmetricAlgSecuritySettings remoteAsymAlgSettings;
  57. AsymmetricAlgSecuritySettings localAsymAlgSettings;
  58. /*
  59. UA_ByteString SecurityPolicyUri;
  60. UA_ByteString SenderCertificate;
  61. UA_ByteString ReceiverCertificateThumbprint;
  62. */
  63. UA_UInt32 sequenceNumber;
  64. UA_UInt32 requestType;
  65. UA_String secureChannelId;
  66. //UInt32 UInt32_secureChannelId;
  67. UA_UInt32 securityMode;
  68. UA_ByteString remoteNonce;
  69. UA_ByteString localNonce;
  70. UA_UInt32 connectionState;
  71. SL_ChannelSecurityToken securityToken;
  72. UA_UInt32 requestId; // request Id of the current request
  73. };
  74. struct SS_connection
  75. {
  76. };
  77. typedef struct
  78. {
  79. struct TL_connection transportLayer;
  80. struct SL_connection secureLayer;
  81. struct SS_connection serviceLayer;
  82. UA_Boolean newDataToRead;
  83. UA_ByteString readData;
  84. UA_Boolean newDataToWrite;
  85. UA_ByteString writeData;
  86. }UA_connection;
  87. #endif /* OPCUA_CONNECTIONHELPER_H_ */