Name: mobileap-agent
Summary: Mobile AP daemon for setting tethering environments
-Version: 1.0.51
+Version: 1.0.52
Release: 1
Group: System/Network
License: Apache-2.0
{NULL, NULL, IP_ADDRESS_BT_1},
{NULL, NULL, IP_ADDRESS_BT_2},
{NULL, NULL, IP_ADDRESS_BT_3},
- {NULL, NULL, IP_ADDRESS_BT_4}};
+ {NULL, NULL, IP_ADDRESS_BT_4} };
static GDBusMethodInvocation *g_context = NULL;
ret = bt_adapter_enable();
if (ret == BT_ERROR_NOW_IN_PROGRESS) {
- if (__recheck_bt_adapter_timer) {
+ if (__recheck_bt_adapter_timer)
g_source_remove(__recheck_bt_adapter_timer);
- }
+
__recheck_bt_adapter_timer = g_timeout_add(PS_RECHECK_INTERVAL,
(GSourceFunc) __bt_adapter_timeout_cb, (gpointer) obj);
return MOBILE_AP_ERROR_NONE;
}
ret = _init_tethering();
- if (ret != MOBILE_AP_ERROR_NONE) {
+ if (ret != MOBILE_AP_ERROR_NONE)
return ret;
- }
ret = __turn_on_bt_nap(obj);
if (ret != MOBILE_AP_ERROR_NONE) {
}
ret = _mh_core_set_ip_address(interface_name, remote->intf_ip);
- if (ret != MOBILE_AP_ERROR_NONE) {
+ if (ret != MOBILE_AP_ERROR_NONE)
ERR("Setting ip address error : %d\n", ret);
- }
} else {
_remove_station_info(remote_address, _slist_find_station_by_mac);
- if (__del_bt_remote(remote_address) == FALSE) {
+ if (__del_bt_remote(remote_address) == FALSE)
ERR("__del_bt_remote is failed\n");
- }
_get_station_count((gconstpointer)MOBILE_AP_TYPE_BT,
_slist_find_station_by_interface, &n_station);
bt_adapter_visibility_mode_e mode = BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE;
ret = bt_adapter_get_visibility(&mode, &duration);
- if (ret != BT_ERROR_NONE) {
+ if (ret != BT_ERROR_NONE)
ERR("bt_adapter_get_visibility is failed 0x[%X]\n", ret);
- }
- if (mode == BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE) {
+ if (mode == BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE)
ERR("_launch_toast_popup() is failed\n");
- }
DBG("-\n");
}
bt_adapter_visibility_mode_e mode = BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE;
ret = bt_adapter_get_visibility(&mode, &duration);
- if (ret != BT_ERROR_NONE) {
+ if (ret != BT_ERROR_NONE)
ERR("bt_adapter_get_visibility is failed 0x[%X]\n", ret);
- }
if (mode == BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE) {
ret = bt_adapter_set_visibility(BT_ADAPTER_VISIBILITY_MODE_LIMITED_DISCOVERABLE, 120);
- if (ret != BT_ERROR_NONE) {
+ if (ret != BT_ERROR_NONE)
ERR("bt_adapter_set_visibility is failed 0x[%X]\n", ret);
- }
}
bt_adapter_set_visibility_mode_changed_cb(__bt_adapter_visibility_changed_cb, NULL);
DBG("-\n");
int bt_count = 0;
int usb_count = 0;
- if (_mobileap_is_enabled(MOBILE_AP_STATE_WIFI_AP)) {
+ if (_mobileap_is_enabled(MOBILE_AP_STATE_WIFI_AP))
return;
- }
- if (prev_cnt == count) {
+ if (prev_cnt == count)
return;
- }
if (vconf_set_int(VCONFKEY_MOBILE_HOTSPOT_CONNECTED_DEVICE,
count) < 0) {
_get_station_count((gconstpointer)MOBILE_AP_TYPE_BT, _slist_find_station_by_interface, &bt_count);
_get_station_count((gconstpointer)MOBILE_AP_TYPE_USB, _slist_find_station_by_interface, &usb_count);
- if (wifi_count > 0 && bt_count == 0 && usb_count == 0) {
+ if (wifi_count > 0 && bt_count == 0 && usb_count == 0)
g_strlcpy(icon_path, MH_NOTI_ICON_WIFI, sizeof(icon_path));
- } else if (wifi_count == 0 && bt_count > 0 && usb_count == 0) {
+ else if (wifi_count == 0 && bt_count > 0 && usb_count == 0)
g_strlcpy(icon_path, MH_NOTI_ICON_BT, sizeof(icon_path));
- } else if (wifi_count == 0 && bt_count == 0 && usb_count > 0) {
+ else if (wifi_count == 0 && bt_count == 0 && usb_count > 0)
g_strlcpy(icon_path, MH_NOTI_ICON_USB, sizeof(icon_path));
- } else if (wifi_count == 0 && bt_count == 0 && usb_count == 0) {
+ else if (wifi_count == 0 && bt_count == 0 && usb_count == 0)
return;
- } else {
+ else
g_strlcpy(icon_path, MH_NOTI_ICON_GENERAL, sizeof(icon_path));
- }
- if (prev_cnt == 0) {
+ if (prev_cnt == 0)
_create_connected_noti(count, icon_path);
- } else {
+ else
_update_connected_noti(count, icon_path);
- }
prev_cnt = count;
return;
if (_get_station_info(info->mac, _slist_find_station_by_mac, &si) ==
MOBILE_AP_ERROR_NONE) {
- if (!si) {
+ if (!si)
return MOBILE_AP_ERROR_INTERNAL;
- }
if (g_strcmp0(si->hostname, info->hostname) == 0 &&
g_strcmp0(si->ip, info->ip) == 0) {
int _remove_station_info_all(mobile_ap_type_e type)
{
- if (station_list == NULL) {
+ if (station_list == NULL)
return MOBILE_AP_ERROR_NONE;
- }
GSList *l = station_list;
GSList *temp_l = NULL;
GVariantBuilder *outer_builder;
mobile_ap_station_info_t *st = NULL;
- outer_builder = g_variant_builder_new(G_VARIANT_TYPE ("a(a{sv})"));
+ outer_builder = g_variant_builder_new(G_VARIANT_TYPE("a(a{sv})"));
for (l = station_list; l != NULL; l = g_slist_next(l)) {
st = (mobile_ap_station_info_t *)l->data;
- inner_builder = g_variant_builder_new(G_VARIANT_TYPE ("a{sv}"));
+ inner_builder = g_variant_builder_new(G_VARIANT_TYPE("a{sv}"));
g_variant_builder_add(inner_builder, "{sv}", "Type",
g_variant_new_int32(st->interface));
g_variant_builder_add(inner_builder, "{sv}", "IP",
}
params = g_variant_new("(@a(a{sv}))", g_variant_builder_end(outer_builder));
- if (params == NULL) {
+ if (params == NULL)
ERR("params IS NULL\n");
- } else {
+ else
SDBG("outer builder print %s", g_variant_print(params, TRUE));
- }
+
g_variant_builder_unref(outer_builder);
return params;
}
}
if (!pid) {
- if (execv(args[0], args)) {
+ if (execv(args[0], args))
ERR("execl failed\n");
- }
ERR("Should never get here!\n");
return EXIT_FAILURE;
{0, 0, __wifi_timeout_cb, NULL},
{0, 0, NULL, NULL},
{0, 0, __bt_timeout_cb, NULL},
- {0, 0, NULL, NULL}};
+ {0, 0, NULL, NULL} };
static void __handle_network_cellular_state_changed_cb(keynode_t *key, void *data)
{
Tethering *obj = (Tethering *)data;
int vconf_key = 0;
- if (!_mobileap_is_enabled(MOBILE_AP_STATE_WIFI | MOBILE_AP_STATE_WIFI_AP)) {
+ if (!_mobileap_is_enabled(MOBILE_AP_STATE_WIFI | MOBILE_AP_STATE_WIFI_AP))
return;
- }
if (vconf_keynode_get_type(key) != VCONF_TYPE_INT) {
ERR("Invalid vconf key type\n");
softap_settings_t *new_settings = _get_softap_settings();
softap_security_type_e sec_type;
- if (!_mobileap_is_enabled(MOBILE_AP_STATE_WIFI | MOBILE_AP_STATE_WIFI_AP)) {
+ if (!_mobileap_is_enabled(MOBILE_AP_STATE_WIFI | MOBILE_AP_STATE_WIFI_AP))
return;
- }
if (vconf_keynode_get_type(key) != VCONF_TYPE_STRING) {
ERR("Invalid vconf key type\n");
if (g_strcmp0(vconf_key, new_settings->ssid) != 0) {
DBG("Device name is changed\n");
- if (!g_strcmp0(new_settings->security_type, SOFTAP_SECURITY_TYPE_WPA2_PSK_STR)) {
+ if (!g_strcmp0(new_settings->security_type, SOFTAP_SECURITY_TYPE_WPA2_PSK_STR))
sec_type = SOFTAP_SECURITY_TYPE_WPA2_PSK;
- } else {
+ else
sec_type = SOFTAP_SECURITY_TYPE_OPEN;
- }
+
if (_mobileap_is_enabled(MOBILE_AP_STATE_WIFI)) {
_reload_softap_settings(obj, vconf_key, new_settings->key,
new_settings->mode, new_settings->channel, new_settings->hide_mode, new_settings->mac_filter, sec_type);
while (vconf_reg[i].key != NULL && vconf_reg[i].cb != NULL) {
ret = vconf_notify_key_changed(vconf_reg[i].key,
vconf_reg[i].cb, user_data);
- if (ret != 0) {
+ if (ret != 0)
ERR("vconf_notify_key_changed is failed : %d\n", ret);
- }
if (vconf_reg[i].value) {
ret = vconf_get_int(vconf_reg[i].key,
vconf_reg[i].value);
- if (ret != 0) {
+ if (ret != 0)
ERR("vconf_get_int is failed : %d\n", ret);
- }
}
i++;
while (vconf_reg[i].key != NULL && vconf_reg[i].cb != NULL) {
ret = vconf_ignore_key_changed(vconf_reg[i].key,
vconf_reg[i].cb);
- if (ret != 0) {
+ if (ret != 0)
ERR("vconf_notify_key_changed is failed : %d\n", ret);
- }
i++;
}
_disable_wifi_tethering(obj);
tethering_emit_wifi_off(obj, SIGNAL_MSG_TIMEOUT);
- //_launch_toast_popup(MOBILE_AP_TETHERING_TIMEOUT_TOAST_POPUP);
+#if 0
+ _launch_toast_popup(MOBILE_AP_TETHERING_TIMEOUT_TOAST_POPUP);
+#endif
_create_timeout_noti(MH_NOTI_ICON_WIFI);
DBG("-\n");
return FALSE;
_disable_bt_tethering(obj);
tethering_emit_bluetooth_off(obj, SIGNAL_MSG_TIMEOUT);
- //_launch_toast_popup(MOBILE_AP_TETHERING_TIMEOUT_TOAST_POPUP);
+#if 0
+ _launch_toast_popup(MOBILE_AP_TETHERING_TIMEOUT_TOAST_POPUP);
+#endif
_create_timeout_noti(MH_NOTI_ICON_BT);
DBG("-\n");
return FALSE;
{
DBG("+\n");
- if (sp_timeout_handler[type].func == NULL) {
+ if (sp_timeout_handler[type].func == NULL)
return;
- }
if (user_data == NULL) {
ERR("Invalid param\n");
mobile_ap_type_e i;
sp_timeout_handler_t *next_timeout;
- if (sp_timeout_handler[type].func == NULL) {
+ if (sp_timeout_handler[type].func == NULL)
return;
- }
__reset_timeout(&sp_timeout_handler[type]);
sp_timeout_handler[type].end_time = end_time;
next_timeout = __find_next_timeout();
- if (next_timeout->alarm_id > 0) {
+ if (next_timeout->alarm_id > 0)
return;
- }
for (i = MOBILE_AP_TYPE_WIFI; i < MOBILE_AP_TYPE_MAX; i++) {
if (sp_timeout_handler[i].alarm_id == 0)
mobile_ap_type_e i;
sp_timeout_handler_t *next_timeout;
- if (sp_timeout_handler[type].func == NULL) {
+ if (sp_timeout_handler[type].func == NULL)
return;
- }
if (sp_timeout_handler[type].alarm_id == 0) {
sp_timeout_handler[type].end_time = 0;
return;
}
-void _deinit_timeout_cb(mobile_ap_type_e type) {
+void _deinit_timeout_cb(mobile_ap_type_e type)
+{
DBG("+\n");
- if (sp_timeout_handler[type].func == NULL) {
+ if (sp_timeout_handler[type].func == NULL)
return;
- }
- if (sp_timeout_handler[type].alarm_id > 0) {
+ if (sp_timeout_handler[type].alarm_id > 0)
_stop_timeout_cb(type);
- }
sp_timeout_handler[type].user_data = NULL;
sp_timeout_handler[type].end_time = 0;
snprintf(cmd, sizeof(cmd),
"%s -t %s -L %s -vx | %s -v DROP | %s \"%s[ ]*%s\" | %s '{ print $2 }' > %s",
IPTABLES, TABLE_FILTER, TETH_FILTER_FW, GREP, GREP, src, dest, AWK, DATA_USAGE_FILE);
- if (system(cmd) < 0) {
+ if (system(cmd) < 0)
ERR("cmd %s is failed\n", cmd);
- }
*tx = 0;
return MOBILE_AP_ERROR_INTERNAL;
}
- while (fgets(buf, sizeof(buf), fp) != NULL) {
+ while (fgets(buf, sizeof(buf), fp) != NULL)
*tx += atoll(buf);
- }
fclose(fp);
unlink(DATA_USAGE_FILE);
snprintf(cmd, sizeof(cmd),
"%s -t %s -L %s -vx | %s -v DROP | %s \"%s[ ]*%s\" | %s '{ print $2 }' > %s",
IPTABLES, TABLE_FILTER, TETH_FILTER_FW, GREP, GREP, dest, src, AWK, DATA_USAGE_FILE);
- if (system(cmd) < 0) {
+ if (system(cmd) < 0)
ERR("cmd %s is failed\n", cmd);
- }
*rx = 0;
return MOBILE_AP_ERROR_INTERNAL;
}
- while (fgets(buf, sizeof(buf), fp) != NULL) {
+ while (fgets(buf, sizeof(buf), fp) != NULL)
*rx += atoll(buf);
- }
fclose(fp);
unlink(DATA_USAGE_FILE);
gboolean _terminate_mobileap_agent(gpointer user_data)
{
- if (mainloop == NULL) {
+ if (mainloop == NULL)
return FALSE;
- }
if (!_mobileap_is_disabled()) {
DBG("Tethering is enabled\n");
return MOBILE_AP_ERROR_NONE;
}
- if (!_mobileap_is_enabled(MOBILE_AP_STATE_WIFI_AP)) {
+ if (!_mobileap_is_enabled(MOBILE_AP_STATE_WIFI_AP))
ret = _open_network();
- }
+
_mh_core_execute_dhcp_server();
init_count++;
_mh_core_terminate_dhcp_server();
- if (!_mobileap_is_enabled(MOBILE_AP_STATE_WIFI_AP)) {
+ if (!_mobileap_is_enabled(MOBILE_AP_STATE_WIFI_AP))
_close_network();
- }
idle_id = g_idle_add(_terminate_mobileap_agent, NULL);
- if (idle_id == 0) {
+ if (idle_id == 0)
ERR("g_idle_add is failed\n");
- }
return TRUE;
}
return TRUE;
}
-void static __handle_dnsmasq_dhcp_status_changed_cb(GDBusConnection *connection,
+static void __handle_dnsmasq_dhcp_status_changed_cb(GDBusConnection *connection,
const gchar *sender_name, const gchar *object_path,
const gchar *interface_name, const gchar *signal_name,
GVariant *parameters, gpointer user_data)
/*
* DHCP ACK received, destroy timeout if exists
*/
- if (ip_addr == NULL || mac == NULL) {
+ if (ip_addr == NULL || mac == NULL)
goto EXIT;
- }
+
_destroy_dhcp_ack_timer(mac);
if (_get_tethering_type_from_ip(ip_addr, &type) != MOBILE_AP_ERROR_NONE)
goto EXIT;
- if (_mobileap_is_enabled_by_type(type) == FALSE) {
+ if (_mobileap_is_enabled_by_type(type) == FALSE)
goto EXIT;
- }
info = (mobile_ap_station_info_t *)g_malloc(sizeof(mobile_ap_station_info_t));
if (info == NULL) {
} else {
SDBG("UNKNOWN member signal\n");
}
-EXIT :
+EXIT:
g_free(ip_addr);
g_free(mac);
g_free(name);
DBG("-\n");
}
-static void on_bus_acquired_cb (GDBusConnection *connection, const gchar *name,
+static void on_bus_acquired_cb(GDBusConnection *connection, const gchar *name,
gpointer user_data)
{
DBG("+\n");
teth_gdbus_conn = connection;
manager_server = g_dbus_object_manager_server_new(TETHERING_SERVICE_OBJECT_PATH);
- if(manager_server == NULL) {
+ if (manager_server == NULL) {
DBG("Manager server not created.");
return;
}
DBG("+\n");
-#if !GLIB_CHECK_VERSION(2,36,0)
+#if !GLIB_CHECK_VERSION(2, 36, 0)
g_type_init();
#endif
return 0;
}
/* Platform modules */
- if (appcore_set_i18n(MOBILEAP_LOCALE_COMMON_PKG, MOBILEAP_LOCALE_COMMON_RES) < 0) {
+ if (appcore_set_i18n(MOBILEAP_LOCALE_COMMON_PKG, MOBILEAP_LOCALE_COMMON_RES) < 0)
ERR("appcore_set_i18n is failed\n");
- }
if (vconf_get_int(VCONFKEY_MOBILE_HOTSPOT_MODE, &mobileap_state) < 0) {
ERR("vconf_get_int is failed\n");
_register_wifi_station_handler();
ret = wifi_initialize();
- if (ret != WIFI_ERROR_NONE) {
+ if (ret != WIFI_ERROR_NONE)
ERR("wifi_initialize() is failed : %d\n", ret);
- }
ret = alarmmgr_init(APPNAME);
if (ret != ALARMMGR_RESULT_SUCCESS) {
ERR("alarmmgr_init(%s) is failed : %d\n", APPNAME, ret);
} else {
ret = alarmmgr_set_cb(_sp_timeout_handler, NULL);
- if (ret != ALARMMGR_RESULT_SUCCESS) {
+ if (ret != ALARMMGR_RESULT_SUCCESS)
ERR("alarmmgr_set_cb is failed : %d\n", ret);
- }
}
_register_app_for_wifi_passphrase(MOBILE_AP_UG_PKG_ID);
alarmmgr_fini();
ret = wifi_deinitialize();
- if (ret != WIFI_ERROR_NONE) {
+ if (ret != WIFI_ERROR_NONE)
ERR("wifi_deinitialize() is failed : %d\n", ret);
- }
_unregister_vconf_cb();
_unregister_wifi_station_handler();
{
int ret = MOBILE_AP_ERROR_NONE;
- if (_mobileap_is_disabled()) {
+ if (_mobileap_is_disabled())
return;
- }
ret = _disable_wifi_tethering(obj);
DBG("_disable_wifi_tethering returns %d\n", ret);
return FALSE;
}
- if (pstat != CONNECTION_PROFILE_STATE_CONNECTED) {
+ if (pstat != CONNECTION_PROFILE_STATE_CONNECTED)
return FALSE;
- }
DBG("Profile is connected\n");
return TRUE;
{
connection_profile_refresh(c_prof.handle);
- if (result != CONNECTION_ERROR_NONE) {
+ if (result != CONNECTION_ERROR_NONE)
ERR("Unable to close profile [0x%X]", result);
- } else {
+ else
DBG("Tethering profile is closed");
- }
return;
}
DBG("+\n");
- if (c_prof.svc_type == __INTERNET) {
+ if (c_prof.svc_type == __INTERNET)
return TRUE;
- }
if (__is_connected_profile(c_prof.handle)) {
DBG("Already connected profile\n");
return FALSE;
}
- if (tethered_prof == NULL) {
+ if (tethered_prof == NULL)
return FALSE;
- }
int ret = 0;
return FALSE;
}
- if (tethered_prof == NULL) {
+ if (tethered_prof == NULL)
return FALSE;
- }
int ret = 0;
char *ip = NULL;
char *interface = NULL;
- if (_get_network_gateway_address(&ip) == FALSE) {
+ if (_get_network_gateway_address(&ip) == FALSE)
return FALSE;
- }
if (_get_network_interface_name(&interface) == FALSE) {
free(ip);
char *ip = NULL;
char *interface = NULL;
- if (_get_network_gateway_address(&ip) == FALSE) {
+ if (_get_network_gateway_address(&ip) == FALSE)
return FALSE;
- }
if (_get_network_interface_name(&interface) == FALSE) {
free(ip);
GSList *l;
port_forward_info_s *pf;
- if (access(MH_PORT_FORWARD_CONF_FILEPATH, F_OK) < 0) {
+ if (access(MH_PORT_FORWARD_CONF_FILEPATH, F_OK) < 0)
return;
- }
if (__read_port_forward_info(MH_PORT_FORWARD_CONF_FILEPATH) == FALSE) {
ERR("__read_port_forward_info() is failed\n");
return;
}
- for(l = port_forward_info; l;) {
+ for (l = port_forward_info; l;) {
pf = (port_forward_info_s *)l->data;
if (pf) {
g_free(pf->new_dest_ip);
__print_cellular_profile();
if (!__is_connected_profile(c_prof.handle)) {
- if (c_prof.svc_type != __TETHERING_ONLY) {
+ if (c_prof.svc_type != __TETHERING_ONLY)
return MOBILE_AP_ERROR_NONE;
- }
if (net_timeout_id) {
g_source_remove(net_timeout_id);
}
ret = connection_unset_type_changed_cb(connection);
- if (ret != CONNECTION_ERROR_NONE) {
+ if (ret != CONNECTION_ERROR_NONE)
ERR("connection_unset_type_changed_cb is failed : %d\n", ret);
- }
connection_destroy(connection);
connection = NULL;
}
ret = notification_free(noti);
- if (ret != NOTIFICATION_ERROR_NONE) {
+ if (ret != NOTIFICATION_ERROR_NONE)
ERR("Fail to notification_free [%d]\n", ret);
- }
}
timeout_noti_id = 0;
return MOBILE_AP_ERROR_INTERNAL;
}
- if (noti_list == NULL) {
+ if (noti_list == NULL)
return MOBILE_AP_ERROR_NONE;
- }
for (l = noti_list; l; l = notification_list_get_next(l)) {
noti = notification_list_get_data(l);
FAIL:
ret = notification_free(noti);
- if (ret != NOTIFICATION_ERROR_NONE) {
+ if (ret != NOTIFICATION_ERROR_NONE)
ERR("Fail to notification_free [%d]\n", ret);
- }
return MOBILE_AP_ERROR_INTERNAL;
}
}
ret = bt_adapter_get_visibility(&mode, &duration);
- if (ret != BT_ERROR_NONE) {
+ if (ret != BT_ERROR_NONE)
ERR("bt_adapter_get_visibility is failed 0x[%X]\n", ret);
- }
if (mode == BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE) {
str2 = MH_STR_BT_VISIBILITY;
return NULL;
}
- while(*str) {
- if (isupper(*str)) {
+ while (*str) {
+ if (isupper(*str))
return str;
- }
str++;
}
return NULL;
char key[MOBILE_AP_WIFI_KEY_MAX_LEN + 1];
char *hw_mode = NULL;
- if (mode == NULL) {
+ if (mode == NULL)
hw_mode = g_strdup("g");
- } else {
+ else
hw_mode = g_strdup(mode);
- }
/* Default conf. */
snprintf(buf, sizeof(buf), HOSTAPD_CONF,
*buf_len = ret;
buf[ret] = '\0';
- if (ret == 0) {
+ if (ret == 0)
ERR("socket is closed\n");
- }
break;
}
src.sun_family = AF_UNIX;
g_strlcpy(src.sun_path, intf, sizeof(src.sun_path));
- if (stat(src.sun_path, &stat_buf) == 0) {
+ if (stat(src.sun_path, &stat_buf) == 0)
unlink(src.sun_path);
- }
if (bind(*fd, (struct sockaddr *)&src, sizeof(src)) < 0) {
ERR("bind is failed\n");
/* concatenated string, containing multiple events can arrive */
while (pbuf && *pbuf) {
pbuf = __find_first_caps_char(pbuf);
- if (!pbuf || !*pbuf) {
+ if (!pbuf || !*pbuf)
break;
- }
if (!strncmp(pbuf, HOSTAPD_STA_CONN, HOSTAPD_STA_CONN_LEN)) {
pbuf = pbuf + HOSTAPD_STA_CONN_LEN;
for (l = sta_timer_list; l != NULL; l = g_slist_next(l)) {
ptr = (sta_timer_t *)l->data;
- if (ptr == NULL) {
+ if (ptr == NULL)
continue;
- }
if (g_strcmp0(ptr->mac_addr, mac) == 0) {
g_free(mac);
}
/* Matched station found, so skip */
- if (l != NULL) {
+ if (l != NULL)
continue;
- }
SDBG("%s%s\n", HOSTAPD_STA_CONN, mac);
ptr = (sta_timer_t *)g_malloc(sizeof(sta_timer_t));
} else if (!strncmp(pbuf, HOSTAPD_STA_DISCONN, HOSTAPD_STA_DISCONN_LEN)) {
pbuf = pbuf + HOSTAPD_STA_DISCONN_LEN;
- if (!pbuf || !*pbuf) {
+ if (!pbuf || !*pbuf)
break;
- }
end = strchr(pbuf, '<');
if (end && *end) {
if (discon_event == FALSE)
goto DONE;
- if (_mobileap_is_enabled(MOBILE_AP_STATE_WIFI)) {
+ if (_mobileap_is_enabled(MOBILE_AP_STATE_WIFI))
type = MOBILE_AP_TYPE_WIFI;
- } else if (_mobileap_is_enabled(MOBILE_AP_STATE_WIFI_AP)) {
+ else if (_mobileap_is_enabled(MOBILE_AP_STATE_WIFI_AP))
type = MOBILE_AP_TYPE_WIFI_AP;
- } else {
+ else
goto DONE;
- }
_get_station_count((gconstpointer)type,
_slist_find_station_by_interface, &n_station);
{
static mobile_ap_drv_interface_e drv_interface = MOBILE_AP_DRV_INTERFACE_NONE;
- if (drv_interface != MOBILE_AP_DRV_INTERFACE_NONE) {
+ if (drv_interface != MOBILE_AP_DRV_INTERFACE_NONE)
return drv_interface;
- }
const char *drv_rfkill_path = "/sys/devices/platform";
const char *wext_drv[] = {
NETCONFIG_DBUS_REPLY_TIMEOUT, &error);
if (dbus_error_is_set(&error) == TRUE) {
if (NULL != strstr(error.message, ".AlreadyExists")) {
- // softap already enabled
+ /* softap already enabled */
} else {
ERR("dbus_connection_send_with_reply_and_block() failed. "
"DBus error [%s: %s]", error.name, error.message);
NETCONFIG_DBUS_REPLY_TIMEOUT, &error);
if (dbus_error_is_set(&error) == TRUE) {
if (NULL != strstr(error.message, ".AlreadyExists")) {
- // softap already disabled
+ /* softap already disabled */
} else {
ERR("dbus_connection_send_with_reply_and_block() failed. "
"DBus error [%s: %s]", error.name, error.message);
ERR("hostapd termination is failed\n");
ret_status = __terminate_hostapd();
- if (ret_status != MOBILE_AP_ERROR_NONE) {
+ if (ret_status != MOBILE_AP_ERROR_NONE)
ERR("hostapd termination is failed\n");
- }
break;
default:
{
int idle_id = 0;
idle_id = g_idle_add(__send_station_event_cb, GINT_TO_POINTER(sig));
- if (idle_id == 0) {
+ if (idle_id == 0)
ERR("g_idle_add is failed\n");
- }
}
void _register_wifi_station_handler(void)
return FALSE;
-SUCCESS :
+SUCCESS:
if (_add_station_info(info) != MOBILE_AP_ERROR_NONE) {
g_free(info->hostname);
g_free(info);
}
g_variant_get(parameters, "(u)", &value);
DBG("Received signal(%s), value: (%u)", signal_name, value);
- DBG("USB connected ? (%s)", value & USBCLIENT_STATE_CONNECTED? "Yes":"No");
- DBG("USB available ? (%s)", value & USBCLIENT_STATE_AVAILABLE? "Yes":"No");
+ DBG("USB connected ? (%s)", value & USBCLIENT_STATE_CONNECTED ? "Yes" : "No");
+ DBG("USB available ? (%s)", value & USBCLIENT_STATE_AVAILABLE ? "Yes" : "No");
if (USBCLIENT_STATE_DISCONNECTED == value) {
_disable_usb_tethering(obj);
mobile_ap_error_code_e ret = MOBILE_AP_ERROR_NONE;
GError *error = NULL;
-#if !GLIB_CHECK_VERSION(2,36,0)
+#if !GLIB_CHECK_VERSION(2, 36, 0)
g_type_init();
#endif
vconf_notify_key_changed(VCONFKEY_SETAPPL_USB_MODE_INT,
__handle_usb_disconnect_cb, (void *)obj);
ret = vconf_get_int(VCONFKEY_SETAPPL_USB_MODE_INT, &vconf_key);
- if (ret != 0) {
+ if (ret != 0)
ERR("vconf_get_int is failed. but ignored [%d]\n", ret);
- }
if (vconf_key != SETTING_USB_TETHERING_MODE) {
ERR("USB Mode is changed suddenly\n");
}
ret = _init_tethering();
- if (ret != MOBILE_AP_ERROR_NONE) {
+ if (ret != MOBILE_AP_ERROR_NONE)
goto FAIL;
- }
vconf_notify_key_changed(VCONFKEY_SETAPPL_USB_MODE_INT,
__handle_usb_mode_change, (void *)obj);
_deinit_tethering();
- if (_remove_station_info_all(MOBILE_AP_TYPE_USB) != MOBILE_AP_ERROR_NONE) {
+ if (_remove_station_info_all(MOBILE_AP_TYPE_USB) != MOBILE_AP_ERROR_NONE)
ERR("_remove_station_info_all is failed. Ignore it\n");
- }
/* Clear DBus Signal Handler for USB Client State */
if (conn) {
wifi_recovery_timeout_id = 0;
ret = wifi_activate(__wifi_activated_cb, NULL);
- if (ret != WIFI_ERROR_NONE) {
+ if (ret != WIFI_ERROR_NONE)
ERR("wifi_activate() is failed : %d\n", ret);
- }
idle_id = g_idle_add(_terminate_mobileap_agent, NULL);
- if (idle_id == 0) {
+ if (idle_id == 0)
ERR("g_idle_add is failed\n");
- }
return FALSE;
}
return MOBILE_AP_ERROR_INTERNAL;
}
- if (mode != NULL) {
+ if (mode != NULL)
g_strlcpy(st->mode, mode, sizeof(st->mode));
- }
st->channel = channel;
st->hide_mode = hide_mode;
int _get_wifi_name_from_lease_info(const char *mac, char **name_buf)
{
- if (mac == NULL || name_buf == NULL) {
+ if (mac == NULL || name_buf == NULL)
return MOBILE_AP_ERROR_INVALID_PARAM;
- }
GIOChannel *io = NULL;
char *line = NULL;
char extra[MOBILE_AP_STR_INFO_LEN] = {0, };
io = g_io_channel_new_file(DNSMASQ_LEASES_FILE, "r", NULL);
- if (io == NULL) {
+ if (io == NULL)
return MOBILE_AP_ERROR_RESOURCE;
- }
while (g_io_channel_read_line(io, &line, NULL, NULL, NULL) ==
G_IO_STATUS_NORMAL) {
return MOBILE_AP_ERROR_ALREADY_ENABLED;
}
- if (!_mobileap_set_state(MOBILE_AP_STATE_WIFI_AP)) {
+ if (!_mobileap_set_state(MOBILE_AP_STATE_WIFI_AP))
return MOBILE_AP_ERROR_RESOURCE;
- }
+
ret = __update_softap_settings(&obj_softap_settings, ssid, passphrase,
NULL, MOBILE_AP_WIFI_CHANNEL, hide_mode, false, security_type);
if (ret != MOBILE_AP_ERROR_NONE) {
_flush_ip_address(WIFI_IF);
_deinit_timeout_cb(type);
- if (_remove_station_info_all(type) != MOBILE_AP_ERROR_NONE) {
+ if (_remove_station_info_all(type) != MOBILE_AP_ERROR_NONE)
ERR("_remove_station_info_all is failed. Ignore it.\n");
- }
ret = _mh_core_disable_softap();
if (ret != MOBILE_AP_ERROR_NONE) {
if (prev_wifi_on == TRUE) {
DBG("Previous Wi-Fi was turned on. Recover it\n");
- if (__turn_on_wifi() != MOBILE_AP_ERROR_NONE) {
+ if (__turn_on_wifi() != MOBILE_AP_ERROR_NONE)
ERR("__turn_on_wifi() is failed\n");
- }
prev_wifi_on = FALSE;
}
DBG("_disable_wifi_tethering is done\n");
_flush_ip_address(WIFI_IF);
_deinit_timeout_cb(type);
- if (_remove_station_info_all(type) != MOBILE_AP_ERROR_NONE) {
+ if (_remove_station_info_all(type) != MOBILE_AP_ERROR_NONE)
ERR("_remove_station_info_all is failed. Ignore it.\n");
- }
ret = _mh_core_disable_softap();
if (ret != MOBILE_AP_ERROR_NONE) {
return MOBILE_AP_ERROR_ALREADY_ENABLED;
}
- if (!_mobileap_set_state(MOBILE_AP_STATE_WIFI_AP)) {
+ if (!_mobileap_set_state(MOBILE_AP_STATE_WIFI_AP))
return MOBILE_AP_ERROR_RESOURCE;
- }
+
ret = __update_softap_settings(&obj_softap_settings, ssid, passphrase,
NULL, MOBILE_AP_WIFI_CHANNEL, hide_mode, false, security_type);
if (ret != MOBILE_AP_ERROR_NONE) {
return ret;
}
- if (vconf_set_str(VCONFKEY_SOFTAP_SSID, obj_softap_settings.ssid) < 0) {
+ if (vconf_set_str(VCONFKEY_SOFTAP_SSID, obj_softap_settings.ssid) < 0)
ERR("vconf_set_str is failed");
- }
- if (vconf_set_str(VCONFKEY_SOFTAP_KEY, obj_softap_settings.key) < 0) {
+ if (vconf_set_str(VCONFKEY_SOFTAP_KEY, obj_softap_settings.key) < 0)
ERR("vconf_set_str is failed");
- }
_block_device_sleep();
_flush_ip_address(WIFI_IF);
_deinit_timeout_cb(type);
- if (_remove_station_info_all(type) != MOBILE_AP_ERROR_NONE) {
+ if (_remove_station_info_all(type) != MOBILE_AP_ERROR_NONE)
ERR("_remove_station_info_all is failed. Ignore it.\n");
- }
ret = _mh_core_disable_softap();
if (ret != MOBILE_AP_ERROR_NONE) {
wifi_recovery_timeout_id = 0;
}
- ret = _enable_wifi_ap(obj, ssid, key, !visibility,
- (softap_security_type_e)security_type);
+ ret = _enable_wifi_ap(obj, ssid, key, !visibility, (softap_security_type_e)security_type);
if (ret != MOBILE_AP_ERROR_NONE) {
ERR("_enable_wifi_tethering is failed\n");
} else {
g_strlcpy(passphrase, (char *)ckmc_buf->data, (*passphrase_len) + 1);
}
- if (alias)
+ if (alias)
free(alias);
return MOBILE_AP_ERROR_NONE;
{
mobile_ap_error_code_e ret = MOBILE_AP_ERROR_NONE;
- if (enable) {
+ if (enable)
ret = _mh_core_execute_dhcp_server();
- }
- else {
+ else
ret = _mh_core_terminate_dhcp_server();
- }
tethering_complete_enable_dhcp(obj, context, ret);
+
return TRUE;
}
gboolean tethering_set_wifi_tethering_passphrase(Tethering *obj,
GDBusMethodInvocation *context, gchar *passphrase)
{
- char old_passphrase[MOBILE_AP_WIFI_KEY_MAX_LEN + 1] = {0, };
- unsigned int old_len = 0;
- unsigned int passphrase_len = strlen(passphrase);
- mobile_ap_error_code_e ret = MOBILE_AP_ERROR_NONE;
-
- ret = __get_passphrase(old_passphrase, sizeof(old_passphrase), &old_len);
- if (ret == MOBILE_AP_ERROR_NONE && old_len == passphrase_len &&
- !g_strcmp0(old_passphrase, passphrase)) {
- ret = MOBILE_AP_ERROR_NONE;
- tethering_complete_set_wifi_tethering_passphrase(obj, context, ret);
- return true;
- }
-
- ret = __set_passphrase(passphrase, passphrase_len);
+ char old_passphrase[MOBILE_AP_WIFI_KEY_MAX_LEN + 1] = {0, };
+ unsigned int old_len = 0;
+ unsigned int passphrase_len = strlen(passphrase);
+ mobile_ap_error_code_e ret = MOBILE_AP_ERROR_NONE;
- tethering_complete_set_wifi_tethering_passphrase(obj, context, ret);
+ ret = __get_passphrase(old_passphrase, sizeof(old_passphrase), &old_len);
+ if (ret == MOBILE_AP_ERROR_NONE && old_len == passphrase_len && !g_strcmp0(old_passphrase, passphrase)) {
+ ret = MOBILE_AP_ERROR_NONE;
+ tethering_complete_set_wifi_tethering_passphrase(obj, context, ret);
+ return true;
+ }
+ ret = __set_passphrase(passphrase, passphrase_len);
+ tethering_complete_set_wifi_tethering_passphrase(obj, context, ret);
- return true;
+ return true;
}
gboolean softap_enable(Softap *obj, GDBusMethodInvocation *context,
{
mobile_ap_error_code_e ret = MOBILE_AP_ERROR_NONE;
gboolean ret_val = FALSE;
-
+
DBG("+");
g_assert(obj != NULL);