It's one of the processess for multi-thread safety.
Change-Id: Ic935276933b63ebea691cdafc393ac5ce839fed9
Signed-off-by: hyunuktak <hyunuk.tak@samsung.com>
extern "C" {
#endif
-gboolean _connection_libnet_mptcp_supported();
-int _connection_libnet_mptcp_enable(connection_mptcp_enable_e enable);
-int _connection_libnet_mptcp_get_enabled(connection_mptcp_enable_e* enable);
-int _connection_libnet_mptcp_set_path_manager(connection_mptcp_path_manager_e pm);
-int _connection_libnet_mptcp_get_path_manager(connection_mptcp_path_manager_e* pm);
-int _connection_libnet_mptcp_set_scheduler(connection_mptcp_scheduler_e scheduler);
-int _connection_libnet_mptcp_get_scheduler(connection_mptcp_scheduler_e* scheduler);
+gboolean _connection_libnet_mptcp_supported(connection_handle_s *conn_handle);
+int _connection_libnet_mptcp_enable(connection_handle_s *conn_handle, connection_mptcp_enable_e enable);
+int _connection_libnet_mptcp_get_enabled(connection_handle_s *conn_handle, connection_mptcp_enable_e* enable);
+int _connection_libnet_mptcp_set_path_manager(connection_handle_s *conn_handle, connection_mptcp_path_manager_e pm);
+int _connection_libnet_mptcp_get_path_manager(connection_handle_s *conn_handle, connection_mptcp_path_manager_e* pm);
+int _connection_libnet_mptcp_set_scheduler(connection_handle_s *conn_handle, connection_mptcp_scheduler_e scheduler);
+int _connection_libnet_mptcp_get_scheduler(connection_handle_s *conn_handle, connection_mptcp_scheduler_e* scheduler);
#ifdef __cplusplus
}
connection_address_changed_cb ip_changed_callback;
connection_address_changed_cb proxy_changed_callback;
connection_ethernet_cable_state_changed_cb ethernet_cable_state_changed_callback;
+ connection_set_default_cb set_default_callback;
+ connection_opened_cb opened_callback;
+ connection_closed_cb closed_callback;
+ connection_opened_cb reset_callback;
void *type_changed_user_data;
void *ip_changed_user_data;
void *proxy_changed_user_data;
void *ethernet_cable_state_changed_user_data;
-} connection_handle_s;
-
-typedef void(*libnet_ethernet_cable_state_changed_cb)
- (connection_ethernet_cable_state_e state);
-
-typedef void(*libnet_type_changed_cb) (int type);
-
-typedef void(*libnet_ip_changed_cb) (connection_address_family_e addr_family,
- char *ip_addr);
+ void *set_default_user_data;
+ void *opened_user_data;
+ void *closed_user_data;
+ void *reset_user_data;
-typedef void(*libnet_proxy_changed_cb) (char *proxy_addr);
-
-bool _connection_is_created(void);
+ void *network_info_handle;
+} connection_handle_s;
-int _connection_libnet_init(void);
-bool _connection_libnet_deinit(void);
-void _connection_set_cs_tid(int tid);
-void _connection_unset_cs_tid(int tid);
-int _connection_libnet_get_metered_state(bool* is_metered);
-int _connection_libnet_get_wifi_state(connection_wifi_state_e *state);
-int _connection_libnet_get_ethernet_state(connection_ethernet_state_e *state);
-int _connection_libnet_get_ethernet_cable_state(connection_ethernet_cable_state_e* state);
-int _connection_libnet_set_ethernet_cable_state_changed_cb(
- libnet_ethernet_cable_state_changed_cb callback);
-int _connection_libnet_get_bluetooth_state(connection_bt_state_e* state);
+int _connection_libnet_init(connection_handle_s *conn_handle);
+bool _connection_libnet_deinit(connection_handle_s *conn_handle);
+void _connection_set_cs_tid(int tid, connection_handle_s *conn_handle);
+void _connection_unset_cs_tid(int tid, connection_handle_s *conn_handle);
+int _connection_libnet_get_metered_state(connection_handle_s *conn_handle, bool* is_metered);
+int _connection_libnet_get_wifi_state(connection_handle_s *conn_handle, connection_wifi_state_e *state);
+int _connection_libnet_get_ethernet_state(connection_handle_s *conn_handle,
+ connection_ethernet_state_e *state);
+int _connection_libnet_get_ethernet_cable_state(connection_handle_s *conn_handle,
+ connection_ethernet_cable_state_e* state);
+int _connection_libnet_get_bluetooth_state(connection_handle_s *conn_handle, connection_bt_state_e* state);
bool _connection_libnet_check_profile_validity(connection_profile_h profile);
-bool _connection_libnet_check_profile_cb_validity(connection_profile_h profile);
-int _connection_libnet_get_profile_iterator(connection_iterator_type_e type,
- connection_profile_iterator_h *profile_iterator);
+int _connection_libnet_get_profile_iterator(connection_handle_s *conn_handle,
+ connection_iterator_type_e type, connection_profile_iterator_h *profile_iterator);
bool _connection_libnet_iterator_has_next(connection_profile_iterator_h profile_iterator);
-int _connection_libnet_get_iterator_next(connection_profile_iterator_h profile_iter_h, connection_profile_h *profile);
+int _connection_libnet_get_iterator_next(connection_profile_iterator_h profile_iter_h,
+ connection_profile_h *profile);
int _connection_libnet_destroy_iterator(connection_profile_iterator_h profile_iter_h);
-int _connection_libnet_get_current_profile(connection_profile_h *profile);
-int _connection_libnet_reset_profile(connection_reset_option_e type, connection_cellular_subscriber_id_e id, connection_reset_cb callback, void *user_data);
-int _connection_libnet_open_profile(connection_profile_h profile, connection_opened_cb callback, void *user_data);
-int _connection_libnet_get_cellular_service_profile(connection_cellular_service_type_e type, connection_profile_h *profile);
-int _connection_libnet_set_cellular_service_profile_sync(connection_cellular_service_type_e type, connection_profile_h profile);
-int _connection_libnet_set_cellular_service_profile_async(connection_cellular_service_type_e type,
- connection_profile_h profile, connection_set_default_cb callback, void* user_data);
-int _connection_libnet_close_profile(connection_profile_h profile, connection_closed_cb callback, void *user_data);
-int _connection_libnet_add_route(const char *interface_name, const char *host_address);
-int _connection_libnet_remove_route(const char *interface_name, const char *host_address);
-int _connection_libnet_add_route_ipv6(const char *interface_name, const char *host_address, const char * gateway);
-int _connection_libnet_remove_route_ipv6(const char *interface_name, const char *host_address, const char * gateway);
-int _connection_libnet_add_route_entry(connection_address_family_e address_family, const char *interface_name, const char *host_address, const char * gateway);
-int _connection_libnet_remove_route_entry(connection_address_family_e address_family, const char *interface_name, const char *host_address, const char * gateway);
+int _connection_libnet_get_current_profile(connection_handle_s *conn_handle,
+ connection_profile_h *profile);
+int _connection_libnet_reset_profile(connection_handle_s *conn_handle,
+ connection_reset_option_e type, connection_cellular_subscriber_id_e id);
+int _connection_libnet_open_profile(connection_handle_s *conn_handle,
+ connection_profile_h profile);
+int _connection_libnet_get_cellular_service_profile(connection_handle_s *conn_handle,
+ connection_cellular_service_type_e type, connection_profile_h *profile);
+int _connection_libnet_set_cellular_service_profile_sync(connection_handle_s *conn_handle,
+ connection_cellular_service_type_e type, connection_profile_h profile);
+int _connection_libnet_set_cellular_service_profile_async(connection_handle_s *conn_handle,
+ connection_cellular_service_type_e type, connection_profile_h profile);
+int _connection_libnet_close_profile(connection_handle_s *conn_handle, connection_profile_h profile);
+int _connection_libnet_add_route(connection_handle_s *conn_handle,
+ const char *interface_name, const char *host_address);
+int _connection_libnet_remove_route(connection_handle_s *conn_handle,
+ const char *interface_name, const char *host_address);
+int _connection_libnet_add_route_ipv6(connection_handle_s *conn_handle,
+ const char *interface_name, const char *host_address, const char * gateway);
+int _connection_libnet_remove_route_ipv6(connection_handle_s *conn_handle,
+ const char *interface_name, const char *host_address, const char * gateway);
+int _connection_libnet_add_route_entry(connection_handle_s *conn_handle,
+ connection_address_family_e address_family, const char *interface_name,
+ const char *host_address, const char * gateway);
+int _connection_libnet_remove_route_entry(connection_handle_s *conn_handle,
+ connection_address_family_e address_family, const char *interface_name,
+ const char *host_address, const char * gateway);
void _connection_libnet_add_to_profile_list(connection_profile_h profile);
void _connection_libnet_remove_from_profile_list(connection_profile_h profile);
bool _connection_libnet_add_to_profile_cb_list(connection_profile_h profile,
- connection_profile_state_changed_cb callback, void *user_data);
+ connection_profile_state_changed_cb callback, void *user_data);
bool _connection_libnet_remove_from_profile_cb_list(connection_profile_h profile);
-int _connection_libnet_set_statistics(net_device_t device_type, net_statistics_type_e statistics_type);
-int _connection_libnet_get_statistics(net_statistics_type_e statistics_type, unsigned long long *size);
-int _connection_libnet_check_get_privilege();
-int _connection_libnet_check_profile_privilege();
+int _connection_libnet_set_statistics(connection_handle_s *conn_handle,
+ net_device_t device_type, net_statistics_type_e statistics_type);
+int _connection_libnet_get_statistics(connection_handle_s *conn_handle,
+ net_statistics_type_e statistics_type, unsigned long long *size);
+int _connection_libnet_check_get_privilege(void);
+int _connection_libnet_check_profile_privilege(void);
int _connection_check_feature_supported(const char *feature_name, ...);
-guint _connection_callback_add(GSourceFunc func, gpointer user_data);
-void _connection_callback_cleanup(void);
-
connection_cellular_service_type_e _profile_convert_to_connection_cellular_service_type(net_service_type_t svc_type);
connection_profile_state_e _profile_convert_to_cp_state(net_state_type_t state);
net_service_type_t _connection_profile_convert_to_libnet_cellular_service_type(connection_cellular_service_type_e svc_type);
net_state_type_t _connection_profile_convert_to_net_state(connection_profile_state_e state);
-int _connection_libnet_set_cellular_subscriber_id(connection_profile_h profile, connection_cellular_subscriber_id_e sim_id);
-
-int _connection_libnet_start_tcpdump(void);
-int _connection_libnet_stop_tcpdump(void);
-int _connection_libnet_get_tcpdump_state(gboolean *tcpdump_state);
+int _connection_libnet_set_cellular_subscriber_id(connection_profile_h profile,
+ connection_cellular_subscriber_id_e sim_id);
-void _connection_libnet_set_type_changed_cb(libnet_type_changed_cb callback);
-void _connection_libnet_set_ip_changed_cb(libnet_ip_changed_cb callback);
-void _connection_libnet_set_proxy_changed_cb(libnet_proxy_changed_cb callback);
+int _connection_libnet_start_tcpdump(connection_handle_s *conn_handle);
+int _connection_libnet_stop_tcpdump(connection_handle_s *conn_handle);
+int _connection_libnet_get_tcpdump_state(connection_handle_s *conn_handle,
+ gboolean *tcpdump_state);
bool _connection_check_handle_validity(connection_h connection);
#ifdef __cplusplus
Name: capi-network-connection
Summary: Network Connection library in TIZEN C API
-Version: 1.0.113
+Version: 1.0.114
Release: 1
Group: System/Network
License: Apache-2.0
#include "net_connection_private.h"
-static __thread GSList *conn_handle_list = NULL;
+static GSList *conn_handle_list = NULL;
static int tv_profile = -1; // Unknown
//LCOV_EXCL_START
return __connection_check_handle_validity(connection);
}
-static connection_type_changed_cb
-__connection_get_type_changed_callback(connection_handle_s *local_handle)
+static int __connection_set_type_changed_callback(connection_handle_s *conn_handle,
+ void *callback, void *user_data)
{
- return local_handle->type_changed_callback;
-}
-
-static void *__connection_get_type_changed_userdata(
- connection_handle_s *local_handle)
-{
- return local_handle->type_changed_user_data;
-}
-
-static void __connection_cb_type_change_cb(int type)
-{
- GSList *list;
- connection_h handle;
- void *data;
- connection_type_changed_cb callback;
- int state;
-
- if (_connection_is_created() != true) {
- CONNECTION_LOG(CONNECTION_ERROR, "Application is not registered"
- "If multi-threaded, thread integrity be broken.");
- return;
- }
-
- state = __connection_convert_net_state(type);
-
- for (list = conn_handle_list; list; list = list->next) {
- handle = (connection_h)list->data;
-
- callback = __connection_get_type_changed_callback(handle);
- data = __connection_get_type_changed_userdata(handle);
- if (callback)
- callback(state, data);
- }
-}
-
-static void __connection_cb_ethernet_cable_state_changed_cb(connection_ethernet_cable_state_e state)
-{
- CONNECTION_LOG(CONNECTION_INFO, "Ethernet Cable state Indication");
-
- GSList *list;
-
- for (list = conn_handle_list; list; list = list->next) {
- connection_handle_s *local_handle = (connection_handle_s *)list->data;
- if (local_handle->ethernet_cable_state_changed_callback)
- local_handle->ethernet_cable_state_changed_callback(state,
- local_handle->ethernet_cable_state_changed_user_data);
- }
-}
-
-static int __connection_get_ethernet_cable_state_changed_callback_count(void)
-{
- GSList *list;
- int count = 0;
-
- for (list = conn_handle_list; list; list = list->next) {
- connection_handle_s *local_handle = (connection_handle_s *)list->data;
- if (local_handle->ethernet_cable_state_changed_callback) count++;
- }
-
- return count;
-}
-
-static int __connection_set_type_changed_callback(connection_h connection,
- void *callback, void *user_data)
-{
- static __thread gint refcount = 0;
- connection_handle_s *local_handle;
-
- local_handle = (connection_handle_s *)connection;
-
- if (callback) {
- if (refcount == 0)
- _connection_libnet_set_type_changed_cb(
- __connection_cb_type_change_cb);
-
- refcount++;
- CONNECTION_LOG(CONNECTION_INFO, "Successfully registered(%d)",
- refcount);
- } else {
- if (refcount > 0 &&
- __connection_get_type_changed_callback(local_handle) != NULL) {
- if (--refcount == 0) {
- _connection_libnet_set_type_changed_cb(NULL);
- CONNECTION_LOG(CONNECTION_INFO,
- "Successfully de-registered(%d)", refcount);
- }
- }
- }
-
- local_handle->type_changed_user_data = user_data;
- local_handle->type_changed_callback = callback;
+ conn_handle->type_changed_user_data = user_data;
+ conn_handle->type_changed_callback = callback;
return CONNECTION_ERROR_NONE;
}
-static connection_address_changed_cb
-__connection_get_ip_changed_callback(connection_handle_s *local_handle)
+static int __connection_set_ip_changed_callback(connection_handle_s *conn_handle,
+ void *callback, void *user_data)
{
- return local_handle->ip_changed_callback;
-}
+ conn_handle->ip_changed_user_data = user_data;
+ conn_handle->ip_changed_callback = callback;
-static void *__connection_get_ip_changed_userdata(
- connection_handle_s *local_handle)
-{
- return local_handle->ip_changed_user_data;
+ return CONNECTION_ERROR_NONE;
}
-static void __connection_cb_ip_change_cb(
- connection_address_family_e addr_family, char *ip_addr)
+static int __connection_set_proxy_changed_callback(connection_handle_s *conn_handle,
+ void *callback, void *user_data)
{
- GSList *list;
- connection_h handle;
- char *ip4_addr = NULL;
- char *ip6_addr = NULL;
- void *data;
- connection_address_changed_cb callback;
-
- if (_connection_is_created() != true) {
- CONNECTION_LOG(CONNECTION_ERROR, "Application is not registered"
- "If multi-threaded, thread integrity be broken.");
- return;
- }
-
- switch (addr_family) {
- case CONNECTION_ADDRESS_FAMILY_IPV4:
- ip4_addr = g_strdup(ip_addr);
-
- ip6_addr = vconf_get_str(VCONFKEY_NETWORK_IP6);
- if (ip6_addr == NULL)
- CONNECTION_LOG(CONNECTION_ERROR, //LCOV_EXCL_LINE
- "vconf_get_str(VCONFKEY_NETWORK_IP6) failed");
- break;
- case CONNECTION_ADDRESS_FAMILY_IPV6:
- ip6_addr = g_strdup(ip_addr);
-
- ip4_addr = vconf_get_str(VCONFKEY_NETWORK_IP);
- if (ip4_addr == NULL)
- CONNECTION_LOG(CONNECTION_ERROR, //LCOV_EXCL_LINE
- "vconf_get_str(VCONFKEY_NETWORK_IP) failed");
- break;
- default:
- CONNECTION_LOG(CONNECTION_ERROR, "Invalid Address Type");
- return;
- }
-
- for (list = conn_handle_list; list; list = list->next) {
- handle = (connection_h)list->data;
-
- callback = __connection_get_ip_changed_callback(handle);
- data = __connection_get_ip_changed_userdata(handle);
-
- if (callback)
- callback(ip4_addr, ip6_addr, data);
- }
+ conn_handle->proxy_changed_user_data = user_data;
+ conn_handle->proxy_changed_callback = callback;
- g_free(ip4_addr);
- g_free(ip6_addr);
+ return CONNECTION_ERROR_NONE;
}
-static int __connection_set_ip_changed_callback(connection_h connection,
- void *callback, void *user_data)
+static int __connection_set_ethernet_cable_state_changed_cb(connection_handle_s *conn_handle,
+ void *callback, void *user_data)
{
- static __thread gint refcount = 0;
- connection_handle_s *local_handle;
-
- local_handle = (connection_handle_s *)connection;
-
- if (callback) {
- if (refcount == 0)
- _connection_libnet_set_ip_changed_cb(
- __connection_cb_ip_change_cb);
-
- refcount++;
- CONNECTION_LOG(CONNECTION_INFO, "Successfully registered(%d)",
- refcount);
- } else {
- if (refcount > 0 &&
- __connection_get_ip_changed_callback(local_handle) != NULL) {
- if (--refcount == 0) {
- _connection_libnet_set_ip_changed_cb(NULL);
- CONNECTION_LOG(CONNECTION_INFO,
- "Successfully de-registered(%d)", refcount);
- }
- }
- }
-
- local_handle->ip_changed_user_data = user_data;
- local_handle->ip_changed_callback = callback;
+ conn_handle->ethernet_cable_state_changed_callback = callback;
+ conn_handle->ethernet_cable_state_changed_user_data = user_data;
return CONNECTION_ERROR_NONE;
}
-static connection_address_changed_cb
-__connection_get_proxy_changed_callback(connection_handle_s *local_handle)
+static int __connection_set_default_cellular_service_profile_callback(connection_handle_s *conn_handle,
+ void *callback, void *user_data)
{
- return local_handle->proxy_changed_callback;
-}
+ conn_handle->set_default_callback = callback;
+ conn_handle->set_default_user_data = user_data;
-static void *__connection_get_proxy_changed_userdata(
- connection_handle_s *local_handle)
-{
- return local_handle->proxy_changed_user_data;
+ return CONNECTION_ERROR_NONE;
}
-static void __connection_cb_proxy_change_cb(char *proxy_addr)
+static int __connection_open_profile_set_callback(connection_handle_s *conn_handle,
+ void *callback, void *user_data)
{
- GSList *list;
- connection_h handle;
- void *data;
- connection_address_changed_cb callback;
-
- if (_connection_is_created() != true) {
- CONNECTION_LOG(CONNECTION_ERROR, "Application is not registered"
- "If multi-threaded, thread integrity be broken.");
- return;
- }
+ conn_handle->opened_callback = callback;
+ conn_handle->opened_user_data = user_data;
- for (list = conn_handle_list; list; list = list->next) {
- handle = (connection_h)list->data;
-
- callback = __connection_get_proxy_changed_callback(handle);
- data = __connection_get_proxy_changed_userdata(handle);
- /* TODO: IPv6 should be supported */
- if (callback)
- callback(proxy_addr, NULL, data);
- }
+ return CONNECTION_ERROR_NONE;
}
-static int __connection_set_proxy_changed_callback(connection_h connection,
- void *callback, void *user_data)
+static int __connection_close_profile_set_callback(connection_handle_s *conn_handle,
+ void *callback, void *user_data)
{
- static __thread gint refcount = 0;
- connection_handle_s *local_handle;
-
- local_handle = (connection_handle_s *)connection;
-
- if (callback) {
- if (refcount == 0)
- _connection_libnet_set_proxy_changed_cb(
- __connection_cb_proxy_change_cb);
-
- refcount++;
- CONNECTION_LOG(CONNECTION_INFO, "Successfully registered(%d)",
- refcount);
- } else {
- if (refcount > 0 &&
- __connection_get_proxy_changed_callback(local_handle) != NULL) {
- if (--refcount == 0) {
- _connection_libnet_set_proxy_changed_cb(NULL);
- CONNECTION_LOG(CONNECTION_INFO,
- "Successfully de-registered(%d)", refcount);
- }
- }
- }
-
- local_handle->proxy_changed_user_data = user_data;
- local_handle->proxy_changed_callback = callback;
+ conn_handle->closed_callback = callback;
+ conn_handle->closed_user_data = user_data;
return CONNECTION_ERROR_NONE;
}
-static int __connection_set_ethernet_cable_state_changed_cb(connection_h connection,
- connection_ethernet_cable_state_changed_cb callback, void *user_data)
+static int __connection_reset_profile_set_callback(connection_handle_s *conn_handle,
+ void *callback, void *user_data)
{
- connection_handle_s *local_handle = (connection_handle_s *)connection;
-
- if (callback) {
- if (__connection_get_ethernet_cable_state_changed_callback_count() == 0)
- _connection_libnet_set_ethernet_cable_state_changed_cb(
- __connection_cb_ethernet_cable_state_changed_cb);
+ conn_handle->reset_callback = callback;
+ conn_handle->reset_user_data = user_data;
- } else {
- if (__connection_get_ethernet_cable_state_changed_callback_count() == 1 &&
- local_handle->ethernet_cable_state_changed_callback)
- _connection_libnet_set_ethernet_cable_state_changed_cb(NULL);
- }
-
- local_handle->ethernet_cable_state_changed_callback = callback;
- local_handle->ethernet_cable_state_changed_user_data = user_data;
return CONNECTION_ERROR_NONE;
}
//LCOV_EXCL_STOP
-static int __connection_get_handle_count(void)
-{
- return ((int)g_slist_length(conn_handle_list));
-}
-
/* Connection Manager ********************************************************/
EXPORT_API int connection_create(connection_h *connection)
{
CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+ int rv;
+
if (connection == NULL || __connection_check_handle_validity(*connection)) {
CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
- int rv = _connection_libnet_init();
+ *connection = g_try_malloc0(sizeof(connection_handle_s));
+ if (*connection != NULL)
+ CONNECTION_LOG(CONNECTION_INFO, "New handle created[%p]", *connection);
+ else
+ return CONNECTION_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE
+
+ rv = _connection_libnet_init(*connection);
if (rv == NET_ERR_ACCESS_DENIED) {
CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
}
- *connection = g_try_malloc0(sizeof(connection_handle_s));
- if (*connection != NULL)
- CONNECTION_LOG(CONNECTION_INFO, "New handle created[%p]", *connection);
- else
- return CONNECTION_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE
-
conn_handle_list = g_slist_prepend(conn_handle_list, *connection);
return CONNECTION_ERROR_NONE;
__connection_set_ip_changed_callback(connection, NULL, NULL);
__connection_set_proxy_changed_callback(connection, NULL, NULL);
__connection_set_ethernet_cable_state_changed_cb(connection, NULL, NULL);
+ _connection_libnet_deinit(connection);
conn_handle_list = g_slist_remove(conn_handle_list, connection);
g_free(connection);
connection = NULL;
- if (__connection_get_handle_count() == 0) {
- _connection_libnet_deinit();
- _connection_callback_cleanup();
- }
-
return CONNECTION_ERROR_NONE;
}
int rv;
rv = connection_create(connection);
-
if (rv == CONNECTION_ERROR_NONE)
- _connection_set_cs_tid(tid);
+ _connection_set_cs_tid(tid, *connection);
return rv;
}
{
int rv;
- _connection_unset_cs_tid(tid);
+ _connection_unset_cs_tid(tid, connection);
rv = connection_destroy(connection);
return rv;
return CONNECTION_ERROR_INVALID_PARAMETER;
}
- int rv = _connection_libnet_get_metered_state(is_metered);
+ int rv = _connection_libnet_get_metered_state(connection, is_metered);
if (rv != CONNECTION_ERROR_NONE) {
CONNECTION_LOG(CONNECTION_ERROR, "Fail to get metered state[%d]", rv); //LCOV_EXCL_LINE
return rv; //LCOV_EXCL_LINE
return CONNECTION_ERROR_INVALID_PARAMETER;
}
- int rv = _connection_libnet_get_wifi_state(state);
+ int rv = _connection_libnet_get_wifi_state(connection, state);
if (rv != CONNECTION_ERROR_NONE) {
CONNECTION_LOG(CONNECTION_ERROR, "Fail to get Wi-Fi state[%d]", rv); //LCOV_EXCL_LINE
return rv; //LCOV_EXCL_LINE
return CONNECTION_ERROR_INVALID_PARAMETER;
}
- return _connection_libnet_get_ethernet_state(state);
+ return _connection_libnet_get_ethernet_state(connection, state);
}
EXPORT_API int connection_get_ethernet_cable_state(connection_h connection, connection_ethernet_cable_state_e *state)
return CONNECTION_ERROR_INVALID_PARAMETER;
}
- return _connection_libnet_get_ethernet_cable_state(state);
+ return _connection_libnet_get_ethernet_cable_state(connection, state);
}
EXPORT_API int connection_set_ethernet_cable_state_chaged_cb(connection_h connection,
DEPRECATED_LOG("connection_ethernet_cable_state_chaged_cb",
"connection_ethernet_cable_state_changed_cb");
- return __connection_set_ethernet_cable_state_changed_cb(connection,
- (connection_ethernet_cable_state_changed_cb)callback, user_data);
+ return __connection_set_ethernet_cable_state_changed_cb(connection, callback, user_data);
}
EXPORT_API int connection_unset_ethernet_cable_state_chaged_cb(connection_h connection)
return CONNECTION_ERROR_INVALID_PARAMETER;
}
- return __connection_set_ethernet_cable_state_changed_cb(connection,
- NULL, NULL);
+ return __connection_set_ethernet_cable_state_changed_cb(connection, NULL, NULL);
}
EXPORT_API int connection_set_ethernet_cable_state_changed_cb(connection_h connection,
return CONNECTION_ERROR_INVALID_PARAMETER;
}
- return __connection_set_ethernet_cable_state_changed_cb(connection,
- callback, user_data);
+ return __connection_set_ethernet_cable_state_changed_cb(connection, callback, user_data);
}
EXPORT_API int connection_unset_ethernet_cable_state_changed_cb(connection_h connection)
return CONNECTION_ERROR_INVALID_PARAMETER;
}
- return __connection_set_ethernet_cable_state_changed_cb(connection,
- NULL, NULL);
+ return __connection_set_ethernet_cable_state_changed_cb(connection, NULL, NULL);
}
//LCOV_EXCL_STOP
return CONNECTION_ERROR_INVALID_PARAMETER;
}
- return _connection_libnet_get_bluetooth_state(state);
+ return _connection_libnet_get_bluetooth_state(connection, state);
}
EXPORT_API int connection_set_type_changed_cb(connection_h connection,
EXPORT_API int connection_add_profile(connection_h connection, connection_profile_h profile)
{
int rv = 0;
- net_profile_info_t *profile_info = profile;
+ connection_handle_s *conn_handle = (connection_handle_s *)connection;
+ net_profile_info_t *profile_info = (net_profile_info_t *)profile;
CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE);
return CONNECTION_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
}
- rv = net_add_profile(profile_info->ProfileInfo.Pdp.ServiceType,
- (net_profile_info_t*)profile);
+ rv = net_add_profile(conn_handle->network_info_handle,
+ profile_info->ProfileInfo.Pdp.ServiceType, profile_info);
if (rv == NET_ERR_ACCESS_DENIED) {
CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
EXPORT_API int connection_remove_profile(connection_h connection, connection_profile_h profile)
{
int rv = 0;
- net_profile_info_t *profile_info = profile;
+ connection_handle_s *conn_handle = (connection_handle_s *)connection;
+ net_profile_info_t *profile_info = (net_profile_info_t *)profile;
CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE);
if (!(__connection_check_handle_validity(connection)) ||
- !(_connection_libnet_check_profile_validity(profile))) {
+ !(_connection_libnet_check_profile_validity(profile))) {
CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
return CONNECTION_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
}
- rv = net_delete_profile(profile_info->ProfileName);
+ rv = net_delete_profile(conn_handle->network_info_handle, profile_info->ProfileName);
if (rv == NET_ERR_ACCESS_DENIED) {
CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
EXPORT_API int connection_update_profile(connection_h connection, connection_profile_h profile)
{
int rv = 0;
- net_profile_info_t *profile_info = profile;
+ connection_handle_s *conn_handle = (connection_handle_s *)connection;
+ net_profile_info_t *profile_info = (net_profile_info_t *)profile;
CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, ETHERNET_FEATURE);
return CONNECTION_ERROR_INVALID_PARAMETER;
}
- rv = net_modify_profile(profile_info->ProfileName, (net_profile_info_t*)profile);
+ rv = net_modify_profile(conn_handle->network_info_handle,
+ profile_info->ProfileName, (net_profile_info_t*)profile);
if (rv == NET_ERR_ACCESS_DENIED) {
CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
return CONNECTION_ERROR_INVALID_PARAMETER;
}
- return _connection_libnet_get_profile_iterator(type, profile_iterator);
+ return _connection_libnet_get_profile_iterator(connection, type, profile_iterator);
}
EXPORT_API int connection_profile_iterator_next(connection_profile_iterator_h profile_iterator,
return CONNECTION_ERROR_INVALID_PARAMETER;
}
- return _connection_libnet_get_current_profile(profile);
+ return _connection_libnet_get_current_profile(connection, profile);
}
EXPORT_API int connection_get_default_cellular_service_profile(
return CONNECTION_ERROR_INVALID_PARAMETER;
}
- return _connection_libnet_get_cellular_service_profile(type, profile);
+ return _connection_libnet_get_cellular_service_profile(connection, type, profile);
}
EXPORT_API int connection_set_default_cellular_service_profile(connection_h connection,
return CONNECTION_ERROR_INVALID_PARAMETER;
}
- return _connection_libnet_set_cellular_service_profile_sync(type, profile);
+ return _connection_libnet_set_cellular_service_profile_sync(connection, type, profile);
}
EXPORT_API int connection_set_default_cellular_service_profile_async(connection_h connection,
{
CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE);
+ int rv;
+
if (!(__connection_check_handle_validity(connection)) ||
profile == NULL || callback == NULL) {
CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
- return _connection_libnet_set_cellular_service_profile_async(type, profile, callback, user_data);
+ rv = _connection_libnet_set_cellular_service_profile_async(connection, type, profile);
+ if (rv == NET_ERR_ACCESS_DENIED) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
+ return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
+ } else if (rv != NET_ERR_NONE) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Failed to set default cellular service profile[%d]", rv); //LCOV_EXCL_LINE
+ return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
+ }
+
+ __connection_set_default_cellular_service_profile_callback(connection, callback, user_data);
+
+ return CONNECTION_ERROR_NONE;
}
EXPORT_API int connection_open_profile(connection_h connection, connection_profile_h profile,
{
CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE);
+ int rv;
+
if (!(__connection_check_handle_validity(connection)) ||
profile == NULL || callback == NULL) {
CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
- return _connection_libnet_open_profile(profile, callback, user_data);
+ rv = _connection_libnet_open_profile(connection, profile);
+ if (rv == NET_ERR_ACCESS_DENIED) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
+ return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
+ } else if (rv != NET_ERR_NONE) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Failed to open profile[%d]", rv); //LCOV_EXCL_LINE
+ return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
+ }
+
+ __connection_open_profile_set_callback(connection, callback, user_data);
+
+ return CONNECTION_ERROR_NONE;
}
EXPORT_API int connection_close_profile(connection_h connection, connection_profile_h profile,
{
CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE);
+ int rv;
+
if (!(__connection_check_handle_validity(connection)) ||
profile == NULL || callback == NULL) {
CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
- return _connection_libnet_close_profile(profile, callback, user_data);
+ rv = _connection_libnet_close_profile(connection, profile);
+ if (rv == NET_ERR_ACCESS_DENIED) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
+ return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
+ } else if (rv != NET_ERR_NONE) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Failed to close profile[%d]", rv); //LCOV_EXCL_LINE
+ return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
+ }
+
+ __connection_close_profile_set_callback(connection, callback, user_data);
+
+ return CONNECTION_ERROR_NONE;
}
EXPORT_API int connection_reset_profile(connection_h connection,
{
CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE);
+ int rv;
+
if (!(__connection_check_handle_validity(connection))) {
CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed");
return CONNECTION_ERROR_INVALID_PARAMETER;
return CONNECTION_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
}
- return _connection_libnet_reset_profile(type, id, callback, user_data);
+ rv = _connection_libnet_reset_profile(connection, type, id);
+ if (rv == NET_ERR_ACCESS_DENIED) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
+ return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
+ } else if (rv != NET_ERR_NONE) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Failed to reset profile[%d]", rv); //LCOV_EXCL_LINE
+ return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
+ }
+
+ __connection_reset_profile_set_callback(connection, callback, user_data);
+
+ return CONNECTION_ERROR_NONE;
}
EXPORT_API int connection_add_route(connection_h connection, const char* interface_name, const char* host_address)
return CONNECTION_ERROR_INVALID_PARAMETER;
}
- return _connection_libnet_add_route(interface_name, host_address);
+ return _connection_libnet_add_route(connection, interface_name, host_address);
}
EXPORT_API int connection_remove_route(connection_h connection, const char* interface_name, const char* host_address)
return CONNECTION_ERROR_INVALID_PARAMETER;
}
- return _connection_libnet_remove_route(interface_name, host_address);
+ return _connection_libnet_remove_route(connection, interface_name, host_address);
}
EXPORT_API int connection_add_route_ipv6(connection_h connection, const char *interface_name, const char *host_address, const char * gateway)
return CONNECTION_ERROR_INVALID_PARAMETER;
}
- return _connection_libnet_add_route_ipv6(interface_name, host_address, gateway);
+ return _connection_libnet_add_route_ipv6(connection, interface_name, host_address, gateway);
}
EXPORT_API int connection_remove_route_ipv6(connection_h connection, const char *interface_name, const char *host_address, const char * gateway)
return CONNECTION_ERROR_INVALID_PARAMETER;
}
- return _connection_libnet_remove_route_ipv6(interface_name, host_address, gateway);
+ return _connection_libnet_remove_route_ipv6(connection, interface_name, host_address, gateway);
}
EXPORT_API int connection_add_route_entry(connection_h connection,
}
if (address_family == CONNECTION_ADDRESS_FAMILY_IPV4)
- return _connection_libnet_add_route_entry(CONNECTION_ADDRESS_FAMILY_IPV4,
+ return _connection_libnet_add_route_entry(connection, CONNECTION_ADDRESS_FAMILY_IPV4,
interface_name, host_address, gateway);
else
- return _connection_libnet_add_route_entry(CONNECTION_ADDRESS_FAMILY_IPV6,
+ return _connection_libnet_add_route_entry(connection, CONNECTION_ADDRESS_FAMILY_IPV6,
interface_name, host_address, gateway);
return CONNECTION_ERROR_NONE;
}
if (address_family == CONNECTION_ADDRESS_FAMILY_IPV4)
- return _connection_libnet_remove_route_entry(CONNECTION_ADDRESS_FAMILY_IPV4,
+ return _connection_libnet_remove_route_entry(connection, CONNECTION_ADDRESS_FAMILY_IPV4,
interface_name, host_address, gateway);
else
- return _connection_libnet_remove_route_entry(CONNECTION_ADDRESS_FAMILY_IPV6,
+ return _connection_libnet_remove_route_entry(connection, CONNECTION_ADDRESS_FAMILY_IPV6,
interface_name, host_address, gateway);
return CONNECTION_ERROR_NONE;
return CONNECTION_ERROR_NONE;
}
-static int __get_statistic(connection_type_e connection_type,
+static int __get_statistic(connection_handle_s *conn_handle, connection_type_e connection_type,
connection_statistics_type_e statistics_type, long long *llsize)
{
int rv, stat_type;
return CONNECTION_ERROR_INVALID_PARAMETER;
}
- rv = _connection_libnet_get_statistics(stat_type, &ull_size);
+ rv = _connection_libnet_get_statistics(conn_handle, stat_type, &ull_size);
if (rv == CONNECTION_ERROR_PERMISSION_DENIED)
return rv;
else if (rv != CONNECTION_ERROR_NONE) {
return CONNECTION_ERROR_NONE;
}
-static int __reset_statistic(connection_type_e connection_type,
- connection_statistics_type_e statistics_type)
+static int __reset_statistic(connection_handle_s *conn_handle,
+ connection_type_e connection_type, connection_statistics_type_e statistics_type)
{
int conn_type;
int stat_type;
return CONNECTION_ERROR_INVALID_PARAMETER;
}
- rv = _connection_libnet_set_statistics(conn_type, stat_type);
+ rv = _connection_libnet_set_statistics(conn_handle, conn_type, stat_type);
if (rv != CONNECTION_ERROR_NONE)
return rv;
return CONNECTION_ERROR_INVALID_PARAMETER;
}
- return __get_statistic(connection_type, statistics_type, size);
+ return __get_statistic(connection, connection_type, statistics_type, size);
}
EXPORT_API int connection_reset_statistics(connection_h connection,
return CONNECTION_ERROR_INVALID_PARAMETER;
}
- return __reset_statistic(connection_type, statistics_type);
+ return __reset_statistic(connection, connection_type, statistics_type);
}
EXPORT_API int connection_foreach_ipv6_address(connection_h connection,
return CONNECTION_ERROR_INVALID_PARAMETER;
}
- ret = _connection_libnet_start_tcpdump();
+ ret = _connection_libnet_start_tcpdump(connection);
if (ret != CONNECTION_ERROR_NONE) {
CONNECTION_LOG(CONNECTION_ERROR, "Failed to start tcpdump (%d)", ret);
return ret;
return CONNECTION_ERROR_INVALID_PARAMETER;
}
- ret = _connection_libnet_stop_tcpdump();
+ ret = _connection_libnet_stop_tcpdump(connection);
if (ret != CONNECTION_ERROR_NONE) {
CONNECTION_LOG(CONNECTION_ERROR, "Failed to stop tcpdump (%d)", ret);
return ret;
return CONNECTION_ERROR_INVALID_PARAMETER;
}
- ret = _connection_libnet_get_tcpdump_state(tcpdump_state);
+ ret = _connection_libnet_get_tcpdump_state(connection, tcpdump_state);
if (ret != CONNECTION_ERROR_NONE) {
CONNECTION_LOG(CONNECTION_ERROR, "Failed to get the tcpdump state (%d)", ret);
return ret;
return CONNECTION_ERROR_INVALID_PARAMETER;
}
- *supported = _connection_libnet_mptcp_supported();
+ *supported = _connection_libnet_mptcp_supported(connection);
return CONNECTION_ERROR_NONE;
}
EXPORT_API int connection_mptcp_enable(connection_h connection, connection_mptcp_enable_e enable)
{
// check MPTCP support
- if (_connection_libnet_mptcp_supported() == FALSE) {
+ if (_connection_libnet_mptcp_supported(connection) == FALSE) {
CONNECTION_LOG(CONNECTION_ERROR, "MPTCP is not supported"); //LCOV_EXCL_LINE
return CONNECTION_ERROR_NOT_SUPPORTED; //LCOV_EXCL_LINE
}
return CONNECTION_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
}
- return _connection_libnet_mptcp_enable(enable);
+ return _connection_libnet_mptcp_enable(connection, enable);
}
EXPORT_API int connection_mptcp_disable(connection_h connection)
{
// check MPTCP support
- if (_connection_libnet_mptcp_supported() == FALSE) {
+ if (_connection_libnet_mptcp_supported(connection) == FALSE) {
CONNECTION_LOG(CONNECTION_ERROR, "MPTCP is not supported"); //LCOV_EXCL_LINE
return CONNECTION_ERROR_NOT_SUPPORTED; //LCOV_EXCL_LINE
}
return CONNECTION_ERROR_INVALID_PARAMETER;
}
- return _connection_libnet_mptcp_enable(CONNECTION_MPTCP_DISABLE);
+ return _connection_libnet_mptcp_enable(connection, CONNECTION_MPTCP_DISABLE);
}
EXPORT_API int connection_mptcp_get_enabled(connection_h connection, connection_mptcp_enable_e* enable)
{
// check MPTCP support
- if (_connection_libnet_mptcp_supported() == FALSE) {
+ if (_connection_libnet_mptcp_supported(connection) == FALSE) {
CONNECTION_LOG(CONNECTION_ERROR, "MPTCP is not supported"); //LCOV_EXCL_LINE
return CONNECTION_ERROR_NOT_SUPPORTED; //LCOV_EXCL_LINE
}
return CONNECTION_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
}
- return _connection_libnet_mptcp_get_enabled(enable);
+ return _connection_libnet_mptcp_get_enabled(connection, enable);
}
EXPORT_API int connection_mptcp_set_path_manager(connection_h connection, connection_mptcp_path_manager_e pm)
{
// check MPTCP support
- if (_connection_libnet_mptcp_supported() == FALSE) {
+ if (_connection_libnet_mptcp_supported(connection) == FALSE) {
CONNECTION_LOG(CONNECTION_ERROR, "MPTCP is not supported"); //LCOV_EXCL_LINE
return CONNECTION_ERROR_NOT_SUPPORTED; //LCOV_EXCL_LINE
}
return CONNECTION_ERROR_INVALID_PARAMETER;
}
- return _connection_libnet_mptcp_set_path_manager(pm);
+ return _connection_libnet_mptcp_set_path_manager(connection, pm);
}
EXPORT_API int connection_mptcp_get_path_manager(connection_h connection, connection_mptcp_path_manager_e* pm)
{
// check MPTCP support
- if (_connection_libnet_mptcp_supported() == FALSE) {
+ if (_connection_libnet_mptcp_supported(connection) == FALSE) {
CONNECTION_LOG(CONNECTION_ERROR, "MPTCP is not supported"); //LCOV_EXCL_LINE
return CONNECTION_ERROR_NOT_SUPPORTED; //LCOV_EXCL_LINE
}
return CONNECTION_ERROR_INVALID_PARAMETER;
}
- return _connection_libnet_mptcp_get_path_manager(pm);
+ return _connection_libnet_mptcp_get_path_manager(connection, pm);
}
EXPORT_API int connection_mptcp_set_scheduler(connection_h connection, connection_mptcp_scheduler_e scheduler)
{
// check MPTCP support
- if (_connection_libnet_mptcp_supported() == FALSE) {
+ if (_connection_libnet_mptcp_supported(connection) == FALSE) {
CONNECTION_LOG(CONNECTION_ERROR, "MPTCP is not supported"); //LCOV_EXCL_LINE
return CONNECTION_ERROR_NOT_SUPPORTED; //LCOV_EXCL_LINE
}
return CONNECTION_ERROR_INVALID_PARAMETER;
}
- return _connection_libnet_mptcp_set_scheduler(scheduler);
+ return _connection_libnet_mptcp_set_scheduler(connection, scheduler);
}
EXPORT_API int connection_mptcp_get_scheduler(connection_h connection, connection_mptcp_scheduler_e* scheduler)
{
// check MPTCP support
- if (_connection_libnet_mptcp_supported() == FALSE) {
+ if (_connection_libnet_mptcp_supported(connection) == FALSE) {
CONNECTION_LOG(CONNECTION_ERROR, "MPTCP is not supported"); //LCOV_EXCL_LINE
return CONNECTION_ERROR_NOT_SUPPORTED; //LCOV_EXCL_LINE
}
return CONNECTION_ERROR_INVALID_PARAMETER;
}
- return _connection_libnet_mptcp_get_scheduler(scheduler);
+ return _connection_libnet_mptcp_get_scheduler(connection, scheduler);
}
net_profile_info_t profile_info_local;
net_profile_info_t *profile_info = profile;
- rv = net_get_profile_info(profile_info->ProfileName, &profile_info_local);
+ rv = net_get_profile_info(NULL, profile_info->ProfileName, &profile_info_local);
if (rv == NET_ERR_ACCESS_DENIED) {
CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
#include "net_connection_private.h"
-static __thread GSList *prof_handle_list = NULL;
-static __thread GHashTable *profile_cb_table = NULL;
+static GSList *prof_handle_list = NULL;
+static GHashTable *profile_cb_table = NULL;
struct _profile_cb_s {
connection_profile_state_changed_cb callback;
net_profile_info_t *profiles;
};
-struct _libnet_s {
- connection_opened_cb opened_cb;
- connection_closed_cb closed_cb;
- connection_set_default_cb set_default_cb;
- connection_reset_cb reset_profile_cb;
- libnet_ethernet_cable_state_changed_cb ethernet_cable_state_changed_cb;
- libnet_type_changed_cb type_changed_cb;
- libnet_ip_changed_cb ip_changed_cb;
- libnet_proxy_changed_cb proxy_changed_cb;
- void *opened_user_data;
- void *closed_user_data;
- void *set_default_user_data;
- void *reset_profile_user_data;
- bool is_created;
-};
-
-struct _state_notify {
- connection_profile_state_changed_cb callback;
- connection_profile_state_e state;
- void *user_data;
-};
-
-struct managed_idle_data {
- GSourceFunc func;
- gpointer user_data;
- guint id;
-};
-
-static __thread struct _profile_list_s profile_iterator = {0, 0, NULL};
-static __thread struct _libnet_s libnet = {NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, false};
-static __thread GSList *managed_idler_list = NULL;
-static __thread bool connection_is_feature_checked[CONNECTION_SUPPORTED_FEATURE_MAX] = {0, };
-static __thread bool connection_feature_supported[CONNECTION_SUPPORTED_FEATURE_MAX] = {0, };
-
-bool _connection_is_created(void)
-{
- return libnet.is_created;
-}
-
-static void __connection_set_created(bool tag)
-{
- libnet.is_created = tag;
-}
+static struct _profile_list_s profile_iterator = {0, 0, NULL};
+static bool connection_is_feature_checked[CONNECTION_SUPPORTED_FEATURE_MAX] = {0, };
+static bool connection_feature_supported[CONNECTION_SUPPORTED_FEATURE_MAX] = {0, };
//LCOV_EXCL_START
static connection_error_e __libnet_convert_to_cp_error_type(net_err_t err_type)
}
}
-static void __libnet_set_reset_profile_cb(connection_opened_cb user_cb, void *user_data)
-{
- if (user_cb != NULL) {
- libnet.reset_profile_cb = user_cb;
- libnet.reset_profile_user_data = user_data;
- }
-}
-
-static gboolean __libnet_reset_profile_cb_idle(gpointer data)
-{
- connection_error_e result = (connection_error_e)data;
-
- if (libnet.reset_profile_cb != NULL)
- libnet.reset_profile_cb(result, libnet.reset_profile_user_data);
-
- libnet.reset_profile_cb = NULL;
- libnet.reset_profile_user_data = NULL;
-
- return FALSE;
-}
-
-static void __libnet_reset_profile_cb(connection_error_e result)
-{
- if (_connection_is_created() != true) {
- CONNECTION_LOG(CONNECTION_ERROR, "Application is not registered"
- "If multi-threaded, thread integrity be broken.");
- return;
- }
-
- if (libnet.reset_profile_cb != NULL)
- _connection_callback_add(__libnet_reset_profile_cb_idle, (gpointer)result);
-}
-
-static void __libnet_set_opened_cb(connection_opened_cb user_cb, void *user_data)
-{
- if (user_cb != NULL) {
- libnet.opened_cb = user_cb;
- libnet.opened_user_data = user_data;
- }
-}
-
-static gboolean __libnet_opened_cb_idle(gpointer data)
-{
- connection_error_e result = (connection_error_e)data;
-
- if (libnet.opened_cb != NULL)
- libnet.opened_cb(result, libnet.opened_user_data);
-
- libnet.opened_cb = NULL;
- libnet.opened_user_data = NULL;
-
- return FALSE;
-}
-
-static void __libnet_opened_cb(connection_error_e result)
-{
- if (_connection_is_created() != true) {
- CONNECTION_LOG(CONNECTION_ERROR, "Application is not registered"
- "If multi-threaded, thread integrity be broken.");
- return;
- }
-
- if (libnet.opened_cb != NULL)
- _connection_callback_add(__libnet_opened_cb_idle, (gpointer)result);
-}
-
-static void __libnet_set_closed_cb(connection_closed_cb user_cb, void *user_data)
-{
- if (user_cb != NULL) {
- libnet.closed_cb = user_cb;
- libnet.closed_user_data = user_data;
- }
-}
-
-static gboolean __libnet_closed_cb_idle(gpointer data)
-{
- connection_error_e result = (connection_error_e)data;
-
- if (libnet.closed_cb != NULL)
- libnet.closed_cb(result, libnet.closed_user_data);
-
- libnet.closed_cb = NULL;
- libnet.closed_user_data = NULL;
-
- return FALSE;
-}
-
-static void __libnet_closed_cb(connection_error_e result)
-{
- if (_connection_is_created() != true) {
- CONNECTION_LOG(CONNECTION_ERROR, "Application is not registered"
- "If multi-threaded, thread integrity be broken.");
- return;
- }
-
- if (libnet.closed_cb != NULL)
- _connection_callback_add(__libnet_closed_cb_idle, (gpointer)result);
-}
-
-static void __libnet_set_default_cb(connection_set_default_cb user_cb, void *user_data)
-{
- if (user_cb != NULL) {
- libnet.set_default_cb = user_cb;
- libnet.set_default_user_data = user_data;
- }
-}
-
-static gboolean __libnet_default_cb_idle(gpointer data)
-{
- connection_error_e result = (connection_error_e)data;
-
- if (libnet.set_default_cb != NULL)
- libnet.set_default_cb(result, libnet.set_default_user_data);
-
- libnet.set_default_cb = NULL;
- libnet.set_default_user_data = NULL;
-
- return FALSE;
-}
-
-static void __libnet_default_cb(connection_error_e result)
-{
- if (_connection_is_created() != true) {
- CONNECTION_LOG(CONNECTION_ERROR, "Application is not registered"
- "If multi-threaded, thread integrity be broken.");
- return;
- }
-
- if (libnet.set_default_cb != NULL)
- _connection_callback_add(__libnet_default_cb_idle, (gpointer)result);
-}
-
-static void __libnet_set_ethernet_cable_state_changed_cb(
- libnet_ethernet_cable_state_changed_cb user_cb)
-{
- libnet.ethernet_cable_state_changed_cb = user_cb;
-}
-
-static void __libnet_ethernet_cable_state_changed_cb(
- connection_ethernet_cable_state_e state)
-{
- if (libnet.ethernet_cable_state_changed_cb)
- libnet.ethernet_cable_state_changed_cb(state);
-}
-
-static void __libnet_type_changed_cb(int type)
-{
- if (libnet.type_changed_cb)
- libnet.type_changed_cb(type);
-}
-
-static void __libnet_ip_changed_cb(connection_address_family_e addr_family,
- char *ip_addr)
-{
- if (libnet.ip_changed_cb)
- libnet.ip_changed_cb(addr_family, ip_addr);
-}
-
-static void __libnet_proxy_changed_cb(char *proxy_addr)
-{
- if (libnet.proxy_changed_cb)
- libnet.proxy_changed_cb(proxy_addr);
-}
-
-static gboolean __libnet_state_changed_cb_idle(gpointer data)
-{
- struct _state_notify *notify = (struct _state_notify *)data;
-
- if (notify == NULL)
- return FALSE;
-
- if (notify->callback != NULL)
- notify->callback(notify->state, notify->user_data);
-
- g_free(notify);
-
- return FALSE;
-}
-
static void __libnet_state_changed_cb(char *profile_name, connection_profile_state_e state)
{
- guint id;
- struct _state_notify *notify;
struct _profile_cb_s *cb_info;
- if (_connection_is_created() != true) {
- CONNECTION_LOG(CONNECTION_ERROR, "Application is not registered"
- "If multi-threaded, thread integrity be broken.");
- return;
- }
-
if (profile_name == NULL)
return;
if (state < 0 || cb_info->callback == NULL)
return;
- notify = g_try_new0(struct _state_notify, 1);
- if (notify == NULL)
- return;
-
- notify->callback = cb_info->callback;
- notify->state = state;
- notify->user_data = cb_info->user_data;
-
- id = _connection_callback_add(__libnet_state_changed_cb_idle,
- (gpointer)notify);
- if (!id)
- g_free(notify);
+ cb_info->callback(cb_info->state, cb_info->user_data);
}
static void __libnet_clear_profile_list(struct _profile_list_s *profile_list)
{
bool is_requested = false;
connection_error_e result = CONNECTION_ERROR_NONE;
+ connection_handle_s *conn_handle = (connection_handle_s *)user_data;
switch (event_cb->Event) {
case NET_EVENT_OPEN_RSP:
(is_requested) ? "RSP" : "IND",
__libnet_convert_cp_error_type_to_string(result));
- if (is_requested)
- __libnet_opened_cb(result);
+ if (is_requested) {
+ if (conn_handle->opened_callback) {
+ conn_handle->opened_callback(result,
+ conn_handle->opened_user_data);
+
+ conn_handle->opened_callback = NULL;
+ conn_handle->opened_user_data = NULL;
+ }
+ }
switch (event_cb->Error) {
case NET_ERR_NONE:
(is_requested) ? "RSP" : "IND",
__libnet_convert_cp_error_type_to_string(result));
- if (is_requested)
- __libnet_closed_cb(result);
+ if (is_requested) {
+ if (conn_handle->closed_callback) {
+ conn_handle->closed_callback(result,
+ conn_handle->closed_user_data);
+
+ conn_handle->closed_callback = NULL;
+ conn_handle->closed_user_data = NULL;
+ }
+ }
switch (event_cb->Error) {
case NET_ERR_NONE:
case NET_EVENT_CELLULAR_SET_DEFAULT_RSP:
result = __libnet_convert_to_cp_error_type(event_cb->Error);
CONNECTION_LOG(CONNECTION_INFO, "Got set default profile RSP %d", result);
- __libnet_default_cb(result);
- break;
+ if (conn_handle->set_default_callback) {
+ conn_handle->set_default_callback(result,
+ conn_handle->set_default_user_data);
+ conn_handle->set_default_callback = NULL;
+ conn_handle->set_default_user_data = NULL;
+ }
+ break;
case NET_EVENT_CELLULAR_RESET_DEFAULT_RSP:
result = __libnet_convert_to_cp_error_type(event_cb->Error);
CONNECTION_LOG(CONNECTION_INFO, "Got reset default profile RSP %d", result);
- __libnet_reset_profile_cb(result);
+ if (conn_handle->reset_callback) {
+ conn_handle->reset_callback(result,
+ conn_handle->reset_user_data);
+
+ conn_handle->reset_callback = NULL;
+ conn_handle->reset_user_data = NULL;
+ }
break;
case NET_EVENT_ETHERNET_CABLE_ATTACHED:
CONNECTION_LOG(CONNECTION_INFO, "Got Ethernet cable Attached Indication\n");
- __libnet_ethernet_cable_state_changed_cb(CONNECTION_ETHERNET_CABLE_ATTACHED);
+ if (conn_handle->ethernet_cable_state_changed_callback) {
+ conn_handle->ethernet_cable_state_changed_callback(CONNECTION_ETHERNET_CABLE_ATTACHED,
+ conn_handle->ethernet_cable_state_changed_user_data);
+ }
break;
case NET_EVENT_ETHERNET_CABLE_DETACHED:
CONNECTION_LOG(CONNECTION_INFO, "Got Ethernet cable detached Indication\n");
- __libnet_ethernet_cable_state_changed_cb(CONNECTION_ETHERNET_CABLE_DETACHED);
+ if (conn_handle->ethernet_cable_state_changed_callback) {
+ conn_handle->ethernet_cable_state_changed_callback(CONNECTION_ETHERNET_CABLE_DETACHED,
+ conn_handle->ethernet_cable_state_changed_user_data);
+ }
break;
case NET_EVENT_NETWORK_TYPE_CHANGED:
CONNECTION_LOG(CONNECTION_INFO, "Got Network Type Changed Indication");
int *state = (int *) event_cb->Data;
- __libnet_type_changed_cb(*state);
+ if (conn_handle->type_changed_callback) {
+ int type = CONNECTION_TYPE_DISCONNECTED;
+
+ switch (*state) {
+ case VCONFKEY_NETWORK_CELLULAR:
+ type = CONNECTION_TYPE_CELLULAR;
+ break;
+ case VCONFKEY_NETWORK_WIFI:
+ type = CONNECTION_TYPE_WIFI;
+ break;
+ case VCONFKEY_NETWORK_ETHERNET:
+ type = CONNECTION_TYPE_ETHERNET;
+ break;
+ case VCONFKEY_NETWORK_BLUETOOTH:
+ type = CONNECTION_TYPE_BT;
+ break;
+ case VCONFKEY_NETWORK_DEFAULT_PROXY:
+ type = CONNECTION_TYPE_NET_PROXY;
+ break;
+ default:
+ type = CONNECTION_TYPE_DISCONNECTED;
+ break;
+ }
+
+ conn_handle->type_changed_callback(type,
+ conn_handle->type_changed_user_data);
+ }
break;
case NET_EVENT_IPV4_ADDRESS_CHANGED:
CONNECTION_LOG(CONNECTION_INFO, "Got IPv4 Address Changed Indication");
- char *ipv4_addr = (char *)event_cb->Data;
- __libnet_ip_changed_cb(CONNECTION_ADDRESS_FAMILY_IPV4, ipv4_addr);
+ if (conn_handle->ip_changed_callback) {
+ char *ipv4_addr = NULL;
+ char *ipv6_addr = NULL;
+ char *addr = (char *)event_cb->Data;
+
+ ipv4_addr = g_strdup(addr);
+ ipv6_addr = vconf_get_str(VCONFKEY_NETWORK_IP6);
+ if (ipv6_addr == NULL)
+ CONNECTION_LOG(CONNECTION_ERROR, //LCOV_EXCL_LINE
+ "vconf_get_str(VCONFKEY_NETWORK_IP6) failed");
+
+ conn_handle->ip_changed_callback(ipv4_addr, ipv6_addr,
+ conn_handle->ip_changed_user_data);
+
+ g_free(ipv4_addr);
+ g_free(ipv6_addr);
+ }
break;
case NET_EVENT_IPV6_ADDRESS_CHANGED:
CONNECTION_LOG(CONNECTION_INFO, "Got IPv6 Address Changed Indication");
- char *ipv6_addr = (char *)event_cb->Data;
- __libnet_ip_changed_cb(CONNECTION_ADDRESS_FAMILY_IPV6, ipv6_addr);
+ if (conn_handle->ip_changed_callback) {
+ char *ipv4_addr = NULL;
+ char *ipv6_addr = NULL;
+ char *addr = (char *)event_cb->Data;
+
+ ipv6_addr = g_strdup(addr);
+ ipv4_addr = vconf_get_str(VCONFKEY_NETWORK_IP);
+ if (ipv4_addr == NULL)
+ CONNECTION_LOG(CONNECTION_ERROR, //LCOV_EXCL_LINE
+ "vconf_get_str(VCONFKEY_NETWORK_IP) failed");
+
+ conn_handle->ip_changed_callback(ipv4_addr, ipv6_addr,
+ conn_handle->ip_changed_user_data);
+
+ g_free(ipv4_addr);
+ g_free(ipv6_addr);
+ }
break;
case NET_EVENT_PROXY_ADDRESS_CHANGED:
CONNECTION_LOG(CONNECTION_INFO, "Got Proxy Changed Indication");
char *proxy_addr = (char *)event_cb->Data;
- __libnet_proxy_changed_cb(proxy_addr);
+
+ if (conn_handle->proxy_changed_callback) {
+ conn_handle->proxy_changed_callback(proxy_addr, NULL,
+ conn_handle->proxy_changed_user_data);
+ }
break;
default:
}
//LCOV_EXCL_STOP
-int _connection_libnet_init(void)
+int _connection_libnet_init(connection_handle_s *conn_handle)
{
int rv;
- if (_connection_is_created() != true) {
- rv = net_register_client_ext((net_event_cb_t)__libnet_evt_cb, NET_DEVICE_DEFAULT, NULL);
- if (rv != NET_ERR_NONE)
- return rv;
+ rv = net_register_client(&(conn_handle->network_info_handle),
+ (net_event_cb_t)__libnet_evt_cb, conn_handle);
+ if (rv != NET_ERR_NONE)
+ return rv;
- __connection_set_created(true);
-
- if (profile_cb_table == NULL)
- profile_cb_table = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
- }
+ if (profile_cb_table == NULL)
+ profile_cb_table = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
return NET_ERR_NONE;
}
-bool _connection_libnet_deinit(void)
+bool _connection_libnet_deinit(connection_handle_s *conn_handle)
{
- if (_connection_is_created() == true) {
- if (net_deregister_client_ext(NET_DEVICE_DEFAULT) != NET_ERR_NONE)
- return false;
-
- __connection_set_created(false);
+ net_deregister_client(conn_handle->network_info_handle);
- if (profile_cb_table) {
- g_hash_table_destroy(profile_cb_table);
- profile_cb_table = NULL;
- }
+ if (profile_cb_table) {
+ g_hash_table_destroy(profile_cb_table);
+ profile_cb_table = NULL;
+ }
- __libnet_clear_profile_list(&profile_iterator);
+ __libnet_clear_profile_list(&profile_iterator);
- if (prof_handle_list) {
- g_slist_free_full(prof_handle_list, g_free);
- prof_handle_list = NULL;
- }
+ if (prof_handle_list) {
+ g_slist_free_full(prof_handle_list, g_free);
+ prof_handle_list = NULL;
}
return true;
}
-void _connection_set_cs_tid(int tid)
+void _connection_set_cs_tid(int tid, connection_handle_s *conn_handle)
{
- net_set_cs_tid(tid);
+ net_set_cs_tid(tid, conn_handle->network_info_handle);
}
-void _connection_unset_cs_tid(int tid)
+void _connection_unset_cs_tid(int tid, connection_handle_s *conn_handle)
{
- net_unset_cs_tid(tid);
+ net_unset_cs_tid(tid, conn_handle->network_info_handle);
}
bool _connection_libnet_check_profile_validity(connection_profile_h profile)
return false;
}
-//LCOV_EXCL_START
-bool _connection_libnet_check_profile_cb_validity(connection_profile_h profile)
-{
- struct _profile_cb_s *cb_info;
- net_profile_info_t *profile_info = profile;
-
- if (profile == NULL)
- return false;
-
- cb_info = g_hash_table_lookup(profile_cb_table, profile_info->ProfileName);
- if (cb_info != NULL)
- return true;
-
- return false;
-}
-//LCOV_EXCL_STOP
-
-int _connection_libnet_get_metered_state(bool* is_metered)
+int _connection_libnet_get_metered_state(connection_handle_s *conn_handle, bool* is_metered)
{
int rv = 0;
int status = 0;
- rv = net_get_metered_state(&status);
+ rv = net_get_metered_state(conn_handle->network_info_handle, &status);
if (rv == NET_ERR_ACCESS_DENIED) {
CONNECTION_LOG(CONNECTION_ERROR, "Access denied");
return CONNECTION_ERROR_PERMISSION_DENIED;
return CONNECTION_ERROR_NONE;
}
-int _connection_libnet_get_wifi_state(connection_wifi_state_e *state)
+int _connection_libnet_get_wifi_state(connection_handle_s *conn_handle, connection_wifi_state_e *state)
{
int rv;
net_wifi_state_t wlan_state;
- rv = net_get_wifi_state(&wlan_state);
+ rv = net_get_wifi_state(conn_handle->network_info_handle, &wlan_state);
if (rv == NET_ERR_ACCESS_DENIED) {
CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
return CONNECTION_ERROR_NONE;
}
-void _connection_libnet_set_type_changed_cb(libnet_type_changed_cb callback)
-{
- libnet.type_changed_cb = callback;
-}
-
-void _connection_libnet_set_ip_changed_cb(libnet_ip_changed_cb callback)
-{
- libnet.ip_changed_cb = callback;
-}
-
-void _connection_libnet_set_proxy_changed_cb(libnet_proxy_changed_cb callback)
-{
- libnet.proxy_changed_cb = callback;
-}
-
//LCOV_EXCL_START
-int _connection_libnet_get_ethernet_state(connection_ethernet_state_e *state)
+int _connection_libnet_get_ethernet_state(connection_handle_s *conn_handle,
+ connection_ethernet_state_e *state)
{
int rv;
struct _profile_list_s ethernet_profiles = {0, 0, NULL};
- rv = net_get_profile_list(NET_DEVICE_ETHERNET, ðernet_profiles.profiles, ðernet_profiles.count);
+ rv = net_get_profile_list(conn_handle->network_info_handle,
+ NET_DEVICE_ETHERNET, ðernet_profiles.profiles,
+ ðernet_profiles.count);
if (rv == NET_ERR_ACCESS_DENIED) {
CONNECTION_LOG(CONNECTION_ERROR, "Access denied");
return CONNECTION_ERROR_PERMISSION_DENIED;
return CONNECTION_ERROR_NONE;
}
-int _connection_libnet_get_ethernet_cable_state(connection_ethernet_cable_state_e* state)
+int _connection_libnet_get_ethernet_cable_state(connection_handle_s *conn_handle,
+ connection_ethernet_cable_state_e* state)
{
int rv = 0;
int status = 0;
- rv = net_get_ethernet_cable_state(&status);
+ rv = net_get_ethernet_cable_state(conn_handle->network_info_handle, &status);
if (rv == NET_ERR_ACCESS_DENIED) {
CONNECTION_LOG(CONNECTION_ERROR, "Access denied");
return CONNECTION_ERROR_PERMISSION_DENIED;
*state = CONNECTION_ETHERNET_CABLE_DETACHED;
return CONNECTION_ERROR_NONE;
}
-
-int _connection_libnet_set_ethernet_cable_state_changed_cb(
- libnet_ethernet_cable_state_changed_cb callback)
-{
- __libnet_set_ethernet_cable_state_changed_cb(callback);
-
- return CONNECTION_ERROR_NONE;
-}
//LCOV_EXCL_STOP
-int _connection_libnet_get_bluetooth_state(connection_bt_state_e *state)
+int _connection_libnet_get_bluetooth_state(connection_handle_s *conn_handle, connection_bt_state_e *state)
{
int i = 0;
int rv = 0;
struct _profile_list_s bluetooth_profiles = {0, 0, NULL};
- rv = net_get_profile_list(NET_DEVICE_BLUETOOTH, &bluetooth_profiles.profiles, &bluetooth_profiles.count);
+ rv = net_get_profile_list(conn_handle->network_info_handle,
+ NET_DEVICE_BLUETOOTH, &bluetooth_profiles.profiles,
+ &bluetooth_profiles.count);
if (rv == NET_ERR_ACCESS_DENIED) {
CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
return CONNECTION_ERROR_NONE;
}
-int _connection_libnet_get_profile_iterator(connection_iterator_type_e type, connection_profile_iterator_h* profile_iter_h)
+int _connection_libnet_get_profile_iterator(connection_handle_s *conn_handle,
+ connection_iterator_type_e type, connection_profile_iterator_h* profile_iter_h)
{
int count = 0;
int rv1, rv2, rv3, rv4, rv5;
__libnet_clear_profile_list(&profile_iterator);
- rv1 = net_get_profile_list(NET_DEVICE_WIFI, &wifi_profiles.profiles, &wifi_profiles.count);
+ rv1 = net_get_profile_list(conn_handle->network_info_handle,
+ NET_DEVICE_WIFI, &wifi_profiles.profiles, &wifi_profiles.count);
if (rv1 == NET_ERR_ACCESS_DENIED) {
CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
CONNECTION_LOG(CONNECTION_INFO, "Wi-Fi profile count: %d", wifi_profiles.count);
- rv2 = net_get_profile_list(NET_DEVICE_CELLULAR, &cellular_profiles.profiles, &cellular_profiles.count);
+ rv2 = net_get_profile_list(conn_handle->network_info_handle,
+ NET_DEVICE_CELLULAR, &cellular_profiles.profiles, &cellular_profiles.count);
if (rv2 == NET_ERR_ACCESS_DENIED) {
CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
__libnet_clear_profile_list(&wifi_profiles);
}
CONNECTION_LOG(CONNECTION_INFO, "Cellular profile count: %d", cellular_profiles.count);
- rv3 = net_get_profile_list(NET_DEVICE_ETHERNET, ðernet_profiles.profiles, ðernet_profiles.count);
+ rv3 = net_get_profile_list(conn_handle->network_info_handle,
+ NET_DEVICE_ETHERNET, ðernet_profiles.profiles, ðernet_profiles.count);
if (rv3 == NET_ERR_ACCESS_DENIED) {
CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
__libnet_clear_profile_list(&wifi_profiles);
}
CONNECTION_LOG(CONNECTION_INFO, "Ethernet profile count : %d", ethernet_profiles.count);
- rv4 = net_get_profile_list(NET_DEVICE_BLUETOOTH, &bluetooth_profiles.profiles, &bluetooth_profiles.count);
+ rv4 = net_get_profile_list(conn_handle->network_info_handle,
+ NET_DEVICE_BLUETOOTH, &bluetooth_profiles.profiles, &bluetooth_profiles.count);
if (rv4 == NET_ERR_ACCESS_DENIED) {
CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
__libnet_clear_profile_list(&wifi_profiles);
}
CONNECTION_LOG(CONNECTION_INFO, "Bluetooth profile count : %d", bluetooth_profiles.count);
- rv5 = net_get_profile_list(NET_DEVICE_MESH, &mesh_profiles.profiles, &mesh_profiles.count);
+ rv5 = net_get_profile_list(conn_handle->network_info_handle,
+ NET_DEVICE_MESH, &mesh_profiles.profiles, &mesh_profiles.count);
if (rv5 == NET_ERR_ACCESS_DENIED) {
CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
__libnet_clear_profile_list(&wifi_profiles);
return CONNECTION_ERROR_NONE;
}
-int _connection_libnet_get_current_profile(connection_profile_h *profile)
+int _connection_libnet_get_current_profile(connection_handle_s *conn_handle,
+ connection_profile_h *profile)
{
net_profile_info_t active_profile;
int rv;
- rv = net_get_active_net_info(&active_profile);
+ rv = net_get_active_net_info(conn_handle->network_info_handle, &active_profile);
if (rv == NET_ERR_NO_SERVICE)
return CONNECTION_ERROR_NO_CONNECTION; //LCOV_EXCL_LINE
else if (rv == NET_ERR_ACCESS_DENIED) {
return CONNECTION_ERROR_NONE;
}
-int _connection_libnet_reset_profile(connection_reset_option_e type,
- connection_cellular_subscriber_id_e id, connection_reset_cb callback, void *user_data)
+int _connection_libnet_reset_profile(connection_handle_s *conn_handle,
+ connection_reset_option_e type, connection_cellular_subscriber_id_e id)
{
int rv;
- rv = net_reset_profile(type, id);
- if (rv == NET_ERR_ACCESS_DENIED) {
- CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
+ rv = net_reset_profile(conn_handle->network_info_handle, type, id);
+ if (rv == NET_ERR_ACCESS_DENIED)
return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
- } else if (rv != NET_ERR_NONE) {
- CONNECTION_LOG(CONNECTION_ERROR, "Failed to add profile[%d]", rv); //LCOV_EXCL_LINE
+ else if (rv != NET_ERR_NONE)
return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
- }
-
- __libnet_set_reset_profile_cb(callback, user_data);
return CONNECTION_ERROR_NONE;
}
-int _connection_libnet_open_profile(connection_profile_h profile,
- connection_opened_cb callback, void* user_data)
+int _connection_libnet_open_profile(connection_handle_s *conn_handle,
+ connection_profile_h profile)
{
int rv;
net_profile_info_t *profile_info = profile;
if (profile_info->profile_type == NET_DEVICE_MESH)
- rv = net_open_mesh_connection_with_profile(profile_info->ProfileName);
+ rv = net_open_mesh_connection_with_profile(conn_handle->network_info_handle,
+ profile_info->ProfileName);
else
- rv = net_open_connection_with_profile(profile_info->ProfileName);
+ rv = net_open_connection_with_profile(conn_handle->network_info_handle,
+ profile_info->ProfileName);
- if (rv == NET_ERR_ACCESS_DENIED) {
- CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
+ if (rv == NET_ERR_ACCESS_DENIED)
return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
- } else if (rv != NET_ERR_NONE)
+ else if (rv != NET_ERR_NONE)
return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
- __libnet_set_opened_cb(callback, user_data);
-
return CONNECTION_ERROR_NONE;
}
-int _connection_libnet_get_cellular_service_profile(
+int _connection_libnet_get_cellular_service_profile(connection_handle_s *conn_handle,
connection_cellular_service_type_e type, connection_profile_h *profile)
{
int i = 0, j = 0;
struct _profile_list_s cellular_profiles = { 0, 0, NULL };
net_service_type_t service_type = _connection_profile_convert_to_libnet_cellular_service_type(type);
- rv = net_get_profile_list(NET_DEVICE_CELLULAR, &cellular_profiles.profiles, &cellular_profiles.count);
+ rv = net_get_profile_list(conn_handle->network_info_handle,
+ NET_DEVICE_CELLULAR, &cellular_profiles.profiles,
+ &cellular_profiles.count);
if (rv == NET_ERR_ACCESS_DENIED) {
CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
return CONNECTION_ERROR_NONE;
}
-int _connection_libnet_set_cellular_service_profile_sync(connection_cellular_service_type_e type, connection_profile_h profile)
+int _connection_libnet_set_cellular_service_profile_sync(connection_handle_s *conn_handle,
+ connection_cellular_service_type_e type, connection_profile_h profile)
{
int rv;
if (service_type != type)
return CONNECTION_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
- rv = net_set_default_cellular_service_profile(profile_info->ProfileName);
+ rv = net_set_default_cellular_service_profile(conn_handle->network_info_handle,
+ profile_info->ProfileName);
if (rv == NET_ERR_ACCESS_DENIED) {
CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
return CONNECTION_ERROR_NONE;
}
-int _connection_libnet_set_cellular_service_profile_async(connection_cellular_service_type_e type,
- connection_profile_h profile, connection_set_default_cb callback, void* user_data)
+int _connection_libnet_set_cellular_service_profile_async(connection_handle_s *conn_handle,
+ connection_cellular_service_type_e type, connection_profile_h profile)
{
int rv;
if (service_type != type)
return CONNECTION_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
- rv = net_set_default_cellular_service_profile_async(profile_info->ProfileName);
+ rv = net_set_default_cellular_service_profile_async(conn_handle->network_info_handle,
+ profile_info->ProfileName);
if (rv == NET_ERR_ACCESS_DENIED) {
- CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
} else if (rv != NET_ERR_NONE)
return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
- __libnet_set_default_cb(callback, user_data);
-
return CONNECTION_ERROR_NONE;
}
-int _connection_libnet_close_profile(connection_profile_h profile, connection_closed_cb callback, void *user_data)
+int _connection_libnet_close_profile(connection_handle_s *conn_handle, connection_profile_h profile)
{
int rv;
net_profile_info_t *profile_info = profile;
if (profile_info->profile_type == NET_DEVICE_MESH)
- rv = net_close_mesh_connection(profile_info->ProfileName);
+ rv = net_close_mesh_connection(conn_handle->network_info_handle, profile_info->ProfileName);
else
- rv = net_close_connection(profile_info->ProfileName);
+ rv = net_close_connection(conn_handle->network_info_handle, profile_info->ProfileName);
- if (rv == NET_ERR_ACCESS_DENIED) {
- CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
+ if (rv == NET_ERR_ACCESS_DENIED)
return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
- } else if (rv != NET_ERR_NONE)
+ else if (rv != NET_ERR_NONE)
return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
- __libnet_set_closed_cb(callback, user_data);
-
return CONNECTION_ERROR_NONE;
}
-int _connection_libnet_add_route(const char *interface_name, const char *host_address)
+int _connection_libnet_add_route(connection_handle_s *conn_handle,
+ const char *interface_name, const char *host_address)
{
int rv;
char *endstr = NULL;
return CONNECTION_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
}
- rv = net_add_route(host_address, interface_name, address_family);
+ rv = net_add_route(conn_handle->network_info_handle,
+ host_address, interface_name, address_family);
if (rv == NET_ERR_ACCESS_DENIED) {
CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
return CONNECTION_ERROR_NONE;
}
-int _connection_libnet_remove_route(const char *interface_name, const char *host_address)
+int _connection_libnet_remove_route(connection_handle_s *conn_handle,
+ const char *interface_name, const char *host_address)
{
int rv;
char *endstr = strrchr(host_address, '.');
return CONNECTION_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
}
- rv = net_remove_route(host_address, interface_name, address_family);
+ rv = net_remove_route(conn_handle->network_info_handle,
+ host_address, interface_name, address_family);
if (rv == NET_ERR_ACCESS_DENIED) {
CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
return CONNECTION_ERROR_NONE;
}
-int _connection_libnet_add_route_ipv6(const char *interface_name, const char *host_address, const char *gateway)
+int _connection_libnet_add_route_ipv6(connection_handle_s *conn_handle,
+ const char *interface_name, const char *host_address, const char *gateway)
{
int rv;
int address_family = 0;
return CONNECTION_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
}
- rv = net_add_route_ipv6(host_address, interface_name, address_family, gateway);
+ rv = net_add_route_ipv6(conn_handle->network_info_handle,
+ host_address, interface_name, address_family, gateway);
if (rv == NET_ERR_ACCESS_DENIED) {
CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
return CONNECTION_ERROR_NONE;
}
-int _connection_libnet_remove_route_ipv6(const char *interface_name, const char *host_address, const char *gateway)
+int _connection_libnet_remove_route_ipv6(connection_handle_s *conn_handle,
+ const char *interface_name, const char *host_address, const char *gateway)
{
int rv;
int address_family = 0;
return CONNECTION_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
}
- rv = net_remove_route_ipv6(host_address, interface_name, address_family, gateway);
+ rv = net_remove_route_ipv6(conn_handle->network_info_handle,
+ host_address, interface_name, address_family, gateway);
if (rv == NET_ERR_ACCESS_DENIED) {
CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
return CONNECTION_ERROR_NONE;
}
-int _connection_libnet_add_route_entry(connection_address_family_e address_family,
- const char *interface_name, const char *host_address, const char *gateway)
+int _connection_libnet_add_route_entry(connection_handle_s *conn_handle,
+ connection_address_family_e address_family, const char *interface_name,
+ const char *host_address, const char *gateway)
{
int rv;
char *endstr = NULL;
return CONNECTION_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
}
- rv = net_add_route_entry(host_address, interface_name, address_family_type, gateway);
+ rv = net_add_route_entry(conn_handle->network_info_handle,
+ host_address, interface_name, address_family_type, gateway);
if (rv == NET_ERR_ACCESS_DENIED) {
CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
return CONNECTION_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
}
- rv = net_add_route_ipv6(host_address, interface_name, address_family_type, gateway);
+ rv = net_add_route_ipv6(conn_handle->network_info_handle,
+ host_address, interface_name, address_family_type, gateway);
if (rv == NET_ERR_ACCESS_DENIED) {
CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
return CONNECTION_ERROR_NONE;
}
-int _connection_libnet_remove_route_entry(connection_address_family_e address_family,
- const char *interface_name, const char *host_address, const char *gateway)
+int _connection_libnet_remove_route_entry(connection_handle_s *conn_handle,
+ connection_address_family_e address_family, const char *interface_name,
+ const char *host_address, const char *gateway)
{
int rv;
char *endstr = strrchr(host_address, '.');
return CONNECTION_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
}
- rv = net_remove_route_entry(host_address, interface_name, address_family_type, gateway);
+ rv = net_remove_route_entry(conn_handle->network_info_handle, host_address,
+ interface_name, address_family_type, gateway);
if (rv == NET_ERR_ACCESS_DENIED) {
CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
return CONNECTION_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
}
- rv = net_remove_route_ipv6(host_address, interface_name, address_family_type, gateway);
+ rv = net_remove_route_ipv6(conn_handle->network_info_handle, host_address,
+ interface_name, address_family_type, gateway);
if (rv == NET_ERR_ACCESS_DENIED) {
CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
return false; //LCOV_EXCL_LINE
}
-int _connection_libnet_set_statistics(net_device_t device_type, net_statistics_type_e statistics_type)
+int _connection_libnet_set_statistics(connection_handle_s *conn_handle,
+ net_device_t device_type, net_statistics_type_e statistics_type)
{
int rv;
- rv = net_set_statistics(device_type, statistics_type);
+ rv = net_set_statistics(conn_handle->network_info_handle,
+ device_type, statistics_type);
if (rv == NET_ERR_ACCESS_DENIED) {
CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
return CONNECTION_ERROR_NONE;
}
-int _connection_libnet_get_statistics(net_statistics_type_e statistics_type, unsigned long long *size)
+int _connection_libnet_get_statistics(connection_handle_s *conn_handle,
+ net_statistics_type_e statistics_type, unsigned long long *size)
{
int rv;
- rv = net_get_statistics(NET_DEVICE_WIFI, statistics_type, size);
+ rv = net_get_statistics(conn_handle->network_info_handle,
+ NET_DEVICE_WIFI, statistics_type, size);
if (rv == NET_ERR_ACCESS_DENIED) {
CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
return CONNECTION_ERROR_NONE;
}
-static void __connection_idle_destroy_cb(gpointer data)
-{
- if (!data)
- return;
-
- managed_idler_list = g_slist_remove(managed_idler_list, data);
- g_free(data);
-}
-
-static gboolean __connection_idle_cb(gpointer user_data)
-{
- struct managed_idle_data *data = (struct managed_idle_data *)user_data;
-
- if (!data)
- return FALSE;
-
- return data->func(data->user_data);
-}
-
-guint _connection_callback_add(GSourceFunc func, gpointer user_data)
-{
- guint id;
- struct managed_idle_data *data;
- GMainContext *context;
- GSource *src;
-
- if (!func)
- return 0;
-
- data = g_try_new0(struct managed_idle_data, 1);
- if (!data)
- return 0;
-
- data->func = func;
- data->user_data = user_data;
-
- 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;
- }
-
- data->id = id;
-
- managed_idler_list = g_slist_append(managed_idler_list, data);
-
- return id;
-}
-
-void _connection_callback_cleanup(void)
-{
- GSList *cur = managed_idler_list;
- GSource *src;
- struct managed_idle_data *data;
-
- while (cur) {
- //LCOV_EXCL_START
- GSList *next = cur->next;
- data = (struct managed_idle_data *)cur->data;
-
- src = g_main_context_find_source_by_id(g_main_context_default(), data->id);
- if (src) {
- g_source_destroy(src);
- cur = managed_idler_list;
- } else
- cur = next;
- //LCOV_EXCL_STOP
- }
-
- g_slist_free(managed_idler_list);
- managed_idler_list = NULL;
-}
-
-int _connection_libnet_check_get_privilege()
+int _connection_libnet_check_get_privilege(void)
{
int rv;
return CONNECTION_ERROR_NONE;
}
-int _connection_libnet_check_profile_privilege()
+int _connection_libnet_check_profile_privilege(void)
{
int rv;
return CONNECTION_ERROR_NONE;
}
-int _connection_libnet_start_tcpdump(void)
+int _connection_libnet_start_tcpdump(connection_handle_s *conn_handle)
{
connection_error_e result = CONNECTION_ERROR_NONE;
net_err_t ret = NET_ERR_NONE;
- ret = net_start_tcpdump();
+ ret = net_start_tcpdump(conn_handle->network_info_handle);
result = __libnet_convert_to_cp_error_type(ret);
return result;
}
-int _connection_libnet_stop_tcpdump(void)
+int _connection_libnet_stop_tcpdump(connection_handle_s *conn_handle)
{
connection_error_e result = CONNECTION_ERROR_NONE;
net_err_t ret = NET_ERR_NONE;
- ret = net_stop_tcpdump();
+ ret = net_stop_tcpdump(conn_handle->network_info_handle);
result = __libnet_convert_to_cp_error_type(ret);
return result;
}
-int _connection_libnet_get_tcpdump_state(gboolean *tcpdump_state)
+int _connection_libnet_get_tcpdump_state(connection_handle_s *conn_handle,
+ gboolean *tcpdump_state)
{
connection_error_e result = CONNECTION_ERROR_NONE;
net_err_t ret = NET_ERR_NONE;
- ret = net_get_tcpdump_state(tcpdump_state);
+ ret = net_get_tcpdump_state(conn_handle->network_info_handle, tcpdump_state);
result = __libnet_convert_to_cp_error_type(ret);
return result;
return CONNECTION_MPTCP_SCHEDULER_UNKNOWN; //LCOV_EXCL_LINE
}
-gboolean _connection_libnet_mptcp_supported()
+gboolean _connection_libnet_mptcp_supported(connection_handle_s *conn_handle)
{
int rv = 0;
gboolean support = false;
- rv = net_mptcp_supported(&support);
+ rv = net_mptcp_supported(conn_handle->network_info_handle, &support);
if (rv == NET_ERR_ACCESS_DENIED) {
CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
return false;
return support;
}
-int _connection_libnet_mptcp_enable(connection_mptcp_enable_e enable)
+int _connection_libnet_mptcp_enable(connection_handle_s *conn_handle, connection_mptcp_enable_e enable)
{
int rv = 0;
- rv = net_mptcp_set_enabled((int)enable);
+ rv = net_mptcp_set_enabled(conn_handle->network_info_handle, (int)enable);
if (rv == NET_ERR_ACCESS_DENIED) {
CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
return CONNECTION_ERROR_NONE;
}
-int _connection_libnet_mptcp_get_enabled(connection_mptcp_enable_e* enable)
+int _connection_libnet_mptcp_get_enabled(connection_handle_s *conn_handle, connection_mptcp_enable_e* enable)
{
int rv = 0;
int result = 0;
- rv = net_mptcp_get_enabled(&result);
+ rv = net_mptcp_get_enabled(conn_handle->network_info_handle, &result);
if (rv == NET_ERR_ACCESS_DENIED) {
CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
}
-int _connection_libnet_mptcp_set_path_manager(connection_mptcp_path_manager_e pm)
+int _connection_libnet_mptcp_set_path_manager(connection_handle_s *conn_handle, connection_mptcp_path_manager_e pm)
{
int rv = 0;
const char* str = __convert_mptcp_path_manager_enum_to_str(pm);
return CONNECTION_ERROR_INVALID_PARAMETER;
}
- rv = net_mptcp_set_path_manager(str);
+ rv = net_mptcp_set_path_manager(conn_handle->network_info_handle, str);
if (rv == NET_ERR_ACCESS_DENIED) {
CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
return CONNECTION_ERROR_NONE;
}
-int _connection_libnet_mptcp_get_path_manager(connection_mptcp_path_manager_e* pm)
+int _connection_libnet_mptcp_get_path_manager(connection_handle_s *conn_handle, connection_mptcp_path_manager_e* pm)
{
int rv = 0;
char* result = NULL;
- rv = net_mptcp_get_path_manager(&result);
+ rv = net_mptcp_get_path_manager(conn_handle->network_info_handle, &result);
if (rv == NET_ERR_ACCESS_DENIED) {
CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
}
-int _connection_libnet_mptcp_set_scheduler(connection_mptcp_scheduler_e scheduler)
+int _connection_libnet_mptcp_set_scheduler(connection_handle_s *conn_handle, connection_mptcp_scheduler_e scheduler)
{
int rv = 0;
const char *str = __convert_mptcp_scheduler_enum_to_str(scheduler);
return CONNECTION_ERROR_INVALID_PARAMETER;
}
- rv = net_mptcp_set_scheduler(str);
+ rv = net_mptcp_set_scheduler(conn_handle->network_info_handle, str);
if (rv == NET_ERR_ACCESS_DENIED) {
CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
return CONNECTION_ERROR_NONE;
}
-int _connection_libnet_mptcp_get_scheduler(connection_mptcp_scheduler_e* scheduler)
+int _connection_libnet_mptcp_get_scheduler(connection_handle_s *conn_handle, connection_mptcp_scheduler_e* scheduler)
{
int rv = 0;
char* result = NULL;
- rv = net_mptcp_get_scheduler(&result);
+ rv = net_mptcp_get_scheduler(conn_handle->network_info_handle, &result);
if (rv == NET_ERR_ACCESS_DENIED) {
CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE