Added support of WPA3-SAE security mode.
[platform/upstream/connman.git] / src / network.c
index 0e3d4b3..4a53bba 100755 (executable)
  */
 #define RS_REFRESH_TIMEOUT     3
 
-#if defined TIZEN_EXT
-#define WIFI_ENCYPTION_MODE_LEN_MAX 6
-#define WIFI_BSSID_LEN_MAX 6
-#endif
-
 /*
  * As per RFC 4861, a host should transmit up to MAX_RTR_SOLICITATIONS(3)
  * Router Solicitation messages, each separated by at least
@@ -108,6 +103,7 @@ struct connman_network {
                char encryption_mode[WIFI_ENCYPTION_MODE_LEN_MAX];
                unsigned char bssid[WIFI_BSSID_LEN_MAX];
                unsigned int maxrate;
+               int maxspeed;
                bool isHS20AP;
                unsigned int keymgmt;
                char *keymgmt_type;
@@ -119,6 +115,10 @@ struct connman_network {
                * Only for EAP-FAST
                */
                char *phase1;
+               unsigned char country_code[WIFI_COUNTRY_CODE_LEN];
+               GSList *bssid_list;
+               ieee80211_modes_e phy_mode;
+               connection_mode_e connection_mode;
 #endif
        } wifi;
 
@@ -984,6 +984,7 @@ static void network_destruct(struct connman_network *network)
        g_free(network->wifi.pin_wps);
 #if defined TIZEN_EXT
        g_slist_free_full(network->wifi.vsie_list, g_free);
+       g_slist_free_full(network->wifi.bssid_list, g_free);
 #endif
        g_free(network->path);
        g_free(network->group);
@@ -1969,6 +1970,24 @@ unsigned char *connman_network_get_bssid(struct connman_network *network)
        return (unsigned char *)network->wifi.bssid;
 }
 
+int connman_network_set_maxspeed(struct connman_network *network,
+                                int maxspeed)
+{
+       network->wifi.maxspeed = maxspeed;
+        return 0;
+}
+
+int connman_network_get_maxspeed(struct connman_network *network)
+{
+       if (!network->driver)
+               return 0;
+
+       if (network->connected)
+               return network->wifi.maxspeed;
+
+       return 0;
+}
+
 int connman_network_set_maxrate(struct connman_network *network,
                                unsigned int maxrate)
 {
@@ -2076,6 +2095,70 @@ int connman_network_get_assoc_status_code(struct connman_network *network)
 
        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;
+}
+
+int connman_network_set_bssid_list(struct connman_network *network,
+                                       GSList *bssids)
+{
+       g_slist_free_full(network->wifi.bssid_list, g_free);
+       network->wifi.bssid_list = bssids;
+
+       return 0;
+}
+
+int connman_network_set_phy_mode(struct connman_network *network,
+                                   ieee80211_modes_e mode)
+{
+       DBG("network %p phy mode %d", network, mode);
+       network->wifi.phy_mode = mode;
+
+       return 0;
+}
+
+ieee80211_modes_e connman_network_get_phy_mode(struct connman_network *network)
+{
+       return network->wifi.phy_mode;
+}
+
+int connman_network_set_connection_mode(struct connman_network *network,
+                                   connection_mode_e mode)
+{
+       DBG("network %p connection mode %d", network, mode);
+       network->wifi.connection_mode = mode;
+
+       return 0;
+}
+
+connection_mode_e connman_network_get_connection_mode(struct connman_network *network)
+{
+       return network->wifi.connection_mode;
+}
+
+void *connman_network_get_bssid_list(struct connman_network *network)
+{
+       return network->wifi.bssid_list;
+}
 #endif
 
 int connman_network_set_nameservers(struct connman_network *network,
@@ -2401,6 +2484,7 @@ bool connman_network_get_bool(struct connman_network *network,
  */
 void connman_network_set_vsie_list(struct connman_network *network, GSList *vsie_list)
 {
+       g_slist_free_full(network->wifi.vsie_list, g_free);
        network->wifi.vsie_list = vsie_list;
 }