Patrick Venture | ab65000 | 2019-03-16 09:08:47 -0700 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Patrick Venture | 3fb7429 | 2019-03-16 11:32:16 -0700 | [diff] [blame] | 3 | #include <cstdint> |
Patrick Venture | ab65000 | 2019-03-16 09:08:47 -0700 | [diff] [blame] | 4 | #include <nlohmann/json.hpp> |
| 5 | #include <string> |
Patrick Venture | 3fb7429 | 2019-03-16 11:32:16 -0700 | [diff] [blame] | 6 | #include <tuple> |
| 7 | #include <vector> |
Patrick Venture | ab65000 | 2019-03-16 09:08:47 -0700 | [diff] [blame] | 8 | |
| 9 | namespace google |
| 10 | { |
| 11 | namespace ipmi |
| 12 | { |
| 13 | |
| 14 | /** |
| 15 | * Parse a file and return the json object. |
| 16 | * |
| 17 | * @param[in] file - the path to the file to parse. |
| 18 | * @return the json object if valid. |
| 19 | * @throw elog<InternalFailure> on failures. |
| 20 | */ |
| 21 | nlohmann::json parseConfig(const std::string& file); |
| 22 | |
Patrick Venture | 8d5c9ce | 2019-03-16 11:20:12 -0700 | [diff] [blame] | 23 | /** |
| 24 | * Read a dts property file and return the contents. |
| 25 | * |
| 26 | * @param[in] file - the path to the file to parse. |
| 27 | * @return the property value or an empty string on failure. |
| 28 | */ |
| 29 | std::string readPropertyFile(const std::string& fileName); |
| 30 | |
Patrick Venture | 3fb7429 | 2019-03-16 11:32:16 -0700 | [diff] [blame] | 31 | /** |
| 32 | * Build a map of the i2c bus numbers to their PCIe slot names. |
| 33 | * |
| 34 | * @return list of pairs of i2c bus with their corresponding slot names. |
| 35 | */ |
| 36 | std::vector<std::tuple<std::uint32_t, std::string>> buildPcieMap(); |
| 37 | |
Patrick Venture | ab65000 | 2019-03-16 09:08:47 -0700 | [diff] [blame] | 38 | } // namespace ipmi |
| 39 | } // namespace google |