ua_transport.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. #ifndef UA_TRANSPORT_H_
  2. #define UA_TRANSPORT_H_
  3. #include "ua_types.h"
  4. #include "ua_types_encoding_binary.h"
  5. typedef enum SecurityTokenRequestType {
  6. UA_SECURITYTOKEN_ISSUE = 0,
  7. UA_SECURITYTOKEN_RENEW = 1
  8. } SecurityTokenRequestType;
  9. typedef enum {
  10. UA_SECURITYMODE_INVALID = 0,
  11. UA_SECURITYMODE_NONE = 1,
  12. UA_SECURITYMODE_SIGNANDENCRYPT = 2
  13. } SecurityMode;
  14. /* MessageType */
  15. typedef UA_Int32 UA_MessageType;
  16. enum UA_MessageType {
  17. UA_MESSAGETYPE_HEL = 0x48454C, // H E L
  18. UA_MESSAGETYPE_ACK = 0x41434B, // A C k
  19. UA_MESSAGETYPE_ERR = 0x455151, // E R R
  20. UA_MESSAGETYPE_OPN = 0x4F504E, // O P N
  21. UA_MESSAGETYPE_MSG = 0x4D5347, // M S G
  22. UA_MESSAGETYPE_CLO = 0x434C4F // C L O
  23. };
  24. UA_TYPE_PROTOTYPES(UA_MessageType)
  25. UA_TYPE_BINARY_ENCODING(UA_MessageType)
  26. void UA_MessageType_printf(char *label, UA_MessageType *p);
  27. /** @brief TCP Header */
  28. typedef struct UA_OPCUATcpMessageHeader {
  29. UA_MessageType messageType;
  30. UA_Byte isFinal;
  31. UA_UInt32 messageSize;
  32. } UA_OPCUATcpMessageHeader;
  33. UA_TYPE_PROTOTYPES(UA_OPCUATcpMessageHeader)
  34. UA_TYPE_BINARY_ENCODING(UA_OPCUATcpMessageHeader)
  35. /** @brief Hello Message */
  36. typedef struct UA_OPCUATcpHelloMesage {
  37. UA_UInt32 protocolVersion;
  38. UA_UInt32 receiveBufferSize;
  39. UA_UInt32 sendBufferSize;
  40. UA_UInt32 maxMessageSize;
  41. UA_UInt32 maxChunkCount;
  42. UA_String endpointUrl;
  43. } UA_OPCUATcpHelloMessage;
  44. UA_TYPE_PROTOTYPES(UA_OPCUATcpHelloMessage)
  45. UA_TYPE_BINARY_ENCODING(UA_OPCUATcpHelloMessage)
  46. /** @brief Acknowledge Message */
  47. typedef struct UA_OPCUATcpAcknowledgeMessage {
  48. UA_UInt32 protocolVersion;
  49. UA_UInt32 receiveBufferSize;
  50. UA_UInt32 sendBufferSize;
  51. UA_UInt32 maxMessageSize;
  52. UA_UInt32 maxChunkCount;
  53. } UA_OPCUATcpAcknowledgeMessage;
  54. UA_TYPE_PROTOTYPES(UA_OPCUATcpAcknowledgeMessage)
  55. UA_TYPE_BINARY_ENCODING(UA_OPCUATcpAcknowledgeMessage)
  56. /** @brief Secure Layer Sequence Header */
  57. typedef struct UA_SecureConversationMessageHeader {
  58. UA_OPCUATcpMessageHeader messageHeader;
  59. UA_UInt32 secureChannelId;
  60. } UA_SecureConversationMessageHeader;
  61. UA_TYPE_PROTOTYPES(UA_SecureConversationMessageHeader)
  62. UA_TYPE_BINARY_ENCODING(UA_SecureConversationMessageHeader)
  63. /** @brief Security Header> */
  64. typedef struct UA_AsymmetricAlgorithmSecurityHeader {
  65. UA_ByteString securityPolicyUri;
  66. UA_ByteString senderCertificate;
  67. UA_ByteString receiverCertificateThumbprint;
  68. } UA_AsymmetricAlgorithmSecurityHeader;
  69. UA_TYPE_PROTOTYPES(UA_AsymmetricAlgorithmSecurityHeader)
  70. UA_TYPE_BINARY_ENCODING(UA_AsymmetricAlgorithmSecurityHeader)
  71. /** @brief Secure Layer Symmetric Algorithm Header */
  72. typedef struct UA_SymmetricAlgorithmSecurityHeader {
  73. UA_UInt32 tokenId;
  74. } UA_SymmetricAlgorithmSecurityHeader;
  75. UA_TYPE_PROTOTYPES(UA_SymmetricAlgorithmSecurityHeader)
  76. UA_TYPE_BINARY_ENCODING(UA_SymmetricAlgorithmSecurityHeader)
  77. /** @brief Secure Layer Sequence Header */
  78. typedef struct UA_SequenceHeader {
  79. UA_UInt32 sequenceNumber;
  80. UA_UInt32 requestId;
  81. } UA_SequenceHeader;
  82. UA_TYPE_PROTOTYPES(UA_SequenceHeader)
  83. UA_TYPE_BINARY_ENCODING(UA_SequenceHeader)
  84. /** @brief Secure Conversation Message Footer */
  85. typedef struct UA_SecureConversationMessageFooter {
  86. UA_Int32 paddingSize;
  87. UA_Byte *padding;
  88. UA_Byte signature;
  89. } UA_SecureConversationMessageFooter;
  90. UA_TYPE_PROTOTYPES(UA_SecureConversationMessageFooter)
  91. UA_TYPE_BINARY_ENCODING(UA_SecureConversationMessageFooter)
  92. /** @brief Secure Conversation Message Abort Body */
  93. typedef struct UA_SecureConversationMessageAbortBody {
  94. UA_UInt32 error;
  95. UA_String reason;
  96. } UA_SecureConversationMessageAbortBody;
  97. UA_TYPE_PROTOTYPES(UA_SecureConversationMessageAbortBody)
  98. UA_TYPE_BINARY_ENCODING(UA_SecureConversationMessageAbortBody)
  99. #endif /* UA_TRANSPORT_H_ */