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)
+++ /dev/null
-/*
- * 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;
-}
-
* 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>
* @}
*/
-#endif /* __IOT_CONNECTIVITY_STRUCT_ATTRIBUTES_H__ */
+#endif /* __IOTCON_STRUCT_ATTRIBUTES_H__ */
* 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>
* @}
*/
-#endif /* __IOT_CONNECTIVITY_CLIENT_H__ */
+#endif /* __IOTCON_CLIENT_H__ */
* 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
* @}
*/
-#endif /* __IOT_CONNECTIVITY_CONSTANT_H__ */
+#endif /* __IOTCON_CONSTANT_H__ */
* 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>
* @}
*/
-#endif /* __IOT_CONNECTIVITY_ERRORS_H__ */
+#endif /* __IOTCON_ERRORS_H__ */
* 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" {
}
#endif
-#endif /* __IOT_CONNECTIVITY_INTERNAL_H__ */
+#endif /* __IOTCON_INTERNAL_H__ */
* 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>
* @}
*/
-#endif /* __IOT_CONNECTIVITY_STRUCT_LIST_H__ */
+#endif /* __IOTCON_STRUCT_LIST_H__ */
* 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>
* @}
*/
-#endif /* __IOT_CONNECTIVITY_SERVER_LITE_RESOURCE_H__ */
+#endif /* __IOTCON_SERVER_LITE_RESOURCE_H__ */
* 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>
* @}
*/
-#endif /* __IOT_CONNECTIVITY_SERVER_OBSERVERS_H__ */
+#endif /* __IOTCON_SERVER_OBSERVERS_H__ */
* 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>
* @}
*/
-#endif /* __IOT_CONNECTIVITY_STRUCT_OPTIONS_H__ */
+#endif /* __IOTCON_STRUCT_OPTIONS_H__ */
* 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>
int permission);
int iotcon_provisioning_acl_destroy(iotcon_provisioning_acl_h acl);
-#endif /* __IOT_CONNECTIVITY_PROVISIONING_H__ */
+#endif /* __IOTCON_PROVISIONING_H__ */
* 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>
* @}
*/
-#endif /* __IOT_CONNECTIVITY_STRUCT_QUERY_H__ */
+#endif /* __IOTCON_STRUCT_QUERY_H__ */
* 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>
* @}
*/
-#endif /* __IOT_CONNECTIVITY_CLIENT_REMOTE_RESOURCE_H__ */
+#endif /* __IOTCON_CLIENT_REMOTE_RESOURCE_H__ */
* 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>
* @}
*/
-#endif /* __IOT_CONNECTIVITY_STRUCT_REPRESENTATION_H__ */
+#endif /* __IOTCON_STRUCT_REPRESENTATION_H__ */
* 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>
* @}
*/
-#endif /* __IOT_CONNECTIVITY_SERVER_REQUEST_H__ */
+#endif /* __IOTCON_SERVER_REQUEST_H__ */
* 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>
* @}
*/
-#endif /* __IOT_CONNECTIVITY_STRUCT_RESOURCE_INTERFACES_H__ */
+#endif /* __IOTCON_STRUCT_RESOURCE_INTERFACES_H__ */
* 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>
* @}
*/
-#endif /* __IOT_CONNECTIVITY_STRUCT_RESOURCE_TYPES_H__ */
+#endif /* __IOTCON_STRUCT_RESOURCE_TYPES_H__ */
* 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>
* @}
*/
-#endif /* __IOT_CONNECTIVITY_SERVER_RESOURCE_H__ */
+#endif /* __IOTCON_SERVER_RESOURCE_H__ */
* 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>
* @}
*/
-#endif /* __IOT_CONNECTIVITY_COMMON_RESPONSE_H__ */
+#endif /* __IOTCON_COMMON_RESPONSE_H__ */
* 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>
* @}
*/
-#endif /* __IOT_CONNECTIVITY_SERVER_H__ */
+#endif /* __IOTCON_SERVER_H__ */
* 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>
#include <iotcon-resource-types.h>
#include <iotcon-resource-interfaces.h>
-#endif /* __IOT_CONNECTIVITY_TYPES_H__ */
+#endif /* __IOTCON_TYPES_H__ */
* 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" {
}
#endif
-#endif /* __IOT_CONNECTIVITY_H__ */
+#endif /* __IOTCON_H__ */
+++ /dev/null
-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})
#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)
{
* 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);
iotcon_attributes_h icl_attributes_ref(iotcon_attributes_h attributes);
-#endif /* __IOT_CONNECTIVITY_LIBRARY_ATTRIBUTES_H__ */
+#endif /* __IOTCON_INTERNAL_ATTRIBUTES_H__ */
#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
* 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__ */
* 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"
#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__ */
#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)
* 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"
char *system_time;
};
-#endif /* __IOT_CONNECTIVITY_LIBRARY_DEVICE_H__ */
+#endif /* __IOTCON_INTERNAL_DEVICE_H__ */
--- /dev/null
+/*
+ * 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;
+}
+
* 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(
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__*/
#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
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);
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;
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;
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;
}
}
/* 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;
}
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;
}
}
/* 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;
}
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;
}
}
/* 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;
}
/* 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 {
/* 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;
* 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();
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__*/
#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)
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)
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;
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) {
}
-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;
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;
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)
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;
}
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;
}
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;
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;
}
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;
/* 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);
/* 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;
}
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;
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;
-}
-
* 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__*/
#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;
/* 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;
}
/* 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;
/* 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;
}
/* 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;
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;
}
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]));
}
- 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;
* 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>
int icl_ioty_response_send(iotcon_response_h response);
-#endif /*__IOT_CONNECTIVITY_LIBRARY_IOTIVITY_H__*/
+#endif /*__IOTCON_INTERNAL_IOTIVITY_H__*/
#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)
{
* 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;
iotcon_list_h icl_list_ref(iotcon_list_h list);
-#endif /* __IOT_CONNECTIVITY_LIBRARY_LIST_H__ */
+#endif /* __IOTCON_INTERNAL_LIST_H__ */
#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. */
* 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"
void *cb_data;
};
-#endif /* __IOT_CONNECTIVITY_LIBRARY_LITE_RESOURCE_H__ */
+#endif /* __IOTCON_INTERNAL_LITE_RESOURCE_H__ */
* 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"
} \
} while (0)
-#endif /* __IOT_CONNECTIVITY_INTERNAL_LOG_H__ */
+#endif /* __IOTCON_INTERNAL_LOG_H__ */
#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)
{
* 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"
GList *observers_list;
};
-#endif /* __IOT_CONNECTIVITY_LIBRARY_OBSERVATION_H__ */
+#endif /* __IOTCON_INTERNAL_OBSERVATION_H__ */
#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.
* 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"
iotcon_options_h icl_options_ref(iotcon_options_h options);
-#endif /* __IOT_CONNECTIVITY_LIBRARY_OPTIONS_H__ */
+#endif /* __IOTCON_INTERNAL_OPTIONS_H__ */
#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)
{
* 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>
iotcon_presence_trigger_e trigger;
} icl_presence_response_s;
-#endif /*__IOT_CONNECTIVITY_LIBRARY_PRESENCE_H__*/
+#endif /*__IOTCON_INTERNAL_PRESENCE_H__*/
#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
* 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>
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__ */
#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
#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)
{
* 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"
GHashTable *hash;
};
-#endif /* __IOT_CONNECTIVITY_LIBRARY_QUERY_H__ */
+#endif /* __IOTCON_INTERNAL_QUERY_H__ */
#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)
* 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)
#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,
#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 */
* 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;
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__ */
#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);
* 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;
iotcon_representation_h repr2);
-#endif /* __IOT_CONNECTIVITY_LIBRARY_REPRESENTATION_H__ */
+#endif /* __IOTCON_INTERNAL_REPRESENTATION_H__ */
* 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)
* 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"
int64_t oic_resource_h;
};
-#endif /* __IOT_CONNECTIVITY_LIBRARY_REQUEST_H__ */
+#endif /* __IOTCON_INTERNAL_REQUEST_H__ */
#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)
* 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"
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__ */
#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)
{
* 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.
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__ */
#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)
{
* 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>
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__*/
#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)
* 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"
int64_t oic_resource_h;
};
-#endif /* __IOT_CONNECTIVITY_LIBRARY_RESPONSE_H__ */
+#endif /* __IOTCON_INTERNAL_RESPONSE_H__ */
#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)
{
* 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;
void icl_destroy_request_container(icl_request_container_s *cb_container);
-#endif /*__IOT_CONNECTIVITY_LIBRARY_TYPES_H__*/
+#endif /*__IOTCON_INTERNAL_TYPES_H__*/
* 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"
IC_UTILS_COND_MAX
};
-#endif /* __IOT_CONNECTIVITY_INTERNAL_COMMON_UTILITY_H__ */
+#endif /* __IOTCON_INTERNAL_UTILITY_H__ */
#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)
{
* 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>
iotcon_value_h icl_value_clone(iotcon_value_h src);
-#endif /* __IOT_CONNECTIVITY_LIBRARY_VALUE_H__ */
+#endif /* __IOTCON_INTERNAL_VALUE_H__ */
#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 */
* 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"
int icl_initialize(const char *file_path, bool is_pt);
-#endif /* __IOT_CONNECTIVITY_LIBRARY_H__ */
+#endif /* __IOTCON_INTERNAL_H__ */
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")
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})
* 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
} \
} while (0)
-#endif /* __IOT_CONNECTIVITY_TEST_H__ */
+#endif /* __IOTCON_TEST_H__ */