Exemplo n.º 1
0
static CMPIStatus 
ResourceCloneInvokeMethod(CMPIMethodMI * mi, CMPIContext * ctx, 
		CMPIResult * rslt, CMPIObjectPath * ref, 
		const char * method_name, CMPIArgs * in, CMPIArgs * out)
{
        CMPIString * 	classname = NULL;
        CMPIStatus 	rc = {CMPI_RC_OK, NULL};
	int 		ret = 0;
       
	PROVIDER_INIT_LOGGER(); 
	DEBUG_ENTER();
        classname = CMGetClassName(ref, &rc);
        if(strcasecmp(CMGetCharPtr(classname), ClassName) == 0 &&
           strcasecmp(METHOD_ADD_RESOURCE, method_name) == 0 ){
		ret = resource_add_subrsc(Broker, ClassName, ctx, rslt, 
			ref, TID_RES_CLONE, in, out, &rc); 
        }

        CMReturnData(rslt, &ret, CMPI_uint32);
        CMReturnDone(rslt);
	DEBUG_LEAVE();
        CMReturn(CMPI_RC_OK);
}
Exemplo n.º 2
0
   static CMPIStatus mbDeleteInstance (const CMPIBroker *mb, const CMPIContext *ctx,
                  const CMPIObjectPath *cop) {
      DDD(cout<<"--- mbDeleteInstance()"<<endl);
      mb=CM_BROKER;
      CIMObjectPath qop(String::EMPTY,CIMNamespaceName(),
                        CM_ObjectPath(cop)->getClassName(),
            CM_ObjectPath(cop)->getKeyBindings());

      AutoMutex mtx(((CMPI_Broker*)mb)->mtx);
      try {
         CM_CIMOM(mb)->deleteInstance(
                     OperationContext(*CM_Context(ctx)),
         CM_ObjectPath(cop)->getNameSpace(),
         qop); //*CM_ObjectPath(cop));
         CMReturn(CMPI_RC_OK);
      }
      catch (const CIMException &e) {
         DDD(cout<<"### exception: mbDeleteInstance - code: "<<e.getCode()<<" msg: "<<e.getMessage()<<endl);
         CMReturnWithString((CMPIrc)e.getCode(),
            (CMPIString*)string2CMPIString(e.getMessage()));
      }
      CMReturnWithChars(mb,CMPI_RC_ERROR,"Internal error - CMPIBoker.cpp-3");
   }
