Fix bug N_SE-26723(Send rejection message)
authorKim Gibyoung <lastkgb.kim@samsung.com>
Fri, 29 Mar 2013 16:53:54 +0000 (01:53 +0900)
committerKim Gibyoung <lastkgb.kim@samsung.com>
Fri, 29 Mar 2013 17:02:12 +0000 (02:02 +0900)
Change-Id: I3150d230d301e72add6b9309bde31d3cfe3b5849

debian/changelog
files/p2p_supplicant
oem/include/wifi-direct-oem.h
oem/wifi-direct-oem.c
packaging/wifi-direct-manager.spec
plugin/wpasupplicant/include/wifi-direct-wpasupplicant.h
plugin/wpasupplicant/src/wifi-direct-plugin.c
src/wifi-direct-client-handler.c
src/wifi-direct-event-handler.c
src/wifi-direct-main.c

index 63e5033..446fb3d 100644 (file)
@@ -1,6 +1,14 @@
+wfi-direct-manager (0.6.14) precise; urgency=low
+
+  * Fix bug N_SE-26723(Send rejection message)
+  * Git : framework/connectivity/wifi-direct-manager
+  * Tag : wifi-direct-manager_0.6.14
+
+ -- Gibyoung Kim <lastkgb.kim@samsung.com>  Sat, 30 Mar 2013 01:49:17 +0900
+
 wfi-direct-manager (0.6.13) precise; urgency=low
 
-  * Flush discovered peer data when starting new scan
+  * Fix bug N_SE-30232(Retry connection during 120 secs)
   * Git : framework/connectivity/wifi-direct-manager
   * Tag : wifi-direct-manager_0.6.13
 
