/* * hidl interface for wpa_supplicant daemon * Copyright (c) 2004-2016, Jouni Malinen * Copyright (c) 2004-2016, Roshan Pius * * This software may be distributed under the terms of the BSD license. * See README for more details. */ #ifndef WPA_SUPPLICANT_HIDL_P2P_NETWORK_H #define WPA_SUPPLICANT_HIDL_P2P_NETWORK_H #include #include #include extern "C" { #include "utils/common.h" #include "utils/includes.h" #include "wpa_supplicant_i.h" } namespace android { namespace hardware { namespace wifi { namespace supplicant { namespace V1_2 { namespace implementation { using namespace android::hardware::wifi::supplicant::V1_0; using namespace android::hardware::wifi::supplicant::V1_1; /** * Implementation of P2pNetwork hidl object. Each unique hidl * object is used for control operations on a specific network * controlled by wpa_supplicant. */ class P2pNetwork : public ISupplicantP2pNetwork { public: P2pNetwork( struct wpa_global* wpa_global, const char ifname[], int network_id); ~P2pNetwork() override = default; // Refer to |StaIface::invalidate()|. void invalidate(); bool isValid(); // Hidl methods exposed. Return getId(getId_cb _hidl_cb) override; Return getInterfaceName(getInterfaceName_cb _hidl_cb) override; Return getType(getType_cb _hidl_cb) override; Return registerCallback( const sp& callback, registerCallback_cb _hidl_cb) override; Return getSsid(getSsid_cb _hidl_cb) override; Return getBssid(getBssid_cb _hidl_cb) override; Return isCurrent(isCurrent_cb _hidl_cb) override; Return isPersistent(isPersistent_cb _hidl_cb) override; Return isGo(isGo_cb _hidl_cb) override; Return setClientList( const hidl_vec>& clients, setClientList_cb _hidl_cb) override; Return getClientList(getClientList_cb _hidl_cb) override; private: // Corresponding worker functions for the HIDL methods. std::pair getIdInternal(); std::pair getInterfaceNameInternal(); std::pair getTypeInternal(); SupplicantStatus registerCallbackInternal( const sp& callback); std::pair> getSsidInternal(); std::pair> getBssidInternal(); std::pair isCurrentInternal(); std::pair isPersistentInternal(); std::pair isGoInternal(); SupplicantStatus setClientListInternal( const std::vector>& clients); std::pair>> getClientListInternal(); struct wpa_ssid* retrieveNetworkPtr(); struct wpa_supplicant* retrieveIfacePtr(); // Reference to the global wpa_struct. This is assumed to be valid // for the lifetime of the process. const struct wpa_global* wpa_global_; // Name of the iface this network belongs to. const std::string ifname_; // Id of the network this hidl object controls. const int network_id_; bool is_valid_; DISALLOW_COPY_AND_ASSIGN(P2pNetwork); }; } // namespace implementation } // namespace V1_2 } // namespace supplicant } // namespace wifi } // namespace hardware } // namespace android #endif // WPA_SUPPLICANT_HIDL_P2P_NETWORK_H