aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManeesh Jain <maneesh.jain@samsung.com>2015-06-18 04:16:34 (GMT)
committerJouni Malinen <j@w1.fi>2015-09-27 12:55:11 (GMT)
commitbe5ab8d4ab95222208978504af9646ded1e2a430 (patch)
treecc00fd910738f98a8d0e71e700045494dce2c352
parent0a7b2a02eb237daecfb9d037179d95db9ab4f988 (diff)
downloadhostap-be5ab8d4ab95222208978504af9646ded1e2a430.zip
hostap-be5ab8d4ab95222208978504af9646ded1e2a430.tar.gz
hostap-be5ab8d4ab95222208978504af9646ded1e2a430.tar.bz2
D-Bus: Add InvitationReceived Signal
This is equivalent to the P2P_EVENT_INVITATION_RECEIVED signal on the control interface. It can be used to sent the Invitation Received signal to applications written using D-Bus. Signed-off-by: Maneesh Jain <maneesh.jain@samsung.com>
-rw-r--r--doc/dbus.doxygen19
-rw-r--r--wpa_supplicant/dbus/dbus_new.c63
-rw-r--r--wpa_supplicant/dbus/dbus_new.h12
-rw-r--r--wpa_supplicant/dbus/dbus_new_introspect.c2
-rw-r--r--wpa_supplicant/notify.c10
-rw-r--r--wpa_supplicant/notify.h3
-rw-r--r--wpa_supplicant/p2p_supplicant.c4
7 files changed, 112 insertions, 1 deletions
diff --git a/doc/dbus.doxygen b/doc/dbus.doxygen
index 806289a..9430632 100644
--- a/doc/dbus.doxygen
+++ b/doc/dbus.doxygen
@@ -1535,6 +1535,25 @@ Interface for performing P2P (Wi-Fi Peer-to-Peer) P2P Device operations.
</li>
<li>
+ <h3>InvitationReceived ( a{sv} : properties )</h3>
+ <p></p>
+ <h4>Arguments</h4>
+ <dl>
+ <dt>a{sv} : properties</dt>
+ <dd>A dictionary with following information:
+ <table>
+ <tr><th>Key</th><th>Value type</th><th>Description</th></tr>
+ <tr><td>sa</td><td>ay</td><td>Optionally present</td></tr>
+ <tr><td>go_dev_addr</td><td>ay</td><td>Optionally present</td></tr>
+ <tr><td>bssid</td><td>ay</td><td>Optionally present</td></tr>
+ <tr><td>persistent_id</td><td>i</td><td>Optionally present</td></tr>
+ <tr><td>op_freq</td><td>i</td><td></td></tr>
+ </table>
+ </dd>
+ </dl>
+ </li>
+
+ <li>
<h3>GroupFormationFailure ( s : reason )</h3>
<p></p>
<h4>Arguments</h4>
diff --git a/wpa_supplicant/dbus/dbus_new.c b/wpa_supplicant/dbus/dbus_new.c
index 9e7de03..67d0e28 100644
--- a/wpa_supplicant/dbus/dbus_new.c
+++ b/wpa_supplicant/dbus/dbus_new.c
@@ -1896,6 +1896,63 @@ void wpas_dbus_signal_p2p_group_formation_failure(struct wpa_supplicant *wpa_s,
dbus_message_unref(msg);
}
+
+/**
+ * wpas_dbus_signal_p2p_invitation_received - Emit InvitationReceived signal
+ * @wpa_s: %wpa_supplicant network interface data
+ * @sa: Source address of the Invitation Request
+ * @dev_add: GO Device Address
+ * @bssid: P2P Group BSSID or %NULL if not received
+ * @id: Persistent group id or %0 if not persistent group
+ * @op_freq: Operating frequency for the group
+ */
+
+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)
+{
+ DBusMessage *msg;
+ DBusMessageIter iter, dict_iter;
+ struct wpas_dbus_priv *iface;
+
+ iface = wpa_s->global->dbus;
+
+ /* Do nothing if the control interface is not turned on */
+ if (iface == NULL)
+ return;
+
+ msg = dbus_message_new_signal(wpa_s->dbus_new_path,
+ WPAS_DBUS_NEW_IFACE_P2PDEVICE,
+ "InvitationReceived");
+ if (msg == NULL)
+ return;
+
+ dbus_message_iter_init_append(msg, &iter);
+ if (!wpa_dbus_dict_open_write(&iter, &dict_iter) ||
+ (sa &&
+ !wpa_dbus_dict_append_byte_array(&dict_iter, "sa",
+ (const char *) sa, ETH_ALEN)) ||
+ (dev_addr &&
+ !wpa_dbus_dict_append_byte_array(&dict_iter, "go_dev_addr",
+ (const char *) dev_addr,
+ ETH_ALEN)) ||
+ (bssid &&
+ !wpa_dbus_dict_append_byte_array(&dict_iter, "bssid",
+ (const char *) bssid,
+ ETH_ALEN)) ||
+ (id &&
+ !wpa_dbus_dict_append_int32(&dict_iter, "persistent_id", id)) ||
+ !wpa_dbus_dict_append_int32(&dict_iter, "op_freq", op_freq) ||
+ !wpa_dbus_dict_close_write(&iter, &dict_iter)) {
+ dbus_message_unref(msg);
+ return;
+ }
+
+ dbus_connection_send(iface->con, msg, NULL);
+}
+
+
#endif /* CONFIG_P2P */
@@ -3281,6 +3338,12 @@ static const struct wpa_dbus_signal_desc wpas_dbus_interface_signals[] = {
END_ARGS
}
},
+ { "InvitationReceived", WPAS_DBUS_NEW_IFACE_P2PDEVICE,
+ {
+ { "properties", "a{sv}", ARG_OUT },
+ END_ARGS
+ }
+ },
#endif /* CONFIG_P2P */
#ifdef CONFIG_AP
{ "ProbeRequest", WPAS_DBUS_NEW_IFACE_INTERFACE,
diff --git a/wpa_supplicant/dbus/dbus_new.h b/wpa_supplicant/dbus/dbus_new.h
index fe63966..6d240ff 100644
--- a/wpa_supplicant/dbus/dbus_new.h
+++ b/wpa_supplicant/dbus/dbus_new.h
@@ -233,6 +233,10 @@ void wpas_dbus_signal_sta_authorized(struct wpa_supplicant *wpa_s,
const u8 *sta);
void wpas_dbus_signal_sta_deauthorized(struct wpa_supplicant *wpa_s,
const u8 *sta);
+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);
#else /* CONFIG_CTRL_IFACE_DBUS_NEW */
@@ -540,6 +544,14 @@ void wpas_dbus_signal_sta_deauthorized(struct wpa_supplicant *wpa_s,
{
}
+static inline
+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)
+{
+}
+
#endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
#endif /* CTRL_IFACE_DBUS_H_NEW */
diff --git a/wpa_supplicant/dbus/dbus_new_introspect.c b/wpa_supplicant/dbus/dbus_new_introspect.c
index 6209c67..fba57e6 100644
--- a/wpa_supplicant/dbus/dbus_new_introspect.c
+++ b/wpa_supplicant/dbus/dbus_new_introspect.c
@@ -257,7 +257,7 @@ DBusMessage * wpa_dbus_introspect(DBusMessage *message,
DBusMessage *reply;
struct wpabuf *xml;
- xml = wpabuf_alloc(10000);
+ xml = wpabuf_alloc(15000);
if (xml == NULL)
return NULL;
diff --git a/wpa_supplicant/notify.c b/wpa_supplicant/notify.c
index 4ece411..45d06bf 100644
--- a/wpa_supplicant/notify.c
+++ b/wpa_supplicant/notify.c
@@ -671,6 +671,16 @@ void wpas_notify_p2p_wps_failed(struct wpa_supplicant *wpa_s,
wpas_dbus_signal_p2p_wps_failed(wpa_s, fail);
}
+
+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)
+{
+ /* Notify a P2P Invitation Request */
+ wpas_dbus_signal_p2p_invitation_received(wpa_s, sa, go_dev_addr, bssid,
+ id, op_freq);
+}
+
#endif /* CONFIG_P2P */
diff --git a/wpa_supplicant/notify.h b/wpa_supplicant/notify.h
index 6860671..d9f0f5a 100644
--- a/wpa_supplicant/notify.h
+++ b/wpa_supplicant/notify.h
@@ -137,5 +137,8 @@ void wpas_notify_network_bssid_set_changed(struct wpa_supplicant *wpa_s,
struct wpa_ssid *ssid);
void wpas_notify_network_type_changed(struct wpa_supplicant *wpa_s,
struct wpa_ssid *ssid);
+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);
#endif /* NOTIFY_H */
diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index b87624a..78bdd08 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -2927,6 +2927,8 @@ static void wpas_invitation_received(void *ctx, const u8 *sa, const u8 *bssid,
" unknown-network",
MAC2STR(sa), MAC2STR(go_dev_addr));
}
+ wpas_notify_p2p_invitation_received(wpa_s, sa, go_dev_addr,
+ bssid, 0, op_freq);
return;
}
@@ -2939,6 +2941,8 @@ static void wpas_invitation_received(void *ctx, const u8 *sa, const u8 *bssid,
"sa=" MACSTR " persistent=%d",
MAC2STR(sa), s->id);
}
+ wpas_notify_p2p_invitation_received(wpa_s, sa, go_dev_addr, bssid,
+ s->id, op_freq);
}