blob: e2e10facf26f6b2c4e5e9096e08e4259ea7958af [file] [log] [blame]
Patrick Venturef085d912019-03-15 08:50:00 -07001#pragma once
2
3#include <cstdint>
4#include <string>
5#include <tuple>
6
7namespace google
8{
9namespace ipmi
10{
11
12class 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 Ventured2037c62019-03-15 10:29:47 -070023
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 Venturef085d912019-03-15 08:50:00 -070032};
33
34class 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 Ventured2037c62019-03-15 10:29:47 -070041 std::int64_t getRxPackets(const std::string& name) const override;
Patrick Venturef085d912019-03-15 08:50:00 -070042};
43
44extern Handler handlerImpl;
45
46} // namespace ipmi
47} // namespace google