MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / GetGateways

Method GetGateways

pcsx2/DEV9/AdapterUtils.cpp:374–394  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

372// Gateways.
373#ifdef _WIN32
374std::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__
397std::vector<IP_Address> AdapterUtils::GetGateways(const Adapter* adapter)

Callers

nothing calls this directly

Calls 8

if_nameindexClass · 0.85
rfindMethod · 0.80
SplitStringFunction · 0.50
push_backMethod · 0.45
closeMethod · 0.45
ErrorMethod · 0.45
sizeMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected