binder: Add |INetwork| object interface
Create a new binder object interface to control networks. Neworks are
added/removed using the corresponding |IIface| binder object.
This CL only contains skeletal code for the new binder object.
While there,
Clean up the error codes in all the aid files and use the binder
exception codes to indicate INVALID_ARGS.
BUG: 30015382
Change-Id: I6953a623ab2c2b25f678d3b515a924a67d67d3fb
diff --git a/wpa_supplicant/binder/iface.h b/wpa_supplicant/binder/iface.h
index f87f19f..bf8c6f0 100644
--- a/wpa_supplicant/binder/iface.h
+++ b/wpa_supplicant/binder/iface.h
@@ -10,7 +10,10 @@
#ifndef WPA_SUPPLICANT_BINDER_IFACE_H
#define WPA_SUPPLICANT_BINDER_IFACE_H
+#include <android-base/macros.h>
+
#include "fi/w1/wpa_supplicant/BnIface.h"
+#include "fi/w1/wpa_supplicant/INetwork.h"
extern "C" {
#include "utils/common.h"
@@ -29,19 +32,25 @@
{
public:
Iface(struct wpa_global *wpa_global, const char ifname[]);
- virtual ~Iface() = default;
+ ~Iface() override = default;
// Binder methods exposed in aidl.
android::binder::Status GetName(std::string *iface_name_out) override;
+ android::binder::Status AddNetwork(
+ android::sp<fi::w1::wpa_supplicant::INetwork> *network_object_out)
+ override;
+ android::binder::Status RemoveNetwork(int network_id) override;
private:
+ 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 binder object controls
const std::string ifname_;
- struct wpa_supplicant *retrieveIfacePtr();
+ DISALLOW_COPY_AND_ASSIGN(Iface);
};
} // namespace wpa_supplicant_binder