opcua_connectionHelper.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. UInt32 sequenceNumber;
  55. UInt32 requestType;
  56. UA_String secureChannelId;
  57. // UInt32 UInt32_secureChannelId;
  58. UInt32 securityMode;
  59. UA_ByteString clientNonce;
  60. UA_ByteString serverNonce;
  61. UInt32 connectionState;
  62. SL_ChannelSecurityToken securityToken;
  63. }SL_connection;
  64. struct SS_connection
  65. {
  66. };
  67. typedef struct
  68. {
  69. struct TL_connection transportLayer;
  70. SL_connection *secureLayer;
  71. struct SS_connection serviceLayer;
  72. Boolean newDataToRead;
  73. UA_ByteString readData;
  74. Boolean newDataToWrite;
  75. UA_ByteString writeData;
  76. }UA_connection;
  77. #endif /* OPCUA_CONNECTIONHELPER_H_ */