blob: 3182cd685e4cd3005bc9837ddd1d444ce2b44bc7 [file] [log] [blame]
William A. Kennington III2e09d272022-10-14 17:15:00 -07001#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
12namespace phosphor::network::system
13{
14
15struct EthInfo
16{
17 bool autoneg;
18 uint16_t speed;
19};
20EthInfo getEthInfo(stdplus::zstring_view ifname);
21
22bool intfIsRunning(std::string_view ifname);
23
24unsigned intfIndex(stdplus::const_zstring ifname);
25
26std::optional<ether_addr> getMAC(stdplus::zstring_view ifname);
27
28std::optional<unsigned> getMTU(stdplus::zstring_view ifname);
29
30void setMTU(std::string_view ifname, unsigned mtu);
31
32void setNICUp(std::string_view ifname, bool up);
33
34/** @brief Get all the interfaces from the system.
35 * @returns list of interface names.
36 */
37string_uset getInterfaces();
38
39} // namespace phosphor::network::system