[PATCH 7/9] dbus: Add a Group property to Peer object which will hold its group path
Tomasz Bursztyka
tomasz.bursztyka
Wed May 14 06:10:44 PDT 2014
If only the Peer is part of a group, this property will tell about the
group object path.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka at linux.intel.com>
---
wpa_supplicant/dbus/dbus_new.c | 4 ++++
wpa_supplicant/dbus/dbus_new_handlers_p2p.c | 33 +++++++++++++++++++++++++++++
wpa_supplicant/dbus/dbus_new_handlers_p2p.h | 4 ++++
3 files changed, 41 insertions(+)
diff --git a/wpa_supplicant/dbus/dbus_new.c b/wpa_supplicant/dbus/dbus_new.c
index 67a121e..3e18431 100644
--- a/wpa_supplicant/dbus/dbus_new.c
+++ b/wpa_supplicant/dbus/dbus_new.c
@@ -3275,6 +3275,10 @@ static const struct wpa_dbus_property_desc wpas_dbus_p2p_peer_properties[] = {
wpas_dbus_getter_p2p_peer_intended_address,
NULL
},
+ { "Group", WPAS_DBUS_NEW_IFACE_P2P_PEER, "o",
+ wpas_dbus_getter_p2p_peer_group,
+ NULL
+ },
{ NULL, NULL, NULL, NULL, NULL }
};
diff --git a/wpa_supplicant/dbus/dbus_new_handlers_p2p.c b/wpa_supplicant/dbus/dbus_new_handlers_p2p.c
index 676124e..de13c5f 100644
--- a/wpa_supplicant/dbus/dbus_new_handlers_p2p.c
+++ b/wpa_supplicant/dbus/dbus_new_handlers_p2p.c
@@ -1545,6 +1545,39 @@ dbus_bool_t wpas_dbus_getter_p2p_peer_intended_address(DBusMessageIter *iter,
ETH_ALEN, error);
}
+dbus_bool_t wpas_dbus_getter_p2p_peer_group(DBusMessageIter *iter,
+ DBusError *error,
+ void *user_data)
+{
+ char groupobj_path[WPAS_DBUS_OBJECT_PATH_MAX], *path;
+ struct peer_handler_args *peer_args = user_data;
+ struct wpa_supplicant *wpa_s = peer_args->wpa_s;
+ struct wpa_supplicant *wpa_s_go;
+ const struct p2p_peer_info *info;
+
+ info = p2p_get_peer_info(peer_args->wpa_s->global->p2p,
+ peer_args->p2p_device_addr, 0);
+ if (info == NULL) {
+ dbus_set_error(error, DBUS_ERROR_FAILED,
+ "failed to find peer");
+ return FALSE;
+ }
+
+ wpa_s_go = wpas_get_go_p2p_client(wpa_s, info->p2p_device_addr);
+ if (wpa_s_go == NULL)
+ wpa_s_go = wpas_get_go_p2p_go(wpa_s, info->p2p_device_addr);
+
+ if (wpa_s_go == NULL || wpa_s_go->dbus_groupobj_path == NULL)
+ os_snprintf(groupobj_path, WPAS_DBUS_OBJECT_PATH_MAX, "/");
+ else
+ os_snprintf(groupobj_path, WPAS_DBUS_OBJECT_PATH_MAX, "%s",
+ wpa_s_go->dbus_groupobj_path);
+
+ path = groupobj_path;
+ return wpas_dbus_simple_property_getter(iter, DBUS_TYPE_OBJECT_PATH,
+ &path, error);
+}
+
/**
* wpas_dbus_getter_persistent_groups - Get array of persistent group objects
* @iter: Pointer to incoming dbus message iter
diff --git a/wpa_supplicant/dbus/dbus_new_handlers_p2p.h b/wpa_supplicant/dbus/dbus_new_handlers_p2p.h
index 4d1cbab..2e1a440 100644
--- a/wpa_supplicant/dbus/dbus_new_handlers_p2p.h
+++ b/wpa_supplicant/dbus/dbus_new_handlers_p2p.h
@@ -155,6 +155,10 @@ dbus_bool_t wpas_dbus_getter_p2p_peer_intended_address(DBusMessageIter *iter,
DBusError *error,
void *user_data);
+dbus_bool_t wpas_dbus_getter_p2p_peer_group(DBusMessageIter *iter,
+ DBusError *error,
+ void *user_data);
+
/*
* P2P Group properties
*/
--
1.8.3.2
More information about the Hostap
mailing list