static CMPIStatus 
PrimitiveResourceInvokeMethod(CMPIMethodMI * mi, CMPIContext * ctx, 
		CMPIResult * rslt, CMPIObjectPath * ref, 
		const char * method_name, CMPIArgs * in, CMPIArgs * out)
{
        CMPIString * 	classname = NULL;
        CMPIStatus 	rc = {CMPI_RC_OK, NULL};
	int 		ret = 0;
        
        classname = CMGetClassName(ref, &rc);
        if(strcasecmp(CMGetCharPtr(classname), ClassName) == 0 &&
           strcasecmp(METHOD_ADD_OPERATION, method_name) == 0 ){
#if 0
		ret = resource_add_operation(Broker, ClassName, ctx, rslt, 
			ref, TID_RES_PRIMITIVE, in, out, &rc);
#endif
		ret = HA_OK;
        }

        CMReturnData(rslt, &ret, CMPI_uint32);
        CMReturnDone(rslt);
        CMReturn(CMPI_RC_OK);
}
Exemplo n.º 4
0
static CMPIStatus __eft_release ( CMPISelectExp * exp )
{
    struct native_selectexp * e = (struct native_selectexp *) exp;
    CMPIContext *ctx;
    CMPIBroker *broker;
    CMPIStatus rc = checkArgsReturnStatus(exp);

    if (rc.rc != CMPI_RC_OK)
    {
        return rc;
    }
    broker = tool_mm_get_broker ( (void**)&ctx);

    if (e->mem_state == TOOL_MM_NO_ADD)
    {
        rc = ( ( (NativeCMPIBrokerFT*)broker->bft) )->selExp_release (exp);
        if (rc.rc == CMPI_RC_OK)
        {
            tool_mm_add ( e );
        }
    }
    CMReturn ( CMPI_RC_OK );
}
Exemplo n.º 5
0
static CMPIStatus ClassProviderCleanup(CMPIClassMI * mi, CMPIContext * ctx)
{
   HashTableIterator *hit,*hitHt,*hitIt;
   char *key;
   ClassRegister *cReg;
   ClassRecord *crec;
   UtilList *ul ;

   for (hit = nsHt->ft->getFirst(nsHt, (void**)&key, (void**)&cReg);
           key && hit && cReg;
           hit = nsHt->ft->getNext(nsHt, hit, (void**)&key, (void**)&cReg)) {
      gzclose(cReg->f);
      free(cReg->vr);
      free(cReg->fn);

      ClassBase *cb = (ClassBase *) (cReg + 1);
      for (hitIt = cb->it->ft->getFirst(cb->it, (void**)&key, (void**)&ul);
           key && hitIt && ul;
           hitIt = cb->it->ft->getNext(cb->it, hitIt, (void**)&key, (void**)&ul)) {
         if (ul) CMRelease(ul);
      }
      CMRelease(cb->it);

      for (hitHt = cb->ht->ft->getFirst(cb->ht, (void**)&key, (void**)&crec);
           key && hitHt && crec;
           hitHt = cb->ht->ft->getNext(cb->ht, hitHt, (void**)&key, (void**)&crec)) {
         free(key);
         if (crec->parent) free(crec->parent);
         free(crec);
      }
      CMRelease(cb->ht);
      free(cReg);
   }
   CMRelease(nsHt);
   CMReturn(CMPI_RC_OK);
}
Exemplo n.º 6
0
    static CMPIStatus errSetMessageArguments(
        CMPIError* eErr, 
        CMPIArray* messageArguments)
    {
        PEG_METHOD_ENTER(
            TRC_CMPIPROVIDERINTERFACE,
            "CMPI_Error:errSetMessageArguments()");
        CIMError* cer=(CIMError*)eErr->hdl;
        if (!cer)
        {
            PEG_METHOD_EXIT();
            CMReturn(CMPI_RC_ERR_INVALID_PARAMETER);
        }

        Array<String> pgMessageArguments;

        CMPIData* dta=(CMPIData*)messageArguments->hdl;
        if (!dta)
        {
            PEG_METHOD_EXIT();
            CMReturn(CMPI_RC_ERR_INVALID_PARAMETER);
        }

        try
        {
            for (unsigned int i=0; i<dta->value.uint32; i++)
            {
                CMPIData arrEl;
                const char * arrElStr;
                CMPIStatus rc = {CMPI_RC_OK,NULL};

                if (dta[i].type!=CMPI_string)
                {
                    PEG_METHOD_EXIT();
                    CMReturn(CMPI_RC_ERR_INVALID_PARAMETER);
                }

                arrEl = CMGetArrayElementAt(messageArguments, i, &rc);
                if (rc.rc != CMPI_RC_OK)
                {
                    PEG_METHOD_EXIT();
                    return rc;
                }

                arrElStr = CMGetCharsPtr(arrEl.value.string, &rc);
                if (rc.rc != CMPI_RC_OK)
                {
                    PEG_METHOD_EXIT();
                    return rc;
                }

                pgMessageArguments.append(String(arrElStr));
            }

            cer->setMessageArguments(pgMessageArguments);
        }
        catch (...)
        {
            PEG_TRACE_CSTRING(
                TRC_CMPIPROVIDERINTERFACE,
                Tracer::LEVEL1,
                "Exception: Unknown Exception received...");
            PEG_METHOD_EXIT();
            CMReturn(CMPI_RC_ERR_FAILED);
        }

        PEG_METHOD_EXIT();
        CMReturn(CMPI_RC_OK);
    }
Exemplo n.º 7
0
    static CMPIStatus errSetRecommendedActions(
        CMPIError* eErr, 
        const CMPIArray* recommendedActions)
    {
        PEG_METHOD_ENTER(
            TRC_CMPIPROVIDERINTERFACE,
            "CMPI_Error:errSetRecommendedActions()");
        CIMError* cer=(CIMError*)eErr->hdl;
        if (!cer)
        {
            PEG_METHOD_EXIT();
            CMReturn(CMPI_RC_ERR_INVALID_PARAMETER);
        }

        Array<String> pgRecommendedActions;

        CMPIData* dta=(CMPIData*)recommendedActions->hdl;
        if (!dta)
        {
            PEG_METHOD_EXIT();
            CMReturn(CMPI_RC_ERR_INVALID_PARAMETER);
        }

        try
        {
            for (unsigned int i=0; i<dta->value.uint32; i++)
            {
                CMPIData arrEl;
                const char * arrElStr;
                CMPIStatus rc = {CMPI_RC_OK,NULL};

                if (dta[i].type!=CMPI_string)
                {
                    PEG_METHOD_EXIT();
                    CMReturn(CMPI_RC_ERR_INVALID_PARAMETER);
                }

                arrEl = CMGetArrayElementAt(recommendedActions, i, &rc);
                if (rc.rc != CMPI_RC_OK)
                {
                    PEG_METHOD_EXIT();
                    return rc;
                }

                arrElStr = CMGetCharsPtr(arrEl.value.string, &rc);
                if (rc.rc != CMPI_RC_OK)
                {
                    PEG_METHOD_EXIT();
                    return rc;
                }

                pgRecommendedActions.append(String(arrElStr));
            }

            cer->setRecommendedActions(pgRecommendedActions);
        }
        catch (...)
        {
            PEG_METHOD_EXIT();
            CMReturn(CMPI_RC_ERR_FAILED);
        }

        PEG_METHOD_EXIT();
        CMReturn(CMPI_RC_OK);
    }
