opcua_connectionHelper.h 1.9 KB

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