13 #ifndef __STOUT_WINDOWS_MAC_HPP__ 14 #define __STOUT_WINDOWS_MAC_HPP__ 40 if (GetAdaptersInfo(
nullptr, &size) != ERROR_BUFFER_OVERFLOW) {
41 return WindowsError(
"Calling GetAdaptersInfo returned unexpected result");
44 std::vector<IP_ADAPTER_INFO> adapterInfo(size /
sizeof(IP_ADAPTER_INFO));
45 result = GetAdaptersInfo(
46 static_cast<PIP_ADAPTER_INFO>(adapterInfo.data()),
49 if (result != NO_ERROR) {
53 foreach (
const IP_ADAPTER_INFO& ip_adapter, adapterInfo) {
54 if (!strcmp(ip_adapter.AdapterName, name.c_str())) {
57 if (ip_adapter.AddressLength == 6) {
62 uint8_t mac_buffer[6];
63 std::copy(ip_adapter.Address, ip_adapter.Address + 6, mac_buffer);
78 return Error(
"Cannot find the link device");
86 #endif // __STOUT_WINDOWS_MAC_HPP__ Definition: errorbase.hpp:36
Try< Bytes > size(const std::string &path, const FollowSymlink follow=FollowSymlink::FOLLOW_SYMLINK)
Definition: stat.hpp:130
Definition: error.hpp:108
Result< MAC > mac(const std::string &name)
Definition: mac.hpp:33
std::string stringify(int flags)
T copy(const T &t)
Definition: utils.hpp:21
constexpr const char * name
Definition: shell.hpp:41