MCPcopy Create free account
hub / github.com/aethersdr/AetherSDR / resolveExplicitSelection

Method resolveExplicitSelection

src/core/NetworkPathResolver.cpp:71–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69}
70
71NetworkPathCandidate NetworkPathResolver::resolveExplicitSelection(const QString& interfaceId,
72 const QString& interfaceName,
73 const QHostAddress& lastSuccessfulAddress)
74{
75 const auto candidates = enumerateIpv4Candidates();
76
77 auto findMatch = [&](auto&& predicate) -> NetworkPathCandidate {
78 for (const auto& candidate : candidates) {
79 if (predicate(candidate))
80 return candidate;
81 }
82 return {};
83 };
84
85 if (!interfaceId.trimmed().isEmpty()) {
86 auto match = findMatch([&](const NetworkPathCandidate& candidate) {
87 return candidate.interfaceId == interfaceId;
88 });
89 if (match.isValid())
90 return match;
91 }
92
93 if (!interfaceName.trimmed().isEmpty()) {
94 auto match = findMatch([&](const NetworkPathCandidate& candidate) {
95 return candidate.interfaceName == interfaceName;
96 });
97 if (match.isValid())
98 return match;
99 }
100
101 if (isUsableIpv4(lastSuccessfulAddress)) {
102 auto match = findMatch([&](const NetworkPathCandidate& candidate) {
103 return candidate.address == lastSuccessfulAddress;
104 });
105 if (match.isValid())
106 return match;
107 }
108
109 return {};
110}
111
112NetworkPathCandidate NetworkPathResolver::autoCandidate()
113{

Callers

nothing calls this directly

Calls 2

isEmptyMethod · 0.45
isValidMethod · 0.45

Tested by

no test coverage detected