summaryrefslogtreecommitdiff
path: root/gsupplicant
diff options
context:
space:
mode:
authorTomasz Bursztyka <tomasz.bursztyka@linux.intel.com>2012-04-20 12:18:35 (GMT)
committerPatrik Flykt <patrik.flykt@linux.intel.com>2012-04-23 07:49:42 (GMT)
commit86c198cbb20d75d774c694ebd735133a962be601 (patch)
treee706b2f6d684ecfa5b4547e130ab0c711818c048 /gsupplicant
parent26694acdacf8fc5e402bea044bd166677531c423 (diff)
downloadconnman-86c198cbb20d75d774c694ebd735133a962be601.zip
connman-86c198cbb20d75d774c694ebd735133a962be601.tar.gz
connman-86c198cbb20d75d774c694ebd735133a962be601.tar.bz2
gsupplicant: Add WPS specific capabilities handling for network
Diffstat (limited to 'gsupplicant')
-rw-r--r--gsupplicant/gsupplicant.h3
-rw-r--r--gsupplicant/supplicant.c39
2 files changed, 41 insertions, 1 deletions
diff --git a/gsupplicant/gsupplicant.h b/gsupplicant/gsupplicant.h
index d5f5a29..7e79050 100644
--- a/gsupplicant/gsupplicant.h
+++ b/gsupplicant/gsupplicant.h
@@ -226,6 +226,9 @@ const char *g_supplicant_network_get_security(GSupplicantNetwork *network);
dbus_int16_t g_supplicant_network_get_signal(GSupplicantNetwork *network);
dbus_uint16_t g_supplicant_network_get_frequency(GSupplicantNetwork *network);
dbus_bool_t g_supplicant_network_get_wps(GSupplicantNetwork *network);
+dbus_bool_t g_supplicant_network_is_wps_active(GSupplicantNetwork *network);
+dbus_bool_t g_supplicant_network_is_wps_pbc(GSupplicantNetwork *network);
+dbus_bool_t g_supplicant_network_is_wps_advertizing(GSupplicantNetwork *network);
struct _GSupplicantCallbacks {
void (*system_ready) (void);
diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c
index b44ea69..25a88af 100644
--- a/gsupplicant/supplicant.c
+++ b/gsupplicant/supplicant.c
@@ -204,6 +204,7 @@ struct _GSupplicantNetwork {
GSupplicantMode mode;
GSupplicantSecurity security;
dbus_bool_t wps;
+ unsigned int wps_capabilities;
GHashTable *bss_table;
GHashTable *config_table;
};
@@ -860,6 +861,39 @@ dbus_bool_t g_supplicant_network_get_wps(GSupplicantNetwork *network)
return network->wps;
}
+dbus_bool_t g_supplicant_network_is_wps_active(GSupplicantNetwork *network)
+{
+ if (network == NULL)
+ return FALSE;
+
+ if (network->wps_capabilities & G_SUPPLICANT_WPS_CONFIGURED)
+ return TRUE;
+
+ return FALSE;
+}
+
+dbus_bool_t g_supplicant_network_is_wps_pbc(GSupplicantNetwork *network)
+{
+ if (network == NULL)
+ return FALSE;
+
+ if (network->wps_capabilities & G_SUPPLICANT_WPS_PBC)
+ return TRUE;
+
+ return FALSE;
+}
+
+dbus_bool_t g_supplicant_network_is_wps_advertizing(GSupplicantNetwork *network)
+{
+ if (network == NULL)
+ return FALSE;
+
+ if (network->wps_capabilities & G_SUPPLICANT_WPS_REGISTRAR)
+ return TRUE;
+
+ return FALSE;
+}
+
static void merge_network(GSupplicantNetwork *network)
{
GString *str;
@@ -1098,9 +1132,12 @@ static void add_bss_to_network(struct g_supplicant_bss *bss)
network->best_bss = bss;
network->wps = FALSE;
- if ((bss->keymgmt & G_SUPPLICANT_KEYMGMT_WPS) != 0)
+ if ((bss->keymgmt & G_SUPPLICANT_KEYMGMT_WPS) != 0) {
network->wps = TRUE;
+ network->wps_capabilities |= bss->wps_capabilities;
+ }
+
network->bss_table = g_hash_table_new_full(g_str_hash, g_str_equal,
NULL, remove_bss);