#include #include #include "Linux_HostedService.h" #include "Linux_ComputerSystem.h" #include "globals.h" #include "trace.h" static const CMPIBroker* _cb; static void Linux_HostedServiceInitialize() { } static CMPIStatus Linux_HostedServiceCleanup( CMPIInstanceMI* mi, const CMPIContext* cc, CMPIBoolean term) { CMReturn(CMPI_RC_OK); } static CMPIStatus Linux_HostedServiceEnumInstanceNames( CMPIInstanceMI* mi, const CMPIContext* cc, const CMPIResult* cr, const CMPIObjectPath* cop) { return KDefaultEnumerateInstanceNames( _cb, mi, cc, cr, cop); } static CMPIStatus Linux_HostedServiceEnumInstances( CMPIInstanceMI* mi, const CMPIContext* cc, const CMPIResult* cr, const CMPIObjectPath* cop, const char** properties) { const char *ns = KNameSpace(cop); Linux_HostedService w; Linux_HostedService_Init(&w, _cb, ns); /* * TODO: Find instance dynamically based on Name property */ /* CMPIObjectPath *computerSystemOP = CMNewObjectPath(_cb, ns, "CIM_ComputerSystem", &rc); CMPIEnumeration *en = CBEnumInstanceNames(_cb, cc, computerSystemOP, &rc); while (CMHasNext(en, &rc)) { data = CMGetNext(en, &rc); if (data.type != CMPI_ref) { TRACE(1, "Not a reference\n"); continue; } fprintf(stderr, "object: %s\n", CMGetCharsPtr(CMObjectPathToString(data.value.ref, &rc), &rc)); name = data.value.ref->ft->getKey(data.value.ref, "Name", &rc); if (name.type != CMPI_string) { fprintf(stderr, "Non-string name %d\n", name.type); continue; } if (rc.rc != CMPI_RC_OK) return rc; fprintf(stderr, "Name: %s\n", CMGetCharsPtr(name.value.string, &rc)); if (strcmp(CMGetCharsPtr(name.value.string, &rc), get_system_name()) == 0) { TRACE(1, "Found\n"); CIM_ComputerSystemRef_InitFromObjectPath(&computerSystemRef, _cb, data.value.ref); break; } } */ Linux_ComputerSystemRef computerSystemRef; Linux_ComputerSystemRef_Init(&computerSystemRef, _cb, ns); Linux_ComputerSystemRef_Set_Name(&computerSystemRef, get_system_name()); Linux_ComputerSystemRef_Set_CreationClassName(&computerSystemRef, "Linux_ComputerSystem"); Linux_HostedService_Set_Antecedent(&w, &computerSystemRef); Linux_PowerManagementServiceRef powerManagementServiceRef; Linux_PowerManagementServiceRef_Init(&powerManagementServiceRef, _cb, ns); Linux_PowerManagementServiceRef_Set_Name(&powerManagementServiceRef, get_system_name()); Linux_PowerManagementServiceRef_Set_SystemName(&powerManagementServiceRef, get_system_name()); Linux_PowerManagementServiceRef_Set_CreationClassName(&powerManagementServiceRef, "Linux_PowerManagementService"); Linux_PowerManagementServiceRef_Set_SystemCreationClassName(&powerManagementServiceRef, "Linux_ComputerSystem"); Linux_HostedService_Set_Dependent(&w, &powerManagementServiceRef); KReturnInstance(cr, w); CMReturn(CMPI_RC_OK); } static CMPIStatus Linux_HostedServiceGetInstance( CMPIInstanceMI* mi, const CMPIContext* cc, const CMPIResult* cr, const CMPIObjectPath* cop, const char** properties) { return KDefaultGetInstance( _cb, mi, cc, cr, cop, properties); } static CMPIStatus Linux_HostedServiceCreateInstance( CMPIInstanceMI* mi, const CMPIContext* cc, const CMPIResult* cr, const CMPIObjectPath* cop, const CMPIInstance* ci) { CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); } static CMPIStatus Linux_HostedServiceModifyInstance( 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 Linux_HostedServiceDeleteInstance( CMPIInstanceMI* mi, const CMPIContext* cc, const CMPIResult* cr, const CMPIObjectPath* cop) { CMReturn(CMPI_RC_ERR_NOT_SUPPORTED); } static CMPIStatus Linux_HostedServiceExecQuery( 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 Linux_HostedServiceAssociationCleanup( CMPIAssociationMI* mi, const CMPIContext* cc, CMPIBoolean term) { CMReturn(CMPI_RC_OK); } static CMPIStatus Linux_HostedServiceAssociators( 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, Linux_HostedService_ClassName, assocClass, resultClass, role, resultRole, properties); } static CMPIStatus Linux_HostedServiceAssociatorNames( 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, Linux_HostedService_ClassName, assocClass, resultClass, role, resultRole); } static CMPIStatus Linux_HostedServiceReferences( 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, Linux_HostedService_ClassName, assocClass, role, properties); } static CMPIStatus Linux_HostedServiceReferenceNames( CMPIAssociationMI* mi, const CMPIContext* cc, const CMPIResult* cr, const CMPIObjectPath* cop, const char* assocClass, const char* role) { return KDefaultReferenceNames( _cb, mi, cc, cr, cop, Linux_HostedService_ClassName, assocClass, role); } CMInstanceMIStub( Linux_HostedService, Linux_HostedService, _cb, Linux_HostedServiceInitialize()) CMAssociationMIStub( Linux_HostedService, Linux_HostedService, _cb, Linux_HostedServiceInitialize()) KONKRET_REGISTRATION( "root/cimv2", "Linux_HostedService", "Linux_HostedService", "instance association")