1 /* 2 * hidl interface for wpa_supplicant daemon 3 * Copyright (c) 2004-2016, Jouni Malinen <j (at) w1.fi> 4 * Copyright (c) 2004-2016, Roshan Pius <rpius (at) google.com> 5 * 6 * This software may be distributed under the terms of the BSD license. 7 * See README for more details. 8 */ 9 10 #ifndef WPA_SUPPLICANT_HIDL_SUPPLICANT_H 11 #define WPA_SUPPLICANT_HIDL_SUPPLICANT_H 12 13 #include <android/hardware/wifi/supplicant/1.0/ISupplicantCallback.h> 14 #include <android/hardware/wifi/supplicant/1.0/ISupplicantIface.h> 15 #include <android/hardware/wifi/supplicant/1.0/types.h> 16 #include <android/hardware/wifi/supplicant/1.2/ISupplicant.h> 17 #include <android-base/macros.h> 18 #include <hidl/Status.h> 19 20 extern "C" 21 { 22 #include "utils/common.h" 23 #include "utils/includes.h" 24 #include "utils/wpa_debug.h" 25 #include "wpa_supplicant_i.h" 26 } 27 28 namespace android { 29 namespace hardware { 30 namespace wifi { 31 namespace supplicant { 32 namespace V1_2 { 33 namespace implementation { 34 using namespace android::hardware::wifi::supplicant::V1_0; 35 36 /** 37 * Implementation of the supplicant hidl object. This hidl 38 * object is used core for global control operations on 39 * wpa_supplicant. 40 */ 41 class Supplicant : public V1_2::ISupplicant 42 { 43 public: 44 Supplicant(struct wpa_global* global); 45 ~Supplicant() override = default; 46 bool isValid(); 47 48 // Hidl methods exposed. 49 Return<void> addInterface( 50 const IfaceInfo& iface_info, addInterface_cb _hidl_cb) override; 51 Return<void> removeInterface( 52 const IfaceInfo& iface_info, removeInterface_cb _hidl_cb) override; 53 Return<void> getInterface( 54 const IfaceInfo& iface_info, getInterface_cb _hidl_cb) override; 55 Return<void> listInterfaces(listInterfaces_cb _hidl_cb) override; 56 Return<void> registerCallback( 57 const sp<ISupplicantCallback>& callback, 58 registerCallback_cb _hidl_cb) override; 59 Return<void> setDebugParams( 60 ISupplicant::DebugLevel level, bool show_timestamp, bool show_keys, 61 setDebugParams_cb _hidl_cb) override; 62 Return<ISupplicant::DebugLevel> getDebugLevel() override; 63 Return<bool> isDebugShowTimestampEnabled() override; 64 Return<bool> isDebugShowKeysEnabled() override; 65 Return<void> setConcurrencyPriority( 66 IfaceType type, setConcurrencyPriority_cb _hidl_cb) override; 67 Return<void> terminate() override; 68 69 private: 70 // Corresponding worker functions for the HIDL methods. 71 std::pair<SupplicantStatus, sp<ISupplicantIface>> getInterfaceInternal( 72 const IfaceInfo& iface_info); 73 std::pair<SupplicantStatus, sp<ISupplicantIface>> addInterfaceInternal( 74 const IfaceInfo& iface_info); 75 SupplicantStatus removeInterfaceInternal(const IfaceInfo& iface_info); 76 std::pair<SupplicantStatus, std::vector<ISupplicant::IfaceInfo>> 77 listInterfacesInternal(); 78 SupplicantStatus registerCallbackInternal( 79 const sp<ISupplicantCallback>& callback); 80 SupplicantStatus setDebugParamsInternal( 81 ISupplicant::DebugLevel level, bool show_timestamp, bool show_keys); 82 SupplicantStatus setConcurrencyPriorityInternal(IfaceType type); 83 84 // Raw pointer to the global structure maintained by the core. 85 struct wpa_global* wpa_global_; 86 // Driver name to be used for creating interfaces. 87 static const char kDriverName[]; 88 // wpa_supplicant.conf file location on the device. 89 static const char kConfigFilePath[]; 90 91 DISALLOW_COPY_AND_ASSIGN(Supplicant); 92 }; 93 94 } // namespace implementation 95 } // namespace V1_2 96 } // namespace supplicant 97 } // namespace wifi 98 } // namespace hardware 99 } // namespace android 100 101 #endif // WPA_SUPPLICANT_HIDL_SUPPLICANT_H 102