[SPIN] Added the connman disconnect reason property.
[platform/upstream/connman.git] / src / network.c
index 4b2ae11..57a1db3 100755 (executable)
@@ -97,6 +97,10 @@ struct connman_network {
                unsigned char bssid[WIFI_BSSID_LEN_MAX];
                unsigned int maxrate;
                unsigned int isHS20AP;
+               unsigned int keymgmt;
+               char *keymgmt_type;
+               bool rsn_selected;
+               int disconnect_reason;
 #endif
        } wifi;
 
@@ -1398,6 +1402,21 @@ static void set_connect_error(struct connman_network *network)
                                        CONNMAN_SERVICE_ERROR_CONNECT_FAILED);
 }
 
+#if defined TIZEN_EXT
+static void set_dhcp_error(struct connman_network *network)
+{
+       struct connman_service *service;
+
+       if (network->associating != FALSE)
+               network->associating = FALSE;
+
+       service = connman_service_lookup_from_network(network);
+
+       __connman_service_indicate_error(service,
+                                       CONNMAN_SERVICE_ERROR_DHCP_FAILED);
+}
+#endif
+
 void connman_network_set_ipv4_method(struct connman_network *network,
                                        enum connman_ipconfig_method method)
 {
@@ -1455,6 +1474,11 @@ void connman_network_set_error(struct connman_network *network,
        case CONNMAN_NETWORK_ERROR_CONNECT_FAIL:
                set_connect_error(network);
                break;
+#if defined TIZEN_EXT
+       case CONNMAN_NETWORK_ERROR_DHCP_FAIL:
+               set_dhcp_error(network);
+               break;
+#endif
        }
 
        network_change(network);
@@ -1875,6 +1899,14 @@ const char *connman_network_get_enc_mode(struct connman_network *network)
        return (const char *)network->wifi.encryption_mode;
 }
 
+int connman_network_set_rsn_selected(struct connman_network *network,
+                               bool rsn_selected)
+{
+       network->wifi.rsn_selected = rsn_selected;
+
+       return 0;
+}
+
 int connman_network_set_proxy(struct connman_network *network,
                                const char *proxies)
 {
@@ -1912,6 +1944,44 @@ unsigned int connman_network_get_is_hs20AP(struct connman_network *network)
 
        return network->wifi.isHS20AP;
 }
+
+int connman_network_set_keymgmt(struct connman_network *network,
+                               unsigned int keymgmt)
+{
+       if (network == NULL)
+               return 0;
+
+       network->wifi.keymgmt = keymgmt;
+
+       return 0;
+}
+
+unsigned int connman_network_get_keymgmt(struct connman_network *network)
+{
+       if (network == NULL)
+               return 0;
+
+       return network->wifi.keymgmt;
+}
+
+int connman_network_set_disconnect_reason(struct connman_network *network,
+                               int reason_code)
+{
+       if (network == NULL)
+               return 0;
+
+       network->wifi.disconnect_reason = reason_code;
+
+       return 0;
+}
+
+int connman_network_get_disconnect_reason(struct connman_network *network)
+{
+       if (network == NULL)
+               return 0;
+
+       return network->wifi.disconnect_reason;
+}
 #endif
 
 int connman_network_set_nameservers(struct connman_network *network,
@@ -2125,7 +2195,15 @@ const char *connman_network_get_string(struct connman_network *network,
        else if (g_str_equal(key, "WiFi.Mode"))
                return network->wifi.mode;
        else if (g_str_equal(key, "WiFi.Security"))
+#if defined TIZEN_EXT
+               if (network->wifi.rsn_selected != true ||
+                   g_str_equal(network->wifi.security, "ieee8021x"))
+                       return network->wifi.security;
+               else
+                       return "rsn";
+#else
                return network->wifi.security;
+#endif
        else if (g_str_equal(key, "WiFi.Passphrase"))
                return network->wifi.passphrase;
        else if (g_str_equal(key, "WiFi.EAP"))