Browse Source

move server and client networking to ua_plugin_network.h

Julius Pfrommer 7 years ago
parent
commit
c2a1407774

+ 1 - 1
CMakeLists.txt

@@ -234,8 +234,8 @@ set(exported_headers ${PROJECT_BINARY_DIR}/src_generated/ua_config.h
                      ${PROJECT_BINARY_DIR}/src_generated/ua_nodeids.h
                      ${PROJECT_BINARY_DIR}/src_generated/ua_types_generated.h
                      ${PROJECT_BINARY_DIR}/src_generated/ua_types_generated_handling.h
-                     ${PROJECT_SOURCE_DIR}/include/ua_connection.h
                      ${PROJECT_SOURCE_DIR}/include/ua_log.h
+                     ${PROJECT_SOURCE_DIR}/include/ua_plugin_network.h
                      ${PROJECT_SOURCE_DIR}/include/ua_server.h
                      ${PROJECT_SOURCE_DIR}/include/ua_client.h
                      ${PROJECT_SOURCE_DIR}/include/ua_client_highlevel.h

+ 3 - 3
doc/CMakeLists.txt

@@ -24,7 +24,7 @@ generate_rst(${PROJECT_SOURCE_DIR}/include/ua_server.h ${DOC_SRC_DIR}/server.rst
 generate_rst(${PROJECT_SOURCE_DIR}/include/ua_client.h ${DOC_SRC_DIR}/client.rst)
 generate_rst(${PROJECT_SOURCE_DIR}/include/ua_client_highlevel.h ${DOC_SRC_DIR}/client_highlevel.rst)
 generate_rst(${PROJECT_SOURCE_DIR}/include/ua_log.h ${DOC_SRC_DIR}/log.rst)
-generate_rst(${PROJECT_SOURCE_DIR}/include/ua_connection.h ${DOC_SRC_DIR}/connection.rst)
+generate_rst(${PROJECT_SOURCE_DIR}/include/ua_plugin_network.h ${DOC_SRC_DIR}/plugin_network.rst)
 generate_rst(${PROJECT_SOURCE_DIR}/src/server/ua_services.h ${DOC_SRC_DIR}/services.rst)
 generate_rst(${PROJECT_SOURCE_DIR}/src/server/ua_nodestore.h ${DOC_SRC_DIR}/nodestore.rst)
 generate_rst(${PROJECT_SOURCE_DIR}/src/server/ua_nodes.h ${DOC_SRC_DIR}/information_modelling.rst)
@@ -43,7 +43,7 @@ add_custom_target(doc_latex ${SPHINX_EXECUTABLE}
   -b latex "${DOC_SRC_DIR}" "${DOC_LATEX_DIR}"
   DEPENDS ${DOC_SRC_DIR}/types.rst ${DOC_SRC_DIR}/constants.rst ${DOC_SRC_DIR}/types_generated.rst
           ${DOC_SRC_DIR}/server.rst ${DOC_SRC_DIR}/client.rst ${DOC_SRC_DIR}/client_highlevel.rst
-          ${DOC_SRC_DIR}/log.rst ${DOC_SRC_DIR}/connection.rst ${DOC_SRC_DIR}/services.rst
+          ${DOC_SRC_DIR}/log.rst ${DOC_SRC_DIR}/plugin_network.rst ${DOC_SRC_DIR}/services.rst
           ${DOC_SRC_DIR}/nodestore.rst ${DOC_SRC_DIR}/information_modelling.rst
           ${DOC_SRC_DIR}/protocol.rst
           ${DOC_SRC_DIR}/tutorial_datatypes.rst
@@ -69,7 +69,7 @@ add_custom_target(doc ${SPHINX_EXECUTABLE}
   -b html "${DOC_SRC_DIR}" "${DOC_HTML_DIR}"
   DEPENDS ${DOC_SRC_DIR}/types.rst ${DOC_SRC_DIR}/constants.rst ${DOC_SRC_DIR}/types_generated.rst
           ${DOC_SRC_DIR}/server.rst ${DOC_SRC_DIR}/client.rst ${DOC_SRC_DIR}/client_highlevel.rst
-          ${DOC_SRC_DIR}/log.rst ${DOC_SRC_DIR}/connection.rst ${DOC_SRC_DIR}/services.rst
+          ${DOC_SRC_DIR}/log.rst ${DOC_SRC_DIR}/plugin_network.rst ${DOC_SRC_DIR}/services.rst
           ${DOC_SRC_DIR}/nodestore.rst ${DOC_SRC_DIR}/information_modelling.rst
           ${DOC_SRC_DIR}/protocol.rst
           ${DOC_SRC_DIR}/tutorial_datatypes.rst

+ 1 - 1
doc/internal.rst

@@ -3,6 +3,6 @@ Internals
 
 .. toctree::
 
+   plugin_network
    nodestore
-   connection
    log

+ 1 - 5
include/ua_client.h

@@ -9,9 +9,8 @@
 extern "C" {
 #endif
 
-#include "ua_config.h"
 #include "ua_types.h"
-#include "ua_connection.h"
+#include "ua_plugin_network.h"
 #include "ua_log.h"
 #include "ua_types_generated.h"
 #include "ua_types_generated_handling.h"
@@ -35,9 +34,6 @@ extern "C" {
  *
  * 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 */

+ 0 - 139
include/ua_connection.h

@@ -1,139 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef UA_CONNECTION_H_
-#define UA_CONNECTION_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "ua_types.h"
-
-/**
- * Networking
- * ----------
- * Client-server connection is represented by a `UA_Connection` structure. In
- * order to allow for different operating systems and connection types. For
- * this, `UA_Connection` stores a pointer to user-defined data and
- * function-pointers to interact with the underlying networking implementation.
- *
- * An example networklayer for TCP communication is contained in the plugins
- * folder. The networklayer forwards messages with `UA_Connection` structures to
- * the main open62541 library. The library can then return messages vie TCP
- * without being aware of the underlying transport technology.
- *
- * Connection Config
- * ^^^^^^^^^^^^^^^^^ */
-typedef struct {
-    UA_UInt32 protocolVersion;
-    UA_UInt32 sendBufferSize;
-    UA_UInt32 recvBufferSize;
-    UA_UInt32 maxMessageSize;
-    UA_UInt32 maxChunkCount;
-} UA_ConnectionConfig;
-
-extern const UA_EXPORT UA_ConnectionConfig UA_ConnectionConfig_standard;
-
-/**
- * Connection Structure
- * ^^^^^^^^^^^^^^^^^^^^ */
-typedef enum {
-    UA_CONNECTION_OPENING,     /* The socket is open, but the HEL/ACK handshake
-                                  is not done */
-    UA_CONNECTION_ESTABLISHED, /* The socket is open and the connection
-                                  configured */
-    UA_CONNECTION_CLOSED,      /* The socket has been closed and the connection
-                                  will be deleted */
-} UA_ConnectionState;
-
-/* Forward declarations */
-struct UA_Connection;
-typedef struct UA_Connection UA_Connection;
-
-struct UA_SecureChannel;
-typedef struct UA_SecureChannel UA_SecureChannel;
-
-struct UA_Connection {
-    UA_ConnectionState state;
-    UA_ConnectionConfig localConf;
-    UA_ConnectionConfig remoteConf;
-    UA_SecureChannel *channel;       /* The securechannel that is attached to
-                                        this connection */
-    UA_Int32 sockfd;                 /* Most connectivity solutions run on
-                                        sockets. Having the socket id here
-                                        simplifies the design. */
-    void *handle;                    /* A pointer to internal data */
-    UA_ByteString incompleteMessage; /* A half-received message (TCP is a
-                                        streaming protocol) is stored here */
-
-    /* Get a buffer for sending */
-    UA_StatusCode (*getSendBuffer)(UA_Connection *connection, size_t length,
-                                   UA_ByteString *buf);
-
-    /* Release the send buffer manually */
-    void (*releaseSendBuffer)(UA_Connection *connection, UA_ByteString *buf);
-
-    /* Sends a message over the connection. The message buffer is always freed,
-     * even if sending fails.
-     *
-     * @param connection The connection
-     * @param buf The message buffer
-     * @return Returns an error code or UA_STATUSCODE_GOOD. */
-    UA_StatusCode (*send)(UA_Connection *connection, UA_ByteString *buf);
-
-    /* Receive a message from the remote connection
-     *
-     * @param connection The connection
-     * @param response The response string. It is allocated by the connection
-     *        and needs to be freed with connection->releaseBuffer
-     * @param timeout Timeout of the recv operation in milliseconds
-     * @return Returns UA_STATUSCODE_BADCOMMUNICATIONERROR if the recv operation
-     *         can be repeated, UA_STATUSCODE_GOOD if it succeeded and
-     *         UA_STATUSCODE_BADCONNECTIONCLOSED if the connection was
-     *         closed. */
-    UA_StatusCode (*recv)(UA_Connection *connection, UA_ByteString *response,
-                          UA_UInt32 timeout);
-
-    /* Release the buffer of a received message */
-    void (*releaseRecvBuffer)(UA_Connection *connection, UA_ByteString *buf);
-
-    /* Close the connection. The network layer closes the socket, removes
-     * internal pointers to the connection and calls
-     * UA_Server_removeConnection. */
-    void (*close)(UA_Connection *connection);
-
-    /* To be called only from within the server (and not the network layer).
-     * Frees up the connection's memory. */
-    void (*free)(UA_Connection *connection);
-};
-
-void UA_EXPORT
-UA_Connection_deleteMembers(UA_Connection *connection);
-
-/**
- * EndpointURL Helper
- * ^^^^^^^^^^^^^^^^^^ */
-/* Split the given endpoint url into hostname, port and path. All arguments must
- * be non-NULL. EndpointUrls have the form "opc.tcp://hostname:port/path", port
- * and path may be omitted (together with the prefix colon and slash).
- *
- * @param endpointUrl The endpoint URL.
- * @param outHostname Set to the parsed hostname. The string points into the
- *        original endpointUrl, so no memory is allocated. If an IPv6 address is
- *        given, hostname contains e.g. '[2001:0db8:85a3::8a2e:0370:7334]'
- * @param outPort Set to the port of the url or left unchanged.
- * @param outPath Set to the path if one is present in the endpointUrl. The
- *        starting (and trailing) '/' is NOT included in the path. The string
- *        points into the original endpointUrl, so no memory is allocated.
- * @return Returns UA_STATUSCODE_BADTCPENDPOINTURLINVALID if parsing failed. */
-UA_StatusCode UA_EXPORT
-UA_parseEndpointUrl(const UA_String *endpointUrl, UA_String *outHostname,
-                    UA_UInt16 *outPort, UA_String *outPath);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif /* UA_CONNECTION_H_ */

+ 224 - 0
include/ua_plugin_network.h

@@ -0,0 +1,224 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef UA_PLUGIN_NETWORK_H_
+#define UA_PLUGIN_NETWORK_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "ua_types.h"
+#include "ua_log.h"
+
+/* Forward declarations */
+struct UA_Connection;
+typedef struct UA_Connection UA_Connection;
+
+struct UA_SecureChannel;
+typedef struct UA_SecureChannel UA_SecureChannel;
+
+struct UA_Server;
+typedef struct UA_Server UA_Server;
+
+struct UA_ServerNetworkLayer;
+typedef struct UA_ServerNetworkLayer UA_ServerNetworkLayer;
+
+/**
+ * .. _networking:
+ * 
+ * Networking Plugin API
+ * =====================
+ *
+ * Connection
+ * ----------
+ * Client-server connections are represented by a `UA_Connection`. The
+ * connection is stateful and stores partially received messages, and so on. In
+ * addition, the connection contains function pointers to the underlying
+ * networking implementation. An example for this is the `send` function. So the
+ * connection encapsulates all the required networking functionality. This lets
+ * users on embedded (or otherwise exotic) systems implement their own
+ * networking plugins with a clear interface to the main open62541 library. */
+
+typedef struct {
+    UA_UInt32 protocolVersion;
+    UA_UInt32 sendBufferSize;
+    UA_UInt32 recvBufferSize;
+    UA_UInt32 maxMessageSize;
+    UA_UInt32 maxChunkCount;
+} UA_ConnectionConfig;
+
+typedef enum {
+    UA_CONNECTION_OPENING,     /* The socket is open, but the HEL/ACK handshake
+                                * is not done */
+    UA_CONNECTION_ESTABLISHED, /* The socket is open and the connection
+                                * configured */
+    UA_CONNECTION_CLOSED,      /* The socket has been closed and the connection
+                                * will be deleted */
+} UA_ConnectionState;
+
+struct UA_Connection {
+    UA_ConnectionState state;
+    UA_ConnectionConfig localConf;
+    UA_ConnectionConfig remoteConf;
+    UA_SecureChannel *channel;       /* The securechannel that is attached to
+                                      * this connection */
+    UA_Int32 sockfd;                 /* Most connectivity solutions run on
+                                      * sockets. Having the socket id here
+                                      * simplifies the design. */
+    void *handle;                    /* A pointer to internal data */
+    UA_ByteString incompleteMessage; /* A half-received message (TCP is a
+                                      * streaming protocol) is stored here */
+
+    /* Get a buffer for sending */
+    UA_StatusCode (*getSendBuffer)(UA_Connection *connection, size_t length,
+                                   UA_ByteString *buf);
+
+    /* Release the send buffer manually */
+    void (*releaseSendBuffer)(UA_Connection *connection, UA_ByteString *buf);
+
+    /* Sends a message over the connection. The message buffer is always freed,
+     * even if sending fails.
+     *
+     * @param connection The connection
+     * @param buf The message buffer
+     * @return Returns an error code or UA_STATUSCODE_GOOD. */
+    UA_StatusCode (*send)(UA_Connection *connection, UA_ByteString *buf);
+
+    /* Receive a message from the remote connection
+     *
+     * @param connection The connection
+     * @param response The response string. It is allocated by the connection
+     *        and needs to be freed with connection->releaseBuffer
+     * @param timeout Timeout of the recv operation in milliseconds
+     * @return Returns UA_STATUSCODE_BADCOMMUNICATIONERROR if the recv operation
+     *         can be repeated, UA_STATUSCODE_GOOD if it succeeded and
+     *         UA_STATUSCODE_BADCONNECTIONCLOSED if the connection was
+     *         closed. */
+    UA_StatusCode (*recv)(UA_Connection *connection, UA_ByteString *response,
+                          UA_UInt32 timeout);
+
+    /* Release the buffer of a received message */
+    void (*releaseRecvBuffer)(UA_Connection *connection, UA_ByteString *buf);
+
+    /* Close the connection. The network layer closes the socket, removes
+     * internal pointers to the connection and calls
+     * UA_Server_removeConnection. */
+    void (*close)(UA_Connection *connection);
+
+    /* To be called only from within the server (and not the network layer).
+     * Frees up the connection's memory. */
+    void (*free)(UA_Connection *connection);
+};
+
+/* Cleans up half-received messages, and so on. Called from connection->free. */
+void UA_EXPORT
+UA_Connection_deleteMembers(UA_Connection *connection);
+
+/**
+ * Server Network Layer
+ * --------------------
+ * The server exposes two functions to interact with remote clients:
+ * `processBinaryMessage` and `removeConnection`. These functions are called by
+ * the server network layer.
+ *
+ * It is the job of the server network layer to listen on a TCP socket, to
+ * accept new connections, to call the server with received messages and to
+ * signal closed connections to the server.
+ *
+ * The network layer is part of the server config. So users can provide a custom
+ * implementation if the provided example does not fit their architecture. The
+ * network layer is invoked only from the server's main loop. So the network
+ * layer does not need to be thread-safe. If the networklayer receives a
+ * positive duration for blocking listening, the server's main loop will block
+ * until a message is received or the duration times out. */
+
+/* Process a binary message (TCP packet). The message can contain partial
+ * chunks. (TCP is a streaming protocol and packets may be split/merge during
+ * transport.) After processing, the message is freed with
+ * connection->releaseRecvBuffer. */
+void UA_EXPORT
+UA_Server_processBinaryMessage(UA_Server *server, UA_Connection *connection,
+                               UA_ByteString *message);
+
+/* The server internally cleans up the connection and then calls
+ * connection->free. */
+void UA_EXPORT
+UA_Server_removeConnection(UA_Server *server, UA_Connection *connection);
+
+struct UA_ServerNetworkLayer {
+    void *handle; /* Internal data */
+    UA_String discoveryUrl;
+
+    /* Start listening on the networklayer.
+     *
+     * @param nl The network layer
+     * @param logger The logger
+     * @return Returns UA_STATUSCODE_GOOD or an error code. */
+    UA_StatusCode (*start)(UA_ServerNetworkLayer *nl, UA_Logger logger);
+
+    /* Listen for new and closed connections and arriving packets. Calls
+     * UA_Server_processBinaryMessage for the arriving packets. Calls
+     * UA_Server_removeConnection for closed connections.
+     *
+     * @param nl The network layer
+     * @param server The server for processing the incoming packets and for
+     *               closing connections. 
+     * @param timeout The timeout during which an event must arrive in
+     *                milliseconds
+     * @return A statuscode for the status of the network layer. */
+    UA_StatusCode (*listen)(UA_ServerNetworkLayer *nl, UA_Server *server,
+                            UA_UInt16 timeout);
+
+    /* Close the network socket and all open connections. Afterwards, the
+     * network layer can be safely deleted.
+     *
+     * @param nl The network layer
+     * @param server The server that processes the incoming packets and for
+     *               closing connections before deleting them.
+     * @return A statuscode for the status of the closing operation. */
+    void (*stop)(UA_ServerNetworkLayer *nl, UA_Server *server);
+
+    /* Deletes the network layer context. Call only after stopping. */
+    void (*deleteMembers)(UA_ServerNetworkLayer *nl);
+};
+
+/**
+ * Client Network Layer
+ * --------------------
+ * The client has only a single connection. The connection is used for both
+ * sending and receiving binary messages. */
+
+typedef UA_Connection
+(*UA_ConnectClientConnection)(UA_ConnectionConfig localConf,
+                              const char *endpointUrl, UA_Logger logger);
+
+/**
+ * Endpoint URL Parser
+ * -------------------
+ * The endpoint URL parser is generally useful for the implementation of network
+ * layer plugins. */
+
+/* Split the given endpoint url into hostname, port and path. All arguments must
+ * be non-NULL. EndpointUrls have the form "opc.tcp://hostname:port/path", port
+ * and path may be omitted (together with the prefix colon and slash).
+ *
+ * @param endpointUrl The endpoint URL.
+ * @param outHostname Set to the parsed hostname. The string points into the
+ *        original endpointUrl, so no memory is allocated. If an IPv6 address is
+ *        given, hostname contains e.g. '[2001:0db8:85a3::8a2e:0370:7334]'
+ * @param outPort Set to the port of the url or left unchanged.
+ * @param outPath Set to the path if one is present in the endpointUrl.
+ *        Starting or trailing '/' are NOT included in the path. The string
+ *        points into the original endpointUrl, so no memory is allocated.
+ * @return Returns UA_STATUSCODE_BADTCPENDPOINTURLINVALID if parsing failed. */
+UA_StatusCode UA_EXPORT
+UA_parseEndpointUrl(const UA_String *endpointUrl, UA_String *outHostname,
+                    UA_UInt16 *outPort, UA_String *outPath);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif /* UA_PLUGIN_NETWORK_H_ */

+ 3 - 70
include/ua_server.h

@@ -15,13 +15,7 @@ extern "C" {
 #include "ua_types_generated_handling.h"
 #include "ua_nodeids.h"
 #include "ua_log.h"
-#include "ua_connection.h"
-
-struct UA_Server;
-typedef struct UA_Server UA_Server;
-
-struct UA_ServerNetworkLayer;
-typedef struct UA_ServerNetworkLayer UA_ServerNetworkLayer;
+#include "ua_plugin_network.h"
 
 /**
  * .. _server:
@@ -29,48 +23,6 @@ typedef struct UA_ServerNetworkLayer UA_ServerNetworkLayer;
  * Server
  * ======
  *
- * Network Layer
- * -------------
- * Interface to the binary network layers. The functions in the network layer
- * are never called in parallel but only sequentially from the server's main
- * loop. So the network layer does not need to be thread-safe. */
-struct UA_ServerNetworkLayer {
-    void *handle; // pointer to internal data
-    UA_String discoveryUrl;
-
-    /* Starts listening on the the networklayer.
-     *
-     * @param nl The network layer
-     * @param logger The logger
-     * @return Returns UA_STATUSCODE_GOOD or an error code. */
-    UA_StatusCode (*start)(UA_ServerNetworkLayer *nl, UA_Logger logger);
-
-    /* Gets called from the main server loop and dispatches the received
-     * messages in the server.
-     *
-     * @param nl The network layer
-     * @param server The server that processes the incoming packets and for closing
-     *               connections before deleting them.
-     * @param timeout The timeout during which an event must arrive in
-     *                microseconds
-     * @return A statuscode for the status of the network layer. */
-    UA_StatusCode (*listen)(UA_ServerNetworkLayer *nl, UA_Server *server,
-                            UA_UInt16 timeout);
-
-    /* Closes the network socket and all open connections before the network
-     * layer can be safely deleted.
-     *
-     * @param nl The network layer
-     * @param server The server that processes the incoming packets and for closing
-     *               connections before deleting them.
-     * @return A statuscode for the status of the closing operation. */
-    void (*stop)(UA_ServerNetworkLayer *nl, UA_Server *server);
-
-    /** Deletes the network content. Call only after stopping. */
-    void (*deleteMembers)(UA_ServerNetworkLayer *nl);
-};
-
-/**
  * Access Control
  * --------------
  * The access control callback is used to authenticate sessions and grant access
@@ -136,7 +88,8 @@ typedef struct {
 /**
  * Server Configuration
  * --------------------
- * The following structure is passed to a new server for configuration. */
+ * The configuration structure is passed to the server during initialization. */
+
 typedef struct {
     UA_String username;
     UA_String password;
@@ -278,26 +231,6 @@ UA_Server_changeRepeatedCallbackInterval(UA_Server *server, UA_UInt64 callbackId
 UA_StatusCode UA_EXPORT
 UA_Server_removeRepeatedCallback(UA_Server *server, UA_UInt64 callbackId);
 
-/*
- * Networking
- * ----------
- *
- * Connections are created in the network layer. The server gets called to
- * remove the connection.
- * - Unlink the securechannel, and so on.
- * - Free the connection when no (concurrent) server thread uses it any more. */
-void UA_EXPORT
-UA_Server_removeConnection(UA_Server *server,
-                           UA_Connection *connection);
-
-/* Process a binary message (packet). The message can contain partial chunks.
- * (TCP is a streaming protocol and packets may be split/merge during
- * transport.) The message is freed with connection->releaseRecvBuffer. */
-void UA_EXPORT
-UA_Server_processBinaryMessage(UA_Server *server,
-                               UA_Connection *connection,
-                               UA_ByteString *message);
-
 /**
  * Reading and Writing Node Attributes
  * -----------------------------------

+ 3 - 2
plugins/ua_config_standard.h

@@ -12,8 +12,9 @@ extern "C" {
 #include "ua_client.h"
 #include "ua_client_highlevel.h"
 
-extern UA_EXPORT const UA_ServerConfig UA_ServerConfig_standard;
-extern UA_EXPORT const UA_ClientConfig UA_ClientConfig_standard;
+extern const UA_EXPORT UA_ConnectionConfig UA_ConnectionConfig_standard;
+extern const UA_EXPORT UA_ServerConfig UA_ServerConfig_standard;
+extern const UA_EXPORT UA_ClientConfig UA_ClientConfig_standard;
 
 #ifdef __cplusplus
 }

+ 1 - 1
src/client/ua_client.c

@@ -590,7 +590,7 @@ __UA_Client_connect(UA_Client *client, const char *endpointUrl,
 
     UA_StatusCode retval = UA_STATUSCODE_GOOD;
     client->connection =
-        client->config.connectionFunc(UA_ConnectionConfig_standard,
+        client->config.connectionFunc(client->config.localConnectionConfig,
                                       endpointUrl, client->config.logger);
     if(client->connection.state != UA_CONNECTION_OPENING) {
         retval = UA_STATUSCODE_BADCONNECTIONCLOSED;

+ 1 - 1
src/ua_connection_internal.h

@@ -9,7 +9,7 @@
 extern "C" {
 #endif
 
-#include "ua_connection.h"
+#include "ua_plugin_network.h"
 
 /* The network layer may receive chopped up messages since TCP is a streaming
  * protocol. Furthermore, the networklayer may operate on ringbuffers or

+ 1 - 1
src/ua_util.c

@@ -3,7 +3,7 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "ua_util.h"
-#include "ua_connection.h"
+#include "ua_plugin_network.h"
 
 size_t
 UA_readNumber(u8 *buf, size_t buflen, u32 *number) {

+ 1 - 0
tests/testing_networklayers.c

@@ -4,6 +4,7 @@
 
 #include <stdlib.h>
 #include "testing_networklayers.h"
+#include "ua_config_standard.h"
 
 static UA_StatusCode
 dummyGetSendBuffer(UA_Connection *connection, size_t length, UA_ByteString *buf) {