It also includes parsing country code from IEs received from the supplicant
Change-Id: Iea5f8b2ea7cc8fefe07591cc4d636d27b015d427
Signed-off-by: Mayank Haarit <mayank.h@samsung.com>
const char *g_supplicant_network_get_phase2(GSupplicantNetwork *network);
unsigned int g_supplicant_network_get_keymgmt(GSupplicantNetwork *network);
void *g_supplicant_network_get_wifi_vsie(GSupplicantNetwork *network);
const char *g_supplicant_network_get_phase2(GSupplicantNetwork *network);
unsigned int g_supplicant_network_get_keymgmt(GSupplicantNetwork *network);
void *g_supplicant_network_get_wifi_vsie(GSupplicantNetwork *network);
+const unsigned char *g_supplicant_network_get_countrycode(GSupplicantNetwork
+ *network);
#endif
struct _GSupplicantCallbacks {
#endif
struct _GSupplicantCallbacks {
#define IEEE80211_CAP_IBSS 0x0002
#define IEEE80211_CAP_PRIVACY 0x0010
#define IEEE80211_CAP_IBSS 0x0002
#define IEEE80211_CAP_PRIVACY 0x0010
+#if defined TIZEN_EXT
+#define COUNTRY_CODE_LENGTH 2
+#endif
+
#define BSS_UNKNOWN_STRENGTH -90
static DBusConnection *connection;
#define BSS_UNKNOWN_STRENGTH -90
static DBusConnection *connection;
dbus_bool_t ft_ieee8021x;
GSList *vsie_list;
dbus_bool_t hs20;
dbus_bool_t ft_ieee8021x;
GSList *vsie_list;
dbus_bool_t hs20;
+ unsigned char country_code[COUNTRY_CODE_LENGTH];
#endif
unsigned int wps_capabilities;
};
#endif
unsigned int wps_capabilities;
};
char *phase2;
unsigned int keymgmt;
GSList *vsie_list;
char *phase2;
unsigned int keymgmt;
GSList *vsie_list;
+ unsigned char country_code[COUNTRY_CODE_LENGTH];
return network->keymgmt;
}
return network->keymgmt;
}
+
+const unsigned char *g_supplicant_network_get_countrycode(GSupplicantNetwork
+ *network)
+{
+ if (!network)
+ return NULL;
+
+ return network->country_code;
+}
#endif
const unsigned char *g_supplicant_peer_get_widi_ies(GSupplicantPeer *peer,
#endif
const unsigned char *g_supplicant_peer_get_widi_ies(GSupplicantPeer *peer,
}
network->isHS20AP = bss->hs20;
}
network->isHS20AP = bss->hs20;
+ memcpy(network->country_code, bss->country_code, COUNTRY_CODE_LENGTH);
#endif
SUPPLICANT_DBG("New network %s created", network->name);
#endif
SUPPLICANT_DBG("New network %s created", network->name);
#define WPS_CONFIGURED 0x02
#if defined TIZEN_EXT
#define VENDOR_SPECIFIC_INFO 0xDD
#define WPS_CONFIGURED 0x02
#if defined TIZEN_EXT
#define VENDOR_SPECIFIC_INFO 0xDD
+#define WLAN_EID_COUNTRY 7
#endif
dbus_message_iter_recurse(iter, &array);
#endif
dbus_message_iter_recurse(iter, &array);
bss->wps_capabilities = 0;
bss->keymgmt = 0;
bss->wps_capabilities = 0;
bss->keymgmt = 0;
+ memset(bss->country_code, 0, COUNTRY_CODE_LENGTH);
for (ie_end = ie + ie_len; ie < ie_end && ie + ie[1] + 1 <= ie_end;
ie += ie[1] + 2) {
for (ie_end = ie + ie_len; ie < ie_end && ie + ie[1] + 1 <= ie_end;
ie += ie[1] + 2) {
SUPPLICANT_DBG("Failed to allocate memory");
continue;
}
SUPPLICANT_DBG("Failed to allocate memory");
continue;
}
+
+ if(ie[0] == WLAN_EID_COUNTRY && ie[1] >= 2) {
+ memcpy(bss->country_code, ie+2, COUNTRY_CODE_LENGTH);
+ continue;
+ }
#endif
if (ie[0] != WMM_WPA1_WPS_INFO || ie[1] < WPS_INFO_MIN_LEN ||
memcmp(ie+2, WPS_OUI, sizeof(WPS_OUI)) != 0)
#endif
if (ie[0] != WMM_WPA1_WPS_INFO || ie[1] < WPS_INFO_MIN_LEN ||
memcmp(ie+2, WPS_OUI, sizeof(WPS_OUI)) != 0)
int connman_network_get_assoc_status_code(struct connman_network *network);
int connman_network_set_assoc_status_code(struct connman_network *network,
int assoc_status_code);
int connman_network_get_assoc_status_code(struct connman_network *network);
int connman_network_set_assoc_status_code(struct connman_network *network,
int assoc_status_code);
+int connman_network_set_countrycode(struct connman_network *network, const
+ unsigned char *country_code);
+unsigned char *connman_network_get_countrycode(struct connman_network *network);
#endif
int connman_network_set_name(struct connman_network *network,
#endif
int connman_network_set_name(struct connman_network *network,
#if defined TIZEN_EXT
GSList *vsie_list = NULL;
#if defined TIZEN_EXT
GSList *vsie_list = NULL;
+ const unsigned char *country_code;
#endif
mode = g_supplicant_network_get_mode(supplicant_network);
#endif
mode = g_supplicant_network_get_mode(supplicant_network);
connman_network_set_vsie_list(network, vsie_list);
else
DBG("vsie_list is NULL");
connman_network_set_vsie_list(network, vsie_list);
else
DBG("vsie_list is NULL");
+ country_code = g_supplicant_network_get_countrycode(supplicant_network);
+ connman_network_set_countrycode(network, country_code);
#endif
connman_network_set_string(network, "WiFi.Security", security);
connman_network_set_strength(network,
#endif
connman_network_set_string(network, "WiFi.Security", security);
connman_network_set_strength(network,
unsigned int maxrate;
uint16_t frequency;
bool wps;
unsigned int maxrate;
uint16_t frequency;
bool wps;
+ const unsigned char *country_code;
#endif
interface = g_supplicant_network_get_interface(network);
#endif
interface = g_supplicant_network_get_interface(network);
connman_network_set_maxrate(connman_network, maxrate);
connman_network_set_frequency(connman_network, frequency);
connman_network_set_bool(connman_network, "WiFi.WPS", wps);
connman_network_set_maxrate(connman_network, maxrate);
connman_network_set_frequency(connman_network, frequency);
connman_network_set_bool(connman_network, "WiFi.WPS", wps);
+ country_code = g_supplicant_network_get_countrycode(network);
+ connman_network_set_countrycode(connman_network, country_code);
#include <glib.h>
#define CONNMAN_API_SUBJECT_TO_CHANGE
#include <glib.h>
#define CONNMAN_API_SUBJECT_TO_CHANGE
+#if defined TIZEN_EXT
+#define WIFI_COUNTRY_CODE_LEN 2
+#endif
#include <connman/dbus.h>
#include <connman/dbus.h>
* Only for EAP-FAST
*/
char *phase1;
* Only for EAP-FAST
*/
char *phase1;
+ unsigned char country_code[WIFI_COUNTRY_CODE_LEN];
return network->wifi.assoc_status_code;
}
return network->wifi.assoc_status_code;
}
+
+int connman_network_set_countrycode(struct connman_network *network,
+ const unsigned char *country_code)
+{
+ int i = 0;
+
+ if (country_code == NULL)
+ return -EINVAL;
+
+ DBG("network %p Country Code %02x:%02x",network,
+ country_code[0],country_code[1]);
+
+ for (; i < WIFI_COUNTRY_CODE_LEN; i++)
+ network->wifi.country_code[i] = country_code[i];
+
+ return 0;
+}
+
+unsigned char *connman_network_get_countrycode(struct connman_network *network)
+{
+ return (unsigned char *)network->wifi.country_code;
+}
+
#endif
int connman_network_set_nameservers(struct connman_network *network,
#endif
int connman_network_set_nameservers(struct connman_network *network,
const char *enc_mode;
const char *str;
gboolean passpoint;
const char *enc_mode;
const char *str;
gboolean passpoint;
+ char country_code_buff[WIFI_COUNTRY_CODE_LEN + 1] = {0,};
+ char *country_code_str = country_code_buff;
+ unsigned char *country_code;
ssid = connman_network_get_blob(network, "WiFi.SSID", &ssid_len);
bssid = connman_network_get_bssid(network);
ssid = connman_network_get_blob(network, "WiFi.SSID", &ssid_len);
bssid = connman_network_get_bssid(network);
enc_mode = connman_network_get_enc_mode(network);
passpoint = connman_network_get_bool(network, "WiFi.HS20AP");
keymgmt = connman_network_get_keymgmt(network);
enc_mode = connman_network_get_enc_mode(network);
passpoint = connman_network_get_bool(network, "WiFi.HS20AP");
keymgmt = connman_network_get_keymgmt(network);
+ country_code = connman_network_get_countrycode(network);
snprintf(bssid_str, WIFI_BSSID_STR_LEN, "%02x:%02x:%02x:%02x:%02x:%02x",
bssid[0], bssid[1], bssid[2],
bssid[3], bssid[4], bssid[5]);
snprintf(bssid_str, WIFI_BSSID_STR_LEN, "%02x:%02x:%02x:%02x:%02x:%02x",
bssid[0], bssid[1], bssid[2],
bssid[3], bssid[4], bssid[5]);
+ snprintf(country_code_str, (WIFI_COUNTRY_CODE_LEN + 1), "%c%c",
+ country_code[0], country_code[1]);
+
+
connman_dbus_dict_append_fixed_array(dict, "SSID",
DBUS_TYPE_BYTE, &ssid, ssid_len);
connman_dbus_dict_append_basic(dict, "BSSID",
connman_dbus_dict_append_fixed_array(dict, "SSID",
DBUS_TYPE_BYTE, &ssid, ssid_len);
connman_dbus_dict_append_basic(dict, "BSSID",
DBUS_TYPE_BOOLEAN, &passpoint);
connman_dbus_dict_append_basic(dict, "Keymgmt",
DBUS_TYPE_UINT32, &keymgmt);
DBUS_TYPE_BOOLEAN, &passpoint);
connman_dbus_dict_append_basic(dict, "Keymgmt",
DBUS_TYPE_UINT32, &keymgmt);
+ connman_dbus_dict_append_basic(dict, "Country", DBUS_TYPE_STRING,
+ &country_code_str);
str = connman_network_get_string(network, "WiFi.Security");
if (str != NULL && g_str_equal(str, "ieee8021x") == TRUE) {
str = connman_network_get_string(network, "WiFi.Security");
if (str != NULL && g_str_equal(str, "ieee8021x") == TRUE) {