blob: 8d51e0f1e8b5dd6a5f8d7decb7562f4ad1b32cd6 [file] [log] [blame]
Ratan Gupta8ab17922017-05-25 13:07:05 +05301#pragma once
William A. Kennington IIIcb64b992019-04-21 18:45:07 -07002#include <net/ethernet.h>
3
William A. Kennington III9ecb90e2022-10-14 03:12:43 -07004#include <optional>
William A. Kennington IIIebb1ad02019-04-21 18:02:49 -07005#include <string>
Ratan Gupta8ab17922017-05-25 13:07:05 +05306
William A. Kennington III862275a2019-04-22 20:37:08 -07007/** @brief Clears out the interfaces and IPs configured for mocking
8 */
9void mock_clear();
10
Ratan Gupta8ab17922017-05-25 13:07:05 +053011/** @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 III9ecb90e2022-10-14 03:12:43 -070019void mock_addIP(const char* name, const char* addr, const char* mask);
William A. Kennington IIIebb1ad02019-04-21 18:02:49 -070020
William A. Kennington IIIcb64b992019-04-21 18:45:07 -070021/** @brief Adds an address string to index mapping and MAC mapping
William A. Kennington IIIebb1ad02019-04-21 18:02:49 -070022 *
23 * @param[in] name - Interface name
24 * @param[in] idx - Interface index
William A. Kennington IIIcb64b992019-04-21 18:45:07 -070025 * @param[in] mac - Interface MAC address
William A. Kennington IIIebb1ad02019-04-21 18:02:49 -070026 */
William A. Kennington III9ecb90e2022-10-14 03:12:43 -070027void 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);