Exemplo n.º 8
0
CMPIStatus TestCMPIBrokerInstanceProviderCreateInstance (CMPIInstanceMI * mi,
    const CMPIContext * ctx,
    const CMPIResult * rslt,
    const CMPIObjectPath * cop,
    const CMPIInstance * ci)
{
    const CMPIString* retNamespace;
    const CMPIString* retClassname;
    CMPIString* type;
    const char* str1;
    const char* str2;
    CMPIStatus rc = { CMPI_RC_OK, NULL };
    CMPIData retData;
    CMPIObjectPath *obj;
    CMPIBoolean bol = 0;

    PROV_LOG_OPEN (_ClassName, _ProviderLocation);
    PROV_LOG("CreateInstance");

    retNamespace = CMGetNameSpace(cop, &rc);
    retClassname = CMGetClassName(cop, &rc);
    str1 = CMGetCharsPtr(retNamespace, &rc);
    str2 = CMGetCharsPtr(retClassname, &rc);
    PROV_LOG("++++Obtained Namespace : (%s) Class (%s)", str1, str2);

    if(ci)
    { 
        /* Test to increase coverage in Broker_Enc.cpp*/
        type = CDToString (_broker, ci, &rc);
        PROV_LOG ("++++ Passing CMPIInstance with CMPI_InstanceOnStack_Ftab "
            "to mbEncToString successes : "
            "(%s)",
            strCMPIStatus (rc));    

        type = CDGetType (_broker, ci, &rc);
        PROV_LOG ("++++ Status of mbEncGetType with input of type CMPIInstance"
            " : (%s) type(%s)",
            strCMPIStatus (rc),
            CMGetCharsPtr(type, NULL));

        bol = CDIsOfType (_broker, ci, "CMPIInstance", &rc);
        if ( bol )
        {
            PROV_LOG ("++++ CDIsOfType for CMPIInstance with "
                "CMPI_InstanceOnStack_Ftab status is (%s) : %d",
                strCMPIStatus (rc),
                bol);
        }

        type = CDToString (_broker, cop, &rc);
        PROV_LOG ("++++ Passing CMPIObjectPath with "
            "CMPI_ObjectPathOnStack_Ftab to mbEncToString successes : (%s)",
            strCMPIStatus (rc));    

        type = CDGetType (_broker, cop, &rc);
        PROV_LOG ("++++ Status of mbEncGetType with input of type "
            "CMPIObjectPath : (%s) type(%s)",
            strCMPIStatus (rc),
            CMGetCharsPtr(type, NULL));

        bol = CDIsOfType (_broker, cop, "CMPIObjectPath", &rc);
        if ( bol )
        {
            PROV_LOG ("++++ CDIsOfType for CMPIObjectPath with "
                "CMPI_ObjectPathOnStack_Ftab status is (%s) : %d",
                strCMPIStatus (rc),
                bol);
        }

        type = CDGetType (_broker, rslt, &rc);
        PROV_LOG ("++++ Status of mbEncGetType with input of type "
            "CMPIResult with CMPI_ResultRefOnStack_Ftab : (%s) type(%s)",
            strCMPIStatus (rc),
            CMGetCharsPtr(type, NULL));

        bol = CDIsOfType (_broker, rslt, "CMPIResult", &rc);
        if ( bol )
        {
            PROV_LOG ("++++ CDIsOfType for CMPIResult with "
                "CMPI_ResultRefOnStack_Ftab status is (%s) : %d",
                strCMPIStatus (rc),
                bol);
        }

        _inst = CMClone(ci, &rc);
        PROV_LOG("++++ Status of CMClone(ci) : (%s)",
            strCMPIStatus(rc));
        CMSetObjectPath (_inst, cop);
        PROV_LOG("++++ Status of CMSetObjectPath(_inst) : (%s)",
            strCMPIStatus(rc));
        _setProperty1(_inst, "*");
        retData = CMGetProperty(_inst, "n64", &rc);
        PROV_LOG("++++ Status of CMGetProperty : (%s)",
            strCMPIStatus(rc));
        PROV_LOG("n64 = %" PEGASUS_64BIT_CONVERSION_WIDTH "u",
            retData.value.uint64);
        retData = CMGetProperty(_inst, "n32", &rc);
        PROV_LOG("++++ Status of CMGetProperty : (%s)",
            strCMPIStatus(rc));
        PROV_LOG("n32 = %d", retData.value.uint32);

        obj = CMGetObjectPath(_inst, &rc);
        PROV_LOG("++++ Status of CMGetObjectPath : (%s)",
            strCMPIStatus(rc));
        retNamespace = CMGetNameSpace(obj, &rc);
        PROV_LOG("++++ Status of CMGetNameSpace : (%s)",
            strCMPIStatus(rc));
        retClassname = CMGetClassName(obj, &rc);
        PROV_LOG("++++ Status of CMGetClassName : (%s)",
            strCMPIStatus(rc));
        str1 = CMGetCharsPtr(retNamespace, &rc);
        PROV_LOG("++++ Status of CMGetCharsPtr : (%s)",
            strCMPIStatus(rc));
        str2 = CMGetCharsPtr(retClassname, &rc);
        PROV_LOG("++++ Status of CMGetCharsPtr : (%s)",
            strCMPIStatus(rc));
        PROV_LOG("++++Namespace (_inst): (%s) Class (*%s)", str1, str2);
        retData = CMGetProperty(_inst, "n64", &rc);
        PROV_LOG("++++ Status of CMGetProperty : (%s)",
            strCMPIStatus(rc));
        PROV_LOG("n64 = %" PEGASUS_64BIT_CONVERSION_WIDTH "u",
            retData.value.uint64);
        PROV_LOG_CLOSE ();

        CMReturnObjectPath(rslt, cop);
        CMReturnDone(rslt);
        CMReturn (CMPI_RC_OK);
    }
    else
    {
        PROV_LOG_CLOSE ();
        CMReturn (CMPI_RC_ERR_NOT_SUPPORTED);
    }
}
Exemplo n.º 9
0
/*
The CMPIInstanceMIFTcleanup() function shall perform any necessary cleanup operation prior to the unloading of the library of which this MI group is part.
This function is called prior to the unloading of the provider.
Parameters:
mi - The mi argument is a pointer to a CMPIInstanceMI structure. 
ctx - The ctx argument is a pointer to a CMPIContext structure containing the Invocation Context. 

Returns:
Function return status. The following CMPIrc codes shall be recognized: CMPI_RC_OK Operation successful. CMPI_RC_ERR_FAILED Unspecific error occurred. 
CMPI_RC_DO_NOT_UNLOAD Operation successful - do not unload now. CMPI_RC_NEVER_UNLOAD Operation successful - never unload.o
*/
CMPIStatus GK_TestCleanup( CMPIInstanceMI * mi, 
           CMPIContext * ctx) {
  CMReturn(CMPI_RC_OK);
}
Exemplo n.º 10
0
static CMPIStatus contextReleaseNop(CMPIContext* eCtx)
{
	CMReturn(CMPI_RC_OK);
}
Exemplo n.º 11
0
/* ---------------------------------------------------------------------------*/
CMPIStatus TestCMPIBrokerEncProviderMethodCleanup (CMPIMethodMI * mi,
    const CMPIContext * ctx,
    CMPIBoolean  term)
{
    CMReturn (CMPI_RC_OK);
}
Exemplo n.º 12
0
static CMPIStatus __rft_returnDone(const CMPIResult * result)
{
   CMReturn(CMPI_RC_OK);
}
Exemplo n.º 13
0
static CMPIStatus 
ResourceGroupMethodCleanup(CMPIMethodMI * mi, CMPIContext * ctx)
{
        CMReturn(CMPI_RC_OK);
}               
Exemplo n.º 14
0
 static CMPIStatus mbAttachThread(const CMPIBroker* mb, const CMPIContext* eCtx) {
    DDD(cout<<"--- mbAttachThread()"<<endl);
    ((CMPI_Context*)eCtx)->thr=new CMPI_ThreadContext(mb,eCtx);
    CMReturn(CMPI_RC_OK);
 }
