summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiraj Kumar Goit <niraj.g@samsung.com>2017-08-04 14:27:34 (GMT)
committerNiraj Kumar Goit <niraj.g@samsung.com>2017-08-09 04:55:38 (GMT)
commit49768e3fb3623e93dce860fca8469cde51902851 (patch)
treeb20896525f73391c79b97dfb9abb4130a5be10e6
parentfd3573b27dcecd10afaaabada6892a0e65974e44 (diff)
downloadconnman-49768e3fb3623e93dce860fca8469cde51902851.zip
connman-49768e3fb3623e93dce860fca8469cde51902851.tar.gz
connman-49768e3fb3623e93dce860fca8469cde51902851.tar.bz2
Change-Id: I560be68a876a5fef516647365db3c56761f2aba1 Signed-off-by: Niraj Kumar Goit <niraj.g@samsung.com>
-rwxr-xr-xgsupplicant/gsupplicant.h2
-rwxr-xr-xgsupplicant/supplicant.c53
-rwxr-xr-xplugins/wifi.c13
-rwxr-xr-xsrc/connman.h4
-rwxr-xr-xsrc/manager.c29
-rwxr-xr-xsrc/network.c27
-rwxr-xr-xsrc/service.c47
7 files changed, 173 insertions, 2 deletions
diff --git a/gsupplicant/gsupplicant.h b/gsupplicant/gsupplicant.h
index fe693cd..f115c5e 100755
--- a/gsupplicant/gsupplicant.h
+++ b/gsupplicant/gsupplicant.h
@@ -377,6 +377,8 @@ const char *g_supplicant_network_get_eap(GSupplicantNetwork *network);
const char *g_supplicant_network_get_identity(GSupplicantNetwork *network);
const char *g_supplicant_network_get_phase2(GSupplicantNetwork *network);
unsigned int g_supplicant_network_get_keymgmt(GSupplicantNetwork *network);
+const void *g_supplicant_network_get_wifi_vsie(GSupplicantNetwork *network,
+ unsigned int *wifi_vsie_len);
#endif
struct _GSupplicantCallbacks {
diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c
index 1c19771..0d5ff3b 100755
--- a/gsupplicant/supplicant.c
+++ b/gsupplicant/supplicant.c
@@ -211,6 +211,8 @@ struct g_supplicant_bss {
#if defined TIZEN_EXT
dbus_bool_t ft_psk;
dbus_bool_t ft_ieee8021x;
+ char *wifi_vsie;
+ unsigned int wifi_vsie_len;
#endif
unsigned int wps_capabilities;
};
@@ -237,6 +239,8 @@ struct _GSupplicantNetwork {
char *identity;
char *phase2;
unsigned int keymgmt;
+ char *wifi_vsie;
+ unsigned int wifi_vsie_len;
#endif
};
@@ -641,6 +645,10 @@ static void remove_network(gpointer data)
g_free(network->identity);
g_free(network->phase2);
#endif
+#if defined TIZEN_EXT
+ g_free(network->wifi_vsie);
+#endif
+
g_free(network);
}
@@ -649,6 +657,9 @@ static void remove_bss(gpointer data)
struct g_supplicant_bss *bss = data;
g_free(bss->path);
+#if defined TIZEN_EXT
+ g_free(bss->wifi_vsie);
+#endif
g_free(bss);
}
@@ -1345,6 +1356,17 @@ bool g_supplicant_network_get_rsn_mode(GSupplicantNetwork *network)
return false;
}
+const void *g_supplicant_network_get_wifi_vsie(GSupplicantNetwork *network,
+ unsigned int *wifi_vsie_len)
+{
+ if (!network) {
+ *wifi_vsie_len = 0;
+ return NULL;
+ }
+
+ *wifi_vsie_len = network->wifi_vsie_len;
+ return network->wifi_vsie;
+}
#endif
static void merge_network(GSupplicantNetwork *network)
@@ -1639,6 +1661,17 @@ static void add_or_replace_bss_to_network(struct g_supplicant_bss *bss)
#if defined TIZEN_EXT
network->keymgmt = bss->keymgmt;
+
+ if (bss->wifi_vsie_len > 0) {
+ SUPPLICANT_DBG("vsie len: %d", bss->wifi_vsie_len);
+ network->wifi_vsie = (char *)g_try_malloc0(bss->wifi_vsie_len);
+ if(network->wifi_vsie) {
+ network->wifi_vsie_len = bss->wifi_vsie_len;
+ memcpy(network->wifi_vsie, bss->wifi_vsie, network->wifi_vsie_len);
+ } else {
+ SUPPLICANT_DBG("Failed to allocate memory for wifi_vsie");
+ }
+ }
#endif
SUPPLICANT_DBG("New network %s created", network->name);
@@ -1818,6 +1851,9 @@ static void bss_process_ies(DBusMessageIter *iter, void *user_data)
{
struct g_supplicant_bss *bss = user_data;
const unsigned char WPS_OUI[] = { 0x00, 0x50, 0xf2, 0x04 };
+#if defined TIZEN_EXT
+ const unsigned char WIFI_OUI[] = {0x00, 0x16, 0x32};
+#endif
unsigned char *ie, *ie_end;
DBusMessageIter array;
unsigned int value;
@@ -1833,6 +1869,9 @@ static void bss_process_ies(DBusMessageIter *iter, void *user_data)
#define WPS_PBC 0x04
#define WPS_PIN 0x00
#define WPS_CONFIGURED 0x02
+#if defined TIZEN_EXT
+#define VENDOR_SPECIFIC_INFO 0xDD
+#endif
dbus_message_iter_recurse(iter, &array);
dbus_message_iter_get_fixed_array(&array, &ie, &ie_len);
@@ -1845,7 +1884,19 @@ static void bss_process_ies(DBusMessageIter *iter, void *user_data)
for (ie_end = ie + ie_len; ie < ie_end && ie + ie[1] + 1 <= ie_end;
ie += ie[1] + 2) {
-
+#if defined TIZEN_EXT
+ if((ie[0] == VENDOR_SPECIFIC_INFO) && (memcmp(ie+2, WIFI_OUI, sizeof(WIFI_OUI)) == 0)) {
+ SUPPLICANT_DBG("IE: match WIFI_OUI");
+ bss->wifi_vsie = (char *)g_try_malloc0(ie[1] + 2); // tag number size(1), tag length size(1)
+ if (bss->wifi_vsie) {
+ bss->wifi_vsie_len = ie[1] + 2;
+ memcpy(bss->wifi_vsie, ie, bss->wifi_vsie_len);
+ } else {
+ SUPPLICANT_DBG("Failed to allocate memory for wifi_vsie");
+ }
+ continue;
+ }
+#endif
if (ie[0] != WMM_WPA1_WPS_INFO || ie[1] < WPS_INFO_MIN_LEN ||
memcmp(ie+2, WPS_OUI, sizeof(WPS_OUI)) != 0)
continue;
diff --git a/plugins/wifi.c b/plugins/wifi.c
index fd046e9..2471141 100755
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -2928,6 +2928,11 @@ static void network_added(GSupplicantNetwork *supplicant_network)
bool wps_ready;
bool wps_advertizing;
+#if defined TIZEN_EXT
+ const char *wifi_vsie;
+ unsigned int wifi_vsie_len;
+#endif
+
mode = g_supplicant_network_get_mode(supplicant_network);
identifier = g_supplicant_network_get_identifier(supplicant_network);
@@ -2952,6 +2957,9 @@ static void network_added(GSupplicantNetwork *supplicant_network)
ssid = g_supplicant_network_get_ssid(supplicant_network, &ssid_len);
+#if defined TIZEN_EXT
+ wifi_vsie = g_supplicant_network_get_wifi_vsie(supplicant_network, &wifi_vsie_len);
+#endif
network = connman_device_get_network(wifi->device, identifier);
if (!network) {
@@ -2975,6 +2983,11 @@ static void network_added(GSupplicantNetwork *supplicant_network)
connman_network_set_blob(network, "WiFi.SSID",
ssid, ssid_len);
+#if defined TIZEN_EXT
+ if(wifi_vsie_len > 0 && wifi_vsie)
+ connman_network_set_blob(network, "WiFi.Vsie",
+ wifi_vsie, wifi_vsie_len);
+#endif
connman_network_set_string(network, "WiFi.Security", security);
connman_network_set_strength(network,
calculate_strength(supplicant_network));
diff --git a/src/connman.h b/src/connman.h
index 237c1ec..dcd8c7f 100755
--- a/src/connman.h
+++ b/src/connman.h
@@ -917,6 +917,10 @@ int __connman_rtnl_init(void);
void __connman_rtnl_start(void);
void __connman_rtnl_cleanup(void);
+#if defined TIZEN_EXT
+void __connman_wifi_vsie_list_struct(DBusMessageIter *iter);
+#endif
+
enum connman_device_type __connman_rtnl_get_device_type(int index);
unsigned int __connman_rtnl_update_interval_add(unsigned int interval);
unsigned int __connman_rtnl_update_interval_remove(unsigned int interval);
diff --git a/src/manager.c b/src/manager.c
index 32705e4..622ed59 100755
--- a/src/manager.c
+++ b/src/manager.c
@@ -34,6 +34,30 @@
static bool connman_state_idle;
static dbus_bool_t sessionmode;
+#if defined TIZEN_EXT
+static void append_wifi_vsies_structs(DBusMessageIter *iter, void *user_data)
+{
+ __connman_wifi_vsie_list_struct(iter);
+}
+
+static DBusMessage *get_wifi_vsies(DBusConnection *conn,
+ DBusMessage *msg, void *data)
+{
+ DBusMessage *reply;
+
+ DBG("ConnMan, get_wifi_vsies API called");
+
+ reply = dbus_message_new_method_return(msg);
+ if (!reply)
+ return NULL;
+
+ __connman_dbus_append_objpath_dict_array(reply,
+ append_wifi_vsies_structs, NULL);
+
+ return reply;
+}
+#endif
+
static DBusMessage *get_properties(DBusConnection *conn,
DBusMessage *msg, void *data)
{
@@ -575,6 +599,11 @@ static const GDBusMethodTable manager_methods[] = {
{ GDBUS_METHOD("UnregisterPeerService",
GDBUS_ARGS({ "specification", "a{sv}" }), NULL,
unregister_peer_service) },
+#if defined TIZEN_EXT
+ { GDBUS_METHOD("GetVsies",
+ NULL, GDBUS_ARGS({ "Vsie", "a(oa{sv})" }),
+ get_wifi_vsies) },
+#endif
{ },
};
diff --git a/src/network.c b/src/network.c
index 8a6b906..546479c 100755
--- a/src/network.c
+++ b/src/network.c
@@ -101,6 +101,8 @@ struct connman_network {
char *keymgmt_type;
bool rsn_mode;
int disconnect_reason;
+ void *wifi_vsie;
+ unsigned int wifi_vsie_len;
#endif
} wifi;
@@ -975,7 +977,9 @@ static void network_destruct(struct connman_network *network)
g_free(network->wifi.private_key_passphrase);
g_free(network->wifi.phase2_auth);
g_free(network->wifi.pin_wps);
-
+#if defined TIZEN_EXT
+ g_free(network->wifi.wifi_vsie);
+#endif
g_free(network->path);
g_free(network->group);
g_free(network->node);
@@ -2424,6 +2428,16 @@ int connman_network_set_blob(struct connman_network *network,
network->wifi.ssid_len = size;
} else
network->wifi.ssid_len = 0;
+#if defined TIZEN_EXT
+ } else if (g_str_equal(key, "WiFi.Vsie")){
+ g_free(network->wifi.wifi_vsie);
+ network->wifi.wifi_vsie = g_try_malloc(size);
+ if (network->wifi.wifi_vsie) {
+ memcpy(network->wifi.wifi_vsie, data, size);
+ network->wifi.wifi_vsie_len = size;
+ } else
+ network->wifi.wifi_vsie_len = 0;
+#endif
} else {
return -EINVAL;
}
@@ -2450,6 +2464,17 @@ const void *connman_network_get_blob(struct connman_network *network,
return network->wifi.ssid;
}
+#if defined TIZEN_EXT
+ if (g_str_equal(key, "WiFi.Vsie")) {
+ if (size) {
+ *size = network->wifi.wifi_vsie_len;
+ DBG("network %p key %s size=%d", network, key, *size);
+ }
+
+ return network->wifi.wifi_vsie;
+ }
+#endif
+
return NULL;
}
diff --git a/src/service.c b/src/service.c
index a5a7f39..4497b39 100755
--- a/src/service.c
+++ b/src/service.c
@@ -3381,6 +3381,53 @@ void __connman_service_list_struct(DBusMessageIter *iter)
g_list_foreach(service_list, append_struct, iter);
}
+#if defined TIZEN_EXT
+static void append_wifi_vsie_properties(DBusMessageIter *iter,
+ struct connman_service *service)
+{
+ DBusMessageIter dict;
+ const void *wifi_vsie;
+ unsigned int wifi_vsie_len;
+
+ connman_dbus_dict_open(iter, &dict);
+
+ wifi_vsie = connman_network_get_blob(service->network, "WiFi.Vsie", &wifi_vsie_len);
+
+ if(wifi_vsie_len > 0) {
+ DBG("ConnMan, service->path=%s vsie length=%d", service->path, wifi_vsie_len);
+ }
+
+ connman_dbus_dict_append_fixed_array(&dict, "Vsie", DBUS_TYPE_BYTE,
+ &wifi_vsie, wifi_vsie_len);
+
+ connman_dbus_dict_close(iter, &dict);
+}
+
+void __connman_wifi_vsie_list_struct(DBusMessageIter *iter)
+{
+ GList *list;
+ DBusMessageIter entry;
+
+ DBG("ConnMan, __connman_wifi_vsie_list_struct API called");
+
+ for (list = service_list; list; list = list->next) {
+ struct connman_service *service = list->data;
+
+ if (!service->path ||
+ service->type != CONNMAN_SERVICE_TYPE_WIFI ||
+ service->network == NULL)
+ continue;
+
+ dbus_message_iter_open_container(iter, DBUS_TYPE_STRUCT,
+ NULL, &entry);
+ dbus_message_iter_append_basic(&entry, DBUS_TYPE_OBJECT_PATH,
+ &service->path);
+ append_wifi_vsie_properties(&entry, service);
+ dbus_message_iter_close_container(iter, &entry);
+ }
+}
+#endif
+
bool __connman_service_is_hidden(struct connman_service *service)
{
return service->hidden;