Quellcode durchsuchen

Generate datatypes for discovery only when required

Julius Pfrommer vor 6 Jahren
Ursprung
Commit
70790ebd1e

+ 4 - 0
CMakeLists.txt

@@ -519,6 +519,10 @@ else()
     if(UA_ENABLE_METHODCALLS)
         list(APPEND UA_FILE_DATATYPES ${PROJECT_SOURCE_DIR}/tools/schema/datatypes_method.txt)
     endif()
+
+    if(UA_ENABLE_DISCOVERY)
+        list(APPEND UA_FILE_DATATYPES ${PROJECT_SOURCE_DIR}/tools/schema/datatypes_discovery.txt)
+    endif()
 endif()
 
 if(NOT EXISTS "${UA_FILE_NS0}")

+ 2 - 0
include/ua_client.h

@@ -181,6 +181,7 @@ UA_Client_findServers(UA_Client *client, const char *serverUrl,
                       size_t *registeredServersSize,
                       UA_ApplicationDescription **registeredServers);
 
+#ifdef UA_ENABLE_DISCOVERY
 /* Get a list of all known server in the network. Only supported by LDS servers.
  *
  * @param client to use. Must be connected to the same endpoint given in
@@ -204,6 +205,7 @@ UA_Client_findServersOnNetwork(UA_Client *client, const char *serverUrl,
                                UA_UInt32 startingRecordId, UA_UInt32 maxRecordsToReturn,
                                size_t serverCapabilityFilterSize, UA_String *serverCapabilityFilter,
                                size_t *serverOnNetworkSize, UA_ServerOnNetwork **serverOnNetwork);
+#endif
 
 /**
  * .. _client-services:

+ 4 - 0
src/client/ua_client_discovery.c

@@ -85,6 +85,8 @@ UA_Client_findServers(UA_Client *client, const char *serverUrl,
     return retval;
 }
 
+#ifdef UA_ENABLE_DISCOVERY
+
 UA_StatusCode
 UA_Client_findServersOnNetwork(UA_Client *client, const char *serverUrl,
                                UA_UInt32 startingRecordId, UA_UInt32 maxRecordsToReturn,
@@ -134,3 +136,5 @@ UA_Client_findServersOnNetwork(UA_Client *client, const char *serverUrl,
         UA_Client_disconnect(client);
     return retval;
 }
+
+#endif

+ 6 - 1
tests/check_types_memory.c

@@ -158,7 +158,10 @@ END_TEST
 
 START_TEST(decodeShallFailWithTruncatedBufferButSurvive) {
     //Skip test for void*
-    if (_i == UA_TYPES_DISCOVERYCONFIGURATION ||
+    if (
+#ifdef UA_ENABLE_DISCOVERY
+        _i == UA_TYPES_DISCOVERYCONFIGURATION ||
+#endif
         _i == UA_TYPES_FILTEROPERAND ||
         _i == UA_TYPES_UNION ||
         _i == UA_TYPES_HISTORYREADDETAILS ||
@@ -281,7 +284,9 @@ START_TEST(calcSizeBinaryShallBeCorrect) {
        _i == UA_TYPES_VARIABLEATTRIBUTES ||
        _i == UA_TYPES_VARIABLETYPEATTRIBUTES ||
        _i == UA_TYPES_FILTEROPERAND ||
+#ifdef UA_ENABLE_DISCOVERY
        _i == UA_TYPES_DISCOVERYCONFIGURATION ||
+#endif
        _i == UA_TYPES_UNION ||
        _i == UA_TYPES_HISTORYREADDETAILS ||
        _i == UA_TYPES_NOTIFICATIONDATA ||

+ 10 - 0
tools/schema/datatypes_discovery.txt

@@ -0,0 +1,10 @@
+ServerOnNetwork
+FindServersOnNetworkRequest
+FindServersOnNetworkResponse
+RegisteredServer
+RegisterServerRequest
+RegisterServerResponse
+DiscoveryConfiguration
+MdnsDiscoveryConfiguration
+RegisterServer2Request
+RegisterServer2Response

+ 0 - 10
tools/schema/datatypes_minimal.txt

@@ -154,16 +154,6 @@ MonitoredItemModifyResult
 ModifyMonitoredItemsResponse
 SetMonitoringModeRequest
 SetMonitoringModeResponse
-RegisteredServer
-RegisterServerRequest
-RegisterServerResponse
-DiscoveryConfiguration
-MdnsDiscoveryConfiguration
-RegisterServer2Request
-RegisterServer2Response
-ServerOnNetwork
-FindServersOnNetworkRequest
-FindServersOnNetworkResponse
 DataChangeTrigger
 DeadbandType
 DataChangeFilter