Patrick Venture | f085d91 | 2019-03-15 08:50:00 -0700 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include <cstdint> |
| 4 | #include <string> |
| 5 | #include <tuple> |
| 6 | |
| 7 | namespace google |
| 8 | { |
| 9 | namespace ipmi |
| 10 | { |
| 11 | |
| 12 | class HandlerInterface |
| 13 | { |
| 14 | public: |
| 15 | virtual ~HandlerInterface() = default; |
| 16 | |
| 17 | /** |
| 18 | * Return ethernet details (hard-coded). |
| 19 | * |
| 20 | * @return tuple of ethernet details (channel, if name). |
| 21 | */ |
| 22 | virtual std::tuple<std::uint8_t, std::string> getEthDetails() const = 0; |
Patrick Venture | d2037c6 | 2019-03-15 10:29:47 -0700 | [diff] [blame^] | 23 | |
| 24 | /** |
| 25 | * Return the value of rx_packets, given a if_name. |
| 26 | * |
| 27 | * @param[in] name, the interface name. |
| 28 | * @return the number of packets received. |
| 29 | * @throw IpmiException on failure. |
| 30 | */ |
| 31 | virtual std::int64_t getRxPackets(const std::string& name) const = 0; |
Patrick Venture | f085d91 | 2019-03-15 08:50:00 -0700 | [diff] [blame] | 32 | }; |
| 33 | |
| 34 | class Handler : public HandlerInterface |
| 35 | { |
| 36 | public: |
| 37 | Handler() = default; |
| 38 | ~Handler() = default; |
| 39 | |
| 40 | std::tuple<std::uint8_t, std::string> getEthDetails() const override; |
Patrick Venture | d2037c6 | 2019-03-15 10:29:47 -0700 | [diff] [blame^] | 41 | std::int64_t getRxPackets(const std::string& name) const override; |
Patrick Venture | f085d91 | 2019-03-15 08:50:00 -0700 | [diff] [blame] | 42 | }; |
| 43 | |
| 44 | extern Handler handlerImpl; |
| 45 | |
| 46 | } // namespace ipmi |
| 47 | } // namespace google |