|
@@ -46,14 +46,11 @@ static void stopHandler(int sign) {
|
|
int main(int argc, char** argv) {
|
|
int main(int argc, char** argv) {
|
|
signal(SIGINT, stopHandler); /* catches ctrl-c */
|
|
signal(SIGINT, stopHandler); /* catches ctrl-c */
|
|
|
|
|
|
- UA_ServerConfig config = UA_ServerConfig_standard;
|
|
|
|
- UA_ServerNetworkLayer nl = UA_ServerNetworkLayerTCP(UA_ConnectionConfig_standard, 16664);
|
|
|
|
- config.networkLayers = &nl;
|
|
|
|
- config.networkLayersSize = 1;
|
|
|
|
|
|
+ UA_ServerConfig *config = UA_ServerConfig_new_default();
|
|
|
|
|
|
/* load certificate */
|
|
/* load certificate */
|
|
- config.serverCertificate = loadCertificate();
|
|
|
|
- if(config.serverCertificate.length > 0)
|
|
|
|
|
|
+ config->serverCertificate = loadCertificate();
|
|
|
|
+ if(config->serverCertificate.length > 0)
|
|
UA_LOG_INFO(logger, UA_LOGCATEGORY_SERVER, "Certificate loaded");
|
|
UA_LOG_INFO(logger, UA_LOGCATEGORY_SERVER, "Certificate loaded");
|
|
|
|
|
|
|
|
|
|
@@ -62,10 +59,10 @@ int main(int argc, char** argv) {
|
|
UA_StatusCode retval = UA_Server_run(server, &running);
|
|
UA_StatusCode retval = UA_Server_run(server, &running);
|
|
|
|
|
|
/* deallocate certificate's memory */
|
|
/* deallocate certificate's memory */
|
|
- UA_ByteString_deleteMembers(&config.serverCertificate);
|
|
|
|
|
|
+ UA_ByteString_deleteMembers(&config->serverCertificate);
|
|
|
|
|
|
UA_Server_delete(server);
|
|
UA_Server_delete(server);
|
|
- nl.deleteMembers(&nl);
|
|
|
|
|
|
+ UA_ServerConfig_delete(config);
|
|
|
|
|
|
return (int)retval;
|
|
return (int)retval;
|
|
}
|
|
}
|