|
From: <mik...@us...> - 2008-10-23 00:50:36
|
Revision: 1121
http://omc.svn.sourceforge.net/omc/?rev=1121&view=rev
Author: mike-brasher
Date: 2008-10-23 00:50:26 +0000 (Thu, 23 Oct 2008)
Log Message:
-----------
Proivders to reproduce upcall hang in pegasus.
Added Paths:
-----------
cmpi-bindings/trunk/test/konkret/
cmpi-bindings/trunk/test/konkret/Gadget.h
cmpi-bindings/trunk/test/konkret/GadgetProvider.c
cmpi-bindings/trunk/test/konkret/Makefile
cmpi-bindings/trunk/test/konkret/README
cmpi-bindings/trunk/test/konkret/Upcall.h
cmpi-bindings/trunk/test/konkret/UpcallProvider.c
cmpi-bindings/trunk/test/konkret/Widget.h
cmpi-bindings/trunk/test/konkret/Widget.mof
cmpi-bindings/trunk/test/konkret/Widget.reg
cmpi-bindings/trunk/test/konkret/WidgetProvider.c
cmpi-bindings/trunk/test/konkret/register.mof
Added: cmpi-bindings/trunk/test/konkret/Gadget.h
===================================================================
--- cmpi-bindings/trunk/test/konkret/Gadget.h (rev 0)
+++ cmpi-bindings/trunk/test/konkret/Gadget.h 2008-10-23 00:50:26 UTC (rev 1121)
@@ -0,0 +1,379 @@
+/*
+**==============================================================================
+**
+** CAUTION: This file generated by KonkretCMPI. Please do not edit.
+**
+**==============================================================================
+*/
+
+#ifndef _konkrete_Gadget_h
+#define _konkrete_Gadget_h
+
+#include <konkret/konkret.h>
+#include "Widget.h"
+
+/*
+**==============================================================================
+**
+** struct GadgetRef
+**
+**==============================================================================
+*/
+
+/* classname=KC_Gadget */
+typedef struct _GadgetRef
+{
+ KBase __base;
+ /* KC_Gadget features */
+ const KRef Left; /* Widget */
+ const KRef Right; /* Widget */
+}
+GadgetRef;
+
+static const unsigned char __GadgetRef_sig[] =
+{
+ 0x09,0x4b,0x43,0x5f,0x47,0x61,0x64,0x67,0x65,0x74,0x00,0x02,0x4e,0x04,0x4c,
+ 0x65,0x66,0x74,0x00,0x4e,0x05,0x52,0x69,0x67,0x68,0x74,0x00,
+};
+
+KINLINE void GadgetRef_Init(
+ GadgetRef* self,
+ const CMPIBroker* cb,
+ const char* ns)
+{
+ const unsigned char* sig = __GadgetRef_sig;
+ KBase_Init(&self->__base, cb, sizeof(*self), sig, ns);
+ ((KRef*)&self->Left)->__sig = __Widget_sig;
+ ((KRef*)&self->Right)->__sig = __Widget_sig;
+}
+
+KINLINE CMPIStatus GadgetRef_InitFromInstance(
+ GadgetRef* self,
+ const CMPIBroker* cb,
+ const CMPIInstance* x)
+{
+ GadgetRef_Init(self, cb, NULL);
+ return KBase_FromInstance(&self->__base, x);
+}
+
+KINLINE CMPIStatus GadgetRef_InitFromObjectPath(
+ GadgetRef* self,
+ const CMPIBroker* cb,
+ const CMPIObjectPath* x)
+{
+ GadgetRef_Init(self, cb, NULL);
+ return KBase_FromObjectPath(&self->__base, x);
+}
+
+KINLINE void GadgetRef_Print(
+ const GadgetRef* self,
+ FILE* os)
+{
+ KBase_Print(os, &self->__base, 'r');
+}
+
+KINLINE CMPIInstance* GadgetRef_ToInstance(
+ const GadgetRef* self,
+ CMPIStatus* status)
+{
+ return KBase_ToInstance(&self->__base, status);
+}
+
+KINLINE CMPIObjectPath* GadgetRef_ToObjectPath(
+ const GadgetRef* self,
+ CMPIStatus* status)
+{
+ return KBase_ToObjectPath(&self->__base, status);
+}
+
+KINLINE const char* GadgetRef_NameSpace(
+ GadgetRef* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ return self->__base.ns ? KChars(self->__base.ns) : NULL;
+ return NULL;
+}
+
+KINLINE void GadgetRef_SetObjectPath_Left(
+ GadgetRef* self,
+ const CMPIObjectPath* x)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KRef* field = (KRef*)&self->Left;
+ KRef_SetObjectPath(field, x);
+ }
+}
+
+KINLINE CMPIStatus GadgetRef_Set_Left(
+ GadgetRef* self,
+ const WidgetRef* x)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KRef* field = (KRef*)&self->Left;
+ return KRef_Set(field, &x->__base);
+ }
+ CMReturn(CMPI_RC_ERR_FAILED);
+}
+
+KINLINE void GadgetRef_Null_Left(
+ GadgetRef* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KRef* field = (KRef*)&self->Left;
+ KRef_Null(field);
+ }
+}
+
+KINLINE void GadgetRef_Clr_Left(
+ GadgetRef* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KRef* field = (KRef*)&self->Left;
+ KRef_Clr(field);
+ }
+}
+
+KINLINE void GadgetRef_SetObjectPath_Right(
+ GadgetRef* self,
+ const CMPIObjectPath* x)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KRef* field = (KRef*)&self->Right;
+ KRef_SetObjectPath(field, x);
+ }
+}
+
+KINLINE CMPIStatus GadgetRef_Set_Right(
+ GadgetRef* self,
+ const WidgetRef* x)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KRef* field = (KRef*)&self->Right;
+ return KRef_Set(field, &x->__base);
+ }
+ CMReturn(CMPI_RC_ERR_FAILED);
+}
+
+KINLINE void GadgetRef_Null_Right(
+ GadgetRef* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KRef* field = (KRef*)&self->Right;
+ KRef_Null(field);
+ }
+}
+
+KINLINE void GadgetRef_Clr_Right(
+ GadgetRef* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KRef* field = (KRef*)&self->Right;
+ KRef_Clr(field);
+ }
+}
+
+/*
+**==============================================================================
+**
+** struct Gadget
+**
+**==============================================================================
+*/
+
+/* classname=KC_Gadget */
+typedef struct _Gadget
+{
+ KBase __base;
+ /* KC_Gadget features */
+ const KRef Left; /* Widget */
+ const KRef Right; /* Widget */
+}
+Gadget;
+
+static const unsigned char __Gadget_sig[] =
+{
+ 0x09,0x4b,0x43,0x5f,0x47,0x61,0x64,0x67,0x65,0x74,0x00,0x02,0x4e,0x04,0x4c,
+ 0x65,0x66,0x74,0x00,0x4e,0x05,0x52,0x69,0x67,0x68,0x74,0x00,
+};
+
+KINLINE void Gadget_Init(
+ Gadget* self,
+ const CMPIBroker* cb,
+ const char* ns)
+{
+ const unsigned char* sig = __Gadget_sig;
+ KBase_Init(&self->__base, cb, sizeof(*self), sig, ns);
+ ((KRef*)&self->Left)->__sig = __Widget_sig;
+ ((KRef*)&self->Right)->__sig = __Widget_sig;
+}
+
+KINLINE CMPIStatus Gadget_InitFromInstance(
+ Gadget* self,
+ const CMPIBroker* cb,
+ const CMPIInstance* x)
+{
+ Gadget_Init(self, cb, NULL);
+ return KBase_FromInstance(&self->__base, x);
+}
+
+KINLINE CMPIStatus Gadget_InitFromObjectPath(
+ Gadget* self,
+ const CMPIBroker* cb,
+ const CMPIObjectPath* x)
+{
+ Gadget_Init(self, cb, NULL);
+ return KBase_FromObjectPath(&self->__base, x);
+}
+
+KINLINE void Gadget_Print(
+ const Gadget* self,
+ FILE* os)
+{
+ KBase_Print(os, &self->__base, 'i');
+}
+
+KINLINE CMPIInstance* Gadget_ToInstance(
+ const Gadget* self,
+ CMPIStatus* status)
+{
+ return KBase_ToInstance(&self->__base, status);
+}
+
+KINLINE CMPIObjectPath* Gadget_ToObjectPath(
+ const Gadget* self,
+ CMPIStatus* status)
+{
+ return KBase_ToObjectPath(&self->__base, status);
+}
+
+KINLINE const char* Gadget_NameSpace(
+ Gadget* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ return self->__base.ns ? KChars(self->__base.ns) : NULL;
+ return NULL;
+}
+
+KINLINE void Gadget_SetObjectPath_Left(
+ Gadget* self,
+ const CMPIObjectPath* x)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KRef* field = (KRef*)&self->Left;
+ KRef_SetObjectPath(field, x);
+ }
+}
+
+KINLINE CMPIStatus Gadget_Set_Left(
+ Gadget* self,
+ const WidgetRef* x)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KRef* field = (KRef*)&self->Left;
+ return KRef_Set(field, &x->__base);
+ }
+ CMReturn(CMPI_RC_ERR_FAILED);
+}
+
+KINLINE void Gadget_Null_Left(
+ Gadget* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KRef* field = (KRef*)&self->Left;
+ KRef_Null(field);
+ }
+}
+
+KINLINE void Gadget_Clr_Left(
+ Gadget* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KRef* field = (KRef*)&self->Left;
+ KRef_Clr(field);
+ }
+}
+
+KINLINE void Gadget_SetObjectPath_Right(
+ Gadget* self,
+ const CMPIObjectPath* x)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KRef* field = (KRef*)&self->Right;
+ KRef_SetObjectPath(field, x);
+ }
+}
+
+KINLINE CMPIStatus Gadget_Set_Right(
+ Gadget* self,
+ const WidgetRef* x)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KRef* field = (KRef*)&self->Right;
+ return KRef_Set(field, &x->__base);
+ }
+ CMReturn(CMPI_RC_ERR_FAILED);
+}
+
+KINLINE void Gadget_Null_Right(
+ Gadget* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KRef* field = (KRef*)&self->Right;
+ KRef_Null(field);
+ }
+}
+
+KINLINE void Gadget_Clr_Right(
+ Gadget* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KRef* field = (KRef*)&self->Right;
+ KRef_Clr(field);
+ }
+}
+
+/*
+**==============================================================================
+**
+** Gadget methods
+**
+**==============================================================================
+*/
+
+KINLINE CMPIStatus Gadget_DispatchMethod(
+ const CMPIBroker* cb,
+ CMPIMethodMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char* meth,
+ const CMPIArgs* in,
+ CMPIArgs* out)
+{
+ GadgetRef self;
+
+ KReturnIf(GadgetRef_InitFromObjectPath(&self, cb, cop));
+
+
+ KReturn(ERR_METHOD_NOT_FOUND);
+}
+
+#define Gadget_ClassName "KC_Gadget"
+
+#endif /* _konkrete_Gadget_h */
Added: cmpi-bindings/trunk/test/konkret/GadgetProvider.c
===================================================================
--- cmpi-bindings/trunk/test/konkret/GadgetProvider.c (rev 0)
+++ cmpi-bindings/trunk/test/konkret/GadgetProvider.c 2008-10-23 00:50:26 UTC (rev 1121)
@@ -0,0 +1,314 @@
+#include <konkret/konkret.h>
+#include "Gadget.h"
+
+static const CMPIBroker* _cb;
+
+static void GadgetInitialize()
+{
+}
+
+static CMPIStatus GadgetCleanup(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ CMPIBoolean term)
+{
+ CMReturn(CMPI_RC_OK);
+}
+
+static CMPIStatus GadgetEnumInstanceNames(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop)
+{
+ const char* ns = KNameSpace(cop);
+ WidgetRef left;
+ WidgetRef right;
+ GadgetRef g;
+
+ /* First Gadget */
+ {
+ WidgetRef_Init(&left, _cb, ns);
+ WidgetRef_Set_Id(&left, "1001");
+
+ WidgetRef_Init(&right, _cb, ns);
+ WidgetRef_Set_Id(&right, "1002");
+
+ GadgetRef_Init(&g, _cb, ns);
+ GadgetRef_Set_Left(&g, &left);
+ GadgetRef_Set_Right(&g, &right);
+ // GadgetRef_Print(&g, stdout);
+ KReturnObjectPath(cr, g);
+ }
+
+ /* Second Gadget */
+ {
+ WidgetRef_Init(&left, _cb, ns);
+ WidgetRef_Set_Id(&left, "1001");
+
+ WidgetRef_Init(&right, _cb, ns);
+ WidgetRef_Set_Id(&right, "1003");
+
+ GadgetRef_Init(&g, _cb, ns);
+ GadgetRef_Set_Left(&g, &left);
+ GadgetRef_Set_Right(&g, &right);
+ // GadgetRef_Print(&g, stdout);
+ KReturnObjectPath(cr, g);
+ }
+
+ CMReturn(CMPI_RC_OK);
+}
+
+static CMPIStatus GadgetEnumInstances(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char** properties)
+{
+ const char* ns = KNameSpace(cop);
+ WidgetRef left;
+ WidgetRef right;
+ Gadget g;
+
+ /* First Gadget */
+ {
+ WidgetRef_Init(&left, _cb, ns);
+ WidgetRef_Set_Id(&left, "1001");
+
+ WidgetRef_Init(&right, _cb, ns);
+ WidgetRef_Set_Id(&right, "1002");
+
+ Gadget_Init(&g, _cb, ns);
+ Gadget_Set_Left(&g, &left);
+ Gadget_Set_Right(&g, &right);
+ KReturnInstance(cr, g);
+ }
+
+ /* Second Gadget */
+ {
+ WidgetRef_Init(&left, _cb, ns);
+ WidgetRef_Set_Id(&left, "1001");
+
+ WidgetRef_Init(&right, _cb, ns);
+ WidgetRef_Set_Id(&right, "1003");
+
+ Gadget_Init(&g, _cb, ns);
+ Gadget_Set_Left(&g, &left);
+ Gadget_Set_Right(&g, &right);
+ KReturnInstance(cr, g);
+ }
+
+ CMReturn(CMPI_RC_OK);
+}
+
+static CMPIStatus GadgetGetInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char** properties)
+{
+ const char* ns = KNameSpace(cop);
+ GadgetRef gr;
+ Gadget g;
+ WidgetRef left;
+ WidgetRef right;
+
+ if (GadgetRef_InitFromObjectPath(&gr, _cb, cop).rc)
+ KReturn(ERR_FAILED);
+
+ if (WidgetRef_InitFromObjectPath(&left, _cb, gr.Left.value).rc)
+ KReturn(ERR_FAILED);
+
+ if (WidgetRef_InitFromObjectPath(&right, _cb, gr.Right.value).rc)
+ KReturn(ERR_FAILED);
+
+ /* First Gadget */
+
+ if (!strcmp(left.Id.chars, "1001") && !strcmp(right.Id.chars, "1002"))
+ {
+ WidgetRef_Init(&left, _cb, ns);
+ WidgetRef_Set_Id(&left, "1001");
+
+ WidgetRef_Init(&right, _cb, ns);
+ WidgetRef_Set_Id(&right, "1002");
+
+ Gadget_Init(&g, _cb, ns);
+ Gadget_Set_Left(&g, &left);
+ Gadget_Set_Right(&g, &right);
+ KReturnInstance(cr, g);
+ KReturn(OK);
+ }
+ else if (!strcmp(left.Id.chars, "1001") && !strcmp(right.Id.chars, "1003"))
+ {
+ WidgetRef_Init(&left, _cb, ns);
+ WidgetRef_Set_Id(&left, "1001");
+
+ WidgetRef_Init(&right, _cb, ns);
+ WidgetRef_Set_Id(&right, "1003");
+
+ Gadget_Init(&g, _cb, ns);
+ Gadget_Set_Left(&g, &left);
+ Gadget_Set_Right(&g, &right);
+ KReturnInstance(cr, g);
+ KReturn(OK);
+ }
+
+ KReturn(ERR_NOT_FOUND);
+}
+
+static CMPIStatus GadgetCreateInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const CMPIInstance* ci)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus GadgetModifyInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const CMPIInstance* ci,
+ const char**properties)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus GadgetDeleteInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus GadgetExecQuery(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char* lang,
+ const char* query)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus GadgetAssociationCleanup(
+ CMPIAssociationMI* mi,
+ const CMPIContext* cc,
+ CMPIBoolean term)
+{
+ CMReturn(CMPI_RC_OK);
+}
+
+static CMPIStatus GadgetAssociators(
+ CMPIAssociationMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char* assocClass,
+ const char* resultClass,
+ const char* role,
+ const char* resultRole,
+ const char** properties)
+{
+ return KDefaultAssociators(
+ _cb,
+ mi,
+ cc,
+ cr,
+ cop,
+ Gadget_ClassName,
+ assocClass,
+ resultClass,
+ role,
+ resultRole,
+ properties);
+}
+
+static CMPIStatus GadgetAssociatorNames(
+ CMPIAssociationMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char* assocClass,
+ const char* resultClass,
+ const char* role,
+ const char* resultRole)
+{
+ return KDefaultAssociatorNames(
+ _cb,
+ mi,
+ cc,
+ cr,
+ cop,
+ Gadget_ClassName,
+ assocClass,
+ resultClass,
+ role,
+ resultRole);
+}
+
+static CMPIStatus GadgetReferences(
+ CMPIAssociationMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char* assocClass,
+ const char* role,
+ const char** properties)
+{
+ return KDefaultReferences(
+ _cb,
+ mi,
+ cc,
+ cr,
+ cop,
+ Gadget_ClassName,
+ assocClass,
+ role,
+ properties);
+}
+
+static CMPIStatus GadgetReferenceNames(
+ CMPIAssociationMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char* assocClass,
+ const char* role)
+{
+ return KDefaultReferenceNames(
+ _cb,
+ mi,
+ cc,
+ cr,
+ cop,
+ Gadget_ClassName,
+ assocClass,
+ role);
+}
+
+CMInstanceMIStub(
+ Gadget,
+ KC_Gadget,
+ _cb,
+ GadgetInitialize())
+
+CMAssociationMIStub(
+ Gadget,
+ KC_Gadget,
+ _cb,
+ GadgetInitialize())
+
+KONKRET_REGISTRATION(
+ "root/cimv2",
+ "KC_Gadget",
+ "KC_Gadget",
+ "instance association");
Added: cmpi-bindings/trunk/test/konkret/Makefile
===================================================================
--- cmpi-bindings/trunk/test/konkret/Makefile (rev 0)
+++ cmpi-bindings/trunk/test/konkret/Makefile 2008-10-23 00:50:26 UTC (rev 1121)
@@ -0,0 +1,41 @@
+TARGET = libWidgetProvider.so
+
+SOURCES = WidgetProvider.c GadgetProvider.c UpcallProvider.c
+
+OBJECTS = $(SOURCES:.c=.o)
+
+INCLUDES += -I/usr/include/cmpi
+
+LIBRARIES += -lkonkret
+
+FLAGS = -g -Wall -O2 -fPIC
+
+all:
+ echo $(OBJECTS)
+ gcc $(FLAGS) -c $(INCLUDES) WidgetProvider.c
+ gcc $(FLAGS) -c $(INCLUDES) GadgetProvider.c
+ gcc $(FLAGS) -c $(INCLUDES) UpcallProvider.c
+ gcc $(FLAGS) -shared -o $(TARGET) $(INCLUDES) $(OBJECTS) $(LIBRARIES)
+
+clean:
+ rm -rf $(TARGET)
+
+gen:
+ konkret -s KC_Upcall -s KC_Widget -s KC_Gadget -m Widget.mof KC_Widget=Widget KC_Gadget=Gadget KC_Upcall=Upcall
+
+install:
+ konkretreg $(TARGET) > Widget.reg
+ su -c "make install-su"
+
+install-su:
+ cp $(TARGET) /usr/lib64
+ cp Widget.mof /var/lib/sfcb/stage/mofs/root/cimv2
+ cp Widget.mof /var/lib/sfcb/stage/mofs/root/interop
+ cp Widget.reg /var/lib/sfcb/stage/regs
+ sfcbrepos -f
+
+reg:
+ cp $(TARGET) $(PEGASUS_HOME)/lib
+ cimmof Widget.mof
+ cimmof -n root/PG_InterOp register.mof
+
Added: cmpi-bindings/trunk/test/konkret/README
===================================================================
--- cmpi-bindings/trunk/test/konkret/README (rev 0)
+++ cmpi-bindings/trunk/test/konkret/README 2008-10-23 00:50:26 UTC (rev 1121)
@@ -0,0 +1,8 @@
+This directory contains test to reproduce an upcall hang in Pegasus. To
+try, install KonkretCMPI 0.8.7. Build this provider with "make". Use the
+.reg files to register with pegasus. Copy library into place. Then run the
+upcall provider as follows:
+
+ $ cimcli ei KC_Upcall
+
+This hangs in the _references() test.
Added: cmpi-bindings/trunk/test/konkret/Upcall.h
===================================================================
--- cmpi-bindings/trunk/test/konkret/Upcall.h (rev 0)
+++ cmpi-bindings/trunk/test/konkret/Upcall.h 2008-10-23 00:50:26 UTC (rev 1121)
@@ -0,0 +1,284 @@
+/*
+**==============================================================================
+**
+** CAUTION: This file generated by KonkretCMPI. Please do not edit.
+**
+**==============================================================================
+*/
+
+#ifndef _konkrete_Upcall_h
+#define _konkrete_Upcall_h
+
+#include <konkret/konkret.h>
+
+/*
+**==============================================================================
+**
+** struct UpcallRef
+**
+**==============================================================================
+*/
+
+/* classname=KC_Upcall */
+typedef struct _UpcallRef
+{
+ KBase __base;
+ /* KC_Upcall features */
+ const KString Id;
+}
+UpcallRef;
+
+static const unsigned char __UpcallRef_sig[] =
+{
+ 0x09,0x4b,0x43,0x5f,0x55,0x70,0x63,0x61,0x6c,0x6c,0x00,0x01,0x4c,0x02,0x49,
+ 0x64,0x00,
+};
+
+KINLINE void UpcallRef_Init(
+ UpcallRef* self,
+ const CMPIBroker* cb,
+ const char* ns)
+{
+ const unsigned char* sig = __UpcallRef_sig;
+ KBase_Init(&self->__base, cb, sizeof(*self), sig, ns);
+}
+
+KINLINE CMPIStatus UpcallRef_InitFromInstance(
+ UpcallRef* self,
+ const CMPIBroker* cb,
+ const CMPIInstance* x)
+{
+ UpcallRef_Init(self, cb, NULL);
+ return KBase_FromInstance(&self->__base, x);
+}
+
+KINLINE CMPIStatus UpcallRef_InitFromObjectPath(
+ UpcallRef* self,
+ const CMPIBroker* cb,
+ const CMPIObjectPath* x)
+{
+ UpcallRef_Init(self, cb, NULL);
+ return KBase_FromObjectPath(&self->__base, x);
+}
+
+KINLINE void UpcallRef_Print(
+ const UpcallRef* self,
+ FILE* os)
+{
+ KBase_Print(os, &self->__base, 'r');
+}
+
+KINLINE CMPIInstance* UpcallRef_ToInstance(
+ const UpcallRef* self,
+ CMPIStatus* status)
+{
+ return KBase_ToInstance(&self->__base, status);
+}
+
+KINLINE CMPIObjectPath* UpcallRef_ToObjectPath(
+ const UpcallRef* self,
+ CMPIStatus* status)
+{
+ return KBase_ToObjectPath(&self->__base, status);
+}
+
+KINLINE const char* UpcallRef_NameSpace(
+ UpcallRef* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ return self->__base.ns ? KChars(self->__base.ns) : NULL;
+ return NULL;
+}
+
+KINLINE void UpcallRef_SetString_Id(
+ UpcallRef* self,
+ CMPIString* x)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KString* field = (KString*)&self->Id;
+ KString_SetString(field, x);
+ }
+}
+
+KINLINE void UpcallRef_Set_Id(
+ UpcallRef* self,
+ const char* s)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KString* field = (KString*)&self->Id;
+ KString_Set(field, self->__base.cb, s);
+ }
+}
+
+KINLINE void UpcallRef_Null_Id(
+ UpcallRef* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KString* field = (KString*)&self->Id;
+ KString_Null(field);
+ }
+}
+
+KINLINE void UpcallRef_Clr_Id(
+ UpcallRef* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KString* field = (KString*)&self->Id;
+ KString_Clr(field);
+ }
+}
+
+/*
+**==============================================================================
+**
+** struct Upcall
+**
+**==============================================================================
+*/
+
+/* classname=KC_Upcall */
+typedef struct _Upcall
+{
+ KBase __base;
+ /* KC_Upcall features */
+ const KString Id;
+}
+Upcall;
+
+static const unsigned char __Upcall_sig[] =
+{
+ 0x09,0x4b,0x43,0x5f,0x55,0x70,0x63,0x61,0x6c,0x6c,0x00,0x01,0x4c,0x02,0x49,
+ 0x64,0x00,
+};
+
+KINLINE void Upcall_Init(
+ Upcall* self,
+ const CMPIBroker* cb,
+ const char* ns)
+{
+ const unsigned char* sig = __Upcall_sig;
+ KBase_Init(&self->__base, cb, sizeof(*self), sig, ns);
+}
+
+KINLINE CMPIStatus Upcall_InitFromInstance(
+ Upcall* self,
+ const CMPIBroker* cb,
+ const CMPIInstance* x)
+{
+ Upcall_Init(self, cb, NULL);
+ return KBase_FromInstance(&self->__base, x);
+}
+
+KINLINE CMPIStatus Upcall_InitFromObjectPath(
+ Upcall* self,
+ const CMPIBroker* cb,
+ const CMPIObjectPath* x)
+{
+ Upcall_Init(self, cb, NULL);
+ return KBase_FromObjectPath(&self->__base, x);
+}
+
+KINLINE void Upcall_Print(
+ const Upcall* self,
+ FILE* os)
+{
+ KBase_Print(os, &self->__base, 'i');
+}
+
+KINLINE CMPIInstance* Upcall_ToInstance(
+ const Upcall* self,
+ CMPIStatus* status)
+{
+ return KBase_ToInstance(&self->__base, status);
+}
+
+KINLINE CMPIObjectPath* Upcall_ToObjectPath(
+ const Upcall* self,
+ CMPIStatus* status)
+{
+ return KBase_ToObjectPath(&self->__base, status);
+}
+
+KINLINE const char* Upcall_NameSpace(
+ Upcall* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ return self->__base.ns ? KChars(self->__base.ns) : NULL;
+ return NULL;
+}
+
+KINLINE void Upcall_SetString_Id(
+ Upcall* self,
+ CMPIString* x)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KString* field = (KString*)&self->Id;
+ KString_SetString(field, x);
+ }
+}
+
+KINLINE void Upcall_Set_Id(
+ Upcall* self,
+ const char* s)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KString* field = (KString*)&self->Id;
+ KString_Set(field, self->__base.cb, s);
+ }
+}
+
+KINLINE void Upcall_Null_Id(
+ Upcall* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KString* field = (KString*)&self->Id;
+ KString_Null(field);
+ }
+}
+
+KINLINE void Upcall_Clr_Id(
+ Upcall* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KString* field = (KString*)&self->Id;
+ KString_Clr(field);
+ }
+}
+
+/*
+**==============================================================================
+**
+** Upcall methods
+**
+**==============================================================================
+*/
+
+KINLINE CMPIStatus Upcall_DispatchMethod(
+ const CMPIBroker* cb,
+ CMPIMethodMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char* meth,
+ const CMPIArgs* in,
+ CMPIArgs* out)
+{
+ UpcallRef self;
+
+ KReturnIf(UpcallRef_InitFromObjectPath(&self, cb, cop));
+
+
+ KReturn(ERR_METHOD_NOT_FOUND);
+}
+
+#define Upcall_ClassName "KC_Upcall"
+
+#endif /* _konkrete_Upcall_h */
Added: cmpi-bindings/trunk/test/konkret/UpcallProvider.c
===================================================================
--- cmpi-bindings/trunk/test/konkret/UpcallProvider.c (rev 0)
+++ cmpi-bindings/trunk/test/konkret/UpcallProvider.c 2008-10-23 00:50:26 UTC (rev 1121)
@@ -0,0 +1,301 @@
+#include <konkret/konkret.h>
+#include "Upcall.h"
+
+static const CMPIBroker* _cb = NULL;
+
+static void UpcallInitialize()
+{
+}
+
+static CMPIStatus UpcallCleanup(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ CMPIBoolean term)
+{
+ CMReturn(CMPI_RC_OK);
+}
+
+static CMPIStatus UpcallEnumInstanceNames(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop)
+{
+ return KDefaultEnumerateInstanceNames(
+ _cb, mi, cc, cr, cop);
+}
+
+static CMPIStatus _associators(const CMPIContext* cc)
+{
+ CMPIObjectPath* op;
+ CMPIEnumeration* e;
+ CMPIStatus st;
+ size_t count = 0;
+
+ if (!(op = CMNewObjectPath(_cb, "root/cimv2", "KC_Widget", NULL)))
+ CMReturn(CMPI_RC_ERR_FAILED);
+
+ st = CMAddKey(op, "Id", "1001", CMPI_chars);
+
+ if (st.rc)
+ CMReturn(CMPI_RC_ERR_FAILED);
+
+ if (!(e = CBAssociators(_cb, cc, op, NULL, NULL, NULL, NULL, NULL, NULL)))
+ CMReturn(CMPI_RC_ERR_FAILED);
+
+ while (CMHasNext(e, NULL))
+ {
+ CMPIData cd = CMGetNext(e, NULL);
+
+ if (cd.type != CMPI_instance)
+ CMReturn(CMPI_RC_ERR_FAILED);
+
+ count++;
+ }
+
+ if (count == 0)
+ CMReturn(CMPI_RC_ERR_FAILED);
+
+ CMReturn(CMPI_RC_OK);
+}
+
+static CMPIStatus _associatorNames(const CMPIContext* cc)
+{
+ CMPIObjectPath* op;
+ CMPIEnumeration* e;
+ CMPIStatus st;
+ size_t count = 0;
+
+ if (!(op = CMNewObjectPath(_cb, "root/cimv2", "KC_Widget", NULL)))
+ CMReturn(CMPI_RC_ERR_FAILED);
+
+ st = CMAddKey(op, "Id", "1001", CMPI_chars);
+
+ if (st.rc)
+ CMReturn(CMPI_RC_ERR_FAILED);
+
+ if (!(e = CBAssociatorNames(_cb, cc, op, NULL, NULL, NULL, NULL, NULL)))
+ CMReturn(CMPI_RC_ERR_FAILED);
+
+ while (CMHasNext(e, NULL))
+ {
+ CMPIData cd = CMGetNext(e, NULL);
+
+ if (cd.type != CMPI_ref)
+ CMReturn(CMPI_RC_ERR_FAILED);
+
+ count++;
+ }
+
+ if (count == 0)
+ CMReturn(CMPI_RC_ERR_FAILED);
+
+ CMReturn(CMPI_RC_OK);
+}
+
+static CMPIStatus _references(const CMPIContext* cc)
+{
+ CMPIObjectPath* op;
+ CMPIEnumeration* e;
+ CMPIStatus st;
+ size_t count = 0;
+
+ if (!(op = CMNewObjectPath(_cb, "root/cimv2", "KC_Widget", NULL)))
+ CMReturn(CMPI_RC_ERR_FAILED);
+
+ st = CMAddKey(op, "Id", "1001", CMPI_chars);
+
+ if (st.rc)
+ CMReturn(CMPI_RC_ERR_FAILED);
+
+ if (!(e = CBReferences(_cb, cc, op, NULL, NULL, NULL, NULL)))
+ CMReturn(CMPI_RC_ERR_FAILED);
+
+ while (CMHasNext(e, NULL))
+ {
+ CMPIData cd = CMGetNext(e, NULL);
+
+ if (cd.type != CMPI_instance)
+ CMReturn(CMPI_RC_ERR_FAILED);
+
+ count++;
+ }
+
+ if (count == 0)
+ CMReturn(CMPI_RC_ERR_FAILED);
+
+ CMReturn(CMPI_RC_OK);
+}
+
+static CMPIStatus _referenceNames(const CMPIContext* cc)
+{
+ CMPIObjectPath* op;
+ CMPIEnumeration* e;
+ CMPIStatus st;
+ size_t count = 0;
+
+ if (!(op = CMNewObjectPath(_cb, "root/cimv2", "KC_Widget", NULL)))
+ CMReturn(CMPI_RC_ERR_FAILED);
+
+ st = CMAddKey(op, "Id", "1001", CMPI_chars);
+
+ if (st.rc)
+ CMReturn(CMPI_RC_ERR_FAILED);
+
+ if (!(e = CBReferenceNames(_cb, cc, op, NULL, NULL, NULL)))
+ CMReturn(CMPI_RC_ERR_FAILED);
+
+ printf("BEFORE\n");
+
+ while (CMHasNext(e, NULL))
+ {
+ CMPIData cd = CMGetNext(e, NULL);
+
+ printf("INSIDE\n");
+
+ if (cd.type != CMPI_ref)
+ CMReturn(CMPI_RC_ERR_FAILED);
+
+ count++;
+ }
+
+ printf("AFTER\n");
+
+ if (count == 0)
+ CMReturn(CMPI_RC_ERR_FAILED);
+
+ CMReturn(CMPI_RC_OK);
+}
+
+static CMPIStatus UpcallEnumInstances(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char** properties)
+{
+ printf("UpcallEnumInstances\n");
+
+ KTRACE;
+
+ if (_associators(cc).rc != CMPI_RC_OK)
+ {
+ printf("UpcallEnumInstances: _associators() failed\n");
+ }
+
+ KTRACE;
+
+ if (_associatorNames(cc).rc != CMPI_RC_OK)
+ {
+ printf("UpcallEnumInstances: _associatorNames() failed\n");
+ }
+
+ KTRACE;
+
+ if (_references(cc).rc != CMPI_RC_OK)
+ {
+ printf("UpcallEnumInstances: _references() failed\n");
+ }
+
+ KTRACE;
+
+ if (_referenceNames(cc).rc != CMPI_RC_OK)
+ {
+ printf("UpcallEnumInstances: _referenceNames() failed\n");
+ }
+
+ KTRACE;
+
+ CMReturn(CMPI_RC_OK);
+}
+
+static CMPIStatus UpcallGetInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char** properties)
+{
+ return KDefaultGetInstance(
+ _cb, mi, cc, cr, cop, properties);
+}
+
+static CMPIStatus UpcallCreateInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const CMPIInstance* ci)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus UpcallModifyInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const CMPIInstance* ci,
+ const char** properties)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus UpcallDeleteInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus UpcallExecQuery(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char* lang,
+ const char* query)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+CMInstanceMIStub(
+ Upcall,
+ KC_Upcall,
+ _cb,
+ UpcallInitialize())
+
+static CMPIStatus UpcallMethodCleanup(
+ CMPIMethodMI* mi,
+ const CMPIContext* cc,
+ CMPIBoolean term)
+{
+ CMReturn(CMPI_RC_OK);
+}
+
+static CMPIStatus UpcallInvokeMethod(
+ CMPIMethodMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char* meth,
+ const CMPIArgs* in,
+ CMPIArgs* out)
+{
+ return Upcall_DispatchMethod(
+ _cb, mi, cc, cr, cop, meth, in, out);
+}
+
+CMMethodMIStub(
+ Upcall,
+ KC_Upcall,
+ _cb,
+ UpcallInitialize())
+
+KONKRET_REGISTRATION(
+ "root/cimv2",
+ "KC_Upcall",
+ "KC_Upcall",
+ "instance method");
Added: cmpi-bindings/trunk/test/konkret/Widget.h
===================================================================
--- cmpi-bindings/trunk/test/konkret/Widget.h (rev 0)
+++ cmpi-bindings/trunk/test/konkret/Widget.h 2008-10-23 00:50:26 UTC (rev 1121)
@@ -0,0 +1,458 @@
+/*
+**==============================================================================
+**
+** CAUTION: This file generated by KonkretCMPI. Please do not edit.
+**
+**==============================================================================
+*/
+
+#ifndef _konkrete_Widget_h
+#define _konkrete_Widget_h
+
+#include <konkret/konkret.h>
+
+/*
+**==============================================================================
+**
+** struct WidgetRef
+**
+**==============================================================================
+*/
+
+/* classname=KC_Widget */
+typedef struct _WidgetRef
+{
+ KBase __base;
+ /* KC_Widget features */
+ const KString Id;
+}
+WidgetRef;
+
+static const unsigned char __WidgetRef_sig[] =
+{
+ 0x09,0x4b,0x43,0x5f,0x57,0x69,0x64,0x67,0x65,0x74,0x00,0x01,0x4c,0x02,0x49,
+ 0x64,0x00,
+};
+
+KINLINE void WidgetRef_Init(
+ WidgetRef* self,
+ const CMPIBroker* cb,
+ const char* ns)
+{
+ const unsigned char* sig = __WidgetRef_sig;
+ KBase_Init(&self->__base, cb, sizeof(*self), sig, ns);
+}
+
+KINLINE CMPIStatus WidgetRef_InitFromInstance(
+ WidgetRef* self,
+ const CMPIBroker* cb,
+ const CMPIInstance* x)
+{
+ WidgetRef_Init(self, cb, NULL);
+ return KBase_FromInstance(&self->__base, x);
+}
+
+KINLINE CMPIStatus WidgetRef_InitFromObjectPath(
+ WidgetRef* self,
+ const CMPIBroker* cb,
+ const CMPIObjectPath* x)
+{
+ WidgetRef_Init(self, cb, NULL);
+ return KBase_FromObjectPath(&self->__base, x);
+}
+
+KINLINE void WidgetRef_Print(
+ const WidgetRef* self,
+ FILE* os)
+{
+ KBase_Print(os, &self->__base, 'r');
+}
+
+KINLINE CMPIInstance* WidgetRef_ToInstance(
+ const WidgetRef* self,
+ CMPIStatus* status)
+{
+ return KBase_ToInstance(&self->__base, status);
+}
+
+KINLINE CMPIObjectPath* WidgetRef_ToObjectPath(
+ const WidgetRef* self,
+ CMPIStatus* status)
+{
+ return KBase_ToObjectPath(&self->__base, status);
+}
+
+KINLINE const char* WidgetRef_NameSpace(
+ WidgetRef* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ return self->__base.ns ? KChars(self->__base.ns) : NULL;
+ return NULL;
+}
+
+KINLINE void WidgetRef_SetString_Id(
+ WidgetRef* self,
+ CMPIString* x)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KString* field = (KString*)&self->Id;
+ KString_SetString(field, x);
+ }
+}
+
+KINLINE void WidgetRef_Set_Id(
+ WidgetRef* self,
+ const char* s)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KString* field = (KString*)&self->Id;
+ KString_Set(field, self->__base.cb, s);
+ }
+}
+
+KINLINE void WidgetRef_Null_Id(
+ WidgetRef* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KString* field = (KString*)&self->Id;
+ KString_Null(field);
+ }
+}
+
+KINLINE void WidgetRef_Clr_Id(
+ WidgetRef* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KString* field = (KString*)&self->Id;
+ KString_Clr(field);
+ }
+}
+
+/*
+**==============================================================================
+**
+** struct Widget
+**
+**==============================================================================
+*/
+
+/* classname=KC_Widget */
+typedef struct _Widget
+{
+ KBase __base;
+ /* KC_Widget features */
+ const KString Id;
+ const KString Color;
+ const KUint32 Size;
+}
+Widget;
+
+static const unsigned char __Widget_sig[] =
+{
+ 0x09,0x4b,0x43,0x5f,0x57,0x69,0x64,0x67,0x65,0x74,0x00,0x03,0x4c,0x02,0x49,
+ 0x64,0x00,0x0c,0x05,0x43,0x6f,0x6c,0x6f,0x72,0x00,0x05,0x04,0x53,0x69,0x7a,
+ 0x65,0x00,
+};
+
+KINLINE void Widget_Init(
+ Widget* self,
+ const CMPIBroker* cb,
+ const char* ns)
+{
+ const unsigned char* sig = __Widget_sig;
+ KBase_Init(&self->__base, cb, sizeof(*self), sig, ns);
+}
+
+KINLINE CMPIStatus Widget_InitFromInstance(
+ Widget* self,
+ const CMPIBroker* cb,
+ const CMPIInstance* x)
+{
+ Widget_Init(self, cb, NULL);
+ return KBase_FromInstance(&self->__base, x);
+}
+
+KINLINE CMPIStatus Widget_InitFromObjectPath(
+ Widget* self,
+ const CMPIBroker* cb,
+ const CMPIObjectPath* x)
+{
+ Widget_Init(self, cb, NULL);
+ return KBase_FromObjectPath(&self->__base, x);
+}
+
+KINLINE void Widget_Print(
+ const Widget* self,
+ FILE* os)
+{
+ KBase_Print(os, &self->__base, 'i');
+}
+
+KINLINE CMPIInstance* Widget_ToInstance(
+ const Widget* self,
+ CMPIStatus* status)
+{
+ return KBase_ToInstance(&self->__base, status);
+}
+
+KINLINE CMPIObjectPath* Widget_ToObjectPath(
+ const Widget* self,
+ CMPIStatus* status)
+{
+ return KBase_ToObjectPath(&self->__base, status);
+}
+
+KINLINE const char* Widget_NameSpace(
+ Widget* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ return self->__base.ns ? KChars(self->__base.ns) : NULL;
+ return NULL;
+}
+
+KINLINE void Widget_SetString_Id(
+ Widget* self,
+ CMPIString* x)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KString* field = (KString*)&self->Id;
+ KString_SetString(field, x);
+ }
+}
+
+KINLINE void Widget_Set_Id(
+ Widget* self,
+ const char* s)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KString* field = (KString*)&self->Id;
+ KString_Set(field, self->__base.cb, s);
+ }
+}
+
+KINLINE void Widget_Null_Id(
+ Widget* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KString* field = (KString*)&self->Id;
+ KString_Null(field);
+ }
+}
+
+KINLINE void Widget_Clr_Id(
+ Widget* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KString* field = (KString*)&self->Id;
+ KString_Clr(field);
+ }
+}
+
+KINLINE void Widget_SetString_Color(
+ Widget* self,
+ CMPIString* x)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KString* field = (KString*)&self->Color;
+ KString_SetString(field, x);
+ }
+}
+
+KINLINE void Widget_Set_Color(
+ Widget* self,
+ const char* s)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KString* field = (KString*)&self->Color;
+ KString_Set(field, self->__base.cb, s);
+ }
+}
+
+KINLINE void Widget_Null_Color(
+ Widget* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KString* field = (KString*)&self->Color;
+ KString_Null(field);
+ }
+}
+
+KINLINE void Widget_Clr_Color(
+ Widget* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KString* field = (KString*)&self->Color;
+ KString_Clr(field);
+ }
+}
+
+KINLINE void Widget_Set_Size(
+ Widget* self,
+ CMPIUint32 x)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KUint32* field = (KUint32*)&self->Size;
+ KUint32_Set(field, x);
+ }
+}
+
+KINLINE void Widget_Null_Size(
+ Widget* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KUint32* field = (KUint32*)&self->Size;
+ KUint32_Null(field);
+ }
+}
+
+KINLINE void Widget_Clr_Size(
+ Widget* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KUint32* field = (KUint32*)&self->Size;
+ KUint32_Clr(field);
+ }
+}
+
+/* classname=KC_Widget */
+typedef struct _Widget_Add_Args
+{
+ KBase __base;
+ /* IN */
+ KUint32 X;
+ /* IN */
+ KUint32 Y;
+}
+Widget_Add_Args;
+
+static const unsigned char __Widget_Add_Args_sig[] =
+{
+ 0x03,0x41,0x64,0x64,0x00,0x02,0x25,0x01,0x58,0x00,0x25,0x01,0x59,0x00,
+};
+
+KINLINE void Widget_Add_Args_Init(
+ Widget_Add_Args* self,
+ const CMPIBroker* cb)
+{
+ const unsigned char* sig = __Widget_Add_Args_sig;
+ KBase_Init(&self->__base, cb, sizeof(*self), sig, NULL);
+}
+
+KINLINE CMPIStatus Widget_Add_Args_InitFromArgs(
+ Widget_Add_Args* self,
+ const CMPIBroker* cb,
+ const CMPIArgs* x,
+ CMPIBoolean in,
+ CMPIBoolean out)
+{
+ Widget_Add_Args_Init(self, cb);
+ return KBase_FromArgs(&self->__base, x, in, out);
+}
+
+KINLINE CMPIArgs* Widget_Add_Args_ToArgs(
+ const Widget_Add_Args* self,
+ CMPIBoolean in,
+ CMPIBoolean out,
+ CMPIStatus* status)
+{
+ return KBase_ToArgs(&self->__base, in, out, status);
+}
+
+KINLINE CMPIStatus Widget_Add_Args_SetArgs(
+ const Widget_Add_Args* self,
+ CMPIBoolean in,
+ CMPIBoolean out,
+ CMPIArgs* ca)
+{
+ return KBase_SetToArgs(&self->__base, in, out, ca);
+}
+
+KINLINE void Widget_Add_Args_Print(
+ const Widget_Add_Args* self,
+ FILE* os)
+{
+ KBase_Print(os, &self->__base, 'a');
+}
+
+/*
+**==============================================================================
+**
+** Widget methods
+**
+**==============================================================================
+*/
+
+KEXTERN KUint32 Widget_Add(
+ const CMPIBroker* cb,
+ CMPIMethodMI* mi,
+ const CMPIContext* context,
+ const KUint32* X,
+ const KUint32* Y,
+ CMPIStatus* status);
+
+KINLINE CMPIStatus Widget_DispatchMethod(
+ const CMPIBroker* cb,
+ CMPIMethodMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char* meth,
+ const CMPIArgs* in,
+ CMPIArgs* out)
+{
+ WidgetRef self;
+
+ KReturnIf(WidgetRef_InitFromObjectPath(&self, cb, cop));
+
+ if (strcasecmp(meth, "Add") == 0)
+ {
+ CMPIStatus st = KSTATUS_INIT;
+ Widget_Add_Args args;
+ KUint32 r;
+
+ KReturnIf(Widget_Add_Args_InitFromArgs(
+ &args, cb, in, 1, 0));
+
+ r = Widget_Add(
+ cb,
+ mi,
+ cc,
+ &args.X,
+ &args.Y,
+ &st);
+
+ if (!KOkay(st))
+ return st;
+
+ if (!r.exists)
+ KReturn(ERR_FAILED);
+
+ KReturnIf(Widget_Add_Args_SetArgs(
+ &args, 0, 1, out));
+ KReturnUint32Data(cr, &r);
+ CMReturnDone(cr);
+
+ KReturn(OK);
+ }
+
+ KReturn(ERR_METHOD_NOT_FOUND);
+}
+
+#define Widget_ClassName "KC_Widget"
+
+#endif /* _konkrete_Widget_h */
Added: cmpi-bindings/trunk/test/konkret/Widget.mof
===================================================================
--- cmpi-bindings/trunk/test/konkret/Widget.mof (rev 0)
+++ cmpi-bindings/trunk/test/konkret/Widget.mof 2008-10-23 00:50:26 UTC (rev 1121)
@@ -0,0 +1,21 @@
+class KC_Widget
+{
+ [Key] String Id;
+ string Color;
+ uint32 Size;
+
+ [Static]
+ uint32 Add([In] uint32 X, [In] uint32 Y);
+};
+
+[Association]
+class KC_Gadget
+{
+ [Key] KC_Widget REF Left;
+ [Key] KC_Widget REF Right;
+};
+
+class KC_Upcall
+{
+ [Key] String Id;
+};
Added: cmpi-bindings/trunk/test/konkret/Widget.reg
===================================================================
--- cmpi-bindings/trunk/test/konkret/Widget.reg (rev 0)
+++ cmpi-bindings/trunk/test/konkret/Widget.reg 2008-10-23 00:50:26 UTC (rev 1121)
@@ -0,0 +1,18 @@
+[KC_Widget]
+ provider: KC_Widget
+ location: WidgetProvider
+ type: instance method
+ namespace: root/cimv2
+#
+[KC_Gadget]
+ provider: KC_Gadget
+ location: WidgetProvider
+ type: instance association
+ namespace: root/cimv2
+#
+[KC_Upcall]
+ provider: KC_Upcall
+ location: WidgetProvider
+ type: instance method
+ namespace: root/cimv2
+#
Added: cmpi-bindings/trunk/test/konkret/WidgetProvider.c
===================================================================
--- cmpi-bindings/trunk/test/konkret/WidgetProvider.c (rev 0)
+++ cmpi-bindings/trunk/test/konkret/WidgetProvider.c 2008-10-23 00:50:26 UTC (rev 1121)
@@ -0,0 +1,215 @@
+#include <konkret/konkret.h>
+#include "Widget.h"
+
+static const CMPIBroker* _broker = NULL;
+
+static void WidgetInitialize()
+{
+}
+
+static CMPIStatus WidgetCleanup(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ CMPIBoolean term)
+{
+ CMReturn(CMPI_RC_OK);
+}
+
+static CMPIStatus WidgetEnumInstanceNames(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop)
+{
+ WidgetRef w;
+
+ /* Widget.Id="1001" */
+ WidgetRef_Init(&w, _broker, KNameSpace(cop));
+ WidgetRef_Set_Id(&w, "1001");
+ KReturnObjectPath(cr, w);
+
+ /* Widget.Id="1002" */
+ WidgetRef_Init(&w, _broker, KNameSpace(cop));
+ WidgetRef_Set_Id(&w, "1002");
+ KReturnObjectPath(cr, w);
+
+ /* Widget.Id=1003 */
+ WidgetRef_Init(&w, _broker, KNameSpace(cop));
+ WidgetRef_Set_Id(&w, "1003");
+ KReturnObjectPath(cr, w);
+
+ CMReturn(CMPI_RC_OK);
+}
+
+static CMPIStatus WidgetEnumInstances(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char** properties)
+{
+ Widget w;
+
+ /* Widget.Id="1001" */
+ Widget_Init(&w, _broker, KNameSpace(cop));
+ Widget_Set_Id(&w, "1001");
+ Widget_Set_Color(&w, "Red");
+ Widget_Set_Size(&w, 1);
+ KReturnInstance(cr, w);
+
+ /* Widget.Id="1002" */
+ Widget_Init(&w, _broker, KNameSpace(cop));
+ Widget_Set_Id(&w, "1002");
+ Widget_Set_Color(&w, "Green");
+ Widget_Set_Size(&w, 2);
+ KReturnInstance(cr, w);
+
+ /* Widget.Id=1003 */
+ Widget_Init(&w, _broker, KNameSpace(cop));
+ Widget_Set_Id(&w, "1003");
+ Widget_Set_Color(&w, "Blue");
+ Widget_Set_Size(&w, 3);
+ KReturnInstance(cr, w);
+
+ CMReturn(CMPI_RC_OK);
+}
+
+CMPIStatus WidgetGetInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* result,
+ const CMPIObjectPath* cop,
+ const char** properties)
+{
+ WidgetRef wr;
+ Widget w;
+
+ WidgetRef_InitFromObjectPath(&wr, _broker, cop);
+
+ if (!wr.Id.exists || wr.Id.null)
+ CMReturn(CMPI_RC_ERR_FAILED);
+
+ if (strcmp(wr.Id.chars, "1001") == 0)
+ {
+ Widget_Init(&w, _broker, KNameSpace(cop));
+ Widget_Set_Id(&w, "1001");
+ Widget_Set_Color(&w, "Red");
+ Widget_Set_Size(&w, 1);
+ KReturnInstance(result, w);
+ CMReturn(CMPI_RC_OK);
+ }
+ else if (strcmp(wr.Id.chars, "1002") == 0)
+ {
+ Widget_Init(&w, _broker, KNameSpace(cop));
+ Widget_Set_Id(&w, "1002");
+ Widget_Set_Color(&w, "Green");
+ Widget_Set_Size(&w, 2);
+ KReturnInstance(result, w);
+ CMReturn(CMPI_RC_OK);
+ }
+ else if (strcmp(wr.Id.chars, "1003") == 0)
+ {
+ Widget_Init(&w, _broker, KNameSpace(cop));
+ Widget_Set_Id(&w, "1003");
+ Widget_Set_Color(&w, "Blue");
+ Widget_Set_Size(&w, 3);
+ KReturnInstance(result, w);
+ CMReturn(CMPI_RC_OK);
+ }
+
+ CMReturn(CMPI_RC_ERR_NOT_FOUND);
+}
+
+static CMPIStatus WidgetCreateInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const CMPIInstance* ci)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus WidgetModifyInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const CMPIInstance* ci,
+ const char** properties)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus WidgetDeleteInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus WidgetExecQuery(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char* lang,
+ const char* query)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+CMInstanceMIStub(
+ Widget,
+ KC_Widget,
+ _broker,
+ WidgetInitialize())
+
+static CMPIStatus WidgetMethodCleanup(
+ CMPIMethodMI* mi,
+ const CMPIContext* cc,
+ CMPIBoolean term)
+{
+ CMReturn(CMPI_RC_OK);
+}
+
+static CMPIStatus WidgetInvokeMethod(
+ CMPIMethodMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char* meth,
+ const CMPIArgs* in,
+ CMPIArgs* out)
+{
+ return Widget_DispatchMethod(
+ _broker, mi, cc, cr, cop, meth, in, out);
+}
+
+CMMethodMIStub(
+ Widget,
+ KC_Widget,
+ _broker,
+ WidgetInitialize())
+
+KUint32 Widget_Add(
+ const CMPIBroker* cb,
+ CMPIMethodMI* mi,
+ const CMPIContext* context,
+ const KUint32* X,
+ const KUint32* Y,
+ CMPIStatus* status)
+{
+ KUint32 result = KUINT32_INIT;
+
+ KSetStatus(status, ERR_NOT_SUPPORTED);
+ return result;
+}
+
+KONKRET_REGISTRATION(
+ "root/cimv2",
+ "KC_Widget",
+ "KC_Widget",
+ "instance method");
Added: cmpi-bindings/trunk/test/konkret/register.mof
===================================================================
--- cmpi-bindings/trunk/test/konkret/register.mof (rev 0)
+++ cmpi-bindings/trunk/test/konkret/register.mof 2008-10-23 00:50:26 UTC (rev 1121)
@@ -0,0 +1,96 @@
+/*
+**==============================================================================
+**
+** Widget Module
+**
+**==============================================================================
+*/
+
+instance of PG_ProviderModule
+{
+ Name = "KC_WidgetModule";
+ Vendor = "Pegasus";
+ Version = "2.0.0";
+ InterfaceType = "CMPI";
+ InterfaceVersion = "2.0.0";
+ Location = "WidgetProvider";
+};
+
+/*
+**==============================================================================
+**
+** Widget Provider
+**
+**==============================================================================
+*/
+
+instance of PG_Provider
+{
+ Name = "KC_Widget";
+ ProviderModuleName = "KC_WidgetModule";
+};
+
+instance of PG_ProviderCapabilities
+{
+ CapabilityID = "KC_Widget";
+ ProviderModuleName = "KC_WidgetModule";
+ ProviderName = "KC_Widget";
+ ClassName = "KC_Widget";
+ Namespaces = {"root/cimv2"};
+ ProviderType = { 2 /*instance*/, 5 /*method*/ };
+ supportedProperties = NULL;
+ supportedMethods = NULL;
+};
+
+/*
+**==============================================================================
+**
+** Gadget Provider
+**
+**==============================================================================
+*/
+
+instance of PG_Provider
+{
+ Name = "KC_Gadget";
+ ProviderModuleName = "KC_WidgetModule";
+};
+
+instance of PG_ProviderCapabilities
+{
+ CapabilityID = "KC_Gadget";
+ ProviderModuleName = "KC_WidgetModule";
+ ProviderName = "KC_Gadget";
+ ClassName = "KC_Gadget";
+ Namespaces = {"root/cimv2"};
+ ProviderType = { 2 /*instance*/, 3, /*association*/ 5 /*method*/ };
+ supportedProperties = NULL;
+ supportedMethods = NULL;
+};
+
+/*
+**==============================================================================
+**
+** Upcall Provider
+**
+**==============================================================================
+*/
+
+instance of PG_Provider
+{
+ Name = "KC_Upcall";
+ ProviderModuleName = "KC_WidgetModule";
+};
+
+instance of PG_ProviderCapabilities
+{
+ CapabilityID = "KC_Upcall";
+ ProviderModuleName = "KC_WidgetModule";
+ ProviderName = "KC_Upcall";
+ ClassName = "KC_Upcall";
+ Namespaces = {"root/cimv2"};
+ ProviderType = { 2 /*instance*/, 5 /*method*/ };
+ supportedProperties = NULL;
+ supportedMethods = NULL;
+};
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|