summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNishant Chaprana <n.chaprana@samsung.com>2021-10-25 17:09:59 +0530
committerNishant Chaprana <n.chaprana@samsung.com>2021-10-27 11:27:01 +0530
commitd0e647678d78604a042c5a607697b43a2342c916 (patch)
tree86ee1163c9136e7dbe2a9340aa686442390a455d
parent6064810fc04058ce74f2573f1e0576829f46ba1e (diff)
downloadconnman-d0e647678d78604a042c5a607697b43a2342c916.tar.gz
connman-d0e647678d78604a042c5a607697b43a2342c916.tar.bz2
connman-d0e647678d78604a042c5a607697b43a2342c916.zip
Use TIZEN_EXT_INS for INS related code
Change-Id: I70f6722e1dcd8898eab2c504e377c65f425461e1 Signed-off-by: Nishant Chaprana <n.chaprana@samsung.com>
-rwxr-xr-xgsupplicant/gsupplicant.h4
-rwxr-xr-xgsupplicant/supplicant.c18
-rwxr-xr-xplugins/wifi.c15
-rwxr-xr-xsrc/device.c8
-rwxr-xr-xsrc/service.c72
-rwxr-xr-xsrc/storage.c8
6 files changed, 67 insertions, 58 deletions
diff --git a/gsupplicant/gsupplicant.h b/gsupplicant/gsupplicant.h
index 05af5de1..54802bd9 100755
--- a/gsupplicant/gsupplicant.h
+++ b/gsupplicant/gsupplicant.h
@@ -574,12 +574,12 @@ struct _GSupplicantCallbacks {
typedef struct _GSupplicantCallbacks GSupplicantCallbacks;
-#if defined TIZEN_EXT
+#if defined TIZEN_EXT && defined TIZEN_EXT_INS
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,
unsigned int assoc_reject_score, int signal_level3_5ghz, int signal_level3_24ghz);
-#endif
+#endif /* defined TIZEN_EXT && defined TIZEN_EXT_INS */
#if defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET
void g_supplicant_replace_config_file(const char *ifname, const char *config_file);
diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c
index 906f0ea7..427c8ca8 100755
--- a/gsupplicant/supplicant.c
+++ b/gsupplicant/supplicant.c
@@ -175,7 +175,7 @@ static struct strvalmap mode_capa_map[] = {
{ }
};
-#if defined TIZEN_EXT
+#if defined TIZEN_EXT && defined TIZEN_EXT_INS
struct _GSupplicantINSSettings {
GSupplicantINSPreferredFreq preferred_freq_bssid;
unsigned int preferred_freq_bssid_score;
@@ -189,7 +189,9 @@ struct _GSupplicantINSSettings {
};
static struct _GSupplicantINSSettings ins_settings;
+#endif /* defined TIZEN_EXT && defined TIZEN_EXT_INS */
+#if defined TIZEN_EXT
static unsigned char invalid_bssid[WIFI_BSSID_LEN_MAX] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
@@ -1855,6 +1857,7 @@ const unsigned char *g_supplicant_network_get_bssid(GSupplicantNetwork *network)
return (const unsigned char *)network->best_bss->bssid;
}
+
dbus_bool_t g_supplicant_network_get_transition_mode(GSupplicantNetwork *network)
{
if (network == NULL)
@@ -1863,7 +1866,6 @@ dbus_bool_t g_supplicant_network_get_transition_mode(GSupplicantNetwork *network
return network->owe_transition_mode;
}
-
const unsigned char *g_supplicant_network_get_transition_mode_bssid(GSupplicantNetwork *network)
{
if (network == NULL)
@@ -1898,11 +1900,9 @@ const char *g_supplicant_network_get_enc_mode(GSupplicantNetwork *network)
return NULL;
if (network->best_bss->security == G_SUPPLICANT_SECURITY_PSK ||
-#if defined TIZEN_EXT
network->best_bss->security == G_SUPPLICANT_SECURITY_SAE ||
network->best_bss->security == G_SUPPLICANT_SECURITY_OWE ||
network->best_bss->security == G_SUPPLICANT_SECURITY_DPP ||
-#endif /* TIZEN_EXT */
network->best_bss->security == G_SUPPLICANT_SECURITY_IEEE8021X) {
unsigned int pairwise;
@@ -1930,12 +1930,10 @@ bool g_supplicant_network_get_rsn_mode(GSupplicantNetwork *network)
if (network == NULL || network->best_bss == NULL)
return 0;
-#if defined TIZEN_EXT
if (network->best_bss->security == G_SUPPLICANT_SECURITY_SAE ||
network->best_bss->security == G_SUPPLICANT_SECURITY_OWE ||
network->best_bss->security == G_SUPPLICANT_SECURITY_DPP)
return false;
-#endif /* TIZEN_EXT */
if (network->best_bss->rsn_selected) {
const char *mode = g_supplicant_network_get_enc_mode(network);
@@ -2056,6 +2054,7 @@ static uint16_t get_assoc_reject_cnt(GHashTable *assoc_reject_table, unsigned ch
return assoc_count.assoc_count;
}
+#if defined TIZEN_EXT_INS
static int calculate_score_last_connected_bssid(bool is_last_connected)
{
int score = 0;
@@ -2126,6 +2125,7 @@ static int calculate_score_est_throughput(dbus_uint32_t est_throughput)
return score;
}
+#endif
static int calculate_score(bool is_last_connected, uint16_t assoc_reject_cnt,
dbus_uint16_t frequency, dbus_int16_t strength,
@@ -2133,12 +2133,14 @@ static int calculate_score(bool is_last_connected, uint16_t assoc_reject_cnt,
{
int score = 0;
+#if defined TIZEN_EXT_INS
score += calculate_score_last_connected_bssid(is_last_connected);
score += calculate_score_assoc_reject(assoc_reject_cnt);
score += calculate_score_frequency(strength, frequency);
score += calculate_score_strength(strength);
score += (int)snr;
score += calculate_score_est_throughput(est_throughput);
+#endif
return score;
}
@@ -8539,7 +8541,7 @@ static void invoke_introspect_method(void)
dbus_message_unref(message);
}
-#if defined TIZEN_EXT
+#if defined TIZEN_EXT && defined TIZEN_EXT_INS
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,
@@ -8565,7 +8567,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
+#endif /* defined TIZEN_EXT && defined TIZEN_EXT_INS */
#if defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET
void g_supplicant_register_eap_callback(g_supplicant_eap_callback cb)
diff --git a/plugins/wifi.c b/plugins/wifi.c
index 82168162..96c84b13 100755
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -5233,7 +5233,7 @@ static void network_changed(GSupplicantNetwork *network, const char *property)
calculate_strength(network));
update_needed = true;
}
-#if defined TIZEN_EXT
+#if defined TIZEN_EXT && defined TIZEN_EXT_INS
else if (g_str_equal(property, "LastConnectedBSSID")) {
const char *ident, *group;
char *service_ident;
@@ -5256,7 +5256,10 @@ static void network_changed(GSupplicantNetwork *network, const char *property)
g_supplicant_network_get_last_connected_bssid(network));
update_needed = true;
- } else if (g_str_equal(property, "UpdateAssocReject")) {
+ }
+#endif /* defined TIZEN_EXT && defined TIZEN_EXT_INS */
+#if defined TIZEN_EXT
+ else if (g_str_equal(property, "UpdateAssocReject")) {
connman_network_set_assoc_reject_table(connman_network,
g_supplicant_network_get_assoc_reject_table(network));
update_needed = true;
@@ -6129,7 +6132,7 @@ static int tech_set_regdom(struct connman_technology *technology, const char *al
return g_supplicant_set_country(alpha2, regdom_callback, NULL);
}
-#if defined TIZEN_EXT
+#if defined TIZEN_EXT && defined TIZEN_EXT_INS
static void supp_ins_init(void)
{
const char *string;
@@ -6154,7 +6157,7 @@ static void supp_ins_init(void)
connman_setting_get_int("INSSignalLevel3_24GHz")
);
}
-#endif
+#endif /* defined TIZEN_EXT && defined TIZEN_EXT_INS */
static struct connman_technology_driver tech_driver = {
.name = "wifi",
@@ -6190,9 +6193,9 @@ static int wifi_init(void)
failed_bssids = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);
#endif
-#if defined TIZEN_EXT
+#if defined TIZEN_EXT && defined TIZEN_EXT_INS
supp_ins_init();
-#endif
+#endif /* defined TIZEN_EXT && defined TIZEN_EXT_INS */
return 0;
}
diff --git a/src/device.c b/src/device.c
index 53502821..dbe556b7 100755
--- a/src/device.c
+++ b/src/device.c
@@ -881,7 +881,9 @@ const char *connman_device_get_last_connected_ident(struct connman_device *devic
{
return device->last_connected_ident;
}
+#endif
+#if defined TIZEN_EXT && defined TIZEN_EXT_INS
void connman_device_save_last_user_selection(struct connman_device *device)
{
GKeyFile *keyfile;
@@ -1015,7 +1017,7 @@ void connman_device_load_last_connected(struct connman_device *device)
g_key_file_free(keyfile);
}
-#endif
+#endif /* defined TIZEN_EXT && defined TIZEN_EXT_INS */
static void mark_network_available(gpointer key, gpointer value,
gpointer user_data)
@@ -2049,10 +2051,10 @@ struct connman_device *connman_device_create_from_index(int index)
connman_device_set_index(device, index);
connman_device_set_interface(device, devname);
-#if defined TIZEN_EXT
+#if defined TIZEN_EXT && defined TIZEN_EXT_INS
connman_device_load_last_connected(device);
connman_device_load_last_user_selection(device);
-#endif
+#endif /* defined TIZEN_EXT && defined TIZEN_EXT_INS */
if (ident) {
connman_device_set_ident(device, ident);
diff --git a/src/service.c b/src/service.c
index 36379b2a..8ffb254b 100755
--- a/src/service.c
+++ b/src/service.c
@@ -75,6 +75,12 @@ struct saved_profiles {
gchar *profile_name;
};
+static unsigned char invalid_bssid[WIFI_BSSID_LEN_MAX] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+#endif
+
+#if defined TIZEN_EXT && defined TIZEN_EXT_INS
enum connman_ins_preferred_freq {
CONNMAN_INS_PREFERRED_FREQ_UNKNOWN,
CONNMAN_INS_PREFERRED_FREQ_24GHZ,
@@ -100,11 +106,7 @@ struct connman_ins_settings {
};
static struct connman_ins_settings ins_settings;
-
-static unsigned char invalid_bssid[WIFI_BSSID_LEN_MAX] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-};
-#endif
+#endif /* defined TIZEN_EXT && defined TIZEN_EXT_INS */
struct connman_stats {
bool valid;
@@ -3081,7 +3083,7 @@ static void state_changed(struct connman_service *service)
#endif
}
-#if defined TIZEN_EXT
+#if defined TIZEN_EXT && defined TIZEN_EXT_INS
static void connect_reason_changed(struct connman_service *service)
{
struct connman_device *device;
@@ -3115,7 +3117,9 @@ static void connect_reason_changed(struct connman_service *service)
DBUS_TYPE_INT32,
&service->connect_reason);
}
+#endif /* defined TIZEN_EXT && defined TIZEN_EXT_INS */
+#if defined TIZEN_EXT
static void disconnection_requested_changed(struct connman_service *service)
{
dbus_bool_t disconnection_requested;
@@ -4562,7 +4566,7 @@ static void append_properties(DBusMessageIter *dict, dbus_bool_t limited,
connman_network_append_acddbus(dict, service->network);
}
-#if defined TIZEN_EXT_INS
+#if defined TIZEN_EXT && defined TIZEN_EXT_INS
static void append_ins_bssid_info(DBusMessageIter *iter, void *user_data)
{
GSList *bssid_list = NULL;
@@ -4653,7 +4657,7 @@ static void append_ins_properties(DBusMessageIter *dict,
append_ins_bssid_info, service->network);
}
}
-#endif
+#endif /* defined TIZEN_EXT && defined TIZEN_EXT_INS */
static void append_struct_service(DBusMessageIter *iter,
connman_dbus_append_cb_t function,
@@ -4692,12 +4696,7 @@ static void append_struct(gpointer value, gpointer user_data)
append_struct_service(iter, append_dict_properties, service);
}
-void __connman_service_list_struct(DBusMessageIter *iter)
-{
- g_list_foreach(service_list, append_struct, iter);
-}
-
-#if defined TIZEN_EXT_INS
+#if defined TIZEN_EXT && defined TIZEN_EXT_INS
static void append_dict_ins_properties(DBusMessageIter *dict, void *user_data)
{
struct connman_service *service = user_data;
@@ -4723,7 +4722,12 @@ void __connman_ins_list_struct(DBusMessageIter *iter)
{
g_list_foreach(service_list, append_ins_struct, iter);
}
-#endif
+#endif /* defined TIZEN_EXT && defined TIZEN_EXT_INS */
+
+void __connman_service_list_struct(DBusMessageIter *iter)
+{
+ g_list_foreach(service_list, append_struct, iter);
+}
bool __connman_service_is_hidden(struct connman_service *service)
{
@@ -7867,7 +7871,7 @@ void connman_service_unref_debug(struct connman_service *service,
g_hash_table_remove(service_hash, service->identifier);
}
-#if defined TIZEN_EXT
+#if defined TIZEN_EXT && defined TIZEN_EXT_INS
static int calculate_score_last_user_selection(struct connman_service *service)
{
int score = 0;
@@ -8033,19 +8037,17 @@ static int calculate_score(struct connman_service *service)
score_frequency + score_security_priority +
score_internet_connection + score_strength;
-#if defined TIZEN_EXT_INS
service->score_last_user_selection = score_last_user_selection;
service->score_last_connected = score_last_connected;
service->score_frequency = score_frequency;
service->score_security_priority = score_security_priority;
service->score_internet_connection = score_internet_connection;
service->score_strength = score_strength;
-#endif
service->ins_score = score;
return score;
}
-#endif
+#endif /* defined TIZEN_EXT && defined TIZEN_EXT_INS */
static gint service_compare(gconstpointer a, gconstpointer b)
{
@@ -8053,12 +8055,12 @@ static gint service_compare(gconstpointer a, gconstpointer b)
struct connman_service *service_b = (void *) b;
enum connman_service_state state_a, state_b;
bool a_connected, b_connected;
-#if defined TIZEN_EXT
+#if defined TIZEN_EXT && defined TIZEN_EXT_INS
int score_a;
int score_b;
-#else
+#else /* defined TIZEN_EXT && defined TIZEN_EXT_INS */
gint strength;
-#endif
+#endif /* defined TIZEN_EXT && defined TIZEN_EXT_INS */
state_a = service_a->state;
state_b = service_b->state;
@@ -8166,21 +8168,21 @@ static gint service_compare(gconstpointer a, gconstpointer b)
return 1;
}
-#if defined TIZEN_EXT
+#if defined TIZEN_EXT && defined TIZEN_EXT_INS
score_a = calculate_score(service_a);
score_b = calculate_score(service_b);
if (score_b != score_a)
return score_b - score_a;
-#else
+#else /* defined TIZEN_EXT && defined TIZEN_EXT_INS */
strength = (gint) service_b->strength - (gint) service_a->strength;
if (strength)
return strength;
-#endif
+#endif /* defined TIZEN_EXT && defined TIZEN_EXT_INS */
return g_strcmp0(service_a->name, service_b->name);
}
-#if defined TIZEN_EXT_INS
+#if defined TIZEN_EXT && defined TIZEN_EXT_INS
static void print_service_sort(gpointer data, gpointer user_data)
{
struct connman_service *service = data;
@@ -8195,15 +8197,15 @@ static void print_service_sort(gpointer data, gpointer user_data)
service->score_security_priority, service->score_internet_connection,
service->score_strength);
}
-#endif
+#endif /* defined TIZEN_EXT && defined TIZEN_EXT_INS */
static void service_list_sort(void)
{
if (service_list && service_list->next) {
service_list = g_list_sort(service_list, service_compare);
-#if defined TIZEN_EXT_INS
+#if defined TIZEN_EXT && defined TIZEN_EXT_INS
g_list_foreach(service_list, print_service_sort, NULL);
-#endif
+#endif /* defined TIZEN_EXT && defined TIZEN_EXT_INS */
service_schedule_changed();
}
}
@@ -9979,9 +9981,9 @@ int __connman_service_connect(struct connman_service *service,
DBG("service %p err %d", service, err);
service->connect_reason = reason;
-#if defined TIZEN_EXT
+#if defined TIZEN_EXT && defined TIZEN_EXT_INS
connect_reason_changed(service);
-#endif
+#endif /* defined TIZEN_EXT && defined TIZEN_EXT_INS */
if (err >= 0)
return 0;
@@ -11126,7 +11128,7 @@ static struct connman_agent_driver agent_driver = {
.context_unref = agent_context_unref,
};
-#if defined TIZEN_EXT
+#if defined TIZEN_EXT && defined TIZEN_EXT_INS
static void ins_setting_init(void)
{
int i;
@@ -11212,7 +11214,7 @@ static void ins_setting_init(void)
DBG("signal_level3_5ghz [%d]", ins_settings.signal_level3_5ghz);
DBG("signal_level3_24ghz [%d]", ins_settings.signal_level3_24ghz);
}
-#endif
+#endif /* defined TIZEN_EXT && defined TIZEN_EXT_INS */
int __connman_service_init(void)
{
@@ -11241,9 +11243,9 @@ int __connman_service_init(void)
remove_unprovisioned_services();
-#if defined TIZEN_EXT
+#if defined TIZEN_EXT && defined TIZEN_EXT_INS
ins_setting_init();
-#endif
+#endif /* defined TIZEN_EXT && defined TIZEN_EXT_INS */
return 0;
}
diff --git a/src/storage.c b/src/storage.c
index 9be60def..fb6dc149 100755
--- a/src/storage.c
+++ b/src/storage.c
@@ -35,9 +35,9 @@
#define SETTINGS "settings"
#define DEFAULT "default.profile"
-#if defined TIZEN_EXT
+#if defined TIZEN_EXT && defined TIZEN_EXT_INS
#define INS_SETTINGS "settings.ins"
-#endif
+#endif /* defined TIZEN_EXT && defined TIZEN_EXT_INS */
#define MODE (S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | \
S_IXGRP | S_IROTH | S_IXOTH)
@@ -133,7 +133,7 @@ int __connman_storage_save_global(GKeyFile *keyfile)
return ret;
}
-#if defined TIZEN_EXT
+#if defined TIZEN_EXT && defined TIZEN_EXT_INS
GKeyFile *__connman_storage_load_ins(void)
{
gchar *pathname;
@@ -165,7 +165,7 @@ int __connman_storage_save_ins(GKeyFile *keyfile)
return ret;
}
-#endif
+#endif /* defined TIZEN_EXT && defined TIZEN_EXT_INS */
void __connman_storage_delete_global(void)
{