diff --git a/CMakeLists.txt b/CMakeLists.txt index b8c5a02a627..f852e8002dc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -174,7 +174,8 @@ set(exported_headers ${PROJECT_BINARY_DIR}/src_generated/ua_config.h ${PROJECT_SOURCE_DIR}/include/ua_client.h ${PROJECT_SOURCE_DIR}/include/ua_client_highlevel.h ${PROJECT_SOURCE_DIR}/plugins/networklayer_tcp.h - ${PROJECT_SOURCE_DIR}/plugins/logger_stdout.h) + ${PROJECT_SOURCE_DIR}/plugins/logger_stdout.h + ${PROJECT_SOURCE_DIR}/plugins/ua_config_standard.h) set(internal_headers ${PROJECT_SOURCE_DIR}/deps/queue.h ${PROJECT_SOURCE_DIR}/deps/pcg_basic.h ${PROJECT_SOURCE_DIR}/deps/libc_time.h @@ -216,6 +217,7 @@ set(lib_sources ${PROJECT_SOURCE_DIR}/src/ua_types.c ${PROJECT_SOURCE_DIR}/src/client/ua_client_highlevel.c ${PROJECT_SOURCE_DIR}/plugins/networklayer_tcp.c ${PROJECT_SOURCE_DIR}/plugins/logger_stdout.c + ${PROJECT_SOURCE_DIR}/plugins/ua_config_standard.c ${PROJECT_SOURCE_DIR}/deps/libc_time.c ${PROJECT_SOURCE_DIR}/deps/pcg_basic.c) ##TODO: make client stuff optional diff --git a/README.md b/README.md index 7665f5e9825..854a1fe63a9 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,6 @@ int main(int argc, char** argv) /* init the server */ UA_ServerNetworkLayer nl = UA_ServerNetworkLayerTCP(UA_ConnectionConfig_standard, PORT); UA_ServerConfig config = UA_ServerConfig_standard; - config.logger = Logger_Stdout; config.networkLayers = &nl; config.networkLayersSize = 1; UA_Server *server = UA_Server_new(config); @@ -91,9 +90,8 @@ int main(int argc, char** argv) int main(int argc, char *argv[]) { /* create a client and connect */ - UA_Client *client = UA_Client_new(UA_ClientConfig_standard, Logger_Stdout); - UA_StatusCode retval = UA_Client_connect(client, UA_ClientConnectionTCP, - "opc.tcp://localhost:16664"); + UA_Client *client = UA_Client_new(UA_ClientConfig_standard); + UA_StatusCode retval = UA_Client_connect(client, "opc.tcp://localhost:16664"); if(retval != UA_STATUSCODE_GOOD) { UA_Client_delete(client); return retval; diff --git a/examples/client.c b/examples/client.c index 292b8f871cb..01b76c227d7 100644 --- a/examples/client.c +++ b/examples/client.c @@ -4,7 +4,7 @@ # include "ua_client_highlevel.h" # include "ua_nodeids.h" # include "networklayer_tcp.h" -# include "logger_stdout.h" +# include "ua_config_standard.h" # include "ua_types_encoding_binary.h" #else # include "open62541.h" @@ -23,20 +23,23 @@ static UA_StatusCode nodeIter(UA_NodeId childId, UA_Boolean isInverse, UA_NodeId referenceTypeId, void *handle) { UA_NodeId *parent = (UA_NodeId *) handle; - if (!isInverse) { - printf("%d, %d --- %d ---> NodeId %d, %d\n", parent->namespaceIndex, parent->identifier.numeric, referenceTypeId.identifier.numeric, childId.namespaceIndex, childId.identifier.numeric); + if(!isInverse) { + printf("%d, %d --- %d ---> NodeId %d, %d\n", + parent->namespaceIndex, parent->identifier.numeric, + referenceTypeId.identifier.numeric, childId.namespaceIndex, + childId.identifier.numeric); } return UA_STATUSCODE_GOOD; } int main(int argc, char *argv[]) { - UA_Client *client = UA_Client_new(UA_ClientConfig_standard, Logger_Stdout); + UA_Client *client = UA_Client_new(UA_ClientConfig_standard); //listing endpoints UA_EndpointDescription* endpointArray = NULL; size_t endpointArraySize = 0; UA_StatusCode retval = - UA_Client_getEndpoints(client, UA_ClientConnectionTCP, "opc.tcp://localhost:16664", + UA_Client_getEndpoints(client, "opc.tcp://localhost:16664", &endpointArraySize, &endpointArray); //freeing the endpointArray @@ -57,7 +60,7 @@ int main(int argc, char *argv[]) { //connect to a server //anonymous connect would be: retval = UA_Client_connect_username(client, UA_ClientConnectionTCP, "opc.tcp://localhost:16664"); - retval = UA_Client_connect_username(client, UA_ClientConnectionTCP, "opc.tcp://localhost:16664", "user1", "password"); + retval = UA_Client_connect_username(client, "opc.tcp://localhost:16664", "user1", "password"); if(retval != UA_STATUSCODE_GOOD) { UA_Client_delete(client); diff --git a/examples/client_firstSteps.c b/examples/client_firstSteps.c index 5d6183fc2b4..77899e99dd7 100644 --- a/examples/client_firstSteps.c +++ b/examples/client_firstSteps.c @@ -4,18 +4,15 @@ #include #ifdef UA_NO_AMALGAMATION -# include "ua_types.h" -# include "ua_server.h" -# include "logger_stdout.h" -# include "networklayer_tcp.h" +# include "ua_client.h" +# include "ua_config_standard.h" #else # include "open62541.h" #endif int main(void) { - UA_Client *client = UA_Client_new(UA_ClientConfig_standard, Logger_Stdout); - UA_StatusCode retval = UA_Client_connect(client, UA_ClientConnectionTCP, - "opc.tcp://localhost:16664"); + UA_Client *client = UA_Client_new(UA_ClientConfig_standard); + UA_StatusCode retval = UA_Client_connect(client, "opc.tcp://localhost:16664"); if(retval != UA_STATUSCODE_GOOD) { UA_Client_delete(client); return (int)retval; diff --git a/examples/server.c b/examples/server.c index ec6b5a056c2..a6b5b827927 100644 --- a/examples/server.c +++ b/examples/server.c @@ -10,7 +10,7 @@ # include # include "ua_types.h" # include "ua_server.h" -# include "logger_stdout.h" +# include "ua_config_standard.h" # include "networklayer_tcp.h" #else # include "open62541.h" @@ -214,7 +214,6 @@ int main(int argc, char** argv) { UA_ServerNetworkLayer nl = UA_ServerNetworkLayerTCP(UA_ConnectionConfig_standard, 16664); UA_ServerConfig config = UA_ServerConfig_standard; - config.logger = Logger_Stdout; config.serverCertificate = loadCertificate(); config.networkLayers = &nl; config.networkLayersSize = 1; diff --git a/examples/server.cpp b/examples/server.cpp index ca069e97c7f..5dff20cb571 100644 --- a/examples/server.cpp +++ b/examples/server.cpp @@ -36,7 +36,6 @@ int main() { UA_ServerConfig config = UA_ServerConfig_standard; UA_ServerNetworkLayer nl = UA_ServerNetworkLayerTCP(UA_ConnectionConfig_standard, 16664); - config.logger = Logger_Stdout; config.networkLayers = &nl; config.networkLayersSize = 1; UA_Server *server = UA_Server_new(config); diff --git a/examples/server_datasource.c b/examples/server_datasource.c index e514dffdc6f..8d17937ef0c 100644 --- a/examples/server_datasource.c +++ b/examples/server_datasource.c @@ -9,7 +9,7 @@ #ifdef UA_NO_AMALGAMATION # include "ua_types.h" # include "ua_server.h" -# include "logger_stdout.h" +# include "ua_config_standard.h" # include "networklayer_tcp.h" #else # include "open62541.h" @@ -54,7 +54,6 @@ int main(int argc, char** argv) { UA_ServerConfig config = UA_ServerConfig_standard; UA_ServerNetworkLayer nl = UA_ServerNetworkLayerTCP(UA_ConnectionConfig_standard, 16664); - config.logger = Logger_Stdout; config.networkLayers = &nl; config.networkLayersSize = 1; UA_Server *server = UA_Server_new(config); diff --git a/examples/server_firstSteps.c b/examples/server_firstSteps.c index a1de8065732..e53b4f80291 100644 --- a/examples/server_firstSteps.c +++ b/examples/server_firstSteps.c @@ -7,7 +7,7 @@ #ifdef UA_NO_AMALGAMATION # include "ua_types.h" # include "ua_server.h" -# include "logger_stdout.h" +# include "ua_config_standard.h" # include "networklayer_tcp.h" #else # include "open62541.h" @@ -24,7 +24,6 @@ int main(void) { UA_ServerConfig config = UA_ServerConfig_standard; UA_ServerNetworkLayer nl = UA_ServerNetworkLayerTCP(UA_ConnectionConfig_standard, 16664); - config.logger = Logger_Stdout; config.networkLayers = &nl; config.networkLayersSize = 1; UA_Server *server = UA_Server_new(config); diff --git a/examples/server_mainloop.c b/examples/server_mainloop.c index 68641bcc81d..5543ade2869 100644 --- a/examples/server_mainloop.c +++ b/examples/server_mainloop.c @@ -13,7 +13,7 @@ #ifdef UA_NO_AMALGAMATION # include "ua_types.h" # include "ua_server.h" -# include "logger_stdout.h" +# include "ua_config_standard.h" # include "networklayer_tcp.h" #else # include "open62541.h" @@ -35,7 +35,6 @@ int main(int argc, char** argv) { UA_ServerConfig config = UA_ServerConfig_standard; UA_ServerNetworkLayer nl = UA_ServerNetworkLayerTCP(UA_ConnectionConfig_standard, 16664); - config.logger = Logger_Stdout; config.networkLayers = &nl; config.networkLayersSize = 1; UA_Server *server = UA_Server_new(config); diff --git a/examples/server_method.c b/examples/server_method.c index 95bedf52ce6..371aa24be6c 100644 --- a/examples/server_method.c +++ b/examples/server_method.c @@ -9,7 +9,7 @@ #ifdef UA_NO_AMALGAMATION # include "ua_types.h" # include "ua_server.h" -# include "logger_stdout.h" +# include "ua_config_standard.h" # include "networklayer_tcp.h" #else # include "open62541.h" @@ -71,7 +71,6 @@ int main(int argc, char** argv) { /* initialize the server */ UA_ServerConfig config = UA_ServerConfig_standard; UA_ServerNetworkLayer nl = UA_ServerNetworkLayerTCP(UA_ConnectionConfig_standard, 16664); - config.logger = Logger_Stdout; config.networkLayers = &nl; config.networkLayersSize = 1; UA_Server *server = UA_Server_new(config); diff --git a/examples/server_nodeset.c b/examples/server_nodeset.c index 235d70638de..8dcac54fb75 100644 --- a/examples/server_nodeset.c +++ b/examples/server_nodeset.c @@ -9,7 +9,7 @@ #ifdef UA_NO_AMALGAMATION # include "ua_types.h" # include "ua_server.h" -# include "logger_stdout.h" +# include "ua_config_standard.h" # include "networklayer_tcp.h" #else # include "open62541.h" @@ -32,7 +32,6 @@ int main(int argc, char** argv) { /* initialize the server */ UA_ServerConfig config = UA_ServerConfig_standard; UA_ServerNetworkLayer nl = UA_ServerNetworkLayerTCP(UA_ConnectionConfig_standard, 16664); - config.logger = Logger_Stdout; config.networkLayers = &nl; config.networkLayersSize = 1; UA_Server *server = UA_Server_new(config); diff --git a/examples/server_readspeed.c b/examples/server_readspeed.c index 831a045b6aa..e1c6bd7dabe 100644 --- a/examples/server_readspeed.c +++ b/examples/server_readspeed.c @@ -9,7 +9,7 @@ # include "ua_types.h" # include "ua_types_generated.h" # include "ua_server.h" -# include "logger_stdout.h" +# include "ua_config_standard.h" # include "networklayer_tcp.h" #else # include "open62541.h" @@ -32,8 +32,7 @@ int main(int argc, char** argv) { signal(SIGINT, stopHandler); /* catches ctrl-c */ UA_ServerConfig config = UA_ServerConfig_standard; - UA_ServerNetworkLayer nl = UA_ServerNetworkLayerTCP(UA_ConnectionConfig_standard, 16664, logger); - config.logger = Logger_Stdout; + UA_ServerNetworkLayer nl = UA_ServerNetworkLayerTCP(UA_ConnectionConfig_standard, 16664); config.networkLayers = &nl; config.networkLayersSize = 1; UA_Server *server = UA_Server_new(config); diff --git a/examples/server_repeated_job.c b/examples/server_repeated_job.c index 307f005d814..f20f850e63e 100644 --- a/examples/server_repeated_job.c +++ b/examples/server_repeated_job.c @@ -8,7 +8,7 @@ #ifdef UA_NO_AMALGAMATION # include "ua_types.h" # include "ua_server.h" -# include "logger_stdout.h" +# include "ua_config_standard.h" # include "networklayer_tcp.h" #else # include "open62541.h" @@ -31,7 +31,6 @@ int main(int argc, char** argv) { UA_ServerConfig config = UA_ServerConfig_standard; UA_ServerNetworkLayer nl = UA_ServerNetworkLayerTCP(UA_ConnectionConfig_standard, 16664); - config.logger = Logger_Stdout; config.networkLayers = &nl; config.networkLayersSize = 1; UA_Server *server = UA_Server_new(config); diff --git a/examples/server_variable.c b/examples/server_variable.c index 52ac752b1e3..1a374dd97f8 100644 --- a/examples/server_variable.c +++ b/examples/server_variable.c @@ -8,7 +8,7 @@ #ifdef UA_NO_AMALGAMATION # include "ua_types.h" # include "ua_server.h" -# include "logger_stdout.h" +# include "ua_config_standard.h" # include "networklayer_tcp.h" #else # include "open62541.h" @@ -35,7 +35,6 @@ int main(int argc, char** argv) { UA_ServerConfig config = UA_ServerConfig_standard; UA_ServerNetworkLayer nl = UA_ServerNetworkLayerTCP(UA_ConnectionConfig_standard, 16664); - config.logger = Logger_Stdout; config.networkLayers = &nl; config.networkLayersSize = 1; UA_Server *server = UA_Server_new(config); diff --git a/include/ua_client.h b/include/ua_client.h index e767c309994..30348b49aa7 100644 --- a/include/ua_client.h +++ b/include/ua_client.h @@ -30,83 +30,90 @@ extern "C" { * Client * ====== * - * Client Lifecycle - * ---------------- */ -struct UA_Client; -typedef struct UA_Client UA_Client; - -typedef enum { - UA_CLIENTSTATE_READY, /* The client is not connected but initialized and ready to use. */ - UA_CLIENTSTATE_CONNECTED, /* The client is connected to a server. */ - UA_CLIENTSTATE_FAULTED, /* An error has occured that might have influenced the connection - state. A successfull service call or renewal of the secure channel - will reset the state to CONNECTED. */ - UA_CLIENTSTATE_ERRORED /* A non-recoverable error has occured and the connection is no - longer reliable. The client needs to be disconnected and - reinitialized to recover into a CONNECTED state. */ -} UA_Client_State; + * Client Configuration + * -------------------- */ +typedef UA_Connection (*UA_ConnectClientConnection)(UA_ConnectionConfig localConf, + const char *endpointUrl, + UA_Logger logger); typedef struct UA_ClientConfig { UA_UInt32 timeout; //sync response timeout UA_UInt32 secureChannelLifeTime; // lifetime in ms (then the channel needs to be renewed) + UA_Logger logger; UA_ConnectionConfig localConnectionConfig; + UA_ConnectClientConnection connectionFunc; } UA_ClientConfig; -extern UA_EXPORT const UA_ClientConfig UA_ClientConfig_standard; +/** + * Client Lifecycle + * ---------------- */ +typedef enum { + UA_CLIENTSTATE_READY, /* The client is not connected but initialized and ready to + use. */ + UA_CLIENTSTATE_CONNECTED, /* The client is connected to a server. */ + UA_CLIENTSTATE_FAULTED, /* An error has occured that might have influenced the + connection state. A successfull service call or renewal + of the secure channel will reset the state to + CONNECTED. */ + UA_CLIENTSTATE_ERRORED /* A non-recoverable error has occured and the connection + is no longer reliable. The client needs to be + disconnected and reinitialized to recover into a + CONNECTED state. */ +} UA_ClientState; + +struct UA_Client; +typedef struct UA_Client UA_Client; -/* Creates a new client +/* Create a new client * * @param config for the new client. You can use UA_ClientConfig_standard which has sane defaults * @param logger function pointer to a logger function. See examples/logger_stdout.c for a simple * implementation * @return return the new Client object */ -UA_Client UA_EXPORT * UA_Client_new(UA_ClientConfig config, UA_Logger logger); +UA_Client UA_EXPORT * UA_Client_new(UA_ClientConfig config); + +/* Get the client connection status */ +UA_ClientState UA_EXPORT UA_Client_getState(UA_Client *client); /* Reset a client */ -void UA_EXPORT UA_Client_reset(UA_Client* client); +void UA_EXPORT UA_Client_reset(UA_Client *client); /* Delete a client */ -void UA_EXPORT UA_Client_delete(UA_Client* client); +void UA_EXPORT UA_Client_delete(UA_Client *client); /** * Manage the Connection * --------------------- */ -typedef UA_Connection (*UA_ConnectClientConnection)(UA_ConnectionConfig localConf, const char *endpointUrl, - UA_Logger logger); - /* Gets a list of endpoints of a server * * @param client to use - * @param connection function. You can use ClientNetworkLayerTCP_connect from examples/networklayer_tcp.h * @param server url to connect (for example "opc.tcp://localhost:16664") * @param endpointDescriptionsSize size of the array of endpoint descriptions * @param endpointDescriptions array of endpoint descriptions that is allocated by the function (you need to free manually) * @return Indicates whether the operation succeeded or returns an error code */ UA_StatusCode UA_EXPORT -UA_Client_getEndpoints(UA_Client *client, UA_ConnectClientConnection connectFunc, - const char *serverUrl, size_t* endpointDescriptionsSize, +UA_Client_getEndpoints(UA_Client *client, const char *serverUrl, + size_t* endpointDescriptionsSize, UA_EndpointDescription** endpointDescriptions); /* Connect to the selected server * * @param client to use - * @param connection function. You can use ClientNetworkLayerTCP_connect from examples/networklayer_tcp.h * @param endpointURL to connect (for example "opc.tcp://localhost:16664") * @return Indicates whether the operation succeeded or returns an error code */ UA_StatusCode UA_EXPORT -UA_Client_connect(UA_Client *client, UA_ConnectClientConnection connFunc, const char *endpointUrl); +UA_Client_connect(UA_Client *client, const char *endpointUrl); /* Connect to the selected server with the given username and password * * @param client to use - * @param connection function. You can use ClientNetworkLayerTCP_connect from examples/networklayer_tcp.h * @param endpointURL to connect (for example "opc.tcp://localhost:16664") * @param username * @param password * @return Indicates whether the operation succeeded or returns an error code */ UA_StatusCode UA_EXPORT -UA_Client_connect_username(UA_Client *client, UA_ConnectClientConnection connFunc, - const char *endpointUrl, const char *username, const char *password); +UA_Client_connect_username(UA_Client *client, const char *endpointUrl, + const char *username, const char *password); /* Close a connection to the selected server */ UA_StatusCode UA_EXPORT UA_Client_disconnect(UA_Client *client); @@ -114,14 +121,9 @@ UA_StatusCode UA_EXPORT UA_Client_disconnect(UA_Client *client); /* Renew the underlying secure channel */ UA_StatusCode UA_EXPORT UA_Client_manuallyRenewSecureChannel(UA_Client *client); - -/* Get the client connection status */ -UA_Client_State UA_EXPORT UA_Client_getState(UA_Client *client); - /** * Raw Services * ------------ - * * The raw OPC UA services are exposed to the client. But most of them time, it is better to use the * convenience functions from `ua_client_highlevel.h` that wrap the raw services. See the Section * :ref:`services` for a detailed description of each service. */ diff --git a/include/ua_client_highlevel.h b/include/ua_client_highlevel.h index 6892f28377b..f04ca0d74ba 100644 --- a/include/ua_client_highlevel.h +++ b/include/ua_client_highlevel.h @@ -15,17 +15,20 @@ extern "C" { * @param namespaceIndex The namespace index of the URI. The value is unchanged in case of an error * @return Indicates whether the operation succeeded or returns an error code */ -UA_StatusCode UA_EXPORT UA_Client_NamespaceGetIndex(UA_Client *client, UA_String *namespaceUri, UA_UInt16 *namespaceIndex); +UA_StatusCode UA_EXPORT +UA_Client_NamespaceGetIndex(UA_Client *client, UA_String *namespaceUri, UA_UInt16 *namespaceIndex); #ifndef HAVE_NODEITER_CALLBACK #define HAVE_NODEITER_CALLBACK /* Iterate over all nodes referenced by parentNodeId by calling the callback - f unction for each child node */ - typedef UA_StatusCode (*UA_NodeIteratorCallback)(UA_NodeId childId, UA_Boolean isInverse, + function for each child node */ +typedef UA_StatusCode (*UA_NodeIteratorCallback)(UA_NodeId childId, UA_Boolean isInverse, UA_NodeId referenceTypeId, void *handle); #endif -UA_StatusCode UA_EXPORT UA_Client_forEachChildNodeCall(UA_Client *client, UA_NodeId parentNodeId, UA_NodeIteratorCallback callback, void *handle) ; +UA_StatusCode UA_EXPORT +UA_Client_forEachChildNodeCall(UA_Client *client, UA_NodeId parentNodeId, + UA_NodeIteratorCallback callback, void *handle) ; /*******************/ /* Node Management */ diff --git a/include/ua_server.h b/include/ua_server.h index a1bb20a485c..60913527578 100644 --- a/include/ua_server.h +++ b/include/ua_server.h @@ -116,8 +116,6 @@ typedef struct { UA_BoundedUInt32 queueSizeLimits; } UA_ServerConfig; -extern UA_EXPORT const UA_ServerConfig UA_ServerConfig_standard; - /** * Server Lifecycle * ---------------- */ diff --git a/plugins/networklayer_tcp.h b/plugins/networklayer_tcp.h index 9956ecb374b..d30f984f497 100644 --- a/plugins/networklayer_tcp.h +++ b/plugins/networklayer_tcp.h @@ -13,7 +13,6 @@ extern "C" { #include "ua_server.h" #include "ua_client.h" -/** @brief Create the TCP networklayer and listen to the specified port */ UA_ServerNetworkLayer UA_EXPORT UA_ServerNetworkLayerTCP(UA_ConnectionConfig conf, UA_UInt16 port); diff --git a/plugins/ua_config_standard.c b/plugins/ua_config_standard.c new file mode 100644 index 00000000000..39094fec7ca --- /dev/null +++ b/plugins/ua_config_standard.c @@ -0,0 +1,65 @@ +#include "ua_config_standard.h" + +#define MANUFACTURER_NAME "open62541.org" +#define PRODUCT_NAME "open62541 OPC UA Server" +#define PRODUCT_URI "urn:unconfigured:open62541" +#define APPLICATION_NAME "open62541-based OPC UA Application" +#define APPLICATION_URI "urn:unconfigured:application" + +#define UA_STRING_STATIC(s) {sizeof(s)-1, (UA_Byte*)s} +#define UA_STRING_STATIC_NULL {0, NULL} + +UA_UsernamePasswordLogin usernamePasswords[2] = { + { UA_STRING_STATIC("user1"), UA_STRING_STATIC("password") }, + { UA_STRING_STATIC("user2"), UA_STRING_STATIC("password1") } }; + +const UA_ServerConfig UA_ServerConfig_standard = { + .nThreads = 1, + .logger = Logger_Stdout, + + .buildInfo = { + .productUri = UA_STRING_STATIC(PRODUCT_URI), + .manufacturerName = UA_STRING_STATIC(MANUFACTURER_NAME), + .productName = UA_STRING_STATIC(PRODUCT_NAME), + .softwareVersion = UA_STRING_STATIC("0"), + .buildNumber = UA_STRING_STATIC("0"), + .buildDate = 0 }, + .applicationDescription = { + .applicationUri = UA_STRING_STATIC(APPLICATION_URI), + .productUri = UA_STRING_STATIC(PRODUCT_URI), + .applicationName = { .locale = UA_STRING_STATIC(""), + .text = UA_STRING_STATIC(APPLICATION_NAME) }, + .applicationType = UA_APPLICATIONTYPE_SERVER, + .gatewayServerUri = UA_STRING_STATIC_NULL, + .discoveryProfileUri = UA_STRING_STATIC_NULL, + .discoveryUrlsSize = 0, + .discoveryUrls = NULL }, + .serverCertificate = UA_STRING_STATIC_NULL, + + .networkLayersSize = 0, + .networkLayers = NULL, + + .enableAnonymousLogin = true, + .enableUsernamePasswordLogin = true, + .usernamePasswordLogins = usernamePasswords, + .usernamePasswordLoginsSize = 2, + + .publishingIntervalLimits = { .max = 10000, .min = 0, .current = 0 }, + .lifeTimeCountLimits = { .max = 15000, .min = 0, .current = 0 }, + .keepAliveCountLimits = { .max = 100, .min = 0, .current = 0 }, + .notificationsPerPublishLimits = { .max = 1000, .min = 1, .current = 0 }, + .samplingIntervalLimits = { .max = 1000, .min = 5, .current = 0 }, + .queueSizeLimits = { .max = 100, .min = 0, .current = 0 } +}; + +const UA_EXPORT UA_ClientConfig UA_ClientConfig_standard = { + .timeout = 5000, + .secureChannelLifeTime = 600000, + .logger = Logger_Stdout, + .localConnectionConfig = { + .protocolVersion = 0, + .sendBufferSize = 65536, + .recvBufferSize = 65536, + .maxMessageSize = 65536, + .maxChunkCount = 1 }, + .connectionFunc = UA_ClientConnectionTCP }; diff --git a/plugins/ua_config_standard.h b/plugins/ua_config_standard.h new file mode 100644 index 00000000000..0a9f6ed3509 --- /dev/null +++ b/plugins/ua_config_standard.h @@ -0,0 +1,25 @@ +/* + * This work is licensed under a Creative Commons CCZero 1.0 Universal License. + * See http://creativecommons.org/publicdomain/zero/1.0/ for more information. + */ + +#ifndef UA_CONFIG_STANDARD_H_ +#define UA_CONFIG_STANDARD_H_ + +#include "ua_server.h" +#include "ua_client.h" +#include "logger_stdout.h" +#include "networklayer_tcp.h" + +#ifdef __cplusplus +extern "C" { +#endif + +extern UA_EXPORT const UA_ServerConfig UA_ServerConfig_standard; +extern UA_EXPORT const UA_ClientConfig UA_ClientConfig_standard; + +#ifdef __cplusplus +} +#endif + +#endif /* UA_CONFIG_STANDARD_H_ */ diff --git a/src/client/ua_client.c b/src/client/ua_client.c index 71027dd3c25..e982aac9d4b 100644 --- a/src/client/ua_client.c +++ b/src/client/ua_client.c @@ -10,16 +10,11 @@ #include "ua_types_generated_encoding_binary.h" #include "ua_transport_generated_encoding_binary.h" -const UA_EXPORT UA_ClientConfig UA_ClientConfig_standard = - { .timeout = 5000 /* ms receive timout */, .secureChannelLifeTime = 600000, - {.protocolVersion = 0, .sendBufferSize = 65536, .recvBufferSize = 65536, - .maxMessageSize = 65536, .maxChunkCount = 1}}; - /*********************/ /* Create and Delete */ /*********************/ -static void UA_Client_init(UA_Client* client, UA_ClientConfig config, UA_Logger logger) { +static void UA_Client_init(UA_Client* client, UA_ClientConfig config) { client->state = UA_CLIENTSTATE_READY; UA_Connection_init(&client->connection); UA_SecureChannel_init(&client->channel); @@ -34,7 +29,6 @@ static void UA_Client_init(UA_Client* client, UA_ClientConfig config, UA_Logger UA_NodeId_init(&client->authenticationToken); client->requestHandle = 0; - client->logger = logger; client->config = config; client->scRenewAt = 0; @@ -45,12 +39,12 @@ static void UA_Client_init(UA_Client* client, UA_ClientConfig config, UA_Logger #endif } -UA_Client * UA_Client_new(UA_ClientConfig config, UA_Logger logger) { +UA_Client * UA_Client_new(UA_ClientConfig config) { UA_Client *client = UA_calloc(1, sizeof(UA_Client)); if(!client) return NULL; - UA_Client_init(client, config, logger); + UA_Client_init(client, config); return client; } @@ -86,7 +80,7 @@ static void UA_Client_deleteMembers(UA_Client* client) { void UA_Client_reset(UA_Client* client){ UA_Client_deleteMembers(client); - UA_Client_init(client, client->config, client->logger); + UA_Client_init(client, client->config); } void UA_Client_delete(UA_Client* client){ @@ -95,18 +89,24 @@ void UA_Client_delete(UA_Client* client){ UA_free(client); } +UA_ClientState UA_EXPORT UA_Client_getState(UA_Client *client) { + if (client == NULL) + return UA_CLIENTSTATE_ERRORED; + return client->state; +} + /*************************/ /* Manage the Connection */ /*************************/ -static UA_StatusCode HelAckHandshake(UA_Client *c) { +static UA_StatusCode HelAckHandshake(UA_Client *client) { UA_TcpMessageHeader messageHeader; messageHeader.messageTypeAndFinal = UA_MESSAGETYPEANDFINAL_HELF; UA_TcpHelloMessage hello; - UA_String_copy(&c->endpointUrl, &hello.endpointUrl); /* must be less than 4096 bytes */ + UA_String_copy(&client->endpointUrl, &hello.endpointUrl); /* must be less than 4096 bytes */ - UA_Connection *conn = &c->connection; + UA_Connection *conn = &client->connection; hello.maxChunkCount = conn->localConf.maxChunkCount; hello.maxMessageSize = conn->localConf.maxMessageSize; hello.protocolVersion = conn->localConf.protocolVersion; @@ -115,7 +115,7 @@ static UA_StatusCode HelAckHandshake(UA_Client *c) { UA_ByteString message; UA_StatusCode retval; - retval = c->connection.getSendBuffer(&c->connection, c->connection.remoteConf.recvBufferSize, &message); + retval = client->connection.getSendBuffer(&client->connection, client->connection.remoteConf.recvBufferSize, &message); if(retval != UA_STATUSCODE_GOOD) return retval; @@ -126,26 +126,26 @@ static UA_StatusCode HelAckHandshake(UA_Client *c) { retval |= UA_TcpMessageHeader_encodeBinary(&messageHeader, &message, &offset); UA_TcpHelloMessage_deleteMembers(&hello); if(retval != UA_STATUSCODE_GOOD) { - c->connection.releaseSendBuffer(&c->connection, &message); + client->connection.releaseSendBuffer(&client->connection, &message); return retval; } message.length = messageHeader.messageSize; - retval = c->connection.send(&c->connection, &message); + retval = client->connection.send(&client->connection, &message); if(retval != UA_STATUSCODE_GOOD) { - UA_LOG_INFO(c->logger, UA_LOGCATEGORY_NETWORK, "Sending HEL failed"); + UA_LOG_INFO(client->config.logger, UA_LOGCATEGORY_NETWORK, "Sending HEL failed"); return retval; } - UA_LOG_DEBUG(c->logger, UA_LOGCATEGORY_NETWORK, "Sent HEL message"); + UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_NETWORK, "Sent HEL message"); UA_ByteString reply; UA_ByteString_init(&reply); UA_Boolean realloced = false; do { - retval = c->connection.recv(&c->connection, &reply, c->config.timeout); - retval |= UA_Connection_completeMessages(&c->connection, &reply, &realloced); + retval = client->connection.recv(&client->connection, &reply, client->config.timeout); + retval |= UA_Connection_completeMessages(&client->connection, &reply, &realloced); if(retval != UA_STATUSCODE_GOOD) { - UA_LOG_INFO(c->logger, UA_LOGCATEGORY_NETWORK, "Receiving ACK message failed"); + UA_LOG_INFO(client->config.logger, UA_LOGCATEGORY_NETWORK, "Receiving ACK message failed"); return retval; } } while(reply.length == 0); @@ -155,15 +155,15 @@ static UA_StatusCode HelAckHandshake(UA_Client *c) { UA_TcpAcknowledgeMessage ackMessage; retval = UA_TcpAcknowledgeMessage_decodeBinary(&reply, &offset, &ackMessage); if(!realloced) - c->connection.releaseRecvBuffer(&c->connection, &reply); + client->connection.releaseRecvBuffer(&client->connection, &reply); else UA_ByteString_deleteMembers(&reply); if(retval != UA_STATUSCODE_GOOD) { - UA_LOG_INFO(c->logger, UA_LOGCATEGORY_NETWORK, "Decoding ACK message failed"); + UA_LOG_INFO(client->config.logger, UA_LOGCATEGORY_NETWORK, "Decoding ACK message failed"); return retval; } - UA_LOG_DEBUG(c->logger, UA_LOGCATEGORY_NETWORK, "Received ACK message"); + UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_NETWORK, "Received ACK message"); conn->remoteConf.maxChunkCount = ackMessage.maxChunkCount; conn->remoteConf.maxMessageSize = ackMessage.maxMessageSize; @@ -208,10 +208,10 @@ static UA_StatusCode SecureChannelHandshake(UA_Client *client, UA_Boolean renew) opnSecRq.requestedLifetime = client->config.secureChannelLifeTime; if(renew) { opnSecRq.requestType = UA_SECURITYTOKENREQUESTTYPE_RENEW; - UA_LOG_DEBUG(client->logger, UA_LOGCATEGORY_SECURECHANNEL, "Requesting to renew the SecureChannel"); + UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_SECURECHANNEL, "Requesting to renew the SecureChannel"); } else { opnSecRq.requestType = UA_SECURITYTOKENREQUESTTYPE_ISSUE; - UA_LOG_DEBUG(client->logger, UA_LOGCATEGORY_SECURECHANNEL, "Requesting to open a SecureChannel"); + UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_SECURECHANNEL, "Requesting to open a SecureChannel"); } UA_ByteString_copy(&client->channel.clientNonce, &opnSecRq.clientNonce); @@ -253,7 +253,7 @@ static UA_StatusCode SecureChannelHandshake(UA_Client *client, UA_Boolean renew) retval = c->recv(c, &reply, client->config.timeout); retval |= UA_Connection_completeMessages(c, &reply, &realloced); if(retval != UA_STATUSCODE_GOOD) { - UA_LOG_DEBUG(client->logger, UA_LOGCATEGORY_SECURECHANNEL, + UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_SECURECHANNEL, "Receiving OpenSecureChannelResponse failed"); return retval; } @@ -270,7 +270,7 @@ static UA_StatusCode SecureChannelHandshake(UA_Client *client, UA_Boolean renew) UA_ByteString_deleteMembers(&reply); UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(&asymHeader); UA_NodeId_deleteMembers(&requestType); - UA_LOG_DEBUG(client->logger, UA_LOGCATEGORY_CLIENT, + UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_CLIENT, "Reply answers the wrong request. Expected OpenSecureChannelResponse."); return UA_STATUSCODE_BADINTERNALERROR; } @@ -284,7 +284,7 @@ static UA_StatusCode SecureChannelHandshake(UA_Client *client, UA_Boolean renew) UA_ByteString_deleteMembers(&reply); if(retval != UA_STATUSCODE_GOOD) { - UA_LOG_DEBUG(client->logger, UA_LOGCATEGORY_SECURECHANNEL, "Decoding OpenSecureChannelResponse failed"); + UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_SECURECHANNEL, "Decoding OpenSecureChannelResponse failed"); UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(&asymHeader); UA_OpenSecureChannelResponse_init(&response); response.responseHeader.serviceResult = retval; @@ -298,7 +298,7 @@ static UA_StatusCode SecureChannelHandshake(UA_Client *client, UA_Boolean renew) retval = response.responseHeader.serviceResult; if(retval != UA_STATUSCODE_GOOD) - UA_LOG_DEBUG(client->logger, UA_LOGCATEGORY_SECURECHANNEL, "SecureChannel could not be opened / renewed"); + UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_SECURECHANNEL, "SecureChannel could not be opened / renewed"); else { UA_ChannelSecurityToken_deleteMembers(&client->channel.securityToken); UA_ChannelSecurityToken_copy(&response.securityToken, &client->channel.securityToken); @@ -306,9 +306,9 @@ static UA_StatusCode SecureChannelHandshake(UA_Client *client, UA_Boolean renew) UA_ByteString_deleteMembers(&client->channel.serverNonce); UA_ByteString_copy(&response.serverNonce, &client->channel.serverNonce); if(renew) - UA_LOG_DEBUG(client->logger, UA_LOGCATEGORY_SECURECHANNEL, "SecureChannel renewed"); + UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_SECURECHANNEL, "SecureChannel renewed"); else - UA_LOG_DEBUG(client->logger, UA_LOGCATEGORY_SECURECHANNEL, "SecureChannel opened"); + UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_SECURECHANNEL, "SecureChannel opened"); } UA_OpenSecureChannelResponse_deleteMembers(&response); UA_AsymmetricAlgorithmSecurityHeader_deleteMembers(&asymHeader); @@ -371,7 +371,7 @@ GetEndpoints(UA_Client *client, size_t* endpointDescriptionsSize, UA_EndpointDes &response, &UA_TYPES[UA_TYPES_GETENDPOINTSRESPONSE]); if(response.responseHeader.serviceResult != UA_STATUSCODE_GOOD) { - UA_LOG_ERROR(client->logger, UA_LOGCATEGORY_CLIENT, "GetEndpointRequest failed"); + UA_LOG_ERROR(client->config.logger, UA_LOGCATEGORY_CLIENT, "GetEndpointRequest failed"); UA_GetEndpointsResponse_deleteMembers(&response); return response.responseHeader.serviceResult; } @@ -424,15 +424,14 @@ static UA_StatusCode EndpointsHandshake(UA_Client *client) { } } - //cleanup array - UA_Array_delete(endpointArray,endpointArraySize,&UA_TYPES[UA_TYPES_ENDPOINTDESCRIPTION]); + UA_Array_delete(endpointArray, endpointArraySize, &UA_TYPES[UA_TYPES_ENDPOINTDESCRIPTION]); if(!endpointFound) { - UA_LOG_ERROR(client->logger, UA_LOGCATEGORY_CLIENT, "No suitable endpoint found"); + UA_LOG_ERROR(client->config.logger, UA_LOGCATEGORY_CLIENT, "No suitable endpoint found"); return UA_STATUSCODE_BADINTERNALERROR; } if(!tokenFound) { - UA_LOG_ERROR(client->logger, UA_LOGCATEGORY_CLIENT, "No anonymous token found"); + UA_LOG_ERROR(client->config.logger, UA_LOGCATEGORY_CLIENT, "No anonymous token found"); return UA_STATUSCODE_BADINTERNALERROR; } return retval; @@ -528,17 +527,16 @@ static UA_StatusCode CloseSecureChannel(UA_Client *client) { } UA_StatusCode -UA_Client_getEndpoints(UA_Client *client, UA_ConnectClientConnection connectFunc, - const char *serverUrl, size_t* endpointDescriptionsSize, +UA_Client_getEndpoints(UA_Client *client, const char *serverUrl, + size_t* endpointDescriptionsSize, UA_EndpointDescription** endpointDescriptions) { if(client->state == UA_CLIENTSTATE_CONNECTED) return UA_STATUSCODE_GOOD; - if(client->state == UA_CLIENTSTATE_ERRORED) { + if(client->state == UA_CLIENTSTATE_ERRORED) UA_Client_reset(client); - } UA_StatusCode retval = UA_STATUSCODE_GOOD; - client->connection = connectFunc(UA_ConnectionConfig_standard, serverUrl, client->logger); + client->connection = client->config.connectionFunc(UA_ConnectionConfig_standard, serverUrl, client->config.logger); if(client->connection.state != UA_CONNECTION_OPENING) { retval = UA_STATUSCODE_BADCONNECTIONCLOSED; goto cleanup; @@ -556,23 +554,25 @@ UA_Client_getEndpoints(UA_Client *client, UA_ConnectClientConnection connectFunc retval = SecureChannelHandshake(client, false); if(retval == UA_STATUSCODE_GOOD) retval = GetEndpoints(client, endpointDescriptionsSize, endpointDescriptions); - //we always cleanup + + /* always cleanup */ cleanup: UA_Client_reset(client); return retval; } -UA_StatusCode UA_Client_connect_username(UA_Client *client, UA_ConnectClientConnection connFunc, - const char *endpointUrl, const char *username, const char *password){ +UA_StatusCode +UA_Client_connect_username(UA_Client *client, const char *endpointUrl, + const char *username, const char *password){ client->authenticationMethod=UA_CLIENTAUTHENTICATION_USERNAME; client->username = UA_STRING_ALLOC(username); client->password = UA_STRING_ALLOC(password); - return UA_Client_connect(client, connFunc, endpointUrl); + return UA_Client_connect(client, endpointUrl); } -UA_StatusCode UA_Client_connect(UA_Client *client, UA_ConnectClientConnection connectFunc, - const char *endpointUrl) { +UA_StatusCode +UA_Client_connect(UA_Client *client, const char *endpointUrl) { if(client->state == UA_CLIENTSTATE_CONNECTED) return UA_STATUSCODE_GOOD; if(client->state == UA_CLIENTSTATE_ERRORED) { @@ -580,7 +580,7 @@ UA_StatusCode UA_Client_connect(UA_Client *client, UA_ConnectClientConnection co } UA_StatusCode retval = UA_STATUSCODE_GOOD; - client->connection = connectFunc(UA_ConnectionConfig_standard, endpointUrl, client->logger); + client->connection = client->config.connectionFunc(UA_ConnectionConfig_standard, endpointUrl, client->config.logger); if(client->connection.state != UA_CONNECTION_OPENING) { retval = UA_STATUSCODE_BADCONNECTIONCLOSED; goto cleanup; @@ -618,13 +618,11 @@ UA_StatusCode UA_Client_connect(UA_Client *client, UA_ConnectClientConnection co UA_StatusCode UA_Client_disconnect(UA_Client *client) { UA_StatusCode retval = UA_STATUSCODE_GOOD; //is a session established? - if(client->state == UA_CLIENTSTATE_CONNECTED && client->channel.connection->state == UA_CONNECTION_ESTABLISHED){ + if(client->state == UA_CLIENTSTATE_CONNECTED && client->channel.connection->state == UA_CONNECTION_ESTABLISHED) retval = CloseSession(client); - } //is a secure channel established? - if(retval == UA_STATUSCODE_GOOD && client->channel.connection->state == UA_CONNECTION_ESTABLISHED){ + if(retval == UA_STATUSCODE_GOOD && client->channel.connection->state == UA_CONNECTION_ESTABLISHED) retval = CloseSecureChannel(client); - } return retval; } @@ -635,11 +633,6 @@ UA_StatusCode UA_Client_manuallyRenewSecureChannel(UA_Client *client) { return retval; } -UA_Client_State UA_EXPORT UA_Client_getState(UA_Client *client) { - if (client == NULL) - return UA_CLIENTSTATE_ERRORED; - return client->state; -} /****************/ /* Raw Services */ /****************/ @@ -667,7 +660,7 @@ void __UA_Client_Service(UA_Client *client, const void *r, const UA_DataType *re /* Send the request */ UA_UInt32 requestId = ++client->requestId; - UA_LOG_DEBUG(client->logger, UA_LOGCATEGORY_CLIENT, + UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_CLIENT, "Sending a request of type %i", requestType->typeId.identifier.numeric); retval = UA_SecureChannel_sendBinaryMessage(&client->channel, requestId, request, requestType); if(retval != UA_STATUSCODE_GOOD) { @@ -712,7 +705,7 @@ void __UA_Client_Service(UA_Client *client, const void *r, const UA_DataType *re /* Todo: we need to demux responses since a publish responses may come at any time */ if(!UA_NodeId_equal(&responseId, &expectedNodeId) || seqHeader.requestId != requestId) { if(responseId.identifier.numeric != UA_NS0ID_SERVICEFAULT + UA_ENCODINGOFFSET_BINARY) { - UA_LOG_ERROR(client->logger, UA_LOGCATEGORY_CLIENT, + UA_LOG_ERROR(client->config.logger, UA_LOGCATEGORY_CLIENT, "Reply answers the wrong request. Expected ns=%i,i=%i. But retrieved ns=%i,i=%i", expectedNodeId.namespaceIndex, expectedNodeId.identifier.numeric, responseId.namespaceIndex, responseId.identifier.numeric); @@ -732,13 +725,14 @@ void __UA_Client_Service(UA_Client *client, const void *r, const UA_DataType *re client->connection.releaseRecvBuffer(&client->connection, &reply); else UA_ByteString_deleteMembers(&reply); + if(retval != UA_STATUSCODE_GOOD){ - UA_LOG_INFO(client->logger, UA_LOGCATEGORY_CLIENT, "Error receiving the response"); + UA_LOG_INFO(client->config.logger, UA_LOGCATEGORY_CLIENT, "Error receiving the response"); client->state = UA_CLIENTSTATE_FAULTED; respHeader->serviceResult = retval; - } - else { + } else { client->state = UA_CLIENTSTATE_CONNECTED; } - UA_LOG_DEBUG(client->logger, UA_LOGCATEGORY_CLIENT, "Received a response of type %i", responseId.identifier.numeric); + UA_LOG_DEBUG(client->config.logger, UA_LOGCATEGORY_CLIENT, + "Received a response of type %i", responseId.identifier.numeric); } diff --git a/src/client/ua_client_internal.h b/src/client/ua_client_internal.h index f649bedf5d3..425c3783bba 100644 --- a/src/client/ua_client_internal.h +++ b/src/client/ua_client_internal.h @@ -52,8 +52,8 @@ typedef enum { } UA_Client_Authentication; struct UA_Client { - /* State */ //maybe it should be visible to user - UA_Client_State state; + /* State */ + UA_ClientState state; /* Connection */ UA_Connection connection; @@ -79,7 +79,6 @@ struct UA_Client { #endif /* Config */ - UA_Logger logger; UA_ClientConfig config; UA_DateTime scRenewAt; }; diff --git a/src/server/ua_server.c b/src/server/ua_server.c index e51b4d626b6..2d021ea25fa 100644 --- a/src/server/ua_server.c +++ b/src/server/ua_server.c @@ -10,54 +10,6 @@ #include "ua_namespaceinit_generated.h" #endif -#define MANUFACTURER_NAME "open62541" -#define PRODUCT_NAME "open62541 OPC UA Server" -#define PRODUCT_URI "urn:unconfigured:open62541" -#define UA_STRING_STATIC(s) {sizeof(s)-1, (UA_Byte*)s} -#define UA_STRING_STATIC_NULL {0, NULL} - -UA_UsernamePasswordLogin usernamePasswords[2] = -{ { UA_STRING_STATIC("user1"), UA_STRING_STATIC("password") }, - { UA_STRING_STATIC("uset2"), UA_STRING_STATIC("password1") } }; - -const UA_ServerConfig UA_ServerConfig_standard = { - .nThreads = 1, - .logger = NULL, - - .buildInfo = { - .productUri = UA_STRING_STATIC(PRODUCT_URI), - .manufacturerName = UA_STRING_STATIC(MANUFACTURER_NAME), - .productName = UA_STRING_STATIC(PRODUCT_NAME), - .softwareVersion = UA_STRING_STATIC("0"), - .buildNumber = UA_STRING_STATIC("0"), - .buildDate = 0}, - .applicationDescription = { - .applicationUri = UA_STRING_STATIC("urn:unconfigured:application"), - .productUri = UA_STRING_STATIC("urn:unconfigured:product"), - .applicationName = { .locale = UA_STRING_STATIC(""), .text = UA_STRING_STATIC("open62541Server") }, - .applicationType = UA_APPLICATIONTYPE_SERVER, - .gatewayServerUri = UA_STRING_STATIC_NULL, - .discoveryProfileUri = UA_STRING_STATIC_NULL, - .discoveryUrlsSize = 0, - .discoveryUrls = NULL - }, - .serverCertificate = UA_STRING_STATIC_NULL, - - .networkLayersSize = 0, .networkLayers = NULL, - - .enableAnonymousLogin = true, - .enableUsernamePasswordLogin = true, - .usernamePasswordLogins = usernamePasswords, - .usernamePasswordLoginsSize = 2, - - .publishingIntervalLimits = { .max = 10000, .min = 0, .current = 0 }, - .lifeTimeCountLimits = { .max = 15000, .min = 0, .current = 0 }, - .keepAliveCountLimits = { .max = 100, .min = 0, .current = 0 }, - .notificationsPerPublishLimits = { .max = 1000, .min = 1, .current = 0 }, - .samplingIntervalLimits = { .max = 1000, .min = 5, .current = 0 }, - .queueSizeLimits = { .max = 100, .min = 0, .current = 0 } -}; - #if defined(UA_ENABLE_MULTITHREADING) && !defined(NDEBUG) UA_THREAD_LOCAL bool rcu_locked = false; #endif diff --git a/tests/check_server_binary_messages.c b/tests/check_server_binary_messages.c index 23f787d855b..651f8581fd1 100644 --- a/tests/check_server_binary_messages.c +++ b/tests/check_server_binary_messages.c @@ -4,7 +4,7 @@ #include "ua_server.h" #include "ua_server_internal.h" -#include "logger_stdout.h" +#include "ua_config_standard.h" #include "testing_networklayers.h" size_t files; diff --git a/tests/check_services_attributes.c b/tests/check_services_attributes.c index 968eeb9d3c6..a619b588040 100644 --- a/tests/check_services_attributes.c +++ b/tests/check_services_attributes.c @@ -8,6 +8,7 @@ #include "ua_client.h" #include "ua_nodeids.h" #include "ua_types.h" +#include "ua_config_standard.h" #include "server/ua_server_internal.h" #ifdef UA_ENABLE_MULTITHREADING diff --git a/tests/check_services_nodemanagement.c b/tests/check_services_nodemanagement.c index 710ed588fa6..98bd89c9dcc 100644 --- a/tests/check_services_nodemanagement.c +++ b/tests/check_services_nodemanagement.c @@ -8,6 +8,7 @@ #include "ua_client.h" #include "ua_nodeids.h" #include "ua_types.h" +#include "ua_config_standard.h" #include "server/ua_server_internal.h" #ifdef UA_ENABLE_MULTITHREADING