mirror of
https://github.com/open62541/open62541.git
synced 2026-10-18 13:42:32 +08:00
38 lines
1.1 KiB
C
38 lines
1.1 KiB
C
/* This work is licensed under a Creative Commons CCZero 1.0 Universal License.
|
|
* See http://creativecommons.org/publicdomain/zero/1.0/ for more information. */
|
|
|
|
#include <open62541/plugin/log_stdout.h>
|
|
#include <open62541/server.h>
|
|
#include <open62541/server_config_default.h>
|
|
#include <open62541/plugin/nodesetloader.h>
|
|
|
|
#include "test_helpers.h"
|
|
#include <signal.h>
|
|
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
|
|
UA_Boolean running = true;
|
|
static void stopHandler(int sign) {
|
|
UA_LOG_INFO(UA_Log_Stdout, UA_LOGCATEGORY_SERVER, "received ctrl-c");
|
|
running = false;
|
|
}
|
|
|
|
int main(int argc, const char *argv[]) {
|
|
signal(SIGINT, stopHandler);
|
|
signal(SIGTERM, stopHandler);
|
|
|
|
UA_Server *server = UA_Server_newForUnitTest();
|
|
|
|
for (int cnt = 1; cnt < argc; cnt++) {
|
|
if (UA_StatusCode_isBad(UA_Server_loadNodeset(server, argv[cnt], NULL))) {
|
|
printf("Nodeset %s could not be loaded, exit\n", argv[cnt]);
|
|
return EXIT_FAILURE;
|
|
}
|
|
}
|
|
|
|
UA_StatusCode retval = UA_Server_run(server, &running);
|
|
UA_Server_delete(server);
|
|
|
|
return retval == UA_STATUSCODE_GOOD ? EXIT_SUCCESS : EXIT_FAILURE;
|
|
}
|