Ratan Gupta | 8ab1792 | 2017-05-25 13:07:05 +0530 | [diff] [blame] | 1 | #pragma once |
William A. Kennington III | cb64b99 | 2019-04-21 18:45:07 -0700 | [diff] [blame] | 2 | #include <net/ethernet.h> |
| 3 | |
William A. Kennington III | 9ecb90e | 2022-10-14 03:12:43 -0700 | [diff] [blame] | 4 | #include <optional> |
William A. Kennington III | ebb1ad0 | 2019-04-21 18:02:49 -0700 | [diff] [blame] | 5 | #include <string> |
Ratan Gupta | 8ab1792 | 2017-05-25 13:07:05 +0530 | [diff] [blame] | 6 | |
William A. Kennington III | 862275a | 2019-04-22 20:37:08 -0700 | [diff] [blame] | 7 | /** @brief Clears out the interfaces and IPs configured for mocking |
| 8 | */ |
| 9 | void mock_clear(); |
| 10 | |
Ratan Gupta | 8ab1792 | 2017-05-25 13:07:05 +0530 | [diff] [blame] | 11 | /** @brief Adds the given interface and addr info |
| 12 | * into the ifaddr list. |
| 13 | * @param[in] name - Interface name. |
| 14 | * @param[in] addr - IP address. |
| 15 | * @param[in] mask - subnet mask. |
| 16 | * @param[in] flags - Interface flags. |
| 17 | */ |
| 18 | |
William A. Kennington III | 9ecb90e | 2022-10-14 03:12:43 -0700 | [diff] [blame] | 19 | void mock_addIP(const char* name, const char* addr, const char* mask); |
William A. Kennington III | ebb1ad0 | 2019-04-21 18:02:49 -0700 | [diff] [blame] | 20 | |
William A. Kennington III | cb64b99 | 2019-04-21 18:45:07 -0700 | [diff] [blame] | 21 | /** @brief Adds an address string to index mapping and MAC mapping |
William A. Kennington III | ebb1ad0 | 2019-04-21 18:02:49 -0700 | [diff] [blame] | 22 | * |
| 23 | * @param[in] name - Interface name |
| 24 | * @param[in] idx - Interface index |
William A. Kennington III | cb64b99 | 2019-04-21 18:45:07 -0700 | [diff] [blame] | 25 | * @param[in] mac - Interface MAC address |
William A. Kennington III | ebb1ad0 | 2019-04-21 18:02:49 -0700 | [diff] [blame] | 26 | */ |
William A. Kennington III | 9ecb90e | 2022-10-14 03:12:43 -0700 | [diff] [blame] | 27 | void mock_addIF(const std::string& name, unsigned idx, unsigned flags = 0, |
| 28 | std::optional<ether_addr> mac = std::nullopt, |
| 29 | std::optional<unsigned> mtu = std::nullopt); |