Skip to content

Commit

Permalink
Remove proto API bits from prior parent PR.
Browse files Browse the repository at this point in the history
  • Loading branch information
abeltrano committed Jan 30, 2024
1 parent effacb1 commit dab12a6
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 106 deletions.
2 changes: 0 additions & 2 deletions protocol/protos/NetRemoteService.proto
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,4 @@ service NetRemote
rpc WifiAccessPointEnable (Microsoft.Net.Remote.Wifi.WifiAccessPointEnableRequest) returns (Microsoft.Net.Remote.Wifi.WifiAccessPointEnableResult);
rpc WifiAccessPointDisable (Microsoft.Net.Remote.Wifi.WifiAccessPointDisableRequest) returns (Microsoft.Net.Remote.Wifi.WifiAccessPointDisableResult);
rpc WifiAccessPointSetPhyType (Microsoft.Net.Remote.Wifi.WifiAccessPointSetPhyTypeRequest) returns (Microsoft.Net.Remote.Wifi.WifiAccessPointSetPhyTypeResult);
rpc WifiAccessPointSetAuthenticationMethod (Microsoft.Net.Remote.Wifi.WifiAccessPointSetAuthenticationMethodRequest) returns (Microsoft.Net.Remote.Wifi.WifiAccessPointSetAuthenticationMethodResult);
rpc WifiAccessPointSetEncryptionMethod (Microsoft.Net.Remote.Wifi.WifiAccessPointSetEncryptionMethodRequest) returns (Microsoft.Net.Remote.Wifi.WifiAccessPointSetEncryptionMethodResult);
}
24 changes: 0 additions & 24 deletions protocol/protos/NetRemoteWifi.proto
Original file line number Diff line number Diff line change
Expand Up @@ -73,27 +73,3 @@ message WifiAccessPointSetPhyTypeResult
string AccessPointId = 1;
WifiAccessPointOperationStatus Status = 2;
}

message WifiAccessPointSetAuthenticationMethodRequest
{
string AccessPointId = 1;
Microsoft.Net.Wifi.Dot11AuthenticationAlgorithm AuthenticationAlgorithm = 2;
}

message WifiAccessPointSetAuthenticationMethodResult
{
string AccessPointId = 1;
WifiAccessPointOperationStatus Status = 2;
}

message WifiAccessPointSetEncryptionMethodRequest
{
string AccessPointId = 1;
Microsoft.Net.Wifi.Dot11CipherAlgorithm CipherAlgorithm = 2;
}

message WifiAccessPointSetEncryptionMethodResult
{
string AccessPointId = 1;
WifiAccessPointOperationStatus Status = 2;
}
80 changes: 0 additions & 80 deletions src/common/service/NetRemoteService.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -494,90 +494,10 @@ NetRemoteService::WifiAccessPointSetPhyType([[maybe_unused]] ::grpc::ServerConte
return grpc::Status::OK;
}

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

::grpc::Status
NetRemoteService::WifiAccessPointSetAuthenticationConfiguration([[maybe_unused]] ::grpc::ServerContext* context, const ::Microsoft::Net::Remote::Wifi::WifiAccessPointSetAuthenticationConfigurationRequest* request, ::Microsoft::Net::Remote::Wifi::WifiAccessPointSetAuthenticationConfigurationResult* response)
{
LOGD << std::format("Received WifiAccessPointSetAuthenticationConfiguration request for access point id {}", request->accesspointid());

WifiAccessPointOperationStatus status{};

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

if (std::empty(akmSuites) && std::empty(cipherSuites)) {
status.set_code(WifiAccessPointOperationStatusCode::WifiAccessPointOperationStatusCodeInvalidParameter);
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);
if (!accessPointController) {
LOGE << std::format("Failed to create controller for access point {}", request->accesspointid());
status.set_code(WifiAccessPointOperationStatusCode::WifiAccessPointOperationStatusCodeAccessPointInvalid);
status.set_message(std::format("Failed to create controller for access point {}", request->accesspointid()));
}

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

response->set_accesspointid(request->accesspointid());
*response->mutable_status() = std::move(status);

return grpc::Status::OK;
}

using Microsoft::Net::Wifi::Dot11FrequencyBand;

::grpc::Status
NetRemoteService::WifiAccessPointSetFrequencyBands([[maybe_unused]] ::grpc::ServerContext* context, const ::Microsoft::Net::Remote::Wifi::WifiAccessPointSetFrequencyBandsRequest* request, ::Microsoft::Net::Remote::Wifi::WifiAccessPointSetFrequencyBandsResult* response)
{
LOGD << std::format("Received WifiAccessPointSetFrequencyBands request for access point id {}", request->accesspointid());

WifiAccessPointOperationStatus status{};

const auto& frequencyBands = request->frequencybands();

if (std::empty(frequencyBands)) {
status.set_code(WifiAccessPointOperationStatusCode::WifiAccessPointOperationStatusCodeInvalidParameter);
status.set_message("No frequency band provided");
} else if (std::ranges::find(frequencyBands, Dot11FrequencyBand::Dot11FrequencyBandUnknown) != std::cend(frequencyBands)) {
status.set_code(WifiAccessPointOperationStatusCode::WifiAccessPointOperationStatusCodeInvalidParameter);
status.set_message("Invalid frequency band provided");
} else {
auto accessPointWeak = m_accessPointManager->GetAccessPoint(request->accesspointid());
auto accessPointController = detail::IAccessPointWeakToAccessPointController(accessPointWeak);
if (!accessPointController) {
LOGE << std::format("Failed to create controller for access point {}", request->accesspointid());
status.set_code(WifiAccessPointOperationStatusCode::WifiAccessPointOperationStatusCodeAccessPointInvalid);
status.set_message(std::format("Failed to create controller for access point {}", request->accesspointid()));
}

// TODO: Use accessPointController to set frequency bands.
status.set_code(WifiAccessPointOperationStatusCode::WifiAccessPointOperationStatusCodeSucceeded);
}

response->set_accesspointid(request->accesspointid());
*response->mutable_status() = std::move(status);

return grpc::Status::OK;
}

bool
NetRemoteService::ValidateWifiAccessPointEnableRequest(const ::Microsoft::Net::Remote::Wifi::WifiAccessPointEnableRequest* request, ::Microsoft::Net::Remote::Wifi::WifiAccessPointOperationStatus& status)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ private:
virtual ::grpc::Status
WifiAccessPointDisable(::grpc::ServerContext* context, const ::Microsoft::Net::Remote::Wifi::WifiAccessPointDisableRequest* request, ::Microsoft::Net::Remote::Wifi::WifiAccessPointDisableResult* response) override;

virtual ::grpc::Status
WifiAccessPointSetPhyType(::grpc::ServerContext* context, const ::Microsoft::Net::Remote::Wifi::WifiAccessPointSetPhyTypeRequest* request, ::Microsoft::Net::Remote::Wifi::WifiAccessPointSetPhyTypeResult* response) override;

protected:
bool
ValidateWifiAccessPointEnableRequest(const ::Microsoft::Net::Remote::Wifi::WifiAccessPointEnableRequest* request, ::Microsoft::Net::Remote::Wifi::WifiAccessPointOperationStatus& status);
Expand Down

0 comments on commit dab12a6

Please sign in to comment.