From 141a0c47e0e014b2fe78fb2f5f8f61429a2ba86c Mon Sep 17 00:00:00 2001 From: "taesub.kim" Date: Tue, 3 Feb 2015 21:18:52 +0900 Subject: [PATCH] Merge 2.3 code for sync Change-Id: I7ce37c0f4de19a3f6c9f340ef0797b6b378377ec Signed-off-by: Taesub Kimz --- include/connection_profile.h | 917 +++++++++++++++++++-------------- include/net_connection.h | 507 ++++++++++++------ include/net_connection_private.h | 61 ++- packaging/capi-network-connection.spec | 2 +- src/connection.c | 24 +- src/connection_profile.c | 3 +- src/libnetwork.c | 43 +- test/connection_test.c | 34 +- 8 files changed, 989 insertions(+), 602 deletions(-) mode change 100644 => 100755 include/net_connection.h diff --git a/include/connection_profile.h b/include/connection_profile.h index 1f37c06..2cfd0a5 100644 --- a/include/connection_profile.h +++ b/include/connection_profile.h @@ -24,12 +24,17 @@ extern "C" { #endif /** + * @file connection_profile.h + */ + +/** * @addtogroup CAPI_NETWORK_CONNECTION_WIFI_PROFILE_MODULE * @{ */ /** -* @brief Security type of Wi-Fi + * @brief Enumeration for security type of Wi-Fi. + * @since_tizen 2.3 */ typedef enum { @@ -41,7 +46,8 @@ typedef enum } connection_wifi_security_type_e; /** -* @brief Below encryption modes are used in infrastructure and ad-hoc mode + * @brief Enumeration for encryption modes. + * @since_tizen 2.3 */ typedef enum { @@ -74,7 +80,8 @@ typedef enum } connection_cellular_network_type_e; /** -* @breif This enum indicates cellular service type + * @brief Enumeration for cellular service type. + * @since_tizen 2.3 */ typedef enum { @@ -88,7 +95,8 @@ typedef enum } connection_cellular_service_type_e; /** -* @brief Cellular Authentication Type + * @brief Enumeration for cellular authentication type. + * @since_tizen 2.3 */ typedef enum { @@ -108,12 +116,14 @@ typedef enum */ /** -* @brief The handle of profile + * @brief The profile handle. + * @since_tizen 2.3 */ typedef void* connection_profile_h; /** -* @brief This enumeration defines the profile state type. + * @brief Enumeration for profile state type. + * @since_tizen 2.3 */ typedef enum { @@ -124,7 +134,8 @@ typedef enum } connection_profile_state_e; /** -* @brief Enumerations of Address family + * @brief Enumeration for address family. + * @since_tizen 2.3 */ typedef enum { @@ -133,7 +144,8 @@ typedef enum } connection_address_family_e; /** -* @brief Net IP configuration Type + * @brief Enumeration for IP configuration type. + * @since_tizen 2.3 */ typedef enum { @@ -145,7 +157,8 @@ typedef enum } connection_ip_config_type_e; /** -* @brief This enumeration defines the proxy method type. + * @brief Enumeration for proxy method type. + * @since_tizen 2.3 */ typedef enum { @@ -155,8 +168,8 @@ typedef enum } connection_proxy_type_e; /** -* @enum connection_profile_type_e -* @brief Enumerations of network connection type. + * @brief Enumeration for network connection type. + * @since_tizen 2.3 */ typedef enum{ CONNECTION_PROFILE_TYPE_CELLULAR = 0, /**< Cellular type */ @@ -166,350 +179,392 @@ typedef enum{ } connection_profile_type_e; /** -* @brief Creates the profile handle. -* @details The profile name, which is got from connection_profile_get_name(), will include the keyword you set. -* @remarks @a profile must be released with connection_profile_destroy(). -* @param[in] type The type of profile. #CONNECTION_PROFILE_TYPE_CELLULAR is only supported. -* @param[in] keyword The keyword included in profile name -* @param[out] profile The handle of the profile -* @return 0 on success, otherwise negative error value. -* @retval #CONNECTION_ERROR_NONE Successful -* @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory -* @see connection_profile_destroy() -* @see connection_profile_get_name() + * @brief Creates a profile handle. + * @details The profile name, which you get from connection_profile_get_name(), will include the keyword you set. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/network.profile \n + * %http://tizen.org/privilege/network.get + * @remarks You must release @a profile using connection_profile_destroy(). \n + * This API needs both privileges. + * @param[in] type The type of profile\n + * #CONNECTION_PROFILE_TYPE_CELLULAR and #CONNECTION_PROFILE_TYPE_WIFI are supported. + * @param[in] keyword The keyword included in profile name + * @param[out] profile The handle of the profile + * @return @c 0 on success, otherwise negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory + * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported + * @see connection_profile_destroy() + * @see connection_profile_get_name() */ int connection_profile_create(connection_profile_type_e type, const char* keyword, connection_profile_h* profile); /** -* @brief Destroys the profile handle. -* @param[out] connection The handle to the connection -* @return 0 on success, otherwise negative error value. -* @retval #CONNECTION_ERROR_NONE Successful -* @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter -* @see connection_profile_create() + * @brief Destroys a profile handle. + * @since_tizen 2.3 + * @param[out] profile The handle to the profile + * @return @c 0 on success, otherwise a negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @see connection_profile_create() */ int connection_profile_destroy(connection_profile_h profile); /** -* @brief Clons the profile handle. -* @remarks @a cloned_profile must be released with connection_profile_destroy(). -* @param[in] origin_profile The handle of origin profile -* @param[out] cloned_profile The handle of cloned profile -* @return 0 on success, otherwise negative error value. -* @retval #CONNECTION_ERROR_NONE Successful -* @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory -* @see connection_profile_destroy() + * @brief Clones a profile handle. + * @since_tizen 2.3 + * @remarks You must release @a cloned_profile using connection_profile_destroy(). + * @param[out] cloned_profile The handle of the cloned profile + * @param[in] origin_profile The handle of the origin profile + * @return @c 0 on success, otherwise a negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory + * @see connection_profile_destroy() */ int connection_profile_clone(connection_profile_h* cloned_profile, connection_profile_h origin_profile); /** -* @brief Gets the profile ID. -* @details The separate profiles can have the same name. -* So, you must use this API instead of connection_profile_get_name() if you want to get the unique identification. -* In case that you create a profile, this value will be determined when you add the profile. -* @remarks @a profile_id must be released with free() by you. -* @param[in] profile The handle of profile -* @param[out] profile_id The ID of profile -* @return 0 on success, otherwise negative error value. -* @retval #CONNECTION_ERROR_NONE Successful -* @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory -* @see connection_profile_get_name() -* @see connection_add_profile() + * @brief Gets the profile ID. + * @details The separate profiles can have the same name. + * So, you must use this API instead of connection_profile_get_name() if you want to get the unique identification. + * In case you create a profile, this value will be determined when you add the profile. + * + * @since_tizen 2.3 + * @remarks You must release @a profile_id using free(). + * @param[in] profile The profile handle + * @param[out] profile_id The ID of the profile + * @return @c 0 on success, otherwise a negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory + * @see connection_profile_get_name() + * @see connection_add_profile() */ int connection_profile_get_id(connection_profile_h profile, char** profile_id); /** -* @brief Gets the profile name. -* @remarks @a profile_name must be released with free() by you. -* @param[in] profile The handle of profile -* @param[out] profile_name The name of profile -* @return 0 on success, otherwise negative error value. -* @retval #CONNECTION_ERROR_NONE Successful -* @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory -* @see connection_profile_get_id() + * @brief Gets the profile name. + * @since_tizen 2.3 + * @remarks You must release @a profile_name using free(). + * @param[in] profile The profile handle + * @param[out] profile_name The name of the profile + * @return @c 0 on success, otherwise a negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory + * @see connection_profile_get_id() */ int connection_profile_get_name(connection_profile_h profile, char** profile_name); /** -* @brief Gets the network type. -* @param[in] profile The handle of profile -* @param[out] type The type of profile -* @return 0 on success, otherwise negative error value. -* @retval #CONNECTION_ERROR_NONE Successful -* @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed + * @brief Gets the network type. + * @since_tizen 2.3 + * @param[in] profile The profile handle + * @param[out] type The type of the profile + * @return @c 0 on success, otherwise a negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed */ int connection_profile_get_type(connection_profile_h profile, connection_profile_type_e* type); /** -* @brief Gets the name of network interface. For example, eth0 and pdp0. -* @remarks @a interface_name must be released with free() by you. -* @param[in] profile The handle of profile -* @param[out] interface_name The name of network interface -* @return 0 on success, otherwise negative error value. -* @retval #CONNECTION_ERROR_NONE Successful -* @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory + * @brief Gets the name of the network interface, e.g. eth0 and pdp0. + * @since_tizen 2.3 + * @remarks You must release @a interface_name using free(). + * @param[in] profile The profile handle + * @param[out] interface_name The name of the network interface + * @return @c 0 on success, otherwise a negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory */ int connection_profile_get_network_interface_name(connection_profile_h profile, char** interface_name); /** -* @brief Refresh the profile information. -* @remarks You should call this function in order to get the current information because the profile information can be changed. -* @param[in] profile The handle of profile -* @return 0 on success, otherwise negative error value. -* @retval #CONNECTION_ERROR_NONE Successful -* @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed -* @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory + * @brief Refreshes the profile information. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/network.get + * @remarks You should call this function in order to get the current information because the profile information can be changed. + * @param[in] profile The profile handle + * @return @c 0 on success, otherwise a negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed + * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory + * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied */ int connection_profile_refresh(connection_profile_h profile); /** -* @brief Gets the network type. -* @param[in] profile The handle of profile -* @param[out] state The state of profile -* @return 0 on success, otherwise negative error value. -* @retval #CONNECTION_ERROR_NONE Successful -* @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed + * @brief Gets the network type. + * @since_tizen 2.3 + * @param[in] profile The profile handle + * @param[out] state The state of the profile + * @return @c 0 on success, otherwise a negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed */ int connection_profile_get_state(connection_profile_h profile, connection_profile_state_e* state); /** -* @brief Gets the IP config type. -* @param[in] profile The handle of profile -* @param[in] address_family The address family -* @param[out] type The type of IP config -* @return 0 on success, otherwise negative error value. -* @retval #CONNECTION_ERROR_NONE Successful -* @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed + * @brief Gets the IP config type. + * @since_tizen 2.3 + * @param[in] profile The profile handle + * @param[in] address_family The address family + * @param[out] type The type of the IP config + * @return @c 0 on success, otherwise a negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed */ int connection_profile_get_ip_config_type(connection_profile_h profile, connection_address_family_e address_family, connection_ip_config_type_e* type); /** -* @brief Gets the IP address. -* @remarks @a ip_address must be released with free() by you. -* @param[in] profile The handle of profile -* @param[in] address_family The address family -* @param[out] ip_address The IP address -* @return 0 on success, otherwise negative error value. -* @retval #CONNECTION_ERROR_NONE Successful -* @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory -* @retval #CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED Not supported address family -* @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed + * @brief Gets the IP address. + * @since_tizen 2.3 + * @remarks You must release @a ip_address using free(). + * @param[in] profile The profile handle + * @param[in] address_family The address family + * @param[out] ip_address The IP address + * @return @c 0 on success, otherwise a negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory + * @retval #CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED Not supported address family + * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed */ int connection_profile_get_ip_address(connection_profile_h profile, connection_address_family_e address_family, char** ip_address); /** -* @brief Gets the Subnet Mask. -* @remarks @a subnet_mask must be released with free() by you. -* @param[in] profile The handle of profile -* @param[in] address_family The address family -* @param[out] subnet_mask The subnet mask -* @return 0 on success, otherwise negative error value. -* @retval #CONNECTION_ERROR_NONE Successful -* @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory -* @retval #CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED Not supported address family -* @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed + * @brief Gets the Subnet Mask. + * @since_tizen 2.3 + * @remarks You must release @a subnet_mask using free(). + * @param[in] profile The profile handle + * @param[in] address_family The address family + * @param[out] subnet_mask The subnet mask + * @return @c 0 on success, otherwise a negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory + * @retval #CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED Not supported address family + * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed */ int connection_profile_get_subnet_mask(connection_profile_h profile, connection_address_family_e address_family, char** subnet_mask); /** -* @brief Gets the Gateway address. -* @remarks @a gateway_address must be released with free() by you. -* @param[in] profile The handle of profile -* @param[in] address_family The address family -* @param[out] gateway_address The gateway address -* @return 0 on success, otherwise negative error value. -* @retval #CONNECTION_ERROR_NONE Successful -* @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory -* @retval #CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED Not supported address family -* @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed + * @brief Gets the Gateway address. + * @since_tizen 2.3 + * @remarks You must release @a gateway_address using free(). + * @param[in] profile The profile handle + * @param[in] address_family The address family + * @param[out] gateway_address The gateway address + * @return @c 0 on success, otherwise a negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory + * @retval #CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED Not supported address family + * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed */ int connection_profile_get_gateway_address(connection_profile_h profile, connection_address_family_e address_family, char** gateway_address); /** -* @brief Gets the DNS address. -* @remarks The allowance of DNS address is 2. @a dns_address must be released with free() by you. -* @param[in] profile The handle of profile -* @param[in] order The order of DNS address. It starts from 1, which means first DNS address. -* @param[in] address_family The address family -* @param[out] dns_address The DNS address -* @return 0 on success, otherwise negative error value. -* @retval #CONNECTION_ERROR_NONE Successful -* @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory -* @retval #CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED Not supported address family -* @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed + * @brief Gets the DNS address. + * @since_tizen 2.3 + * @remarks The allowance of the DNS address is @c 2. You must release @a dns_address using free(). + * @param[in] profile The profile handle + * @param[in] order The order of DNS address \n + * it starts from 1, which means first DNS address. + * @param[in] address_family The address family + * @param[out] dns_address The DNS address + * @return @c 0 on success, otherwise a negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory + * @retval #CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED Not supported address family + * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed */ int connection_profile_get_dns_address(connection_profile_h profile, int order, connection_address_family_e address_family, char** dns_address); /** -* @brief Gets the Proxy type. -* @param[in] profile The handle of profile -* @param[out] type The type of proxy -* @return 0 on success, otherwise negative error value. -* @retval #CONNECTION_ERROR_NONE Successful -* @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed + * @brief Gets the Proxy type. + * @since_tizen 2.3 + * @param[in] profile The profile handle + * @param[out] type The type of the proxy + * @return @c 0 on success, otherwise a negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed */ int connection_profile_get_proxy_type(connection_profile_h profile, connection_proxy_type_e* type); /** -* @brief Gets the Proxy address. -* @remarks @a proxy_address must be released with free() by you. -* @param[in] profile The handle of profile -* @param[in] address_family The address family -* @param[out] proxy_address The proxy address -* @return 0 on success, otherwise negative error value. -* @retval #CONNECTION_ERROR_NONE Successful -* @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory -* @retval #CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED Not supported address family -* @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed + * @brief Gets the Proxy address. + * @since_tizen 2.3 + * @remarks You must release @a proxy_address using free(). + * @param[in] profile The profile handle + * @param[in] address_family The address family + * @param[out] proxy_address The proxy address + * @return @c 0 on success, otherwise a negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory + * @retval #CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED Not supported address family + * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed */ int connection_profile_get_proxy_address(connection_profile_h profile, connection_address_family_e address_family, char** proxy_address); /** -* @brief Sets the IP config type. -* @details If you set IP config type to #WIFI_IP_CONFIG_TYPE_STATIC, -* then IP address, Gateway and Subnet mask will be set to the initial value "0.0.0.0". -* @param[in] profile The handle of profile -* @param[in] address_family The address family -* @param[in] type The type of IP config -* @return 0 on success, otherwise negative error value. -* @retval #CONNECTION_ERROR_NONE Successful -* @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed + * @brief Sets the IP config type. + * @details If you set IP config type to #CONNECTION_IP_CONFIG_TYPE_STATIC, + * then IP address, Gateway and Subnet mask will be set to the initial value "0.0.0.0". + * @since_tizen 2.3 + * @param[in] profile The profile handle + * @param[in] address_family The address family + * @param[in] type The type of the IP config + * @return @c 0 on success, otherwise a negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed */ int connection_profile_set_ip_config_type(connection_profile_h profile, connection_address_family_e address_family, connection_ip_config_type_e type); /** -* @brief Sets the IP address. -* @param[in] profile The handle of profile -* @param[in] address_family The address family -* @param[in] ip_address The IP address. If you set this value to NULL, then the existing value will be deleted. -* @return 0 on success, otherwise negative error value. -* @retval #CONNECTION_ERROR_NONE Successful -* @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED Not supported address family -* @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed -* @see connection_update_profile() + * @brief Sets the IP address. + * @since_tizen 2.3 + * @param[in] profile The profile handle + * @param[in] address_family The address family + * @param[in] ip_address The IP address.\n + * If you set this value to @c NULL, then the existing value will be deleted. + * @return @c 0 on success, otherwise a negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED Not supported address family + * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed + * @see connection_update_profile() */ int connection_profile_set_ip_address(connection_profile_h profile, connection_address_family_e address_family, const char* ip_address); /** -* @brief Sets the Subnet Mask. -* @param[in] profile The handle of profile -* @param[in] address_family The address family -* @param[in] subnet_mask The subnet mask. If you set this value to NULL, then the existing value will be deleted. -* @return 0 on success, otherwise negative error value. -* @retval #CONNECTION_ERROR_NONE Successful -* @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED Not supported address family -* @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed -* @see connection_update_profile() + * @brief Sets the Subnet Mask. + * @since_tizen 2.3 + * @param[in] profile The profile handle + * @param[in] address_family The address family + * @param[in] subnet_mask The subnet mask. \n + * If you set this value to @c NULL, then the existing value will be deleted. + * @return @c 0 on success, otherwise a negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED Not supported address family + * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed + * @see connection_update_profile() */ int connection_profile_set_subnet_mask(connection_profile_h profile, connection_address_family_e address_family, const char* subnet_mask); /** -* @brief Sets the Gateway address. -* @param[in] profile The handle of profile -* @param[in] address_family The address family -* @param[in] gateway_address The gateway address. If you set this value to NULL, then the existing value will be deleted. -* @return 0 on success, otherwise negative error value. -* @retval #CONNECTION_ERROR_NONE Successful -* @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED Not supported address family -* @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed -* @see connection_update_profile() + * @brief Sets the Gateway address. + * @since_tizen 2.3 + * @param[in] profile The profile handle + * @param[in] address_family The address family + * @param[in] gateway_address The gateway address. \n + * If you set this value to @c NULL, then the existing value will be deleted. + * @return @c 0 on success, otherwise a negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED Not supported address family + * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed + * @see connection_update_profile() */ int connection_profile_set_gateway_address(connection_profile_h profile, connection_address_family_e address_family, const char* gateway_address); /** -* @brief Sets the DNS address. -* @remarks The allowance of DNS address is 2. -* @param[in] profile The handle of profile -* @param[in] order The order of DNS address. It starts from 1, which means first DNS address. -* @param[in] address_family The address family -* @param[in] dns_address The DNS address. If you set this value to NULL, then the existing value will be deleted. -* @return 0 on success, otherwise negative error value. -* @retval #CONNECTION_ERROR_NONE Successful -* @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED Not supported address family -* @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed -* @see connection_update_profile() + * @brief Sets the DNS address. + * @since_tizen 2.3 + * @remarks The allowance of the DNS address is @c 2. + * @param[in] profile The profile handle + * @param[in] order The order of the DNS address. \n + * It starts from @c 1, which means first DNS address. + * @param[in] address_family The address family + * @param[in] dns_address The DNS address; if you set this value to NULL, then the existing value will be deleted + * @return @c 0 on success, otherwise a negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED Not supported address family + * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed + * @see connection_update_profile() */ int connection_profile_set_dns_address(connection_profile_h profile, int order, connection_address_family_e address_family, const char* dns_address); /** -* @brief Sets the Proxy type. -* @details If you set Proxy type to #WIFI_PROXY_TYPE_AUTO or #WIFI_PROXY_TYPE_MANUAL, then Proxy will be restored. -* @param[in] profile The handle of profile -* @param[in] type The type of proxy -* @return 0 on success, otherwise negative error value. -* @retval #CONNECTION_ERROR_NONE Successful -* @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed -* @see connection_update_profile() + * @brief Sets the Proxy type. + * @details If you set the Proxy type to #CONNECTION_PROXY_TYPE_AUTO or #CONNECTION_PROXY_TYPE_MANUAL, then Proxy will be restored. + * @since_tizen 2.3 + * @param[in] profile The profile handle + * @param[in] type The type of the proxy + * @return @c 0 on success, otherwise a negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed + * @see connection_update_profile() */ int connection_profile_set_proxy_type(connection_profile_h profile, connection_proxy_type_e type); /** -* @brief Sets the Proxy address. -* @param[in] profile The handle of profile -* @param[in] address_family The address family -* @param[in] proxy_address The proxy address. If you set this value to NULL, then the existing value will be deleted. -* @return 0 on success, otherwise negative error value. -* @retval #CONNECTION_ERROR_NONE Successful -* @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED Not supported address family -* @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed -* @see connection_update_profile() + * @brief Sets the Proxy address. + * @since_tizen 2.3 + * @param[in] profile The profile handle + * @param[in] address_family The address family + * @param[in] proxy_address The proxy address. \n + * if you set this value to @c NULL, then the existing value will be deleted. + * @return @c 0 on success, otherwise a negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED Not supported address family + * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed + * @see connection_update_profile() */ int connection_profile_set_proxy_address(connection_profile_h profile, connection_address_family_e address_family, const char* proxy_address); /** -* @brief Called when the state of profile is changed. -* @param[in] state The state -* @param[in] user_data The user data passed from the callback registration function -* @see connection_profile_set_state_changed_cb() -* @see connection_profile_unset_state_changed_cb() + * @brief Called when the state of the profile is changed. + * @since_tizen 2.3 + * @param[in] state The state + * @param[in] user_data The user data passed from the callback registration function + * @see connection_profile_set_state_changed_cb() + * @see connection_profile_unset_state_changed_cb() */ typedef void(*connection_profile_state_changed_cb)(connection_profile_state_e state, void* user_data); /** -* @brief Registers the callback called when the state of profile is changed. -* @param[in] profile The handle of profile -* @param[in] callback The callback function to be called -* @param[in] user_data The user data passed to the callback function -* @return 0 on success, otherwise negative error value. -* @retval #CONNECTION_ERROR_NONE Successful -* @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed -* @post connection_opened_cb() is invoked when the state of profile is changed. -* @see connection_profile_state_changed_cb() -* @see connection_profile_unset_state_changed_cb() + * @brief Registers the callback that is called when the state of profile is changed. + * @since_tizen 2.3 + * @param[in] profile The profile handle + * @param[in] callback The callback function to be called + * @param[in] user_data The user data passed to the callback function + * @return @c 0 on success, otherwise a negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed + * @post connection_opened_cb() is invoked when the state of profile is changed. + * @see connection_profile_state_changed_cb() + * @see connection_profile_unset_state_changed_cb() */ int connection_profile_set_state_changed_cb(connection_profile_h profile, connection_profile_state_changed_cb callback, void* user_data); /** -* @brief Unregisters the callback called when the state of profile is changed. -* @param[in] profile The handle of profile -* @return 0 on success, otherwise negative error value. -* @retval #CONNECTION_ERROR_NONE Successful -* @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter -* @see connection_profile_state_changed_cb() -* @see connection_profile_set_state_changed_cb() + * @brief Unregisters the callback that is called when the state of profile is changed. + * @since_tizen 2.3 + * @param[in] profile The profile handle + * @return @c 0 on success, otherwise a negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @see connection_profile_state_changed_cb() + * @see connection_profile_set_state_changed_cb() */ int connection_profile_unset_state_changed_cb(connection_profile_h profile); @@ -524,111 +579,131 @@ int connection_profile_unset_state_changed_cb(connection_profile_h profile); */ /** -* @brief Gets the ESSID(Extended Service Set Identifier). -* @remarks @a essid must be released with free() by you. -* @param[in] profile The handle of profile -* @param[out] essid The ESSID -* @return 0 on success, otherwise negative error value. -* @retval #CONNECTION_ERROR_NONE Successful -* @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory + * @brief Gets the ESSID (Extended Service Set Identifier). + * @since_tizen 2.3 + * @remarks You must release @a essid using free(). + * @param[in] profile The profile handle + * @param[out] essid The ESSID + * @return @c 0 on success, otherwise a negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory + * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported */ int connection_profile_get_wifi_essid(connection_profile_h profile, char** essid); /** -* @brief Gets the BSSID(Basic Service Set Identifier). -* @remarks @a bssid must be released with free() by you. -* @param[in] profile The handle of profile -* @param[out] bssid The BSSID -* @return 0 on success, otherwise negative error value. -* @retval #CONNECTION_ERROR_NONE Successful -* @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory + * @brief Gets the BSSID (Basic Service Set Identifier). + * @since_tizen 2.3 + * @remarks You must release @a bssid using free(). + * @param[in] profile The profile handle + * @param[out] bssid The BSSID + * @return @c 0 on success, otherwise a negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory + * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported */ int connection_profile_get_wifi_bssid(connection_profile_h profile, char** bssid); /** -* @brief Gets the RSSI. -* @param[in] profile The handle of profile -* @param[out] rssi The RSSI -* @return 0 on success, otherwise negative error value. -* @retval #CONNECTION_ERROR_NONE Successful -* @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @brief Gets the RSSI. + * @since_tizen 2.3 + * @param[in] profile The profile handle + * @param[out] rssi The RSSI + * @return @c 0 on success, otherwise a negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported */ int connection_profile_get_wifi_rssi(connection_profile_h profile, int* rssi); /** -* @brief Gets the frequency (MHz). -* @param[in] profile The handle of profile -* @param[out] frequency The frequency -* @return 0 on success, otherwise negative error value. -* @retval #CONNECTION_ERROR_NONE Successful -* @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @brief Gets the frequency (MHz). + * @since_tizen 2.3 + * @param[in] profile The profile handle + * @param[out] frequency The frequency + * @return @c 0 on success, otherwise a negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported */ int connection_profile_get_wifi_frequency(connection_profile_h profile, int* frequency); /** -* @brief Gets the max speed (Mbps). -* @param[in] profile The handle of profile -* @param[out] max_speed The max speed -* @return 0 on success, otherwise negative error value. -* @retval #CONNECTION_ERROR_NONE Successful -* @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @brief Gets the max speed (Mbps). + * @since_tizen 2.3 + * @param[in] profile The profile handle + * @param[out] max_speed The max speed + * @return @c 0 on success, otherwise a negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported */ int connection_profile_get_wifi_max_speed(connection_profile_h profile, int* max_speed); /** -* @brief Gets the security mode of Wi-Fi. -* @param[in] profile The handle of profile -* @param[out] type The type of Wi-Fi security -* @return 0 on success, otherwise negative error value. -* @retval #CONNECTION_ERROR_NONE Successful -* @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed + * @brief Gets the security mode of Wi-Fi. + * @since_tizen 2.3 + * @param[in] profile The profile handle + * @param[out] type The type of Wi-Fi security + * @return @c 0 on success, otherwise a negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed + * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported */ int connection_profile_get_wifi_security_type(connection_profile_h profile, connection_wifi_security_type_e* type); /** -* @brief Gets the security mode of Wi-Fi. -* @param[in] profile The handle of profile -* @param[out] type The type of Wi-Fi security -* @return 0 on success, otherwise negative error value. -* @retval #CONNECTION_ERROR_NONE Successful -* @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed + * @brief Gets the security mode of Wi-Fi. + * @since_tizen 2.3 + * @param[in] profile The profile handle + * @param[out] type The type of Wi-Fi security + * @return @c 0 on success, otherwise a negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed + * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported */ int connection_profile_get_wifi_encryption_type(connection_profile_h profile, connection_wifi_encryption_type_e* type); /** -* @brief Checks whether passphrase is required. -* @remarks This function is not valid if security type is #WIFI_SECURITY_TYPE_EAP. -* @param[in] profile The handle of profile -* @param[out] required Indicates whether passphrase is required or not -* @return 0 on success, otherwise negative error value. -* @retval #CONNECTION_ERROR_NONE Successful -* @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @brief Checks whether passphrase is required. + * @since_tizen 2.3 + * @remarks This function is not valid if security type is #CONNECTION_WIFI_SECURITY_TYPE_EAP. + * @param[in] profile The profile handle + * @param[out] required @c true if a passphrase is required, otherwise @c false if a passphrase is not required. + * @return @c 0 on success, otherwise a negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported */ int connection_profile_is_wifi_passphrase_required(connection_profile_h profile, bool* required); /** -* @brief Sets the passphrase of Wi-Fi WPA. -* @param[in] profile The handle of profile -* @param[in] passphrase The passphrase of Wi-Fi security -* @return 0 on success, otherwise negative error value. -* @retval #CONNECTION_ERROR_NONE Successful -* @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter -* @see connection_update_profile() + * @brief Sets the passphrase of the Wi-Fi WPA. + * @since_tizen 2.3 + * @param[in] profile The profile handle + * @param[in] passphrase The passphrase of Wi-Fi security + * @return @c 0 on success, otherwise a negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported + * @see connection_update_profile() */ int connection_profile_set_wifi_passphrase(connection_profile_h profile, const char* passphrase); /** -* @brief Checks whether WPS(Wi-Fi Protected Setup) is supported. -* @remarks If WPS is supported, you can connect access point with WPS by wifi_connect_with_wps(). -* @param[in] profile The handle of profile -* @param[out] supported Indicates whether WPS is supported or not -* @return 0 on success, otherwise negative error value. -* @retval #CONNECTION_ERROR_NONE Successful -* @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @brief Checks whether the WPS (Wi-Fi Protected Setup) is supported. + * @since_tizen 2.3 + * @remarks If WPS is supported, you can connect the access point with WPS by wifi_connect_with_wps(). + * @param[in] profile The profile handle + * @param[out] supported @c true if WPS is supported, otherwise @c false if WPS is not supported. + * @return @c 0 on success, otherwise negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported */ int connection_profile_is_wifi_wps_supported(connection_profile_h profile, bool* supported); @@ -654,108 +729,162 @@ int connection_profile_is_wifi_wps_supported(connection_profile_h profile, bool* int connection_profile_get_cellular_network_type(connection_profile_h profile, connection_cellular_network_type_e* type); /** -* @brief Gets the service type. -* @param[in] profile The handle of profile -* @param[out] type The type of cellular service -* @return 0 on success, otherwise negative error value. -* @retval #CONNECTION_ERROR_NONE Successful -* @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed + * @brief Gets the service type. + * @since_tizen 2.3 + * @param[in] profile The profile handle + * @param[out] type The type of the cellular service + * @return @c 0 on success, otherwise a negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed + * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported */ int connection_profile_get_cellular_service_type(connection_profile_h profile, connection_cellular_service_type_e* type); /** -* @brief Gets the APN(access point name). -* @remarks @a apn must be released with free() by you. -* @param[in] profile The handle of profile -* @param[out] apn The name of APN -* @return 0 on success, otherwise negative error value. -* @retval #CONNECTION_ERROR_NONE Successful -* @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory + * @brief Gets the APN (access point name). + * @since_tizen 2.3 + * @remarks You must release @a apn using free(). + * @param[in] profile The profile handle + * @param[out] apn The name of the APN + * @return @c 0 on success, otherwise a negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory + * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported */ int connection_profile_get_cellular_apn(connection_profile_h profile, char** apn); /** -* @brief Gets the authentication information. -* @remarks @a user_name and @a password must be released with free() by you. -* @param[in] profile The handle of profile -* @param[out] type The type of authentication -* @param[out] user_name The user name -* @param[out] password The password -* @return 0 on success, otherwise negative error value. -* @retval #CONNECTION_ERROR_NONE Successful -* @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory -* @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed + * @brief Gets the authentication information. + * @since_tizen 2.3 + * @remarks You must release @a user_name and @a password using free(). + * @param[in] profile The profile handle + * @param[out] type The type of the authentication + * @param[out] user_name The user name + * @param[out] password The password + * @return @c 0 on success, otherwise a negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory + * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed + * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported */ int connection_profile_get_cellular_auth_info(connection_profile_h profile, connection_cellular_auth_type_e* type, char** user_name, char** password); /** -* @brief Gets the home URL. -* @remarks @a home_url must be released with free() by you. -* @param[in] profile The handle of profile -* @param[out] home_url The home URL -* @return 0 on success, otherwise negative error value. -* @retval #CONNECTION_ERROR_NONE Successful -* @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter -* @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory + * @brief Gets the home URL. + * @since_tizen 2.3 + * @remarks You must release @a home_url using free(). + * @param[in] profile The profile handle + * @param[out] home_url The home URL + * @return @c 0 on success, otherwise a negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory + * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported */ int connection_profile_get_cellular_home_url(connection_profile_h profile, char** home_url); /** -* @brief Gets the state of roaming. -* @param[in] profile The handle of profile -* @param[out] is_roaming Indicates whether cellular is in roaming or not -* @return 0 on success, otherwise negative error value. -* @retval #CONNECTION_ERROR_NONE Successful -* @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @brief Checks wheter the connection is in roaming state. + * @since_tizen 2.3 + * @param[in] profile The profile handle + * @param[out] is_roaming @c true if the cellular is roaming, otherwise @c false if it is not roaming. + * @return @c 0 on success, otherwise a negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported */ int connection_profile_is_cellular_roaming(connection_profile_h profile, bool* is_roaming); /** -* @brief Sets the service type. -* @param[in] profile The handle of profile -* @param[out] type The type of cellular service -* @return 0 on success, otherwise negative error value. -* @retval #CONNECTION_ERROR_NONE Successful -* @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter -* @see connection_update_profile() + * @brief Checks whether the profile is hidden. + * @since_tizen 2.3 + * @param[in] profile The profile handle + * @param[out] is_hidden @c ture if the profile is in hidden, otherwise @c false if the profile is not hidden. + * @return @c 0 on success, otherwise a negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported +*/ +int connection_profile_is_cellular_hidden(connection_profile_h profile, bool* is_hidden); + +/** + * @brief Checks whether the profile is editable. + * @since_tizen 2.3 + * @param[in] profile The profile handle + * @param[out] is_editable @c true if the profile is editable, otherwise @c false if the profile is not editable. + * @return @c 0 on success, otherwise a negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported +*/ +int connection_profile_is_cellular_editable(connection_profile_h profile, bool* is_editable); + +/** + * @brief Checks whether the profile is default. + * @since_tizen 2.3 + * @param[in] profile The profile handle + * @param[out] is_default @c true if the profile is default, otherwise @c false if the profile is not default. + * @return @c 0 on success, otherwise a negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported +*/ +int connection_profile_is_cellular_default(connection_profile_h profile, bool* is_default); + +/** + * @brief Sets the service type. + * @since_tizen 2.3 + * @param[in] profile The profile handle + * @param[in] service_type The type of cellular service + * @return @c 0 on success, otherwise a negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported + * @see connection_update_profile() */ int connection_profile_set_cellular_service_type(connection_profile_h profile, connection_cellular_service_type_e service_type); /** -* @brief Sets the APN(Access Point Name). -* @param[in] profile The handle of profile -* @param[out] apn The name of APN -* @return 0 on success, otherwise negative error value. -* @retval #CONNECTION_ERROR_NONE Successful -* @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter -* @see connection_update_profile() + * @brief Sets the APN (Access Point Name). + * @since_tizen 2.3 + * @param[in] profile The profile handle + * @param[in] apn The name of APN + * @return @c 0 on success, otherwise a negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported + * @see connection_update_profile() */ int connection_profile_set_cellular_apn(connection_profile_h profile, const char* apn); /** -* @brief Sets the Athentication information. -* @param[in] profile The handle of profile -* @param[out] type The type of authentication -* @param[out] user_name The user name -* @param[out] password The password -* @return 0 on success, otherwise negative error value. -* @retval #CONNECTION_ERROR_NONE Successful -* @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter -* @see connection_update_profile() + * @brief Sets the Authentication information. + * @since_tizen 2.3 + * @param[in] profile The profile handle + * @param[in] type The type of the authentication + * @param[in] user_name The user name + * @param[in] password The password + * @return @c 0 on success, otherwise a negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported + * @see connection_update_profile() */ int connection_profile_set_cellular_auth_info(connection_profile_h profile, connection_cellular_auth_type_e type, const char* user_name, const char* password); /** -* @brief Sets the home URL. -* @param[in] profile The handle of profile -* @param[out] home_url The home URL -* @return 0 on success, otherwise negative error value. -* @retval #CONNECTION_ERROR_NONE Successful -* @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter -* @see connection_update_profile() + * @brief Sets the home URL. + * @since_tizen 2.3 + * @param[in] profile The profile handle + * @param[in] home_url The home URL + * @return @c 0 on success, otherwise a negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported + * @see connection_update_profile() */ int connection_profile_set_cellular_home_url(connection_profile_h profile, const char* home_url); diff --git a/include/net_connection.h b/include/net_connection.h old mode 100644 new mode 100755 index c144c45..964f21a --- a/include/net_connection.h +++ b/include/net_connection.h @@ -24,22 +24,29 @@ extern "C" { #endif /* __cplusplus */ /** + * @file net_connection.h + */ + +/** * @addtogroup CAPI_NETWORK_CONNECTION_MANAGER_MODULE * @{ */ /** - * @brief The connection handle for all connection functions. + * @brief The connection handle. + * @since_tizen 2.3 */ typedef void* connection_h; /** - * @brief The iterator handle for profiles. + * @brief The profiles iterator handle. + * @since_tizen 2.3 */ typedef void* connection_profile_iterator_h; /** - * @brief Enumerations of connection type. + * @brief Enumeration for connection type. + * @since_tizen 2.3 */ typedef enum { @@ -51,7 +58,8 @@ typedef enum } connection_type_e; /** - * @brief Enumerations of cellular network state. + * @brief Enumeration for cellular network state. + * @since_tizen 2.3 */ typedef enum { @@ -64,7 +72,8 @@ typedef enum } connection_cellular_state_e; /** - * @brief This enumeration defines the Wi-Fi state. + * @brief Enumeration for Wi-Fi state. + * @since_tizen 2.3 */ typedef enum { @@ -74,17 +83,20 @@ typedef enum } connection_wifi_state_e; /** - * @brief This enumeration defines the ethernet state. + * @internal + * @brief Enumeration for ethernet state. + * @since_tizen 2.3 */ typedef enum { - CONNECTION_ETHERNET_STATE_DEACTIVATED = 0, /**< There is no Ethernet profile to open */ - CONNECTION_ETHERNET_STATE_DISCONNECTED = 1, /**< Disconnected */ - CONNECTION_ETHERNET_STATE_CONNECTED = 2, /**< Connected */ + CONNECTION_ETHERNET_STATE_DEACTIVATED = 0, /**< @internal There is no Ethernet profile to open */ + CONNECTION_ETHERNET_STATE_DISCONNECTED = 1, /**< @internal Disconnected */ + CONNECTION_ETHERNET_STATE_CONNECTED = 2, /**< @internal Connected */ } connection_ethernet_state_e; /** - * @brief This enumeration defines the Bluetooth state. + * @brief Enumeration for Bluetooth state. + * @since_tizen 2.3 */ typedef enum { @@ -94,16 +106,29 @@ typedef enum } connection_bt_state_e; /** - * @brief This enumeration defines the type of connection iterator. + * @brief Enumeration for connection iterator type. + * @since_tizen 2.3 */ typedef enum { - CONNECTION_ITERATOR_TYPE_REGISTERED = 0, /**< The iterator of registered profile */ - CONNECTION_ITERATOR_TYPE_CONNECTED = 1, /**< The iterator of connected profile */ + CONNECTION_ITERATOR_TYPE_REGISTERED = 0, /**< The iterator of the registered profile */ + CONNECTION_ITERATOR_TYPE_CONNECTED = 1, /**< The iterator of the connected profile */ + CONNECTION_ITERATOR_TYPE_DEFAULT = 2, /**< The iterator of the default profile */ } connection_iterator_type_e; /** - * @brief Enumerations of connection errors. + * @brief Enumeration for reset profile type. + * @since_tizen 2.3 +*/ +typedef enum +{ + CONNECTION_RESET_DEFAULT_PROFILE = 0, /**< Initialized with the default profile defined by csc */ + CONNECTION_RESET_CLEAR_PROFILE = 1, /**< Remove all profiles */ +} connection_reset_option_e; + +/** + * @brief Enumeration for connection errors. + * @since_tizen 2.3 */ typedef enum { @@ -112,15 +137,17 @@ typedef enum CONNECTION_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory error */ CONNECTION_ERROR_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION, /**< Invalid Operation */ CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED = TIZEN_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED, /**< Address family not supported */ - CONNECTION_ERROR_OPERATION_FAILED = TIZEN_ERROR_NETWORK_CLASS|0x0401, /**< Operation failed */ - CONNECTION_ERROR_ITERATOR_END = TIZEN_ERROR_NETWORK_CLASS|0x0402, /**< End of iteration */ - CONNECTION_ERROR_NO_CONNECTION = TIZEN_ERROR_NETWORK_CLASS|0x0403, /**< There is no connection */ + CONNECTION_ERROR_OPERATION_FAILED = TIZEN_ERROR_CONNECTION|0x0401, /**< Operation failed */ + CONNECTION_ERROR_ITERATOR_END = TIZEN_ERROR_CONNECTION|0x0402, /**< End of iteration */ + CONNECTION_ERROR_NO_CONNECTION = TIZEN_ERROR_CONNECTION|0x0403, /**< There is no connection */ CONNECTION_ERROR_NOW_IN_PROGRESS = TIZEN_ERROR_NOW_IN_PROGRESS, /** Now in progress */ - CONNECTION_ERROR_ALREADY_EXISTS = TIZEN_ERROR_NETWORK_CLASS|0x0404, /**< Already exists */ - CONNECTION_ERROR_OPERATION_ABORTED = TIZEN_ERROR_NETWORK_CLASS|0x0405, /**< Operation is aborted */ - CONNECTION_ERROR_DHCP_FAILED = TIZEN_ERROR_NETWORK_CLASS|0x0406, /**< DHCP failed */ - CONNECTION_ERROR_INVALID_KEY = TIZEN_ERROR_NETWORK_CLASS|0x0407, /**< Invalid key */ - CONNECTION_ERROR_NO_REPLY = TIZEN_ERROR_NETWORK_CLASS|0x0408, /**< No reply */ + CONNECTION_ERROR_ALREADY_EXISTS = TIZEN_ERROR_CONNECTION|0x0404, /**< Already exists */ + CONNECTION_ERROR_OPERATION_ABORTED = TIZEN_ERROR_CONNECTION|0x0405, /**< Operation is aborted */ + CONNECTION_ERROR_DHCP_FAILED = TIZEN_ERROR_CONNECTION|0x0406, /**< DHCP failed */ + CONNECTION_ERROR_INVALID_KEY = TIZEN_ERROR_CONNECTION|0x0407, /**< Invalid key */ + CONNECTION_ERROR_NO_REPLY = TIZEN_ERROR_CONNECTION|0x0408, /**< No reply */ + CONNECTION_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */ + CONNECTION_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED /**< Not Supported */ } connection_error_e; /** @@ -133,7 +160,8 @@ typedef enum */ /** - * @brief Enumerations of statistics type. + * @brief Enumeration for statistics type. + * @since_tizen 2.3 */ typedef enum { @@ -155,9 +183,12 @@ typedef enum /** * @brief Creates a handle for managing data connections. - * @remarks @a handle must be released with connection_destroy(). - * @param[out] connection The handle of the connection - * @return 0 on success, otherwise negative error value. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/network.get + * @remarks You must release @a handle using connection_destroy(). + * @param[out] connection The connection handle + * @return @c 0 on success, otherwise a negative error value * @retval #CONNECTION_ERROR_NONE Successful * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory @@ -167,8 +198,9 @@ int connection_create(connection_h* connection); /** * @brief Destroys the connection handle. - * @param[in] connection The handle of the connection - * @return 0 on success, otherwise negative error value. + * @since_tizen 2.3 + * @param[in] connection The connection handle + * @return @c 0 on success, otherwise negative error value * @retval #CONNECTION_ERROR_NONE Successful * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter * @see connection_create() @@ -176,16 +208,18 @@ int connection_create(connection_h* connection); int connection_destroy(connection_h connection); /** - * @brief Called when the type of connection is changed. - * @param[in] type The type of current network connection + * @brief Called when the type of a connection is changed. + * @since_tizen 2.3 + * @param[in] type The type of the current network connection * @param[in] user_data The user data passed from the callback registration function - * @see connection_set_network_type_changed_cb() - * @see connection_unset_network_type_changed_cb() + * @see connection_set_type_changed_cb() + * @see connection_unset_type_changed_cb() */ typedef void(*connection_type_changed_cb)(connection_type_e type, void* user_data); /** * @brief Called when the address is changed. + * @since_tizen 2.3 * @param[in] ipv4_address The IP address for IPv4 * @param[in] ipv6_address The IP address for IPv6 * @param[in] user_data The user data passed from the callback registration function @@ -197,19 +231,21 @@ typedef void(*connection_type_changed_cb)(connection_type_e type, void* user_dat typedef void(*connection_address_changed_cb)(const char* ipv4_address, const char* ipv6_address, void* user_data); /** -* @brief Called after connection_set_default_cellular_service_profile_async() is completed. -* @param[in] result The result -* @param[in] user_data The user data passed from connection_open_profile() -* @pre connection_set_default_cellular_service_profile_async() will invoke this callback function. -* @see connection_set_default_cellular_service_profile_async() + * @brief Called when connection_set_default_cellular_service_profile_async() finishes. + * @since_tizen 2.3 + * @param[in] result The result + * @param[in] user_data The user data passed from connection_open_profile() + * @pre connection_set_default_cellular_service_profile_async() will invoke this callback function. + * @see connection_set_default_cellular_service_profile_async() */ typedef void(*connection_set_default_cb)(connection_error_e result, void* user_data); /** * @brief Gets the type of the current profile for data connection. - * @param[in] connection The handle of the connection - * @param[out] state The state of network - * @return 0 on success, otherwise negative error value. + * @since_tizen 2.3 + * @param[in] connection The connection handle + * @param[out] type The type of the network + * @return @c 0 on success, otherwise negative error value * @retval #CONNECTION_ERROR_NONE Successful * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed @@ -218,11 +254,12 @@ int connection_get_type(connection_h connection, connection_type_e* type); /** * @brief Gets the IP address of the current connection. - * @remarks @a ip_address must be released with free() by you. - * @param[in] connection The handle of the connection + * @since_tizen 2.3 + * @remarks You must release @a ip_address using free(). + * @param[in] connection The connection handle * @param[in] address_family The address family - * @param[out] ip_address The pointer to IP address string. - * @return 0 on success, otherwise negative error value. + * @param[out] ip_address The pointer to the IP address string + * @return @c 0 on success, otherwise a negative error value * @retval #CONNECTION_ERROR_NONE Successful * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed @@ -232,11 +269,12 @@ int connection_get_ip_address(connection_h connection, connection_address_family /** * @brief Gets the proxy address of the current connection. - * @remarks @a proxy must be released with free() by you. - * @param[in] connection The handle of the connection + * @since_tizen 2.3 + * @remarks You must release @a proxy using free(). + * @param[in] connection The connection handle * @param[in] address_family The address family * @param[out] proxy The proxy address - * @return 0 on success, otherwise negative error value. + * @return @c 0 on success, otherwise a negative error value * @retval #CONNECTION_ERROR_NONE Successful * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed @@ -245,59 +283,78 @@ int connection_get_ip_address(connection_h connection, connection_address_family int connection_get_proxy(connection_h connection, connection_address_family_e address_family, char** proxy); /** - * @brief Gets the state of celluar connection. + * @brief Gets the state of cellular connection. * @details The returned state is for the cellular connection state. - * @param[in] connection The handle of connection - * @param[out] state The state of cellular connection - * @return 0 on success, otherwise negative error value. + * @since_tizen 2.3 + * @param[in] connection The connection handle + * @param[out] state The state of the cellular connection + * @return @c 0 on success, otherwise a negative error value * @retval #CONNECTION_ERROR_NONE Successful * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed + * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported */ int connection_get_cellular_state(connection_h connection, connection_cellular_state_e* state); /** - * @brief Gets the state of Wi-Fi. + * @brief Gets the state of the Wi-Fi. * @details The returned state is for the Wi-Fi connection state. - * @param[in] connection The handle of connection + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/network.get + * @param[in] connection The connection handle * @param[out] state The state of Wi-Fi connection - * @return 0 on success, otherwise negative error value. + * @return @c 0 on success, otherwise a negative error value * @retval #CONNECTION_ERROR_NONE Successful * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed + * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied + * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported */ int connection_get_wifi_state(connection_h connection, connection_wifi_state_e* state); /** - * @brief Gets the state of ethernet. - * @details The returned state is for the ethernet connection state. - * @param[in] connection The handle of connection + * @internal + * @brief Gets the state of the Ethernet. + * @details The returned state is for the Ethernet connection state. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/network.get + * @param[in] connection The connection handle * @param[out] state The state of Ethernet connection - * @return 0 on success, otherwise negative error value. + * @return @c 0 on success, otherwise a negative error value * @retval #CONNECTION_ERROR_NONE Successful * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed + * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied + * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported */ int connection_get_ethernet_state(connection_h connection, connection_ethernet_state_e* state); /** - * @brief Gets the state of Bluetooth. + * @brief Gets the state of the Bluetooth. * @details The returned state is for the Bluetooth connection state. - * @param[in] connection The handle of connection - * @param[out] state The state of Ethernet connection - * @return 0 on success, otherwise negative error value. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/network.get + * @param[in] connection The connection handle + * @param[out] state The state of the Bluetooth connection + * @return @c 0 on success, otherwise a negative error value * @retval #CONNECTION_ERROR_NONE Successful * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed + * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied + * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported */ int connection_get_bt_state(connection_h connection, connection_bt_state_e* state); /** - * @brief Registers the callback called when the type of current connection is changed. - * @param[in] connection The handle of connection + * @brief Registers the callback that is called when the type of the current connection is changed. + * @since_tizen 2.3 + * @param[in] connection The connection handle * @param[in] callback The callback function to be called * @param[in] user_data The user data passed to the callback function - * @return 0 on success, otherwise negative error value. + * @return @c 0 on success, otherwise a negative error value * @retval #CONNECTION_ERROR_NONE Successful * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed @@ -305,9 +362,10 @@ int connection_get_bt_state(connection_h connection, connection_bt_state_e* stat int connection_set_type_changed_cb(connection_h connection, connection_type_changed_cb callback, void* user_data); /** - * @brief Unregisters the callback called when the type of current connection is changed. - * @param[in] connection The handle of connection - * @return 0 on success, otherwise negative error value. + * @brief Unregisters the callback that is called when the type of current connection is changed. + * @since_tizen 2.3 + * @param[in] connection The connection handle + * @return @c 0 on success, otherwise a negative error value * @retval #CONNECTION_ERROR_NONE Successful * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed @@ -315,11 +373,12 @@ int connection_set_type_changed_cb(connection_h connection, connection_type_chan int connection_unset_type_changed_cb(connection_h connection); /** - * @brief Registers the callback called when the IP address is changed. - * @param[in] connection The handle of connection + * @brief Registers the callback that is called when the IP address is changed. + * @since_tizen 2.3 + * @param[in] connection The connection handle * @param[in] callback The callback function to be called * @param[in] user_data The user data passed to the callback function - * @return 0 on success, otherwise negative error value. + * @return @c 0 on success, otherwise a negative error value * @retval #CONNECTION_ERROR_NONE Successful * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed @@ -327,9 +386,10 @@ int connection_unset_type_changed_cb(connection_h connection); int connection_set_ip_address_changed_cb(connection_h connection, connection_address_changed_cb callback, void* user_data); /** - * @brief Unregisters the callback called when the IP address is changed. - * @param[in] connection The handle of connection - * @return 0 on success, otherwise negative error value. + * @brief Unregisters the callback that is called when the IP address is changed. + * @since_tizen 2.3 + * @param[in] connection The connection handle + * @return @c 0 on success, otherwise a negative error value * @retval #CONNECTION_ERROR_NONE Successful * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed @@ -337,11 +397,12 @@ int connection_set_ip_address_changed_cb(connection_h connection, connection_add int connection_unset_ip_address_changed_cb(connection_h connection); /** - * @brief Registers the callback called when the proxy address is changed. - * @param[in] connection The handle of connection + * @brief Registers the callback that is called when the proxy address is changed. + * @since_tizen 2.3 + * @param[in] connection The connection handle * @param[in] callback The callback function to be called * @param[in] user_data The user data passed to the callback function - * @return 0 on success, otherwise negative error value. + * @return @c 0 on success, otherwise a negative error value * @retval #CONNECTION_ERROR_NONE Successful * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed @@ -349,9 +410,10 @@ int connection_unset_ip_address_changed_cb(connection_h connection); int connection_set_proxy_address_changed_cb(connection_h connection, connection_address_changed_cb callback, void* user_data); /** - * @brief Unregisters the callback called when the proxy address is changed. - * @param[in] connection The handle of connection - * @return 0 on success, otherwise negative error value. + * @brief Unregisters the callback that is called when the proxy address is changed. + * @since_tizen 2.3 + * @param[in] connection The connection handle + * @return @c 0 on success, otherwise a negative error value * @retval #CONNECTION_ERROR_NONE Successful * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed @@ -359,62 +421,88 @@ int connection_set_proxy_address_changed_cb(connection_h connection, connection_ int connection_unset_proxy_address_changed_cb(connection_h connection); /** - * @brief Adds new profile which is created by connection_profile_created(). - * @remarks You can only add a profile of cellular type. - * @param[in] connection The handle of connection - * @param[in] profile The handle of profile - * @return 0 on success, otherwise negative error value. + * @brief Adds a new profile which is created by connection_profile_create(). + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/network.profile \n + * %http://tizen.org/privilege/network.get + * @remarks You can only add a profile of the cellular type. \n + * This API needs both privileges. + * @param[in] connection The connection handle + * @param[in] profile The profile handle + * @return @c 0 on success, otherwise a negative error value * @retval #CONNECTION_ERROR_NONE Successful * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed + * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied + * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported */ int connection_add_profile(connection_h connection, connection_profile_h profile); /** - * @brief Removes existing profile. - * @param[in] connection The handle of connection - * @param[in] profile The handle of profile - * @return 0 on success, otherwise negative error value. + * @brief Removes an existing profile. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/network.profile \n + * %http://tizen.org/privilege/network.get + * @remarks This API needs both privileges. + * @param[in] connection The connection handle + * @param[in] profile The profile handle + * @return @c 0 on success, otherwise a negative error value * @retval #CONNECTION_ERROR_NONE Successful * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed + * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied + * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported */ int connection_remove_profile(connection_h connection, connection_profile_h profile); /** - * @brief Updates existing profile. - * @details If you change somethings of a profile, this changes will be not applied to the Connection Manager immediately. + * @brief Updates an existing profile. + * @details When a profile is changed, these changes will be not applied to the Connection Manager immediately. * When you call this function, your changes affect the Connection Manager and the existing profile is updated. * In addition, the existing profile will be updated if you call connection_open_profile(). - * @param[in] connection The handle of connection - * @param[in] profile The handle of profile - * @return 0 on success, otherwise negative error value. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/network.profile \n + * %http://tizen.org/privilege/network.get + * @remarks This API needs both privileges. + * @param[in] connection The connection handle + * @param[in] profile The profile handle + * @return @c 0 on success, otherwise a negative error value * @retval #CONNECTION_ERROR_NONE Successful * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed + * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied + * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported * @see connection_open_profile() */ int connection_update_profile(connection_h connection, connection_profile_h profile); /** - * @brief Gets a iterator of the profiles. - * @remarks @a profile_iterator must be released with connection_destroy_profile_iterator(). - * @param[in] connection The handle of connection - * @param[in] type The type of connetion iterator + * @brief Gets a profiles iterator. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/network.get + * @remarks You must release @a profile_iterator using connection_destroy(). + * @param[in] connection The connection handle + * @param[in] type The type of the connetion iterator * @param[out] profile_iterator The iterator of profile - * @return 0 on success, otherwise negative error value. + * @return @c 0 on success, otherwise a negative error value * @retval #CONNECTION_ERROR_NONE Successful * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed + * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied */ int connection_get_profile_iterator(connection_h connection, connection_iterator_type_e type, connection_profile_iterator_h* profile_iterator); /** * @brief Moves the profile iterator to the next position and gets a profile handle. + * @since_tizen 2.3 * @param[in] profile_iterator The iterator of profile - * @param[out] profile The handle of profile - * @return 0 on success, otherwise negative error value. + * @param[out] profile The profile handle + * @return @c 0 on success, otherwise a negative error value * @retval #CONNECTION_ERROR_NONE Successful * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter * @retval #CONNECTION_ERROR_ITERATOR_END End of iteration @@ -422,106 +510,150 @@ int connection_get_profile_iterator(connection_h connection, connection_iterator int connection_profile_iterator_next(connection_profile_iterator_h profile_iterator, connection_profile_h* profile); /** - * @brief Checks whether the next element of profile iterator exists or not. + * @brief Checks whether the next element of a profile iterator exists or not. + * @since_tizen 2.3 + * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section. * @param[in] profile_iterator The iterator of profile - * @return @c true if next element exists, \n @c false if next element doesn't exist + * @return @c true if next element exists, otherwise @c false if next element doesn't exist */ bool connection_profile_iterator_has_next(connection_profile_iterator_h profile_iterator); /** - * @brief Destroys a iterator of the profiles. - * @param[in] profile_iterator The iterator of profile - * @return 0 on success, otherwise negative error value. + * @brief Destroys a profiles iterator. + * @since_tizen 2.3 + * @param[in] profile_iterator The iterator of the profile + * @return @c 0 on success, otherwise a negative error value * @retval #CONNECTION_ERROR_NONE Successful * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter */ int connection_destroy_profile_iterator(connection_profile_iterator_h profile_iterator); /** - * @brief Gets the name of default profile. - * @remarks @a profile must be released with connection_profile_destroy(). - * @param[in] connection The handle of connection - * @param[out] profile The handle of profile - * @return 0 on success, otherwise negative error value. + * @brief Gets the name of the default profile. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/network.get + * @remarks You must release @a profile using connection_profile_destroy(). + * @param[in] connection The connection handle + * @param[out] profile The profile handle + * @return @c 0 on success, otherwise a negative error value * @retval #CONNECTION_ERROR_NONE Successful * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed * @retval #CONNECTION_ERROR_NO_CONNECTION There is no connection + * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied */ int connection_get_current_profile(connection_h connection, connection_profile_h* profile); /** * @brief Gets the default profile which provides the given cellular service. - * @remarks @a profile must be released with connection_profile_destroy(). - * @param[in] connection The handle of connection - * @param[in] type The type of cellular service. #CONNECTION_CELLULAR_SERVICE_TYPE_APPLICATION is not permitted - * @param[out] profile The handle of profile - * @return 0 on success, otherwise negative error value. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/network.get + * @remarks You must release @a profile using connection_profile_destroy(). + * @param[in] connection The connection handle + * @param[in] type The type of cellular service \n + * #CONNECTION_CELLULAR_SERVICE_TYPE_APPLICATION is not permitted. + * @param[out] profile The profile handle + * @return @c 0 on success, otherwise a negative error value * @retval #CONNECTION_ERROR_NONE Successful * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed + * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denieda + * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported */ int connection_get_default_cellular_service_profile(connection_h connection, connection_cellular_service_type_e type, connection_profile_h* profile); /** * @brief Sets the default profile which provides the given cellular service. - * @param[in] connection The handle of connection - * @param[in] type The type of cellular service. - * #CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET and #CONNECTION_CELLULAR_SERVICE_TYPE_PREPAID_INTERNET are only permitted. - * @param[in] profile The handle of profile - * @return 0 on success, otherwise negative error value. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/network.profile \n + * %http://tizen.org/privilege/network.get + * @remarks This API needs both privileges. + * @param[in] connection The connection handle + * @param[in] type The type of cellular service \n + * only #CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET and #CONNECTION_CELLULAR_SERVICE_TYPE_PREPAID_INTERNET are permitted. + * @param[in] profile The profile handle + * @return @c 0 on success, otherwise a negative error value * @retval #CONNECTION_ERROR_NONE Successful * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed + * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied + * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported */ int connection_set_default_cellular_service_profile(connection_h connection, connection_cellular_service_type_e type, connection_profile_h profile); /** * @brief Sets the default profile which provides the given cellular service, asynchronously. - * @param[in] connection The handle of connection - * @param[in] type The type of cellular service. - * #CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET and #CONNECTION_CELLULAR_SERVICE_TYPE_PREPAID_INTERNET are only permitted. - * @param[in] profile The handle of profile + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/network.profile \n + * %http://tizen.org/privilege/network.get + * @remarks This API needs both privileges. + * @param[in] connection The connection handle + * @param[in] type The type of cellular service (only #CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET and #CONNECTION_CELLULAR_SERVICE_TYPE_PREPAID_INTERNET are permitted) + * @param[in] profile The profile handle * @param[in] callback The callback function to be called * @param[in] user_data The user data passed to the callback function - * @return 0 on success, otherwise negative error value. + * @return @c 0 on success, otherwise negative error value * @retval #CONNECTION_ERROR_NONE Successful * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed + * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied + * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported */ int connection_set_default_cellular_service_profile_async(connection_h connection, connection_cellular_service_type_e type, connection_profile_h profile, connection_set_default_cb callback, void* user_data); /** -* @brief Called after connection_open_profile() is completed. -* @param[in] result The result -* @param[in] user_data The user data passed from connection_open_profile() -* @pre connection_open_profile() will invoke this callback function. -* @see connection_open_profile() + * @brief Called after connection_open_profile() is finished. + * @since_tizen 2.3 + * @param[in] result The result + * @param[in] user_data The user data passed from connection_open_profile() + * @pre connection_open_profile() will invoke this callback function. + * @see connection_open_profile() */ typedef void(*connection_opened_cb)(connection_error_e result, void* user_data); /** -* @brief Called after connection_close_profile() is completed. -* @param[in] result The result -* @param[in] user_data The user data passed from connection_close_profile() -* @pre connection_close_profile() will invoke this callback function. -* @see connection_close_profile() + * @brief Called after connection_close_profile() is finished. + * @since_tizen 2.3 + * @param[in] result The result + * @param[in] user_data The user data passed from connection_close_profile() + * @pre connection_close_profile() will invoke this callback function. + * @see connection_close_profile() */ typedef void(*connection_closed_cb)(connection_error_e result, void* user_data); /** + * @brief Called after connection_reset_profile() is finished. + * @since_tizen 2.3 + * @param[in] result The result + * @param[in] user_data The user data passed from connection_reset_profile() + * @pre connection_reset_profile() will invoke this callback function. + * @see connection_reset_profile() +*/ +typedef void(*connection_reset_cb)(connection_error_e result, void* user_data); + +/** * @brief Opens a connection of profile, asynchronously. - * @param[in] connection The handle of connection - * @param[in] profile The handle of profile + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/network.set \n + * %http://tizen.org/privilege/network.get + * @remarks This API needs both privileges. + * @param[in] connection The connection handle + * @param[in] profile The profile handle * @param[in] callback The callback function to be called * @param[in] user_data The user data passed to the callback function - * @return 0 on success, otherwise negative error value. + * @return @c 0 on success, otherwise negative error value * @retval #CONNECTION_ERROR_NONE Successful * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed + * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied * @post connection_opened_cb() will be invoked. * @see connection_opened_cb() * @see connection_close_profile() @@ -533,14 +665,20 @@ int connection_open_profile(connection_h connection, connection_profile_h profil /** * @brief Closes a connection of profile. - * @param[in] connection The handle of connection - * @param[in] profile The handle of profile + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/network.set \n + * %http://tizen.org/privilege/network.get + * @remarks This API needs both privileges. + * @param[in] connection The connection handle + * @param[in] profile The profile handle * @param[in] callback The callback function to be called * @param[in] user_data The user data passed to the callback function - * @return 0 on success, otherwise negative error value. + * @return @c 0 on success, otherwise negative error value * @retval #CONNECTION_ERROR_NONE Successful * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed + * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied * @post connection_closed_cb() will be invoked. * @see connection_closed_cb() * @see connection_open_profile() @@ -551,21 +689,70 @@ int connection_open_profile(connection_h connection, connection_profile_h profil int connection_close_profile(connection_h connection, connection_profile_h profile, connection_closed_cb callback, void* user_data); /** - * @brief Add a route to routing table. + * @brief Resets the cellular profile. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/network.profile \n + * %http://tizen.org/privilege/network.get + * @remarks This API needs both privileges. + * @param[in] connection The connection handle + * @param[in] type The type of reset + * @param[in] id The subscriber identity module id to reset (The sim index starts from 0.) + * @param[in] callback The callback function to be called + * @param[in] user_data The user data passed to the callback function + * @return 0 on success, otherwise negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed + * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied + * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported + * @post connection_reset_cb() will be invoked. +*/ +int connection_reset_profile(connection_h connection, connection_reset_option_e type, int id, connection_reset_cb callback, void *user_data); + +/** + * @brief Adds a route to the routing table. * @details You can get the @a interface_name from connection_profile_get_network_interface_name() of opened profile. - * @param[in] connection The handle of connection + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/network.set \n + * %http://tizen.org/privilege/network.get + * @remarks This API needs both privileges. + * @param[in] connection The connection handle * @param[in] interface_name The name of network interface * @param[in] host_address The IP address of the host - * @return 0 on success, otherwise negative error value. + * @return @c 0 on success, otherwise negative error value * @retval #CONNECTION_ERROR_NONE Successful * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter * @retval #CONNECTION_ERROR_ALREADY_EXISTS Already exists * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed + * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied * @see connection_profile_get_network_interface_name() */ int connection_add_route(connection_h connection, const char* interface_name, const char* host_address); /** + * @brief Removes a route from the routing table. + * @details You can get the @a interface_name from connection_profile_get_network_interface_name() of opened profile. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/network.set \n + * %http://tizen.org/privilege/network.get + * @remarks This API needs both privileges. + * @param[in] connection The connection handle + * @param[in] interface_name The name of network interface + * @param[in] host_address The IP address of the host + * @return @c 0 on success, otherwise negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_ALREADY_EXISTS Already exists + * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed + * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied + * @see connection_profile_get_network_interface_name() + */ +int connection_remove_route(connection_h connection, const char* interface_name, const char* host_address); + +/** * @} */ @@ -576,31 +763,43 @@ int connection_add_route(connection_h connection, const char* interface_name, co /** * @brief Gets the statistics information. - * @param[in] connection_type The type of connection. CONNECTION_TYPE_WIFI and CONNECTION_TYPE_CELLULAR are only supported. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/network.get + * @param[in] connection The connection handle + * @param[in] connection_type The type of connection (only CONNECTION_TYPE_WIFI and CONNECTION_TYPE_CELLULAR are supported) * @param[in] statistics_type The type of statistics * @param[out] size The received data size of the last cellular packet data connection (bytes) - * @return 0 on success, otherwise negative error value. + * @return @c 0 on success, otherwise negative error value * @retval #CONNECTION_ERROR_NONE Successful * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed + * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported */ -int connection_get_statistics(connection_type_e connection_type, connection_statistics_type_e statistics_type, long long* size); +int connection_get_statistics(connection_h connection, connection_type_e connection_type, connection_statistics_type_e statistics_type, long long* size); /** - * @brief Resets the statistics information - * @param[in] connection_type The type of connection. CONNECTION_TYPE_WIFI and CONNECTION_TYPE_CELLULAR are only supported. + * @brief Resets the statistics information. + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/network.set \n + * %http://tizen.org/privilege/network.get + * @remarks This API needs both privileges. + * @param[in] connection The connection handle + * @param[in] connection_type The type of connection (only CONNECTION_TYPE_WIFI and CONNECTION_TYPE_CELLULAR are supported) * @param[in] statistics_type The type of statistics - * @return 0 on success, otherwise negative error value. + * @return @c 0 on success, otherwise negative error value * @retval #CONNECTION_ERROR_NONE Successful * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed + * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied + * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported */ -int connection_reset_statistics(connection_type_e connection_type, connection_statistics_type_e statistics_type); +int connection_reset_statistics(connection_h connection, connection_type_e connection_type, connection_statistics_type_e statistics_type); /** * @} - */ - +*/ #ifdef __cplusplus } diff --git a/include/net_connection_private.h b/include/net_connection_private.h index ddfdcd3..c77f537 100644 --- a/include/net_connection_private.h +++ b/include/net_connection_private.h @@ -11,7 +11,7 @@ * 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. */ #ifndef __NET_CONNECTION_PRIVATE_H__ @@ -20,8 +20,13 @@ #include #include #include + #include "net_connection.h" +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + #undef LOG_TAG #define LOG_TAG "CAPI_NETWORK_CONNECTION" @@ -29,6 +34,19 @@ #define CONNECTION_ERROR 2 #define CONNECTION_WARN 3 +typedef enum +{ + FEATURE_TYPE_TELEPHONY = 0, + FEATURE_TYPE_WIFI = 1, + FEATURE_TYPE_TETHERING_BLUETOOTH = 2 +} enable_feature_type_e; + +typedef enum +{ + CONNECTION_CELLULAR_SUBSCRIBER_1 = 0x00, + CONNECTION_CELLULAR_SUBSCRIBER_2 = 0x01, +} connection_cellular_subscriber_id_e; + #define CONNECTION_LOG(log_level, format, args...) \ do { \ switch (log_level) { \ @@ -46,9 +64,24 @@ #define CONNECTION_MUTEX_LOCK _connection_inter_mutex_lock() #define CONNECTION_MUTEX_UNLOCK _connection_inter_mutex_unlock() -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ +#define SECURE_CONNECTION_LOG(log_level, format, args...) \ + do { \ + switch (log_level) { \ + case CONNECTION_ERROR: \ + SECURE_LOGE(format, ## args); \ + break; \ + case CONNECTION_WARN: \ + SECURE_LOGW(format, ## args); \ + break; \ + default: \ + SECURE_LOGI(format, ## args); \ + } \ + } while(0) + +#define VCONF_TELEPHONY_DEFAULT_DATA_SERVICE \ + "db/telephony/dualsim/default_data_service" + +bool _connection_is_created(void); typedef struct _connection_handle_s { @@ -63,9 +96,9 @@ typedef struct _connection_handle_s bool _connection_libnet_init(void); bool _connection_libnet_deinit(void); -bool _connection_libnet_get_wifi_state(connection_wifi_state_e *state); -bool _connection_libnet_get_ethernet_state(connection_ethernet_state_e *state); -bool _connection_libnet_get_bluetooth_state(connection_bt_state_e* state); +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_bluetooth_state(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, @@ -74,6 +107,7 @@ bool _connection_libnet_iterator_has_next(connection_profile_iterator_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); @@ -81,19 +115,30 @@ int _connection_libnet_set_cellular_service_profile_async(connection_cellular_se 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); 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); -void _connection_libnet_remove_from_profile_cb_list(connection_profile_h profile); +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(); + +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(); + +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); void _connection_inter_mutex_lock(void); void _connection_inter_mutex_unlock(void); diff --git a/packaging/capi-network-connection.spec b/packaging/capi-network-connection.spec index 991b828..befb81b 100644 --- a/packaging/capi-network-connection.spec +++ b/packaging/capi-network-connection.spec @@ -1,6 +1,6 @@ Name: capi-network-connection Summary: Network Connection library in TIZEN C API -Version: 0.1.3_18 +Version: 0.1.3_19 Release: 1 Group: System/Network License: Apache-2.0 diff --git a/src/connection.c b/src/connection.c index 899d87f..43b2fe0 100644 --- a/src/connection.c +++ b/src/connection.c @@ -417,14 +417,17 @@ EXPORT_API int connection_get_cellular_state(connection_h connection, connection EXPORT_API int connection_get_wifi_state(connection_h connection, connection_wifi_state_e* state) { + int rv; + if (state == NULL || !(__connection_check_handle_validity(connection))) { CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n"); return CONNECTION_ERROR_INVALID_PARAMETER; } - if (_connection_libnet_get_wifi_state(state) == false) { - CONNECTION_LOG(CONNECTION_ERROR, "Fail to get wifi state\n"); - return CONNECTION_ERROR_OPERATION_FAILED; + rv = _connection_libnet_get_wifi_state(state); + if (rv != CONNECTION_ERROR_NONE) { + CONNECTION_LOG(CONNECTION_ERROR, "Fail to get Wi-Fi state[%d]", rv); + return rv; } CONNECTION_LOG(CONNECTION_INFO, "WiFi state = %d\n", *state); @@ -439,10 +442,7 @@ EXPORT_API int connection_get_ethernet_state(connection_h connection, connection return CONNECTION_ERROR_INVALID_PARAMETER; } - if (_connection_libnet_get_ethernet_state(state) == false) - return CONNECTION_ERROR_OPERATION_FAILED; - - return CONNECTION_ERROR_NONE; + return _connection_libnet_get_ethernet_state(state); } EXPORT_API int connection_get_bt_state(connection_h connection, connection_bt_state_e* state) @@ -452,10 +452,8 @@ EXPORT_API int connection_get_bt_state(connection_h connection, connection_bt_st return CONNECTION_ERROR_INVALID_PARAMETER; } - if (_connection_libnet_get_bluetooth_state(state) == false) - return CONNECTION_ERROR_OPERATION_FAILED; + return _connection_libnet_get_bluetooth_state(state); - return CONNECTION_ERROR_NONE; } EXPORT_API int connection_set_type_changed_cb(connection_h connection, @@ -817,13 +815,15 @@ static int __reset_statistic(connection_type_e connection_type, return CONNECTION_ERROR_NONE; } -EXPORT_API int connection_get_statistics(connection_type_e connection_type, +EXPORT_API int connection_get_statistics(connection_h connection, + connection_type_e connection_type, connection_statistics_type_e statistics_type, long long* size) { return __get_statistic(connection_type, statistics_type, size); } -EXPORT_API int connection_reset_statistics(connection_type_e connection_type, +EXPORT_API int connection_reset_statistics(connection_h connection, + connection_type_e connection_type, connection_statistics_type_e statistics_type) { return __reset_statistic(connection_type, statistics_type); diff --git a/src/connection_profile.c b/src/connection_profile.c index 6d0bfe3..3d30695 100644 --- a/src/connection_profile.c +++ b/src/connection_profile.c @@ -841,7 +841,8 @@ EXPORT_API int connection_profile_unset_state_changed_cb(connection_profile_h pr return CONNECTION_ERROR_INVALID_PARAMETER; } - _connection_libnet_remove_from_profile_cb_list(profile); + if (_connection_libnet_remove_from_profile_cb_list(profile) != true) + return CONNECTION_ERROR_INVALID_PARAMETER; return CONNECTION_ERROR_NONE; } diff --git a/src/libnetwork.c b/src/libnetwork.c index 1a8390d..b63a600 100755 --- a/src/libnetwork.c +++ b/src/libnetwork.c @@ -107,6 +107,10 @@ static const char *__libnet_convert_cp_error_type_to_string(connection_error_e e return "INVALID_KEY"; case CONNECTION_ERROR_NO_REPLY: return "NO_REPLY"; + case CONNECTION_ERROR_PERMISSION_DENIED: + return "PERMISSION_DENIED"; + case CONNECTION_ERROR_NOT_SUPPORTED: + return "NOT_SUPPORTED"; } return "UNKNOWN"; @@ -404,14 +408,16 @@ bool _connection_libnet_check_profile_cb_validity(connection_profile_h profile) } -bool _connection_libnet_get_wifi_state(connection_wifi_state_e *state) +int _connection_libnet_get_wifi_state(connection_wifi_state_e *state) { + int rv; net_wifi_state_t wlan_state; net_profile_name_t profile_name; - if (net_get_wifi_state(&wlan_state, &profile_name) != NET_ERR_NONE) { + rv = net_get_wifi_state(&wlan_state, &profile_name); + if (rv != NET_ERR_NONE) { CONNECTION_LOG(CONNECTION_ERROR, "Error!! net_get_wifi_state() failed.\n"); - return false; + return CONNECTION_ERROR_OPERATION_FAILED; } switch (wlan_state) { @@ -428,20 +434,20 @@ bool _connection_libnet_get_wifi_state(connection_wifi_state_e *state) break; default : CONNECTION_LOG(CONNECTION_ERROR, "Error!! Unknown state\n"); - return false; + return CONNECTION_ERROR_INVALID_OPERATION; } - return true; + return CONNECTION_ERROR_NONE; } -bool _connection_libnet_get_ethernet_state(connection_ethernet_state_e* state) +int _connection_libnet_get_ethernet_state(connection_ethernet_state_e* state) { struct _profile_list_s ethernet_profiles = {0, 0, NULL}; net_get_profile_list(NET_DEVICE_ETHERNET, ðernet_profiles.profiles, ðernet_profiles.count); if (ethernet_profiles.count == 0) { *state = CONNECTION_ETHERNET_STATE_DEACTIVATED; - return true; + return CONNECTION_ERROR_NONE; } switch (ethernet_profiles.profiles->ProfileState) { @@ -457,15 +463,15 @@ bool _connection_libnet_get_ethernet_state(connection_ethernet_state_e* state) *state = CONNECTION_ETHERNET_STATE_DISCONNECTED; break; default: - return false; + return CONNECTION_ERROR_OPERATION_FAILED; } __libnet_clear_profile_list(ðernet_profiles); - return true; + return CONNECTION_ERROR_NONE; } -bool _connection_libnet_get_bluetooth_state(connection_bt_state_e* state) +int _connection_libnet_get_bluetooth_state(connection_bt_state_e* state) { int i = 0; struct _profile_list_s bluetooth_profiles = {0, 0, NULL}; @@ -473,7 +479,7 @@ bool _connection_libnet_get_bluetooth_state(connection_bt_state_e* state) if (bluetooth_profiles.count == 0) { *state = CONNECTION_BT_STATE_DEACTIVATED; - return true; + return CONNECTION_ERROR_NONE; } for (; i < bluetooth_profiles.count; i++) { @@ -491,14 +497,14 @@ bool _connection_libnet_get_bluetooth_state(connection_bt_state_e* state) break; default: __libnet_clear_profile_list(&bluetooth_profiles); - return false; + return CONNECTION_ERROR_OPERATION_FAILED; } } done: __libnet_clear_profile_list(&bluetooth_profiles); - return true; + return CONNECTION_ERROR_NONE; } int _connection_libnet_get_profile_iterator(connection_iterator_type_e type, connection_profile_iterator_h* profile_iter_h) @@ -545,6 +551,10 @@ int _connection_libnet_get_profile_iterator(connection_iterator_type_e type, con if (profiles == NULL) { __libnet_clear_profile_list(&all_profiles); return CONNECTION_ERROR_OUT_OF_MEMORY; + break; + case CONNECTION_ITERATOR_TYPE_DEFAULT: + /* To do : Not supported yet */ + break; } profile_iterator.profiles = profiles; @@ -796,10 +806,13 @@ bool _connection_libnet_add_to_profile_cb_list(connection_profile_h profile, return true; } -void _connection_libnet_remove_from_profile_cb_list(connection_profile_h profile) +bool _connection_libnet_remove_from_profile_cb_list(connection_profile_h profile) { net_profile_info_t *profile_info = profile; - g_hash_table_remove(profile_cb_table, profile_info->ProfileName); + if (g_hash_table_remove(profile_cb_table, profile_info->ProfileName) == TRUE) + return true; + + return false; } int _connection_libnet_set_statistics(net_device_t device_type, net_statistics_type_e statistics_type) diff --git a/test/connection_test.c b/test/connection_test.c index b160a6f..dca780e 100644 --- a/test/connection_test.c +++ b/test/connection_test.c @@ -782,20 +782,20 @@ int test_get_current_ip(void) printf("IPv4 address : %s\n", ip_addr); g_free(ip_addr); - return 1; + return 1; } int test_get_call_statistics_info(void) { long long rv = 0; - connection_get_statistics(CONNECTION_TYPE_CELLULAR, CONNECTION_STATISTICS_TYPE_LAST_RECEIVED_DATA, &rv); + connection_get_statistics(connection, CONNECTION_TYPE_CELLULAR, CONNECTION_STATISTICS_TYPE_LAST_RECEIVED_DATA, &rv); printf("last recv data size [%lld]\n", rv); - connection_get_statistics(CONNECTION_TYPE_CELLULAR, CONNECTION_STATISTICS_TYPE_LAST_SENT_DATA, &rv); + connection_get_statistics(connection, CONNECTION_TYPE_CELLULAR, CONNECTION_STATISTICS_TYPE_LAST_SENT_DATA, &rv); printf("last sent data size [%lld]\n",rv ); - connection_get_statistics(CONNECTION_TYPE_CELLULAR, CONNECTION_STATISTICS_TYPE_TOTAL_RECEIVED_DATA, &rv); + connection_get_statistics(connection, CONNECTION_TYPE_CELLULAR, CONNECTION_STATISTICS_TYPE_TOTAL_RECEIVED_DATA, &rv); printf("total received data size [%lld]\n",rv ); - connection_get_statistics(CONNECTION_TYPE_CELLULAR, CONNECTION_STATISTICS_TYPE_TOTAL_SENT_DATA, &rv); + connection_get_statistics(connection, CONNECTION_TYPE_CELLULAR, CONNECTION_STATISTICS_TYPE_TOTAL_SENT_DATA, &rv); printf("total sent data size [%lld]\n", rv); return 1; @@ -805,13 +805,13 @@ int test_get_wifi_call_statistics_info(void) { long long rv = 0; - connection_get_statistics(CONNECTION_TYPE_WIFI, CONNECTION_STATISTICS_TYPE_LAST_RECEIVED_DATA, &rv); + connection_get_statistics(connection, CONNECTION_TYPE_WIFI, CONNECTION_STATISTICS_TYPE_LAST_RECEIVED_DATA, &rv); printf("WiFi last recv data size [%lld]\n", rv); - connection_get_statistics(CONNECTION_TYPE_WIFI, CONNECTION_STATISTICS_TYPE_LAST_SENT_DATA, &rv); + connection_get_statistics(connection, CONNECTION_TYPE_WIFI, CONNECTION_STATISTICS_TYPE_LAST_SENT_DATA, &rv); printf("WiFi last sent data size [%lld]\n",rv ); - connection_get_statistics(CONNECTION_TYPE_WIFI, CONNECTION_STATISTICS_TYPE_TOTAL_RECEIVED_DATA, &rv); + connection_get_statistics(connection, CONNECTION_TYPE_WIFI, CONNECTION_STATISTICS_TYPE_TOTAL_RECEIVED_DATA, &rv); printf("WiFi total received data size [%lld]\n",rv ); - connection_get_statistics(CONNECTION_TYPE_WIFI, CONNECTION_STATISTICS_TYPE_TOTAL_SENT_DATA, &rv); + connection_get_statistics(connection, CONNECTION_TYPE_WIFI, CONNECTION_STATISTICS_TYPE_TOTAL_SENT_DATA, &rv); printf("WiFi total sent data size [%lld]\n", rv); return 1; @@ -1271,13 +1271,13 @@ int test_reset_call_statistics_info(void) { int ret = CONNECTION_ERROR_NONE; - ret = connection_reset_statistics(CONNECTION_TYPE_CELLULAR, CONNECTION_STATISTICS_TYPE_LAST_RECEIVED_DATA); + ret = connection_reset_statistics(connection, CONNECTION_TYPE_CELLULAR, CONNECTION_STATISTICS_TYPE_LAST_RECEIVED_DATA); printf("reset last recv data size [%d]\n", ret); - ret = connection_reset_statistics(CONNECTION_TYPE_CELLULAR, CONNECTION_STATISTICS_TYPE_LAST_SENT_DATA); + ret = connection_reset_statistics(connection, CONNECTION_TYPE_CELLULAR, CONNECTION_STATISTICS_TYPE_LAST_SENT_DATA); printf("last sent data size [%d]\n", ret); - ret = connection_reset_statistics(CONNECTION_TYPE_CELLULAR, CONNECTION_STATISTICS_TYPE_TOTAL_RECEIVED_DATA); + ret = connection_reset_statistics(connection, CONNECTION_TYPE_CELLULAR, CONNECTION_STATISTICS_TYPE_TOTAL_RECEIVED_DATA); printf("total received data size [%d]\n", ret); - ret = connection_reset_statistics(CONNECTION_TYPE_CELLULAR, CONNECTION_STATISTICS_TYPE_TOTAL_SENT_DATA); + ret = connection_reset_statistics(connection, CONNECTION_TYPE_CELLULAR, CONNECTION_STATISTICS_TYPE_TOTAL_SENT_DATA); printf("total sent data size [%d]\n", ret); return 1; @@ -1287,13 +1287,13 @@ int test_reset_wifi_call_statistics_info(void) { int ret = CONNECTION_ERROR_NONE; - ret = connection_reset_statistics(CONNECTION_TYPE_WIFI, CONNECTION_STATISTICS_TYPE_LAST_SENT_DATA); + ret = connection_reset_statistics(connection, CONNECTION_TYPE_WIFI, CONNECTION_STATISTICS_TYPE_LAST_SENT_DATA); printf("WiFi last sent data size [%d]\n", ret); - ret = connection_reset_statistics(CONNECTION_TYPE_WIFI, CONNECTION_STATISTICS_TYPE_LAST_RECEIVED_DATA); + ret = connection_reset_statistics(connection, CONNECTION_TYPE_WIFI, CONNECTION_STATISTICS_TYPE_LAST_RECEIVED_DATA); printf("WiFi last recv data size [%d]\n", ret); - ret = connection_reset_statistics(CONNECTION_TYPE_WIFI, CONNECTION_STATISTICS_TYPE_TOTAL_SENT_DATA); + ret = connection_reset_statistics(connection, CONNECTION_TYPE_WIFI, CONNECTION_STATISTICS_TYPE_TOTAL_SENT_DATA); printf("WiFi total sent data size [%d]\n", ret); - ret = connection_reset_statistics(CONNECTION_TYPE_WIFI, CONNECTION_STATISTICS_TYPE_TOTAL_RECEIVED_DATA); + ret = connection_reset_statistics(connection, CONNECTION_TYPE_WIFI, CONNECTION_STATISTICS_TYPE_TOTAL_RECEIVED_DATA); printf("WiFi total received data size [%d]\n", ret); return 1; -- 2.7.4