aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/binder/supplicant.cpp
diff options
context:
space:
mode:
authorRoshan Pius <rpius@google.com>2016-07-07 16:48:58 (GMT)
committerJouni Malinen <j@w1.fi>2016-08-07 08:21:45 (GMT)
commita1979469fd13dd39201362fa953fcb3087d7a17b (patch)
tree29ba83e812e080a15920cada0050d96e12568c2a /wpa_supplicant/binder/supplicant.cpp
parentfe1d0771f72e6be7e81d46658dcac37a3629c317 (diff)
downloadhostap-a1979469fd13dd39201362fa953fcb3087d7a17b.zip
hostap-a1979469fd13dd39201362fa953fcb3087d7a17b.tar.gz
hostap-a1979469fd13dd39201362fa953fcb3087d7a17b.tar.bz2
binder: Clang format the source code
Add a ".clang-format" file which is pretty close to the rest of wpa_supplicant code base and reformat the binder codebase. Signed-off-by: Roshan Pius <rpius@google.com>
Diffstat (limited to 'wpa_supplicant/binder/supplicant.cpp')
-rw-r--r--wpa_supplicant/binder/supplicant.cpp80
1 files changed, 41 insertions, 39 deletions
diff --git a/wpa_supplicant/binder/supplicant.cpp b/wpa_supplicant/binder/supplicant.cpp
index 6844e5a..76569b1 100644
--- a/wpa_supplicant/binder/supplicant.cpp
+++ b/wpa_supplicant/binder/supplicant.cpp
@@ -7,28 +7,24 @@
* See README for more details.
*/
-#include "binder_manager.h"
#include "supplicant.h"
+#include "binder_manager.h"
namespace wpa_supplicant_binder {
-Supplicant::Supplicant(struct wpa_global *global)
- : wpa_global_(global)
-{
-}
-
+Supplicant::Supplicant(struct wpa_global *global) : wpa_global_(global) {}
android::binder::Status Supplicant::CreateInterface(
- const android::os::PersistableBundle &params,
- android::sp<fi::w1::wpa_supplicant::IIface> *aidl_return)
+ const android::os::PersistableBundle &params,
+ android::sp<fi::w1::wpa_supplicant::IIface> *aidl_return)
{
android::String16 driver, ifname, confname, bridge_ifname;
/* Check if required Ifname argument is missing */
if (!params.getString(android::String16("Ifname"), &ifname))
return android::binder::Status::fromServiceSpecificError(
- ERROR_INVALID_ARGS,
- android::String8("Ifname missing in params."));
+ ERROR_INVALID_ARGS,
+ android::String8("Ifname missing in params."));
/* Retrieve the remaining params from the dictionary */
params.getString(android::String16("Driver"), &driver);
params.getString(android::String16("ConfigFile"), &confname);
@@ -38,11 +34,12 @@ android::binder::Status Supplicant::CreateInterface(
* Try to get the wpa_supplicant record for this iface, return
* an error if we already control it.
*/
- if (wpa_supplicant_get_iface(wpa_global_,
- android::String8(ifname).string()) != NULL)
+ if (wpa_supplicant_get_iface(
+ wpa_global_, android::String8(ifname).string()) != NULL)
return android::binder::Status::fromServiceSpecificError(
- ERROR_IFACE_EXISTS,
- android::String8("wpa_supplicant already controls this interface."));
+ ERROR_IFACE_EXISTS,
+ android::String8("wpa_supplicant already controls this "
+ "interface."));
android::binder::Status status;
struct wpa_supplicant *wpa_s = NULL;
@@ -52,36 +49,38 @@ android::binder::Status Supplicant::CreateInterface(
iface.driver = os_strdup(android::String8(driver).string());
iface.ifname = os_strdup(android::String8(ifname).string());
iface.confname = os_strdup(android::String8(confname).string());
- iface.bridge_ifname = os_strdup(
- android::String8(bridge_ifname).string());
+ iface.bridge_ifname =
+ os_strdup(android::String8(bridge_ifname).string());
/* Otherwise, have wpa_supplicant attach to it. */
wpa_s = wpa_supplicant_add_iface(wpa_global_, &iface, NULL);
/* The supplicant core creates a corresponding binder object via
* BinderManager when |wpa_supplicant_add_iface| is called. */
if (!wpa_s || !wpa_s->binder_object_key) {
status = android::binder::Status::fromServiceSpecificError(
- ERROR_UNKNOWN,
- android::String8("wpa_supplicant couldn't grab this interface."));
+ ERROR_UNKNOWN,
+ android::String8(
+ "wpa_supplicant couldn't grab this interface."));
} else {
BinderManager *binder_manager = BinderManager::getInstance();
if (!binder_manager ||
binder_manager->getIfaceBinderObjectByKey(
- wpa_s->binder_object_key, aidl_return))
- status = android::binder::Status::fromServiceSpecificError(
+ wpa_s->binder_object_key, aidl_return))
+ status =
+ android::binder::Status::fromServiceSpecificError(
ERROR_UNKNOWN,
- android::String8("wpa_supplicant encountered a binder error."));
+ android::String8("wpa_supplicant encountered a "
+ "binder error."));
else
status = android::binder::Status::ok();
}
- os_free((void *) iface.driver);
- os_free((void *) iface.ifname);
- os_free((void *) iface.confname);
- os_free((void *) iface.bridge_ifname);
+ os_free((void *)iface.driver);
+ os_free((void *)iface.ifname);
+ os_free((void *)iface.confname);
+ os_free((void *)iface.bridge_ifname);
return status;
}
-
android::binder::Status Supplicant::RemoveInterface(const std::string &ifname)
{
struct wpa_supplicant *wpa_s;
@@ -89,35 +88,38 @@ android::binder::Status Supplicant::RemoveInterface(const std::string &ifname)
wpa_s = wpa_supplicant_get_iface(wpa_global_, ifname.c_str());
if (!wpa_s || !wpa_s->binder_object_key)
return android::binder::Status::fromServiceSpecificError(
- ERROR_IFACE_UNKNOWN,
- android::String8("wpa_supplicant does not control this interface."));
+ ERROR_IFACE_UNKNOWN,
+ android::String8("wpa_supplicant does not control this "
+ "interface."));
if (wpa_supplicant_remove_iface(wpa_global_, wpa_s, 0))
return android::binder::Status::fromServiceSpecificError(
- ERROR_UNKNOWN,
- android::String8("wpa_supplicant couldn't remove this interface."));
+ ERROR_UNKNOWN,
+ android::String8(
+ "wpa_supplicant couldn't remove this interface."));
return android::binder::Status::ok();
}
-
android::binder::Status Supplicant::GetInterface(
- const std::string &ifname,
- android::sp<fi::w1::wpa_supplicant::IIface> *aidl_return)
+ const std::string &ifname,
+ android::sp<fi::w1::wpa_supplicant::IIface> *aidl_return)
{
struct wpa_supplicant *wpa_s;
wpa_s = wpa_supplicant_get_iface(wpa_global_, ifname.c_str());
if (!wpa_s || !wpa_s->binder_object_key)
return android::binder::Status::fromServiceSpecificError(
- ERROR_IFACE_UNKNOWN,
- android::String8("wpa_supplicant does not control this interface."));
+ ERROR_IFACE_UNKNOWN,
+ android::String8(
+ "wpa_supplicant does not control this interface."));
BinderManager *binder_manager = BinderManager::getInstance();
if (!binder_manager ||
- binder_manager->getIfaceBinderObjectByKey(wpa_s->binder_object_key,
- aidl_return))
+ binder_manager->getIfaceBinderObjectByKey(
+ wpa_s->binder_object_key, aidl_return))
return android::binder::Status::fromServiceSpecificError(
- ERROR_UNKNOWN,
- android::String8("wpa_supplicant encountered a binder error."));
+ ERROR_UNKNOWN,
+ android::String8(
+ "wpa_supplicant encountered a binder error."));
return android::binder::Status::ok();
}