]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Move appInfo and serviceDiscovery plugin related header files.
authorOliver Kurth <okurth@vmware.com>
Wed, 10 Jun 2020 19:05:44 +0000 (12:05 -0700)
committerOliver Kurth <okurth@vmware.com>
Wed, 10 Jun 2020 19:05:44 +0000 (12:05 -0700)
As part of an upcoming project, some appinfo and serviceDiscovery
header files are needed at a different location in the common source
tree.

* Moved the appInfo.h and serviceDiscovery.h to a different location.

* Made necessary code and OVT changes to refer to new file paths.

* Did some cleanup related to the MACRO names for the keys and scripts.

open-vm-tools/lib/include/vmware/guestrpc/appInfo.h [moved from open-vm-tools/lib/include/appInfo.h with 88% similarity]
open-vm-tools/lib/include/vmware/guestrpc/serviceDiscovery.h [new file with mode: 0644]
open-vm-tools/services/plugins/appInfo/appInfo.c
open-vm-tools/services/plugins/serviceDiscovery/Makefile.am
open-vm-tools/services/plugins/serviceDiscovery/serviceDiscovery.c
open-vm-tools/services/plugins/serviceDiscovery/serviceDiscoveryInt.h [moved from open-vm-tools/services/plugins/serviceDiscovery/serviceDiscovery.h with 91% similarity]
open-vm-tools/services/plugins/serviceDiscovery/serviceDiscoveryPosix.c

similarity index 88%
rename from open-vm-tools/lib/include/appInfo.h
rename to open-vm-tools/lib/include/vmware/guestrpc/appInfo.h
index f6a27ed6f5044cb68f0e66dd2ca6d20fc5b014d3..bef7fc68562685933c96139f893be12eda0700c9 100644 (file)
@@ -1,5 +1,5 @@
 /*********************************************************
- * Copyright (C) 2019 VMware, Inc. All rights reserved.
+ * Copyright (C) 2020 VMware, Inc. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License as published
@@ -22,7 +22,8 @@
 /**
  * @file appInfo.h
  *
- * Declares few constants for the appInfo plugin.
+ * Common declarations that aid in sending application information
+ * from 'appInfo' plugin in 'VMware Tools' to the host.
  */
 
 /**
diff --git a/open-vm-tools/lib/include/vmware/guestrpc/serviceDiscovery.h b/open-vm-tools/lib/include/vmware/guestrpc/serviceDiscovery.h
new file mode 100644 (file)
index 0000000..8a6d869
--- /dev/null
@@ -0,0 +1,58 @@
+/*********************************************************
+ * Copyright (C) 2020 VMware, Inc. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation version 2.1 and no later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the Lesser GNU General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA.
+ *
+ *********************************************************/
+
+#ifndef _SERVICEDISCOVERY_H_
+#define _SERVICEDISCOVERY_H_
+
+/**
+ * @file serviceDiscovery.h
+ *
+ * Common declarations that aid in sending services information
+ * from 'serviceDiscovery' plugin in 'VMware Tools' to the host.
+ */
+
+
+/*
+ * Namespace DB used for service discovery
+ */
+#define SERVICE_DISCOVERY_NAMESPACE_DB_NAME "com.vmware.vrops.sdmp"
+
+/*
+ * ready - used to identify if data is succesfully written to Namespace DB
+ * signal - signal send by sdmp client for plugin to start data collection
+ */
+#define SERVICE_DISCOVERY_KEY_READY "ready"
+#define SERVICE_DISCOVERY_KEY_SIGNAL "signal"
+
+/*
+ * keys for types of service data collected by plugin.
+ */
+#define SERVICE_DISCOVERY_KEY_PROCESSES "listening-process-info"
+#define SERVICE_DISCOVERY_KEY_CONNECTIONS "connection-info"
+#define SERVICE_DISCOVERY_KEY_PERFORMANCE_METRICS                              \
+   "listening-process-perf-metrics"
+#define SERVICE_DISCOVERY_KEY_VERSIONS "versions"
+
+/*
+ * keys for types of service data collected by plugin from Windows guest
+ */
+#define SERVICE_DISCOVERY_WIN_KEY_RELATIONSHIP "pid-to-ppid"
+#define SERVICE_DISCOVERY_WIN_KEY_NET "net"
+#define SERVICE_DISCOVERY_WIN_KEY_IIS_PORTS "iis-ports-info"
+
+#endif /* _SERVICEDISCOVERY_H_ */
index 4e64799b628bf4de72feebf93316532be4149663..3e4a259b91bd873b62c2afe84970e194e3e1c2e1 100644 (file)
@@ -28,7 +28,6 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "appInfo.h"
 #include "appInfoInt.h"
 #include "vmware.h"
 #include "conf.h"
