D-Bus: Add ConfigFile parameter into the interface properties
authorJose Blanquicet <blanquicet@gmail.com>
Tue, 23 Aug 2016 12:16:00 +0000 (14:16 +0200)
committerJouni Malinen <j@w1.fi>
Mon, 29 Aug 2016 08:43:53 +0000 (11:43 +0300)
This patch aims to expose the configuration file path as an interface
property, like is done with the driver and the bridge name. Doing so,
higher layer programs become responsible to recreate interfaces with the
correct configuration file path when programs need to remove them.

Signed-off-by: Jose Blanquicet <blanquicet@gmail.com>
doc/dbus.doxygen
wpa_supplicant/dbus/dbus_new.c
wpa_supplicant/dbus/dbus_new_handlers.c
wpa_supplicant/dbus/dbus_new_handlers.h

index e6c70f9..b0e67d4 100644 (file)
@@ -681,6 +681,11 @@ fi.w1.wpa_supplicant1.CreateInterface.
       </li>
 
       <li>
+       <h3>ConfigFile - s - (read)</h3>
+       <p>Configuration file path. Returns an empty string if no configuration file is in use.</p>
+      </li>
+
+      <li>
        <h3>CurrentBSS - o - (read)</h3>
        <p>Path to D-Bus object representing BSS which wpa_supplicant is associated with, or "/" if is not associated at all.</p>
       </li>
index 6d73bbc..27b3012 100644 (file)
@@ -3158,6 +3158,11 @@ static const struct wpa_dbus_property_desc wpas_dbus_interface_properties[] = {
          NULL,
          NULL
        },
+       { "ConfigFile", WPAS_DBUS_NEW_IFACE_INTERFACE, "s",
+         wpas_dbus_getter_config_file,
+         NULL,
+         NULL
+       },
        { "CurrentBSS", WPAS_DBUS_NEW_IFACE_INTERFACE, "o",
          wpas_dbus_getter_current_bss,
          NULL,
index f185f27..e11dd36 100644 (file)
@@ -3240,6 +3240,30 @@ dbus_bool_t wpas_dbus_getter_bridge_ifname(
 
 
 /**
+ * wpas_dbus_getter_config_file - Get interface configuration file path
+ * @iter: Pointer to incoming dbus message iter
+ * @error: Location to store error on failure
+ * @user_data: Function specific data
+ * Returns: TRUE on success, FALSE on failure
+ *
+ * Getter for "ConfigFile" property.
+ */
+dbus_bool_t wpas_dbus_getter_config_file(
+       const struct wpa_dbus_property_desc *property_desc,
+       DBusMessageIter *iter, DBusError *error, void *user_data)
+{
+       struct wpa_supplicant *wpa_s = user_data;
+       char *confname = "";
+
+       if (wpa_s->confname)
+               confname = wpa_s->confname;
+
+       return wpas_dbus_simple_property_getter(iter, DBUS_TYPE_STRING,
+                                               &confname, error);
+}
+
+
+/**
  * wpas_dbus_getter_bsss - Get array of BSSs objects
  * @iter: Pointer to incoming dbus message iter
  * @error: Location to store error on failure
index cd299c0..1d6235d 100644 (file)
@@ -150,6 +150,7 @@ DECLARE_ACCESSOR(wpas_dbus_setter_scan_interval);
 DECLARE_ACCESSOR(wpas_dbus_getter_ifname);
 DECLARE_ACCESSOR(wpas_dbus_getter_driver);
 DECLARE_ACCESSOR(wpas_dbus_getter_bridge_ifname);
+DECLARE_ACCESSOR(wpas_dbus_getter_config_file);
 DECLARE_ACCESSOR(wpas_dbus_getter_current_bss);
 DECLARE_ACCESSOR(wpas_dbus_getter_current_network);
 DECLARE_ACCESSOR(wpas_dbus_getter_current_auth_mode);