summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYoungjae Shin <yj99.shin@samsung.com>2016-07-25 16:36:25 +0900
committerYoungjae Shin <yj99.shin@samsung.com>2016-07-26 08:46:43 +0900
commite620b335cc2d72863157ce66f843a658cfc22b08 (patch)
treeffcd2dfc7d705b47b68326335e4c37aa6ebb5fa6
parentaec9f03ca4cbaa6a40ae5eb00163bac9b0940126 (diff)
downloadiotcon-e620b335cc2d72863157ce66f843a658cfc22b08.tar.gz
iotcon-e620b335cc2d72863157ce66f843a658cfc22b08.tar.bz2
iotcon-e620b335cc2d72863157ce66f843a658cfc22b08.zip
ceanup source code.
remove common and separate ioty-types Change-Id: I4e110dcd0e64cfc8c17e844c9088051ae7ee7e10
-rw-r--r--CMakeLists.txt30
-rw-r--r--common/ic-ioty-types.c338
-rw-r--r--include/iotcon-attributes.h (renamed from lib/include/iotcon-attributes.h)6
-rw-r--r--include/iotcon-client.h (renamed from lib/include/iotcon-client.h)6
-rw-r--r--include/iotcon-constant.h (renamed from lib/include/iotcon-constant.h)6
-rw-r--r--include/iotcon-errors.h (renamed from lib/include/iotcon-errors.h)6
-rw-r--r--include/iotcon-internal.h (renamed from lib/include/iotcon-internal.h)6
-rw-r--r--include/iotcon-list.h (renamed from lib/include/iotcon-list.h)6
-rw-r--r--include/iotcon-lite-resource.h (renamed from lib/include/iotcon-lite-resource.h)6
-rw-r--r--include/iotcon-observers.h (renamed from lib/include/iotcon-observers.h)6
-rw-r--r--include/iotcon-options.h (renamed from lib/include/iotcon-options.h)6
-rw-r--r--include/iotcon-provisioning.h (renamed from lib/include/iotcon-provisioning.h)6
-rw-r--r--include/iotcon-query.h (renamed from lib/include/iotcon-query.h)6
-rw-r--r--include/iotcon-remote-resource.h (renamed from lib/include/iotcon-remote-resource.h)6
-rw-r--r--include/iotcon-representation.h (renamed from lib/include/iotcon-representation.h)6
-rw-r--r--include/iotcon-request.h (renamed from lib/include/iotcon-request.h)6
-rw-r--r--include/iotcon-resource-interfaces.h (renamed from lib/include/iotcon-resource-interfaces.h)6
-rw-r--r--include/iotcon-resource-types.h (renamed from lib/include/iotcon-resource-types.h)6
-rw-r--r--include/iotcon-resource.h (renamed from lib/include/iotcon-resource.h)6
-rw-r--r--include/iotcon-response.h (renamed from lib/include/iotcon-response.h)6
-rw-r--r--include/iotcon-server.h (renamed from lib/include/iotcon-server.h)6
-rw-r--r--include/iotcon-types.h (renamed from lib/include/iotcon-types.h)6
-rw-r--r--include/iotcon.h (renamed from lib/include/iotcon.h)6
-rw-r--r--iotcon.pc.in (renamed from lib/iotcon.pc.in)0
-rw-r--r--lib/CMakeLists.txt28
-rw-r--r--src/ic-attributes.c (renamed from lib/icl-attributes.c)10
-rw-r--r--src/ic-attributes.h (renamed from lib/icl-attributes.h)10
-rw-r--r--src/ic-cbor.c (renamed from lib/icl-cbor.c)4
-rw-r--r--src/ic-cbor.h (renamed from lib/icl-cbor.h)6
-rw-r--r--src/ic-common.h (renamed from common/ic-common.h)6
-rw-r--r--src/ic-device.c (renamed from lib/icl-device.c)8
-rw-r--r--src/ic-device.h (renamed from lib/icl-device.h)6
-rw-r--r--src/ic-ioty-convert.c542
-rw-r--r--src/ic-ioty-convert.h (renamed from common/ic-ioty-types.h)25
-rw-r--r--src/ic-ioty-ocprocess.c (renamed from lib/icl-ioty-ocprocess.c)71
-rw-r--r--src/ic-ioty-ocprocess.h (renamed from lib/icl-ioty-ocprocess.h)7
-rw-r--r--src/ic-ioty-parse.c (renamed from lib/icl-ioty-types.c)583
-rw-r--r--src/ic-ioty-parse.h (renamed from lib/icl-ioty-types.h)32
-rw-r--r--src/ic-ioty.c (renamed from lib/icl-ioty.c)62
-rw-r--r--src/ic-ioty.h (renamed from lib/icl-ioty.h)6
-rw-r--r--src/ic-list.c (renamed from lib/icl-list.c)10
-rw-r--r--src/ic-list.h (renamed from lib/icl-list.h)8
-rw-r--r--src/ic-lite-resource.c (renamed from lib/icl-lite-resource.c)18
-rw-r--r--src/ic-lite-resource.h (renamed from lib/icl-lite-resource.h)6
-rw-r--r--src/ic-log.h (renamed from common/ic-log.h)6
-rw-r--r--src/ic-observation.c (renamed from lib/icl-observation.c)4
-rw-r--r--src/ic-observation.h (renamed from lib/icl-observation.h)6
-rw-r--r--src/ic-options.c (renamed from lib/icl-options.c)4
-rw-r--r--src/ic-options.h (renamed from lib/icl-options.h)6
-rw-r--r--src/ic-presence.c (renamed from lib/icl-presence.c)10
-rw-r--r--src/ic-presence.h (renamed from lib/icl-presence.h)6
-rw-r--r--src/ic-provisioning-struct.c (renamed from lib/icl-provisioning-struct.c)7
-rw-r--r--src/ic-provisioning-struct.h (renamed from lib/icl-provisioning-struct.h)6
-rw-r--r--src/ic-provisioning.c (renamed from lib/icl-provisioning.c)8
-rw-r--r--src/ic-query.c (renamed from lib/icl-query.c)8
-rw-r--r--src/ic-query.h (renamed from lib/icl-query.h)6
-rw-r--r--src/ic-remote-resource-caching.c (renamed from lib/icl-remote-resource-caching.c)14
-rw-r--r--src/ic-remote-resource-crud.c (renamed from lib/icl-remote-resource-crud.c)12
-rw-r--r--src/ic-remote-resource-monitoring.c (renamed from lib/icl-remote-resource-monitoring.c)8
-rw-r--r--src/ic-remote-resource.c (renamed from lib/icl-remote-resource.c)16
-rw-r--r--src/ic-remote-resource.h (renamed from lib/icl-remote-resource.h)8
-rw-r--r--src/ic-representation.c (renamed from lib/icl-representation.c)18
-rw-r--r--src/ic-representation.h (renamed from lib/icl-representation.h)8
-rw-r--r--src/ic-request.c (renamed from lib/icl-request.c)4
-rw-r--r--src/ic-request.h (renamed from lib/icl-request.h)6
-rw-r--r--src/ic-resource-interfaces.c (renamed from lib/icl-resource-interfaces.c)6
-rw-r--r--src/ic-resource-interfaces.h (renamed from lib/icl-resource-interfaces.h)6
-rw-r--r--src/ic-resource-types.c (renamed from lib/icl-resource-types.c)6
-rw-r--r--src/ic-resource-types.h (renamed from lib/icl-resource-types.h)8
-rw-r--r--src/ic-resource.c (renamed from lib/icl-resource.c)14
-rw-r--r--src/ic-resource.h (renamed from lib/icl-resource.h)6
-rw-r--r--src/ic-response.c (renamed from lib/icl-response.c)16
-rw-r--r--src/ic-response.h (renamed from lib/icl-response.h)6
-rw-r--r--src/ic-types.c (renamed from lib/icl-types.c)12
-rw-r--r--src/ic-types.h (renamed from lib/icl-types.h)8
-rw-r--r--src/ic-utils.c (renamed from common/ic-utils.c)0
-rw-r--r--src/ic-utils.h (renamed from common/ic-utils.h)6
-rw-r--r--src/ic-value.c (renamed from lib/icl-value.c)10
-rw-r--r--src/ic-value.h (renamed from lib/icl-value.h)6
-rw-r--r--src/ic.c (renamed from lib/icl.c)4
-rw-r--r--src/ic.h (renamed from lib/icl.h)6
-rw-r--r--test/CMakeLists.txt18
-rw-r--r--test/test.h6
83 files changed, 1125 insertions, 1132 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f3ecf19..9be56b2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,16 +2,40 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(iotcon C)
INCLUDE(FindPkgConfig)
+INCLUDE_DIRECTORIES(include)
+SET(LIB ${PROJECT_NAME})
SET(EXTRA_CFLAGS "-Wall -Werror-implicit-function-declaration -fvisibility=hidden")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
-SET(CLIENT ${PROJECT_NAME})
-SET(DAEMON "${PROJECT_NAME}-daemon")
+FILE(GLOB SRCS src/*.c)
+
+pkg_check_modules(pkgs REQUIRED glib-2.0 dlog capi-base-common gio-2.0
+ capi-system-info capi-system-system-settings gio-unix-2.0 iotivity cynara-client uuid)
+
+FOREACH(flag ${pkgs_CFLAGS_OTHER})
+ IF(${flag} MATCHES "\\-D+")
+ ADD_DEFINITIONS(${flag})
+ ENDIF(${flag} MATCHES "\\-D+")
+ENDFOREACH(flag)
+
+INCLUDE_DIRECTORIES(${pkgs_INCLUDE_DIRS})
+LINK_DIRECTORIES(${pkgs_LIBRARY_DIRS})
IF(TZ_VER_3)
ADD_DEFINITIONS("-DTZ_VER_3")
ENDIF(TZ_VER_3)
-ADD_SUBDIRECTORY(lib)
+ADD_LIBRARY(${LIB} SHARED ${SRCS})
+TARGET_LINK_LIBRARIES(${LIB} ${pkgs_LIBRARIES} pthread)
+SET_TARGET_PROPERTIES(${LIB} PROPERTIES VERSION ${FULLVER} SOVERSION ${MAJORVER})
+INSTALL(TARGETS ${LIB} DESTINATION ${LIB_INSTALL_DIR})
+
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+CONFIGURE_FILE(${LIB}.pc.in ${LIB}.pc @ONLY)
+INSTALL(FILES ${LIB}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
+
+FILE(GLOB HEADER include/*.h)
+INSTALL(FILES ${HEADER} DESTINATION ${INCLUDE_INSTALL_DIR}/${LIB})
+
ADD_SUBDIRECTORY(test)
diff --git a/common/ic-ioty-types.c b/common/ic-ioty-types.c
deleted file mode 100644
index 58dbdc2..0000000
--- a/common/ic-ioty-types.c
+++ /dev/null
@@ -1,338 +0,0 @@
-/*
- * Copyright (c) 2015 - 2016 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 <stdlib.h>
-#include <limits.h>
-
-#include <octypes.h>
-
-#include "iotcon-types.h"
-#include "iotcon-options.h"
-#include "ic-common.h"
-#include "ic-log.h"
-#include "ic-utils.h"
-#include "ic-ioty-types.h"
-
-OCConnectivityType ic_ioty_convert_connectivity_type(
- iotcon_connectivity_type_e conn_type)
-{
- int connectivity_type = conn_type;
-
- switch (connectivity_type) {
- case IOTCON_CONNECTIVITY_IPV4:
- return CT_ADAPTER_IP | CT_IP_USE_V4;
- case IOTCON_CONNECTIVITY_IPV6:
- return CT_ADAPTER_IP | CT_IP_USE_V6;
- case IOTCON_CONNECTIVITY_ALL:
- return CT_DEFAULT;
- default:
- ERR("Invalid conn_type(%d)", conn_type);
- }
- return CT_DEFAULT;
-}
-
-iotcon_connectivity_type_e ic_ioty_parse_oic_transport(
- OCTransportAdapter adapter, OCTransportFlags flag)
-{
- iotcon_connectivity_type_e type = IOTCON_CONNECTIVITY_ALL;
-
- /* Need to consider to allow various connectivity types */
- switch (adapter) {
- case OC_ADAPTER_IP:
- if (OC_IP_USE_V4 & flag)
- type = IOTCON_CONNECTIVITY_IPV4;
- else if (OC_IP_USE_V6 & flag)
- type = IOTCON_CONNECTIVITY_IPV6;
- else
- ERR("Invalid Flag(%d)", flag);
- break;
- default:
- ERR("Invalid Adpater(%d)", adapter);
- }
- return type;
-}
-
-
-static void _ic_ioty_conn_type_to_oic_transport_type(int conn_type,
- OCTransportAdapter *adapter, OCTransportFlags *flag)
-{
- RET_IF(NULL == adapter);
- RET_IF(NULL == flag);
-
- switch (conn_type) {
- case IOTCON_CONNECTIVITY_IPV4:
- *adapter = OC_ADAPTER_IP;
- *flag = OC_IP_USE_V4;
- break;
- case IOTCON_CONNECTIVITY_IPV6:
- *adapter = OC_ADAPTER_IP;
- *flag = OC_IP_USE_V6;
- break;
- case IOTCON_CONNECTIVITY_ALL:
- default:
- *adapter = OC_DEFAULT_ADAPTER;
- *flag = OC_DEFAULT_FLAGS;
- }
-}
-
-
-int ic_ioty_convert_connectivity(const char *host_address, int conn_type,
- OCDevAddr *dev_addr)
-{
- char host[PATH_MAX] = {0};
- char *dev_host, *ptr = NULL;
-
- RETV_IF(NULL == dev_addr, IOTCON_ERROR_INVALID_PARAMETER);
-
- snprintf(host, sizeof(host), "%s", host_address);
-
- switch (conn_type) {
- case IOTCON_CONNECTIVITY_IPV4:
- dev_host = strtok_r(host, ":", &ptr);
- snprintf(dev_addr->addr, sizeof(dev_addr->addr), "%s", dev_host);
- dev_addr->port = atoi(strtok_r(NULL, ":", &ptr));
- break;
- case IOTCON_CONNECTIVITY_IPV6:
- dev_host = strtok_r(host, "]", &ptr);
- snprintf(dev_addr->addr, sizeof(dev_addr->addr), "%s", dev_host + 1);
- dev_addr->port = atoi(strtok_r(NULL, ":", &ptr));
- break;
- default:
- ERR("Invalid Connectivity Type(%d)", conn_type);
- return IOTCON_ERROR_INVALID_PARAMETER;
- }
-
- _ic_ioty_conn_type_to_oic_transport_type(conn_type, &(dev_addr->adapter),
- &(dev_addr->flags));
-
- return IOTCON_ERROR_NONE;
-}
-
-
-int ic_ioty_parse_oic_dev_address(OCDevAddr *dev_addr, char **host_address,
- int *conn_type)
-{
- int connectivity_type;
- char host_addr[PATH_MAX] = {0};
-
- RETV_IF(NULL == host_address, IOTCON_ERROR_INVALID_PARAMETER);
- RETV_IF(NULL == conn_type, IOTCON_ERROR_INVALID_PARAMETER);
-
- connectivity_type = ic_ioty_parse_oic_transport(dev_addr->adapter,
- dev_addr->flags);
-
- switch (connectivity_type) {
- case IOTCON_CONNECTIVITY_IPV6:
- snprintf(host_addr, sizeof(host_addr), "[%s]:%d", dev_addr->addr,
- dev_addr->port);
- break;
- case IOTCON_CONNECTIVITY_IPV4:
- snprintf(host_addr, sizeof(host_addr), "%s:%d", dev_addr->addr,
- dev_addr->port);
- break;
- default:
- ERR("Invalid Connectivity Type(%d)", connectivity_type);
- return IOTCON_ERROR_INVALID_PARAMETER;
- }
-
- *host_address = strdup(host_addr);
-
- *conn_type = connectivity_type;
-
- return IOTCON_ERROR_NONE;
-}
-
-
-uint8_t ic_ioty_parse_oic_policies(uint8_t oic_policies)
-{
- uint8_t policies = IOTCON_RESOURCE_NO_POLICY;
-
- if (OC_DISCOVERABLE & oic_policies)
- policies |= IOTCON_RESOURCE_DISCOVERABLE;
-
- if (OC_OBSERVABLE & oic_policies)
- policies |= IOTCON_RESOURCE_OBSERVABLE;
-
- if (OC_ACTIVE & oic_policies)
- policies |= IOTCON_RESOURCE_ACTIVE;
-
- if (OC_SLOW & oic_policies)
- policies |= IOTCON_RESOURCE_SLOW;
-
- if (OC_SECURE & oic_policies)
- policies |= IOTCON_RESOURCE_SECURE;
-
- if (OC_EXPLICIT_DISCOVERABLE & oic_policies)
- policies |= IOTCON_RESOURCE_EXPLICIT_DISCOVERABLE;
-
- return policies;
-}
-
-iotcon_error_e ic_ioty_parse_oic_error(OCStackResult ret)
-{
- switch (ret) {
- case OC_STACK_OK:
- return IOTCON_ERROR_NONE;
- case OC_STACK_NO_MEMORY:
- return IOTCON_ERROR_OUT_OF_MEMORY;
- case OC_STACK_NO_RESOURCE:
- return IOTCON_ERROR_NO_DATA;
- default:
- WARN("Unknown result(%d)", ret);
- }
- return IOTCON_ERROR_IOTIVITY;
-}
-
-iotcon_presence_trigger_e ic_ioty_parse_oic_trigger(OCPresenceTrigger src)
-{
- switch (src) {
- case OC_PRESENCE_TRIGGER_CREATE:
- return IOTCON_PRESENCE_RESOURCE_CREATED;
- case OC_PRESENCE_TRIGGER_CHANGE:
- return IOTCON_PRESENCE_RESOURCE_UPDATED;
- case OC_PRESENCE_TRIGGER_DELETE:
- return IOTCON_PRESENCE_RESOURCE_DESTROYED;
- default:
- ERR("Unknown trigger(%d)", src);
- }
- return IOTCON_PRESENCE_RESOURCE_CREATED;
-}
-
-OCEntityHandlerResult ic_ioty_convert_response_result(
- iotcon_response_result_e result)
-{
- switch (result) {
- case IOTCON_RESPONSE_OK:
- return OC_EH_OK;
- case IOTCON_RESPONSE_RESOURCE_CREATED:
- return OC_EH_RESOURCE_CREATED;
- case IOTCON_RESPONSE_RESOURCE_DELETED:
- return OC_EH_RESOURCE_DELETED;
- case IOTCON_RESPONSE_FORBIDDEN:
- return OC_EH_FORBIDDEN;
- case IOTCON_RESPONSE_ERROR:
- return OC_EH_ERROR;
- default:
- WARN("Unknown result(%d)", result);
- }
- return OC_EH_ERROR;
-}
-
-iotcon_response_result_e ic_ioty_parse_oic_response_result(OCStackResult result)
-{
- switch (result) {
- case OC_STACK_OK:
- return IOTCON_RESPONSE_OK;
- case OC_STACK_RESOURCE_CREATED:
- return IOTCON_RESPONSE_RESOURCE_CREATED;
- case OC_STACK_RESOURCE_DELETED:
- return IOTCON_RESPONSE_RESOURCE_DELETED;
- case OC_STACK_UNAUTHORIZED_REQ:
- return IOTCON_RESPONSE_FORBIDDEN;
- case OC_STACK_ERROR:
- return IOTCON_RESPONSE_ERROR;
- default:
- WARN("Unknown result(%d)", result);
- }
- return IOTCON_RESPONSE_ERROR;
-}
-
-OCMethod ic_ioty_convert_request_type(iotcon_request_type_e type)
-{
- switch (type) {
- case IOTCON_REQUEST_GET:
- return OC_REST_GET;
- case IOTCON_REQUEST_PUT:
- return OC_REST_PUT;
- case IOTCON_REQUEST_POST:
- return OC_REST_POST;
- case IOTCON_REQUEST_DELETE:
- return OC_REST_DELETE;
- default:
- ERR("Unknown Type(%d)", type);
- }
- return OC_REST_NOMETHOD;
-}
-
-iotcon_request_type_e ic_ioty_parse_oic_method(OCMethod method)
-{
- switch (method) {
- case OC_REST_GET:
- return IOTCON_REQUEST_GET;
- case OC_REST_PUT:
- return IOTCON_REQUEST_PUT;
- case OC_REST_POST:
- return IOTCON_REQUEST_POST;
- case OC_REST_DELETE:
- return IOTCON_REQUEST_DELETE;
- default:
- ERR("Unknown method(%d)", method);
- return IOTCON_REQUEST_UNKNOWN;
- }
-}
-
-iotcon_observe_type_e ic_ioty_parse_oic_action(OCObserveAction oic_action)
-{
- switch (oic_action) {
- case OC_OBSERVE_REGISTER:
- return IOTCON_OBSERVE_REGISTER;
- case OC_OBSERVE_DEREGISTER:
- return IOTCON_OBSERVE_DEREGISTER;
- case OC_OBSERVE_NO_OPTION:
- default:
- ERR("Unknown action (%d)", oic_action);
- }
- return IOTCON_OBSERVE_NO_TYPE;
-}
-
-OCQualityOfService ic_ioty_convert_qos(iotcon_qos_e qos)
-{
- switch (qos) {
- case IOTCON_QOS_HIGH:
- return OC_HIGH_QOS;
- case IOTCON_QOS_LOW:
- return OC_LOW_QOS;
- default:
- ERR("Unknown qos(%d)", qos);
- }
- return OC_NA_QOS;
-}
-
-uint8_t ic_ioty_convert_policies(uint8_t policies)
-{
- uint8_t oic_policies = OC_RES_PROP_NONE;
-
- if (IOTCON_RESOURCE_DISCOVERABLE & policies)
- oic_policies |= OC_DISCOVERABLE;
-
- if (IOTCON_RESOURCE_OBSERVABLE & policies)
- oic_policies |= OC_OBSERVABLE;
-
- if (IOTCON_RESOURCE_ACTIVE & policies)
- oic_policies |= OC_ACTIVE;
-
- if (IOTCON_RESOURCE_SLOW & policies)
- oic_policies |= OC_SLOW;
-
- if (IOTCON_RESOURCE_SECURE & policies)
- oic_policies |= OC_SECURE;
-
- if (IOTCON_RESOURCE_EXPLICIT_DISCOVERABLE & policies)
- oic_policies |= OC_EXPLICIT_DISCOVERABLE;
-
- return oic_policies;
-}
-
diff --git a/lib/include/iotcon-attributes.h b/include/iotcon-attributes.h
index e8ade6c..5e64ad4 100644
--- a/lib/include/iotcon-attributes.h
+++ b/include/iotcon-attributes.h
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __IOT_CONNECTIVITY_STRUCT_ATTRIBUTES_H__
-#define __IOT_CONNECTIVITY_STRUCT_ATTRIBUTES_H__
+#ifndef __IOTCON_STRUCT_ATTRIBUTES_H__
+#define __IOTCON_STRUCT_ATTRIBUTES_H__
#include <iotcon-types.h>
@@ -585,4 +585,4 @@ int iotcon_attributes_get_keys_count(iotcon_attributes_h attributes, unsigned in
* @}
*/
-#endif /* __IOT_CONNECTIVITY_STRUCT_ATTRIBUTES_H__ */
+#endif /* __IOTCON_STRUCT_ATTRIBUTES_H__ */
diff --git a/lib/include/iotcon-client.h b/include/iotcon-client.h
index 7e8b1d6..5774c0b 100644
--- a/lib/include/iotcon-client.h
+++ b/include/iotcon-client.h
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __IOT_CONNECTIVITY_CLIENT_H__
-#define __IOT_CONNECTIVITY_CLIENT_H__
+#ifndef __IOTCON_CLIENT_H__
+#define __IOTCON_CLIENT_H__
#include <iotcon-types.h>
#include <iotcon-remote-resource.h>
@@ -554,4 +554,4 @@ int iotcon_platform_info_get_property(iotcon_platform_info_h platform_info,
* @}
*/
-#endif /* __IOT_CONNECTIVITY_CLIENT_H__ */
+#endif /* __IOTCON_CLIENT_H__ */
diff --git a/lib/include/iotcon-constant.h b/include/iotcon-constant.h
index 46fb2cb..f0657cf 100644
--- a/lib/include/iotcon-constant.h
+++ b/include/iotcon-constant.h
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __IOT_CONNECTIVITY_CONSTANT_H__
-#define __IOT_CONNECTIVITY_CONSTANT_H__
+#ifndef __IOTCON_CONSTANT_H__
+#define __IOTCON_CONSTANT_H__
/**
* @file iotcon-constant.h
@@ -255,4 +255,4 @@ typedef enum {
* @}
*/
-#endif /* __IOT_CONNECTIVITY_CONSTANT_H__ */
+#endif /* __IOTCON_CONSTANT_H__ */
diff --git a/lib/include/iotcon-errors.h b/include/iotcon-errors.h
index 18256a1..b0ebe7e 100644
--- a/lib/include/iotcon-errors.h
+++ b/include/iotcon-errors.h
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __IOT_CONNECTIVITY_ERRORS_H__
-#define __IOT_CONNECTIVITY_ERRORS_H__
+#ifndef __IOTCON_ERRORS_H__
+#define __IOTCON_ERRORS_H__
#include <tizen.h>
@@ -53,4 +53,4 @@ typedef enum {
* @}
*/
-#endif /* __IOT_CONNECTIVITY_ERRORS_H__ */
+#endif /* __IOTCON_ERRORS_H__ */
diff --git a/lib/include/iotcon-internal.h b/include/iotcon-internal.h
index 9450010..c4e4d53 100644
--- a/lib/include/iotcon-internal.h
+++ b/include/iotcon-internal.h
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __IOT_CONNECTIVITY_INTERNAL_H__
-#define __IOT_CONNECTIVITY_INTERNAL_H__
+#ifndef __IOTCON_INTERNAL_H__
+#define __IOTCON_INTERNAL_H__
#ifdef __cplusplus
extern "C" {
@@ -26,4 +26,4 @@ extern "C" {
}
#endif
-#endif /* __IOT_CONNECTIVITY_INTERNAL_H__ */
+#endif /* __IOTCON_INTERNAL_H__ */
diff --git a/lib/include/iotcon-list.h b/include/iotcon-list.h
index 9982584..606a433 100644
--- a/lib/include/iotcon-list.h
+++ b/include/iotcon-list.h
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __IOT_CONNECTIVITY_STRUCT_LIST_H__
-#define __IOT_CONNECTIVITY_STRUCT_LIST_H__
+#ifndef __IOTCON_STRUCT_LIST_H__
+#define __IOTCON_STRUCT_LIST_H__
#include <iotcon-types.h>
@@ -821,4 +821,4 @@ int iotcon_list_foreach_attributes(iotcon_list_h list, iotcon_list_attributes_cb
* @}
*/
-#endif /* __IOT_CONNECTIVITY_STRUCT_LIST_H__ */
+#endif /* __IOTCON_STRUCT_LIST_H__ */
diff --git a/lib/include/iotcon-lite-resource.h b/include/iotcon-lite-resource.h
index 3572a22..dd54aee 100644
--- a/lib/include/iotcon-lite-resource.h
+++ b/include/iotcon-lite-resource.h
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __IOT_CONNECTIVITY_SERVER_LITE_RESOURCE_H__
-#define __IOT_CONNECTIVITY_SERVER_LITE_RESOURCE_H__
+#ifndef __IOTCON_SERVER_LITE_RESOURCE_H__
+#define __IOTCON_SERVER_LITE_RESOURCE_H__
#include <stdint.h>
#include <iotcon-types.h>
@@ -283,4 +283,4 @@ int iotcon_lite_resource_get_attributes(iotcon_lite_resource_h resource,
* @}
*/
-#endif /* __IOT_CONNECTIVITY_SERVER_LITE_RESOURCE_H__ */
+#endif /* __IOTCON_SERVER_LITE_RESOURCE_H__ */
diff --git a/lib/include/iotcon-observers.h b/include/iotcon-observers.h
index 97a4a64..adb93c3 100644
--- a/lib/include/iotcon-observers.h
+++ b/include/iotcon-observers.h
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __IOT_CONNECTIVITY_SERVER_OBSERVERS_H__
-#define __IOT_CONNECTIVITY_SERVER_OBSERVERS_H__
+#ifndef __IOTCON_SERVER_OBSERVERS_H__
+#define __IOTCON_SERVER_OBSERVERS_H__
#include <iotcon-types.h>
@@ -207,4 +207,4 @@ int iotcon_observers_remove(iotcon_observers_h observers, int obs_id);
* @}
*/
-#endif /* __IOT_CONNECTIVITY_SERVER_OBSERVERS_H__ */
+#endif /* __IOTCON_SERVER_OBSERVERS_H__ */
diff --git a/lib/include/iotcon-options.h b/include/iotcon-options.h
index 773da84..7a03f82 100644
--- a/lib/include/iotcon-options.h
+++ b/include/iotcon-options.h
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __IOT_CONNECTIVITY_STRUCT_OPTIONS_H__
-#define __IOT_CONNECTIVITY_STRUCT_OPTIONS_H__
+#ifndef __IOTCON_STRUCT_OPTIONS_H__
+#define __IOTCON_STRUCT_OPTIONS_H__
#include <iotcon-types.h>
@@ -272,4 +272,4 @@ int iotcon_options_foreach(iotcon_options_h options, iotcon_options_foreach_cb c
* @}
*/
-#endif /* __IOT_CONNECTIVITY_STRUCT_OPTIONS_H__ */
+#endif /* __IOTCON_STRUCT_OPTIONS_H__ */
diff --git a/lib/include/iotcon-provisioning.h b/include/iotcon-provisioning.h
index d39d468..d1ef840 100644
--- a/lib/include/iotcon-provisioning.h
+++ b/include/iotcon-provisioning.h
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __IOT_CONNECTIVITY_PROVISIONING_H__
-#define __IOT_CONNECTIVITY_PROVISIONING_H__
+#ifndef __IOTCON_PROVISIONING_H__
+#define __IOTCON_PROVISIONING_H__
#include <iotcon-errors.h>
@@ -180,4 +180,4 @@ int iotcon_provisioning_acl_set_permission(iotcon_provisioning_acl_h acl,
int permission);
int iotcon_provisioning_acl_destroy(iotcon_provisioning_acl_h acl);
-#endif /* __IOT_CONNECTIVITY_PROVISIONING_H__ */
+#endif /* __IOTCON_PROVISIONING_H__ */
diff --git a/lib/include/iotcon-query.h b/include/iotcon-query.h
index 637b57a..ca43e28 100644
--- a/lib/include/iotcon-query.h
+++ b/include/iotcon-query.h
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __IOT_CONNECTIVITY_STRUCT_QUERY_H__
-#define __IOT_CONNECTIVITY_STRUCT_QUERY_H__
+#ifndef __IOTCON_STRUCT_QUERY_H__
+#define __IOTCON_STRUCT_QUERY_H__
#include <iotcon-types.h>
@@ -357,4 +357,4 @@ int iotcon_query_foreach(iotcon_query_h query, iotcon_query_foreach_cb cb,
* @}
*/
-#endif /* __IOT_CONNECTIVITY_STRUCT_QUERY_H__ */
+#endif /* __IOTCON_STRUCT_QUERY_H__ */
diff --git a/lib/include/iotcon-remote-resource.h b/include/iotcon-remote-resource.h
index ee9eaea..360fb4c 100644
--- a/lib/include/iotcon-remote-resource.h
+++ b/include/iotcon-remote-resource.h
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __IOT_CONNECTIVITY_CLIENT_REMOTE_RESOURCE_H__
-#define __IOT_CONNECTIVITY_CLIENT_REMOTE_RESOURCE_H__
+#ifndef __IOTCON_CLIENT_REMOTE_RESOURCE_H__
+#define __IOTCON_CLIENT_REMOTE_RESOURCE_H__
#include <stdint.h>
#include <iotcon-types.h>
@@ -914,4 +914,4 @@ int iotcon_remote_resource_set_time_interval(int time_interval);
* @}
*/
-#endif /* __IOT_CONNECTIVITY_CLIENT_REMOTE_RESOURCE_H__ */
+#endif /* __IOTCON_CLIENT_REMOTE_RESOURCE_H__ */
diff --git a/lib/include/iotcon-representation.h b/include/iotcon-representation.h
index de97f7a..def9ec6 100644
--- a/lib/include/iotcon-representation.h
+++ b/include/iotcon-representation.h
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __IOT_CONNECTIVITY_STRUCT_REPRESENTATION_H__
-#define __IOT_CONNECTIVITY_STRUCT_REPRESENTATION_H__
+#ifndef __IOTCON_STRUCT_REPRESENTATION_H__
+#define __IOTCON_STRUCT_REPRESENTATION_H__
#include <iotcon-types.h>
@@ -510,4 +510,4 @@ int iotcon_representation_get_nth_child(iotcon_representation_h parent, int pos,
* @}
*/
-#endif /* __IOT_CONNECTIVITY_STRUCT_REPRESENTATION_H__ */
+#endif /* __IOTCON_STRUCT_REPRESENTATION_H__ */
diff --git a/lib/include/iotcon-request.h b/include/iotcon-request.h
index 81da9a7..5e4a6d0 100644
--- a/lib/include/iotcon-request.h
+++ b/include/iotcon-request.h
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __IOT_CONNECTIVITY_SERVER_REQUEST_H__
-#define __IOT_CONNECTIVITY_SERVER_REQUEST_H__
+#ifndef __IOTCON_SERVER_REQUEST_H__
+#define __IOTCON_SERVER_REQUEST_H__
#include <iotcon-types.h>
@@ -327,4 +327,4 @@ int iotcon_request_get_observe_id(iotcon_request_h request, int *observe_id);
* @}
*/
-#endif /* __IOT_CONNECTIVITY_SERVER_REQUEST_H__ */
+#endif /* __IOTCON_SERVER_REQUEST_H__ */
diff --git a/lib/include/iotcon-resource-interfaces.h b/include/iotcon-resource-interfaces.h
index 565ca6b..709d044 100644
--- a/lib/include/iotcon-resource-interfaces.h
+++ b/include/iotcon-resource-interfaces.h
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __IOT_CONNECTIVITY_STRUCT_RESOURCE_INTERFACES_H__
-#define __IOT_CONNECTIVITY_STRUCT_RESOURCE_INTERFACES_H__
+#ifndef __IOTCON_STRUCT_RESOURCE_INTERFACES_H__
+#define __IOTCON_STRUCT_RESOURCE_INTERFACES_H__
#include <iotcon-types.h>
@@ -260,4 +260,4 @@ int iotcon_resource_interfaces_clone(iotcon_resource_interfaces_h src,
* @}
*/
-#endif /* __IOT_CONNECTIVITY_STRUCT_RESOURCE_INTERFACES_H__ */
+#endif /* __IOTCON_STRUCT_RESOURCE_INTERFACES_H__ */
diff --git a/lib/include/iotcon-resource-types.h b/include/iotcon-resource-types.h
index d983947..6247bac 100644
--- a/lib/include/iotcon-resource-types.h
+++ b/include/iotcon-resource-types.h
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __IOT_CONNECTIVITY_STRUCT_RESOURCE_TYPES_H__
-#define __IOT_CONNECTIVITY_STRUCT_RESOURCE_TYPES_H__
+#ifndef __IOTCON_STRUCT_RESOURCE_TYPES_H__
+#define __IOTCON_STRUCT_RESOURCE_TYPES_H__
#include <iotcon-types.h>
@@ -256,4 +256,4 @@ int iotcon_resource_types_clone(iotcon_resource_types_h src,
* @}
*/
-#endif /* __IOT_CONNECTIVITY_STRUCT_RESOURCE_TYPES_H__ */
+#endif /* __IOTCON_STRUCT_RESOURCE_TYPES_H__ */
diff --git a/lib/include/iotcon-resource.h b/include/iotcon-resource.h
index df554d4..30d462e 100644
--- a/lib/include/iotcon-resource.h
+++ b/include/iotcon-resource.h
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __IOT_CONNECTIVITY_SERVER_RESOURCE_H__
-#define __IOT_CONNECTIVITY_SERVER_RESOURCE_H__
+#ifndef __IOTCON_SERVER_RESOURCE_H__
+#define __IOTCON_SERVER_RESOURCE_H__
#include <stdint.h>
#include <iotcon-types.h>
@@ -622,4 +622,4 @@ int iotcon_resource_get_policies(iotcon_resource_h resource, uint8_t *policies);
* @}
*/
-#endif /* __IOT_CONNECTIVITY_SERVER_RESOURCE_H__ */
+#endif /* __IOTCON_SERVER_RESOURCE_H__ */
diff --git a/lib/include/iotcon-response.h b/include/iotcon-response.h
index 2709d0b..4fee6a8 100644
--- a/lib/include/iotcon-response.h
+++ b/include/iotcon-response.h
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __IOT_CONNECTIVITY_COMMON_RESPONSE_H__
-#define __IOT_CONNECTIVITY_COMMON_RESPONSE_H__
+#ifndef __IOTCON_COMMON_RESPONSE_H__
+#define __IOTCON_COMMON_RESPONSE_H__
#include <iotcon-types.h>
@@ -367,4 +367,4 @@ int iotcon_response_send(iotcon_response_h resp);
* @}
*/
-#endif /* __IOT_CONNECTIVITY_COMMON_RESPONSE_H__ */
+#endif /* __IOTCON_COMMON_RESPONSE_H__ */
diff --git a/lib/include/iotcon-server.h b/include/iotcon-server.h
index 4ae4884..1beb06d 100644
--- a/lib/include/iotcon-server.h
+++ b/include/iotcon-server.h
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __IOT_CONNECTIVITY_SERVER_H__
-#define __IOT_CONNECTIVITY_SERVER_H__
+#ifndef __IOTCON_SERVER_H__
+#define __IOTCON_SERVER_H__
#include <iotcon-resource.h>
#include <iotcon-lite-resource.h>
@@ -126,4 +126,4 @@ int iotcon_set_device_name(const char *device_name);
* @}
*/
-#endif /* __IOT_CONNECTIVITY_SERVER_H__ */
+#endif /* __IOTCON_SERVER_H__ */
diff --git a/lib/include/iotcon-types.h b/include/iotcon-types.h
index 8b6983f..bca283d 100644
--- a/lib/include/iotcon-types.h
+++ b/include/iotcon-types.h
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __IOT_CONNECTIVITY_TYPES_H__
-#define __IOT_CONNECTIVITY_TYPES_H__
+#ifndef __IOTCON_TYPES_H__
+#define __IOTCON_TYPES_H__
#include <tizen_type.h>
@@ -229,4 +229,4 @@ typedef struct icl_attributes_s* iotcon_attributes_h;
#include <iotcon-resource-types.h>
#include <iotcon-resource-interfaces.h>
-#endif /* __IOT_CONNECTIVITY_TYPES_H__ */
+#endif /* __IOTCON_TYPES_H__ */
diff --git a/lib/include/iotcon.h b/include/iotcon.h
index 7ca874b..8c3b644 100644
--- a/lib/include/iotcon.h
+++ b/include/iotcon.h
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __IOT_CONNECTIVITY_H__
-#define __IOT_CONNECTIVITY_H__
+#ifndef __IOTCON_H__
+#define __IOTCON_H__
#ifdef __cplusplus
extern "C" {
@@ -198,4 +198,4 @@ int iotcon_polling_invoke(void);
}
#endif
-#endif /* __IOT_CONNECTIVITY_H__ */
+#endif /* __IOTCON_H__ */
diff --git a/lib/iotcon.pc.in b/iotcon.pc.in
index 7750f73..7750f73 100644
--- a/lib/iotcon.pc.in
+++ b/iotcon.pc.in
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
deleted file mode 100644
index 8995d11..0000000
--- a/lib/CMakeLists.txt
+++ /dev/null
@@ -1,28 +0,0 @@
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/common/)
-INCLUDE_DIRECTORIES(include)
-
-FILE(GLOB CLIENT_SRCS *.c ${CMAKE_SOURCE_DIR}/common/*.c)
-
-pkg_check_modules(client_pkgs REQUIRED glib-2.0 dlog capi-base-common gio-2.0
- capi-system-info capi-system-system-settings gio-unix-2.0 iotivity cynara-client uuid)
-
-FOREACH(flag ${client_pkgs_CFLAGS_OTHER})
- IF(${flag} MATCHES "\\-D+")
- ADD_DEFINITIONS(${flag})
- ENDIF(${flag} MATCHES "\\-D+")
-ENDFOREACH(flag)
-
-INCLUDE_DIRECTORIES(${client_pkgs_INCLUDE_DIRS})
-LINK_DIRECTORIES(${client_pkgs_LIBRARY_DIRS})
-
-ADD_LIBRARY(${CLIENT} SHARED ${CLIENT_SRCS})
-TARGET_LINK_LIBRARIES(${CLIENT} ${client_pkgs_LIBRARIES} pthread)
-SET_TARGET_PROPERTIES(${CLIENT} PROPERTIES VERSION ${FULLVER} SOVERSION ${MAJORVER})
-INSTALL(TARGETS ${CLIENT} DESTINATION ${LIB_INSTALL_DIR})
-
-SET(PREFIX ${CMAKE_INSTALL_PREFIX})
-CONFIGURE_FILE(${CLIENT}.pc.in ${CLIENT}.pc @ONLY)
-INSTALL(FILES ${CLIENT}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
-
-FILE(GLOB CLIENT_HEADER include/*.h)
-INSTALL(FILES ${CLIENT_HEADER} DESTINATION ${INCLUDE_INSTALL_DIR}/${CLIENT})
diff --git a/lib/icl-attributes.c b/src/ic-attributes.c
index e12e360..c877991 100644
--- a/lib/icl-attributes.c
+++ b/src/ic-attributes.c
@@ -17,12 +17,12 @@
#include <glib.h>
#include "iotcon-types.h"
+#include "ic.h"
+#include "ic-list.h"
+#include "ic-value.h"
#include "ic-utils.h"
-#include "icl.h"
-#include "icl-list.h"
-#include "icl-value.h"
-#include "icl-representation.h"
-#include "icl-attributes.h"
+#include "ic-representation.h"
+#include "ic-attributes.h"
iotcon_attributes_h icl_attributes_ref(iotcon_attributes_h attributes)
{
diff --git a/lib/icl-attributes.h b/src/ic-attributes.h
index b74f418..2259767 100644
--- a/lib/icl-attributes.h
+++ b/src/ic-attributes.h
@@ -13,11 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __IOT_CONNECTIVITY_LIBRARY_ATTRIBUTES_H__
-#define __IOT_CONNECTIVITY_LIBRARY_ATTRIBUTES_H__
+#ifndef __IOTCON_INTERNAL_ATTRIBUTES_H__
+#define __IOTCON_INTERNAL_ATTRIBUTES_H__
-#include "icl-value.h"
-#include "icl-representation.h"
+#include "ic-value.h"
+#include "ic-representation.h"
int icl_attributes_set_value(iotcon_attributes_h attributes, const char *key,
iotcon_value_h value);
@@ -27,4 +27,4 @@ void icl_attributes_clone_foreach(char *key, iotcon_value_h src_val,
iotcon_attributes_h icl_attributes_ref(iotcon_attributes_h attributes);
-#endif /* __IOT_CONNECTIVITY_LIBRARY_ATTRIBUTES_H__ */
+#endif /* __IOTCON_INTERNAL_ATTRIBUTES_H__ */
diff --git a/lib/icl-cbor.c b/src/ic-cbor.c
index fcbc780..1eb4097 100644
--- a/lib/icl-cbor.c
+++ b/src/ic-cbor.c
@@ -23,8 +23,8 @@
#include <fcntl.h>
#include <uuid/uuid.h>
-#include "icl.h"
-#include "icl-cbor.h"
+#include "ic.h"
+#include "ic-cbor.h"
#define ICL_CBOR_UUID_STR_LEN 36
#define ICL_CBOR_UUID_SIZE 16
diff --git a/lib/icl-cbor.h b/src/ic-cbor.h
index 1cf5344..115c4eb 100644
--- a/lib/icl-cbor.h
+++ b/src/ic-cbor.h
@@ -13,11 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __IOT_CONNECTIVITY_LIBRARY_CBOR_H__
-#define __IOT_CONNECTIVITY_LIBRARY_CBOR_H__
+#ifndef __IOTCON_INTERNAL_CBOR_H__
+#define __IOTCON_INTERNAL_CBOR_H__
int icl_cbor_create_svr_db(const char *path);
int icl_cbor_create_pt_svr_db(const char *path);
-#endif /* __IOT_CONNECTIVITY_LIBRARY_CBOR_H__ */
+#endif /* __IOTCON_INTERNAL_CBOR_H__ */
diff --git a/common/ic-common.h b/src/ic-common.h
index fdb9882..8f05aaa 100644
--- a/common/ic-common.h
+++ b/src/ic-common.h
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __IOT_CONNECTIVITY_INTERNAL_COMMON_H__
-#define __IOT_CONNECTIVITY_INTERNAL_COMMON_H__
+#ifndef __IOTCON_INTERNAL_COMMON_H__
+#define __IOTCON_INTERNAL_COMMON_H__
#include <stdint.h>
#include "iotcon-errors.h"
@@ -32,4 +32,4 @@
#define IC_IOTY_COAPS "coaps://"
#define IC_IOTY_MULTICAST_ADDRESS "224.0.1.187:5683"
-#endif /* __IOT_CONNECTIVITY_INTERNAL_COMMON_H__ */
+#endif /* __IOTCON_INTERNAL_COMMON_H__ */
diff --git a/lib/icl-device.c b/src/ic-device.c
index 115b2ec..ac653df 100644
--- a/lib/icl-device.c
+++ b/src/ic-device.c
@@ -18,11 +18,11 @@
#include <string.h>
#include "iotcon.h"
+#include "ic.h"
#include "ic-utils.h"
-#include "icl.h"
-#include "icl-representation.h"
-#include "icl-device.h"
-#include "icl-ioty.h"
+#include "ic-representation.h"
+#include "ic-device.h"
+#include "ic-ioty.h"
API int iotcon_device_info_get_property(iotcon_device_info_h device_info,
iotcon_device_info_e property, char **value)
diff --git a/lib/icl-device.h b/src/ic-device.h
index ad625a1..278a0f8 100644
--- a/lib/icl-device.h
+++ b/src/ic-device.h
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __IOT_CONNECTIVITY_LIBRARY_DEVICE_H__
-#define __IOT_CONNECTIVITY_LIBRARY_DEVICE_H__
+#ifndef __IOTCON_INTERNAL_DEVICE_H__
+#define __IOTCON_INTERNAL_DEVICE_H__
#include "iotcon-types.h"
@@ -39,4 +39,4 @@ struct icl_platform_info {
char *system_time;
};
-#endif /* __IOT_CONNECTIVITY_LIBRARY_DEVICE_H__ */
+#endif /* __IOTCON_INTERNAL_DEVICE_H__ */
diff --git a/src/ic-ioty-convert.c b/src/ic-ioty-convert.c
new file mode 100644
index 0000000..6b68605
--- /dev/null
+++ b/src/ic-ioty-convert.c
@@ -0,0 +1,542 @@
+/*
+ * Copyright (c) 2015 - 2016 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 <stdlib.h>
+#include <limits.h>
+#include <glib.h>
+
+#include <octypes.h>
+#include <ocpayload.h>
+
+#include "iotcon.h"
+#include "ic.h"
+#include "ic-list.h"
+#include "ic-value.h"
+#include "ic-options.h"
+#include "ic-representation.h"
+#include "ic-resource-types.h"
+#include "ic-resource-interfaces.h"
+#include "ic-ioty-convert.h"
+
+struct icl_attributes_list_s {
+ OCRepPayloadPropType type;
+ size_t dimensions[MAX_REP_ARRAY_DEPTH];
+ GList *list;
+};
+
+static int _icl_ioty_fill_oic_rep_payload_value(OCRepPayload *payload,
+ iotcon_attributes_h attributes);
+
+
+OCConnectivityType ic_ioty_convert_connectivity_type(
+ iotcon_connectivity_type_e conn_type)
+{
+ int connectivity_type = conn_type;
+
+ switch (connectivity_type) {
+ case IOTCON_CONNECTIVITY_IPV4:
+ return CT_ADAPTER_IP | CT_IP_USE_V4;
+ case IOTCON_CONNECTIVITY_IPV6:
+ return CT_ADAPTER_IP | CT_IP_USE_V6;
+ case IOTCON_CONNECTIVITY_ALL:
+ return CT_DEFAULT;
+ default:
+ ERR("Invalid conn_type(%d)", conn_type);
+ }
+ return CT_DEFAULT;
+}
+
+
+static void _ic_ioty_conn_type_to_oic_transport_type(int conn_type,
+ OCTransportAdapter *adapter, OCTransportFlags *flag)
+{
+ RET_IF(NULL == adapter);
+ RET_IF(NULL == flag);
+
+ switch (conn_type) {
+ case IOTCON_CONNECTIVITY_IPV4:
+ *adapter = OC_ADAPTER_IP;
+ *flag = OC_IP_USE_V4;
+ break;
+ case IOTCON_CONNECTIVITY_IPV6:
+ *adapter = OC_ADAPTER_IP;
+ *flag = OC_IP_USE_V6;
+ break;
+ case IOTCON_CONNECTIVITY_ALL:
+ default:
+ *adapter = OC_DEFAULT_ADAPTER;
+ *flag = OC_DEFAULT_FLAGS;
+ }
+}
+
+
+int ic_ioty_convert_connectivity(const char *host_address, int conn_type,
+ OCDevAddr *dev_addr)
+{
+ char host[PATH_MAX] = {0};
+ char *dev_host, *ptr = NULL;
+
+ RETV_IF(NULL == dev_addr, IOTCON_ERROR_INVALID_PARAMETER);
+
+ snprintf(host, sizeof(host), "%s", host_address);
+
+ switch (conn_type) {
+ case IOTCON_CONNECTIVITY_IPV4:
+ dev_host = strtok_r(host, ":", &ptr);
+ snprintf(dev_addr->addr, sizeof(dev_addr->addr), "%s", dev_host);
+ dev_addr->port = atoi(strtok_r(NULL, ":", &ptr));
+ break;
+ case IOTCON_CONNECTIVITY_IPV6:
+ dev_host = strtok_r(host, "]", &ptr);
+ snprintf(dev_addr->addr, sizeof(dev_addr->addr), "%s", dev_host + 1);
+ dev_addr->port = atoi(strtok_r(NULL, ":", &ptr));
+ break;
+ default:
+ ERR("Invalid Connectivity Type(%d)", conn_type);
+ return IOTCON_ERROR_INVALID_PARAMETER;
+ }
+
+ _ic_ioty_conn_type_to_oic_transport_type(conn_type, &(dev_addr->adapter),
+ &(dev_addr->flags));
+
+ return IOTCON_ERROR_NONE;
+}
+
+OCEntityHandlerResult ic_ioty_convert_response_result(
+ iotcon_response_result_e result)
+{
+ switch (result) {
+ case IOTCON_RESPONSE_OK:
+ return OC_EH_OK;
+ case IOTCON_RESPONSE_RESOURCE_CREATED:
+ return OC_EH_RESOURCE_CREATED;
+ case IOTCON_RESPONSE_RESOURCE_DELETED:
+ return OC_EH_RESOURCE_DELETED;
+ case IOTCON_RESPONSE_FORBIDDEN:
+ return OC_EH_FORBIDDEN;
+ case IOTCON_RESPONSE_ERROR:
+ return OC_EH_ERROR;
+ default:
+ WARN("Unknown result(%d)", result);
+ }
+ return OC_EH_ERROR;
+}
+
+OCMethod ic_ioty_convert_request_type(iotcon_request_type_e type)
+{
+ switch (type) {
+ case IOTCON_REQUEST_GET:
+ return OC_REST_GET;
+ case IOTCON_REQUEST_PUT:
+ return OC_REST_PUT;
+ case IOTCON_REQUEST_POST:
+ return OC_REST_POST;
+ case IOTCON_REQUEST_DELETE:
+ return OC_REST_DELETE;
+ default:
+ ERR("Unknown Type(%d)", type);
+ }
+ return OC_REST_NOMETHOD;
+}
+
+OCQualityOfService ic_ioty_convert_qos(iotcon_qos_e qos)
+{
+ switch (qos) {
+ case IOTCON_QOS_HIGH:
+ return OC_HIGH_QOS;
+ case IOTCON_QOS_LOW:
+ return OC_LOW_QOS;
+ default:
+ ERR("Unknown qos(%d)", qos);
+ }
+ return OC_NA_QOS;
+}
+
+uint8_t ic_ioty_convert_policies(uint8_t policies)
+{
+ uint8_t oic_policies = OC_RES_PROP_NONE;
+
+ if (IOTCON_RESOURCE_DISCOVERABLE & policies)
+ oic_policies |= OC_DISCOVERABLE;
+
+ if (IOTCON_RESOURCE_OBSERVABLE & policies)
+ oic_policies |= OC_OBSERVABLE;
+
+ if (IOTCON_RESOURCE_ACTIVE & policies)
+ oic_policies |= OC_ACTIVE;
+
+ if (IOTCON_RESOURCE_SLOW & policies)
+ oic_policies |= OC_SLOW;
+
+ if (IOTCON_RESOURCE_SECURE & policies)
+ oic_policies |= OC_SECURE;
+
+ if (IOTCON_RESOURCE_EXPLICIT_DISCOVERABLE & policies)
+ oic_policies |= OC_EXPLICIT_DISCOVERABLE;
+
+ return oic_policies;
+}
+
+int ic_ioty_convert_header_options(iotcon_options_h options,
+ OCHeaderOption dest[], int dest_size)
+{
+ int i = 0, src_size;
+ GHashTableIter iter;
+ gpointer option_id, option_data;
+
+ RETV_IF(NULL == options, IOTCON_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == options->hash, IOTCON_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == dest, IOTCON_ERROR_INVALID_PARAMETER);
+
+ src_size = g_hash_table_size(options->hash);
+
+ if (dest_size < src_size) {
+ ERR("Exceed Size(%d)", src_size);
+ return IOTCON_ERROR_INVALID_PARAMETER;
+ }
+
+ g_hash_table_iter_init(&iter, options->hash);
+ while (g_hash_table_iter_next(&iter, &option_id, &option_data)) {
+ dest[i].protocolID = OC_COAP_ID;
+ dest[i].optionID = GPOINTER_TO_INT(option_id);
+ dest[i].optionLength = strlen(option_data) + 1;
+ memcpy(dest[i].optionData, option_data, dest[i].optionLength);
+ i++;
+ }
+ return IOTCON_ERROR_NONE;
+}
+
+static int _icl_ioty_attributes_list_to_value_list(iotcon_list_h list,
+ struct icl_attributes_list_s *value_list, int depth)
+{
+ int ret;
+ GList *c;
+
+ RETV_IF(NULL == list, IOTCON_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == value_list, IOTCON_ERROR_INVALID_PARAMETER);
+
+ value_list->dimensions[depth] = g_list_length(list->list);
+
+ switch (list->type) {
+ case IOTCON_TYPE_BOOL:
+ value_list->type = OCREP_PROP_BOOL;
+ for (c = list->list; c; c = c->next)
+ value_list->list = g_list_append(value_list->list, c->data);
+ break;
+ case IOTCON_TYPE_INT:
+ value_list->type = OCREP_PROP_INT;
+ for (c = list->list; c; c = c->next)
+ value_list->list = g_list_append(value_list->list, c->data);
+ break;
+ case IOTCON_TYPE_DOUBLE:
+ value_list->type = OCREP_PROP_DOUBLE;
+ for (c = list->list; c; c = c->next)
+ value_list->list = g_list_append(value_list->list, c->data);
+ break;
+ case IOTCON_TYPE_STR:
+ value_list->type = OCREP_PROP_STRING;
+ for (c = list->list; c; c = c->next)
+ value_list->list = g_list_append(value_list->list, c->data);
+ break;
+ case IOTCON_TYPE_BYTE_STR:
+ value_list->type = OCREP_PROP_BYTE_STRING;
+ for (c = list->list; c; c = c->next)
+ value_list->list = g_list_append(value_list->list, c->data);
+ break;
+ case IOTCON_TYPE_ATTRIBUTES:
+ value_list->type = OCREP_PROP_OBJECT;
+ for (c = list->list; c; c = c->next)
+ value_list->list = g_list_append(value_list->list, c->data);
+ break;
+ case IOTCON_TYPE_LIST:
+ for (c = list->list; c; c = c->next) {
+ ret = _icl_ioty_attributes_list_to_value_list(((icl_val_list_s *)c->data)->list,
+ value_list, depth + 1);
+ if (IOTCON_ERROR_NONE != ret) {
+ ERR("_icl_ioty_attributes_list_to_value_list() Fail(%d)", ret);
+ return ret;
+ }
+ }
+ break;
+ case IOTCON_TYPE_NULL:
+ default:
+ ERR("Invalid type (%d)", list->type);
+ return IOTCON_ERROR_INVALID_PARAMETER;
+ }
+
+ return IOTCON_ERROR_NONE;
+}
+
+static int _icl_ioty_fill_oic_rep_payload_value_array(OCRepPayload *payload,
+ const char *key, struct icl_attributes_list_s *list)
+{
+ int i, j, len, ret;
+ bool *b_arr;
+ double *d_arr;
+ char **str_arr;
+ int64_t *i_arr;
+ OCByteString *byte_arr;
+ struct OCRepPayload **attributes_arr;
+ GList *node;
+
+ RETV_IF(NULL == payload, IOTCON_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == key, IOTCON_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == list, IOTCON_ERROR_INVALID_PARAMETER);
+
+ if (NULL == list->list || 0 == g_list_length(list->list)) {
+ DBG("list is empty");
+ return IOTCON_ERROR_NONE;
+ }
+
+ len = calcDimTotal(list->dimensions);
+
+ switch (list->type) {
+ case OCREP_PROP_BOOL:
+ b_arr = calloc(len, sizeof(bool));
+ if (NULL == b_arr) {
+ ERR("calloc() Fail(%d)", errno);
+ return IOTCON_ERROR_OUT_OF_MEMORY;
+ }
+ for (node = list->list, i = 0; node; node = node->next, i++)
+ b_arr[i] = ((icl_basic_s*)node->data)->val.b;
+ OCRepPayloadSetBoolArrayAsOwner(payload, key, b_arr, list->dimensions);
+ break;
+ case OCREP_PROP_INT:
+ i_arr = calloc(len, sizeof(int64_t));
+ if (NULL == i_arr) {
+ ERR("calloc() Fail(%d)", errno);
+ return IOTCON_ERROR_OUT_OF_MEMORY;
+ }
+ for (node = list->list, i = 0; node; node = node->next, i++)
+ i_arr[i] = ((icl_basic_s*)node->data)->val.b;
+ OCRepPayloadSetIntArrayAsOwner(payload, key, i_arr, list->dimensions);
+ break;
+ case OCREP_PROP_DOUBLE:
+ d_arr = calloc(len, sizeof(double));
+ if (NULL == d_arr) {
+ ERR("calloc() Fail(%d)", errno);
+ return IOTCON_ERROR_OUT_OF_MEMORY;
+ }
+ for (node = list->list, i = 0; node; node = node->next, i++)
+ d_arr[i] = ((icl_basic_s*)node->data)->val.d;
+ OCRepPayloadSetDoubleArrayAsOwner(payload, key, d_arr, list->dimensions);
+ break;
+ case OCREP_PROP_STRING:
+ str_arr = calloc(len, sizeof(char *));
+ if (NULL == str_arr) {
+ ERR("calloc() Fail(%d)", errno);
+ return IOTCON_ERROR_OUT_OF_MEMORY;
+ }
+ for (node = list->list, i = 0; node; node = node->next, i++)
+ str_arr[i] = ((icl_basic_s*)node->data)->val.s;
+
+ OCRepPayloadSetStringArray(payload, key, (const char **)str_arr, list->dimensions);
+ free(str_arr);
+ break;
+ case OCREP_PROP_BYTE_STRING:
+ byte_arr = calloc(len, sizeof(OCByteString));
+ if (NULL == byte_arr) {
+ ERR("calloc() Fail(%d)", errno);
+ return IOTCON_ERROR_OUT_OF_MEMORY;
+ }
+ for (node = list->list, i = 0; node; node = node->next, i++) {
+ byte_arr[i].bytes = ((icl_val_byte_str_s*)node->data)->s;
+ byte_arr[i].len = ((icl_val_byte_str_s*)node->data)->len;
+ }
+ OCRepPayloadSetByteStringArray(payload, key, byte_arr, list->dimensions);
+ free(byte_arr);
+ break;
+ case OCREP_PROP_OBJECT:
+ attributes_arr = calloc(len, sizeof(struct OCRepPayload *));
+ if (NULL == attributes_arr) {
+ ERR("calloc() Fail(%d)", errno);
+ return IOTCON_ERROR_OUT_OF_MEMORY;
+ }
+ for (node = list->list, i = 0; node; node = node->next, i++) {
+ attributes_arr[i] = OCRepPayloadCreate();
+ if (NULL == attributes_arr[i]) {
+ ERR("OCRepPayloadCreate() Fail");
+ free(attributes_arr);
+ return ret;
+ }
+ ret = _icl_ioty_fill_oic_rep_payload_value(attributes_arr[i],
+ ((icl_val_attributes_s*)node->data)->attributes);
+ if (IOTCON_ERROR_NONE != ret) {
+ ERR("_icl_ioty_fill_oic_rep_payload_value() Fail(%d)", ret);
+ for (j = 0; j <= i; j++)
+ OCRepPayloadDestroy(attributes_arr[j]);
+ free(attributes_arr);
+ return ret;
+ }
+ }
+ OCRepPayloadSetPropObjectArrayAsOwner(payload, key, attributes_arr, list->dimensions);
+ break;
+ case OCREP_PROP_ARRAY:
+ case OCREP_PROP_NULL:
+ default:
+ ERR("Invalid Type(%d)", list->type);
+ return IOTCON_ERROR_INVALID_PARAMETER;
+ }
+ return IOTCON_ERROR_NONE;
+}
+
+static int _icl_ioty_fill_oic_rep_payload_value(OCRepPayload *payload,
+ iotcon_attributes_h attributes)
+{
+ FN_CALL;
+ int ret;
+ GHashTableIter iter;
+ gpointer key, value;
+ OCRepPayload *repr_payload;
+ OCByteString byte_string;
+ struct icl_value_s *attributes_value;
+ struct icl_attributes_list_s value_list = {0};
+
+ RETV_IF(NULL == attributes, IOTCON_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == payload, IOTCON_ERROR_INVALID_PARAMETER);
+
+ g_hash_table_iter_init(&iter, attributes->hash_table);
+ while (g_hash_table_iter_next(&iter, &key, &value)) {
+ attributes_value = (struct icl_value_s *)value;
+ if (NULL == attributes_value) {
+ ERR("attributes_value(%s) is NULL", key);
+ continue;
+ }
+
+ switch (attributes_value->type) {
+ case IOTCON_TYPE_BOOL:
+ OCRepPayloadSetPropBool(payload, key, ((icl_basic_s*)attributes_value)->val.b);
+ break;
+ case IOTCON_TYPE_INT:
+ OCRepPayloadSetPropInt(payload, key, ((icl_basic_s*)attributes_value)->val.i);
+ break;
+ case IOTCON_TYPE_DOUBLE:
+ OCRepPayloadSetPropDouble(payload, key, ((icl_basic_s*)attributes_value)->val.d);
+ break;
+ case IOTCON_TYPE_STR:
+ OCRepPayloadSetPropString(payload, key, ((icl_basic_s*)attributes_value)->val.s);
+ break;
+ case IOTCON_TYPE_NULL:
+ OCRepPayloadSetNull(payload, key);
+ break;
+ case IOTCON_TYPE_BYTE_STR:
+ byte_string.bytes = ((icl_val_byte_str_s*)attributes_value)->s;
+ byte_string.len = ((icl_val_byte_str_s*)attributes_value)->len;
+ OCRepPayloadSetPropByteString(payload, key, byte_string);
+ break;
+ case IOTCON_TYPE_LIST:
+ ret = _icl_ioty_attributes_list_to_value_list(((icl_val_list_s*)attributes_value)->list,
+ &value_list, 0);
+ if (IOTCON_ERROR_NONE != ret) {
+ ERR("_icl_ioty_attributes_list_to_value_list() Fail(%d)", ret);
+ return ret;
+ }
+ ret = _icl_ioty_fill_oic_rep_payload_value_array(payload, key, &value_list);
+ if (IOTCON_ERROR_NONE != ret) {
+ ERR("_icl_ioty_fill_oic_rep_payload_value_array() Fail(%d)", ret);
+ g_list_free(value_list.list);
+ return ret;
+ }
+ g_list_free(value_list.list);
+ value_list.list = NULL;
+ break;
+ case IOTCON_TYPE_ATTRIBUTES:
+ repr_payload = OCRepPayloadCreate();
+ ret = _icl_ioty_fill_oic_rep_payload_value(repr_payload,
+ ((icl_val_attributes_s*)attributes_value)->attributes);
+ if (IOTCON_ERROR_NONE != ret) {
+ ERR("_icl_ioty_fill_oic_rep_payload_value() Fail(%d)", ret);
+ OCRepPayloadDestroy(repr_payload);
+ return ret;
+ }
+ OCRepPayloadSetPropObjectAsOwner(payload, key, repr_payload);
+ break;
+ case IOTCON_TYPE_NONE:
+ default:
+ ERR("Invalid Type(%d)", attributes_value->type);
+ return IOTCON_ERROR_INVALID_PARAMETER;
+ }
+ }
+ return IOTCON_ERROR_NONE;
+}
+
+int ic_ioty_convert_representation(iotcon_representation_h repr,
+ OCPayload **payload)
+{
+ FN_CALL;
+ int ret;
+ GList *c;
+ OCRepPayload *repr_payload, *cur;
+
+ RETV_IF(NULL == payload, IOTCON_ERROR_INVALID_PARAMETER);
+
+ repr_payload = OCRepPayloadCreate();
+ if (NULL == repr_payload) {
+ ERR("OCRepPayloadCreate() Fail");
+ return IOTCON_ERROR_OUT_OF_MEMORY;
+ }
+
+ if (NULL == repr) {
+ *payload = (OCPayload *)repr_payload;
+ return IOTCON_ERROR_NONE;
+ }
+
+ /* uri path */
+ if (repr->uri_path)
+ OCRepPayloadSetUri(repr_payload, repr->uri_path);
+
+ /* interfaces */
+ if (repr->interfaces) {
+ for (c = repr->interfaces->iface_list; c; c = c->next)
+ OCRepPayloadAddInterface(repr_payload, c->data);
+ } else {
+ OCRepPayloadAddInterface(repr_payload, IOTCON_INTERFACE_DEFAULT);
+ }
+
+ /* resource types */
+ if (repr->res_types) {
+ for (c = repr->res_types->type_list; c; c = c->next)
+ OCRepPayloadAddResourceType(repr_payload, c->data);
+ }
+
+ /* attributes */
+ if (repr->attributes) {
+ ret = _icl_ioty_fill_oic_rep_payload_value(repr_payload, repr->attributes);
+ if (IOTCON_ERROR_NONE != ret) {
+ ERR("_icl_ioty_fill_oic_rep_payload_value() Fail(%d)", ret);
+ OCRepPayloadDestroy(repr_payload);
+ return ret;
+ }
+ }
+
+ /* children */
+ cur = repr_payload;
+ for (c = repr->children; c; c = c->next) {
+ OCPayload *child = NULL;
+ ret = ic_ioty_convert_representation(c->data, &child);
+ if (IOTCON_ERROR_NONE != ret) {
+ ERR("ic_ioty_convert_representation() Fail(%d)", ret);
+ OCRepPayloadDestroy(repr_payload);
+ return IOTCON_ERROR_IOTIVITY;
+ }
+ cur->next = (OCRepPayload *)child;
+ cur = cur->next;
+ }
+
+ *payload = (OCPayload *)repr_payload;
+ return IOTCON_ERROR_NONE;
+}
+
diff --git a/common/ic-ioty-types.h b/src/ic-ioty-convert.h
index 92d4942..42bf8cf 100644
--- a/common/ic-ioty-types.h
+++ b/src/ic-ioty-convert.h
@@ -13,23 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-#ifndef __IOT_CONNECTIVITY_COMMON_IOTIVITY_TYPES_H__
-#define __IOT_CONNECTIVITY_COMMON_IOTIVITY_TYPES_H__
+#ifndef __IOTCON_INTERNAL_IOTIVITY_CONVERT_H__
+#define __IOTCON_INTERNAL_IOTIVITY_CONVERT_H__
#include <octypes.h>
-
-/* oic -> iotcon */
-iotcon_connectivity_type_e ic_ioty_parse_oic_transport(OCTransportAdapter adapter,
- OCTransportFlags flag);
-iotcon_request_type_e ic_ioty_parse_oic_method(OCMethod method);
-iotcon_response_result_e ic_ioty_parse_oic_response_result(OCStackResult result);
-uint8_t ic_ioty_parse_oic_policies(uint8_t policies);
-iotcon_error_e ic_ioty_parse_oic_error(OCStackResult ret);
-iotcon_presence_trigger_e ic_ioty_parse_oic_trigger(OCPresenceTrigger src);
-iotcon_observe_type_e ic_ioty_parse_oic_action(OCObserveAction oic_action);
-int ic_ioty_parse_oic_dev_address(OCDevAddr *dev_addr, char **host_address,
- int *conn_type);
+#include "iotcon-types.h"
/* iotcon -> oic */
OCConnectivityType ic_ioty_convert_connectivity_type(
@@ -41,4 +29,9 @@ int ic_ioty_convert_connectivity(const char *host_address, int conn_type,
OCDevAddr *dev_addr);
uint8_t ic_ioty_convert_policies(uint8_t policies);
-#endif /*__IOT_CONNECTIVITY_COMMON_IOTIVITY_TYPES_H__*/
+int ic_ioty_convert_representation(iotcon_representation_h repr,
+ OCPayload **payload);
+int ic_ioty_convert_header_options(iotcon_options_h options,
+ OCHeaderOption dest[], int dest_size);
+
+#endif /*__IOTCON_INTERNAL_IOTIVITY_CONVERT_H__*/
diff --git a/lib/icl-ioty-ocprocess.c b/src/ic-ioty-ocprocess.c
index 67a571d..1f586e8 100644
--- a/lib/icl-ioty-ocprocess.c
+++ b/src/ic-ioty-ocprocess.c
@@ -20,24 +20,23 @@
#include <octypes.h>
#include "iotcon.h"
+#include "ic.h"
#include "ic-utils.h"
-#include "ic-ioty-types.h"
-#include "icl.h"
-#include "icl-ioty.h"
-#include "icl-remote-resource.h"
-#include "icl-device.h"
-#include "icl-presence.h"
-#include "icl-request.h"
-#include "icl-resource.h"
-#include "icl-response.h"
-#include "icl-options.h"
-#include "icl-representation.h"
-#include "icl-types.h"
-#include "icl-attributes.h"
-#include "icl-lite-resource.h"
-#include "icl-ioty.h"
-#include "icl-ioty-types.h"
-#include "icl-ioty-ocprocess.h"
+#include "ic-ioty.h"
+#include "ic-ioty-parse.h"
+#include "ic-remote-resource.h"
+#include "ic-device.h"
+#include "ic-presence.h"
+#include "ic-request.h"
+#include "ic-resource.h"
+#include "ic-response.h"
+#include "ic-options.h"
+#include "ic-representation.h"
+#include "ic-types.h"
+#include "ic-attributes.h"
+#include "ic-lite-resource.h"
+#include "ic-ioty.h"
+#include "ic-ioty-ocprocess.h"
#define ICL_IOTY_TIME_INTERVAL_MIN 0
#define ICL_IOTY_TIME_INTERVAL_DEFAULT 100
@@ -201,7 +200,7 @@ OCStackApplicationResult icl_ioty_ocprocess_find_cb(void *ctx, OCDoHandle handle
RETVM_IF(PAYLOAD_TYPE_DISCOVERY != resp->payload->type,
OC_STACK_KEEP_TRANSACTION, "Invalid payload type(%d)", resp->payload->type);
- ret = icl_ioty_parse_oic_discovery_payload(&(resp->devAddr),
+ ret = ic_ioty_parse_oic_discovery_payload(&(resp->devAddr),
(OCDiscoveryPayload*)resp->payload, &resource_list, &resource_count);
if (IOTCON_ERROR_NONE != ret) {
ERR("_icl_ioty_ocprocess_parse_find_payload() Fail(%d)", ret);
@@ -276,10 +275,10 @@ OCStackApplicationResult icl_ioty_ocprocess_device_info_cb(void *ctx,
return OC_STACK_KEEP_TRANSACTION;
}
- ret = icl_ioty_parse_oic_device_payload((OCDevicePayload *)resp->payload,
+ ret = ic_ioty_parse_oic_device_payload((OCDevicePayload *)resp->payload,
&info);
if (IOTCON_ERROR_NONE != ret) {
- ERR("icl_ioty_parse_oic_device_payload() Fail(%d)", ret);
+ ERR("ic_ioty_parse_oic_device_payload() Fail(%d)", ret);
cb_data->result = ret;
g_idle_add(_icl_ioty_ocprocess_fail_idle_cb, cb_data);
return OC_STACK_KEEP_TRANSACTION;
@@ -351,10 +350,10 @@ OCStackApplicationResult icl_ioty_ocprocess_platform_info_cb(void *ctx,
return OC_STACK_KEEP_TRANSACTION;
}
- ret = icl_ioty_parse_oic_platform_payload((OCPlatformPayload *)resp->payload,
+ ret = ic_ioty_parse_oic_platform_payload((OCPlatformPayload *)resp->payload,
&info);
if (IOTCON_ERROR_NONE != ret) {
- ERR("icl_ioty_parse_oic_platform_payload() Fail(%d)", ret);
+ ERR("ic_ioty_parse_oic_platform_payload() Fail(%d)", ret);
cb_data->result = ret;
g_idle_add(_icl_ioty_ocprocess_fail_idle_cb, cb_data);
return OC_STACK_KEEP_TRANSACTION;
@@ -408,10 +407,10 @@ OCStackApplicationResult icl_ioty_ocprocess_presence_cb(void *ctx,
RETV_IF(NULL == resp, OC_STACK_KEEP_TRANSACTION);
RETV_IF(NULL == presence, OC_STACK_KEEP_TRANSACTION);
- ret = icl_ioty_parse_oic_presence_payload(&resp->devAddr,
+ ret = ic_ioty_parse_oic_presence_payload(&resp->devAddr,
(OCPresencePayload*)resp->payload, resp->result, &presence_response);
if (IOTCON_ERROR_NONE != ret) {
- ERR("icl_ioty_parse_oic_presence_payload() Fail(%d)", ret);
+ ERR("ic_ioty_parse_oic_presence_payload() Fail(%d)", ret);
return OC_STACK_KEEP_TRANSACTION;
}
@@ -472,9 +471,9 @@ OCStackApplicationResult icl_ioty_ocprocess_observe_cb(void *ctx,
}
/* representation */
- ret = icl_ioty_parse_oic_rep_payload((OCRepPayload*)resp->payload, true, &repr);
+ ret = ic_ioty_parse_oic_rep_payload((OCRepPayload*)resp->payload, true, &repr);
if (IOTCON_ERROR_NONE != ret) {
- ERR("icl_ioty_parse_oic_rep_payload() Fail(%d)", ret);
+ ERR("ic_ioty_parse_oic_rep_payload() Fail(%d)", ret);
return OC_STACK_KEEP_TRANSACTION;
}
@@ -485,10 +484,10 @@ OCStackApplicationResult icl_ioty_ocprocess_observe_cb(void *ctx,
response_result = ic_ioty_parse_oic_response_result(resp->result);
/* header options */
- ret = icl_ioty_parse_oic_header_option(resp->rcvdVendorSpecificHeaderOptions,
+ ret = ic_ioty_parse_oic_header_option(resp->rcvdVendorSpecificHeaderOptions,
resp->numRcvdVendorSpecificHeaderOptions, &options);
if (IOTCON_ERROR_NONE != ret) {
- ERR("icl_ioty_parse_oic_header_option() Fail(%d)", ret);
+ ERR("ic_ioty_parse_oic_header_option() Fail(%d)", ret);
return OC_STACK_KEEP_TRANSACTION;
}
@@ -577,9 +576,9 @@ OCStackApplicationResult icl_ioty_ocprocess_crud_cb(void *ctx,
}
/* representation */
- ret = icl_ioty_parse_oic_rep_payload((OCRepPayload*)resp->payload, true, &repr);
+ ret = ic_ioty_parse_oic_rep_payload((OCRepPayload*)resp->payload, true, &repr);
if (IOTCON_ERROR_NONE != ret) {
- ERR("icl_ioty_parse_oic_rep_payload() Fail(%d)", ret);
+ ERR("ic_ioty_parse_oic_rep_payload() Fail(%d)", ret);
return OC_STACK_DELETE_TRANSACTION;
}
@@ -590,10 +589,10 @@ OCStackApplicationResult icl_ioty_ocprocess_crud_cb(void *ctx,
response_result = ic_ioty_parse_oic_response_result(resp->result);
/* header options */
- ret = icl_ioty_parse_oic_header_option(resp->rcvdVendorSpecificHeaderOptions,
+ ret = ic_ioty_parse_oic_header_option(resp->rcvdVendorSpecificHeaderOptions,
resp->numRcvdVendorSpecificHeaderOptions, &options);
if (IOTCON_ERROR_NONE != ret) {
- ERR("icl_ioty_parse_oic_header_option() Fail(%d)", ret);
+ ERR("ic_ioty_parse_oic_header_option() Fail(%d)", ret);
return OC_STACK_DELETE_TRANSACTION;
}
@@ -683,10 +682,10 @@ OCEntityHandlerResult icl_ioty_ocprocess_request_cb(OCEntityHandlerFlag flag,
}
/* header options */
- ret = icl_ioty_parse_oic_header_option(request->rcvdVendorSpecificHeaderOptions,
+ ret = ic_ioty_parse_oic_header_option(request->rcvdVendorSpecificHeaderOptions,
request->numRcvdVendorSpecificHeaderOptions, &options);
if (IOTCON_ERROR_NONE != ret) {
- ERR("icl_ioty_parse_oic_header_option() Fail(%d)", ret);
+ ERR("ic_ioty_parse_oic_header_option() Fail(%d)", ret);
return OC_EH_ERROR;
}
@@ -710,7 +709,7 @@ OCEntityHandlerResult icl_ioty_ocprocess_request_cb(OCEntityHandlerFlag flag,
/* representation */
if (request->payload) {
- icl_ioty_parse_oic_rep_payload((OCRepPayload*)request->payload, true, &repr);
+ ic_ioty_parse_oic_rep_payload((OCRepPayload*)request->payload, true, &repr);
if (repr && NULL == repr->uri_path)
repr->uri_path = ic_utils_strdup(resource->uri_path);
} else {
@@ -866,7 +865,7 @@ OCEntityHandlerResult icl_ioty_ocprocess_lite_request_cb(OCEntityHandlerFlag fla
/* representation */
if (request->payload)
- icl_ioty_parse_oic_rep_payload((OCRepPayload*)request->payload, true, &repr);
+ ic_ioty_parse_oic_rep_payload((OCRepPayload*)request->payload, true, &repr);
else
repr = NULL;
diff --git a/lib/icl-ioty-ocprocess.h b/src/ic-ioty-ocprocess.h
index e142837..9a420b5 100644
--- a/lib/icl-ioty-ocprocess.h
+++ b/src/ic-ioty-ocprocess.h
@@ -13,9 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-#ifndef __IOT_CONNECTIVITY_LIBRARY_IOTIVITY_OCPROCESS_H__
-#define __IOT_CONNECTIVITY_LIBRARY_IOTIVITY_OCPROCESS_H__
+#ifndef __IOTCON_INTERNAL_IOTIVITY_OCPROCESS_H__
+#define __IOTCON_INTERNAL_IOTIVITY_OCPROCESS_H__
void icl_ioty_ocprocess_stop();
void icl_ioty_ocprocess_start();
@@ -47,5 +46,5 @@ OCEntityHandlerResult icl_ioty_ocprocess_request_cb(OCEntityHandlerFlag flag,
OCEntityHandlerResult icl_ioty_ocprocess_lite_request_cb(OCEntityHandlerFlag flag,
OCEntityHandlerRequest *request, void *user_data);
-#endif /*__IOT_CONNECTIVITY_LIBRARY_IOTIVITY_OCPROCESS_H__*/
+#endif /*__IOTCON_INTERNAL_IOTIVITY_OCPROCESS_H__*/
diff --git a/lib/icl-ioty-types.c b/src/ic-ioty-parse.c
index 77b1cee..f484802 100644
--- a/lib/icl-ioty-types.c
+++ b/src/ic-ioty-parse.c
@@ -16,36 +16,186 @@
#include <stdlib.h>
#include <errno.h>
+#include <stdint.h>
+#include <limits.h>
+
#include <octypes.h>
-#include <ocstack.h>
#include <ocpayload.h>
#include "iotcon.h"
+#include "ic.h"
#include "ic-utils.h"
-#include "ic-ioty-types.h"
-#include "icl.h"
-#include "icl-device.h"
-#include "icl-remote-resource.h"
-#include "icl-list.h"
-#include "icl-value.h"
-#include "icl-presence.h"
-#include "icl-representation.h"
-#include "icl-resource-types.h"
-#include "icl-resource-interfaces.h"
-#include "icl-ioty.h"
-#include "icl-types.h"
-#include "icl-ioty-types.h"
-
-struct icl_attributes_list_s {
- OCRepPayloadPropType type;
- size_t dimensions[MAX_REP_ARRAY_DEPTH];
- GList *list;
-};
-
-static int _icl_ioty_parse_oic_rep_payload_value(OCRepPayloadValue *val,
+#include "ic-remote-resource.h"
+#include "ic-device.h"
+#include "ic-presence.h"
+#include "ic-types.h"
+#include "ic-representation.h"
+#include "ic-ioty-parse.h"
+
+static int _ioty_parse_oic_rep_payload_value(OCRepPayloadValue *val,
iotcon_attributes_h *attributes);
-static int _icl_ioty_fill_oic_rep_payload_value(OCRepPayload *payload,
- iotcon_attributes_h attributes);
+
+
+iotcon_observe_type_e ic_ioty_parse_oic_action(OCObserveAction oic_action)
+{
+ switch (oic_action) {
+ case OC_OBSERVE_REGISTER:
+ return IOTCON_OBSERVE_REGISTER;
+ case OC_OBSERVE_DEREGISTER:
+ return IOTCON_OBSERVE_DEREGISTER;
+ case OC_OBSERVE_NO_OPTION:
+ default:
+ ERR("Unknown action (%d)", oic_action);
+ }
+ return IOTCON_OBSERVE_NO_TYPE;
+}
+
+iotcon_error_e ic_ioty_parse_oic_error(OCStackResult ret)
+{
+ switch (ret) {
+ case OC_STACK_OK:
+ return IOTCON_ERROR_NONE;
+ case OC_STACK_NO_MEMORY:
+ return IOTCON_ERROR_OUT_OF_MEMORY;
+ case OC_STACK_NO_RESOURCE:
+ return IOTCON_ERROR_NO_DATA;
+ default:
+ WARN("Unknown result(%d)", ret);
+ }
+ return IOTCON_ERROR_IOTIVITY;
+}
+
+static iotcon_connectivity_type_e _ioty_parse_oic_transport(OCTransportAdapter adapter,
+ OCTransportFlags flag)
+{
+ iotcon_connectivity_type_e type = IOTCON_CONNECTIVITY_ALL;
+
+ /* Need to consider to allow various connectivity types */
+ switch (adapter) {
+ case OC_ADAPTER_IP:
+ if (OC_IP_USE_V4 & flag)
+ type = IOTCON_CONNECTIVITY_IPV4;
+ else if (OC_IP_USE_V6 & flag)
+ type = IOTCON_CONNECTIVITY_IPV6;
+ else
+ ERR("Invalid Flag(%d)", flag);
+ break;
+ default:
+ ERR("Invalid Adpater(%d)", adapter);
+ }
+ return type;
+}
+
+
+int ic_ioty_parse_oic_dev_address(OCDevAddr *dev_addr, char **host_address,
+ int *conn_type)
+{
+ int connectivity_type;
+ char host_addr[PATH_MAX] = {0};
+
+ RETV_IF(NULL == host_address, IOTCON_ERROR_INVALID_PARAMETER);
+ RETV_IF(NULL == conn_type, IOTCON_ERROR_INVALID_PARAMETER);
+
+ connectivity_type = _ioty_parse_oic_transport(dev_addr->adapter,
+ dev_addr->flags);
+
+ switch (connectivity_type) {
+ case IOTCON_CONNECTIVITY_IPV6:
+ snprintf(host_addr, sizeof(host_addr), "[%s]:%d", dev_addr->addr,
+ dev_addr->port);
+ break;
+ case IOTCON_CONNECTIVITY_IPV4:
+ snprintf(host_addr, sizeof(host_addr), "%s:%d", dev_addr->addr,
+ dev_addr->port);
+ break;
+ default:
+ ERR("Invalid Connectivity Type(%d)", connectivity_type);
+ return IOTCON_ERROR_INVALID_PARAMETER;
+ }
+
+ *host_address = strdup(host_addr);
+
+ *conn_type = connectivity_type;
+
+ return IOTCON_ERROR_NONE;
+}
+
+iotcon_response_result_e ic_ioty_parse_oic_response_result(OCStackResult result)
+{
+ switch (result) {
+ case OC_STACK_OK:
+ return IOTCON_RESPONSE_OK;
+ case OC_STACK_RESOURCE_CREATED:
+ return IOTCON_RESPONSE_RESOURCE_CREATED;
+ case OC_STACK_RESOURCE_DELETED:
+ return IOTCON_RESPONSE_RESOURCE_DELETED;
+ case OC_STACK_UNAUTHORIZED_REQ:
+ return IOTCON_RESPONSE_FORBIDDEN;
+ case OC_STACK_ERROR:
+ return IOTCON_RESPONSE_ERROR;
+ default:
+ WARN("Unknown result(%d)", result);
+ }
+ return IOTCON_RESPONSE_ERROR;
+}
+
+static iotcon_presence_trigger_e _ioty_parse_oic_trigger(OCPresenceTrigger src)
+{
+ switch (src) {
+ case OC_PRESENCE_TRIGGER_CREATE:
+ return IOTCON_PRESENCE_RESOURCE_CREATED;
+ case OC_PRESENCE_TRIGGER_CHANGE:
+ return IOTCON_PRESENCE_RESOURCE_UPDATED;
+ case OC_PRESENCE_TRIGGER_DELETE:
+ return IOTCON_PRESENCE_RESOURCE_DESTROYED;
+ default:
+ ERR("Unknown trigger(%d)", src);
+ }
+ return IOTCON_PRESENCE_RESOURCE_CREATED;
+}
+
+
+static uint8_t _ioty_parse_oic_policies(uint8_t oic_policies)
+{
+ uint8_t policies = IOTCON_RESOURCE_NO_POLICY;
+
+ if (OC_DISCOVERABLE & oic_policies)
+ policies |= IOTCON_RESOURCE_DISCOVERABLE;
+
+ if (OC_OBSERVABLE & oic_policies)
+ policies |= IOTCON_RESOURCE_OBSERVABLE;
+
+ if (OC_ACTIVE & oic_policies)
+ policies |= IOTCON_RESOURCE_ACTIVE;
+
+ if (OC_SLOW & oic_policies)
+ policies |= IOTCON_RESOURCE_SLOW;
+
+ if (OC_SECURE & oic_policies)
+ policies |= IOTCON_RESOURCE_SECURE;
+
+ if (OC_EXPLICIT_DISCOVERABLE & oic_policies)
+ policies |= IOTCON_RESOURCE_EXPLICIT_DISCOVERABLE;
+
+ return policies;
+}
+
+iotcon_request_type_e ic_ioty_parse_oic_method(OCMethod method)
+{
+ switch (method) {
+ case OC_REST_GET:
+ return IOTCON_REQUEST_GET;
+ case OC_REST_PUT:
+ return IOTCON_REQUEST_PUT;
+ case OC_REST_POST:
+ return IOTCON_REQUEST_POST;
+ case OC_REST_DELETE:
+ return IOTCON_REQUEST_DELETE;
+ default:
+ ERR("Unknown method(%d)", method);
+ return IOTCON_REQUEST_UNKNOWN;
+ }
+}
static void _icl_ioty_free_resource_list(iotcon_remote_resource_h *resource_list,
int resource_count)
@@ -60,7 +210,7 @@ static void _icl_ioty_free_resource_list(iotcon_remote_resource_h *resource_list
free(resource_list);
}
-int icl_ioty_parse_oic_discovery_payload(OCDevAddr *dev_addr,
+int ic_ioty_parse_oic_discovery_payload(OCDevAddr *dev_addr,
OCDiscoveryPayload *payload,
iotcon_remote_resource_h **resource_list,
int *resource_count)
@@ -141,7 +291,7 @@ int icl_ioty_parse_oic_discovery_payload(OCDevAddr *dev_addr,
iotcon_resource_interfaces_add(ifaces, node->value);
/* Resource Policies */
- policies = ic_ioty_parse_oic_policies(res_payload->bitmap);
+ policies = _ioty_parse_oic_policies(res_payload->bitmap);
if (res_payload->secure)
policies |= IOTCON_RESOURCE_SECURE;
@@ -149,7 +299,7 @@ int icl_ioty_parse_oic_discovery_payload(OCDevAddr *dev_addr,
port = (res_payload->port) ? res_payload->port : dev_addr->port;
/* connectivity type */
- conn_type = ic_ioty_parse_oic_transport(dev_addr->adapter, dev_addr->flags);
+ conn_type = _ioty_parse_oic_transport(dev_addr->adapter, dev_addr->flags);
/* host address */
switch (conn_type) {
@@ -202,7 +352,7 @@ int icl_ioty_parse_oic_discovery_payload(OCDevAddr *dev_addr,
}
-int icl_ioty_parse_oic_device_payload(OCDevicePayload *payload,
+int ic_ioty_parse_oic_device_payload(OCDevicePayload *payload,
iotcon_device_info_h *device_info)
{
struct icl_device_info *info = NULL;
@@ -230,7 +380,7 @@ int icl_ioty_parse_oic_device_payload(OCDevicePayload *payload,
return IOTCON_ERROR_NONE;
}
-int icl_ioty_parse_oic_platform_payload(OCPlatformPayload *payload,
+int ic_ioty_parse_oic_platform_payload(OCPlatformPayload *payload,
iotcon_platform_info_h *platform_info)
{
struct icl_platform_info *info = NULL;
@@ -270,7 +420,7 @@ int icl_ioty_parse_oic_platform_payload(OCPlatformPayload *payload,
return IOTCON_ERROR_NONE;
}
-int icl_ioty_parse_oic_presence_payload(OCDevAddr *dev_addr,
+int ic_ioty_parse_oic_presence_payload(OCDevAddr *dev_addr,
OCPresencePayload *payload,
OCStackResult result,
iotcon_presence_response_h *presence_response)
@@ -300,7 +450,7 @@ int icl_ioty_parse_oic_presence_payload(OCDevAddr *dev_addr,
switch (result) {
case OC_STACK_OK:
resp->result = IOTCON_PRESENCE_OK;
- resp->trigger = ic_ioty_parse_oic_trigger(payload->trigger);
+ resp->trigger = _ioty_parse_oic_trigger(payload->trigger);
break;
case OC_STACK_PRESENCE_STOPPED:
resp->result = IOTCON_PRESENCE_STOPPED;
@@ -415,10 +565,10 @@ static int _icl_ioty_parse_oic_rep_payload_value_array_attr(
}
for (i = 0; i < len; i++) {
iotcon_attributes_h attributes;
- ret = _icl_ioty_parse_oic_rep_payload_value(arr->objArray[index + i]->values,
+ ret = _ioty_parse_oic_rep_payload_value(arr->objArray[index + i]->values,
&attributes);
if (IOTCON_ERROR_NONE != ret) {
- ERR("_icl_ioty_parse_oic_rep_payload_value(%d)", ret);
+ ERR("_ioty_parse_oic_rep_payload_value(%d)", ret);
iotcon_list_destroy(l);
return ret;
}
@@ -496,7 +646,7 @@ static int _icl_ioty_parse_oic_rep_payload_value_array(
return IOTCON_ERROR_NONE;
}
-static int _icl_ioty_parse_oic_rep_payload_value(OCRepPayloadValue *val,
+static int _ioty_parse_oic_rep_payload_value(OCRepPayloadValue *val,
iotcon_attributes_h *attributes)
{
int ret, total_len;
@@ -583,9 +733,9 @@ static int _icl_ioty_parse_oic_rep_payload_value(OCRepPayloadValue *val,
iotcon_list_destroy(list);
break;
case OCREP_PROP_OBJECT:
- ret = _icl_ioty_parse_oic_rep_payload_value(val->obj->values, &s_obj);
+ ret = _ioty_parse_oic_rep_payload_value(val->obj->values, &s_obj);
if (IOTCON_ERROR_NONE != ret) {
- ERR("_icl_ioty_parse_oic_rep_payload_value() Fail(%d)", ret);
+ ERR("_ioty_parse_oic_rep_payload_value() Fail(%d)", ret);
iotcon_attributes_destroy(s);
return ret;
}
@@ -609,7 +759,7 @@ static int _icl_ioty_parse_oic_rep_payload_value(OCRepPayloadValue *val,
return IOTCON_ERROR_NONE;
}
-int icl_ioty_parse_oic_rep_payload(OCRepPayload *payload, bool is_parent,
+int ic_ioty_parse_oic_rep_payload(OCRepPayload *payload, bool is_parent,
iotcon_representation_h *representation)
{
int ret = 0;
@@ -689,7 +839,7 @@ int icl_ioty_parse_oic_rep_payload(OCRepPayload *payload, bool is_parent,
/* attributes */
if (payload->values) {
- ret = _icl_ioty_parse_oic_rep_payload_value(payload->values, &attributes);
+ ret = _ioty_parse_oic_rep_payload_value(payload->values, &attributes);
if (IOTCON_ERROR_NONE != ret) {
ERR("iotcon_representation_set_resource_types() Fail(%d)", ret);
iotcon_representation_destroy(repr);
@@ -711,9 +861,9 @@ int icl_ioty_parse_oic_rep_payload(OCRepPayload *payload, bool is_parent,
/* generate recursively */
iotcon_representation_h repr_child;
- ret = icl_ioty_parse_oic_rep_payload(child_node, false, &repr_child);
+ ret = ic_ioty_parse_oic_rep_payload(child_node, false, &repr_child);
if (IOTCON_ERROR_NONE != ret) {
- ERR("icl_ioty_parse_oic_rep_payload() Fail(%d)", ret);
+ ERR("ic_ioty_parse_oic_rep_payload() Fail(%d)", ret);
iotcon_representation_destroy(repr);
return ret;
}
@@ -735,329 +885,7 @@ int icl_ioty_parse_oic_rep_payload(OCRepPayload *payload, bool is_parent,
return IOTCON_ERROR_NONE;
}
-static int _icl_ioty_fill_oic_rep_payload_value_array(OCRepPayload *payload,
- const char *key, struct icl_attributes_list_s *list)
-{
- int i, j, len, ret;
- bool *b_arr;
- double *d_arr;
- char **str_arr;
- int64_t *i_arr;
- OCByteString *byte_arr;
- struct OCRepPayload **attributes_arr;
- GList *node;
-
- RETV_IF(NULL == payload, IOTCON_ERROR_INVALID_PARAMETER);
- RETV_IF(NULL == key, IOTCON_ERROR_INVALID_PARAMETER);
- RETV_IF(NULL == list, IOTCON_ERROR_INVALID_PARAMETER);
-
- if (NULL == list->list || 0 == g_list_length(list->list)) {
- DBG("list is empty");
- return IOTCON_ERROR_NONE;
- }
-
- len = calcDimTotal(list->dimensions);
-
- switch (list->type) {
- case OCREP_PROP_BOOL:
- b_arr = calloc(len, sizeof(bool));
- if (NULL == b_arr) {
- ERR("calloc() Fail(%d)", errno);
- return IOTCON_ERROR_OUT_OF_MEMORY;
- }
- for (node = list->list, i = 0; node; node = node->next, i++)
- b_arr[i] = ((icl_basic_s*)node->data)->val.b;
- OCRepPayloadSetBoolArrayAsOwner(payload, key, b_arr, list->dimensions);
- break;
- case OCREP_PROP_INT:
- i_arr = calloc(len, sizeof(int64_t));
- if (NULL == i_arr) {
- ERR("calloc() Fail(%d)", errno);
- return IOTCON_ERROR_OUT_OF_MEMORY;
- }
- for (node = list->list, i = 0; node; node = node->next, i++)
- i_arr[i] = ((icl_basic_s*)node->data)->val.b;
- OCRepPayloadSetIntArrayAsOwner(payload, key, i_arr, list->dimensions);
- break;
- case OCREP_PROP_DOUBLE:
- d_arr = calloc(len, sizeof(double));
- if (NULL == d_arr) {
- ERR("calloc() Fail(%d)", errno);
- return IOTCON_ERROR_OUT_OF_MEMORY;
- }
- for (node = list->list, i = 0; node; node = node->next, i++)
- d_arr[i] = ((icl_basic_s*)node->data)->val.d;
- OCRepPayloadSetDoubleArrayAsOwner(payload, key, d_arr, list->dimensions);
- break;
- case OCREP_PROP_STRING:
- str_arr = calloc(len, sizeof(char *));
- if (NULL == str_arr) {
- ERR("calloc() Fail(%d)", errno);
- return IOTCON_ERROR_OUT_OF_MEMORY;
- }
- for (node = list->list, i = 0; node; node = node->next, i++)
- str_arr[i] = ((icl_basic_s*)node->data)->val.s;
-
- OCRepPayloadSetStringArray(payload, key, (const char **)str_arr, list->dimensions);
- free(str_arr);
- break;
- case OCREP_PROP_BYTE_STRING:
- byte_arr = calloc(len, sizeof(OCByteString));
- if (NULL == byte_arr) {
- ERR("calloc() Fail(%d)", errno);
- return IOTCON_ERROR_OUT_OF_MEMORY;
- }
- for (node = list->list, i = 0; node; node = node->next, i++) {
- byte_arr[i].bytes = ((icl_val_byte_str_s*)node->data)->s;
- byte_arr[i].len = ((icl_val_byte_str_s*)node->data)->len;
- }
- OCRepPayloadSetByteStringArray(payload, key, byte_arr, list->dimensions);
- free(byte_arr);
- break;
- case OCREP_PROP_OBJECT:
- attributes_arr = calloc(len, sizeof(struct OCRepPayload *));
- if (NULL == attributes_arr) {
- ERR("calloc() Fail(%d)", errno);
- return IOTCON_ERROR_OUT_OF_MEMORY;
- }
- for (node = list->list, i = 0; node; node = node->next, i++) {
- attributes_arr[i] = OCRepPayloadCreate();
- if (NULL == attributes_arr[i]) {
- ERR("OCRepPayloadCreate() Fail");
- free(attributes_arr);
- return ret;
- }
- ret = _icl_ioty_fill_oic_rep_payload_value(attributes_arr[i],
- ((icl_val_attributes_s*)node->data)->attributes);
- if (IOTCON_ERROR_NONE != ret) {
- ERR("_icl_ioty_fill_oic_rep_payload_value() Fail(%d)", ret);
- for (j = 0; j <= i; j++)
- OCRepPayloadDestroy(attributes_arr[j]);
- free(attributes_arr);
- return ret;
- }
- }
- OCRepPayloadSetPropObjectArrayAsOwner(payload, key, attributes_arr, list->dimensions);
- break;
- case OCREP_PROP_ARRAY:
- case OCREP_PROP_NULL:
- default:
- ERR("Invalid Type(%d)", list->type);
- return IOTCON_ERROR_INVALID_PARAMETER;
- }
- return IOTCON_ERROR_NONE;
-}
-
-
-static int _icl_ioty_attributes_list_to_value_list(iotcon_list_h list,
- struct icl_attributes_list_s *value_list, int depth)
-{
- int ret;
- GList *c;
-
- RETV_IF(NULL == list, IOTCON_ERROR_INVALID_PARAMETER);
- RETV_IF(NULL == value_list, IOTCON_ERROR_INVALID_PARAMETER);
-
- value_list->dimensions[depth] = g_list_length(list->list);
-
- switch (list->type) {
- case IOTCON_TYPE_BOOL:
- value_list->type = OCREP_PROP_BOOL;
- for (c = list->list; c; c = c->next)
- value_list->list = g_list_append(value_list->list, c->data);
- break;
- case IOTCON_TYPE_INT:
- value_list->type = OCREP_PROP_INT;
- for (c = list->list; c; c = c->next)
- value_list->list = g_list_append(value_list->list, c->data);
- break;
- case IOTCON_TYPE_DOUBLE:
- value_list->type = OCREP_PROP_DOUBLE;
- for (c = list->list; c; c = c->next)
- value_list->list = g_list_append(value_list->list, c->data);
- break;
- case IOTCON_TYPE_STR:
- value_list->type = OCREP_PROP_STRING;
- for (c = list->list; c; c = c->next)
- value_list->list = g_list_append(value_list->list, c->data);
- break;
- case IOTCON_TYPE_BYTE_STR:
- value_list->type = OCREP_PROP_BYTE_STRING;
- for (c = list->list; c; c = c->next)
- value_list->list = g_list_append(value_list->list, c->data);
- break;
- case IOTCON_TYPE_ATTRIBUTES:
- value_list->type = OCREP_PROP_OBJECT;
- for (c = list->list; c; c = c->next)
- value_list->list = g_list_append(value_list->list, c->data);
- break;
- case IOTCON_TYPE_LIST:
- for (c = list->list; c; c = c->next) {
- ret = _icl_ioty_attributes_list_to_value_list(((icl_val_list_s *)c->data)->list,
- value_list, depth + 1);
- if (IOTCON_ERROR_NONE != ret) {
- ERR("_icl_ioty_attributes_list_to_value_list() Fail(%d)", ret);
- return ret;
- }
- }
- break;
- case IOTCON_TYPE_NULL:
- default:
- ERR("Invalid type (%d)", list->type);
- return IOTCON_ERROR_INVALID_PARAMETER;
- }
-
- return IOTCON_ERROR_NONE;
-}
-
-static int _icl_ioty_fill_oic_rep_payload_value(OCRepPayload *payload,
- iotcon_attributes_h attributes)
-{
- FN_CALL;
- int ret;
- GHashTableIter iter;
- gpointer key, value;
- OCRepPayload *repr_payload;
- OCByteString byte_string;
- struct icl_value_s *attributes_value;
- struct icl_attributes_list_s value_list = {0};
-
- RETV_IF(NULL == attributes, IOTCON_ERROR_INVALID_PARAMETER);
- RETV_IF(NULL == payload, IOTCON_ERROR_INVALID_PARAMETER);
-
- g_hash_table_iter_init(&iter, attributes->hash_table);
- while (g_hash_table_iter_next(&iter, &key, &value)) {
- attributes_value = (struct icl_value_s *)value;
- if (NULL == attributes_value) {
- ERR("attributes_value(%s) is NULL", key);
- continue;
- }
-
- switch (attributes_value->type) {
- case IOTCON_TYPE_BOOL:
- OCRepPayloadSetPropBool(payload, key, ((icl_basic_s*)attributes_value)->val.b);
- break;
- case IOTCON_TYPE_INT:
- OCRepPayloadSetPropInt(payload, key, ((icl_basic_s*)attributes_value)->val.i);
- break;
- case IOTCON_TYPE_DOUBLE:
- OCRepPayloadSetPropDouble(payload, key, ((icl_basic_s*)attributes_value)->val.d);
- break;
- case IOTCON_TYPE_STR:
- OCRepPayloadSetPropString(payload, key, ((icl_basic_s*)attributes_value)->val.s);
- break;
- case IOTCON_TYPE_NULL:
- OCRepPayloadSetNull(payload, key);
- break;
- case IOTCON_TYPE_BYTE_STR:
- byte_string.bytes = ((icl_val_byte_str_s*)attributes_value)->s;
- byte_string.len = ((icl_val_byte_str_s*)attributes_value)->len;
- OCRepPayloadSetPropByteString(payload, key, byte_string);
- break;
- case IOTCON_TYPE_LIST:
- ret = _icl_ioty_attributes_list_to_value_list(((icl_val_list_s*)attributes_value)->list,
- &value_list, 0);
- if (IOTCON_ERROR_NONE != ret) {
- ERR("_icl_ioty_attributes_list_to_value_list() Fail(%d)", ret);
- return ret;
- }
- ret = _icl_ioty_fill_oic_rep_payload_value_array(payload, key, &value_list);
- if (IOTCON_ERROR_NONE != ret) {
- ERR("_icl_ioty_fill_oic_rep_payload_value_array() Fail(%d)", ret);
- g_list_free(value_list.list);
- return ret;
- }
- g_list_free(value_list.list);
- value_list.list = NULL;
- break;
- case IOTCON_TYPE_ATTRIBUTES:
- repr_payload = OCRepPayloadCreate();
- ret = _icl_ioty_fill_oic_rep_payload_value(repr_payload,
- ((icl_val_attributes_s*)attributes_value)->attributes);
- if (IOTCON_ERROR_NONE != ret) {
- ERR("_icl_ioty_fill_oic_rep_payload_value() Fail(%d)", ret);
- OCRepPayloadDestroy(repr_payload);
- return ret;
- }
- OCRepPayloadSetPropObjectAsOwner(payload, key, repr_payload);
- break;
- case IOTCON_TYPE_NONE:
- default:
- ERR("Invalid Type(%d)", attributes_value->type);
- return IOTCON_ERROR_INVALID_PARAMETER;
- }
- }
- return IOTCON_ERROR_NONE;
-}
-
-int icl_ioty_convert_representation(iotcon_representation_h repr,
- OCPayload **payload)
-{
- FN_CALL;
- int ret;
- GList *c;
- OCRepPayload *repr_payload, *cur;
-
- RETV_IF(NULL == payload, IOTCON_ERROR_INVALID_PARAMETER);
-
- repr_payload = OCRepPayloadCreate();
- if (NULL == repr_payload) {
- ERR("OCRepPayloadCreate() Fail");
- return IOTCON_ERROR_OUT_OF_MEMORY;
- }
-
- if (NULL == repr) {
- *payload = (OCPayload *)repr_payload;
- return IOTCON_ERROR_NONE;
- }
-
- /* uri path */
- if (repr->uri_path)
- OCRepPayloadSetUri(repr_payload, repr->uri_path);
-
- /* interfaces */
- if (repr->interfaces) {
- for (c = repr->interfaces->iface_list; c; c = c->next)
- OCRepPayloadAddInterface(repr_payload, c->data);
- } else {
- OCRepPayloadAddInterface(repr_payload, IOTCON_INTERFACE_DEFAULT);
- }
-
- /* resource types */
- if (repr->res_types) {
- for (c = repr->res_types->type_list; c; c = c->next)
- OCRepPayloadAddResourceType(repr_payload, c->data);
- }
-
- /* attributes */
- if (repr->attributes) {
- ret = _icl_ioty_fill_oic_rep_payload_value(repr_payload, repr->attributes);
- if (IOTCON_ERROR_NONE != ret) {
- ERR("_icl_ioty_fill_oic_rep_payload_value() Fail(%d)", ret);
- OCRepPayloadDestroy(repr_payload);
- return ret;
- }
- }
-
- /* children */
- cur = repr_payload;
- for (c = repr->children; c; c = c->next) {
- OCPayload *child = NULL;
- ret = icl_ioty_convert_representation(c->data, &child);
- if (IOTCON_ERROR_NONE != ret) {
- ERR("icl_ioty_convert_representation() Fail(%d)", ret);
- OCRepPayloadDestroy(repr_payload);
- return IOTCON_ERROR_IOTIVITY;
- }
- cur->next = (OCRepPayload *)child;
- cur = cur->next;
- }
-
- *payload = (OCPayload *)repr_payload;
- return IOTCON_ERROR_NONE;
-}
-
-int icl_ioty_parse_oic_header_option(OCHeaderOption *option, int option_size,
+int ic_ioty_parse_oic_header_option(OCHeaderOption *option, int option_size,
iotcon_options_h *options)
{
int i, ret;
@@ -1084,32 +912,3 @@ int icl_ioty_parse_oic_header_option(OCHeaderOption *option, int option_size,
return IOTCON_ERROR_NONE;
}
-int icl_ioty_convert_header_options(iotcon_options_h options,
- OCHeaderOption dest[], int dest_size)
-{
- int i = 0, src_size;
- GHashTableIter iter;
- gpointer option_id, option_data;
-
- RETV_IF(NULL == options, IOTCON_ERROR_INVALID_PARAMETER);
- RETV_IF(NULL == options->hash, IOTCON_ERROR_INVALID_PARAMETER);
- RETV_IF(NULL == dest, IOTCON_ERROR_INVALID_PARAMETER);
-
- src_size = g_hash_table_size(options->hash);
-
- if (dest_size < src_size) {
- ERR("Exceed Size(%d)", src_size);
- return IOTCON_ERROR_INVALID_PARAMETER;
- }
-
- g_hash_table_iter_init(&iter, options->hash);
- while (g_hash_table_iter_next(&iter, &option_id, &option_data)) {
- dest[i].protocolID = OC_COAP_ID;
- dest[i].optionID = GPOINTER_TO_INT(option_id);
- dest[i].optionLength = strlen(option_data) + 1;
- memcpy(dest[i].optionData, option_data, dest[i].optionLength);
- i++;
- }
- return IOTCON_ERROR_NONE;
-}
-
diff --git a/lib/icl-ioty-types.h b/src/ic-ioty-parse.h
index 3bfcb79..1e9a508 100644
--- a/lib/icl-ioty-types.h
+++ b/src/ic-ioty-parse.h
@@ -13,34 +13,38 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+#ifndef __IOTCON_INTERNAL_IOTIVITY_PARSE_H__
+#define __IOTCON_INTERNAL_IOTIVITY_PARSE_H__
-#ifndef __IOT_CONNECTIVITY_LIBRARY_IOTIVITY_TYPES_H__
-#define __IOT_CONNECTIVITY_LIBRARY_IOTIVITY_TYPES_H__
+#include <stdbool.h>
#include "iotcon-types.h"
-#include "icl-ioty.h"
+#include "iotcon-errors.h"
+/* oic -> iotcon */
+iotcon_request_type_e ic_ioty_parse_oic_method(OCMethod method);
+iotcon_response_result_e ic_ioty_parse_oic_response_result(OCStackResult result);
+iotcon_error_e ic_ioty_parse_oic_error(OCStackResult ret);
+iotcon_observe_type_e ic_ioty_parse_oic_action(OCObserveAction oic_action);
+int ic_ioty_parse_oic_dev_address(OCDevAddr *dev_addr, char **host_address,
+ int *conn_type);
-int icl_ioty_parse_oic_header_option(OCHeaderOption *option, int option_size,
+int ic_ioty_parse_oic_header_option(OCHeaderOption *option, int option_size,
iotcon_options_h *options);
-int icl_ioty_parse_oic_discovery_payload(OCDevAddr *dev_addr,
+int ic_ioty_parse_oic_discovery_payload(OCDevAddr *dev_addr,
OCDiscoveryPayload *discovered,
iotcon_remote_resource_h **resource_list,
int *resource_count);
-int icl_ioty_parse_oic_device_payload(OCDevicePayload *payload,
+int ic_ioty_parse_oic_device_payload(OCDevicePayload *payload,
iotcon_device_info_h *device_info);
-int icl_ioty_parse_oic_platform_payload(OCPlatformPayload *payload,
+int ic_ioty_parse_oic_platform_payload(OCPlatformPayload *payload,
iotcon_platform_info_h *platform_info);
-int icl_ioty_parse_oic_presence_payload(OCDevAddr *dev_addr,
+int ic_ioty_parse_oic_presence_payload(OCDevAddr *dev_addr,
OCPresencePayload *payload,
OCStackResult result,
iotcon_presence_response_h *presence_response);
-int icl_ioty_parse_oic_rep_payload(OCRepPayload *payload, bool is_parent,
+int ic_ioty_parse_oic_rep_payload(OCRepPayload *payload, bool is_parent,
iotcon_representation_h *representation);
-int icl_ioty_convert_representation(iotcon_representation_h repr,
- OCPayload **payload);
-int icl_ioty_convert_header_options(iotcon_options_h options,
- OCHeaderOption dest[], int dest_size);
-#endif /*__IOT_CONNECTIVITY_LIBRARY_IOTIVITY_TYPES_H__*/
+#endif /*__IOTCON_INTERNAL_IOTIVITY_PARSE_H__*/
diff --git a/lib/icl-ioty.c b/src/ic-ioty.c
index 764471d..ec20dc5 100644
--- a/lib/icl-ioty.c
+++ b/src/ic-ioty.c
@@ -27,26 +27,26 @@
#include <pinoxmcommon.h>
#include "iotcon.h"
+#include "ic.h"
#include "ic-utils.h"
-#include "ic-ioty-types.h"
-#include "icl.h"
-#include "icl-types.h"
-#include "icl-presence.h"
-#include "icl-remote-resource.h"
-#include "icl-representation.h"
-#include "icl-query.h"
-#include "icl-request.h"
-#include "icl-resource.h"
-#include "icl-resource-interfaces.h"
-#include "icl-resource-types.h"
-#include "icl-response.h"
-#include "icl-observation.h"
-#include "icl-attributes.h"
-#include "icl-lite-resource.h"
-#include "icl-ioty-ocprocess.h"
-#include "icl-ioty-types.h"
-#include "icl-ioty.h"
-#include "icl-cbor.h"
+#include "ic-types.h"
+#include "ic-presence.h"
+#include "ic-remote-resource.h"
+#include "ic-representation.h"
+#include "ic-query.h"
+#include "ic-request.h"
+#include "ic-resource.h"
+#include "ic-resource-interfaces.h"
+#include "ic-resource-types.h"
+#include "ic-response.h"
+#include "ic-observation.h"
+#include "ic-attributes.h"
+#include "ic-lite-resource.h"
+#include "ic-ioty.h"
+#include "ic-ioty-parse.h"
+#include "ic-ioty-convert.h"
+#include "ic-ioty-ocprocess.h"
+#include "ic-cbor.h"
static bool icl_state;
static int icl_remote_resource_time_interval = IC_REMOTE_RESOURCE_DEFAULT_TIME_INTERVAL;
@@ -726,10 +726,10 @@ static int _icl_ioty_remote_resource_observe(iotcon_remote_resource_h resource,
/* options */
if (resource->header_options && resource->header_options->hash) {
- ret = icl_ioty_convert_header_options(resource->header_options, oic_options,
+ ret = ic_ioty_convert_header_options(resource->header_options, oic_options,
sizeof(oic_options)/sizeof(oic_options[0]));
if (IOTCON_ERROR_NONE != ret) {
- ERR("icl_ioty_convert_header_options() Fail(%d)", ret);
+ ERR("ic_ioty_convert_header_options() Fail(%d)", ret);
free(uri);
return ret;
}
@@ -815,10 +815,10 @@ int icl_ioty_remote_resource_observe_cancel(iotcon_remote_resource_h resource,
/* options */
if (resource->header_options && resource->header_options->hash) {
- ret = icl_ioty_convert_header_options(resource->header_options, oic_options,
+ ret = ic_ioty_convert_header_options(resource->header_options, oic_options,
sizeof(oic_options)/sizeof(oic_options[0]));
if (IOTCON_ERROR_NONE != ret) {
- ERR("icl_ioty_convert_header_options() Fail(%d)", ret);
+ ERR("ic_ioty_convert_header_options() Fail(%d)", ret);
return ret;
}
oic_options_ptr = oic_options;
@@ -943,9 +943,9 @@ static int _icl_ioty_remote_resource_crud(
/* representation */
if (repr) {
- ret = icl_ioty_convert_representation(repr, &payload);
+ ret = ic_ioty_convert_representation(repr, &payload);
if (IOTCON_ERROR_NONE != ret) {
- ERR("icl_ioty_convert_representation() Fail(%d)", ret);
+ ERR("ic_ioty_convert_representation() Fail(%d)", ret);
free(uri);
return ret;
}
@@ -956,10 +956,10 @@ static int _icl_ioty_remote_resource_crud(
/* options */
if (resource->header_options && resource->header_options->hash) {
- ret = icl_ioty_convert_header_options(resource->header_options, oic_options,
+ ret = ic_ioty_convert_header_options(resource->header_options, oic_options,
sizeof(oic_options)/sizeof(oic_options[0]));
if (IOTCON_ERROR_NONE != ret) {
- ERR("icl_ioty_convert_header_options() Fail(%d)", ret);
+ ERR("ic_ioty_convert_header_options() Fail(%d)", ret);
OCRepPayloadDestroy((OCRepPayload*)payload);
free(uri);
return ret;
@@ -1719,9 +1719,9 @@ int icl_ioty_resource_notify(iotcon_resource_h resource, iotcon_representation_h
return IOTCON_ERROR_NONE;
}
- ret = icl_ioty_convert_representation(repr, (OCPayload **)&payload);
+ ret = ic_ioty_convert_representation(repr, (OCPayload **)&payload);
if (IOTCON_ERROR_NONE != ret) {
- ERR("icl_ioty_convert_representation() Fail(%d)", ret);
+ ERR("ic_ioty_convert_representation() Fail(%d)", ret);
return ret;
}
@@ -1938,7 +1938,7 @@ int icl_ioty_response_send(iotcon_response_h response_handle)
response.ehResult = ic_ioty_convert_response_result(response_handle->result);
if (response_handle->header_options && response_handle->header_options->hash) {
- icl_ioty_convert_header_options(response_handle->header_options,
+ ic_ioty_convert_header_options(response_handle->header_options,
response.sendVendorSpecificHeaderOptions,
sizeof(response.sendVendorSpecificHeaderOptions)
/ sizeof(response.sendVendorSpecificHeaderOptions[0]));
@@ -1948,7 +1948,7 @@ int icl_ioty_response_send(iotcon_response_h response_handle)
}
- icl_ioty_convert_representation(response_handle->repr, &(response.payload));
+ ic_ioty_convert_representation(response_handle->repr, &(response.payload));
/* related to block transfer */
response.persistentBufferFlag = 0;
diff --git a/lib/icl-ioty.h b/src/ic-ioty.h
index f58a916..1c1d74d 100644
--- a/lib/icl-ioty.h
+++ b/src/ic-ioty.h
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __IOT_CONNECTIVITY_LIBRARY_IOTIVITY_H__
-#define __IOT_CONNECTIVITY_LIBRARY_IOTIVITY_H__
+#ifndef __IOTCON_INTERNAL_IOTIVITY_H__
+#define __IOTCON_INTERNAL_IOTIVITY_H__
#include <stdint.h>
#include <pthread.h>
@@ -144,5 +144,5 @@ int icl_ioty_lite_resource_notify(iotcon_lite_resource_h resource);
int icl_ioty_response_send(iotcon_response_h response);
-#endif /*__IOT_CONNECTIVITY_LIBRARY_IOTIVITY_H__*/
+#endif /*__IOTCON_INTERNAL_IOTIVITY_H__*/
diff --git a/lib/icl-list.c b/src/ic-list.c
index d6561a6..9421b75 100644
--- a/lib/icl-list.c
+++ b/src/ic-list.c
@@ -18,12 +18,12 @@
#include <errno.h>
#include "iotcon-types.h"
+#include "ic.h"
#include "ic-utils.h"
-#include "icl.h"
-#include "icl-attributes.h"
-#include "icl-representation.h"
-#include "icl-value.h"
-#include "icl-list.h"
+#include "ic-attributes.h"
+#include "ic-representation.h"
+#include "ic-value.h"
+#include "ic-list.h"
iotcon_list_h icl_list_ref(iotcon_list_h list)
{
diff --git a/lib/icl-list.h b/src/ic-list.h
index 4a1a5e5..bbf6ad1 100644
--- a/lib/icl-list.h
+++ b/src/ic-list.h
@@ -13,13 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __IOT_CONNECTIVITY_LIBRARY_LIST_H__
-#define __IOT_CONNECTIVITY_LIBRARY_LIST_H__
+#ifndef __IOTCON_INTERNAL_LIST_H__
+#define __IOTCON_INTERNAL_LIST_H__
#include <glib.h>
#include "iotcon-types.h"
-#include "icl-value.h"
+#include "ic-value.h"
struct icl_list_s {
int type;
@@ -32,4 +32,4 @@ int icl_list_insert(iotcon_list_h list, iotcon_value_h value, int pos);
iotcon_list_h icl_list_ref(iotcon_list_h list);
-#endif /* __IOT_CONNECTIVITY_LIBRARY_LIST_H__ */
+#endif /* __IOTCON_INTERNAL_LIST_H__ */
diff --git a/lib/icl-lite-resource.c b/src/ic-lite-resource.c
index b22e240..c77c3dd 100644
--- a/lib/icl-lite-resource.c
+++ b/src/ic-lite-resource.c
@@ -18,16 +18,16 @@
#include <string.h>
#include "iotcon-types.h"
+#include "ic.h"
#include "ic-utils.h"
-#include "icl.h"
-#include "icl-representation.h"
-#include "icl-attributes.h"
-#include "icl-value.h"
-#include "icl-list.h"
-#include "icl-resource.h"
-#include "icl-response.h"
-#include "icl-lite-resource.h"
-#include "icl-ioty.h"
+#include "ic-representation.h"
+#include "ic-attributes.h"
+#include "ic-value.h"
+#include "ic-list.h"
+#include "ic-resource.h"
+#include "ic-response.h"
+#include "ic-lite-resource.h"
+#include "ic-ioty.h"
/* The length of uri_path should be less than 128. */
diff --git a/lib/icl-lite-resource.h b/src/ic-lite-resource.h
index 7201958..00b05d7 100644
--- a/lib/icl-lite-resource.h
+++ b/src/ic-lite-resource.h
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __IOT_CONNECTIVITY_LIBRARY_LITE_RESOURCE_H__
-#define __IOT_CONNECTIVITY_LIBRARY_LITE_RESOURCE_H__
+#ifndef __IOTCON_INTERNAL_LITE_RESOURCE_H__
+#define __IOTCON_INTERNAL_LITE_RESOURCE_H__
#include <stdint.h>
#include "iotcon-lite-resource.h"
@@ -29,5 +29,5 @@ struct icl_lite_resource {
void *cb_data;
};
-#endif /* __IOT_CONNECTIVITY_LIBRARY_LITE_RESOURCE_H__ */
+#endif /* __IOTCON_INTERNAL_LITE_RESOURCE_H__ */
diff --git a/common/ic-log.h b/src/ic-log.h
index ec6e9a6..6f6ab30 100644
--- a/common/ic-log.h
+++ b/src/ic-log.h
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __IOT_CONNECTIVITY_INTERNAL_LOG_H__
-#define __IOT_CONNECTIVITY_INTERNAL_LOG_H__
+#ifndef __IOTCON_INTERNAL_LOG_H__
+#define __IOTCON_INTERNAL_LOG_H__
#define IC_LOG_RED "\033[0;31m"
#define IC_LOG_GREEN "\033[0;32m"
@@ -141,4 +141,4 @@
} \
} while (0)
-#endif /* __IOT_CONNECTIVITY_INTERNAL_LOG_H__ */
+#endif /* __IOTCON_INTERNAL_LOG_H__ */
diff --git a/lib/icl-observation.c b/src/ic-observation.c
index 7546ba6..94e095a 100644
--- a/lib/icl-observation.c
+++ b/src/ic-observation.c
@@ -18,9 +18,9 @@
#include <glib.h>
#include "iotcon-types.h"
+#include "ic.h"
#include "ic-utils.h"
-#include "icl.h"
-#include "icl-observation.h"
+#include "ic-observation.h"
API int iotcon_observers_create(iotcon_observers_h *ret_observers)
{
diff --git a/lib/icl-observation.h b/src/ic-observation.h
index be77a23..e882f31 100644
--- a/lib/icl-observation.h
+++ b/src/ic-observation.h
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __IOT_CONNECTIVITY_LIBRARY_OBSERVATION_H__
-#define __IOT_CONNECTIVITY_LIBRARY_OBSERVATION_H__
+#ifndef __IOTCON_INTERNAL_OBSERVATION_H__
+#define __IOTCON_INTERNAL_OBSERVATION_H__
#include <glib.h>
#include "iotcon-types.h"
@@ -23,4 +23,4 @@ struct icl_observers {
GList *observers_list;
};
-#endif /* __IOT_CONNECTIVITY_LIBRARY_OBSERVATION_H__ */
+#endif /* __IOTCON_INTERNAL_OBSERVATION_H__ */
diff --git a/lib/icl-options.c b/src/ic-options.c
index 0068e9d..3fcab28 100644
--- a/lib/icl-options.c
+++ b/src/ic-options.c
@@ -18,9 +18,9 @@
#include <glib.h>
#include "iotcon-types.h"
+#include "ic.h"
#include "ic-utils.h"
-#include "icl.h"
-#include "icl-options.h"
+#include "ic-options.h"
/**
* @brief HeaderOption range from 2048 to 3000.
diff --git a/lib/icl-options.h b/src/ic-options.h
index d6d97ee..9e4b1ba 100644
--- a/lib/icl-options.h
+++ b/src/ic-options.h
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __IOT_CONNECTIVITY_LIBRARY_OPTIONS_H__
-#define __IOT_CONNECTIVITY_LIBRARY_OPTIONS_H__
+#ifndef __IOTCON_INTERNAL_OPTIONS_H__
+#define __IOTCON_INTERNAL_OPTIONS_H__
#include <glib.h>
#include "iotcon-types.h"
@@ -26,4 +26,4 @@ struct icl_options {
iotcon_options_h icl_options_ref(iotcon_options_h options);
-#endif /* __IOT_CONNECTIVITY_LIBRARY_OPTIONS_H__ */
+#endif /* __IOTCON_INTERNAL_OPTIONS_H__ */
diff --git a/lib/icl-presence.c b/src/ic-presence.c
index 2a52314..21f8149 100644
--- a/lib/icl-presence.c
+++ b/src/ic-presence.c
@@ -18,12 +18,12 @@
#include <string.h>
#include "iotcon-types.h"
+#include "ic.h"
#include "ic-utils.h"
-#include "icl.h"
-#include "icl-resource.h"
-#include "icl-presence.h"
-#include "icl-resource-types.h"
-#include "icl-ioty.h"
+#include "ic-resource.h"
+#include "ic-presence.h"
+#include "ic-resource-types.h"
+#include "ic-ioty.h"
API int iotcon_start_presence(unsigned int time_to_live)
{
diff --git a/lib/icl-presence.h b/src/ic-presence.h
index 56e8ef3..5f290b2 100644
--- a/lib/icl-presence.h
+++ b/src/ic-presence.h
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __IOT_CONNECTIVITY_LIBRARY_PRESENCE_H__
-#define __IOT_CONNECTIVITY_LIBRARY_PRESENCE_H__
+#ifndef __IOTCON_INTERNAL_PRESENCE_H__
+#define __IOTCON_INTERNAL_PRESENCE_H__
#include <octypes.h>
@@ -35,4 +35,4 @@ typedef struct icl_presence_response {
iotcon_presence_trigger_e trigger;
} icl_presence_response_s;
-#endif /*__IOT_CONNECTIVITY_LIBRARY_PRESENCE_H__*/
+#endif /*__IOTCON_INTERNAL_PRESENCE_H__*/
diff --git a/lib/icl-provisioning-struct.c b/src/ic-provisioning-struct.c
index 2657886..902175d 100644
--- a/lib/icl-provisioning-struct.c
+++ b/src/ic-provisioning-struct.c
@@ -27,11 +27,10 @@
#include "iotcon.h"
#include "iotcon-provisioning.h"
+#include "ic.h"
#include "ic-utils.h"
-#include "ic-ioty-types.h"
-#include "icl.h"
-#include "icl-ioty.h"
-#include "icl-provisioning-struct.h"
+#include "ic-ioty.h"
+#include "ic-provisioning-struct.h"
#define ICL_PROVISIONING_TIMEOUT_MAX 10
diff --git a/lib/icl-provisioning-struct.h b/src/ic-provisioning-struct.h
index 9123e97..013cf50 100644
--- a/lib/icl-provisioning-struct.h
+++ b/src/ic-provisioning-struct.h
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __IOT_CONNECTIVITY_LIBRARY_PROVISIONING_STRUCT_H__
-#define __IOT_CONNECTIVITY_LIBRARY_PROVISIONING_STRUCT_H__
+#ifndef __IOTCON_INTERNAL_PROVISIONING_STRUCT_H__
+#define __IOTCON_INTERNAL_PROVISIONING_STRUCT_H__
#include <ocprovisioningmanager.h>
@@ -53,4 +53,4 @@ char* icl_provisioning_acl_get_nth_resource(iotcon_provisioning_acl_h acl, int i
int icl_provisioning_acl_convert_permission(int permission);
int icl_provisioning_acl_get_permission(iotcon_provisioning_acl_h acl);
-#endif /* __IOT_CONNECTIVITY_LIBRARY_PROVISIONING_STRUCT_H__ */
+#endif /* __IOTCON_INTERNAL_PROVISIONING_STRUCT_H__ */
diff --git a/lib/icl-provisioning.c b/src/ic-provisioning.c
index c4299ff..73700a8 100644
--- a/lib/icl-provisioning.c
+++ b/src/ic-provisioning.c
@@ -27,11 +27,11 @@
#include "iotcon.h"
#include "iotcon-provisioning.h"
+#include "ic.h"
#include "ic-utils.h"
-#include "ic-ioty-types.h"
-#include "icl.h"
-#include "icl-ioty.h"
-#include "icl-provisioning-struct.h"
+#include "ic-ioty.h"
+#include "ic-ioty-parse.h"
+#include "ic-provisioning-struct.h"
#define ICL_PROVISIONING_TIMEOUT_MAX 10
diff --git a/lib/icl-query.c b/src/ic-query.c
index 8f020f3..8ddb96e 100644
--- a/lib/icl-query.c
+++ b/src/ic-query.c
@@ -21,11 +21,11 @@
#include <glib.h>
#include "iotcon-types.h"
+#include "ic.h"
#include "ic-utils.h"
-#include "icl.h"
-#include "icl-resource.h"
-#include "icl-resource-types.h"
-#include "icl-query.h"
+#include "ic-resource.h"
+#include "ic-resource-types.h"
+#include "ic-query.h"
API int iotcon_query_create(iotcon_query_h *ret_query)
{
diff --git a/lib/icl-query.h b/src/ic-query.h
index 3eba7ad..c1c7897 100644
--- a/lib/icl-query.h
+++ b/src/ic-query.h
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __IOT_CONNECTIVITY_LIBRARY_QUERY_H__
-#define __IOT_CONNECTIVITY_LIBRARY_QUERY_H__
+#ifndef __IOTCON_INTERNAL_QUERY_H__
+#define __IOTCON_INTERNAL_QUERY_H__
#include <glib.h>
#include "iotcon-types.h"
@@ -34,4 +34,4 @@ struct icl_query {
GHashTable *hash;
};
-#endif /* __IOT_CONNECTIVITY_LIBRARY_QUERY_H__ */
+#endif /* __IOTCON_INTERNAL_QUERY_H__ */
diff --git a/lib/icl-remote-resource-caching.c b/src/ic-remote-resource-caching.c
index b56daee..432339c 100644
--- a/lib/icl-remote-resource-caching.c
+++ b/src/ic-remote-resource-caching.c
@@ -17,14 +17,14 @@
#include <stdlib.h>
#include "iotcon.h"
+#include "ic.h"
#include "ic-utils.h"
-#include "icl.h"
-#include "icl-types.h"
-#include "icl-representation.h"
-#include "icl-list.h"
-#include "icl-value.h"
-#include "icl-remote-resource.h"
-#include "icl-ioty.h"
+#include "ic-types.h"
+#include "ic-representation.h"
+#include "ic-list.h"
+#include "ic-value.h"
+#include "ic-remote-resource.h"
+#include "ic-ioty.h"
API int iotcon_remote_resource_start_caching(iotcon_remote_resource_h resource,
iotcon_remote_resource_cached_representation_changed_cb cb, void *user_data)
diff --git a/lib/icl-remote-resource-crud.c b/src/ic-remote-resource-crud.c
index d59beb8..ed7e822 100644
--- a/lib/icl-remote-resource-crud.c
+++ b/src/ic-remote-resource-crud.c
@@ -14,13 +14,13 @@
* limitations under the License.
*/
#include "iotcon.h"
+#include "ic.h"
#include "ic-utils.h"
-#include "icl.h"
-#include "icl-ioty.h"
-#include "icl-options.h"
-#include "icl-response.h"
-#include "icl-representation.h"
-#include "icl-remote-resource.h"
+#include "ic-ioty.h"
+#include "ic-options.h"
+#include "ic-response.h"
+#include "ic-representation.h"
+#include "ic-remote-resource.h"
API int iotcon_remote_resource_get(iotcon_remote_resource_h resource,
iotcon_query_h query, iotcon_remote_resource_response_cb cb, void *user_data)
diff --git a/lib/icl-remote-resource-monitoring.c b/src/ic-remote-resource-monitoring.c
index e9bbf79..1b7c3e4 100644
--- a/lib/icl-remote-resource-monitoring.c
+++ b/src/ic-remote-resource-monitoring.c
@@ -17,11 +17,11 @@
#include <stdlib.h>
#include "iotcon.h"
-#include "icl.h"
-#include "icl-types.h"
+#include "ic.h"
+#include "ic-types.h"
#include "ic-utils.h"
-#include "icl-remote-resource.h"
-#include "icl-ioty.h"
+#include "ic-remote-resource.h"
+#include "ic-ioty.h"
API int iotcon_remote_resource_start_monitoring(
iotcon_remote_resource_h resource,
diff --git a/lib/icl-remote-resource.c b/src/ic-remote-resource.c
index 94c01a1..f223550 100644
--- a/lib/icl-remote-resource.c
+++ b/src/ic-remote-resource.c
@@ -19,15 +19,15 @@
#include <errno.h>
#include "iotcon-types.h"
+#include "ic.h"
#include "ic-utils.h"
-#include "icl.h"
-#include "icl-options.h"
-#include "icl-representation.h"
-#include "icl-remote-resource.h"
-#include "icl-resource.h"
-#include "icl-resource-types.h"
-#include "icl-resource-interfaces.h"
-#include "icl-ioty.h"
+#include "ic-options.h"
+#include "ic-representation.h"
+#include "ic-remote-resource.h"
+#include "ic-resource.h"
+#include "ic-resource-types.h"
+#include "ic-resource-interfaces.h"
+#include "ic-ioty.h"
#define ICL_REMOTE_RESOURCE_MAX_TIME_INTERVAL 3600 /* 60 min */
diff --git a/lib/icl-remote-resource.h b/src/ic-remote-resource.h
index fc6c49f..0a903d0 100644
--- a/lib/icl-remote-resource.h
+++ b/src/ic-remote-resource.h
@@ -13,15 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __IOT_CONNECTIVITY_LIBRARY_CLIENT_H__
-#define __IOT_CONNECTIVITY_LIBRARY_CLIENT_H__
+#ifndef __IOTCON_INTERNAL_REMOTE_RESOURCE_H__
+#define __IOTCON_INTERNAL_REMOTE_RESOURCE_H__
#include <stdint.h>
#include <gio/gio.h>
#include "iotcon-types.h"
#include "iotcon-remote-resource.h"
-#include "icl-options.h"
+#include "ic-options.h"
struct icl_remote_resource {
bool is_found;
@@ -42,4 +42,4 @@ struct icl_remote_resource {
void icl_remote_resource_ref(iotcon_remote_resource_h resource);
void icl_remote_resource_unref(iotcon_remote_resource_h resource);
-#endif /* __IOT_CONNECTIVITY_LIBRARY_CLIENT_H__ */
+#endif /* __IOTCON_INTERNAL_REMOTE_RESOURCE_H__ */
diff --git a/lib/icl-representation.c b/src/ic-representation.c
index 55e0c44..2388c4e 100644
--- a/lib/icl-representation.c
+++ b/src/ic-representation.c
@@ -22,16 +22,16 @@
#include <glib.h>
#include "iotcon-types.h"
+#include "ic.h"
#include "ic-utils.h"
-#include "icl.h"
-#include "icl-resource.h"
-#include "icl-resource-types.h"
-#include "icl-resource-interfaces.h"
-#include "icl-response.h"
-#include "icl-list.h"
-#include "icl-value.h"
-#include "icl-attributes.h"
-#include "icl-representation.h"
+#include "ic-resource.h"
+#include "ic-resource-types.h"
+#include "ic-resource-interfaces.h"
+#include "ic-response.h"
+#include "ic-list.h"
+#include "ic-value.h"
+#include "ic-attributes.h"
+#include "ic-representation.h"
static int _icl_repr_compare_attributes_value(struct icl_value_s *val1,
struct icl_value_s *val2);
diff --git a/lib/icl-representation.h b/src/ic-representation.h
index 8f2873c..9ca1a40 100644
--- a/lib/icl-representation.h
+++ b/src/ic-representation.h
@@ -13,13 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __IOT_CONNECTIVITY_LIBRARY_REPRESENTATION_H__
-#define __IOT_CONNECTIVITY_LIBRARY_REPRESENTATION_H__
+#ifndef __IOTCON_INTERNAL_REPRESENTATION_H__
+#define __IOTCON_INTERNAL_REPRESENTATION_H__
#include <glib.h>
#include "iotcon-types.h"
-#include "icl-value.h"
+#include "ic-value.h"
struct icl_attributes_s {
int ref_count;
@@ -41,4 +41,4 @@ int icl_representation_compare(iotcon_representation_h repr1,
iotcon_representation_h repr2);
-#endif /* __IOT_CONNECTIVITY_LIBRARY_REPRESENTATION_H__ */
+#endif /* __IOTCON_INTERNAL_REPRESENTATION_H__ */
diff --git a/lib/icl-request.c b/src/ic-request.c
index 88e4be4..1e392f1 100644
--- a/lib/icl-request.c
+++ b/src/ic-request.c
@@ -14,9 +14,9 @@
* limitations under the License.
*/
#include "iotcon-types.h"
+#include "ic.h"
#include "ic-utils.h"
-#include "icl.h"
-#include "icl-request.h"
+#include "ic-request.h"
API int iotcon_request_get_host_address(iotcon_request_h request,
char **host_address)
diff --git a/lib/icl-request.h b/src/ic-request.h
index 7f970b2..8b77a66 100644
--- a/lib/icl-request.h
+++ b/src/ic-request.h
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __IOT_CONNECTIVITY_LIBRARY_REQUEST_H__
-#define __IOT_CONNECTIVITY_LIBRARY_REQUEST_H__
+#ifndef __IOTCON_INTERNAL_REQUEST_H__
+#define __IOTCON_INTERNAL_REQUEST_H__
#include <stdint.h>
#include "iotcon-types.h"
@@ -36,4 +36,4 @@ struct icl_resource_request {
int64_t oic_resource_h;
};
-#endif /* __IOT_CONNECTIVITY_LIBRARY_REQUEST_H__ */
+#endif /* __IOTCON_INTERNAL_REQUEST_H__ */
diff --git a/lib/icl-resource-interfaces.c b/src/ic-resource-interfaces.c
index fdc3bc5..fdfc6fe 100644
--- a/lib/icl-resource-interfaces.c
+++ b/src/ic-resource-interfaces.c
@@ -19,10 +19,10 @@
#include <glib.h>
#include "iotcon-types.h"
+#include "ic.h"
#include "ic-utils.h"
-#include "icl.h"
-#include "icl-resource.h"
-#include "icl-resource-interfaces.h"
+#include "ic-resource.h"
+#include "ic-resource-interfaces.h"
iotcon_resource_interfaces_h icl_resource_interfaces_ref(
iotcon_resource_interfaces_h ifaces)
diff --git a/lib/icl-resource-interfaces.h b/src/ic-resource-interfaces.h
index 741c850..57f9ba8 100644
--- a/lib/icl-resource-interfaces.h
+++ b/src/ic-resource-interfaces.h
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __IOT_CONNECTIVITY_LIBRARY_RESOURCE_INTERFACES_H__
-#define __IOT_CONNECTIVITY_LIBRARY_RESOURCE_INTERFACES_H__
+#ifndef __IOTCON_INTERNAL_RESOURCE_INTERFACES_H__
+#define __IOTCON_INTERNAL_RESOURCE_INTERFACES_H__
#include <glib.h>
#include "iotcon-types.h"
@@ -27,4 +27,4 @@ struct icl_resource_ifaces {
iotcon_resource_interfaces_h icl_resource_interfaces_ref(
iotcon_resource_interfaces_h res_ifaces);
-#endif /* __IOT_CONNECTIVITY_LIBRARY_RESOURCE_INTERFACES_H__ */
+#endif /* __IOTCON_INTERNAL_RESOURCE_INTERFACES_H__ */
diff --git a/lib/icl-resource-types.c b/src/ic-resource-types.c
index 91d5634..3dc43e4 100644
--- a/lib/icl-resource-types.c
+++ b/src/ic-resource-types.c
@@ -19,10 +19,10 @@
#include <glib.h>
#include "iotcon-types.h"
+#include "ic.h"
#include "ic-utils.h"
-#include "icl.h"
-#include "icl-resource.h"
-#include "icl-resource-types.h"
+#include "ic-resource.h"
+#include "ic-resource-types.h"
iotcon_resource_types_h icl_resource_types_ref(iotcon_resource_types_h types)
{
diff --git a/lib/icl-resource-types.h b/src/ic-resource-types.h
index 72bd1b3..d693df1 100644
--- a/lib/icl-resource-types.h
+++ b/src/ic-resource-types.h
@@ -13,12 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __IOT_CONNECTIVITY_LIBRARY_RESOURCE_TYPES_H__
-#define __IOT_CONNECTIVITY_LIBRARY_RESOURCE_TYPES_H__
+#ifndef __IOTCON_INTERNAL_RESOURCE_TYPES_H__
+#define __IOTCON_INTERNAL_RESOURCE_TYPES_H__
#include <glib.h>
#include "iotcon-types.h"
-#include "icl-query.h"
+#include "ic-query.h"
/**
* @brief The maximum length which can be held in a resource type.
@@ -35,4 +35,4 @@ struct icl_resource_types {
iotcon_resource_types_h icl_resource_types_ref(iotcon_resource_types_h res_types);
-#endif /* __IOT_CONNECTIVITY_LIBRARY_RESOURCE_TYPES_H__ */
+#endif /* __IOTCON_INTERNAL_RESOURCE_TYPES_H__ */
diff --git a/lib/icl-resource.c b/src/ic-resource.c
index c9182b1..d6353f9 100644
--- a/lib/icl-resource.c
+++ b/src/ic-resource.c
@@ -20,14 +20,14 @@
#include <tizen_type.h>
#include "iotcon.h"
+#include "ic.h"
#include "ic-utils.h"
-#include "icl.h"
-#include "icl-representation.h"
-#include "icl-request.h"
-#include "icl-resource-types.h"
-#include "icl-resource-interfaces.h"
-#include "icl-resource.h"
-#include "icl-ioty.h"
+#include "ic-representation.h"
+#include "ic-request.h"
+#include "ic-resource-types.h"
+#include "ic-resource-interfaces.h"
+#include "ic-resource.h"
+#include "ic-ioty.h"
bool icl_resource_check_uri_path(const char *uri_path)
{
diff --git a/lib/icl-resource.h b/src/ic-resource.h
index 92d3ee8..b6fda39 100644
--- a/lib/icl-resource.h
+++ b/src/ic-resource.h
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __IOT_CONNECTIVITY_LIBRARY_RESOURCE_H__
-#define __IOT_CONNECTIVITY_LIBRARY_RESOURCE_H__
+#ifndef __IOTCON_INTERNAL_RESOURCE_H__
+#define __IOTCON_INTERNAL_RESOURCE_H__
#include <stdint.h>
#include <glib.h>
@@ -49,4 +49,4 @@ bool icl_resource_check_uri_path(const char *uri_path);
bool icl_resource_check_type(const char *type);
bool icl_resource_check_interface(const char *iface);
-#endif /*__IOT_CONNECTIVITY_LIBRARY_RESOURCE_H__*/
+#endif /*__IOTCON_INTERNAL_RESOURCE_H__*/
diff --git a/lib/icl-response.c b/src/ic-response.c
index 3a405bb..b13fa46 100644
--- a/lib/icl-response.c
+++ b/src/ic-response.c
@@ -18,15 +18,15 @@
#include <glib.h>
#include "iotcon.h"
+#include "ic.h"
#include "ic-utils.h"
-#include "icl.h"
-#include "icl-resource.h"
-#include "icl-representation.h"
-#include "icl-options.h"
-#include "icl-request.h"
-#include "icl-response.h"
-
-#include "icl-ioty.h"
+#include "ic-resource.h"
+#include "ic-representation.h"
+#include "ic-options.h"
+#include "ic-request.h"
+#include "ic-response.h"
+
+#include "ic-ioty.h"
/* the last index of iotcon_response_result_e */
#define ICL_RESPONSE_RESULT_MAX (IOTCON_RESPONSE_FORBIDDEN + 1)
diff --git a/lib/icl-response.h b/src/ic-response.h
index ca629ec..aae9395 100644
--- a/lib/icl-response.h
+++ b/src/ic-response.h
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __IOT_CONNECTIVITY_LIBRARY_RESPONSE_H__
-#define __IOT_CONNECTIVITY_LIBRARY_RESPONSE_H__
+#ifndef __IOTCON_INTERNAL_RESPONSE_H__
+#define __IOTCON_INTERNAL_RESPONSE_H__
#include <stdint.h>
#include "iotcon-types.h"
@@ -35,4 +35,4 @@ struct icl_resource_response {
int64_t oic_resource_h;
};
-#endif /* __IOT_CONNECTIVITY_LIBRARY_RESPONSE_H__ */
+#endif /* __IOTCON_INTERNAL_RESPONSE_H__ */
diff --git a/lib/icl-types.c b/src/ic-types.c
index e6929c4..a46ddbc 100644
--- a/lib/icl-types.c
+++ b/src/ic-types.c
@@ -17,12 +17,12 @@
#include <errno.h>
#include "iotcon.h"
-#include "icl.h"
-#include "icl-device.h"
-#include "icl-remote-resource.h"
-#include "icl-presence.h"
-#include "icl-request.h"
-#include "icl-types.h"
+#include "ic.h"
+#include "ic-device.h"
+#include "ic-remote-resource.h"
+#include "ic-presence.h"
+#include "ic-request.h"
+#include "ic-types.h"
void icl_destroy_find_cb_data(icl_find_cb_s *cb_data)
{
diff --git a/lib/icl-types.h b/src/ic-types.h
index b61b29b..1908fd0 100644
--- a/lib/icl-types.h
+++ b/src/ic-types.h
@@ -14,13 +14,13 @@
* limitations under the License.
*/
-#ifndef __IOT_CONNECTIVITY_LIBRARY_TYPES_H__
-#define __IOT_CONNECTIVITY_LIBRARY_TYPES_H__
+#ifndef __IOTCON_INTERNAL_TYPES_H__
+#define __IOTCON_INTERNAL_TYPES_H__
#include <stdint.h>
#include <glib.h>
#include "iotcon-types.h"
-#include "icl-ioty.h"
+#include "ic-ioty.h"
typedef struct {
icl_cb_s *cb_data;
@@ -132,4 +132,4 @@ void icl_destroy_caching_container(void *data);
void icl_destroy_request_container(icl_request_container_s *cb_container);
-#endif /*__IOT_CONNECTIVITY_LIBRARY_TYPES_H__*/
+#endif /*__IOTCON_INTERNAL_TYPES_H__*/
diff --git a/common/ic-utils.c b/src/ic-utils.c
index 415bc6b..415bc6b 100644
--- a/common/ic-utils.c
+++ b/src/ic-utils.c
diff --git a/common/ic-utils.h b/src/ic-utils.h
index f35eb0c..2e43b5e 100644
--- a/common/ic-utils.h
+++ b/src/ic-utils.h
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __IOT_CONNECTIVITY_INTERNAL_COMMON_UTILITY_H__
-#define __IOT_CONNECTIVITY_INTERNAL_COMMON_UTILITY_H__
+#ifndef __IOTCON_INTERNAL_UTILITY_H__
+#define __IOTCON_INTERNAL_UTILITY_H__
#include <octypes.h>
#include "iotcon-types.h"
@@ -54,4 +54,4 @@ enum IC_UTILS_COND {
IC_UTILS_COND_MAX
};
-#endif /* __IOT_CONNECTIVITY_INTERNAL_COMMON_UTILITY_H__ */
+#endif /* __IOTCON_INTERNAL_UTILITY_H__ */
diff --git a/lib/icl-value.c b/src/ic-value.c
index 1922b1b..182b635 100644
--- a/lib/icl-value.c
+++ b/src/ic-value.c
@@ -19,12 +19,12 @@
#include "iotcon-types.h"
#include "iotcon-representation.h"
+#include "ic.h"
#include "ic-utils.h"
-#include "icl.h"
-#include "icl-representation.h"
-#include "icl-list.h"
-#include "icl-attributes.h"
-#include "icl-value.h"
+#include "ic-representation.h"
+#include "ic-list.h"
+#include "ic-attributes.h"
+#include "ic-value.h"
static iotcon_value_h _icl_value_create(int type)
{
diff --git a/lib/icl-value.h b/src/ic-value.h
index cc7c1de..ddb64cc 100644
--- a/lib/icl-value.h
+++ b/src/ic-value.h
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __IOT_CONNECTIVITY_LIBRARY_VALUE_H__
-#define __IOT_CONNECTIVITY_LIBRARY_VALUE_H__
+#ifndef __IOTCON_INTERNAL_VALUE_H__
+#define __IOTCON_INTERNAL_VALUE_H__
#include <glib.h>
@@ -92,4 +92,4 @@ void icl_value_destroy(gpointer data);
iotcon_value_h icl_value_clone(iotcon_value_h src);
-#endif /* __IOT_CONNECTIVITY_LIBRARY_VALUE_H__ */
+#endif /* __IOTCON_INTERNAL_VALUE_H__ */
diff --git a/lib/icl.c b/src/ic.c
index 77bba35..89b3bd4 100644
--- a/lib/icl.c
+++ b/src/ic.c
@@ -16,9 +16,9 @@
#include <glib.h>
#include <glib-object.h>
+#include "ic.h"
#include "ic-utils.h"
-#include "icl.h"
-#include "icl-ioty.h"
+#include "ic-ioty.h"
#define ICL_TIMEOUT_DEFAULT 30 /* 30 sec */
#define ICL_TIMEOUT_MAX 60*60 /* 60 min */
diff --git a/lib/icl.h b/src/ic.h
index 544263c..dcaa9f6 100644
--- a/lib/icl.h
+++ b/src/ic.h
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __IOT_CONNECTIVITY_LIBRARY_H__
-#define __IOT_CONNECTIVITY_LIBRARY_H__
+#ifndef __IOTCON_INTERNAL_H__
+#define __IOTCON_INTERNAL_H__
#include "iotcon.h"
#include "ic-common.h"
@@ -27,4 +27,4 @@
int icl_initialize(const char *file_path, bool is_pt);
-#endif /* __IOT_CONNECTIVITY_LIBRARY_H__ */
+#endif /* __IOTCON_INTERNAL_H__ */
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index e99b386..7305559 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -1,5 +1,5 @@
LINK_DIRECTORIES(${CMAKE_BINARY_DIR})
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/lib/include)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
SET(IOTCON_TEST_BASIC_CLIENT "iotcon-test-basic-client")
SET(IOTCON_TEST_BASIC_SERVER "iotcon-test-basic-server")
@@ -30,35 +30,35 @@ INCLUDE_DIRECTORIES(${test_pkgs_INCLUDE_DIRS})
LINK_DIRECTORIES(${test_pkgs_LIBRARY_DIRS})
ADD_EXECUTABLE(${IOTCON_TEST_BASIC_CLIENT} ${IOTCON_TEST_BASIC_CLIENT_SRCS})
-TARGET_LINK_LIBRARIES(${IOTCON_TEST_BASIC_CLIENT} ${test_pkgs_LIBRARIES} ${CLIENT})
+TARGET_LINK_LIBRARIES(${IOTCON_TEST_BASIC_CLIENT} ${test_pkgs_LIBRARIES} ${LIB})
INSTALL(TARGETS ${IOTCON_TEST_BASIC_CLIENT} DESTINATION ${BIN_INSTALL_DIR})
ADD_EXECUTABLE(${IOTCON_TEST_BASIC_SERVER} ${IOTCON_TEST_BASIC_SERVER_SRCS})
-TARGET_LINK_LIBRARIES(${IOTCON_TEST_BASIC_SERVER} ${test_pkgs_LIBRARIES} ${CLIENT})
+TARGET_LINK_LIBRARIES(${IOTCON_TEST_BASIC_SERVER} ${test_pkgs_LIBRARIES} ${LIB})
INSTALL(TARGETS ${IOTCON_TEST_BASIC_SERVER} DESTINATION ${BIN_INSTALL_DIR})
ADD_EXECUTABLE(${IOTCON_TEST_DEVICE_CLIENT} ${IOTCON_TEST_DEVICE_CLIENT_SRCS})
-TARGET_LINK_LIBRARIES(${IOTCON_TEST_DEVICE_CLIENT} ${test_pkgs_LIBRARIES} ${CLIENT})
+TARGET_LINK_LIBRARIES(${IOTCON_TEST_DEVICE_CLIENT} ${test_pkgs_LIBRARIES} ${LIB})
INSTALL(TARGETS ${IOTCON_TEST_DEVICE_CLIENT} DESTINATION ${BIN_INSTALL_DIR})
ADD_EXECUTABLE(${IOTCON_TEST_IFACE_CLIENT} ${IOTCON_TEST_IFACE_CLIENT_SRCS})
-TARGET_LINK_LIBRARIES(${IOTCON_TEST_IFACE_CLIENT} ${test_pkgs_LIBRARIES} ${CLIENT})
+TARGET_LINK_LIBRARIES(${IOTCON_TEST_IFACE_CLIENT} ${test_pkgs_LIBRARIES} ${LIB})
INSTALL(TARGETS ${IOTCON_TEST_IFACE_CLIENT} DESTINATION ${BIN_INSTALL_DIR})
ADD_EXECUTABLE(${IOTCON_TEST_IFACE_SERVER} ${IOTCON_TEST_IFACE_SERVER_SRCS})
-TARGET_LINK_LIBRARIES(${IOTCON_TEST_IFACE_SERVER} ${test_pkgs_LIBRARIES} ${CLIENT})
+TARGET_LINK_LIBRARIES(${IOTCON_TEST_IFACE_SERVER} ${test_pkgs_LIBRARIES} ${LIB})
INSTALL(TARGETS ${IOTCON_TEST_IFACE_SERVER} DESTINATION ${BIN_INSTALL_DIR})
ADD_EXECUTABLE(${IOTCON_TEST_ENCAP_CLIENT} ${IOTCON_TEST_ENCAP_CLIENT_SRCS})
-TARGET_LINK_LIBRARIES(${IOTCON_TEST_ENCAP_CLIENT} ${test_pkgs_LIBRARIES} ${CLIENT})
+TARGET_LINK_LIBRARIES(${IOTCON_TEST_ENCAP_CLIENT} ${test_pkgs_LIBRARIES} ${LIB})
INSTALL(TARGETS ${IOTCON_TEST_ENCAP_CLIENT} DESTINATION ${BIN_INSTALL_DIR})
ADD_EXECUTABLE(${IOTCON_TEST_ENCAP_SERVER} ${IOTCON_TEST_ENCAP_SERVER_SRCS})
-TARGET_LINK_LIBRARIES(${IOTCON_TEST_ENCAP_SERVER} ${test_pkgs_LIBRARIES} ${CLIENT})
+TARGET_LINK_LIBRARIES(${IOTCON_TEST_ENCAP_SERVER} ${test_pkgs_LIBRARIES} ${LIB})
INSTALL(TARGETS ${IOTCON_TEST_ENCAP_SERVER} DESTINATION ${BIN_INSTALL_DIR})
ADD_EXECUTABLE(${IOTCON_TEST_WIFI} ${IOTCON_TEST_WIFI_SRCS})
-TARGET_LINK_LIBRARIES(${IOTCON_TEST_WIFI} ${test_pkgs_LIBRARIES} ${CLIENT})
+TARGET_LINK_LIBRARIES(${IOTCON_TEST_WIFI} ${test_pkgs_LIBRARIES} ${LIB})
INSTALL(TARGETS ${IOTCON_TEST_WIFI} DESTINATION ${BIN_INSTALL_DIR})
INSTALL(FILES ${IOTCON_TEST_PROVISIONING_DAT} DESTINATION ${BIN_INSTALL_DIR})
diff --git a/test/test.h b/test/test.h
index 9735573..a047c10 100644
--- a/test/test.h
+++ b/test/test.h
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __IOT_CONNECTIVITY_TEST_H__
-#define __IOT_CONNECTIVITY_TEST_H__
+#ifndef __IOTCON_TEST_H__
+#define __IOTCON_TEST_H__
/* for strcmp() */
#define TEST_STR_EQUAL 0
@@ -129,4 +129,4 @@
} \
} while (0)
-#endif /* __IOT_CONNECTIVITY_TEST_H__ */
+#endif /* __IOTCON_TEST_H__ */