blob: 3650c80c19d9d8b74bb730d8d9f760e0236d0735 [file] [log] [blame]
Ratan Gupta233524c2017-05-27 11:47:31 +05301#pragma once
William A. Kennington III2bd35d62022-10-26 19:20:29 -07002#include "types.hpp"
Ratan Gupta233524c2017-05-27 11:47:31 +05303
William A. Kennington III2bd35d62022-10-26 19:20:29 -07004#include <unordered_map>
Ratan Gupta233524c2017-05-27 11:47:31 +05305
6namespace phosphor
7{
8namespace network
9{
10namespace route
11{
Ratan Gupta233524c2017-05-27 11:47:31 +053012class Table
13{
Gunnar Mills57d9c502018-09-14 14:42:34 -050014 public:
William A. Kennington IIIe0564842021-10-23 16:02:22 -070015 /** @brief Rebuilds the routing table from the kernel */
16 void refresh();
Ratan Gupta233524c2017-05-27 11:47:31 +053017
Gunnar Mills57d9c502018-09-14 14:42:34 -050018 /**
William A. Kennington IIId3c249c2019-02-01 21:12:02 -080019 * @brief gets the default v4 gateway.
Gunnar Mills57d9c502018-09-14 14:42:34 -050020 *
Ravi Tejaa5a09442020-07-17 00:57:33 -050021 * @returns the default v4 gateway list.
Gunnar Mills57d9c502018-09-14 14:42:34 -050022 */
William A. Kennington IIIe0564842021-10-23 16:02:22 -070023 inline const auto& getDefaultGateway() const
Gunnar Mills57d9c502018-09-14 14:42:34 -050024 {
William A. Kennington III2bd35d62022-10-26 19:20:29 -070025 return gws4;
William A. Kennington IIIe0564842021-10-23 16:02:22 -070026 }
Ratan Gupta233524c2017-05-27 11:47:31 +053027
Gunnar Mills57d9c502018-09-14 14:42:34 -050028 /**
William A. Kennington IIId3c249c2019-02-01 21:12:02 -080029 * @brief gets the default v6 gateway.
30 *
Ravi Tejaa5a09442020-07-17 00:57:33 -050031 * @returns the default v6 gateway list.
William A. Kennington IIId3c249c2019-02-01 21:12:02 -080032 */
William A. Kennington IIIe0564842021-10-23 16:02:22 -070033 inline const auto& getDefaultGateway6() const
William A. Kennington IIId3c249c2019-02-01 21:12:02 -080034 {
William A. Kennington III2bd35d62022-10-26 19:20:29 -070035 return gws6;
William A. Kennington IIId3c249c2019-02-01 21:12:02 -080036 };
37
Gunnar Mills57d9c502018-09-14 14:42:34 -050038 private:
William A. Kennington III2bd35d62022-10-26 19:20:29 -070039 std::unordered_map<unsigned, in_addr> gws4;
40 std::unordered_map<unsigned, in6_addr> gws6;
Ratan Gupta233524c2017-05-27 11:47:31 +053041};
42
Gunnar Mills57d9c502018-09-14 14:42:34 -050043} // namespace route
44} // namespace network
45} // namespace phosphor