[PATCH 4/7] dbus: Add a Group property to Peer object which will hold its group path
Tomasz Bursztyka
tomasz.bursztyka
Tue May 20 04:51:11 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 881082a..91d5b1b 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_interface_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 f76e2b6..9465cea 100644
--- a/wpa_supplicant/dbus/dbus_new_handlers_p2p.c
+++ b/wpa_supplicant/dbus/dbus_new_handlers_p2p.c
@@ -1544,6 +1544,39 @@ dbus_bool_t wpas_dbus_getter_p2p_peer_interface_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 3f1b577..d7cdfa2 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_interface_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