OSDN Git Service

Add netlink helper function to request a full scan am: 72312e2e46
[android-x86/system-connectivity-wificond.git] / server.h
index 5ceac41..119ee2e 100644 (file)
--- a/server.h
+++ b/server.h
 #include "android/net/wifi/BnWificond.h"
 #include "android/net/wifi/IApInterface.h"
 #include "android/net/wifi/IClientInterface.h"
+#include "android/net/wifi/IInterfaceEventCallback.h"
 
 #include "wificond/ap_interface_impl.h"
 #include "wificond/client_interface_impl.h"
+#include "wificond/rtt/rtt_controller_impl.h"
 
 namespace android {
 namespace wificond {
@@ -45,10 +47,28 @@ class Server : public android::net::wifi::BnWificond {
   Server(std::unique_ptr<wifi_system::HalTool> hal_tool,
          std::unique_ptr<wifi_system::InterfaceTool> if_tool,
          std::unique_ptr<wifi_hal::DriverTool> driver_tool,
+         std::unique_ptr<wifi_system::SupplicantManager> supplicant_man,
+         std::unique_ptr<wifi_system::HostapdManager> hostapd_man,
          NetlinkUtils* netlink_utils,
          ScanUtils* scan_utils);
   ~Server() override = default;
 
+  android::binder::Status RegisterCallback(
+      const android::sp<android::net::wifi::IInterfaceEventCallback>&
+          callback) override;
+  android::binder::Status UnregisterCallback(
+      const android::sp<android::net::wifi::IInterfaceEventCallback>&
+          callback) override;
+
+  android::binder::Status registerRttClient(
+      const ::android::sp<::android::net::wifi::IRttClient>& rtt_client,
+      ::android::sp<::android::net::wifi::IRttController>*
+          out_rtt_controller) override;
+
+  android::binder::Status unregisterRttClient(
+      const ::android::sp<::android::net::wifi::IRttClient>&
+          rttClient) override;
+
   android::binder::Status createApInterface(
       android::sp<android::net::wifi::IApInterface>*
           created_interface) override;
@@ -59,6 +79,16 @@ class Server : public android::net::wifi::BnWificond {
 
   android::binder::Status tearDownInterfaces() override;
 
+  android::binder::Status GetClientInterfaces(
+      std::vector<android::sp<android::IBinder>>* out_client_ifs) override;
+  android::binder::Status GetApInterfaces(
+      std::vector<android::sp<android::IBinder>>* out_ap_ifs) override;
+
+  // Call this once on startup.  It ignores all the invariants held
+  // in wificond and tries to restore ourselves to a blank state by
+  // killing userspace daemons and cleaning up the interface state.
+  void CleanUpSystemState();
+
  private:
   // Does the actual work of setting up an interface for a particular mode.
   //
@@ -69,18 +99,33 @@ class Server : public android::net::wifi::BnWificond {
   // Returns true on success, false otherwise.
   bool SetupInterfaceForMode(int mode,
                              std::string* interface_name,
-                             uint32_t* interface_index);
+                             uint32_t* interface_index,
+                             std::vector<uint8_t>* interface_mac_addr);
   bool RefreshWiphyIndex();
+  void BroadcastClientInterfaceReady(
+      android::sp<android::net::wifi::IClientInterface> network_interface);
+  void BroadcastApInterfaceReady(
+      android::sp<android::net::wifi::IApInterface> network_interface);
+  void BroadcastClientInterfaceTornDown(
+      android::sp<android::net::wifi::IClientInterface> network_interface);
+  void BroadcastApInterfaceTornDown(
+      android::sp<android::net::wifi::IApInterface> network_interface);
 
   const std::unique_ptr<wifi_system::HalTool> hal_tool_;
   const std::unique_ptr<wifi_system::InterfaceTool> if_tool_;
   const std::unique_ptr<wifi_hal::DriverTool> driver_tool_;
+  const std::unique_ptr<wifi_system::SupplicantManager> supplicant_manager_;
+  const std::unique_ptr<wifi_system::HostapdManager> hostapd_manager_;
   NetlinkUtils* const netlink_utils_;
   ScanUtils* const scan_utils_;
 
   uint32_t wiphy_index_;
   std::vector<std::unique_ptr<ApInterfaceImpl>> ap_interfaces_;
   std::vector<std::unique_ptr<ClientInterfaceImpl>> client_interfaces_;
+  std::vector<android::sp<android::net::wifi::IInterfaceEventCallback>>
+      interface_event_callbacks_;
+
+  std::unique_ptr<RttControllerImpl> rtt_controller_;
 
   DISALLOW_COPY_AND_ASSIGN(Server);
 };