Sfoglia il codice sorgente

use a const string for the client connection

Julius Pfrommer 9 anni fa
parent
commit
7c152a5ece

+ 1 - 1
examples/networklayer_tcp.c

@@ -479,7 +479,7 @@ ClientNetworkLayerClose(UA_Connection *connection) {
 
 /* we have no networklayer. instead, attach the reusable buffer to the handle */
 UA_Connection
-ClientNetworkLayerTCP_connect(UA_ConnectionConfig localConf, char *endpointUrl, UA_Logger logger) {
+ClientNetworkLayerTCP_connect(UA_ConnectionConfig localConf, const char *endpointUrl, UA_Logger logger) {
     UA_Connection connection;
     UA_Connection_init(&connection);
     connection.localConf = localConf;

+ 1 - 1
examples/networklayer_tcp.h

@@ -17,7 +17,7 @@ extern "C" {
 UA_ServerNetworkLayer UA_EXPORT * ServerNetworkLayerTCP_new(UA_ConnectionConfig conf, UA_UInt32 port);
 
 UA_Connection UA_EXPORT
-ClientNetworkLayerTCP_connect(UA_ConnectionConfig conf, char *endpointUrl, UA_Logger logger);
+ClientNetworkLayerTCP_connect(UA_ConnectionConfig conf, const char *endpointUrl, UA_Logger logger);
 
 #ifdef __cplusplus
 } // extern "C"

+ 2 - 2
include/ua_client.h

@@ -52,7 +52,7 @@ void UA_EXPORT UA_Client_delete(UA_Client* client);
 /* Manage the Connection */
 /*************************/
 
-typedef UA_Connection (*UA_ConnectClientConnection)(UA_ConnectionConfig localConf, char *endpointUrl,
+typedef UA_Connection (*UA_ConnectClientConnection)(UA_ConnectionConfig localConf, const char *endpointUrl,
                                                     UA_Logger logger);
 
 /**
@@ -64,7 +64,7 @@ typedef UA_Connection (*UA_ConnectClientConnection)(UA_ConnectionConfig localCon
  * @return Indicates whether the operation succeeded or returns an error code
  */
 UA_StatusCode UA_EXPORT
-UA_Client_connect(UA_Client *client, UA_ConnectClientConnection connFunc, char *endpointUrl);
+UA_Client_connect(UA_Client *client, UA_ConnectClientConnection connFunc, const char *endpointUrl);
 
 /**
  * close a connection to the selected server

+ 1 - 1
src/client/ua_client.c

@@ -446,7 +446,7 @@ static UA_StatusCode CloseSecureChannel(UA_Client *client) {
 }
 
 UA_StatusCode UA_Client_connect(UA_Client *client, UA_ConnectClientConnection connectFunc,
-                                char *endpointUrl) {
+                                const char *endpointUrl) {
     if(client->state == UA_CLIENTSTATE_CONNECTED)
         return UA_STATUSCODE_GOOD;
     if(client->state == UA_CLIENTSTATE_ERRORED) {