+++ /dev/null
-Jeik Jaehyun Kim <jeik01.kim@samsung.com>
-ByungWoo Lee <bw1212.lee@samsung.com>
PROJECT(${fw_name})
-SET(CMAKE_INSTALL_PREFIX /usr)
SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+SET(LIB ${LIB_PATH})
+SET(LIBDIR ${PREFIX}/${LIB_PATH})
+
SET(INC_DIR include)
INCLUDE_DIRECTORIES(${INC_DIR})
SET(dependents "dlog vconf capi-base-common glib-2.0 network capi-system-info")
SET(pc_dependents "capi-base-common")
+IF(TIZEN_DUALSIM_ENABLE)
+ ADD_DEFINITIONS(-DTIZEN_DUALSIM_ENABLE)
+ENDIF(TIZEN_DUALSIM_ENABLE)
+IF(TIZEN_WEARABLE)
+ ADD_DEFINITIONS(-DTIZEN_WEARABLE)
+ENDIF(TIZEN_WEARABLE)
+IF(TIZEN_MOBILE)
+ ADD_DEFINITIONS(-DTIZEN_MOBILE)
+ENDIF(TIZEN_MOBILE)
+IF(TIZEN_TV)
+ ADD_DEFINITIONS(-DTIZEN_TV)
+ENDIF(TIZEN_TV)
+
+
INCLUDE(FindPkgConfig)
pkg_check_modules(${fw_name} REQUIRED ${dependents})
FOREACH(flag ${${fw_name}_CFLAGS})
ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
ADD_DEFINITIONS("-DTIZEN_DEBUG")
-SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=${LIB_INSTALL_DIR}")
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=${LIBDIR}")
aux_source_directory(src SOURCES)
ADD_LIBRARY(${fw_name} SHARED ${SOURCES})
CLEAN_DIRECT_OUTPUT 1
)
-INSTALL(TARGETS ${fw_name} DESTINATION ${LIB_INSTALL_DIR})
+INSTALL(TARGETS ${fw_name} DESTINATION ${LIB})
INSTALL(
DIRECTORY ${INC_DIR}/ DESTINATION include/network
FILES_MATCHING
${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc
@ONLY
)
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc DESTINATION ${LIB}/pkgconfig)
ADD_SUBDIRECTORY(test)
+Copyright (c) 2011-2013 Samsung Electronics Co., Ltd. All rights reserved.
Apache License
Version 2.0, January 2004
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.
+
Copyright (c) Samsung Electronics Co., Ltd. All rights reserved.
Except as noted, this software is licensed under Apache License, Version 2.
-Please, see the LICENSE.APLv2 file for Apache License terms and conditions.
+Please, see the LICENSE file for Apache License terms and conditions.
--- /dev/null
+<manifest>
+ <assign>
+ <filesystem path="/usr/bin/connection_test" exec_label="connman"/>
+ </assign>
+ <request>
+ <domain name="_"/>
+ </request>
+</manifest>
prefix=@PREFIX@
exec_prefix=/usr
-libdir=@LIB_INSTALL_DIR@
+libdir=/usr/lib
includedir=/usr/include/network
Name: @PC_NAME@
+++ /dev/null
-/usr/include/*
-/usr/include/*/*
-/usr/lib/pkgconfig/*.pc
-
+++ /dev/null
-/usr/lib/lib*.so*
+++ /dev/null
-capi-network-connection (0.1.3-16) unstable; urgency=low
-
- * Eliminate user privacy information
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.1.3-16
-
- -- Taesub Kim <taesub.kim@samsung.com> Fri, 29 Nov 2013 11:29:46 +0900
-
-capi-network-connection (0.1.3-15) unstable; urgency=low
-
- * Fix memory leak
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.1.3-15
-
- -- Taesub Kim <taesub.kim@samsung.com> Fri, 29 Nov 2013 10:52:46 +0900
-
-capi-network-connection (0.1.3-14) unstable; urgency=low
-
- * Set CFLAGS fvisibility hidden
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.1.3-14
-
- -- Taesub Kim <taesub.kim@samsung.com> Fri, 29 Nov 2013 10:36:46 +0900
-
-capi-network-connection (0.1.3-12) unstable; urgency=low
-
- * Check return value of read()
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.1.3-12
-
- -- JaeHyun Kim <jeik01.kim@samsung.com> Thu, 24 Jan 2013 20:14:09 +0900
-
-capi-network-connection (0.1.3-11) unstable; urgency=low
-
- * Revise connection_profile_is_wifi_passphrase_required() to fit connman 1.3
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.1.3-11
-
- -- JaeHyun Kim <jeik01.kim@samsung.com> Wed, 16 Jan 2013 18:44:18 +0900
-
-capi-network-connection (0.1.3-10) unstable; urgency=low
-
- * Revise connection_profile_get_proxy_address() to support ethernet proxy
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.1.3-10
-
- -- JaeHyun Kim <jeik01.kim@samsung.com> Tue, 15 Jan 2013 20:34:31 +0900
-
-capi-network-connection (0.1.3-9) unstable; urgency=low
-
- * Support additional vconf keys for ethernet/bluetooth
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.1.3-9
-
- -- JaeHyun Kim <jeik01.kim@samsung.com> Tue, 15 Jan 2013 19:15:37 +0900
-
-capi-network-connection (0.1.3-8) unstable; urgency=low
-
- * Use libnet-client API instead of vconf value to get Wi-Fi state in connection_get_wifi_state() API
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.1.3-8
-
- -- JaeHyun Kim <jeik01.kim@samsung.com> Mon, 14 Jan 2013 23:23:03 +0900
-
-capi-network-connection (0.1.3-7) unstable; urgency=low
-
- * Revise connection_profile_get_cellular_network_type() because connman doesn't provide this information anymore
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.1.3-7
-
- -- JaeHyun Kim <jeik01.kim@samsung.com> Fri, 04 Jan 2013 16:05:28 +0900
-
-capi-network-connection (0.1.3-6) unstable; urgency=low
-
- * Add connection_profile_get_id()
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.1.3-6
-
- -- JaeHyun Kim <jeik01.kim@samsung.com> Thu, 03 Jan 2013 20:36:29 +0900
-
-capi-network-connection (0.1.3-5) unstable; urgency=low
-
- * In case of setting IP address, Gateway, Subnet and proxy, it is allowed that a value is set to NULL.
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.1.3-5
-
- -- JaeHyun Kim <jeik01.kim@samsung.com> Wed, 02 Jan 2013 11:33:58 +0900
-
-capi-network-connection (0.1.3-4) unstable; urgency=low
-
- * Checking return value and strict nul-terminated buffer
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.1.3-4
-
- -- Danny Jeongseok Seo <s.seo@samsung.com> Tue, 13 Nov 2012 11:45:41 +0900
-
-capi-network-connection (0.1.3-2) unstable; urgency=low
-
- * Revise connection_get_cellular_state() to support connected state
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.1.3-2
-
- -- JaeHyun Kim <jeik01.kim@samsung.com> Fri, 02 Nov 2012 20:23:04 +0900
-
-capi-network-connection (0.1.3-1) unstable; urgency=low
-
- * Add bluetooth support
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.1.3-1
-
- -- JaeHyun Kim <jeik01.kim@samsung.com> Thu, 25 Oct 2012 14:30:14 +0900
-
-capi-network-connection (0.1.2-4) unstable; urgency=low
-
- * Update UTC
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.1.2-4
-
- -- JaeHyun Kim <jeik01.kim@samsung.com> Mon, 15 Oct 2012 21:10:09 +0900
-
-capi-network-connection (0.1.2-3) unstable; urgency=low
-
- * Add connection_add_route()
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.1.2-3
-
- -- JaeHyun Kim <jeik01.kim@samsung.com> Fri, 12 Oct 2012 20:13:52 +0900
-
-capi-network-connection (0.1.2-2) unstable; urgency=low
-
- * Install license
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.1.2-2
-
- -- Danny Jeongseok Seo <s.seo@samsung.com> Thu, 11 Oct 2012 18:09:07 +0900
-
-capi-network-connection (0.1.2-1) unstable; urgency=low
-
- * Extend some APIs to fit requirements from setting and tethering
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.1.2-1
-
- -- JaeHyun Kim <jeik01.kim@samsung.com> Thu, 27 Sep 2012 16:30:42 +0900
-
-capi-network-connection (0.1.1-12) unstable; urgency=low
-
- * update manifest
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.1.1-12
-
- -- Danny Jeongseok Seo <s.seo@samsung.com> Fri, 21 Sep 2012 15:38:33 +0900
-
-capi-network-connection (0.1.1-11) unstable; urgency=low
-
- * Use static mutex initializer to avoid runtime initialization tests and overhead
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.1.1-11
-
- -- JaeHyun Kim <jeik01.kim@samsung.com> Fri, 07 Sep 2012 11:21:04 +0900
-
-capi-network-connection (0.1.1-10) unstable; urgency=low
-
- * Update UTC
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.1.1-10
-
- -- JaeHyun Kim <jeik01.kim@samsung.com> Tue, 04 Sep 2012 16:52:06 +0900
-
-capi-network-connection (0.1.1-9) unstable; urgency=low
-
- * Remove deprecated APIs
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.1.1-9
-
- -- JaeHyun Kim <jeik01.kim@samsung.com> Fri, 03 Aug 2012 16:51:25 +0900
-
-capi-network-connection (0.1.1-8) unstable; urgency=low
-
- * Modify connection_create() and connection_destroy() API to assure thread safety
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.1.1-8
-
- -- JaeHyun Kim <jeik01.kim@samsung.com> Fri, 27 Jul 2012 12:36:54 +0900
-
-capi-network-connection (0.1.1-7) unstable; urgency=low
-
- * Modify set/get statistics API to support dbus interface of net-config
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.1.1-7
-
- -- JaeHyun Kim <jeik01.kim@samsung.com> Fri, 06 Jul 2012 18:13:11 +0900
-
-capi-network-connection (0.1.1-6) unstable; urgency=low
-
- * Modify connection_reset_statistics() to avoid vconf permission error
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.1.1-6
-
- -- JaeHyun Kim <jeik01.kim@samsung.com> Wed, 27 Jun 2012 19:06:32 +0900
-
-capi-network-connection (0.1.1-5) unstable; urgency=low
-
- * Update TC
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.1.1-5
-
- -- JaeHyun Kim <jeik01.kim@samsung.com> Tue, 12 Jun 2012 18:49:08 +0900
-
-capi-network-connection (0.1.1-4) unstable; urgency=low
-
- * Add profile initialization functions for user creation
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.1.1-4
-
- -- JaeHyun Kim <jeik01.kim@samsung.com> Tue, 12 Jun 2012 17:17:00 +0900
-
-capi-network-connection (0.1.1-3) unstable; urgency=low
-
- * Implementation of connection_reset_statistics()
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.1.1-3
-
- -- JaeHyun Kim <jeik01.kim@samsung.com> Tue, 12 Jun 2012 16:34:52 +0900
-
-capi-network-connection (0.1.1-2) unstable; urgency=low
-
- * Implementation of extened APIs again
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.1.1-2
-
- -- JaeHyun Kim <jeik01.kim@samsung.com> Tue, 29 May 2012 17:00:36 +0900
-
-capi-network-connection (0.1.1-1) unstable; urgency=low
-
- * Rollback to capi-network-connection_0.1.0-23
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.1.1-1
-
- -- JaeHyun Kim <jeik01.kim@samsung.com> Wed, 23 May 2012 20:56:07 +0900
-
-capi-network-connection (0.1.1-0) unstable; urgency=low
-
- * Implementation of extened APIs
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.1.1-0
-
- -- JaeHyun Kim <jeik01.kim@samsung.com> Fri, 18 May 2012 14:57:49 +0900
-
-capi-network-connection (0.1.0-23) unstable; urgency=low
-
- * Fix a bug which don't set user data in proxy callback setter
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.1.0-23
-
- -- JaeHyun Kim <jeik01.kim@samsung.com> Mon, 16 Apr 2012 12:02:47 +0900
-
-capi-network-connection (0.1.0-22) unstable; urgency=low
-
- * Fix connection destroy bug
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.1.0-22
-
- -- JaeHyun Kim <jeik01.kim@samsung.com> Mon, 09 Apr 2012 20:54:57 +0900
-
-capi-network-connection (0.1.0-21) unstable; urgency=low
-
- * Add ipv6 feature and update DTS code
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.1.0-21
-
- -- JaeHyun Kim <jeik01.kim@samsung.com> Fri, 30 Mar 2012 18:15:20 +0900
-
-capi-network-connection (0.1.0-20) unstable; urgency=low
-
- * Update DTS code
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.1.0-20
-
- -- JaeHyun Kim <jeik01.kim@samsung.com> Tue, 20 Mar 2012 16:08:10 +0900
-
-capi-network-connection (0.1.0-19) unstable; urgency=low
-
- * Revise spec for OBS
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.1.0-19
-
- -- Danny Jeongseok Seo <s.seo@samsung.com> Sat, 17 Mar 2012 18:31:44 +0900
-
-capi-network-connection (0.1.0-18) unstable; urgency=low
-
- * Implementation of new APIs and TC code
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.1.0-18
-
- -- JaeHyun Kim <jeik01.kim@samsung.com> Fri, 16 Mar 2012 18:46:37 +0900
-
-capi-network-connection (0.1.0-17) unstable; urgency=low
-
- * Convert internal function to static function
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.1.0-17
-
- -- ByungWoo Lee <bw1212.lee@samsung.com> Mon, 20 Feb 2012 17:55:42 +0900
-
-capi-network-connection (0.1.0-16) unstable; urgency=low
-
- * Add versioning of library
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.1.0-16
-
- -- ByungWoo Lee <bw1212.lee@samsung.com> Tue, 14 Feb 2012 17:23:56 +0900
-
-capi-network-connection (0.1.0-15) unstable; urgency=low
-
- * Fix bugs and related DTS
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.1.0-15
-
- -- JaeHyun Kim <jeik01.kim@samsung.com> Tue, 07 Feb 2012 19:09:07 +0900
-
-capi-network-connection (0.1.0-14) unstable; urgency=low
-
- * Update DTS
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.1.0-14
-
- -- ByungWoo Lee <bw1212.lee@samsung.com> Fri, 27 Jan 2012 18:18:29 +0900
-
-capi-network-connection (0.1.0-13) unstable; urgency=low
-
- * License and Boilerplate update.
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.1.0-13
-
- -- Sanjeev BA <as2902.b@samsung.com> Tue, 06 Dec 2011 18:48:48 +0900
-
-capi-network-connection (0.1.0-12) unstable; urgency=low
-
- * Bump up version.
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.1.0-12
-
- -- Sanjeev BA <as2902.b@samsung.com> Thu, 01 Dec 2011 19:40:16 +0900
-
-capi-network-connection (0.1.0-11) unstable; urgency=low
-
- * Add data connection statistics.
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.1.0-11
-
- -- Sanjeev BA <as2902.b@samsung.com> Thu, 01 Dec 2011 19:18:24 +0900
-
-capi-network-connection (0.1.0-10) unstable; urgency=low
-
- * Cleanup of vconf notifications.
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.1.0-10
-
- -- Sanjeev BA <as2902.b@samsung.com> Thu, 01 Dec 2011 11:08:59 +0900
-
-capi-network-connection (0.1.0-9) unstable; urgency=low
-
- * Renaming for tizen.
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.1.0-9
-
- -- Sanjeev BA <as2902.b@samsung.com> Wed, 30 Nov 2011 15:10:59 +0900
-
-capi-network-connection (0.1.0-8) unstable; urgency=low
-
- * Renaming for tizen.
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.1.0-8
-
- -- Sanjeev BA <as2902.b@samsung.com> Wed, 23 Nov 2011 15:07:23 +0900
-
-capi-network-connection (0.1.0-7) unstable; urgency=low
-
- * Correct status updates.
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.1.0-7
-
- -- Sanjeev BA <as2902.b@samsung.com> Wed, 23 Nov 2011 13:46:23 +0900
-
-capi-network-connection (0.1.0-6) unstable; urgency=low
-
- * Correct status updates.
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.1.0-6
-
- -- Sanjeev BA <as2902.b@samsung.com> Thu, 17 Nov 2011 15:10:55 +0900
-
-capi-network-connection (0.1.0-5) unstable; urgency=low
-
- * Correct status updates.
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.1.0-5
-
- -- Sanjeev BA <as2902.b@samsung.com> Fri, 04 Nov 2011 17:55:49 +0900
-
-capi-network-connection (0.1.0-4) unstable; urgency=low
-
- * Fix boilerplate.
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.1.0-4
-
- -- Sanjeev BA <as2902.b@samsung.com> Fri, 04 Nov 2011 11:22:10 +0900
-
-capi-network-connection (0.1.0-3) unstable; urgency=low
-
- * Fix doxygen comments.
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.1.0-3
-
- -- Sanjeev BA <as2902.b@samsung.com> Mon, 31 Oct 2011 20:13:02 +0900
-
-capi-network-connection (0.1.0-2) unstable; urgency=low
-
- * Add new mappings between vconf and connection_network_param_e.
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.1.0-2
-
- -- Sanjeev BA <as2902.b@samsung.com> Fri, 14 Oct 2011 19:37:05 +0900
-
-capi-network-connection (0.1.0-1) unstable; urgency=low
-
- * Alpha Release
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.1.0-1
-
- -- Kangho Hur <kangho.hur@samsung.com> Tue, 27 Sep 2011 20:35:08 +0900
-
-capi-network-connection (0.0.1-11) unstable; urgency=low
-
- * Fix build error from sbs using (sbs --clean-build).
- * Updated debian/control file to add build depedency.
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.0.1-11
-
- -- Sanjeev BA <as2902.b@samsung.com> Thu, 08 Sep 2011 17:36:05 +0900
-
-capi-network-connection (0.0.1-10) unstable; urgency=low
-
- * Fix as per new libnetwork API.
- * remove dnet dependency, use only vconf.
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.0.1-10
-
- -- Sanjeev BA <as2902.b@samsung.com> Wed, 07 Sep 2011 14:19:30 +0900
-
-capi-network-connection (0.0.1-9) unstable; urgency=low
-
- * Add param_name to callbacks. Will help apps identify what has changed.
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.0.1-9
-
- -- Sanjeev BA <as2902.b@samsung.com> Fri, 02 Sep 2011 10:20:09 +0900
-
-capi-network-connection (0.0.1-8) unstable; urgency=low
-
- * Cleanup unused code. Fix documentation.
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.0.1-8
-
- -- Sanjeev BA <as2902.b@samsung.com> Thu, 01 Sep 2011 20:03:11 +0900
-
-capi-network-connection (0.0.1-7) unstable; urgency=low
-
- * Fix handles.
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.0.1-7
-
-
- -- Sanjeev BA <as2902.b@samsung.com> Mon, 22 Aug 2011 14:31:53 +0900
-
-capi-network-connection (0.0.1-6) unstable; urgency=low
-
- * Fix handles.
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.0.1-6
-
- -- Sanjeev BA <as2902.b@samsung.com> Thu, 18 Aug 2011 09:50:20 +0900
-
-capi-network-connection (0.0.1-5) unstable; urgency=low
-
- * Fix debain packaging issue.
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.0.1-5
-
- -- Sanjeev BA <as2902.b@samsung.com> Thu, 11 Aug 2011 19:28:50 +0900
-
-capi-network-connection (0.0.1-4) unstable; urgency=low
-
- * Fix regression test case that was never used before.
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.0.1-4
-
- -- Sanjeev BA <as2902.b@samsung.com> Thu, 04 Aug 2011 19:04:04 +0900
-
-capi-network-connection (0.0.1-3) unstable; urgency=low
-
- * Add missing pc.in file.
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.0.1-3
-
- -- Sanjeev BA <as2902.b@samsung.com> Thu, 04 Aug 2011 18:04:33 +0900
-
-capi-network-connection (0.0.1-2) unstable; urgency=low
-
- * Initial Upload
- * Git: framework/api/connection
- * Tag: capi-network-connection_0.0.1-2
-
- -- Sanjeev BA <as2902.b@samsung.com> Thu, 04 Aug 2011 17:32:41 +0900
+++ /dev/null
-Source: capi-network-connection
-Section: libs
-Priority: extra
-Maintainer: JaeHyun Kim <jeik01.kim@samsung.com>
-Build-Depends: debhelper (>= 5), dlog-dev, capi-base-common-dev, libvconf-dev, libglib2.0-dev, libnetwork-dev
-
-Package: capi-network-connection
-Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}
-Description: Network Connection library in TIZEN C API
-
-Package: capi-network-connection-dev
-Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, capi-network-connection (= ${Source-Version}), capi-base-common-dev
-Description: Network Connection library in TIZEN C API (DEV)
-
-Package: capi-network-connection-dbg
-Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, capi-network-connection (= ${Source-Version})
-Description: Network Connection library in TIZEN C API (DBG)
-
+++ /dev/null
-#!/usr/bin/make -f
-
-CFLAGS = -Wall -g
-FULLVER ?= $(shell dpkg-parsechangelog | grep Version: | cut -d ' ' -f 2 | cut -d '-' -f 1)
-MAJORVER ?= $(shell echo $(FULLVER) | cut -d '.' -f 1)
-
-ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
- CFLAGS += -O0
-else
- CFLAGS += -O2
-endif
-CMAKE_ROOT_DIR ?= $(CURDIR)
-CMAKE_BUILD_DIR ?= $(CURDIR)/cmake_build_tmp
-
-configure: configure-stamp
-configure-stamp:
- dh_testdir
- mkdir -p $(CMAKE_BUILD_DIR) && cd $(CMAKE_BUILD_DIR) && cmake .. -DFULLVER=${FULLVER} -DMAJORVER=${MAJORVER}
- touch configure-stamp
-
-
-build: build-stamp
-build-stamp: configure-stamp
- dh_testdir
- cd $(CMAKE_BUILD_DIR) && $(MAKE)
- touch $@
-
-clean:
- cd $(CMAKE_ROOT_DIR)
- dh_testdir
- dh_testroot
- rm -f build-stamp configure-stamp
- rm -f `find . -name *.pc`
- rm -rf $(CMAKE_BUILD_DIR)
- dh_clean
-
-install: build
- dh_testdir
- dh_testroot
- dh_clean -k
- dh_installdirs
-
- cd $(CMAKE_BUILD_DIR) && $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
-
-binary-indep: build install
-
-binary-arch: build install
- dh_testdir
- dh_testroot
- dh_installchangelogs
- dh_installdocs
- dh_installexamples
- dh_install --sourcedir=debian/tmp
- dh_installman
- dh_link
- dh_strip --dbg-package=capi-network-connection-dbg
- dh_fixperms
- dh_makeshlibs
- dh_installdeb
- dh_shlibdeps
- dh_gencontrol
- dh_md5sums
- dh_builddeb
-
-binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary install configure
-
*
* To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n
*
- * More details on featuring your application can be found from <a href="../org.tizen.mobile.native.appprogramming/html/ide_sdk_tools/feature_element.htm"><b>Feature Element</b>.</a>
+ * More details on featuring your application can be found from <a href="../org.tizen.gettingstarted/html/native/details/app_filtering_n.htm"><b>Feature List</b>.</a>
*
*/
*
* To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n
*
- * More details on featuring your application can be found from <a href="../org.tizen.mobile.native.appprogramming/html/ide_sdk_tools/feature_element.htm"><b>Feature Element</b>.</a>
+ * More details on featuring your application can be found from <a href="../org.tizen.gettingstarted/html/native/details/app_filtering_n.htm"><b>Feature List</b>.</a>
*
*/
*
* To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n
*
- * More details on featuring your application can be found from <a href="../org.tizen.mobile.native.appprogramming/html/ide_sdk_tools/feature_element.htm"><b>Feature Element</b>.</a>
+ * More details on featuring your application can be found from <a href="../org.tizen.gettingstarted/html/native/details/app_filtering_n.htm"><b>Feature List</b>.</a>
*
*/
*
* To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n
*
- * More details on featuring your application can be found from <a href="../org.tizen.mobile.native.appprogramming/html/ide_sdk_tools/feature_element.htm"><b>Feature Element</b>.</a>
+ * More details on featuring your application can be found from <a href="../org.tizen.gettingstarted/html/native/details/app_filtering_n.htm"><b>Feature List</b>.</a>
*
*/
*
* To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n
*
- * More details on featuring your application can be found from <a href="../org.tizen.mobile.native.appprogramming/html/ide_sdk_tools/feature_element.htm"><b>Feature Element</b>.</a>
+ * More details on featuring your application can be found from <a href="../org.tizen.gettingstarted/html/native/details/app_filtering_n.htm"><b>Feature List</b>.</a>
*
*/
/**
* @brief Enumeration for security type of Wi-Fi.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef enum
{
/**
* @brief Enumeration for encryption modes.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef enum
{
*/
/**
-* @brief This enumeration defines the cellular protocol type.
-*/
-typedef enum
-{
- CONNECTION_CELLULAR_NETWORK_TYPE_UNKNOWN = 0, /**< Not defined */
- CONNECTION_CELLULAR_NETWORK_TYPE_GPRS = 1, /**< GPRS type */
- CONNECTION_CELLULAR_NETWORK_TYPE_EDGE = 2, /**< EDGE type */
- CONNECTION_CELLULAR_NETWORK_TYPE_UMTS = 3, /**< UMTS type */
-} connection_cellular_network_type_e;
-
-/**
* @brief Enumeration for cellular service type.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef enum
{
/**
* @brief Enumeration for cellular authentication type.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef enum
{
/**
* @brief The profile handle.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef void* connection_profile_h;
/**
* @brief Enumeration for profile state type.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef enum
{
/**
* @brief Enumeration for address family.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef enum
{
/**
* @brief Enumeration for IP configuration type.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef enum
{
/**
* @brief Enumeration for proxy method type.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef enum
{
/**
* @brief Enumeration for network connection type.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef enum{
CONNECTION_PROFILE_TYPE_CELLULAR = 0, /**< Cellular type */
/**
* @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
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/network.get
* @remarks You must release @a profile using connection_profile_destroy().
/**
* @brief Destroys a profile handle.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[out] profile The handle to the profile
* @return @c 0 on success, otherwise a negative error value
* @retval #CONNECTION_ERROR_NONE Successful
* 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
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @remarks You must release @a profile_id using free().
* @param[in] profile The profile handle
* @param[out] profile_id The ID of the profile
/**
* @brief Gets the profile name.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @remarks You must release @a profile_name using free().
* @param[in] profile The profile handle
* @param[out] profile_name The name of the profile
/**
* @brief Gets the network type.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] profile The profile handle
* @param[out] type The type of the profile
* @return @c 0 on success, otherwise a negative error value
/**
* @brief Gets the name of the network interface, e.g. eth0 and pdp0.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @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
/**
* @brief Refreshes the profile information.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @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.
/**
* @brief Gets the network type.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] profile The profile handle
* @param[out] state The state of the profile
* @return @c 0 on success, otherwise a negative error value
/**
* @brief Gets the IP config type.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] profile The profile handle
* @param[in] address_family The address family
* @param[out] type The type of the IP config
/**
* @brief Gets the IP address.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @remarks You must release @a ip_address using free().
* @param[in] profile The profile handle
* @param[in] address_family The address family
/**
* @brief Gets the Subnet Mask.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @remarks You must release @a subnet_mask using free().
* @param[in] profile The profile handle
* @param[in] address_family The address family
/**
* @brief Gets the Gateway address.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @remarks You must release @a gateway_address using free().
* @param[in] profile The profile handle
* @param[in] address_family The address family
/**
* @brief Gets the DNS address.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @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
/**
* @brief Gets the Proxy type.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] profile The profile handle
* @param[out] type The type of the proxy
* @return @c 0 on success, otherwise a negative error value
/**
* @brief Gets the Proxy address.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @remarks You must release @a proxy_address using free().
* @param[in] profile The profile handle
* @param[in] address_family The address family
* @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
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] profile The profile handle
* @param[in] address_family The address family
* @param[in] type The type of the IP config
/**
* @brief Sets the IP address.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] profile The profile handle
* @param[in] address_family The address family
* @param[in] ip_address The IP address.\n
/**
* @brief Sets the Subnet Mask.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] profile The profile handle
* @param[in] address_family The address family
* @param[in] subnet_mask The subnet mask. \n
/**
* @brief Sets the Gateway address.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] profile The profile handle
* @param[in] address_family The address family
* @param[in] gateway_address The gateway address. \n
/**
* @brief Sets the DNS address.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @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
/**
* @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
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] profile The profile handle
* @param[in] type The type of the proxy
* @return @c 0 on success, otherwise a negative error value
/**
* @brief Sets the Proxy address.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] profile The profile handle
* @param[in] address_family The address family
* @param[in] proxy_address The proxy address. \n
/**
* @brief Called when the state of the profile is changed.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @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()
/**
* @brief Registers the callback that is called when the state of profile is changed.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @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
/**
* @brief Unregisters the callback that is called when the state of profile is changed.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] profile The profile handle
* @return @c 0 on success, otherwise a negative error value
* @retval #CONNECTION_ERROR_NONE Successful
/**
* @brief Gets the ESSID (Extended Service Set Identifier).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @remarks You must release @a essid using free().
* @param[in] profile The profile handle
* @param[out] essid The ESSID
/**
* @brief Gets the BSSID (Basic Service Set Identifier).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @remarks You must release @a bssid using free().
* @param[in] profile The profile handle
* @param[out] bssid The BSSID
/**
* @brief Gets the RSSI.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] profile The profile handle
* @param[out] rssi The RSSI
* @return @c 0 on success, otherwise a negative error value
/**
* @brief Gets the frequency (MHz).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] profile The profile handle
* @param[out] frequency The frequency
* @return @c 0 on success, otherwise a negative error value
/**
* @brief Gets the max speed (Mbps).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] profile The profile handle
* @param[out] max_speed The max speed
* @return @c 0 on success, otherwise a negative error value
/**
* @brief Gets the security mode of Wi-Fi.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @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
/**
* @brief Gets the security mode of Wi-Fi.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @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
/**
* @brief Checks whether passphrase is required.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @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.
/**
* @brief Sets the passphrase of the Wi-Fi WPA.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @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
/**
* @brief Checks whether the WPS (Wi-Fi Protected Setup) is supported.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @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.
*/
/**
-* @brief Gets the cellular network type.
-* @param[in] profile The handle of profile
-* @param[out] type The type of cellular
-* @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
-*/
-int connection_profile_get_cellular_network_type(connection_profile_h profile, connection_cellular_network_type_e* type);
-
-/**
* @brief Gets the service type.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @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
/**
* @brief Gets the APN (access point name).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @remarks You must release @a apn using free().
* @param[in] profile The profile handle
* @param[out] apn The name of the APN
/**
* @brief Gets the authentication information.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @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
/**
* @brief Gets the home URL.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @remarks You must release @a home_url using free().
* @param[in] profile The profile handle
* @param[out] home_url The home URL
/**
* @brief Checks wheter the connection is in roaming state.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @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
/**
* @brief Checks whether the profile is hidden.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @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
/**
* @brief Checks whether the profile is editable.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @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
/**
* @brief Checks whether the profile is default.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @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
/**
* @brief Sets the service type.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @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
/**
* @brief Sets the APN (Access Point Name).
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] profile The profile handle
* @param[in] apn The name of APN
* @return @c 0 on success, otherwise a negative error value
/**
* @brief Sets the Authentication information.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] profile The profile handle
* @param[in] type The type of the authentication
* @param[in] user_name The user name
/**
* @brief Sets the home URL.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] profile The profile handle
* @param[in] home_url The home URL
* @return @c 0 on success, otherwise a negative error value
/**
* @brief The connection handle.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef void* connection_h;
/**
* @brief The profiles iterator handle.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef void* connection_profile_iterator_h;
/**
* @brief Enumeration for connection type.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef enum
{
/**
* @brief Enumeration for cellular network state.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef enum
{
/**
* @brief Enumeration for Wi-Fi state.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef enum
{
/**
* @brief Enumeration for Bluetooth state.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef enum
{
/**
* @brief Enumeration for connection iterator type.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef enum
{
/**
* @brief Enumeration for reset profile type.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef enum
{
/**
* @brief Enumeration for connection errors.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef enum
{
/**
* @brief Enumeration for statistics type.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef enum
{
/**
* @brief Creates a handle for managing data connections.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/network.get
* @remarks You must release @a handle using connection_destroy().
/**
* @brief Destroys the connection handle.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] connection The connection handle
* @return @c 0 on success, otherwise negative error value
* @retval #CONNECTION_ERROR_NONE Successful
/**
* @brief Called when the type of a connection is changed.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @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_type_changed_cb()
/**
* @brief Called when the address is changed.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @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
/**
* @brief Called when connection_set_default_cellular_service_profile_async() finishes.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @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.
/**
* @brief Gets the type of the current profile for data connection.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] connection The connection handle
* @param[out] type The type of the network
* @return @c 0 on success, otherwise negative error value
/**
* @brief Gets the IP address of the current connection.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @remarks You must release @a ip_address using free().
* @param[in] connection The connection handle
* @param[in] address_family The address family
/**
* @brief Gets the proxy address of the current connection.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @remarks You must release @a proxy using free().
* @param[in] connection The connection handle
* @param[in] address_family The address family
/**
* @brief Gets the state of cellular connection.
* @details The returned state is for the cellular connection state.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @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
/**
* @brief Gets the state of the Wi-Fi.
* @details The returned state is for the Wi-Fi connection state.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/network.get
* @param[in] connection The connection handle
/**
* @brief Gets the state of the Bluetooth.
* @details The returned state is for the Bluetooth connection state.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/network.get
* @param[in] connection The connection handle
/**
* @brief Registers the callback that is called when the type of the current connection is changed.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @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
/**
* @brief Unregisters the callback that is called when the type of current connection is changed.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] connection The connection handle
* @return @c 0 on success, otherwise a negative error value
* @retval #CONNECTION_ERROR_NONE Successful
/**
* @brief Registers the callback that is called when the IP address is changed.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @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
/**
* @brief Unregisters the callback that is called when the IP address is changed.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] connection The connection handle
* @return @c 0 on success, otherwise a negative error value
* @retval #CONNECTION_ERROR_NONE Successful
/**
* @brief Registers the callback that is called when the proxy address is changed.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @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
/**
* @brief Unregisters the callback that is called when the proxy address is changed.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] connection The connection handle
* @return @c 0 on success, otherwise a negative error value
* @retval #CONNECTION_ERROR_NONE Successful
/**
* @brief Adds a new profile which is created by connection_profile_create().
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/network.profile
* @remarks You can only add a profile of the cellular type.
/**
* @brief Removes an existing profile.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/network.profile \n
* %http://tizen.org/privilege/network.get
* @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().
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/network.profile \n
* %http://tizen.org/privilege/network.get
/**
* @brief Gets a profiles iterator.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/network.get
* @remarks You must release @a profile_iterator using connection_destroy().
/**
* @brief Moves the profile iterator to the next position and gets a profile handle.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] profile_iterator The iterator of profile
* @param[out] profile The profile handle
* @return @c 0 on success, otherwise a negative error value
/**
* @brief Checks whether the next element of a profile iterator exists or not.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @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, otherwise @c false if next element doesn't exist
/**
* @brief Destroys a profiles iterator.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[in] profile_iterator The iterator of the profile
* @return @c 0 on success, otherwise a negative error value
* @retval #CONNECTION_ERROR_NONE Successful
/**
* @brief Gets the name of the default profile.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/network.get
* @remarks You must release @a profile using connection_profile_destroy().
/**
* @brief Gets the default profile which provides the given cellular service.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/network.get
* @remarks You must release @a profile using connection_profile_destroy().
/**
* @brief Sets the default profile which provides the given cellular service.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/network.profile \n
* %http://tizen.org/privilege/network.get
/**
* @brief Sets the default profile which provides the given cellular service, asynchronously.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/network.profile \n
* %http://tizen.org/privilege/network.get
/**
* @brief Called after connection_open_profile() is finished.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @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.
/**
* @brief Called after connection_close_profile() is finished.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @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.
/**
* @brief Called after connection_reset_profile() is finished.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @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.
/**
* @brief Opens a connection of profile, asynchronously.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/network.set \n
* %http://tizen.org/privilege/network.get
/**
* @brief Closes a connection of profile.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/network.set
* @param[in] connection The connection handle
/**
* @brief Resets the cellular profile.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/network.profile \n
* %http://tizen.org/privilege/network.get
/**
* @brief Adds a IPv4 route to 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
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/network.set
* @param[in] connection The connection handle
/**
* @brief Removes a IPv4 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
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/network.set
* @param[in] connection The connection handle
* @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
* @see connection_profile_get_network_interface_name()
*/
-
int connection_add_route_ipv6(connection_h connection, const char *interface_name, const char *host_address, const char * gateway);
/**
* @privilege %http://tizen.org/privilege/network.set
* @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
+ * @param[in] host_address The IP address of the host
* @param[in] gateway The gateway address
* @return @c 0 on success, otherwise negative error value
* @retval #CONNECTION_ERROR_NONE Successful
- * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
* @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
* @see connection_profile_get_network_interface_name()
/**
* @brief Gets the statistics information.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/network.get
* @param[in] connection The connection handle
/**
* @brief Resets the statistics information.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/network.set
* @remarks This API needs both privileges.
CONNECTION_CELLULAR_SUBSCRIBER_2 = 0x01,
} connection_cellular_subscriber_id_e;
+#if !defined TIZEN_TV
#define CHECK_FEATURE_SUPPORTED(...) \
do { \
int rv = _connection_check_feature_supported(__VA_ARGS__, NULL); \
if( rv != CONNECTION_ERROR_NONE ) \
return rv; \
} while(0)
+#else
+#define CHECK_FEATURE_SUPPORTED(...)
+#endif
#define CONNECTION_LOG(log_level, format, args...) \
do { \
} \
} while(0)
-#define CONNECTION_MUTEX_LOCK _connection_inter_mutex_lock()
-#define CONNECTION_MUTEX_UNLOCK _connection_inter_mutex_unlock()
-
#define SECURE_CONNECTION_LOG(log_level, format, args...) \
do { \
switch (log_level) { \
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);
#ifdef __cplusplus
}
+++ /dev/null
-* Tue Jul 09 2013 Baptiste DURAND <baptiste.durand@eurogiciel.fr> bd62c93
-- x86_64 compliance: Fix libdir variable in PC file
-
-* Mon May 20 2013 Rusty Lynch <rusty.lynch@intel.com> submit/tizen/20130520.200645@62a88ba
-- Work around build breakages by unsetting LD_AS_NEEDED
-
+++ /dev/null
-<manifest>
- <request>
- <domain name="_"/>
- </request>
-</manifest>
-Name: capi-network-connection
-Summary: Network Connection library in TIZEN C API
-Version: 0.1.3_27
-Release: 1
-Group: System/Network
-License: Apache-2.0
-Source0: %{name}-%{version}.tar.gz
-Source1001: capi-network-connection.manifest
-BuildRequires: cmake
-BuildRequires: pkgconfig(dlog)
-BuildRequires: pkgconfig(glib-2.0)
-BuildRequires: pkgconfig(vconf)
-BuildRequires: pkgconfig(capi-base-common)
-BuildRequires: pkgconfig(capi-system-info)
-BuildRequires: pkgconfig(network)
+Name: capi-network-connection
+Summary: Network Connection library in TIZEN C API
+Version: 1.0.70
+Release: 1
+Group: System/Network
+License: Apache-2.0
+Source0: %{name}-%{version}.tar.gz
+BuildRequires: cmake
+BuildRequires: pkgconfig(dlog)
+BuildRequires: pkgconfig(vconf)
+BuildRequires: pkgconfig(network)
+BuildRequires: pkgconfig(glib-2.0)
+BuildRequires: pkgconfig(capi-base-common)
+BuildRequires: pkgconfig(capi-system-info)
+BuildRequires: model-build-features
+Requires(post): /sbin/ldconfig
+Requires(postun): /sbin/ldconfig
%description
Network Connection library in Tizen C API
%package devel
-Summary: Network Connection library in Tizen C API (Development)
-Group: System/Network
-Requires: %{name} = %{version}-%{release}
+Summary: Network Connection library in Tizen C API (Development)
+Group: System/Network
+Requires: %{name} = %{version}-%{release}
%description devel
Network Connection library in Tizen C API (Development)
%prep
%setup -q
-cp %{SOURCE1001} .
%build
-unset LD_AS_NEEDED
+export CFLAGS+=' -Wno-unused-local-typedefs'
MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
-%cmake . -DFULLVER=%{version} -DMAJORVER=${MAJORVER}
+cmake -DCMAKE_INSTALL_PREFIX=/usr -DFULLVER=%{version} -DMAJORVER=${MAJORVER} \
+ -DLIB_PATH=%{_lib} \
+%if 0%{?model_build_feature_network_dsds} == 1
+ -DTIZEN_DUALSIM_ENABLE=1 \
+%endif
+%if "%{?tizen_profile_name}" == "wearable"
+ -DTIZEN_WEARABLE=1 \
+%else
+%if "%{?tizen_profile_name}" == "mobile"
+ -DTIZEN_MOBILE=1 \
+%else
+%if "%{?tizen_profile_name}" == "tv"
+ -DTIZEN_TV=1 \
+%endif
+%endif
+%endif
+ .
make %{?_smp_mflags}
#License
mkdir -p %{buildroot}%{_datadir}/license
-cp LICENSE.APLv2 %{buildroot}%{_datadir}/license/capi-network-connection
+cp LICENSE %{buildroot}%{_datadir}/license/capi-network-connection
%post -p /sbin/ldconfig
%files
-%manifest %{name}.manifest
+%manifest capi-network-connection.manifest
%attr(644,-,-) %{_libdir}/libcapi-network-connection.so.*
%{_datadir}/license/capi-network-connection
%{_bindir}/connection_test
%files devel
-%manifest %{name}.manifest
%{_includedir}/network/*.h
%{_libdir}/pkgconfig/*.pc
%{_libdir}/libcapi-network-connection.so
* limitations under the License.
*/
+#include <glib.h>
#include <stdio.h>
#include <string.h>
-#include <glib.h>
#include <vconf/vconf.h>
-#include "net_connection_private.h"
-static GSList *conn_handle_list = NULL;
+#include "net_connection_private.h"
-static void __connection_cb_state_change_cb(keynode_t *node, void *user_data);
-static void __connection_cb_ip_change_cb(keynode_t *node, void *user_data);
-static void __connection_cb_proxy_change_cb(keynode_t *node, void *user_data);
+static __thread GSList *conn_handle_list = NULL;
static int __connection_convert_net_state(int status)
{
}
}
-static int __connection_get_type_changed_callback_count(void)
+static bool __connection_check_handle_validity(connection_h connection)
{
- GSList *list;
- int count = 0;
+ bool ret = false;
- for (list = conn_handle_list; list; list = list->next) {
- connection_handle_s *local_handle = (connection_handle_s *)list->data;
- if (local_handle->type_changed_callback) count++;
- }
+ if (connection == NULL)
+ return false;
- return count;
+ if (g_slist_find(conn_handle_list, connection) != NULL)
+ ret = true;
+
+ return ret;
}
-static int __connection_get_ip_changed_callback_count(void)
+static connection_type_changed_cb
+__connection_get_type_changed_callback(connection_handle_s *local_handle)
{
- GSList *list;
- int count = 0;
+ return local_handle->type_changed_callback;
+}
- for (list = conn_handle_list; list; list = list->next) {
- connection_handle_s *local_handle = (connection_handle_s *)list->data;
- if (local_handle->ip_changed_callback) count++;
- }
+static void *__connection_get_type_changed_userdata(
+ connection_handle_s *local_handle)
+{
+ return local_handle->type_changed_user_data;
+}
- return count;
+static gboolean __connection_cb_type_changed_cb_idle(gpointer user_data)
+{
+ int state, status;
+ void *data;
+ connection_type_changed_cb callback;
+ connection_handle_s *local_handle = (connection_handle_s *)user_data;
+
+ if (__connection_check_handle_validity((connection_h)local_handle) != true)
+ return FALSE;
+
+ if (vconf_get_int(VCONFKEY_NETWORK_STATUS, &status) != 0)
+ return FALSE;
+
+ state = __connection_convert_net_state(status);
+
+ callback = __connection_get_type_changed_callback(local_handle);
+ data = __connection_get_type_changed_userdata(local_handle);
+ if (callback)
+ callback(state, data);
+
+ return FALSE;
}
-static int __connection_get_proxy_changed_callback_count(void)
+static void __connection_cb_type_change_cb(keynode_t *node, void *user_data)
{
GSList *list;
- int count = 0;
+ connection_h handle;
- for (list = conn_handle_list; list; list = list->next) {
- connection_handle_s *local_handle = (connection_handle_s *)list->data;
- if (local_handle->proxy_changed_callback) count++;
+ if (_connection_is_created() != true) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Application is not registered"
+ "If multi-threaded, thread integrity be broken.");
+ return;
}
- return count;
+ for (list = conn_handle_list; list; list = list->next) {
+ handle = (connection_h)list->data;
+ _connection_callback_add(__connection_cb_type_changed_cb_idle, (gpointer)handle);
+ }
}
static void __connection_cb_ethernet_cable_state_changed_cb(connection_ethernet_cable_state_e state)
static int __connection_set_type_changed_callback(connection_h connection,
void *callback, void *user_data)
{
- connection_handle_s *local_handle = (connection_handle_s *)connection;
+ static __thread gint refcount = 0;
+ connection_handle_s *local_handle;
+
+ local_handle = (connection_handle_s *)connection;
if (callback) {
- if (__connection_get_type_changed_callback_count() == 0)
- if (vconf_notify_key_changed(VCONFKEY_NETWORK_STATUS ,
- __connection_cb_state_change_cb, NULL))
- return CONNECTION_ERROR_OPERATION_FAILED;
+ if (refcount == 0)
+ vconf_notify_key_changed(VCONFKEY_NETWORK_STATUS,
+ __connection_cb_type_change_cb, NULL);
- local_handle->type_changed_user_data = user_data;
+ refcount++;
+ CONNECTION_LOG(CONNECTION_INFO, "Successfully registered(%d)", refcount);
} else {
- if (local_handle->type_changed_callback &&
- __connection_get_type_changed_callback_count() == 1)
- if (vconf_ignore_key_changed(VCONFKEY_NETWORK_STATUS,
- __connection_cb_state_change_cb))
- return CONNECTION_ERROR_OPERATION_FAILED;
+ if (refcount > 0 &&
+ __connection_get_type_changed_callback(local_handle) != NULL) {
+ if (--refcount == 0) {
+ if (vconf_ignore_key_changed(VCONFKEY_NETWORK_STATUS,
+ __connection_cb_type_change_cb) < 0) {
+ CONNECTION_LOG(CONNECTION_ERROR,
+ "Error to de-register vconf callback(%d)", refcount);
+ } else {
+ CONNECTION_LOG(CONNECTION_INFO,
+ "Successfully de-registered(%d)", refcount);
+ }
+ }
+ }
}
+ local_handle->type_changed_user_data = user_data;
local_handle->type_changed_callback = callback;
+
return CONNECTION_ERROR_NONE;
}
-static int __connection_set_ip_changed_callback(connection_h connection,
- void *callback, void *user_data)
+static connection_address_changed_cb
+__connection_get_ip_changed_callback(connection_handle_s *local_handle)
{
- connection_handle_s *local_handle = (connection_handle_s *)connection;
+ return local_handle->ip_changed_callback;
+}
- if (callback) {
- if (__connection_get_ip_changed_callback_count() == 0)
- if (vconf_notify_key_changed(VCONFKEY_NETWORK_IP,
- __connection_cb_ip_change_cb, NULL))
- return CONNECTION_ERROR_OPERATION_FAILED;
+static void *__connection_get_ip_changed_userdata(
+ connection_handle_s *local_handle)
+{
+ return local_handle->ip_changed_user_data;
+}
- local_handle->ip_changed_user_data = user_data;
- } else {
- if (local_handle->ip_changed_callback &&
- __connection_get_ip_changed_callback_count() == 1)
- if (vconf_ignore_key_changed(VCONFKEY_NETWORK_IP,
- __connection_cb_ip_change_cb))
- return CONNECTION_ERROR_OPERATION_FAILED;
+static gboolean __connection_cb_ip_changed_cb_idle(gpointer user_data)
+{
+ char *ip_addr;
+ void *data;
+ connection_address_changed_cb callback;
+ connection_handle_s *local_handle = (connection_handle_s *)user_data;
+
+ if (__connection_check_handle_validity((connection_h)local_handle) != true)
+ return FALSE;
+
+ ip_addr = vconf_get_str(VCONFKEY_NETWORK_IP);
+
+ callback = __connection_get_ip_changed_callback(local_handle);
+ data = __connection_get_ip_changed_userdata(local_handle);
+ /* TODO: IPv6 should be supported */
+ if (callback)
+ callback(ip_addr, NULL, data);
+
+ return FALSE;
+}
+
+static void __connection_cb_ip_change_cb(keynode_t *node, void *user_data)
+{
+ GSList *list;
+ connection_h handle;
+
+ if (_connection_is_created() != true) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Application is not registered"
+ "If multi-threaded, thread integrity be broken.");
+ return;
}
- local_handle->ip_changed_callback = callback;
- return CONNECTION_ERROR_NONE;
+ for (list = conn_handle_list; list; list = list->next) {
+ handle = (connection_h)list->data;
+ _connection_callback_add(__connection_cb_ip_changed_cb_idle, (gpointer)handle);
+ }
}
-static int __connection_set_proxy_changed_callback(connection_h connection,
+static int __connection_set_ip_changed_callback(connection_h connection,
void *callback, void *user_data)
{
- connection_handle_s *local_handle = (connection_handle_s *)connection;
+ static __thread gint refcount = 0;
+ connection_handle_s *local_handle;
+
+ local_handle = (connection_handle_s *)connection;
if (callback) {
- if (__connection_get_proxy_changed_callback_count() == 0)
- if (vconf_notify_key_changed(VCONFKEY_NETWORK_PROXY,
- __connection_cb_proxy_change_cb, NULL))
- return CONNECTION_ERROR_OPERATION_FAILED;
+ if (refcount == 0)
+ vconf_notify_key_changed(VCONFKEY_NETWORK_IP,
+ __connection_cb_ip_change_cb, NULL);
- local_handle->proxy_changed_user_data = user_data;
+ refcount++;
+ CONNECTION_LOG(CONNECTION_INFO, "Successfully registered(%d)", refcount);
} else {
- if (local_handle->proxy_changed_callback &&
- __connection_get_proxy_changed_callback_count() == 1)
- if (vconf_ignore_key_changed(VCONFKEY_NETWORK_PROXY,
- __connection_cb_proxy_change_cb))
- return CONNECTION_ERROR_OPERATION_FAILED;
+ if (refcount > 0 &&
+ __connection_get_ip_changed_callback(local_handle) != NULL) {
+ if (--refcount == 0) {
+ if (vconf_ignore_key_changed(VCONFKEY_NETWORK_IP,
+ __connection_cb_ip_change_cb) < 0) {
+ CONNECTION_LOG(CONNECTION_ERROR,
+ "Error to de-register vconf callback(%d)", refcount);
+ } else {
+ CONNECTION_LOG(CONNECTION_INFO,
+ "Successfully de-registered(%d)", refcount);
+ }
+ }
+ }
}
- local_handle->proxy_changed_callback = callback;
+ local_handle->ip_changed_user_data = user_data;
+ local_handle->ip_changed_callback = callback;
+
return CONNECTION_ERROR_NONE;
}
-static void __connection_cb_state_change_cb(keynode_t *node, void *user_data)
+static connection_address_changed_cb
+__connection_get_proxy_changed_callback(connection_handle_s *local_handle)
{
- CONNECTION_LOG(CONNECTION_INFO, "Net Status Changed Indication\n");
-
- GSList *list;
- int state = vconf_keynode_get_int(node);
+ return local_handle->proxy_changed_callback;
+}
- for (list = conn_handle_list; list; list = list->next) {
- connection_handle_s *local_handle = (connection_handle_s *)list->data;
- if (local_handle->type_changed_callback)
- local_handle->type_changed_callback(
- __connection_convert_net_state(state),
- local_handle->type_changed_user_data);
- }
+static void *__connection_get_proxy_changed_userdata(
+ connection_handle_s *local_handle)
+{
+ return local_handle->proxy_changed_user_data;
}
-static void __connection_cb_ip_change_cb(keynode_t *node, void *user_data)
+static gboolean __connection_cb_proxy_changed_cb_idle(gpointer user_data)
{
- CONNECTION_LOG(CONNECTION_INFO, "Net IP Changed Indication\n");
+ char *proxy;
+ void *data;
+ connection_address_changed_cb callback;
+ connection_handle_s *local_handle = (connection_handle_s *)user_data;
- GSList *list;
- char *ip_addr = vconf_keynode_get_str(node);
+ if (__connection_check_handle_validity((connection_h)local_handle) != true)
+ return FALSE;
- for (list = conn_handle_list; list; list = list->next) {
- connection_handle_s *local_handle = (connection_handle_s *)list->data;
- if (local_handle->ip_changed_callback)
- local_handle->ip_changed_callback(
- ip_addr, NULL,
- local_handle->ip_changed_user_data);
- }
+ proxy = vconf_get_str(VCONFKEY_NETWORK_PROXY);
+
+ callback = __connection_get_proxy_changed_callback(local_handle);
+ data = __connection_get_proxy_changed_userdata(local_handle);
+ /* TODO: IPv6 should be supported */
+ if (callback)
+ callback(proxy, NULL, data);
+
+ return FALSE;
}
static void __connection_cb_proxy_change_cb(keynode_t *node, void *user_data)
{
- CONNECTION_LOG(CONNECTION_INFO, "Net IP Changed Indication\n");
-
GSList *list;
- char *proxy = vconf_keynode_get_str(node);
+ connection_h handle;
+
+ if (_connection_is_created() != true) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Application is not registered"
+ "If multi-threaded, thread integrity be broken.");
+ return;
+ }
for (list = conn_handle_list; list; list = list->next) {
- connection_handle_s *local_handle = (connection_handle_s *)list->data;
- if (local_handle->proxy_changed_callback)
- local_handle->proxy_changed_callback(
- proxy, NULL,
- local_handle->proxy_changed_user_data);
+ handle = (connection_h)list->data;
+ _connection_callback_add(__connection_cb_proxy_changed_cb_idle, (gpointer)handle);
}
}
-static bool __connection_check_handle_validity(connection_h connection)
+static int __connection_set_proxy_changed_callback(connection_h connection,
+ void *callback, void *user_data)
{
- bool ret = false;
+ static __thread gint refcount = 0;
+ connection_handle_s *local_handle;
- if (connection == NULL)
- return false;
+ local_handle = (connection_handle_s *)connection;
- if (g_slist_find(conn_handle_list, connection) != NULL)
- ret = true;
+ if (callback) {
+ if (refcount == 0)
+ vconf_notify_key_changed(VCONFKEY_NETWORK_PROXY,
+ __connection_cb_proxy_change_cb, NULL);
- return ret;
+ refcount++;
+ CONNECTION_LOG(CONNECTION_INFO, "Successfully registered(%d)", refcount);
+ } else {
+ if (refcount > 0 &&
+ __connection_get_proxy_changed_callback(local_handle) != NULL) {
+ if (--refcount == 0) {
+ if (vconf_ignore_key_changed(VCONFKEY_NETWORK_PROXY,
+ __connection_cb_proxy_change_cb) < 0) {
+ CONNECTION_LOG(CONNECTION_ERROR,
+ "Error to de-register vconf callback(%d)", refcount);
+ } else {
+ CONNECTION_LOG(CONNECTION_INFO,
+ "Successfully de-registered(%d)", refcount);
+ }
+ }
+ }
+ }
+
+ local_handle->proxy_changed_user_data = user_data;
+ local_handle->proxy_changed_callback = callback;
+
+ return CONNECTION_ERROR_NONE;
}
static int __connection_set_ethernet_cable_state_changed_cb(connection_h connection,
static int __connection_get_handle_count(void)
{
- GSList *list;
- int count = 0;
-
- if (!conn_handle_list)
- return count;
-
- for (list = conn_handle_list; list; list = list->next) count++;
-
- return count;
+ return ((int)g_slist_length(conn_handle_list));
}
/* Connection Manager ********************************************************/
-EXPORT_API int connection_create(connection_h* connection)
+EXPORT_API int connection_create(connection_h *connection)
{
CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
- CONNECTION_MUTEX_LOCK;
- int rv;
if (connection == NULL || __connection_check_handle_validity(*connection)) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
- CONNECTION_MUTEX_UNLOCK;
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
- rv = _connection_libnet_init();
+ int rv = _connection_libnet_init();
if (rv == NET_ERR_ACCESS_DENIED) {
CONNECTION_LOG(CONNECTION_ERROR, "Access denied");
- CONNECTION_MUTEX_UNLOCK;
return CONNECTION_ERROR_PERMISSION_DENIED;
}
else if (rv != NET_ERR_NONE) {
CONNECTION_LOG(CONNECTION_ERROR, "Failed to create connection[%d]", rv);
- CONNECTION_MUTEX_UNLOCK;
return CONNECTION_ERROR_OPERATION_FAILED;
}
*connection = g_try_malloc0(sizeof(connection_handle_s));
- if (*connection != NULL) {
- CONNECTION_LOG(CONNECTION_INFO, "New Handle Created %p\n", *connection);
- } else {
- CONNECTION_MUTEX_UNLOCK;
+ if (*connection != NULL)
+ CONNECTION_LOG(CONNECTION_INFO, "New handle created[%p]", *connection);
+ else
return CONNECTION_ERROR_OUT_OF_MEMORY;
- }
- conn_handle_list = g_slist_append(conn_handle_list, *connection);
+ conn_handle_list = g_slist_prepend(conn_handle_list, *connection);
- CONNECTION_MUTEX_UNLOCK;
return CONNECTION_ERROR_NONE;
}
{
CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
- CONNECTION_MUTEX_LOCK;
-
- if (connection == NULL || !(__connection_check_handle_validity(connection))) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
- CONNECTION_MUTEX_UNLOCK;
+ if (!(__connection_check_handle_validity(connection))) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
- CONNECTION_LOG(CONNECTION_INFO, "Destroy Handle : %p\n", connection);
+ CONNECTION_LOG(CONNECTION_INFO, "Destroy handle: %p", connection);
__connection_set_type_changed_callback(connection, NULL, NULL);
__connection_set_ip_changed_callback(connection, NULL, NULL);
conn_handle_list = g_slist_remove(conn_handle_list, connection);
g_free(connection);
+ connection = NULL;
- if (__connection_get_handle_count() == 0)
+ if (__connection_get_handle_count() == 0) {
_connection_libnet_deinit();
+ _connection_callback_cleanup();
+ }
- CONNECTION_MUTEX_UNLOCK;
return CONNECTION_ERROR_NONE;
}
EXPORT_API int connection_get_type(connection_h connection, connection_type_e* type)
{
+ int rv = 0;
int status = 0;
CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
if (type == NULL || !(__connection_check_handle_validity(connection))) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
- if (vconf_get_int(VCONFKEY_NETWORK_STATUS, &status)) {
- CONNECTION_LOG(CONNECTION_ERROR, "vconf_get_int Failed = %d\n", status);
+ rv = vconf_get_int(VCONFKEY_NETWORK_STATUS, &status);
+ if (rv != VCONF_OK) {
+ CONNECTION_LOG(CONNECTION_ERROR, "vconf_get_int Failed = %d", status);
return CONNECTION_ERROR_OPERATION_FAILED;
}
- CONNECTION_LOG(CONNECTION_INFO, "Connected Network = %d\n", status);
+ CONNECTION_LOG(CONNECTION_INFO, "Connected Network = %d", status);
*type = __connection_convert_net_state(status);
}
EXPORT_API int connection_get_ip_address(connection_h connection,
- connection_address_family_e address_family, char **ip_address)
+ connection_address_family_e address_family, char** ip_address)
{
CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
case CONNECTION_ADDRESS_FAMILY_IPV6:
*ip_address = vconf_get_str(VCONFKEY_NETWORK_IP);
break;
-
default:
CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
EXPORT_API int connection_get_proxy(connection_h connection,
- connection_address_family_e address_family, char **proxy)
+ connection_address_family_e address_family, char** proxy)
{
CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
case CONNECTION_ADDRESS_FAMILY_IPV6:
*proxy = vconf_get_str(VCONFKEY_NETWORK_PROXY);
break;
-
default:
CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
switch (type) {
case CONNECTION_TYPE_WIFI:
+#if defined TIZEN_TV
fp = fopen(WIFI_MAC_INFO_FILE, "r");
if (fp == NULL) {
CONNECTION_LOG(CONNECTION_ERROR, "Failed to open file %s", WIFI_MAC_INFO_FILE);
}
g_strlcpy(*mac_addr, buf, CONNECTION_MAC_INFO_LENGTH + 1);
fclose(fp);
+#else
+ *mac_addr = vconf_get_str(VCONFKEY_WIFI_BSSID_ADDRESS);
+
+ if(*mac_addr == NULL) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Failed to get vconf from %s", VCONFKEY_WIFI_BSSID_ADDRESS);
+ return CONNECTION_ERROR_OPERATION_FAILED;
+ }
+#endif
break;
case CONNECTION_TYPE_ETHERNET:
fp = fopen(ETHERNET_MAC_INFO_FILE, "r");
EXPORT_API int connection_get_cellular_state(connection_h connection, connection_cellular_state_e* state)
{
+ int rv = 0;
int status = 0;
int cellular_state = 0;
+#if defined TIZEN_DUALSIM_ENABLE
+ int sim_id = 0;
+#endif
CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE);
if (state == NULL || !(__connection_check_handle_validity(connection))) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
- if (!vconf_get_int(VCONFKEY_NETWORK_CELLULAR_STATE, &status)) {
- CONNECTION_LOG(CONNECTION_INFO, "Cellular = %d\n", status);
- *state = __connection_convert_cellular_state(status);
+ rv = vconf_get_int(VCONFKEY_NETWORK_CELLULAR_STATE, &status);
+ if (rv != VCONF_OK) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Failed to get cellular state");
+ return CONNECTION_ERROR_OPERATION_FAILED;
+ }
- if (*state == CONNECTION_CELLULAR_STATE_AVAILABLE) {
- if (vconf_get_int(VCONFKEY_DNET_STATE, &cellular_state)) {
- CONNECTION_LOG(CONNECTION_ERROR,
- "vconf_get_int Failed = %d\n", cellular_state);
- return CONNECTION_ERROR_OPERATION_FAILED;
- }
+ CONNECTION_LOG(CONNECTION_INFO, "Cellular: %d", status);
+ *state = __connection_convert_cellular_state(status);
+
+ if (*state == CONNECTION_CELLULAR_STATE_AVAILABLE) {
+#if defined TIZEN_DUALSIM_ENABLE
+ rv = vconf_get_int(VCONF_TELEPHONY_DEFAULT_DATA_SERVICE, &sim_id);
+ if (rv != VCONF_OK) {
+ CONNECTION_LOG(CONNECTION_ERROR,
+ "Failed to get default subscriber id", sim_id);
+ return CONNECTION_ERROR_OPERATION_FAILED;
}
- CONNECTION_LOG(CONNECTION_INFO, "Connection state = %d\n", cellular_state);
+ switch (sim_id) {
+ case CONNECTION_CELLULAR_SUBSCRIBER_1:
+#endif
+ rv = vconf_get_int(VCONFKEY_DNET_STATE, &cellular_state);
+#if defined TIZEN_DUALSIM_ENABLE
+ break;
- if (cellular_state == VCONFKEY_DNET_NORMAL_CONNECTED ||
- cellular_state == VCONFKEY_DNET_SECURE_CONNECTED ||
- cellular_state == VCONFKEY_DNET_TRANSFER)
- *state = CONNECTION_CELLULAR_STATE_CONNECTED;
+ case CONNECTION_CELLULAR_SUBSCRIBER_2:
+ rv = vconf_get_int(VCONFKEY_DNET_STATE2, &cellular_state);
+ break;
- return CONNECTION_ERROR_NONE;
- } else {
- CONNECTION_LOG(CONNECTION_ERROR, "vconf_get_int Failed = %d\n", status);
- return CONNECTION_ERROR_OPERATION_FAILED;
+ default:
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid subscriber id:%d", sim_id);
+ return CONNECTION_ERROR_OPERATION_FAILED;
+ }
+#endif
+ if (rv != VCONF_OK) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Failed to get cellular state");
+ return CONNECTION_ERROR_OPERATION_FAILED;
+ }
}
+
+ CONNECTION_LOG(CONNECTION_INFO, "Cellular state: %d", cellular_state);
+
+ if (cellular_state == VCONFKEY_DNET_NORMAL_CONNECTED ||
+ cellular_state == VCONFKEY_DNET_SECURE_CONNECTED ||
+ cellular_state == VCONFKEY_DNET_TRANSFER)
+ *state = CONNECTION_CELLULAR_STATE_CONNECTED;
+
+ return CONNECTION_ERROR_NONE;
}
EXPORT_API int connection_get_wifi_state(connection_h connection, connection_wifi_state_e* state)
{
CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
- int rv;
-
if (state == NULL || !(__connection_check_handle_validity(connection))) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
- rv = _connection_libnet_get_wifi_state(state);
+ int 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);
+ CONNECTION_LOG(CONNECTION_INFO, "Wi-Fi state: %d", *state);
return CONNECTION_ERROR_NONE;
}
CHECK_FEATURE_SUPPORTED(ETHERNET_FEATURE);
if (state == NULL || !(__connection_check_handle_validity(connection))) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
CHECK_FEATURE_SUPPORTED(TETHERING_BLUETOOTH_FEATURE);
if (state == NULL || !(__connection_check_handle_validity(connection))) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
return _connection_libnet_get_bluetooth_state(state);
-
}
EXPORT_API int connection_set_type_changed_cb(connection_h connection,
CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
if (callback == NULL || !(__connection_check_handle_validity(connection))) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
if (!(__connection_check_handle_validity(connection))) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
if (callback == NULL || !(__connection_check_handle_validity(connection))) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
if (!(__connection_check_handle_validity(connection))) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
if (callback == NULL || !(__connection_check_handle_validity(connection))) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
if (!(__connection_check_handle_validity(connection))) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
EXPORT_API int connection_add_profile(connection_h connection, connection_profile_h profile)
{
+ int rv = 0;
+ net_profile_info_t *profile_info = profile;
+
CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE);
if (!(__connection_check_handle_validity(connection)) ||
!(_connection_libnet_check_profile_validity(profile))) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
- int rv = 0;
-
- net_profile_info_t *profile_info = profile;
-
if (profile_info->profile_type != NET_DEVICE_CELLULAR) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
+ return CONNECTION_ERROR_INVALID_PARAMETER;
+ }
+
+ if (profile_info->ProfileInfo.Pdp.PSModemPath[0] != '/' ||
+ strlen(profile_info->ProfileInfo.Pdp.PSModemPath) < 2) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Modem object path is NULL");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
- rv = net_add_profile(profile_info->ProfileInfo.Pdp.ServiceType, (net_profile_info_t*)profile);
+ rv = net_add_profile(profile_info->ProfileInfo.Pdp.ServiceType,
+ (net_profile_info_t*)profile);
if (rv == NET_ERR_ACCESS_DENIED) {
CONNECTION_LOG(CONNECTION_ERROR, "Access denied");
return CONNECTION_ERROR_PERMISSION_DENIED;
EXPORT_API int connection_remove_profile(connection_h connection, connection_profile_h profile)
{
+ int rv = 0;
+ net_profile_info_t *profile_info = profile;
+
CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE);
if (!(__connection_check_handle_validity(connection)) ||
- !(_connection_libnet_check_profile_validity(profile))) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
+ !(_connection_libnet_check_profile_validity(profile))) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
- int rv = 0;
- net_profile_info_t *profile_info = profile;
-
if (profile_info->profile_type != NET_DEVICE_CELLULAR &&
profile_info->profile_type != NET_DEVICE_WIFI) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
EXPORT_API int connection_update_profile(connection_h connection, connection_profile_h profile)
{
+ int rv = 0;
+ net_profile_info_t *profile_info = profile;
+
CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, ETHERNET_FEATURE);
if (!(__connection_check_handle_validity(connection)) ||
!(_connection_libnet_check_profile_validity(profile))) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
- int rv = 0;
- net_profile_info_t *profile_info = profile;
-
rv = net_modify_profile(profile_info->ProfileName, (net_profile_info_t*)profile);
if (rv == NET_ERR_ACCESS_DENIED) {
CONNECTION_LOG(CONNECTION_ERROR, "Access denied");
CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
if (!(__connection_check_handle_validity(connection)) || profile == NULL) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
return _connection_libnet_get_current_profile(profile);
}
-EXPORT_API int connection_get_default_cellular_service_profile(connection_h connection,
- connection_cellular_service_type_e type, connection_profile_h* profile)
+EXPORT_API int connection_get_default_cellular_service_profile(
+ connection_h connection, connection_cellular_service_type_e type,
+ connection_profile_h *profile)
{
CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE);
if (!(__connection_check_handle_validity(connection)) || profile == NULL) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE);
if (!(__connection_check_handle_validity(connection)) || profile == NULL) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
if (!(__connection_check_handle_validity(connection)) ||
profile == NULL || callback == NULL) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
if (!(__connection_check_handle_validity(connection)) ||
profile == NULL || callback == NULL) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
if (!(__connection_check_handle_validity(connection)) ||
profile == NULL || callback == NULL) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
if (!(__connection_check_handle_validity(connection)) ||
interface_name == NULL || host_address == NULL) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
return _connection_libnet_remove_route_ipv6(interface_name, host_address, gateway);
}
-/* Connection Statistics module ******************************************************************/
-
-static int __get_statistic(connection_type_e connection_type,
- connection_statistics_type_e statistics_type, long long* llsize)
+static int __get_cellular_statistic(connection_statistics_type_e statistics_type, long long *llsize)
{
- int rv, size;
- unsigned long long ull_size;
- int stat_type;
- char *key = NULL;
+ int rv = VCONF_OK, rv1 = VCONF_OK;
+ int last_size = 0, size = 0;
+#if defined TIZEN_DUALSIM_ENABLE
+ int sim_id = 0;
+#endif
if (llsize == NULL) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
- if (connection_type == CONNECTION_TYPE_CELLULAR) {
+ switch (statistics_type) {
+ case CONNECTION_STATISTICS_TYPE_LAST_SENT_DATA:
+ case CONNECTION_STATISTICS_TYPE_LAST_RECEIVED_DATA:
+ case CONNECTION_STATISTICS_TYPE_TOTAL_SENT_DATA:
+ case CONNECTION_STATISTICS_TYPE_TOTAL_RECEIVED_DATA:
+ break;
+ default:
+ return CONNECTION_ERROR_INVALID_PARAMETER;
+ }
+
+#if defined TIZEN_DUALSIM_ENABLE
+ rv = vconf_get_int(VCONF_TELEPHONY_DEFAULT_DATA_SERVICE, &sim_id);
+ if (rv != VCONF_OK) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Failed to get default subscriber id");
+ *llsize = 0;
+ return CONNECTION_ERROR_OPERATION_FAILED;
+ }
+
+ switch (sim_id) {
+ case 0:
+#endif
switch (statistics_type) {
case CONNECTION_STATISTICS_TYPE_LAST_SENT_DATA:
- key = VCONFKEY_NETWORK_CELLULAR_PKT_LAST_SNT;
+ rv = vconf_get_int(VCONFKEY_NETWORK_CELLULAR_PKT_LAST_SNT, &last_size);
break;
case CONNECTION_STATISTICS_TYPE_LAST_RECEIVED_DATA:
- key = VCONFKEY_NETWORK_CELLULAR_PKT_LAST_RCV;
+ rv = vconf_get_int(VCONFKEY_NETWORK_CELLULAR_PKT_LAST_RCV, &last_size);
break;
case CONNECTION_STATISTICS_TYPE_TOTAL_SENT_DATA:
- key = VCONFKEY_NETWORK_CELLULAR_PKT_TOTAL_SNT;
+ rv = vconf_get_int(VCONFKEY_NETWORK_CELLULAR_PKT_LAST_SNT, &last_size);
+ rv1 = vconf_get_int(VCONFKEY_NETWORK_CELLULAR_PKT_TOTAL_SNT, &size);
break;
case CONNECTION_STATISTICS_TYPE_TOTAL_RECEIVED_DATA:
- key = VCONFKEY_NETWORK_CELLULAR_PKT_TOTAL_RCV;
+ rv = vconf_get_int(VCONFKEY_NETWORK_CELLULAR_PKT_LAST_RCV, &last_size);
+ rv1 = vconf_get_int(VCONFKEY_NETWORK_CELLULAR_PKT_TOTAL_RCV, &size);
break;
- default:
- return CONNECTION_ERROR_INVALID_PARAMETER;
}
-
- if (vconf_get_int(key, &size)) {
- CONNECTION_LOG(CONNECTION_ERROR, "Cannot Get %s = %d\n", key, size);
- *llsize = 0;
- return CONNECTION_ERROR_OPERATION_FAILED;
+#if defined TIZEN_DUALSIM_ENABLE
+ break;
+ case 1:
+ switch (statistics_type) {
+ case CONNECTION_STATISTICS_TYPE_LAST_SENT_DATA:
+ rv = vconf_get_int(VCONFKEY_NETWORK_CELLULAR_PKT_LAST_SNT2, &last_size);
+ break;
+ case CONNECTION_STATISTICS_TYPE_LAST_RECEIVED_DATA:
+ rv = vconf_get_int(VCONFKEY_NETWORK_CELLULAR_PKT_LAST_RCV2, &last_size);
+ break;
+ case CONNECTION_STATISTICS_TYPE_TOTAL_SENT_DATA:
+ rv = vconf_get_int(VCONFKEY_NETWORK_CELLULAR_PKT_LAST_SNT2, &last_size);
+ rv1 = vconf_get_int(VCONFKEY_NETWORK_CELLULAR_PKT_TOTAL_SNT2, &size);
+ break;
+ case CONNECTION_STATISTICS_TYPE_TOTAL_RECEIVED_DATA:
+ rv = vconf_get_int(VCONFKEY_NETWORK_CELLULAR_PKT_LAST_RCV2, &last_size);
+ rv1 = vconf_get_int(VCONFKEY_NETWORK_CELLULAR_PKT_TOTAL_RCV2, &size);
+ break;
}
+ break;
+ default:
+ *llsize = 0;
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid subscriber id:%d", sim_id);
+ return CONNECTION_ERROR_OPERATION_FAILED;
+ }
+#endif
- CONNECTION_LOG(CONNECTION_INFO,"%s:%d bytes\n", key, size);
- *llsize = (long long)size;
- } else if (connection_type == CONNECTION_TYPE_WIFI) {
+ if (rv != VCONF_OK || rv1 != VCONF_OK) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Failed to get cellular statistics");
+ return CONNECTION_ERROR_OPERATION_FAILED;
+ }
+
+ *llsize = (long long)(last_size * 1000 + size * 1000);
+ CONNECTION_LOG(CONNECTION_INFO,"%lld bytes", *llsize);
+
+ return CONNECTION_ERROR_NONE;
+}
+
+static int __get_statistic(connection_type_e connection_type,
+ connection_statistics_type_e statistics_type, long long *llsize)
+{
+ int rv, stat_type;
+ unsigned long long ull_size;
+
+ if (llsize == NULL) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
+ return CONNECTION_ERROR_INVALID_PARAMETER;
+ }
+
+ rv = _connection_libnet_check_get_privilege();
+ if (rv == CONNECTION_ERROR_PERMISSION_DENIED)
+ return rv;
+ else if (rv != CONNECTION_ERROR_NONE) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Failed to get statistics");
+ return CONNECTION_ERROR_OPERATION_FAILED;
+ }
+
+ if (connection_type == CONNECTION_TYPE_CELLULAR)
+ return __get_cellular_statistic(statistics_type, llsize);
+ else if (connection_type == CONNECTION_TYPE_WIFI) {
switch (statistics_type) {
case CONNECTION_STATISTICS_TYPE_LAST_SENT_DATA:
stat_type = NET_STATISTICS_TYPE_LAST_SENT_DATA;
return CONNECTION_ERROR_OPERATION_FAILED;
}
- CONNECTION_LOG(CONNECTION_INFO,"%d bytes\n", ull_size);
+ CONNECTION_LOG(CONNECTION_INFO,"%lld bytes", ull_size);
*llsize = (long long)ull_size;
} else
return CONNECTION_ERROR_INVALID_PARAMETER;
}
static int __reset_statistic(connection_type_e connection_type,
- connection_statistics_type_e statistics_type)
+ connection_statistics_type_e statistics_type)
{
int conn_type;
int stat_type;
}
rv = _connection_libnet_set_statistics(conn_type, stat_type);
- if(rv != CONNECTION_ERROR_NONE)
+ if (rv != CONNECTION_ERROR_NONE)
return rv;
-
- CONNECTION_LOG(CONNECTION_INFO,"connection_reset_statistics success\n");
+ CONNECTION_LOG(CONNECTION_INFO,"connection_reset_statistics success");
return CONNECTION_ERROR_NONE;
}
else if(connection_type == CONNECTION_TYPE_WIFI)
CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
- if (!(__connection_check_handle_validity(connection))) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed");
+ if (!__connection_check_handle_validity(connection)) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
return __reset_statistic(connection_type, statistics_type);
}
+
* limitations under the License.
*/
+#include <glib.h>
#include <stdio.h>
-#include <string.h>
#include <stdlib.h>
+#include <string.h>
#include <arpa/inet.h>
-#include <glib.h>
#include <vconf/vconf.h>
+
#include "net_connection_private.h"
#define HTTP_PROXY "http_proxy"
{
char *proxy;
- proxy = getenv(HTTP_PROXY);
+ proxy = vconf_get_str(VCONFKEY_NETWORK_PROXY);
- if(proxy == NULL) {
+ if (proxy == NULL) {
CONNECTION_LOG(CONNECTION_ERROR, "Fail to get system proxy");
return NULL;
}
else if(type == CONNECTION_PROFILE_TYPE_WIFI)
CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
- if ((type != CONNECTION_PROFILE_TYPE_CELLULAR &&
- type != CONNECTION_PROFILE_TYPE_WIFI) || profile == NULL) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
+ if (type != CONNECTION_PROFILE_TYPE_CELLULAR &&
+ type != CONNECTION_PROFILE_TYPE_WIFI) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
+ if (profile == NULL) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
+ return CONNECTION_ERROR_INVALID_PARAMETER;
+ }
+
+ int rv = _connection_libnet_check_profile_privilege();
+ if (rv == CONNECTION_ERROR_PERMISSION_DENIED)
+ return rv;
+ else if (rv != CONNECTION_ERROR_NONE) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Failed to create profile");
+ return CONNECTION_ERROR_OPERATION_FAILED;
+ }
+
net_profile_info_t *profile_info = g_try_malloc0(sizeof(net_profile_info_t));
if (profile_info == NULL)
return CONNECTION_ERROR_OUT_OF_MEMORY;
switch (type) {
case CONNECTION_PROFILE_TYPE_CELLULAR:
if (keyword == NULL) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
g_free(profile_info);
return CONNECTION_ERROR_INVALID_PARAMETER;
}
CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
if (!(_connection_libnet_check_profile_validity(profile))) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
if (!(_connection_libnet_check_profile_validity(origin_profile)) || cloned_profile == NULL) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
if (!(_connection_libnet_check_profile_validity(profile)) || profile_id == NULL) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
if (!(_connection_libnet_check_profile_validity(profile)) || profile_name == NULL) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
if (!(_connection_libnet_check_profile_validity(profile)) || type == NULL) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
*type = CONNECTION_PROFILE_TYPE_BT;
break;
default:
- CONNECTION_LOG(CONNECTION_ERROR, "Invalid profile type\n");
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid profile type");
return CONNECTION_ERROR_OPERATION_FAILED;
}
CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
if (!(_connection_libnet_check_profile_validity(profile)) || interface_name == NULL) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
if (!(_connection_libnet_check_profile_validity(profile))) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
if (!(_connection_libnet_check_profile_validity(profile)) || state == NULL) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
net_profile_info_t *profile_info = profile;
*state = _profile_convert_to_cp_state(profile_info->ProfileState);
if (*state < 0)
- return CONNECTION_ERROR_OPERATION_FAILED;
+ return CONNECTION_ERROR_OPERATION_FAILED;
return CONNECTION_ERROR_NONE;
}
if (address_family == CONNECTION_ADDRESS_FAMILY_IPV6) {
prefixlen = g_try_malloc0(MAX_PREFIX_LENGTH);
- snprintf(prefixlen, MAX_PREFIX_LENGTH, "%d", net_info->PrefixLen6);
- *subnet_mask = prefixlen;
+ if (prefixlen != NULL) {
+ snprintf(prefixlen, MAX_PREFIX_LENGTH, "%d", net_info->PrefixLen6);
+ *subnet_mask = prefixlen;
+ } else
+ *subnet_mask = NULL;
} else
*subnet_mask = __profile_convert_ip_to_string(&net_info->SubnetMask,
address_family);
CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
if (!(_connection_libnet_check_profile_validity(profile)) || type == NULL) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
if (!(_connection_libnet_check_profile_validity(profile))) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
if (!(_connection_libnet_check_profile_validity(profile)) || callback == NULL) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
{
CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE, TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
- if (!(_connection_libnet_check_profile_cb_validity(profile))) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
+ if (!(_connection_libnet_check_profile_validity(profile))) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
if (!(_connection_libnet_check_profile_validity(profile)) || essid == NULL) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
if (!(_connection_libnet_check_profile_validity(profile)) || bssid == NULL) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
if (!(_connection_libnet_check_profile_validity(profile)) || rssi == NULL) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
if (!(_connection_libnet_check_profile_validity(profile)) || frequency == NULL) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
if (!(_connection_libnet_check_profile_validity(profile)) || max_speed == NULL) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
if (!(_connection_libnet_check_profile_validity(profile)) || type == NULL) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
if (!(_connection_libnet_check_profile_validity(profile)) || type == NULL) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
if (!(_connection_libnet_check_profile_validity(profile)) || required == NULL) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
if (!(_connection_libnet_check_profile_validity(profile)) || passphrase == NULL) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
if (!(_connection_libnet_check_profile_validity(profile)) || supported == NULL) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
/* Cellular profile **********************************************************/
-EXPORT_API int connection_profile_get_cellular_network_type(connection_profile_h profile, connection_cellular_network_type_e* type)
-{
- CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE);
-
- if (!(_connection_libnet_check_profile_validity(profile)) || type == NULL) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
- return CONNECTION_ERROR_INVALID_PARAMETER;
- }
-
- int network_type;
- net_profile_info_t *profile_info = profile;
-
- if (profile_info->profile_type != NET_DEVICE_CELLULAR)
- return CONNECTION_ERROR_INVALID_PARAMETER;
-
- if (vconf_get_int(VCONFKEY_TELEPHONY_SVC_ACT, &network_type)) {
- CONNECTION_LOG(CONNECTION_ERROR, "vconf_get_int Failed\n");
- return CONNECTION_ERROR_OPERATION_FAILED;
- }
-
- CONNECTION_LOG(CONNECTION_INFO, "Cellular network type = %d\n", network_type);
-
- switch (network_type) {
- case VCONFKEY_TELEPHONY_SVC_ACT_NONE:
- *type = CONNECTION_CELLULAR_NETWORK_TYPE_UNKNOWN;
- break;
- case VCONFKEY_TELEPHONY_SVC_ACT_GPRS:
- *type = CONNECTION_CELLULAR_NETWORK_TYPE_GPRS;
- break;
- case VCONFKEY_TELEPHONY_SVC_ACT_EGPRS:
- *type = CONNECTION_CELLULAR_NETWORK_TYPE_EDGE;
- break;
- case VCONFKEY_TELEPHONY_SVC_ACT_UMTS:
- *type = CONNECTION_CELLULAR_NETWORK_TYPE_UMTS;
- break;
- default:
- return CONNECTION_ERROR_OPERATION_FAILED;
- }
-
- return CONNECTION_ERROR_NONE;
-}
-
EXPORT_API int connection_profile_get_cellular_service_type(connection_profile_h profile,
connection_cellular_service_type_e* type)
{
CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE);
if (!(_connection_libnet_check_profile_validity(profile)) || type == NULL) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
net_profile_info_t *profile_info = profile;
if (profile_info->profile_type != NET_DEVICE_CELLULAR) {
- CONNECTION_LOG(CONNECTION_ERROR, "Invalid profile type Passed\n");
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
*type = _profile_convert_to_connection_cellular_service_type(profile_info->ProfileInfo.Pdp.ServiceType);
if (*type == CONNECTION_CELLULAR_SERVICE_TYPE_UNKNOWN) {
- CONNECTION_LOG(CONNECTION_ERROR, "Invalid service type Passed\n");
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid service type Passed");
return CONNECTION_ERROR_OPERATION_FAILED;
}
CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE);
if (!(_connection_libnet_check_profile_validity(profile)) || apn == NULL) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
net_profile_info_t *profile_info = profile;
- if (profile_info->profile_type != NET_DEVICE_CELLULAR)
+ if (profile_info->profile_type != NET_DEVICE_CELLULAR) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
+ }
*apn = g_strdup(profile_info->ProfileInfo.Pdp.Apn);
if (*apn == NULL)
if (!(_connection_libnet_check_profile_validity(profile)) ||
type == NULL || user_name == NULL || password == NULL) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
net_profile_info_t *profile_info = profile;
- if (profile_info->profile_type != NET_DEVICE_CELLULAR)
+ if (profile_info->profile_type != NET_DEVICE_CELLULAR) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
+ }
switch (profile_info->ProfileInfo.Pdp.AuthInfo.AuthType) {
case NET_PDP_AUTH_NONE:
CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE);
if (!(_connection_libnet_check_profile_validity(profile)) || home_url == NULL) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
net_profile_info_t *profile_info = profile;
- if (profile_info->profile_type != NET_DEVICE_CELLULAR)
+ if (profile_info->profile_type != NET_DEVICE_CELLULAR) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
+ }
*home_url = g_strdup(profile_info->ProfileInfo.Pdp.HomeURL);
if (*home_url == NULL)
CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE);
if (!(_connection_libnet_check_profile_validity(profile)) || is_roaming == NULL) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
net_profile_info_t *profile_info = profile;
- if (profile_info->profile_type != NET_DEVICE_CELLULAR)
+ if (profile_info->profile_type != NET_DEVICE_CELLULAR) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
+ }
if (profile_info->ProfileInfo.Pdp.Roaming)
*is_roaming = true;
CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE);
if (!(_connection_libnet_check_profile_validity(profile))) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
net_profile_info_t *profile_info = profile;
- if (profile_info->profile_type != NET_DEVICE_CELLULAR)
+ if (profile_info->profile_type != NET_DEVICE_CELLULAR) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
+ }
switch (service_type) {
case CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET:
CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE);
if (!(_connection_libnet_check_profile_validity(profile)) || apn == NULL) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
net_profile_info_t *profile_info = profile;
- if (profile_info->profile_type != NET_DEVICE_CELLULAR)
+ if (profile_info->profile_type != NET_DEVICE_CELLULAR) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
+ }
g_strlcpy(profile_info->ProfileInfo.Pdp.Apn, apn, NET_PDP_APN_LEN_MAX+1);
if (!(_connection_libnet_check_profile_validity(profile)) ||
user_name == NULL || password == NULL) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
net_profile_info_t *profile_info = profile;
- if (profile_info->profile_type != NET_DEVICE_CELLULAR)
+ if (profile_info->profile_type != NET_DEVICE_CELLULAR) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
+ }
switch (type) {
case CONNECTION_CELLULAR_AUTH_TYPE_NONE:
CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE);
if (!(_connection_libnet_check_profile_validity(profile)) || home_url == NULL) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
net_profile_info_t *profile_info = profile;
- if (profile_info->profile_type != NET_DEVICE_CELLULAR)
+ if (profile_info->profile_type != NET_DEVICE_CELLULAR) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
+ }
g_strlcpy(profile_info->ProfileInfo.Pdp.HomeURL, home_url, NET_HOME_URL_LEN_MAX);
+++ /dev/null
-/*
- * Copyright (c) 2011-2013 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * 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.
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <glib.h>
-#include "net_connection_private.h"
-
-
-static pthread_mutex_t connection_mutex = PTHREAD_MUTEX_INITIALIZER;
-
-
-void _connection_inter_mutex_lock(void)
-{
- pthread_mutex_lock(&connection_mutex);
-}
-
-void _connection_inter_mutex_unlock(void)
-{
- pthread_mutex_unlock(&connection_mutex);
-}
-
* limitations under the License.
*/
+#include <glib.h>
#include <stdio.h>
+#include <stdarg.h>
#include <string.h>
-#include <glib.h>
#include <vconf/vconf.h>
#include <system_info.h>
#include <arpa/inet.h>
#include "net_connection_private.h"
-static GSList *prof_handle_list = NULL;
-static GHashTable *profile_cb_table = NULL;
+static __thread GSList *prof_handle_list = NULL;
+static __thread GHashTable *profile_cb_table = NULL;
struct _profile_cb_s {
connection_profile_state_changed_cb callback;
void *closed_user_data;
void *set_default_user_data;
void *reset_profile_user_data;
- bool registered;
bool is_created;
};
+struct _state_notify {
+ connection_profile_state_changed_cb callback;
+ connection_profile_state_e state;
+ void *user_data;
+};
+
struct managed_idle_data {
GSourceFunc func;
gpointer user_data;
guint id;
};
-static struct _profile_list_s profile_iterator = {0, 0, NULL};
-static struct _libnet_s libnet = {NULL, NULL, NULL, NULL, NULL, NULL, false};
+static __thread struct _profile_list_s profile_iterator = {0, 0, NULL};
+static __thread struct _libnet_s libnet = {NULL, NULL, NULL, NULL, NULL, NULL, false};
static __thread GSList *managed_idler_list = NULL;
bool _connection_is_created(void)
return libnet.is_created;
}
+static void __connection_set_created(bool tag)
+{
+ libnet.is_created = tag;
+}
+
static connection_error_e __libnet_convert_to_cp_error_type(net_err_t err_type)
{
switch (err_type) {
}
}
-static void __libnet_set_opened_cb(connection_opened_cb user_cb, void *user_data)
-{
- if (user_cb) {
- libnet.opened_cb = user_cb;
- libnet.opened_user_data = user_data;
- }
-}
-
static gboolean __libnet_reset_profile_cb_idle(gpointer data)
{
connection_error_e result = (connection_error_e)data;
_connection_callback_add(__libnet_reset_profile_cb_idle, (gpointer)result);
}
-static void __libnet_opened_cb(connection_error_e result)
+static void __libnet_set_opened_cb(connection_opened_cb user_cb, void *user_data)
{
- if (libnet.opened_cb)
+ if (user_cb != NULL) {
+ libnet.opened_cb = user_cb;
+ libnet.opened_user_data = user_data;
+ }
+}
+
+static gboolean __libnet_opened_cb_idle(gpointer data)
+{
+ connection_error_e result = (connection_error_e)data;
+
+ if (libnet.opened_cb != NULL)
libnet.opened_cb(result, libnet.opened_user_data);
libnet.opened_cb = NULL;
libnet.opened_user_data = NULL;
+
+ return FALSE;
+}
+
+static void __libnet_opened_cb(connection_error_e result)
+{
+ if (_connection_is_created() != true) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Application is not registered"
+ "If multi-threaded, thread integrity be broken.");
+ return;
+ }
+
+ if (libnet.opened_cb != NULL)
+ _connection_callback_add(__libnet_opened_cb_idle, (gpointer)result);
}
static void __libnet_set_closed_cb(connection_closed_cb user_cb, void *user_data)
{
- if (user_cb) {
+ if (user_cb != NULL) {
libnet.closed_cb = user_cb;
libnet.closed_user_data = user_data;
}
}
-static void __libnet_closed_cb(connection_error_e result)
+static gboolean __libnet_closed_cb_idle(gpointer data)
{
- if (libnet.closed_cb)
+ connection_error_e result = (connection_error_e)data;
+
+ if (libnet.closed_cb != NULL)
libnet.closed_cb(result, libnet.closed_user_data);
libnet.closed_cb = NULL;
libnet.closed_user_data = NULL;
+
+ return FALSE;
+}
+
+static void __libnet_closed_cb(connection_error_e result)
+{
+ if (_connection_is_created() != true) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Application is not registered"
+ "If multi-threaded, thread integrity be broken.");
+ return;
+ }
+
+ if (libnet.closed_cb != NULL)
+ _connection_callback_add(__libnet_closed_cb_idle, (gpointer)result);
}
static void __libnet_set_default_cb(connection_set_default_cb user_cb, void *user_data)
{
- if (user_cb) {
+ if (user_cb != NULL) {
libnet.set_default_cb = user_cb;
libnet.set_default_user_data = user_data;
}
}
-static void __libnet_default_cb(connection_error_e result)
+static gboolean __libnet_default_cb_idle(gpointer data)
{
- if (libnet.set_default_cb)
+ connection_error_e result = (connection_error_e)data;
+
+ if (libnet.set_default_cb != NULL)
libnet.set_default_cb(result, libnet.set_default_user_data);
libnet.set_default_cb = NULL;
libnet.set_default_user_data = NULL;
+
+ return FALSE;
+}
+
+static void __libnet_default_cb(connection_error_e result)
+{
+ if (_connection_is_created() != true) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Application is not registered"
+ "If multi-threaded, thread integrity be broken.");
+ return;
+ }
+
+ if (libnet.set_default_cb != NULL)
+ _connection_callback_add(__libnet_default_cb_idle, (gpointer)result);
}
static void __libnet_set_ethernet_cable_state_changed_cb(
libnet.ethernet_cable_state_changed_cb(state);
}
+static gboolean __libnet_state_changed_cb_idle(gpointer data)
+{
+ struct _state_notify *notify = (struct _state_notify *)data;
+
+ if (notify == NULL)
+ return FALSE;
+
+ if (notify->callback != NULL)
+ notify->callback(notify->state, notify->user_data);
+
+ g_free(notify);
+
+ return FALSE;
+}
+
static void __libnet_state_changed_cb(char *profile_name, connection_profile_state_e state)
{
+ guint id;
+ struct _state_notify *notify;
+ struct _profile_cb_s *cb_info;
+
+ if (_connection_is_created() != true) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Application is not registered"
+ "If multi-threaded, thread integrity be broken.");
+ return;
+ }
+
if (profile_name == NULL)
return;
- struct _profile_cb_s *cb_info;
cb_info = g_hash_table_lookup(profile_cb_table, profile_name);
-
if (cb_info == NULL)
return;
cb_info->state = state;
- if (state >= 0 && cb_info->callback)
- cb_info->callback(state, cb_info->user_data);
+ if (state < 0 || cb_info->callback == NULL)
+ return;
+
+ notify = g_try_new0(struct _state_notify, 1);
+ if (notify == NULL)
+ return;
+
+ notify->callback = cb_info->callback;
+ notify->state = state;
+ notify->user_data = cb_info->user_data;
+
+ id = _connection_callback_add(__libnet_state_changed_cb_idle,
+ (gpointer)notify);
+ if (!id)
+ g_free(notify);
}
static void __libnet_clear_profile_list(struct _profile_list_s *profile_list)
profile_list->profiles = NULL;
}
-static void __libnet_evt_cb(net_event_info_t* event_cb, void* user_data)
+static void __libnet_evt_cb(net_event_info_t *event_cb, void *user_data)
{
bool is_requested = false;
connection_error_e result = CONNECTION_ERROR_NONE;
/* fall through */
case NET_EVENT_OPEN_IND:
result = __libnet_convert_to_cp_error_type(event_cb->Error);
- CONNECTION_LOG(CONNECTION_INFO, "Got connection open %s : %s\n",
+ CONNECTION_LOG(CONNECTION_INFO, "Connection opened %s[%s]",
(is_requested) ? "RSP":"IND",
__libnet_convert_cp_error_type_to_string(result));
switch (event_cb->Error) {
case NET_ERR_NONE:
case NET_ERR_ACTIVE_CONNECTION_EXISTS:
- CONNECTION_LOG(CONNECTION_INFO, "'Open connection' succeeded\n");
+ CONNECTION_LOG(CONNECTION_INFO, "Successfully open connection");
__libnet_state_changed_cb(event_cb->ProfileName, CONNECTION_PROFILE_STATE_CONNECTED);
return;
default:
- CONNECTION_LOG(CONNECTION_ERROR, "'Open connection' failed!! [%s]\n",
+ CONNECTION_LOG(CONNECTION_ERROR, "Failed to open connection[%s]",
__libnet_convert_cp_error_type_to_string(result));
}
/* fall through */
case NET_EVENT_CLOSE_IND:
result = __libnet_convert_to_cp_error_type(event_cb->Error);
- CONNECTION_LOG(CONNECTION_INFO, "Got connection close %s : %s\n",
+ CONNECTION_LOG(CONNECTION_INFO, "Connection closed %s[%s]",
(is_requested) ? "RSP":"IND",
__libnet_convert_cp_error_type_to_string(result));
switch (event_cb->Error) {
case NET_ERR_NONE:
- CONNECTION_LOG(CONNECTION_INFO, "'Close connection' succeeded!\n");
+ CONNECTION_LOG(CONNECTION_INFO, "Successfully closed connection");
__libnet_state_changed_cb(event_cb->ProfileName, CONNECTION_PROFILE_STATE_DISCONNECTED);
return;
default:
- CONNECTION_LOG(CONNECTION_ERROR, "'Close connection' failed!! [%s]\n",
- __libnet_convert_cp_error_type_to_string(result));
+ CONNECTION_LOG(CONNECTION_ERROR, "Failed to close connection[%s]",
+ __libnet_convert_cp_error_type_to_string(result));
}
break;
case NET_EVENT_NET_STATE_IND:
- CONNECTION_LOG(CONNECTION_INFO, "Got State changed IND\n");
+ CONNECTION_LOG(CONNECTION_INFO, "State changed IND");
if (event_cb->Datalength != sizeof(net_state_type_t))
return;
- net_state_type_t *profile_state = (net_state_type_t*)event_cb->Data;
+ net_state_type_t *profile_state = (net_state_type_t *)event_cb->Data;
connection_profile_state_e cp_state = _profile_convert_to_cp_state(*profile_state);
- CONNECTION_LOG(CONNECTION_INFO,
- "Profile State : %s, profile name : %s\n",
- __libnet_convert_cp_state_to_string(cp_state),
- event_cb->ProfileName);
+ CONNECTION_LOG(CONNECTION_INFO, "state: %s", __libnet_convert_cp_state_to_string(cp_state));
+ SECURE_CONNECTION_LOG(CONNECTION_INFO, "profile name: %s", event_cb->ProfileName);
__libnet_state_changed_cb(event_cb->ProfileName, cp_state);
break;
- case NET_EVENT_WIFI_SCAN_IND:
- case NET_EVENT_WIFI_SCAN_RSP:
- CONNECTION_LOG(CONNECTION_INFO, "Got wifi scan IND\n");
- break;
- case NET_EVENT_WIFI_POWER_IND:
- case NET_EVENT_WIFI_POWER_RSP:
- CONNECTION_LOG(CONNECTION_INFO, "Got wifi power IND\n");
- break;
case NET_EVENT_CELLULAR_SET_DEFAULT_RSP:
result = __libnet_convert_to_cp_error_type(event_cb->Error);
- CONNECTION_LOG(CONNECTION_INFO, "Got set default profile RSP %d\n", result);
+ CONNECTION_LOG(CONNECTION_INFO, "Got set default profile RSP %d", result);
__libnet_default_cb(result);
break;
- case NET_EVENT_WIFI_WPS_RSP:
- CONNECTION_LOG(CONNECTION_INFO, "Got wifi WPS RSP\n");
- /* fall through */
+
case NET_EVENT_CELLULAR_RESET_DEFAULT_RSP:
result = __libnet_convert_to_cp_error_type(event_cb->Error);
CONNECTION_LOG(CONNECTION_INFO, "Got reset default profile RSP %d", result);
__libnet_reset_profile_cb(result);
-
+ break;
case NET_EVENT_ETHERNET_CABLE_ATTACHED:
CONNECTION_LOG(CONNECTION_INFO, "Got Ethernet cable Attached Indication\n");
__libnet_ethernet_cable_state_changed_cb(CONNECTION_ETHERNET_CABLE_ATTACHED);
CONNECTION_LOG(CONNECTION_INFO, "Got Ethernet cable detached Indication\n");
__libnet_ethernet_cable_state_changed_cb(CONNECTION_ETHERNET_CABLE_DETACHED);
break;
+
default :
- CONNECTION_LOG(CONNECTION_ERROR, "Error! Unknown Event\n\n");
break;
}
}
}
}
+int __libnet_get_default_count(struct _profile_list_s *profile_list)
+{
+ int count = 0;
+ int i = 0;
+
+ for (;i < profile_list->count;i++) {
+ if (profile_list->profiles[i].ProfileInfo.Pdp.DefaultConn == TRUE)
+ count++;
+ }
+
+ return count;
+}
+
+void __libnet_copy_default_profile(net_profile_info_t **dest, struct _profile_list_s *source)
+{
+ int i = 0;
+
+ for (;i < source->count;i++) {
+ if (source->profiles[i].ProfileInfo.Pdp.DefaultConn == TRUE) {
+ memcpy(*dest, &source->profiles[i], sizeof(net_profile_info_t));
+ (*dest)++;
+ }
+ }
+}
+
int _connection_libnet_init(void)
{
int rv;
- if (!libnet.registered) {
+ if (_connection_is_created() != true) {
rv = net_register_client_ext((net_event_cb_t)__libnet_evt_cb, NET_DEVICE_DEFAULT, NULL);
if (rv != NET_ERR_NONE)
- return false;
+ return rv;
- libnet.registered = true;
+ __connection_set_created(true);
if (profile_cb_table == NULL)
profile_cb_table = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
bool _connection_libnet_deinit(void)
{
- if (libnet.registered) {
+ if (_connection_is_created() == true) {
if (net_deregister_client_ext(NET_DEVICE_DEFAULT) != NET_ERR_NONE)
return false;
- libnet.registered = false;
+ __connection_set_created(false);
if (profile_cb_table) {
g_hash_table_destroy(profile_cb_table);
*state = CONNECTION_WIFI_STATE_DEACTIVATED;
break;
case WIFI_ON:
- case WIFI_CONNECTING:
+ case WIFI_ASSOCIATION:
+ case WIFI_CONFIGURATION:
*state = CONNECTION_WIFI_STATE_DISCONNECTED;
break;
case WIFI_CONNECTED:
*state = CONNECTION_WIFI_STATE_CONNECTED;
break;
default :
- CONNECTION_LOG(CONNECTION_ERROR, "Error!! Unknown state\n");
+ CONNECTION_LOG(CONNECTION_ERROR, "Unknown Wi-Fi state");
return CONNECTION_ERROR_INVALID_OPERATION;
}
}
if (ethernet_profiles.count == 0) {
- state = CONNECTION_ETHERNET_STATE_DEACTIVATED;
+ *state = CONNECTION_ETHERNET_STATE_DEACTIVATED;
return CONNECTION_ERROR_NONE;
}
*state = CONNECTION_ETHERNET_STATE_DISCONNECTED;
break;
default:
+ __libnet_clear_profile_list(ðernet_profiles);
return CONNECTION_ERROR_OPERATION_FAILED;
}
int _connection_libnet_get_profile_iterator(connection_iterator_type_e type, connection_profile_iterator_h* profile_iter_h)
{
int count = 0;
- int rv;
+ int rv1, rv2, rv3, rv4;
net_profile_info_t *profiles = NULL;
- struct _profile_list_s all_profiles = {0, 0, NULL};
+ struct _profile_list_s wifi_profiles = {0, 0, NULL};
+ struct _profile_list_s cellular_profiles = {0, 0, NULL};
+ struct _profile_list_s ethernet_profiles = {0, 0, NULL};
+ struct _profile_list_s bluetooth_profiles = {0, 0, NULL};
__libnet_clear_profile_list(&profile_iterator);
- rv = net_get_profile_list(NET_DEVICE_MAX, &all_profiles.profiles, &all_profiles.count);
+ rv1 = net_get_profile_list(NET_DEVICE_WIFI, &wifi_profiles.profiles, &wifi_profiles.count);
+ if (rv1 == NET_ERR_ACCESS_DENIED) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Access denied");
+ return CONNECTION_ERROR_PERMISSION_DENIED;
+ } else if (rv1 != NET_ERR_NO_SERVICE && rv1 != NET_ERR_NONE)
+ return CONNECTION_ERROR_OPERATION_FAILED;
- if (rv != NET_ERR_NONE) {
- if (rv == NET_ERR_NO_SERVICE) {
- *profile_iter_h = &profile_iterator;
- return CONNECTION_ERROR_NONE;
- } else
- return CONNECTION_ERROR_OPERATION_FAILED;
+ CONNECTION_LOG(CONNECTION_INFO, "Wi-Fi profile count: %d", wifi_profiles.count);
+
+ rv2 = net_get_profile_list(NET_DEVICE_CELLULAR, &cellular_profiles.profiles, &cellular_profiles.count);
+ if (rv2 == NET_ERR_ACCESS_DENIED) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Access denied");
+ __libnet_clear_profile_list(&wifi_profiles);
+ return CONNECTION_ERROR_PERMISSION_DENIED;
+ } else if (rv2 != NET_ERR_NO_SERVICE && rv2 != NET_ERR_NONE) {
+ __libnet_clear_profile_list(&wifi_profiles);
+ return CONNECTION_ERROR_OPERATION_FAILED;
+ }
+ CONNECTION_LOG(CONNECTION_INFO, "Cellular profile count: %d", cellular_profiles.count);
+
+ rv3 = net_get_profile_list(NET_DEVICE_ETHERNET, ðernet_profiles.profiles, ðernet_profiles.count);
+ if (rv3 == NET_ERR_ACCESS_DENIED) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Access denied");
+ __libnet_clear_profile_list(&wifi_profiles);
+ __libnet_clear_profile_list(&cellular_profiles);
+ return CONNECTION_ERROR_PERMISSION_DENIED;
+ } else if (rv3 != NET_ERR_NO_SERVICE && rv3 != NET_ERR_NONE) {
+ __libnet_clear_profile_list(&wifi_profiles);
+ __libnet_clear_profile_list(&cellular_profiles);
+ return CONNECTION_ERROR_OPERATION_FAILED;
}
+ CONNECTION_LOG(CONNECTION_INFO, "Ethernet profile count : %d", ethernet_profiles.count);
+
+ rv4 = net_get_profile_list(NET_DEVICE_BLUETOOTH, &bluetooth_profiles.profiles, &bluetooth_profiles.count);
+ if (rv4 == NET_ERR_ACCESS_DENIED) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Access denied");
+ __libnet_clear_profile_list(&wifi_profiles);
+ __libnet_clear_profile_list(&cellular_profiles);
+ __libnet_clear_profile_list(ðernet_profiles);
+ return CONNECTION_ERROR_PERMISSION_DENIED;
+ } else if (rv4 != NET_ERR_NO_SERVICE && rv4 != NET_ERR_NONE) {
+ __libnet_clear_profile_list(&wifi_profiles);
+ __libnet_clear_profile_list(&cellular_profiles);
+ __libnet_clear_profile_list(ðernet_profiles);
+ return CONNECTION_ERROR_OPERATION_FAILED;
+ }
+ CONNECTION_LOG(CONNECTION_INFO, "Bluetooth profile count : %d", bluetooth_profiles.count);
*profile_iter_h = &profile_iterator;
switch (type) {
case CONNECTION_ITERATOR_TYPE_REGISTERED:
- count = all_profiles.count;
- CONNECTION_LOG(CONNECTION_INFO, "Total profile count : %d\n", count);
-
+ count = wifi_profiles.count + cellular_profiles.count + ethernet_profiles.count + bluetooth_profiles.count;
+ CONNECTION_LOG(CONNECTION_INFO, "Total profile count : %d", count);
if (count == 0)
return CONNECTION_ERROR_NONE;
- profile_iterator.profiles = all_profiles.profiles;
+ profiles = g_try_new0(net_profile_info_t, count);
+ if (profiles == NULL) {
+ __libnet_clear_profile_list(&wifi_profiles);
+ __libnet_clear_profile_list(&cellular_profiles);
+ __libnet_clear_profile_list(ðernet_profiles);
+ __libnet_clear_profile_list(&bluetooth_profiles);
+ return CONNECTION_ERROR_OUT_OF_MEMORY;
+ }
+
+ profile_iterator.profiles = profiles;
+
+ if (wifi_profiles.count > 0) {
+ memcpy(profiles, wifi_profiles.profiles,
+ sizeof(net_profile_info_t) * wifi_profiles.count);
+ profiles += wifi_profiles.count;
+ }
+
+ if (cellular_profiles.count > 0) {
+ memcpy(profiles, cellular_profiles.profiles,
+ sizeof(net_profile_info_t) * cellular_profiles.count);
+ profiles += cellular_profiles.count;
+ }
+
+ if (ethernet_profiles.count > 0) {
+ memcpy(profiles, ethernet_profiles.profiles,
+ sizeof(net_profile_info_t) * ethernet_profiles.count);
+ profiles += ethernet_profiles.count;
+ }
+
+ if (bluetooth_profiles.count > 0)
+ memcpy(profiles, bluetooth_profiles.profiles,
+ sizeof(net_profile_info_t) * bluetooth_profiles.count);
break;
case CONNECTION_ITERATOR_TYPE_CONNECTED:
- count = __libnet_get_connected_count(&all_profiles);
- CONNECTION_LOG(CONNECTION_INFO, "Total connected profile count : %d\n", count);
-
+ count = __libnet_get_connected_count(&wifi_profiles);
+ count += __libnet_get_connected_count(&cellular_profiles);
+ count += __libnet_get_connected_count(ðernet_profiles);
+ count += __libnet_get_connected_count(&bluetooth_profiles);
+ CONNECTION_LOG(CONNECTION_INFO, "Total connected profile count : %d", count);
if (count == 0)
return CONNECTION_ERROR_NONE;
profiles = g_try_new0(net_profile_info_t, count);
if (profiles == NULL) {
- __libnet_clear_profile_list(&all_profiles);
+ __libnet_clear_profile_list(&wifi_profiles);
+ __libnet_clear_profile_list(&cellular_profiles);
+ __libnet_clear_profile_list(ðernet_profiles);
+ __libnet_clear_profile_list(&bluetooth_profiles);
return CONNECTION_ERROR_OUT_OF_MEMORY;
+ }
+
+ profile_iterator.profiles = profiles;
+
+ if (wifi_profiles.count > 0)
+ __libnet_copy_connected_profile(&profiles, &wifi_profiles);
+
+ if (cellular_profiles.count > 0)
+ __libnet_copy_connected_profile(&profiles, &cellular_profiles);
+
+ if (ethernet_profiles.count > 0)
+ __libnet_copy_connected_profile(&profiles, ðernet_profiles);
+
+ if (bluetooth_profiles.count > 0)
+ __libnet_copy_connected_profile(&profiles, &bluetooth_profiles);
+
break;
case CONNECTION_ITERATOR_TYPE_DEFAULT:
- /* To do : Not supported yet */
- break;
+ count = __libnet_get_default_count(&cellular_profiles);
+ CONNECTION_LOG(CONNECTION_INFO, "Total default profile count : %d", count);
+ if (count == 0)
+ return CONNECTION_ERROR_NONE;
+
+ profiles = g_try_new0(net_profile_info_t, count);
+ if (profiles == NULL) {
+ __libnet_clear_profile_list(&wifi_profiles);
+ __libnet_clear_profile_list(&cellular_profiles);
+ __libnet_clear_profile_list(ðernet_profiles);
+ __libnet_clear_profile_list(&bluetooth_profiles);
+ return CONNECTION_ERROR_OUT_OF_MEMORY;
}
profile_iterator.profiles = profiles;
- __libnet_copy_connected_profile(&profiles, &all_profiles);
-
- __libnet_clear_profile_list(&all_profiles);
+ if (cellular_profiles.count > 0)
+ __libnet_copy_default_profile(&profiles, &cellular_profiles);
+ break;
}
+ __libnet_clear_profile_list(&wifi_profiles);
+ __libnet_clear_profile_list(&cellular_profiles);
+ __libnet_clear_profile_list(ðernet_profiles);
+ __libnet_clear_profile_list(&bluetooth_profiles);
+
profile_iterator.count = count;
return CONNECTION_ERROR_NONE;
return CONNECTION_ERROR_NONE;
}
-int _connection_libnet_open_profile(connection_profile_h profile, connection_opened_cb callback, void* user_data)
+int _connection_libnet_open_profile(connection_profile_h profile,
+ connection_opened_cb callback, void* user_data)
{
int rv;
return CONNECTION_ERROR_NONE;
}
-int _connection_libnet_get_cellular_service_profile(connection_cellular_service_type_e type, connection_profile_h *profile)
+int _connection_libnet_get_cellular_service_profile(
+ connection_cellular_service_type_e type, connection_profile_h *profile)
{
- int i = 0;
- int j = 0;
+ int i = 0, j = 0;
int rv = NET_ERR_NONE;
- net_service_type_t service_type = _connection_profile_convert_to_libnet_cellular_service_type(type);
+#if defined TIZEN_DUALSIM_ENABLE
+ int default_subscriber_id = 0;
+ char subscriber_id[3];
+#endif
- struct _profile_list_s cellular_profiles = {0, 0, NULL};
+ struct _profile_list_s cellular_profiles = { 0, 0, NULL };
+ net_service_type_t service_type = _connection_profile_convert_to_libnet_cellular_service_type(type);
rv = net_get_profile_list(NET_DEVICE_CELLULAR, &cellular_profiles.profiles, &cellular_profiles.count);
if (rv == NET_ERR_ACCESS_DENIED) {
return CONNECTION_ERROR_OPERATION_FAILED;
}
- for (;i < cellular_profiles.count;i++)
- if (cellular_profiles.profiles[i].ProfileInfo.Pdp.ServiceType == service_type)
- break;
+#if defined TIZEN_DUALSIM_ENABLE
+ if (vconf_get_int(VCONF_TELEPHONY_DEFAULT_DATA_SERVICE,
+ &default_subscriber_id) != 0) {
+ CONNECTION_LOG(CONNECTION_ERROR,
+ "Failed to get VCONF_TELEPHONY_DEFAULT_DATA_SERVICE");
+ __libnet_clear_profile_list(&cellular_profiles);
+ return CONNECTION_ERROR_OPERATION_FAILED;
+ }
- if (i >= cellular_profiles.count)
+ g_snprintf(subscriber_id, sizeof(subscriber_id), "%d", default_subscriber_id);
+#endif
+
+ for (i = 0; i < cellular_profiles.count; i++)
+ if (cellular_profiles.profiles[i].ProfileInfo.Pdp.ServiceType == service_type)
+#if defined TIZEN_DUALSIM_ENABLE
+ if (g_str_has_suffix(
+ cellular_profiles.profiles[i].ProfileInfo.Pdp.PSModemPath,
+ subscriber_id) == TRUE)
+#endif
+ break;
+
+ if (i >= cellular_profiles.count) {
+ __libnet_clear_profile_list(&cellular_profiles);
return CONNECTION_ERROR_OPERATION_FAILED;
+ }
*profile = g_try_malloc0(sizeof(net_profile_info_t));
- if (*profile == NULL)
+ if (*profile == NULL) {
+ __libnet_clear_profile_list(&cellular_profiles);
return CONNECTION_ERROR_OUT_OF_MEMORY;
+ }
memcpy(*profile, &cellular_profiles.profiles[i], sizeof(net_profile_info_t));
type != CONNECTION_CELLULAR_SERVICE_TYPE_PREPAID_INTERNET)
goto done;
- for (;j < cellular_profiles.count;j++) {
+ for (j = 0; j < cellular_profiles.count; j++) {
if (i == j)
continue;
}
done:
+ __libnet_clear_profile_list(&cellular_profiles);
prof_handle_list = g_slist_append(prof_handle_list, *profile);
return CONNECTION_ERROR_NONE;
int rv;
if (!(_connection_libnet_check_profile_validity(profile))) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
int rv;
if (!(_connection_libnet_check_profile_validity(profile))) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
int rv;
if (!(_connection_libnet_check_profile_validity(profile))) {
- CONNECTION_LOG(CONNECTION_ERROR, "Wrong Parameter Passed\n");
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
return CONNECTION_ERROR_INVALID_PARAMETER;
}
} else if (rv != NET_ERR_NONE)
return CONNECTION_ERROR_OPERATION_FAILED;
- if (net_close_connection(profile_info->ProfileName) != NET_ERR_NONE)
- return CONNECTION_ERROR_OPERATION_FAILED;
-
__libnet_set_closed_cb(callback, user_data);
return CONNECTION_ERROR_NONE;
profile_cb_info->callback = callback;
profile_cb_info->user_data = user_data;
+ profile_cb_info->state = _profile_convert_to_cp_state(profile_info->ProfileState);
- g_hash_table_insert(profile_cb_table, profile_name, profile_cb_info);
+ g_hash_table_replace(profile_cb_table, profile_name, profile_cb_info);
return true;
}
bool _connection_libnet_remove_from_profile_cb_list(connection_profile_h profile)
{
net_profile_info_t *profile_info = profile;
+
if (g_hash_table_remove(profile_cb_table, profile_info->ProfileName) == TRUE)
return true;
+PROJECT(connection_test C)
+
SET(fw_test "${fw_name}-test")
SET(dependents "capi-base-common glib-2.0 network")
+SET(pc_dependents "capi-base-common")
INCLUDE(FindPkgConfig)
pkg_check_modules(${fw_test} REQUIRED ${dependents})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
ENDFOREACH(flag)
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall -fPIE")
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -pie")
aux_source_directory(. sources)
FOREACH(src ${sources})
#include <glib.h>
#include "net_connection.h"
+
#include <tizen_error.h>
#define RETURN_FAIL_DESTROY(x) {connection_profile_destroy(x); return -1;}
}
buf[rv-1]='\0';
-
return true;
}
if (result == CONNECTION_ERROR_NONE)
printf("Connection open Succeeded\n");
else
- printf("Connection open Failed, err : %d\n", result);
+ printf("Connection open Failed, err : [%s]\n", test_print_error(result));
}
static void test_connection_closed_callback(connection_error_e result, void* user_data)
if (result == CONNECTION_ERROR_NONE)
printf("Connection close Succeeded\n");
else
- printf("Connection close Failed, err : %d\n", result);
+ printf("Connection close Failed, err : [%s]\n", test_print_error(result));
}
static void test_connection_reset_profile_callback(connection_error_e result, void* user_data)
if (result == CONNECTION_ERROR_NONE)
printf("Default profile setting Succeeded\n");
else
- printf("Default profile setting Failed, err : %d\n", result);
+ printf("Default profile setting Failed, err : [%s]\n", test_print_error(result));
}
void test_get_ethernet_cable_state_callback(connection_ethernet_cable_state_e state,
rv = connection_get_profile_iterator(connection, CONNECTION_ITERATOR_TYPE_REGISTERED, &profile_iter);
if (rv != CONNECTION_ERROR_NONE) {
- printf("Fail to get profile iterator [%d]\n", rv);
+ printf("Fail to get profile iterator [%s]\n", test_print_error(rv));
return false;
}
profile_list[profile_count] = profile_h;
profile_count++;
} else {
- printf("%d. state:[%s], profile name : %s\n",
- profile_count, test_print_state(profile_state), profile_name);
+ connection_cellular_service_type_e service_type;
+ if (connection_profile_get_cellular_service_type(profile_h, &service_type) != CONNECTION_ERROR_NONE) {
+ printf("Fail to get cellular service type!\n");
+ }
+
+ printf("%d. state:[%s], profile name:%s[%d]\n",
+ profile_count, test_print_state(profile_state), profile_name, service_type);
profile_list[profile_count] = profile_h;
profile_count++;
return -1;
if (test_get_user_string("Input Apn - (Enter for skip) :", input_str1, 100)) {
+ g_strstrip(input_str1);
rv = connection_profile_set_cellular_apn(profile, input_str1);
if (rv != CONNECTION_ERROR_NONE)
return -1;
}
if (test_get_user_string("Input Proxy - (Enter for skip) :", input_str1, 100)) {
+ g_strstrip(input_str1);
rv = connection_profile_set_proxy_address(profile, CONNECTION_ADDRESS_FAMILY_IPV4, input_str1);
if (rv != CONNECTION_ERROR_NONE)
return -1;
}
if (test_get_user_string("Input HomeURL - (Enter for skip) :", input_str1, 100)) {
+ g_strstrip(input_str1);
rv = connection_profile_set_cellular_home_url(profile, input_str1);
if (rv != CONNECTION_ERROR_NONE)
return -1;
if (test_get_user_string("Input AuthPwd(Enter for skip) :", input_str2, 100) == false)
input_str2[0] = 0;
+ g_strstrip(input_str1);
+ g_strstrip(input_str2);
rv = connection_profile_set_cellular_auth_info(profile, type_val, input_str1, input_str2);
if (rv != CONNECTION_ERROR_NONE)
return -1;
{
int rv = 0;
int input_int = 0;
- int address_family = 0;
+ int address_family;
test_get_user_int("Input Address Family (0:IPv4 1:IPv6) :", &address_family);
static void test_print_cellular_info(connection_profile_h profile)
{
- connection_cellular_network_type_e network_type;
connection_cellular_service_type_e service_type;
char *apn = NULL;
connection_cellular_auth_type_e auth_type;
bool hidden = false;
bool editable = false;
- if (connection_profile_get_cellular_network_type(profile, &network_type) != CONNECTION_ERROR_NONE)
- printf("Fail to get cellular network type!\n");
- else
- printf("Cellular network type : %d\n", network_type);
-
if (connection_profile_get_cellular_service_type(profile, &service_type) != CONNECTION_ERROR_NONE)
printf("Fail to get cellular service type!\n");
else
}
if (connection_profile_is_cellular_roaming(profile, &roaming) != CONNECTION_ERROR_NONE)
- printf("Fail to get cellular is roaming!\n");
+ printf("Fail to get cellular roaming state!\n");
else
printf("Cellular roaming : %s\n", roaming ? "true" : "false");
connection_set_ethernet_cable_state_chaged_cb(connection,
test_get_ethernet_cable_state_callback, NULL);
} else {
- printf("Client registration failed %d\n", err);
+ printf("Client registration failed [%s]\n", test_print_error(err));
return -1;
}
rv = CONNECTION_ERROR_INVALID_OPERATION;
}
- if (rv != CONNECTION_ERROR_NONE){
- printf("Client deregistration fail [%d]\n", rv);
+ if (rv != CONNECTION_ERROR_NONE) {
+ printf("Client deregistration fail [%s]\n", test_print_error(rv));
return -1;
}
rv = connection_get_type(connection, &net_state);
if (rv != CONNECTION_ERROR_NONE) {
- printf("Fail to get network state [%d]\n", rv);
+ printf("Fail to get network state [%s]\n", test_print_error(rv));
return -1;
}
- printf("Retval = %d network connection state [%d]\n", rv, net_state);
+ printf("Retval = [%s] network connection state [%d]\n", test_print_error(rv), net_state);
return 1;
}
rv = connection_get_cellular_state(connection, &cellular_state);
if (rv != CONNECTION_ERROR_NONE) {
- printf("Fail to get Cellular state [%d]\n", rv);
+ printf("Fail to get Cellular state [%s]\n", test_print_error(rv));
return -1;
}
- printf("Retval = %d Cellular state [%d]\n", rv, cellular_state);
+ printf("Retval = [%s] Cellular state [%d]\n", test_print_error(rv), cellular_state);
return 1;
}
rv = connection_get_wifi_state(connection, &wifi_state);
if (rv != CONNECTION_ERROR_NONE) {
- printf("Fail to get WiFi state [%d]\n", rv);
+ printf("Fail to get WiFi state [%s]\n", test_print_error(rv));
return -1;
}
- printf("Retval = %d WiFi state [%d]\n", rv, wifi_state);
+ printf("Retval = [%s] WiFi state [%d]\n", test_print_error(rv), wifi_state);
return 1;
}
rv = connection_get_profile_iterator(connection, CONNECTION_ITERATOR_TYPE_CONNECTED, &profile_iter);
if (rv != CONNECTION_ERROR_NONE) {
- printf("Fail to get profile iterator [%d]\n", rv);
+ printf("Fail to get profile iterator [%s]\n", test_print_error(rv));
return -1;
}
printf("Fail to get profile name\n");
return -1;
}
- printf("profile name : %s\n", profile_name);
+ printf("profile name is %s\n", profile_name);
g_free(profile_name);
if (connection_profile_get_type(profile_h, &type) != CONNECTION_ERROR_NONE) {
rv = connection_get_current_profile(connection, &profile_h);
if (rv != CONNECTION_ERROR_NONE) {
- printf("Fail to get profile iterator [%d]\n", rv);
+ printf("Fail to get profile iterator [%s]\n", test_print_error(rv));
return -1;
}
char *profile_name = NULL;
rv = test_get_user_int("Input profile type to get"
- "(1:Internet, 2:MMS, 3:Prepaid internet, 4:Prepaid MMS, 5:Tethering):", &input);
+ "(1:Internet, 2:MMS, 3:Prepaid internet, 4:Prepaid MMS, 5:Tethering, 6:Application):", &input);
if (rv == false) {
printf("Invalid input!!\n");
case 5:
service_type = CONNECTION_CELLULAR_SERVICE_TYPE_TETHERING;
break;
+ case 6:
+ service_type = CONNECTION_CELLULAR_SERVICE_TYPE_APPLICATION;
+ break;
default:
printf("Wrong number!!\n");
return -1;
if (test_get_user_string("Input Keyword - (Enter for skip) :", input_str, 100) == false)
return -1;
+ g_strstrip(input_str);
rv = connection_profile_create(CONNECTION_PROFILE_TYPE_CELLULAR, input_str, &profile);
if (rv != CONNECTION_ERROR_NONE)
RETURN_FAIL_DESTROY(profile);
case CONNECTION_PROFILE_TYPE_ETHERNET:
if (test_update_network_info(profile) == -1)
return -1;
-
break;
+
case CONNECTION_PROFILE_TYPE_BT:
printf("Not supported!\n");
/* fall through */
rv = connection_get_bt_state(connection, &bt_state);
if (rv != CONNECTION_ERROR_NONE) {
- printf("Fail to get Bluetooth state [%d]\n", rv);
+ printf("Fail to get Bluetooth state [%s]\n", test_print_error(rv));
return -1;
}
- printf("Retval = %d, Bluetooth state [%d]\n", rv, bt_state);
+ printf("Retval = [%s], Bluetooth state [%d]\n", test_print_error(rv), bt_state);
return 1;
}
exit(1);
}
- if (*a == '\n' || *a == '\r'){
+ if (*a == '\n' || *a == '\r') {
printf("\n\n Network Connection API Test App\n\n");
printf("Options..\n");
printf("1 - Create Handle and set callbacks\n");
printf("e - Get default cellular service by type\n");
printf("f - Set default cellular service by type\n");
printf("g - Close connection with profile\n");
- printf("h - Add profile(Cellular only)\n");
+ printf("h - Add profile(Cellular and Wifi only)\n");
printf("i - Remove profile(Cellular:delete, WiFi:forgot)\n");
printf("j - Update profile\n");
printf("k - Get profile info\n");
printf("x - Get ethernet cable state\n");
printf("B - Add IPv6 new route\n");
printf("C - Remove IPv6 route\n");
- printf("0 - Exit \n");
- printf("ENTER - Show options menu.......\n");
+ printf("0 - Exit \n");
+ printf("ENTER - Show options menu.......\n");
}
switch (a[0]) {