1 #pragma once 2 3 #include <stdint.h> 4 5 #include <sdbusplus/message/types.hpp> 6 7 #include <bitset> 8 #include <map> 9 #include <set> 10 #include <string> 11 #include <unordered_map> 12 #include <variant> 13 #include <vector> 14 15 namespace pldm 16 { 17 18 using eid = uint8_t; 19 using UUID = std::string; 20 using Request = std::vector<uint8_t>; 21 using Response = std::vector<uint8_t>; 22 using Command = uint8_t; 23 24 using MctpMedium = std::string; 25 using NetworkId = uint32_t; 26 using MctpInfo = std::tuple<eid, UUID, MctpMedium, NetworkId>; 27 using MctpInfos = std::vector<MctpInfo>; 28 29 namespace dbus 30 { 31 32 using ObjectPath = std::string; 33 using Service = std::string; 34 using Interface = std::string; 35 using Interfaces = std::vector<std::string>; 36 using Property = std::string; 37 using PropertyType = std::string; 38 using Value = 39 std::variant<bool, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, 40 uint64_t, double, std::string, std::vector<uint8_t>>; 41 42 using PropertyMap = std::map<Property, Value>; 43 using InterfaceMap = std::map<Interface, PropertyMap>; 44 using ObjectValueTree = std::map<sdbusplus::message::object_path, InterfaceMap>; 45 46 } // namespace dbus 47 48 namespace fw_update 49 { 50 51 // Descriptor definition 52 using DescriptorType = uint16_t; 53 using DescriptorData = std::vector<uint8_t>; 54 using VendorDefinedDescriptorTitle = std::string; 55 using VendorDefinedDescriptorData = std::vector<uint8_t>; 56 using VendorDefinedDescriptorInfo = 57 std::tuple<VendorDefinedDescriptorTitle, VendorDefinedDescriptorData>; 58 using Descriptors = 59 std::map<DescriptorType, 60 std::variant<DescriptorData, VendorDefinedDescriptorInfo>>; 61 62 using DescriptorMap = std::unordered_map<eid, Descriptors>; 63 64 // Component information 65 using CompClassification = uint16_t; 66 using CompIdentifier = uint16_t; 67 using CompKey = std::pair<CompClassification, CompIdentifier>; 68 using CompClassificationIndex = uint8_t; 69 using ComponentInfo = std::map<CompKey, CompClassificationIndex>; 70 using ComponentInfoMap = std::unordered_map<eid, ComponentInfo>; 71 72 // PackageHeaderInformation 73 using PackageHeaderSize = size_t; 74 using PackageVersion = std::string; 75 using ComponentBitmapBitLength = uint16_t; 76 using PackageHeaderChecksum = uint32_t; 77 78 // FirmwareDeviceIDRecords 79 using DeviceIDRecordCount = uint8_t; 80 using DeviceUpdateOptionFlags = std::bitset<32>; 81 using ApplicableComponents = std::vector<size_t>; 82 using ComponentImageSetVersion = std::string; 83 using FirmwareDevicePackageData = std::vector<uint8_t>; 84 using FirmwareDeviceIDRecord = 85 std::tuple<DeviceUpdateOptionFlags, ApplicableComponents, 86 ComponentImageSetVersion, Descriptors, 87 FirmwareDevicePackageData>; 88 using FirmwareDeviceIDRecords = std::vector<FirmwareDeviceIDRecord>; 89 90 // ComponentImageInformation 91 using ComponentImageCount = uint16_t; 92 using CompComparisonStamp = uint32_t; 93 using CompOptions = std::bitset<16>; 94 using ReqCompActivationMethod = std::bitset<16>; 95 using CompLocationOffset = uint32_t; 96 using CompSize = uint32_t; 97 using CompVersion = std::string; 98 using ComponentImageInfo = 99 std::tuple<CompClassification, CompIdentifier, CompComparisonStamp, 100 CompOptions, ReqCompActivationMethod, CompLocationOffset, 101 CompSize, CompVersion>; 102 using ComponentImageInfos = std::vector<ComponentImageInfo>; 103 104 enum class ComponentImageInfoPos : size_t 105 { 106 CompClassificationPos = 0, 107 CompIdentifierPos = 1, 108 CompComparisonStampPos = 2, 109 CompOptionsPos = 3, 110 ReqCompActivationMethodPos = 4, 111 CompLocationOffsetPos = 5, 112 CompSizePos = 6, 113 CompVersionPos = 7, 114 }; 115 116 } // namespace fw_update 117 118 namespace pdr 119 { 120 121 using EID = uint8_t; 122 using TerminusHandle = uint16_t; 123 using TerminusID = uint8_t; 124 using SensorID = uint16_t; 125 using EntityType = uint16_t; 126 using EntityInstance = uint16_t; 127 using ContainerID = uint16_t; 128 using StateSetId = uint16_t; 129 using CompositeCount = uint8_t; 130 using SensorOffset = uint8_t; 131 using EventState = uint8_t; 132 using TerminusValidity = uint8_t; 133 134 //!< Subset of the State Set that is supported by a effecter/sensor 135 using PossibleStates = std::set<uint8_t>; 136 //!< Subset of the State Set that is supported by each effecter/sensor in a 137 //!< composite efffecter/sensor 138 using CompositeSensorStates = std::vector<PossibleStates>; 139 using EntityInfo = std::tuple<ContainerID, EntityType, EntityInstance>; 140 using SensorInfo = 141 std::tuple<EntityInfo, CompositeSensorStates, std::vector<StateSetId>>; 142 143 } // namespace pdr 144 145 } // namespace pldm 146