Exemplo n.º 15
0
static CMPIStatus __rft_returnInstance(const CMPIResult * result,
                                       const CMPIInstance * instance)
{
   int size,isInst=isInstance(instance);
   void *ptr;
   NativeResult *r = (NativeResult*) result;
   int releaseInstance=0;
   CMPIStatus st={CMPI_RC_OK,NULL};
   
   _SFCB_ENTER(TRACE_PROVIDERDRV, "__rft_returnInstance");
   
   if (r->qs) {
      int irc;

      if (r->qs->where) {
         r->qs->propSrc.data=(CMPIInstance *)instance;
         irc=r->qs->where->ft->evaluate(r->qs->where,&r->qs->propSrc);
         if (irc==1) {
            if (r->qs->allProps==0) {
               instance=
		       r->qs->ft->cloneAndFilter(r->qs,(CMPIInstance *)instance,CMGetObjectPath(instance, NULL),r->qs->keys);
               releaseInstance=1;
            }     
         }   
         else CMReturn(CMPI_RC_OK);
      }
      else {
         if (r->qs->allProps==0) {
		 instance=r->qs->ft->cloneAndFilter(r->qs,(CMPIInstance *)instance,CMGetObjectPath(instance,NULL), r->qs->keys);
            releaseInstance=1;
         }
      }        
   }

   if (r->legacy) {
      CMPIValue v;
      CMPIStatus rc;
      _SFCB_TRACE(1,("--- Legacy Mode"));
      if(isInst) {
        v.inst = CMClone(instance,NULL);
        memLinkInstance(v.inst);
      }
      else v.inst = (CMPIInstance *) instance;
      rc=returnData(result, &v, CMPI_instance);
      if (releaseInstance) instance->ft->release((CMPIInstance*)instance);
      _SFCB_RETURN(rc);
   }

   if (isInst) {
      size=getInstanceSerializedSize(instance);
      ptr=nextResultBufferPos(r, MSG_SEG_INSTANCE, (unsigned long)size);
      _SFCB_TRACE(1,("--- Moving instance %d",size));
      getSerializedInstance(instance,ptr); /* memcpy inst to ptr */
   }
   else {
      size=getConstClassSerializedSize((CMPIConstClass*)instance);
      ptr=nextResultBufferPos(r, MSG_SEG_CONSTCLASS, (unsigned long)size);
      _SFCB_TRACE(1,("--- Moving class %d",size));
      getSerializedConstClass((CMPIConstClass*)instance,ptr);
   }

   if (releaseInstance) instance->ft->release((CMPIInstance*)instance);
   _SFCB_RETURN(st);
}
Exemplo n.º 16
0
CMPIStatus TestInstanceProviderExecQuery (
    CMPIInstanceMI * mi,
    const CMPIContext * ctx,
    const CMPIResult * rslt,
    const CMPIObjectPath * referencePath,
    const char *query,
    const char *lang)
{
    CMPIStatus rc = { CMPI_RC_OK, NULL };
    CMPIStatus rc_Eval = { CMPI_RC_OK, NULL };
    CMPIStatus rc_Clone = { CMPI_RC_OK, NULL };
    CMPIStatus rc_Array = { CMPI_RC_OK, NULL };
    CMPISelectExp *se_def = NULL;
    CMPICount cnt = 0;
    CMPIArray *projection = NULL;
    unsigned int j = 0;
    CMPIBoolean evalRes;
    CMPIData arr_data;
    CMPIInstance *instance1;
    CMPIObjectPath *cop1;
    CMPIData data;
    CMPIValue value1;
    const char* prop_name;
    CMPIData retProp;

    /*create the select expression */
    se_def = CMNewSelectExp (_broker, query, lang, &projection, &rc_Clone);
    if (se_def)
    {
        /*loop over instances in array to evaluate for requested properties */
        for (j = 0; j < numOfInst ; j++)
        {
            /*check for validity of Instance,that its not deleted */
            if(valid[j] == 1)
            {
                /*get the element from array */
                arr_data = CMGetArrayElementAt(
                    clone_arr_ptr,
                    j,
                    &rc);
                /*Evaluate the instance using this select expression */
               evalRes = CMEvaluateSelExp(se_def,arr_data.value.inst, &rc_Eval);
                if (evalRes)
                {
                    /*check if any of properties are requested */
                    if (projection)
                    {
                        /*get number of properties requested */
                        cnt = CMGetArrayCount (projection, &rc_Array);
                        /*if count is not equal to number of properties of
                          instance */
                        if(cnt == 1)
                        {
                            /*check for the properties, requested */
                            data = CMGetArrayElementAt(
                                projection,
                                0,
                                &rc_Array);
                            prop_name = CMGetCharsPtr (
                                data.value.string,
                                &rc);
                            /*create the new instance that has to be returned */
                            cop1 = CMNewObjectPath(
                                _broker,
                                "root/cimv2",
                                _ClassName,
                                &rc);

                            instance1 = CMNewInstance(_broker,
                                cop1,
                                &rc);

                            /*if property name is "Identifier",
                               gets its value from instance */
                            if(!strcmp(prop_name, "Identifier"))
                            {
                                retProp = CMGetProperty(
                                    arr_data.value.inst,
                                        "Identifier",
                                        &rc);
                                value1.uint8 = retProp.value.uint8;
                                CMSetProperty(
                                    instance1,
                                    "Identifier",
                                    (CMPIValue *)&value1,
                                    CMPI_uint8);
                            }
                            /*if property name is "Message",
                              gets its value from instance */
                            if(!strcmp(prop_name, "Message"))
                            {
                                retProp = CMGetProperty(
                                    arr_data.value.inst,
                                    "Message",
                                    &rc);
                                    value1.string = retProp.value.string;
                                    CMSetProperty(
                                        instance1,
                                        "Message",
                                        (CMPIValue *)&value1,
                                        CMPI_string);
                            }
                            /*if the query is evaluated return instance */
                            CMReturnInstance (rslt, instance1);
                        }
                    }
                    else
                    {
                        CMReturnInstance(rslt, arr_data.value.inst);
                    }
                }
            }
        }
    }

    CMReturnDone (rslt);
    CMReturn (CMPI_RC_OK);
}
Exemplo n.º 17
0
    PEGASUS_STATIC CMPIStatus arrayRelease(CMPIArray* eArray)
    {
        PEG_METHOD_ENTER(
            TRC_CMPIPROVIDERINTERFACE,
            "CMPI_Array:arrayRelease()");
        CMPIStatus rrc = {CMPI_RC_OK,NULL};
        CMPI_Array *arr = (CMPI_Array*)eArray->hdl;
        if (!arr)
        {
            PEG_METHOD_EXIT();
            CMReturn(CMPI_RC_ERR_INVALID_HANDLE);
        }
        CMPIData* dta=(CMPIData*)arr->hdl;
        if (!dta)
        {
            PEG_METHOD_EXIT();
            CMReturn(CMPI_RC_ERR_INVALID_HANDLE);
        }

        if (arr->isCloned != 0)
        {
            for (unsigned int i=1; i<=dta->value.uint32; i++)
            {
                if (dta->type & CMPI_ENC && dta[i].state==CMPI_goodValue)
                {
                    switch (dta[i].type)
                    {
                        case CMPI_instance:
                            if (dta[i].value.inst)
                            {
                                rrc = (dta[i].value.inst)->ft->release(
                                    dta[i].value.inst);
                            }
                            break;
                        case CMPI_ref:
                            if (dta[i].value.ref)
                            {
                                rrc = (dta[i].value.ref)->ft->release(
                                    dta[i].value.ref);
                            }
                            break;
                        case CMPI_args:
                            if (dta[i].value.args)
                            {
                                rrc = (dta[i].value.args)->ft->release(
                                    dta[i].value.args);
                            }
                            break;
                        case CMPI_dateTime:
                            if (dta[i].value.dateTime)
                            {
                                rrc = (dta[i].value.dateTime)->ft->release(
                                    dta[i].value.dateTime);
                            }
                            break;
                        case CMPI_enumeration:
                            if (dta[i].value.Enum)
                            {
                                rrc = (dta[i].value.Enum)->ft->release(
                                    dta[i].value.Enum);
                            }
                            break;
                        case CMPI_filter:
                            if (dta[i].value.filter)
                            {
                                rrc = (dta[i].value.filter)->ft->release(
                                    dta[i].value.filter);
                            }
                            break;
                        case CMPI_charsptr:
                            if (dta[i].value.dataPtr.ptr)
                            {
                                free(dta[i].value.dataPtr.ptr);
                            }
                            break;
                        case CMPI_string:
                            if (dta[i].value.string)
                            {
                                rrc = (dta[i].value.string)->ft->release(
                                    dta[i].value.string);
                            }
                            break;
                    }
                }
            }
        }
        delete[] dta;
        delete arr;
        reinterpret_cast<CMPI_Object*>(eArray)->unlinkAndDelete();
        PEG_METHOD_EXIT();
        CMReturn(CMPI_RC_OK);
    }
