Prechádzať zdrojové kódy

Client: Add UA_Client_getConfig

Julius Pfrommer 6 rokov pred
rodič
commit
acf47875ef
2 zmenil súbory, kde vykonal 14 pridanie a 5 odobranie
  1. 11 2
      include/ua_client.h
  2. 3 3
      src/client/ua_client.c

+ 11 - 2
include/ua_client.h

@@ -79,9 +79,18 @@ UA_Client_secure_new(UA_ClientConfig config, UA_ByteString certificate,
 UA_ClientState UA_EXPORT
 UA_Client_getState(UA_Client *client);
 
+/* Get the client configuration */
+UA_EXPORT UA_ClientConfig *
+UA_Client_getConfig(UA_Client *client);
+
 /* Get the client context */
-void UA_EXPORT *
-UA_Client_getContext(UA_Client *client);
+static UA_INLINE void *
+UA_Client_getContext(UA_Client *client) {
+    UA_ClientConfig *config = UA_Client_getConfig(client);
+    if(!config)
+        return NULL;
+    return config->clientContext;
+}
 
 /* Reset a client */
 void UA_EXPORT

+ 3 - 3
src/client/ua_client.c

@@ -262,11 +262,11 @@ UA_Client_getState(UA_Client *client) {
     return client->state;
 }
 
-void *
-UA_Client_getContext(UA_Client *client) {
+UA_ClientConfig *
+UA_Client_getConfig(UA_Client *client) {
     if(!client)
         return NULL;
-    return client->config.clientContext;
+    return &client->config;
 }
 
 /****************/