check_stack.c 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include "ua_types.h"
  4. #include "ua_transport.h"
  5. #include "ua_transport_binary.h"
  6. #include "ua_transport_binary_secure.h"
  7. #include "ua_transport_connection.h"
  8. #include "ua_channel_manager.h"
  9. #include "ua_session_manager.h"
  10. #include "check.h"
  11. #define MAXMSG 512
  12. #define BUFFER_SIZE 8192
  13. /** @brief this structure holds all the information for the stack test fixture */
  14. typedef struct stackTestFixture {
  15. /** @brief the actual buffer to receive the response msg */
  16. UA_Byte respMsgBuffer[BUFFER_SIZE];
  17. /** @brief the management structure (initialized to point to respMsgBuffer in create */
  18. UA_ByteString respMsg;
  19. /** @brief the management data structure for the fake connection */
  20. UA_TL_Connection *connection;
  21. } stackTestFixture;
  22. /** @brief the maximum number of parallel fixtures.
  23. * ( MAX_FIXTURES needs to match the number of bytes of fixturesMap )*/
  24. #define MAX_FIXTURES 32
  25. /** @brief this map marks the slots in fixtures as free (bit=0) or in use (bit=1) */
  26. UA_Int32 fixturesMap = 0;
  27. /** @brief the array of pointers to the fixtures */
  28. stackTestFixture *fixtures[MAX_FIXTURES];
  29. /** @brief search first free handle, set and return */
  30. UA_Int32 stackTestFixture_getAndMarkFreeHandle() {
  31. UA_Int32 freeFixtureHandle = 0;
  32. for(freeFixtureHandle = 0;freeFixtureHandle < MAX_FIXTURES;++freeFixtureHandle) {
  33. if(!(fixturesMap & (1 << freeFixtureHandle))) { // when free
  34. fixturesMap |= (1 << freeFixtureHandle); // then set
  35. return freeFixtureHandle;
  36. }
  37. }
  38. return UA_ERR_NO_MEMORY;
  39. }
  40. /** @brief clear bit in fixture map */
  41. UA_Int32 stackTestFixture_markHandleAsFree(UA_Int32 fixtureHandle) {
  42. if(fixtureHandle >= 0 && fixtureHandle < MAX_FIXTURES) {
  43. fixturesMap &= ~(1 << fixtureHandle); // clear bit
  44. return UA_SUCCESS;
  45. }
  46. return UA_ERR_INVALID_VALUE;
  47. }
  48. UA_Int32 closerCallback(UA_TL_Connection *connection)
  49. {
  50. return UA_SUCCESS;
  51. }
  52. /** @brief get a handle to a free slot and create a new stackTestFixture */
  53. UA_Int32 stackTestFixture_create(TL_Writer writerCallback, TL_Closer closerCallback) {
  54. UA_String endpointUrl;
  55. UA_String_copycstring("no url",&endpointUrl);
  56. SL_ChannelManager_init(4,36000,25,22,&endpointUrl);
  57. UA_SessionManager_init(4,220000,222);
  58. UA_UInt32 fixtureHandle = stackTestFixture_getAndMarkFreeHandle();
  59. if(fixtureHandle < MAX_FIXTURES) {
  60. UA_alloc((void **)&fixtures[fixtureHandle], sizeof(stackTestFixture));
  61. stackTestFixture *fixture = fixtures[fixtureHandle];
  62. fixture->respMsg.data = fixture->respMsgBuffer;
  63. fixture->respMsg.length = 0;
  64. TL_Buffer buffer;
  65. buffer.maxChunkCount = 1;
  66. buffer.maxMessageSize = BUFFER_SIZE;
  67. buffer.protocolVersion = 0;
  68. buffer.recvBufferSize = BUFFER_SIZE;
  69. buffer.recvBufferSize = BUFFER_SIZE;
  70. UA_TL_Connection_new(&fixture->connection,buffer,writerCallback,closerCallback,fixtureHandle,UA_NULL);
  71. }
  72. return fixtureHandle;
  73. }
  74. /** @brief free the allocated memory of the stackTestFixture associated with the handle */
  75. UA_Int32 stackTestFixture_delete(UA_UInt32 fixtureHandle) {
  76. if(fixtureHandle < MAX_FIXTURES) {
  77. UA_free(fixtures[fixtureHandle]);
  78. stackTestFixture_markHandleAsFree(fixtureHandle);
  79. return UA_SUCCESS;
  80. }
  81. return UA_ERR_INVALID_VALUE;
  82. }
  83. /** @brief return the fixture associated with the handle */
  84. stackTestFixture *stackTestFixture_getFixture(UA_UInt32 fixtureHandle) {
  85. if(fixtureHandle < MAX_FIXTURES && ( fixturesMap & (1 << fixtureHandle)))
  86. return fixtures[fixtureHandle];
  87. return UA_NULL;
  88. }
  89. /** @brief write message provided in the gather buffers to the buffer of the fixture */
  90. UA_Int32 responseMsg(UA_Int32 connectionHandle, UA_ByteString const **gather_buf, UA_Int32 gather_len) {
  91. stackTestFixture *fixture = stackTestFixture_getFixture(connectionHandle);
  92. UA_Int32 retval = UA_SUCCESS;
  93. UA_UInt32 total_len = 0;
  94. for(UA_Int32 i = 0;i < gather_len && retval == UA_SUCCESS;++i) {
  95. if(total_len + gather_buf[i]->length < BUFFER_SIZE) {
  96. memcpy(&(fixture->respMsg.data[total_len]), gather_buf[i]->data, gather_buf[i]->length);
  97. total_len += gather_buf[i]->length;
  98. } else
  99. retval = UA_ERR_NO_MEMORY;
  100. }
  101. fixture->respMsg.length = total_len;
  102. return UA_SUCCESS;
  103. }
  104. void indicateMsg(UA_Int32 handle, UA_ByteString *slMessage) {
  105. printf("indicate: %d", TL_Process((stackTestFixture_getFixture(handle)->connection), slMessage));
  106. }
  107. UA_Byte pkt_HEL[] = {
  108. 0x48, 0x45, 0x4c, 0x46, 0x39, 0x00, /* HELF9. */
  109. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ........ */
  110. 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, /* ........ */
  111. 0x00, 0x01, 0x88, 0x13, 0x00, 0x00, 0x19, 0x00, /* ........ */
  112. 0x00, 0x00, 0x6f, 0x70, 0x63, 0x2e, 0x74, 0x63, /* ..opc.tc */
  113. 0x70, 0x3a, 0x2f, 0x2f, 0x31, 0x30, 0x2e, 0x30, /* p://10.0 */
  114. 0x2e, 0x35, 0x34, 0x2e, 0x37, 0x37, 0x3a, 0x34, /* .54.77:4 */
  115. 0x38, 0x34, 0x32 /* 842 */
  116. };
  117. UA_Byte pkt_OPN[] = {
  118. 0x4f, 0x50, 0x4e, 0x46, 0x85, 0x00, /* OPNF.. */
  119. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2f, 0x00, /* ....../. */
  120. 0x00, 0x00, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, /* ..http:/ */
  121. 0x2f, 0x6f, 0x70, 0x63, 0x66, 0x6f, 0x75, 0x6e, /* /opcfoun */
  122. 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x6f, /* dation.o */
  123. 0x72, 0x67, 0x2f, 0x55, 0x41, 0x2f, 0x53, 0x65, /* rg/UA/Se */
  124. 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x50, 0x6f, /* curityPo */
  125. 0x6c, 0x69, 0x63, 0x79, 0x23, 0x4e, 0x6f, 0x6e, /* licy#Non */
  126. 0x65, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* e....... */
  127. 0xff, 0x33, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, /* .3...... */
  128. 0x00, 0x01, 0x00, 0xbe, 0x01, 0x00, 0x00, 0x40, /* .......@ */
  129. 0xaf, 0xfc, 0xe8, 0xa1, 0x76, 0xcf, 0x01, 0x00, /* ....v... */
  130. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, /* ........ */
  131. 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, /* ........ */
  132. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ........ */
  133. 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, /* ........ */
  134. 0x00, 0x00, 0x00, 0x80, 0xee, 0x36, 0x00 /* .....6. */
  135. };
  136. UA_Byte pkt_CLO[] = {
  137. 0x43, 0x4c, 0x4f, 0x46, 0x39, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, /* CLOF9........... */ /*19 here assusmes channelid=25 ! */
  138. 0xea, 0x00, 0x00, 0x00, 0xb8, 0x00, 0x00, 0x00, 0x01, 0x00, 0xc4, 0x01, 0x00, 0x00, 0x4d, 0x65, /* ..............Me */
  139. 0x16, 0x3b, 0x47, 0x99, 0xcf, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, /* .;G............. */
  140. 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 /* ......... */
  141. };
  142. UA_Byte pkt_MSG_CreateSession[] = {
  143. 0x4d, 0x53, 0x47, 0x46, 0xb4, 0x05, 0x00, 0x00, /* MSGF.... */
  144. 0x19, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, /* QQ...... // assumes fixed secureChannelID=25 ! */
  145. 0x34, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, /* 4....... */
  146. 0x01, 0x00, 0xcd, 0x01, 0x00, 0x00, 0x50, 0xd6, /* ......P. */
  147. 0xfc, 0xe8, 0xa1, 0x76, 0xcf, 0x01, 0x01, 0x00, /* ...v.... */
  148. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, /* ........ */
  149. 0xff, 0xff, 0x10, 0x27, 0x00, 0x00, 0x00, 0x00, /* ...'.... */
  150. 0x00, 0x2d, 0x00, 0x00, 0x00, 0x75, 0x72, 0x6e, /* .-...urn */
  151. 0x3a, 0x6d, 0x72, 0x74, 0x2d, 0x56, 0x69, 0x72, /* :mrt-Vir */
  152. 0x74, 0x75, 0x61, 0x6c, 0x42, 0x6f, 0x78, 0x3a, /* tualBox: */
  153. 0x55, 0x6e, 0x69, 0x66, 0x69, 0x65, 0x64, 0x41, /* UnifiedA */
  154. 0x75, 0x74, 0x6f, 0x6d, 0x61, 0x74, 0x69, 0x6f, /* utomatio */
  155. 0x6e, 0x3a, 0x55, 0x61, 0x45, 0x78, 0x70, 0x65, /* n:UaExpe */
  156. 0x72, 0x74, 0x1e, 0x00, 0x00, 0x00, 0x75, 0x72, /* rt....ur */
  157. 0x6e, 0x3a, 0x55, 0x6e, 0x69, 0x66, 0x69, 0x65, /* n:Unifie */
  158. 0x64, 0x41, 0x75, 0x74, 0x6f, 0x6d, 0x61, 0x74, /* dAutomat */
  159. 0x69, 0x6f, 0x6e, 0x3a, 0x55, 0x61, 0x45, 0x78, /* ion:UaEx */
  160. 0x70, 0x65, 0x72, 0x74, 0x02, 0x1b, 0x00, 0x00, /* pert.... */
  161. 0x00, 0x55, 0x6e, 0x69, 0x66, 0x69, 0x65, 0x64, /* .Unified */
  162. 0x20, 0x41, 0x75, 0x74, 0x6f, 0x6d, 0x61, 0x74, /* Automat */
  163. 0x69, 0x6f, 0x6e, 0x20, 0x55, 0x61, 0x45, 0x78, /* ion UaEx */
  164. 0x70, 0x65, 0x72, 0x74, 0x01, 0x00, 0x00, 0x00, /* pert.... */
  165. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* ........ */
  166. 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, /* ........ */
  167. 0x19, 0x00, 0x00, 0x00, 0x6f, 0x70, 0x63, 0x2e, /* ....opc. */
  168. 0x74, 0x63, 0x70, 0x3a, 0x2f, 0x2f, 0x31, 0x30, /* tcp://10 */
  169. 0x2e, 0x30, 0x2e, 0x35, 0x34, 0x2e, 0x37, 0x37, /* .0.54.77 */
  170. 0x3a, 0x34, 0x38, 0x34, 0x32, 0x2d, 0x00, 0x00, /* :4842-.. */
  171. 0x00, 0x75, 0x72, 0x6e, 0x3a, 0x6d, 0x72, 0x74, /* .urn:mrt */
  172. 0x2d, 0x56, 0x69, 0x72, 0x74, 0x75, 0x61, 0x6c, /* -Virtual */
  173. 0x42, 0x6f, 0x78, 0x3a, 0x55, 0x6e, 0x69, 0x66, /* Box:Unif */
  174. 0x69, 0x65, 0x64, 0x41, 0x75, 0x74, 0x6f, 0x6d, /* iedAutom */
  175. 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x55, 0x61, /* ation:Ua */
  176. 0x45, 0x78, 0x70, 0x65, 0x72, 0x74, 0x20, 0x00, /* Expert . */
  177. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ........ */
  178. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ........ */
  179. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ........ */
  180. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ........ */
  181. 0x00, 0x00, 0x72, 0x04, 0x00, 0x00, 0x30, 0x82, /* ..r...0. */
  182. 0x04, 0x6e, 0x30, 0x82, 0x03, 0xd7, 0xa0, 0x03, /* .n0..... */
  183. 0x02, 0x01, 0x02, 0x02, 0x04, 0x53, 0x1b, 0x10, /* .....S.. */
  184. 0x9f, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, /* .0...*.H */
  185. 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, /* ........ */
  186. 0x30, 0x81, 0x93, 0x31, 0x0b, 0x30, 0x09, 0x06, /* 0..1.0.. */
  187. 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x44, 0x45, /* .U....DE */
  188. 0x31, 0x11, 0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, /* 1.0...U. */
  189. 0x08, 0x13, 0x08, 0x41, 0x6e, 0x79, 0x77, 0x68, /* ...Anywh */
  190. 0x65, 0x72, 0x65, 0x31, 0x11, 0x30, 0x0f, 0x06, /* ere1.0.. */
  191. 0x03, 0x55, 0x04, 0x07, 0x13, 0x08, 0x41, 0x6e, /* .U....An */
  192. 0x79, 0x77, 0x68, 0x65, 0x72, 0x65, 0x31, 0x13, /* ywhere1. */
  193. 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, /* 0...U... */
  194. 0x0a, 0x54, 0x55, 0x20, 0x44, 0x72, 0x65, 0x73, /* .TU Dres */
  195. 0x64, 0x65, 0x6e, 0x31, 0x36, 0x30, 0x34, 0x06, /* den1604. */
  196. 0x03, 0x55, 0x04, 0x0b, 0x13, 0x2d, 0x43, 0x68, /* .U...-Ch */
  197. 0x61, 0x69, 0x72, 0x20, 0x66, 0x6f, 0x72, 0x20, /* air for */
  198. 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x20, /* Process */
  199. 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x20, /* Control */
  200. 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x73, 0x20, /* Systems */
  201. 0x45, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x65, 0x72, /* Engineer */
  202. 0x69, 0x6e, 0x67, 0x31, 0x11, 0x30, 0x0f, 0x06, /* ing1.0.. */
  203. 0x03, 0x55, 0x04, 0x03, 0x13, 0x08, 0x55, 0x61, /* .U....Ua */
  204. 0x45, 0x78, 0x70, 0x65, 0x72, 0x74, 0x30, 0x1e, /* Expert0. */
  205. 0x17, 0x0d, 0x31, 0x34, 0x30, 0x33, 0x30, 0x38, /* ..140308 */
  206. 0x31, 0x32, 0x34, 0x34, 0x31, 0x35, 0x5a, 0x17, /* 124415Z. */
  207. 0x0d, 0x31, 0x34, 0x30, 0x33, 0x30, 0x38, 0x31, /* .1403081 */
  208. 0x33, 0x34, 0x34, 0x31, 0x35, 0x5a, 0x30, 0x81, /* 34415Z0. */
  209. 0x93, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, /* .1.0...U */
  210. 0x04, 0x06, 0x13, 0x02, 0x44, 0x45, 0x31, 0x11, /* ....DE1. */
  211. 0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, /* 0...U... */
  212. 0x08, 0x41, 0x6e, 0x79, 0x77, 0x68, 0x65, 0x72, /* .Anywher */
  213. 0x65, 0x31, 0x11, 0x30, 0x0f, 0x06, 0x03, 0x55, /* e1.0...U */
  214. 0x04, 0x07, 0x13, 0x08, 0x41, 0x6e, 0x79, 0x77, /* ....Anyw */
  215. 0x68, 0x65, 0x72, 0x65, 0x31, 0x13, 0x30, 0x11, /* here1.0. */
  216. 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x0a, 0x54, /* ..U....T */
  217. 0x55, 0x20, 0x44, 0x72, 0x65, 0x73, 0x64, 0x65, /* U Dresde */
  218. 0x6e, 0x31, 0x36, 0x30, 0x34, 0x06, 0x03, 0x55, /* n1604..U */
  219. 0x04, 0x0b, 0x13, 0x2d, 0x43, 0x68, 0x61, 0x69, /* ...-Chai */
  220. 0x72, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x50, 0x72, /* r for Pr */
  221. 0x6f, 0x63, 0x65, 0x73, 0x73, 0x20, 0x43, 0x6f, /* ocess Co */
  222. 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x20, 0x53, 0x79, /* ntrol Sy */
  223. 0x73, 0x74, 0x65, 0x6d, 0x73, 0x20, 0x45, 0x6e, /* stems En */
  224. 0x67, 0x69, 0x6e, 0x65, 0x65, 0x72, 0x69, 0x6e, /* gineerin */
  225. 0x67, 0x31, 0x11, 0x30, 0x0f, 0x06, 0x03, 0x55, /* g1.0...U */
  226. 0x04, 0x03, 0x13, 0x08, 0x55, 0x61, 0x45, 0x78, /* ....UaEx */
  227. 0x70, 0x65, 0x72, 0x74, 0x30, 0x81, 0x9f, 0x30, /* pert0..0 */
  228. 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, /* ...*.H.. */
  229. 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x81, /* ........ */
  230. 0x8d, 0x00, 0x30, 0x81, 0x89, 0x02, 0x81, 0x81, /* ..0..... */
  231. 0x00, 0xb3, 0xb3, 0xc9, 0x97, 0xb7, 0x4f, 0x6d, /* ......Om */
  232. 0x6f, 0x72, 0x48, 0xe2, 0x5f, 0x8c, 0x89, 0x0f, /* orH._... */
  233. 0xc3, 0x47, 0x17, 0x4c, 0xd2, 0x8c, 0x2a, 0x85, /* .G.L..*. */
  234. 0xf6, 0x80, 0xb1, 0x9e, 0xf4, 0x90, 0xff, 0x0f, /* ........ */
  235. 0xff, 0x42, 0x74, 0x75, 0xcd, 0xd5, 0xe0, 0x8f, /* .Btu.... */
  236. 0x7f, 0xa1, 0x41, 0x86, 0x83, 0xcf, 0x2c, 0xef, /* ..A...,. */
  237. 0xbd, 0xb7, 0xbf, 0x50, 0xa9, 0x5c, 0xfa, 0x39, /* ...P.\.9 */
  238. 0x84, 0xbb, 0x7e, 0xc9, 0x7e, 0x5b, 0xc8, 0x1b, /* ..~.~[.. */
  239. 0x19, 0xfc, 0x31, 0x05, 0xa9, 0x0c, 0x31, 0x3c, /* ..1...1< */
  240. 0x1a, 0x86, 0x50, 0x17, 0x45, 0x0a, 0xfd, 0xfe, /* ..P.E... */
  241. 0xa0, 0xc4, 0x88, 0x93, 0xff, 0x1c, 0xf3, 0x60, /* .......` */
  242. 0x06, 0xc6, 0xdf, 0x7c, 0xc6, 0xcd, 0x95, 0x7d, /* ...|...} */
  243. 0xf8, 0x3b, 0x7a, 0x53, 0x15, 0xbb, 0x2e, 0xcf, /* .;zS.... */
  244. 0xd1, 0x63, 0xae, 0x5a, 0x30, 0x48, 0x67, 0x5f, /* .c.Z0Hg_ */
  245. 0xa8, 0x30, 0x7f, 0x35, 0xe4, 0x43, 0x94, 0xa3, /* .0.5.C.. */
  246. 0xc1, 0xfe, 0x69, 0xcd, 0x5c, 0xd7, 0x88, 0xc0, /* ..i.\... */
  247. 0xa5, 0x02, 0x03, 0x01, 0x00, 0x01, 0xa3, 0x82, /* ........ */
  248. 0x01, 0xcb, 0x30, 0x82, 0x01, 0xc7, 0x30, 0x0c, /* ..0...0. */
  249. 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff, /* ..U..... */
  250. 0x04, 0x02, 0x30, 0x00, 0x30, 0x50, 0x06, 0x09, /* ..0.0P.. */
  251. 0x60, 0x86, 0x48, 0x01, 0x86, 0xf8, 0x42, 0x01, /* `.H...B. */
  252. 0x0d, 0x04, 0x43, 0x16, 0x41, 0x22, 0x47, 0x65, /* ..C.A"Ge */
  253. 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x20, /* nerated */
  254. 0x77, 0x69, 0x74, 0x68, 0x20, 0x55, 0x6e, 0x69, /* with Uni */
  255. 0x66, 0x69, 0x65, 0x64, 0x20, 0x41, 0x75, 0x74, /* fied Aut */
  256. 0x6f, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, /* omation */
  257. 0x55, 0x41, 0x20, 0x42, 0x61, 0x73, 0x65, 0x20, /* UA Base */
  258. 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x20, /* Library */
  259. 0x75, 0x73, 0x69, 0x6e, 0x67, 0x20, 0x4f, 0x70, /* using Op */
  260. 0x65, 0x6e, 0x53, 0x53, 0x4c, 0x22, 0x30, 0x1d, /* enSSL"0. */
  261. 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16, 0x04, /* ..U..... */
  262. 0x14, 0x37, 0x39, 0x34, 0x93, 0xa2, 0x65, 0xef, /* .794..e. */
  263. 0xb9, 0xd4, 0x71, 0x21, 0x4b, 0x77, 0xdb, 0x28, /* ..q!Kw.( */
  264. 0xc8, 0xfa, 0x03, 0xfe, 0x05, 0x30, 0x81, 0xc3, /* .....0.. */
  265. 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, 0x81, 0xbb, /* ..U.#... */
  266. 0x30, 0x81, 0xb8, 0x80, 0x14, 0x37, 0x39, 0x34, /* 0....794 */
  267. 0x93, 0xa2, 0x65, 0xef, 0xb9, 0xd4, 0x71, 0x21, /* ..e...q! */
  268. 0x4b, 0x77, 0xdb, 0x28, 0xc8, 0xfa, 0x03, 0xfe, /* Kw.(.... */
  269. 0x05, 0xa1, 0x81, 0x99, 0xa4, 0x81, 0x96, 0x30, /* .......0 */
  270. 0x81, 0x93, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, /* ..1.0... */
  271. 0x55, 0x04, 0x06, 0x13, 0x02, 0x44, 0x45, 0x31, /* U....DE1 */
  272. 0x11, 0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, 0x08, /* .0...U.. */
  273. 0x13, 0x08, 0x41, 0x6e, 0x79, 0x77, 0x68, 0x65, /* ..Anywhe */
  274. 0x72, 0x65, 0x31, 0x11, 0x30, 0x0f, 0x06, 0x03, /* re1.0... */
  275. 0x55, 0x04, 0x07, 0x13, 0x08, 0x41, 0x6e, 0x79, /* U....Any */
  276. 0x77, 0x68, 0x65, 0x72, 0x65, 0x31, 0x13, 0x30, /* where1.0 */
  277. 0x11, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x0a, /* ...U.... */
  278. 0x54, 0x55, 0x20, 0x44, 0x72, 0x65, 0x73, 0x64, /* TU Dresd */
  279. 0x65, 0x6e, 0x31, 0x36, 0x30, 0x34, 0x06, 0x03, /* en1604.. */
  280. 0x55, 0x04, 0x0b, 0x13, 0x2d, 0x43, 0x68, 0x61, /* U...-Cha */
  281. 0x69, 0x72, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x50, /* ir for P */
  282. 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x20, 0x43, /* rocess C */
  283. 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x20, 0x53, /* ontrol S */
  284. 0x79, 0x73, 0x74, 0x65, 0x6d, 0x73, 0x20, 0x45, /* ystems E */
  285. 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x65, 0x72, 0x69, /* ngineeri */
  286. 0x6e, 0x67, 0x31, 0x11, 0x30, 0x0f, 0x06, 0x03, /* ng1.0... */
  287. 0x55, 0x04, 0x03, 0x13, 0x08, 0x55, 0x61, 0x45, /* U....UaE */
  288. 0x78, 0x70, 0x65, 0x72, 0x74, 0x82, 0x04, 0x53, /* xpert..S */
  289. 0x1b, 0x10, 0x9f, 0x30, 0x0e, 0x06, 0x03, 0x55, /* ...0...U */
  290. 0x1d, 0x0f, 0x01, 0x01, 0xff, 0x04, 0x04, 0x03, /* ........ */
  291. 0x02, 0x02, 0xf4, 0x30, 0x20, 0x06, 0x03, 0x55, /* ...0 ..U */
  292. 0x1d, 0x25, 0x01, 0x01, 0xff, 0x04, 0x16, 0x30, /* .%.....0 */
  293. 0x14, 0x06, 0x08, 0x2b, 0x06, 0x01, 0x05, 0x05, /* ...+.... */
  294. 0x07, 0x03, 0x01, 0x06, 0x08, 0x2b, 0x06, 0x01, /* .....+.. */
  295. 0x05, 0x05, 0x07, 0x03, 0x02, 0x30, 0x4e, 0x06, /* .....0N. */
  296. 0x03, 0x55, 0x1d, 0x11, 0x04, 0x47, 0x30, 0x45, /* .U...G0E */
  297. 0x86, 0x2d, 0x75, 0x72, 0x6e, 0x3a, 0x6d, 0x72, /* .-urn:mr */
  298. 0x74, 0x2d, 0x56, 0x69, 0x72, 0x74, 0x75, 0x61, /* t-Virtua */
  299. 0x6c, 0x42, 0x6f, 0x78, 0x3a, 0x55, 0x6e, 0x69, /* lBox:Uni */
  300. 0x66, 0x69, 0x65, 0x64, 0x41, 0x75, 0x74, 0x6f, /* fiedAuto */
  301. 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x55, /* mation:U */
  302. 0x61, 0x45, 0x78, 0x70, 0x65, 0x72, 0x74, 0x82, /* aExpert. */
  303. 0x0e, 0x6d, 0x72, 0x74, 0x2d, 0x56, 0x69, 0x72, /* .mrt-Vir */
  304. 0x74, 0x75, 0x61, 0x6c, 0x42, 0x6f, 0x78, 0x87, /* tualBox. */
  305. 0x04, 0xc0, 0xa8, 0x02, 0x73, 0x30, 0x0d, 0x06, /* ....s0.. */
  306. 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, /* .*.H.... */
  307. 0x01, 0x05, 0x05, 0x00, 0x03, 0x81, 0x81, 0x00, /* ........ */
  308. 0x77, 0x2c, 0x9c, 0x23, 0x60, 0x13, 0x3f, 0xa5, /* w,.#`.?. */
  309. 0xc8, 0xb3, 0x20, 0x27, 0x64, 0xda, 0x7f, 0xaa, /* .. 'd... */
  310. 0xc5, 0x86, 0xfa, 0xd7, 0x24, 0x2e, 0xbe, 0xa0, /* ....$... */
  311. 0xfc, 0x49, 0x8f, 0xc0, 0xef, 0xfb, 0x9a, 0xe6, /* .I...... */
  312. 0x50, 0xe6, 0xb3, 0x53, 0x91, 0x91, 0x89, 0xd3, /* P..S.... */
  313. 0x5a, 0xa5, 0xc9, 0x9c, 0xf6, 0x7b, 0x8f, 0x93, /* Z....{.. */
  314. 0xb4, 0x98, 0xc3, 0x92, 0x26, 0x49, 0x8a, 0x96, /* ....&I.. */
  315. 0x6e, 0x8f, 0xf5, 0x93, 0x48, 0x90, 0x9e, 0x7e, /* n...H..~ */
  316. 0x1d, 0xad, 0x63, 0xbb, 0x5e, 0x1c, 0x0c, 0x86, /* ..c.^... */
  317. 0x2d, 0xce, 0xe2, 0xe1, 0x87, 0x8d, 0x4c, 0x4b, /* -.....LK */
  318. 0x89, 0x24, 0x77, 0xff, 0x62, 0x95, 0xf7, 0xec, /* .$w.b... */
  319. 0x16, 0x7c, 0x8a, 0x1e, 0x4d, 0x89, 0xcb, 0x3d, /* .|..M..= */
  320. 0xc8, 0xc0, 0x7c, 0x12, 0x5a, 0x29, 0xf2, 0xe7, /* ..|.Z).. */
  321. 0x68, 0xf9, 0xb9, 0x85, 0xe5, 0xc0, 0x46, 0xac, /* h.....F. */
  322. 0x89, 0xdb, 0xd0, 0x87, 0xaa, 0xa1, 0x7a, 0x73, /* ......zs */
  323. 0x71, 0xcc, 0x8e, 0x01, 0x80, 0xf3, 0x07, 0x70, /* q......p */
  324. 0x00, 0x00, 0x00, 0x00, 0x80, 0x4f, 0x32, 0x41, /* .....O2A */
  325. 0xff, 0xff, 0xff, 0xff /* .... */
  326. };
  327. START_TEST(emptyIndicationShallYieldNoResponse) {
  328. // given
  329. UA_Int32 handle = stackTestFixture_create(responseMsg, closerCallback);
  330. UA_ByteString message = { -1, (UA_Byte *)UA_NULL };
  331. // when
  332. indicateMsg(handle, &message);
  333. // then
  334. ck_assert_int_eq(stackTestFixture_getFixture(handle)->respMsg.length, 0);
  335. // finally
  336. stackTestFixture_delete(handle);
  337. }
  338. END_TEST
  339. START_TEST(validHELIndicationShallYieldACKResponse) {
  340. // given
  341. UA_Int32 handle = stackTestFixture_create(responseMsg, closerCallback);
  342. UA_ByteString message_001 = { sizeof(pkt_HEL), pkt_HEL };
  343. // when
  344. indicateMsg(handle, &message_001);
  345. // then
  346. ck_assert_int_eq(stackTestFixture_getFixture(handle)->respMsg.length, 28);
  347. ck_assert_int_eq(stackTestFixture_getFixture(handle)->respMsg.data[0], 'A');
  348. ck_assert_int_eq(stackTestFixture_getFixture(handle)->respMsg.data[1], 'C');
  349. ck_assert_int_eq(stackTestFixture_getFixture(handle)->respMsg.data[2], 'K');
  350. // finally
  351. stackTestFixture_delete(handle);
  352. }
  353. END_TEST
  354. START_TEST(validOpeningSequenceShallCreateChannel) {
  355. // given
  356. UA_Int32 handle = stackTestFixture_create(responseMsg,closerCallback);
  357. UA_ByteString message_001 = { sizeof(pkt_HEL), pkt_HEL };
  358. UA_ByteString message_002 = { sizeof(pkt_OPN), pkt_OPN };
  359. UA_Int32 connectionState;
  360. // when
  361. indicateMsg(handle, &message_001);
  362. indicateMsg(handle, &message_002);
  363. UA_TL_Connection_getState(stackTestFixture_getFixture(handle)->connection, &connectionState);
  364. // then
  365. ck_assert_int_eq(stackTestFixture_getFixture(handle)->respMsg.data[0], 'O');
  366. ck_assert_int_eq(stackTestFixture_getFixture(handle)->respMsg.data[1], 'P');
  367. ck_assert_int_eq(stackTestFixture_getFixture(handle)->respMsg.data[2], 'N');
  368. ck_assert_int_eq(connectionState, CONNECTIONSTATE_ESTABLISHED);
  369. // finally
  370. stackTestFixture_delete(handle);
  371. }
  372. END_TEST
  373. START_TEST(validOpeningCloseSequence) {
  374. // given
  375. UA_Int32 handle = stackTestFixture_create(responseMsg,closerCallback);
  376. UA_ByteString message_001 = { sizeof(pkt_HEL), pkt_HEL };
  377. UA_ByteString message_002 = { sizeof(pkt_OPN), pkt_OPN };
  378. UA_ByteString message_003 = { sizeof(pkt_CLO), pkt_CLO };
  379. UA_Int32 connectionState;
  380. // when
  381. indicateMsg(handle, &message_001);
  382. indicateMsg(handle, &message_002);
  383. indicateMsg(handle, &message_003);
  384. UA_TL_Connection_getState(stackTestFixture_getFixture(handle)->connection, &connectionState);
  385. // then
  386. ck_assert_int_eq(connectionState, CONNECTIONSTATE_CLOSE);
  387. // finally
  388. stackTestFixture_delete(handle);
  389. }
  390. END_TEST
  391. START_TEST(validCreateSessionShallCreateSession) {
  392. // given
  393. UA_Int32 handle = stackTestFixture_create(responseMsg,closerCallback);
  394. SL_Channel *channel;
  395. UA_ByteString message_001 = { sizeof(pkt_HEL), pkt_HEL };
  396. UA_ByteString message_002 = { sizeof(pkt_OPN), pkt_OPN };
  397. UA_ByteString message_003 = { sizeof(pkt_MSG_CreateSession), pkt_MSG_CreateSession };
  398. // when
  399. indicateMsg(handle, &message_001);
  400. indicateMsg(handle, &message_002);
  401. indicateMsg(handle, &message_003);
  402. // then
  403. ck_assert_int_eq(stackTestFixture_getFixture(handle)->respMsg.data[0], 'M');
  404. ck_assert_int_eq(stackTestFixture_getFixture(handle)->respMsg.data[1], 'S');
  405. ck_assert_int_eq(stackTestFixture_getFixture(handle)->respMsg.data[2], 'G');
  406. SL_ChannelManager_getChannel(25,&channel);
  407. ck_assert_ptr_ne(channel,UA_NULL);
  408. // finally
  409. SL_ChannelManager_removeChannel(25);
  410. stackTestFixture_delete(handle);
  411. }
  412. END_TEST
  413. START_TEST(UA_OPCUATcpMessageHeader_copyShallWorkOnInputExample) {
  414. // given
  415. UA_OPCUATcpMessageHeader src;
  416. UA_OPCUATcpMessageHeader_init(&src);
  417. src.isFinal = 2;
  418. src.messageSize = 43;
  419. src.messageType = UA_MESSAGETYPE_MSG;
  420. const UA_OPCUATcpMessageHeader srcConst = src;
  421. UA_OPCUATcpMessageHeader dst;
  422. UA_Int32 ret;
  423. // when
  424. ret = UA_OPCUATcpMessageHeader_copy(&srcConst, &dst);
  425. // then
  426. ck_assert_int_eq(ret, UA_SUCCESS);
  427. ck_assert_int_eq(UA_MESSAGETYPE_MSG, dst.messageType);
  428. ck_assert_int_eq(43, dst.messageSize);
  429. ck_assert_int_eq(2, dst.isFinal);
  430. }
  431. END_TEST
  432. START_TEST(UA_AsymmetricAlgorithmSecurityHeader_copyShallWorkOnInputExample) {
  433. // given
  434. UA_AsymmetricAlgorithmSecurityHeader src;
  435. UA_AsymmetricAlgorithmSecurityHeader_init(&src);
  436. src.receiverCertificateThumbprint = (UA_String){10, (UA_Byte*)"thumbprint"};
  437. src.securityPolicyUri = (UA_String){6, (UA_Byte*)"policy"};
  438. src.senderCertificate = (UA_String){8, (UA_Byte*)"tEsT123!"};
  439. const UA_AsymmetricAlgorithmSecurityHeader srcConst = src;
  440. UA_AsymmetricAlgorithmSecurityHeader dst;
  441. UA_Int32 ret;
  442. // when
  443. ret = UA_AsymmetricAlgorithmSecurityHeader_copy(&srcConst, &dst);
  444. // then
  445. ck_assert_int_eq(ret, UA_SUCCESS);
  446. ck_assert_int_eq('m', dst.receiverCertificateThumbprint.data[3]);
  447. ck_assert_int_eq(10, dst.receiverCertificateThumbprint.length);
  448. ck_assert_int_eq('o', dst.securityPolicyUri.data[1]);
  449. ck_assert_int_eq(6, dst.securityPolicyUri.length);
  450. ck_assert_int_eq('t', dst.senderCertificate.data[0]);
  451. ck_assert_int_eq(8, dst.senderCertificate.length);
  452. }
  453. END_TEST
  454. START_TEST(UA_SecureConversationMessageHeader_copyShallWorkOnInputExample) {
  455. // given
  456. UA_SecureConversationMessageHeader src;
  457. UA_SecureConversationMessageHeader_init(&src);
  458. src.secureChannelId = 84;
  459. UA_OPCUATcpMessageHeader srcHeader;
  460. UA_OPCUATcpMessageHeader_init(&srcHeader);
  461. srcHeader.isFinal = 4;
  462. srcHeader.messageSize = 765;
  463. srcHeader.messageType = UA_MESSAGETYPE_CLO;
  464. src.messageHeader = srcHeader;
  465. const UA_SecureConversationMessageHeader srcConst = src;
  466. UA_SecureConversationMessageHeader dst;
  467. UA_Int32 ret;
  468. // when
  469. ret = UA_SecureConversationMessageHeader_copy(&srcConst, &dst);
  470. // then
  471. ck_assert_int_eq(ret, UA_SUCCESS);
  472. ck_assert_int_eq(84, dst.secureChannelId);
  473. ck_assert_int_eq(4, dst.messageHeader.isFinal);
  474. ck_assert_int_eq(765, dst.messageHeader.messageSize);
  475. ck_assert_int_eq(UA_MESSAGETYPE_CLO, dst.messageHeader.messageType);
  476. }
  477. END_TEST
  478. START_TEST(UA_SequenceHeader_copyShallWorkOnInputExample) {
  479. // given
  480. UA_SequenceHeader src;
  481. UA_SequenceHeader_init(&src);
  482. src.requestId = 84;
  483. src.sequenceNumber = 1345;
  484. const UA_SequenceHeader srcConst = src;
  485. UA_SequenceHeader dst;
  486. UA_Int32 ret;
  487. // when
  488. ret = UA_SequenceHeader_copy(&srcConst, &dst);
  489. // then
  490. ck_assert_int_eq(ret, UA_SUCCESS);
  491. ck_assert_int_eq(84, dst.requestId);
  492. ck_assert_int_eq(1345, dst.sequenceNumber);
  493. }
  494. END_TEST
  495. START_TEST(UA_SecureConversationMessageFooter_copyShallWorkOnInputExample) {
  496. // given
  497. UA_SecureConversationMessageFooter src;
  498. UA_SecureConversationMessageFooter_init(&src);
  499. UA_Byte srcByte[3] = {24, 57, 87};
  500. src.padding = srcByte;
  501. src.paddingSize = 3;
  502. src.signature = 5;
  503. const UA_SecureConversationMessageFooter srcConst = src;
  504. UA_SecureConversationMessageFooter dst;
  505. UA_Int32 ret;
  506. // when
  507. ret = UA_SecureConversationMessageFooter_copy(&srcConst, &dst);
  508. // then
  509. ck_assert_int_eq(ret, UA_SUCCESS);
  510. ck_assert_int_eq(5, dst.signature);
  511. ck_assert_int_eq(3, dst.paddingSize);
  512. ck_assert_int_eq(24, dst.padding[0]);
  513. ck_assert_int_eq(57, dst.padding[1]);
  514. ck_assert_int_eq(87, dst.padding[2]);
  515. }
  516. END_TEST
  517. START_TEST(UA_SecureConversationMessageFooter_calcSizeBinaryShallWorkOnInputExample) {
  518. // given
  519. UA_SecureConversationMessageFooter src;
  520. UA_SecureConversationMessageFooter_init(&src);
  521. UA_Byte srcByte[3] = {24, 57, 87};
  522. src.padding = srcByte;
  523. src.paddingSize = 3;
  524. src.signature = 5;
  525. const UA_SecureConversationMessageFooter srcConst = src;
  526. UA_Int32 ret;
  527. // when
  528. ret = UA_SecureConversationMessageFooter_calcSizeBinary(&srcConst);
  529. // then
  530. ck_assert_int_eq(ret, 8);
  531. }
  532. END_TEST
  533. START_TEST(UA_SecureConversationMessageFooter_encodeBinaryShallWorkOnInputExample) {
  534. // // given
  535. // UA_SecureConversationMessageFooter src = {3, (UA_Byte*)"447", 5};;
  536. //
  537. // UA_Int32 ret;
  538. // UA_UInt32 offset = 0;
  539. // UA_ByteString dst = (UA_ByteString){15, (UA_Byte*)"123456789abcdef"};
  540. //
  541. // // when
  542. // ret = UA_SecureConversationMessageFooter_encodeBinary(&src, &dst, &offset);
  543. // // then
  544. // ck_assert_int_eq(ret, UA_SUCCESS);
  545. // ck_assert_int_eq(dst.length, 8);
  546. // ck_assert_int_eq(dst.data[0], 0);
  547. // ck_assert_int_eq(dst.data[1], 0);
  548. // ck_assert_int_eq(dst.data[2], 0);
  549. // ck_assert_int_eq(dst.data[3], 3);
  550. // ck_assert_int_eq(dst.data[4], 24);
  551. // ck_assert_int_eq(dst.data[5], 57);
  552. // ck_assert_int_eq(dst.data[6], 87);
  553. // ck_assert_int_eq(dst.data[7], 6);
  554. }
  555. END_TEST
  556. START_TEST(UA_SecureConversationMessageAbortBody_copyShallWorkOnInputExample) {
  557. // given
  558. UA_SecureConversationMessageAbortBody src;
  559. UA_SecureConversationMessageAbortBody_init(&src);
  560. src.error = 5478;
  561. src.reason = (UA_String){6, (UA_Byte*)"reAson"};
  562. const UA_SecureConversationMessageAbortBody srcConst = src;
  563. UA_SecureConversationMessageAbortBody dst;
  564. UA_Int32 ret;
  565. // when
  566. ret = UA_SecureConversationMessageAbortBody_copy(&srcConst, &dst);
  567. // then
  568. ck_assert_int_eq(ret, UA_SUCCESS);
  569. ck_assert_int_eq(5478, dst.error);
  570. ck_assert_int_eq('A', dst.reason.data[2]);
  571. ck_assert_int_eq(6, dst.reason.length);
  572. }
  573. END_TEST
  574. Suite *testSuite() {
  575. Suite *s = suite_create("Stack Test");
  576. TCase *tc_core = tcase_create("Core");
  577. tcase_add_test(tc_core, emptyIndicationShallYieldNoResponse);
  578. tcase_add_test(tc_core, validHELIndicationShallYieldACKResponse);
  579. tcase_add_test(tc_core, validOpeningSequenceShallCreateChannel);
  580. tcase_add_test(tc_core, validOpeningCloseSequence);
  581. tcase_add_test(tc_core, validCreateSessionShallCreateSession);
  582. suite_add_tcase(s, tc_core);
  583. TCase *tc_transport = tcase_create("Transport");
  584. tcase_add_test(tc_transport, UA_OPCUATcpMessageHeader_copyShallWorkOnInputExample);
  585. tcase_add_test(tc_transport, UA_AsymmetricAlgorithmSecurityHeader_copyShallWorkOnInputExample);
  586. tcase_add_test(tc_transport, UA_SecureConversationMessageHeader_copyShallWorkOnInputExample);
  587. tcase_add_test(tc_transport, UA_SequenceHeader_copyShallWorkOnInputExample);
  588. tcase_add_test(tc_transport, UA_SecureConversationMessageFooter_copyShallWorkOnInputExample);
  589. tcase_add_test(tc_transport, UA_SecureConversationMessageFooter_calcSizeBinaryShallWorkOnInputExample);
  590. tcase_add_test(tc_transport, UA_SecureConversationMessageFooter_encodeBinaryShallWorkOnInputExample);
  591. tcase_add_test(tc_transport, UA_SecureConversationMessageAbortBody_copyShallWorkOnInputExample);
  592. suite_add_tcase(s, tc_transport);
  593. return s;
  594. }
  595. int main(void) {
  596. int number_failed = 0;
  597. Suite *s;
  598. SRunner *sr;
  599. s = testSuite();
  600. sr = srunner_create(s);
  601. srunner_set_fork_status (sr, CK_NOFORK);
  602. srunner_run_all(sr, CK_NOFORK);
  603. //srunner_run_all(sr, CK_NORMAL);
  604. number_failed += srunner_ntests_failed(sr);
  605. srunner_free(sr);
  606. return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
  607. }