]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Add GO Intent of connecting device in GO Negotiation Request event
authorMAYANK HAARIT <mayank.h@samsung.com>
Tue, 2 Jun 2015 05:47:33 +0000 (05:47 +0000)
committerJouni Malinen <j@w1.fi>
Sat, 6 Jun 2015 15:16:39 +0000 (18:16 +0300)
Add GO Intent information of connecting device in GO Negotiation Request
event which will help applications to decide its own GO intent value in
advance and can avoid failure cases when both devices use GO Intent 15
depending on application requirement.

Signed-off-by: Mayank Haarit <mayank.h@samsung.com>
src/p2p/p2p.h
src/p2p/p2p_go_neg.c
wpa_supplicant/dbus/dbus_new.c
wpa_supplicant/dbus/dbus_new.h
wpa_supplicant/notify.c
wpa_supplicant/notify.h
wpa_supplicant/p2p_supplicant.c

index da2446dff2fe9bade5edb048201bfef8c97f1f38..6b0ba8008665b1d8aa56cdc39f5c6313469778a4 100644 (file)
@@ -705,6 +705,7 @@ struct p2p_config {
         * @ctx: Callback context from cb_ctx
         * @src: Source address of the message triggering this notification
         * @dev_passwd_id: WPS Device Password ID
+        * @go_intent: Peer's GO Intent
         *
         * This callback is used to notify that a P2P Device is requesting
         * group owner negotiation with us, but we do not have all the
@@ -713,7 +714,8 @@ struct p2p_config {
         * PIN or PBC button press. This information can be provided with a
         * call to p2p_connect().
         */
-       void (*go_neg_req_rx)(void *ctx, const u8 *src, u16 dev_passwd_id);
+       void (*go_neg_req_rx)(void *ctx, const u8 *src, u16 dev_passwd_id,
+                             u8 go_intent);
 
        /**
         * go_neg_completed - Notification of GO Negotiation results
index 98abf9d2293e95accd135960008028f366d51748..63837ebc0e9a8636601e05a6476e3f8d5b3afd50 100644 (file)
@@ -668,7 +668,9 @@ void p2p_process_go_neg_req(struct p2p_data *p2p, const u8 *sa,
                        MAC2STR(sa));
                status = P2P_SC_FAIL_INFO_CURRENTLY_UNAVAILABLE;
                p2p->cfg->go_neg_req_rx(p2p->cfg->cb_ctx, sa,
-                                       msg.dev_password_id);
+                                       msg.dev_password_id,
+                                       msg.go_intent ? (*msg.go_intent >> 1) :
+                                       0);
        } else if (p2p->go_neg_peer && p2p->go_neg_peer != dev) {
                p2p_dbg(p2p, "Already in Group Formation with another peer");
                status = P2P_SC_FAIL_UNABLE_TO_ACCOMMODATE;
index 6382d77aa6de3bc22caea7075c4d2742d5e24ed1..a97860b9968cb693135b0f66b8355db653f30fd3 100644 (file)
@@ -1063,7 +1063,8 @@ error:
 
 
 void wpas_dbus_signal_p2p_go_neg_req(struct wpa_supplicant *wpa_s,
-                                    const u8 *src, u16 dev_passwd_id)
+                                    const u8 *src, u16 dev_passwd_id,
+                                    u8 go_intent)
 {
        DBusMessage *msg;
        DBusMessageIter iter;
@@ -1097,7 +1098,9 @@ void wpas_dbus_signal_p2p_go_neg_req(struct wpa_supplicant *wpa_s,
        if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_OBJECT_PATH,
                                            &path) ||
            !dbus_message_iter_append_basic(&iter, DBUS_TYPE_UINT16,
-                                           &dev_passwd_id))
+                                           &dev_passwd_id) ||
+           !dbus_message_iter_append_basic(&iter, DBUS_TYPE_BYTE,
+                                           &go_intent))
                wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
        else
                dbus_connection_send(iface->con, msg, NULL);
@@ -3123,6 +3126,7 @@ static const struct wpa_dbus_signal_desc wpas_dbus_interface_signals[] = {
          {
                  { "path", "o", ARG_OUT },
                  { "dev_passwd_id", "i", ARG_OUT },
+                 { "device_go_intent", "y", ARG_OUT },
                  END_ARGS
          }
        },
index 31db8d41d235db9bd1f355a546f6a4653984dde5..86bcdbfec4c31884e9950f8662dce4bfbbe0de70 100644 (file)
@@ -185,7 +185,8 @@ void wpas_dbus_signal_p2p_provision_discovery(struct wpa_supplicant *wpa_s,
                                              u16 config_methods,
                                              unsigned int generated_pin);
 void wpas_dbus_signal_p2p_go_neg_req(struct wpa_supplicant *wpa_s,
-                                    const u8 *src, u16 dev_passwd_id);
+                                    const u8 *src, u16 dev_passwd_id,
+                                    u8 go_intent);
 void wpas_dbus_signal_p2p_group_started(struct wpa_supplicant *wpa_s,
                                        const struct wpa_ssid *ssid,
                                        int client, int network_id);
@@ -378,10 +379,10 @@ wpas_dbus_signal_p2p_provision_discovery(struct wpa_supplicant *wpa_s,
 {
 }
 
-static inline void wpas_dbus_signal_p2p_go_neg_req(
-                               struct wpa_supplicant *wpa_s,
-                               const u8 *src,
-                               u16 dev_passwd_id)
+static inline void wpas_dbus_signal_p2p_go_neg_req(struct wpa_supplicant *wpa_s,
+                                                  const u8 *src,
+                                                  u16 dev_passwd_id,
+                                                  u8 go_intent)
 {
 }
 
index 4df9d903964a5ee2cae8926a27bf9bcb23c1b25e..5cef64624e0acc2b3fc0b03c8c51f586f052f864 100644 (file)
@@ -561,9 +561,9 @@ void wpas_notify_p2p_group_removed(struct wpa_supplicant *wpa_s,
 
 
 void wpas_notify_p2p_go_neg_req(struct wpa_supplicant *wpa_s,
-                               const u8 *src, u16 dev_passwd_id)
+                               const u8 *src, u16 dev_passwd_id, u8 go_intent)
 {
-       wpas_dbus_signal_p2p_go_neg_req(wpa_s, src, dev_passwd_id);
+       wpas_dbus_signal_p2p_go_neg_req(wpa_s, src, dev_passwd_id, go_intent);
 }
 
 
index 1025ca8b0eda66352fd553dc406338efd8d49724..b02a4424772c92995a677514a3ea8aaf79dfd869 100644 (file)
@@ -93,7 +93,7 @@ void wpas_notify_p2p_group_removed(struct wpa_supplicant *wpa_s,
                                   const struct wpa_ssid *ssid,
                                   const char *role);
 void wpas_notify_p2p_go_neg_req(struct wpa_supplicant *wpa_s,
-                               const u8 *src, u16 dev_passwd_id);
+                               const u8 *src, u16 dev_passwd_id, u8 go_intent);
 void wpas_notify_p2p_go_neg_completed(struct wpa_supplicant *wpa_s,
                                      struct p2p_go_neg_results *res);
 void wpas_notify_p2p_invitation_result(struct wpa_supplicant *wpa_s,
index e7a4db3a6a5530fcb0a5d4c3b0d2af70caf2c19f..5c8a3b21441f28e7f4567474109ad95202100885 100644 (file)
@@ -2146,13 +2146,15 @@ static void wpas_go_neg_completed(void *ctx, struct p2p_go_neg_results *res)
 }
 
 
-static void wpas_go_neg_req_rx(void *ctx, const u8 *src, u16 dev_passwd_id)
+static void wpas_go_neg_req_rx(void *ctx, const u8 *src, u16 dev_passwd_id,
+                              u8 go_intent)
 {
        struct wpa_supplicant *wpa_s = ctx;
        wpa_msg_global(wpa_s, MSG_INFO, P2P_EVENT_GO_NEG_REQUEST MACSTR
-                      " dev_passwd_id=%u", MAC2STR(src), dev_passwd_id);
+                      " dev_passwd_id=%u go_intent=%u", MAC2STR(src),
+                      dev_passwd_id, go_intent);
 
-       wpas_notify_p2p_go_neg_req(wpa_s, src, dev_passwd_id);
+       wpas_notify_p2p_go_neg_req(wpa_s, src, dev_passwd_id, go_intent);
 }