index d705287..c53bd44 100755 (executable)
Binary files a/files/p2p_supplicant and b/files/p2p_supplicant differ
index 3acb7af..6374abe 100755 (executable)
@@ -33,7 +33,8 @@ int wfd_oem_connect(unsigned char mac_addr[6], wifi_direct_wps_type_e wps_config
 int wfd_oem_wps_pbc_start(unsigned char mac_addr[6]);
 int wfd_oem_wps_pin_start(unsigned char mac_addr[6]);
 int wfd_oem_disconnect(void);
-int wfd_oem_disconnect_sta(unsigned char mac_addr[6]); 
+int wfd_oem_disconnect_sta(unsigned char mac_addr[6]);
+int wfd_oem_reject_connection(unsigned char mac_addr[6]);
 bool wfd_oem_is_discovery_enabled(void);
 int wfd_oem_start_discovery(bool listen_only, int timeout);
 int wfd_oem_cancel_discovery(void);
@@ -83,6 +84,7 @@ struct wfd_oem_operations {
        int (*wfd_oem_wps_pin_start)(unsigned char mac_addr[6]);
        int (*wfd_oem_disconnect)(void);
        int (*wfd_oem_disconnect_sta)(unsigned char mac_addr[6]);
+       int (*wfd_oem_reject_connection) (unsigned char mac_addr[6]);
        bool (*wfd_oem_is_discovery_enabled)(void);
        int (*wfd_oem_start_discovery)(bool listen_only, int timeout);
        int (*wfd_oem_cancel_discovery)(void);
index 7d02bd5..b3535d3 100644 (file)
@@ -129,6 +129,17 @@ int wfd_oem_disconnect_sta(unsigned char mac_addr[6])
        return (g_ops->wfd_oem_disconnect_sta(mac_addr));
 }
 
+int wfd_oem_reject_connection(unsigned char mac_addr[6])
+{
+       if (NULL == g_ops->wfd_oem_reject_connection)
+       {
+               WDS_LOGE( "g_ops->wfd_oem_reject_connection is NULL!!\n");
+               return false;
+       }
+
+       return (g_ops->wfd_oem_reject_connection(mac_addr));
+}
+
 bool wfd_oem_is_discovery_enabled()
 {
        if (NULL == g_ops->wfd_oem_is_discovery_enabled)
index 2138706..51a117c 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       wifi-direct-manager
 Summary:    Wi-Fi Direct manger
-Version:    0.6.13
+Version:    0.6.14
 Release:    1
 Group:      TO_BE_FILLED
 License:    Apache License Version 2.0
index 09e4677..e527df4 100644 (file)
@@ -133,6 +133,7 @@ typedef void (*wfd_noti_cb) (int event_type);
 #define CMD_SEND_INVITE_REQ "P2P_INVITE"
 #define CMD_CREATE_GROUP "P2P_GROUP_ADD"
 #define CMD_CONNECT "P2P_CONNECT"
+#define CMD_REJECT "P2P_REJECT"
 #define CMD_PBC_STRING "pbc"
 #define CMD_DISPLAY_STRING "display"
 #define CMD_KEYPAD_STRING "keypad"
@@ -427,6 +428,7 @@ int wfd_ws_deactivate();
 int wfd_ws_connect(unsigned char mac_addr[6], wifi_direct_wps_type_e wps_config);
 int wfd_ws_disconnect();
 int wfd_ws_disconnect_sta(unsigned char mac_addr[6]);
+int wfd_ws_reject_connection(unsigned char mac_addr[6]);
 int wfd_ws_wps_pbc_start(unsigned char mac_addr[6]);
 int wfd_ws_wps_pin_start(unsigned char mac_addr[6]);
 bool wfd_ws_is_discovery_enabled();
index e6fa962..a3711f7 100644 (file)
@@ -71,6 +71,7 @@ static struct wfd_oem_operations supplicant_ops =
        .wfd_oem_wps_pin_start = wfd_ws_wps_pin_start,
        .wfd_oem_disconnect = wfd_ws_disconnect,
        .wfd_oem_disconnect_sta = wfd_ws_disconnect_sta,
+       .wfd_oem_reject_connection = wfd_ws_reject_connection,
        .wfd_oem_is_discovery_enabled = wfd_ws_is_discovery_enabled,
        .wfd_oem_start_discovery = wfd_ws_start_discovery,
        .wfd_oem_cancel_discovery = wfd_ws_cancel_discovery,
@@ -2646,7 +2647,6 @@ int wfd_ws_connect_for_persistent_group(unsigned char mac_addr[6], wifi_direct_w
 int wfd_ws_disconnect()
 {
        __WDP_LOG_FUNC_ENTER__;
-
        char cmd[32] = {0, };
        char res_buffer[1024]={0,};
        int res_buffer_len = sizeof(res_buffer);
@@ -2682,7 +2682,6 @@ int wfd_ws_disconnect()
 int wfd_ws_disconnect_sta(unsigned char mac_addr[6])
 {
        __WDP_LOG_FUNC_ENTER__;
-
        int result;
 
        result = wfd_ws_disconnect();
@@ -2691,6 +2690,38 @@ int wfd_ws_disconnect_sta(unsigned char mac_addr[6])
        return result;
 }
 
+int wfd_ws_reject_connection(unsigned char mac_addr[6])
+{
+       __WDP_LOG_FUNC_ENTER__;
+       char cmd[32] = {0, };
+       char res_buffer[1024]={0,};
+       int res_buffer_len = sizeof(res_buffer);
+       int result;
+
+       g_wps_event_block = 0;
+
+       snprintf(cmd, sizeof(cmd), "%s " MACSTR, CMD_REJECT, MAC2STR(mac_addr));
+       result = __send_wpa_request(g_control_sockfd, cmd, (char*)res_buffer, res_buffer_len);
+       WDP_LOGD("__send_wpa_request(P2P_REJECT) result=[%d]\n", result);
+       if (result < 0)
+       {
+               WDP_LOGE("__send_wpa_request FAILED!!\n");
+               __WDP_LOG_FUNC_EXIT__;
+               return false;
+       }
+
+       if ( (result == 0) || (strncmp(res_buffer, "FAIL", 4) == 0))
+       {
+               __WDP_LOG_FUNC_EXIT__;
+               return false;
+       }
+
+       WDP_LOGD("reject connection attempt by peer [" MACSTR "]", MAC2STR(mac_addr));
+
+       __WDP_LOG_FUNC_EXIT__;
+       return true;
+}
+
 bool wfd_ws_cancel()
 {
         __WDP_LOG_FUNC_ENTER__;
index e1247b8..6d153dc 100644 (file)
@@ -709,8 +709,11 @@ void wfd_server_process_client_request(wifi_direct_client_request_s * client_req
 
        case WIFI_DIRECT_CMD_DISCONNECT:
        {
-               wfd_local_connected_peer_info_t* peer = NULL;
+               // Response app first.
+               resp.result = WIFI_DIRECT_ERROR_NONE;
+               wfd_server_send_response(client->sync_sockfd, &resp, sizeof(wifi_direct_client_response_s));
 
+               wfd_local_connected_peer_info_t* peer = NULL;
                peer = wfd_server_get_connected_peer_by_device_mac(client_req->data.mac_addr);
 #if 0          
                if (peer == NULL)
@@ -722,10 +725,6 @@ void wfd_server_process_client_request(wifi_direct_client_request_s * client_req
                }
 #endif
 
-               // Response app first.
-               resp.result = WIFI_DIRECT_ERROR_NONE;
-               wfd_server_send_response(client->sync_sockfd, &resp, sizeof(wifi_direct_client_response_s));
-
                if (wfd_oem_is_groupowner() == TRUE)
                {
                        if (NULL == peer)
@@ -760,9 +759,14 @@ void wfd_server_process_client_request(wifi_direct_client_request_s * client_req
                }
                else
                {
+                       if (wfd_server->state < WIFI_DIRECT_STATE_CONNECTED) {
+                               ret = wfd_oem_reject_connection(client_req->data.mac_addr);
+                               ret = wfd_oem_connect(client_req->data.mac_addr, wfd_server->config_data.wps_config);
+                       } else {
+                               ret = wfd_oem_disconnect();
+                       }
                        wfd_server_set_state(WIFI_DIRECT_STATE_DISCONNECTING);
                
-                       ret = wfd_oem_disconnect();
                        if (ret)
                        {
                                wfd_server_remember_connecting_peer(client_req->data.mac_addr);
index d4460a3..2ee3488 100644 (file)
@@ -892,6 +892,7 @@ void wfd_server_process_event(wfd_event_t event)
                                                 MAC2STR(g_incomming_peer_mac_address));\r
 \r
                                __wfd_server_send_client_event(&noti);\r
+                               wfd_server->state = WIFI_DIRECT_STATE_CONNECTING;\r
                        }\r
                        break;\r
 \r
index 4cadcd0..09080d3 100644 (file)
@@ -390,15 +390,12 @@ static gboolean wfd_connection_timeout_cb(void *user_data)
        g_source_remove(wfd_server->connection_timer);
        wfd_server->connection_timer = 0;
        wfd_server->connecting_120 = 0;
+       wfd_oem_reject_connection(wfd_server->current_peer.mac_address);
 
        if (wfd_oem_is_groupowner())
-       {
                wfd_server_set_state(WIFI_DIRECT_STATE_GROUP_OWNER);
-       }
        else
-       {
                wfd_server_set_state(WIFI_DIRECT_STATE_ACTIVATED);
-       }
 
 #if 0
        // disconnect the peer to reset state.