Make local handle for event loop
[platform/core/api/connection.git] / include / net_connection_private.h
index 8582d4c..a5b59be 100755 (executable)
@@ -105,85 +105,93 @@ typedef struct _connection_handle_s {
        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