ua_transport.c 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464
  1. #include "ua_transport.h"
  2. #include "stdio.h"
  3. UA_Int32 UA_MessageType_calcSize(UA_MessageType const * ptr){
  4. if(ptr==UA_NULL){return sizeof(UA_MessageType);}
  5. return 0
  6. + 3 * sizeof(UA_Byte);
  7. }
  8. UA_Int32 UA_MessageType_encodeBinary(UA_MessageType const * src, UA_Int32* pos, UA_ByteString* dst){
  9. UA_Int32 retval = UA_SUCCESS;
  10. UA_Byte tmpBuf[3];
  11. tmpBuf[0] = (UA_Byte)((((UA_Int32)*src) >> 16) );
  12. tmpBuf[1] = (UA_Byte)((((UA_Int32)*src) >> 8));
  13. tmpBuf[2] = (UA_Byte)(((UA_Int32)*src));
  14. retval |= UA_Byte_encodeBinary(&(tmpBuf[0]),pos,dst);
  15. retval |= UA_Byte_encodeBinary(&(tmpBuf[1]),pos,dst);
  16. retval |= UA_Byte_encodeBinary(&(tmpBuf[2]),pos,dst);
  17. return retval;
  18. }
  19. UA_Int32 UA_MessageType_decodeBinary(UA_ByteString const * src, UA_Int32* pos, UA_MessageType* dst){
  20. UA_Int32 retval = UA_SUCCESS;
  21. UA_Byte tmpBuf[3];
  22. retval |= UA_Byte_decodeBinary(src,pos,&(tmpBuf[0])); //messageType to Byte representation
  23. retval |= UA_Byte_decodeBinary(src,pos,&(tmpBuf[1]));
  24. retval |= UA_Byte_decodeBinary(src,pos,&(tmpBuf[2]));
  25. *dst = (UA_MessageType)((UA_Int32)(tmpBuf[0]<<16) + (UA_Int32)(tmpBuf[1]<<8) + (UA_Int32)(tmpBuf[2]));
  26. return retval;
  27. }
  28. UA_TYPE_METHOD_DELETE_FREE(UA_MessageType)
  29. UA_TYPE_METHOD_DELETEMEMBERS_NOACTION(UA_MessageType)
  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_calcSize(UA_OPCUATcpMessageHeader const * ptr) {
  35. if(ptr==UA_NULL){return sizeof(UA_OPCUATcpMessageHeader);}
  36. return 0
  37. + UA_MessageType_calcSize(&(ptr->messageType)) // messageType
  38. + sizeof(UA_Byte) // isFinal
  39. + sizeof(UA_UInt32) // messageSize
  40. ;
  41. }
  42. UA_Int32 UA_OPCUATcpMessageHeader_encodeBinary(UA_OPCUATcpMessageHeader const * src, UA_Int32* pos, UA_ByteString* dst) {
  43. UA_Int32 retval = UA_SUCCESS;
  44. retval |= UA_MessageType_encodeBinary(&(src->messageType),pos,dst);
  45. retval |= UA_Byte_encodeBinary(&(src->isFinal),pos,dst);
  46. retval |= UA_UInt32_encodeBinary(&(src->messageSize),pos,dst);
  47. return retval;
  48. }
  49. UA_Int32 UA_OPCUATcpMessageHeader_decodeBinary(UA_ByteString const * src, UA_Int32* pos, UA_OPCUATcpMessageHeader* dst) {
  50. UA_Int32 retval = UA_SUCCESS;
  51. UA_OPCUATcpMessageHeader_init(dst);
  52. CHECKED_DECODE(UA_MessageType_decodeBinary(src,pos,&(dst->messageType)), UA_OPCUATcpMessageHeader_deleteMembers(dst));
  53. CHECKED_DECODE(UA_Byte_decodeBinary(src,pos,&(dst->isFinal)), UA_OPCUATcpMessageHeader_deleteMembers(dst));
  54. CHECKED_DECODE(UA_UInt32_decodeBinary(src,pos,&(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_METHOD_NEW_DEFAULT(UA_OPCUATcpMessageHeader)
  74. UA_Int32 UA_OPCUATcpHelloMessage_calcSize(UA_OPCUATcpHelloMessage const * ptr) {
  75. if(ptr==UA_NULL){return sizeof(UA_OPCUATcpHelloMessage);}
  76. return 0
  77. + sizeof(UA_UInt32) // protocolVersion
  78. + sizeof(UA_UInt32) // receiveBufferSize
  79. + sizeof(UA_UInt32) // sendBufferSize
  80. + sizeof(UA_UInt32) // maxMessageSize
  81. + sizeof(UA_UInt32) // maxChunkCount
  82. + UA_String_calcSize(&(ptr->endpointUrl))
  83. ;
  84. }
  85. UA_Int32 UA_OPCUATcpHelloMessage_encodeBinary(UA_OPCUATcpHelloMessage const * src, UA_Int32* pos, UA_ByteString* dst) {
  86. UA_Int32 retval = UA_SUCCESS;
  87. retval |= UA_UInt32_encodeBinary(&(src->protocolVersion),pos,dst);
  88. retval |= UA_UInt32_encodeBinary(&(src->receiveBufferSize),pos,dst);
  89. retval |= UA_UInt32_encodeBinary(&(src->sendBufferSize),pos,dst);
  90. retval |= UA_UInt32_encodeBinary(&(src->maxMessageSize),pos,dst);
  91. retval |= UA_UInt32_encodeBinary(&(src->maxChunkCount),pos,dst);
  92. retval |= UA_String_encodeBinary(&(src->endpointUrl),pos,dst);
  93. return retval;
  94. }
  95. UA_Int32 UA_OPCUATcpHelloMessage_decodeBinary(UA_ByteString const * src, UA_Int32* pos, UA_OPCUATcpHelloMessage* dst) {
  96. UA_Int32 retval = UA_SUCCESS;
  97. UA_OPCUATcpHelloMessage_init(dst);
  98. CHECKED_DECODE(UA_UInt32_decodeBinary(src,pos,&(dst->protocolVersion)), UA_OPCUATcpHelloMessage_deleteMembers(dst));
  99. CHECKED_DECODE(UA_UInt32_decodeBinary(src,pos,&(dst->receiveBufferSize)), UA_OPCUATcpHelloMessage_deleteMembers(dst));
  100. CHECKED_DECODE(UA_UInt32_decodeBinary(src,pos,&(dst->sendBufferSize)), UA_OPCUATcpHelloMessage_deleteMembers(dst));
  101. CHECKED_DECODE(UA_UInt32_decodeBinary(src,pos,&(dst->maxMessageSize)), UA_OPCUATcpHelloMessage_deleteMembers(dst));
  102. CHECKED_DECODE(UA_UInt32_decodeBinary(src,pos,&(dst->maxChunkCount)), UA_OPCUATcpHelloMessage_deleteMembers(dst));
  103. CHECKED_DECODE(UA_String_decodeBinary(src,pos,&(dst->endpointUrl)), UA_OPCUATcpHelloMessage_deleteMembers(dst));
  104. return retval;
  105. }
  106. UA_Int32 UA_OPCUATcpHelloMessage_delete(UA_OPCUATcpHelloMessage* p) {
  107. UA_Int32 retval = UA_SUCCESS;
  108. retval |= UA_OPCUATcpHelloMessage_deleteMembers(p);
  109. retval |= UA_free(p);
  110. return retval;
  111. }
  112. UA_Int32 UA_OPCUATcpHelloMessage_deleteMembers(UA_OPCUATcpHelloMessage* p) {
  113. UA_Int32 retval = UA_SUCCESS;
  114. retval |= UA_String_deleteMembers(&(p->endpointUrl));
  115. return retval;
  116. }
  117. UA_Int32 UA_OPCUATcpHelloMessage_init(UA_OPCUATcpHelloMessage * p) {
  118. UA_Int32 retval = UA_SUCCESS;
  119. retval |= UA_UInt32_init(&(p->protocolVersion));
  120. retval |= UA_UInt32_init(&(p->receiveBufferSize));
  121. retval |= UA_UInt32_init(&(p->sendBufferSize));
  122. retval |= UA_UInt32_init(&(p->maxMessageSize));
  123. retval |= UA_UInt32_init(&(p->maxChunkCount));
  124. retval |= UA_String_init(&(p->endpointUrl));
  125. return retval;
  126. }
  127. UA_TYPE_METHOD_NEW_DEFAULT(UA_OPCUATcpHelloMessage)
  128. UA_Int32 UA_OPCUATcpAcknowledgeMessage_calcSize(UA_OPCUATcpAcknowledgeMessage const * ptr) {
  129. if(ptr==UA_NULL){return sizeof(UA_OPCUATcpAcknowledgeMessage);}
  130. return 0
  131. + sizeof(UA_UInt32) // protocolVersion
  132. + sizeof(UA_UInt32) // receiveBufferSize
  133. + sizeof(UA_UInt32) // sendBufferSize
  134. + sizeof(UA_UInt32) // maxMessageSize
  135. + sizeof(UA_UInt32) // maxChunkCount
  136. ;
  137. }
  138. UA_Int32 UA_OPCUATcpAcknowledgeMessage_encodeBinary(UA_OPCUATcpAcknowledgeMessage const * src, UA_Int32* pos, UA_ByteString* dst) {
  139. UA_Int32 retval = UA_SUCCESS;
  140. retval |= UA_UInt32_encodeBinary(&(src->protocolVersion),pos,dst);
  141. retval |= UA_UInt32_encodeBinary(&(src->receiveBufferSize),pos,dst);
  142. retval |= UA_UInt32_encodeBinary(&(src->sendBufferSize),pos,dst);
  143. retval |= UA_UInt32_encodeBinary(&(src->maxMessageSize),pos,dst);
  144. retval |= UA_UInt32_encodeBinary(&(src->maxChunkCount),pos,dst);
  145. return retval;
  146. }
  147. UA_Int32 UA_OPCUATcpAcknowledgeMessage_decodeBinary(UA_ByteString const * src, UA_Int32* pos, UA_OPCUATcpAcknowledgeMessage* dst) {
  148. UA_Int32 retval = UA_SUCCESS;
  149. UA_OPCUATcpAcknowledgeMessage_init(dst);
  150. CHECKED_DECODE(UA_UInt32_decodeBinary(src,pos,&(dst->protocolVersion)), UA_OPCUATcpAcknowledgeMessage_deleteMembers(dst));
  151. CHECKED_DECODE(UA_UInt32_decodeBinary(src,pos,&(dst->receiveBufferSize)), UA_OPCUATcpAcknowledgeMessage_deleteMembers(dst));
  152. CHECKED_DECODE(UA_UInt32_decodeBinary(src,pos,&(dst->sendBufferSize)), UA_OPCUATcpAcknowledgeMessage_deleteMembers(dst));
  153. CHECKED_DECODE(UA_UInt32_decodeBinary(src,pos,&(dst->maxMessageSize)), UA_OPCUATcpAcknowledgeMessage_deleteMembers(dst));
  154. CHECKED_DECODE(UA_UInt32_decodeBinary(src,pos,&(dst->maxChunkCount)), UA_OPCUATcpAcknowledgeMessage_deleteMembers(dst));
  155. return retval;
  156. }
  157. UA_Int32 UA_OPCUATcpAcknowledgeMessage_delete(UA_OPCUATcpAcknowledgeMessage* p) {
  158. UA_Int32 retval = UA_SUCCESS;
  159. retval |= UA_OPCUATcpAcknowledgeMessage_deleteMembers(p);
  160. retval |= UA_free(p);
  161. return retval;
  162. }
  163. UA_Int32 UA_OPCUATcpAcknowledgeMessage_deleteMembers(UA_OPCUATcpAcknowledgeMessage* p) {
  164. UA_Int32 retval = UA_SUCCESS;
  165. return retval;
  166. }
  167. UA_Int32 UA_OPCUATcpAcknowledgeMessage_init(UA_OPCUATcpAcknowledgeMessage * p) {
  168. UA_Int32 retval = UA_SUCCESS;
  169. retval |= UA_UInt32_init(&(p->protocolVersion));
  170. retval |= UA_UInt32_init(&(p->receiveBufferSize));
  171. retval |= UA_UInt32_init(&(p->sendBufferSize));
  172. retval |= UA_UInt32_init(&(p->maxMessageSize));
  173. retval |= UA_UInt32_init(&(p->maxChunkCount));
  174. return retval;
  175. }
  176. UA_TYPE_METHOD_NEW_DEFAULT(UA_OPCUATcpAcknowledgeMessage)
  177. UA_Int32 UA_SecureConversationMessageHeader_calcSize(UA_SecureConversationMessageHeader const * ptr) {
  178. if(ptr==UA_NULL){return sizeof(UA_SecureConversationMessageHeader);}
  179. return 0
  180. // + UA_OPCUATcpMessageHeader_calcSize(&(ptr->messageHeader))
  181. + sizeof(UA_UInt32) // secureChannelId
  182. ;
  183. }
  184. UA_Int32 UA_SecureConversationMessageHeader_encodeBinary(UA_SecureConversationMessageHeader const * src, UA_Int32* pos, UA_ByteString* dst) {
  185. UA_Int32 retval = UA_SUCCESS;
  186. // retval |= UA_OPCUATcpMessageHeader_encodeBinary(&(src->messageHeader),pos,dst);
  187. retval |= UA_UInt32_encodeBinary(&(src->secureChannelId),pos,dst);
  188. return retval;
  189. }
  190. UA_Int32 UA_SecureConversationMessageHeader_decodeBinary(UA_ByteString const * src, UA_Int32* pos, UA_SecureConversationMessageHeader* dst) {
  191. UA_Int32 retval = UA_SUCCESS;
  192. UA_SecureConversationMessageHeader_init(dst);
  193. // CHECKED_DECODE(UA_OPCUATcpMessageHeader_decodeBinary(src,pos,&(dst->messageHeader)), UA_SecureConversationMessageHeader_deleteMembers(dst));
  194. CHECKED_DECODE(UA_UInt32_decodeBinary(src,pos,&(dst->secureChannelId)), UA_SecureConversationMessageHeader_deleteMembers(dst));
  195. return retval;
  196. }
  197. UA_Int32 UA_SecureConversationMessageHeader_delete(UA_SecureConversationMessageHeader* p) {
  198. UA_Int32 retval = UA_SUCCESS;
  199. retval |= UA_SecureConversationMessageHeader_deleteMembers(p);
  200. retval |= UA_free(p);
  201. return retval;
  202. }
  203. UA_Int32 UA_SecureConversationMessageHeader_deleteMembers(UA_SecureConversationMessageHeader* p) {
  204. UA_Int32 retval = UA_SUCCESS;
  205. // retval |= UA_OPCUATcpMessageHeader_deleteMembers(&(p->messageHeader));
  206. return retval;
  207. }
  208. UA_Int32 UA_SecureConversationMessageHeader_init(UA_SecureConversationMessageHeader * p) {
  209. UA_Int32 retval = UA_SUCCESS;
  210. // retval |= UA_OPCUATcpMessageHeader_init(&(p->messageHeader));
  211. retval |= UA_UInt32_init(&(p->secureChannelId));
  212. return retval;
  213. }
  214. UA_TYPE_METHOD_NEW_DEFAULT(UA_SecureConversationMessageHeader)
  215. UA_Int32 UA_AsymmetricAlgorithmSecurityHeader_calcSize(UA_AsymmetricAlgorithmSecurityHeader const * ptr) {
  216. if(ptr==UA_NULL){return sizeof(UA_AsymmetricAlgorithmSecurityHeader);}
  217. return 0
  218. + UA_ByteString_calcSize(&(ptr->securityPolicyUri))
  219. + UA_ByteString_calcSize(&(ptr->senderCertificate))
  220. + UA_ByteString_calcSize(&(ptr->receiverCertificateThumbprint))
  221. // + sizeof(UA_UInt32) // requestId
  222. ;
  223. }
  224. UA_Int32 UA_AsymmetricAlgorithmSecurityHeader_encodeBinary(UA_AsymmetricAlgorithmSecurityHeader const * src, UA_Int32* pos, UA_ByteString* dst) {
  225. UA_Int32 retval = UA_SUCCESS;
  226. retval |= UA_ByteString_encodeBinary(&(src->securityPolicyUri),pos,dst);
  227. retval |= UA_ByteString_encodeBinary(&(src->senderCertificate),pos,dst);
  228. retval |= UA_ByteString_encodeBinary(&(src->receiverCertificateThumbprint),pos,dst);
  229. // retval |= UA_UInt32_encodeBinary(&(src->requestId),pos,dst);
  230. return retval;
  231. }
  232. UA_Int32 UA_AsymmetricAlgorithmSecurityHeader_decodeBinary(UA_ByteString const * src, UA_Int32* pos, UA_AsymmetricAlgorithmSecurityHeader* dst) {
  233. UA_Int32 retval = UA_SUCCESS;
  234. UA_AsymmetricAlgorithmSecurityHeader_init(dst);
  235. CHECKED_DECODE(UA_ByteString_decodeBinary(src,pos,&(dst->securityPolicyUri)), UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(dst));
  236. CHECKED_DECODE(UA_ByteString_decodeBinary(src,pos,&(dst->senderCertificate)), UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(dst));
  237. CHECKED_DECODE(UA_ByteString_decodeBinary(src,pos,&(dst->receiverCertificateThumbprint)), UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(dst));
  238. // CHECKED_DECODE(UA_UInt32_decodeBinary(src,pos,&(dst->requestId)), UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(dst));
  239. return retval;
  240. }
  241. UA_Int32 UA_AsymmetricAlgorithmSecurityHeader_delete(UA_AsymmetricAlgorithmSecurityHeader* p) {
  242. UA_Int32 retval = UA_SUCCESS;
  243. retval |= UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(p);
  244. retval |= UA_free(p);
  245. return retval;
  246. }
  247. UA_Int32 UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(UA_AsymmetricAlgorithmSecurityHeader* p) {
  248. UA_Int32 retval = UA_SUCCESS;
  249. retval |= UA_ByteString_deleteMembers(&(p->securityPolicyUri));
  250. retval |= UA_ByteString_deleteMembers(&(p->senderCertificate));
  251. retval |= UA_ByteString_deleteMembers(&(p->receiverCertificateThumbprint));
  252. return retval;
  253. }
  254. UA_Int32 UA_AsymmetricAlgorithmSecurityHeader_init(UA_AsymmetricAlgorithmSecurityHeader * p) {
  255. UA_Int32 retval = UA_SUCCESS;
  256. retval |= UA_ByteString_init(&(p->securityPolicyUri));
  257. retval |= UA_ByteString_init(&(p->senderCertificate));
  258. retval |= UA_ByteString_init(&(p->receiverCertificateThumbprint));
  259. // retval |= UA_UInt32_init(&(p->requestId));
  260. return retval;
  261. }
  262. UA_TYPE_METHOD_NEW_DEFAULT(UA_AsymmetricAlgorithmSecurityHeader)
  263. UA_Int32 UA_SymmetricAlgorithmSecurityHeader_calcSize(UA_SymmetricAlgorithmSecurityHeader const * ptr) {
  264. if(ptr==UA_NULL){return sizeof(UA_SymmetricAlgorithmSecurityHeader);}
  265. return 0
  266. + sizeof(UA_UInt32) // tokenId
  267. ;
  268. }
  269. UA_Int32 UA_SymmetricAlgorithmSecurityHeader_encodeBinary(UA_SymmetricAlgorithmSecurityHeader const * src, UA_Int32* pos, UA_ByteString* dst) {
  270. UA_Int32 retval = UA_SUCCESS;
  271. retval |= UA_UInt32_encodeBinary(&(src->tokenId),pos,dst);
  272. return retval;
  273. }
  274. UA_Int32 UA_SymmetricAlgorithmSecurityHeader_decodeBinary(UA_ByteString const * src, UA_Int32* pos, UA_SymmetricAlgorithmSecurityHeader* dst) {
  275. UA_Int32 retval = UA_SUCCESS;
  276. UA_SymmetricAlgorithmSecurityHeader_init(dst);
  277. CHECKED_DECODE(UA_UInt32_decodeBinary(src,pos,&(dst->tokenId)), UA_SymmetricAlgorithmSecurityHeader_deleteMembers(dst));
  278. return retval;
  279. }
  280. UA_Int32 UA_SymmetricAlgorithmSecurityHeader_delete(UA_SymmetricAlgorithmSecurityHeader* p) {
  281. UA_Int32 retval = UA_SUCCESS;
  282. retval |= UA_SymmetricAlgorithmSecurityHeader_deleteMembers(p);
  283. retval |= UA_free(p);
  284. return retval;
  285. }
  286. UA_Int32 UA_SymmetricAlgorithmSecurityHeader_deleteMembers(UA_SymmetricAlgorithmSecurityHeader* p) {
  287. UA_Int32 retval = UA_SUCCESS;
  288. return retval;
  289. }
  290. UA_Int32 UA_SymmetricAlgorithmSecurityHeader_init(UA_SymmetricAlgorithmSecurityHeader * p) {
  291. UA_Int32 retval = UA_SUCCESS;
  292. retval |= UA_UInt32_init(&(p->tokenId));
  293. return retval;
  294. }
  295. UA_TYPE_METHOD_NEW_DEFAULT(UA_SymmetricAlgorithmSecurityHeader)
  296. UA_Int32 UA_SequenceHeader_calcSize(UA_SequenceHeader const * ptr) {
  297. if(ptr==UA_NULL){return sizeof(UA_SequenceHeader);}
  298. return 0
  299. + sizeof(UA_UInt32) // sequenceNumber
  300. + sizeof(UA_UInt32) // requestId
  301. ;
  302. }
  303. UA_Int32 UA_SequenceHeader_encodeBinary(UA_SequenceHeader const * src, UA_Int32* pos, UA_ByteString* dst) {
  304. UA_Int32 retval = UA_SUCCESS;
  305. retval |= UA_UInt32_encodeBinary(&(src->sequenceNumber),pos,dst);
  306. retval |= UA_UInt32_encodeBinary(&(src->requestId),pos,dst);
  307. return retval;
  308. }
  309. UA_Int32 UA_SequenceHeader_decodeBinary(UA_ByteString const * src, UA_Int32* pos, UA_SequenceHeader* dst) {
  310. UA_Int32 retval = UA_SUCCESS;
  311. UA_SequenceHeader_init(dst);
  312. CHECKED_DECODE(UA_UInt32_decodeBinary(src,pos,&(dst->sequenceNumber)), UA_SequenceHeader_deleteMembers(dst));
  313. CHECKED_DECODE(UA_UInt32_decodeBinary(src,pos,&(dst->requestId)), UA_SequenceHeader_deleteMembers(dst));
  314. return retval;
  315. }
  316. UA_Int32 UA_SequenceHeader_delete(UA_SequenceHeader* p) {
  317. UA_Int32 retval = UA_SUCCESS;
  318. retval |= UA_SequenceHeader_deleteMembers(p);
  319. retval |= UA_free(p);
  320. return retval;
  321. }
  322. UA_Int32 UA_SequenceHeader_deleteMembers(UA_SequenceHeader* p) {
  323. UA_Int32 retval = UA_SUCCESS;
  324. return retval;
  325. }
  326. UA_Int32 UA_SequenceHeader_init(UA_SequenceHeader * p) {
  327. UA_Int32 retval = UA_SUCCESS;
  328. retval |= UA_UInt32_init(&(p->sequenceNumber));
  329. retval |= UA_UInt32_init(&(p->requestId));
  330. return retval;
  331. }
  332. UA_TYPE_METHOD_NEW_DEFAULT(UA_SequenceHeader)
  333. UA_Int32 UA_SecureConversationMessageFooter_calcSize(UA_SecureConversationMessageFooter const * ptr) {
  334. if(ptr==UA_NULL){return sizeof(UA_SecureConversationMessageFooter);}
  335. return 0
  336. + 0 //paddingSize is included in UA_Array_calcSize
  337. + UA_Array_calcSize(ptr->paddingSize, UA_BYTE, (void const**) ptr->padding)
  338. + sizeof(UA_Byte) // signature
  339. ;
  340. }
  341. UA_Int32 UA_SecureConversationMessageFooter_encodeBinary(UA_SecureConversationMessageFooter const * src, UA_Int32* pos, UA_ByteString* dst) {
  342. UA_Int32 retval = UA_SUCCESS;
  343. //retval |= UA_Int32_encodeBinary(&(src->paddingSize),pos,dst); // encode size managed by UA_Array_encodeBinary
  344. retval |= UA_Array_encodeBinary((void const**) (src->padding),src->paddingSize, UA_BYTE,pos,dst);
  345. retval |= UA_Byte_encodeBinary(&(src->signature),pos,dst);
  346. return retval;
  347. }
  348. UA_Int32 UA_SecureConversationMessageFooter_decodeBinary(UA_ByteString const * src, UA_Int32* pos, UA_SecureConversationMessageFooter* dst) {
  349. UA_Int32 retval = UA_SUCCESS;
  350. UA_SecureConversationMessageFooter_init(dst);
  351. CHECKED_DECODE(UA_Int32_decodeBinary(src,pos,&(dst->paddingSize)), UA_SecureConversationMessageFooter_deleteMembers(dst)); // decode size
  352. CHECKED_DECODE(UA_Array_new((void***)&dst->padding, dst->paddingSize, UA_BYTE), dst->padding = UA_NULL; UA_SecureConversationMessageFooter_deleteMembers(dst));
  353. CHECKED_DECODE(UA_Array_decodeBinary(src,dst->paddingSize, UA_BYTE,pos,(void *** const) (&dst->padding)), UA_SecureConversationMessageFooter_deleteMembers(dst));
  354. CHECKED_DECODE(UA_Byte_decodeBinary(src,pos,&(dst->signature)), UA_SecureConversationMessageFooter_deleteMembers(dst));
  355. return retval;
  356. }
  357. UA_Int32 UA_SecureConversationMessageFooter_delete(UA_SecureConversationMessageFooter* p) {
  358. UA_Int32 retval = UA_SUCCESS;
  359. retval |= UA_SecureConversationMessageFooter_deleteMembers(p);
  360. retval |= UA_free(p);
  361. return retval;
  362. }
  363. UA_Int32 UA_SecureConversationMessageFooter_deleteMembers(UA_SecureConversationMessageFooter* p) {
  364. UA_Int32 retval = UA_SUCCESS;
  365. retval |= UA_Array_delete((void***)&p->padding,p->paddingSize,UA_BYTE); p->padding = UA_NULL;
  366. return retval;
  367. }
  368. UA_Int32 UA_SecureConversationMessageFooter_init(UA_SecureConversationMessageFooter * p) {
  369. UA_Int32 retval = UA_SUCCESS;
  370. p->paddingSize=0;
  371. p->padding=UA_NULL;
  372. retval |= UA_Byte_init(&(p->signature));
  373. return retval;
  374. }
  375. UA_TYPE_METHOD_NEW_DEFAULT(UA_SecureConversationMessageFooter)
  376. UA_Int32 UA_SecureConversationMessageAbortBody_calcSize(UA_SecureConversationMessageAbortBody const * ptr) {
  377. if(ptr==UA_NULL){return sizeof(UA_SecureConversationMessageAbortBody);}
  378. return 0
  379. + sizeof(UA_UInt32) // error
  380. + UA_String_calcSize(&(ptr->reason))
  381. ;
  382. }
  383. UA_Int32 UA_SecureConversationMessageAbortBody_encodeBinary(UA_SecureConversationMessageAbortBody const * src, UA_Int32* pos, UA_ByteString* dst) {
  384. UA_Int32 retval = UA_SUCCESS;
  385. retval |= UA_UInt32_encodeBinary(&(src->error),pos,dst);
  386. retval |= UA_String_encodeBinary(&(src->reason),pos,dst);
  387. return retval;
  388. }
  389. UA_Int32 UA_SecureConversationMessageAbortBody_decodeBinary(UA_ByteString const * src, UA_Int32* pos, UA_SecureConversationMessageAbortBody* dst) {
  390. UA_Int32 retval = UA_SUCCESS;
  391. UA_SecureConversationMessageAbortBody_init(dst);
  392. CHECKED_DECODE(UA_UInt32_decodeBinary(src,pos,&(dst->error)), UA_SecureConversationMessageAbortBody_deleteMembers(dst));
  393. CHECKED_DECODE(UA_String_decodeBinary(src,pos,&(dst->reason)), UA_SecureConversationMessageAbortBody_deleteMembers(dst));
  394. return retval;
  395. }
  396. UA_Int32 UA_SecureConversationMessageAbortBody_delete(UA_SecureConversationMessageAbortBody* p) {
  397. UA_Int32 retval = UA_SUCCESS;
  398. retval |= UA_SecureConversationMessageAbortBody_deleteMembers(p);
  399. retval |= UA_free(p);
  400. return retval;
  401. }
  402. UA_Int32 UA_SecureConversationMessageAbortBody_deleteMembers(UA_SecureConversationMessageAbortBody* p) {
  403. UA_Int32 retval = UA_SUCCESS;
  404. retval |= UA_String_deleteMembers(&(p->reason));
  405. return retval;
  406. }
  407. UA_Int32 UA_SecureConversationMessageAbortBody_init(UA_SecureConversationMessageAbortBody * p) {
  408. UA_Int32 retval = UA_SUCCESS;
  409. retval |= UA_UInt32_init(&(p->error));
  410. retval |= UA_String_init(&(p->reason));
  411. return retval;
  412. }
  413. UA_TYPE_METHOD_NEW_DEFAULT(UA_SecureConversationMessageAbortBody)