case NET_EVENT_OPEN_IND:
result = __libnet_convert_to_cp_error_type(event_cb->Error);
CONNECTION_LOG(CONNECTION_INFO, "Connection opened %s[%s]",
- (is_requested) ? "RSP":"IND",
+ (is_requested) ? "RSP" : "IND",
__libnet_convert_cp_error_type_to_string(result));
if (is_requested)
case NET_EVENT_CLOSE_IND:
result = __libnet_convert_to_cp_error_type(event_cb->Error);
CONNECTION_LOG(CONNECTION_INFO, "Connection closed %s[%s]",
- (is_requested) ? "RSP":"IND",
+ (is_requested) ? "RSP" : "IND",
__libnet_convert_cp_error_type_to_string(result));
if (is_requested)
__libnet_ethernet_cable_state_changed_cb(CONNECTION_ETHERNET_CABLE_DETACHED);
break;
- default :
+ default:
break;
}
}
int err = 0;
err = inet_pton(address_family, address, &buf);
- if(err > 0)
+ if (err > 0)
return 1;
return 0;
int count = 0;
int i = 0;
- for (;i < profile_list->count;i++) {
+ for (; i < profile_list->count; i++) {
if (profile_list->profiles[i].ProfileState == NET_STATE_TYPE_ONLINE ||
profile_list->profiles[i].ProfileState == NET_STATE_TYPE_READY)
count++;
{
int i = 0;
- for (;i < source->count;i++) {
+ for (; i < source->count; i++) {
if (source->profiles[i].ProfileState == NET_STATE_TYPE_ONLINE ||
source->profiles[i].ProfileState == NET_STATE_TYPE_READY) {
memcpy(*dest, &source->profiles[i], sizeof(net_profile_info_t));
int count = 0;
int i = 0;
- for (;i < profile_list->count;i++) {
+ for (; i < profile_list->count; i++) {
if (profile_list->profiles[i].ProfileInfo.Pdp.DefaultConn == TRUE)
count++;
}
{
int i = 0;
- for (;i < source->count;i++) {
+ for (; i < source->count; i++) {
if (source->profiles[i].ProfileInfo.Pdp.DefaultConn == TRUE) {
memcpy(*dest, &source->profiles[i], sizeof(net_profile_info_t));
(*dest)++;
for (list = prof_handle_list; list; list = list->next)
if (profile == list->data) return true;
- for (;i < profile_iterator.count;i++)
+ for (; i < profile_iterator.count; i++)
if (profile == &profile_iterator.profiles[i]) return true;
return false;
case WIFI_DISCONNECTING:
*state = CONNECTION_WIFI_STATE_CONNECTED;
break;
- default :
+ default:
CONNECTION_LOG(CONNECTION_ERROR, "Unknown Wi-Fi state");
return CONNECTION_ERROR_INVALID_OPERATION;
}
return CONNECTION_ERROR_OPERATION_FAILED;
}
- if(status == 1)
+ if (status == 1)
*state = CONNECTION_ETHERNET_CABLE_ATTACHED;
else
*state = CONNECTION_ETHERNET_CABLE_DETACHED;
char *endstr = NULL;
int address_family = 0;
- if(__libnet_check_address_type(AF_INET, host_address))
+ if (__libnet_check_address_type(AF_INET, host_address))
address_family = AF_INET;
else
return CONNECTION_ERROR_INVALID_PARAMETER;
- switch(address_family) {
- case AF_INET:
- endstr = strrchr(host_address, '.');
- if (endstr == NULL ||
- strcmp(endstr, ".0") == 0 ||
- strncmp(host_address, "0.", 2) == 0 ||
- strstr(host_address, "255") != NULL) {
- CONNECTION_LOG(CONNECTION_ERROR, "Invalid IP address Passed\n");
- return CONNECTION_ERROR_INVALID_PARAMETER;
- }
- break;
- default:
- return CONNECTION_ERROR_OPERATION_FAILED;
+ switch (address_family) {
+ case AF_INET:
+ endstr = strrchr(host_address, '.');
+ if (endstr == NULL ||
+ strcmp(endstr, ".0") == 0 ||
+ strncmp(host_address, "0.", 2) == 0 ||
+ strstr(host_address, "255") != NULL) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid IP address Passed\n");
+ return CONNECTION_ERROR_INVALID_PARAMETER;
+ }
+ break;
+ default:
+ return CONNECTION_ERROR_OPERATION_FAILED;
}
rv = net_add_route(host_address, interface_name, address_family);
else
return CONNECTION_ERROR_INVALID_PARAMETER;
- switch(address_family) {
- case AF_INET:
- endstr = strrchr(host_address, '.');
- if (endstr == NULL ||
- strcmp(endstr, ".0") == 0 ||
- strncmp(host_address, "0.", 2) == 0 ||
- strstr(host_address, ".0.") != NULL ||strstr(host_address, "255") != NULL) {
- CONNECTION_LOG(CONNECTION_ERROR, "Invalid IP address Passed");
- return CONNECTION_ERROR_INVALID_PARAMETER;
- }
- break;
- default:
- return CONNECTION_ERROR_OPERATION_FAILED;
+ switch (address_family) {
+ case AF_INET:
+ endstr = strrchr(host_address, '.');
+ if (endstr == NULL ||
+ strcmp(endstr, ".0") == 0 ||
+ strncmp(host_address, "0.", 2) == 0 ||
+ strstr(host_address, ".0.") != NULL || strstr(host_address, "255") != NULL) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid IP address Passed");
+ return CONNECTION_ERROR_INVALID_PARAMETER;
+ }
+ break;
+ default:
+ return CONNECTION_ERROR_OPERATION_FAILED;
}
rv = net_remove_route(host_address, interface_name, address_family);
else
return CONNECTION_ERROR_INVALID_PARAMETER;*/
- switch(address_family) {
- case AF_INET6:
- if (strncmp(host_address, "fe80:", 5) == 0 ||
- strncmp(host_address, "ff00:", 5) == 0 ||
- strncmp(host_address, "::", 2) == 0) {
- CONNECTION_LOG(CONNECTION_ERROR, "Invalid IP address Passed\n");
- return CONNECTION_ERROR_INVALID_PARAMETER;
- }
- break;
- default:
- return CONNECTION_ERROR_OPERATION_FAILED;
+ switch (address_family) {
+ case AF_INET6:
+ if (strncmp(host_address, "fe80:", 5) == 0 ||
+ strncmp(host_address, "ff00:", 5) == 0 ||
+ strncmp(host_address, "::", 2) == 0) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid IP address Passed\n");
+ return CONNECTION_ERROR_INVALID_PARAMETER;
+ }
+ break;
+ default:
+ return CONNECTION_ERROR_OPERATION_FAILED;
}
rv = net_add_route_ipv6(host_address, interface_name, address_family, gateway);
else
return CONNECTION_ERROR_INVALID_PARAMETER;*/
- switch(address_family) {
- case AF_INET6:
- if (strncmp(host_address, "fe80:", 5) == 0 ||
- strncmp(host_address, "ff00:", 5) == 0 ||
- strncmp(host_address, "::", 2) == 0) {
- CONNECTION_LOG(CONNECTION_ERROR, "Invalid IP address Passed\n");
- return CONNECTION_ERROR_INVALID_PARAMETER;
- }
- break;
- default:
- return CONNECTION_ERROR_OPERATION_FAILED;
+ switch (address_family) {
+ case AF_INET6:
+ if (strncmp(host_address, "fe80:", 5) == 0 ||
+ strncmp(host_address, "ff00:", 5) == 0 ||
+ strncmp(host_address, "::", 2) == 0) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid IP address Passed\n");
+ return CONNECTION_ERROR_INVALID_PARAMETER;
+ }
+ break;
+ default:
+ return CONNECTION_ERROR_OPERATION_FAILED;
}
rv = net_remove_route_ipv6(host_address, interface_name, address_family, gateway);
if (rv == NET_ERR_ACCESS_DENIED) {
CONNECTION_LOG(CONNECTION_ERROR, "Access denied");
return CONNECTION_ERROR_PERMISSION_DENIED;
- }else if (rv != NET_ERR_NONE)
+ } else if (rv != NET_ERR_NONE)
return CONNECTION_ERROR_OPERATION_FAILED;
return CONNECTION_ERROR_NONE;
{
guint id;
struct managed_idle_data *data;
+ GMainContext *context;
+ GSource *src;
if (!func)
return 0;
data->func = func;
data->user_data = user_data;
- id = g_idle_add_full(G_PRIORITY_DEFAULT_IDLE, __connection_idle_cb, data,
- __connection_idle_destroy_cb);
+ context = g_main_context_get_thread_default();
+ src = g_idle_source_new();
+ g_source_set_callback(src, __connection_idle_cb, data,
+ __connection_idle_destroy_cb);
+ id = g_source_attach(src, context);
+ g_source_unref(src);
if (!id) {
g_free(data);
return id;
bool __libnet_check_feature_supported(const char *key, connection_supported_feature_e feature)
{
- if(!connection_is_feature_checked[feature]) {
- if(system_info_get_platform_bool(key, &connection_feature_supported[feature]) < 0) {
+ if (!connection_is_feature_checked[feature]) {
+ if (system_info_get_platform_bool(key, &connection_feature_supported[feature]) < 0) {
CONNECTION_LOG(CONNECTION_ERROR, "Error - Feature getting from System Info");
set_last_result(CONNECTION_ERROR_OPERATION_FAILED);
return CONNECTION_ERROR_OPERATION_FAILED;
va_start(list, feature_name);
key = feature_name;
- while(1) {
- if((strcmp(key, TELEPHONY_FEATURE) == 0)){
+ while (1) {
+ if (strcmp(key, TELEPHONY_FEATURE) == 0)
value = __libnet_check_feature_supported(key, CONNECTION_SUPPORTED_FEATURE_TELEPHONY);
- }
- if((strcmp(key, WIFI_FEATURE) == 0)){
+ if (strcmp(key, WIFI_FEATURE) == 0)
value = __libnet_check_feature_supported(key, CONNECTION_SUPPORTED_FEATURE_WIFI);
- }
- if((strcmp(key, TETHERING_BLUETOOTH_FEATURE) == 0)){
+ if (strcmp(key, TETHERING_BLUETOOTH_FEATURE) == 0)
value = __libnet_check_feature_supported(key, CONNECTION_SUPPORTED_FEATURE_TETHERING_BLUETOOTH);
- }
- if((strcmp(key, ETHERNET_FEATURE) == 0)){
+ if (strcmp(key, ETHERNET_FEATURE) == 0)
value = __libnet_check_feature_supported(key, CONNECTION_SUPPORTED_FEATURE_ETHERNET);
- }
- SECURE_CONNECTION_LOG(CONNECTION_INFO, "%s feature is %s", key, (value?"true":"false"));
+ SECURE_CONNECTION_LOG(CONNECTION_INFO, "%s feature is %s", key, (value ? "true" : "false"));
feature_supported |= value;
key = va_arg(list, const char *);
if (!key) break;