6 #include <boost/system/error_code.hpp> 12 #include "gtest/gtest.h" 16 BETTER_ENUM(Statistics, uint8_t, rx_packets, rx_errors, rx_dropped, tx_packets, tx_errors, tx_dropped)
28 static bool isIPFormatValid(
const std::string &ip);
29 static bool isInterfaceActive(
const std::string &iface);
30 static bool getIPv4Address(
const std::string &iface, std::string &address);
31 static uint32_t getInterfaceStatistics(boost::system::error_code &ec,
const std::string &iface,
const dpyNetworking::Statistics &type);
32 static float getDailyTraffic(boost::system::error_code &ec,
const std::string &iface,
const struct tm date);
34 static float getDailyMegabytes(boost::system::error_code &ec,
const std::string &vnstat_response,
const std::string& date_string);
39 friend class Networking_Daily_Megabytes_test;
40 FRIEND_TEST(Networking_Daily_Megabytes_test,Invalid_response_does_not_match_expression);
41 FRIEND_TEST(Networking_Daily_Megabytes_test,Incomplete_response_full_match_not_found);
42 FRIEND_TEST(Networking_Daily_Megabytes_test,Invalid_date_does_not_match_query);
43 FRIEND_TEST(Networking_Daily_Megabytes_test,Invalid_traffic_value);
44 FRIEND_TEST(Networking_Daily_Megabytes_test,Invalid_value_output_bad_units);
45 FRIEND_TEST(Networking_Daily_Megabytes_test,Valid_value_output_kilobytes);
46 FRIEND_TEST(Networking_Daily_Megabytes_test,Valid_value_output_megabytes);
47 FRIEND_TEST(Networking_Daily_Megabytes_test,Valid_value_output_gigabytes);
Class meant to facilitate the use of networking functionalities.
Definition: networking.h:22
Definition: networking.h:15