From: taesub kim Date: Mon, 11 Sep 2017 04:33:23 +0000 (+0900) Subject: Add API to flush BSS X-Git-Tag: accepted/tizen/4.0/unified/20170913.003044^0 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fconnectivity%2Fnet-config.git;a=commitdiff_plain;h=8cabf4573700915eb2a17ac634705d6a4b70a4f6 Add API to flush BSS Change-Id: I9153f1f28ee0e7a28c7f96a0472bdb03ab2f3a5f Signed-off-by: Taesub Kim --- diff --git a/CMakeLists.txt b/CMakeLists.txt index c05f3fd..87477e0 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 "") diff --git a/include/wifi-bssid-scan.h b/include/wifi-bssid-scan.h old mode 100644 new mode 100755 diff --git a/include/wifi-extension.h b/include/wifi-extension.h new file mode 100755 index 0000000..e434b51 --- /dev/null +++ b/include/wifi-extension.h @@ -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__ */ + diff --git a/interfaces/netconfig-iface-wifi.xml b/interfaces/netconfig-iface-wifi.xml index e99123d..23dbabd 100755 --- a/interfaces/netconfig-iface-wifi.xml +++ b/interfaces/netconfig-iface-wifi.xml @@ -24,6 +24,8 @@ + + diff --git a/resources/etc/dbus-1/system.d/net-config.conf b/resources/etc/dbus-1/system.d/net-config.conf index b4454c3..a40e647 100755 --- a/resources/etc/dbus-1/system.d/net-config.conf +++ b/resources/etc/dbus-1/system.d/net-config.conf @@ -17,6 +17,10 @@ + + + + diff --git a/src/wifi-bssid-scan.c b/src/wifi-bssid-scan.c old mode 100644 new mode 100755 diff --git a/src/wifi-extension.c b/src/wifi-extension.c new file mode 100755 index 0000000..eaf1e75 --- /dev/null +++ b/src/wifi-extension.c @@ -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 +#include +#include +#include +#include +#include + +#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; +} diff --git a/src/wifi.c b/src/wifi.c index b91ee3b..92376b0 100755 --- a/src/wifi.c +++ b/src/wifi.c @@ -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);