@@ -38,6 +37,7 @@
 #include "util.h"
 #include "vm_atomic.h"
 #include "vmcheck.h"
+#include "vmware/guestrpc/appInfo.h"
 #include "vmware/tools/log.h"
 #include "vmware/tools/threadPool.h"
 #include "vmware/tools/utils.h"
index f341f9b545fc79657a7d678fb05be32b835d7bf2..f16964c24e5edc0eb930c587fc688cd59e953421 100644 (file)
@@ -34,7 +34,7 @@ libserviceDiscovery_la_LIBADD += @GOBJECT_LIBS@
 libserviceDiscovery_la_SOURCES =
 libserviceDiscovery_la_SOURCES += serviceDiscovery.c
 libserviceDiscovery_la_SOURCES += serviceDiscoveryPosix.c
-libserviceDiscovery_la_SOURCES += serviceDiscovery.h
+libserviceDiscovery_la_SOURCES += serviceDiscoveryInt.h
 
 install-data-local:
        $(INSTALL) -d $(DESTDIR)/$(libdir)/open-vm-tools/serviceDiscovery/scripts/
index f57f02446920f26db6728be2d8dd3dee3bb11641..622f5c3f8de47b2629c64846d825ca4194449a7f 100644 (file)
@@ -25,7 +25,7 @@
 
 #include <string.h>
 
-#include "serviceDiscovery.h"
+#include "serviceDiscoveryInt.h"
 #include "vmware.h"
 #include "conf.h"
 #include "dynbuf.h"
@@ -34,6 +34,7 @@
 #include "util.h"
 #include "vm_atomic.h"
 #include "vmcheck.h"
+#include "vmware/guestrpc/serviceDiscovery.h"
 #include "vmware/tools/log.h"
 #include "vmware/tools/threadPool.h"
 #include "vmware/tools/utils.h"
@@ -50,61 +51,42 @@ VM_EMBED_VERSION(VMTOOLSD_VERSION_STRING);
 #define NSDB_PRIV_GET_VALUES_CMD "namespace-priv-get-values"
 #define NSDB_PRIV_SET_KEYS_CMD "namespace-priv-set-keys"
 
-/*
- * Namespace DB used for service discovery
- */
-#define SERVICE_DISCOVERY_NAMESPACE_DB_NAME "com.vmware.vrops.sdmp"
-
-/*
- * ready - used to identify if data is succesfully written to Namespace DB
- * signal - signal send by sdmp client for plugin to start data collection
- */
-#define SERVICE_DISCOVERY_KEY_NAME_READY "ready"
-#define SERVICE_DISCOVERY_KEY_NAME_SIGNAL "signal"
 
 #if defined (_WIN32)
 
-/*
- * keys for types of service data collected by plugin from Windows guest
- */
-#define WIN_KEY_NAME_PROCESSES "listening-process-info"
-#define WIN_KEY_NAME_CONNECTIONS "connection-info"
-#define WIN_KEY_NAME_PERFORMANCE_METRICS "listening-process-perf-metrics"
-#define WIN_KEY_NAME_VERSIONS "versions"
-#define WIN_KEY_NAME_RELATIONSHIP "pid-to-ppid"
-#define WIN_KEY_NAME_NET "net"
-#define WIN_KEY_NAME_IIS_PORTS "iis-ports-info"
+#define SCRIPT_EXTN ".bat"
 
 /*
- * scripts used by plugin to collect from Windows guest
+ * Scripts used by plugin in Windows guests to capture information about
+ * running services.
  */
