Destroy profile handle when all connection handle is deinitialized
[platform/core/api/connection.git] / include / net_connection_private.h
index a5b59be..0550e32 100755 (executable)
@@ -56,11 +56,23 @@ typedef enum {
        CONNECTION_SUPPORTED_FEATURE_MAX,
 } connection_supported_feature_e;
 
+#define CONN_LOCK \
+       do { \
+               _connection_lock(); \
+       } while(0)
+
+#define CONN_UNLOCK \
+       do { \
+               _connection_unlock(); \
+       } while(0)
+
 #define CHECK_FEATURE_SUPPORTED(...) \
        do { \
                int rv = _connection_check_feature_supported(__VA_ARGS__, NULL); \
-               if (rv != CONNECTION_ERROR_NONE) \
+               if (rv != CONNECTION_ERROR_NONE) { \
+                       CONN_UNLOCK; \
                        return rv; \
+               } \
        } while (0)
 
 #define DEPRECATED_LOG(origin, substitution) \
@@ -104,6 +116,7 @@ typedef struct _connection_handle_s {
        connection_type_changed_cb type_changed_callback;
        connection_address_changed_cb ip_changed_callback;
        connection_address_changed_cb proxy_changed_callback;
+       connection_internet_state_changed_cb internet_state_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;
@@ -112,6 +125,7 @@ typedef struct _connection_handle_s {
        void *type_changed_user_data;
        void *ip_changed_user_data;
        void *proxy_changed_user_data;
+       void *internet_state_changed_user_data;
        void *ethernet_cable_state_changed_user_data;
        void *set_default_user_data;
        void *opened_user_data;
@@ -122,7 +136,7 @@ typedef struct _connection_handle_s {
 } connection_handle_s;
 
 int _connection_libnet_init(connection_handle_s *conn_handle);
-bool _connection_libnet_deinit(connection_handle_s *conn_handle);
+bool _connection_libnet_deinit(connection_handle_s *conn_handle, bool is_empty);
 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);
@@ -193,6 +207,9 @@ int _connection_libnet_stop_tcpdump(connection_handle_s *conn_handle);
 int _connection_libnet_get_tcpdump_state(connection_handle_s *conn_handle,
                        gboolean *tcpdump_state);
 
+void _connection_lock(void);
+void _connection_unlock(void);
+
 bool _connection_check_handle_validity(connection_h connection);
 #ifdef __cplusplus
 }