(ACR) Modify Document
authoryoungman <yman.jung@samsung.com>
Mon, 26 Oct 2015 04:28:31 +0000 (13:28 +0900)
committeryoungman <yman.jung@samsung.com>
Tue, 3 Nov 2015 11:08:20 +0000 (20:08 +0900)
Change-Id: If4943d541ff83601132ac972365f635ce95ac9e4
Signed-off-by: youngman <yman.jung@samsung.com>
25 files changed:
.gitignore
doc/iotcon_doc.h
lib/icl-dbus-type.c
lib/icl-remote-resource.c
lib/icl-remote-resource.h
lib/include/iotcon-client.h [new file with mode: 0644]
lib/include/iotcon-constant.h
lib/include/iotcon-errors.h
lib/include/iotcon-internal.h
lib/include/iotcon-list.h [new file with mode: 0644]
lib/include/iotcon-lite-resource.h [new file with mode: 0644]
lib/include/iotcon-notimsg.h [new file with mode: 0644]
lib/include/iotcon-observers.h [new file with mode: 0644]
lib/include/iotcon-options.h [new file with mode: 0644]
lib/include/iotcon-query.h [new file with mode: 0644]
lib/include/iotcon-remote-resource.h [new file with mode: 0644]
lib/include/iotcon-representation.h
lib/include/iotcon-request.h [new file with mode: 0644]
lib/include/iotcon-resource-types.h [new file with mode: 0644]
lib/include/iotcon-resource.h [new file with mode: 0644]
lib/include/iotcon-response.h [new file with mode: 0644]
lib/include/iotcon-server.h [new file with mode: 0644]
lib/include/iotcon-state.h [new file with mode: 0644]
lib/include/iotcon-struct.h
lib/include/iotcon.h

index 795775b..40dc38e 100644 (file)
@@ -5,3 +5,12 @@ cscope.out
 .project
 common/ic-dbus.c
 common/ic-dbus.h
+Doxyfile
+docs_mobile
+doxygen_html_stylesheet.css
+footer.html
+html/
+latex/
+ref_config_mobile
+ref_layout.xml
+
index 79efc27..6c1235e 100644 (file)
@@ -30,6 +30,8 @@
  * The Iotcon API provides to register resources, discover resources and access them via
  * RESTful API.\n\n
  *
+ * @addtogroup CAPI_IOT_CONNECTIVITY_SERVER_MODULE
+ * @{
  * @subsection CAPI_IOT_CONNECTIVITY_MODULE_RESOURCE Resource
  * A Resource is a component in a server that can be viewed and conrolled by another client.\n
  * There are different resource types, for example a temperature sensor, a light controller etc.\n\n
@@ -140,7 +142,10 @@ static void _request_handler(iotcon_request_h request, void *user_data)
        iotcon_resource_types_destroy(resource_types);
 }
  * @endcode
+ * @}
  *
+ * @addtogroup CAPI_IOT_CONNECTIVITY_CLIENT_MODULE
+ * @{
  * @subsection CAPI_IOT_CONNECTIVITY_MODULE_FINDING_RESOURCE Finding a resource.
  * This operation returns all resources of given type on the network service.\n
  * This operation is sent via multicast to all services.\n
@@ -212,7 +217,10 @@ static void _found_resource(iotcon_remote_resource_h resource, void *user_data)
        }
 }
  * @endcode
+ * @}
  *
+ * @addtogroup CAPI_IOT_CONNECTIVITY_SERVER_MODULE
+ * @{
  * @subsection CAPI_IOT_CONNECTIVITY_MODULE_OBSERVING_RESOURCE Observing resource
  * This operation fetches and registers as an observer for the value of simple specific resource.\n
  * An observable resource can handle any number of observers.\n
@@ -349,218 +357,8 @@ static void _on_observe(iotcon_options_h header_options, iotcon_representation_h
                return;
 }
  * @endcode
+ * @}
  *
- * @subsection CAPI_IOT_CONNECTIVITY_MODULE_SERVER_CLIENT_OPERATIONS Server / client operations
- * Server operations should be called in server mode.\n
- * Client operations should be called in client mode.\n
- * Both mode can call both operations.
- * <div><table class="doxtable">
- *     <tr>
- *         <td><b>Server</b></td>
- *         <td><b>Client</b></td>
- *     </tr>
- *     <tr>
- *         <td>iotcon_resource_create</td>
- *         <td>iotcon_get_device_info</td>
- *     </tr>
- *     <tr>
- *         <td>iotcon_resource_destroy</td>
- *         <td>iotcon_subscribe_presence</td>
- *     </tr>
- *     <tr>
- *         <td>iotcon_resource_bind_interface</td>
- *         <td>iotcon_unsubscribe_presence</td>
- *     </tr>
- *     <tr>
- *         <td>iotcon_resource_bind_type</td>
- *         <td>iotcon_find_resource</td>
- *     </tr>
- *     <tr>
- *         <td>iotcon_resource_bind_request_handler</td>
- *         <td>iotcon_remote_resource_observer_start</td>
- *     </tr>
- *     <tr>
- *         <td>iotcon_resource_bind_child_resource</td>
- *         <td>iotcon_remote_resource_observer_stop</td>
- *     </tr>
- *     <tr>
- *         <td>iotcon_resource_unbind_child_resource</td>
- *         <td>iotcon_remote_resource_get</td>
- *     </tr>
- *     <tr>
- *         <td>iotcon_response_send</td>
- *         <td>iotcon_remote_resource_put</td>
- *     </tr>
- *     <tr>
- *         <td>iotcon_resource_notify</td>
- *         <td>iotcon_remote_resource_post</td>
- *     </tr>
- *     <tr>
- *         <td></td>
- *         <td>iotcon_remote_resource_delete</td>
- *     </tr>
- * </table></div>
- *
- */
-
-/**
- * @ingroup CAPI_IOT_CONNECTIVITY_MODULE
- * @defgroup CAPI_IOT_CONNECTIVITY_REPRESENTATION_MODULE Iotcon Representation
- *
- * @section CAPI_IOT_CONNECTIVITY_REPRESENTATION_MODULE_HEADER Required Header
- * \#include <iotcon-resp_repr.h>
- *
- * @section CAPI_IOT_CONNECTIVITY_REPRESENTATION_MODULE_OVERVIEW Overview
- * The Iotcon Representation API provides data type of resp_repr handling.\n
- * A resp_repr is a payload of a request or a response.\n
- * It has uri_path, interface, list of resource types and its attributes.\n
- * Attributes have capabilties to store and retrieve integer, boolean, double, string, list, null,
- * resp_repr.\n
- * A list is a container that includes number of datas of same type.\n
- * It has capabilties to store and retrieve integer, boolean, double, string, list, null, resp_repr.
- *
- *@code
-#include <iotcon.h>
-...
-{
-       int ret;
-       iotcon_representation_h repr;
-       iotcon_resource_types_h types;
-       iotcon_list_h bright_step_list;
-
-       ret = iotcon_representation_create(&resp_repr);
-       if (IOTCON_ERROR_NONE != ret) {
-               return;
-       }
-
-       ret = iotcon_representation_set_uri_path(resp_repr, "/a/light");
-       if (IOTCON_ERROR_NONE != ret) {
-               iotcon_representation_destroy(resp_repr);
-               return;
-       }
-
-       ret = iotcon_resource_types_create(&types);
-       if (IOTCON_ERROR_NONE != ret) {
-               iotcon_representation_destroy(resp_repr);
-               return;
-       }
-
-       ret = iotcon_resource_types_add(types, "core.light");
-       if (IOTCON_ERROR_NONE != ret) {
-               iotcon_resource_types_destroy(types);
-               iotcon_representation_destroy(resp_repr);
-               return;
-       }
-
-       ret = iotcon_representation_set_resource_types(resp_repr, types);
-       if (IOTCON_ERROR_NONE != ret) {
-               iotcon_resource_types_destroy(types);
-               iotcon_representation_destroy(resp_repr);
-               return;
-       }
-
-       ret = iotcon_representation_set_resource_interfaces(resp_repr, IOTCON_INTERFACE_LINK);
-       if (IOTCON_ERROR_NONE != ret) {
-               iotcon_resource_types_destroy(types);
-               iotcon_representation_destroy(resp_repr);
-               return;
-       }
-
-       ret = iotcon_state_set_str(resp_repr, "type", "lamp");
-       if (IOTCON_ERROR_NONE != ret) {
-               iotcon_resource_types_destroy(types);
-               iotcon_representation_destroy(resp_repr);
-               return;
-       }
-
-       ret = iotcon_state_set_str(resp_repr, "where", "desk");
-       if (IOTCON_ERROR_NONE != ret) {
-               iotcon_resource_types_destroy(types);
-               iotcon_representation_destroy(resp_repr);
-               return;
-       }
-
-       ret = iotcon_state_set_double(resp_repr, "default_bright", 200.0);
-       if (IOTCON_ERROR_NONE != ret) {
-               iotcon_resource_types_destroy(types);
-               iotcon_representation_destroy(resp_repr);
-               return;
-       }
-
-       ret = iotcon_state_set_str(resp_repr, "unit", "lux");
-       if (IOTCON_ERROR_NONE != ret) {
-               iotcon_resource_types_destroy(types);
-               iotcon_representation_destroy(resp_repr);
-               return;
-       }
-
-       ret = iotcon_state_set_bool(resp_repr, "bright_step", true);
-       if (IOTCON_ERROR_NONE != ret) {
-               iotcon_resource_types_destroy(types);
-               iotcon_representation_destroy(resp_repr);
-               return;
-       }
-
-       ret = iotcon_list_create(IOTCON_TYPE_DOUBLE, &bright_step_list);
-       if (IOTCON_ERROR_NONE != ret) {
-               iotcon_resource_types_destroy(types);
-               iotcon_representation_destroy(resp_repr);
-               return;
-       }
-
-       ret = iotcon_list_add_double(bright_step_list, 100.0, -1);
-       if (IOTCON_ERROR_NONE != ret) {
-               iotcon_list_destroy(bright_step_list);
-               iotcon_resource_types_destroy(types);
-               iotcon_representation_destroy(resp_repr);
-               return;
-       }
-
-       ret = iotcon_list_add_double(bright_step_list, 200.0, -1);
-       if (IOTCON_ERROR_NONE != ret) {
-               iotcon_list_destroy(bright_step_list);
-               iotcon_resource_types_destroy(types);
-               iotcon_representation_destroy(resp_repr);
-               return;
-       }
-
-       ret = iotcon_list_add_double(bright_step_list, 300.0, -1);
-       if (IOTCON_ERROR_NONE != ret) {
-               iotcon_list_destroy(bright_step_list);
-               iotcon_resource_types_destroy(types);
-               iotcon_representation_destroy(resp_repr);
-               return;
-       }
-
-       ret = iotcon_list_add_double(bright_step_list, 400.0, -1);
-       if (IOTCON_ERROR_NONE != ret) {
-               iotcon_list_destroy(bright_step_list);
-               iotcon_resource_types_destroy(types);
-               iotcon_representation_destroy(resp_repr);
-               return;
-       }
-
-       ret = iotcon_list_add_double(bright_step_list, 500.0, -1);
-       if (IOTCON_ERROR_NONE != ret) {
-               iotcon_list_destroy(bright_step_list);
-               iotcon_resource_types_destroy(types);
-               iotcon_representation_destroy(resp_repr);
-               return;
-       }
-
-       ret = iotcon_state_set_list(resp_repr, "bright_step_list", bright_step_list);
-       if (IOTCON_ERROR_NONE != ret) {
-               iotcon_list_destroy(bright_step_list);
-               iotcon_resource_types_destroy(types);
-               iotcon_representation_destroy(resp_repr);
-               return;
-       }
-
-       iotcon_list_destroy(bright_step_list);
-       iotcon_resource_types_destroy(types);
-       iotcon_representation_destroy(resp_repr);
-}
- * @endcode
  */
 
 #endif /* __TIZEN_NETWORK_IOTCON_DOC_H__ */
index c67f268..b9c32f9 100644 (file)
@@ -132,7 +132,7 @@ GVariant* icl_dbus_remote_resource_to_gvariant(struct icl_remote_resource *resou
                }
        }
 