-#define WIN_SCRIPT_NAME_PROCESSES "get-listening-process-info.bat"
-#define WIN_SCRIPT_NAME_CONNECTIONS "get-connection-info.bat"
-#define WIN_SCRIPT_NAME_PERFORMANCE_METRICS "get-performance-metrics.bat"
-#define WIN_SCRIPT_NAME_VERSIONS "get-versions.bat"
-#define WIN_SCRIPT_NAME_RELATIONSHIP "get-parent-child-rels.bat"
-#define WIN_SCRIPT_NAME_NET "net-share.bat"
-#define WIN_SCRIPT_NAME_IIS_PORTS "get-iis-ports-info.bat"
+#define SERVICE_DISCOVERY_SCRIPT_PERFORMANCE_METRICS \
+        "get-performance-metrics" SCRIPT_EXTN
+#define SERVICE_DISCOVERY_WIN_SCRIPT_RELATIONSHIP "get-parent-child-rels" \
+        SCRIPT_EXTN
+#define SERVICE_DISCOVERY_WIN_SCRIPT_NET "net-share" SCRIPT_EXTN
+#define SERVICE_DISCOVERY_WIN_SCRIPT_IIS_PORTS "get-iis-ports-info" SCRIPT_EXTN
 
 #else
 
+#define SCRIPT_EXTN ".sh"
+
 /*
- * keys for types of service data collected by plugin from Linux guest
+ * Scripts used by plugin in Linux guests to capture information about
+ * running services.
  */
-#define LIN_KEY_NAME_PROCESSES "listening-process-info"
-#define LIN_KEY_NAME_CONNECTIONS "connection-info"
-#define LIN_KEY_NAME_PERFORMANCE_METRICS "listening-process-perf-metrics"
-#define LIN_KEY_NAME_VERSIONS "versions"
+#define SERVICE_DISCOVERY_SCRIPT_PERFORMANCE_METRICS \
+        "get-listening-process-perf-metrics" SCRIPT_EXTN
+#endif
 
 /*
- * scripts used by plugin to collect from Linux guest
+ * Scripts used by plugin in both Windows and Linux guests to capture
+ * information about running services.
  */
-#define LIN_SCRIPT_NAME_PROCESSES "get-listening-process-info.sh"
-#define LIN_SCRIPT_NAME_CONNECTIONS "get-connection-info.sh"
-#define LIN_SCRIPT_NAME_PERFORMANCE_METRICS "get-listening-process-perf-metrics.sh"
-#define LIN_SCRIPT_NAME_VERSIONS "get-versions.sh"
-
-#endif
+#define SERVICE_DISCOVERY_SCRIPT_PROCESSES "get-listening-process-info" \
+        SCRIPT_EXTN
+#define SERVICE_DISCOVERY_SCRIPT_CONNECTIONS "get-connection-info" SCRIPT_EXTN
+#define SERVICE_DISCOVERY_SCRIPT_VERSIONS "get-versions" SCRIPT_EXTN
 
 /*
  * Default value for CONFNAME_SERVICE_DISCOVERY_DISABLED setting in
@@ -139,24 +121,21 @@ typedef struct {
    gchar *val;
 } KeyNameValue;
 
-#if defined(_WIN32)
 static KeyNameValue gKeyScripts[] = {
-   { WIN_KEY_NAME_PROCESSES, WIN_SCRIPT_NAME_PROCESSES },
-   { WIN_KEY_NAME_CONNECTIONS, WIN_SCRIPT_NAME_CONNECTIONS },
-   { WIN_KEY_NAME_PERFORMANCE_METRICS, WIN_SCRIPT_NAME_PERFORMANCE_METRICS },
-   { WIN_KEY_NAME_VERSIONS, WIN_SCRIPT_NAME_VERSIONS },
-   { WIN_KEY_NAME_RELATIONSHIP, WIN_SCRIPT_NAME_RELATIONSHIP },
-   { WIN_KEY_NAME_IIS_PORTS, WIN_SCRIPT_NAME_IIS_PORTS },
-   { WIN_KEY_NAME_NET, WIN_SCRIPT_NAME_NET },
-};
-#else
-static KeyNameValue gKeyScripts[] = {
-   { LIN_KEY_NAME_PROCESSES, LIN_SCRIPT_NAME_PROCESSES },
-   { LIN_KEY_NAME_CONNECTIONS, LIN_SCRIPT_NAME_CONNECTIONS },
-   { LIN_KEY_NAME_PERFORMANCE_METRICS, LIN_SCRIPT_NAME_PERFORMANCE_METRICS },
-   { LIN_KEY_NAME_VERSIONS, LIN_SCRIPT_NAME_VERSIONS },
-};
+   { SERVICE_DISCOVERY_KEY_PROCESSES, SERVICE_DISCOVERY_SCRIPT_PROCESSES },
+   { SERVICE_DISCOVERY_KEY_CONNECTIONS,
+     SERVICE_DISCOVERY_SCRIPT_CONNECTIONS },
+   { SERVICE_DISCOVERY_KEY_PERFORMANCE_METRICS,
+     SERVICE_DISCOVERY_SCRIPT_PERFORMANCE_METRICS },
+   { SERVICE_DISCOVERY_KEY_VERSIONS, SERVICE_DISCOVERY_SCRIPT_VERSIONS },
+#if defined(_WIN32)
+   { SERVICE_DISCOVERY_WIN_KEY_RELATIONSHIP,
+     SERVICE_DISCOVERY_WIN_SCRIPT_RELATIONSHIP },
+   { SERVICE_DISCOVERY_WIN_KEY_IIS_PORTS,
+     SERVICE_DISCOVERY_WIN_SCRIPT_IIS_PORTS },
+   { SERVICE_DISCOVERY_WIN_KEY_NET, SERVICE_DISCOVERY_WIN_SCRIPT_NET },
 #endif
+};
 
 static GSource *gServiceDiscoveryTimeoutSource = NULL;
 static gint64 gLastWriteTime = 0;
@@ -609,11 +588,11 @@ ServiceDiscoveryTask(ToolsAppCtx *ctx,
    /*
     * Reset "ready" flag to stop readers until all data is written
     */