Exemplo n.º 18
0
    CMPIStatus arraySetElementAt(
        CMPIArray* eArray,
        CMPICount pos,
        const CMPIValue *val,
        CMPIType type)
    {
        PEG_METHOD_ENTER(
            TRC_CMPIPROVIDERINTERFACE,
            "CMPI_Array:arraySetElementAt()");
        CMPI_Array *arr = (CMPI_Array*)eArray->hdl;
        if (!arr)
        {
            PEG_METHOD_EXIT();
            CMReturn(CMPI_RC_ERR_INVALID_HANDLE);
        }

        CMPIData *dta = (CMPIData*)arr->hdl;
        if (!dta)
        {
            PEG_METHOD_EXIT();
            CMReturn(CMPI_RC_ERR_INVALID_HANDLE);
        }
        if (!val)
        {
            PEG_METHOD_EXIT();
            CMReturn( CMPI_RC_ERR_INVALID_PARAMETER);
        }
        if (pos<dta->value.uint32)
        {
            if (type == CMPI_null)
            {
                dta[pos+1].state=CMPI_nullValue;
                PEG_METHOD_EXIT();
                CMReturn(CMPI_RC_OK);
            }
            else if ((dta->type&~CMPI_ARRAY)==type)
            {
                dta[pos+1].state=CMPI_goodValue;
                if (type == CMPI_chars)
                {
                    // Store char* as CMPIString internally, this frees us from
                    // doing explicit memory management for char*.
                    dta[pos+1].value.string = reinterpret_cast<CMPIString*>(
                        new CMPI_Object((const char*) val));
                    dta[pos+1].type = CMPI_string;
                }
                else
                {
                    dta[pos+1].value = *val;
                }
                PEG_METHOD_EXIT();
                CMReturn(CMPI_RC_OK);
            }
            else
            {
                char msg[512];
                sprintf(msg,"arraySetElementAt(): CMPI_RC_ERR_TYPE_MISMATCH."
                    " Is %u - should be %u",
                    (unsigned int)type, (unsigned int)dta->type);
                PEG_METHOD_EXIT();
                CMReturnWithString(
                    CMPI_RC_ERR_TYPE_MISMATCH,
                    reinterpret_cast<CMPIString*>(new CMPI_Object(msg)));
            }
        }
        PEG_METHOD_EXIT();
        CMReturn(CMPI_RC_ERR_NO_SUCH_PROPERTY);
    }
