1 #include "pdr.hpp" 2 3 #include "pdr_state_effecter.hpp" 4 5 namespace pldm 6 { 7 8 namespace responder 9 { 10 11 namespace pdr 12 { 13 using namespace pldm::responder::pdr_utils; 14 15 void getRepoByType(const Repo& inRepo, Repo& outRepo, Type pdrType) 16 { 17 uint8_t* pdrData = nullptr; 18 uint32_t pdrSize{}; 19 auto record = pldm_pdr_find_record_by_type(inRepo.getPdr(), pdrType, NULL, 20 &pdrData, &pdrSize); 21 while (record) 22 { 23 PdrEntry pdrEntry{}; 24 pdrEntry.data = pdrData; 25 pdrEntry.size = pdrSize; 26 pdrEntry.handle.recordHandle = inRepo.getRecordHandle(record); 27 outRepo.addRecord(pdrEntry); 28 29 pdrData = nullptr; 30 pdrSize = 0; 31 record = pldm_pdr_find_record_by_type(inRepo.getPdr(), pdrType, record, 32 &pdrData, &pdrSize); 33 } 34 } 35 36 const pldm_pdr_record* getRecordByHandle(const RepoInterface& pdrRepo, 37 RecordHandle recordHandle, 38 PdrEntry& pdrEntry) 39 { 40 uint8_t* pdrData = nullptr; 41 auto record = 42 pldm_pdr_find_record(pdrRepo.getPdr(), recordHandle, &pdrData, 43 &pdrEntry.size, &pdrEntry.handle.nextRecordHandle); 44 if (record) 45 { 46 pdrEntry.data = pdrData; 47 } 48 49 return record; 50 } 51 52 } // namespace pdr 53 } // namespace responder 54 } // namespace pldm 55