aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSaurav Babu <saurav.babu@samsung.com>2017-07-18 07:07:51 (GMT)
committerJouni Malinen <j@w1.fi>2017-09-09 11:01:14 (GMT)
commit89e9cd25d235eed91eaf397550c77ce07e5a895f (patch)
tree66c37158d4c13aff69d44314d9d612964a26d68d
parent49e6a55537269e26a0ebd4f7536dbd54734e91fa (diff)
downloadhostap-89e9cd25d235eed91eaf397550c77ce07e5a895f.zip
hostap-89e9cd25d235eed91eaf397550c77ce07e5a895f.tar.gz
hostap-89e9cd25d235eed91eaf397550c77ce07e5a895f.tar.bz2
dbus: Add MeshGroupStarted signal
This introduces a new interface for mesh and adds a signal that is similar to the control interface event MESH-GROUP-STARTED. Signed-off-by: Saurav Babu <saurav.babu@samsung.com>
-rw-r--r--doc/dbus.doxygen19
-rw-r--r--wpa_supplicant/dbus/dbus_new.c43
-rw-r--r--wpa_supplicant/dbus/dbus_new.h10
-rw-r--r--wpa_supplicant/notify.c12
-rw-r--r--wpa_supplicant/notify.h2
-rw-r--r--wpa_supplicant/wpa_supplicant.c1
6 files changed, 87 insertions, 0 deletions
diff --git a/doc/dbus.doxygen b/doc/dbus.doxygen
index a0e8fe4..ce588ef 100644
--- a/doc/dbus.doxygen
+++ b/doc/dbus.doxygen
@@ -16,6 +16,7 @@ Interfaces:
- \ref dbus_peer
- \ref dbus_group
- \ref dbus_persistent_group
+- \ref dbus_mesh
\section dbus_main fi.w1.wpa_supplicant1
@@ -2253,4 +2254,22 @@ Interface implemented by objects representing persistent P2P groups.
</li>
</ul>
+\section dbus_mesh fi.w1.wpa_supplicant1.Interface.Mesh
+
+Interface for performing mesh operations.
+
+\subsection dbus_mesh_signals Signals
+
+<ul>
+ <li>
+ <h3>MeshGroupStarted ( a{sv} : args )</h3>
+ <p></p>
+ <h4>Arguments</h4>
+ <dl>
+ <dt>a{sv} : args</dt>
+ <dd>A dictionary containing information of the started mesh group.</dd>
+ </dl>
+ </li>
+</ul>
+
*/
diff --git a/wpa_supplicant/dbus/dbus_new.c b/wpa_supplicant/dbus/dbus_new.c
index 393cdd4..519908c 100644
--- a/wpa_supplicant/dbus/dbus_new.c
+++ b/wpa_supplicant/dbus/dbus_new.c
@@ -793,6 +793,41 @@ nomem:
#endif /* CONFIG_WPS */
+
+#ifdef CONFIG_MESH
+void wpas_dbus_signal_mesh_group_started(struct wpa_supplicant *wpa_s,
+ struct wpa_ssid *ssid)
+{
+ struct wpas_dbus_priv *iface;
+ DBusMessage *msg;
+ DBusMessageIter iter, dict_iter;
+
+ iface = wpa_s->global->dbus;
+
+ /* Do nothing if the control interface is not turned on */
+ if (!iface || !wpa_s->dbus_new_path)
+ return;
+
+ msg = dbus_message_new_signal(wpa_s->dbus_new_path,
+ WPAS_DBUS_NEW_IFACE_MESH,
+ "MeshGroupStarted");
+ if (!msg)
+ return;
+
+ dbus_message_iter_init_append(msg, &iter);
+ if (!wpa_dbus_dict_open_write(&iter, &dict_iter) ||
+ !wpa_dbus_dict_append_byte_array(&dict_iter, "SSID",
+ (const char *) ssid->ssid,
+ ssid->ssid_len) ||
+ !wpa_dbus_dict_close_write(&iter, &dict_iter))
+ wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
+ else
+ dbus_connection_send(iface->con, msg, NULL);
+ dbus_message_unref(msg);
+}
+#endif /* CONFIG_MESH */
+
+
void wpas_dbus_signal_certification(struct wpa_supplicant *wpa_s,
int depth, const char *subject,
const char *altsubject[],
@@ -3622,6 +3657,14 @@ static const struct wpa_dbus_signal_desc wpas_dbus_interface_signals[] = {
END_ARGS
}
},
+#ifdef CONFIG_MESH
+ { "MeshGroupStarted", WPAS_DBUS_NEW_IFACE_MESH,
+ {
+ { "args", "a{sv}", ARG_OUT },
+ END_ARGS
+ }
+ },
+#endif /* CONFIG_MESH */
{ NULL, NULL, { END_ARGS } }
};
diff --git a/wpa_supplicant/dbus/dbus_new.h b/wpa_supplicant/dbus/dbus_new.h
index bd0e074..84c0a08 100644
--- a/wpa_supplicant/dbus/dbus_new.h
+++ b/wpa_supplicant/dbus/dbus_new.h
@@ -65,6 +65,8 @@ enum wpas_dbus_bss_prop {
#define WPAS_DBUS_NEW_IFACE_P2PDEVICE \
WPAS_DBUS_NEW_IFACE_INTERFACE ".P2PDevice"
+#define WPAS_DBUS_NEW_IFACE_MESH WPAS_DBUS_NEW_IFACE_INTERFACE ".Mesh"
+
/*
* Groups correspond to P2P groups where this device is a GO (owner)
*/
@@ -239,6 +241,8 @@ void wpas_dbus_signal_p2p_invitation_received(struct wpa_supplicant *wpa_s,
const u8 *sa, const u8 *dev_addr,
const u8 *bssid, int id,
int op_freq);
+void wpas_dbus_signal_mesh_group_started(struct wpa_supplicant *wpa_s,
+ struct wpa_ssid *ssid);
#else /* CONFIG_CTRL_IFACE_DBUS_NEW */
@@ -554,6 +558,12 @@ void wpas_dbus_signal_p2p_invitation_received(struct wpa_supplicant *wpa_s,
{
}
+static inline
+void wpas_dbus_signal_mesh_group_started(struct wpa_supplicant *wpa_s,
+ struct wpa_ssid *ssid)
+{
+}
+
#endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
#endif /* CTRL_IFACE_DBUS_H_NEW */
diff --git a/wpa_supplicant/notify.c b/wpa_supplicant/notify.c
index f9c119a..e617022 100644
--- a/wpa_supplicant/notify.c
+++ b/wpa_supplicant/notify.c
@@ -850,3 +850,15 @@ void wpas_notify_network_type_changed(struct wpa_supplicant *wpa_s,
}
#endif /* CONFIG_P2P */
}
+
+
+#ifdef CONFIG_MESH
+void wpas_notify_mesh_group_started(struct wpa_supplicant *wpa_s,
+ struct wpa_ssid *ssid)
+{
+ if (wpa_s->p2p_mgmt)
+ return;
+
+ wpas_dbus_signal_mesh_group_started(wpa_s, ssid);
+}
+#endif /* CONFIG_MESH */
diff --git a/wpa_supplicant/notify.h b/wpa_supplicant/notify.h
index e4d7fbf..53b880f 100644
--- a/wpa_supplicant/notify.h
+++ b/wpa_supplicant/notify.h
@@ -141,5 +141,7 @@ void wpas_notify_network_type_changed(struct wpa_supplicant *wpa_s,
void wpas_notify_p2p_invitation_received(struct wpa_supplicant *wpa_s,
const u8 *sa, const u8 *go_dev_addr,
const u8 *bssid, int id, int op_freq);
+void wpas_notify_mesh_group_started(struct wpa_supplicant *wpa_s,
+ struct wpa_ssid *ssid);
#endif /* NOTIFY_H */
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index be44787..c41093a 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -1845,6 +1845,7 @@ void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
wpa_msg(wpa_s, MSG_INFO, MESH_GROUP_STARTED "ssid=\"%s\" id=%d",
wpa_ssid_txt(ssid->ssid, ssid->ssid_len),
ssid->id);
+ wpas_notify_mesh_group_started(wpa_s, ssid);
#else /* CONFIG_MESH */
wpa_msg(wpa_s, MSG_ERROR,
"mesh mode support not included in the build");