ua_transport.c 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538
  1. #include "ua_transport.h"
  2. #include "ua_types_encoding_binary.h"
  3. #include "stdio.h"
  4. UA_TYPE_DEFAULT(UA_MessageType)
  5. UA_Int32 UA_MessageType_calcSize(UA_MessageType const * ptr){
  6. if(ptr==UA_NULL){return sizeof(UA_MessageType);}
  7. return 0
  8. + 3 * sizeof(UA_Byte);
  9. }
  10. UA_Int32 UA_MessageType_encodeBinary(UA_MessageType const * src, UA_ByteString* dst, UA_UInt32 *offset){
  11. UA_Int32 retval = UA_SUCCESS;
  12. UA_Byte tmpBuf[3];
  13. tmpBuf[0] = (UA_Byte)((((UA_Int32)*src) >> 16) );
  14. tmpBuf[1] = (UA_Byte)((((UA_Int32)*src) >> 8));
  15. tmpBuf[2] = (UA_Byte)(((UA_Int32)*src));
  16. retval |= UA_Byte_encodeBinary(&(tmpBuf[0]),dst,offset);
  17. retval |= UA_Byte_encodeBinary(&(tmpBuf[1]),dst,offset);
  18. retval |= UA_Byte_encodeBinary(&(tmpBuf[2]),dst,offset);
  19. return retval;
  20. }
  21. UA_Int32 UA_MessageType_decodeBinary(UA_ByteString const * src, UA_UInt32 *offset, UA_MessageType* dst){
  22. UA_Int32 retval = UA_SUCCESS;
  23. UA_Byte tmpBuf[3];
  24. retval |= UA_Byte_decodeBinary(src,offset,&(tmpBuf[0])); //messageType to Byte representation
  25. retval |= UA_Byte_decodeBinary(src,offset,&(tmpBuf[1]));
  26. retval |= UA_Byte_decodeBinary(src,offset,&(tmpBuf[2]));
  27. *dst = (UA_MessageType)((UA_Int32)(tmpBuf[0]<<16) + (UA_Int32)(tmpBuf[1]<<8) + (UA_Int32)(tmpBuf[2]));
  28. return retval;
  29. }
  30. void UA_MessageType_printf(char *label, UA_MessageType* p) {
  31. UA_Byte* b = (UA_Byte*) p;
  32. printf("%s{%c%c%c}\n", label, b[2],b[1],b[0]);
  33. }
  34. UA_Int32 UA_OPCUATcpMessageHeader_calcSizeBinary(UA_OPCUATcpMessageHeader const * ptr) {
  35. if(ptr==UA_NULL) return sizeof(UA_OPCUATcpMessageHeader);
  36. return 0
  37. + 3 // messageType
  38. + sizeof(UA_Byte) // isFinal
  39. + sizeof(UA_UInt32) // messageSize
  40. ;
  41. }
  42. UA_Int32 UA_OPCUATcpMessageHeader_encodeBinary(UA_OPCUATcpMessageHeader const * src, UA_ByteString* dst, UA_UInt32 *offset) {
  43. UA_Int32 retval = UA_SUCCESS;
  44. retval |= UA_MessageType_encodeBinary(&src->messageType,dst,offset);
  45. retval |= UA_Byte_encodeBinary(&src->isFinal,dst,offset);
  46. retval |= UA_UInt32_encodeBinary(&src->messageSize,dst,offset);
  47. return retval;
  48. }
  49. UA_Int32 UA_OPCUATcpMessageHeader_decodeBinary(UA_ByteString const * src, UA_UInt32 *offset, UA_OPCUATcpMessageHeader * dst) {
  50. UA_Int32 retval = UA_SUCCESS;
  51. UA_OPCUATcpMessageHeader_init(dst);
  52. CHECKED_DECODE(UA_MessageType_decodeBinary(src,offset,&dst->messageType), UA_OPCUATcpMessageHeader_deleteMembers(dst));
  53. CHECKED_DECODE(UA_Byte_decodeBinary(src,offset,&dst->isFinal), UA_OPCUATcpMessageHeader_deleteMembers(dst));
  54. CHECKED_DECODE(UA_UInt32_decodeBinary(src,offset,&dst->messageSize), UA_OPCUATcpMessageHeader_deleteMembers(dst));
  55. return retval;
  56. }
  57. UA_Int32 UA_OPCUATcpMessageHeader_delete(UA_OPCUATcpMessageHeader *p) {
  58. UA_Int32 retval = UA_SUCCESS;
  59. retval |= UA_OPCUATcpMessageHeader_deleteMembers(p);
  60. retval |= UA_free(p);
  61. return retval;
  62. }
  63. UA_Int32 UA_OPCUATcpMessageHeader_deleteMembers(UA_OPCUATcpMessageHeader *p) {
  64. UA_Int32 retval = UA_SUCCESS;
  65. return retval;
  66. }
  67. UA_Int32 UA_OPCUATcpMessageHeader_init(UA_OPCUATcpMessageHeader *p) {
  68. UA_Int32 retval = UA_SUCCESS;
  69. retval |= UA_Byte_init(&p->isFinal);
  70. retval |= UA_UInt32_init(&p->messageSize);
  71. return retval;
  72. }
  73. UA_TYPE_NEW_DEFAULT(UA_OPCUATcpMessageHeader)
  74. UA_Int32 UA_OPCUATcpMessageHeader_copy(const UA_OPCUATcpMessageHeader *src,UA_OPCUATcpMessageHeader *dst) {
  75. UA_Int32 retval = UA_SUCCESS;
  76. if(src == UA_NULL || dst == UA_NULL)
  77. return UA_ERROR;
  78. memcpy(dst, src, sizeof(UA_OPCUATcpMessageHeader));
  79. return retval;
  80. }
  81. UA_Int32 UA_OPCUATcpHelloMessage_calcSizeBinary(UA_OPCUATcpHelloMessage const * ptr) {
  82. if(ptr==UA_NULL) return sizeof(UA_OPCUATcpHelloMessage);
  83. return 0
  84. + sizeof(UA_UInt32) // protocolVersion
  85. + sizeof(UA_UInt32) // receiveBufferSize
  86. + sizeof(UA_UInt32) // sendBufferSize
  87. + sizeof(UA_UInt32) // maxMessageSize
  88. + sizeof(UA_UInt32) // maxChunkCount
  89. + UA_String_calcSizeBinary(&ptr->endpointUrl)
  90. ;
  91. }
  92. UA_Int32 UA_OPCUATcpHelloMessage_encodeBinary(UA_OPCUATcpHelloMessage const * src, UA_ByteString* dst, UA_UInt32 *offset) {
  93. UA_Int32 retval = UA_SUCCESS;
  94. retval |= UA_UInt32_encodeBinary(&src->protocolVersion,dst,offset);
  95. retval |= UA_UInt32_encodeBinary(&src->receiveBufferSize,dst,offset);
  96. retval |= UA_UInt32_encodeBinary(&src->sendBufferSize,dst,offset);
  97. retval |= UA_UInt32_encodeBinary(&src->maxMessageSize,dst,offset);
  98. retval |= UA_UInt32_encodeBinary(&src->maxChunkCount,dst,offset);
  99. retval |= UA_String_encodeBinary(&src->endpointUrl,dst,offset);
  100. return retval;
  101. }
  102. UA_Int32 UA_OPCUATcpHelloMessage_decodeBinary(UA_ByteString const * src, UA_UInt32 *offset, UA_OPCUATcpHelloMessage * dst) {
  103. UA_Int32 retval = UA_SUCCESS;
  104. UA_OPCUATcpHelloMessage_init(dst);
  105. CHECKED_DECODE(UA_UInt32_decodeBinary(src,offset,&dst->protocolVersion), UA_OPCUATcpHelloMessage_deleteMembers(dst));
  106. CHECKED_DECODE(UA_UInt32_decodeBinary(src,offset,&dst->receiveBufferSize), UA_OPCUATcpHelloMessage_deleteMembers(dst));
  107. CHECKED_DECODE(UA_UInt32_decodeBinary(src,offset,&dst->sendBufferSize), UA_OPCUATcpHelloMessage_deleteMembers(dst));
  108. CHECKED_DECODE(UA_UInt32_decodeBinary(src,offset,&dst->maxMessageSize), UA_OPCUATcpHelloMessage_deleteMembers(dst));
  109. CHECKED_DECODE(UA_UInt32_decodeBinary(src,offset,&dst->maxChunkCount), UA_OPCUATcpHelloMessage_deleteMembers(dst));
  110. CHECKED_DECODE(UA_String_decodeBinary(src,offset,&dst->endpointUrl), UA_OPCUATcpHelloMessage_deleteMembers(dst));
  111. return retval;
  112. }
  113. UA_Int32 UA_OPCUATcpHelloMessage_delete(UA_OPCUATcpHelloMessage *p) {
  114. UA_Int32 retval = UA_SUCCESS;
  115. retval |= UA_OPCUATcpHelloMessage_deleteMembers(p);
  116. retval |= UA_free(p);
  117. return retval;
  118. }
  119. UA_Int32 UA_OPCUATcpHelloMessage_deleteMembers(UA_OPCUATcpHelloMessage *p) {
  120. UA_Int32 retval = UA_SUCCESS;
  121. retval |= UA_String_deleteMembers(&p->endpointUrl);
  122. return retval;
  123. }
  124. UA_Int32 UA_OPCUATcpHelloMessage_init(UA_OPCUATcpHelloMessage *p) {
  125. UA_Int32 retval = UA_SUCCESS;
  126. retval |= UA_UInt32_init(&p->protocolVersion);
  127. retval |= UA_UInt32_init(&p->receiveBufferSize);
  128. retval |= UA_UInt32_init(&p->sendBufferSize);
  129. retval |= UA_UInt32_init(&p->maxMessageSize);
  130. retval |= UA_UInt32_init(&p->maxChunkCount);
  131. retval |= UA_String_init(&p->endpointUrl);
  132. return retval;
  133. }
  134. UA_TYPE_NEW_DEFAULT(UA_OPCUATcpHelloMessage)
  135. UA_Int32 UA_OPCUATcpHelloMessage_copy(const UA_OPCUATcpHelloMessage *src,UA_OPCUATcpHelloMessage *dst) {
  136. UA_Int32 retval = UA_SUCCESS;
  137. if(src == UA_NULL || dst == UA_NULL) return UA_ERROR;
  138. memcpy(dst, src, sizeof(UA_OPCUATcpHelloMessage));
  139. retval |= UA_String_copy(&src->endpointUrl,&dst->endpointUrl);
  140. return retval;
  141. }
  142. UA_Int32 UA_OPCUATcpAcknowledgeMessage_calcSizeBinary(UA_OPCUATcpAcknowledgeMessage const * ptr) {
  143. if(ptr==UA_NULL) return sizeof(UA_OPCUATcpAcknowledgeMessage);
  144. return 0
  145. + sizeof(UA_UInt32) // protocolVersion
  146. + sizeof(UA_UInt32) // receiveBufferSize
  147. + sizeof(UA_UInt32) // sendBufferSize
  148. + sizeof(UA_UInt32) // maxMessageSize
  149. + sizeof(UA_UInt32) // maxChunkCount
  150. ;
  151. }
  152. UA_Int32 UA_OPCUATcpAcknowledgeMessage_encodeBinary(UA_OPCUATcpAcknowledgeMessage const * src, UA_ByteString* dst, UA_UInt32 *offset) {
  153. UA_Int32 retval = UA_SUCCESS;
  154. retval |= UA_UInt32_encodeBinary(&src->protocolVersion,dst,offset);
  155. retval |= UA_UInt32_encodeBinary(&src->receiveBufferSize,dst,offset);
  156. retval |= UA_UInt32_encodeBinary(&src->sendBufferSize,dst,offset);
  157. retval |= UA_UInt32_encodeBinary(&src->maxMessageSize,dst,offset);
  158. retval |= UA_UInt32_encodeBinary(&src->maxChunkCount,dst,offset);
  159. return retval;
  160. }
  161. UA_Int32 UA_OPCUATcpAcknowledgeMessage_decodeBinary(UA_ByteString const * src, UA_UInt32 *offset, UA_OPCUATcpAcknowledgeMessage * dst) {
  162. UA_Int32 retval = UA_SUCCESS;
  163. UA_OPCUATcpAcknowledgeMessage_init(dst);
  164. CHECKED_DECODE(UA_UInt32_decodeBinary(src,offset,&dst->protocolVersion), UA_OPCUATcpAcknowledgeMessage_deleteMembers(dst));
  165. CHECKED_DECODE(UA_UInt32_decodeBinary(src,offset,&dst->receiveBufferSize), UA_OPCUATcpAcknowledgeMessage_deleteMembers(dst));
  166. CHECKED_DECODE(UA_UInt32_decodeBinary(src,offset,&dst->sendBufferSize), UA_OPCUATcpAcknowledgeMessage_deleteMembers(dst));
  167. CHECKED_DECODE(UA_UInt32_decodeBinary(src,offset,&dst->maxMessageSize), UA_OPCUATcpAcknowledgeMessage_deleteMembers(dst));
  168. CHECKED_DECODE(UA_UInt32_decodeBinary(src,offset,&dst->maxChunkCount), UA_OPCUATcpAcknowledgeMessage_deleteMembers(dst));
  169. return retval;
  170. }
  171. UA_Int32 UA_OPCUATcpAcknowledgeMessage_delete(UA_OPCUATcpAcknowledgeMessage *p) {
  172. UA_Int32 retval = UA_SUCCESS;
  173. retval |= UA_OPCUATcpAcknowledgeMessage_deleteMembers(p);
  174. retval |= UA_free(p);
  175. return retval;
  176. }
  177. UA_Int32 UA_OPCUATcpAcknowledgeMessage_deleteMembers(UA_OPCUATcpAcknowledgeMessage *p) {
  178. UA_Int32 retval = UA_SUCCESS;
  179. return retval;
  180. }
  181. UA_Int32 UA_OPCUATcpAcknowledgeMessage_init(UA_OPCUATcpAcknowledgeMessage *p) {
  182. UA_Int32 retval = UA_SUCCESS;
  183. retval |= UA_UInt32_init(&p->protocolVersion);
  184. retval |= UA_UInt32_init(&p->receiveBufferSize);
  185. retval |= UA_UInt32_init(&p->sendBufferSize);
  186. retval |= UA_UInt32_init(&p->maxMessageSize);
  187. retval |= UA_UInt32_init(&p->maxChunkCount);
  188. return retval;
  189. }
  190. UA_TYPE_NEW_DEFAULT(UA_OPCUATcpAcknowledgeMessage)
  191. UA_Int32 UA_OPCUATcpAcknowledgeMessage_copy(const UA_OPCUATcpAcknowledgeMessage *src,UA_OPCUATcpAcknowledgeMessage *dst) {
  192. UA_Int32 retval = UA_SUCCESS;
  193. if(src == UA_NULL || dst == UA_NULL) return UA_ERROR;
  194. memcpy(dst, src, sizeof(UA_OPCUATcpAcknowledgeMessage));
  195. return retval;
  196. }
  197. UA_Int32 UA_SecureConversationMessageHeader_calcSizeBinary(UA_SecureConversationMessageHeader const * ptr) {
  198. if(ptr==UA_NULL) return sizeof(UA_SecureConversationMessageHeader);
  199. return 0
  200. + sizeof(UA_OPCUATcpMessageHeader) // messageHeader CHECK: delete this or use in binary_secure.c
  201. + sizeof(UA_UInt32) // secureChannelId
  202. ;
  203. }
  204. UA_Int32 UA_SecureConversationMessageHeader_encodeBinary(UA_SecureConversationMessageHeader const * src, UA_ByteString* dst, UA_UInt32 *offset) {
  205. UA_Int32 retval = UA_SUCCESS;
  206. retval |= UA_OPCUATcpMessageHeader_encodeBinary(&src->messageHeader,dst,offset);
  207. retval |= UA_UInt32_encodeBinary(&src->secureChannelId,dst,offset);
  208. return retval;
  209. }
  210. UA_Int32 UA_SecureConversationMessageHeader_decodeBinary(UA_ByteString const * src, UA_UInt32 *offset, UA_SecureConversationMessageHeader * dst) {
  211. UA_Int32 retval = UA_SUCCESS;
  212. UA_SecureConversationMessageHeader_init(dst);
  213. CHECKED_DECODE(UA_OPCUATcpMessageHeader_decodeBinary(src,offset,&dst->messageHeader), UA_SecureConversationMessageHeader_deleteMembers(dst));
  214. CHECKED_DECODE(UA_UInt32_decodeBinary(src,offset,&dst->secureChannelId), UA_SecureConversationMessageHeader_deleteMembers(dst));
  215. return retval;
  216. }
  217. UA_Int32 UA_SecureConversationMessageHeader_delete(UA_SecureConversationMessageHeader *p) {
  218. UA_Int32 retval = UA_SUCCESS;
  219. retval |= UA_SecureConversationMessageHeader_deleteMembers(p);
  220. retval |= UA_free(p);
  221. return retval;
  222. }
  223. UA_Int32 UA_SecureConversationMessageHeader_deleteMembers(UA_SecureConversationMessageHeader *p) {
  224. UA_Int32 retval = UA_SUCCESS;
  225. return retval;
  226. }
  227. UA_Int32 UA_SecureConversationMessageHeader_init(UA_SecureConversationMessageHeader *p) {
  228. UA_Int32 retval = UA_SUCCESS;
  229. retval |= UA_OPCUATcpMessageHeader_init(&p->messageHeader);
  230. retval |= UA_UInt32_init(&p->secureChannelId);
  231. return retval;
  232. }
  233. UA_TYPE_NEW_DEFAULT(UA_SecureConversationMessageHeader)
  234. UA_Int32 UA_SecureConversationMessageHeader_copy(const UA_SecureConversationMessageHeader *src,UA_SecureConversationMessageHeader *dst) {
  235. UA_Int32 retval = UA_SUCCESS;
  236. if(src == UA_NULL || dst == UA_NULL) return UA_ERROR;
  237. memcpy(dst, src, sizeof(UA_SecureConversationMessageHeader));
  238. return retval;
  239. }
  240. UA_Int32 UA_AsymmetricAlgorithmSecurityHeader_calcSizeBinary(UA_AsymmetricAlgorithmSecurityHeader const * ptr) {
  241. if(ptr==UA_NULL) return sizeof(UA_AsymmetricAlgorithmSecurityHeader);
  242. return 0
  243. + UA_ByteString_calcSizeBinary(&ptr->securityPolicyUri)
  244. + UA_ByteString_calcSizeBinary(&ptr->senderCertificate)
  245. + UA_ByteString_calcSizeBinary(&ptr->receiverCertificateThumbprint)
  246. ;
  247. }
  248. UA_Int32 UA_AsymmetricAlgorithmSecurityHeader_encodeBinary(UA_AsymmetricAlgorithmSecurityHeader const * src, UA_ByteString* dst, UA_UInt32 *offset) {
  249. UA_Int32 retval = UA_SUCCESS;
  250. retval |= UA_ByteString_encodeBinary(&src->securityPolicyUri,dst,offset);
  251. retval |= UA_ByteString_encodeBinary(&src->senderCertificate,dst,offset);
  252. retval |= UA_ByteString_encodeBinary(&src->receiverCertificateThumbprint,dst,offset);
  253. return retval;
  254. }
  255. UA_Int32 UA_AsymmetricAlgorithmSecurityHeader_decodeBinary(UA_ByteString const * src, UA_UInt32 *offset, UA_AsymmetricAlgorithmSecurityHeader * dst) {
  256. UA_Int32 retval = UA_SUCCESS;
  257. UA_AsymmetricAlgorithmSecurityHeader_init(dst);
  258. CHECKED_DECODE(UA_ByteString_decodeBinary(src,offset,&dst->securityPolicyUri), UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(dst));
  259. CHECKED_DECODE(UA_ByteString_decodeBinary(src,offset,&dst->senderCertificate), UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(dst));
  260. CHECKED_DECODE(UA_ByteString_decodeBinary(src,offset,&dst->receiverCertificateThumbprint), UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(dst));
  261. return retval;
  262. }
  263. UA_Int32 UA_AsymmetricAlgorithmSecurityHeader_delete(UA_AsymmetricAlgorithmSecurityHeader *p) {
  264. UA_Int32 retval = UA_SUCCESS;
  265. retval |= UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(p);
  266. retval |= UA_free(p);
  267. return retval;
  268. }
  269. UA_Int32 UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(UA_AsymmetricAlgorithmSecurityHeader *p) {
  270. UA_Int32 retval = UA_SUCCESS;
  271. retval |= UA_ByteString_deleteMembers(&p->securityPolicyUri);
  272. retval |= UA_ByteString_deleteMembers(&p->senderCertificate);
  273. retval |= UA_ByteString_deleteMembers(&p->receiverCertificateThumbprint);
  274. return retval;
  275. }
  276. UA_Int32 UA_AsymmetricAlgorithmSecurityHeader_init(UA_AsymmetricAlgorithmSecurityHeader *p) {
  277. UA_Int32 retval = UA_SUCCESS;
  278. retval |= UA_ByteString_init(&p->securityPolicyUri);
  279. retval |= UA_ByteString_init(&p->senderCertificate);
  280. retval |= UA_ByteString_init(&p->receiverCertificateThumbprint);
  281. return retval;
  282. }
  283. UA_TYPE_NEW_DEFAULT(UA_AsymmetricAlgorithmSecurityHeader)
  284. UA_Int32 UA_AsymmetricAlgorithmSecurityHeader_copy(const UA_AsymmetricAlgorithmSecurityHeader *src,UA_AsymmetricAlgorithmSecurityHeader *dst) {
  285. UA_Int32 retval = UA_SUCCESS;
  286. if(src == UA_NULL || dst == UA_NULL) return UA_ERROR;
  287. memcpy(dst, src, sizeof(UA_AsymmetricAlgorithmSecurityHeader));
  288. retval |= UA_ByteString_copy(&src->securityPolicyUri,&dst->securityPolicyUri);
  289. retval |= UA_ByteString_copy(&src->senderCertificate,&dst->senderCertificate);
  290. retval |= UA_ByteString_copy(&src->receiverCertificateThumbprint,&dst->receiverCertificateThumbprint);
  291. return retval;
  292. }
  293. UA_Int32 UA_SymmetricAlgorithmSecurityHeader_calcSizeBinary(UA_SymmetricAlgorithmSecurityHeader const * ptr) {
  294. if(ptr==UA_NULL) return sizeof(UA_SymmetricAlgorithmSecurityHeader);
  295. return 0
  296. + sizeof(UA_UInt32) // tokenId
  297. ;
  298. }
  299. UA_Int32 UA_SymmetricAlgorithmSecurityHeader_encodeBinary(UA_SymmetricAlgorithmSecurityHeader const * src, UA_ByteString* dst, UA_UInt32 *offset) {
  300. UA_Int32 retval = UA_SUCCESS;
  301. retval |= UA_UInt32_encodeBinary(&src->tokenId,dst,offset);
  302. return retval;
  303. }
  304. UA_Int32 UA_SymmetricAlgorithmSecurityHeader_decodeBinary(UA_ByteString const * src, UA_UInt32 *offset, UA_SymmetricAlgorithmSecurityHeader * dst) {
  305. UA_Int32 retval = UA_SUCCESS;
  306. UA_SymmetricAlgorithmSecurityHeader_init(dst);
  307. CHECKED_DECODE(UA_UInt32_decodeBinary(src,offset,&dst->tokenId), UA_SymmetricAlgorithmSecurityHeader_deleteMembers(dst));
  308. return retval;
  309. }
  310. UA_Int32 UA_SymmetricAlgorithmSecurityHeader_delete(UA_SymmetricAlgorithmSecurityHeader *p) {
  311. UA_Int32 retval = UA_SUCCESS;
  312. retval |= UA_SymmetricAlgorithmSecurityHeader_deleteMembers(p);
  313. retval |= UA_free(p);
  314. return retval;
  315. }
  316. UA_Int32 UA_SymmetricAlgorithmSecurityHeader_deleteMembers(UA_SymmetricAlgorithmSecurityHeader *p) {
  317. UA_Int32 retval = UA_SUCCESS;
  318. return retval;
  319. }
  320. UA_Int32 UA_SymmetricAlgorithmSecurityHeader_init(UA_SymmetricAlgorithmSecurityHeader *p) {
  321. UA_Int32 retval = UA_SUCCESS;
  322. retval |= UA_UInt32_init(&p->tokenId);
  323. return retval;
  324. }
  325. UA_TYPE_NEW_DEFAULT(UA_SymmetricAlgorithmSecurityHeader)
  326. UA_Int32 UA_SymmetricAlgorithmSecurityHeader_copy(const UA_SymmetricAlgorithmSecurityHeader *src,UA_SymmetricAlgorithmSecurityHeader *dst) {
  327. UA_Int32 retval = UA_SUCCESS;
  328. if(src == UA_NULL || dst == UA_NULL) return UA_ERROR;
  329. memcpy(dst, src, sizeof(UA_SymmetricAlgorithmSecurityHeader));
  330. return retval;
  331. }
  332. UA_Int32 UA_SequenceHeader_calcSizeBinary(UA_SequenceHeader const * ptr) {
  333. if(ptr==UA_NULL) return sizeof(UA_SequenceHeader);
  334. return 0
  335. + sizeof(UA_UInt32) // sequenceNumber
  336. + sizeof(UA_UInt32) // requestId
  337. ;
  338. }
  339. UA_Int32 UA_SequenceHeader_encodeBinary(UA_SequenceHeader const * src, UA_ByteString* dst, UA_UInt32 *offset) {
  340. UA_Int32 retval = UA_SUCCESS;
  341. retval |= UA_UInt32_encodeBinary(&src->sequenceNumber,dst,offset);
  342. retval |= UA_UInt32_encodeBinary(&src->requestId,dst,offset);
  343. return retval;
  344. }
  345. UA_Int32 UA_SequenceHeader_decodeBinary(UA_ByteString const * src, UA_UInt32 *offset, UA_SequenceHeader * dst) {
  346. UA_Int32 retval = UA_SUCCESS;
  347. UA_SequenceHeader_init(dst);
  348. CHECKED_DECODE(UA_UInt32_decodeBinary(src,offset,&dst->sequenceNumber), UA_SequenceHeader_deleteMembers(dst));
  349. CHECKED_DECODE(UA_UInt32_decodeBinary(src,offset,&dst->requestId), UA_SequenceHeader_deleteMembers(dst));
  350. return retval;
  351. }
  352. UA_Int32 UA_SequenceHeader_delete(UA_SequenceHeader *p) {
  353. UA_Int32 retval = UA_SUCCESS;
  354. retval |= UA_SequenceHeader_deleteMembers(p);
  355. retval |= UA_free(p);
  356. return retval;
  357. }
  358. UA_Int32 UA_SequenceHeader_deleteMembers(UA_SequenceHeader *p) {
  359. UA_Int32 retval = UA_SUCCESS;
  360. return retval;
  361. }
  362. UA_Int32 UA_SequenceHeader_init(UA_SequenceHeader *p) {
  363. UA_Int32 retval = UA_SUCCESS;
  364. retval |= UA_UInt32_init(&p->sequenceNumber);
  365. retval |= UA_UInt32_init(&p->requestId);
  366. return retval;
  367. }
  368. UA_TYPE_NEW_DEFAULT(UA_SequenceHeader)
  369. UA_Int32 UA_SequenceHeader_copy(const UA_SequenceHeader *src,UA_SequenceHeader *dst) {
  370. UA_Int32 retval = UA_SUCCESS;
  371. if(src == UA_NULL || dst == UA_NULL) return UA_ERROR;
  372. memcpy(dst, src, sizeof(UA_SequenceHeader));
  373. return retval;
  374. }
  375. UA_Int32 UA_SecureConversationMessageFooter_calcSizeBinary(UA_SecureConversationMessageFooter const * ptr) {
  376. if(ptr==UA_NULL) return sizeof(UA_SecureConversationMessageFooter);
  377. return 0
  378. + UA_Array_calcSizeBinary(ptr->paddingSize,&UA_.types[UA_BYTE],ptr->padding)
  379. + sizeof(UA_Byte) // signature
  380. ;
  381. }
  382. UA_Int32 UA_SecureConversationMessageFooter_encodeBinary(UA_SecureConversationMessageFooter const * src, UA_ByteString* dst, UA_UInt32 *offset) {
  383. UA_Int32 retval = UA_SUCCESS;
  384. retval |= UA_Array_encodeBinary(src->padding,src->paddingSize,&UA_.types[UA_BYTE],dst,offset);
  385. retval |= UA_Byte_encodeBinary(&src->signature,dst,offset);
  386. return retval;
  387. }
  388. UA_Int32 UA_SecureConversationMessageFooter_decodeBinary(UA_ByteString const * src, UA_UInt32 *offset, UA_SecureConversationMessageFooter * dst) {
  389. UA_Int32 retval = UA_SUCCESS;
  390. UA_SecureConversationMessageFooter_init(dst);
  391. CHECKED_DECODE(UA_Int32_decodeBinary(src,offset,&dst->paddingSize),UA_SecureConversationMessageFooter_deleteMembers(dst));
  392. CHECKED_DECODE(UA_Array_decodeBinary(src,offset,dst->paddingSize,&UA_.types[UA_BYTE],(void**)&dst->padding), UA_SecureConversationMessageFooter_deleteMembers(dst));
  393. CHECKED_DECODE(UA_Byte_decodeBinary(src,offset,&dst->signature), UA_SecureConversationMessageFooter_deleteMembers(dst));
  394. return retval;
  395. }
  396. UA_Int32 UA_SecureConversationMessageFooter_delete(UA_SecureConversationMessageFooter *p) {
  397. UA_Int32 retval = UA_SUCCESS;
  398. retval |= UA_SecureConversationMessageFooter_deleteMembers(p);
  399. retval |= UA_free(p);
  400. return retval;
  401. }
  402. UA_Int32 UA_SecureConversationMessageFooter_deleteMembers(UA_SecureConversationMessageFooter *p) {
  403. UA_Int32 retval = UA_SUCCESS;
  404. retval |= UA_Array_delete((void*)p->padding,p->paddingSize,&UA_.types[UA_BYTE]);
  405. return retval;
  406. }
  407. UA_Int32 UA_SecureConversationMessageFooter_init(UA_SecureConversationMessageFooter *p) {
  408. UA_Int32 retval = UA_SUCCESS;
  409. p->paddingSize = 0;
  410. p->padding = UA_NULL;
  411. retval |= UA_Byte_init(&p->signature);
  412. return retval;
  413. }
  414. UA_TYPE_NEW_DEFAULT(UA_SecureConversationMessageFooter)
  415. UA_Int32 UA_SecureConversationMessageFooter_copy(const UA_SecureConversationMessageFooter *src,UA_SecureConversationMessageFooter *dst) {
  416. UA_Int32 retval = UA_SUCCESS;
  417. if(src == UA_NULL || dst == UA_NULL) return UA_ERROR;
  418. memcpy(dst, src, sizeof(UA_SecureConversationMessageFooter));
  419. retval |= UA_Array_copy(src->padding, src->paddingSize,&UA_.types[UA_BYTE],(void**)&dst->padding);
  420. return retval;
  421. }
  422. UA_Int32 UA_SecureConversationMessageAbortBody_calcSizeBinary(UA_SecureConversationMessageAbortBody const * ptr) {
  423. if(ptr==UA_NULL) return sizeof(UA_SecureConversationMessageAbortBody);
  424. return 0
  425. + sizeof(UA_UInt32) // error
  426. + UA_String_calcSizeBinary(&ptr->reason)
  427. ;
  428. }
  429. UA_Int32 UA_SecureConversationMessageAbortBody_encodeBinary(UA_SecureConversationMessageAbortBody const * src, UA_ByteString* dst, UA_UInt32 *offset) {
  430. UA_Int32 retval = UA_SUCCESS;
  431. retval |= UA_UInt32_encodeBinary(&src->error,dst,offset);
  432. retval |= UA_String_encodeBinary(&src->reason,dst,offset);
  433. return retval;
  434. }
  435. UA_Int32 UA_SecureConversationMessageAbortBody_decodeBinary(UA_ByteString const * src, UA_UInt32 *offset, UA_SecureConversationMessageAbortBody * dst) {
  436. UA_Int32 retval = UA_SUCCESS;
  437. UA_SecureConversationMessageAbortBody_init(dst);
  438. CHECKED_DECODE(UA_UInt32_decodeBinary(src,offset,&dst->error), UA_SecureConversationMessageAbortBody_deleteMembers(dst));
  439. CHECKED_DECODE(UA_String_decodeBinary(src,offset,&dst->reason), UA_SecureConversationMessageAbortBody_deleteMembers(dst));
  440. return retval;
  441. }
  442. UA_Int32 UA_SecureConversationMessageAbortBody_delete(UA_SecureConversationMessageAbortBody *p) {
  443. UA_Int32 retval = UA_SUCCESS;
  444. retval |= UA_SecureConversationMessageAbortBody_deleteMembers(p);
  445. retval |= UA_free(p);
  446. return retval;
  447. }
  448. UA_Int32 UA_SecureConversationMessageAbortBody_deleteMembers(UA_SecureConversationMessageAbortBody *p) {
  449. UA_Int32 retval = UA_SUCCESS;
  450. retval |= UA_String_deleteMembers(&p->reason);
  451. return retval;
  452. }
  453. UA_Int32 UA_SecureConversationMessageAbortBody_init(UA_SecureConversationMessageAbortBody *p) {
  454. UA_Int32 retval = UA_SUCCESS;
  455. retval |= UA_UInt32_init(&p->error);
  456. retval |= UA_String_init(&p->reason);
  457. return retval;
  458. }
  459. UA_TYPE_NEW_DEFAULT(UA_SecureConversationMessageAbortBody)
  460. UA_Int32 UA_SecureConversationMessageAbortBody_copy(const UA_SecureConversationMessageAbortBody *src,UA_SecureConversationMessageAbortBody *dst) {
  461. UA_Int32 retval = UA_SUCCESS;
  462. if(src == UA_NULL || dst == UA_NULL) return UA_ERROR;
  463. memcpy(dst, src, sizeof(UA_SecureConversationMessageAbortBody));
  464. retval |= UA_String_copy(&src->reason,&dst->reason);
  465. return retval;
  466. }