vector<LpmSet> LpmConfigurationReaderV1::readLpmSets(void) { vector<LpmSet> lpmSets; vector<LpmEntry> lpmEntries; // // Since this configuration does not have the numLpmEntries we loop through // till we fail to read. We handle it in the catch block. // UIntN lpmSetIndex; try { for (lpmSetIndex = LpmEntriesIndexLimit::MinLpmSetIndex; ; lpmSetIndex++) { setLpmSetsKeyPath(lpmSetIndex); lpmEntries = readLpmEntries(); if (lpmEntries.empty()) { // No more LPM entries to process. throw dptf_exception("No more LPM entries"); } lpmSets.push_back(LpmSet(lpmSetIndex, lpmEntries)); if (lpmSetIndex >= LpmEntriesIndexLimit::MaxLpmSetIndex) { throw dptf_exception("Number of LPM sets exceeded max value"); } } } catch (dptf_exception& e) { string msg = e.what(); postInfoMessage(PolicyMessage(FLF, "Error msg (" + msg + "). Last lpmSetIndex = " + to_string(lpmSetIndex), Constants::Invalid)); return lpmSets; } // Will come here only if there are no entries/lpmsets. return lpmSets; }
vector<AppSpecificEntry> LpmConfigurationReaderV0::readAppSpecificEntries(void) { m_lpmSets.clear(); vector<AppSpecificEntry> appSpecificEntries; UIntN entryIndex = 0; try { string key = "NumAppSpecificEntries"; UIntN numEntries = getPolicyServices().platformConfigurationData->readConfigurationUInt32( root() + key); if (numEntries == 0) { throw dptf_exception("No app specific entries for v0"); } for (entryIndex = 0; entryIndex < numEntries; entryIndex++) { vector<string> appNames = readAppNames(entryIndex); vector<LpmEntry> lpmEntries = readLpmEntries(); appSpecificEntries.push_back(AppSpecificEntry(appNames, entryIndex)); m_lpmSets.push_back(LpmSet(entryIndex, lpmEntries)); } } catch (dptf_exception& e) { string msg = e.what(); m_policyServices.messageLogging->writeMessageDebug(PolicyMessage(FLF, "Error msg (" + msg + "). Last entryIndex = " + to_string(entryIndex), Constants::Invalid)); } return appSpecificEntries; }