summaryrefslogtreecommitdiff
path: root/gsupplicant/supplicant.c
diff options
context:
space:
mode:
Diffstat (limited to 'gsupplicant/supplicant.c')
-rwxr-xr-xgsupplicant/supplicant.c122
1 files changed, 57 insertions, 65 deletions
diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c
index 0c38ad3d..8329975b 100755
--- a/gsupplicant/supplicant.c
+++ b/gsupplicant/supplicant.c
@@ -175,7 +175,7 @@ static struct strvalmap mode_capa_map[] = {
{ }
};
-#if defined TIZEN_EXT && defined TIZEN_EXT_INS
+#if defined TIZEN_EXT
struct _GSupplicantINSSettings {
GSupplicantINSPreferredFreq preferred_freq_bssid;
unsigned int preferred_freq_bssid_score;
@@ -189,13 +189,11 @@ struct _GSupplicantINSSettings {
};
static struct _GSupplicantINSSettings ins_settings;
-#endif /* defined TIZEN_EXT && defined TIZEN_EXT_INS */
-#if defined TIZEN_EXT_INS
static unsigned char invalid_bssid[WIFI_BSSID_LEN_MAX] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
-#endif
+#endif /* defined TIZEN_EXT */
static GHashTable *interface_table;
static GHashTable *bss_mapping;
@@ -457,9 +455,7 @@ struct assoc_count_data {
int assoc_count;
};
-#if defined TIZEN_EXT_INS
static unsigned int last_connected_bss_timeout = 0;
-#endif
static bool simplified_log = true;
#endif
@@ -2031,7 +2027,6 @@ void *g_supplicant_network_get_wifi_vsie(GSupplicantNetwork *network)
return vsie_list;
}
-#if defined TIZEN_EXT_INS
static bool compare_bssid(unsigned char *bssid_a, unsigned char *bssid_b)
{
if (!memcmp(bssid_a, bssid_b, WIFI_BSSID_LEN_MAX))
@@ -2199,7 +2194,6 @@ static int calculate_score(bool is_last_connected, uint16_t assoc_reject_cnt,
return score;
}
-#endif /* defined TIZEN_EXT_INS */
static void update_bssid_list(gpointer key, gpointer value, gpointer user_data)
{
@@ -2222,22 +2216,23 @@ static void update_bssid_list(gpointer key, gpointer value, gpointer user_data)
bssids->est_throughput = bss->est_throughput;
bssids->score_snr = (int)bss->snr;
-#if defined TIZEN_EXT_INS
- bssids->assoc_reject_cnt = get_assoc_reject_cnt(bssid_data->assoc_reject_table, bssids->bssid);
- bssids->is_last_connected = compare_bssid(bssids->bssid, bssid_data->last_connected_bssid);
+ if (TIZEN_INS_ENABLED) {
+ bssids->assoc_reject_cnt = get_assoc_reject_cnt(bssid_data->assoc_reject_table, bssids->bssid);
+ bssids->is_last_connected = compare_bssid(bssids->bssid, bssid_data->last_connected_bssid);
- bssids->score_last_connected_bssid = calculate_score_last_connected_bssid(bssids->is_last_connected);
- bssids->score_assoc_reject = calculate_score_assoc_reject(bssids->assoc_reject_cnt);
- bssids->score_frequency = calculate_score_frequency(bss->signal, bssids->frequency);
- bssids->score_strength = calculate_score_strength(bss->signal);
- bssids->score_est_throughput = calculate_score_est_throughput(bss->est_throughput);
+ bssids->score_last_connected_bssid = calculate_score_last_connected_bssid(bssids->is_last_connected);
+ bssids->score_assoc_reject = calculate_score_assoc_reject(bssids->assoc_reject_cnt);
+ bssids->score_frequency = calculate_score_frequency(bss->signal, bssids->frequency);
+ bssids->score_strength = calculate_score_strength(bss->signal);
+ bssids->score_est_throughput = calculate_score_est_throughput(bss->est_throughput);
+
+ bssids->ins_score = calculate_score(bssids->is_last_connected,
+ bssids->assoc_reject_cnt, bssids->frequency, bss->signal,
+ bss->snr, bss->est_throughput);
+ } else {
+ bssids->ins_score = bss->signal;
+ }
- bssids->ins_score = calculate_score(bssids->is_last_connected,
- bssids->assoc_reject_cnt, bssids->frequency, bss->signal,
- bss->snr, bss->est_throughput);
-#else
- bssids->ins_score = bss->signal;
-#endif
bssid_data->bssid_list = g_slist_append(bssid_data->bssid_list, bssids);
} else
SUPPLICANT_DBG("Failed to allocate memory");
@@ -2264,7 +2259,6 @@ static gint cmp_bss(gconstpointer a, gconstpointer b)
return 0;
}
-#if defined TIZEN_EXT_INS
static void print_bssid_sort(gpointer data, gpointer user_data)
{
struct g_connman_bssids *bssids = data;
@@ -2274,14 +2268,12 @@ static void print_bssid_sort(gpointer data, gpointer user_data)
if (!bssids || !network)
return;
- if (!simplified_log)
- SUPPLICANT_DBG("ssid [%-20s] bssid[" MACSTR "] total[%2d] freq[%2d] "
- "last_conn[%2d] assoc_reject[%2d] strength[%2d] rssi[%2d]",
- network->ssid, MAC2STR(bssids->bssid), bssids->ins_score,
- bssids->score_frequency, bssids->score_last_connected_bssid,
- bssids->score_assoc_reject, bssids->score_strength, bssids->strength - 120);
+ SUPPLICANT_DBG("ssid [%-20s] bssid[" MACSTR "] total[%2d] freq[%2d] "
+ "last_conn[%2d] assoc_reject[%2d] strength[%2d] rssi[%2d]",
+ network->ssid, MAC2STR(bssids->bssid), bssids->ins_score,
+ bssids->score_frequency, bssids->score_last_connected_bssid,
+ bssids->score_assoc_reject, bssids->score_strength, bssids->strength - 120);
}
-#endif
void *g_supplicant_network_get_bssid_list(GSupplicantNetwork *network)
{
@@ -2297,14 +2289,12 @@ void *g_supplicant_network_get_bssid_list(GSupplicantNetwork *network)
g_hash_table_foreach(network->bss_table, update_bssid_list, &bssid_data);
bssid_data.bssid_list = g_slist_sort(bssid_data.bssid_list, cmp_bss);
-#if defined TIZEN_EXT_INS
- g_slist_foreach(bssid_data.bssid_list, print_bssid_sort, (gpointer)network);
-#endif
+ if (TIZEN_INS_ENABLED && !simplified_log)
+ g_slist_foreach(bssid_data.bssid_list, print_bssid_sort, (gpointer)network);
return bssid_data.bssid_list;
}
-#if defined TIZEN_EXT_INS
void g_supplicant_network_set_last_connected_bssid(GSupplicantNetwork *network, const unsigned char *bssid)
{
if (!bssid)
@@ -2405,7 +2395,6 @@ GHashTable *g_supplicant_network_clone_assoc_reject_table(GSupplicantNetwork *ne
return cloned_assoc_reject_table;
}
-#endif /* defined TIZEN_EXT_INS */
GSupplicantNetwork *g_supplicant_interface_get_network(GSupplicantInterface *interface,
const char *group)
@@ -2693,21 +2682,21 @@ static bool update_best_bss(GSupplicantNetwork *network,
return true;
}
-#if defined TIZEN_EXT_INS
- score_new = calculate_score(
- compare_bssid(bss->bssid, network->last_connected_bssid),
- get_assoc_reject_cnt(network->assoc_reject_table, bss->bssid),
- bss->frequency, bss->signal, bss->snr, bss->est_throughput);
+ if (TIZEN_INS_ENABLED) {
+ score_new = calculate_score(
+ compare_bssid(bss->bssid, network->last_connected_bssid),
+ get_assoc_reject_cnt(network->assoc_reject_table, bss->bssid),
+ bss->frequency, bss->signal, bss->snr, bss->est_throughput);
- score_best = calculate_score(
- compare_bssid(network->best_bss->bssid, network->last_connected_bssid),
- get_assoc_reject_cnt(network->assoc_reject_table, network->best_bss->bssid),
- network->best_bss->frequency, network->best_bss->signal,
- network->best_bss->snr, network->best_bss->est_throughput);
-#else
- score_new = bss->signal;
- score_best = network->best_bss->signal;
-#endif
+ score_best = calculate_score(
+ compare_bssid(network->best_bss->bssid, network->last_connected_bssid),
+ get_assoc_reject_cnt(network->assoc_reject_table, network->best_bss->bssid),
+ network->best_bss->frequency, network->best_bss->signal,
+ network->best_bss->snr, network->best_bss->est_throughput);
+ } else {
+ score_new = bss->signal;
+ score_best = network->best_bss->signal;
+ }
if (score_new > score_best) {
SUPPLICANT_DBG("new[" MACSTR "][%d] : best[" MACSTR "][%d]",
@@ -3579,7 +3568,7 @@ static void update_network_signal(GSupplicantNetwork *network)
SUPPLICANT_DBG("New network signal %d", network->signal);
}
-#if defined TIZEN_EXT_INS
+#if defined TIZEN_EXT
static gboolean last_connected_timeout(gpointer data)
{
GSupplicantInterface *interface = data;
@@ -3630,7 +3619,7 @@ static void remove_timer_for_last_connected(GSupplicantInterface *interface)
}
}
}
-#endif /* defined TIZEN_EXT_INS */
+#endif /* defined TIZEN_EXT */
static void interface_current_bss(GSupplicantInterface *interface,
DBusMessageIter *iter)
@@ -3727,8 +3716,9 @@ static void interface_current_bss(GSupplicantInterface *interface,
case G_SUPPLICANT_STATE_GROUP_HANDSHAKE:
case G_SUPPLICANT_STATE_COMPLETED:
callback_network_associated(network);
-#if defined TIZEN_EXT_INS
- add_timer_for_last_connected(interface);
+#if defined TIZEN_EXT
+ if (TIZEN_INS_ENABLED)
+ add_timer_for_last_connected(interface);
#endif
break;
}
@@ -3886,16 +3876,18 @@ static void interface_property(const char *key, DBusMessageIter *iter,
interface->state = string2state(str);
callback_interface_state(interface);
}
-#if defined TIZEN_EXT_INS
- switch (interface->state) {
- case G_SUPPLICANT_STATE_COMPLETED:
- add_timer_for_last_connected(interface);
- break;
- case G_SUPPLICANT_STATE_DISCONNECTED:
- remove_timer_for_last_connected(interface);
- break;
- default:
- break;
+#if defined TIZEN_EXT
+ if (TIZEN_INS_ENABLED) {
+ switch (interface->state) {
+ case G_SUPPLICANT_STATE_COMPLETED:
+ add_timer_for_last_connected(interface);
+ break;
+ case G_SUPPLICANT_STATE_DISCONNECTED:
+ remove_timer_for_last_connected(interface);
+ break;
+ default:
+ break;
+ }
}
#endif
if (interface->ap_create_in_progress) {
@@ -8840,7 +8832,7 @@ static void invoke_introspect_method(void)
dbus_message_unref(message);
}
-#if defined TIZEN_EXT && defined TIZEN_EXT_INS
+#if defined TIZEN_EXT
void g_supplicant_set_ins_settings(GSupplicantINSPreferredFreq preferred_freq_bssid,
bool last_connected_bssid, bool assoc_reject, bool signal_bssid,
unsigned int preferred_freq_bssid_score, unsigned int last_connected_bssid_score,
@@ -8866,7 +8858,7 @@ void g_supplicant_set_ins_settings(GSupplicantINSPreferredFreq preferred_freq_bs
SUPPLICANT_DBG("signal_level3_5ghz [%d]", signal_level3_5ghz);
SUPPLICANT_DBG("signal_level3_24ghz [%d]", signal_level3_24ghz);
}
-#endif /* defined TIZEN_EXT && defined TIZEN_EXT_INS */
+#endif /* defined TIZEN_EXT */
#if defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET
void g_supplicant_register_eap_callback(g_supplicant_eap_callback cb)