/* **************************************************************************** * * equalEntityIdVector - * */ static bool equalEntityIdVector(EntityIdVector enExpectedV, EntityIdVector enArgV) { /* Check vector size */ if (enExpectedV.size() != enArgV.size()) { LM_M(("different sizes: expected %d, actual %d", enExpectedV.size(), enArgV.size())); return false; } /* Check that every entity in 'enArgV' is in 'enExpectedV'. Order doesn't matter */ for (unsigned int ix = 0; ix < enArgV.size(); ++ix) { bool entityMatch = false; for (unsigned int jx = 0; jx < enExpectedV.size(); ++jx) { EntityId enArg = *enArgV.get(ix); EntityId enExpected = *enExpectedV.get(jx); LM_M(("%d == %d?", ix, jx)); if (equalEntity(enExpected, enArg)) { LM_M(("entity matches in EntityIdVector comparison, check next one...")); entityMatch = true; break; /* loop in jx */ } } if (!entityMatch) { LM_M(("after looking everyone, entity doesn't match in EntityIdVector")); return false; } } LM_M(("EntityIdVector comparison ok")); return true; }
/* **************************************************************************** * * processGenericEntities - * * If the request included some "generic" entity, some additional CPr could be needed in the CER array. There are * three cases of "generic" entities: 1) not pattern + null type, 2) pattern + not null type, 3) pattern + null type * * The limitReached parameter is to prevent the addition of new entities, which is needed in the case of the pagination * limit has been reached with local entities. * */ void processGenericEntities(EntityIdVector& enV, ContextElementResponseVector& cerV, ContextRegistrationResponseVector& crrV, bool limitReached) { for (unsigned int ix = 0; ix < enV.size(); ++ix) { EntityId* enP = enV.get(ix); if (enP->type == "" || isTrue(enP->isPattern)) { addContextProviders(cerV, crrV, limitReached, enP); } } }