[RFC PATCH 4/8] iwd: Add nm_iwd_manager_forget_network API
- From: Andrew Zaborowski <andrew zaborowski intel com>
- To: networkmanager-list gnome org
- Subject: [RFC PATCH 4/8] iwd: Add nm_iwd_manager_forget_network API
- Date: Tue, 12 Jun 2018 10:21:38 +0200
Add a function that maps to the
net.connman.iwd.KnownNetworks.ForgetNetwork DBus call and causes an IWD
Known Network to be forgotten with its config file removed.
---
src/devices/wifi/nm-iwd-manager.c | 36 ++++++++++++++++++++++++++++++++++++
src/devices/wifi/nm-iwd-manager.h | 2 ++
2 files changed, 38 insertions(+)
diff --git a/src/devices/wifi/nm-iwd-manager.c b/src/devices/wifi/nm-iwd-manager.c
index 8897f43a4..d785c1100 100644
--- a/src/devices/wifi/nm-iwd-manager.c
+++ b/src/devices/wifi/nm-iwd-manager.c
@@ -639,6 +639,42 @@ nm_iwd_manager_network_connected (NMIwdManager *self, const gchar *name,
g_signal_emit (self, signals[KNOWN_NETWORKS_CHANGED], 0, priv->known_networks);
}
+void
+nm_iwd_manager_forget_network (NMIwdManager *self, const gchar *name,
+ NMIwdNetworkSecurity security)
+{
+ NMIwdManagerPrivate *priv = NM_IWD_MANAGER_GET_PRIVATE (self);
+ gs_unref_object GDBusInterface *known_networks_if = NULL;
+ const char *security_str =
+ security == NM_IWD_NETWORK_SECURITY_NONE ? "open" :
+ security == NM_IWD_NETWORK_SECURITY_PSK ? "psk" : "8021x";
+ const GSList *iter;
+
+ known_networks_if = g_dbus_object_manager_get_interface (priv->object_manager,
+ "/",
+ NM_IWD_KNOWN_NETWORKS_INTERFACE);
+
+ g_dbus_proxy_call (G_DBUS_PROXY (known_networks_if),
+ "ForgetNetwork",
+ g_variant_new ("(ss)", name, security_str),
+ G_DBUS_CALL_FLAGS_NONE, -1,
+ NULL, NULL, NULL);
+
+ g_object_unref (known_networks_if);
+
+ for (iter = priv->known_networks; iter; iter = g_slist_next (iter)) {
+ const NMIwdKnownNetworkData *network = iter->data;
+
+ if (strcmp (network->name, name) || network->security != security)
+ continue;
+
+ priv->known_networks = g_slist_remove (priv->known_networks, network);
+ break;
+ }
+
+ g_signal_emit (self, signals[KNOWN_NETWORKS_CHANGED], 0, priv->known_networks);
+}
+
/*****************************************************************************/
NM_DEFINE_SINGLETON_GETTER (NMIwdManager, nm_iwd_manager_get,
diff --git a/src/devices/wifi/nm-iwd-manager.h b/src/devices/wifi/nm-iwd-manager.h
index 96b5e2c26..a4491286e 100644
--- a/src/devices/wifi/nm-iwd-manager.h
+++ b/src/devices/wifi/nm-iwd-manager.h
@@ -69,5 +69,7 @@ gboolean nm_iwd_manager_is_known_network (NMIwdManager *self, const gchar *name,
NMIwdNetworkSecurity security);
void nm_iwd_manager_network_connected (NMIwdManager *self, const gchar *name,
NMIwdNetworkSecurity security);
+void nm_iwd_manager_forget_network (NMIwdManager *self, const gchar *name,
+ NMIwdNetworkSecurity security);
#endif /* __NETWORKMANAGER_IWD_MANAGER_H__ */
--
2.14.1
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]