xref: /openbmc/openpower-vpd-parser/types.hpp (revision 414d5aef4abee12e24547b8528745d159321f4ba)
1 #pragma once
2 
3 #include <climits>
4 #include <map>
5 #include <sdbusplus/server.hpp>
6 #include <string>
7 #include <unordered_map>
8 #include <vector>
9 
10 namespace openpower
11 {
12 namespace vpd
13 {
14 
15 /** @brief The OpenPOWER VPD, in binary, is specified as a
16  *         sequence of characters */
17 static_assert((8 == CHAR_BIT), "A byte is not 8 bits!");
18 using Byte = uint8_t;
19 using Binary = std::vector<Byte>;
20 
21 namespace inventory
22 {
23 
24 using Path = std::string;
25 using Property = std::string;
26 using Value = std::variant<bool, int64_t, std::string, Binary>;
27 using PropertyMap = std::map<Property, Value>;
28 
29 using Interface = std::string;
30 using InterfaceMap = std::map<Interface, PropertyMap>;
31 
32 using Object = sdbusplus::message::object_path;
33 using ObjectMap = std::map<Object, InterfaceMap>;
34 
35 using VPDfilepath = std::string;
36 using FruIsMotherboard = bool;
37 using FrusMap = std::multimap<Path, std::pair<VPDfilepath, FruIsMotherboard>>;
38 using LocationCode = std::string;
39 using LocationCodeMap = std::unordered_multimap<LocationCode, Path>;
40 using ListOfPaths = std::vector<sdbusplus::message::object_path>;
41 using NodeNumber = uint16_t;
42 using namespace std::string_literals;
43 using KeywordVpdMap = std::unordered_map<std::string, Binary>;
44 
45 using systemType = std::string;
46 using deviceTree = std::string;
47 using deviceTreeMap = std::unordered_map<systemType, deviceTree>;
48 using PelAdditionalData = std::map<std::string, std::string>;
49 using Keyword = std::string;
50 using KeywordData = std::string;
51 using DbusPropertyMap = std::unordered_map<Keyword, KeywordData>;
52 using PelAdditionalData = std::map<std::string, std::string>;
53 using Service = std::string;
54 using MapperResponse =
55     std::map<Path, std::map<Service, std::vector<Interface>>>;
56 using RestoredEeproms = std::tuple<Path, std::string, Keyword, Binary>;
57 using ReplaceableFrus = std::vector<VPDfilepath>;
58 } // namespace inventory
59 
60 } // namespace vpd
61 } // namespace openpower
62