summaryrefslogtreecommitdiffstats
path: root/src/software-dbus
diff options
context:
space:
mode:
authorPeter Schiffer <pschiffe@redhat.com>2014-03-26 16:59:12 +0100
committerPeter Schiffer <pschiffe@redhat.com>2014-03-26 16:59:12 +0100
commitc9dd327c44eca6b5226f0d6ea4449a0261b2f2ab (patch)
tree455714a08d0bc3db5f150f0d6a7e205397eb6c63 /src/software-dbus
parent6560717c0211cd13949a5a2f1c5469cca103786c (diff)
downloadopenlmi-providers-c9dd327c44eca6b5226f0d6ea4449a0261b2f2ab.tar.gz
openlmi-providers-c9dd327c44eca6b5226f0d6ea4449a0261b2f2ab.tar.xz
openlmi-providers-c9dd327c44eca6b5226f0d6ea4449a0261b2f2ab.zip
Software-dbus: implemented LMI_SystemSoftwareCollectionProvider
Diffstat (limited to 'src/software-dbus')
-rw-r--r--src/software-dbus/LMI_Software.h1
-rw-r--r--src/software-dbus/LMI_SystemSoftwareCollectionProvider.c40
-rw-r--r--src/software-dbus/sw-utils.c9
-rw-r--r--src/software-dbus/sw-utils.h2
4 files changed, 46 insertions, 6 deletions
diff --git a/src/software-dbus/LMI_Software.h b/src/software-dbus/LMI_Software.h
index fff4714..916ca5f 100644
--- a/src/software-dbus/LMI_Software.h
+++ b/src/software-dbus/LMI_Software.h
@@ -29,5 +29,6 @@
#define INSTANCE_ID_LEN 282
#define SW_IDENTITY_CLASS_NAME "SoftwareIdentity"
+#define SYSTEM_SW_COLLECTION_CLASS_NAME "SystemSoftwareCollection"
#endif /* LMI_SOFTWARE_H_ */
diff --git a/src/software-dbus/LMI_SystemSoftwareCollectionProvider.c b/src/software-dbus/LMI_SystemSoftwareCollectionProvider.c
index 1f954ae..56a4d36 100644
--- a/src/software-dbus/LMI_SystemSoftwareCollectionProvider.c
+++ b/src/software-dbus/LMI_SystemSoftwareCollectionProvider.c
@@ -1,10 +1,32 @@
+/*
+ * Copyright (C) 2013-2014 Red Hat, Inc. All rights reserved.
+ *
+ * This library 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; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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 GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Authors: Peter Schiffer <pschiffe@redhat.com>
+ */
+
#include <konkret/konkret.h>
#include "LMI_SystemSoftwareCollection.h"
+#include "LMI_Software.h"
static const CMPIBroker* _cb = NULL;
-static void LMI_SystemSoftwareCollectionInitialize()
+static void LMI_SystemSoftwareCollectionInitialize(const CMPIContext *ctx)
{
+ lmi_init(provider_name, _cb, ctx, provider_config_defaults);
}
static CMPIStatus LMI_SystemSoftwareCollectionCleanup(
@@ -32,6 +54,18 @@ static CMPIStatus LMI_SystemSoftwareCollectionEnumInstances(
const CMPIObjectPath* cop,
const char** properties)
{
+ char instance_id[INSTANCE_ID_LEN] = "";
+
+ create_instance_id(SYSTEM_SW_COLLECTION_CLASS_NAME, NULL, instance_id,
+ INSTANCE_ID_LEN);
+
+ LMI_SystemSoftwareCollection w;
+ LMI_SystemSoftwareCollection_Init(&w, _cb, KNameSpace(cop));
+ LMI_SystemSoftwareCollection_Set_InstanceID(&w, instance_id);
+ LMI_SystemSoftwareCollection_Set_Caption(&w,
+ "System RPM Package Collection");
+ KReturnInstance(cr, w);
+
CMReturn(CMPI_RC_OK);
}
@@ -91,7 +125,7 @@ CMInstanceMIStub(
LMI_SystemSoftwareCollection,
LMI_SystemSoftwareCollection,
_cb,
- LMI_SystemSoftwareCollectionInitialize())
+ LMI_SystemSoftwareCollectionInitialize(ctx))
static CMPIStatus LMI_SystemSoftwareCollectionMethodCleanup(
CMPIMethodMI* mi,
@@ -118,7 +152,7 @@ CMMethodMIStub(
LMI_SystemSoftwareCollection,
LMI_SystemSoftwareCollection,
_cb,
- LMI_SystemSoftwareCollectionInitialize())
+ LMI_SystemSoftwareCollectionInitialize(ctx))
KONKRET_REGISTRATION(
"root/cimv2",
diff --git a/src/software-dbus/sw-utils.c b/src/software-dbus/sw-utils.c
index f10d891..ca9722a 100644
--- a/src/software-dbus/sw-utils.c
+++ b/src/software-dbus/sw-utils.c
@@ -223,6 +223,11 @@ short check_and_create_error_msg(PkResults *results, const char *custom_msg,
void create_instance_id(const char *class_name, const char *id,
char *instance_id, const unsigned instance_id_len)
{
- snprintf(instance_id, instance_id_len, ORGID ":" ORGID "_%s:%s",
- class_name, id);
+ if (id) {
+ snprintf(instance_id, instance_id_len, ORGID ":" ORGID "_%s:%s",
+ class_name, id);
+ } else {
+ snprintf(instance_id, instance_id_len, ORGID ":" ORGID "_%s",
+ class_name);
+ }
}
diff --git a/src/software-dbus/sw-utils.h b/src/software-dbus/sw-utils.h
index e5eb150..5e61ccb 100644
--- a/src/software-dbus/sw-utils.h
+++ b/src/software-dbus/sw-utils.h
@@ -106,7 +106,7 @@ short check_and_create_error_msg(PkResults *results, const char *custom_msg,
/*
* Create standard instance ID based on class name and ID.
* @param class_name
- * @param id
+ * @param id, may by null
* @param instance_id output string
* @param instance_id_len length of output string
*/