Remove iotcon_secure_initialize 81/75081/6
authorsung.goo.kim <sung.goo.kim@samsung.com>
Thu, 16 Jun 2016 11:51:25 +0000 (20:51 +0900)
committersung.goo.kim <sung.goo.kim@samsung.com>
Mon, 20 Jun 2016 09:30:10 +0000 (18:30 +0900)
Change-Id: If60753a7b12373100aa430fde6ecb58e767e691c

common/ic-utils.c
common/ic-utils.h
lib/icl.c
lib/include/iotcon.h
test/iotcon-test-basic-client.c
test/iotcon-test-basic-server.c
test/iotcon-test-device-client.c
test/iotcon-test-encap-client.c
test/iotcon-test-encap-server.c
test/iotcon-test-iface-client.c
test/iotcon-test-iface-server.c

index bdb5365b9d78f17207289c36a56ddd74e064775d..141dc7151c47517424b41d075eca8f51debc15b8 100644 (file)
@@ -33,9 +33,6 @@
 #ifdef TZ_VER_3
 static int _ic_ocf_feature = -1;
 static const char *IC_FEATURE_OCF = "http://tizen.org/feature/iot.ocf";
-
-static int _ic_ocf_security_feature = -1;
-static const char *IC_FEATURE_OCF_SECURITY = "http://tizen.org/feature/iot.ocf.security";
 #endif
 
 // TODO: Can't access in user side daemon
@@ -81,8 +78,6 @@ char* ic_utils_strdup(const char *src)
 
 bool ic_utils_check_permission(int permssion)
 {
-       // TODO: Temporary code (need guide from security team)
-
        static int has_network_permission = -1;
        static int has_internet_permission = -1;
 
@@ -155,20 +150,6 @@ bool ic_utils_check_ocf_feature()
 #endif
 }
 
