blob: 83e0b131aebcfaa9a72106bffa65bfb3e0f649a8 [file] [log] [blame]
Willy Tua2056e92021-10-10 13:36:16 -07001// Copyright 2021 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
Patrick Ventureab650002019-03-16 09:08:47 -070015#pragma once
16
17#include <nlohmann/json.hpp>
Patrick Williams444b5ea2023-05-19 13:56:42 -050018
19#include <cstdint>
Patrick Ventureab650002019-03-16 09:08:47 -070020#include <string>
Patrick Venture3fb74292019-03-16 11:32:16 -070021#include <tuple>
22#include <vector>
Patrick Ventureab650002019-03-16 09:08:47 -070023
24namespace google
25{
26namespace ipmi
27{
28
29/**
30 * Parse a file and return the json object.
31 *
32 * @param[in] file - the path to the file to parse.
33 * @return the json object if valid.
34 * @throw elog<InternalFailure> on failures.
35 */
36nlohmann::json parseConfig(const std::string& file);
37
Patrick Venture8d5c9ce2019-03-16 11:20:12 -070038/**
39 * Read a dts property file and return the contents.
40 *
41 * @param[in] file - the path to the file to parse.
42 * @return the property value or an empty string on failure.
43 */
44std::string readPropertyFile(const std::string& fileName);
45
Patrick Venture3fb74292019-03-16 11:32:16 -070046/**
47 * Build a map of the i2c bus numbers to their PCIe slot names.
48 *
49 * @return list of pairs of i2c bus with their corresponding slot names.
50 */
51std::vector<std::tuple<std::uint32_t, std::string>> buildPcieMap();
52
Patrick Ventureab650002019-03-16 09:08:47 -070053} // namespace ipmi
54} // namespace google