Patrick Venture | f085d91 | 2019-03-15 08:50:00 -0700 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include <cstdint> |
Patrick Venture | ab65000 | 2019-03-16 09:08:47 -0700 | [diff] [blame] | 4 | #include <map> |
Patrick Venture | f085d91 | 2019-03-15 08:50:00 -0700 | [diff] [blame] | 5 | #include <string> |
| 6 | #include <tuple> |
Patrick Venture | 49f23ad | 2019-03-16 11:59:55 -0700 | [diff] [blame] | 7 | #include <vector> |
Patrick Venture | f085d91 | 2019-03-15 08:50:00 -0700 | [diff] [blame] | 8 | |
| 9 | namespace google |
| 10 | { |
| 11 | namespace ipmi |
| 12 | { |
| 13 | |
Patrick Venture | bb90d4f | 2019-03-15 13:42:06 -0700 | [diff] [blame] | 14 | using VersionTuple = |
| 15 | std::tuple<std::uint8_t, std::uint8_t, std::uint8_t, std::uint8_t>; |
| 16 | |
Patrick Venture | f085d91 | 2019-03-15 08:50:00 -0700 | [diff] [blame] | 17 | class HandlerInterface |
| 18 | { |
| 19 | public: |
| 20 | virtual ~HandlerInterface() = default; |
| 21 | |
| 22 | /** |
| 23 | * Return ethernet details (hard-coded). |
| 24 | * |
| 25 | * @return tuple of ethernet details (channel, if name). |
| 26 | */ |
| 27 | virtual std::tuple<std::uint8_t, std::string> getEthDetails() const = 0; |
Patrick Venture | d2037c6 | 2019-03-15 10:29:47 -0700 | [diff] [blame] | 28 | |
| 29 | /** |
| 30 | * Return the value of rx_packets, given a if_name. |
| 31 | * |
| 32 | * @param[in] name, the interface name. |
| 33 | * @return the number of packets received. |
| 34 | * @throw IpmiException on failure. |
| 35 | */ |
| 36 | virtual std::int64_t getRxPackets(const std::string& name) const = 0; |
Patrick Venture | bb90d4f | 2019-03-15 13:42:06 -0700 | [diff] [blame] | 37 | |
| 38 | /** |
| 39 | * Return the values from a cpld version file. |
| 40 | * |
| 41 | * @param[in] id - the cpld id number. |
| 42 | * @return the quad of numbers as a tuple (maj,min,pt,subpt) |
| 43 | * @throw IpmiException on failure. |
| 44 | */ |
| 45 | virtual VersionTuple getCpldVersion(unsigned int id) const = 0; |
Patrick Venture | aa37412 | 2019-03-15 15:09:10 -0700 | [diff] [blame] | 46 | |
| 47 | /** |
| 48 | * Set the PSU Reset delay. |
| 49 | * |
| 50 | * @param[in] delay - delay in seconds. |
| 51 | * @throw IpmiException on failure. |
| 52 | */ |
| 53 | virtual void psuResetDelay(std::uint32_t delay) const = 0; |
Patrick Venture | 07f8515 | 2019-03-15 21:36:56 -0700 | [diff] [blame] | 54 | |
| 55 | /** |
| 56 | * Return the entity name. |
| 57 | * On the first call to this method it'll build the list of entities. |
| 58 | * @todo Consider moving the list building to construction time (and ignore |
| 59 | * failures). |
| 60 | * |
| 61 | * @param[in] id - the entity id value |
| 62 | * @param[in] instance - the entity instance |
| 63 | * @return the entity's name |
| 64 | * @throw IpmiException on failure. |
| 65 | */ |
| 66 | virtual std::string getEntityName(std::uint8_t id, |
| 67 | std::uint8_t instance) = 0; |
Patrick Venture | 49f23ad | 2019-03-16 11:59:55 -0700 | [diff] [blame] | 68 | |
| 69 | /** |
| 70 | * Populate the i2c-pcie mapping vector. |
| 71 | */ |
| 72 | virtual void buildI2cPcieMapping() = 0; |
| 73 | |
| 74 | /** |
| 75 | * Return the size of the i2c-pcie mapping vector. |
| 76 | * |
| 77 | * @return the size of the vector holding the i2c-pcie mapping tuples. |
| 78 | */ |
| 79 | virtual size_t getI2cPcieMappingSize() const = 0; |
| 80 | |
| 81 | /** |
| 82 | * Return a copy of the entry in the vector. |
| 83 | * |
| 84 | * @param[in] entry - the index into the vector. |
| 85 | * @return the tuple at that index. |
| 86 | */ |
| 87 | virtual std::tuple<std::uint32_t, std::string> |
| 88 | getI2cEntry(unsigned int entry) const = 0; |
Patrick Venture | f085d91 | 2019-03-15 08:50:00 -0700 | [diff] [blame] | 89 | }; |
| 90 | |
Patrick Venture | f085d91 | 2019-03-15 08:50:00 -0700 | [diff] [blame] | 91 | } // namespace ipmi |
| 92 | } // namespace google |