| 372 | // Gateways. |
| 373 | #ifdef _WIN32 |
| 374 | std::vector<IP_Address> AdapterUtils::GetGateways(const Adapter* adapter) |
| 375 | { |
| 376 | if (adapter == nullptr) |
| 377 | return {}; |
| 378 | |
| 379 | std::vector<IP_Address> collection; |
| 380 | |
| 381 | PIP_ADAPTER_GATEWAY_ADDRESS address = adapter->FirstGatewayAddress; |
| 382 | while (address != nullptr) |
| 383 | { |
| 384 | if (ReadAddressFamily(address->Address.lpSockaddr) == AF_INET) |
| 385 | { |
| 386 | const sockaddr_in* sockaddr = reinterpret_cast<sockaddr_in*>(address->Address.lpSockaddr); |
| 387 | if (sockaddr->sin_addr.S_un.S_addr != 0) |
| 388 | collection.push_back(std::bit_cast<IP_Address>(sockaddr->sin_addr)); |
| 389 | } |
| 390 | address = address->Next; |
| 391 | } |
| 392 | |
| 393 | return collection; |
| 394 | } |
| 395 | #elif defined(__POSIX__) |
| 396 | #ifdef __linux__ |
| 397 | std::vector<IP_Address> AdapterUtils::GetGateways(const Adapter* adapter) |
nothing calls this directly
no test coverage detected