Add API to flush BSS 34/148834/1
authortaesub kim <taesub.kim@samsung.com>
Mon, 11 Sep 2017 04:33:23 +0000 (13:33 +0900)
committertaesub kim <taesub.kim@samsung.com>
Mon, 11 Sep 2017 04:33:30 +0000 (13:33 +0900)
Change-Id: I9153f1f28ee0e7a28c7f96a0472bdb03ab2f3a5f
Signed-off-by: Taesub Kim <taesub.kim@samsung.com>
CMakeLists.txt
include/wifi-bssid-scan.h [changed mode: 0644->0755]
include/wifi-extension.h [new file with mode: 0755]
interfaces/netconfig-iface-wifi.xml
resources/etc/dbus-1/system.d/net-config.conf
src/wifi-bssid-scan.c [changed mode: 0644->0755]
src/wifi-extension.c [new file with mode: 0755]
src/wifi.c

index c05f3fd..87477e0 100755 (executable)
@@ -39,6 +39,7 @@ SET(SRCS
        src/dbus/netsupplicant.c
        src/wifi-background-scan.c
        src/wifi-config.c
+       src/wifi-extension.c
        )
 
 IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
old mode 100644 (file)
new mode 100755 (executable)
diff --git a/include/wifi-extension.h b/include/wifi-extension.h
new file mode 100755 (executable)
index 0000000..e434b51
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Network Extension Module
+ *
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef __NETCONFIG_WIFI_EXTENSION_H__
+#define __NETCONFIG_WIFI_EXTENSION_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+gboolean handle_flush_bss(Wifi *wifi, GDBusMethodInvocation *context);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __NETCONFIG_WIFI_EXTENSION_H__ */
+
index e99123d..23dbabd 100755 (executable)
@@ -24,6 +24,8 @@
                </method>
                <method name="PauseBgscan">
                </method>
+               <method name="FlushBss">
+               </method>
                <method name="GetAutoscan">
                        <arg type="b" name="autoscan" direction="out"/>
                </method>
index b4454c3..a40e647 100755 (executable)
                <allow send_destination="net.netconfig" send_interface="net.netconfig.network" send_member="DevicePolicyGetWifi" />
                <allow send_destination="net.netconfig" send_interface="net.netconfig.network" send_member="DevicePolicyGetWifiProfile" />
 
+               <allow send_destination="net.netconfig" send_interface="net.netconfig.wifi" send_member="GetAutoscan" />
+               <allow send_destination="net.netconfig" send_interface="net.netconfig.wifi" send_member="GetAutoscanmode" />
+               <allow send_destination="net.netconfig" send_interface="net.netconfig.wifi" send_member="FlushBss" />
+
                <check send_destination="net.netconfig" send_interface="net.netconfig.network" send_member="AddRoute" privilege="http://tizen.org/privilege/network.set" />
                <check send_destination="net.netconfig" send_interface="net.netconfig.network" send_member="RemoveRoute" privilege="http://tizen.org/privilege/network.set" />
                <check send_destination="net.netconfig" send_interface="net.netconfig.network" send_member="EthernetCableState" privilege="http://tizen.org/privilege/network.get" />
old mode 100644 (file)
new mode 100755 (executable)
diff --git a/src/wifi-extension.c b/src/wifi-extension.c
new file mode 100755 (executable)
index 0000000..eaf1e75
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * Network Extension Module
+ *
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <errno.h>
+#include <vconf.h>
+#include <vconf-keys.h>
+
+#include "log.h"
+#include "util.h"
+#include "neterror.h"
+#include "netdbus.h"
+#include "netsupplicant.h"
+#include "wifi-state.h"
+#include "wifi-extension.h"
+
+
+gboolean handle_flush_bss(Wifi *wifi, GDBusMethodInvocation *context)
+{
+       DBG("Wi-Fi flush bss");
+
+       g_return_val_if_fail(wifi != NULL, FALSE);
+
+       GDBusConnection *connection = NULL;
+       const char *if_path = NULL;
+
+       if_path = netconfig_wifi_get_supplicant_interface();
+       if (if_path == NULL) {
+               netconfig_error_dbus_method_return(context, NETCONFIG_ERROR_INTERNAL, "FailFlushBss");
+               DBG("Fail to get wpa_supplicant DBus path");
+               return FALSE;
+       }
+
+       connection = netdbus_get_connection();
+       if (connection == NULL) {
+               netconfig_error_dbus_method_return(context, NETCONFIG_ERROR_INTERNAL, "FailFlushBss");
+               ERR("Failed to get netdbus connection");
+               return FALSE;
+       }
+
+
+       g_dbus_connection_call(connection,
+                       SUPPLICANT_SERVICE,
+                       if_path,
+                       SUPPLICANT_INTERFACE ".Interface",
+                       "FlushBSS",
+                       g_variant_new("(u)", 0),
+                       NULL,
+                       G_DBUS_CALL_FLAGS_NONE,
+                       10 * 1000,
+                       netdbus_get_cancellable(),
+                       NULL,
+                       NULL);
+
+       wifi_complete_flush_bss(wifi, context);
+       return TRUE;
+}
index b91ee3b..92376b0 100755 (executable)
@@ -41,6 +41,7 @@
 #include "wifi-background-scan.h"
 #include "wifi-config.h"
 #include "wifi-tdls.h"
+#include "wifi-extension.h"
 
 #define SPRD_CP2_FIRMWARE_PATH "/usr/bin/cp2-downloader"
 static int is_wifi_firmware_downloaded = FALSE;
@@ -205,6 +206,7 @@ void wifi_object_create_and_init(void)
                        G_CALLBACK(handle_set_config_field), NULL);
        g_signal_connect(wifi_object, "handle-get-config-passphrase",
                        G_CALLBACK(handle_get_config_passphrase), NULL);
+
        /* WIFI EAP configuration */
        g_signal_connect(wifi_object, "handle-save-eap-configuration",
                        G_CALLBACK(handle_save_eap_configuration), NULL);
@@ -219,12 +221,16 @@ void wifi_object_create_and_init(void)
        g_signal_connect(wifi_object, "handle-pause-bgscan",
                        G_CALLBACK(handle_pause_bgscan), NULL);
 
-       /*Auto Scan Mode */
+       /* Auto Scan Mode */
        g_signal_connect(wifi_object, "handle-get-autoscan",
                        G_CALLBACK(handle_get_autoscan), NULL);
        g_signal_connect(wifi_object, "handle-get-autoscanmode",
                        G_CALLBACK(handle_get_autoscanmode), NULL);
 
+       /* Extension API methods */
+       g_signal_connect(wifi_object, "handle-flush-bss",
+                       G_CALLBACK(handle_flush_bss), NULL);
+
        /* Passpoint */
        g_signal_connect(wifi_object, "handle-set-passpoint",
                                G_CALLBACK(handle_set_passpoint), NULL);