1e10dffd0bf6335016daecdc42d0ebfba8532cb8eRoshan Pius// 2e10dffd0bf6335016daecdc42d0ebfba8532cb8eRoshan Pius// Copyright (C) 2015 The Android Open Source Project 3e10dffd0bf6335016daecdc42d0ebfba8532cb8eRoshan Pius// 4e10dffd0bf6335016daecdc42d0ebfba8532cb8eRoshan Pius// Licensed under the Apache License, Version 2.0 (the "License"); 5e10dffd0bf6335016daecdc42d0ebfba8532cb8eRoshan Pius// you may not use this file except in compliance with the License. 6e10dffd0bf6335016daecdc42d0ebfba8532cb8eRoshan Pius// You may obtain a copy of the License at 7e10dffd0bf6335016daecdc42d0ebfba8532cb8eRoshan Pius// 8e10dffd0bf6335016daecdc42d0ebfba8532cb8eRoshan Pius// http://www.apache.org/licenses/LICENSE-2.0 9e10dffd0bf6335016daecdc42d0ebfba8532cb8eRoshan Pius// 10e10dffd0bf6335016daecdc42d0ebfba8532cb8eRoshan Pius// Unless required by applicable law or agreed to in writing, software 11e10dffd0bf6335016daecdc42d0ebfba8532cb8eRoshan Pius// distributed under the License is distributed on an "AS IS" BASIS, 12e10dffd0bf6335016daecdc42d0ebfba8532cb8eRoshan Pius// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13e10dffd0bf6335016daecdc42d0ebfba8532cb8eRoshan Pius// See the License for the specific language governing permissions and 14e10dffd0bf6335016daecdc42d0ebfba8532cb8eRoshan Pius// limitations under the License. 15e10dffd0bf6335016daecdc42d0ebfba8532cb8eRoshan Pius// 16e10dffd0bf6335016daecdc42d0ebfba8532cb8eRoshan Pius 17e10dffd0bf6335016daecdc42d0ebfba8532cb8eRoshan Pius#ifndef PROXY_SHILL_WIFI_CLIENT_H 18e10dffd0bf6335016daecdc42d0ebfba8532cb8eRoshan Pius#define PROXY_SHILL_WIFI_CLIENT_H 19e10dffd0bf6335016daecdc42d0ebfba8532cb8eRoshan Pius 20e10dffd0bf6335016daecdc42d0ebfba8532cb8eRoshan Pius#include <stdio.h> 21e10dffd0bf6335016daecdc42d0ebfba8532cb8eRoshan Pius#include <stdlib.h> 22e10dffd0bf6335016daecdc42d0ebfba8532cb8eRoshan Pius#include <sysexits.h> 23e10dffd0bf6335016daecdc42d0ebfba8532cb8eRoshan Pius 24e10dffd0bf6335016daecdc42d0ebfba8532cb8eRoshan Pius#include <string> 25e10dffd0bf6335016daecdc42d0ebfba8532cb8eRoshan Pius 269cfc26a516f58d6f0c5f066c779b332d81cd0c4eRoshan Pius#include <brillo/any.h> 2703e6719bae1e0903d94853b896673a033196bcf5Alex Vakulenko#include <brillo/variant_dictionary.h> 28e10dffd0bf6335016daecdc42d0ebfba8532cb8eRoshan Pius// Abstract class which defines the interface for the RPC server to talk to Shill. 29e10dffd0bf6335016daecdc42d0ebfba8532cb8eRoshan Pius// This helps in abstracting out the underlying protocol that Shill client 30e10dffd0bf6335016daecdc42d0ebfba8532cb8eRoshan Pius// needs to use: Dbus, Binder, etc. 31e10dffd0bf6335016daecdc42d0ebfba8532cb8eRoshan Pius// TODO: Need to come up with comments explaining what each method needs to do here. 32e10dffd0bf6335016daecdc42d0ebfba8532cb8eRoshan Piusclass ProxyShillWifiClient { 33e10dffd0bf6335016daecdc42d0ebfba8532cb8eRoshan Pius public: 34e10dffd0bf6335016daecdc42d0ebfba8532cb8eRoshan Pius enum AutoConnectType { 359cfc26a516f58d6f0c5f066c779b332d81cd0c4eRoshan Pius kAutoConnectTypeDisabled = 0, 369cfc26a516f58d6f0c5f066c779b332d81cd0c4eRoshan Pius kAutoConnectTypeEnabled = 1, 379cfc26a516f58d6f0c5f066c779b332d81cd0c4eRoshan Pius kAutoConnectTypeUnspecified 38e10dffd0bf6335016daecdc42d0ebfba8532cb8eRoshan Pius }; 39e10dffd0bf6335016daecdc42d0ebfba8532cb8eRoshan Pius enum StationType { 409cfc26a516f58d6f0c5f066c779b332d81cd0c4eRoshan Pius kStationTypeIBSS, 419cfc26a516f58d6f0c5f066c779b332d81cd0c4eRoshan Pius kStationTypeManaged, 429cfc26a516f58d6f0c5f066c779b332d81cd0c4eRoshan Pius kStationTypeUnknown, 439cfc26a516f58d6f0c5f066c779b332d81cd0c4eRoshan Pius kStationTypeDefault = kStationTypeManaged 44e10dffd0bf6335016daecdc42d0ebfba8532cb8eRoshan Pius }; 45e10dffd0bf6335016daecdc42d0ebfba8532cb8eRoshan Pius 46e10dffd0bf6335016daecdc42d0ebfba8532cb8eRoshan Pius ProxyShillWifiClient() = default; 479cfc26a516f58d6f0c5f066c779b332d81cd0c4eRoshan Pius virtual ~ProxyShillWifiClient() = default; 489cfc26a516f58d6f0c5f066c779b332d81cd0c4eRoshan Pius virtual bool SetLogging() = 0; 499cfc26a516f58d6f0c5f066c779b332d81cd0c4eRoshan Pius virtual bool RemoveAllWifiEntries() = 0; 5058f74a182a788f7e1a9219b099fb502a4fc07f48Roshan Pius virtual bool ConfigureServiceByGuid(const std::string& guid, 5158f74a182a788f7e1a9219b099fb502a4fc07f48Roshan Pius AutoConnectType autoconnect, 5258f74a182a788f7e1a9219b099fb502a4fc07f48Roshan Pius const std::string& passphrase) = 0; 5358f74a182a788f7e1a9219b099fb502a4fc07f48Roshan Pius virtual bool ConfigureWifiService(const std::string& ssid, 5458f74a182a788f7e1a9219b099fb502a4fc07f48Roshan Pius const std::string& security, 5558f74a182a788f7e1a9219b099fb502a4fc07f48Roshan Pius const brillo::VariantDictionary& security_params, 56e10dffd0bf6335016daecdc42d0ebfba8532cb8eRoshan Pius bool save_credentials, 57e10dffd0bf6335016daecdc42d0ebfba8532cb8eRoshan Pius StationType station_type, 58e10dffd0bf6335016daecdc42d0ebfba8532cb8eRoshan Pius bool hidden_network, 5958f74a182a788f7e1a9219b099fb502a4fc07f48Roshan Pius const std::string& guid, 60e10dffd0bf6335016daecdc42d0ebfba8532cb8eRoshan Pius AutoConnectType autoconnect) = 0; 61f751cd3cd732ee302ebc813a2c09fd286bf6d38aRoshan Pius virtual bool ConnectToWifiNetwork(const std::string& ssid, 62f751cd3cd732ee302ebc813a2c09fd286bf6d38aRoshan Pius const std::string& security, 63f751cd3cd732ee302ebc813a2c09fd286bf6d38aRoshan Pius const brillo::VariantDictionary& security_params, 64e10dffd0bf6335016daecdc42d0ebfba8532cb8eRoshan Pius bool save_credentials, 65e10dffd0bf6335016daecdc42d0ebfba8532cb8eRoshan Pius StationType station_type, 66e10dffd0bf6335016daecdc42d0ebfba8532cb8eRoshan Pius bool hidden_network, 67f751cd3cd732ee302ebc813a2c09fd286bf6d38aRoshan Pius const std::string& guid, 68e10dffd0bf6335016daecdc42d0ebfba8532cb8eRoshan Pius AutoConnectType autoconnect, 69f751cd3cd732ee302ebc813a2c09fd286bf6d38aRoshan Pius long discovery_timeout_milliseconds, 70f751cd3cd732ee302ebc813a2c09fd286bf6d38aRoshan Pius long association_timeout_milliseconds, 71f751cd3cd732ee302ebc813a2c09fd286bf6d38aRoshan Pius long configuration_timeout_milliseconds, 72f751cd3cd732ee302ebc813a2c09fd286bf6d38aRoshan Pius long* discovery_time_milliseconds, 73f751cd3cd732ee302ebc813a2c09fd286bf6d38aRoshan Pius long* association_time_milliseconds, 74f751cd3cd732ee302ebc813a2c09fd286bf6d38aRoshan Pius long* configuration_time_milliseconds, 75f751cd3cd732ee302ebc813a2c09fd286bf6d38aRoshan Pius std::string* failure_reason) = 0; 7682c4ed9c51c24d5458e1cc3c018e682f483b2ccdRoshan Pius virtual bool DisconnectFromWifiNetwork(const std::string& ssid, 7782c4ed9c51c24d5458e1cc3c018e682f483b2ccdRoshan Pius long disconnect_timeout_milliseconds, 7882c4ed9c51c24d5458e1cc3c018e682f483b2ccdRoshan Pius long* disconnect_time_milliseconds, 7982c4ed9c51c24d5458e1cc3c018e682f483b2ccdRoshan Pius std::string* failure_reason) = 0; 8082c4ed9c51c24d5458e1cc3c018e682f483b2ccdRoshan Pius virtual bool ConfigureBgScan(const std::string& interface_name, 8182c4ed9c51c24d5458e1cc3c018e682f483b2ccdRoshan Pius const std::string& method_name, 823a62e235646ec19bee71e8dbee5208282dcd13b5Alex Vakulenko uint16_t short_interval, 833a62e235646ec19bee71e8dbee5208282dcd13b5Alex Vakulenko uint16_t long_interval, 8482c4ed9c51c24d5458e1cc3c018e682f483b2ccdRoshan Pius int signal_threshold) = 0; 85a5354f8fe745e91d9de5dd8d9c1396c4ba076d24Roshan Pius virtual bool GetActiveWifiSsids(std::vector<std::string>* ssids) = 0; 86a5354f8fe745e91d9de5dd8d9c1396c4ba076d24Roshan Pius virtual bool WaitForServiceStates(const std::string& ssid, 87e10dffd0bf6335016daecdc42d0ebfba8532cb8eRoshan Pius const std::vector<std::string>& expected_states, 88a5354f8fe745e91d9de5dd8d9c1396c4ba076d24Roshan Pius long wait_timeout_milliseconds, 89a5354f8fe745e91d9de5dd8d9c1396c4ba076d24Roshan Pius std::string* final_state, 90a5354f8fe745e91d9de5dd8d9c1396c4ba076d24Roshan Pius long* wait_time_milliseconds) = 0; 916a5ac27e04f987fe108cea5745368917f6067b2dRoshan Pius virtual bool CreateProfile(const std::string& profile_name) = 0; 926a5ac27e04f987fe108cea5745368917f6067b2dRoshan Pius virtual bool PushProfile(const std::string& profile_name) = 0; 936a5ac27e04f987fe108cea5745368917f6067b2dRoshan Pius virtual bool PopProfile(const std::string& profile_name) = 0; 946a5ac27e04f987fe108cea5745368917f6067b2dRoshan Pius virtual bool RemoveProfile(const std::string& profile_name) = 0; 95e10dffd0bf6335016daecdc42d0ebfba8532cb8eRoshan Pius virtual bool CleanProfiles() = 0; 968d439de5ced728792cc239de20efa508758c227dRoshan Pius virtual bool DeleteEntriesForSsid(const std::string& ssid) = 0; 978d439de5ced728792cc239de20efa508758c227dRoshan Pius virtual bool ListControlledWifiInterfaces(std::vector<std::string>* interface_names) = 0; 988d439de5ced728792cc239de20efa508758c227dRoshan Pius virtual bool Disconnect(const std::string& ssid) = 0; 99c047fb393a7d364de958ce3881d75b75bb428da3Roshan Pius virtual bool GetServiceOrder(std::string* service_order) = 0; 100c047fb393a7d364de958ce3881d75b75bb428da3Roshan Pius virtual bool SetServiceOrder(const std::string& service_order) = 0; 101c047fb393a7d364de958ce3881d75b75bb428da3Roshan Pius virtual bool GetServiceProperties(const std::string& ssid, 102c047fb393a7d364de958ce3881d75b75bb428da3Roshan Pius brillo::VariantDictionary* properties) = 0; 103e10dffd0bf6335016daecdc42d0ebfba8532cb8eRoshan Pius virtual bool SetSchedScan(bool enable) = 0; 10478dfe30f944f6eb63e6b56b632e3c048fbcd2524Roshan Pius virtual bool GetPropertyOnDevice(const std::string& interface_name, 10578dfe30f944f6eb63e6b56b632e3c048fbcd2524Roshan Pius const std::string& property_name, 10678dfe30f944f6eb63e6b56b632e3c048fbcd2524Roshan Pius brillo::Any* property_value) = 0; 10778dfe30f944f6eb63e6b56b632e3c048fbcd2524Roshan Pius virtual bool SetPropertyOnDevice(const std::string& interface_name, 10878dfe30f944f6eb63e6b56b632e3c048fbcd2524Roshan Pius const std::string& property_name, 10978dfe30f944f6eb63e6b56b632e3c048fbcd2524Roshan Pius const brillo::Any& property_value) = 0; 1109cac82a4fda9ceee25e69b21686645daa4266afbRoshan Pius virtual bool RequestRoam(const std::string& interface_name, const std::string& bssid) = 0; 1119cac82a4fda9ceee25e69b21686645daa4266afbRoshan Pius virtual bool SetDeviceEnabled(const std::string& interface_name, bool enable) = 0; 11290d08ac5a43d06f6674edc394f4a0d05cf2298b9Roshan Pius virtual bool DiscoverTdlsLink(const std::string& interface_name, 11390d08ac5a43d06f6674edc394f4a0d05cf2298b9Roshan Pius const std::string& peer_mac_address) = 0; 11490d08ac5a43d06f6674edc394f4a0d05cf2298b9Roshan Pius virtual bool EstablishTdlsLink(const std::string& interface_name, 11590d08ac5a43d06f6674edc394f4a0d05cf2298b9Roshan Pius const std::string& peer_mac_address) = 0; 11690d08ac5a43d06f6674edc394f4a0d05cf2298b9Roshan Pius virtual bool QueryTdlsLink(const std::string& interface_name, 11790d08ac5a43d06f6674edc394f4a0d05cf2298b9Roshan Pius const std::string& peer_mac_address, 11890d08ac5a43d06f6674edc394f4a0d05cf2298b9Roshan Pius std::string* status) = 0; 119be28266e1e51a76629f109063eb7fe1ea38823a8Roshan Pius virtual bool AddWakePacketSource(const std::string& interface_name, 120be28266e1e51a76629f109063eb7fe1ea38823a8Roshan Pius const std::string& source_ip_address) = 0; 121be28266e1e51a76629f109063eb7fe1ea38823a8Roshan Pius virtual bool RemoveWakePacketSource(const std::string& interface_name, 122be28266e1e51a76629f109063eb7fe1ea38823a8Roshan Pius const std::string& source_ip_address) = 0; 123be28266e1e51a76629f109063eb7fe1ea38823a8Roshan Pius virtual bool RemoveAllWakePacketSources(const std::string& interface_name) = 0; 1249cfc26a516f58d6f0c5f066c779b332d81cd0c4eRoshan Pius 1259cfc26a516f58d6f0c5f066c779b332d81cd0c4eRoshan Pius std::string GetModeFromStationType(StationType station_type); 126e10dffd0bf6335016daecdc42d0ebfba8532cb8eRoshan Pius}; 127e10dffd0bf6335016daecdc42d0ebfba8532cb8eRoshan Pius 128e10dffd0bf6335016daecdc42d0ebfba8532cb8eRoshan Pius#endif // PROXY_SHILL_WIFI_CLIENT_H 129