X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=include%2Fnet_connection_private.h;h=d05f0ad4748c8e4cb8a468d8182c59dd7c6e8643;hb=4d297013fd680009f28806557b8ae16aa5eae205;hp=7fd31340d675aa6e9760a6923fbb120801f6d198;hpb=d4cfefb9aff8235a0c2e8bfc094c74be33fb3201;p=platform%2Fcore%2Fapi%2Fconnection.git diff --git a/include/net_connection_private.h b/include/net_connection_private.h old mode 100644 new mode 100755 index 7fd3134..d05f0ad --- a/include/net_connection_private.h +++ b/include/net_connection_private.h @@ -38,19 +38,44 @@ extern "C" { #define ETHERNET_MAC_INFO_FILE "/sys/class/net/eth0/address" #define WIFI_MAC_INFO_FILE "/sys/class/net/wlan0/address" -typedef enum -{ - FEATURE_TYPE_TELEPHONY = 0, - FEATURE_TYPE_WIFI = 1, - FEATURE_TYPE_TETHERING_BLUETOOTH = 2 -} enable_feature_type_e; - -typedef enum -{ +#define TELEPHONY_FEATURE "http://tizen.org/feature/network.telephony" +#define WIFI_FEATURE "http://tizen.org/feature/network.wifi" +#define TETHERING_BLUETOOTH_FEATURE "http://tizen.org/feature/network.tethering.bluetooth" +#define ETHERNET_FEATURE "http://tizen.org/feature/network.ethernet" + +#ifdef ADDRESS_SANITIZER +#define NO_SANITIZE \ + __attribute__((optimize(2))) __attribute__((no_sanitize_address)) +#else +#define NO_SANITIZE +#endif + +typedef enum { CONNECTION_CELLULAR_SUBSCRIBER_1 = 0x00, CONNECTION_CELLULAR_SUBSCRIBER_2 = 0x01, } connection_cellular_subscriber_id_e; +typedef enum { + CONNECTION_SUPPORTED_FEATURE_TELEPHONY, + CONNECTION_SUPPORTED_FEATURE_WIFI, + CONNECTION_SUPPORTED_FEATURE_TETHERING_BLUETOOTH, + CONNECTION_SUPPORTED_FEATURE_ETHERNET, + CONNECTION_SUPPORTED_FEATURE_MAX, +} connection_supported_feature_e; + +#define CHECK_FEATURE_SUPPORTED(...) \ + do { \ + int rv = _connection_check_feature_supported(__VA_ARGS__, NULL); \ + if (rv != CONNECTION_ERROR_NONE) \ + return rv; \ + } while (0) + +#define DEPRECATED_LOG(origin, substitution) \ + do { \ + LOGW("DEPRECATION WARNING: %s() is deprecated and will be removed " \ + "from next release. Use %s() instead", origin, substitution); \ + } while (0) + #define CONNECTION_LOG(log_level, format, args...) \ do { \ switch (log_level) { \ @@ -63,10 +88,7 @@ typedef enum default: \ LOGI(format, ## args); \ } \ - } while(0) - -#define CONNECTION_MUTEX_LOCK _connection_inter_mutex_lock() -#define CONNECTION_MUTEX_UNLOCK _connection_inter_mutex_unlock() + } while (0) #define SECURE_CONNECTION_LOG(log_level, format, args...) \ do { \ @@ -80,7 +102,7 @@ typedef enum default: \ SECURE_LOGI(format, ## args); \ } \ - } while(0) + } while (0) #define VCONF_TELEPHONY_DEFAULT_DATA_SERVICE \ "db/telephony/dualsim/default_data_service" @@ -89,7 +111,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_ethernet_cable_state_chaged_cb ethernet_cable_state_changed_callback; + connection_ethernet_cable_state_changed_cb ethernet_cable_state_changed_callback; void *type_changed_user_data; void *ip_changed_user_data; void *proxy_changed_user_data; @@ -99,10 +121,20 @@ typedef struct _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); + +typedef void(*libnet_proxy_changed_cb) (char *proxy_addr); + bool _connection_is_created(void); 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); @@ -128,6 +160,8 @@ int _connection_libnet_add_route(const char *interface_name, const char *host_ad 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); 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, @@ -138,9 +172,7 @@ int _connection_libnet_get_statistics(net_statistics_type_e statistics_type, uns int _connection_libnet_check_get_privilege(); int _connection_libnet_check_profile_privilege(); -bool _connection_libnet_get_is_check_enable_feature(); -bool _connection_libnet_get_enable_feature_state(enable_feature_type_e feature_type); -int _connection_libnet_check_enable_feature(); +int _connection_check_feature_supported(const char *feature_name, ...); guint _connection_callback_add(GSourceFunc func, gpointer user_data); void _connection_callback_cleanup(void); @@ -151,8 +183,14 @@ net_service_type_t _connection_profile_convert_to_libnet_cellular_service_type(c 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); -void _connection_inter_mutex_lock(void); -void _connection_inter_mutex_unlock(void); + +int _connection_libnet_start_tcpdump(void); +int _connection_libnet_stop_tcpdump(void); +int _connection_libnet_get_tcpdump_state(gboolean *tcpdump_state); + +void _connection_libnet_set_type_changed_cb(libnet_type_changed_cb callback) NO_SANITIZE; +void _connection_libnet_set_ip_changed_cb(libnet_ip_changed_cb callback); +void _connection_libnet_set_proxy_changed_cb(libnet_proxy_changed_cb callback); #ifdef __cplusplus }