Exemplo n.º 19
0
CMPIStatus
indProvMethodCleanup(CMPIMethodMI * cThis, const CMPIContext *ctx,
                     CMPIBoolean term)
{
  CMReturn(CMPI_RC_OK);
}
CMPIStatus
indProvDisableIndications(CMPIIndicationMI * cThis, const CMPIContext *ctx)
{
  fprintf(stderr, "+++ indProvDisableIndications\n");
  CMReturn(CMPI_RC_OK);
}
Exemplo n.º 21
0
CMPIStatus
indProvIndicationCleanup(CMPIIndicationMI * cThis, const CMPIContext *ctx,
                         CMPIBoolean term)
{
  CMReturn(CMPI_RC_OK);
}
Exemplo n.º 22
0
    static CMPIStatus mbDeliverIndication(
        const CMPIBroker* eMb,
        const CMPIContext* ctx,
        const char *ns,
        const CMPIInstance* ind)
    {
        PEG_METHOD_ENTER(
            TRC_CMPIPROVIDERINTERFACE,
            "CMPI_Broker:mbDeliverIndication()");
        eMb = CM_BROKER;
        CMPI_Broker *mb = (CMPI_Broker*)eMb;
        IndProvRecord *indProvRec;
        OperationContext* context = CM_Context(ctx);

        SCMOInstance* scmoInst = SCMO_Instance(ind);
        CIMInstance indInst;
        scmoInst->getCIMInstance(indInst);

        // When an indication to be delivered comes from Remote providers,
        // the CMPIBroker contains the name of the provider in the form
        // of physical-name:logical-name. Search using logical-name. -V 5884
        String provider_name;
        CMPIUint32 n;

        if ( (n = mb->name.find(':') ) != PEG_NOT_FOUND)
        {
            provider_name = mb->name.subString (n + 1);
        }
        else
        {
            provider_name = mb->name;
        }
        ReadLock readLock(CMPIProviderManager::rwSemProvTab);
        if (CMPIProviderManager::indProvTab.lookup(provider_name, indProvRec))
        {
            if (indProvRec->isEnabled())
            {
                try
                {
                    context->get(SubscriptionInstanceNamesContainer::NAME);
                }
                catch (const Exception &e)
                {
                    PEG_TRACE((TRC_CMPIPROVIDERINTERFACE,Tracer::LEVEL1,
                        "Exception: %s",
                        (const char*)e.getMessage().getCString()));
                    Array<CIMObjectPath> subscriptionInstanceNames;
                    context->insert(
                        SubscriptionInstanceNamesContainer(
                            subscriptionInstanceNames));
                }
                CIMIndication cimIndication(indInst);
                try
                {
                    indProvRec->getHandler()->deliver(
                        *context,
   //                   OperationContext(*CM_Context(ctx)),
                        cimIndication);
                    PEG_METHOD_EXIT();
                    CMReturn(CMPI_RC_OK);
                }
                HandlerCatchReturnStatus();
            }
        }
        PEG_METHOD_EXIT();
        CMReturn(CMPI_RC_ERR_FAILED);
    }
