/*
* hyperv_wmi_classes.h: WMI classes for managing Microsoft Hyper-V hosts
*
+ * Copyright (C) 2017 Datto Inc
* Copyright (C) 2011 Matthias Bolte <matthias.bolte@googlemail.com>
* Copyright (C) 2009 Michael Sievers <msievers83@googlemail.com>
*
#ifndef __HYPERV_WMI_CLASSES_H__
# define __HYPERV_WMI_CLASSES_H__
+# include "internal.h"
# include "openwsman.h"
# include "hyperv_wmi_classes.generated.typedef"
};
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * WMI
+ */
+
+typedef struct _hypervCimType hypervCimType;
+typedef hypervCimType *hypervCimTypePtr;
+struct _hypervCimType {
+ /* Parameter name */
+ const char *name;
+ /* Parameter type */
+ const char *type;
+ /* whether parameter is an array type */
+ bool isArray;
+};
+
typedef struct _hypervWmiClassInfo hypervWmiClassInfo;
typedef hypervWmiClassInfo *hypervWmiClassInfoPtr;
struct _hypervWmiClassInfo {
const char *resourceUri;
/* The wsman serializer info - one of the *_TypeInfo structs */
XmlSerializerInfo *serializerInfo;
+ /* Property type information */
+ hypervCimTypePtr propertyInfo;
};
source += "SER_END_ITEMS(%s_Data);\n\n" % cls.name
+ # also generate typemap data while we're here
+ source += "hypervCimType %s_Typemap[] = {\n" % cls.name
+
+ for property in cls.properties:
+ source += property.generate_typemap()
+ source += ' { "", "", 0 },\n' # null terminated
+ source += '};\n\n'
+
source += self._define_WmiInfo_struct()
source += "\n\n"
source += " .version = NULL,\n"
source += " .rootUri = %s,\n" % cls.uri_info.rootUri
source += " .resourceUri = %s_RESOURCE_URI,\n" % cls.name.upper()
- source += " .serializerInfo = %s_Data_TypeInfo\n" % cls.name
+ source += " .serializerInfo = %s_Data_TypeInfo,\n" % cls.name
+ source += " .propertyInfo = %s_Typemap\n" % cls.name
source += " },\n"
source += " }\n"
% (Property.typemap[self.type], class_name.upper(), self.name)
+ def generate_typemap(self):
+ return ' { "%s", "%s", %s },\n' % (self.name, self.type.lower(), str(self.is_array).lower())
+
+
def open_and_print(filename):
if filename.startswith("./"):