Ratan Gupta | 233524c | 2017-05-27 11:47:31 +0530 | [diff] [blame] | 1 | #pragma once |
William A. Kennington III | 2bd35d6 | 2022-10-26 19:20:29 -0700 | [diff] [blame^] | 2 | #include "types.hpp" |
Ratan Gupta | 233524c | 2017-05-27 11:47:31 +0530 | [diff] [blame] | 3 | |
William A. Kennington III | 2bd35d6 | 2022-10-26 19:20:29 -0700 | [diff] [blame^] | 4 | #include <unordered_map> |
Ratan Gupta | 233524c | 2017-05-27 11:47:31 +0530 | [diff] [blame] | 5 | |
6 | namespace phosphor | ||||
7 | { | ||||
8 | namespace network | ||||
9 | { | ||||
10 | namespace route | ||||
11 | { | ||||
Ratan Gupta | 233524c | 2017-05-27 11:47:31 +0530 | [diff] [blame] | 12 | class Table |
13 | { | ||||
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 14 | public: |
William A. Kennington III | e056484 | 2021-10-23 16:02:22 -0700 | [diff] [blame] | 15 | /** @brief Rebuilds the routing table from the kernel */ |
16 | void refresh(); | ||||
Ratan Gupta | 233524c | 2017-05-27 11:47:31 +0530 | [diff] [blame] | 17 | |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 18 | /** |
William A. Kennington III | d3c249c | 2019-02-01 21:12:02 -0800 | [diff] [blame] | 19 | * @brief gets the default v4 gateway. |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 20 | * |
Ravi Teja | a5a0944 | 2020-07-17 00:57:33 -0500 | [diff] [blame] | 21 | * @returns the default v4 gateway list. |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 22 | */ |
William A. Kennington III | e056484 | 2021-10-23 16:02:22 -0700 | [diff] [blame] | 23 | inline const auto& getDefaultGateway() const |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 24 | { |
William A. Kennington III | 2bd35d6 | 2022-10-26 19:20:29 -0700 | [diff] [blame^] | 25 | return gws4; |
William A. Kennington III | e056484 | 2021-10-23 16:02:22 -0700 | [diff] [blame] | 26 | } |
Ratan Gupta | 233524c | 2017-05-27 11:47:31 +0530 | [diff] [blame] | 27 | |
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 28 | /** |
William A. Kennington III | d3c249c | 2019-02-01 21:12:02 -0800 | [diff] [blame] | 29 | * @brief gets the default v6 gateway. |
30 | * | ||||
Ravi Teja | a5a0944 | 2020-07-17 00:57:33 -0500 | [diff] [blame] | 31 | * @returns the default v6 gateway list. |
William A. Kennington III | d3c249c | 2019-02-01 21:12:02 -0800 | [diff] [blame] | 32 | */ |
William A. Kennington III | e056484 | 2021-10-23 16:02:22 -0700 | [diff] [blame] | 33 | inline const auto& getDefaultGateway6() const |
William A. Kennington III | d3c249c | 2019-02-01 21:12:02 -0800 | [diff] [blame] | 34 | { |
William A. Kennington III | 2bd35d6 | 2022-10-26 19:20:29 -0700 | [diff] [blame^] | 35 | return gws6; |
William A. Kennington III | d3c249c | 2019-02-01 21:12:02 -0800 | [diff] [blame] | 36 | }; |
37 | |||||
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 38 | private: |
William A. Kennington III | 2bd35d6 | 2022-10-26 19:20:29 -0700 | [diff] [blame^] | 39 | std::unordered_map<unsigned, in_addr> gws4; |
40 | std::unordered_map<unsigned, in6_addr> gws6; | ||||
Ratan Gupta | 233524c | 2017-05-27 11:47:31 +0530 | [diff] [blame] | 41 | }; |
42 | |||||
Gunnar Mills | 57d9c50 | 2018-09-14 14:42:34 -0500 | [diff] [blame] | 43 | } // namespace route |
44 | } // namespace network | ||||
45 | } // namespace phosphor |