int dqRetry(CMPIContext * ctx, RTElement * cur) { _SFCB_ENTER(TRACE_INDPROVIDER, "dqRetry"); // Delete the instance in the repo CMPIObjectPath * op=CMNewObjectPath(_broker,"root/interop","SFCB_IndicationElement",NULL); CMAddKey(op,"IndicationID",&cur->instanceID,CMPI_uint32); CBDeleteInstance(_broker,ctx,op); CBDeleteInstance(_broker,ctx,cur->ind); CMRelease(op); // Remove the entry from the queue, closing the hole if (cur->next == cur) { // queue is empty free(cur); RQhead = NULL; } else { // not last cur->prev->next = cur->next; cur->next->prev = cur->prev; CMRelease(cur->ref); CMRelease(cur->sub); if (cur) free(cur); } _SFCB_RETURN(0); }
/** Create Instance from inst, using object-path op as reference. */ CMPIStatus TestInstanceProviderCreateInstance ( CMPIInstanceMI * mi, const CMPIContext * ctx, const CMPIResult * rslt, const CMPIObjectPath * cop, const CMPIInstance * ci) { CMPIStatus rc = { CMPI_RC_OK, NULL }; CMPIInstance * inst; CMPIValue value_inst; CMPIData key1,key2, retInst; CMPIObjectPath *obp; unsigned int j = 0; if(ci) { /* clone the instance to be added to the array */ inst = CMClone(ci, &rc); key1 = CMGetProperty(inst, "Identifier", &rc); for (j=0; j < numOfInst ; j++) { /* check for validity of Instance, that its not deleted */ if (valid[j] == 1) { /* get element(instance) from array */ retInst = CMGetArrayElementAt(clone_arr_ptr, j, &rc); /* get object-path of instance */ obp = CMGetObjectPath(retInst.value.inst, &rc); /* get key from this object-path */ key2 = CMGetKey(obp, "Identifier", &rc); /*compare key values. If they match throw exception as two instance with same key properties cannot exists. */ if(key1.value.uint8 == key2.value.uint8) { CMRelease(inst); CMReturn (CMPI_RC_ERR_ALREADY_EXISTS); } } } value_inst.inst = inst; /* If instance doesnot exists in array add it */ rc = CMSetArrayElementAt( clone_arr_ptr, numOfInst, &value_inst, CMPI_instance); valid[numOfInst]=1; numOfInst++; /* return object-path of instance */ CMReturnObjectPath(rslt, cop); CMReturnDone(rslt); } else { CMReturn (CMPI_RC_ERR_NOT_SUPPORTED); } CMRelease(inst); CMReturn (CMPI_RC_OK); }
int main() { CMCIClient *cc; CMPIObjectPath * objectpath; CMPIEnumeration * enumeration; CMPIStatus status; char *cim_host, *cim_host_passwd, *cim_host_userid; /* Setup a connection to the CIMOM */ cim_host = getenv("CIM_HOST"); if (cim_host == NULL) cim_host = "localhost"; cim_host_userid = getenv("CIM_HOST_USERID"); if (cim_host_userid == NULL) cim_host_userid = "root"; cim_host_passwd = getenv("CIM_HOST_PASSWD"); if (cim_host_passwd == NULL) cim_host_passwd = "password"; cc = cmciConnect(cim_host, NULL, "5988", cim_host_userid, cim_host_passwd, NULL); /* Test references() */ printf("\n----------------------------------------------------------\n"); printf("--> Testing references() ...\n"); objectpath = newCMPIObjectPath("root/cimv2", "Linux_ComputerSystem", NULL); printf( "--> Adding keys to object path\n" ); CMAddKey(objectpath, "CreationClassName", "Linux_ComputerSystem", CMPI_chars); CMAddKey(objectpath, "Name", "localhost.localdomain", CMPI_chars); printf( "--> Enumerating Instances\n" ); enumeration = cc->ft->references(cc, objectpath, NULL, NULL, 0, NULL, &status); printf( "--> Print the results \n" ); printf( "--> references() rc=%d, msg=%s\n", status.rc, (status.msg)? (char *)status.msg->hdl : NULL); if (!status.rc) { printf("--> result(s):\n"); while (enumeration->ft->hasNext(enumeration, NULL)) { CMPIData data = enumeration->ft->getNext(enumeration, NULL); showInstance(data.value.inst); } } if (enumeration) CMRelease(enumeration); if (objectpath) CMRelease(objectpath); if (status.msg) CMRelease(status.msg); if (cc) CMRelease(cc); return 0; }
int enqRetry(RTElement * element, const CMPIContext * ctx, int repo) { _SFCB_ENTER(TRACE_INDPROVIDER, "enqRetry"); // Put this one on the retry queue if (pthread_mutex_lock(&RQlock) != 0) { // lock failed return 1; } if (RQhead == NULL) { // Queue is empty _SFCB_TRACE(1,("--- Adding indication to new retry queue.")); RQhead = element; RQtail = element; RQtail->next = element; RQtail->prev = element; } else { _SFCB_TRACE(1,("--- Adding indication to retry queue.")); element->next = RQtail->next; element->next->prev = element; RQtail->next = element; element->prev = RQtail; RQtail = element; } if (repo==1) { // If this needs to be persisted in the repo // (not the initial fill from refillRetryQ) _SFCB_TRACE(1,("--- Creating SFCB_IndicationElement instance.")); CMPIObjectPath * op=CMNewObjectPath(_broker,"root/interop","SFCB_IndicationElement",NULL); // Add the indID as the only key CMAddKey(op,"IndicationID",&element->instanceID,CMPI_uint32); // Create the instance //element->SFCBIndEle=op; element->SFCBIndEle=op->ft->clone(op,NULL); CMPIInstance * ci=CMNewInstance(_broker,op,NULL); // Set all the properties CMSetProperty(ci,"IndicationID",&element->instanceID,CMPI_uint32); CMSetProperty(ci,"RetryCount",&(RQtail->count),CMPI_uint32); CMSetProperty(ci,"LastDelivery",&(RQtail->lasttry),CMPI_sint32); CMSetProperty(ci,"ld",&(element->ref),CMPI_ref); CMSetProperty(ci,"ind",&element->ind,CMPI_ref); CMSetProperty(ci,"sub",&element->sub,CMPI_ref); CBCreateInstance(_broker, ctx, op, ci, NULL); CMRelease(op); CMRelease(ci); } if (pthread_mutex_unlock(&RQlock) != 0) { // lock failed return 1; } _SFCB_RETURN(0); }
CMPIStatus IndCIMXMLHandlerEnumInstanceNames(CMPIInstanceMI * mi, const CMPIContext * ctx, const CMPIResult * rslt, const CMPIObjectPath * ref) { CMPIStatus st; CMPIEnumeration *enm; CMPIContext *ctxLocal; _SFCB_ENTER(TRACE_INDPROVIDER, "IndCIMXMLHandlerEnumInstanceNames"); if (interOpNameSpace(ref,&st)!=1) _SFCB_RETURN(st); ctxLocal = prepareUpcall((CMPIContext *)ctx); #ifdef HAVE_OPTIMIZED_ENUMERATION CMPIString* cn; CMPIObjectPath* refLocal; cn = CMGetClassName(ref, &st); if (strcasecmp(CMGetCharPtr(cn), "cim_listenerdestination") == 0) { enm = _broker->bft->enumerateInstanceNames(_broker, ctxLocal, ref, &st); while(enm && enm->ft->hasNext(enm, &st)) { CMReturnObjectPath(rslt, (enm->ft->getNext(enm, &st)).value.ref); } refLocal = CMNewObjectPath(_broker,"root/interop","cim_listenerdestinationcimxml",&st); enm = _broker->bft->enumerateInstanceNames(_broker, ctxLocal, refLocal, &st); while(enm && enm->ft->hasNext(enm, &st)) { CMReturnObjectPath(rslt, (enm->ft->getNext(enm, &st)).value.ref); } refLocal = CMNewObjectPath(_broker,"root/interop","cim_indicationhandlercimxml",&st); enm = _broker->bft->enumerateInstanceNames(_broker, ctxLocal, refLocal, &st); while(enm && enm->ft->hasNext(enm, &st)) { CMReturnObjectPath(rslt, (enm->ft->getNext(enm, &st)).value.ref); } CMRelease(refLocal); } else { enm = _broker->bft->enumerateInstanceNames(_broker, ctxLocal, ref, &st); while(enm && enm->ft->hasNext(enm, &st)) { CMReturnObjectPath(rslt, (enm->ft->getNext(enm, &st)).value.ref); } } #else enm = _broker->bft->enumerateInstanceNames(_broker, ctxLocal, ref, &st); while(enm && enm->ft->hasNext(enm, &st)) { CMReturnObjectPath(rslt, (enm->ft->getNext(enm, &st)).value.ref); } #endif CMRelease(ctxLocal); if(enm) CMRelease(enm); _SFCB_RETURN(st); }
int main() { CMCIClient *cc; CMPIObjectPath * objectpath; CMPIEnumeration * enumeration; CMPIStatus status; char *cim_host, *cim_host_passwd, *cim_host_userid, *cim_host_cert, *cim_client_cert, *cim_client_key; /* Setup a connection to the CIMOM */ cim_host = getenv("CIM_HOST"); if (cim_host == NULL) cim_host = "localhost"; cim_host_userid = getenv("CIM_HOST_USERID"); if (cim_host_userid == NULL) cim_host_userid = "root"; cim_host_passwd = getenv("CIM_HOST_PASSWD"); if (cim_host_passwd == NULL) cim_host_passwd = "password"; cim_host_cert = getenv("CIM_HOST_CERT"); cim_client_cert = getenv("CIM_CLIENT_CERT"); cim_client_key = getenv("CIM_CLIENT_KEY"); cc = cmciConnect2(cim_host, "https", "5989", cim_host_userid, cim_host_passwd, CMCI_VERIFY_PEER, cim_host_cert, cim_client_cert, cim_client_key, NULL); /* Test enumClassNames() */ printf("\n----------------------------------------------------------\n"); printf("Testing enumClassNames() ...\n"); objectpath = newCMPIObjectPath("root/cimv2", NULL, NULL); enumeration = cc->ft->enumClassNames(cc, objectpath, 0, &status); /* Print the results */ printf( "enumClassNames() rc=%d, msg=%s\n", status.rc, (status.msg)? (char *)status.msg->hdl : NULL); if (!status.rc) { printf("result(s):\n"); while (enumeration->ft->hasNext(enumeration, NULL)) { CMPIData data = enumeration->ft->getNext(enumeration, NULL); showObjectPath(data.value.ref); } } if (enumeration) CMRelease(enumeration); if (objectpath) CMRelease(objectpath); if (status.msg) CMRelease(status.msg); if (cc) CMRelease(cc); return 0; }
void sfcb_native_release_CMPIValue(CMPIType type, CMPIValue * val) { switch (type) { case CMPI_instance: CMRelease(val->inst); break; case CMPI_class: CMRelease(val->inst); break; case CMPI_qualifierDecl: CMRelease((CMPIQualifierDecl *) val->dataPtr.ptr); break; case CMPI_ref: CMRelease(val->ref); break; case CMPI_args: CMRelease(val->args); break; case CMPI_filter: CMRelease(val->filter); break; case CMPI_enumeration: CMRelease(val->Enum); break; case CMPI_string: CMRelease(val->string); break; case CMPI_chars: free(val->chars); break; case CMPI_dateTime: CMRelease(val->dateTime); break; default: if (type & CMPI_ARRAY) { CMRelease(val->array); } } }
static CMPIStatus ClassProviderCleanup(CMPIClassMI * mi, const 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); }
static int _testErrorPaths() { CMPIArgs *args_ptr = NULL; CMPIStatus rc = { CMPI_RC_OK, NULL }; CMPIValue value; char *str = NULL; value.inst = NULL; args_ptr = CMNewArgs(_broker, &rc); rc = CMAddArg(args_ptr, "EmptyInstance", (CMPIValue *) & value, CMPI_instance); value.ref = NULL; rc = CMAddArg(args_ptr, "EmptyRef", (CMPIValue *) & value, CMPI_ref); value.dateTime = NULL; rc = CMAddArg(args_ptr, "EmptyDatetime", (CMPIValue *) & value, CMPI_dateTime); rc = CMAddArg(args_ptr, "EmptyChars", (CMPIValue *) str, CMPI_chars); rc = CMAddArg(args_ptr, "EmptyCharsPtrA", NULL, CMPI_charsptrA); value.chars = NULL; rc = CMAddArg(args_ptr, "EmptyCharsPtr", &value, CMPI_charsptr); value.args = NULL; rc = CMAddArg(args_ptr, "EmptyArgs", (CMPIValue *) & value, CMPI_args); rc = CMRelease(args_ptr); return 1; }
void releaseClass(CMPIConstClass * cls, char *from, int id) { printf("### RELEASE %s %p %s %d\n", cls->ft->getCharClassName(cls), cls, from, id); CMRelease(cls); }
/** * call-seq: * instance.each_property do |name, value| * ... * end * * enumerates properties yielding the property name and * its value * */ static VALUE each_property(VALUE self) { CIMCInstance *ptr; CIMCStatus status; int k=0; int num_props=0; CIMCString *property_name = NULL; CIMCData data; Data_Get_Struct(self, CIMCInstance, ptr); num_props = ptr->ft->getPropertyCount(ptr, &status); if (!status.rc) { for (; k < num_props; ++k) { data = ptr->ft->getPropertyAt(ptr, k, &property_name, &status); if (!status.rc) { rb_yield_values(2, (property_name ? rb_str_intern(rb_str_new2(property_name->ft->getCharPtr(property_name, NULL))) : Qnil), sfcc_cimdata_to_value(data)); } else { sfcc_rb_raise_if_error(status, "Can't retrieve property #%d", k); } if (property_name) CMRelease(property_name); } } else { sfcc_rb_raise_if_error(status, "Can't retrieve property count"); } return Qnil; }
int args2xml(CMPIArgs * args, UtilStringBuffer * sb) { int i, m; _SFCB_ENTER(TRACE_CIMXMLPROC, "args2xml"); if (args == NULL) _SFCB_RETURN(0); m = CMGetArgCount(args, NULL); if (m == 0) _SFCB_RETURN(0); for (i = 0; i < m; i++) { CMPIString *name; CMPIData data; data = CMGetArgAt(args, i, &name, NULL); DATA2XML(&data, args, name, NULL, "<PARAMVALUE NAME=\"", "</PARAMVALUE>\n", sb, NULL, 1, 1); if ((data.type & (CMPI_ENC | CMPI_ARRAY)) && data.value.inst) { // don't get confused using generic release data.value.inst->ft->release(data.value.inst); } CMRelease(name); } _SFCB_RETURN(0); }
CMPIStatus cmpiPerf_TestClassProviderEnumInstanceNames( CMPIInstanceMI * mi, const CMPIContext * ctx, const CMPIResult * rslt, const CMPIObjectPath * ref) { CMPIObjectPath * op = NULL; CMPIStatus rc = {CMPI_RC_OK, NULL}; unsigned int index = 0; unsigned int numInst = 1; // // While the instance itself is hard code, the number of instances // is determined from an environment variable // numInst = getNumberOfInstances(); for (index=0; index < numInst; index++) { op = _makePath_TestClass( _broker, ctx, ref, index ); if (op == NULL) { return rc; } CMReturnObjectPath( rslt, op ); CMRelease( op ); } CMReturnDone( rslt ); return rc; }
static CMPIStatus mergeParents(ClassRegister * cr, ClClass * cl, char *p, CMPIConstClass * cc, ReadCtl * rctl) { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIConstClass *pcc = NULL; unsigned char originId = 0; char *np = NULL; ReadCtl ctl; if (cc) { if (p) originId = ClClassAddGrandParent(cl, p); cpyClass(cl, cc, originId); } if (p) { ctl = *rctl; pcc = getClass(cr, p, &ctl); if (pcc == NULL) { st.rc = CMPI_RC_ERR_INVALID_SUPERCLASS; return st; } np = (char *) pcc->ft->getCharSuperClassName(pcc); st = mergeParents(cr, cl, np, pcc, rctl); if (ctl != cached) CMRelease(pcc); } return st; }
int main() { CMCIClient *cc; CMPIObjectPath * objectpath; CMPIEnumeration * enumeration; CMPIStatus status; char *cim_host, *cim_host_passwd, *cim_host_userid; /* Setup a connection to the CIMOM */ cim_host = getenv("CIM_HOST"); if (cim_host == NULL) cim_host = "localhost"; cim_host_userid = getenv("CIM_HOST_USERID"); if (cim_host_userid == NULL) cim_host_userid = "root"; cim_host_passwd = getenv("CIM_HOST_PASSWD"); if (cim_host_passwd == NULL) cim_host_passwd = "password"; cc = cmciConnect(cim_host, NULL, "5988", cim_host_userid, cim_host_passwd, NULL); /* Test enumClasses() */ printf("\n----------------------------------------------------------\n"); printf("Testing enumClasses() ...\n"); objectpath = newCMPIObjectPath("root/cimv2", NULL, NULL); enumeration = cc->ft->enumClasses(cc, objectpath, CMPI_FLAG_DeepInheritance|CMPI_FLAG_IncludeQualifiers, &status); /* Print the results */ printf( "enumClasses() rc=%d, msg=%s\n", status.rc, (status.msg)? (char *)status.msg->hdl : NULL); if (!status.rc) { printf("result(s):\n"); while (enumeration->ft->hasNext(enumeration, NULL)) { CMPIData data = enumeration->ft->getNext(enumeration, NULL); showClass(data.value.cls); } } if (enumeration) CMRelease(enumeration); if (objectpath) CMRelease(objectpath); if (status.msg) CMRelease(status.msg); if (cc) CMRelease(cc); return 0; }
CMPIStatus InstProvCleanup ( CMPIInstanceMI * mi, const CMPIContext * ctx, CMPIBoolean term) { CMRelease(clone_arr_ptr); CMReturn (CMPI_RC_OK); }
/** Replace an existing Instance from inst, using object-path op as reference. */ CMPIStatus TestInstanceProviderModifyInstance ( CMPIInstanceMI * mi, const CMPIContext * ctx, const CMPIResult * rslt, const CMPIObjectPath * cop, const CMPIInstance * ci, const char **properties) { CMPIStatus rc = { CMPI_RC_OK, NULL }; CMPIInstance * inst; CMPIValue val1, val2; CMPIData key1, key2, retData1, retInst; CMPIObjectPath *obp; unsigned int j = 0, flag = 0; if(ci) { inst = CMClone(ci, &rc); /* get key from the object-path */ key1 = CMGetKey(cop, "Identifier", &rc); val1.uint8 = key1.value.uint8; /* get the value of Message property */ retData1 = CMGetProperty(inst, "Message", &rc); val2.string = retData1.value.string; for (j=0; j < numOfInst; j++) { /* check for validity of Instance, that its not deleted */ if (valid[j] == 1) { /* get element(instance) from array */ retInst = CMGetArrayElementAt(clone_arr_ptr, j, &rc); /* get object-path of instance */ obp = CMGetObjectPath(retInst.value.inst, &rc); /* get key from this object-path */ key2 = CMGetKey(obp, "Identifier", &rc); /*compare key values. If they match then set the properties received from client */ if(key1.value.uint8 == key2.value.uint8) { CMSetProperty( retInst.value.inst, "Message", &val2, CMPI_string); flag = 1; } } } CMRelease(inst); /*If match fails, throw exception, as instance to be mmodified is not found */ if(!flag) { CMReturn (CMPI_RC_ERR_NOT_FOUND); } } CMReturnDone (rslt); CMReturn (CMPI_RC_OK); }
static int _testCMPIEnumeration(const CMPIContext *ctx) { CMPIStatus rc = { CMPI_RC_OK, NULL }; CMPIEnumeration *enum_ptr = NULL; CMPIData data; unsigned int initCount = 0; CMPIObjectPath *objPath = NULL; CMPIArray *arr_ptr = NULL; CMPICount returnedArraySize; void *eptr; objPath = make_ObjectPath(_broker, _Namespace, _PersonClass); enum_ptr = CBEnumInstances(_broker, ctx, objPath, NULL, &rc); if (enum_ptr == NULL) { return 1; } arr_ptr = CMToArray(enum_ptr, &rc); if (arr_ptr == NULL) { return 1; } returnedArraySize = CMGetArrayCount(arr_ptr, &rc); while (CMHasNext(enum_ptr, &rc)) { data = CMGetNext(enum_ptr, &rc); if (data.type != CMPI_instance) { return 1; } initCount++; } eptr = enum_ptr->hdl; enum_ptr->hdl = NULL; CMToArray(enum_ptr, &rc); if (rc.rc != CMPI_RC_ERR_INVALID_HANDLE) { return 1; } CMGetNext(enum_ptr, &rc); if (rc.rc != CMPI_RC_ERR_INVALID_HANDLE) { return 1; } CMHasNext(enum_ptr, &rc); if (rc.rc != CMPI_RC_ERR_INVALID_HANDLE) { return 1; } enum_ptr->hdl = eptr; rc = CMRelease(enum_ptr); if (rc.rc != CMPI_RC_OK) { return 1; } return 0; }
CMPIStatus TestInstanceProviderCleanup ( CMPIInstanceMI * mi, const CMPIContext * ctx, CMPIBoolean term) { CMRelease(clone_arr_ptr); deleteThreads (); _broker->xft->destroyMutex (threadCntMutex); CMReturn (CMPI_RC_OK); }
/*! The function prepares a context for the MB listen thread and launches it. */ static void __launch_proxy_daemon() { CMPIContext *ctx = CBPrepareAttachThread(__init_broker, __init_context); if (!(__init_context && __init_broker)) { CMRelease(ctx); ctx = NULL; } CMPI_BrokerExt_Ftab->newThread((void*(*)(void*))__start_proxy_daemon,ctx,1); }
CMPIStatus TestCMPIBrokerInstanceProviderDeleteInstance (CMPIInstanceMI * mi, const CMPIContext * ctx, const CMPIResult * rslt, const CMPIObjectPath * cop) { PROV_LOG_OPEN (_ClassName, _ProviderLocation); PROV_LOG ("Inside Delete Instance"); PROV_LOG_CLOSE (); CMRelease (_inst); CMReturn (CMPI_RC_OK); }
// Helper function void __free_ind_object (ind_object *obj) { switch (obj->type) { case PEGASUS_INDICATION_OBJECT_TYPE_CMPI_SELECT_EXP : CMRelease ( (CMPISelectExp*)obj->ptr); break; case PEGASUS_INDICATION_OBJECT_TYPE_CMPI_SELECT_COND: CMRelease ( (CMPISelectCond*)obj->ptr); break; case PEGASUS_INDICATION_OBJECT_TYPE_CMPI_SUB_COND: CMRelease ( (CMPISubCond*)obj->ptr); break; case PEGASUS_INDICATION_OBJECT_TYPE_CMPI_PREDICATE: CMRelease ( (CMPIPredicate*)obj->ptr); break; default : TRACE_CRITICAL(("Unknown Object type: %d", obj->type )); } }
CMPIStatus deliverInd(const CMPIObjectPath * ref, const CMPIArgs * in, CMPIInstance * ind) { _SFCB_ENTER(TRACE_INDPROVIDER, "deliverInd"); CMPIInstance *hci, *sub; CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIString *dest; char strId[64]; ExpSegments xs; UtilStringBuffer *sb; static int id = 1; char *resp; char *msg; if ((hci = internalProviderGetInstance(ref, &st)) == NULL) { setStatus(&st, CMPI_RC_ERR_NOT_FOUND, NULL); _SFCB_RETURN(st); } dest = CMGetProperty(hci, "destination", NULL).value.string; _SFCB_TRACE(1, ("--- destination: %s\n", (char *) dest->hdl)); sub = CMGetArg(in, "subscription", NULL).value.inst; sprintf(strId, "%d", id++); xs = exportIndicationReq(ind, strId); sb = segments2stringBuffer(xs.segments); if (exportIndication ((char *) dest->hdl, (char *) sb->ft->getCharPtr(sb), &resp, &msg)) { setStatus(&st, CMPI_RC_ERR_FAILED, NULL); } RespSegment rs = xs.segments[5]; UtilStringBuffer *usb = (UtilStringBuffer *) rs.txt; CMRelease(usb); CMRelease(sb); if (resp) free(resp); if (msg) free(msg); _SFCB_RETURN(st); }
CMPIStatus TestInstanceProviderDeleteInstance ( CMPIInstanceMI * mi, const CMPIContext * ctx, const CMPIResult * result, const CMPIObjectPath * cop) { CMPIStatus rc = { CMPI_RC_OK, NULL }; CMPIData key1, key2, retInst; CMPIObjectPath *obp; unsigned int j = 0, flag = 0; /* get key from the object-path */ key1 = CMGetKey(cop, "Identifier", &rc); for (j=0; j < numOfInst ; j++) { /*check for validity of Instance, that its not deleted */ if(valid[j] == 1) { /*get element(instance) from array */ retInst = CMGetArrayElementAt(clone_arr_ptr, j, &rc); /*get object-path of instance */ obp = CMGetObjectPath(retInst.value.inst, &rc); /*get key from this object-path */ key2 = CMGetKey(obp, "Identifier" , &rc); /*compare key values. If they match, release the object(instance) Also set its validity to zero, marking it as deleted */ if (key1.value.uint8 == key2.value.uint8) { if(retInst.value.inst) { flag =1; CMRelease(retInst.value.inst); CMSetArrayElementAt( clone_arr_ptr, j, &retInst.value.inst, CMPI_null); valid[j] = 0; } } } } if(!flag) { CMReturn (CMPI_RC_ERR_NOT_FOUND); } CMReturn (CMPI_RC_OK); }
static CMPIStatus __eft_release ( CMPIEnumeration * enumeration ) { struct native_enum * e = (struct native_enum *) enumeration; CMPIStatus st; if (e) { st = CMRelease(e->data); free ( enumeration ); return st; } CMReturn ( CMPI_RC_ERR_FAILED ); }
static void pruneRCache(ClassRegister * cr) { ClassBase *cb = (ClassBase *) (cr + 1); ClassRecord *crec; while (cb->cachedRCount>rSize) { crec=cb->lastRCached; DEQ_FROM_LIST(crec,cb->firstRCached,cb->lastRCached,nextRCached,prevRCached); CMRelease(crec->cachedRCls); crec->cachedRCls=NULL; cb->cachedRCount--; } }
static void loopOnChildren(ClassRegister *cReg, char *cn, CMPIResult * rslt) { UtilList *ul = getChildren(cReg,cn); char *child; void *cid; if (ul) for (child = (char *) ul->ft->getFirst(ul); child; child = (char *) ul->ft->getNext(ul)) { CMPIConstClass *cl = getClass(cReg,child,&cid); CMReturnInstance(rslt, (CMPIInstance *) cl); if (cid==NULL) CMRelease(cl); loopOnChildren(cReg,child,rslt); } }
static void loopOnChildren(ClassRegister *cReg, char *cn, CMPIResult * rslt) { UtilList *ul = getChildren(cReg,cn); char *child; ReadCtl ctl; if (ul) for (child = (char *) ul->ft->getFirst(ul); child; child = (char *) ul->ft->getNext(ul)) { ctl=tempRead; CMPIConstClass *cl = getResolvedClass(cReg,child,NULL, &ctl); CMReturnInstance(rslt, (CMPIInstance *) cl); if (ctl!=cached) CMRelease(cl); loopOnChildren(cReg,child,rslt); } }
void native_release_CMPIValue ( CMPIType type, CMPIValue * val ) { switch (type) { case CMPI_instance: CMRelease ( val->inst ); break; case CMPI_ref: CMRelease ( val->ref ); break; case CMPI_args: CMRelease ( val->args ); break; case CMPI_filter: CMRelease ( val->filter ); break; case CMPI_enumeration: CMRelease ( val->Enum ); break; case CMPI_string: CMRelease ( val->string ); break; case CMPI_chars: tool_mm_add ( val->chars ); break; case CMPI_dateTime: CMRelease ( val->dateTime ); break; case CMPI_charsptr: free (val->dataPtr.ptr); break; default: if (type & CMPI_ARRAY) { CMRelease ( val->array ); } } }
static CMPIStatus ClassProviderGetClass(CMPIClassMI * mi, const CMPIContext *ctx, const CMPIResult *rslt, const CMPIObjectPath * ref, const char **properties) { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIString *cn = CMGetClassName(ref, NULL); CMPIConstClass *cl, *clLocal; ClassRegister *cReg; int rc; ReadCtl ctl; _SFCB_ENTER(TRACE_PROVIDERS, "ClassProviderGetClass"); _SFCB_TRACE(1, ("--- ClassName=\"%s\"", (char *) cn->hdl)); cReg = getNsReg(ref, &rc); if (cReg == NULL) { CMPIStatus st = { CMPI_RC_ERR_INVALID_NAMESPACE, NULL }; _SFCB_RETURN(st); } cReg->ft->wLock(cReg); ctl = stdRead; clLocal = getResolvedClass(cReg, (char *) cn->hdl, NULL, &ctl); if (clLocal) { /* * Make a cloned copy of the cached results to prevent thread * interference. */ _SFCB_TRACE(1, ("--- Class found")); cl = clLocal->ft->clone(clLocal, NULL); memLinkInstance((CMPIInstance *) cl); CMReturnInstance(rslt, (CMPIInstance *) cl); if (ctl != cached) CMRelease(cl); } else { _SFCB_TRACE(1, ("--- Class not found")); st.rc = CMPI_RC_ERR_NOT_FOUND; } cReg->ft->wUnLock(cReg); _SFCB_RETURN(st); }