CMPIStatus IndCIMXMLHandlerGetInstance(CMPIInstanceMI * mi, const CMPIContext *ctx, const CMPIResult *rslt, const CMPIObjectPath * cop, const char **properties) { CMPIStatus st; CMPIInstance* ci; const char** keyList; _SFCB_ENTER(TRACE_INDPROVIDER, "IndCIMXMLHandlerGetInstance"); ci = internalProviderGetInstance(cop, &st); if (st.rc == CMPI_RC_OK) { if (isa("root/interop", CMGetCharPtr(CMGetClassName(cop,NULL)), "cim_indicationhandler")) { filterInternalProps(ci); } if (properties) { keyList = getKeyList(ci->ft->getObjectPath(ci, NULL)); ci->ft->setPropertyFilter(ci, properties, keyList); if (keyList) { free(keyList); } } CMReturnInstance(rslt, ci); } _SFCB_RETURN(st); }
CMPIStatus InternalProviderGetInstance(CMPIInstanceMI * mi, const CMPIContext *ctx, const CMPIResult *rslt, const CMPIObjectPath * cop, const char **properties) { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIInstance *ci; const char **keyList; _SFCB_ENTER(TRACE_INTERNALPROVIDER, "InternalProviderGetInstance"); ci = internalProviderGetInstance(cop, &st); if (st.rc == CMPI_RC_OK && properties) { keyList = getKeyList(ci->ft->getObjectPath(ci, NULL)); ci->ft->setPropertyFilter(ci, properties, keyList); if (keyList) { free(keyList); } } if (st.rc == CMPI_RC_OK) { CMReturnInstance(rslt, ci); } _SFCB_RETURN(st); }
int Rule::Eliminate() /** This rule eliminates any unnecessary rules. \todo Currently does not work since removeItem changes the top rule (so should this) @return number of items eliminated */ { std::map<int, int> Base; // map of key names + test value (initially 1) std::vector<int> baseVal; std::vector<int> baseKeys; std::vector<int> deadKeys; // collect base keys and populate the cells getKeyList(baseKeys); std::vector<int>::const_iterator xv; for (xv = baseKeys.begin(); xv != baseKeys.end(); ++xv) { baseVal.push_back(0); Base[(*xv)] = 1; } // For each key :: check if the Rule is equal for both cases 0 + 1 // then loop through all combinations of the map to determine validity // This function is not optimised since the tree can be trimmed // if the test item is not in a branch. for (unsigned int TKey = 0; TKey < baseKeys.size(); TKey++) { // INITIALISE STUFF int valueTrue(1), valueFalse(1); int keyChange = 0; int targetKey = baseKeys[TKey]; for (unsigned int i = 0; i < baseVal.size(); i++) { baseVal[i] = 0; Base[baseKeys[i]] = 0; } // CHECK EACH KEY IN TURN while (valueTrue == valueFalse || keyChange >= 0) { // Zero value Base[baseKeys[targetKey]] = 0; valueFalse = isValid(Base); // True value Base[baseKeys[targetKey]] = 1; valueTrue = isValid(Base); // Put everything back if (valueTrue == valueFalse) { keyChange = addToKey(baseVal, TKey); // note pass index not key for (int ic = 0; ic < keyChange; ic++) Base[baseKeys[ic]] = baseVal[ic]; } } if (keyChange < 0) // Success !!!!! deadKeys.push_back(targetKey); } return static_cast<int>(deadKeys.size()); }
void InitKey(mpz_t LKey[6]) { for(int i = 0; i < 6; i++) { mpz_init(LKey[i]); } for(int i = 0; i < 3; i++) { mpz_init(KPub[i]); } getKeyList(LKey); getPubKey(KPub, LKey); }
CMPIStatus InternalProviderModifyInstance(CMPIInstanceMI * mi, const CMPIContext *ctx, const CMPIResult *rslt, const CMPIObjectPath * cop, const CMPIInstance *ci, const char **properties) { CMPIStatus st = { CMPI_RC_OK, NULL }; unsigned long len; void *blob; CMPIString *cn = CMGetClassName(cop, NULL); CMPIString *ns = CMGetNameSpace(cop, NULL); char *key = normalizeObjectPathCharsDup(cop); const char *nss = ns->ft->getCharPtr(ns, NULL); const char *cns = cn->ft->getCharPtr(cn, NULL); const char *bnss = repositoryNs(nss); const char **keyList; _SFCB_ENTER(TRACE_INTERNALPROVIDER, "InternalProviderSetInstance"); if (testNameSpace(bnss, &st) == 0) { free(key); _SFCB_RETURN(st); } if (existingBlob(bnss, cns, key) == 0) { CMPIStatus st = { CMPI_RC_ERR_NOT_FOUND, NULL }; free(key); _SFCB_RETURN(st); } if (properties) { keyList = getKeyList(ci->ft->getObjectPath(ci, NULL)); ci->ft->setPropertyFilter((CMPIInstance *) ci, properties, keyList); if (keyList) { free(keyList); } } len = getInstanceSerializedSize(ci); blob = malloc(len + 64); getSerializedInstance(ci, blob); addBlob(bnss, cns, key, blob, (int) len); free(blob); free(key); _SFCB_RETURN(st); }
static CMPIStatus enumInstances(CMPIInstanceMI * mi, const CMPIContext *ctx, void *rslt, const CMPIObjectPath * ref, const char **properties, void (*retFnc) (void *, CMPIInstance *), int ignprov) { CMPIStatus st = { CMPI_RC_OK, NULL }; CMPIStatus sti = { CMPI_RC_OK, NULL }; BlobIndex *bi; CMPIString *cn = CMGetClassName(ref, NULL); CMPIString *ns = CMGetNameSpace(ref, NULL); const char *nss = ns->ft->getCharPtr(ns, NULL); const char *cns = cn->ft->getCharPtr(cn, NULL); const char *bnss = repositoryNs(nss); int len, i, ac = 0; CMPIInstance *ci; CMPIArgs *in, *out; CMPIObjectPath *op; CMPIArray *ar; CMPIData rv; const char **keyList; _SFCB_ENTER(TRACE_INTERNALPROVIDER, "enumInstances"); _SFCB_TRACE(1, ("--- %s %s", nss, cns)); in = CMNewArgs(Broker, NULL); out = CMNewArgs(Broker, NULL); if (ignprov) CMAddArg(in, "classignoreprov", cns, CMPI_chars); else CMAddArg(in, "class", cns, CMPI_chars); op = CMNewObjectPath(Broker, bnss, "$ClassProvider$", &sti); _SFCB_TRACE(1, ("--- getallchildren")); rv = CBInvokeMethod(Broker, ctx, op, "getallchildren", in, out, &sti); _SFCB_TRACE(1, ("--- getallchildren rc: %d", sti.rc)); ar = CMGetArg(out, "children", NULL).value.array; if (ar) ac = CMGetArrayCount(ar, NULL); _SFCB_TRACE(1, ("--- getallchildren ar: %p count: %d", ar, ac)); for (i = 0; cns; i++) { _SFCB_TRACE(1, ("--- looking for %s", cns)); if ((bi = _getIndex(bnss, cns)) != NULL) { for (ci = ipGetFirst(bi, &len, NULL, 0); ci; ci = ipGetNext(bi, &len, NULL, 0)) { if (properties) { keyList = getKeyList(ci->ft->getObjectPath(ci, NULL)); ci->ft->setPropertyFilter(ci, properties, keyList); if (keyList) { free(keyList); } } _SFCB_TRACE(1, ("--- returning instance %p", ci)); retFnc(rslt, ci); } } freeBlobIndex(&bi, 1); if (i < ac) cns = (char *) CMGetArrayElementAt(ar, i, NULL).value.string->hdl; else cns = NULL; } _SFCB_RETURN(st); }