summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManeesh Jain <maneesh.jain@samsung.com>2017-10-26 17:27:35 +0530
committerManeesh Jain <maneesh.jain@samsung.com>2017-11-03 10:18:34 +0000
commit5b04daf30f54e0728d91a65d71e1dc6a47075a11 (patch)
treee81d8fcc932c3743caff8679f0b1070d1b14cf95
parent29893040d7906f1f70960726b3037d1b363955ca (diff)
downloadconnman-5b04daf30f54e0728d91a65d71e1dc6a47075a11.tar.gz
connman-5b04daf30f54e0728d91a65d71e1dc6a47075a11.tar.bz2
connman-5b04daf30f54e0728d91a65d71e1dc6a47075a11.zip
Added handling of "AssocStatusCode" signal
Description : This can be used by application in case AP is denying association with status code Change-Id: I195492be4320032b460b708034f044eec03b71dd Signed-off-by: Maneesh Jain <maneesh.jain@samsung.com>
-rwxr-xr-xgsupplicant/gsupplicant.h2
-rwxr-xr-xgsupplicant/supplicant.c19
-rwxr-xr-xplugins/wifi.c23
-rwxr-xr-xsrc/network.c21
-rwxr-xr-xsrc/service.c4
5 files changed, 68 insertions, 1 deletions
diff --git a/gsupplicant/gsupplicant.h b/gsupplicant/gsupplicant.h
index f115c5e5..a33dab0f 100755
--- a/gsupplicant/gsupplicant.h
+++ b/gsupplicant/gsupplicant.h
@@ -410,6 +410,8 @@ struct _GSupplicantCallbacks {
void (*debug) (const char *str);
void (*disconnect_reasoncode)(GSupplicantInterface *interface,
int reasoncode);
+ void (*assoc_status_code)(GSupplicantInterface *interface,
+ int reasoncode);
};
typedef struct _GSupplicantCallbacks GSupplicantCallbacks;
diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c
index f3f2b403..b1232a5d 100755
--- a/gsupplicant/supplicant.c
+++ b/gsupplicant/supplicant.c
@@ -577,6 +577,19 @@ static void callback_disconnect_reason_code(GSupplicantInterface *interface,
reason_code);
}
+static void callback_assoc_status_code(GSupplicantInterface *interface,
+ int status_code)
+{
+ if (!callbacks_pointer)
+ return;
+
+ if (!callbacks_pointer->assoc_status_code)
+ return;
+
+ callbacks_pointer->assoc_status_code(interface, status_code);
+
+}
+
static void remove_group(gpointer data)
{
GSupplicantGroup *group = data;
@@ -2359,6 +2372,12 @@ static void interface_property(const char *key, DBusMessageIter *iter,
dbus_message_iter_get_basic(iter, &reason_code);
callback_disconnect_reason_code(interface, reason_code);
}
+ } else if (g_strcmp0(key, "AssocStatusCode") == 0) {
+ int status_code;
+ if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_INVALID) {
+ dbus_message_iter_get_basic(iter, &status_code);
+ callback_assoc_status_code(interface, status_code);
+ }
} else
SUPPLICANT_DBG("key %s type %c",
key, dbus_message_iter_get_arg_type(iter));
diff --git a/plugins/wifi.c b/plugins/wifi.c
index b7e37a1b..116fa600 100755
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -71,6 +71,7 @@
#define P2P_LISTEN_PERIOD 500
#define P2P_LISTEN_INTERVAL 2000
+
static struct connman_technology *wifi_technology = NULL;
static struct connman_technology *p2p_technology = NULL;
@@ -134,6 +135,7 @@ struct wifi_data {
bool allow_full_scan;
#endif
int disconnect_code;
+ int assoc_code;
};
#if defined TIZEN_EXT
@@ -2785,6 +2787,7 @@ static void interface_state(GSupplicantInterface *interface)
connman_network_set_connected(network, true);
wifi->disconnect_code = 0;
+ wifi->assoc_code = 0;
break;
case G_SUPPLICANT_STATE_DISCONNECTED:
@@ -3577,12 +3580,29 @@ static void disconnect_reasoncode(GSupplicantInterface *interface,
int reasoncode)
{
struct wifi_data *wifi = g_supplicant_interface_get_data(interface);
-
if (wifi != NULL) {
wifi->disconnect_code = reasoncode;
}
}
+static void assoc_status_code(GSupplicantInterface *interface, int status_code)
+{
+ struct wifi_data *wifi = g_supplicant_interface_get_data(interface);
+
+#if defined TIZEN_EXT
+ struct connman_network *network;
+#endif
+
+ if (wifi != NULL) {
+ wifi->assoc_code = status_code;
+
+#if defined TIZEN_EXT
+ network = wifi->network;
+ connman_network_set_assoc_status_code(network,status_code);
+#endif
+
+ }
+}
static const GSupplicantCallbacks callbacks = {
.system_ready = system_ready,
@@ -3607,6 +3627,7 @@ static const GSupplicantCallbacks callbacks = {
.network_merged = network_merged,
#endif
.disconnect_reasoncode = disconnect_reasoncode,
+ .assoc_status_code = assoc_status_code,
.debug = debug,
};
diff --git a/src/network.c b/src/network.c
index 546479c2..08b1319a 100755
--- a/src/network.c
+++ b/src/network.c
@@ -101,6 +101,7 @@ struct connman_network {
char *keymgmt_type;
bool rsn_mode;
int disconnect_reason;
+ int assoc_status_code;
void *wifi_vsie;
unsigned int wifi_vsie_len;
#endif
@@ -2092,6 +2093,26 @@ int connman_network_get_disconnect_reason(struct connman_network *network)
return network->wifi.disconnect_reason;
}
+
+int connman_network_set_assoc_status_code(struct connman_network *network,
+ int assoc_status_code)
+{
+
+ if (network == NULL)
+ return 0;
+
+ network->wifi.assoc_status_code = assoc_status_code;
+ return 0;
+}
+
+int connman_network_get_assoc_status_code(struct connman_network *network)
+{
+ if (network == NULL)
+ return 0;
+
+ return network->wifi.assoc_status_code;
+}
+
#endif
int connman_network_set_nameservers(struct connman_network *network,
diff --git a/src/service.c b/src/service.c
index 0c9c8977..468a327b 100755
--- a/src/service.c
+++ b/src/service.c
@@ -160,6 +160,7 @@ struct connman_service {
*/
char *keymgmt_type;
int disconnect_reason;
+ int assoc_status_code;
#endif
#ifdef TIZEN_EXT
enum connman_dnsconfig_method dns_config_method_ipv4;
@@ -7172,6 +7173,9 @@ static int service_indicate_state(struct connman_service *service)
case CONNMAN_SERVICE_STATE_FAILURE:
#if defined TIZEN_EXT
+
+ service->assoc_status_code = connman_network_get_assoc_status_code(service->network);
+
if (service->type == CONNMAN_SERVICE_TYPE_WIFI)
service->order = 5;
__connman_service_auto_connect(CONNMAN_SERVICE_CONNECT_REASON_AUTO);