-   status = WriteData(ctx, SERVICE_DISCOVERY_KEY_NAME_READY, "FALSE", 5);
+   status = WriteData(ctx, SERVICE_DISCOVERY_KEY_READY, "FALSE", 5);
    if (!status) {
       gLastWriteTime = previousWriteTime;
       g_warning("%s: Failed to reset %s flag", __FUNCTION__,
-                SERVICE_DISCOVERY_KEY_NAME_READY);
+                SERVICE_DISCOVERY_KEY_READY);
       goto out;
    }
 
@@ -633,7 +612,7 @@ ServiceDiscoveryTask(ToolsAppCtx *ctx,
    /*
     * Update ready flag
     */
-   status = WriteData(ctx, SERVICE_DISCOVERY_KEY_NAME_READY, "TRUE", 4);
+   status = WriteData(ctx, SERVICE_DISCOVERY_KEY_READY, "TRUE", 4);
    if (!status) {
       g_warning("%s: Failed to update ready flag", __FUNCTION__);
    }
@@ -674,7 +653,7 @@ checkForWrite(ToolsAppCtx *ctx)
    /*
     * Read signal from Namespace DB
     */
-   if (!ReadData(ctx, SERVICE_DISCOVERY_KEY_NAME_SIGNAL, &signal, &signalLen)) {
+   if (!ReadData(ctx, SERVICE_DISCOVERY_KEY_SIGNAL, &signal, &signalLen)) {
       g_debug("%s: Failed to read necessary information from Namespace DB\n",
               __FUNCTION__);
    } else {
similarity index 91%
rename from open-vm-tools/services/plugins/serviceDiscovery/serviceDiscovery.h
rename to open-vm-tools/services/plugins/serviceDiscovery/serviceDiscoveryInt.h
index 445c20a746b1a386ff503d340465f0aaac09cdc6..71267cd569dc0be1a0f544c955a67fc2256fa2e5 100644 (file)
  *
  *********************************************************/
 
-#ifndef _SERVICEDISCOVERY_H_
-#define _SERVICEDISCOVERY_H_
+#ifndef _SERVICEDISCOVERYINT_H_
+#define _SERVICEDISCOVERYINT_H_
 
 /**
- * @file serviceDiscovery.h
+ * @file serviceDiscoveryInt.h
  *
  * Declares few constants for the serviceDiscovery plugin.
  */
@@ -45,4 +45,4 @@ Bool WriteData(ToolsAppCtx *ctx,
                const char *data,
                const size_t len);
 
-#endif /* _SERVICEDISCOVERY_H_ */
\ No newline at end of file
+#endif /* _SERVICEDISCOVERYINT_H_ */
index 2b1b9d3718ff62813ccc2447bf9e137865e89d8c..c3c2b83bdfe3e27e8a09044f31f694801fe15f17 100644 (file)
@@ -27,7 +27,7 @@
 #   error This file should not be compiled.
 #endif
 
-#include "serviceDiscovery.h"
+#include "serviceDiscoveryInt.h"
 #include "dynbuf.h"
 
 #include <stdio.h>