xref: /openbmc/openpower-vpd-parser/types.hpp (revision 3ab26a74c68da014af3860c7c070b617d6195bd7)
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, size_t, int64_t, std::string, Binary>;
27 using PropertyMap = std::map<Property, Value>;
28 using kwdVpdValueTypes = std::variant<size_t, Binary>;
29 
30 using Interface = std::string;
31 using InterfaceMap = std::map<Interface, PropertyMap>;
32 
33 using Object = sdbusplus::message::object_path;
34 using ObjectMap = std::map<Object, InterfaceMap>;
35 
36 using VPDfilepath = std::string;
37 using FruIsMotherboard = bool;
38 using FrusMap = std::multimap<Path, std::pair<VPDfilepath, FruIsMotherboard>>;
39 using LocationCode = std::string;
40 using LocationCodeMap = std::unordered_multimap<LocationCode, Path>;
41 using ListOfPaths = std::vector<sdbusplus::message::object_path>;
42 using NodeNumber = uint16_t;
43 using namespace std::string_literals;
44 using KeywordVpdMap = std::unordered_map<std::string, kwdVpdValueTypes>;
45 
46 using systemType = std::string;
47 using deviceTree = std::string;
48 using deviceTreeMap = std::unordered_map<systemType, deviceTree>;
49 using PelAdditionalData = std::map<std::string, std::string>;
50 using Keyword = std::string;
51 using KeywordData = std::string;
52 using DbusPropertyMap = std::unordered_map<Keyword, KeywordData>;
53 using PelAdditionalData = std::map<std::string, std::string>;
54 using Service = std::string;
55 using MapperResponse =
56     std::map<Path, std::map<Service, std::vector<Interface>>>;
57 using RestoredEeproms = std::tuple<Path, std::string, Keyword, Binary>;
58 using ReplaceableFrus = std::vector<VPDfilepath>;
59 } // namespace inventory
60 
61 } // namespace vpd
62 } // namespace openpower