Name: net-config
Summary: TIZEN Network Configuration service
-Version: 1.1.63
+Version: 1.1.64
Release: 2
Group: System/Network
License: Apache-2.0
{
INFO("Got gdbus name: [%s] and gdbus connection: [%p]", name, conn);
- if (g_callback != NULL) {
+ if (g_callback != NULL)
g_callback();
- }
}
static void _lost_name_cb(GDBusConnection *conn, const gchar *name,
ERR("Failed to create cert directory");
}
-#if !GLIB_CHECK_VERSION(2,36,0)
+#if !GLIB_CHECK_VERSION(2, 36, 0)
g_type_init();
#endif
if (!system_info_get_platform_bool(ETHERNET_FEATURE, ðernet_feature_supported)) {
if (ethernet_feature_supported == TRUE) {
- //Register the callback to check the ethernet Plug-in /Plug-out Status
+ /* Register the callback to check the ethernet Plug-in /Plug-out Status */
check_ethernet_monitor_timer = g_timeout_add(ETH_POLLING_TIME,
__net_ethernet_cable_status_polling_callback,
&check_ethernet_monitor_timer);
/*remove the Timer*/
- if(check_ethernet_monitor_timer >0)
+ if (check_ethernet_monitor_timer > 0)
g_source_remove(check_ethernet_monitor_timer);
wifi_state_notifier_cleanup();
ERR("dbus method return error");
msg = g_strdup_printf("%s.%s", NETCONFIG_ERROR_INTERFACE, message);
- g_dbus_method_invocation_return_error(context, netconfig_error_quark(), error,"%s", msg);
+ g_dbus_method_invocation_return_error(context, netconfig_error_quark(), error, "%s", msg);
g_free(msg);
}
GVariant *params = NULL;
GVariantBuilder *builder;
- builder = g_variant_builder_new(G_VARIANT_TYPE ("as"));
+ builder = g_variant_builder_new(G_VARIANT_TYPE("as"));
g_variant_builder_add(builder, "s", server);
- params = g_variant_new("(sv)",param0, g_variant_builder_end(builder));
+ params = g_variant_new("(sv)", param0, g_variant_builder_end(builder));
g_variant_builder_unref(builder);
reply = netconfig_invoke_dbus_method(CONNMAN_SERVICE,
gboolean automatic_time_update = FALSE;
wifi_service_state_e wifi_state = NETCONFIG_WIFI_UNKNOWN;
- if (node != NULL) {
+ if (node != NULL)
automatic_time_update = vconf_keynode_get_bool(node);
- } else {
+ else
vconf_get_bool(VCONFKEY_SETAPPL_STATE_AUTOMATIC_TIME_UPDATE_BOOL, &automatic_time_update);
- }
if (automatic_time_update == FALSE) {
INFO("Automatic time update is changed to 'FALSE'");
memset(&ifr, 0, sizeof(ifr));
g_strlcpy(ifr.ifr_name, "eth0", IFNAMSIZ);
- if (ioctl(soketfd, SIOCGMIIPHY, &ifr) < 0){
+ if (ioctl(soketfd, SIOCGMIIPHY, &ifr) < 0) {
error = -errno;
strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER);
ERR("SIOCGMIIPHY on eth0 failed : [%d] [%s]", errno, error_buf);
mdata = (struct _stMData *)&ifr.ifr_data;
mdata->reg_num = ETH_REG_BMSR;
- if (ioctl(soketfd, SIOCGMIIREG, &ifr) < 0){
+ if (ioctl(soketfd, SIOCGMIIREG, &ifr) < 0) {
error = -errno;
strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER);
- ERR("SIOCGMIIREG on %s failed , [%d] [%s] ", ifr.ifr_name,errno,error_buf);
+ ERR("SIOCGMIIREG on %s failed , [%d] [%s] ", ifr.ifr_name, errno, error_buf);
goto done;
}
ret = mdata->val_out;
ret = ret & BMSR_LINK_VALID;
- if(ret == 4) {
- if(!g_chk_eth_send_notification)
+ if (ret == 4) {
+ if (!g_chk_eth_send_notification)
netconfig_network_notify_ethernet_cable_state("ATTACHED");
g_chk_eth_send_notification = TRUE;
} else if (ret == 0) {
- if(g_chk_eth_send_notification)
+ if (g_chk_eth_send_notification)
netconfig_network_notify_ethernet_cable_state("DETACHED");
g_chk_eth_send_notification = FALSE;
}
int netconfig_get_ethernet_cable_state(int *status)
{
int error = 0;
- if(status == NULL) {
+ if (status == NULL) {
DBG("Error !!! Invalid Parameter\n");
return -1;
}
- if((error = netconfig_ethernet_cable_plugin_status_check()) != 0) {
+ if ((error = netconfig_ethernet_cable_plugin_status_check()) != 0) {
DBG("Error !!! Failed to check ethernet cable status [%d]\n", error);
return -1;
}
- if(g_chk_eth_send_notification == TRUE)
+ if (g_chk_eth_send_notification == TRUE)
*status = 1; /* Ethernet cable Attached */
else
*status = 0; /* Ethernet cable Deattached */
const gchar *value = NULL;
while (g_variant_iter_loop(array, "{sv}", &key, &variant)) {
- if (g_strcmp0(key, "State") != 0) {
+ if (g_strcmp0(key, "State") != 0)
continue;
- }
if (g_variant_is_of_type(variant, G_VARIANT_TYPE_STRING)) {
value = g_variant_get_string(variant, NULL);
g_variant_get(message, "(a(oa{sv}))", &iter);
while (g_variant_iter_loop(iter, "(oa{sv})", &object_path, &next)) {
- if (object_path == NULL) {
+ if (object_path == NULL)
continue;
- }
- if(netconfig_is_cellular_profile(object_path) && !netconfig_is_cellular_internet_profile(object_path)){
+ if (netconfig_is_cellular_profile(object_path) && !netconfig_is_cellular_internet_profile(object_path))
continue;
- }
if (__netconfig_is_connected(next) == TRUE) {
default_profile = g_strdup(object_path);
g_variant_unref(message);
if (iter)
- g_variant_iter_free (iter);
+ g_variant_iter_free(iter);
if (iter1)
- g_variant_iter_free (iter1);
+ g_variant_iter_free(iter1);
return;
}
/* Disable clatd if it is in running state */
netconfig_clatd_disable();
- }
- else if (profile != NULL) {
+ } else if (profile != NULL) {
char *old_ip = vconf_get_str(VCONFKEY_NETWORK_IP);
char *old_proxy = vconf_get_str(VCONFKEY_NETWORK_PROXY);
netconfig_set_system_event(SYS_EVENT_NETWORK_STATUS,
EVT_KEY_NETWORK_STATUS, EVT_VAL_NETWORK_WIFI);
- }
- else if (netconfig_is_cellular_profile(profile) ){
+ } else if (netconfig_is_cellular_profile(profile)) {
- if( !netconfig_is_cellular_internet_profile(profile)){
+ if (!netconfig_is_cellular_internet_profile(profile)) {
DBG("connection is not a internet profile - stop to update the cellular state");
return;
}
EVT_KEY_NETWORK_STATUS, EVT_VAL_NETWORK_CELLULAR);
/* Enable clatd if IPv6 is set and no IPv4 address */
- if (!ip_addr && ip_addr6 )
+ if (!ip_addr && ip_addr6)
netconfig_clatd_enable();
- }
- else if (netconfig_is_ethernet_profile(profile) == TRUE){
+ } else if (netconfig_is_ethernet_profile(profile) == TRUE) {
netconfig_set_vconf_int(VCONFKEY_NETWORK_STATUS, VCONFKEY_NETWORK_ETHERNET);
netconfig_set_system_event(SYS_EVENT_NETWORK_STATUS,
EVT_KEY_NETWORK_STATUS, EVT_VAL_NETWORK_ETHERNET);
- }
- else if (netconfig_is_bluetooth_profile(profile) == TRUE){
+ } else if (netconfig_is_bluetooth_profile(profile) == TRUE) {
netconfig_set_vconf_int(VCONFKEY_NETWORK_STATUS, VCONFKEY_NETWORK_BLUETOOTH);
netconfig_set_system_event(SYS_EVENT_NETWORK_STATUS,
EVT_KEY_NETWORK_STATUS, EVT_VAL_NETWORK_BT);
- }
- else{
+ } else{
netconfig_set_vconf_int(VCONFKEY_NETWORK_STATUS, VCONFKEY_NETWORK_OFF);
netconfig_set_system_event(SYS_EVENT_NETWORK_STATUS,
EVT_KEY_NETWORK_STATUS, EVT_VAL_NETWORK_DISCONNECTED);
g_variant_get(message, "(a(oa{sv}))", &iter);
while (g_variant_iter_loop(iter, "(oa{sv})", &path, &next)) {
- if (path == NULL) {
+ if (path == NULL)
continue;
- }
while (g_variant_iter_loop(next, "{sv}", &key, &variant)) {
gboolean data;
g_variant_get(message, "(a(oa{sv}))", &iter);
while (g_variant_iter_loop(iter, "(oa{sv})", &path, &next)) {
- if (path == NULL) {
+ if (path == NULL)
continue;
- }
if (g_str_has_prefix(path,
CONNMAN_WIFI_SERVICE_PROFILE_PREFIX) == TRUE) {
return;
}
- builder = g_variant_builder_new(G_VARIANT_TYPE ("a{sv}"));
+ builder = g_variant_builder_new(G_VARIANT_TYPE("a{sv}"));
g_variant_builder_add(builder, "{sv}", prop_key, g_variant_new_string(key));
params = g_variant_new("(@a{sv})", g_variant_builder_end(builder));
}
}
- //default profile is NULL and new connected profile is NULL
- if( !profile ){
+ /* default profile is NULL and new connected profile is NULL */
+ if (!profile) {
profile = __netconfig_get_default_profile();
if (profile && netconfig_is_cellular_profile(profile) &&
- !netconfig_is_cellular_internet_profile(profile)){
+ !netconfig_is_cellular_internet_profile(profile)) {
DBG("not a default cellular profile");
profile = NULL;
}
- if(!profile){
+ if (!profile) {
__netconfig_update_default_connection_info();
return;
}
/* Check Ethernet Cable Plug-in /Plug-out Status */
void netconfig_network_notify_ethernet_cable_state(const char *key)
{
- __netconfig_network_notify_result("EthernetCableState", key);
+ __netconfig_network_notify_result("EthernetCableState", key);
}
static gboolean handle_add_route(
DBG("ip_addr(%s), netmask(%s), interface(%s), gateway(%s)", ip_addr, netmask, interface, gateway);
- switch(address_family) {
- case AF_INET:
- if (ip_addr == NULL || netmask == NULL || interface == NULL) {
- ERR("Invalid parameter");
- netconfig_error_invalid_parameter(context);
- return FALSE;
- }
+ switch (address_family) {
+ case AF_INET:
+ if (ip_addr == NULL || netmask == NULL || interface == NULL) {
+ ERR("Invalid parameter");
+ netconfig_error_invalid_parameter(context);
+ return FALSE;
+ }
- if (netconfig_execute_file(path, args, envs) < 0) {
- DBG("Failed to add a new route");
- netconfig_error_permission_denied(context);
- return FALSE;
- }
+ if (netconfig_execute_file(path, args, envs) < 0) {
+ DBG("Failed to add a new route");
+ netconfig_error_permission_denied(context);
+ return FALSE;
+ }
- break;
- case AF_INET6:
- if (ip_addr == NULL || interface == NULL || gateway == NULL) {
- ERR("Invalid parameter");
- netconfig_error_invalid_parameter(context);
- return FALSE;
- }
+ break;
+ case AF_INET6:
+ if (ip_addr == NULL || interface == NULL || gateway == NULL) {
+ ERR("Invalid parameter");
+ netconfig_error_invalid_parameter(context);
+ return FALSE;
+ }
- buf = ip_addr;
- ch = strchr(buf, '/');
- pos = ch - buf + 1;
- if (ch) {
- prefix_len = atoi(ch + 1);
- ip_addr[pos-1] = '\0';
- } else {
- prefix_len = 128;
- }
+ buf = ip_addr;
+ ch = strchr(buf, '/');
+ pos = ch - buf + 1;
+ if (ch) {
+ prefix_len = atoi(ch + 1);
+ ip_addr[pos-1] = '\0';
+ } else {
+ prefix_len = 128;
+ }
- if (netconfig_add_route_ipv6(ip_addr, interface, gateway, prefix_len) < 0) {
- DBG("Failed to add a new route");
- netconfig_error_permission_denied(context);
- return FALSE;
- }
- break;
- default:
- DBG("Unknown Address Family");
- netconfig_error_invalid_parameter(context);
+ if (netconfig_add_route_ipv6(ip_addr, interface, gateway, prefix_len) < 0) {
+ DBG("Failed to add a new route");
+ netconfig_error_permission_denied(context);
return FALSE;
+ }
+ break;
+ default:
+ DBG("Unknown Address Family");
+ netconfig_error_invalid_parameter(context);
+ return FALSE;
}
DBG("Successfully added a new route");
DBG("ip_addr(%s), netmask(%s), interface(%s), gateway(%s)", ip_addr, netmask, interface, gateway);
- switch(address_family) {
- case AF_INET:
- if (ip_addr == NULL || netmask == NULL || interface == NULL) {
- DBG("Invalid parameter!");
- netconfig_error_invalid_parameter(context);
- return FALSE;
- }
- if (netconfig_execute_file(path, args, envs) < 0) {
- DBG("Failed to remove the route");
- netconfig_error_permission_denied(context);
- return FALSE;
- }
- break;
- case AF_INET6:
- if (ip_addr == NULL || interface == NULL || gateway == NULL) {
- DBG("Invalid parameter!");
- netconfig_error_invalid_parameter(context);
- return FALSE;
- }
+ switch (address_family) {
+ case AF_INET:
+ if (ip_addr == NULL || netmask == NULL || interface == NULL) {
+ DBG("Invalid parameter!");
+ netconfig_error_invalid_parameter(context);
+ return FALSE;
+ }
+ if (netconfig_execute_file(path, args, envs) < 0) {
+ DBG("Failed to remove the route");
+ netconfig_error_permission_denied(context);
+ return FALSE;
+ }
+ break;
+ case AF_INET6:
+ if (ip_addr == NULL || interface == NULL || gateway == NULL) {
+ DBG("Invalid parameter!");
+ netconfig_error_invalid_parameter(context);
+ return FALSE;
+ }
- buf = ip_addr;
- ch = strchr(buf, '/');
- pos = ch - buf + 1;
- if (ch) {
- prefix_len = atoi(ch + 1);
- ip_addr[pos-1] = '\0';
- } else {
- prefix_len = 128;
- }
+ buf = ip_addr;
+ ch = strchr(buf, '/');
+ pos = ch - buf + 1;
+ if (ch) {
+ prefix_len = atoi(ch + 1);
+ ip_addr[pos-1] = '\0';
+ } else {
+ prefix_len = 128;
+ }
- if (netconfig_del_route_ipv6(ip_addr, interface, gateway, prefix_len) < 0) {
- DBG("Failed to remove the route");
- netconfig_error_permission_denied(context);
- return FALSE;
- }
- break;
- default:
- DBG("Unknown Address Family");
- netconfig_error_invalid_parameter(context);
+ if (netconfig_del_route_ipv6(ip_addr, interface, gateway, prefix_len) < 0) {
+ DBG("Failed to remove the route");
+ netconfig_error_permission_denied(context);
return FALSE;
+ }
+ break;
+ default:
+ DBG("Unknown Address Family");
+ netconfig_error_invalid_parameter(context);
+ return FALSE;
}
DBG("Successfully removed the route");
int state = 0;
ret = netconfig_get_ethernet_cable_state(&state);
- if(ret != 0) {
+ if (ret != 0) {
DBG("Failed to get ethernet cable state");
netconfig_error_fail_ethernet_cable_state(context);
return FALSE;
if (g_strcmp0(key, "Powered") == 0) {
/* Power state */
value = g_variant_get_boolean(var);
- if (value == TRUE) {
+ if (value == TRUE)
wifi_state_update_power_state(TRUE);
- } else {
+ else
wifi_state_update_power_state(FALSE);
- }
} else if (g_strcmp0(key, "Connected") == 0) {
/* Connection state */
value = g_variant_get_boolean(var);
- if (value == TRUE) {
+ if (value == TRUE)
wifi_state_set_tech_state(NETCONFIG_WIFI_TECH_CONNECTED);
- } else {
+ else
wifi_state_set_tech_state(NETCONFIG_WIFI_TECH_POWERED);
- }
} else if (g_strcmp0(key, "Tethering") == 0) {
/* Tethering state */
wifi_state_set_tech_state(NETCONFIG_WIFI_TECH_TETHERED);
if (sigvalue == NULL)
goto done;
- if (g_strcmp0(sig, CONNMAN_SIGNAL_PROPERTY_CHANGED) != 0) {
+ if (g_strcmp0(sig, CONNMAN_SIGNAL_PROPERTY_CHANGED) != 0)
goto done;
- }
if (g_strcmp0(sigvalue, "State") == 0) {
g_variant_get(variant, "s", &property);
} else {
if (g_strcmp0(property, "ready") == 0 || g_strcmp0(property, "online") == 0) {
if (netconfig_get_default_profile() == NULL) {
- if(!netconfig_is_cellular_profile(path)) {
+ if (!netconfig_is_cellular_profile(path))
netconfig_update_default_profile(path);
- } else {
- if (netconfig_is_cellular_internet_profile(path)) {
+ else {
+ if (netconfig_is_cellular_internet_profile(path))
netconfig_update_default_profile(path);
- }
}
}
goto done;
netconfig_update_default_profile(NULL);
- } else if (g_strcmp0(property, "association") == 0 || g_strcmp0(property, "configuration") == 0) {
+ } else if (g_strcmp0(property, "association") == 0 || g_strcmp0(property, "configuration") == 0) {
if (netconfig_get_default_profile() == NULL)
goto done;
break;
}
- if(!is_cell_prof)
+ if (!is_cell_prof)
netconfig_update_default_profile(
service_path);
else if (is_cell_internet_prof) {
proxy = netconfig_get_env(HTTP_PROXY);
DBG("Get system proxy: %s", proxy);
- if (proxy != NULL){
+ if (proxy != NULL) {
vconf_set_str(VCONFKEY_NETWORK_PROXY, proxy);
free(proxy);
}
gboolean request_started;
};
-const static char* url_list[] = {
+static const char* url_list[] = {
"www.google.com",
"www.msn.com",
"www.yahoo.com",
"m.google.com",
"www.amazon.com",
"www.youtube.com"
- };
+};
#define URL_LIST_NUM 6
{
DBG("Timer timed-out");
enum netconfig_internet_check_state prev_state = (enum netconfig_internet_check_state)GPOINTER_TO_INT(data);
- INFO("Prev_state: state=%d (1:dns check / 2:packet check)",prev_state);
+ INFO("Prev_state: state=%d (1:dns check / 2:packet check)", prev_state);
if (net_params == NULL)
return FALSE;
__internet_check_state(INTERNET_CHECK_STATE_PACKET_CHECK);
return;
- cleanup:
+cleanup:
__internet_check_state(INTERNET_CHECK_STATE_NONE);
}
list = g_resolver_lookup_by_name_finish((GResolver *)src, res, &error);
if (error != NULL) {
- if (error->code == G_IO_ERROR_CANCELLED) {
+ if (error->code == G_IO_ERROR_CANCELLED)
ERR("G_IO_ERROR_CANCELLED is called[%s]", error->message);
- }
g_error_free(error);
}
is_internet_available = FALSE;
/* If the host IP is resolved, directly go for connecting to sockets*/
- if (__netconfig_obtain_host_ip_addr() == TRUE) {
+ if (__netconfig_obtain_host_ip_addr() == TRUE)
__netconfig_connect_sockets();
- }
}
void netconfig_stop_internet_check(void)
#if defined TIZEN_WEARABLE
int wc_launch_syspopup(netconfig_wcpopup_type_e type)
{
- int ret;
- bundle* b;
- char *ssid = NULL;
-
- b = bundle_create();
- if (!b) {
- ERR("Failed to create bundle");
- return -1;
- }
-
- switch (type) {
- case WC_POPUP_TYPE_SESSION_OVERLAPPED:
- bundle_add(b, "event-type", "wps-session-overlapped");
- break;
- case WC_POPUP_TYPE_WIFI_CONNECTED:
- ssid = vconf_get_str(VCONFKEY_WIFI_CONNECTED_AP_NAME);
- if (ssid == NULL) {
- ERR("Failed to get connected ap ssid");
- ssid = g_strdup(" ");
- }
- bundle_add(b, "event-type", "wifi-connected");
- bundle_add(b, "ssid", ssid);
- if (ssid)
- g_free(ssid);
- break;
- case WC_POPUP_TYPE_WIFI_RESTRICT:
- bundle_add(b, "event-type", "wifi-restrict");
- break;
- default:
- ERR("Popup is not supported[%d]", type);
- bundle_free(b);
- return -1;
- }
+ int ret;
+ bundle* b;
+ char *ssid = NULL;
- ret = syspopup_launch("wc-syspopup", b);
- if (ret < 0)
- ERR("Failed to launch syspopup");
+ b = bundle_create();
+ if (!b) {
+ ERR("Failed to create bundle");
+ return -1;
+ }
+
+ switch (type) {
+ case WC_POPUP_TYPE_SESSION_OVERLAPPED:
+ bundle_add(b, "event-type", "wps-session-overlapped");
+ break;
+ case WC_POPUP_TYPE_WIFI_CONNECTED:
+ ssid = vconf_get_str(VCONFKEY_WIFI_CONNECTED_AP_NAME);
+ if (ssid == NULL) {
+ ERR("Failed to get connected ap ssid");
+ ssid = g_strdup(" ");
+ }
+ bundle_add(b, "event-type", "wifi-connected");
+ bundle_add(b, "ssid", ssid);
+ if (ssid)
+ g_free(ssid);
+ break;
+ case WC_POPUP_TYPE_WIFI_RESTRICT:
+ bundle_add(b, "event-type", "wifi-restrict");
+ break;
+ default:
+ ERR("Popup is not supported[%d]", type);
+ bundle_free(b);
+ return -1;
+ }
- bundle_free(b);
+ ret = syspopup_launch("wc-syspopup", b);
+ if (ret < 0)
+ ERR("Failed to launch syspopup");
- return ret;
+ bundle_free(b);
+ return ret;
}
int wc_launch_popup(netconfig_wcpopup_type_e type)
{
FILE *fp;
char buf[256], *entry = NULL, *value = NULL, *last;
- int len=0;
+ int len = 0;
if (!key)
return NULL;
if (entry) {
if (strstr(entry, key)) {
entry = strtok_r(NULL, "\n", &last);
- if(entry){
+ if (entry) {
len = strlen(entry);
value = (char*)malloc(len+1);
g_strlcpy(value, entry, len+1);
- }
- else{
+ } else {
value = (char*)malloc(sizeof(char));
g_strlcpy(value, "\n", sizeof(char));
}
ERR("Fail to open %s", MAC_INFO_FILEPATH);
return;
}
- if (fgets(mac_str, sizeof(mac_str), file) == NULL ) {
+ if (fgets(mac_str, sizeof(mac_str), file) == NULL) {
ERR("Fail to read mac address");
fclose(file);
return;
&error);
if (reply == NULL) {
- if (error != NULL) {
- if (g_strcmp0(error->message,
- "GDBus.Error:net.connman.Error.AlreadyExists: Already exists") == 0) {
+ if (error != NULL) {
+ if (g_strcmp0(error->message,
+ "GDBus.Error:net.connman.Error.AlreadyExists: Already exists") == 0) {
break;
- } else {
- ERR("Fail to register agent [%d: %s]",
- error->code, error->message);
- }
-
- g_error_free(error);
- } else
- ERR("Fail to register agent");
+ } else {
+ ERR("Fail to register agent [%d: %s]",
+ error->code, error->message);
+ }
+
+ g_error_free(error);
+ } else
+ ERR("Fail to register agent");
} else
g_variant_unref(reply);
GByteArray *array = g_byte_array_new();
g_variant_get(value, "ay", &iter1);
- while(g_variant_iter_loop(iter1, "y", &char_value)) {
+ while (g_variant_iter_loop(iter1, "y", &char_value))
g_byte_array_append(array, &char_value, 1);
- }
g_variant_iter_free(iter1);
if (array != NULL && (array->len > 0)) {
agent.ssid = g_byte_array_sized_new(array->len);
service, CONNMAN_SERVICE_INTERFACE, "Connect",
NULL, __netconfig_wifi_connect_reply);
if (reply == TRUE) {
- g_dbus_method_invocation_return_value (context, NULL);
+ g_dbus_method_invocation_return_value(context, NULL);
} else {
error = g_error_new(G_DBUS_ERROR,
G_DBUS_ERROR_AUTH_FAILED,
DBG("Agent fields requested for service: %s", service);
- builder = g_variant_builder_new(G_VARIANT_TYPE ("a{sv}"));
+ builder = g_variant_builder_new(G_VARIANT_TYPE("a{sv}"));
g_variant_get(fields, "a{sv}", &iter);
while (g_variant_iter_loop(iter, "{sv}", &field, &r_value)) {
} else if (g_strcmp0(field, NETCONFIG_AGENT_FIELD_WPS) == 0 &&
(agent.wps_pbc == TRUE || agent.wps_pin != NULL)) {
if (agent.wps_pbc == TRUE) {
- // Sending empty string for WPS push button method
+ /* Sending empty string for WPS push button method */
g_variant_builder_add(builder, "{sv}", NETCONFIG_AGENT_FIELD_WPS, g_variant_new_string(""));
updated = TRUE;
agent.ssid != NULL) {
int i = 0;
GVariantBuilder *builder1 = NULL;
- builder1 = g_variant_builder_new (G_VARIANT_TYPE ("ay"));
+ builder1 = g_variant_builder_new(G_VARIANT_TYPE("ay"));
- for (i = 0; i < (agent.ssid->len); i++) {
- g_variant_builder_add (builder1, "y", agent.ssid->data[i]);
- }
+ for (i = 0; i < (agent.ssid->len); i++)
+ g_variant_builder_add(builder1, "y", agent.ssid->data[i]);
g_variant_builder_add(builder, "{sv}", NETCONFIG_AGENT_FIELD_SSID, g_variant_builder_end(builder1));
if (builder1 != NULL)
g_variant_iter_free(iter);
- if (NULL == out_table){
+ if (NULL == out_table) {
net_connman_agent_complete_request_input(connman_agent, context, out_table);
return FALSE;
}
if (updated == TRUE)
- g_dbus_method_invocation_return_value (context, out_table);
+ g_dbus_method_invocation_return_value(context, out_table);
else {
GError *error = NULL;
error = g_error_new(G_DBUS_ERROR,
net_connman_agent_complete_report_error(connman_agent, context);
DBG("Agent error for service[%s] - [%s]", service, error);
- // Do something when it failed to make a connection
+ /* Do something when it failed to make a connection */
return ret;
}
void* data;
};
-static struct poll_timer_data timer_data =
- {QUERY_FOR_INTERNET_INTERVAL, 0, NULL};
+static struct poll_timer_data timer_data = {
+ QUERY_FOR_INTERNET_INTERVAL, 0, NULL};
static gboolean __check_ignore_portal_list(const char * ssid)
{
DBG("csc string [%s]", def_str);
gchar ** ignore_ap_list = g_strsplit(def_str, ",", 0);
ignore_ap_count = g_strv_length(ignore_ap_list);
- for(i = 0; i < ignore_ap_count; i++) {
+ for (i = 0; i < ignore_ap_count; i++) {
DBG("[%d] - [%s]", i, ignore_ap_list[i]);
if (strncmp(ignore_ap_list[i], ssid, strlen(ssid)) == 0) {
g_strfreev(ignore_ap_list);
ignore_portal = __check_ignore_portal_list(ssid);
- if (ignore_portal == TRUE){
+ if (ignore_portal == TRUE) {
net_connman_agent_complete_request_browser(connman_agent, context);
return TRUE;
}
}
#if defined TIZEN_WEARABLE
- if (is_portal_msg_shown){
+ if (is_portal_msg_shown) {
net_connman_agent_complete_request_browser(connman_agent, context);
return TRUE;
}
static struct bgscan_timer_data *__netconfig_wifi_bgscan_get_bgscan_data(void)
{
- static struct bgscan_timer_data timer_data =
- {SCAN_EXPONENTIAL_MIN, WIFI_BGSCAN_MODE_EXPONENTIAL, 0};
+ static struct bgscan_timer_data timer_data = {
+ SCAN_EXPONENTIAL_MIN, WIFI_BGSCAN_MODE_EXPONENTIAL, 0};
return &timer_data;
}
if (__netconfig_wifi_bgscan_get_mode() == WIFI_BGSCAN_MODE_EXPONENTIAL)
return TRUE;
- if (state == NETCONFIG_WIFI_ASSOCIATION ||state == NETCONFIG_WIFI_CONFIGURATION) {
+ if (state == NETCONFIG_WIFI_ASSOCIATION || state == NETCONFIG_WIFI_CONFIGURATION) {
/* During Wi-Fi connecting, Wi-Fi can be disappeared.
* After 1 sec, try scan even if connecting state */
if (retries < 2)
int pm_state = VCONFKEY_PM_STATE_NORMAL;
old_mode = __netconfig_wifi_bgscan_get_mode();
- if (old_mode == scan_mode){
+ if (old_mode == scan_mode) {
wifi_complete_set_bgscan(wifi, context);
return TRUE;
}
{
netconfig_wifi_set_bgscan_pause(FALSE);
- wifi_complete_resume_bgscan (wifi, context);
+ wifi_complete_resume_bgscan(wifi, context);
return TRUE;
}
#define WIFI_CONFIG_PREFIX "wifi_"
#define MAC_ADDRESS_LENGTH 12
-#define WIFI_PREFIX_LENGTH MAC_ADDRESS_LENGTH + 6 // wifi_485a3f2f506a_
-#define PROFILE_PREFIX_LENGTH WIFI_PREFIX_LENGTH + 21 // /net/connman/service/wifi_485a3f2f506a_
+#define WIFI_PREFIX_LENGTH MAC_ADDRESS_LENGTH + 6 /* wifi_485a3f2f506a_ */
+#define PROFILE_PREFIX_LENGTH WIFI_PREFIX_LENGTH + 21 /* /net/connman/service/wifi_485a3f2f506a_ */
#define WIFI_MAC_ADD_LENGTH 17
#define WIFI_MAC_ADD_PATH "/sys/class/net/wlan0/address"
tmp = g_ascii_strdown(tmp_mac, (gssize)strlen(tmp_mac));
g_free(tmp_mac);
while (tmp[i]) {
- if (tmp[i] != ':') {
+ if (tmp[i] != ':')
mac[j++] = tmp[i];
- }
i++;
}
mac[12] = '\0';
}
config->proxy_address = g_key_file_get_string(keyfile, group_name, WIFI_CONFIG_PROXY_SERVER, NULL);
hidden = g_key_file_get_boolean(keyfile, group_name, WIFI_CONFIG_HIDDEN, NULL);
- if (hidden) {
+ if (hidden)
config->is_hidden = g_strdup("TRUE");
- } else {
+ else
config->is_hidden = g_strdup("FALSE");
- }
if (g_strcmp0(config->security_type, WIFI_SECURITY_EAP) == 0) {
config->eap_config->anonymous_identity = g_key_file_get_string(keyfile, group_name, WIFI_CONFIG_EAP_ANONYMOUS_IDENTITY, NULL);
if (g_strcmp0(key, WIFI_CONFIG_PROXY_METHOD) == 0) {
g_key_file_set_string(keyfile, group_name, key, value);
- }else if (g_strcmp0(key, WIFI_CONFIG_PROXY_SERVER) == 0) {
+ } else if (g_strcmp0(key, WIFI_CONFIG_PROXY_SERVER) == 0) {
g_key_file_set_string(keyfile, group_name, key, value);
} else if (g_strcmp0(key, WIFI_CONFIG_HIDDEN) == 0) {
gboolean hidden = FALSE;
- if (g_strcmp0(value, "TRUE") == 0) {
+ if (g_strcmp0(value, "TRUE") == 0)
hidden = TRUE;
- }
g_key_file_set_boolean(keyfile, group_name, key, hidden);
} else if (g_strcmp0(key, WIFI_CONFIG_EAP_ANONYMOUS_IDENTITY) == 0) {
g_key_file_set_string(keyfile, group_name, key, value);
val = g_key_file_get_string(keyfile, group_name, WIFI_CONFIG_PROXY_SERVER, NULL);
} else if (g_strcmp0(key, WIFI_CONFIG_HIDDEN) == 0) {
hidden = g_key_file_get_boolean(keyfile, group_name, WIFI_CONFIG_HIDDEN, NULL);
- if (hidden) {
+ if (hidden)
val = g_strdup("TRUE");
- } else {
+ else
val = g_strdup("FALSE");
- }
} else if (g_strcmp0(key, WIFI_CONFIG_EAP_ANONYMOUS_IDENTITY) == 0) {
val = g_key_file_get_string(keyfile, group_name, WIFI_CONFIG_EAP_ANONYMOUS_IDENTITY, NULL);
} else if (g_strcmp0(key, WIFI_CONFIG_EAP_CACERT) == 0) {
return ret;
}
-// dbus method
+/* dbus method */
gboolean handle_get_config_ids(Wifi *wifi, GDBusMethodInvocation *context)
{
guint i = 0;
config_ids = g_slist_nth(config_ids, 0);
g_slist_free_full(config_ids, g_free);
- wifi_complete_get_config_ids(wifi, context, (const gchar * const*)result);
+ wifi_complete_get_config_ids(wifi, context, (const gchar * const *)result);
if (result)
g_free(result);
g_key_file_set_boolean(keyfile, group_name, WIFI_CONFIG_FAVORITE, conf->favorite);
g_key_file_set_boolean(keyfile, group_name, WIFI_CONFIG_AUTOCONNECT, conf->autoconnect);
- // Optional field
+ /* Optional field */
if (conf->proxy_address != NULL) {
g_key_file_set_string(keyfile, group_name, WIFI_CONFIG_PROXY_METHOD, "manual");
g_key_file_set_string(keyfile, group_name, WIFI_CONFIG_PROXY_SERVER, conf->proxy_address);
if (conf->is_hidden != NULL) {
gboolean hidden = FALSE;
- if (g_strcmp0(conf->is_hidden, "TRUE") == 0) {
+ if (g_strcmp0(conf->is_hidden, "TRUE") == 0)
hidden = TRUE;
- }
g_key_file_set_boolean(keyfile, group_name, WIFI_CONFIG_HIDDEN, hidden);
}
if (conf->proxy_address != NULL) {
g_variant_builder_add(b, "{sv}", WIFI_CONFIG_PROXYADDRESS, g_variant_new_string(conf->proxy_address));
g_free(conf->proxy_address);
- } else {
+ } else
g_variant_builder_add(b, "{sv}", WIFI_CONFIG_PROXYADDRESS, g_variant_new_string("NONE"));
- }
+
if (conf->last_error != NULL) {
g_variant_builder_add(b, "{sv}", WIFI_CONFIG_FAILURE, g_variant_new_string(conf->last_error));
g_free(conf->last_error);
- } else {
+ } else
g_variant_builder_add(b, "{sv}", WIFI_CONFIG_FAILURE, g_variant_new_string("ERROR_NONE"));
- }
+
if (conf->eap_config != NULL) {
- if (conf->eap_config->anonymous_identity != NULL) {
+ if (conf->eap_config->anonymous_identity != NULL)
g_variant_builder_add(b, "{sv}", WIFI_CONFIG_EAP_ANONYMOUS_IDENTITY, g_variant_new_string(conf->eap_config->anonymous_identity));
- } else {
+ else
g_variant_builder_add(b, "{sv}", WIFI_CONFIG_EAP_ANONYMOUS_IDENTITY, g_variant_new_string("NONE"));
- }
- if (conf->eap_config->ca_cert != NULL) {
+
+ if (conf->eap_config->ca_cert != NULL)
g_variant_builder_add(b, "{sv}", WIFI_CONFIG_EAP_CACERT, g_variant_new_string(conf->eap_config->ca_cert));
- } else {
+ else
g_variant_builder_add(b, "{sv}", WIFI_CONFIG_EAP_CACERT, g_variant_new_string("NONE"));
- }
- if (conf->eap_config->client_cert != NULL) {
+
+ if (conf->eap_config->client_cert != NULL)
g_variant_builder_add(b, "{sv}", WIFI_CONFIG_EAP_CLIENTCERT, g_variant_new_string(conf->eap_config->client_cert));
- } else {
+ else
g_variant_builder_add(b, "{sv}", WIFI_CONFIG_EAP_CLIENTCERT, g_variant_new_string("NONE"));
- }
- if (conf->eap_config->private_key != NULL) {
+
+ if (conf->eap_config->private_key != NULL)
g_variant_builder_add(b, "{sv}", WIFI_CONFIG_EAP_PRIVATEKEY, g_variant_new_string(conf->eap_config->private_key));
- } else {
+ else
g_variant_builder_add(b, "{sv}", WIFI_CONFIG_EAP_PRIVATEKEY, g_variant_new_string("NONE"));
- }
- if (conf->eap_config->identity != NULL) {
+
+ if (conf->eap_config->identity != NULL)
g_variant_builder_add(b, "{sv}", WIFI_CONFIG_EAP_IDENTITY, g_variant_new_string(conf->eap_config->identity));
- } else {
+ else
g_variant_builder_add(b, "{sv}", WIFI_CONFIG_EAP_IDENTITY, g_variant_new_string("NONE"));
- }
- if (conf->eap_config->eap_type != NULL) {
+
+ if (conf->eap_config->eap_type != NULL)
g_variant_builder_add(b, "{sv}", WIFI_CONFIG_EAP_TYPE, g_variant_new_string(conf->eap_config->eap_type));
- } else {
+ else
g_variant_builder_add(b, "{sv}", WIFI_CONFIG_EAP_TYPE, g_variant_new_string("NONE"));
- }
- if (conf->eap_config->eap_auth_type != NULL) {
+
+ if (conf->eap_config->eap_auth_type != NULL)
g_variant_builder_add(b, "{sv}", WIFI_CONFIG_EAP_AUTH_TYPE, g_variant_new_string(conf->eap_config->eap_auth_type));
- } else {
+ else
g_variant_builder_add(b, "{sv}", WIFI_CONFIG_EAP_AUTH_TYPE, g_variant_new_string("NONE"));
- }
- if (conf->eap_config->subject_match != NULL) {
+
+ if (conf->eap_config->subject_match != NULL)
g_variant_builder_add(b, "{sv}", WIFI_CONFIG_EAP_SUBJECT_MATCH, g_variant_new_string(conf->eap_config->subject_match));
- } else {
+ else
g_variant_builder_add(b, "{sv}", WIFI_CONFIG_EAP_SUBJECT_MATCH, g_variant_new_string("NONE"));
- }
}
__free_wifi_configuration(conf);
g_key_file_set_boolean(keyfile, group_name, WIFI_CONFIG_FAVORITE, conf->favorite);
g_key_file_set_boolean(keyfile, group_name, WIFI_CONFIG_AUTOCONNECT, conf->autoconnect);
- // Optional field
+ /* Optional field */
if (conf->proxy_address != NULL) {
g_key_file_set_string(keyfile, group_name, WIFI_CONFIG_PROXY_METHOD, "manual");
g_key_file_set_string(keyfile, group_name, WIFI_CONFIG_PROXY_SERVER, conf->proxy_address);
if (conf->is_hidden != NULL) {
gboolean hidden = FALSE;
- if (g_strcmp0(conf->is_hidden, "TRUE") == 0) {
+ if (g_strcmp0(conf->is_hidden, "TRUE") == 0)
hidden = TRUE;
- }
g_key_file_set_boolean(keyfile, group_name, WIFI_CONFIG_HIDDEN, hidden);
}
ret = _remove_configuration(config_id);
if (ret != TRUE) {
- // no configuration or error
+ /* no configuration or error */
ERR("No [%s] configuration", config_id);
netconfig_error_no_profile(context);
return FALSE;
return ret;
}
-// config field key / value
+/* config field key / value */
/*
* [wifi_macaddress_config_id]
* Name=name (mandatory)
if (keyfile_key != NULL)
g_free(keyfile_key);
- wifi_complete_set_config_field(wifi,context);
+ wifi_complete_set_config_field(wifi, context);
return ret;
}
ERR("get config_id [%s] from [%s]", config_id, profile);
ret = wifi_config_remove_configuration(config_id);
- if (ret != TRUE) {
+ if (ret != TRUE)
ERR("Fail to wifi_config_remove_configuration [%s]", config_id);
- }
- if (config_id != NULL) {
+ if (config_id != NULL)
g_free(config_id);
- }
return ret;
}
return FALSE;
}
- if (_delete_configuration(profile) != TRUE) {
+ if (_delete_configuration(profile) != TRUE)
ERR("Fail to delete configuration [%s]", profile);
- }
wifi_ident = strstr(profile, "wifi_");
if (wifi_ident == NULL) {
auth_data.auth_type = TAPI_SIM_AUTH_TYPE_GSM;
auth_data.rand_length = SIM_RAND_DATA_LEN;
- for (i=0; i<rand_data->len; i++)
+ for (i = 0; i < rand_data->len; i++)
auth_data.rand_data[i] = g_array_index(rand_data, guint8, i);
handle = (TapiHandle *)netconfig_tel_init();
auth_data.rand_length = AKA_RAND_DATA_LEN;
auth_data.autn_length = AKA_AUTN_DATA_LEN;
- for (i=0; i<rand_data->len; i++)
+ for (i = 0; i < rand_data->len; i++)
auth_data.rand_data[i] = g_array_index(rand_data, guint8, i);
- for (i=0; i<autn_data->len; i++)
+ for (i = 0; i < autn_data->len; i++)
auth_data.autn_data[i] = g_array_index(autn_data, guint8, i);
handle = (TapiHandle *)netconfig_tel_init();
- if (handle == NULL) {
+ if (handle == NULL)
return NETCONFIG_ERROR_FAILED_REQ_SIM_AUTH;
- }
ret = tel_req_sim_authentication(handle, &auth_data,
__netconfig_response_aka_authentication, NULL);
}
wifi_complete_get_sim_auth(wifi, context, array->data);
- g_array_free (array, TRUE);
+ g_array_free(array, TRUE);
__netconfig_wifi_clean_authentication();
return TRUE;
}
wifi_authdata->resp_length);
wifi_complete_get_aka_auth(wifi, context, array->data);
- g_array_free (array, TRUE);
+ g_array_free(array, TRUE);
__netconfig_wifi_clean_authentication();
}
wifi_complete_get_aka_auth(wifi, context, array->data);
- g_array_free (array, TRUE);
+ g_array_free(array, TRUE);
__netconfig_wifi_clean_authentication();
return TRUE;
result = __netconfig_wifi_req_sim_auth(rand_data_garray, context);
g_array_free(rand_data_garray, FALSE);
- if (result) {
+ if (result)
wifi_complete_req_sim_auth(wifi, context, result);
- }
return result;
}
return TRUE;
} else
netconfig_error_wifi_driver_failed(context);
- }
- else
+ } else
netconfig_error_wifi_driver_failed(context);
return FALSE;
/* read wireless status */
char *saveptr;
- p_entry = strtok_r(p_entry, " .", &saveptr); // status "%x"
+ p_entry = strtok_r(p_entry, " .", &saveptr); /* status "%x" */
if (p_entry != NULL)
sscanf(p_entry, "%x", &status);
- p_entry = strtok_r(NULL, " .", &saveptr); // Quality link "%d"
+ p_entry = strtok_r(NULL, " .", &saveptr); /* Quality link "%d" */
if (p_entry != NULL)
sscanf(p_entry, "%d", &link);
- p_entry = strtok_r(NULL, " .", &saveptr); // Quality level "%d"
+ p_entry = strtok_r(NULL, " .", &saveptr); /* Quality level "%d" */
if (p_entry != NULL)
sscanf(p_entry, "%d", &rssi_dbm);
- p_entry = strtok_r(NULL, " .", &saveptr); // Quality noise "%d"
+ p_entry = strtok_r(NULL, " .", &saveptr); /* Quality noise "%d" */
if (p_entry != NULL)
sscanf(p_entry, "%d", &noise);
if (level > 0) {
/* enable booster */
- switch(level) {
+ switch (level) {
case 1:
params = g_variant_new("(ii)", level1, lock);
break;
if (old_level == 0 || old_level == level)
return;
- switch(old_level) {
+ switch (old_level) {
case 1:
params = g_variant_new("(ii)", level1, unlock);
break;
return TRUE;
rssi_dbm = __netconfig_wifi_update_and_get_rssi();
- //INFO("%d dbm", rssi_dbm);
+ /* INFO("%d dbm", rssi_dbm); */
snr_level = netconfig_wifi_rssi_level(rssi_dbm);
__netconfig_wifi_set_rssi_level(snr_level);
g_return_val_if_fail(wifi != NULL, FALSE);
#if defined TIZEN_WLAN_PASSPOINT
- if (netconfig_wifi_get_passpoint(&enable)){
+ if (netconfig_wifi_get_passpoint(&enable)) {
wifi_complete_get_passpoint(wifi, context, enable);
return TRUE;
}
GDBusConnection *conn = NULL;
GError *error = NULL;
- conn = G_DBUS_CONNECTION (source_object);
+ conn = G_DBUS_CONNECTION(source_object);
reply = g_dbus_connection_call_finish(conn, res, &error);
if (reply == NULL) {
if (error != NULL) {
- if (g_strcmp0(error->message, CONNMAN_ERROR_INTERFACE ".AlreadyEnabled") == 0) {
+ if (g_strcmp0(error->message, CONNMAN_ERROR_INTERFACE ".AlreadyEnabled") == 0)
wifi_state_update_power_state(TRUE);
- } else if (g_strcmp0(error->message, CONNMAN_ERROR_INTERFACE ".AlreadyDisabled") == 0) {
+ else if (g_strcmp0(error->message, CONNMAN_ERROR_INTERFACE ".AlreadyDisabled") == 0)
wifi_state_update_power_state(FALSE);
- } else {
+ else
ERR("Fail to request status [%d: %s]", error->code, error->message);
- }
g_error_free(error);
} else {
ERR("Fail torequest status");
else
param0 = g_variant_new_boolean(value_disable);
- params = g_variant_new("(sv)",key, param0);
+ params = g_variant_new("(sv)", key, param0);
reply = netconfig_invoke_dbus_method_nonblock(CONNMAN_SERVICE,
CONNMAN_WIFI_TECHNOLOGY_PREFIX, CONNMAN_TECHNOLOGY_INTERFACE,
/* enhanced power saving mode on */
vconf_get_int(VCONF_WIFI_WEARABLE_WIFI_USE, &wifi_use);
psmode_wifi_use = wifi_use;
- if (wifi_use != 0) {
+ if (wifi_use != 0)
netconfig_set_vconf_int(VCONF_WIFI_WEARABLE_WIFI_USE, 0);
- }
if (wifi_state == VCONFKEY_WIFI_OFF)
return;
netconfig_set_vconf_str(VCONF_ETH_MAC_ADDRESS, mac_addr);
}
- DBG("MAC Address of eth0 [%s]",mac_addr);
+ DBG("MAC Address of eth0 [%s]", mac_addr);
const char *path = NET_EXEC_PATH;
char *const args[] = { "/sbin/ifconfig", "eth0", "hw",
- "ether",mac_addr, "up", NULL};
+ "ether", mac_addr, "up", NULL};
char *const envs[] = { NULL };
rv = netconfig_execute_file(path, args, envs);
- if (rv < 0) {
+ if (rv < 0)
ERR("Unable to execute system command");
- }
g_free(mac_addr);
}
{
INFO("keymgmt : %s", str_keymgmt);
- if (g_strcmp0(str_keymgmt, "ieee8021x") == 0) {
+ if (g_strcmp0(str_keymgmt, "ieee8021x") == 0)
bss_info->security = WIFI_SECURITY_IEEE8021X;
- } else if (g_strcmp0(str_keymgmt, "wpa-psk") == 0) {
+ else if (g_strcmp0(str_keymgmt, "wpa-psk") == 0)
bss_info->security = WIFI_SECURITY_PSK;
- } else if (g_strcmp0(str_keymgmt, "wpa-psk-sha256") == 0) {
+ else if (g_strcmp0(str_keymgmt, "wpa-psk-sha256") == 0)
bss_info->security = WIFI_SECURITY_PSK;
- } else if (g_strcmp0(str_keymgmt, "wpa-ft-psk") == 0) {
+ else if (g_strcmp0(str_keymgmt, "wpa-ft-psk") == 0)
bss_info->security = WIFI_SECURITY_PSK;
- } else if (g_strcmp0(str_keymgmt, "wpa-ft-eap") == 0) {
+ else if (g_strcmp0(str_keymgmt, "wpa-ft-eap") == 0)
bss_info->security = WIFI_SECURITY_IEEE8021X;
- } else if (g_strcmp0(str_keymgmt, "wpa-eap") == 0) {
+ else if (g_strcmp0(str_keymgmt, "wpa-eap") == 0)
bss_info->security = WIFI_SECURITY_IEEE8021X;
- } else if (g_strcmp0(str_keymgmt, "wpa-eap-sha256") == 0) {
+ else if (g_strcmp0(str_keymgmt, "wpa-eap-sha256") == 0)
bss_info->security = WIFI_SECURITY_IEEE8021X;
- } else if (g_strcmp0(str_keymgmt, "wps") == 0) {
+ else if (g_strcmp0(str_keymgmt, "wps") == 0)
bss_info->wps = TRUE;
- }
}
static gboolean __ssid_scan_timeout(gpointer data)
g_variant_get(param, "a{sv}", &iter1);
while (g_variant_iter_loop(iter1, "{sv}", &key, &var)) {
- if (g_strcmp0(key, "KeyMgmt") == 0) {//check this :iterate
+ if (g_strcmp0(key, "KeyMgmt") == 0) {
GVariantIter *iter2;
g_variant_get(var, "as", &iter2);
char *str;
while (g_variant_iter_loop(iter2, "s", &str)) {
- if (str == NULL) {
+ if (str == NULL)
break;
- }
__check_security(str, bss_info);
}
- g_variant_iter_free (iter2);
+ g_variant_iter_free(iter2);
}
}
- g_variant_iter_free (iter1);
+ g_variant_iter_free(iter1);
return;
}
return FALSE;
}
- builder1 = g_variant_builder_new(G_VARIANT_TYPE ("a{sv}"));
+ builder1 = g_variant_builder_new(G_VARIANT_TYPE("a{sv}"));
g_variant_builder_add(builder1, "{sv}", key1, g_variant_new_string(val1));
- builder2 = g_variant_builder_new(G_VARIANT_TYPE ("aay"));
- builder3 = g_variant_builder_new (G_VARIANT_TYPE ("ay"));
+ builder2 = g_variant_builder_new(G_VARIANT_TYPE("aay"));
+ builder3 = g_variant_builder_new(G_VARIANT_TYPE("ay"));
- for (i = 0; i < strlen(ssid); i++) {
- g_variant_builder_add (builder3, "y", ssid[i]);
- }
+ for (i = 0; i < strlen(ssid); i++)
+ g_variant_builder_add(builder3, "y", ssid[i]);
g_variant_builder_add(builder2, "@ay", g_variant_builder_end(builder3));
g_variant_builder_add(builder1, "{sv}", key2, g_variant_builder_end(builder2));
return FALSE;
}
- if (g_ssid != NULL) {
+ if (g_ssid != NULL)
g_free(g_ssid);
- }
g_ssid = g_strdup(ssid);
const char *prop_security = "security";
const char *prop_wps = "wps";
- builder = g_variant_builder_new(G_VARIANT_TYPE ("a{sv}"));
+ builder = g_variant_builder_new(G_VARIANT_TYPE("a{sv}"));
for (list = bss_info_list; list != NULL; list = list->next) {
bss_info_t *bss_info = (bss_info_t *)list->data;
if (bss_info && g_strcmp0((char *)bss_info->ssid, g_ssid) == 0) {
netconfig_wifi_bgscan_stop();
if (ssid != NULL) {
- if (scan_ssid != NULL) {
+ if (scan_ssid != NULL)
g_free(scan_ssid);
- }
scan_ssid = g_strdup(ssid);
}
}
if (path != NULL)
- INFO("Object path of BSS added is %s",path);
+ INFO("Object path of BSS added is %s", path);
bss_info = g_try_new0(bss_info_t, 1);
if (bss_info == NULL)
const guchar *ie;
gsize ie_len;
ie = g_variant_get_fixed_array(value, &ie_len, sizeof(guchar));
- DBG("The IE : %s",ie);
+ DBG("The IE : %s", ie);
}
}
result = wifi_ssid_scan((const char *)ssid);
- if (result != TRUE) {
+ if (result != TRUE)
netconfig_error_dbus_method_return(context, NETCONFIG_ERROR_INTERNAL, "FailSpecificScan");
- } else {
+ else
wifi_complete_request_wps_scan(wifi, context);
- }
return result;
}
g_variant_get(message, "(a(oa{sv}))", &iter);
while (g_variant_iter_loop(iter, "(oa{sv})", &obj, &next)) {
- if (obj == NULL || netconfig_is_wifi_profile((const gchar*)obj) == FALSE) {
+ if (obj == NULL || netconfig_is_wifi_profile((const gchar*)obj) == FALSE)
continue;
- }
g_variant_iter_free(next);
g_free(obj);
while (g_variant_iter_loop(array, "{sv}", &key, &var)) {
gboolean value;
- if (g_str_equal(key, "Favorite") != TRUE) {
+ if (g_str_equal(key, "Favorite") != TRUE)
continue;
- }
value = g_variant_get_boolean(var);
if (value)
}
vconf_get_int(VCONFKEY_WIFI_UG_RUN_STATE, &ug_state);
- if (ug_state == VCONFKEY_WIFI_UG_RUN_STATE_ON_FOREGROUND) {
+ if (ug_state == VCONFKEY_WIFI_UG_RUN_STATE_ON_FOREGROUND)
goto cleanup;
- }
netconfig_send_notification_to_net_popup(NETCONFIG_ADD_FOUND_AP_NOTI, NULL);
g_variant_get(message, "(a(oa{sv}))", &iter);
while (g_variant_iter_loop(iter, "(oa{sv})", &obj, &next)) {
- if (obj == NULL || netconfig_is_wifi_profile(obj) == FALSE) {
+ if (obj == NULL || netconfig_is_wifi_profile(obj) == FALSE)
continue;
- }
if (__is_favorited(next) == TRUE) {
favorite_service = g_strdup(obj);
{
int value = -1;
- if (vconf_get_int(VCONFKEY_WIFI_ENABLE_QS, &value) < 0) {
+ if (vconf_get_int(VCONFKEY_WIFI_ENABLE_QS, &value) < 0)
return;
- }
- if (value == VCONFKEY_WIFI_QS_DISABLE) {
+ if (value == VCONFKEY_WIFI_QS_DISABLE)
netconfig_send_notification_to_net_popup(NETCONFIG_DEL_FOUND_AP_NOTI, NULL);
- }
}
static void _register_network_notification(void)
"org.tizen.system.deviced.display",
lock_method,
params);
- if (reply == NULL){
+ if (reply == NULL) {
ERR("Failed to set_power_lock");
return;
}
else
wifi_emit_power_off_completed((Wifi *)get_wifi_object());
- DBG("Successfully sent signal [%s]",(power_on)?"powerOn":"powerOff");
+ DBG("Successfully sent signal [%s]", (power_on) ? "powerOn" : "powerOff");
}
void wifi_state_emit_power_failed(void)
netconfig_wifi_bgscan_stop();
netconfig_wifi_bgscan_start(TRUE);
- } else if ((old_state > NETCONFIG_WIFI_IDLE && old_state < NETCONFIG_WIFI_CONNECTED) && new_state == NETCONFIG_WIFI_IDLE){
- //in ipv6 case disconnect/association -> association
+ } else if ((old_state > NETCONFIG_WIFI_IDLE && old_state < NETCONFIG_WIFI_CONNECTED) && new_state == NETCONFIG_WIFI_IDLE) {
+ /* in ipv6 case disconnect/association -> association */
DBG("reset the bg scan period");
netconfig_wifi_set_bgscan_pause(FALSE);
_wifi_state_changed(new_state);
- if (new_state == NETCONFIG_WIFI_CONNECTED){
+ if (new_state == NETCONFIG_WIFI_CONNECTED) {
_wifi_state_connected_activation();
#if defined TIZEN_WEARABLE
wc_launch_syspopup(WC_POPUP_TYPE_WIFI_CONNECTED);
g_variant_get(message, "(a(oa{sv}))", &iter);
while (g_variant_iter_loop(iter, "(oa{sv})", &path, &next)) {
- if (path == NULL || g_strcmp0(path, CONNMAN_WIFI_TECHNOLOGY_PREFIX) != 0) {
+ if (path == NULL || g_strcmp0(path, CONNMAN_WIFI_TECHNOLOGY_PREFIX) != 0)
continue;
- }
while (g_variant_iter_loop(next, "{sv}", &key, &variant)) {
const gchar *sdata = NULL;
data = g_variant_get_boolean(variant);
DBG("key-[%s] - %s", key, data ? "True" : "False");
- if (strcmp(key, "Powered") == 0 && data) {
+ if (strcmp(key, "Powered") == 0 && data)
wifi_tech_powered = TRUE;
- } else if (strcmp(key, "Connected") == 0 && data) {
+ else if (strcmp(key, "Connected") == 0 && data)
wifi_tech_connected = TRUE;
- } else if (strcmp(key, "Tethering") == 0 && data) {
- // For further use
- }
+ /* For further use
+ else if (strcmp(key, "Tethering") == 0 && data) {
+ } */
} else if (g_variant_is_of_type(variant, G_VARIANT_TYPE_STRING)) {
sdata = g_variant_get_string(variant, NULL);
DBG("%s", sdata);
}
}
- g_variant_iter_free (next);
+ g_variant_iter_free(next);
}
g_variant_unref(message);
- g_variant_iter_free (iter);
+ g_variant_iter_free(iter);
if (wifi_tech_powered == TRUE)
ret = NETCONFIG_WIFI_TECH_POWERED;
tech_state = wifi_state_get_technology_state();
service_state = wifi_state_get_service_state();
- if(tech_state == NETCONFIG_WIFI_TECH_UNKNOWN) {
+ if (tech_state == NETCONFIG_WIFI_TECH_UNKNOWN)
param = g_variant_new("(s)", "unknown");
- } else if(tech_state == NETCONFIG_WIFI_TECH_OFF ||
- tech_state == NETCONFIG_WIFI_TECH_WPS_ONLY) {
+ else if (tech_state == NETCONFIG_WIFI_TECH_OFF ||
+ tech_state == NETCONFIG_WIFI_TECH_WPS_ONLY)
param = g_variant_new("(s)", "deactivated");
- } else if(tech_state == NETCONFIG_WIFI_TECH_CONNECTED) {
+ else if (tech_state == NETCONFIG_WIFI_TECH_CONNECTED)
param = g_variant_new("(s)", "connected");
- } else {
+ else {
switch (service_state) {
case NETCONFIG_WIFI_FAILURE:
param = g_variant_new("(s)", "failure");
char *peer_mac = NULL;
int is_connected = 0;
-void __netconfig_wifi_notify_tdls_event(const char *sig_name,const char *peer_mac)
+void __netconfig_wifi_notify_tdls_event(const char *sig_name, const char *peer_mac)
{
GVariantBuilder *builder;
GVariant *params;
}
params = g_variant_new("(s)", str);
- INFO("[TizenMW-->WPAS] Sent Dbus Method :[%s],value[%s]", method,str);
+ INFO("[TizenMW-->WPAS] Sent Dbus Method :[%s],value[%s]", method, str);
message = netconfig_invoke_dbus_method(SUPPLICANT_SERVICE,
if_path, SUPPLICANT_INTERFACE ".Interface", method, params);
{
DBG("[TizenMW-->WPAS]: TDLS Teardown Request: [%s]", peer_mac_Addr);
- if(!is_connected) {
+ if (!is_connected) {
ERR(" No active TDLS Connection !!!");
-
} else {
GVariant *message = NULL;
message = __netconfig_wifi_tdls_send_dbus_str("TDLSTeardown", (const char*)peer_mac_Addr);
if (g_strcmp0(peer_mac, peer_mac_addr) == 0) {
INFO("TDLS Peer Disconnected Mac Address: [%s]", peer_mac);
is_connected = 0;
- __netconfig_wifi_notify_tdls_event("TDLSDisconnect",peer_mac);
+ __netconfig_wifi_notify_tdls_event("TDLSDisconnect", peer_mac);
} else
INFO("TDLS Peer Disconnected peer_mac(%s) != peer_mac_address(%s)", peer_mac, peer_mac_addr);
}
void netconfig_tel_deinit(void)
{
- int current_sim = _check_current_sim();
+ int current_sim = _check_current_sim();
- if (current_sim < 0){
+ if (current_sim < 0) {
if (tapi_handle)
tel_deinit(tapi_handle);
return netconfig_is_wps_enabled;
}
-static void __netconfig_wifi_wps_notify_scan_done(void)//check this
+static void __netconfig_wifi_wps_notify_scan_done(void)
{
GVariantBuilder *builder = NULL;
GVariantBuilder *builder1 = NULL;
const char *prop_rssi = "rssi";
const char *prop_mode = "mode";
- builder = g_variant_builder_new(G_VARIANT_TYPE ("a{sv}"));
+ builder = g_variant_builder_new(G_VARIANT_TYPE("a{sv}"));
for (list = wps_bss_info_list; list != NULL; list = list->next) {
struct wps_bss_info_t *bss_info = (struct wps_bss_info_t *)list->data;
DBG("BSS found; SSID %s, BSSID %s, RSSI %d MODE %d", ssid, bssid_str, rssi, mode);
- builder1 = g_variant_builder_new (G_VARIANT_TYPE ("ay"));
- for (i = 0; i < ssid_len; i++) {
- g_variant_builder_add (builder1, "y", ssid[i]);
- }
+ builder1 = g_variant_builder_new(G_VARIANT_TYPE("ay"));
+ for (i = 0; i < ssid_len; i++)
+ g_variant_builder_add(builder1, "y", ssid[i]);
g_variant_builder_add(builder, "{sv}", prop_ssid, g_variant_builder_end(builder1));
g_variant_builder_unref(builder1);
wifi_emit_wps_scan_completed((Wifi *)get_wifi_object(), g_variant_builder_end(builder));
g_variant_builder_unref(builder);
- if (wps_bss_info_list != NULL) {
+ if (wps_bss_info_list != NULL)
g_slist_free_full(wps_bss_info_list, g_free);
- }
wps_bss_info_list = NULL;
wps_bss_list_count = 0;
GDBusConnection *conn = NULL;
GError *error = NULL;
- conn = G_DBUS_CONNECTION (source_object);
+ conn = G_DBUS_CONNECTION(source_object);
reply = g_dbus_connection_call_finish(conn, res, &error);
if (error != NULL) {
gboolean counter_flag = FALSE;
GError *error = NULL;
- conn = G_DBUS_CONNECTION (source_object);
+ conn = G_DBUS_CONNECTION(source_object);
reply = g_dbus_connection_call_finish(conn, res, &error);
if (error != NULL) {
ERR("Error code: [%d] Error message: [%s]", error->code, error->message);
return -EIO;
}
- builder = g_variant_builder_new(G_VARIANT_TYPE ("a{sv}"));
+ builder = g_variant_builder_new(G_VARIANT_TYPE("a{sv}"));
g_variant_builder_add(builder, "{sv}", key1, g_variant_new_string(val1));
message = g_variant_new("(@a{sv})", g_variant_builder_end(builder));
g_variant_builder_unref(builder);
GDBusConnection *conn = NULL;
GError *error = NULL;
- conn = G_DBUS_CONNECTION (source_object);
+ conn = G_DBUS_CONNECTION(source_object);
message = g_dbus_connection_call_finish(conn, res, &error);
if (error == NULL) {
return -EIO;
}
- builder = g_variant_builder_new(G_VARIANT_TYPE ("a{sv}"));
+ builder = g_variant_builder_new(G_VARIANT_TYPE("a{sv}"));
g_variant_builder_add(builder, "{sv}", key, g_variant_new_string(val));
message = g_variant_new("(@a{sv})", g_variant_builder_end(builder));
GDBusConnection *conn = NULL;
GError *error = NULL;
- conn = G_DBUS_CONNECTION (source_object);
+ conn = G_DBUS_CONNECTION(source_object);
reply = g_dbus_connection_call_finish(conn, res, &error);
if (reply == NULL) {
{
ERR("Name (%s)", name);
INFO("disable to check");
- wifi_complete_check_black_list (wifi, context, TRUE);
+ wifi_complete_check_black_list(wifi, context, TRUE);
return TRUE;
}
wifi_object = wifi_skeleton_new();
interface_wifi = G_DBUS_INTERFACE_SKELETON(wifi_object);
- // WIFI power
+ /* WIFI power */
g_signal_connect(wifi_object, "handle-load-driver",
G_CALLBACK(handle_load_driver), NULL);
g_signal_connect(wifi_object, "handle-remove-driver",
g_signal_connect(wifi_object, "handle-remove-p2p-driver",
G_CALLBACK(handle_remove_p2p_driver), NULL);
- // WIFI state
+ /* WIFI state */
g_signal_connect(wifi_object, "handle-get-wifi-state",
G_CALLBACK(handle_get_wifi_state), NULL);
- // WIFI scan
+ /* WIFI scan */
g_signal_connect(wifi_object, "handle-request-specific-scan",
G_CALLBACK(handle_request_specific_scan), NULL);
g_signal_connect(wifi_object, "handle-request-wps-scan",
G_CALLBACK(handle_request_wps_scan), NULL);
- // WIFI direct
+ /* WIFI direct */
g_signal_connect(wifi_object, "handle-launch-direct",
G_CALLBACK(handle_launch_direct), NULL);
- // EAP config
+ /* EAP config */
g_signal_connect(wifi_object, "handle-create-eap-config",
G_CALLBACK(handle_create_eap_config), NULL);
g_signal_connect(wifi_object, "handle-delete-eap-config",
G_CALLBACK(handle_delete_eap_config), NULL);
- // WIFI configuration
+ /* WIFI configuration */
g_signal_connect(wifi_object, "handle-save-configuration",
G_CALLBACK(handle_save_configuration), NULL);
g_signal_connect(wifi_object, "handle-remove-configuration",
G_CALLBACK(handle_set_config_field), NULL);
g_signal_connect(wifi_object, "handle-get-config-passphrase",
G_CALLBACK(handle_get_config_passphrase), NULL);
- // WIFI EAP configuration
+ /* WIFI EAP configuration */
g_signal_connect(wifi_object, "handle-save-eap-configuration",
G_CALLBACK(handle_save_eap_configuration), NULL);
g_signal_connect(wifi_object, "handle-load-eap-configuration",
G_CALLBACK(handle_load_eap_configuration), NULL);
- // BG scan mode
+ /* BG scan mode */
g_signal_connect(wifi_object, "handle-set-bgscan",
G_CALLBACK(handle_set_bgscan), NULL);
g_signal_connect(wifi_object, "handle-resume-bgscan",
g_signal_connect(wifi_object, "handle-pause-bgscan",
G_CALLBACK(handle_pause_bgscan), NULL);
- // Passpoint
+ /* Passpoint */
g_signal_connect(wifi_object, "handle-set-passpoint",
G_CALLBACK(handle_set_passpoint), NULL);
g_signal_connect(wifi_object, "handle-get-passpoint",
G_CALLBACK(handle_get_passpoint), NULL);
- // EAP authentication
+ /* EAP authentication */
g_signal_connect(wifi_object, "handle-get-aka-auth",
G_CALLBACK(handle_get_aka_auth), NULL);
g_signal_connect(wifi_object, "handle-get-sim-auth",
g_signal_connect(wifi_object, "handle-req-sim-auth",
G_CALLBACK(handle_req_sim_auth), NULL);
- // WIFI MDM blacklist
+ /* WIFI MDM blacklist */
g_signal_connect(wifi_object, "handle-check-black-list",
G_CALLBACK(handle_check_black_list), NULL);
- //TDLS methods
+ /* TDLS methods */
g_signal_connect(wifi_object, "handle-tdls-disconnect",
G_CALLBACK(handle_tdls_disconnect), NULL);
g_signal_connect(wifi_object, "handle-tdls-connected-peer",
ERR("Export WIFI_PATH for wifi failed");
}
- /*Interface connman.Agent*/
+ /* Interface connman.Agent */
connman_agent_object = net_connman_agent_skeleton_new();
interface_connman_agent = G_DBUS_INTERFACE_SKELETON(connman_agent_object);