Add support for managing access list API 10/17410/1
authorJiung Yu <jiung.yu@samsung.com>
Fri, 7 Mar 2014 01:07:34 +0000 (10:07 +0900)
committerJiung Yu <jiung.yu@samsung.com>
Fri, 7 Mar 2014 01:08:17 +0000 (10:08 +0900)
Change-Id: I821ca2af62e61895ef84e6aeddb9a2608d811103
Signed-off-by: Yu jiung <jiung.yu@samsung.com>
include/wifi-direct-internal.h
include/wifi-direct.h
packaging/libwifi-direct.changes
packaging/libwifi-direct.spec
src/wifi-direct-client-proxy.c

index 8f8cdc7..ad76139 100644 (file)
@@ -146,6 +146,9 @@ typedef enum
        WIFI_DIRECT_CMD_GET_DISPLAY_PORT,
        WIFI_DIRECT_CMD_GET_DISPLAY_TYPE,
 
+       WIFI_DIRECT_CMD_ADD_TO_ACCESS_LIST,
+       WIFI_DIRECT_CMD_DEL_FROM_ACCESS_LIST,
+
        WIFI_DIRECT_CMD_MAX
 } wifi_direct_cmd_e;
 
index d455d03..c67f02f 100644 (file)
@@ -2995,11 +2995,11 @@ int wifi_direct_init_wifi_display(wifi_direct_display_type_e type, int port, int
 int wifi_direct_deinit_wifi_display(void);
 
 /*****************************************************************************************/
-/* wifi_direct_service_del API function prototype
+/* wifi_direct_get_display_port API function prototype
  * int wifi_direct_get_display_port(int *port)
  */
 /**
- * \brief This API shall delete the service user expects. \n
+ * \brief This API shall get wifi display port. \n
  * @param port              TCP control port of this wifi direct diplay device. Application had enabled the wifi direct display before use this function.
  *
  * \see wifi_direct_init_wifi_display.
@@ -3041,12 +3041,12 @@ int wifi_direct_deinit_wifi_display(void);
 int wifi_direct_get_display_port(int *port);
 
 /*****************************************************************************************/
-/* wifi_direct_service_del API function prototype
+/* wifi_direct_get_display_type API function prototype
  * int wifi_direct_get_display_type(wifi_direct_display_type *type)
  */
 /**
- * \brief This API shall delete the service user expects. \n
- * @param handle              wifi direct display type of this device. Application had enabled the wifi direct display before use this function.
+ * \brief This API shall get wifi display type. \n
+ * @param type              wifi direct display type of this device. Application had enabled the wifi direct display before use this function.
  *
  * \see wifi_direct_init_wifi_display.
  * \see wifi_direct_deinit_wifi_display.
@@ -3086,6 +3086,95 @@ int wifi_direct_get_display_port(int *port);
  ******************************************************************************/
 int wifi_direct_get_display_type(wifi_direct_display_type_e *type);
 
+/*****************************************************************************************/
+/* wifi_direct_add_to_access_list API function prototype
+ * int wifi_direct_add_to_access_list(const char *mac_address, bool allow)
+ */
+/**
+ * \brief This API shall add device to list to automatically allow or deny connection request. \n
+ * @param mac_address              device mac address to add device list.
+ * @param allow                                                allow or deny flag.
+ *
+ * \see wifi_direct_del_from_access_list.
+ *
+ * \par Sync (or) Async:
+ * This is a Synchronous API.
+ *
+ * \warning
+ *  None
+ *
+ *
+ * \return Return Type (int) \n
+ *     WIFI_DIRECT_ERROR_NONE on Success \n
+ *     WIFI_DIRECT_ERROR_NOT_PERMITTED  for Operation not permitted \n
+ *     WIFI_DIRECT_ERROR_OUT_OF_MEMORY  for Out of memory \n
+ *     WIFI_DIRECT_ERROR_RESOURCE_BUSY  for Device or resource busy \n
+ *     WIFI_DIRECT_ERROR_INVALID_PARAMETER for Invalid function parameter \n
+ *     WIFI_DIRECT_ERROR_CONNECTION_TIME_OUT for Connection timed out \n
+ *     WIFI_DIRECT_ERROR_NOT_INITIALIZED Not for initialized \n
+ *     WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for I/O error \n
+ *     WIFI_DIRECT_ERROR_WIFI_USED for WiFi is being used \n
+ *     WIFI_DIRECT_ERROR_MOBILE_AP_USED for Mobile AP is being used \n
+ *     WIFI_DIRECT_ERROR_CONNECTION_FAILED for Connection failed \n
+ *     WIFI_DIRECT_ERROR_AUTH_FAILED for Authentication failed \n
+ *     WIFI_DIRECT_ERROR_OPERATION_FAILED for Operation failed \n
+ *     WIFI_DIRECT_ERROR_TOO_MANY_CLIENT for Too many client \n
+ *     WIFI_DIRECT_ERROR_ALREADY_INITIALIZED for Already initialized client \n
+ *     WIFI_DIRECT_ERROR_CONNECTION_CANCELED \n
+ *
+ *
+ *
+ *\endcode
+ *
+ *\remarks None.
+ *
+ ******************************************************************************/
+int wifi_direct_add_to_access_list(const char *mac_address, bool allow);
+
+/*****************************************************************************************/
+/* wifi_direct_del_from_access_list API function prototype
+ * int wifi_direct_del_from_access_list(const char *mac_address, bool allow)
+ */
+/**
+ * \brief This API shall add device to list to automatically allow or deny connection request. \n
+ * @param mac_address              device mac address to delete from list.
+ *
+ * \see wifi_direct_add_to_access_list.
+ *
+ * \par Sync (or) Async:
+ * This is a Synchronous API.
+ *
+ * \warning
+ *  None
+ *
+ *
+ * \return Return Type (int) \n
+ *     WIFI_DIRECT_ERROR_NONE on Success \n
+ *     WIFI_DIRECT_ERROR_NOT_PERMITTED  for Operation not permitted \n
+ *     WIFI_DIRECT_ERROR_OUT_OF_MEMORY  for Out of memory \n
+ *     WIFI_DIRECT_ERROR_RESOURCE_BUSY  for Device or resource busy \n
+ *     WIFI_DIRECT_ERROR_INVALID_PARAMETER for Invalid function parameter \n
+ *     WIFI_DIRECT_ERROR_CONNECTION_TIME_OUT for Connection timed out \n
+ *     WIFI_DIRECT_ERROR_NOT_INITIALIZED Not for initialized \n
+ *     WIFI_DIRECT_ERROR_COMMUNICATION_FAILED for I/O error \n
+ *     WIFI_DIRECT_ERROR_WIFI_USED for WiFi is being used \n
+ *     WIFI_DIRECT_ERROR_MOBILE_AP_USED for Mobile AP is being used \n
+ *     WIFI_DIRECT_ERROR_CONNECTION_FAILED for Connection failed \n
+ *     WIFI_DIRECT_ERROR_AUTH_FAILED for Authentication failed \n
+ *     WIFI_DIRECT_ERROR_OPERATION_FAILED for Operation failed \n
+ *     WIFI_DIRECT_ERROR_TOO_MANY_CLIENT for Too many client \n
+ *     WIFI_DIRECT_ERROR_ALREADY_INITIALIZED for Already initialized client \n
+ *     WIFI_DIRECT_ERROR_CONNECTION_CANCELED \n
+ *
+ *
+ *
+ *\endcode
+ *
+ *\remarks None.
+ *
+ ******************************************************************************/
+int wifi_direct_del_from_access_list(const char *mac_address);
+
 /**
  * @}
  */
index 09631a2..e89ce5f 100644 (file)
@@ -1,3 +1,6 @@
+* Fri, 07  Mar 2014 Jiung Yu <jiung.yu@samsung.com> (1.0.9)
+  - Add support for managing access list API
+
 * Thu, 13 Feb 2014 Jiung Yu <jiung.yu@samsung.com> (1.0.8)
   - Add support for Wifi Direct Display API and data structure
 
index 4e3e397..0d15bea 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libwifi-direct
 Summary:    Wifi Direct Library
-Version:    1.0.8
+Version:    1.0.9
 Release:    1
 Group:      Network & Connectivity/Wireless 
 License:    Apache-2.0
index 675adcc..f7ba1d4 100644 (file)
@@ -431,6 +431,10 @@ char *__wfd_client_print_cmd(wifi_direct_cmd_e cmd)
                return "WIFI_DIRECT_CMD_GET_DISPLAY_PORT";
        case WIFI_DIRECT_CMD_GET_DISPLAY_TYPE:
                return "WIFI_DIRECT_CMD_GET_DISPLAY_TYPE";
+       case WIFI_DIRECT_CMD_ADD_TO_ACCESS_LIST:
+               return "WIFI_DIRECT_CMD_ADD_TO_ACCESS_LIST";
+       case WIFI_DIRECT_CMD_DEL_FROM_ACCESS_LIST:
+               return "WIFI_DIRECT_CMD_DEL_FROM_ACCESS_LIST";
        default:
                return "WIFI_DIRECT_CMD_INVALID";
 
@@ -4212,7 +4216,7 @@ int wifi_direct_get_display_port(int *port)
                __WDC_LOG_FUNC_END__;
                return res;
        }
