binder: Notify iface add/remove to binder
Notify |BinderManager| about any new iface addition/removal from
|wpa_supplicant| core.
|Iface| objects are stateless in the sense that they only
hold the name of the iface it controls. Every RPC call through the iface object
will first invoke |wpa_supplicant_get_iface| to ensure that the iface still
exists in the wpa_supplicant core.
While there,
1. Add some debug logs in binder.cpp.
2. Change C style comments to c++ style.
3. Add @utf8incpp annotation at the interface level in all the aidl files.
BUG: 29998764
TEST: Tested using the |gTest| integration tests. Will upload these under
|wificond|
Change-Id: If69bfaece7a6f69640fe8cbf90d1006a88aef8af
Signed-off-by: Roshan Pius <rpius@google.com>
diff --git a/wpa_supplicant/binder/iface.h b/wpa_supplicant/binder/iface.h
index c0ee12c..f87f19f 100644
--- a/wpa_supplicant/binder/iface.h
+++ b/wpa_supplicant/binder/iface.h
@@ -28,15 +28,22 @@
class Iface : public fi::w1::wpa_supplicant::BnIface
{
public:
- Iface(struct wpa_supplicant *wpa_s);
+ Iface(struct wpa_global *wpa_global, const char ifname[]);
virtual ~Iface() = default;
+ // Binder methods exposed in aidl.
+ android::binder::Status GetName(std::string *iface_name_out) override;
+
private:
- /* Raw pointer to the structure maintained by the core for this
- * interface. */
- struct wpa_supplicant *wpa_s_;
+ // 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();
};
-} /* namespace wpa_supplicant_binder */
+} // namespace wpa_supplicant_binder
-#endif /* WPA_SUPPLICANT_BINDER_IFACE_H */
+#endif // WPA_SUPPLICANT_BINDER_IFACE_H