Skip to content

Commit

Permalink
Improve placeholder API impl
Browse files Browse the repository at this point in the history
  • Loading branch information
corbin-phipps committed Jan 26, 2024
1 parent 3aea2a5 commit b41cf35
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions src/common/service/NetRemoteService.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,8 @@ NetRemoteService::WifiAccessPointSetPhyType([[maybe_unused]] ::grpc::ServerConte
}

using Microsoft::Net::Wifi::Dot11AccessPointAuthenticationConfiguration;
using Microsoft::Net::Wifi::Dot11AkmSuiteConfiguration;
using Microsoft::Net::Wifi::Dot11AkmSuite;
using Microsoft::Net::Wifi::Dot11AuthenticationAlgorithm;
using Microsoft::Net::Wifi::Dot11CipherSuite;

Expand All @@ -441,13 +443,22 @@ NetRemoteService::WifiAccessPointSetAuthenticationConfiguration([[maybe_unused]]

WifiAccessPointOperationStatus status{};

auto authenticationConfiguration = request->authenticationconfiguration();
auto akmSuites = authenticationConfiguration.akmsuites();
auto cipherSuites = authenticationConfiguration.ciphersuites();
const auto& authenticationConfiguration = request->authenticationconfiguration();
const auto& akmSuites = authenticationConfiguration.akmsuites();
const auto& cipherSuites = authenticationConfiguration.ciphersuites();

if (akmSuites[0].authenticationalgorithm() == Dot11AuthenticationAlgorithm::Dot11AuthenticationAlgorithmUnknown) {
if (std::empty(akmSuites) && std::empty(cipherSuites)) {
status.set_code(WifiAccessPointOperationStatusCode::WifiAccessPointOperationStatusCodeInvalidParameter);
status.set_message("No authentication algorithm provided");
status.set_message("No AKM suite or cipher suite provided");
} else if (!std::empty(akmSuites) && std::ranges::find(akmSuites, Dot11AkmSuite::Dot11AkmSuiteUnknown, &Dot11AkmSuiteConfiguration::akmsuite) != std::cend(akmSuites)) {
status.set_code(WifiAccessPointOperationStatusCode::WifiAccessPointOperationStatusCodeInvalidParameter);
status.set_message("Invalid AKM suite provided");
} else if (!std::empty(akmSuites) && std::ranges::find(akmSuites, Dot11AuthenticationAlgorithm::Dot11AuthenticationAlgorithmUnknown, &Dot11AkmSuiteConfiguration::authenticationalgorithm) != std::cend(akmSuites)) {
status.set_code(WifiAccessPointOperationStatusCode::WifiAccessPointOperationStatusCodeInvalidParameter);
status.set_message("Invalid authentication algorithm provided");
} else if (!std::empty(cipherSuites) && std::ranges::find(cipherSuites, Dot11CipherSuite::Dot11CipherSuiteUnknown) != std::cend(cipherSuites)) {
status.set_code(WifiAccessPointOperationStatusCode::WifiAccessPointOperationStatusCodeInvalidParameter);
status.set_message("Invalid cipher suite provided");
} else {
auto accessPointWeak = m_accessPointManager->GetAccessPoint(request->accesspointid());
auto accessPointController = detail::IAccessPointWeakToAccessPointController(accessPointWeak);
Expand All @@ -457,7 +468,7 @@ NetRemoteService::WifiAccessPointSetAuthenticationConfiguration([[maybe_unused]]
status.set_message(std::format("Failed to create controller for access point {}", request->accesspointid()));
}

// TODO: Use accessPointController to set authentication algorithm.
// TODO: Use accessPointController to set authentication configuration.
status.set_code(WifiAccessPointOperationStatusCode::WifiAccessPointOperationStatusCodeSucceeded);
}

Expand Down

0 comments on commit b41cf35

Please sign in to comment.