OSDN Git Service

Revert "Use new netlink attribute for scan result timestamp" am: ecb6bb205f
[android-x86/system-connectivity-wificond.git] / server.h
index 3a63970..8fc3d77 100644 (file)
--- a/server.h
+++ b/server.h
@@ -22,8 +22,6 @@
 #include <vector>
 
 #include <android-base/macros.h>
-#include <wifi_hal/driver_tool.h>
-#include <wifi_system/hal_tool.h>
 #include <wifi_system/interface_tool.h>
 
 #include "android/net/wifi/BnWificond.h"
@@ -33,6 +31,7 @@
 
 #include "wificond/ap_interface_impl.h"
 #include "wificond/client_interface_impl.h"
+#include "wificond/rtt/rtt_controller_impl.h"
 
 namespace android {
 namespace wificond {
@@ -41,11 +40,11 @@ class NL80211Packet;
 class NetlinkUtils;
 class ScanUtils;
 
+struct InterfaceInfo;
+
 class Server : public android::net::wifi::BnWificond {
  public:
-  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,
+  Server(std::unique_ptr<wifi_system::InterfaceTool> if_tool,
          std::unique_ptr<wifi_system::SupplicantManager> supplicant_man,
          std::unique_ptr<wifi_system::HostapdManager> hostapd_man,
          NetlinkUtils* netlink_utils,
@@ -59,6 +58,15 @@ class Server : public android::net::wifi::BnWificond {
       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;
@@ -69,24 +77,27 @@ 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;
+  status_t dump(int fd, const Vector<String16>& args) 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.
-  //
-  // |mode| is one of WIFI_GET_FW_PATH_* defined in hardware_legacy/wifi.h.
-  // |interface_name| is a pointer to a string to store the name of Linux
-  //     network interface that has been setup.
-  //
+  // Request interface information from kernel and setup local interface object.
+  // This assumes that interface should be in STATION mode. Even if we setup
+  // interface on behalf of createApInterace(), it is Hostapd that configure
+  // the interface to Ap mode later.
   // Returns true on success, false otherwise.
-  bool SetupInterfaceForMode(int mode,
-                             std::string* interface_name,
-                             uint32_t* interface_index,
-                             std::vector<uint8_t>* interface_mac_addr);
+  bool SetupInterface(InterfaceInfo* interface);
   bool RefreshWiphyIndex();
+  void LogSupportedBands();
+  void OnRegDomainChanged(std::string& country_code);
   void BroadcastClientInterfaceReady(
       android::sp<android::net::wifi::IClientInterface> network_interface);
   void BroadcastApInterfaceReady(
@@ -95,10 +106,9 @@ class Server : public android::net::wifi::BnWificond {
       android::sp<android::net::wifi::IClientInterface> network_interface);
   void BroadcastApInterfaceTornDown(
       android::sp<android::net::wifi::IApInterface> network_interface);
+  void MarkDownAllInterfaces();
 
-  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_;
@@ -110,6 +120,11 @@ class Server : public android::net::wifi::BnWificond {
   std::vector<android::sp<android::net::wifi::IInterfaceEventCallback>>
       interface_event_callbacks_;
 
+  std::unique_ptr<RttControllerImpl> rtt_controller_;
+
+  // Cached interface list from kernel.
+  std::vector<InterfaceInfo> interfaces_;
+
   DISALLOW_COPY_AND_ASSIGN(Server);
 };