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