- 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;