Dmitry Shmidt | e466304 | 2016-04-04 10:07:49 -0700 | [diff] [blame] | 1 | /* |
Roshan Pius | 57ffbcf | 2016-09-27 09:12:46 -0700 | [diff] [blame] | 2 | * hidl interface for wpa_supplicant daemon |
Dmitry Shmidt | e466304 | 2016-04-04 10:07:49 -0700 | [diff] [blame] | 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 | |
Roshan Pius | 57ffbcf | 2016-09-27 09:12:46 -0700 | [diff] [blame] | 10 | #ifndef WPA_SUPPLICANT_HIDL_SUPPLICANT_H |
| 11 | #define WPA_SUPPLICANT_HIDL_SUPPLICANT_H |
Dmitry Shmidt | e466304 | 2016-04-04 10:07:49 -0700 | [diff] [blame] | 12 | |
Roshan Pius | d6e3751 | 2016-07-07 13:20:46 -0700 | [diff] [blame] | 13 | #include <android-base/macros.h> |
| 14 | |
Roshan Pius | 7c0ebf2 | 2016-09-20 15:11:56 -0700 | [diff] [blame] | 15 | #include <android/hardware/wifi/supplicant/1.0/ISupplicant.h> |
| 16 | #include <android/hardware/wifi/supplicant/1.0/ISupplicantCallback.h> |
| 17 | #include <android/hardware/wifi/supplicant/1.0/ISupplicantIface.h> |
Dmitry Shmidt | e466304 | 2016-04-04 10:07:49 -0700 | [diff] [blame] | 18 | |
| 19 | extern "C" { |
Dmitry Shmidt | e466304 | 2016-04-04 10:07:49 -0700 | [diff] [blame] | 20 | #include "utils/common.h" |
Dmitry Shmidt | 7f2c753 | 2016-08-15 09:48:12 -0700 | [diff] [blame] | 21 | #include "utils/includes.h" |
Roshan Pius | 7c0ebf2 | 2016-09-20 15:11:56 -0700 | [diff] [blame] | 22 | #include "utils/wpa_debug.h" |
| 23 | #include "wpa_supplicant_i.h" |
Dmitry Shmidt | e466304 | 2016-04-04 10:07:49 -0700 | [diff] [blame] | 24 | } |
| 25 | |
Roshan Pius | 7c0ebf2 | 2016-09-20 15:11:56 -0700 | [diff] [blame] | 26 | namespace android { |
| 27 | namespace hardware { |
| 28 | namespace wifi { |
| 29 | namespace supplicant { |
| 30 | namespace V1_0 { |
| 31 | namespace implementation { |
Dmitry Shmidt | e466304 | 2016-04-04 10:07:49 -0700 | [diff] [blame] | 32 | /** |
Roshan Pius | 57ffbcf | 2016-09-27 09:12:46 -0700 | [diff] [blame] | 33 | * Implementation of the supplicant hidl object. This hidl |
Dmitry Shmidt | e466304 | 2016-04-04 10:07:49 -0700 | [diff] [blame] | 34 | * object is used core for global control operations on |
| 35 | * wpa_supplicant. |
| 36 | */ |
Roshan Pius | 7c0ebf2 | 2016-09-20 15:11:56 -0700 | [diff] [blame] | 37 | class Supplicant : public android::hardware::wifi::supplicant::V1_0::ISupplicant |
Dmitry Shmidt | e466304 | 2016-04-04 10:07:49 -0700 | [diff] [blame] | 38 | { |
| 39 | public: |
Roshan Pius | 7c0ebf2 | 2016-09-20 15:11:56 -0700 | [diff] [blame] | 40 | Supplicant(struct wpa_global* global); |
Roshan Pius | d6e3751 | 2016-07-07 13:20:46 -0700 | [diff] [blame] | 41 | ~Supplicant() override = default; |
Roshan Pius | bded320 | 2016-11-15 10:34:04 -0800 | [diff] [blame] | 42 | bool isValid(); |
Dmitry Shmidt | e466304 | 2016-04-04 10:07:49 -0700 | [diff] [blame] | 43 | |
Roshan Pius | 7c0ebf2 | 2016-09-20 15:11:56 -0700 | [diff] [blame] | 44 | // Hidl methods exposed. |
Roshan Pius | 7c0ebf2 | 2016-09-20 15:11:56 -0700 | [diff] [blame] | 45 | Return<void> getInterface( |
Roshan Pius | e286edf | 2016-11-01 16:56:42 -0700 | [diff] [blame] | 46 | const IfaceInfo& iface_info, getInterface_cb _hidl_cb) override; |
Roshan Pius | 7c0ebf2 | 2016-09-20 15:11:56 -0700 | [diff] [blame] | 47 | Return<void> listInterfaces(listInterfaces_cb _hidl_cb) override; |
| 48 | Return<void> registerCallback( |
| 49 | const sp<ISupplicantCallback>& callback, |
| 50 | registerCallback_cb _hidl_cb) override; |
| 51 | Return<void> setDebugParams( |
| 52 | ISupplicant::DebugLevel level, bool show_timestamp, bool show_keys, |
| 53 | setDebugParams_cb _hidl_cb) override; |
| 54 | Return<ISupplicant::DebugLevel> getDebugLevel() override; |
| 55 | Return<bool> isDebugShowTimestampEnabled() override; |
| 56 | Return<bool> isDebugShowKeysEnabled() override; |
Roshan Pius | 36e2140 | 2016-11-15 15:59:42 -0800 | [diff] [blame] | 57 | Return<void> setConcurrencyPriority( |
| 58 | IfaceType type, setConcurrencyPriority_cb _hidl_cb) override; |
Dmitry Shmidt | e466304 | 2016-04-04 10:07:49 -0700 | [diff] [blame] | 59 | |
| 60 | private: |
Roshan Pius | bded320 | 2016-11-15 10:34:04 -0800 | [diff] [blame] | 61 | // Corresponding worker functions for the HIDL methods. |
| 62 | std::pair<SupplicantStatus, sp<ISupplicantIface>> getInterfaceInternal( |
| 63 | const IfaceInfo& iface_info); |
| 64 | std::pair<SupplicantStatus, std::vector<ISupplicant::IfaceInfo>> |
| 65 | listInterfacesInternal(); |
| 66 | SupplicantStatus registerCallbackInternal( |
| 67 | const sp<ISupplicantCallback>& callback); |
| 68 | SupplicantStatus setDebugParamsInternal( |
| 69 | ISupplicant::DebugLevel level, bool show_timestamp, bool show_keys); |
Roshan Pius | 36e2140 | 2016-11-15 15:59:42 -0800 | [diff] [blame] | 70 | SupplicantStatus setConcurrencyPriorityInternal(IfaceType type); |
Roshan Pius | bded320 | 2016-11-15 10:34:04 -0800 | [diff] [blame] | 71 | |
Roshan Pius | 7c0ebf2 | 2016-09-20 15:11:56 -0700 | [diff] [blame] | 72 | // Raw pointer to the global structure maintained by the core. |
| 73 | struct wpa_global* wpa_global_; |
| 74 | // Driver name to be used for creating interfaces. |
| 75 | static const char kDriverName[]; |
| 76 | // wpa_supplicant.conf file location on the device. |
| 77 | static const char kConfigFilePath[]; |
Roshan Pius | d6e3751 | 2016-07-07 13:20:46 -0700 | [diff] [blame] | 78 | |
| 79 | DISALLOW_COPY_AND_ASSIGN(Supplicant); |
Dmitry Shmidt | e466304 | 2016-04-04 10:07:49 -0700 | [diff] [blame] | 80 | }; |
| 81 | |
Roshan Pius | 7c0ebf2 | 2016-09-20 15:11:56 -0700 | [diff] [blame] | 82 | } // namespace implementation |
| 83 | } // namespace V1_0 |
| 84 | } // namespace wifi |
| 85 | } // namespace supplicant |
| 86 | } // namespace hardware |
| 87 | } // namespace android |
Dmitry Shmidt | e466304 | 2016-04-04 10:07:49 -0700 | [diff] [blame] | 88 | |
Roshan Pius | 7c0ebf2 | 2016-09-20 15:11:56 -0700 | [diff] [blame] | 89 | #endif // WPA_SUPPLICANT_HIDL_SUPPLICANT_H |