blob: 757126dfbc74de69f60fdb7d01b7d89a73c3b9de [file] [log] [blame]
Patrick Ventureaca98132019-03-18 11:14:16 -07001#pragma once
2
3#include <cstdint>
4#include <string>
5
6namespace ethstats
7{
8
9class EthStatsInterface
10{
11 public:
12 virtual ~EthStatsInterface() = default;
13
14 /** Given an ifname and a statistic, validate both.
15 *
16 * @param[in] path - the interface name and statistics field
17 * @return true if both valid, false otherwise.
18 */
19 virtual bool validIfNameAndField(const std::string& path) const = 0;
20
21 /** Given an ifname and a statistic, return the value.
22 *
23 * @param[in] path - the interface name and statistics field
24 * @return the value of that statistic for that interface.
25 */
26 virtual std::uint64_t readStatistic(const std::string& path) const = 0;
27};
28
29class EthStats : public EthStatsInterface
30{
31 public:
32 EthStats() = default;
33 ~EthStats() = default;
34
35 bool validIfNameAndField(const std::string& path) const override;
36 std::uint64_t readStatistic(const std::string& path) const override;
37};
38
Patrick Ventureaca98132019-03-18 11:14:16 -070039} // namespace ethstats