-       WDC_LOGD("wifi_direct_is_autoconnection_mode() SUCCESS");
+       WDC_LOGD("wifi_direct_get_display_port() SUCCESS");
        *port = (int) rsp.param1;
 
        __WDC_LOG_FUNC_END__;
@@ -4251,10 +4255,93 @@ int wifi_direct_get_display_type(wifi_direct_display_type_e *type)
                __WDC_LOG_FUNC_END__;
                return res;
        }
-       WDC_LOGD("wifi_direct_is_autoconnection_mode() SUCCESS");
+       WDC_LOGD("wifi_direct_get_display_type() SUCCESS");
        *type = (wifi_direct_display_type_e) rsp.param1;
 
        __WDC_LOG_FUNC_END__;
        return WIFI_DIRECT_ERROR_NONE;
 }
 
+int wifi_direct_add_to_access_list(const char *mac_address, bool allow)
+{
+       __WDC_LOG_FUNC_START__;
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+       unsigned char la_mac_addr[6];
+       wifi_direct_client_request_s req;
+       wifi_direct_client_response_s rsp;
+       int res = WIFI_DIRECT_ERROR_NONE;
+
+       if ((client_info->is_registered == false) ||
+                       (client_info->client_id == WFD_INVALID_ID)) {
+               WDC_LOGE("Client is NOT registered");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       if (!mac_address) {
+               WDC_LOGE("mac_addr is NULL");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
+       }
+
+       memset(&req, 0, sizeof(wifi_direct_client_request_s));
+       memset(&rsp, 0, sizeof(wifi_direct_client_response_s));
+
+       req.cmd = WIFI_DIRECT_CMD_ADD_TO_ACCESS_LIST;
+       req.client_id = client_info->client_id;
+       req.data.int1 = allow;
+       macaddr_atoe(mac_address, la_mac_addr);
+       memcpy(req.data.mac_addr, la_mac_addr, MACADDR_LEN);
+
+       res = __wfd_client_send_request(client_info->sync_sockfd, &req, &rsp);
+       if (res != WIFI_DIRECT_ERROR_NONE) {
+               __WDC_LOG_FUNC_END__;
+               return res;
+       }
+       WDC_LOGD("wifi_direct_add_device_to_list() SUCCESS");
+
+       __WDC_LOG_FUNC_END__;
+       return WIFI_DIRECT_ERROR_NONE;
+}
+
+int wifi_direct_del_from_access_list(const char *mac_address)
+{
+       __WDC_LOG_FUNC_START__;
+       wifi_direct_client_info_s *client_info = __wfd_get_control();
+       unsigned char la_mac_addr[6];
+       wifi_direct_client_request_s req;
+       wifi_direct_client_response_s rsp;
+       int res = WIFI_DIRECT_ERROR_NONE;
+
+       if ((client_info->is_registered == false) ||
+                       (client_info->client_id == WFD_INVALID_ID)) {
+               WDC_LOGE("Client is NOT registered");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       if (!mac_address) {
+               WDC_LOGE("mac_addr is NULL");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_INVALID_PARAMETER;
+       }
+
+       memset(&req, 0, sizeof(wifi_direct_client_request_s));
+       memset(&rsp, 0, sizeof(wifi_direct_client_response_s));
+
+       req.cmd = WIFI_DIRECT_CMD_DEL_FROM_ACCESS_LIST;
+       req.client_id = client_info->client_id;
+       macaddr_atoe(mac_address, la_mac_addr);
+       memcpy(req.data.mac_addr, la_mac_addr, MACADDR_LEN);
+
+       res = __wfd_client_send_request(client_info->sync_sockfd, &req, &rsp);
+       if (res != WIFI_DIRECT_ERROR_NONE) {
+               __WDC_LOG_FUNC_END__;
+               return res;
+       }
+       WDC_LOGD("wifi_direct_del_device_from_list() SUCCESS");
+
+       __WDC_LOG_FUNC_END__;
+       return WIFI_DIRECT_ERROR_NONE;
+}
+