Exemplo n.º 23
0
CMPIStatus CWS_DirectoryCleanup( CMPIInstanceMI * mi, 
                 const CMPIContext * ctx, CMPIBoolean term) 
{
  CMReturn(CMPI_RC_OK);
}
Exemplo n.º 24
0
 static CMPIStatus resultBadReturnObjectPath(const CMPIResult* eRes, const CMPIObjectPath* eRef) {
    CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
 }
Exemplo n.º 25
0
static CMPIStatus argsReleaseNop(CMPIArgs* eArg)
{
	CMReturn(CMPI_RC_OK);
}
Exemplo n.º 26
0
 static CMPIStatus resultBadReturnInstance(const CMPIResult* eRes, const CMPIInstance* eInst) {
    CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
 }
Exemplo n.º 27
0
CMPIStatus TestCMPIBrokerInstanceProviderCleanup (CMPIInstanceMI * mi,
    const CMPIContext * ctx,
    CMPIBoolean term)
{
    CMReturn (CMPI_RC_OK);
}
static CMPIStatus 
PrimitiveResourceMethodCleanup(CMPIMethodMI * mi, CMPIContext * ctx)
{
        CMReturn(CMPI_RC_OK);
}
Exemplo n.º 29
0
CMPIStatus TestCMPIBrokerInstanceProviderGetInstance (CMPIInstanceMI * mi,
    const CMPIContext * ctx,
    const CMPIResult * rslt,
    const CMPIObjectPath * cop,
    const char **properties)
{
    CMPIStatus rc = {CMPI_RC_OK, NULL};
    CMPIString* retNamespace;
    CMPIString* retClassname;
    CMPIString* type;
    CMPIData retData;
    CMPIObjectPath* obj;
    CMPIBoolean bol = 0;
    const char* str1;
    const char* str2;

    PROV_LOG_OPEN (_ClassName, _ProviderLocation);
    PROV_LOG("GetInstance");
    PROV_LOG("++++Namespace ");

    obj = CMGetObjectPath(_inst, &rc);
    PROV_LOG("++++ Status of CMGetObjectPath : (%s)",
        strCMPIStatus(rc));
    retNamespace = CMGetNameSpace(obj, &rc);
    PROV_LOG("++++ Status of CMGetNameSpace : (%s)",
        strCMPIStatus(rc));
    retClassname = CMGetClassName(obj, &rc);
    PROV_LOG("++++ Status of CMGetClassName : (%s)",
        strCMPIStatus(rc));
    str1 = CMGetCharsPtr(retNamespace, &rc);
    PROV_LOG("++++ Status of CMGetCharsPtr : (%s)",
        strCMPIStatus(rc));
    str2 = CMGetCharsPtr(retClassname, &rc);
    PROV_LOG("++++ Status of CMGetCharsPtr : (%s)",
        strCMPIStatus(rc));
    retData = CMGetProperty(_inst, "n64", &rc);
    PROV_LOG("++++ Status of CMGetProperty : (%s)",
        strCMPIStatus(rc));
    PROV_LOG("n64 = %" PEGASUS_64BIT_CONVERSION_WIDTH "u",
        retData.value.uint64);
   
    /* Test cases for increasing coverage in CMPI_BrokerEnc.cpp*/
    type = CDGetType (_broker, rslt, &rc);
    PROV_LOG ("++++ Status of mbEncGetType with input of type "
        "CMPIResult with CMPI_ResultInstOnStack_Ftab : (%s) type(%s)",
        strCMPIStatus (rc),
        CMGetCharsPtr(type, NULL));

    bol = CDIsOfType (_broker, rslt, "CMPIResult", &rc);
    if ( bol )
    {
        PROV_LOG ("++++ CDIsOfType for CMPIResult with "
            "CMPI_ResultInstOnStack_Ftab status is (%s) : %d",
            strCMPIStatus (rc),
            bol);
    }
    PROV_LOG_CLOSE();

    if (_inst)
    {
        CMReturnInstance(rslt, _inst);
        CMReturnDone(rslt);
        CMReturn (CMPI_RC_OK);
    }
    else
    {
        CMReturn (CMPI_RC_ERR_NOT_SUPPORTED);
    }
}
Exemplo n.º 30
0
/*
The CMPIMethodMIFTcleanup() function shall perform any necessary cleanup operation prior to the unloading of the library of which this MI group is part. 
This function is called prior to the unloading of the provider.
Parameters:
mi - The mi argument is a pointer to a CMPIMethodMI structure. 
ctx - The ctx argument is a pointer to a CMPIContext structure containing the Invocation Context. 
terminating - When true, the terminating argument indicates that the MB is in the process of terminating and that cleanup must be done. 
When set to false, the MI may respond with CMPI_IRC_DO_NOT_UNLOAD, or CMPI_IRC_NEVER_UNLOAD, indicating that unload will interfere with current MI processing. 
Returns:
Function return status. The following CMPIrc codes shall be recognized: CMPI_RC_OK Operation successful. CMPI_RC_ERR_FAILED Unspecific error occurred. 
CMPI_RC_DO_NOT_UNLOAD Operation successful - do not unload now. CMPI_RC_NEVER_UNLOAD Operation successful - never unload.
*/
CMPIStatus GK_TestMethodCleanup( CMPIMethodMI * mi, 
           CMPIContext * ctx) {
  CMReturn(CMPI_RC_OK);
}