]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
dbus: Add global capabilities property
authorDan Williams <dcbw@redhat.com>
Sat, 29 Sep 2012 16:06:30 +0000 (19:06 +0300)
committerJouni Malinen <j@w1.fi>
Sat, 29 Sep 2012 16:06:30 +0000 (19:06 +0300)
Otherwise it's difficult to determine if the supplicant was built with
CONFIG_AP, CONFIG_IBSS_RSN, CONFIG_P2P, etc. CONFIG_AP and CONFIG_P2P
can be inferred from the introspection data of the Interface object,
but CONFIG_IBSS_RSN does not change the introspection data at all and
thus it's impossible to determine whether the supplicant supports it
without knowing its compile-time options.

Signed-hostap: Dan Williams <dcbw@redhat.com>
intended-for: hostap-1

wpa_supplicant/dbus/dbus_new.c
wpa_supplicant/dbus/dbus_new_handlers.c
wpa_supplicant/dbus/dbus_new_handlers.h

index 4eeb93a4acca3e0b35f5f7b2f60c5bc3c52326ea..9e00e228226299289b87e05867bafac6f2c72812 100644 (file)
@@ -1950,6 +1950,10 @@ static const struct wpa_dbus_property_desc wpas_dbus_global_properties[] = {
          wpas_dbus_getter_eap_methods,
          NULL
        },
+       { "Capabilities", WPAS_DBUS_NEW_INTERFACE, "as",
+         wpas_dbus_getter_global_capabilities,
+         NULL
+       },
        { NULL, NULL, NULL, NULL, NULL }
 };
 
index 5668e1a1b06ee6aaadddd457342776f012cbd20f..00378beabb12ed3a6755f069309b159c10aac002 100644 (file)
@@ -924,6 +924,44 @@ dbus_bool_t wpas_dbus_getter_eap_methods(DBusMessageIter *iter,
 }
 
 
+/**
+ * wpas_dbus_getter_global_capabilities - Request supported global capabilities
+ * @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 "Capabilities" property. Handles requests by dbus clients to
+ * return a list of strings with supported capabilities like AP, RSN IBSS,
+ * and P2P that are determined at compile time.
+ */
+dbus_bool_t wpas_dbus_getter_global_capabilities(DBusMessageIter *iter,
+                                                DBusError *error,
+                                                void *user_data)
+{
+       const char *capabilities[5] = { NULL, NULL, NULL, NULL, NULL };
+       size_t num_items = 0;
+
+#ifdef CONFIG_AP
+       capabilities[num_items++] = "ap";
+#endif /* CONFIG_AP */
+#ifdef CONFIG_IBSS_RSN
+       capabilities[num_items++] = "ibss-rsn";
+#endif /* CONFIG_IBSS_RSN */
+#ifdef CONFIG_P2P
+       capabilities[num_items++] = "p2p";
+#endif /* CONFIG_P2P */
+#ifdef CONFIG_INTERWORKING
+       capabilities[num_items++] = "interworking";
+#endif /* CONFIG_INTERWORKING */
+
+       return wpas_dbus_simple_array_property_getter(iter,
+                                                     DBUS_TYPE_STRING,
+                                                     capabilities,
+                                                     num_items, error);
+}
+
+
 static int wpas_dbus_get_scan_type(DBusMessage *message, DBusMessageIter *var,
                                   char **type, DBusMessage **reply)
 {
index 178a76b7fb55bb719ecc9dd248bf55d3700a59d5..ea0944ed0a66498e2a19c171d0d2af40cce9ae2d 100644 (file)
@@ -80,6 +80,10 @@ dbus_bool_t wpas_dbus_getter_interfaces(DBusMessageIter *iter,
 dbus_bool_t wpas_dbus_getter_eap_methods(DBusMessageIter *iter,
                                         DBusError *error, void *user_data);
 
+dbus_bool_t wpas_dbus_getter_global_capabilities(DBusMessageIter *iter,
+                                                DBusError *error,
+                                                void *user_data);
+
 DBusMessage * wpas_dbus_handler_scan(DBusMessage *message,
                                     struct wpa_supplicant *wpa_s);