-bool ic_utils_check_ocf_security_feature()
-{
-#ifdef TZ_VER_3
-       if (_ic_ocf_security_feature < 0) {
-               bool feature_supported = false;
-               system_info_get_platform_bool(IC_FEATURE_OCF_SECURITY, &feature_supported);
-               _ic_ocf_security_feature = feature_supported ? 1 : 0;
-       }
-       return _ic_ocf_security_feature;
-#else
-       return true;
-#endif
-}
-
 void ic_utils_free_platform_info(OCPlatformInfo *platform_info)
 {
        RET_IF(NULL == platform_info);
index c3ba27a0ea9b6f33a7149bf5222576d7e3e0c3a5..671f9f84ea345f11109bdb456301a6c5129a0c75 100644 (file)
@@ -29,7 +29,6 @@ enum {
 char* ic_utils_strdup(const char *src);
 bool ic_utils_check_permission(int permssion);
 bool ic_utils_check_ocf_feature();
-bool ic_utils_check_ocf_security_feature();
 int ic_utils_get_platform_info(OCPlatformInfo *platform_info);
 void ic_utils_free_platform_info(OCPlatformInfo *platform_info);
 
index 6c6d34fe7d6e4c8192b687615c140b50982f7efd..a25fdaa94a4fdb8f1c7785b5c663673e9cab5c71 100644 (file)
--- a/lib/icl.c
+++ b/lib/icl.c
@@ -27,32 +27,7 @@ static pthread_t icl_thread;
 static int icl_timeout_seconds = ICL_TIMEOUT_DEFAULT;
 static int icl_init_count;
 
-API int iotcon_secure_initialize(const char *file_path)
-{
-       int ret;
-
-       RETV_IF(false == ic_utils_check_ocf_security_feature(), IOTCON_ERROR_NOT_SUPPORTED);
-       RETV_IF(false == ic_utils_check_permission((IC_PERMISSION_INTERNET|IC_PERMISSION_NETWORK_GET)),
-                       IOTCON_ERROR_PERMISSION_DENIED);
-       // TODO: Consider (NULL == Path)
-       RETV_IF(NULL == file_path, IOTCON_ERROR_INVALID_PARAMETER);
-
-       ret = icl_ioty_set_persistent_storage(file_path);
-       if (IOTCON_ERROR_NONE != ret) {
-               ERR("icl_set_persistent_storage() Fail(%d)", ret);
-               return ret;
-       }
-
-       ret = iotcon_initialize();
-       if (IOTCON_ERROR_NONE != ret) {
-               ERR("iotcon_initialize() Fail(%d)", ret);
-               return ret;
-       }
-
-       return IOTCON_ERROR_NONE;
-}
-
-API int iotcon_initialize(void)
+API int iotcon_initialize(const char *file_path)
 {
        int ret;
 
@@ -60,10 +35,21 @@ API int iotcon_initialize(void)
        RETV_IF(false == ic_utils_check_permission((IC_PERMISSION_INTERNET|IC_PERMISSION_NETWORK_GET)),
                        IOTCON_ERROR_PERMISSION_DENIED);
 
+       // TODO: Fixme
+       //RETV_IF(NULL == file_path, IOTCON_ERROR_INVALID_PARAMETER);
+
 #if !GLIB_CHECK_VERSION(2, 35, 0)
        g_type_init();
 #endif
 
+       if (file_path && *file_path) {
+               ret = icl_ioty_set_persistent_storage(file_path);
+               if (IOTCON_ERROR_NONE != ret) {
+                       ERR("icl_set_persistent_storage() Fail(%d)", ret);
+                       return ret;
+               }
+       }
+
        ic_utils_mutex_lock(IC_UTILS_MUTEX_INIT);
        icl_init_count++;
        if (1 == icl_init_count) {
index f3a19f65f5fda464a7360912a9a1212cbb800e1d..7ca874bdf4dfe66a189f3c96f25059a56990922c 100644 (file)
@@ -36,14 +36,9 @@ extern "C" {
  * @section CAPI_IOT_CONNECTIVITY_MODULE_FEATURE Related Features
  * This API is related with the following features:\n
  * - http://tizen.org/feature/iot.ocf\n
- * - http://tizen.org/feature/iot.ocf.security\n
  *
  * It is recommended to design feature related codes in your application for reliability.\n
  *
- * If the feature(http://tizen.org/feature/iot.ocf.security) for OCF security architecture
- * is applied, you MUST call iotcon_secure_initialize() instead of iotcon_initialize().
- * Then applications communicate with each other based on OCF security architecture.
- *
  * You can check if a device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.\n
  *
  * 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
@@ -54,54 +49,28 @@ extern "C" {
  */
 
 /**
- * @brief Initializes IoTCon with secure mode.
- * @details Call this function to start IoTCon above OCF security architecture.
+ * @brief Initializes IoTCon.
+ * @details Call this function to start IoTCon.
  *
  * @since_tizen 3.0
  * @privlevel public
  * @privilege %http://tizen.org/privilege/network.get
  * @privilege %http://tizen.org/privilege/internet
  *
- * @remarks If the device has the feature("http://tizen.org/feature/iot.ocf.security"),
- * you must call this function instead of iotcon_initialize().\n
- * @a file_path point to a file for handling secure virtual resources.
+ * @remarks The @a file_path point to a file for handling secure virtual resources.
  * The file that is CBOR(Concise Binary Object Representation)-format must already exist
  * in @a file_path. We recommend to use application-local file for @a file_path.\n
  * You must call iotcon_deinitialize() if IoTCon API is no longer needed.
  *
- * @param[in] file_path The file path to point to storage for handling secure virtual resources.
- *
- * @return  0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE Successful
- * @retval #IOTCON_ERROR_NOT_SUPPORTED  Not supported
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_PERMISSION_DENIED Permission denied
- * @retval #IOTCON_ERROR_IOTIVITY  Iotivity errors
- *
- * @see iotcon_deinitialize()
- * @see system_info_get_platform_bool()
- */
-int iotcon_secure_initialize(const char *file_path);
-
-/**
- * @brief Initializes IoTCon.
- * @details Call this function to start IoTCon.
- *
- * @since_tizen 3.0
- * @privlevel public
- * @privilege %http://tizen.org/privilege/network.get
- * @privilege %http://tizen.org/privilege/internet
- *
- * @remarks You must call iotcon_deinitialize() if IoTCon API is no longer needed.
- *
  * @return  0 on success, otherwise a negative error value.
  * @retval #IOTCON_ERROR_NONE Successful
  * @retval #IOTCON_ERROR_NOT_SUPPORTED  Not supported
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #IOTCON_ERROR_PERMISSION_DENIED Permission denied
  *
  * @see iotcon_deinitialize()
  */
-int iotcon_initialize(void);
+int iotcon_initialize(const char *file_path);
 
 /**
  * @brief Deinitializes IoTCon.
@@ -116,7 +85,6 @@ int iotcon_initialize(void);
  * @pre iotcon_initialize() should be called to initialize.
  *
  * @see iotcon_initialize()
- * @see iotcon_secure_initialize()
  */
 void iotcon_deinitialize(void);
 
index b46afa9771d9c34fb9a92a1a0ff6f536aecad992..f0ce27d7becb724d57c372d36c4109b8c300e85b 100644 (file)
@@ -599,7 +599,7 @@ int main(int argc, char **argv)
        loop = g_main_loop_new(NULL, FALSE);
 
        /* initialize iotcon */
-       ret = iotcon_initialize();
+       ret = iotcon_initialize(NULL);
        if (IOTCON_ERROR_NONE != ret) {
                ERR("iotcon_initialize() Fail(%d)", ret);
                return -1;
index 41c20f925c772937be64b210540d4b04469cccd8..1cdebf273199afc16f613325dbe24ecd85c34d31 100644 (file)
@@ -564,7 +564,7 @@ int main(int argc, char **argv)
        loop = g_main_loop_new(NULL, FALSE);
 
        /* initialize iotcon */
-       ret = iotcon_initialize();
+       ret = iotcon_initialize(NULL);
        if (IOTCON_ERROR_NONE != ret) {
                ERR("iotcon_initialize() Fail(%d)", ret);
                return -1;
index 203b7c5ffcc3497927308c4ef6f4bcf9c8e80e5f..75415cd1a5a6f606c7117aeb269c24a70ba457bc 100644 (file)
@@ -180,7 +180,7 @@ int main(int argc, char **argv)
        loop = g_main_loop_new(NULL, FALSE);
 
        /* initialize iotcon */
-       ret = iotcon_initialize();
+       ret = iotcon_initialize(NULL);
        if (IOTCON_ERROR_NONE != ret) {
                ERR("iotcon_initialize() Fail(%d)", ret);
                return -1;
index 7403eff07c0e222d6b70a13dc2432ce9ef38c8c2..66517e04ec63b8f058b046ef4f81716b9c72ef23 100644 (file)
@@ -239,7 +239,7 @@ int main(int argc, char **argv)
        loop = g_main_loop_new(NULL, FALSE);
 
        /* initialize iotcon */
-       ret = iotcon_initialize();
+       ret = iotcon_initialize(NULL);
        if (IOTCON_ERROR_NONE != ret) {
                ERR("iotcon_initialize() Fail(%d)", ret);
                return -1;
index df18804a8c09b43c49bf7dd90228ca70c16602d3..32fb68e875e8ff5bdcdb7b06823e36d581b0f76b 100644 (file)
@@ -197,7 +197,7 @@ int main(int argc, char **argv)
        loop = g_main_loop_new(NULL, FALSE);
 
        /* initialize iotcon */
-       ret = iotcon_initialize();
+       ret = iotcon_initialize(NULL);
        if (IOTCON_ERROR_NONE != ret) {
                ERR("iotcon_initialize() Fail(%d)", ret);
                return -1;
index 91c57d160404fc3ff4e23de8bd9c36e0b68368a6..d051c2ccfa12b97d9c08627e5e74064c97163690 100644 (file)
@@ -404,7 +404,7 @@ int main(int argc, char **argv)
        loop = g_main_loop_new(NULL, FALSE);
 
        /* initialize iotcon */
-       ret = iotcon_initialize();
+       ret = iotcon_initialize(NULL);
        if (IOTCON_ERROR_NONE != ret) {
                ERR("iotcon_initialize() Fail(%d)", ret);
                return -1;
index 1f08b5c73603df7e83a4394be00b49e94917081c..b26098b8e8e476bfe30691fb6573408addef253c 100644 (file)
@@ -746,7 +746,7 @@ int main(int argc, char **argv)
        loop = g_main_loop_new(NULL, FALSE);
 
        /* initialize iotcon */
-       ret = iotcon_initialize();
+       ret = iotcon_initialize(NULL);
        if (IOTCON_ERROR_NONE != ret) {
                ERR("iotcon_initialize() Fail(%d)", ret);
                return -1;