William A. Kennington III | 2e09d27 | 2022-10-14 17:15:00 -0700 | [diff] [blame] | 1 | #pragma once |
| 2 | #include "types.hpp" |
| 3 | |
| 4 | #include <netinet/ether.h> |
| 5 | |
| 6 | #include <cstdint> |
| 7 | #include <optional> |
| 8 | #include <stdplus/zstring.hpp> |
| 9 | #include <stdplus/zstring_view.hpp> |
| 10 | #include <string_view> |
| 11 | |
| 12 | namespace phosphor::network::system |
| 13 | { |
| 14 | |
| 15 | struct EthInfo |
| 16 | { |
| 17 | bool autoneg; |
| 18 | uint16_t speed; |
| 19 | }; |
| 20 | EthInfo getEthInfo(stdplus::zstring_view ifname); |
| 21 | |
| 22 | bool intfIsRunning(std::string_view ifname); |
| 23 | |
| 24 | unsigned intfIndex(stdplus::const_zstring ifname); |
| 25 | |
| 26 | std::optional<ether_addr> getMAC(stdplus::zstring_view ifname); |
| 27 | |
| 28 | std::optional<unsigned> getMTU(stdplus::zstring_view ifname); |
| 29 | |
| 30 | void setMTU(std::string_view ifname, unsigned mtu); |
| 31 | |
| 32 | void setNICUp(std::string_view ifname, bool up); |
| 33 | |
| 34 | /** @brief Get all the interfaces from the system. |
| 35 | * @returns list of interface names. |
| 36 | */ |
| 37 | string_uset getInterfaces(); |
| 38 | |
| 39 | } // namespace phosphor::network::system |