server.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425
  1. /* This work is licensed under a Creative Commons CCZero 1.0 Universal License.
  2. * See http://creativecommons.org/publicdomain/zero/1.0/ for more information. */
  3. /* Compile with single file release:
  4. * - single-threaded: gcc -std=c99 server.c open62541.c -o server
  5. * - multi-threaded: gcc -std=c99 server.c open62541.c -o server -lurcu-cds -lurcu -lurcu-common -lpthread */
  6. #ifdef _MSC_VER
  7. #define _CRT_SECURE_NO_WARNINGS //disable fopen deprication warning in msvs
  8. #endif
  9. #ifdef UA_NO_AMALGAMATION
  10. # include <time.h>
  11. # include "ua_types.h"
  12. # include "ua_server.h"
  13. # include "ua_config_standard.h"
  14. # include "ua_network_tcp.h"
  15. # include "ua_log_stdout.h"
  16. #else
  17. # include "open62541.h"
  18. #endif
  19. #include <signal.h>
  20. #include <errno.h> // errno, EINTR
  21. #include <stdio.h>
  22. #include <stdlib.h>
  23. #include <string.h>
  24. #ifdef _MSC_VER
  25. # include <io.h> //access
  26. #else
  27. # include <unistd.h> //access
  28. #endif
  29. #ifdef UA_ENABLE_MULTITHREADING
  30. # ifdef UA_NO_AMALGAMATION
  31. # ifndef __USE_XOPEN2K
  32. # define __USE_XOPEN2K
  33. # endif
  34. # endif
  35. #include <pthread.h>
  36. #endif
  37. UA_Boolean running = 1;
  38. UA_Logger logger = UA_Log_Stdout;
  39. static UA_ByteString loadCertificate(void) {
  40. UA_ByteString certificate = UA_STRING_NULL;
  41. FILE *fp = NULL;
  42. //FIXME: a potiential bug of locating the certificate, we need to get the path from the server's config
  43. fp=fopen("server_cert.der", "rb");
  44. if(!fp) {
  45. errno = 0; // we read errno also from the tcp layer...
  46. return certificate;
  47. }
  48. fseek(fp, 0, SEEK_END);
  49. certificate.length = (size_t)ftell(fp);
  50. certificate.data = malloc(certificate.length*sizeof(UA_Byte));
  51. if(!certificate.data)
  52. return certificate;
  53. fseek(fp, 0, SEEK_SET);
  54. if(fread(certificate.data, sizeof(UA_Byte), certificate.length, fp) < (size_t)certificate.length)
  55. UA_ByteString_deleteMembers(&certificate); // error reading the cert
  56. fclose(fp);
  57. return certificate;
  58. }
  59. static void stopHandler(int sign) {
  60. UA_LOG_INFO(logger, UA_LOGCATEGORY_SERVER, "Received Ctrl-C");
  61. running = 0;
  62. }
  63. /* Datasource Example */
  64. static UA_StatusCode
  65. readTimeData(void *handle, const UA_NodeId nodeId, UA_Boolean sourceTimeStamp,
  66. const UA_NumericRange *range, UA_DataValue *value) {
  67. if(range) {
  68. value->hasStatus = true;
  69. value->status = UA_STATUSCODE_BADINDEXRANGEINVALID;
  70. return UA_STATUSCODE_GOOD;
  71. }
  72. UA_DateTime currentTime = UA_DateTime_now();
  73. UA_Variant_setScalarCopy(&value->value, &currentTime, &UA_TYPES[UA_TYPES_DATETIME]);
  74. value->hasValue = true;
  75. if(sourceTimeStamp) {
  76. value->hasSourceTimestamp = true;
  77. value->sourceTimestamp = currentTime;
  78. }
  79. return UA_STATUSCODE_GOOD;
  80. }
  81. /* Method Node Example */
  82. #ifdef UA_ENABLE_METHODCALLS
  83. static UA_StatusCode
  84. helloWorld(void *methodHandle, const UA_NodeId objectId,
  85. size_t inputSize, const UA_Variant *input,
  86. size_t outputSize, UA_Variant *output) {
  87. /* input is a scalar string (checked by the server) */
  88. UA_String *name = (UA_String*)input[0].data;
  89. UA_String hello = UA_STRING("Hello ");
  90. UA_String greet;
  91. greet.length = hello.length + name->length;
  92. greet.data = malloc(greet.length);
  93. memcpy(greet.data, hello.data, hello.length);
  94. memcpy(greet.data + hello.length, name->data, name->length);
  95. UA_Variant_setScalarCopy(output, &greet, &UA_TYPES[UA_TYPES_STRING]);
  96. UA_String_deleteMembers(&greet);
  97. return UA_STATUSCODE_GOOD;
  98. }
  99. static UA_StatusCode
  100. noargMethod (void *methodHandle, const UA_NodeId objectId,
  101. size_t inputSize, const UA_Variant *input,
  102. size_t outputSize, UA_Variant *output) {
  103. return UA_STATUSCODE_GOOD;
  104. }
  105. static UA_StatusCode
  106. outargMethod (void *methodHandle, const UA_NodeId objectId,
  107. size_t inputSize, const UA_Variant *input,
  108. size_t outputSize, UA_Variant *output) {
  109. UA_Int32 out = 42;
  110. UA_Variant_setScalarCopy(output, &out, &UA_TYPES[UA_TYPES_INT32]);
  111. return UA_STATUSCODE_GOOD;
  112. }
  113. #endif
  114. int main(int argc, char** argv) {
  115. signal(SIGINT, stopHandler); /* catches ctrl-c */
  116. UA_ServerNetworkLayer nl = UA_ServerNetworkLayerTCP(UA_ConnectionConfig_standard, 16664);
  117. UA_ServerConfig config = UA_ServerConfig_standard;
  118. config.networkLayers = &nl;
  119. config.networkLayersSize = 1;
  120. /* load certificate */
  121. config.serverCertificate = loadCertificate();
  122. UA_Server *server = UA_Server_new(config);
  123. /* add a static variable node to the server */
  124. UA_VariableAttributes myVar;
  125. UA_VariableAttributes_init(&myVar);
  126. myVar.description = UA_LOCALIZEDTEXT("en_US", "the answer");
  127. myVar.displayName = UA_LOCALIZEDTEXT("en_US", "the answer");
  128. myVar.accessLevel = UA_ACCESSLEVELMASK_READ | UA_ACCESSLEVELMASK_WRITE;
  129. UA_Int32 myInteger = 42;
  130. UA_Variant_setScalarCopy(&myVar.value, &myInteger, &UA_TYPES[UA_TYPES_INT32]);
  131. const UA_QualifiedName myIntegerName = UA_QUALIFIEDNAME(1, "the answer");
  132. const UA_NodeId myIntegerNodeId = UA_NODEID_STRING(1, "the.answer");
  133. UA_NodeId parentNodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_OBJECTSFOLDER);
  134. UA_NodeId parentReferenceNodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_ORGANIZES);
  135. UA_Server_addVariableNode(server, myIntegerNodeId, parentNodeId, parentReferenceNodeId,
  136. myIntegerName, UA_NODEID_NULL, myVar, NULL, NULL);
  137. UA_Variant_deleteMembers(&myVar.value);
  138. /* add a variable with the datetime data source */
  139. UA_DataSource dateDataSource = (UA_DataSource) {.handle = NULL, .read = readTimeData, .write = NULL};
  140. UA_VariableAttributes v_attr;
  141. UA_VariableAttributes_init(&v_attr);
  142. v_attr.description = UA_LOCALIZEDTEXT("en_US","current time");
  143. v_attr.displayName = UA_LOCALIZEDTEXT("en_US","current time");
  144. v_attr.accessLevel = UA_ACCESSLEVELMASK_READ | UA_ACCESSLEVELMASK_WRITE;
  145. const UA_QualifiedName dateName = UA_QUALIFIEDNAME(1, "current time");
  146. UA_NodeId dataSourceId;
  147. UA_Server_addDataSourceVariableNode(server, UA_NODEID_NULL, UA_NODEID_NUMERIC(0, UA_NS0ID_OBJECTSFOLDER),
  148. UA_NODEID_NUMERIC(0, UA_NS0ID_ORGANIZES), dateName,
  149. UA_NODEID_NULL, v_attr, dateDataSource, &dataSourceId);
  150. /* Add HelloWorld method to the server */
  151. #ifdef UA_ENABLE_METHODCALLS
  152. /* Method with IO Arguments */
  153. UA_Argument inputArguments;
  154. UA_Argument_init(&inputArguments);
  155. inputArguments.dataType = UA_TYPES[UA_TYPES_STRING].typeId;
  156. inputArguments.description = UA_LOCALIZEDTEXT("en_US", "Say your name");
  157. inputArguments.name = UA_STRING("Name");
  158. inputArguments.valueRank = -1; /* scalar argument */
  159. UA_Argument outputArguments;
  160. UA_Argument_init(&outputArguments);
  161. outputArguments.arrayDimensionsSize = 0;
  162. outputArguments.arrayDimensions = NULL;
  163. outputArguments.dataType = UA_TYPES[UA_TYPES_STRING].typeId;
  164. outputArguments.description = UA_LOCALIZEDTEXT("en_US", "Receive a greeting");
  165. outputArguments.name = UA_STRING("greeting");
  166. outputArguments.valueRank = -1;
  167. UA_MethodAttributes addmethodattributes;
  168. UA_MethodAttributes_init(&addmethodattributes);
  169. addmethodattributes.displayName = UA_LOCALIZEDTEXT("en_US", "Hello World");
  170. addmethodattributes.executable = true;
  171. addmethodattributes.userExecutable = true;
  172. UA_Server_addMethodNode(server, UA_NODEID_NUMERIC(1, 62541),
  173. UA_NODEID_NUMERIC(0, UA_NS0ID_OBJECTSFOLDER),
  174. UA_NODEID_NUMERIC(0, UA_NS0ID_HASCOMPONENT),
  175. UA_QUALIFIEDNAME(1, "hello_world"), addmethodattributes,
  176. &helloWorld, /* callback of the method node */
  177. NULL, /* handle passed with the callback */
  178. 1, &inputArguments, 1, &outputArguments, NULL);
  179. #endif
  180. /* Add folders for demo information model */
  181. #define DEMOID 50000
  182. #define SCALARID 50001
  183. #define ARRAYID 50002
  184. #define MATRIXID 50003
  185. #define DEPTHID 50004
  186. UA_ObjectAttributes object_attr;
  187. UA_ObjectAttributes_init(&object_attr);
  188. object_attr.description = UA_LOCALIZEDTEXT("en_US", "Demo");
  189. object_attr.displayName = UA_LOCALIZEDTEXT("en_US", "Demo");
  190. UA_Server_addObjectNode(server, UA_NODEID_NUMERIC(1, DEMOID),
  191. UA_NODEID_NUMERIC(0, UA_NS0ID_OBJECTSFOLDER),
  192. UA_NODEID_NUMERIC(0, UA_NS0ID_ORGANIZES), UA_QUALIFIEDNAME(1, "Demo"),
  193. UA_NODEID_NUMERIC(0, UA_NS0ID_FOLDERTYPE), object_attr, NULL, NULL);
  194. object_attr.description = UA_LOCALIZEDTEXT("en_US", "Scalar");
  195. object_attr.displayName = UA_LOCALIZEDTEXT("en_US", "Scalar");
  196. UA_Server_addObjectNode(server, UA_NODEID_NUMERIC(1, SCALARID),
  197. UA_NODEID_NUMERIC(1, DEMOID), UA_NODEID_NUMERIC(0, UA_NS0ID_ORGANIZES),
  198. UA_QUALIFIEDNAME(1, "Scalar"),
  199. UA_NODEID_NUMERIC(0, UA_NS0ID_FOLDERTYPE), object_attr, NULL, NULL);
  200. object_attr.description = UA_LOCALIZEDTEXT("en_US", "Array");
  201. object_attr.displayName = UA_LOCALIZEDTEXT("en_US", "Array");
  202. UA_Server_addObjectNode(server, UA_NODEID_NUMERIC(1, ARRAYID),
  203. UA_NODEID_NUMERIC(1, DEMOID), UA_NODEID_NUMERIC(0, UA_NS0ID_ORGANIZES),
  204. UA_QUALIFIEDNAME(1, "Array"),
  205. UA_NODEID_NUMERIC(0, UA_NS0ID_FOLDERTYPE), object_attr, NULL, NULL);
  206. object_attr.description = UA_LOCALIZEDTEXT("en_US", "Matrix");
  207. object_attr.displayName = UA_LOCALIZEDTEXT("en_US", "Matrix");
  208. UA_Server_addObjectNode(server, UA_NODEID_NUMERIC(1, MATRIXID), UA_NODEID_NUMERIC(1, DEMOID),
  209. UA_NODEID_NUMERIC(0, UA_NS0ID_ORGANIZES), UA_QUALIFIEDNAME(1, "Matrix"),
  210. UA_NODEID_NUMERIC(0, UA_NS0ID_FOLDERTYPE), object_attr, NULL, NULL);
  211. /* Fill demo nodes for each type*/
  212. UA_UInt32 id = 51000; // running id in namespace 0
  213. for(UA_UInt32 type = 0; type < UA_TYPES_DIAGNOSTICINFO; type++) {
  214. if(type == UA_TYPES_VARIANT || type == UA_TYPES_DIAGNOSTICINFO)
  215. continue;
  216. UA_VariableAttributes attr;
  217. UA_VariableAttributes_init(&attr);
  218. attr.valueRank = -2;
  219. attr.dataType = UA_TYPES[type].typeId;
  220. #ifndef UA_ENABLE_TYPENAMES
  221. char name[15];
  222. #if defined(_WIN32) && !defined(__MINGW32__)
  223. sprintf_s(name, 15, "%02d", type);
  224. #else
  225. sprintf(name, "%02d", type);
  226. #endif
  227. attr.displayName = UA_LOCALIZEDTEXT("en_US", name);
  228. UA_QualifiedName qualifiedName = UA_QUALIFIEDNAME(1, name);
  229. #else
  230. attr.displayName = UA_LOCALIZEDTEXT_ALLOC("en_US", UA_TYPES[type].typeName);
  231. UA_QualifiedName qualifiedName = UA_QUALIFIEDNAME_ALLOC(1, UA_TYPES[type].typeName);
  232. #endif
  233. attr.accessLevel = UA_ACCESSLEVELMASK_READ | UA_ACCESSLEVELMASK_WRITE;
  234. attr.writeMask = UA_WRITEMASK_DISPLAYNAME | UA_WRITEMASK_DESCRIPTION;
  235. attr.userWriteMask = UA_WRITEMASK_DISPLAYNAME | UA_WRITEMASK_DESCRIPTION;
  236. /* add a scalar node for every built-in type */
  237. void *value = UA_new(&UA_TYPES[type]);
  238. UA_Variant_setScalar(&attr.value, value, &UA_TYPES[type]);
  239. UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(1, ++id),
  240. UA_NODEID_NUMERIC(1, SCALARID), UA_NODEID_NUMERIC(0, UA_NS0ID_ORGANIZES),
  241. qualifiedName, UA_NODEID_NULL, attr, NULL, NULL);
  242. UA_Variant_deleteMembers(&attr.value);
  243. /* add an array node for every built-in type */
  244. UA_Variant_setArray(&attr.value, UA_Array_new(10, &UA_TYPES[type]), 10, &UA_TYPES[type]);
  245. UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(1, ++id), UA_NODEID_NUMERIC(1, ARRAYID),
  246. UA_NODEID_NUMERIC(0, UA_NS0ID_ORGANIZES), qualifiedName,
  247. UA_NODEID_NULL, attr, NULL, NULL);
  248. UA_Variant_deleteMembers(&attr.value);
  249. /* add an matrix node for every built-in type */
  250. void* myMultiArray = UA_Array_new(9, &UA_TYPES[type]);
  251. attr.value.arrayDimensions = UA_Array_new(2, &UA_TYPES[UA_TYPES_INT32]);
  252. attr.value.arrayDimensions[0] = 3;
  253. attr.value.arrayDimensions[1] = 3;
  254. attr.value.arrayDimensionsSize = 2;
  255. attr.value.arrayLength = 9;
  256. attr.value.data = myMultiArray;
  257. attr.value.type = &UA_TYPES[type];
  258. UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(1, ++id), UA_NODEID_NUMERIC(1, MATRIXID),
  259. UA_NODEID_NUMERIC(0, UA_NS0ID_ORGANIZES), qualifiedName,
  260. UA_NODEID_NULL, attr, NULL, NULL);
  261. UA_Variant_deleteMembers(&attr.value);
  262. #ifdef UA_ENABLE_TYPENAMES
  263. UA_LocalizedText_deleteMembers(&attr.displayName);
  264. UA_QualifiedName_deleteMembers(&qualifiedName);
  265. #endif
  266. }
  267. /* Hierarchy of depth 10 for CTT testing with forward and inverse references */
  268. /* Enter node "depth 9" in CTT configuration - Project->Settings->Server
  269. Test->NodeIds->Paths->Starting Node 1 */
  270. object_attr.description = UA_LOCALIZEDTEXT("en_US","DepthDemo");
  271. object_attr.displayName = UA_LOCALIZEDTEXT("en_US","DepthDemo");
  272. UA_Server_addObjectNode(server, UA_NODEID_NUMERIC(1, DEPTHID),
  273. UA_NODEID_NUMERIC(1, DEMOID),
  274. UA_NODEID_NUMERIC(0, UA_NS0ID_ORGANIZES), UA_QUALIFIEDNAME(1, "DepthDemo"),
  275. UA_NODEID_NUMERIC(0, UA_NS0ID_FOLDERTYPE), object_attr, NULL, NULL);
  276. id = DEPTHID; // running id in namespace 0 - Start with Matrix NODE
  277. for(UA_UInt32 i = 1; i <= 20; i++) {
  278. char name[15];
  279. #if defined(_WIN32) && !defined(__MINGW32__)
  280. sprintf_s(name, 15, "depth%i", i);
  281. #else
  282. sprintf(name, "depth%i", i);
  283. #endif
  284. object_attr.description = UA_LOCALIZEDTEXT("en_US",name);
  285. object_attr.displayName = UA_LOCALIZEDTEXT("en_US",name);
  286. UA_Server_addObjectNode(server, UA_NODEID_NUMERIC(1, id+i),
  287. UA_NODEID_NUMERIC(1, i==1 ? DEPTHID : id+i-1), UA_NODEID_NUMERIC(0, UA_NS0ID_ORGANIZES),
  288. UA_QUALIFIEDNAME(1, name),
  289. UA_NODEID_NUMERIC(0, UA_NS0ID_FOLDERTYPE), object_attr, NULL, NULL);
  290. }
  291. /* Add the variable to some more places to get a node with three inverse references for the CTT */
  292. UA_ExpandedNodeId answer_nodeid = UA_EXPANDEDNODEID_STRING(1, "the.answer");
  293. UA_Server_addReference(server, UA_NODEID_NUMERIC(1, DEMOID),
  294. UA_NODEID_NUMERIC(0, UA_NS0ID_ORGANIZES), answer_nodeid, true);
  295. UA_Server_addReference(server, UA_NODEID_NUMERIC(1, SCALARID),
  296. UA_NODEID_NUMERIC(0, UA_NS0ID_ORGANIZES), answer_nodeid, true);
  297. /* Example for manually setting an attribute within the server */
  298. UA_LocalizedText objectsName = UA_LOCALIZEDTEXT("en_US", "Objects");
  299. UA_Server_writeDisplayName(server, UA_NODEID_NUMERIC(0, UA_NS0ID_OBJECTSFOLDER), objectsName);
  300. #define NOARGID 60000
  301. #define INARGID 60001
  302. #define OUTARGID 60002
  303. #define INOUTARGID 60003
  304. #ifdef UA_ENABLE_METHODCALLS
  305. /* adding some more method nodes to pass CTT */
  306. /* Method without arguments */
  307. UA_MethodAttributes_init(&addmethodattributes);
  308. addmethodattributes.displayName = UA_LOCALIZEDTEXT("en_US", "noarg");
  309. addmethodattributes.executable = true;
  310. addmethodattributes.userExecutable = true;
  311. UA_Server_addMethodNode(server, UA_NODEID_NUMERIC(1, NOARGID),
  312. UA_NODEID_NUMERIC(1, DEMOID),
  313. UA_NODEID_NUMERIC(0, UA_NS0ID_HASCOMPONENT),
  314. UA_QUALIFIEDNAME(1, "noarg"), addmethodattributes,
  315. &noargMethod, /* callback of the method node */
  316. NULL, /* handle passed with the callback */
  317. 0, NULL, 0, NULL, NULL);
  318. /* Method with in arguments */
  319. UA_MethodAttributes_init(&addmethodattributes);
  320. addmethodattributes.displayName = UA_LOCALIZEDTEXT("en_US", "inarg");
  321. addmethodattributes.executable = true;
  322. addmethodattributes.userExecutable = true;
  323. UA_Argument_init(&inputArguments);
  324. inputArguments.dataType = UA_TYPES[UA_TYPES_INT32].typeId;
  325. inputArguments.description = UA_LOCALIZEDTEXT("en_US", "Input");
  326. inputArguments.name = UA_STRING("Input");
  327. inputArguments.valueRank = -1; //uaexpert will crash if set to 0 ;)
  328. UA_Server_addMethodNode(server, UA_NODEID_NUMERIC(1, INARGID),
  329. UA_NODEID_NUMERIC(1, DEMOID),
  330. UA_NODEID_NUMERIC(0, UA_NS0ID_HASCOMPONENT),
  331. UA_QUALIFIEDNAME(1, "noarg"), addmethodattributes,
  332. &noargMethod, /* callback of the method node */
  333. NULL, /* handle passed with the callback */
  334. 1, &inputArguments, 0, NULL, NULL);
  335. /* Method with out arguments */
  336. UA_MethodAttributes_init(&addmethodattributes);
  337. addmethodattributes.displayName = UA_LOCALIZEDTEXT("en_US", "outarg");
  338. addmethodattributes.executable = true;
  339. addmethodattributes.userExecutable = true;
  340. UA_Argument_init(&outputArguments);
  341. outputArguments.dataType = UA_TYPES[UA_TYPES_INT32].typeId;
  342. outputArguments.description = UA_LOCALIZEDTEXT("en_US", "Output");
  343. outputArguments.name = UA_STRING("Output");
  344. outputArguments.valueRank = -1;
  345. UA_Server_addMethodNode(server, UA_NODEID_NUMERIC(1, OUTARGID),
  346. UA_NODEID_NUMERIC(1, DEMOID),
  347. UA_NODEID_NUMERIC(0, UA_NS0ID_HASCOMPONENT),
  348. UA_QUALIFIEDNAME(1, "outarg"), addmethodattributes,
  349. &outargMethod, /* callback of the method node */
  350. NULL, /* handle passed with the callback */
  351. 0, NULL, 1, &outputArguments, NULL);
  352. /* Method with inout arguments */
  353. UA_MethodAttributes_init(&addmethodattributes);
  354. addmethodattributes.displayName = UA_LOCALIZEDTEXT("en_US", "inoutarg");
  355. addmethodattributes.executable = true;
  356. addmethodattributes.userExecutable = true;
  357. UA_Server_addMethodNode(server, UA_NODEID_NUMERIC(1, INOUTARGID),
  358. UA_NODEID_NUMERIC(1, DEMOID),
  359. UA_NODEID_NUMERIC(0, UA_NS0ID_HASCOMPONENT),
  360. UA_QUALIFIEDNAME(1, "inoutarg"), addmethodattributes,
  361. &outargMethod, /* callback of the method node */
  362. NULL, /* handle passed with the callback */
  363. 1, &inputArguments, 1, &outputArguments, NULL);
  364. #endif
  365. /* run server */
  366. UA_StatusCode retval = UA_Server_run(server, &running); /* run until ctrl-c is received */
  367. /* deallocate certificate's memory */
  368. UA_ByteString_deleteMembers(&config.serverCertificate);
  369. UA_Server_delete(server);
  370. nl.deleteMembers(&nl);
  371. return (int)retval;
  372. }