-       value = g_variant_new("(ssba(qs)i)", resource->uri_path, resource->host,
+       value = g_variant_new("(ssba(qs)i)", resource->uri_path, resource->host_address,
                        resource->is_secure, &options, resource->connectivity_type);
 
        return value;
index 4056f5c..e807388 100644 (file)
@@ -160,7 +160,7 @@ API int iotcon_find_resource(const char *host_address,
 
 
 /* If you know the information of resource, then you can make a proxy of the resource. */
-API int iotcon_remote_resource_create(const char *host,
+API int iotcon_remote_resource_create(const char *host_address,
                iotcon_connectivity_type_e connectivity_type,
                const char *uri_path,
                bool is_observable,
@@ -171,7 +171,7 @@ API int iotcon_remote_resource_create(const char *host,
        FN_CALL;
        iotcon_remote_resource_h resource = NULL;
 
-       RETV_IF(NULL == host, IOTCON_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == host_address, IOTCON_ERROR_INVALID_PARAMETER);
        RETV_IF(NULL == uri_path, IOTCON_ERROR_INVALID_PARAMETER);
        RETV_IF(NULL == resource_types, IOTCON_ERROR_INVALID_PARAMETER);
        RETV_IF(NULL == resource_handle, IOTCON_ERROR_INVALID_PARAMETER);
@@ -182,7 +182,7 @@ API int iotcon_remote_resource_create(const char *host,
                return IOTCON_ERROR_OUT_OF_MEMORY;
        }
 
-       resource->host = ic_utils_strdup(host);
+       resource->host_address = ic_utils_strdup(host_address);
        resource->connectivity_type = connectivity_type;
        resource->uri_path = ic_utils_strdup(uri_path);
        resource->is_observable = is_observable;
@@ -210,7 +210,7 @@ API void iotcon_remote_resource_destroy(iotcon_remote_resource_h resource)
                iotcon_remote_resource_stop_monitoring(resource);
 
        free(resource->uri_path);
-       free(resource->host);
+       free(resource->host_address);
        free(resource->device_id);
        iotcon_resource_types_destroy(resource->types);
 
@@ -261,7 +261,7 @@ API int iotcon_remote_resource_clone(iotcon_remote_resource_h src,
        }
 
        resource->uri_path = ic_utils_strdup(src->uri_path);
-       resource->host = ic_utils_strdup(src->host);
+       resource->host_address = ic_utils_strdup(src->host_address);
        resource->connectivity_type = src->connectivity_type;
        resource->device_id = ic_utils_strdup(src->device_id);
        resource->is_secure = src->is_secure;
@@ -310,12 +310,12 @@ API int iotcon_remote_resource_get_uri_path(iotcon_remote_resource_h resource,
 
 /* The content of the resource should not be freed by user. */
 API int iotcon_remote_resource_get_host_address(iotcon_remote_resource_h resource,
-               char **host)
+               char **host_address)
 {
        RETV_IF(NULL == resource, IOTCON_ERROR_INVALID_PARAMETER);
-       RETV_IF(NULL == host, IOTCON_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == host_address, IOTCON_ERROR_INVALID_PARAMETER);
 
-       *host = resource->host;
+       *host_address = resource->host_address;
 
        return IOTCON_ERROR_NONE;
 }
index a4311df..49cde6a 100644 (file)
@@ -55,7 +55,7 @@ typedef struct icl_remote_resource_monitoring* icl_remote_resource_monitoring_h;
 
 struct icl_remote_resource {
        char *uri_path;
-       char *host;
+       char *host_address;
        char *device_id;
        bool is_secure;
        bool is_observable;
diff --git a/lib/include/iotcon-client.h b/lib/include/iotcon-client.h
new file mode 100644 (file)
index 0000000..0ceb1d0
--- /dev/null
@@ -0,0 +1,382 @@
+/*
+ * Copyright (c) 2015 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.
+ */
+#ifndef __IOT_CONNECTIVITY_MANAGER_CLIENT_H__
+#define __IOT_CONNECTIVITY_MANAGER_CLIENT_H__
+
+#include <iotcon-constant.h>
+#include <iotcon-remote-resource.h>
+
+/**
+ * @file iotcon-client.h
+ */
+
+/**
+ * @ingroup CAPI_IOT_CONNECTIVITY_MODULE
+ * @defgroup CAPI_IOT_CONNECTIVITY_CLIENT_MODULE Client
+ *
+ * @brief Iotcon Client provides API for client side.
+ *
+ * @section CAPI_IOT_CONNECTIVITY_CLIENT_MODULE_HEADER Header
+ *  \#include <iotcon.h>
+ *
+ * @section CAPI_IOT_CONNECTIVITY_CLIENT_MODULE_OVERVIEW Overview
+ * This API set consists of client side API for @ref CAPI_IOT_CONNECTIVITY_CLIENT_REMOTE_RESOURCE_MODULE.
+ *
+ * @{
+ */
+
+/**
+ * @brief Specifies the type of function passed to iotcon_subscribe_presence().
+ * @details Called when client receive presence events from the server.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] result The result code of server's presence
+ * @param[in] nonce Current nonce of server's presence
+ * @param[in] host_address The address or addressable name of server
+ * @param[in] user_data The user data to pass to the function
+ *
+ * @pre The callback must be registered using iotcon_subscribe_presence()
+ *
+ * @see iotcon_subscribe_presence()
+ */
+typedef void (*iotcon_presence_cb)(int result, unsigned int nonce,
+               const char *host_address, void *user_data);
+
+/**
+ * @brief Subscribes to a server to receive presence events.
+ * @details Request to receive presence to an interested server's resource with @a resource_type.\n
+ * If succeed to subscribe, iotcon_presence_cb() will be invoked when the server sends presence\n
+ * A server sends presence events when adds/removes/alters a resource or start/stop presence.
+ *
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/internet
+ *
+ * @param[in] host_address The address or addressable name of the server
+ * @param[in] connectivity_type The connectivity type
+ * @param[in] resource_type A resource type that a client has interested in
+ * @param[in] cb The callback function to invoke
+ * @param[in] user_data The user data to pass to the function
+ * @param[out] presence_handle The generated presence handle
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_IOTIVITY  Iotivity errors
+ * @retval #IOTCON_ERROR_DBUS  Dbus errors
+ * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
+ * @retval #IOTCON_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @post When the resource receive presence, iotcon_presence_cb() will be called.
+ *
+ * @see iotcon_start_presence()
+ * @see iotcon_stop_presence()
+ * @see iotcon_unsubscribe_presence()
+ * @see iotcon_presence_cb()
+ */
+int iotcon_subscribe_presence(const char *host_address,
+               iotcon_connectivity_type_e connectivity_type,
+               const char *resource_type,
+               iotcon_presence_cb cb,
+               void *user_data,
+               iotcon_presence_h *presence_handle);
+
+/**
+ * @brief Unsubscribes to a server's presence events.
+ * @details Request not to receive server's presence any more.
+ *
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/internet
+ *
+ * @param[in] presence_handle The presence handle to be unsubscribed
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_DBUS  Dbus error
+ * @retval #IOTCON_ERROR_SYSTEM System error
+ * @retval #IOTCON_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @see iotcon_start_presence()
+ * @see iotcon_stop_presence()
+ * @see iotcon_subscribe_presence()
+ * @see iotcon_presence_cb()
+ */
+int iotcon_unsubscribe_presence(iotcon_presence_h presence_handle);
+
+/**
+ * @brief Specifies the type of function passed to iotcon_find_resource().
+ * @details Called when a resource is found from the remote server.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] resource The handle of resource which is found
+ * @param[in] result The result code (Lesser than 0 on fail, otherwise a response result value)
+ * @param[in] user_data The user data to pass to the function
+ *
+ * @pre The callback must be registered using iotcon_find_resource()
+ *
+ * @see iotcon_find_resource()
+ */
+typedef void (*iotcon_found_resource_cb)(iotcon_remote_resource_h resource, int result,
+               void *user_data);
+
+/**
+ * @brief Finds resources.
+ * @details Request to find a resource of @a host_address server with @a resource_type.\n
+ * If succeed to find the resource, iotcon_found_resource_cb() will be invoked with
+ * information of the resource.
+ *
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/internet
+ *
+ * @param[in] host_address The address or addressable name of server
+ * @param[in] connectivity_type The connectivity type
+ * @param[in] resource_type The resource type specified as a filter for the resource
+ * @param[in] cb The callback function to invoke
+ * @param[in] user_data The user data to pass to the function
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_DBUS  Dbus error
+ * @retval #IOTCON_ERROR_SYSTEM System error
+ * @retval #IOTCON_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @post When the resource is found, iotcon_found_resource_cb() will be called.
+ *
+ * @see iotcon_found_resource_cb()
+ */
+int iotcon_find_resource(const char *host_address,
+               iotcon_connectivity_type_e connectivity_type,
+               const char *resource_type,
+               iotcon_found_resource_cb cb,
+               void *user_data);
+
+/**
+ * @brief Specifies the type of function passed to iotcon_get_device_info().
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] device_info the device information from remote server.
+ * @param[in] result The result code (0 on success, other wise a negative error value)
+ * @param[in] user_data The user data to pass to the function
+ *
+ * @pre iotcon_get_device_info() will invoke this callback function.
+ *
+ * @see iotcon_get_device_info()
+ * @see iotcon_device_info_get_property()
+ */
+typedef void (*iotcon_device_info_cb)(iotcon_device_info_h device_info, int result,
+               void *user_data);
+
+/**
+ * @brief Calls a function for device information of remote server.
+ * @details Request device information to server and pass the information by calling
+ * iotcon_device_info_cb().\n
+ * iotcon_device_info_cb() will be called when success on getting device information.
+ *
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/internet
+ *
+ * @param[in] host_address The host address of remote server
+ * @param[in] connectivity_type The connectivity type
+ * @param[in] cb The callback function to invoke
+ * @param[in] user_data The user data to pass to the function
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_DBUS  Dbus error
+ * @retval #IOTCON_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #IOTCON_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @post iotcon_device_info_cb() will be called when success on getting device information.
+ *
+ * @see iotcon_device_info_cb()
+ * @see iotcon_device_info_get_property()
+ */
+int iotcon_get_device_info(const char *host_address,
+               iotcon_connectivity_type_e connectivity_type,
+               iotcon_device_info_cb cb,
+               void *user_data);
+
+/**
+ * @brief Get device properties from the device information handle
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] device_info The handle of the device information
+ * @param[in] property The properties of the device information
+ * @param[out] value The value of the property
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ *
+ * @see iotcon_device_info_cb()
+ * @see iotcon_get_device_info()
+ */
+int iotcon_device_info_get_property(iotcon_device_info_h device_info,
+               iotcon_device_info_e property, char **value);
+
+/**
+ * @brief Specifies the type of function passed to iotcon_get_platform_info().
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] platform_info The platform information from remote server.
+ * @param[in] result The result code (0 on success, other wise a negative error value)
+ * @param[in] user_data The user data to pass to the function
+ *
+ * @pre iotcon_get_platform_info() will invoke this callback function.
+ *
+ * @see iotcon_get_platform_info()
+ * @see iotcon_platform_info_get_property()
+ */
+typedef void (*iotcon_platform_info_cb)(iotcon_platform_info_h platform_info, int result,
+               void *user_data);
+
+/**
+ * @brief Calls a function for platform information of remote server.
+ * @details Request platform information to server and pass the information by calling
+ * iotcon_platform_info_cb().\n
+ * iotcon_platform_info_cb() will be called when success on getting device information.
+ *
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/internet
+ *
+ * @param[in] host_address The host address of remote server
+ * @param[in] connectivity_type The connectivity type
+ * @param[in] cb The callback function to invoke
+ * @param[in] user_data The user data to pass to the function
+ *
+ * @return  0 on success, otherwise a negative error value.
+ *
+ * @retval #IOTCON_ERROR_NONE Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_DBUS  Dbus error
+ * @retval #IOTCON_ERROR_SYSTEM System error
+ * @retval #IOTCON_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #IOTCON_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @post iotcon_platform_info_cb() will be called when success on getting device information.
+ *
+ * @see iotcon_platform_info_cb()
+ * @see iotcon_platform_info_get_property()
+ */
+int iotcon_get_platform_info(const char *host_address,
+               iotcon_connectivity_type_e connectivity_type,
+               iotcon_platform_info_cb cb,
+               void *user_data);
+
+/**
+ * @brief Get platform properties from the platform information handle
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] platform_info The handle of the platform information
+ * @param[in] property The properties of the platform information
+ * @param[out] value The value of the property
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ *
+ * @see iotcon_platform_info_cb()
+ * @see iotcon_get_platform_info()
+ */
+int iotcon_platform_info_get_property(iotcon_platform_info_h platform_info,
+               iotcon_platform_info_e property, char **value);
+
+/**
+ * @brief Specifies the type of function passed to iotcon_get_tizen_info().
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] tizen_info The information of tizen device from remote server.
+ * @param[in] response_result The response result code (Lesser than 0 on fail, otherwise a response result value)
+ * @param[in] user_data The user data to pass to the function
+ *
+ * @pre iotcon_get_tizen_info() will invoke this callback function.
+ *
+ * @see iotcon_get_tizen_info()
+ * @see iotcon_tizen_info_get_property()
+ */
+typedef void (*iotcon_tizen_info_cb)(iotcon_tizen_info_h tizen_info,
+               int response_result, void *user_data);
+
+/**
+ * @brief Calls a function for tizen device information of remote server.
+ * @details Request tizen device information to server and pass the information by calling
+ * iotcon_tizen_info_cb().\n
+ * iotcon_tizen_info_cb() will be called when success on getting tizen device information.
+ *
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/internet
+ *
+ * @param[in] host_address The host address of remote server
+ * @param[in] connectivity_type The connectivity type
+ * @param[in] cb The callback function to invoke
+ * @param[in] user_data The user data to pass to the function
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_DBUS  Dbus error
+ * @retval #IOTCON_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #IOTCON_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @post iotcon_tizen_info_cb() will be called when success on getting tizen device information.
+ *
+ * @see iotcon_tizen_info_cb()
+ * @see iotcon_tizen_info_get_property()
+ */
+int iotcon_get_tizen_info(const char *host_address,
+               iotcon_connectivity_type_e connectivity_type,
+               iotcon_tizen_info_cb cb,
+               void *user_data);
+
+/**
+ * @brief Get tizen device properties from the tizen device information handle
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] tizen_info The handle of the tizen device information
+ * @param[in] property The properties of the tizen device information
+ * @param[out] value The value of the property
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ *
+ * @see iotcon_tizen_info_cb()
+ * @see iotcon_get_tizen_info()
+ */
+int iotcon_tizen_info_get_property(iotcon_tizen_info_h tizen_info,
+                               iotcon_tizen_info_e property, char **value);
+
+/**
+ * @}
+ */
+
+#endif /* __IOT_CONNECTIVITY_MANAGER_CLIENT_H__ */
index 3bcf0e3..de5df10 100644 (file)
 #define __IOT_CONNECTIVITY_MANAGER_CONSTANT_H__
 
 /**
- * @addtogroup CAPI_IOT_CONNECTIVITY_MODULE
+ * @file iotcon-constant.h
+ */
+
+/**
+ * @ingroup CAPI_IOT_CONNECTIVITY_MODULE
+ * @defgroup CAPI_IOT_CONNECTIVITY_COMMON_MODULE Common
+ *
+ * @brief Iotcon Common API provides the set of definitions to use server and client API.
+ *
+ * @section CAPI_IOT_CONNECTIVITY_COMMON_MODULE_HEADER Header
+ *  \#include <iotcon.h>
+ *
+ * @section CAPI_IOT_CONNECTIVITY_COMMON_MODULE_OVERVIEW Overview
+ * This API set consists of data structures for @ref CAPI_IOT_CONNECTIVITY_COMMON_RESOURCE_TYPES_MODULE,
+ * @ref CAPI_IOT_CONNECTIVITY_COMMON_QUERY_MODULE, @ref CAPI_IOT_CONNECTIVITY_COMMON_OPTIONS_MODULE,
+ * @ref CAPI_IOT_CONNECTIVITY_COMMON_REPRESENTATION_MODULE, @ref CAPI_IOT_CONNECTIVITY_COMMON_LIST_MODULE,
+ * @ref CAPI_IOT_CONNECTIVITY_COMMON_STATE_MODULE.
  *
  * @{
  */
 
 /**
+ * @brief The handle of resource.
+ * @details iotcon_resource_h is an opaque data structure to represent registered\n
+ * resource by server. A resource has host_address, uri_path, resource types, interfaces\n
+ * and internal handle. If observable attribute of resource is true, client can observe\n
+ * this resource. When client request by CRUD functions, handler will be invoked\n
+ * if registered. It could contain other resource as children.\n
+ *
+ * @since_tizen 3.0
+ */
+typedef struct icl_resource* iotcon_resource_h;
+
+/**
+ * @brief The handle of lite resource.
+ * @details iotcon_lite_resource_h is an opaque data structure to represent registered\n
+ * resource by server. A resource has host_address, uri_path, resource types, and internal\n
+ * handle. If observable attribute of resource is true, client can observe\n
+ * this resource. When client request by GET / PUT / OBSERVE functions, handler will be\n
+ * invoked, internally. Then, it sends the response to client, automatically.
+ *
+ * @since_tizen 3.0
+ */
+typedef struct icl_lite_resource* iotcon_lite_resource_h;
+
+/**
+ * @brief The handle of notifications message.
+ * @details iotcon_notimsg_h is an opaque data structure to notify message to observers.
+ *
+ * @since_tizen 3.0
+ */
+typedef struct icl_notify_msg* iotcon_notimsg_h;
+
+/**
+* @brief The handle of response
+* @details iotcon_response_h is an opaque data structure to respond to client.\n
+* iotcon_response_h is a data type of server's response which consists of result,
+* header options, query, representation.
+*
+*
+* @since_tizen 3.0
+*/
+typedef struct icl_resource_response* iotcon_response_h;
+
+/**
+ * @brief The handle of observers.
+ * @details The list of observer ids.
+ *
+ * @since_tizen 3.0
+ */
+typedef struct icl_observers* iotcon_observers_h;
+
+/**
+* @brief The handle of request
+* @details iotcon_request_h is an opaque data structure to request to a particular resource.\n
+* iotcon_request_h is a data type of client's request which consists of header options,
+* query, representation.
+*
+* @since_tizen 3.0
+*/
+typedef struct icl_resource_request* iotcon_request_h;
+
+/**
+ * @brief The handle of remote resource
+ * @details When Client success to find out resource from remote server,
+ * server's resource information is reorganized as iotcon_remote_resource_h by Iotcon.
+ * Client can request CRUD to server by using this.\n
+ * iotcon_remote_resource_h is an opaque data structure to have host_address, uri_path,\n
+ * resource types, interfaces, options and device id.\n
+ * If observable attribute is true, remote resource is observable.\n
+ * When you observe remote resource, observe_handle will be set.
+ *
+ * @since_tizen 3.0
+ */
+typedef struct icl_remote_resource* iotcon_remote_resource_h;
+
+/**
+ * @brief The handle of presence.
+ * @details iotcon_presence_h is a handle of presence subscription.\n
+ * It is used to cancel presence.
+ *
+ * @since_tizen 3.0
+ */
+typedef struct icl_presence* iotcon_presence_h;
+
+/**
+ * @brief The handle of device information.
+ * @details iotcon_device_info_h is a handle of device information.\n
+ *
+ * @since_tizen 3.0
+ */
+typedef struct icl_device_info* iotcon_device_info_h;
+
+/**
+ * @brief The handle of platform information.
+ * @details iotcon_platform_info_h is a handle of platform information.\n
+ *
+ * @since_tizen 3.0
+ */
+typedef struct icl_platform_info* iotcon_platform_info_h;
+
+/**
+ * @brief The handle of tizen device information.
+ * @details iotcon_tizen_info_h is a handle of tizen device information.\n
+ *
+ * @since_tizen 3.0
+ */
+typedef struct icl_tizen_info* iotcon_tizen_info_h;
+
+/**
+ * @brief The handle of resource types
+ * @details iotcon_resource_types_h is an opaque data structure to have list\n
+ * of resource types. A resource type is datatype of string.
+ *
+ * @since_tizen 3.0
+ */
+typedef struct icl_resource_types* iotcon_resource_types_h;
+
+/**
+ * @brief The handle of options
+ * @details iotcon_options_h is an opaque data structure to have attribute value map
+ * which consists of a key and a value.\n
+ * Datatype of key is integer and value is string.\n
+ *
+ * @since_tizen 3.0
+ */
+typedef struct icl_options* iotcon_options_h;
+
+/**
+ * @brief The handle of query
+ * @details iotcon_query_h is an opaque data structure to have attribute value map
+ * which consists of key and value.\n
+ * Data ype of both key and value are string.\n
+ * iotcon_query_h also have length.\n
+ * The length is total length of all keys and values of map.\n
+ * The length should be less than or equal to 64.
+ *
+ * @since_tizen 3.0
+ */
+typedef struct icl_query* iotcon_query_h;
+
+/**
+ * @brief The handle of representation.
+ * @details iotcon_representation_h is an opaque data structure to have uri_path,\n
+ * list of resource types and interfaces.\n
+ * It could contain other representation as children.\n
+ *
+ * @since_tizen 3.0
+ */
+typedef struct icl_representation_s* iotcon_representation_h;
+
+/**
+ * @brief The handle of list which is consist of iotcon_value_h type values.
+ * @details iotcon_list_h is an opaque data structure to have iotcon_value_h type values.
+ *
+ * @since_tizen 3.0
+ */
+typedef struct icl_list_s* iotcon_list_h;
+
+/**
+ * @brief The handle of state.
+ * @details iotcon_state_h is an opaque data structure to have attribute value map.\n
+ * Attribute value map consists of a key and a value.\n
+ * Datatype of the key is string and the value should be one of them\n
+ * #IOTCON_TYPE_INT\n
+ * #IOTCON_TYPE_BOOL\n
+ * #IOTCON_TYPE_DOUBLE\n
+ * #IOTCON_TYPE_STR\n
+ * #IOTCON_TYPE_NULL\n
+ * #IOTCON_TYPE_LIST\n
+ * #IOTCON_TYPE_STATE
+ *
+ * @since_tizen 3.0
+ */
+typedef struct icl_state_s* iotcon_state_h;
+
+/**
  * @brief The IP Address for multicast.
  *
  * @since_tizen 3.0
index d91e24a..a2f6f48 100644 (file)
 #endif
 
 /**
+ * @file iotcon-errors.h
+ */
+
+/**
  * @ingroup CAPI_IOT_CONNECTIVITY_MODULE
  * @brief Enumeration for Iotcon error code.
  * @since_tizen 3.0
+ *
+ * @{
  */
 typedef enum
 {
@@ -45,4 +51,8 @@ typedef enum
        IOTCON_ERROR_SYSTEM = TIZEN_ERROR_IOTCON | 0x06, /**< System errors */
 }iotcon_error_e;
 
+/**
+ * @}
+ */
+
 #endif /* __IOT_CONNECTIVITY_MANAGER_ERRORS_H__ */
index 5287c60..39543ec 100644 (file)
@@ -72,7 +72,6 @@ int iotcon_start_presence(unsigned int time_to_live);
  */
 int iotcon_stop_presence(void);
 
-
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib/include/iotcon-list.h b/lib/include/iotcon-list.h
new file mode 100644 (file)
index 0000000..50ade26
--- /dev/null
@@ -0,0 +1,579 @@
+/*
+ * Copyright (c) 2015 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.
+ */
+#ifndef __IOT_CONNECTIVITY_MANAGER_STRUCT_LIST_H__
+#define __IOT_CONNECTIVITY_MANAGER_STRUCT_LIST_H__
+
+#include <stdbool.h>
+#include <iotcon-constant.h>
+
+/**
+ * @file iotcon-list.h
+ */
+
+/**
+ * @ingroup CAPI_IOT_CONNECTIVITY_COMMON_MODULE
+ * @defgroup CAPI_IOT_CONNECTIVITY_COMMON_LIST_MODULE List
+ *
+ * @brief Iotcon List provides API to get data from list and set data to list.
+ *
+ * @section CAPI_IOT_CONNECTIVITY_COMMON_MODULE_HEADER Header
+ *  \#include <iotcon.h>
+ *
+ * @{
+ */
+
+/**
+ * @brief Creates a new list handle.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] type The type of list
+ * @param[out] list A newly allocated list handle
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_INVALID_TYPE  Invalid type
+ */
+int iotcon_list_create(iotcon_types_e type, iotcon_list_h *list);
+
+/**
+ * @brief Frees a list handle.
+ * @details Releases a @a list and its internal data.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] list The handle to the list
+ *
+ * @return void
+ */
+void iotcon_list_destroy(iotcon_list_h list);
+
+/**
+ * @brief Inserts a new element integer value into the list at the given position.
+ * @details If @a pos is negative, or is larger than the number of elements in the list,
+ * the new value is added on to the end of the list.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] list The list handle
+ * @param[in] val The new integer value
+ * @param[in] pos The position to insert value
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_INVALID_TYPE  Invalid type
+ */
+int iotcon_list_add_int(iotcon_list_h list, int val, int pos);
+
+/**
+ * @brief Inserts a new element boolean value into the list at the given position.
+ * @details If @a pos is negative, or is larger than the number of elements in the list,
+ * the new value is added on to the end of the list.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] list The list handle
+ * @param[in] val The new boolean value
+ * @param[in] pos The position to insert value
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_INVALID_TYPE  Invalid type
+ */
+int iotcon_list_add_bool(iotcon_list_h list, bool val, int pos);
+
+/**
+ * @brief Inserts a new element double value into the list at the given position.
+ * @details If @a pos is negative, or is larger than the number of elements in the list,
+ * the new value is added on to the end of the list.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] list The list handle
+ * @param[in] val The new double value
+ * @param[in] pos The position to insert value
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_INVALID_TYPE  Invalid type
+ */
+int iotcon_list_add_double(iotcon_list_h list, double val, int pos);
+
+/**
+ * @brief Inserts a new element string value into the list at the given position.
+ * @details If @a pos is negative, or is larger than the number of elements in the list,
+ * the new value is added on to the end of the list.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] list The list handle
+ * @param[in] val The new char value
+ * @param[in] pos The position to insert value
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_INVALID_TYPE  Invalid type
+ */
+int iotcon_list_add_str(iotcon_list_h list, char *val, int pos);
+
+/**
+ * @brief Inserts a new element list into the list at the given position.
+ * @details If @a pos is negative, or is larger than the number of elements in the list,
+ * the new value is added on to the end of the list.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] list The list handle
+ * @param[in] val The new list value
+ * @param[in] pos The position to insert value
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_INVALID_TYPE  Invalid type
+ */
+int iotcon_list_add_list(iotcon_list_h list, iotcon_list_h val, int pos);
+
+/**
+ * @brief Inserts a new element state value into the list at the given position.
+ * @details If @a pos is negative, or is larger than the number of elements in the list,
+ * the new value is added on to the end of the list.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] list The list handle
+ * @param[in] val The new state value
+ * @param[in] pos The position to insert value
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_INVALID_TYPE  Invalid type
+ */
+int iotcon_list_add_state(iotcon_list_h list, iotcon_state_h val, int pos);
+
+/**
+ * @brief Gets the integer value at the given position.
+ * @details Iterates over the list until it reaches the @a pos-1 position.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] list The list handle
+ * @param[in] pos The position
+ * @param[out] val The integer value to get
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_NO_DATA  No data available
+ * @retval #IOTCON_ERROR_REPRESENTATION  Representation errors
+ */
+int iotcon_list_get_nth_int(iotcon_list_h list, int pos, int *val);
+
+/**
+ * @brief Gets the boolean value at the given position.
+ * @details Iterates over the list until it reaches the @a pos-1 position.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] list The list handle
+ * @param[in] pos The position
+ * @param[out] val The boolean value to get
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_NO_DATA  No data available
+ * @retval #IOTCON_ERROR_REPRESENTATION  Representation errors
+ */
+int iotcon_list_get_nth_bool(iotcon_list_h list, int pos, bool *val);
+
+/**
+ * @brief Gets the double value at the given position.
+ * @details Iterates over the list until it reaches the @a pos-1 position.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] list The list handle
+ * @param[in] pos The position
+ * @param[out] val The double value to get
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_NO_DATA  No data available
+ * @retval #IOTCON_ERROR_REPRESENTATION  Representation errors
+ */
+int iotcon_list_get_nth_double(iotcon_list_h list, int pos, double *val);
+
+/**
+ * @brief Gets the string value at the given position.
+ * @details Iterates over the list until it reaches the @a pos-1 position.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] list The list handle
+ * @param[in] pos The position
+ * @param[out] val The string value to get
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_NO_DATA  No data available
+ * @retval #IOTCON_ERROR_REPRESENTATION  Representation errors
+ */
+int iotcon_list_get_nth_str(iotcon_list_h list, int pos, char **val);
+
+/**
+ * @brief Gets the list value at the given position.
+ * @details Iterates over the list until it reaches the @a pos-1 position.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] src The list handle
+ * @param[in] pos The position
+ * @param[out] dest The list value to get
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_NO_DATA  No data available
+ * @retval #IOTCON_ERROR_REPRESENTATION  Representation errors
+ */
+int iotcon_list_get_nth_list(iotcon_list_h src, int pos, iotcon_list_h *dest);
+
+/**
+ * @brief Gets the state value at the given position.
+ * @details Iterates over the list until it reaches the @a pos-1 position.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] list The list handle
+ * @param[in] pos The position
+ * @param[out] state The state value to get
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_NO_DATA  No data available
+ * @retval #IOTCON_ERROR_REPRESENTATION  Representation errors
+ */
+int iotcon_list_get_nth_state(iotcon_list_h list, int pos, iotcon_state_h *state);
+
+/**
+ * @brief Deletes the value at the given position.
+ * @details Iterates over the list until it reaches the @a pos-1 position.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] list The list handle
+ * @param[in] pos The position to delete
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_NO_DATA  No data available
+ */
+int iotcon_list_remove_nth(iotcon_list_h list, int pos);
+
+/**
+ * @brief Gets the type of the list.
+ * @details It gets the data type of value related the @a key in @a state.
+ * The data type could be one of #iotcon_types_e.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] list The list handle
+ * @param[out] type The data type of list.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ */
+int iotcon_list_get_type(iotcon_list_h list, int *type);
+
+/**
+ * @brief Gets the number of elements in a list.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] list The handle to the list
+ * @param[out] length The length of list
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ */
+int iotcon_list_get_length(iotcon_list_h list, unsigned int *length);
+
+/**
+ * @brief Specifies the type of function passed to iotcon_list_foreach_int()
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] pos The number of the integer value (0 being the first)
+ * @param[in] value The integer value
+ * @param[in] user_data The user data to pass to the function
+ *
+ * @return #IOTCON_FUNC_CONTINUE to continue with the next function of the loop,
+ * otherwise #IOTCON_FUNC_STOP to break out of the loop
+ * @retval #IOTCON_FUNC_STOP  stop to call next function
+ * @retval #IOTCON_FUNC_CONTINUE  continue to call next function
+ *
+ * @pre iotcon_list_foreach_int() will invoke this callback function.
+ *
+ * @see iotcon_list_foreach_int()
+ */
+typedef int (*iotcon_list_int_cb)(int pos, int value, void *user_data);
+
+/**
+ * @brief Gets all integer values of the given list by invoking the callback function.
+ * @details iotcon_list_int_cb() will be called for each child.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] list The handle to the list
+ * @param[in] cb The callback function to get each integer value
+ * @param[in] user_data The user data to be passed to the callback function
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ *
+ * @post iotcon_list_int_cb() will be called for each item.
+ *
+ * @see iotcon_list_int_cb()
+ */
+int iotcon_list_foreach_int(iotcon_list_h list, iotcon_list_int_cb cb, void *user_data);
+
+/**
+ * @brief Specifies the type of function passed to iotcon_list_foreach_bool()
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] pos The number of the boolean value (0 being the first)
+ * @param[in] value The boolean value
+ * @param[in] user_data The user data to pass to the function
+ *
+ * @return #IOTCON_FUNC_CONTINUE to continue with the next function of the loop,
+ * otherwise #IOTCON_FUNC_STOP to break out of the loop
+ * @retval #IOTCON_FUNC_STOP  stop to call next function
+ * @retval #IOTCON_FUNC_CONTINUE  continue to call next function
+ *
+ * @pre iotcon_list_foreach_bool() will invoke this callback function.
+ *
+ * @see iotcon_list_foreach_bool()
+ */
+typedef int (*iotcon_list_bool_cb)(int pos, bool value, void *user_data);
+
+/**
+ * @brief Gets all boolean values of the given list by invoking the callback function.
+ * @details iotcon_list_bool_cb() will be called for each child.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] list The handle to the list
+ * @param[in] cb The callback function to get each boolean value
+ * @param[in] user_data The user data to be passed to the callback function
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ *
+ * @post iotcon_list_bool_cb() will be called for each item.
+ *
+ * @see iotcon_list_bool_cb()
+ */
+int iotcon_list_foreach_bool(iotcon_list_h list, iotcon_list_bool_cb cb, void *user_data);
+
+/**
+ * @brief Specifies the type of function passed to iotcon_list_foreach_double()
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] pos The number of the double value (0 being the first)
+ * @param[in] value The double value
+ * @param[in] user_data The user data to pass to the function
+ *
+ * @return #IOTCON_FUNC_CONTINUE to continue with the next function of the loop,
+ * otherwise #IOTCON_FUNC_STOP to break out of the loop
+ * @retval #IOTCON_FUNC_STOP  stop to call next function
+ * @retval #IOTCON_FUNC_CONTINUE  continue to call next function
+ *
+ * @pre iotcon_list_foreach_double() will invoke this callback function.
+ *
+ * @see iotcon_list_foreach_double()
+ */
+typedef int (*iotcon_list_double_cb)(int pos, double value, void *user_data);
+
+/**
+ * @brief Gets all double values of the given list by invoking the callback function.
+ * @details iotcon_list_double_cb() will be called for each child.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] list The handle to the list
+ * @param[in] cb The callback function to get each double value
+ * @param[in] user_data The user data to be passed to the callback function
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ *
+ * @post iotcon_list_double_cb() will be called for each item.
+ *
+ * @see iotcon_list_double_cb()
+ */
+int iotcon_list_foreach_double(iotcon_list_h list, iotcon_list_double_cb cb,
+               void *user_data);
+
+/**
+ * @brief Specifies the type of function passed to iotcon_list_foreach_str()
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] pos The number of the string value (0 being the first)
+ * @param[in] value The string value
+ * @param[in] user_data The user data to pass to the function
+ *
+ * @return #IOTCON_FUNC_CONTINUE to continue with the next function of the loop,
+ * otherwise #IOTCON_FUNC_STOP to break out of the loop
+ * @retval #IOTCON_FUNC_STOP  stop to call next function
+ * @retval #IOTCON_FUNC_CONTINUE  continue to call next function
+ *
+ * @pre iotcon_list_foreach_str() will invoke this callback function.
+ *
+ * @see iotcon_list_foreach_str()
+ */
+typedef int (*iotcon_list_str_cb)(int pos, const char *value, void *user_data);
+
+/**
+ * @brief Gets all string values of the given list by invoking the callback function.
+ * @details iotcon_list_str_cb() will be called for each child.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] list The handle to the list
+ * @param[in] cb The callback function to get each string value
+ * @param[in] user_data The user data to be passed to the callback function
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ *
+ * @post iotcon_list_str_cb() will be called for each item.
+ *
+ * @see iotcon_list_str_cb()
+ */
+int iotcon_list_foreach_str(iotcon_list_h list, iotcon_list_str_cb cb, void *user_data);
+
+/**
+ * @brief Specifies the type of function passed to iotcon_list_foreach_list()
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] pos The number of the list value (0 being the first)
+ * @param[in] value The list value
+ * @param[in] user_data The user data to pass to the function
+ *
+ * @return #IOTCON_FUNC_CONTINUE to continue with the next function of the loop,
+ * otherwise #IOTCON_FUNC_STOP to break out of the loop
+ * @retval #IOTCON_FUNC_STOP  stop to call next function
+ * @retval #IOTCON_FUNC_CONTINUE  continue to call next function
+ *
+ * @pre iotcon_list_foreach_list() will invoke this callback function.
+ *
+ * @see iotcon_list_foreach_list()
+ */
+typedef int (*iotcon_list_list_cb)(int pos, iotcon_list_h value, void *user_data);
+
+/**
+ * @brief Gets all sub lists of the given list by invoking the callback function.
+ * @details iotcon_list_list_cb() will be called for each child.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] list The handle to the origin list
+ * @param[in] cb The callback function to get each sub list
+ * @param[in] user_data The user data to be passed to the callback function
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ *
+ * @post iotcon_list_list_cb() will be called for each item.
+ *
+ * @see iotcon_list_list_cb()
+ */
+int iotcon_list_foreach_list(iotcon_list_h list, iotcon_list_list_cb cb, void *user_data);
+
+/**
+ * @brief Specifies the type of function passed to iotcon_list_foreach_state()
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] pos The number of the state value (0 being the first)
+ * @param[in] value The state value
+ * @param[in] user_data The user data to pass to the function
+ *
+ * @return #IOTCON_FUNC_CONTINUE to continue with the next function of the loop,
+ * otherwise #IOTCON_FUNC_STOP to break out of the loop
+ * @retval #IOTCON_FUNC_STOP  stop to call next function
+ * @retval #IOTCON_FUNC_CONTINUE  continue to call next function
+ *
+ * @pre iotcon_list_foreach_state() will invoke this callback function.
+ *
+ * @see iotcon_list_foreach_state()
+ */
+typedef int (*iotcon_list_state_cb)(int pos, iotcon_state_h value, void *user_data);
+
+/**
+ * @brief Gets all state of the given list by invoking the callback function.
+ * @details iotcon_list_state_cb() will be called for each child.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] list The handle to the list
+ * @param[in] cb The callback function to get each state
+ * @param[in] user_data The user data to be passed to the callback function
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ *
+ * @post iotcon_list_state_cb() will be called for each item.
+ *
+ * @see iotcon_list_state_cb()
+ */
+int iotcon_list_foreach_state(iotcon_list_h list, iotcon_list_state_cb cb, void *user_data);
+
+/**
+ * @}
+ */
+
+#endif /* __IOT_CONNECTIVITY_MANAGER_STRUCT_LIST_H__ */
diff --git a/lib/include/iotcon-lite-resource.h b/lib/include/iotcon-lite-resource.h
new file mode 100644 (file)
index 0000000..cbe0ab4
--- /dev/null
@@ -0,0 +1,138 @@
+/*
+ * Copyright (c) 2015 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.
+ */
+#ifndef __IOT_CONNECTIVITY_MANAGER_SERVER_LITE_RESOURCE_H__
+#define __IOT_CONNECTIVITY_MANAGER_SERVER_LITE_RESOURCE_H__
+
+#include <iotcon-constant.h>
+
+/**
+ * @file iotcon-lite-resource.h
+ */
+
+/**
+ * @ingroup CAPI_IOT_CONNECTIVITY_SERVER_MODULE
+ * @defgroup CAPI_IOT_CONNECTIVITY_SERVER_LITE_RESOURCE_MODULE Lite Resource
+ *
+ * @brief Iotcon Lite Resource provides API to encapsulate resources.\n
+ * This API provides that the users manages resources, simply.
+ *
+ * @section CAPI_IOT_CONNECTIVITY_SERVER_LITE_RESOURCE_MODULE_HEADER Header
+ *  \#include <iotcon.h>
+ *
+ * @{
+ */
+
+/**
+ * @brief Create a lite resource handle and registers the resource in server
+ * @details Registers a resource specified by @a uri_path, @a res_types, @a state which have
+ * @a properties in Iotcon server.\n
+ * When client requests some operations, it send a response to client, automatically.\n
+ *
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/internet
+ *
+ * @remarks @a uri_path length must be less than or equal 36.\n
+ * You must unregister resource by calling iotcon_resource_destroy()
+ * if resource is no longer needed.
+ *
+ * @param[in] uri_path The URI path of the resource.
+ * @param[in] res_types The list of type of the resource.
+ * @param[in] properties The property of the resource.
+ * @param[in] state The state handle to set.
+ * @param[out] resource_handle The handle of the resource
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_IOTIVITY  Iotivity errors
+ * @retval #IOTCON_ERROR_DBUS  Dbus errors
+ * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
+ * @retval #IOTCON_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @post When the resource receive CRUD request, iotcon_request_handler_cb() will be called.
+ *
+ * @see iotcon_lite_resource_destroy()
+ */
+int iotcon_lite_resource_create(const char *uri_path,
+               iotcon_resource_types_h res_types,
+               int properties,
+               iotcon_state_h state,
+               iotcon_lite_resource_h *resource_handle);
+
+/**
+ * @brief Destroy the resource and releases its data.
+ *
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/internet
+ *
+ * @remarks When a normal variable is used, there are only dbus error and permission\n
+ * denied error. If the errors of this API are not handled, then you must check\n
+ * whether dbus is running and an application have the privileges for the API.
+ *
+ * @param[in] resource The handle of the lite resource to be unregistered
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_DBUS  Dbus error
+ * @retval #IOTCON_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @see iotcon_lite_resource_create()
+ */
+int iotcon_lite_resource_destroy(iotcon_lite_resource_h resource);
+
+/**
+ * @brief Update state into the lite resource handle
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] resource The handle of the lite resource
+ * @param[in] state The state handle to update
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
+ *
+ * @see iotcon_lite_resource_get_state()
+ */
+int iotcon_lite_resource_update_state(iotcon_lite_resource_h resource,
+               iotcon_state_h state);
+
+/**
+ * @brief Get state from the lite resource handle
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] resource The handle of the lite resource
+ * @param[out] state The state handle of the lite resource
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ *
+ * @see iotcon_lite_resource_update_state()
+ */
+int iotcon_lite_resource_get_state(iotcon_lite_resource_h resource,
+               iotcon_state_h *state);
+
+/**
+ * @}
+ */
+
+#endif /* __IOT_CONNECTIVITY_MANAGER_SERVER_LITE_RESOURCE_H__ */
diff --git a/lib/include/iotcon-notimsg.h b/lib/include/iotcon-notimsg.h
new file mode 100644 (file)
index 0000000..c2fc8a8
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2015 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.
+ */
+#ifndef __IOT_CONNECTIVITY_MANAGER_SERVER_NOTIMSG_H__
+#define __IOT_CONNECTIVITY_MANAGER_SERVER_NOTIMSG_H__
+
+#include <iotcon-constant.h>
+
+/**
+ * @file iotcon-notimsg.h
+ */
+
+/**
+ * @ingroup CAPI_IOT_CONNECTIVITY_SERVER_MODULE
+ * @defgroup CAPI_IOT_CONNECTIVITY_SERVER_NOTIMSG_MODULE Notimsg
+ *
+ * @brief Iotcon Notimsg provides API to create a message to notify to client.
+ *
+ * @section CAPI_IOT_CONNECTIVITY_SERVER_NOTIMSG_MODULE_HEADER Header
+ *  \#include <iotcon.h>
+ *
+ * @{
+ */
+
+/**
+ * @brief Creates a new notifications message handle.
+ * @details @a iface could be one of #iotcon_interface_e.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] repr The handle of the representation
+ * @param[in] iface The resource interface
+ * @param[out] notimsg_handle The generated notifications message handle
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
+ *
+ * @see iotcon_remote_resource_observe_cb()
+ * @see iotcon_remote_resource_observer_start()
+ * @see iotcon_remote_resource_observer_stop()
+ * @see iotcon_resource_notify()
+ */
+int iotcon_notimsg_create(iotcon_representation_h repr, iotcon_interface_e iface,
+               iotcon_notimsg_h *notimsg_handle);
+
+/**
+ * @brief Releases a notifications message handle.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] msg The handle of the notifications message
+ *
+ * @return void
+ *
+ * @see iotcon_notimsg_create()
+ */
+void iotcon_notimsg_destroy(iotcon_notimsg_h msg);
+
+/**
+ * @}
+ */
+
+#endif /* __IOT_CONNECTIVITY_MANAGER_SERVER_NOTIMSG_H__ */
diff --git a/lib/include/iotcon-observers.h b/lib/include/iotcon-observers.h
new file mode 100644 (file)
index 0000000..e66ec98
--- /dev/null
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2015 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.
+ */
+#ifndef __IOT_CONNECTIVITY_MANAGER_SERVER_OBSERVERS_H__
+#define __IOT_CONNECTIVITY_MANAGER_SERVER_OBSERVERS_H__
+
+#include <iotcon-constant.h>
+
+/**
+ * @file iotcon-observers.h
+ */
+
+/**
+ * @ingroup CAPI_IOT_CONNECTIVITY_SERVER_MODULE
+ * @defgroup CAPI_IOT_CONNECTIVITY_SERVER_OBSERVERS_MODULE Observers
+ *
+ * @brief Iotcon Observers provides API to manage client observing a resource.
+ *
+ * @section CAPI_IOT_CONNECTIVITY_SERVER_OBSERVERS_MODULE_HEADER Header
+ *  \#include <iotcon.h>
+ *
+ * @{
+ */
+
+/**
+ * @brief Creates a new observers handle.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] ret_observers A newly allocated list of observers handle
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
+ *
+ * @see iotcon_observers_destroy()
+ * @see iotcon_observers_add()
+ * @see iotcon_observers_remove()
+ */
+int iotcon_observers_create(iotcon_observers_h *ret_observers);
+
+/**
+ * @brief Free a observers handle.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] observers The handle of the observers
+ *
+ * @return void
+ *
+ * @see iotcon_observers_create()
+ * @see iotcon_observers_add()
+ * @see iotcon_observers_remove()
+ */
+void iotcon_observers_destroy(iotcon_observers_h observers);
+
+/**
+ * @brief Sets a observer id into the observers handle
+ *
+ * @since_tizen 3.0
+ * @remarks  If you want to make a new list, then you should set NULL to @a observers.
+ *
+ * @param[in] observers The handle of the observers
+ * @param[in] obs_id The id to be appended to observers
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ *
+ * @see iotcon_observers_create()
+ * @see iotcon_observers_destroy()
+ * @see iotcon_observers_remove()
+ */
+int iotcon_observers_add(iotcon_observers_h observers, int obs_id);
+
+/**
+ * @brief Remove id from the observers.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] observers observers The handle of the observers
+ * @param[in] obs_id The id to be removed from observers
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ *
+ * @see iotcon_observers_create()
+ * @see iotcon_observers_destroy()
+ * @see iotcon_observers_add()
+ */
+int iotcon_observers_remove(iotcon_observers_h observers, int obs_id);
+
+/**
+ * @}
+ */
+
+#endif /* __IOT_CONNECTIVITY_MANAGER_SERVER_OBSERVERS_H__ */
diff --git a/lib/include/iotcon-options.h b/lib/include/iotcon-options.h
new file mode 100644 (file)
index 0000000..5c87cc0
--- /dev/null
@@ -0,0 +1,183 @@
+/*
+ * Copyright (c) 2015 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.
+ */
+#ifndef __IOT_CONNECTIVITY_MANAGER_STRUCT_OPTIONS_H__
+#define __IOT_CONNECTIVITY_MANAGER_STRUCT_OPTIONS_H__
+
+#include <iotcon-constant.h>
+
+/**
+ * @file iotcon-options.h
+ */
+
+/**
+ * @ingroup CAPI_IOT_CONNECTIVITY_COMMON_MODULE
+ * @defgroup CAPI_IOT_CONNECTIVITY_COMMON_OPTIONS_MODULE Options
+ *
+ * @brief Iotcon Options provides API to manage options.
+ *
+ * @section CAPI_IOT_CONNECTIVITY_COMMON_OPTIONS_MODULE_HEADER Header
+ *  \#include <iotcon.h>
+ *
+ * @{
+ */
+
+/**
+ * @brief Creates a new option handle.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] options A newly allocated option handle
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see iotcon_options_destroy()
+ * @see iotcon_options_add()
+ * @see iotcon_options_remove()
+ * @see iotcon_options_lookup()
+ */
+int iotcon_options_create(iotcon_options_h *options);
+
+/**
+ * @brief Free an option handle.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] options The handle of the options
+ *
+ * @return void
+ *
+ * @see iotcon_options_create()
+ * @see iotcon_options_add()
+ * @see iotcon_options_remove()
+ * @see iotcon_options_lookup()
+ */
+void iotcon_options_destroy(iotcon_options_h options);
+
+/**
+ * @brief Inserts a new id and a correspoding data into the options.
+ *
+ * @since_tizen 3.0
+ * @remarks iotcon_options_h can have up to 2 options. \n
+ * option id is always situated between 2048 and 3000. \n
+ * Length of option data is less than or equal to 15.
+ *
+ * @param[in] options The handle of the options
+ * @param[in] id The id of the option to insert
+ * @param[in] data The string data to insert into the options
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ *
+ * @see iotcon_options_create()
+ * @see iotcon_options_destroy()
+ * @see iotcon_options_remove()
+ * @see iotcon_options_lookup()
+ */
+int iotcon_options_add(iotcon_options_h options, unsigned short id,
+               const char *data);
+
+/**
+ * @brief Deletes the id and its associated data from the options.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] options The handle of the options
+ * @param[in] id The id of the option to delete
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ *
+ * @see iotcon_options_create()
+ * @see iotcon_options_destroy()
+ * @see iotcon_options_add()
+ * @see iotcon_options_lookup()
+ */
+int iotcon_options_remove(iotcon_options_h options, unsigned short id);
+
+/**
+ * @brief Looks up data at the given id from the options.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] options The handle of the options
+ * @param[in] id The id of the option to lookup
+ * @param[out] data Found data from options
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ *
+ * @see iotcon_options_create()
+ * @see iotcon_options_destroy()
+ * @see iotcon_options_add()
+ * @see iotcon_options_remove()
+ */
+int iotcon_options_lookup(iotcon_options_h options, unsigned short id, char **data);
+
+/**
+ * @brief Specifies the type of function passed to iotcon_options_foreach()
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] id The information of the option
+ * @param[in] data The data of the option
+ * @param[in] user_data The user data to pass to the function
+ *
+ * @return #IOTCON_FUNC_CONTINUE to continue with the next function of the loop,
+ * otherwise #IOTCON_FUNC_STOP to break out of the loop
+ * @retval #IOTCON_FUNC_STOP  stop to call next function
+ * @retval #IOTCON_FUNC_CONTINUE  continue to call next function
+ *
+ * @pre iotcon_options_foreach() will invoke this callback function.
+ *
+ * @see iotcon_options_foreach()
+ */
+typedef int (*iotcon_options_foreach_cb)(unsigned short id, const char *data,
+               void *user_data);
+
+/**
+ * @brief Gets all datas of the options by invoking the callback function.
+ * @details iotcon_options_foreach_cb() will be called for each option.\n
+ * If iotcon_options_foreach_cb() returns #IOTCON_FUNC_STOP, iteration will be stop.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] options The handle of the options
+ * @param[in] cb The callback function to get data
+ * @param[in] user_data The user data to pass to the function
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ *
+ * @post iotcon_options_foreach_cb() will be called for each option.
+ *
+ * @see iotcon_options_foreach_cb()
+ */
+int iotcon_options_foreach(iotcon_options_h options, iotcon_options_foreach_cb cb,
+               void *user_data);
+
+/**
+ * @}
+ */
+
+#endif /* __IOT_CONNECTIVITY_MANAGER_STRUCT_OPTIONS_H__ */
diff --git a/lib/include/iotcon-query.h b/lib/include/iotcon-query.h
new file mode 100644 (file)
index 0000000..fa33225
--- /dev/null
@@ -0,0 +1,269 @@
+/*
+ * Copyright (c) 2015 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.
+ */
+#ifndef __IOT_CONNECTIVITY_MANAGER_STRUCT_QUERY_H__
+#define __IOT_CONNECTIVITY_MANAGER_STRUCT_QUERY_H__
+
+#include <iotcon-constant.h>
+
+/**
+ * @file iotcon-query.h
+ */
+
+/**
+ * @ingroup CAPI_IOT_CONNECTIVITY_COMMON_MODULE
+ * @defgroup CAPI_IOT_CONNECTIVITY_COMMON_QUERY_MODULE Query
+ *
+ * @brief Iotcon Query provides API to manage query.
+ *
+ * @section CAPI_IOT_CONNECTIVITY_COMMON_QUERY_MODULE_HEADER Header
+ *  \#include <iotcon.h>
+ *
+ * @{
+ */
+
+/**
+ * @brief Creates a new query handle.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] query A newly allocated query handle
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ *
+ * @see iotcon_query_destroy()
+ * @see iotcon_query_add()
+ * @see iotcon_query_remove()
+ * @see iotcon_query_lookup()
+ */
+int iotcon_query_create(iotcon_query_h *query);
+
+/**
+ * @brief Free a query handle.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] query The handle of the query
+ *
+ * @return void
+ *
+ * @see iotcon_query_create()
+ * @see iotcon_query_add()
+ * @see iotcon_query_remove()
+ * @see iotcon_query_lookup()
+ */
+void iotcon_query_destroy(iotcon_query_h query);
+
+/**
+ * @brief Get resource types from the query.
+ *
+ * @since_tizen 3.0
+ * @remarks @a types must not be released using iotcon_resource_types_destroy().
+ *
+ * @param[in] query The handle of the query
+ * @param[out] types Found resource types from query
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_NO_DATA  No data available
+ * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
+ *
+ * @see iotcon_query_create()
+ * @see iotcon_query_destroy()
+ * @see iotcon_query_add()
+ * @see iotcon_query_remove()
+ * @see iotcon_query_set_resource_types()
+ */
+int iotcon_query_get_resource_tyeps(iotcon_query_h query, iotcon_resource_types_h *types);
+
+/**
+ * @brief Get resource types from the query.
+ * @details @a iface could be one of #iotcon_interface_e.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] query The handle of the query
+ * @param[out] iface Found interface from query
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_NO_DATA  No data available
+ *
+ * @see iotcon_query_create()
+ * @see iotcon_query_destroy()
+ * @see iotcon_query_add()
+ * @see iotcon_query_remove()
+ * @see iotcon_query_set_interface()
+ */
+int iotcon_query_get_interface(iotcon_query_h query, int *iface);
+
+/**
+ * @brief Sets the resource types into the query.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] query The handle of the query
+ * @param[in] types The resoure types to set into the query
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ *
+ * @see iotcon_query_create()
+ * @see iotcon_query_destroy()
+ * @see iotcon_query_add()
+ * @see iotcon_query_remove()
+ * @see iotcon_query_lookup()
+ * @see iotcon_query_get_resource_tyeps()
+ */
+int iotcon_query_set_resource_types(iotcon_query_h query, iotcon_resource_types_h types);
+
+/**
+ * @brief Sets the interface into the query.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] query The handle of the query
+ * @param[in] iface The interface to add into the query
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ *
+ * @see iotcon_query_create()
+ * @see iotcon_query_destroy()
+ * @see iotcon_query_add()
+ * @see iotcon_query_remove()
+ * @see iotcon_query_lookup()
+ * @see iotcon_query_get_interface()
+ */
+int iotcon_query_set_interface(iotcon_query_h query, iotcon_interface_e iface);
+
+/**
+ * @brief Inserts a new key and correspoding value into the query.
+ *
+ * @since_tizen 3.0
+ * @remarks The full length of query should be less than or equal to 64.
+ *
+ * @param[in] query The handle of the query
+ * @param[in] key The key of the query to insert
+ * @param[in] value The string data to insert into the query
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ *
+ * @see iotcon_query_create()
+ * @see iotcon_query_destroy()
+ * @see iotcon_query_remove()
+ * @see iotcon_query_lookup()
+ */
+int iotcon_query_add(iotcon_query_h query, const char *key, const char *value);
+
+/**
+ * @brief Deletes the key and its associated value from the query.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] query The handle of the query
+ * @param[in] key The key of the option to delete
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ *
+ * @see iotcon_query_create()
+ * @see iotcon_query_destroy()
+ * @see iotcon_query_add()
+ * @see iotcon_query_lookup()
+ */
+int iotcon_query_remove(iotcon_query_h query, const char *key);
+
+/**
+ * @brief Lookup data at the given key from the query.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] query The handle of the query
+ * @param[in] key The key of the query to lookup
+ * @param[out] data Found data from query
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ *
+ * @see iotcon_query_create()
+ * @see iotcon_query_destroy()
+ * @see iotcon_query_add()
+ * @see iotcon_query_remove()
+ */
+int iotcon_query_lookup(iotcon_query_h query, const char *key, char **data);
+
+/**
+ * @brief Specifies the type of function passed to iotcon_query_foreach()
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] key The key of the query
+ * @param[in] value The value of the query
+ * @param[in] user_data The user data to pass to the function
+ *
+ * @return #IOTCON_FUNC_CONTINUE to continue with the next function of the loop,
+ * otherwise #IOTCON_FUNC_STOP to break out of the loop
+ * @retval #IOTCON_FUNC_STOP  stop to call next function
+ * @retval #IOTCON_FUNC_CONTINUE  continue to call next function
+ *
+ * @pre iotcon_query_foreach() will invoke this callback function.
+ *
+ * @see iotcon_query_foreach()
+ */
+typedef int (*iotcon_query_foreach_cb)(const char *key, const char *value,
+               void *user_data);
+
+/**
+ * @brief Gets all datas of the query by invoking the callback function.
+ * @details iotcon_query_foreach_cb() will be called for each query.\n
+ * If iotcon_query_foreach_cb() returns #IOTCON_FUNC_STOP, iteration will be stop.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] query The handle of the query
+ * @param[in] cb The callback function to get data
+ * @param[in] user_data The user data to be passed to the callback function
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ *
+ * @post iotcon_query_foreach_cb() will be called for each query.
+ *
+ * @see iotcon_query_foreach_cb()
+ */
+int iotcon_query_foreach(iotcon_query_h query, iotcon_query_foreach_cb cb,
+               void *user_data);
+
+/**
+ * @}
+ */
+
+#endif /* __IOT_CONNECTIVITY_MANAGER_STRUCT_QUERY_H__ */
diff --git a/lib/include/iotcon-remote-resource.h b/lib/include/iotcon-remote-resource.h
new file mode 100644 (file)
index 0000000..2699221
--- /dev/null
@@ -0,0 +1,706 @@
+/*
+ * Copyright (c) 2015 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.
+ */
+#ifndef __IOT_CONNECTIVITY_MANAGER_CLIENT_REMOTE_RESOURCE_H__
+#define __IOT_CONNECTIVITY_MANAGER_CLIENT_REMOTE_RESOURCE_H__
+
+#include <stdbool.h>
+#include <iotcon-constant.h>
+
+/**
+ * @file iotcon-remote-resource.h
+ */
+
+/**
+ * @ingroup CAPI_IOT_CONNECTIVITY_CLIENT_MODULE
+ * @defgroup CAPI_IOT_CONNECTIVITY_CLIENT_REMOTE_RESOURCE_MODULE Remote Resource
+ *
+ * @brief Iotcon Remote Resource provides API to manage remote resource.
+ *
+ * @section CAPI_IOT_CONNECTIVITY_CLIENT_REMOTE_RESOURCE_MODULE_HEADER Header
+ *  \#include <iotcon.h>
+ *
+ * @{
+ */
+
+/**
+ * @brief Creates a new resource handle.
+ * @details Creates a resource proxy object so that get/put/observe functionality can be used
+ * without discovering the object in advance.\n
+ * To use this API, you should provide all of the details required to correctly contact and
+ * observe the object.\n
+ * If not, you should discover the resource object manually.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] host_address The host address of the resource
+ * @param[in] connectivity_type The connectivity type
+ * @param[in] uri_path The URI path of the resource.
+ * @param[in] is_observable Allow observation
+ * @param[in] resource_types The resource type of the resource. For example, "core.light"
+ * @param[in] resource_ifaces The resource interfaces (whether it is collection etc)
+ * @param[out] client_handle Generated resource handle
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_IOTIVITY  Iotivity errors
+ * @retval #IOTCON_ERROR_DBUS  Dbus errors
+ * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
+ *
+ * @see iotcon_remote_resource_destroy()
+ * @see iotcon_remote_resource_clone()
+ */
+int iotcon_remote_resource_create(const char *host_address,
+               iotcon_connectivity_type_e connectivity_type,
+               const char *uri_path,
+               bool is_observable,
+               iotcon_resource_types_h resource_types,
+               int resource_ifaces,
+               iotcon_remote_resource_h *client_handle);
+
+/**
+ * @brief Releases a resource handle.
+ * @details Decrements reference count of the source resource.\n
+ * If the reference count drops to 0, releases a resource handle.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] resource The handle of the resource
+ *
+ * @return void
+ *
+ * @see iotcon_remote_resource_create()
+ * @see iotcon_remote_resource_clone()
+ */
+void iotcon_remote_resource_destroy(iotcon_remote_resource_h resource);
+
+/**
+ * @brief Makes a clone of a remote resource.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] src The Source of resource
+ * @param[out] dest The cloned resource handle
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ *
+ * @see iotcon_remote_resource_create()
+ * @see iotcon_remote_resource_destroy()
+ */
+int iotcon_remote_resource_clone(iotcon_remote_resource_h src, iotcon_remote_resource_h *dest);
+
+/**
+ * @brief Specifies the type of function passed to iotcon_remote_resource_observer_start().
+ * @details Called when a client receive notifications from a server. The @a response_result could be one of #iotcon_response_result_e.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] resource The handle of the resource
+ * @param[in] repr The handle of the representation
+ * @param[in] options The handle of the header options
+ * @param[in] response_result The response result code
+ * @param[in] sequence_number The sequence of notifications from server.
+ * @param[in] user_data The user data passed from the callback registration function
+ *
+ * @pre The callback must be registered using iotcon_remote_resource_observer_start()
+ *
+ * @see iotcon_remote_resource_observer_start()
+ */
+typedef void (*iotcon_remote_resource_observe_cb)(iotcon_remote_resource_h resource,
+               iotcon_representation_h repr,
+               iotcon_options_h options,
+               int response_result,
+               int sequence_number,
+               void *user_data);
+
+/**
+ * @brief Sets observation on the resource
+ * @details When server sends notification message, iotcon_remote_resource_observe_cb() will be called.
+ * The @a observe_type could be one of #iotcon_observe_type_e.
+ *
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/internet
+ *
+ * @param[in] resource The handle of the resource
+ * @param[in] observe_type The type to specify how client wants to observe.
+ * @param[in] query The query to send to server
+ * @param[in] cb The callback function to get notifications from server
+ * @param[in] user_data The user data to pass to the function
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_IOTIVITY  Iotivity errors
+ * @retval #IOTCON_ERROR_DBUS  Dbus errors
+ * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
+ * @retval #IOTCON_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @post When the @a resource receive notification message, iotcon_remote_resource_observe_cb() will be called.
+ *
+ * @see iotcon_remote_resource_observe_cb()
+ * @see iotcon_remote_resource_observer_stop()
+ * @see iotcon_notimsg_create()
+ * @see iotcon_resource_notify()
+ */
+int iotcon_remote_resource_observer_start(iotcon_remote_resource_h resource,
+               iotcon_observe_type_e observe_type,
+               iotcon_query_h query,
+               iotcon_remote_resource_observe_cb cb,
+               void *user_data);
+
+/**
+ * @brief Cancels the observation on the resource
+ *
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/internet
+ *
+ * @param[in] resource The handle of the resource
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_DBUS  Dbus error
+ * @retval #IOTCON_ERROR_SYSTEM System error
+ * @retval #IOTCON_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @see iotcon_remote_resource_observe_cb()
+ * @see iotcon_remote_resource_observer_start()
+ * @see iotcon_notimsg_create()
+ * @see iotcon_resource_notify()
+ */
+int iotcon_remote_resource_observer_stop(iotcon_remote_resource_h resource);
+
+/**
+ * @brief Specifies the type of function passed to iotcon_remote_resource_get(), iotcon_remote_resource_put(), iotcon_remote_resource_post()
+ * @details The @a response_result could be one of #iotcon_response_result_e.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] resource The handle of the resource
+ * @param[in] repr The handle of the representation
+ * @param[in] options The handle of the header options
+ * @param[in] response_result The response result code (Lesser than 0 on fail, otherwise a response result value)
+ * @param[in] user_data The user data to pass to the function
+ *
+ * @pre The callback must be registered using iotcon_remote_resource_get(), iotcon_remote_resource_put(), iotcon_remote_resource_post()
+ *
+ * @see iotcon_remote_resource_get()
+ * @see iotcon_remote_resource_put()
+ * @see iotcon_remote_resource_post()
+ */
+typedef void (*iotcon_remote_resource_cru_cb)(iotcon_remote_resource_h resource,
+               iotcon_representation_h repr,
+               iotcon_options_h options,
+               int response_result,
+               void *user_data);
+
+/**
+ * @brief Gets the attributes of a resource.
+ * @details When server sends response on get request, iotcon_remote_resource_cru_cb() will be called.
+ *
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/internet
+ *
+ * @param[in] resource The handle of the resource
+ * @param[in] query The query to send to server
+ * @param[in] cb The callback function
+ * @param[in] user_data The user data to pass to the function
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_DBUS  Dbus errors
+ * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
+ * @retval #IOTCON_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @post When the client receive get response, iotcon_remote_resource_cru_cb() will be called.
+ *
+ * @see iotcon_remote_resource_cru_cb()
+ * @see iotcon_remote_resource_put()
+ * @see iotcon_remote_resource_post()
+ */
+int iotcon_remote_resource_get(iotcon_remote_resource_h resource, iotcon_query_h query,
+               iotcon_remote_resource_cru_cb cb, void *user_data);
+
+/**
+ * @brief Sets the representation of a resource (via PUT)
+ * @details When server sends response on put request, iotcon_remote_resource_cru_cb() will be called.
+ *
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/internet
+ *
+ * @param[in] resource The handle of the resource
+ * @param[in] repr The handle of the representation
+ * @param[in] query The query to send to server
+ * @param[in] cb The callback function
+ * @param[in] user_data The user data to pass to the function
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_DBUS  Dbus errors
+ * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
+ * @retval #IOTCON_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @post When the client receive put response, iotcon_remote_resource_cru_cb() will be called.
+ *
+ * @see iotcon_remote_resource_cru_cb()
+ * @see iotcon_remote_resource_get()
+ * @see iotcon_remote_resource_post()
+ */
+int iotcon_remote_resource_put(iotcon_remote_resource_h resource,
+               iotcon_representation_h repr,
+               iotcon_query_h query,
+               iotcon_remote_resource_cru_cb cb,
+               void *user_data);
+
+/**
+ * @brief Posts on a resource
+ * @details When server sends response on post request, iotcon_remote_resource_cru_cb() will be called.
+ *
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/internet
+ *
+ * @param[in] resource The handle of the resource
+ * @param[in] repr The handle of the representation
+ * @param[in] query The query to send to server
+ * @param[in] cb The callback function
+ * @param[in] user_data The user data to pass to the function
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_DBUS  Dbus errors
+ * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
+ * @retval #IOTCON_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @post When the client receive post response, iotcon_remote_resource_cru_cb() will be called.
+ *
+ * @see iotcon_remote_resource_cru_cb()
+ * @see iotcon_remote_resource_get()
+ * @see iotcon_remote_resource_put()
+ */
+int iotcon_remote_resource_post(iotcon_remote_resource_h resource,
+               iotcon_representation_h repr,
+               iotcon_query_h query,
+               iotcon_remote_resource_cru_cb cb,
+               void *user_data);
+
+/**
+ * @brief Specifies the type of function passed to iotcon_remote_resource_delete()
+ * @details The @a response_result could be one of #iotcon_response_result_e.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] resource The handle of the resource
+ * @param[in] options The handle of the header options
+ * @param[in] response_result The response result code
+ * @param[in] user_data The user data to pass to the function
+ *
+ * @pre The callback must be registered using iotcon_remote_resource_delete()
+ *
+ * @see iotcon_remote_resource_delete()
+ */
+typedef void (*iotcon_remote_resource_delete_cb)(iotcon_remote_resource_h resource,
+               iotcon_options_h options,
+               int response_result,
+               void *user_data);
+
+/**
+ * @brief Deletes a resource.
+ * @details When server sends response on delete request, iotcon_remote_resource_delete_cb() will be called.
+ *
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/internet
+ *
+ * @param[in] resource The handle of the resource
+ * @param[in] cb The callback function
+ * @param[in] user_data The user data to pass to the function
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_DBUS  Dbus errors
+ * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
+ * @retval #IOTCON_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @post When the client receive delete response, iotcon_remote_resource_delete_cb() will be called.
+ *
+ * @see iotcon_remote_resource_delete_cb()
+ */
+int iotcon_remote_resource_delete(iotcon_remote_resource_h resource,
+               iotcon_remote_resource_delete_cb cb, void *user_data);
+
+/**
+ * @brief Specifies the type of function passed to iotcon_remote_resource_start_caching().
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] resource The handle of the remote resource
+ * @param[in] representation The handle of the representation
+ * @param[in] user_data The user data to pass to the function
+ *
+ * @pre The callback must be registered using iotcon_remote_resource_start_caching()\n
+ *
+ * @see iotcon_remote_resource_start_caching()
+ * @see iotcon_remote_resource_stop_caching()
+ */
+typedef void (*iotcon_remote_resource_cached_representation_changed_cb)(
+               iotcon_remote_resource_h resource,
+               iotcon_representation_h representation,
+               void *user_data);
+
+/**
+ * @brief Start caching of a remote resource.
+ * @details Use this function to start caching the resource's attribute data (state).\n
+ * Default caching time interval is 10 seconds.
+ * Internally, it operates GET method, periodically, and it observes the remote resource.
+ *
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/internet
+ *
+ * @param[in] resource The handle of the remote resource to be cached
+ * @param[in] caching_interval Seconds for caching time interval.\n
+ * If value is 0, then it sets 10 seconds(default caching time).
+ * @param[in] cb The callback function to add into callback list
+ * @param[in] user_data The user data to pass to the callback function
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_DBUS  Dbus error
+ * @retval #IOTCON_ERROR_SYSTEM System error
+ * @retval #IOTCON_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_ALREADY Already done
+ * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
+ *
+ * @see iotcon_remote_resource_stop_caching()
+ * @see iotcon_remote_resource_cached_representation_changed_cb()
+ */
+int iotcon_remote_resource_start_caching(iotcon_remote_resource_h resource,
+               int caching_interval,
+               iotcon_remote_resource_cached_representation_changed_cb cb,
+               void *user_data);
+
+/**
+ * @brief Stop caching of a remote resource.
+ * @details Use this function to stop caching the resource's attribute data (state).\n
+ *
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/internet
+ *
+ * @param[in] resource The handle of the remote resource
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_DBUS  Dbus error
+ * @retval #IOTCON_ERROR_SYSTEM System error
+ * @retval #IOTCON_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @see iotcon_remote_resource_start_caching()
+ * @see iotcon_remote_resource_cached_representation_changed_cb()
+ */
+int iotcon_remote_resource_stop_caching(iotcon_remote_resource_h resource);
+
+/**
+ * @brief Specifies the type of function passed to iotcon_remote_resource_start_monitoring().
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] resource The handle of the remote resource
+ * @param[in] state The state of the remote resource
+ * @param[in] user_data The user data to pass to the function
+ *
+ * @pre The callback must be registered using iotcon_remote_resource_start_monitoring()\n
+ *
+ * @see iotcon_remote_resource_start_monitoring()
+ * @see iotcon_remote_resource_stop_monitoring()
+ */
+typedef void (*iotcon_remote_resource_state_changed_cb)(iotcon_remote_resource_h resource,
+               iotcon_remote_resource_state_e state, void *user_data);
+
+/**
+ * @brief Start monitoring of a remote resource.
+ * @details When remote resource's state are changed, registered callbacks will be called\n
+ * in turn. Default monitoring time interval is 10 seconds.
+ * Internally, it operates GET method, periodically, and it subscribes the devices's presence.
+ *
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/internet
+ *
+ * @param[in] resource The handle of the remote resource
+ * @param[in] monitoring_interval Seconds for monitoring time interval.\n
+ * If value is 0, then it sets 10 seconds(default monitoring time).
+ * @param[in] cb The callback function to add into callback list
+ * @param[in] user_data The user data to pass to the callback function
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_ALREADY  Already done
+ * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
+ *
+ * @see iotcon_remote_resource_stop_monitoring()
+ * @see iotcon_remote_resource_state_changed_cb()
+ */
+int iotcon_remote_resource_start_monitoring(iotcon_remote_resource_h resource,
+               int monitoring_interval,
+               iotcon_remote_resource_state_changed_cb cb,
+               void *user_data);
+
+/**
+ * @brief Stop monitoring.
+ * @details Use this function to stop monitoring the remote resource.
+ *
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/internet
+ *
+ * @param[in] resource The handle of the remote resource
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_DBUS  Dbus error
+ * @retval #IOTCON_ERROR_SYSTEM System error
+ * @retval #IOTCON_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @see iotcon_remote_resource_start_monitoring()
+ * @see iotcon_remote_resource_state_changed_cb()
+ */
+int iotcon_remote_resource_stop_monitoring(iotcon_remote_resource_h resource);
+
+/**
+ * @brief Gets an URI path of the remote resource
+ *
+ * @since_tizen 3.0
+ * @remarks @a uri_path must not be released using free().
+ *
+ * @param[in] resource The handle of the remote resource
+ * @param[out] uri_path The URI path of the remote resource
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ *
+ * @see iotcon_remote_resource_get_host_address()
+ * @see iotcon_remote_resource_get_connectivity_type()
+ * @see iotcon_remote_resource_get_device_id()
+ * @see iotcon_remote_resource_get_types()
+ * @see iotcon_remote_resource_get_interfaces()
+ * @see iotcon_remote_resource_is_observable()
+ * @see iotcon_remote_resource_set_options()
+ */
+int iotcon_remote_resource_get_uri_path(iotcon_remote_resource_h resource,
+               char **uri_path);
+
+/**
+ * @brief Gets connectivity type of the remote resource
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] resource The handle of the remote resource
+ * @param[out] connectivity_type The connectivity type of the remote resource
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+
+ * @see iotcon_remote_resource_get_uri_path()
+ * @see iotcon_remote_resource_get_host_address()
+ * @see iotcon_remote_resource_get_connectivity_type()
+ * @see iotcon_remote_resource_get_device_id()
+ * @see iotcon_remote_resource_get_types()
+ * @see iotcon_remote_resource_get_interfaces()
+ * @see iotcon_remote_resource_is_observable()
+ * @see iotcon_remote_resource_set_options()
+ */
+int iotcon_remote_resource_get_connectivity_type(iotcon_remote_resource_h resource,
+               int *connectivity_type);
+
+/**
+ * @brief Gets an host address of the remote resource
+ *
+ * @since_tizen 3.0
+ * @remarks @a host_address must not be released using free().
+ *
+ * @param[in] resource The handle of the remote resource
+ * @param[out] host_address The host address of the remote resource
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ *
+ * @see iotcon_remote_resource_get_connectivity_type()
+ * @see iotcon_remote_resource_get_uri_path()
+ * @see iotcon_remote_resource_get_device_id()
+ * @see iotcon_remote_resource_get_types()
+ * @see iotcon_remote_resource_get_interfaces()
+ * @see iotcon_remote_resource_is_observable()
+ * @see iotcon_remote_resource_set_options()
+ */
+int iotcon_remote_resource_get_host_address(iotcon_remote_resource_h resource,
+               char **host_address);
+
+/**
+ * @brief Gets an device id of the remote resource
+ *
+ * @since_tizen 3.0
+ * @remarks @a device_id must not be released using free().
+ *
+ * @param[in] resource The handle of the remote resource
+ * @param[out] device_id The device id of the remote resource
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ *
+ * @see iotcon_remote_resource_get_uri_path()
+ * @see iotcon_remote_resource_get_host_address()
+ * @see iotcon_remote_resource_get_connectivity_type()
+ * @see iotcon_remote_resource_get_types()
+ * @see iotcon_remote_resource_get_interfaces()
+ * @see iotcon_remote_resource_is_observable()
+ * @see iotcon_remote_resource_set_options()
+ */
+int iotcon_remote_resource_get_device_id(iotcon_remote_resource_h resource,
+               char **device_id);
+
+/**
+ * @brief Gets resource types of the remote resource
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] resource The handle of the remote resource
+ * @param[out] types The resource types of the remote resource
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ *
+ * @see iotcon_remote_resource_get_uri_path()
+ * @see iotcon_remote_resource_get_host_address()
+ * @see iotcon_remote_resource_get_connectivity_type()
+ * @see iotcon_remote_resource_get_device_id()
+ * @see iotcon_remote_resource_get_interfaces()
+ * @see iotcon_remote_resource_is_observable()
+ * @see iotcon_remote_resource_set_options()
+ */
+int iotcon_remote_resource_get_types(iotcon_remote_resource_h resource,
+               iotcon_resource_types_h *types);
+
+/**
+ * @brief Gets resource interfaces of the remote resource
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] resource The handle of the remote resource
+ * @param[out] ifaces The resource interfaces of the remote resource
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ *
+ * @see iotcon_remote_resource_get_uri_path()
+ * @see iotcon_remote_resource_get_host_address()
+ * @see iotcon_remote_resource_get_connectivity_type()
+ * @see iotcon_remote_resource_get_device_id()
+ * @see iotcon_remote_resource_get_types()
+ * @see iotcon_remote_resource_is_observable()
+ * @see iotcon_remote_resource_set_options()
+ */
+int iotcon_remote_resource_get_interfaces(iotcon_remote_resource_h resource, int *ifaces);
+
+/**
+ * @brief Checks whether the remote resource is observable or not.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] resource The handle of the resource
+ * @param[out] observable The value of observable
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ *
+ * @see iotcon_remote_resource_get_uri_path()
+ * @see iotcon_remote_resource_get_host_address()
+ * @see iotcon_remote_resource_get_connectivity_type()
+ * @see iotcon_remote_resource_get_device_id()
+ * @see iotcon_remote_resource_get_types()
+ * @see iotcon_remote_resource_get_interfaces()
+ * @see iotcon_remote_resource_set_options()
+ */
+int iotcon_remote_resource_is_observable(iotcon_remote_resource_h resource,
+               bool *observable);
+
+/**
+ * @brief Sets options into the remote resource
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] resource The handle of the remote resource
+ * @param[in] options The handle of the header options
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ *
+ * @see iotcon_remote_resource_get_uri_path()
+ * @see iotcon_remote_resource_get_host_address()
+ * @see iotcon_remote_resource_get_connectivity_type()
+ * @see iotcon_remote_resource_get_device_id()
+ * @see iotcon_remote_resource_get_types()
+ * @see iotcon_remote_resource_get_interfaces()
+ * @see iotcon_remote_resource_is_observable()
+ */
+int iotcon_remote_resource_set_options(iotcon_remote_resource_h resource,
+               iotcon_options_h options);
+
+/**
+ * @brief Get cached representation from the remote resource
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] resource The handle of the remote resource
+ * @param[out] representation The handle of the representation
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_NO_DATA  No data
+ */
+int iotcon_remote_resource_get_cached_representation(
+               iotcon_remote_resource_h resource,
+               iotcon_representation_h *representation);
+
+/**
+ * @}
+ */
+
+#endif /* __IOT_CONNECTIVITY_MANAGER_CLIENT_REMOTE_RESOURCE_H__ */
index 3f4f56a..ade3c2e 100644 (file)
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-#ifndef __IOT_CONNECTIVITY_MANAGER_REPRESENTATION_H__
-#define __IOT_CONNECTIVITY_MANAGER_REPRESENTATION_H__
+#ifndef __IOT_CONNECTIVITY_MANAGER_STRUCT_REPRESENTATION_H__
+#define __IOT_CONNECTIVITY_MANAGER_STRUCT_REPRESENTATION_H__
 
-#include <stdbool.h>
 #include <iotcon-constant.h>
-#include <iotcon-struct.h>
 
 /**
- *
- * @addtogroup CAPI_IOT_CONNECTIVITY_REPRESENTATION_MODULE
- *
+ * @file iotcon-representation.h
+ */
+
+/**
+ * @ingroup CAPI_IOT_CONNECTIVITY_COMMON_MODULE
+ * @defgroup CAPI_IOT_CONNECTIVITY_COMMON_REPRESENTATION_MODULE Representation
+ *
+ * @brief Iotcon Representation provides API to manage representation
+ *
+ * @section CAPI_IOT_CONNECTIVITY_COMMON_REPRESENTATION_MODULE_HEADER Header
+ *  \#include <iotcon.h>
+ *
+ * @section CAPI_IOT_CONNECTIVITY_COMMON_REPRESENTATION_MODULE_OVERVIEW Overview
+ * The Iotcon Representation API provides data type of resp_repr handling.\n
+ * A resp_repr is a payload of a request or a response.\n
+ * It has uri_path, interface, list of resource types and its attributes.\n
+ * Attributes have capabilties to store and retrieve integer, boolean, double, string, list, null,
+ * resp_repr.\n
+ * A list is a container that includes number of datas of same type.\n
+ * It has capabilties to store and retrieve integer, boolean, double, string, list, null, resp_repr.
+ * Example
+ *@code
+#include <iotcon.h>
+...
+{
+       int ret;
+       iotcon_representation_h repr;
+       iotcon_resource_types_h types;
+       iotcon_list_h bright_step_list;
+
+       ret = iotcon_representation_create(&resp_repr);
+       if (IOTCON_ERROR_NONE != ret) {
+               return;
+       }
+
+       ret = iotcon_representation_set_uri_path(resp_repr, "/a/light");
+       if (IOTCON_ERROR_NONE != ret) {
+               iotcon_representation_destroy(resp_repr);
+               return;
+       }
+
+       ret = iotcon_resource_types_create(&types);
+       if (IOTCON_ERROR_NONE != ret) {
+               iotcon_representation_destroy(resp_repr);
+               return;
+       }
+
+       ret = iotcon_resource_types_add(types, "core.light");
+       if (IOTCON_ERROR_NONE != ret) {
+               iotcon_resource_types_destroy(types);
+               iotcon_representation_destroy(resp_repr);
+               return;
+       }
+
+       ret = iotcon_representation_set_resource_types(resp_repr, types);
+       if (IOTCON_ERROR_NONE != ret) {
+               iotcon_resource_types_destroy(types);
+               iotcon_representation_destroy(resp_repr);
+               return;
+       }
+
+       ret = iotcon_representation_set_resource_interfaces(resp_repr, IOTCON_INTERFACE_LINK);
+       if (IOTCON_ERROR_NONE != ret) {
+               iotcon_resource_types_destroy(types);
+               iotcon_representation_destroy(resp_repr);
+               return;
+       }
+
+       ret = iotcon_state_set_str(resp_repr, "type", "lamp");
+       if (IOTCON_ERROR_NONE != ret) {
+               iotcon_resource_types_destroy(types);
+               iotcon_representation_destroy(resp_repr);
+               return;
+       }
+
+       ret = iotcon_state_set_str(resp_repr, "where", "desk");
+       if (IOTCON_ERROR_NONE != ret) {
+               iotcon_resource_types_destroy(types);
+               iotcon_representation_destroy(resp_repr);
+               return;
+       }
+
+       ret = iotcon_state_set_double(resp_repr, "default_bright", 200.0);
+       if (IOTCON_ERROR_NONE != ret) {
+               iotcon_resource_types_destroy(types);
+               iotcon_representation_destroy(resp_repr);
+               return;
+       }
+
+       ret = iotcon_state_set_str(resp_repr, "unit", "lux");
+       if (IOTCON_ERROR_NONE != ret) {
+               iotcon_resource_types_destroy(types);
+               iotcon_representation_destroy(resp_repr);
+               return;
+       }
+
+       ret = iotcon_state_set_bool(resp_repr, "bright_step", true);
+       if (IOTCON_ERROR_NONE != ret) {
+               iotcon_resource_types_destroy(types);
+               iotcon_representation_destroy(resp_repr);
+               return;
+       }
+
+       ret = iotcon_list_create(IOTCON_TYPE_DOUBLE, &bright_step_list);
+       if (IOTCON_ERROR_NONE != ret) {
+               iotcon_resource_types_destroy(types);
+               iotcon_representation_destroy(resp_repr);
+               return;
+       }
+
+       ret = iotcon_list_add_double(bright_step_list, 100.0, -1);
+       if (IOTCON_ERROR_NONE != ret) {
+               iotcon_list_destroy(bright_step_list);
+               iotcon_resource_types_destroy(types);
+               iotcon_representation_destroy(resp_repr);
+               return;
+       }
+
+       ret = iotcon_list_add_double(bright_step_list, 200.0, -1);
+       if (IOTCON_ERROR_NONE != ret) {
+               iotcon_list_destroy(bright_step_list);
+               iotcon_resource_types_destroy(types);
+               iotcon_representation_destroy(resp_repr);
+               return;
+       }
+
+       ret = iotcon_list_add_double(bright_step_list, 300.0, -1);
+       if (IOTCON_ERROR_NONE != ret) {
+               iotcon_list_destroy(bright_step_list);
+               iotcon_resource_types_destroy(types);
+               iotcon_representation_destroy(resp_repr);
+               return;
+       }
+
+       ret = iotcon_list_add_double(bright_step_list, 400.0, -1);
+       if (IOTCON_ERROR_NONE != ret) {
+               iotcon_list_destroy(bright_step_list);
+               iotcon_resource_types_destroy(types);
+               iotcon_representation_destroy(resp_repr);
+               return;
+       }
+
+       ret = iotcon_list_add_double(bright_step_list, 500.0, -1);
+       if (IOTCON_ERROR_NONE != ret) {
+               iotcon_list_destroy(bright_step_list);
+               iotcon_resource_types_destroy(types);
+               iotcon_representation_destroy(resp_repr);
+               return;
+       }
+
+       ret = iotcon_state_set_list(resp_repr, "bright_step_list", bright_step_list);
+       if (IOTCON_ERROR_NONE != ret) {
+               iotcon_list_destroy(bright_step_list);
+               iotcon_resource_types_destroy(types);
+               iotcon_representation_destroy(resp_repr);
+               return;
+       }
+
+       iotcon_list_destroy(bright_step_list);
+       iotcon_resource_types_destroy(types);
+       iotcon_representation_destroy(resp_repr);
+}
+ * @endcode
  * @{
  */
 
  *
  * @see iotcon_representation_destroy()
  */
-int iotcon_representation_create(iotcon_representation_h *ret_repr);
+int iotcon_representation_create(iotcon_representation_h *repr);
 
 /**
  * @brief Frees a representation.
@@ -74,7 +232,6 @@ int iotcon_representation_clone(const iotcon_representation_h src,
                iotcon_representation_h *dest);
 
 /**
- * @ingroup CAPI_IOT_CONNECTIVITY_MODULE
  * @brief Appends resource type name.
  *
  * @since_tizen 3.0
@@ -107,7 +264,6 @@ int iotcon_representation_set_uri_path(iotcon_representation_h repr,
 int iotcon_representation_get_uri_path(iotcon_representation_h repr, char **uri_path);
 
 /**
- * @ingroup CAPI_IOT_CONNECTIVITY_MODULE
  * @brief Sets resource type list to the Representation.
  *
  * @since_tizen 3.0
@@ -214,304 +370,6 @@ int iotcon_representation_get_state(iotcon_representation_h repr, iotcon_state_h
 int iotcon_representation_del_state(iotcon_representation_h repr);
 
 /**
- * @brief Creates a new state handle.
- *
- * @since_tizen 3.0
- *
- * @param[out] state A newly allocated state handle
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- *
- * @see iotcon_state_destroy()
- */
-int iotcon_state_create(iotcon_state_h *ret_state);
-
-/**
- * @brief Frees a state.
- * @details Releases a @a state and its internal data.
- *
- * @since_tizen 3.0
- *
- * @param[in] state The state handle to free
- *
- * @return void
- *
- * @see iotcon_state_create()
- */
-void iotcon_state_destroy(iotcon_state_h state);
-
-/**
- * @brief Sets a new key and integer value into the representation.
- * @details If @a key is already exists, current value will be replaced with new @a val.
- *
- * @since_tizen 3.0
- *
- * @param[in] state The state handle
- * @param[in] key The key
- * @param[in] val The value
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- */
-int iotcon_state_set_int(iotcon_state_h state, const char *key, int val);
-
-/**
- * @brief Sets a new key and boolean value into the representation.
- * @details If @a key is already exists, current value will be replaced with new @a val.
- *
- * @since_tizen 3.0
- *
- * @param[in] state The state handle
- * @param[in] key The key
- * @param[in] val The value
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- */
-int iotcon_state_set_bool(iotcon_state_h state, const char *key, bool val);
-
-/**
- * @brief Sets a new key and double value into the representation.
- * @details If @a key is already exists, current value will be replaced with new @a val.
- *
- * @since_tizen 3.0
- *
- * @param[in] state The state handle
- * @param[in] key The key
- * @param[in] val The value
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- */
-int iotcon_state_set_double(iotcon_state_h state, const char *key, double val);
-
-/**
- * @brief Sets a new key and string value into the representation.
- * @details If @a key is already exists, current value will be replaced with new @a val.
- *
- * @since_tizen 3.0
- *
- * @param[in] state The state handle
- * @param[in] key The key
- * @param[in] val The value
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- */
-int iotcon_state_set_str(iotcon_state_h state, const char *key, char *val);
-
-/**
- * @brief Sets a new key and list value into the representation.
- * @details If @a key is already exists, current list will be replaced with new @a list.
- *
- * @since_tizen 3.0
- *
- * @param[in] state The state handle
- * @param[in] key The key
- * @param[in] list The value
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- */
-int iotcon_state_set_list(iotcon_state_h state, const char *key, iotcon_list_h list);
-
-/**
- * @brief Sets a new key and state value into the representation.
- * @details If @a key is already exists, current state will be replaced with new @a src.
- *
- * @since_tizen 3.0
- *
- * @param[in] dest The state handle
- * @param[in] key The key
- * @param[in] src The state handle to set newly
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- */
-int iotcon_state_set_state(iotcon_state_h dest, const char *key, iotcon_state_h src);
-
-/**
- * @brief Sets a new key with NULL value into the representation.
- * @details If @a key is already exists, current value will be replaced with NULL
- *
- * @since_tizen 3.0
- *
- * @param[in] state The state handle
- * @param[in] key The key to be set NULL
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- */
-int iotcon_state_set_null(iotcon_state_h state, const char *key);
-
-/**
- * @brief Gets the integer value from the given key.
- *
- * @since_tizen 3.0
- *
- * @param[in] state The state handle
- * @param[in] key The key
- * @param[out] val The integer value
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_NO_DATA  No data available
- * @retval #IOTCON_ERROR_INVALID_TYPE  Invalid type
- */
-int iotcon_state_get_int(iotcon_state_h state, const char *key, int *val);
-
-/**
- * @brief Gets the boolean value from the given key.
- *
- * @since_tizen 3.0
- *
- * @param[in] state The state handle
- * @param[in] key The key
- * @param[out] val The boolean value
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_NO_DATA  No data available
- * @retval #IOTCON_ERROR_INVALID_TYPE  Invalid type
- */
-int iotcon_state_get_bool(iotcon_state_h state, const char *key, bool *val);
-
-/**
- * @brief Gets the double value from the given key.
- *
- * @since_tizen 3.0
- *
- * @param[in] state The state handle
- * @param[in] key The key
- * @param[out] val The double value
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_NO_DATA  No data available
- * @retval #IOTCON_ERROR_INVALID_TYPE  Invalid type
- */
-int iotcon_state_get_double(iotcon_state_h state, const char *key, double *val);
-
-/**
- * @brief Gets the string value from the given key.
- *
- * @since_tizen 3.0
- *
- * @param[in] state The state handle
- * @param[in] key The key
- * @param[out] val The string value
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_NO_DATA  No data available
- * @retval #IOTCON_ERROR_INVALID_TYPE  Invalid type
- */
-int iotcon_state_get_str(iotcon_state_h state, const char *key, char **val);
-
-/**
- * @brief Gets the list value from the given key.
- *
- * @since_tizen 3.0
- *
- * @param[in] state The state handle
- * @param[in] key The key
- * @param[out] list The list value
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_NO_DATA  No data available
- * @retval #IOTCON_ERROR_INVALID_TYPE  Invalid type
- */
-int iotcon_state_get_list(iotcon_state_h state, const char *key, iotcon_list_h *list);
-
-/**
- * @brief Gets the state value from the given key.
- *
- * @since_tizen 3.0
- *
- * @param[in] src The state handle
- * @param[in] key The key
- * @param[out] dest The state value at the key
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_NO_DATA  No data available
- * @retval #IOTCON_ERROR_INVALID_TYPE  Invalid type
- */
-int iotcon_state_get_state(iotcon_state_h src, const char *key, iotcon_state_h *dest);
-
-/**
- * @brief Checks whether the value of given key is NULL or not.
- *
- * @since_tizen 3.0
- *
- * @param[in] state The state handle
- * @param[in] key The key
- * @param[out] is_null true if the type of the given key is null, otherwise false
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- */
-int iotcon_state_is_null(iotcon_state_h state, const char *key, bool *is_null);
-
-/**
- * @brief Deletes the key and its associated value from the state.
- *
- * @since_tizen 3.0
- *
- * @param[in] state The state handle
- * @param[in] key The key
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_NO_DATA  No data available
- */
-int iotcon_state_unset(iotcon_state_h state, const char *key);
-
-/**
- * @brief Gets the type of a value at the given key.
- * @details It gets the data type of value related the @a key in @a state.
- * The data type could be one of #iotcon_types_e.
- *
- * @since_tizen 3.0
- *
- * @param[in] state The state handle
- * @param[in] key The key
- * @param[out] type The data type of value related the key in state handle.
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_NO_DATA  No data available
- */
-int iotcon_state_get_type(iotcon_state_h state, const char *key, int *type);
-
-/**
  * @brief Appends a new child representation on to the end of the parent representation
  * @details Duplicated child representation is allowed to append.
  *
@@ -616,597 +474,7 @@ int iotcon_representation_get_nth_child(iotcon_representation_h parent, int pos,
                iotcon_representation_h *child);
 
 /**
- * @brief Specifies the type of function passed to iotcon_state_foreach()
- *
- * @since_tizen 3.0
- *
- * @param[in] state The state handle
- * @param[in] key The key
- * @param[in] user_data The user data to pass to the function
- *
- * @return #IOTCON_FUNC_CONTINUE to continue with the next function of the loop,
- * otherwise #IOTCON_FUNC_STOP to break out of the loop
- * @retval #IOTCON_FUNC_CONTINUE  Continue to iterate next key
- * @retval #IOTCON_FUNC_STOP  Stop to iterate key
- *
- * @pre iotcon_state_foreach() will invoke this callback function.
- *
- * @see iotcon_state_foreach()
- */
-typedef int (*iotcon_state_cb)(iotcon_state_h state, const char *key, void *user_data);
-
-/**
- * @brief Call a function for each element of state.
- * @details iotcon_state_cb() will be called for each child.
- *
- * @since_tizen 3.0
- *
- * @param[in] state The state handle
- * @param[in] cb The callback function to invoke
- * @param[in] user_data The user data to pass to the function
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- *
- * @post iotcon_state_cb() will be called for each child.
- *
- * @see iotcon_state_cb()
- */
-int iotcon_state_foreach(iotcon_state_h state, iotcon_state_cb cb, void *user_data);
-
-/**
- * @brief  Gets the number of keys in the state.
- *
- * @since_tizen 3.0
- *
- * @param[in] state The state handle
- * @param[out] count The number of keys
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- */
-int iotcon_state_get_keys_count(iotcon_state_h state, unsigned int *count);
-
-/**
- * @brief Creates a new list handle.
- *
- * @since_tizen 3.0
- *
- * @param[in] type The type of list
- * @param[out] list A newly allocated list handle
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_INVALID_TYPE  Invalid type
- */
-int iotcon_list_create(iotcon_types_e type, iotcon_list_h *list);
-
-/**
- * @brief Frees a list handle.
- * @details Releases a @a list and its internal data.
- *
- * @since_tizen 3.0
- *
- * @param[in] list The handle to the list
- *
- * @return void
+ * @}
  */
-void iotcon_list_destroy(iotcon_list_h list);
 
-/**
- * @brief Inserts a new element integer value into the list at the given position.
- * @details If @a pos is negative, or is larger than the number of elements in the list,
- * the new value is added on to the end of the list.
- *
- * @since_tizen 3.0
- *
- * @param[in] list The list handle
- * @param[in] val The new integer value
- * @param[in] pos The position to insert value
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_INVALID_TYPE  Invalid type
- */
-int iotcon_list_add_int(iotcon_list_h list, int val, int pos);
-
-/**
- * @brief Inserts a new element boolean value into the list at the given position.
- * @details If @a pos is negative, or is larger than the number of elements in the list,
- * the new value is added on to the end of the list.
- *
- * @since_tizen 3.0
- *
- * @param[in] list The list handle
- * @param[in] val The new boolean value
- * @param[in] pos The position to insert value
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_INVALID_TYPE  Invalid type
- */
-int iotcon_list_add_bool(iotcon_list_h list, bool val, int pos);
-
-/**
- * @brief Inserts a new element double value into the list at the given position.
- * @details If @a pos is negative, or is larger than the number of elements in the list,
- * the new value is added on to the end of the list.
- *
- * @since_tizen 3.0
- *
- * @param[in] list The list handle
- * @param[in] val The new double value
- * @param[in] pos The position to insert value
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_INVALID_TYPE  Invalid type
- */
-int iotcon_list_add_double(iotcon_list_h list, double val, int pos);
-
-/**
- * @brief Inserts a new element string value into the list at the given position.
- * @details If @a pos is negative, or is larger than the number of elements in the list,
- * the new value is added on to the end of the list.
- *
- * @since_tizen 3.0
- *
- * @param[in] list The list handle
- * @param[in] val The new char value
- * @param[in] pos The position to insert value
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_INVALID_TYPE  Invalid type
- */
-int iotcon_list_add_str(iotcon_list_h list, char *val, int pos);
-
-/**
- * @brief Inserts a new element list into the list at the given position.
- * @details If @a pos is negative, or is larger than the number of elements in the list,
- * the new value is added on to the end of the list.
- *
- * @since_tizen 3.0
- *
- * @param[in] list The list handle
- * @param[in] val The new list value
- * @param[in] pos The position to insert value
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_INVALID_TYPE  Invalid type
- */
-int iotcon_list_add_list(iotcon_list_h list, iotcon_list_h val, int pos);
-
-/**
- * @brief Inserts a new element state value into the list at the given position.
- * @details If @a pos is negative, or is larger than the number of elements in the list,
- * the new value is added on to the end of the list.
- *
- * @since_tizen 3.0
- *
- * @param[in] list The list handle
- * @param[in] val The new state value
- * @param[in] pos The position to insert value
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_INVALID_TYPE  Invalid type
- */
-int iotcon_list_add_state(iotcon_list_h list, iotcon_state_h val, int pos);
-
-/**
- * @brief Gets the integer value at the given position.
- * @details Iterates over the list until it reaches the @a pos-1 position.
- *
- * @since_tizen 3.0
- *
- * @param[in] list The list handle
- * @param[in] pos The position
- * @param[out] val The integer value to get
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_NO_DATA  No data available
- * @retval #IOTCON_ERROR_REPRESENTATION  Representation errors
- */
-int iotcon_list_get_nth_int(iotcon_list_h list, int pos, int *val);
-
-/**
- * @brief Gets the boolean value at the given position.
- * @details Iterates over the list until it reaches the @a pos-1 position.
- *
- * @since_tizen 3.0
- *
- * @param[in] list The list handle
- * @param[in] pos The position
- * @param[out] val The boolean value to get
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_NO_DATA  No data available
- * @retval #IOTCON_ERROR_REPRESENTATION  Representation errors
- */
-int iotcon_list_get_nth_bool(iotcon_list_h list, int pos, bool *val);
-
-/**
- * @brief Gets the double value at the given position.
- * @details Iterates over the list until it reaches the @a pos-1 position.
- *
- * @since_tizen 3.0
- *
- * @param[in] list The list handle
- * @param[in] pos The position
- * @param[out] val The double value to get
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_NO_DATA  No data available
- * @retval #IOTCON_ERROR_REPRESENTATION  Representation errors
- */
-int iotcon_list_get_nth_double(iotcon_list_h list, int pos, double *val);
-
-/**
- * @brief Gets the string value at the given position.
- * @details Iterates over the list until it reaches the @a pos-1 position.
- *
- * @since_tizen 3.0
- *
- * @param[in] list The list handle
- * @param[in] pos The position
- * @param[out] val The string value to get
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_NO_DATA  No data available
- * @retval #IOTCON_ERROR_REPRESENTATION  Representation errors
- */
-int iotcon_list_get_nth_str(iotcon_list_h list, int pos, char **val);
-
-/**
- * @brief Gets the list value at the given position.
- * @details Iterates over the list until it reaches the @a pos-1 position.
- *
- * @since_tizen 3.0
- *
- * @param[in] src The list handle
- * @param[in] pos The position
- * @param[out] dest The list value to get
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_NO_DATA  No data available
- * @retval #IOTCON_ERROR_REPRESENTATION  Representation errors
- */
-int iotcon_list_get_nth_list(iotcon_list_h src, int pos, iotcon_list_h *dest);
-
-/**
- * @brief Gets the state value at the given position.
- * @details Iterates over the list until it reaches the @a pos-1 position.
- *
- * @since_tizen 3.0
- *
- * @param[in] list The list handle
- * @param[in] pos The position
- * @param[out] state The state value to get
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_NO_DATA  No data available
- * @retval #IOTCON_ERROR_REPRESENTATION  Representation errors
- */
-int iotcon_list_get_nth_state(iotcon_list_h list, int pos, iotcon_state_h *state);
-
-/**
- * @brief Deletes the value at the given position.
- * @details Iterates over the list until it reaches the @a pos-1 position.
- *
- * @since_tizen 3.0
- *
- * @param[in] list The list handle
- * @param[in] pos The position to delete
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_NO_DATA  No data available
- */
-int iotcon_list_remove_nth(iotcon_list_h list, int pos);
-
-/**
- * @brief Gets the type of the list.
- * @details It gets the data type of value related the @a key in @a state.
- * The data type could be one of #iotcon_types_e.
- *
- * @since_tizen 3.0
- *
- * @param[in] list The list handle
- * @param[out] type The data type of list.
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- */
-int iotcon_list_get_type(iotcon_list_h list, int *type);
-
-/**
- * @brief Gets the number of elements in a list.
- *
- * @since_tizen 3.0
- *
- * @param[in] list The handle to the list
- * @param[out] length The length of list
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- */
-int iotcon_list_get_length(iotcon_list_h list, unsigned int *length);
-
-/**
- * @brief Specifies the type of function passed to iotcon_list_foreach_int()
- *
- * @since_tizen 3.0
- *
- * @param[in] pos The number of the integer value (0 being the first)
- * @param[in] value The integer value
- * @param[in] user_data The user data to pass to the function
- *
- * @return #IOTCON_FUNC_CONTINUE to continue with the next function of the loop,
- * otherwise #IOTCON_FUNC_STOP to break out of the loop
- * @retval #IOTCON_FUNC_STOP  stop to call next function
- * @retval #IOTCON_FUNC_CONTINUE  continue to call next function
- *
- * @pre iotcon_list_foreach_int() will invoke this callback function.
- *
- * @see iotcon_list_foreach_int()
- */
-typedef int (*iotcon_list_int_cb)(int pos, int value, void *user_data);
-
-/**
- * @brief Gets all integer values of the given list by invoking the callback function.
- * @details iotcon_list_int_cb() will be called for each child.
- *
- * @since_tizen 3.0
- *
- * @param[in] list The handle to the list
- * @param[in] cb The callback function to get each integer value
- * @param[in] user_data The user data to be passed to the callback function
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- *
- * @post iotcon_list_int_cb() will be called for each item.
- *
- * @see iotcon_list_int_cb()
- */
-int iotcon_list_foreach_int(iotcon_list_h list, iotcon_list_int_cb cb, void *user_data);
-
-/**
- * @brief Specifies the type of function passed to iotcon_list_foreach_bool()
- *
- * @since_tizen 3.0
- *
- * @param[in] pos The number of the boolean value (0 being the first)
- * @param[in] value The boolean value
- * @param[in] user_data The user data to pass to the function
- *
- * @return #IOTCON_FUNC_CONTINUE to continue with the next function of the loop,
- * otherwise #IOTCON_FUNC_STOP to break out of the loop
- * @retval #IOTCON_FUNC_STOP  stop to call next function
- * @retval #IOTCON_FUNC_CONTINUE  continue to call next function
- *
- * @pre iotcon_list_foreach_bool() will invoke this callback function.
- *
- * @see iotcon_list_foreach_bool()
- */
-typedef int (*iotcon_list_bool_cb)(int pos, bool value, void *user_data);
-
-/**
- * @brief Gets all boolean values of the given list by invoking the callback function.
- * @details iotcon_list_bool_cb() will be called for each child.
- *
- * @since_tizen 3.0
- *
- * @param[in] list The handle to the list
- * @param[in] cb The callback function to get each boolean value
- * @param[in] user_data The user data to be passed to the callback function
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- *
- * @post iotcon_list_bool_cb() will be called for each item.
- *
- * @see iotcon_list_bool_cb()
- */
-int iotcon_list_foreach_bool(iotcon_list_h list, iotcon_list_bool_cb cb, void *user_data);
-
-/**
- * @brief Specifies the type of function passed to iotcon_list_foreach_double()
- *
- * @since_tizen 3.0
- *
- * @param[in] pos The number of the double value (0 being the first)
- * @param[in] value The double value
- * @param[in] user_data The user data to pass to the function
- *
- * @return #IOTCON_FUNC_CONTINUE to continue with the next function of the loop,
- * otherwise #IOTCON_FUNC_STOP to break out of the loop
- * @retval #IOTCON_FUNC_STOP  stop to call next function
- * @retval #IOTCON_FUNC_CONTINUE  continue to call next function
- *
- * @pre iotcon_list_foreach_double() will invoke this callback function.
- *
- * @see iotcon_list_foreach_double()
- */
-typedef int (*iotcon_list_double_cb)(int pos, double value, void *user_data);
-
-/**
- * @brief Gets all double values of the given list by invoking the callback function.
- * @details iotcon_list_double_cb() will be called for each child.
- *
- * @since_tizen 3.0
- *
- * @param[in] list The handle to the list
- * @param[in] cb The callback function to get each double value
- * @param[in] user_data The user data to be passed to the callback function
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- *
- * @post iotcon_list_double_cb() will be called for each item.
- *
- * @see iotcon_list_double_cb()
- */
-int iotcon_list_foreach_double(iotcon_list_h list, iotcon_list_double_cb cb,
-               void *user_data);
-
-/**
- * @brief Specifies the type of function passed to iotcon_list_foreach_str()
- *
- * @since_tizen 3.0
- *
- * @param[in] pos The number of the string value (0 being the first)
- * @param[in] value The string value
- * @param[in] user_data The user data to pass to the function
- *
- * @return #IOTCON_FUNC_CONTINUE to continue with the next function of the loop,
- * otherwise #IOTCON_FUNC_STOP to break out of the loop
- * @retval #IOTCON_FUNC_STOP  stop to call next function
- * @retval #IOTCON_FUNC_CONTINUE  continue to call next function
- *
- * @pre iotcon_list_foreach_str() will invoke this callback function.
- *
- * @see iotcon_list_foreach_str()
- */
-typedef int (*iotcon_list_str_cb)(int pos, const char *value, void *user_data);
-
-/**
- * @brief Gets all string values of the given list by invoking the callback function.
- * @details iotcon_list_str_cb() will be called for each child.
- *
- * @since_tizen 3.0
- *
- * @param[in] list The handle to the list
- * @param[in] cb The callback function to get each string value
- * @param[in] user_data The user data to be passed to the callback function
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- *
- * @post iotcon_list_str_cb() will be called for each item.
- *
- * @see iotcon_list_str_cb()
- */
-int iotcon_list_foreach_str(iotcon_list_h list, iotcon_list_str_cb cb, void *user_data);
-
-/**
- * @brief Specifies the type of function passed to iotcon_list_foreach_list()
- *
- * @since_tizen 3.0
- *
- * @param[in] pos The number of the list value (0 being the first)
- * @param[in] value The list value
- * @param[in] user_data The user data to pass to the function
- *
- * @return #IOTCON_FUNC_CONTINUE to continue with the next function of the loop,
- * otherwise #IOTCON_FUNC_STOP to break out of the loop
- * @retval #IOTCON_FUNC_STOP  stop to call next function
- * @retval #IOTCON_FUNC_CONTINUE  continue to call next function
- *
- * @pre iotcon_list_foreach_list() will invoke this callback function.
- *
- * @see iotcon_list_foreach_list()
- */
-typedef int (*iotcon_list_list_cb)(int pos, iotcon_list_h value, void *user_data);
-
-/**
- * @brief Gets all sub lists of the given list by invoking the callback function.
- * @details iotcon_list_list_cb() will be called for each child.
- *
- * @since_tizen 3.0
- *
- * @param[in] list The handle to the origin list
- * @param[in] cb The callback function to get each sub list
- * @param[in] user_data The user data to be passed to the callback function
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- *
- * @post iotcon_list_list_cb() will be called for each item.
- *
- * @see iotcon_list_list_cb()
- */
-int iotcon_list_foreach_list(iotcon_list_h list, iotcon_list_list_cb cb, void *user_data);
-
-/**
- * @brief Specifies the type of function passed to iotcon_list_foreach_state()
- *
- * @since_tizen 3.0
- *
- * @param[in] pos The number of the state value (0 being the first)
- * @param[in] value The state value
- * @param[in] user_data The user data to pass to the function
- *
- * @return #IOTCON_FUNC_CONTINUE to continue with the next function of the loop,
- * otherwise #IOTCON_FUNC_STOP to break out of the loop
- * @retval #IOTCON_FUNC_STOP  stop to call next function
- * @retval #IOTCON_FUNC_CONTINUE  continue to call next function
- *
- * @pre iotcon_list_foreach_state() will invoke this callback function.
- *
- * @see iotcon_list_foreach_state()
- */
-typedef int (*iotcon_list_state_cb)(int pos, iotcon_state_h value, void *user_data);
-
-/**
- * @brief Gets all state of the given list by invoking the callback function.
- * @details iotcon_list_state_cb() will be called for each child.
- *
- * @since_tizen 3.0
- *
- * @param[in] list The handle to the list
- * @param[in] cb The callback function to get each state
- * @param[in] user_data The user data to be passed to the callback function
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- *
- * @post iotcon_list_state_cb() will be called for each item.
- *
- * @see iotcon_list_state_cb()
- */
-int iotcon_list_foreach_state(iotcon_list_h list, iotcon_list_state_cb cb, void *user_data);
-
-/**
- * @}
- */
-#endif /* __IOT_CONNECTIVITY_MANAGER_REPRESENTATION_H__ */
+#endif /* __IOT_CONNECTIVITY_MANAGER_STRUCT_REPRESENTATION_H__ */
diff --git a/lib/include/iotcon-request.h b/lib/include/iotcon-request.h
new file mode 100644 (file)
index 0000000..015e419
--- /dev/null
@@ -0,0 +1,224 @@
+/*
+ * Copyright (c) 2015 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.
+ */
+#ifndef __IOT_CONNECTIVITY_MANAGER_SERVER_REQUEST_H__
+#define __IOT_CONNECTIVITY_MANAGER_SERVER_REQUEST_H__
+
+#include <iotcon-constant.h>
+
+/**
+ * @file iotcon-request.h
+ */
+
+/**
+ * @ingroup CAPI_IOT_CONNECTIVITY_SERVER_MODULE
+ * @defgroup CAPI_IOT_CONNECTIVITY_SERVER_REQUEST_MODULE Request
+ *
+ * @brief Iotcon Request provides API to manage client's request.
+ *
+ * @section CAPI_IOT_CONNECTIVITY_SERVER_REQUEST_MODULE_HEADER Header
+ *  \#include <iotcon.h>
+ *
+ * @{
+ */
+
+/**
+ * @brief Gets host address of the request
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] request The handle of the request
+ * @param[out] host_address The host address of the request
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ *
+ * @see iotcon_request_get_connectivity_type()
+ * @see iotcon_request_get_representation()
+ * @see iotcon_request_get_types()
+ * @see iotcon_request_get_options()
+ * @see iotcon_request_get_query()
+ * @see iotcon_request_get_observer_action()
+ * @see iotcon_request_get_observer_id()
+ */
+int iotcon_request_get_host_address(iotcon_request_h request,
+               char **host_address);
+
+/**
+ * @brief Gets connectivity type of the request
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] request The handle of the request
+ * @param[out] connectivity_type The connectivity type of the request
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ *
+ * @see iotcon_request_get_host_address()
+ * @see iotcon_request_get_representation()
+ * @see iotcon_request_get_types()
+ * @see iotcon_request_get_options()
+ * @see iotcon_request_get_query()
+ * @see iotcon_request_get_observer_action()
+ * @see iotcon_request_get_observer_id()
+ */
+int iotcon_request_get_connectivity_type(iotcon_request_h request,
+               int *connectivity_type);
+               
+/**
+ * @brief Gets an representation of the request
+ *
+ * @since_tizen 3.0
+ * @remarks @a repr must not be released using free().
+ *
+ * @param[in] request The handle of the request
+ * @param[out] repr The representation of the request
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ *
+ * @see iotcon_request_get_host_address()
+ * @see iotcon_request_get_connectivity_type()
+ * @see iotcon_request_get_types()
+ * @see iotcon_request_get_options()
+ * @see iotcon_request_get_query()
+ * @see iotcon_request_get_observer_action()
+ * @see iotcon_request_get_observer_id()
+ */
+int iotcon_request_get_representation(iotcon_request_h request,
+               iotcon_representation_h *repr);
+
+/**
+ * @brief Get types of the request
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] request The handle of the request
+ * @param[out] types The types of the request
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ *
+ * @see iotcon_request_get_host_address()
+ * @see iotcon_request_get_connectivity_type()
+ * @see iotcon_request_get_representation()
+ * @see iotcon_request_get_options()
+ * @see iotcon_request_get_query()
+ * @see iotcon_request_get_observer_action()
+ * @see iotcon_request_get_observer_id()
+ */
+int iotcon_request_get_types(iotcon_request_h request, int *types);
+
+/**
+ * @brief Get options of the request
+ *
+ * @since_tizen 3.0
+ * @remarks @a options must not be released using free().
+ *
+ * @param[in] request The handle of the request
+ * @param[out] options The options of the request
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ *
+ * @see iotcon_request_get_host_address()
+ * @see iotcon_request_get_connectivity_type()
+ * @see iotcon_request_get_representation()
+ * @see iotcon_request_get_types()
+ * @see iotcon_request_get_query()
+ * @see iotcon_request_get_observer_action()
+ * @see iotcon_request_get_observer_id()
+ */
+int iotcon_request_get_options(iotcon_request_h request, iotcon_options_h *options);
+
+/**
+ * @brief Get query of the request
+ *
+ * @since_tizen 3.0
+ * @remarks @a query must not be released using free().
+ *
+ * @param[in] request The handle of the request
+ * @param[out] query The query of the request
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ *
+ * @see iotcon_request_get_host_address()
+ * @see iotcon_request_get_connectivity_type()
+ * @see iotcon_request_get_representation()
+ * @see iotcon_request_get_types()
+ * @see iotcon_request_get_options()
+ * @see iotcon_request_get_observer_action()
+ * @see iotcon_request_get_observer_id()
+ */
+int iotcon_request_get_query(iotcon_request_h request, iotcon_query_h *query);
+
+/**
+ * @brief Get observation action of the request
+ *
+ * @since_tizen 3.0
+ * @details The @a action could be one of #iotcon_observe_action_e.
+ *
+ * @param[in] request The handle of the request
+ * @param[out] action The observation action of the request
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ *
+ * @see iotcon_request_get_host_address()
+ * @see iotcon_request_get_connectivity_type()
+ * @see iotcon_request_get_representation()
+ * @see iotcon_request_get_types()
+ * @see iotcon_request_get_options()
+ * @see iotcon_request_get_query()
+ * @see iotcon_request_get_observer_id()
+ */
+int iotcon_request_get_observer_action(iotcon_request_h request, int *action);
+
+/**
+ * @brief Get observation id of the request
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] request The handle of the request
+ * @param[out] observer_id The id of the observer
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ *
+ * @see iotcon_request_get_host_address()
+ * @see iotcon_request_get_connectivity_type()
+ * @see iotcon_request_get_representation()
+ * @see iotcon_request_get_types()
+ * @see iotcon_request_get_options()
+ * @see iotcon_request_get_query()
+ * @see iotcon_request_get_observer_action()
+ */
+int iotcon_request_get_observer_id(iotcon_request_h request, int *observer_id);
+
+/**
+ * @}
+ */
+
+#endif /* __IOT_CONNECTIVITY_MANAGER_SERVER_REQUEST_H__ */
diff --git a/lib/include/iotcon-resource-types.h b/lib/include/iotcon-resource-types.h
new file mode 100644 (file)
index 0000000..dd5bdf3
--- /dev/null
@@ -0,0 +1,179 @@
+/*
+ * Copyright (c) 2015 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.
+ */
+#ifndef __IOT_CONNECTIVITY_MANAGER_STRUCT_RESOURCE_TYPES_H__
+#define __IOT_CONNECTIVITY_MANAGER_STRUCT_RESOURCE_TYPES_H__
+
+#include <iotcon-constant.h>
+
+/**
+ * @file iotcon-resource-types.h
+ */
+
+/**
+ * @ingroup CAPI_IOT_CONNECTIVITY_COMMON_MODULE
+ * @defgroup CAPI_IOT_CONNECTIVITY_COMMON_RESOURCE_TYPES_MODULE Resource Types
+ *
+ * @brief Iotcon Resource Types provides API to manage resource types.
+ *
+ * @section CAPI_IOT_CONNECTIVITY_COMMON_RESOURCE_TYPES_MODULE_HEADER Header
+ *  \#include <iotcon.h>
+ *
+ * @{
+ */
+
+/**
+ * @brief Creates a new resource types handle.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] ret_types A newly allocated list of resource types handle
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ *
+ * @see iotcon_resource_types_destroy()
+ * @see iotcon_resource_types_add()
+ * @see iotcon_resource_types_remove()
+ * @see iotcon_resource_types_clone()
+ */
+int iotcon_resource_types_create(iotcon_resource_types_h *ret_types);
+
+/**
+ * @brief Free a resource types handle.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] types The handle of the resource types
+ *
+ * @return void
+ *
+ * @see iotcon_resource_types_create()
+ * @see iotcon_resource_types_add()
+ * @see iotcon_resource_types_remove()
+ * @see iotcon_resource_types_clone()
+ */
+void iotcon_resource_types_destroy(iotcon_resource_types_h types);
+
+/**
+ * @brief Inserts a resource type into the list.
+ *
+ * @since_tizen 3.0
+ * @remarks The length of resource type should be less than or equal to 61. \n
+ * Duplicate strings are not allowed.
+ *
+ * @param[in] types The handle of the resource types
+ * @param[in] type The string data to insert into the resource types
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ *
+ * @see iotcon_resource_types_create()
+ * @see iotcon_resource_types_destroy()
+ * @see iotcon_resource_types_remove()
+ * @see iotcon_resource_types_clone()
+ */
+int iotcon_resource_types_add(iotcon_resource_types_h types, const char *type);
+
+/**
+ * @brief Delete a resource type form the list.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] types The handle of the resource types
+ * @param[in] type The string data to delete from the resource types
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_NO_DATA  No data available
+ *
+ * @see iotcon_resource_types_create()
+ * @see iotcon_resource_types_destroy()
+ * @see iotcon_resource_types_add()
+ * @see iotcon_resource_types_clone()
+ */
+int iotcon_resource_types_remove(iotcon_resource_types_h types, const char *type);
+
+/**
+ * @brief Specifies the type of function passed to iotcon_resource_types_foreach()
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] type The value of the resource types
+ * @param[in] user_data The user data to pass to the function
+ *
+ * @return #IOTCON_FUNC_CONTINUE to continue with the next function of the loop,
+ * otherwise #IOTCON_FUNC_STOP to break out of the loop
+ * @retval #IOTCON_FUNC_STOP  stop to call next function
+ * @retval #IOTCON_FUNC_CONTINUE  continue to call next function
+ *
+ * @pre iotcon_resource_types_foreach() will invoke this callback function.
+ *
+ * @see iotcon_resource_types_foreach()
+ */
+typedef int (*iotcon_resource_types_foreach_cb)(const char *type, void *user_data);
+
+/**
+ * @brief Gets all of the resource types of the list by invoking the callback function.
+ * @details iotcon_resource_types_foreach_cb() will be called for each type.\n
+ * If iotcon_resource_types_foreach_cb() returns #IOTCON_FUNC_STOP, iteration will be stop.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] types The handle of resource types
+ * @param[in] cb The callback function to get data
+ * @param[in] user_data The user data to pass to the function
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ *
+ * @post iotcon_resource_types_foreach() will be called for each type.
+ *
+ * @see iotcon_resource_types_foreach_cb()
+ */
+int iotcon_resource_types_foreach(iotcon_resource_types_h types,
+               iotcon_resource_types_foreach_cb cb, void *user_data);
+
+/**
+ * @brief Clones the resource types handle.
+ * @details Makes a deep copy of a source list of resource types.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] src The origin handle of the resource types
+ * @param[out] dest Clone of a source list of resource types
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ *
+ * @see iotcon_resource_types_create()
+ * @see iotcon_resource_types_destroy()
+ * @see iotcon_resource_types_add()
+ * @see iotcon_resource_types_remove()
+ */
+int iotcon_resource_types_clone(iotcon_resource_types_h src,
+               iotcon_resource_types_h *dest);
+
+/**
+ * @}
+ */
+
+#endif /* __IOT_CONNECTIVITY_MANAGER_STRUCT_RESOURCE_TYPES_H__ */
diff --git a/lib/include/iotcon-resource.h b/lib/include/iotcon-resource.h
new file mode 100644 (file)
index 0000000..26b18d2
--- /dev/null
@@ -0,0 +1,444 @@
+/*
+ * Copyright (c) 2015 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.
+ */
+#ifndef __IOT_CONNECTIVITY_MANAGER_SERVER_RESOURCE_H__
+#define __IOT_CONNECTIVITY_MANAGER_SERVER_RESOURCE_H__
+
+#include <stdbool.h>
+#include <iotcon-constant.h>
+
+/**
+ * @file iotcon-resource.h
+ */
+
+/**
+ * @ingroup CAPI_IOT_CONNECTIVITY_SERVER_MODULE
+ * @defgroup CAPI_IOT_CONNECTIVITY_SERVER_RESOURCE_MODULE Resource
+ *
+ * @brief Iotcon Resource provides API to manage resource.
+ *
+ * @section CAPI_IOT_CONNECTIVITY_SERVER_RESOURCE_MODULE_HEADER Header
+ *  \#include <iotcon.h>
+ *
+ * @{
+ */
+
+/**
+ * @brief Specifies the type of function passed to iotcon_resource_create() and
+ * iotcon_resource_set_request_handler()
+ * @details Called when server receive request from the client.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] resource The resource requested
+ * @param[in] request The request from client
+ * @param[in] user_data The user data to pass to the function
+ *
+ * @pre The callback must be registered using iotcon_resource_create()
+ *
+ * @see iotcon_resource_create()
+ * @see iotcon_resource_set_request_handler()
+ */
+typedef void (*iotcon_request_handler_cb)(iotcon_resource_h resource,
+               iotcon_request_h request, void *user_data);
+
+/**
+ * @brief Create a resource handle and registers the resource in server
+ * @details Registers a resource specified by @a uri_path, @a res_types, @a ifaces which have
+ * @a properties in Iotcon server.\n
+ * When client find the registered resource, iotcon_request_handler_cb() will be called automatically.\n
+ * @a uri_path format would be relative URI path like '/a/light'\n
+ * @a res_types is a list of resource types. Create a iotcon_resource_types_h handle and
+ * add types string to it.\n
+ * @a ifaces can contain multiple interfaces like
+ * IOTCON_INTERFACE_LINK | IOTCON_INTERFACE_BATCH.\n
+ * @a properties also can contain multiple properties like
+ * IOTCON_ACTIVE | IOTCON_DISCOVERABLE.\n
+ * iotcon_request_handler_cb() will be called when receive CRUD request to the registered
+ * resource.
+ *
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/internet
+ *
+ * @remarks @a uri_path length must be less than or equal 36.\n
+ * You must unregister resource by calling iotcon_resource_destroy()
+ * if resource is no longer needed.
+ *
+ * @param[in] uri_path The URI path of the resource.
+ * @param[in] res_types The list of type of the resource.
+ * @param[in] ifaces The interfaces of the resource.
+ * @param[in] properties The property of the resource.
+ * @param[in] cb The request handler callback function
+ * @param[in] user_data The user data to pass to the callback function
+ * @param[out] resource_handle The handle of the resource
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_IOTIVITY  Iotivity errors
+ * @retval #IOTCON_ERROR_DBUS  Dbus errors
+ * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
+ * @retval #IOTCON_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @post When the resource receive CRUD request, iotcon_request_handler_cb() will be called.
+ *
+ * @see iotcon_resource_destroy()
+ * @see iotcon_resource_bind_interface()
+ * @see iotcon_resource_bind_type()
+ * @see iotcon_resource_set_request_handler()
+ * @see iotcon_resource_bind_child_resource()
+ * @see iotcon_resource_unbind_child_resource()
+ * @see iotcon_request_handler_cb()
+ */
+int iotcon_resource_create(const char *uri_path,
+               iotcon_resource_types_h res_types,
+               int ifaces,
+               int properties,
+               iotcon_request_handler_cb cb,
+               void *user_data,
+               iotcon_resource_h *resource_handle);
+
+/**
+ * @brief Destroy the resource and releases its data.
+ *
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/internet
+ *
+ * @remarks When a normal variable is used, there are only dbus error and permission\n
+ * denied error. If the errors of this API are not handled, then you must check\n
+ * whether dbus is running and an application have the privileges for the API.
+ *
+ * @param[in] resource_handle The handle of the resource to be unregistered
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_DBUS  Dbus error
+ * @retval #IOTCON_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @see iotcon_resource_create()
+ * @see iotcon_resource_bind_interface()
+ * @see iotcon_resource_bind_type()
+ * @see iotcon_resource_set_request_handler()
+ * @see iotcon_resource_bind_child_resource()
+ * @see iotcon_resource_unbind_child_resource()
+ * @see iotcon_request_handler_cb()
+ */
+int iotcon_resource_destroy(iotcon_resource_h resource_handle);
+
+/**
+ * @brief Binds an interface to the resource
+ *
+ * @details The @a action could be one of #iotcon_interface_e.
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/internet
+ *
+ * @remarks Set only one interface to @a iface. If not, @a iface will be ignored.
+ *
+ * @param[in] resource The handle of the resource
+ * @param[in] iface The interface to be bound to the resource
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_DBUS  Dbus error
+ * @retval #IOTCON_ERROR_SYSTEM System error
+ * @retval #IOTCON_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @see iotcon_resource_create()
+ * @see iotcon_resource_destroy()
+ * @see iotcon_resource_bind_type()
+ * @see iotcon_resource_set_request_handler()
+ * @see iotcon_resource_bind_child_resource()
+ * @see iotcon_resource_unbind_child_resource()
+ * @see iotcon_request_handler_cb()
+ */
+int iotcon_resource_bind_interface(iotcon_resource_h resource, iotcon_interface_e iface);
+
+/**
+ * @brief Binds a type to the resource
+ *
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/internet
+ *
+ * @param[in] resource_handle The handle of the resource
+ * @param[in] resource_type The type to be bound to the resource
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_DBUS  Dbus error
+ * @retval #IOTCON_ERROR_SYSTEM System error
+ * @retval #IOTCON_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @see iotcon_resource_create()
+ * @see iotcon_resource_destroy()
+ * @see iotcon_resource_bind_interface()
+ * @see iotcon_resource_set_request_handler()
+ * @see iotcon_resource_bind_child_resource()
+ * @see iotcon_resource_unbind_child_resource()
+ * @see iotcon_request_handler_cb()
+ */
+int iotcon_resource_bind_type(iotcon_resource_h resource_handle,
+               const char *resource_type);
+
+/**
+ * @brief Binds a request handler to the resource
+ * @details When the resource receive CRUD request, iotcon_request_handler_cb() will be
+ * called.
+ *
+ * @since_tizen 3.0
+ *
+ * @remarks Registered callback function will be replaced with the new @a cb.\n
+ *
+ * @param[in] resource The handle of the resource
+ * @param[in] cb The request handler to be bound to the resource
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ *
+ * @see iotcon_resource_create()
+ * @see iotcon_resource_destroy()
+ * @see iotcon_resource_bind_interface()
+ * @see iotcon_resource_bind_type()
+ * @see iotcon_resource_bind_child_resource()
+ * @see iotcon_resource_unbind_child_resource()
+ * @see iotcon_request_handler_cb()
+ */
+int iotcon_resource_set_request_handler(iotcon_resource_h resource,
+               iotcon_request_handler_cb cb);
+
+/**
+ * @brief Binds a child resource into the parent resource.
+ *
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/internet
+ *
+ * @param[in] parent The handle of the parent resource
+ * @param[in] child The handle of the child resource to be added to the parent resource
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_ALREADY  Already done
+ * @retval #IOTCON_ERROR_DBUS  Dbus error
+ * @retval #IOTCON_ERROR_SYSTEM System error
+ * @retval #IOTCON_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @see iotcon_resource_create()
+ * @see iotcon_resource_destroy()
+ * @see iotcon_resource_bind_interface()
+ * @see iotcon_resource_bind_type()
+ * @see iotcon_resource_set_request_handler()
+ * @see iotcon_resource_unbind_child_resource()
+ * @see iotcon_request_handler_cb()
+ */
+int iotcon_resource_bind_child_resource(iotcon_resource_h parent,
+               iotcon_resource_h child);
+
+/**
+ * @brief Unbinds a child resource from the parent resource.
+ *
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/internet
+ *
+ * @param[in] parent The handle of the parent resource
+ * @param[in] child The handle of the child resource to be unbound from the parent resource
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_DBUS  Dbus error
+ * @retval #IOTCON_ERROR_SYSTEM System error
+ * @retval #IOTCON_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @see iotcon_resource_create()
+ * @see iotcon_resource_destroy()
+ * @see iotcon_resource_bind_interface()
+ * @see iotcon_resource_bind_type()
+ * @see iotcon_resource_set_request_handler()
+ * @see iotcon_resource_bind_child_resource()
+ * @see iotcon_request_handler_cb()
+ */
+int iotcon_resource_unbind_child_resource(iotcon_resource_h parent,
+               iotcon_resource_h child);
+
+/**
+ * @brief Notifies specific clients that resource's attributes have changed.
+ * @details If @a observers is @c NULL, the @a msg will notify to all observers.
+ *
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/internet
+ *
+ * @param[in] resource The handle of the resource
+ * @param[in] msg The handle of the notifications message
+ * @param[in] observers The handle of the observers.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_DBUS  Dbus error
+ * @retval #IOTCON_ERROR_REPRESENTATION  Representation error
+ * @retval #IOTCON_ERROR_SYSTEM  System error
+ * @retval #IOTCON_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @see iotcon_remote_resource_observe_cb()
+ * @see iotcon_remote_resource_observer_start()
+ * @see iotcon_remote_resource_observer_stop()
+ * @see iotcon_notimsg_create()
+ * @see iotcon_notimsg_destroy()
+ * @see iotcon_observers_create()
+ * @see iotcon_observers_destroy()
+ * @see iotcon_observers_add()
+ * @see iotcon_observers_remove()
+ */
+int iotcon_resource_notify(iotcon_resource_h resource, iotcon_notimsg_h msg,
+               iotcon_observers_h observers);
+
+/**
+ * @brief Gets the number of children resources of the resource
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] resource The handle of the resource
+ * @param[out] number The number of children resources
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ *
+ * @see iotcon_resource_get_nth_child()
+ * @see iotcon_resource_get_uri_path()
+ * @see iotcon_resource_get_types()
+ * @see iotcon_resource_get_interfaces()
+ * @see iotcon_resource_is_observable()
+ */
+int iotcon_resource_get_number_of_children(iotcon_resource_h resource, int *number);
+
+/**
+ * @brief Gets the child resource at the given index in the parent resource
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] parent The handle of the parent resource
+ * @param[in] index The index of the child resource
+ * @param[out] child The child resource at the index
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ *
+ * @see iotcon_resource_get_number_of_children()
+ * @see iotcon_resource_get_uri_path()
+ * @see iotcon_resource_get_types()
+ * @see iotcon_resource_get_interfaces()
+ * @see iotcon_resource_is_observable()
+ */
+int iotcon_resource_get_nth_child(iotcon_resource_h parent, int index,
+               iotcon_resource_h *child);
+
+/**
+ * @brief Gets an URI path of the resource
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] resource The handle of the resource
+ * @param[out] uri_path The URI path of the resource
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ *
+ * @see iotcon_resource_get_number_of_children()
+ * @see iotcon_resource_get_nth_child()
+ * @see iotcon_resource_get_types()
+ * @see iotcon_resource_get_interfaces()
+ * @see iotcon_resource_is_observable()
+ */
+int iotcon_resource_get_uri_path(iotcon_resource_h resource, char **uri_path);
+
+/**
+ * @brief Get the list of types in the resource
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] resource The handle of the resource
+ * @param[out] types The types of the resource
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ *
+ * @see iotcon_resource_get_number_of_children()
+ * @see iotcon_resource_get_nth_child()
+ * @see iotcon_resource_get_uri_path()
+ * @see iotcon_resource_get_interfaces()
+ * @see iotcon_resource_is_observable()
+ */
+int iotcon_resource_get_types(iotcon_resource_h resource, iotcon_resource_types_h *types);
+
+/**
+ * @brief Get the interfaces of the resource
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] resource The handle of the resource
+ * @param[out] ifaces The interfaces of the resource
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ *
+ * @see iotcon_resource_get_number_of_children()
+ * @see iotcon_resource_get_nth_child()
+ * @see iotcon_resource_get_uri_path()
+ * @see iotcon_resource_get_types()
+ * @see iotcon_resource_is_observable()
+ */
+int iotcon_resource_get_interfaces(iotcon_resource_h resource, int *ifaces);
+
+/**
+ * @brief Checks whether the resource is observable or not.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] resource The handle of the resource
+ * @param[out] observable The value of observable
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ *
+ * @see iotcon_resource_get_number_of_children()
+ * @see iotcon_resource_get_nth_child()
+ * @see iotcon_resource_get_uri_path()
+ * @see iotcon_resource_get_types()
+ * @see iotcon_resource_get_interfaces()
+ */
+int iotcon_resource_is_observable(iotcon_resource_h resource, bool *observable);
+
+/**
+ * @}
+ */
+
+#endif /* __IOT_CONNECTIVITY_MANAGER_SERVER_RESOURCE_H__ */
diff --git a/lib/include/iotcon-response.h b/lib/include/iotcon-response.h
new file mode 100644 (file)
index 0000000..d9db53d
--- /dev/null
@@ -0,0 +1,180 @@
+/*
+ * Copyright (c) 2015 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.
+ */
+#ifndef __IOT_CONNECTIVITY_MANAGER_SERVER_RESPONSE_H__
+#define __IOT_CONNECTIVITY_MANAGER_SERVER_RESPONSE_H__
+
+#include <iotcon-constant.h>
+
+/**
+ * @file iotcon-response.h
+ */
+
+/**
+ * @ingroup CAPI_IOT_CONNECTIVITY_SERVER_MODULE
+ * @defgroup CAPI_IOT_CONNECTIVITY_SERVER_RESPONSE_MODULE Response
+ *
+ * @brief Iotcon Response provides API to manage response.
+ *
+ * @section CAPI_IOT_CONNECTIVITY_SERVER_RESPONSE_MODULE_HEADER Header
+ *  \#include <iotcon.h>
+ *
+ * @{
+ */
+
+/**
+ * @brief Creates a response handle.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] request The handle of received request handle
+ * @param[out] response Generated response handle
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
+ *
+ * @see iotcon_response_destroy()
+ * @see iotcon_response_set()
+ */
+int iotcon_response_create(iotcon_request_h request, iotcon_response_h *response);
+
+/**
+ * @brief Free a response handle.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] resp The handle of the response
+ *
+ * @see iotcon_response_create()
+ * @see iotcon_response_set()
+ */
+void iotcon_response_destroy(iotcon_response_h resp);
+
+/**
+ * @brief Sets new uri path into the response
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] resp The handle of the response
+ * @param[in] new_uri_path New uri path to set
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
+ *
+ * @see iotcon_response_create()
+ * @see iotcon_response_destroy()
+ */
+int iotcon_response_set_new_uri_path(iotcon_response_h resp, char *new_uri_path);
+
+/**
+ * @brief Sets result into the response
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] resp The handle of the response
+ * @param[in] result The result to set
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
+ *
+ * @see iotcon_response_create()
+ * @see iotcon_response_destroy()
+ */
+int iotcon_response_set_result(iotcon_response_h resp, int result);
+
+/**
+ * @brief Sets representation into the response
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] resp The handle of the response
+ * @param[in] repr The representation of the response
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
+ *
+ * @see iotcon_response_create()
+ * @see iotcon_response_destroy()
+ */
+int iotcon_response_set_representation(iotcon_response_h resp,
+               iotcon_representation_h repr);
+
+/**
+ * @brief Sets header options into the response
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] resp The handle of the response
+ * @param[in] options The header options of the response
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
+ *
+ * @see iotcon_response_create()
+ * @see iotcon_response_destroy()
+ */
+int iotcon_response_set_header_options(iotcon_response_h resp, iotcon_options_h options);
+
+/**
+ * @brief Sets resource interface into the response
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] resp The handle of the response
+ * @param[in] iface The resource interface
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
+ *
+ * @see iotcon_response_create()
+ * @see iotcon_response_destroy()
+ */
+int iotcon_response_set_interface(iotcon_response_h resp, iotcon_interface_e iface);
+
+/**
+ * @brief Send response for incoming request.
+ *
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/internet
+ *
+ * @param[in] resp The handle of the response to send
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_DBUS  Dbus error
+ * @retval #IOTCON_ERROR_SYSTEM System error
+ * @retval #IOTCON_ERROR_PERMISSION_DENIED Permission denied
+ */
+int iotcon_response_send(iotcon_response_h resp);
+
+/**
+ * @}
+ */
+
+#endif /* __IOT_CONNECTIVITY_MANAGER_SERVER_RESPONSE_H__ */
diff --git a/lib/include/iotcon-server.h b/lib/include/iotcon-server.h
new file mode 100644 (file)
index 0000000..4835890
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2015 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.
+ */
+#ifndef __IOT_CONNECTIVITY_MANAGER_SERVER_H__
+#define __IOT_CONNECTIVITY_MANAGER_SERVER_H__
+
+#include <iotcon-resource.h>
+#include <iotcon-lite-resource.h>
+#include <iotcon-notimsg.h>
+#include <iotcon-response.h>
+#include <iotcon-observers.h>
+#include <iotcon-request.h>
+
+/**
+ * @file iotcon-server.h
+ */
+
+/**
+ * @ingroup CAPI_IOT_CONNECTIVITY_MODULE
+ * @defgroup CAPI_IOT_CONNECTIVITY_SERVER_MODULE Server
+ *
+ * @brief Iotcon Server provides API for server side.
+ *
+ * @section CAPI_IOT_CONNECTIVITY_SERVER_MODULE_HEADER Header
+ *  \#include <iotcon.h>
+ *
+ * @section CAPI_IOT_CONNECTIVITY_SERVER_MODULE_OVERVIEW Overview
+ * This API set consists of server side API for @ref CAPI_IOT_CONNECTIVITY_SERVER_RESOURCE_MODULE,
+ * @ref CAPI_IOT_CONNECTIVITY_SERVER_LITE_RESOURCE_MODULE, @ref CAPI_IOT_CONNECTIVITY_SERVER_NOTIMSG_MODULE,
+ * @ref CAPI_IOT_CONNECTIVITY_SERVER_OBSERVERS_MODULE, @ref CAPI_IOT_CONNECTIVITY_SERVER_REQUEST_MODULE,
+ * @ref CAPI_IOT_CONNECTIVITY_SERVER_RESPONSE_MODULE.
+ *
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+#endif /* __IOT_CONNECTIVITY_MANAGER_SERVER_H__ */
diff --git a/lib/include/iotcon-state.h b/lib/include/iotcon-state.h
new file mode 100644 (file)
index 0000000..7ebc6d3
--- /dev/null
@@ -0,0 +1,394 @@
+/*
+ * Copyright (c) 2015 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.
+ */
+#ifndef __IOT_CONNECTIVITY_MANAGER_STRUCT_STATE_H__
+#define __IOT_CONNECTIVITY_MANAGER_STRUCT_STATE_H__
+
+#include <stdbool.h>
+#include <iotcon-constant.h>
+
+/**
+ * @file iotcon-state.h
+ */
+
+/**
+ * @ingroup CAPI_IOT_CONNECTIVITY_COMMON_MODULE
+ * @defgroup CAPI_IOT_CONNECTIVITY_COMMON_STATE_MODULE State
+ *
+ * @brief Iotcon State provides API to manage state.
+ *
+ * @section CAPI_IOT_CONNECTIVITY_COMMON_STATE_MODULE_HEADER Header
+ *  \#include <iotcon.h>
+ *
+ * @{
+ */
+
+/**
+ * @brief Creates a new state handle.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[out] state A newly allocated state handle
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ *
+ * @see iotcon_state_destroy()
+ */
+int iotcon_state_create(iotcon_state_h *state);
+
+/**
+ * @brief Frees a state.
+ * @details Releases a @a state and its internal data.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] state The state handle to free
+ *
+ * @return void
+ *
+ * @see iotcon_state_create()
+ */
+void iotcon_state_destroy(iotcon_state_h state);
+
+/**
+ * @brief Sets a new key and integer value into the representation.
+ * @details If @a key is already exists, current value will be replaced with new @a val.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] state The state handle
+ * @param[in] key The key
+ * @param[in] val The value
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ */
+int iotcon_state_set_int(iotcon_state_h state, const char *key, int val);
+
+/**
+ * @brief Sets a new key and boolean value into the representation.
+ * @details If @a key is already exists, current value will be replaced with new @a val.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] state The state handle
+ * @param[in] key The key
+ * @param[in] val The value
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ */
+int iotcon_state_set_bool(iotcon_state_h state, const char *key, bool val);
+
+/**
+ * @brief Sets a new key and double value into the representation.
+ * @details If @a key is already exists, current value will be replaced with new @a val.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] state The state handle
+ * @param[in] key The key
+ * @param[in] val The value
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ */
+int iotcon_state_set_double(iotcon_state_h state, const char *key, double val);
+
+/**
+ * @brief Sets a new key and string value into the representation.
+ * @details If @a key is already exists, current value will be replaced with new @a val.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] state The state handle
+ * @param[in] key The key
+ * @param[in] val The value
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ */
+int iotcon_state_set_str(iotcon_state_h state, const char *key, char *val);
+
+/**
+ * @brief Sets a new key and list value into the representation.
+ * @details If @a key is already exists, current list will be replaced with new @a list.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] state The state handle
+ * @param[in] key The key
+ * @param[in] list The value
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ */
+int iotcon_state_set_list(iotcon_state_h state, const char *key, iotcon_list_h list);
+
+/**
+ * @brief Sets a new key and state value into the representation.
+ * @details If @a key is already exists, current state will be replaced with new @a src.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] dest The state handle
+ * @param[in] key The key
+ * @param[in] src The state handle to set newly
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ */
+int iotcon_state_set_state(iotcon_state_h dest, const char *key, iotcon_state_h src);
+
+/**
+ * @brief Sets a new key with NULL value into the representation.
+ * @details If @a key is already exists, current value will be replaced with NULL
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] state The state handle
+ * @param[in] key The key to be set NULL
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ */
+int iotcon_state_set_null(iotcon_state_h state, const char *key);
+
+/**
+ * @brief Gets the integer value from the given key.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] state The state handle
+ * @param[in] key The key
+ * @param[out] val The integer value
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_NO_DATA  No data available
+ * @retval #IOTCON_ERROR_INVALID_TYPE  Invalid type
+ */
+int iotcon_state_get_int(iotcon_state_h state, const char *key, int *val);
+
+/**
+ * @brief Gets the boolean value from the given key.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] state The state handle
+ * @param[in] key The key
+ * @param[out] val The boolean value
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_NO_DATA  No data available
+ * @retval #IOTCON_ERROR_INVALID_TYPE  Invalid type
+ */
+int iotcon_state_get_bool(iotcon_state_h state, const char *key, bool *val);
+
+/**
+ * @brief Gets the double value from the given key.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] state The state handle
+ * @param[in] key The key
+ * @param[out] val The double value
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_NO_DATA  No data available
+ * @retval #IOTCON_ERROR_INVALID_TYPE  Invalid type
+ */
+int iotcon_state_get_double(iotcon_state_h state, const char *key, double *val);
+
+/**
+ * @brief Gets the string value from the given key.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] state The state handle
+ * @param[in] key The key
+ * @param[out] val The string value
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_NO_DATA  No data available
+ * @retval #IOTCON_ERROR_INVALID_TYPE  Invalid type
+ */
+int iotcon_state_get_str(iotcon_state_h state, const char *key, char **val);
+
+/**
+ * @brief Gets the list value from the given key.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] state The state handle
+ * @param[in] key The key
+ * @param[out] list The list value
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_NO_DATA  No data available
+ * @retval #IOTCON_ERROR_INVALID_TYPE  Invalid type
+ */
+int iotcon_state_get_list(iotcon_state_h state, const char *key, iotcon_list_h *list);
+
+/**
+ * @brief Gets the state value from the given key.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] src The state handle
+ * @param[in] key The key
+ * @param[out] dest The state value at the key
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_NO_DATA  No data available
+ * @retval #IOTCON_ERROR_INVALID_TYPE  Invalid type
+ */
+int iotcon_state_get_state(iotcon_state_h src, const char *key, iotcon_state_h *dest);
+
+/**
+ * @brief Checks whether the value of given key is NULL or not.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] state The state handle
+ * @param[in] key The key
+ * @param[out] is_null true if the type of the given key is null, otherwise false
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ */
+int iotcon_state_is_null(iotcon_state_h state, const char *key, bool *is_null);
+
+/**
+ * @brief Deletes the key and its associated value from the state.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] state The state handle
+ * @param[in] key The key
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_NO_DATA  No data available
+ */
+int iotcon_state_unset(iotcon_state_h state, const char *key);
+
+/**
+ * @brief Gets the type of a value at the given key.
+ * @details It gets the data type of value related the @a key in @a state.
+ * The data type could be one of #iotcon_types_e.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] state The state handle
+ * @param[in] key The key
+ * @param[out] type The data type of value related the key in state handle.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #IOTCON_ERROR_NO_DATA  No data available
+ */
+int iotcon_state_get_type(iotcon_state_h state, const char *key, int *type);
+
+/**
+ * @brief Specifies the type of function passed to iotcon_state_foreach()
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] state The state handle
+ * @param[in] key The key
+ * @param[in] user_data The user data to pass to the function
+ *
+ * @return #IOTCON_FUNC_CONTINUE to continue with the next function of the loop,
+ * otherwise #IOTCON_FUNC_STOP to break out of the loop
+ * @retval #IOTCON_FUNC_CONTINUE  Continue to iterate next key
+ * @retval #IOTCON_FUNC_STOP  Stop to iterate key
+ *
+ * @pre iotcon_state_foreach() will invoke this callback function.
+ *
+ * @see iotcon_state_foreach()
+ */
+typedef int (*iotcon_state_cb)(iotcon_state_h state, const char *key, void *user_data);
+
+/**
+ * @brief Call a function for each element of state.
+ * @details iotcon_state_cb() will be called for each child.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] state The state handle
+ * @param[in] cb The callback function to invoke
+ * @param[in] user_data The user data to pass to the function
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ *
+ * @post iotcon_state_cb() will be called for each child.
+ *
+ * @see iotcon_state_cb()
+ */
+int iotcon_state_foreach(iotcon_state_h state, iotcon_state_cb cb, void *user_data);
+
+/**
+ * @brief  Gets the number of keys in the state.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] state The state handle
+ * @param[out] count The number of keys
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #IOTCON_ERROR_NONE  Successful
+ * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
+ */
+int iotcon_state_get_keys_count(iotcon_state_h state, unsigned int *count);
+
+/**
+ * @}
+ */
+
+#endif /* __IOT_CONNECTIVITY_MANAGER_STRUCT_STATE_H__ */
index 4d3ae65..1729c8c 100644 (file)
 #ifndef __IOT_CONNECTIVITY_MANAGER_STRUCT_H__
 #define __IOT_CONNECTIVITY_MANAGER_STRUCT_H__
 
-#include <stdbool.h>
+#include <iotcon-resource-types.h>
+#include <iotcon-options.h>
+#include <iotcon-query.h>
+#include <iotcon-list.h>
+#include <iotcon-state.h>
+#include <iotcon-representation.h>
 
-#include "iotcon-constant.h"
-
-/**
- *
- * @addtogroup CAPI_IOT_CONNECTIVITY_MODULE
- *
- * @{
- */
-
-/**
- * @brief The handle of lite resource.
- * @details iotcon_lite_resource_h is an opaque data structure to represent registered\n
- * resource by server. A resource has host, uri_path, resource types, and internal\n
- * handle. If observable attribute of resource is true, client can observe\n
- * this resource. When client request by GET / PUT / OBSERVE functions, handler will be\n
- * invoked, internally. Then, it sends the response to client, automatically.
- *
- * @since_tizen 3.0
- */
-typedef struct icl_lite_resource* iotcon_lite_resource_h;
-
-/**
- * @ingroup CAPI_IOT_CONNECTIVITY_REPRESENTATION_MODULE
- * @brief The handle of list which is consist of iotcon_value_h type values.
- * @details iotcon_list_h is an opaque data structure to have iotcon_value_h type values.
- *
- * @since_tizen 3.0
- */
-typedef struct icl_list_s* iotcon_list_h;
-
-/**
- * @ingroup CAPI_IOT_CONNECTIVITY_REPRESENTATION_MODULE
- * @brief The handle of representation.
- * @details iotcon_representation_h is an opaque data structure to have uri_path,\n
- * list of resource types and interfaces.\n
- * It could contain other representation as children.\n
- *
- * @since_tizen 3.0
- */
-typedef struct icl_representation_s* iotcon_representation_h;
-
-/**
- * @ingroup CAPI_IOT_CONNECTIVITY_REPRESENTATION_MODULE
- * @brief The handle of state.
- * @details iotcon_state_h is an opaque data structure to have attribute value map.\n
- * Attribute value map consists of a key and a value.\n
- * Datatype of the key is string and the value should be one of them\n
- * #IOTCON_TYPE_INT\n
- * #IOTCON_TYPE_BOOL\n
- * #IOTCON_TYPE_DOUBLE\n
- * #IOTCON_TYPE_STR\n
- * #IOTCON_TYPE_NULL\n
- * #IOTCON_TYPE_LIST\n
- * #IOTCON_TYPE_STATE
- *
- * @since_tizen 3.0
- */
-typedef struct icl_state_s* iotcon_state_h;
-
-/**
- * @brief The handle of notifications message.
- * @details iotcon_notimsg_h is an opaque data structure to notify message to observers.
- *
- * @since_tizen 3.0
- */
-typedef struct icl_notify_msg* iotcon_notimsg_h;
-
-/**
- * @brief The handle of presence.
- * @details iotcon_presence_h is a handle of presence subscription.\n
- * It is used to cancel presence.
- *
- * @since_tizen 3.0
- */
-typedef struct icl_presence* iotcon_presence_h;
-
-/**
- * @brief The handle of resource types
- * @details iotcon_resource_types_h is an opaque data structure to have list\n
- * of resource types. A resource type is datatype of string.
- *
- * @since_tizen 3.0
- */
-typedef struct icl_resource_types* iotcon_resource_types_h;
-
-
-/**
- * @brief Creates a new resource types handle.
- *
- * @since_tizen 3.0
- *
- * @param[out] ret_types A newly allocated list of resource types handle
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- *
- * @see iotcon_resource_types_destroy()
- * @see iotcon_resource_types_add()
- * @see iotcon_resource_types_remove()
- * @see iotcon_resource_types_clone()
- */
-int iotcon_resource_types_create(iotcon_resource_types_h *ret_types);
-
-/**
- * @brief Free a resource types handle.
- *
- * @since_tizen 3.0
- *
- * @param[in] types The handle of the resource types
- *
- * @return void
- *
- * @see iotcon_resource_types_create()
- * @see iotcon_resource_types_add()
- * @see iotcon_resource_types_remove()
- * @see iotcon_resource_types_clone()
- */
-void iotcon_resource_types_destroy(iotcon_resource_types_h types);
-
-/**
- * @brief Inserts a resource type into the list.
- *
- * @since_tizen 3.0
- * @remarks The length of resource type should be less than or equal to 61. \n
- * Duplicate strings are not allowed.
- *
- * @param[in] types The handle of the resource types
- * @param[in] type The string data to insert into the resource types
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- *
- * @see iotcon_resource_types_create()
- * @see iotcon_resource_types_destroy()
- * @see iotcon_resource_types_remove()
- * @see iotcon_resource_types_clone()
- */
-int iotcon_resource_types_add(iotcon_resource_types_h types, const char *type);
-
-/**
- * @brief Delete a resource type form the list.
- *
- * @since_tizen 3.0
- *
- * @param[in] types The handle of the resource types
- * @param[in] type The string data to delete from the resource types
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_NO_DATA  No data available
- *
- * @see iotcon_resource_types_create()
- * @see iotcon_resource_types_destroy()
- * @see iotcon_resource_types_add()
- * @see iotcon_resource_types_clone()
- */
-int iotcon_resource_types_remove(iotcon_resource_types_h types, const char *type);
-
-/**
- * @brief Specifies the type of function passed to iotcon_resource_types_foreach()
- *
- * @since_tizen 3.0
- *
- * @param[in] type The value of the resource types
- * @param[in] user_data The user data to pass to the function
- *
- * @return #IOTCON_FUNC_CONTINUE to continue with the next function of the loop,
- * otherwise #IOTCON_FUNC_STOP to break out of the loop
- * @retval #IOTCON_FUNC_STOP  stop to call next function
- * @retval #IOTCON_FUNC_CONTINUE  continue to call next function
- *
- * @pre iotcon_resource_types_foreach() will invoke this callback function.
- *
- * @see iotcon_resource_types_foreach()
- */
-typedef int (*iotcon_resource_types_foreach_cb)(const char *type, void *user_data);
-
-/**
- * @brief Gets all of the resource types of the list by invoking the callback function.
- * @details iotcon_resource_types_foreach_cb() will be called for each type.\n
- * If iotcon_resource_types_foreach_cb() returns #IOTCON_FUNC_STOP, iteration will be stop.
- *
- * @since_tizen 3.0
- *
- * @param[in] types The handle of resource types
- * @param[in] cb The callback function to get data
- * @param[in] user_data The user data to pass to the function
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- *
- * @post iotcon_resource_types_foreach() will be called for each type.
- *
- * @see iotcon_resource_types_foreach_cb()
- */
-int iotcon_resource_types_foreach(iotcon_resource_types_h types,
-               iotcon_resource_types_foreach_cb cb, void *user_data);
-
-/**
- * @brief Clones the resource types handle.
- * @details Makes a deep copy of a source list of resource types.
- *
- * @since_tizen 3.0
- *
- * @param[in] src The origin handle of the resource types
- * @param[out] dest Clone of a source list of resource types
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- *
- * @see iotcon_resource_types_create()
- * @see iotcon_resource_types_destroy()
- * @see iotcon_resource_types_add()
- * @see iotcon_resource_types_remove()
- */
-int iotcon_resource_types_clone(iotcon_resource_types_h src,
-               iotcon_resource_types_h *dest);
-
-
-
-/**
- * @brief The handle of options
- * @details iotcon_options_h is an opaque data structure to have attribute value map
- * which consists of a key and a value.\n
- * Datatype of key is integer and value is string.\n
- *
- * @since_tizen 3.0
- */
-typedef struct icl_options* iotcon_options_h;
-
-/**
- * @brief Creates a new option handle.
- *
- * @since_tizen 3.0
- *
- * @param[out] options A newly allocated option handle
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
- * @retval #IOTCON_ERROR_INVALID_PARAMETER Invalid parameter
- *
- * @see iotcon_options_destroy()
- * @see iotcon_options_add()
- * @see iotcon_options_remove()
- * @see iotcon_options_lookup()
- */
-int iotcon_options_create(iotcon_options_h *options);
-
-/**
- * @brief Free an option handle.
- *
- * @since_tizen 3.0
- *
- * @param[in] options The handle of the options
- *
- * @return void
- *
- * @see iotcon_options_create()
- * @see iotcon_options_add()
- * @see iotcon_options_remove()
- * @see iotcon_options_lookup()
- */
-void iotcon_options_destroy(iotcon_options_h options);
-
-/**
- * @brief Inserts a new id and a correspoding data into the options.
- *
- * @since_tizen 3.0
- * @remarks iotcon_options_h can have up to 2 options. \n
- * option id is always situated between 2048 and 3000. \n
- * Length of option data is less than or equal to 15.
- *
- * @param[in] options The handle of the options
- * @param[in] id The id of the option to insert
- * @param[in] data The string data to insert into the options
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- *
- * @see iotcon_options_create()
- * @see iotcon_options_destroy()
- * @see iotcon_options_remove()
- * @see iotcon_options_lookup()
- */
-int iotcon_options_add(iotcon_options_h options, unsigned short id,
-               const char *data);
-
-/**
- * @brief Deletes the id and its associated data from the options.
- *
- * @since_tizen 3.0
- *
- * @param[in] options The handle of the options
- * @param[in] id The id of the option to delete
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- *
- * @see iotcon_options_create()
- * @see iotcon_options_destroy()
- * @see iotcon_options_add()
- * @see iotcon_options_lookup()
- */
-int iotcon_options_remove(iotcon_options_h options, unsigned short id);
-
-/**
- * @brief Looks up data at the given id from the options.
- *
- * @since_tizen 3.0
- *
- * @param[in] options The handle of the options
- * @param[in] id The id of the option to lookup
- * @param[out] data Found data from options
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- *
- * @see iotcon_options_create()
- * @see iotcon_options_destroy()
- * @see iotcon_options_add()
- * @see iotcon_options_remove()
- */
-int iotcon_options_lookup(iotcon_options_h options, unsigned short id, char **data);
-
-/**
- * @brief Specifies the type of function passed to iotcon_options_foreach()
- *
- * @since_tizen 3.0
- *
- * @param[in] id The information of the option
- * @param[in] data The data of the option
- * @param[in] user_data The user data to pass to the function
- *
- * @return #IOTCON_FUNC_CONTINUE to continue with the next function of the loop,
- * otherwise #IOTCON_FUNC_STOP to break out of the loop
- * @retval #IOTCON_FUNC_STOP  stop to call next function
- * @retval #IOTCON_FUNC_CONTINUE  continue to call next function
- *
- * @pre iotcon_options_foreach() will invoke this callback function.
- *
- * @see iotcon_options_foreach()
- */
-typedef int (*iotcon_options_foreach_cb)(unsigned short id, const char *data,
-               void *user_data);
-
-/**
- * @brief Gets all datas of the options by invoking the callback function.
- * @details iotcon_options_foreach_cb() will be called for each option.\n
- * If iotcon_options_foreach_cb() returns #IOTCON_FUNC_STOP, iteration will be stop.
- *
- * @since_tizen 3.0
- *
- * @param[in] options The handle of the options
- * @param[in] cb The callback function to get data
- * @param[in] user_data The user data to pass to the function
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- *
- * @post iotcon_options_foreach_cb() will be called for each option.
- *
- * @see iotcon_options_foreach_cb()
- */
-int iotcon_options_foreach(iotcon_options_h options, iotcon_options_foreach_cb cb,
-               void *user_data);
-
-/**
- * @brief The handle of query
- * @details iotcon_query_h is an opaque data structure to have attribute value map
- * which consists of key and value.\n
- * Data ype of both key and value are string.\n
- * iotcon_query_h also have length.\n
- * The length is total length of all keys and values of map.\n
- * The length should be less than or equal to 64.
- *
- * @since_tizen 3.0
- */
-typedef struct icl_query* iotcon_query_h;
-
-/**
- * @brief Creates a new query handle.
- *
- * @since_tizen 3.0
- *
- * @param[out] query A newly allocated query handle
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- *
- * @see iotcon_query_destroy()
- * @see iotcon_query_add()
- * @see iotcon_query_remove()
- * @see iotcon_query_lookup()
- */
-int iotcon_query_create(iotcon_query_h *query);
-
-/**
- * @brief Free a query handle.
- *
- * @since_tizen 3.0
- *
- * @param[in] query The handle of the query
- *
- * @return void
- *
- * @see iotcon_query_create()
- * @see iotcon_query_add()
- * @see iotcon_query_remove()
- * @see iotcon_query_lookup()
- */
-void iotcon_query_destroy(iotcon_query_h query);
-
-/**
- * @brief Get resource types from the query.
- *
- * @since_tizen 3.0
- * @remarks @a types must not be released using iotcon_resource_types_destroy().
- *
- * @param[in] query The handle of the query
- * @param[out] types Found resource types from query
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_NO_DATA  No data available
- * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
- *
- * @see iotcon_query_create()
- * @see iotcon_query_destroy()
- * @see iotcon_query_add()
- * @see iotcon_query_remove()
- * @see iotcon_query_set_resource_types()
- */
-int iotcon_query_get_resource_tyeps(iotcon_query_h query, iotcon_resource_types_h *types);
-
-/**
- * @brief Get resource types from the query.
- * @details @a iface could be one of #iotcon_interface_e.
- *
- * @since_tizen 3.0
- *
- * @param[in] query The handle of the query
- * @param[out] iface Found interface from query
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_NO_DATA  No data available
- *
- * @see iotcon_query_create()
- * @see iotcon_query_destroy()
- * @see iotcon_query_add()
- * @see iotcon_query_remove()
- * @see iotcon_query_set_interface()
- */
-int iotcon_query_get_interface(iotcon_query_h query, int *iface);
-
-/**
- * @brief Sets the resource types into the query.
- *
- * @since_tizen 3.0
- *
- * @param[in] query The handle of the query
- * @param[in] value The resoure types to set into the query
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- *
- * @see iotcon_query_create()
- * @see iotcon_query_destroy()
- * @see iotcon_query_add()
- * @see iotcon_query_remove()
- * @see iotcon_query_lookup()
- * @see iotcon_query_get_resource_tyeps()
- */
-int iotcon_query_set_resource_types(iotcon_query_h query, iotcon_resource_types_h types);
-
-/**
- * @brief Sets the interface into the query.
- *
- * @since_tizen 3.0
- *
- * @param[in] query The handle of the query
- * @param[in] iface The interface to add into the query
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- *
- * @see iotcon_query_create()
- * @see iotcon_query_destroy()
- * @see iotcon_query_add()
- * @see iotcon_query_remove()
- * @see iotcon_query_lookup()
- * @see iotcon_query_get_interface()
- */
-int iotcon_query_set_interface(iotcon_query_h query, iotcon_interface_e iface);
-
-/**
- * @brief Inserts a new key and correspoding value into the query.
- *
- * @since_tizen 3.0
- * @remarks The full length of query should be less than or equal to 64.
- *
- * @param[in] query The handle of the query
- * @param[in] key The key of the query to insert
- * @param[in] value The string data to insert into the query
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- *
- * @see iotcon_query_create()
- * @see iotcon_query_destroy()
- * @see iotcon_query_remove()
- * @see iotcon_query_lookup()
- */
-int iotcon_query_add(iotcon_query_h query, const char *key, const char *value);
-
-/**
- * @brief Deletes the key and its associated value from the query.
- *
- * @since_tizen 3.0
- *
- * @param[in] query The handle of the query
- * @param[in] key The key of the option to delete
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- *
- * @see iotcon_query_create()
- * @see iotcon_query_destroy()
- * @see iotcon_query_add()
- * @see iotcon_query_lookup()
- */
-int iotcon_query_remove(iotcon_query_h query, const char *key);
-
-/**
- * @brief Lookup data at the given key from the query.
- *
- * @since_tizen 3.0
- *
- * @param[in] query The handle of the query
- * @param[in] key The key of the query to lookup
- * @param[out] data Found data from query
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- *
- * @see iotcon_query_create()
- * @see iotcon_query_destroy()
- * @see iotcon_query_add()
- * @see iotcon_query_remove()
- */
-int iotcon_query_lookup(iotcon_query_h query, const char *key, char **data);
-
-/**
- * @brief Specifies the type of function passed to iotcon_query_foreach()
- *
- * @since_tizen 3.0
- *
- * @param[in] key The key of the query
- * @param[in] value The value of the query
- * @param[in] user_data The user data to pass to the function
- *
- * @return #IOTCON_FUNC_CONTINUE to continue with the next function of the loop,
- * otherwise #IOTCON_FUNC_STOP to break out of the loop
- * @retval #IOTCON_FUNC_STOP  stop to call next function
- * @retval #IOTCON_FUNC_CONTINUE  continue to call next function
- *
- * @pre iotcon_query_foreach() will invoke this callback function.
- *
- * @see iotcon_query_foreach()
- */
-typedef int (*iotcon_query_foreach_cb)(const char *key, const char *value,
-               void *user_data);
-
-/**
- * @brief Gets all datas of the query by invoking the callback function.
- * @details iotcon_query_foreach_cb() will be called for each query.\n
- * If iotcon_query_foreach_cb() returns #IOTCON_FUNC_STOP, iteration will be stop.
- *
- * @since_tizen 3.0
- *
- * @param[in] query The handle of the query
- * @param[in] cb The callback function to get data
- * @param[in] user_data The user data to be passed to the callback function
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- *
- * @post iotcon_query_foreach_cb() will be called for each query.
- *
- * @see iotcon_query_foreach_cb()
- */
-int iotcon_query_foreach(iotcon_query_h query, iotcon_query_foreach_cb cb,
-               void *user_data);
-
-/**
- * @brief The handle of observers.
- * @details The list of observer ids.
- *
- * @since_tizen 3.0
- */
-typedef struct icl_observers* iotcon_observers_h;
-
-/**
- * @brief Creates a new observers handle.
- *
- * @since_tizen 3.0
- *
- * @param[out] ret_observers A newly allocated list of observers handle
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
- *
- * @see iotcon_observers_destroy()
- * @see iotcon_observers_add()
- * @see iotcon_observers_remove()
- */
-int iotcon_observers_create(iotcon_observers_h *ret_observers);
-
-/**
- * @brief Free a observers handle.
- *
- * @since_tizen 3.0
- *
- * @param[in] observers The handle of the observers
- *
- * @return void
- *
- * @see iotcon_observers_create()
- * @see iotcon_observers_add()
- * @see iotcon_observers_remove()
- */
-void iotcon_observers_destroy(iotcon_observers_h observers);
-
-/**
- * @brief Sets a observer id into the observers handle
- *
- * @since_tizen 3.0
- * @remarks  If you want to make a new list, then you should set NULL to @a observers.
- *
- * @param[in] observers The handle of the observers
- * @param[in] obs_id The id to be appended to observers
- * @param[out] ret_observers New appended observers handle
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- *
- * @see iotcon_observers_create()
- * @see iotcon_observers_destroy()
- * @see iotcon_observers_remove()
- */
-int iotcon_observers_add(iotcon_observers_h observers, int obs_id);
-
-/**
- * @brief Remove id from the observers.
- *
- * @since_tizen 3.0
- *
- * @param[in] observers observers The handle of the observers
- * @param[in] obs_id The id to be removed from observers
- * @param[out] ret_observers New deleted observers handle
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- *
- * @see iotcon_observers_create()
- * @see iotcon_observers_destroy()
- * @see iotcon_observers_add()
- */
-int iotcon_observers_remove(iotcon_observers_h observers, int obs_id);
-
-/**
- * @brief The handle of resource.
- * @details iotcon_resource_h is an opaque data structure to represent registered\n
- * resource by server. A resource has host, uri_path, resource types, interfaces\n
- * and internal handle. If observable attribute of resource is true, client can observe\n
- * this resource. When client request by CRUD functions, handler will be invoked\n
- * if registered. It could contain other resource as children.\n
- *
- * @since_tizen 3.0
- */
-typedef struct icl_resource* iotcon_resource_h;
-
-/**
- * @brief Gets the number of children resources of the resource
- *
- * @since_tizen 3.0
- *
- * @param[in] resource The handle of the resource
- * @param[out] number The number of children resources
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- *
- * @see iotcon_resource_get_nth_child()
- * @see iotcon_resource_get_uri_path()
- * @see iotcon_resource_get_types()
- * @see iotcon_resource_get_interfaces()
- * @see iotcon_resource_is_observable()
- */
-int iotcon_resource_get_number_of_children(iotcon_resource_h resource, int *number);
-
-/**
- * @brief Gets the child resource at the given index in the parent resource
- *
- * @since_tizen 3.0
- *
- * @param[in] parent The handle of the parent resource
- * @param[in] index The index of the child resource
- * @param[out] child The child resource at the index
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- *
- * @see iotcon_resource_get_number_of_children()
- * @see iotcon_resource_get_uri_path()
- * @see iotcon_resource_get_types()
- * @see iotcon_resource_get_interfaces()
- * @see iotcon_resource_is_observable()
- */
-int iotcon_resource_get_nth_child(iotcon_resource_h parent, int index,
-               iotcon_resource_h *child);
-
-/**
- * @brief Gets an URI path of the resource
- *
- * @since_tizen 3.0
- *
- * @param[in] resource The handle of the resource
- * @param[out] uri_path The URI path of the resource
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- *
- * @see iotcon_resource_get_number_of_children()
- * @see iotcon_resource_get_nth_child()
- * @see iotcon_resource_get_types()
- * @see iotcon_resource_get_interfaces()
- * @see iotcon_resource_is_observable()
- */
-int iotcon_resource_get_uri_path(iotcon_resource_h resource, char **uri_path);
-
-/**
- * @brief Get the list of types in the resource
- *
- * @since_tizen 3.0
- *
- * @param[in] resource The handle of the resource
- * @param[out] types The types of the resource
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- *
- * @see iotcon_resource_get_number_of_children()
- * @see iotcon_resource_get_nth_child()
- * @see iotcon_resource_get_uri_path()
- * @see iotcon_resource_get_interfaces()
- * @see iotcon_resource_is_observable()
- */
-int iotcon_resource_get_types(iotcon_resource_h resource, iotcon_resource_types_h *types);
-
-/**
- * @brief Get the interfaces of the resource
- *
- * @since_tizen 3.0
- *
- * @param[in] resource The handle of the resource
- * @param[out] ifaces The interfaces of the resource
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- *
- * @see iotcon_resource_get_number_of_children()
- * @see iotcon_resource_get_nth_child()
- * @see iotcon_resource_get_uri_path()
- * @see iotcon_resource_get_types()
- * @see iotcon_resource_is_observable()
- */
-int iotcon_resource_get_interfaces(iotcon_resource_h resource, int *ifaces);
-
-/**
- * @brief Checks whether the resource is observable or not.
- *
- * @since_tizen 3.0
- *
- * @param[in] resource The handle of the resource
- * @param[out] observable The value of observable
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- *
- * @see iotcon_resource_get_number_of_children()
- * @see iotcon_resource_get_nth_child()
- * @see iotcon_resource_get_uri_path()
- * @see iotcon_resource_get_types()
- * @see iotcon_resource_get_interfaces()
- */
-int iotcon_resource_is_observable(iotcon_resource_h resource, bool *observable);
-
-/**
- * @brief The handle of remote resource
- * @details When Client success to find out resource from remote server,
- * server's resource information is reorganized as iotcon_remote_resource_h by Iotcon.
- * Client can request CRUD to server by using this.\n
- * iotcon_remote_resource_h is an opaque data structure to have host, uri_path,\n
- * resource types, interfaces, options and device id.\n
- * If observable attribute is true, remote resource is observable.\n
- * When you observe remote resource, observe_handle will be set.
- *
- * @since_tizen 3.0
- */
-typedef struct icl_remote_resource* iotcon_remote_resource_h;
-
-/**
- * @brief Gets an URI path of the remote resource
- *
- * @since_tizen 3.0
- * @remarks @a uri_path must not be released using free().
- *
- * @param[in] resource The handle of the remote resource
- * @param[out] uri_path The URI path of the remote resource
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- *
- * @see iotcon_remote_resource_get_host_address()
- * @see iotcon_remote_resource_get_connectivity_type()
- * @see iotcon_remote_resource_get_device_id()
- * @see iotcon_remote_resource_get_types()
- * @see iotcon_remote_resource_get_interfaces()
- * @see iotcon_remote_resource_is_observable()
- * @see iotcon_remote_resource_set_options()
- */
-int iotcon_remote_resource_get_uri_path(iotcon_remote_resource_h resource,
-               char **uri_path);
-
-/**
- * @brief Gets an host address of the remote resource
- *
- * @since_tizen 3.0
- * @remarks @a host must not be released using free().
- *
- * @param[in] resource The handle of the remote resource
- * @param[out] host The host address of the remote resource
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- *
- * @see iotcon_remote_resource_get_uri_path()
- * @see iotcon_remote_resource_get_connectivity_type()
- * @see iotcon_remote_resource_get_device_id()
- * @see iotcon_remote_resource_get_types()
- * @see iotcon_remote_resource_get_interfaces()
- * @see iotcon_remote_resource_is_observable()
- * @see iotcon_remote_resource_set_options()
- */
-int iotcon_remote_resource_get_host_address(iotcon_remote_resource_h resource,
-               char **host);
-
-/**
- * @brief Gets connectivity type of the remote resource
- *
- * @since_tizen 3.0
- *
- * @param[in] request The handle of the remote resource
- * @param[out] connectivity_type The connectivity type of the remote resource
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
-
- * @see iotcon_remote_resource_get_uri_path()
- * @see iotcon_remote_resource_get_host_address()
- * @see iotcon_remote_resource_get_device_id()
- * @see iotcon_remote_resource_get_types()
- * @see iotcon_remote_resource_get_interfaces()
- * @see iotcon_remote_resource_is_observable()
- * @see iotcon_remote_resource_set_options()
- */
-int iotcon_remote_resource_get_connectivity_type(iotcon_remote_resource_h resource,
-               int *connectivity_type);
-
-/**
- * @brief Gets an device id of the remote resource
- *
- * @since_tizen 3.0
- * @remarks @a device_id must not be released using free().
- *
- * @param[in] resource The handle of the remote resource
- * @param[out] device_id The device id of the remote resource
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- *
- * @see iotcon_remote_resource_get_uri_path()
- * @see iotcon_remote_resource_get_host_address()
- * @see iotcon_remote_resource_get_connectivity_type()
- * @see iotcon_remote_resource_get_types()
- * @see iotcon_remote_resource_get_interfaces()
- * @see iotcon_remote_resource_is_observable()
- * @see iotcon_remote_resource_set_options()
- */
-int iotcon_remote_resource_get_device_id(iotcon_remote_resource_h resource,
-               char **device_id);
-
-/**
- * @brief Gets resource types of the remote resource
- *
- * @since_tizen 3.0
- *
- * @param[in] resource The handle of the remote resource
- * @param[out] types The resource types of the remote resource
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- *
- * @see iotcon_remote_resource_get_uri_path()
- * @see iotcon_remote_resource_get_host_address()
- * @see iotcon_remote_resource_get_connectivity_type()
- * @see iotcon_remote_resource_get_device_id()
- * @see iotcon_remote_resource_get_interfaces()
- * @see iotcon_remote_resource_is_observable()
- * @see iotcon_remote_resource_set_options()
- */
-int iotcon_remote_resource_get_types(iotcon_remote_resource_h resource,
-               iotcon_resource_types_h *types);
-
-/**
- * @brief Gets resource interfaces of the remote resource
- *
- * @since_tizen 3.0
- *
- * @param[in] resource The handle of the remote resource
- * @param[out] ifaces The resource interfaces of the remote resource
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- *
- * @see iotcon_remote_resource_get_uri_path()
- * @see iotcon_remote_resource_get_host_address()
- * @see iotcon_remote_resource_get_connectivity_type()
- * @see iotcon_remote_resource_get_device_id()
- * @see iotcon_remote_resource_get_types()
- * @see iotcon_remote_resource_is_observable()
- * @see iotcon_remote_resource_set_options()
- */
-int iotcon_remote_resource_get_interfaces(iotcon_remote_resource_h resource, int *ifaces);
-
-/**
- * @brief Checks whether the remote resource is observable or not.
- *
- * @since_tizen 3.0
- *
- * @param[in] resource The handle of the resource
- * @param[out] observable The value of observable
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- *
- * @see iotcon_remote_resource_get_uri_path()
- * @see iotcon_remote_resource_get_host_address()
- * @see iotcon_remote_resource_get_connectivity_type()
- * @see iotcon_remote_resource_get_device_id()
- * @see iotcon_remote_resource_get_types()
- * @see iotcon_remote_resource_get_interfaces()
- * @see iotcon_remote_resource_set_options()
- */
-int iotcon_remote_resource_is_observable(iotcon_remote_resource_h resource,
-               bool *observable);
-
-/**
- * @brief Sets options into the remote resource
- *
- * @since_tizen 3.0
- *
- * @param[in] resource The handle of the remote resource
- * @param[in] options The handle of the header options
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- *
- * @see iotcon_remote_resource_get_uri_path()
- * @see iotcon_remote_resource_get_host_address()
- * @see iotcon_remote_resource_get_connectivity_type()
- * @see iotcon_remote_resource_get_device_id()
- * @see iotcon_remote_resource_get_types()
- * @see iotcon_remote_resource_get_interfaces()
- * @see iotcon_remote_resource_is_observable()
- */
-int iotcon_remote_resource_set_options(iotcon_remote_resource_h resource,
-               iotcon_options_h options);
-
-/**
-* @brief The handle of request
-* @details iotcon_request_h is an opaque data structure to request to a particular resource.\n
-* iotcon_request_h is a data type of client's request which consists of header options,
-* query, representation.
-*
-* @since_tizen 3.0
-*/
-typedef struct icl_resource_request* iotcon_request_h;
-
-/**
- * @brief Gets host address of the request
- *
- * @since_tizen 3.0
- *
- * @param[in] request The handle of the request
- * @param[out] host_address The host address of the request
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- *
- * @see iotcon_request_get_connectivity_type()
- * @see iotcon_request_get_representation()
- * @see iotcon_request_get_types()
- * @see iotcon_request_get_options()
- * @see iotcon_request_get_query()
- * @see iotcon_request_get_observer_action()
- * @see iotcon_request_get_observer_id()
- */
-int iotcon_request_get_host_address(iotcon_request_h request,
-               char **host_address);
-
-/**
- * @brief Gets connectivity type of the request
- *
- * @since_tizen 3.0
- *
- * @param[in] request The handle of the request
- * @param[out] connectivity_type The connectivity type of the request
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- *
- * @see iotcon_request_get_host_address()
- * @see iotcon_request_get_representation()
- * @see iotcon_request_get_types()
- * @see iotcon_request_get_options()
- * @see iotcon_request_get_query()
- * @see iotcon_request_get_observer_action()
- * @see iotcon_request_get_observer_id()
- */
-int iotcon_request_get_connectivity_type(iotcon_request_h request,
-               int *connectivity_type);
-
-/**
- * @brief Gets an representation of the request
- *
- * @since_tizen 3.0
- * @remarks @a repr must not be released using free().
- *
- * @param[in] request The handle of the request
- * @param[out] repr The representation of the request
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- *
- * @see iotcon_request_get_host_address()
- * @see iotcon_request_get_connectivity_type()
- * @see iotcon_request_get_types()
- * @see iotcon_request_get_options()
- * @see iotcon_request_get_query()
- * @see iotcon_request_get_observer_action()
- * @see iotcon_request_get_observer_id()
- */
-int iotcon_request_get_representation(iotcon_request_h request,
-               iotcon_representation_h *repr);
-
-/**
- * @brief Get types of the request
- *
- * @since_tizen 3.0
- *
- * @param[in] request The handle of the request
- * @param[out] types The types of the request
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- *
- * @see iotcon_request_get_host_address()
- * @see iotcon_request_get_connectivity_type()
- * @see iotcon_request_get_representation()
- * @see iotcon_request_get_options()
- * @see iotcon_request_get_query()
- * @see iotcon_request_get_observer_action()
- * @see iotcon_request_get_observer_id()
- */
-int iotcon_request_get_types(iotcon_request_h request, int *types);
-
-/**
- * @brief Get options of the request
- *
- * @since_tizen 3.0
- * @remarks @a options must not be released using free().
- *
- * @param[in] request The handle of the request
- * @param[out] options The options of the request
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- *
- * @see iotcon_request_get_host_address()
- * @see iotcon_request_get_connectivity_type()
- * @see iotcon_request_get_representation()
- * @see iotcon_request_get_types()
- * @see iotcon_request_get_query()
- * @see iotcon_request_get_observer_action()
- * @see iotcon_request_get_observer_id()
- */
-int iotcon_request_get_options(iotcon_request_h request, iotcon_options_h *options);
-
-/**
- * @brief Get query of the request
- *
- * @since_tizen 3.0
- * @remarks @a query must not be released using free().
- *
- * @param[in] request The handle of the request
- * @param[out] query The query of the request
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- *
- * @see iotcon_request_get_host_address()
- * @see iotcon_request_get_connectivity_type()
- * @see iotcon_request_get_representation()
- * @see iotcon_request_get_types()
- * @see iotcon_request_get_options()
- * @see iotcon_request_get_observer_action()
- * @see iotcon_request_get_observer_id()
- */
-int iotcon_request_get_query(iotcon_request_h request, iotcon_query_h *query);
-
-/**
- * @brief Get observation action of the request
- *
- * @since_tizen 3.0
- * @details The @a action could be one of #iotcon_observe_action_e.
- *
- * @param[in] request The handle of the request
- * @param[out] action The observation action of the request
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- *
- * @see iotcon_request_get_host_address()
- * @see iotcon_request_get_connectivity_type()
- * @see iotcon_request_get_representation()
- * @see iotcon_request_get_types()
- * @see iotcon_request_get_options()
- * @see iotcon_request_get_query()
- * @see iotcon_request_get_observer_id()
- */
-int iotcon_request_get_observer_action(iotcon_request_h request, int *action);
-
-/**
- * @brief Get observation id of the request
- *
- * @since_tizen 3.0
- *
- * @param[in] request The handle of the request
- * @param[out] observer_id The id of the observer
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- *
- * @see iotcon_request_get_host_address()
- * @see iotcon_request_get_connectivity_type()
- * @see iotcon_request_get_representation()
- * @see iotcon_request_get_types()
- * @see iotcon_request_get_options()
- * @see iotcon_request_get_query()
- * @see iotcon_request_get_observer_action()
- */
-int iotcon_request_get_observer_id(iotcon_request_h request, int *observer_id);
-
-/**
-* @brief The handle of response
-* @details iotcon_response_h is an opaque data structure to respond to client.\n
-* iotcon_response_h is a data type of server's response which consists of result,
-* header options, query, representation.
-*
-*
-* @since_tizen 3.0
-*/
-typedef struct icl_resource_response* iotcon_response_h;
-
-/**
- * @brief Creates a response handle.
- *
- * @since_tizen 3.0
- *
- * @param[in] request The handle of received request handle
- * @param[out] response Generated response handle
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
- *
- * @see iotcon_response_destroy()
- * @see iotcon_response_set()
- */
-int iotcon_response_create(iotcon_request_h request, iotcon_response_h *response);
-
-/**
- * @brief Free a response handle.
- *
- * @since_tizen 3.0
- *
- * @param[in] resp The handle of the response
- *
- * @see iotcon_response_create()
- * @see iotcon_response_set()
- */
-void iotcon_response_destroy(iotcon_response_h resp);
-
-/**
- * @brief Sets new uri path into the response
- *
- * @since_tizen 3.0
- *
- * @param[in] resp The handle of the response
- * @param[in] new_uri_path New uri path to set
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
- *
- * @see iotcon_response_create()
- * @see iotcon_response_destroy()
- */
-int iotcon_response_set_new_uri_path(iotcon_response_h resp, char *new_uri_path);
-
-/**
- * @brief Sets result into the response
- *
- * @since_tizen 3.0
- *
- * @param[in] resp The handle of the response
- * @param[in] result The result to set
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
- *
- * @see iotcon_response_create()
- * @see iotcon_response_destroy()
- */
-int iotcon_response_set_result(iotcon_response_h resp, int result);
-
-/**
- * @brief Sets representation into the response
- *
- * @since_tizen 3.0
- *
- * @param[in] resp The handle of the response
- * @param[in] representation The representation of the response
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
- *
- * @see iotcon_response_create()
- * @see iotcon_response_destroy()
- */
-int iotcon_response_set_representation(iotcon_response_h resp,
-               iotcon_representation_h repr);
-
-/**
- * @brief Sets header options into the response
- *
- * @since_tizen 3.0
- *
- * @param[in] resp The handle of the response
- * @param[in] options The header options of the response
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
- *
- * @see iotcon_response_create()
- * @see iotcon_response_destroy()
- */
-int iotcon_response_set_header_options(iotcon_response_h resp, iotcon_options_h options);
-
-/**
- * @brief Sets resource interface into the response
- *
- * @since_tizen 3.0
- *
- * @param[in] resp The handle of the response
- * @param[in] iface The resource interface
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
- *
- * @see iotcon_response_create()
- * @see iotcon_response_destroy()
- */
-int iotcon_response_set_interface(iotcon_response_h resp, iotcon_interface_e iface);
-
-/**
- * @brief The handle of device information.
- * @details iotcon_device_info_h is a handle of device information.\n
- *
- * @since_tizen 3.0
- */
-typedef struct icl_device_info* iotcon_device_info_h;
-
-/**
- * @brief Get device properties from the device information handle
- *
- * @since_tizen 3.0
- *
- * @param[in] device_info The handle of the device information
- * @param[in] property The properties of the device information
- * @param[out] value The value of the property
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- *
- * @see iotcon_device_info_cb()
- * @see iotcon_get_device_info()
- */
-int iotcon_device_info_get_property(iotcon_device_info_h device_info,
-               iotcon_device_info_e property, char **value);
-
-/**
- * @brief The handle of platform information.
- * @details iotcon_platform_info_h is a handle of platform information.\n
- *
- * @since_tizen 3.0
- */
-typedef struct icl_platform_info* iotcon_platform_info_h;
-
-/**
- * @brief Get platform properties from the platform information handle
- *
- * @since_tizen 3.0
- *
- * @param[in] platform_info The handle of the platform information
- * @param[in] property The properties of the platform information
- * @param[out] value The value of the property
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- *
- * @see iotcon_platform_info_cb()
- * @see iotcon_get_platform_info()
- */
-int iotcon_platform_info_get_property(iotcon_platform_info_h platform_info,
-               iotcon_platform_info_e property, char **value);
-
-/**
- * @brief The handle of tizen device information.
- * @details iotcon_tizen_info_h is a handle of tizen device information.\n
- *
- * @since_tizen 3.0
- */
-typedef struct icl_tizen_info* iotcon_tizen_info_h;
-
-/**
- * @brief Get tizen device properties from the tizen device information handle
- *
- * @since_tizen 3.0
- *
- * @param[in] tizen_info The handle of the tizen device information
- * @param[in] property The properties of the tizen device information
- * @param[out] value The value of the property
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- *
- * @see iotcon_tizen_info_cb()
- * @see iotcon_get_tizen_info()
- */
-int iotcon_tizen_info_get_property(iotcon_tizen_info_h tizen_info,
-                               iotcon_tizen_info_e property, char **value);
-
-/**
- * @brief Update state into the lite resource handle
- *
- * @since_tizen 3.0
- *
- * @param[in] resource The handle of the lite resource
- * @param[in] state The state handle to update
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
- *
- * @see iotcon_lite_resource_get_state()
- */
-int iotcon_lite_resource_update_state(iotcon_lite_resource_h resource,
-               iotcon_state_h state);
-
-/**
- * @brief Get state from the lite resource handle
- *
- * @since_tizen 3.0
- *
- * @param[in] resource The handle of the lite resource
- * @param[out] state The state handle of the lite resource
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- *
- * @see iotcon_lite_resource_update_state()
- */
-int iotcon_lite_resource_get_state(iotcon_lite_resource_h resource,
-               iotcon_state_h *state);
-
-/**
- * @brief Get cached representation from the remote resource
- *
- * @since_tizen 3.0
- *
- * @param[in] resource The handle of the remote resource
- * @param[out] representation The handle of the representation
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_NO_DATA  No data
- */
-int iotcon_remote_resource_get_cached_representation(
-               iotcon_remote_resource_h resource,
-               iotcon_representation_h *representation);
 /**
- * @}
+ * @file iotcon-struct.h
  */
 
 #endif /* __IOT_CONNECTIVITY_MANAGER_STRUCT_H__ */
index c305d76..b8292eb 100644 (file)
 extern "C" {
 #endif
 
-#include <stdint.h>
 #include <stdbool.h>
+
+#include <iotcon-constant.h>
 #include <iotcon-errors.h>
 #include <iotcon-struct.h>
-#include <iotcon-constant.h>
-#include <iotcon-representation.h>
+#include <iotcon-server.h>
+#include <iotcon-client.h>
 
 /**
  * @file iotcon.h
@@ -69,15 +70,14 @@ int iotcon_open(void);
  */
 void iotcon_close(void);
 
-
 /**
- * @brief Set timeout of asynchronize APIs.
+ * @brief Set timeout of asynchronous APIs.
  * @details Default timeout is 10 seconds.
  * Maximum timeout is 60 seconds.
  *
  * @since_tizen 3.0
  *
- * @param[in] timeout_secods Seconds for timeout
+ * @param[in] timeout_seconds Seconds for timeout
  *
  * @return  0 on success, otherwise a negative error value.
  * @retval  #IOTCON_ERROR_NONE Successful
@@ -153,1142 +153,6 @@ int iotcon_add_connection_changed_cb(iotcon_connection_changed_cb cb, void *user
 int iotcon_remove_connection_changed_cb(iotcon_connection_changed_cb cb, void *user_data);
 
 /**
- * @brief Specifies the type of function passed to iotcon_resource_create() and
- * iotcon_resource_set_request_handler()
- * @details Called when server receive request from the client.
- *
- * @since_tizen 3.0
- *
- * @param[in] resource The resource requested
- * @param[in] request The request from client
- * @param[in] user_data The user data to pass to the function
- *
- * @pre The callback must be registered using iotcon_resource_create()
- *
- * @see iotcon_resource_create()
- * @see iotcon_resource_set_request_handler()
- */
-typedef void (*iotcon_request_handler_cb)(iotcon_resource_h resource,
-               iotcon_request_h request, void *user_data);
-
-/**
- * @brief Create a resource handle and registers the resource in server
- * @details Registers a resource specified by @a uri_path, @a res_types, @a ifaces which have
- * @a properties in Iotcon server.\n
- * When client find the registered resource, iotcon_request_handler_cb() will be called automatically.\n
- * @a uri_path format would be relative URI path like '/a/light'\n
- * @a res_types is a list of resource types. Create a iotcon_resource_types_h handle and
- * add types string to it.\n
- * @a ifaces can contain multiple interfaces like
- * IOTCON_INTERFACE_LINK | IOTCON_INTERFACE_BATCH.\n
- * @a properties also can contain multiple properties like
- * IOTCON_ACTIVE | IOTCON_DISCOVERABLE.\n
- * iotcon_request_handler_cb() will be called when receive CRUD request to the registered
- * resource.
- *
- * @since_tizen 3.0
- * @privlevel public
- * @privilege %http://tizen.org/privilege/internet
- *
- * @remarks @a uri_path length must be less than or equal 36.\n
- * You must unregister resource by calling iotcon_resource_destroy()
- * if resource is no longer needed.
- *
- * @param[in] uri_path The URI path of the resource.
- * @param[in] res_types The list of type of the resource.
- * @param[in] ifaces The interfaces of the resource.
- * @param[in] properties The property of the resource.
- * @param[in] cb The request handler callback function
- * @param[in] user_data The user data to pass to the callback function
- * @param[out] resource_handle The handle of the resource
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_IOTIVITY  Iotivity errors
- * @retval #IOTCON_ERROR_DBUS  Dbus errors
- * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
- * @retval #IOTCON_ERROR_PERMISSION_DENIED Permission denied
- *
- * @post When the resource receive CRUD request, iotcon_request_handler_cb() will be called.
- *
- * @see iotcon_resource_destroy()
- * @see iotcon_resource_bind_interface()
- * @see iotcon_resource_bind_type()
- * @see iotcon_resource_set_request_handler()
- * @see iotcon_resource_bind_child_resource()
- * @see iotcon_resource_unbind_child_resource()
- * @see iotcon_request_handler_cb()
- */
-int iotcon_resource_create(const char *uri_path,
-               iotcon_resource_types_h res_types,
-               int ifaces,
-               int properties,
-               iotcon_request_handler_cb cb,
-               void *user_data,
-               iotcon_resource_h *resource_handle);
-
-/**
- * @brief Destroy the resource and releases its data.
- *
- * @since_tizen 3.0
- * @privlevel public
- * @privilege %http://tizen.org/privilege/internet
- *
- * @remarks When a normal variable is used, there are only dbus error and permission\n
- * denied error. If the errors of this API are not handled, then you must check\n
- * whether dbus is running and an application have the privileges for the API.
- *
- * @param[in] resource_handle The handle of the resource to be unregistered
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_DBUS  Dbus error
- * @retval #IOTCON_ERROR_PERMISSION_DENIED Permission denied
- *
- * @see iotcon_resource_create()
- * @see iotcon_resource_bind_interface()
- * @see iotcon_resource_bind_type()
- * @see iotcon_resource_set_request_handler()
- * @see iotcon_resource_bind_child_resource()
- * @see iotcon_resource_unbind_child_resource()
- * @see iotcon_request_handler_cb()
- */
-int iotcon_resource_destroy(iotcon_resource_h resource_handle);
-
-/**
- * @brief Binds an interface to the resource
- *
- * @details The @a action could be one of #iotcon_interface_e.
- * @since_tizen 3.0
- * @privlevel public
- * @privilege %http://tizen.org/privilege/internet
- *
- * @remarks Set only one interface to @a iface. If not, @a iface will be ignored.
- *
- * @param[in] resource The handle of the resource
- * @param[in] iface The interface to be bound to the resource
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_DBUS  Dbus error
- * @retval #IOTCON_ERROR_SYSTEM System error
- * @retval #IOTCON_ERROR_PERMISSION_DENIED Permission denied
- *
- * @see iotcon_resource_create()
- * @see iotcon_resource_destroy()
- * @see iotcon_resource_bind_type()
- * @see iotcon_resource_set_request_handler()
- * @see iotcon_resource_bind_child_resource()
- * @see iotcon_resource_unbind_child_resource()
- * @see iotcon_request_handler_cb()
- */
-int iotcon_resource_bind_interface(iotcon_resource_h resource, iotcon_interface_e iface);
-
-/**
- * @brief Binds a type to the resource
- *
- * @since_tizen 3.0
- * @privlevel public
- * @privilege %http://tizen.org/privilege/internet
- *
- * @param[in] resource_handle The handle of the resource
- * @param[in] resource_type The type to be bound to the resource
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_DBUS  Dbus error
- * @retval #IOTCON_ERROR_SYSTEM System error
- * @retval #IOTCON_ERROR_PERMISSION_DENIED Permission denied
- *
- * @see iotcon_resource_create()
- * @see iotcon_resource_destroy()
- * @see iotcon_resource_bind_interface()
- * @see iotcon_resource_set_request_handler()
- * @see iotcon_resource_bind_child_resource()
- * @see iotcon_resource_unbind_child_resource()
- * @see iotcon_request_handler_cb()
- */
-int iotcon_resource_bind_type(iotcon_resource_h resource_handle,
-               const char *resource_type);
-
-/**
- * @brief Binds a request handler to the resource
- * @details When the resource receive CRUD request, iotcon_request_handler_cb() will be
- * called.
- *
- * @since_tizen 3.0
- *
- * @remarks Registered callback function will be replaced with the new @a cb.\n
- *
- * @param[in] resource The handle of the resource
- * @param[in] cb The request handler to be bound to the resource
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- *
- * @see iotcon_resource_create()
- * @see iotcon_resource_destroy()
- * @see iotcon_resource_bind_interface()
- * @see iotcon_resource_bind_type()
- * @see iotcon_resource_bind_child_resource()
- * @see iotcon_resource_unbind_child_resource()
- * @see iotcon_request_handler_cb()
- */
-int iotcon_resource_set_request_handler(iotcon_resource_h resource,
-               iotcon_request_handler_cb cb);
-
-/**
- * @brief Binds a child resource into the parent resource.
- *
- * @since_tizen 3.0
- * @privlevel public
- * @privilege %http://tizen.org/privilege/internet
- *
- * @param[in] parent The handle of the parent resource
- * @param[in] child The handle of the child resource to be added to the parent resource
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_ALREADY  Already done
- * @retval #IOTCON_ERROR_DBUS  Dbus error
- * @retval #IOTCON_ERROR_SYSTEM System error
- * @retval #IOTCON_ERROR_PERMISSION_DENIED Permission denied
- *
- * @see iotcon_resource_create()
- * @see iotcon_resource_destroy()
- * @see iotcon_resource_bind_interface()
- * @see iotcon_resource_bind_type()
- * @see iotcon_resource_set_request_handler()
- * @see iotcon_resource_unbind_child_resource()
- * @see iotcon_request_handler_cb()
- */
-int iotcon_resource_bind_child_resource(iotcon_resource_h parent,
-               iotcon_resource_h child);
-
-/**
- * @brief Unbinds a child resource from the parent resource.
- *
- * @since_tizen 3.0
- * @privlevel public
- * @privilege %http://tizen.org/privilege/internet
- *
- * @param[in] parent The handle of the parent resource
- * @param[in] child The handle of the child resource to be unbound from the parent resource
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_DBUS  Dbus error
- * @retval #IOTCON_ERROR_SYSTEM System error
- * @retval #IOTCON_ERROR_PERMISSION_DENIED Permission denied
- *
- * @see iotcon_resource_create()
- * @see iotcon_resource_destroy()
- * @see iotcon_resource_bind_interface()
- * @see iotcon_resource_bind_type()
- * @see iotcon_resource_set_request_handler()
- * @see iotcon_resource_bind_child_resource()
- * @see iotcon_request_handler_cb()
- */
-int iotcon_resource_unbind_child_resource(iotcon_resource_h parent,
-               iotcon_resource_h child);
-
-/**
- * @brief Specifies the type of function passed to iotcon_get_device_info().
- *
- * @since_tizen 3.0
- *
- * @param[in] device_info the device information from remote server.
- * @param[in] result The result code (0 on success, other wise a negative error value)
- * @param[in] user_data The user data to pass to the function
- *
- * @pre iotcon_get_device_info() will invoke this callback function.
- *
- * @see iotcon_get_device_info()
- * @see iotcon_device_info_get_property()
- */
-typedef void (*iotcon_device_info_cb)(iotcon_device_info_h device_info, int result,
-               void *user_data);
-
-/**
- * @brief Calls a function for device information of remote server.
- * @details Request device information to server and pass the information by calling
- * iotcon_device_info_cb().\n
- * iotcon_device_info_cb() will be called when success on getting device information.
- *
- * @since_tizen 3.0
- * @privlevel public
- * @privilege %http://tizen.org/privilege/internet
- *
- * @param[in] host_address The host address of remote server
- * @param[in] connectivity_type The connectivity type
- * @param[in] cb The callback function to invoke
- * @param[in] user_data The user data to pass to the function
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_DBUS  Dbus error
- * @retval #IOTCON_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #IOTCON_ERROR_PERMISSION_DENIED Permission denied
- *
- * @post iotcon_device_info_cb() will be called when success on getting device information.
- *
- * @see iotcon_device_info_cb()
- * @see iotcon_device_info_get_property()
- */
-int iotcon_get_device_info(const char *host_address,
-               iotcon_connectivity_type_e connectivity_type,
-               iotcon_device_info_cb cb,
-               void *user_data);
-
-/**
- * @brief Specifies the type of function passed to iotcon_get_platform_info().
- *
- * @since_tizen 3.0
- *
- * @param[in] platform_info The platform information from remote server.
- * @param[in] result The result code (0 on success, other wise a negative error value)
- * @param[in] user_data The user data to pass to the function
- *
- * @pre iotcon_get_platform_info() will invoke this callback function.
- *
- * @see iotcon_get_platform_info()
- * @see iotcon_platform_info_get_property()
- */
-typedef void (*iotcon_platform_info_cb)(iotcon_platform_info_h platform_info, int result,
-               void *user_data);
-
-/**
- * @brief Calls a function for platform information of remote server.
- * @details Request platform information to server and pass the information by calling
- * iotcon_platform_info_cb().\n
- * iotcon_platform_info_cb() will be called when success on getting device information.
- *
- * @since_tizen 3.0
- * @privlevel public
- * @privilege %http://tizen.org/privilege/internet
- *
- * @param[in] host_address The host address of remote server
- * @param[in] connectivity_type The connectivity type
- * @param[in] cb The callback function to invoke
- * @param[in] user_data The user data to pass to the function
- *
- * @return  0 on success, otherwise a negative error value.
- *
- * @retval #IOTCON_ERROR_NONE Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_DBUS  Dbus error
- * @retval #IOTCON_ERROR_SYSTEM System error
- * @retval #IOTCON_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #IOTCON_ERROR_PERMISSION_DENIED Permission denied
- *
- * @post iotcon_platform_info_cb() will be called when success on getting device information.
- *
- * @see iotcon_platform_info_cb()
- * @see iotcon_platform_info_get_property()
- */
-int iotcon_get_platform_info(const char *host_address,
-               iotcon_connectivity_type_e connectivity_type,
-               iotcon_platform_info_cb cb,
-               void *user_data);
-
-/**
- * @brief Specifies the type of function passed to iotcon_get_tizen_info().
- *
- * @since_tizen 3.0
- *
- * @param[in] tizen_info The information of tizen device from remote server.
- * @param[in] response_result The response result code (Lesser than 0 on fail, otherwise a response result value)
- * @param[in] user_data The user data to pass to the function
- *
- * @pre iotcon_get_tizen_info() will invoke this callback function.
- *
- * @see iotcon_get_tizen_info()
- * @see iotcon_tizen_info_get_property()
- */
-typedef void (*iotcon_tizen_info_cb)(iotcon_tizen_info_h tizen_info,
-               int response_result, void *user_data);
-
-/**
- * @brief Calls a function for tizen device information of remote server.
- * @details Request tizen device information to server and pass the information by calling
- * iotcon_tizen_info_cb().\n
- * iotcon_tizen_info_cb() will be called when success on getting tizen device information.
- *
- * @since_tizen 3.0
- * @privlevel public
- * @privilege %http://tizen.org/privilege/internet
- *
- * @param[in] host_address The host address of remote server
- * @param[in] connectivity_type The connectivity type
- * @param[in] cb The callback function to invoke
- * @param[in] user_data The user data to pass to the function
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_DBUS  Dbus error
- * @retval #IOTCON_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #IOTCON_ERROR_PERMISSION_DENIED Permission denied
- *
- * @post iotcon_tizen_info_cb() will be called when success on getting tizen device information.
- *
- * @see iotcon_tizen_info_cb()
- * @see iotcon_tizen_info_get_property()
- */
-int iotcon_get_tizen_info(const char *host_address,
-               iotcon_connectivity_type_e connectivity_type,
-               iotcon_tizen_info_cb cb,
-               void *user_data);
-
-/**
- * @brief Specifies the type of function passed to iotcon_subscribe_presence().
- * @details Called when client receive presence events from the server.
- *
- * @since_tizen 3.0
- *
- * @param[in] result The result code of server's presence
- * @param[in] nonce Current nonce of server's presence
- * @param[in] host_address The address or addressable name of server
- * @param[in] user_data The user data to pass to the function
- *
- * @pre The callback must be registered using iotcon_subscribe_presence()
- *
- * @see iotcon_subscribe_presence()
- */
-typedef void (*iotcon_presence_cb)(int result, unsigned int nonce,
-               const char *host_address, void *user_data);
-
-/**
- * @brief Subscribes to a server to receive presence events.
- * @details Request to receive presence to an interested server's resource with @a resource_type.\n
- * If succeed to subscribe, iotcon_presence_cb() will be invoked when the server sends presence\n
- * A server sends presence events when adds/removes/alters a resource or start/stop presence.
- *
- * @since_tizen 3.0
- * @privlevel public
- * @privilege %http://tizen.org/privilege/internet
- *
- * @param[in] host_address The address or addressable name of the server
- * @param[in] connectivity_type The connectivity type
- * @param[in] resource_type A resource type that a client has interested in
- * @param[in] cb The callback function to invoke
- * @param[in] user_data The user data to pass to the function
- * @param[out] presence_handle The generated presence handle
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_IOTIVITY  Iotivity errors
- * @retval #IOTCON_ERROR_DBUS  Dbus errors
- * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
- * @retval #IOTCON_ERROR_PERMISSION_DENIED Permission denied
- *
- * @post When the resource receive presence, iotcon_presence_cb() will be called.
- *
- * @see iotcon_start_presence()
- * @see iotcon_stop_presence()
- * @see iotcon_unsubscribe_presence()
- * @see iotcon_presence_cb()
- */
-int iotcon_subscribe_presence(const char *host_address,
-               iotcon_connectivity_type_e connectivity_type,
-               const char *resource_type,
-               iotcon_presence_cb cb,
-               void *user_data,
-               iotcon_presence_h *presence_handle);
-
-/**
- * @brief Unsubscribes to a server's presence events.
- * @details Request not to receive server's presence any more.
- *
- * @since_tizen 3.0
- * @privlevel public
- * @privilege %http://tizen.org/privilege/internet
- *
- * @param[in] presence_handle The presence handle to be unsubscribed
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_DBUS  Dbus error
- * @retval #IOTCON_ERROR_SYSTEM System error
- * @retval #IOTCON_ERROR_PERMISSION_DENIED Permission denied
- *
- * @see iotcon_start_presence()
- * @see iotcon_stop_presence()
- * @see iotcon_subscribe_presence()
- * @see iotcon_presence_cb()
- */
-int iotcon_unsubscribe_presence(iotcon_presence_h presence_handle);
-
-/**
- * @brief Specifies the type of function passed to iotcon_find_resource().
- * @details Called when a resource is found from the remote server.
- *
- * @since_tizen 3.0
- *
- * @param[in] resource The handle of resource which is found
- * @param[in] result The result code (Lesser than 0 on fail, otherwise a response result value)
- * @param[in] user_data The user data to pass to the function
- *
- * @pre The callback must be registered using iotcon_find_resource()
- *
- * @see iotcon_find_resource()
- */
-typedef void (*iotcon_found_resource_cb)(iotcon_remote_resource_h resource, int result,
-               void *user_data);
-
-/**
- * @brief Finds resources.
- * @details Request to find a resource of @a host_address server with @a resource_type.\n
- * If succeed to find the resource, iotcon_found_resource_cb() will be invoked with
- * information of the resource.
- *
- * @since_tizen 3.0
- * @privlevel public
- * @privilege %http://tizen.org/privilege/internet
- *
- * @param[in] host_address The address or addressable name of server
- * @param[in] connectivity_type The connectivity type
- * @param[in] resource_type The resource type specified as a filter for the resource
- * @param[in] cb The callback function to invoke
- * @param[in] user_data The user data to pass to the function
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_DBUS  Dbus error
- * @retval #IOTCON_ERROR_SYSTEM System error
- * @retval #IOTCON_ERROR_PERMISSION_DENIED Permission denied
- *
- * @post When the resource is found, iotcon_found_resource_cb() will be called.
- *
- * @see iotcon_found_resource_cb()
- */
-int iotcon_find_resource(const char *host_address,
-               iotcon_connectivity_type_e connectivity_type,
-               const char *resource_type,
-               iotcon_found_resource_cb cb,
-               void *user_data);
-
-/**
- * @brief Creates a new resource handle.
- * @details Creates a resource proxy object so that get/put/observe functionality can be used
- * without discovering the object in advance.\n
- * To use this API, you should provide all of the details required to correctly contact and
- * observe the object.\n
- * If not, you should discover the resource object manually.
- *
- * @since_tizen 3.0
- *
- * @param[in] host The host address of the resource
- * @param[in] connectivity_type The connectivity type
- * @param[in] uri_path The URI path of the resource.
- * @param[in] is_observable Allow observation
- * @param[in] resource_types The resource type of the resource. For example, "core.light"
- * @param[in] resource_interfaces The resource interfaces (whether it is collection etc)
- * @param[out] client_handle Generated resource handle
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_IOTIVITY  Iotivity errors
- * @retval #IOTCON_ERROR_DBUS  Dbus errors
- * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
- *
- * @see iotcon_remote_resource_destroy()
- * @see iotcon_remote_resource_clone()
- */
-int iotcon_remote_resource_create(const char *host,
-               iotcon_connectivity_type_e connectivity_type,
-               const char *uri_path,
-               bool is_observable,
-               iotcon_resource_types_h resource_types,
-               int resource_ifs,
-               iotcon_remote_resource_h *client_handle);
-
-/**
- * @brief Releases a resource handle.
- * @details Decrements reference count of the source resource.\n
- * If the reference count drops to 0, releases a resource handle.
- *
- * @since_tizen 3.0
- *
- * @param[in] resource The handle of the resource
- *
- * @return void
- *
- * @see iotcon_remote_resource_create()
- * @see iotcon_remote_resource_clone()
- */
-void iotcon_remote_resource_destroy(iotcon_remote_resource_h resource);
-
-/**
- * @brief Makes a clone of a remote resource.
- *
- * @since_tizen 3.0
- *
- * @param[in] src The Source of resource
- * @param[out] dest The cloned resource handle
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- *
- * @see iotcon_remote_resource_create()
- * @see iotcon_remote_resource_destroy()
- */
-int iotcon_remote_resource_clone(iotcon_remote_resource_h src,
-               iotcon_remote_resource_h *dest);
-
-/**
- * @brief Specifies the type of function passed to iotcon_remote_resource_observer_start().
- * @details Called when a client receive notifications from a server. The @a response_result could be one of #iotcon_response_result_e.
- *
- * @since_tizen 3.0
- *
- * @param[in] resource The handle of the resource
- * @param[in] repr The handle of the representation
- * @param[in] options The handle of the header options
- * @param[in] response_result The response result code
- * @param[in] sequence_number The sequence of notifications from server.
- * @param[in] user_data The user data passed from the callback registration function
- *
- * @pre The callback must be registered using iotcon_remote_resource_observer_start()
- *
- * @see iotcon_remote_resource_observer_start()
- */
-typedef void (*iotcon_remote_resource_observe_cb)(iotcon_remote_resource_h resource,
-               iotcon_representation_h repr,
-               iotcon_options_h options,
-               int response_result,
-               int sequence_number,
-               void *user_data);
-
-/**
- * @brief Sets observation on the resource
- * @details When server sends notification message, iotcon_remote_resource_observe_cb() will be called.
- * The @a observe_type could be one of #iotcon_observe_type_e.
- *
- * @since_tizen 3.0
- * @privlevel public
- * @privilege %http://tizen.org/privilege/internet
- *
- * @param[in] resource The handle of the resource
- * @param[in] observe_type The type to specify how client wants to observe.
- * @param[in] query The query to send to server
- * @param[in] cb The callback function to get notifications from server
- * @param[in] user_data The user data to pass to the function
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_IOTIVITY  Iotivity errors
- * @retval #IOTCON_ERROR_DBUS  Dbus errors
- * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
- * @retval #IOTCON_ERROR_PERMISSION_DENIED Permission denied
- *
- * @post When the @a resource receive notification message, iotcon_remote_resource_observe_cb() will be called.
- *
- * @see iotcon_remote_resource_observe_cb()
- * @see iotcon_remote_resource_observer_stop()
- * @see iotcon_notimsg_create()
- * @see iotcon_resource_notify()
- */
-int iotcon_remote_resource_observer_start(iotcon_remote_resource_h resource,
-               iotcon_observe_type_e observe_type,
-               iotcon_query_h query,
-               iotcon_remote_resource_observe_cb cb,
-               void *user_data);
-
-/**
- * @brief Cancels the observation on the resource
- *
- * @since_tizen 3.0
- * @privlevel public
- * @privilege %http://tizen.org/privilege/internet
- *
- * @param[in] resource The handle of the resource
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_DBUS  Dbus error
- * @retval #IOTCON_ERROR_SYSTEM System error
- * @retval #IOTCON_ERROR_PERMISSION_DENIED Permission denied
- *
- * @see iotcon_remote_resource_observe_cb()
- * @see iotcon_remote_resource_observer_start()
- * @see iotcon_notimsg_create()
- * @see iotcon_resource_notify()
- */
-int iotcon_remote_resource_observer_stop(iotcon_remote_resource_h resource);
-
-/**
- * @brief Send response for incoming request.
- *
- * @since_tizen 3.0
- * @privlevel public
- * @privilege %http://tizen.org/privilege/internet
- *
- * @param[in] resp The handle of the response to send
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_DBUS  Dbus error
- * @retval #IOTCON_ERROR_SYSTEM System error
- * @retval #IOTCON_ERROR_PERMISSION_DENIED Permission denied
- */
-int iotcon_response_send(iotcon_response_h resp);
-
-/**
- * @brief Creates a new notifications message handle.
- * @details @a iface could be one of #iotcon_interface_e.
- *
- * @since_tizen 3.0
- *
- * @param[in] repr The handle of the representation
- * @param[in] iface The resource interface
- * @param[out] notimsg_handle The generated notifications message handle
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
- *
- * @see iotcon_remote_resource_observe_cb()
- * @see iotcon_remote_resource_observer_start()
- * @see iotcon_remote_resource_observer_stop()
- * @see iotcon_resource_notify()
- */
-int iotcon_notimsg_create(iotcon_representation_h repr, iotcon_interface_e iface,
-               iotcon_notimsg_h *notimsg_handle);
-
-/**
- * @brief Releases a notifications message handle.
- *
- * @since_tizen 3.0
- *
- * @param[in] msg The handle of the notifications message
- *
- * @return void
- *
- * @see iotcon_notimsg_create()
- */
-void iotcon_notimsg_destroy(iotcon_notimsg_h msg);
-
-/**
- * @brief Notifies specific clients that resource's attributes have changed.
- * @details If @a observers is @c NULL, the @a msg will notify to all observers.
- *
- * @since_tizen 3.0
- * @privlevel public
- * @privilege %http://tizen.org/privilege/internet
- *
- * @param[in] resource The handle of the resource
- * @param[in] msg The handle of the notifications message
- * @param[in] observers The handle of the observers.
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_DBUS  Dbus error
- * @retval #IOTCON_ERROR_REPRESENTATION  Representation error
- * @retval #IOTCON_ERROR_SYSTEM  System error
- * @retval #IOTCON_ERROR_PERMISSION_DENIED Permission denied
- *
- * @see iotcon_remote_resource_observe_cb()
- * @see iotcon_remote_resource_observer_start()
- * @see iotcon_remote_resource_observer_stop()
- * @see iotcon_notimsg_create()
- * @see iotcon_notimsg_destroy()
- * @see iotcon_observers_create()
- * @see iotcon_observers_destroy()
- * @see iotcon_observers_add()
- * @see iotcon_observers_remove()
- */
-int iotcon_resource_notify(iotcon_resource_h resource, iotcon_notimsg_h msg,
-               iotcon_observers_h observers);
-
-/**
- * @brief Specifies the type of function passed to iotcon_remote_resource_get(), iotcon_remote_resource_put(), iotcon_remote_resource_post()
- * @details The @a response_result could be one of #iotcon_response_result_e.
- *
- * @since_tizen 3.0
- *
- * @param[in] resource The handle of the resource
- * @param[in] repr The handle of the representation
- * @param[in] options The handle of the header options
- * @param[in] response_result The response result code (Lesser than 0 on fail, otherwise a response result value)
- * @param[in] user_data The user data to pass to the function
- *
- * @pre The callback must be registered using iotcon_remote_resource_get(), iotcon_remote_resource_put(), iotcon_remote_resource_post()
- *
- * @see iotcon_remote_resource_get()
- * @see iotcon_remote_resource_put()
- * @see iotcon_remote_resource_post()
- */
-typedef void (*iotcon_remote_resource_cru_cb)(iotcon_remote_resource_h resource,
-               iotcon_representation_h repr,
-               iotcon_options_h options,
-               int response_result,
-               void *user_data);
-
-/**
- * @brief Gets the attributes of a resource.
- * @details When server sends response on get request, iotcon_remote_resource_cru_cb() will be called.
- *
- * @since_tizen 3.0
- * @privlevel public
- * @privilege %http://tizen.org/privilege/internet
- *
- * @param[in] resource The handle of the resource
- * @param[in] query The query to send to server
- * @param[in] cb The callback function
- * @param[in] user_data The user data to pass to the function
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_DBUS  Dbus errors
- * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
- * @retval #IOTCON_ERROR_PERMISSION_DENIED Permission denied
- *
- * @post When the client receive get response, iotcon_remote_resource_cru_cb() will be called.
- *
- * @see iotcon_remote_resource_cru_cb()
- * @see iotcon_remote_resource_put()
- * @see iotcon_remote_resource_post()
- */
-int iotcon_remote_resource_get(iotcon_remote_resource_h resource, iotcon_query_h query,
-               iotcon_remote_resource_cru_cb cb, void *user_data);
-
-/**
- * @brief Sets the representation of a resource (via PUT)
- * @details When server sends response on put request, iotcon_remote_resource_cru_cb() will be called.
- *
- * @since_tizen 3.0
- * @privlevel public
- * @privilege %http://tizen.org/privilege/internet
- *
- * @param[in] resource The handle of the resource
- * @param[in] repr The handle of the representation
- * @param[in] query The query to send to server
- * @param[in] cb The callback function
- * @param[in] user_data The user data to pass to the function
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_DBUS  Dbus errors
- * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
- * @retval #IOTCON_ERROR_PERMISSION_DENIED Permission denied
- *
- * @post When the client receive put response, iotcon_remote_resource_cru_cb() will be called.
- *
- * @see iotcon_remote_resource_cru_cb()
- * @see iotcon_remote_resource_get()
- * @see iotcon_remote_resource_post()
- */
-int iotcon_remote_resource_put(iotcon_remote_resource_h resource,
-               iotcon_representation_h repr,
-               iotcon_query_h query,
-               iotcon_remote_resource_cru_cb cb,
-               void *user_data);
-
-/**
- * @brief Posts on a resource
- * @details When server sends response on post request, iotcon_remote_resource_cru_cb() will be called.
- *
- * @since_tizen 3.0
- * @privlevel public
- * @privilege %http://tizen.org/privilege/internet
- *
- * @param[in] resource The handle of the resource
- * @param[in] repr The handle of the representation
- * @param[in] query The query to send to server
- * @param[in] cb The callback function
- * @param[in] user_data The user data to pass to the function
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_DBUS  Dbus errors
- * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
- * @retval #IOTCON_ERROR_PERMISSION_DENIED Permission denied
- *
- * @post When the client receive post response, iotcon_remote_resource_cru_cb() will be called.
- *
- * @see iotcon_remote_resource_cru_cb()
- * @see iotcon_remote_resource_get()
- * @see iotcon_remote_resource_put()
- */
-int iotcon_remote_resource_post(iotcon_remote_resource_h resource,
-               iotcon_representation_h repr,
-               iotcon_query_h query,
-               iotcon_remote_resource_cru_cb cb,
-               void *user_data);
-
-/**
- * @brief Specifies the type of function passed to iotcon_remote_resource_delete()
- * @details The @a response_result could be one of #iotcon_response_result_e.
- *
- * @since_tizen 3.0
- *
- * @param[in] resource The handle of the resource
- * @param[in] options The handle of the header options
- * @param[in] response_result The response result code
- * @param[in] user_data The user data to pass to the function
- *
- * @pre The callback must be registered using iotcon_remote_resource_delete()
- *
- * @see iotcon_remote_resource_delete()
- */
-typedef void (*iotcon_remote_resource_delete_cb)(iotcon_remote_resource_h resource,
-               iotcon_options_h options,
-               int response_result,
-               void *user_data);
-
-/**
- * @brief Deletes a resource.
- * @details When server sends response on delete request, iotcon_remote_resource_delete_cb() will be called.
- *
- * @since_tizen 3.0
- * @privlevel public
- * @privilege %http://tizen.org/privilege/internet
- *
- * @param[in] resource The handle of the resource
- * @param[in] cb The callback function
- * @param[in] user_data The user data to pass to the function
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_DBUS  Dbus errors
- * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
- * @retval #IOTCON_ERROR_PERMISSION_DENIED Permission denied
- *
- * @post When the client receive delete response, iotcon_remote_resource_delete_cb() will be called.
- *
- * @see iotcon_remote_resource_delete_cb()
- */
-int iotcon_remote_resource_delete(iotcon_remote_resource_h resource,
-               iotcon_remote_resource_delete_cb cb, void *user_data);
-
-/**
- * @brief Create a lite resource handle and registers the resource in server
- * @details Registers a resource specified by @a uri_path, @a res_types, @a state which have
- * @a properties in Iotcon server.\n
- * When client requests some operations, it send a response to client, automatically.\n
- *
- * @since_tizen 3.0
- * @privlevel public
- * @privilege %http://tizen.org/privilege/internet
- *
- * @remarks @a uri_path length must be less than or equal 36.\n
- * You must unregister resource by calling iotcon_resource_destroy()
- * if resource is no longer needed.
- *
- * @param[in] uri_path The URI path of the resource.
- * @param[in] res_types The list of type of the resource.
- * @param[in] properties The property of the resource.
- * @param[in] state The state handle to set.
- * @param[out] resource_handle The handle of the resource
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_IOTIVITY  Iotivity errors
- * @retval #IOTCON_ERROR_DBUS  Dbus errors
- * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
- * @retval #IOTCON_ERROR_PERMISSION_DENIED Permission denied
- *
- * @post When the resource receive CRUD request, iotcon_request_handler_cb() will be called.
- *
- * @see iotcon_lite_resource_destroy()
- */
-int iotcon_lite_resource_create(const char *uri_path,
-               iotcon_resource_types_h res_types,
-               int properties,
-               iotcon_state_h state,
-               iotcon_lite_resource_h *resource_handle);
-
-/**
- * @brief Destroy the resource and releases its data.
- *
- * @since_tizen 3.0
- * @privlevel public
- * @privilege %http://tizen.org/privilege/internet
- *
- * @remarks When a normal variable is used, there are only dbus error and permission\n
- * denied error. If the errors of this API are not handled, then you must check\n
- * whether dbus is running and an application have the privileges for the API.
- *
- * @param[in] resource The handle of the lite resource to be unregistered
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_DBUS  Dbus error
- * @retval #IOTCON_ERROR_PERMISSION_DENIED Permission denied
- *
- * @see iotcon_lite_resource_create()
- */
-int iotcon_lite_resource_destroy(iotcon_lite_resource_h resource);
-
-/**
- * @brief Specifies the type of function passed to iotcon_remote_resource_start_caching().
- *
- * @since_tizen 3.0
- *
- * @param[in] resource The handle of the remote resource
- * @param[in] representation The handle of the representation
- * @param[in] user_data The user data to pass to the function
- *
- * @pre The callback must be registered using iotcon_remote_resource_start_caching()\n
- *
- * @see iotcon_remote_resource_start_caching()
- * @see iotcon_remote_resource_stop_caching()
- */
-typedef void (*iotcon_remote_resource_cached_representation_changed_cb)(
-               iotcon_remote_resource_h resource,
-               iotcon_representation_h representation,
-               void *user_data);
-
-/**
- * @brief Start caching of a remote resource.
- * @details Use this function to start caching the resource's attribute data (state).\n
- * Default caching time interval is 10 seconds.
- * Internally, it operates GET method, periodically, and it observes the remote resource.
- *
- * @since_tizen 3.0
- * @privlevel public
- * @privilege %http://tizen.org/privilege/internet
- *
- * @param[in] resource The handle of the remote resource to be cached
- * @param[in] caching_interval Seconds for caching time interval.\n
- * If value is 0, then it sets 10 seconds(default caching time).
- * @param[in] cb The callback function to add into callback list
- * @param[in] user_data The user data to pass to the callback function
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_DBUS  Dbus error
- * @retval #IOTCON_ERROR_SYSTEM System error
- * @retval #IOTCON_ERROR_PERMISSION_DENIED Permission denied
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_ALREADY Already done
- * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
- *
- * @see iotcon_remote_resource_stop_caching()
- * @see iotcon_remote_resource_cached_representation_changed_cb()
- */
-int iotcon_remote_resource_start_caching(iotcon_remote_resource_h resource,
-               int caching_interval,
-               iotcon_remote_resource_cached_representation_changed_cb cb,
-               void *user_data);
-
-/**
- * @brief Stop caching of a remote resource.
- * @details Use this function to stop caching the resource's attribute data (state).\n
- *
- * @since_tizen 3.0
- * @privlevel public
- * @privilege %http://tizen.org/privilege/internet
- *
- * @param[in] resource The handle of the remote resource
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_DBUS  Dbus error
- * @retval #IOTCON_ERROR_SYSTEM System error
- * @retval #IOTCON_ERROR_PERMISSION_DENIED Permission denied
- *
- * @see iotcon_remote_resource_start_caching()
- * @see iotcon_remote_resource_cached_representation_changed_cb()
- */
-int iotcon_remote_resource_stop_caching(iotcon_remote_resource_h resource);
-
-/**
- * @brief Specifies the type of function passed to iotcon_remote_resource_start_monitoring().
- *
- * @since_tizen 3.0
- *
- * @param[in] resource The handle of the remote resource
- * @param[in] state The state of the remote resource
- * @param[in] user_data The user data to pass to the function
- *
- * @pre The callback must be registered using iotcon_remote_resource_start_monitoring()\n
- *
- * @see iotcon_remote_resource_start_monitoring()
- * @see iotcon_remote_resource_stop_monitoring()
- */
-typedef void (*iotcon_remote_resource_state_changed_cb)(iotcon_remote_resource_h resource,
-               iotcon_remote_resource_state_e state, void *user_data);
-
-/**
- * @brief Start monitoring of a remote resource.
- * @details When remote resource's state are changed, registered callbacks will be called\n
- * in turn. Default monitoring time interval is 10 seconds.
- * Internally, it operates GET method, periodically, and it subscribes the devices's presence.
- *
- * @since_tizen 3.0
- * @privlevel public
- * @privilege %http://tizen.org/privilege/internet
- *
- * @param[in] resource The handle of the remote resource
- * @param[in] monitoring_interval Seconds for monitoring time interval.\n
- * If value is 0, then it sets 10 seconds(default monitoring time).
- * @param[in] cb The callback function to add into callback list
- * @param[in] user_data The user data to pass to the callback function
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_ALREADY  Already done
- * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
- *
- * @see iotcon_remote_resource_stop_monitoring()
- * @see iotcon_remote_resource_state_changed_cb()
- */
-int iotcon_remote_resource_start_monitoring(iotcon_remote_resource_h resource,
-               int monitoring_interval,
-               iotcon_remote_resource_state_changed_cb cb,
-               void *user_data);
-
-/**
- * @brief Stop monitoring.
- * @details Use this function to stop monitoring the remote resource.
- *
- * @since_tizen 3.0
- * @privlevel public
- * @privilege %http://tizen.org/privilege/internet
- *
- * @param[in] resource The handle of the remote resource
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #IOTCON_ERROR_NONE  Successful
- * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #IOTCON_ERROR_DBUS  Dbus error
- * @retval #IOTCON_ERROR_SYSTEM System error
- * @retval #IOTCON_ERROR_PERMISSION_DENIED Permission denied
- *
- * @see iotcon_remote_resource_start_monitoring()
- * @see iotcon_remote_resource_state_changed_cb()
- */
-int iotcon_remote_resource_stop_monitoring(iotcon_remote_resource_h resource);
-
-/**
  * @}
  */