SET(INC_DIR include)
INCLUDE_DIRECTORIES(${INC_DIR})
-SET(dependents "dlog vconf capi-base-common glib-2.0 network")
+SET(dependents "dlog vconf capi-base-common glib-2.0 network capi-system-info")
SET(pc_dependents "capi-base-common")
INCLUDE(FindPkgConfig)
*/
int connection_add_route_ipv6(connection_h connection, const char *interface_name, const char *host_address, const char * gateway);
-
+
/**
* @brief Removes a IPV6 route from the routing table.
* @details You can get the @a interface_name from connection_profile_get_network_interface_name() of opened profile.
#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;
+#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"
typedef enum
{
CONNECTION_CELLULAR_SUBSCRIBER_2 = 0x01,
} connection_cellular_subscriber_id_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 CONNECTION_LOG(log_level, format, args...) \
do { \
switch (log_level) { \
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);
Name: capi-network-connection
Summary: Network Connection library in TIZEN C API
-Version: 0.1.3_26
+Version: 0.1.3_27
Release: 1
Group: System/Network
License: Apache-2.0
BuildRequires: pkgconfig(glib-2.0)
BuildRequires: pkgconfig(vconf)
BuildRequires: pkgconfig(capi-base-common)
+BuildRequires: pkgconfig(capi-system-info)
BuildRequires: pkgconfig(network)
%description
/* Connection Manager ********************************************************/
EXPORT_API int connection_create(connection_h* connection)
{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
CONNECTION_MUTEX_LOCK;
int rv;
if (connection == NULL || __connection_check_handle_validity(*connection)) {
EXPORT_API int connection_destroy(connection_h connection)
{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
CONNECTION_MUTEX_LOCK;
if (connection == NULL || !(__connection_check_handle_validity(connection))) {
{
int status = 0;
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
if (type == NULL || !(__connection_check_handle_validity(connection))) {
CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
return CONNECTION_ERROR_INVALID_PARAMETER;
EXPORT_API int connection_get_ip_address(connection_h connection,
connection_address_family_e address_family, char **ip_address)
{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
if (ip_address == NULL || !(__connection_check_handle_validity(connection))) {
CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
EXPORT_API int connection_get_proxy(connection_h connection,
connection_address_family_e address_family, char **proxy)
{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
if (proxy == NULL || !(__connection_check_handle_validity(connection))) {
CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
FILE *fp;
char buf[CONNECTION_MAC_INFO_LENGTH + 1];
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE, ETHERNET_FEATURE);
+
+ if(type == CONNECTION_TYPE_WIFI)
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+ else if(type == CONNECTION_TYPE_ETHERNET)
+ CHECK_FEATURE_SUPPORTED(ETHERNET_FEATURE);
+
if (mac_addr == NULL || !(__connection_check_handle_validity(connection))) {
CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
int status = 0;
int cellular_state = 0;
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE);
+
if (state == NULL || !(__connection_check_handle_validity(connection))) {
CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
return CONNECTION_ERROR_INVALID_PARAMETER;
EXPORT_API int connection_get_wifi_state(connection_h connection, connection_wifi_state_e* state)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
int rv;
if (state == NULL || !(__connection_check_handle_validity(connection))) {
EXPORT_API int connection_get_ethernet_state(connection_h connection, connection_ethernet_state_e* state)
{
+ CHECK_FEATURE_SUPPORTED(ETHERNET_FEATURE);
+
if (state == NULL || !(__connection_check_handle_validity(connection))) {
CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
return CONNECTION_ERROR_INVALID_PARAMETER;
EXPORT_API int connection_get_ethernet_cable_state(connection_h connection, connection_ethernet_cable_state_e *state)
{
+ CHECK_FEATURE_SUPPORTED(ETHERNET_FEATURE);
+
if (state == NULL || !(__connection_check_handle_validity(connection))) {
CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
EXPORT_API int connection_set_ethernet_cable_state_chaged_cb(connection_h connection,
connection_ethernet_cable_state_chaged_cb callback, void *user_data)
{
+ CHECK_FEATURE_SUPPORTED(ETHERNET_FEATURE);
+
if (callback == NULL || !(__connection_check_handle_validity(connection))) {
CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
EXPORT_API int connection_unset_ethernet_cable_state_chaged_cb(connection_h connection)
{
+ CHECK_FEATURE_SUPPORTED(ETHERNET_FEATURE);
+
if ( !(__connection_check_handle_validity(connection)) ) {
CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
EXPORT_API int connection_get_bt_state(connection_h connection, connection_bt_state_e* state)
{
+ CHECK_FEATURE_SUPPORTED(TETHERING_BLUETOOTH_FEATURE);
+
if (state == NULL || !(__connection_check_handle_validity(connection))) {
CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
return CONNECTION_ERROR_INVALID_PARAMETER;
EXPORT_API int connection_set_type_changed_cb(connection_h connection,
connection_type_changed_cb callback, void* user_data)
{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
if (callback == NULL || !(__connection_check_handle_validity(connection))) {
CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
return CONNECTION_ERROR_INVALID_PARAMETER;
EXPORT_API int connection_unset_type_changed_cb(connection_h connection)
{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
if (!(__connection_check_handle_validity(connection))) {
CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
return CONNECTION_ERROR_INVALID_PARAMETER;
EXPORT_API int connection_set_ip_address_changed_cb(connection_h connection,
connection_address_changed_cb callback, void* user_data)
{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
if (callback == NULL || !(__connection_check_handle_validity(connection))) {
CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
return CONNECTION_ERROR_INVALID_PARAMETER;
EXPORT_API int connection_unset_ip_address_changed_cb(connection_h connection)
{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
if (!(__connection_check_handle_validity(connection))) {
CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
return CONNECTION_ERROR_INVALID_PARAMETER;
EXPORT_API int connection_set_proxy_address_changed_cb(connection_h connection,
connection_address_changed_cb callback, void* user_data)
{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
if (callback == NULL || !(__connection_check_handle_validity(connection))) {
CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
return CONNECTION_ERROR_INVALID_PARAMETER;
EXPORT_API int connection_unset_proxy_address_changed_cb(connection_h connection)
{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
if (!(__connection_check_handle_validity(connection))) {
CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
return CONNECTION_ERROR_INVALID_PARAMETER;
EXPORT_API int connection_add_profile(connection_h connection, connection_profile_h profile)
{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE);
+
if (!(__connection_check_handle_validity(connection)) ||
!(_connection_libnet_check_profile_validity(profile))) {
CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
EXPORT_API int connection_remove_profile(connection_h connection, connection_profile_h profile)
{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE);
+
if (!(__connection_check_handle_validity(connection)) ||
!(_connection_libnet_check_profile_validity(profile))) {
CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
EXPORT_API int connection_update_profile(connection_h connection, connection_profile_h profile)
{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, ETHERNET_FEATURE);
+
if (!(__connection_check_handle_validity(connection)) ||
!(_connection_libnet_check_profile_validity(profile))) {
CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
EXPORT_API int connection_get_profile_iterator(connection_h connection,
connection_iterator_type_e type, connection_profile_iterator_h* profile_iterator)
{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
if (!(__connection_check_handle_validity(connection)) ||
(type != CONNECTION_ITERATOR_TYPE_REGISTERED &&
type != CONNECTION_ITERATOR_TYPE_CONNECTED &&
EXPORT_API int connection_profile_iterator_next(connection_profile_iterator_h profile_iterator,
connection_profile_h* profile)
{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
return _connection_libnet_get_iterator_next(profile_iterator, profile);
}
EXPORT_API bool connection_profile_iterator_has_next(connection_profile_iterator_h profile_iterator)
{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
return _connection_libnet_iterator_has_next(profile_iterator);
}
EXPORT_API int connection_destroy_profile_iterator(connection_profile_iterator_h profile_iterator)
{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
return _connection_libnet_destroy_iterator(profile_iterator);
}
EXPORT_API int connection_get_current_profile(connection_h connection, connection_profile_h* profile)
{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
if (!(__connection_check_handle_validity(connection)) || profile == NULL) {
CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
return CONNECTION_ERROR_INVALID_PARAMETER;
EXPORT_API int connection_get_default_cellular_service_profile(connection_h connection,
connection_cellular_service_type_e type, connection_profile_h* profile)
{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE);
+
if (!(__connection_check_handle_validity(connection)) || profile == NULL) {
CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
return CONNECTION_ERROR_INVALID_PARAMETER;
EXPORT_API int connection_set_default_cellular_service_profile(connection_h connection,
connection_cellular_service_type_e type, connection_profile_h profile)
{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE);
+
if (!(__connection_check_handle_validity(connection)) || profile == NULL) {
CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
return CONNECTION_ERROR_INVALID_PARAMETER;
connection_cellular_service_type_e type, connection_profile_h profile,
connection_set_default_cb callback, void* user_data)
{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE);
+
if (!(__connection_check_handle_validity(connection)) ||
profile == NULL || callback == NULL) {
CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
EXPORT_API int connection_open_profile(connection_h connection, connection_profile_h profile,
connection_opened_cb callback, void* user_data)
{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE);
+
if (!(__connection_check_handle_validity(connection)) ||
profile == NULL || callback == NULL) {
CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
EXPORT_API int connection_close_profile(connection_h connection, connection_profile_h profile,
connection_closed_cb callback, void* user_data)
{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE);
+
if (!(__connection_check_handle_validity(connection)) ||
profile == NULL || callback == NULL) {
CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
EXPORT_API int connection_reset_profile(connection_h connection,
connection_reset_option_e type, int id, connection_reset_cb callback, void *user_data)
{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE);
+
if (!(__connection_check_handle_validity(connection))) {
CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed");
return CONNECTION_ERROR_INVALID_PARAMETER;
EXPORT_API int connection_add_route(connection_h connection, const char* interface_name, const char* host_address)
{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
if (!(__connection_check_handle_validity(connection)) ||
interface_name == NULL || host_address == NULL) {
CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
EXPORT_API int connection_remove_route(connection_h connection, const char* interface_name, const char* host_address)
{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
if (!(__connection_check_handle_validity(connection)) ||
interface_name == NULL || host_address == NULL) {
CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
EXPORT_API int connection_add_route_ipv6(connection_h connection, const char *interface_name, const char *host_address, const char * gateway)
{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, ETHERNET_FEATURE);
+
if (!(__connection_check_handle_validity(connection)) ||
interface_name == NULL || host_address == NULL) {
CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
EXPORT_API int connection_remove_route_ipv6(connection_h connection, const char *interface_name, const char *host_address, const char * gateway)
{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, ETHERNET_FEATURE);
+
if (!(__connection_check_handle_validity(connection)) ||
interface_name == NULL || host_address == NULL) {
CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
connection_type_e connection_type,
connection_statistics_type_e statistics_type, long long* size)
{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE);
+
+ if(connection_type == CONNECTION_TYPE_CELLULAR )
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE);
+ else if(connection_type == CONNECTION_TYPE_WIFI)
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (!(__connection_check_handle_validity(connection)) || size == NULL) {
CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
connection_type_e connection_type,
connection_statistics_type_e statistics_type)
{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE);
+
+ if(connection_type == CONNECTION_TYPE_CELLULAR )
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE);
+ else if(connection_type == CONNECTION_TYPE_WIFI)
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (!(__connection_check_handle_validity(connection))) {
CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed");
return CONNECTION_ERROR_INVALID_PARAMETER;
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
- * limitations under the License.
+ * limitations under the License.
*/
#include <stdio.h>
/* Connection profile ********************************************************/
EXPORT_API int connection_profile_create(connection_profile_type_e type, const char* keyword, connection_profile_h* profile)
{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE);
+
+ if(type == CONNECTION_PROFILE_TYPE_CELLULAR)
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE);
+ else if(type == CONNECTION_PROFILE_TYPE_WIFI)
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if ((type != CONNECTION_PROFILE_TYPE_CELLULAR &&
type != CONNECTION_PROFILE_TYPE_WIFI) || profile == NULL) {
CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
EXPORT_API int connection_profile_destroy(connection_profile_h profile)
{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
if (!(_connection_libnet_check_profile_validity(profile))) {
CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
return CONNECTION_ERROR_INVALID_PARAMETER;
EXPORT_API int connection_profile_clone(connection_profile_h* cloned_profile, connection_profile_h origin_profile)
{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
if (!(_connection_libnet_check_profile_validity(origin_profile)) || cloned_profile == NULL) {
CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
return CONNECTION_ERROR_INVALID_PARAMETER;
EXPORT_API int connection_profile_get_id(connection_profile_h profile, char** profile_id)
{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
if (!(_connection_libnet_check_profile_validity(profile)) || profile_id == NULL) {
CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
return CONNECTION_ERROR_INVALID_PARAMETER;
EXPORT_API int connection_profile_get_name(connection_profile_h profile, char** profile_name)
{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
if (!(_connection_libnet_check_profile_validity(profile)) || profile_name == NULL) {
CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
return CONNECTION_ERROR_INVALID_PARAMETER;
EXPORT_API int connection_profile_get_type(connection_profile_h profile, connection_profile_type_e* type)
{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
if (!(_connection_libnet_check_profile_validity(profile)) || type == NULL) {
CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
return CONNECTION_ERROR_INVALID_PARAMETER;
EXPORT_API int connection_profile_get_network_interface_name(connection_profile_h profile, char** interface_name)
{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
if (!(_connection_libnet_check_profile_validity(profile)) || interface_name == NULL) {
CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
return CONNECTION_ERROR_INVALID_PARAMETER;
EXPORT_API int connection_profile_refresh(connection_profile_h profile)
{
int rv;
+
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
if (!(_connection_libnet_check_profile_validity(profile))) {
CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
return CONNECTION_ERROR_INVALID_PARAMETER;
EXPORT_API int connection_profile_get_state(connection_profile_h profile, connection_profile_state_e* state)
{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
if (!(_connection_libnet_check_profile_validity(profile)) || state == NULL) {
CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
return CONNECTION_ERROR_INVALID_PARAMETER;
{
net_ip_config_type_t profile_type;
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
if (!(_connection_libnet_check_profile_validity(profile)) ||
(address_family != CONNECTION_ADDRESS_FAMILY_IPV4 &&
address_family != CONNECTION_ADDRESS_FAMILY_IPV6) ||
EXPORT_API int connection_profile_get_ip_address(connection_profile_h profile,
connection_address_family_e address_family, char** ip_address)
{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
if (!(_connection_libnet_check_profile_validity(profile)) ||
(address_family != CONNECTION_ADDRESS_FAMILY_IPV4 &&
address_family != CONNECTION_ADDRESS_FAMILY_IPV6) ||
connection_address_family_e address_family, char** subnet_mask)
{
char* prefixlen;
-
+
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
if (!(_connection_libnet_check_profile_validity(profile)) ||
(address_family != CONNECTION_ADDRESS_FAMILY_IPV4 &&
address_family != CONNECTION_ADDRESS_FAMILY_IPV6) ||
EXPORT_API int connection_profile_get_gateway_address(connection_profile_h profile,
connection_address_family_e address_family, char** gateway_address)
-{
+{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
if (!(_connection_libnet_check_profile_validity(profile)) ||
(address_family != CONNECTION_ADDRESS_FAMILY_IPV4 &&
address_family != CONNECTION_ADDRESS_FAMILY_IPV6) ||
EXPORT_API int connection_profile_get_dns_address(connection_profile_h profile, int order,
connection_address_family_e address_family, char** dns_address)
{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
if (!(_connection_libnet_check_profile_validity(profile)) ||
(address_family != CONNECTION_ADDRESS_FAMILY_IPV4 &&
address_family != CONNECTION_ADDRESS_FAMILY_IPV6) ||
EXPORT_API int connection_profile_get_proxy_type(connection_profile_h profile, connection_proxy_type_e* type)
{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
if (!(_connection_libnet_check_profile_validity(profile)) || type == NULL) {
CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
return CONNECTION_ERROR_INVALID_PARAMETER;
EXPORT_API int connection_profile_get_proxy_address(connection_profile_h profile,
connection_address_family_e address_family, char** proxy_address)
{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
if (!(_connection_libnet_check_profile_validity(profile)) ||
(address_family != CONNECTION_ADDRESS_FAMILY_IPV4 &&
address_family != CONNECTION_ADDRESS_FAMILY_IPV6) ||
{
net_ip_config_type_t *profile_type = NULL;
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
if (!(_connection_libnet_check_profile_validity(profile)) ||
(address_family != CONNECTION_ADDRESS_FAMILY_IPV4 &&
address_family != CONNECTION_ADDRESS_FAMILY_IPV6)) {
EXPORT_API int connection_profile_set_ip_address(connection_profile_h profile,
connection_address_family_e address_family, const char* ip_address)
-{
+{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
if (!(_connection_libnet_check_profile_validity(profile)) ||
(address_family != CONNECTION_ADDRESS_FAMILY_IPV4 &&
address_family != CONNECTION_ADDRESS_FAMILY_IPV6)) {
EXPORT_API int connection_profile_set_subnet_mask(connection_profile_h profile,
connection_address_family_e address_family, const char* subnet_mask)
-{
+{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
if (!(_connection_libnet_check_profile_validity(profile)) ||
(address_family != CONNECTION_ADDRESS_FAMILY_IPV4 &&
address_family != CONNECTION_ADDRESS_FAMILY_IPV6)) {
EXPORT_API int connection_profile_set_gateway_address(connection_profile_h profile,
connection_address_family_e address_family, const char* gateway_address)
{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
if (!(_connection_libnet_check_profile_validity(profile)) ||
(address_family != CONNECTION_ADDRESS_FAMILY_IPV4 &&
address_family != CONNECTION_ADDRESS_FAMILY_IPV6)) {
EXPORT_API int connection_profile_set_dns_address(connection_profile_h profile, int order,
connection_address_family_e address_family, const char* dns_address)
{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
if (!(_connection_libnet_check_profile_validity(profile)) ||
(address_family != CONNECTION_ADDRESS_FAMILY_IPV4 &&
address_family != CONNECTION_ADDRESS_FAMILY_IPV6) ||
EXPORT_API int connection_profile_set_proxy_type(connection_profile_h profile, connection_proxy_type_e type)
{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
if (!(_connection_libnet_check_profile_validity(profile))) {
CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
return CONNECTION_ERROR_INVALID_PARAMETER;
EXPORT_API int connection_profile_set_proxy_address(connection_profile_h profile,
connection_address_family_e address_family, const char* proxy_address)
{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
if (!(_connection_libnet_check_profile_validity(profile)) ||
(address_family != CONNECTION_ADDRESS_FAMILY_IPV4 &&
address_family != CONNECTION_ADDRESS_FAMILY_IPV6)) {
EXPORT_API int connection_profile_set_state_changed_cb(connection_profile_h profile,
connection_profile_state_changed_cb callback, void* user_data)
{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
if (!(_connection_libnet_check_profile_validity(profile)) || callback == NULL) {
CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
return CONNECTION_ERROR_INVALID_PARAMETER;
EXPORT_API int connection_profile_unset_state_changed_cb(connection_profile_h profile)
{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
if (!(_connection_libnet_check_profile_cb_validity(profile))) {
CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
return CONNECTION_ERROR_INVALID_PARAMETER;
/* Wi-Fi profile *************************************************************/
EXPORT_API int connection_profile_get_wifi_essid(connection_profile_h profile, char** essid)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (!(_connection_libnet_check_profile_validity(profile)) || essid == NULL) {
CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
return CONNECTION_ERROR_INVALID_PARAMETER;
EXPORT_API int connection_profile_get_wifi_bssid(connection_profile_h profile, char** bssid)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (!(_connection_libnet_check_profile_validity(profile)) || bssid == NULL) {
CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
return CONNECTION_ERROR_INVALID_PARAMETER;
EXPORT_API int connection_profile_get_wifi_rssi(connection_profile_h profile, int* rssi)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (!(_connection_libnet_check_profile_validity(profile)) || rssi == NULL) {
CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
return CONNECTION_ERROR_INVALID_PARAMETER;
EXPORT_API int connection_profile_get_wifi_frequency(connection_profile_h profile, int* frequency)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (!(_connection_libnet_check_profile_validity(profile)) || frequency == NULL) {
CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
return CONNECTION_ERROR_INVALID_PARAMETER;
EXPORT_API int connection_profile_get_wifi_max_speed(connection_profile_h profile, int* max_speed)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (!(_connection_libnet_check_profile_validity(profile)) || max_speed == NULL) {
CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
return CONNECTION_ERROR_INVALID_PARAMETER;
EXPORT_API int connection_profile_get_wifi_security_type(connection_profile_h profile, connection_wifi_security_type_e* type)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (!(_connection_libnet_check_profile_validity(profile)) || type == NULL) {
CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
return CONNECTION_ERROR_INVALID_PARAMETER;
EXPORT_API int connection_profile_get_wifi_encryption_type(connection_profile_h profile, connection_wifi_encryption_type_e* type)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (!(_connection_libnet_check_profile_validity(profile)) || type == NULL) {
CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
return CONNECTION_ERROR_INVALID_PARAMETER;
EXPORT_API int connection_profile_is_wifi_passphrase_required(connection_profile_h profile, bool* required)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (!(_connection_libnet_check_profile_validity(profile)) || required == NULL) {
CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
return CONNECTION_ERROR_INVALID_PARAMETER;
EXPORT_API int connection_profile_set_wifi_passphrase(connection_profile_h profile, const char* passphrase)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (!(_connection_libnet_check_profile_validity(profile)) || passphrase == NULL) {
CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
return CONNECTION_ERROR_INVALID_PARAMETER;
EXPORT_API int connection_profile_is_wifi_wps_supported(connection_profile_h profile, bool* supported)
{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
if (!(_connection_libnet_check_profile_validity(profile)) || supported == NULL) {
CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
return CONNECTION_ERROR_INVALID_PARAMETER;
/* Cellular profile **********************************************************/
EXPORT_API int connection_profile_get_cellular_network_type(connection_profile_h profile, connection_cellular_network_type_e* type)
{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE);
+
if (!(_connection_libnet_check_profile_validity(profile)) || type == NULL) {
CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
return CONNECTION_ERROR_INVALID_PARAMETER;
EXPORT_API int connection_profile_get_cellular_service_type(connection_profile_h profile,
connection_cellular_service_type_e* type)
{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE);
+
if (!(_connection_libnet_check_profile_validity(profile)) || type == NULL) {
CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
return CONNECTION_ERROR_INVALID_PARAMETER;
EXPORT_API int connection_profile_get_cellular_apn(connection_profile_h profile, char** apn)
{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE);
+
if (!(_connection_libnet_check_profile_validity(profile)) || apn == NULL) {
CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
return CONNECTION_ERROR_INVALID_PARAMETER;
EXPORT_API int connection_profile_get_cellular_auth_info(connection_profile_h profile,
connection_cellular_auth_type_e* type, char** user_name, char** password)
{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE);
+
if (!(_connection_libnet_check_profile_validity(profile)) ||
type == NULL || user_name == NULL || password == NULL) {
CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
EXPORT_API int connection_profile_get_cellular_home_url(connection_profile_h profile, char** home_url)
{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE);
+
if (!(_connection_libnet_check_profile_validity(profile)) || home_url == NULL) {
CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
return CONNECTION_ERROR_INVALID_PARAMETER;
EXPORT_API int connection_profile_is_cellular_roaming(connection_profile_h profile, bool* is_roaming)
{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE);
+
if (!(_connection_libnet_check_profile_validity(profile)) || is_roaming == NULL) {
CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
return CONNECTION_ERROR_INVALID_PARAMETER;
EXPORT_API int connection_profile_is_cellular_hidden(connection_profile_h profile, bool* is_hidden)
{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE);
+
if (!(_connection_libnet_check_profile_validity(profile)) || is_hidden == NULL) {
CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
EXPORT_API int connection_profile_is_cellular_editable(connection_profile_h profile, bool* is_editable)
{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE);
+
if (!(_connection_libnet_check_profile_validity(profile)) || is_editable == NULL) {
CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
EXPORT_API int connection_profile_is_cellular_default(connection_profile_h profile, bool* is_default)
{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE);
+
if (!(_connection_libnet_check_profile_validity(profile)) || is_default == NULL) {
CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
EXPORT_API int connection_profile_set_cellular_service_type(connection_profile_h profile,
connection_cellular_service_type_e service_type)
{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE);
+
if (!(_connection_libnet_check_profile_validity(profile))) {
CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
return CONNECTION_ERROR_INVALID_PARAMETER;
EXPORT_API int connection_profile_set_cellular_apn(connection_profile_h profile, const char* apn)
{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE);
+
if (!(_connection_libnet_check_profile_validity(profile)) || apn == NULL) {
CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
return CONNECTION_ERROR_INVALID_PARAMETER;
EXPORT_API int connection_profile_set_cellular_auth_info(connection_profile_h profile,
connection_cellular_auth_type_e type, const char* user_name, const char* password)
{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE);
+
if (!(_connection_libnet_check_profile_validity(profile)) ||
user_name == NULL || password == NULL) {
CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
EXPORT_API int connection_profile_set_cellular_home_url(connection_profile_h profile, const char* home_url)
{
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE);
+
if (!(_connection_libnet_check_profile_validity(profile)) || home_url == NULL) {
CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
return CONNECTION_ERROR_INVALID_PARAMETER;
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
- * limitations under the License.
+ * limitations under the License.
*/
#include <stdio.h>
#include <string.h>
#include <glib.h>
#include <vconf/vconf.h>
+#include <system_info.h>
#include <arpa/inet.h>
#include "net_connection_private.h"
guint id;
};
-struct feature_type {
- bool telephony;
- bool wifi;
- bool tethering_bluetooth;
-};
-
static struct _profile_list_s profile_iterator = {0, 0, NULL};
static struct _libnet_s libnet = {NULL, NULL, NULL, NULL, NULL, NULL, false};
static __thread GSList *managed_idler_list = NULL;
-static __thread bool is_check_enable_feature = false;
-static __thread struct feature_type enable_feature = {false, false, false};
bool _connection_is_created(void)
{
return CONNECTION_ERROR_NONE;
}
-bool _connection_libnet_get_is_check_enable_feature()
-{
- return is_check_enable_feature;
-}
-
-bool _connection_libnet_get_enable_feature_state(enable_feature_type_e feature_type)
+int _connection_check_feature_supported(const char *feature_name, ...)
{
- if(is_check_enable_feature){
- switch(feature_type) {
- case FEATURE_TYPE_TELEPHONY:
- return enable_feature.telephony;
- case FEATURE_TYPE_WIFI:
- return enable_feature.wifi;
- case FEATURE_TYPE_TETHERING_BLUETOOTH:
- return enable_feature.tethering_bluetooth;
- default:
- CONNECTION_LOG(CONNECTION_ERROR, "Invalid feature type");
- return false;
+ va_list list;
+ const char *key;
+ bool value, feature_supported = false;
+
+ va_start(list, feature_name);
+ key = feature_name;
+ while(1) {
+ if(system_info_get_platform_bool(key, &value) < 0) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Error - Feature getting from System Info");
+ set_last_result(CONNECTION_ERROR_OPERATION_FAILED);
+ return CONNECTION_ERROR_OPERATION_FAILED;
}
+ SECURE_CONNECTION_LOG(CONNECTION_INFO, "%s feature is %s", key, (value?"true":"false"));
+ feature_supported |= value;
+ key = va_arg(list, const char *);
+ if (!key) break;
}
- CONNECTION_LOG(CONNECTION_ERROR, "Not checked enable feature yet");
- return false;
+ if (!feature_supported) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Error - Feature is not supported");
+ set_last_result(CONNECTION_ERROR_NOT_SUPPORTED);
+ return CONNECTION_ERROR_NOT_SUPPORTED;
+ }
+ va_end(list);
+
+ set_last_result(CONNECTION_ERROR_NONE);
+ return CONNECTION_ERROR_NONE;
}
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
- * limitations under the License.
+ * limitations under the License.
*/
#include <stdio.h>
{
int rv = 0;
char a[100];
-
+
memset(a, '\0', 100);
printf("Event received from stdin\n");
-
+
rv = read(0, a, 100);
-
+
if (rv < 0 || a[0] == '0') {
if (connection != NULL)
test_deregister_client();