(ACR) Add query_get/set_interface/resource_types
authorsung.goo.kim <sung.goo.kim@samsung.com>
Fri, 23 Oct 2015 07:30:20 +0000 (16:30 +0900)
committeryoungman <yman.jung@samsung.com>
Tue, 3 Nov 2015 11:08:20 +0000 (20:08 +0900)
Change-Id: I4fd695f48f1253f014e83b1eef66e5afe5771182

19 files changed:
doc/iotcon_doc.h
lib/icl-observation.c
lib/icl-options.c
lib/icl-payload.c
lib/icl-query.c
lib/icl-query.h
lib/icl-remote-resource-crud.c
lib/icl-remote-resource.c
lib/icl-repr-list.c
lib/icl-repr-state.c
lib/icl-resource-types.c
lib/icl-resource.c
lib/include/iotcon-representation.h
lib/include/iotcon-struct.h
lib/include/iotcon.h
test/crud-test-client.c
test/crud-test-server.c
test/repr-test-client.c
test/repr-test-server.c

index 4dbffa3..ab82716 100644 (file)
@@ -124,7 +124,7 @@ static void _request_handler(iotcon_request_h request, void *user_data)
                return;
        }
 
-       ret = iotcon_resource_types_insert(resource_types, type);
+       ret = iotcon_resource_types_add(resource_types, type);
        if (IOTCON_ERROR_NONE != ret) {
                iotcon_resource_types_destroy(resource_types);
                return;
@@ -195,7 +195,7 @@ static void _found_resource(iotcon_remote_resource_h resource, void *user_data)
                return;
        }
 
-       iotcon_query_insert(query, "key", "value");
+       iotcon_query_add(query, "key", "value");
 
        iotcon_remote_resource_get(resource, query, &_on_get, NULL);
        iotcon_query_destroy(query);
@@ -254,7 +254,7 @@ static void _request_handler(iotcon_request_h request, void *user_data)
                        if (IOTCON_ERROR_NONE != ret) {
                                return;
                        }
-                       ret = iotcon_observers_insert(observers, observer_id);
+                       ret = iotcon_observers_add(observers, observer_id);
                        if (IOTCON_ERROR_NONE != ret) {
                                return;
                        }
@@ -263,7 +263,7 @@ static void _request_handler(iotcon_request_h request, void *user_data)
                        if (IOTCON_ERROR_NONE != ret) {
                                return;
                        }
-                       ret = iotcon_observers_delete(observers, observer_id);
+                       ret = iotcon_observers_remove(observers, observer_id);
                        if (IOTCON_ERROR_NONE != ret) {
                                return;
                        }
@@ -285,7 +285,7 @@ static void _request_handler(iotcon_request_h request, void *user_data)
                return;
        }
 
-       ret = iotcon_resource_types_insert(resource_types, type);
+       ret = iotcon_resource_types_add(resource_types, type);
        if (IOTCON_ERROR_NONE != ret) {
                iotcon_resource_types_destroy(resource_types);
                return;
@@ -444,7 +444,7 @@ static void _on_observe(iotcon_options_h header_options, iotcon_representation_h
                return;
        }
 
-       ret = iotcon_resource_types_insert(types, "core.light");
+       ret = iotcon_resource_types_add(types, "core.light");
        if (IOTCON_ERROR_NONE != ret) {
                iotcon_resource_types_destroy(types);
                iotcon_representation_destroy(resp_repr);
@@ -507,7 +507,7 @@ static void _on_observe(iotcon_options_h header_options, iotcon_representation_h
                return;
        }
 
-       ret = iotcon_list_insert_double(bright_step_list, 100.0, -1);
+       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);
@@ -515,7 +515,7 @@ static void _on_observe(iotcon_options_h header_options, iotcon_representation_h
                return;
        }
 
-       ret = iotcon_list_insert_double(bright_step_list, 200.0, -1);
+       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);
@@ -523,7 +523,7 @@ static void _on_observe(iotcon_options_h header_options, iotcon_representation_h
                return;
        }
 
-       ret = iotcon_list_insert_double(bright_step_list, 300.0, -1);
+       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);
@@ -531,7 +531,7 @@ static void _on_observe(iotcon_options_h header_options, iotcon_representation_h
                return;
        }
 
-       ret = iotcon_list_insert_double(bright_step_list, 400.0, -1);
+       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);
@@ -539,7 +539,7 @@ static void _on_observe(iotcon_options_h header_options, iotcon_representation_h
                return;
        }
 
-       ret = iotcon_list_insert_double(bright_step_list, 500.0, -1);
+       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);
index 6edeab2..7a59d4f 100644 (file)
@@ -46,7 +46,7 @@ API void iotcon_observers_destroy(iotcon_observers_h observers)
 }
 
 
-API int iotcon_observers_insert(iotcon_observers_h observers, int obs_id)
+API int iotcon_observers_add(iotcon_observers_h observers, int obs_id)
 {
        RETV_IF(NULL == observers, IOTCON_ERROR_INVALID_PARAMETER);
 
@@ -57,7 +57,7 @@ API int iotcon_observers_insert(iotcon_observers_h observers, int obs_id)
 }
 
 
-API int iotcon_observers_delete(iotcon_observers_h observers, int obs_id)
+API int iotcon_observers_remove(iotcon_observers_h observers, int obs_id)
 {
        RETV_IF(NULL == observers, IOTCON_ERROR_INVALID_PARAMETER);
 
index 7b12320..cc586b4 100644 (file)
@@ -103,7 +103,7 @@ API void iotcon_options_destroy(iotcon_options_h options)
 /* iotcon_options_h can have up to 2 options.
  * option id is always situated between 2048 and 3000.
  * Length of option data is less than or equal to 15. */
-API int iotcon_options_insert(iotcon_options_h options, unsigned short id,
+API int iotcon_options_add(iotcon_options_h options, unsigned short id,
                const char *data)
 {
        RETV_IF(NULL == options, IOTCON_ERROR_INVALID_PARAMETER);
@@ -125,7 +125,7 @@ API int iotcon_options_insert(iotcon_options_h options, unsigned short id,
 }
 
 
-API int iotcon_options_delete(iotcon_options_h options, unsigned short id)
+API int iotcon_options_remove(iotcon_options_h options, unsigned short id)
 {
        gboolean is_removed;
 
index 3c3f291..15b12ff 100644 (file)
@@ -270,7 +270,7 @@ static iotcon_list_h _icl_state_list_from_gvariant(GVariant *var)
                }
 
                while (g_variant_iter_loop(&iter, "b", &b))
-                       iotcon_list_insert_bool(list, b, -1);
+                       iotcon_list_add_bool(list, b, -1);
        } else if (g_variant_type_equal(G_VARIANT_TYPE("ai"), type)) {
                int i;
                ret = iotcon_list_create(IOTCON_TYPE_INT, &list);
@@ -280,7 +280,7 @@ static iotcon_list_h _icl_state_list_from_gvariant(GVariant *var)
                }
 
                while (g_variant_iter_loop(&iter, "i", &i))
-                       iotcon_list_insert_int(list, i, -1);
+                       iotcon_list_add_int(list, i, -1);
        } else if (g_variant_type_equal(G_VARIANT_TYPE("ad"), type)) {
                double d;
                ret = iotcon_list_create(IOTCON_TYPE_DOUBLE, &list);
@@ -290,7 +290,7 @@ static iotcon_list_h _icl_state_list_from_gvariant(GVariant *var)
                }
 
                while (g_variant_iter_loop(&iter, "d", &d))
-                       iotcon_list_insert_double(list, d, -1);
+                       iotcon_list_add_double(list, d, -1);
        } else if (g_variant_type_equal(G_VARIANT_TYPE("as"), type)) {
                char *s;
                ret = iotcon_list_create(IOTCON_TYPE_STR, &list);
@@ -300,7 +300,7 @@ static iotcon_list_h _icl_state_list_from_gvariant(GVariant *var)
                }
 
                while (g_variant_iter_loop(&iter, "s", &s))
-                       iotcon_list_insert_str(list, s, -1);
+                       iotcon_list_add_str(list, s, -1);
        } else if (g_variant_type_equal(G_VARIANT_TYPE("v"), type)) {
                GVariant *value;
                iotcon_list_h list_value;
@@ -309,12 +309,12 @@ static iotcon_list_h _icl_state_list_from_gvariant(GVariant *var)
                while (g_variant_iter_loop(&iter, "v", &value)) {
                        if (g_variant_is_of_type(value, G_VARIANT_TYPE_ARRAY)) {
                                list_value = _icl_state_list_from_gvariant(value);
-                               iotcon_list_insert_list(list, list_value, -1);
+                               iotcon_list_add_list(list, list_value, -1);
                        } else if (g_variant_is_of_type(value, G_VARIANT_TYPE("a{sv}"))) {
                                GVariantIter *state_iter;
                                g_variant_get(value, "(&a{sv})", &state_iter);
                                _icl_state_from_gvariant(state_value, state_iter);
-                               iotcon_list_insert_state(list, state_value, -1);
+                               iotcon_list_add_state(list, state_value, -1);
                        }
                }
        }
@@ -367,7 +367,7 @@ iotcon_representation_h icl_representation_from_gvariant(GVariant *var)
                }
 
                while (g_variant_iter_loop(resource_types, "s", &resource_type))
-                       iotcon_resource_types_insert(repr->res_types, resource_type);
+                       iotcon_resource_types_add(repr->res_types, resource_type);
        }
        g_variant_iter_free(resource_types);
 
index 3924f88..75941ec 100644 (file)
@@ -13,6 +13,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
+#include <stdio.h>
 #include <stdbool.h>
 #include <stdlib.h>
 #include <string.h>
@@ -52,8 +54,120 @@ API void iotcon_query_destroy(iotcon_query_h query)
 }
 
 
+API int iotcon_query_get_resource_tyeps(iotcon_query_h query, iotcon_resource_types_h *types)
+{
+       int ret;
+       char *resource_type = NULL;
+       iotcon_resource_types_h types_temp = NULL;
+
+       RETV_IF(NULL == query, IOTCON_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == types, IOTCON_ERROR_INVALID_PARAMETER);
+
+       iotcon_query_lookup(query, ICL_QUERY_KEY_RESOURCE_TYPE, &resource_type);
+       if (NULL == resource_type) {
+               ERR("resource_type is NULL");
+               return IOTCON_ERROR_NO_DATA;
+       }
+
+       ret = iotcon_resource_types_create(&types_temp);
+       if (IOTCON_ERROR_NONE != ret) {
+               ERR("iotcon_resource_types_create() Fail(%d)", ret);
+               return ret;
+       }
+
+       ret = iotcon_resource_types_add(types_temp, resource_type);
+       if (IOTCON_ERROR_NONE != ret) {
+               ERR("iotcon_resource_types_add() Fail(%d)", ret);
+               iotcon_resource_types_destroy(types_temp);
+               return ret;
+       }
+
+       *types = types_temp;
+
+       return IOTCON_ERROR_NONE;
+}
+
+API int iotcon_query_get_interface(iotcon_query_h query, int *iface)
+{
+       char *iface_str = NULL;
+
+       RETV_IF(NULL == query, IOTCON_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == iface, IOTCON_ERROR_INVALID_PARAMETER);
+
+       iotcon_query_lookup(query, ICL_QUERY_KEY_INTERFACE, &iface_str);
+       if (NULL == iface_str) {
+               ERR("iface_str is NULL");
+               return IOTCON_ERROR_NO_DATA;
+       }
+
+       *iface = atoi(iface_str);
+
+       return IOTCON_ERROR_NONE;
+}
+
+API int iotcon_query_set_resource_types(iotcon_query_h query, iotcon_resource_types_h types)
+{
+       int length_old = 0;
+       int length_new = 0;
+       char *value = NULL;
+       char *resource_type = NULL;
+
+       RETV_IF(NULL == query, IOTCON_ERROR_INVALID_PARAMETER);
+
+       value = g_hash_table_lookup(query->hash, ICL_QUERY_KEY_RESOURCE_TYPE);
+       if (value)
+               length_old = (sizeof(ICL_QUERY_KEY_RESOURCE_TYPE) - 1) + strlen(value) + 2;
+
+       if (types && types->type_list) {
+               resource_type = types->type_list->data;
+               length_new = (sizeof(ICL_QUERY_KEY_RESOURCE_TYPE) - 1) + strlen(resource_type) + 2;
+       }
+
+       if (ICL_QUERY_LENGTH_MAX < query->len - length_old + length_new) {
+               ERR("Length of query is invalid.");
+               return IOTCON_ERROR_OUT_OF_MEMORY;
+       }
+
+       if (value)
+               iotcon_query_remove(query, ICL_QUERY_KEY_RESOURCE_TYPE);
+
+       if (resource_type)
+               iotcon_query_add(query, ICL_QUERY_KEY_RESOURCE_TYPE, resource_type);
+
+       return IOTCON_ERROR_NONE;
+}
+
+API int iotcon_query_set_interface(iotcon_query_h query, iotcon_interface_e iface)
+{
+       int length_old = 0;
+       int length_new = 0;
+       char *value = NULL;
+       char iface_str[ICL_QUERY_LENGTH_MAX] = {0};
+
+       RETV_IF(NULL == query, IOTCON_ERROR_INVALID_PARAMETER);
+
+       value = g_hash_table_lookup(query->hash, ICL_QUERY_KEY_INTERFACE);
+       if (value)
+               length_old = (sizeof(ICL_QUERY_KEY_INTERFACE) - 1) + strlen(value) + 2;
+
+       snprintf(iface_str, sizeof(iface_str), "%d", iface);
+       length_new = (sizeof(ICL_QUERY_KEY_INTERFACE) - 1) + strlen(iface_str) + 2;
+
+       if (ICL_QUERY_LENGTH_MAX < query->len - length_old + length_new) {
+               ERR("Length of query is invalid.");
+               return IOTCON_ERROR_OUT_OF_MEMORY;
+       }
+
+       if (value)
+               iotcon_query_remove(query, ICL_QUERY_KEY_INTERFACE);
+
+       iotcon_query_add(query, ICL_QUERY_KEY_INTERFACE, iface_str);
+
+       return IOTCON_ERROR_NONE;
+}
+
 /* The full length of query should be less than or equal to 64. */
-API int iotcon_query_insert(iotcon_query_h query, const char *key, const char *value)
+API int iotcon_query_add(iotcon_query_h query, const char *key, const char *value)
 {
        int query_len;
 
@@ -76,7 +190,7 @@ API int iotcon_query_insert(iotcon_query_h query, const char *key, const char *v
 }
 
 
-API int iotcon_query_delete(iotcon_query_h query, const char *key)
+API int iotcon_query_remove(iotcon_query_h query, const char *key)
 {
        gboolean is_removed;
        int query_len;
index d36e671..fd3e9f8 100644 (file)
@@ -25,6 +25,8 @@
  */
 #define ICL_QUERY_LENGTH_MAX 64
 
+#define ICL_QUERY_KEY_RESOURCE_TYPE "rt"
+#define ICL_QUERY_KEY_INTERFACE "if"
 
 struct icl_query {
        int len;
index c3c6293..975c24d 100644 (file)
@@ -100,7 +100,7 @@ static void _icl_on_cru_cb(GVariant *result, icl_on_cru_s *cb_container)
                }
 
                while (g_variant_iter_loop(options, "(q&s)", &option_id, &option_data))
-                       iotcon_options_insert(header_options, option_id, option_data);
+                       iotcon_options_add(header_options, option_id, option_data);
        }
        g_variant_iter_free(options);
 
@@ -362,7 +362,7 @@ static void _icl_on_delete_cb(GObject *object, GAsyncResult *g_async_res,
                }
 
                while (g_variant_iter_loop(options, "(q&s)", &option_id, &option_data))
-                       iotcon_options_insert(header_options, option_id, option_data);
+                       iotcon_options_add(header_options, option_id, option_data);
        }
        g_variant_iter_free(options);
 
@@ -442,7 +442,7 @@ static void _icl_on_observe_cb(GDBusConnection *connection,
                }
 
                while (g_variant_iter_loop(options, "(q&s)", &option_id, &option_data))
-                       iotcon_options_insert(header_options, option_id, option_data);
+                       iotcon_options_add(header_options, option_id, option_data);
        }
        g_variant_iter_free(options);
 
index 6f17a76..d17cdc0 100644 (file)
@@ -231,9 +231,9 @@ static int _icl_remote_resource_header_foreach_cb(unsigned short id,
                }
        }
 
-       ret = iotcon_options_insert(resource->header_options, id, data);
+       ret = iotcon_options_add(resource->header_options, id, data);
        if (IOTCON_ERROR_NONE != ret) {
-               ERR("iotcon_options_insert() Fail(%d)", ret);
+               ERR("iotcon_options_add() Fail(%d)", ret);
                return IOTCON_FUNC_STOP;
        }
 
@@ -405,7 +405,7 @@ static iotcon_remote_resource_h _icl_remote_resource_from_gvariant(GVariant *pay
        }
 
        while (g_variant_iter_loop(types_iter, "s", &res_type))
-               iotcon_resource_types_insert(res_types, res_type);
+               iotcon_resource_types_add(res_types, res_type);
 
        ret = iotcon_remote_resource_create(host_addr, uri_path, !!is_observable, res_types, ifaces,
                        &resource);
index d119707..ab53957 100644 (file)
@@ -91,7 +91,7 @@ API int iotcon_list_create(iotcon_types_e type, iotcon_list_h *ret_list)
 }
 
 
-API int iotcon_list_insert_int(iotcon_list_h list, int val, int pos)
+API int iotcon_list_add_int(iotcon_list_h list, int val, int pos)
 {
        iotcon_value_h value;
 
@@ -109,7 +109,7 @@ API int iotcon_list_insert_int(iotcon_list_h list, int val, int pos)
 }
 
 
-API int iotcon_list_insert_bool(iotcon_list_h list, bool val, int pos)
+API int iotcon_list_add_bool(iotcon_list_h list, bool val, int pos)
 {
        iotcon_value_h value;
 
@@ -127,7 +127,7 @@ API int iotcon_list_insert_bool(iotcon_list_h list, bool val, int pos)
 }
 
 
-API int iotcon_list_insert_double(iotcon_list_h list, double val, int pos)
+API int iotcon_list_add_double(iotcon_list_h list, double val, int pos)
 {
        iotcon_value_h value;
 
@@ -145,7 +145,7 @@ API int iotcon_list_insert_double(iotcon_list_h list, double val, int pos)
 }
 
 
-API int iotcon_list_insert_str(iotcon_list_h list, char *val, int pos)
+API int iotcon_list_add_str(iotcon_list_h list, char *val, int pos)
 {
        iotcon_value_h value;
 
@@ -164,7 +164,7 @@ API int iotcon_list_insert_str(iotcon_list_h list, char *val, int pos)
 }
 
 
-API int iotcon_list_insert_list(iotcon_list_h list, iotcon_list_h val, int pos)
+API int iotcon_list_add_list(iotcon_list_h list, iotcon_list_h val, int pos)
 {
        iotcon_value_h value;
 
@@ -185,7 +185,7 @@ API int iotcon_list_insert_list(iotcon_list_h list, iotcon_list_h val, int pos)
 }
 
 
-API int iotcon_list_insert_state(iotcon_list_h list, iotcon_state_h val, int pos)
+API int iotcon_list_add_state(iotcon_list_h list, iotcon_state_h val, int pos)
 {
        iotcon_value_h value;
 
@@ -372,7 +372,7 @@ API int iotcon_list_get_nth_state(iotcon_list_h list, int pos, iotcon_state_h *s
 }
 
 
-static int _icl_list_del_nth_value(iotcon_list_h list, int pos)
+static int _icl_list_remove_nth_value(iotcon_list_h list, int pos)
 {
        iotcon_value_h value;
 
@@ -401,13 +401,13 @@ static int _icl_list_del_nth_value(iotcon_list_h list, int pos)
 }
 
 
-API int iotcon_list_del_nth(iotcon_list_h list, int pos)
+API int iotcon_list_remove_nth(iotcon_list_h list, int pos)
 {
        int ret;
 
-       ret = _icl_list_del_nth_value(list, pos);
+       ret = _icl_list_remove_nth_value(list, pos);
        if (IOTCON_ERROR_NONE != ret)
-               ERR("_icl_list_del_nth_value() Fail(%d)", ret);
+               ERR("_icl_list_remove_nth_value() Fail(%d)", ret);
 
        return ret;
 }
index 2844422..f315396 100644 (file)
@@ -146,7 +146,7 @@ API int iotcon_state_set_int(iotcon_state_h state, const char *key, int val)
        return IOTCON_ERROR_NONE;
 }
 
-API int iotcon_state_del(iotcon_state_h state, const char *key)
+API int iotcon_state_unset(iotcon_state_h state, const char *key)
 {
        int ret;
 
index eab91cf..01209c8 100644 (file)
@@ -92,7 +92,7 @@ static bool _icl_resource_types_duplicate_check(iotcon_resource_types_h types,
 
 /* The length of resource type should be less than or equal to 61.
  * Duplicate strings are not allowed. */
-API int iotcon_resource_types_insert(iotcon_resource_types_h types, const char *type)
+API int iotcon_resource_types_add(iotcon_resource_types_h types, const char *type)
 {
        char *resource_type;
 
@@ -124,7 +124,7 @@ API int iotcon_resource_types_insert(iotcon_resource_types_h types, const char *
 }
 
 
-API int iotcon_resource_types_delete(iotcon_resource_types_h types, const char *type)
+API int iotcon_resource_types_remove(iotcon_resource_types_h types, const char *type)
 {
        GList *found_node;
 
index 49dc550..2fdfb8a 100644 (file)
@@ -83,7 +83,7 @@ static void _icl_request_handler(GDBusConnection *connection,
                }
 
                while (g_variant_iter_loop(options, "(q&s)", &option_id, &option_data))
-                       iotcon_options_insert(request.header_options, option_id, option_data);
+                       iotcon_options_add(request.header_options, option_id, option_data);
        }
        g_variant_iter_free(options);
 
@@ -99,7 +99,7 @@ static void _icl_request_handler(GDBusConnection *connection,
                }
 
                while (g_variant_iter_loop(query, "(&s&s)", &key, &value))
-                       iotcon_query_insert(request.query, key, value);
+                       iotcon_query_add(request.query, key, value);
        }
        g_variant_iter_free(query);
 
@@ -122,9 +122,9 @@ static void _icl_request_handler(GDBusConnection *connection,
                if (IOTCON_OBSERVE_REGISTER == request.observation_info.action) {
                        if (NULL == resource->observers)
                                iotcon_observers_create(&resource->observers);
-                       iotcon_observers_insert(resource->observers, observer_id);
+                       iotcon_observers_add(resource->observers, observer_id);
                } else if (IOTCON_OBSERVE_DEREGISTER == request.observation_info.action) {
-                       iotcon_observers_delete(resource->observers, observer_id);
+                       iotcon_observers_remove(resource->observers, observer_id);
                }
        }
 
index 40c0d18..3f4f56a 100644 (file)
@@ -491,7 +491,7 @@ int iotcon_state_is_null(iotcon_state_h state, const char *key, bool *is_null);
  * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
  * @retval #IOTCON_ERROR_NO_DATA  No data available
  */
-int iotcon_state_del(iotcon_state_h state, const char *key);
+int iotcon_state_unset(iotcon_state_h state, const char *key);
 
 /**
  * @brief Gets the type of a value at the given key.
@@ -714,7 +714,7 @@ void iotcon_list_destroy(iotcon_list_h list);
  * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
  * @retval #IOTCON_ERROR_INVALID_TYPE  Invalid type
  */
-int iotcon_list_insert_int(iotcon_list_h list, int val, int pos);
+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.
@@ -733,7 +733,7 @@ int iotcon_list_insert_int(iotcon_list_h list, int val, int pos);
  * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
  * @retval #IOTCON_ERROR_INVALID_TYPE  Invalid type
  */
-int iotcon_list_insert_bool(iotcon_list_h list, bool val, int pos);
+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.
@@ -752,7 +752,7 @@ int iotcon_list_insert_bool(iotcon_list_h list, bool val, int pos);
  * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
  * @retval #IOTCON_ERROR_INVALID_TYPE  Invalid type
  */
-int iotcon_list_insert_double(iotcon_list_h list, double val, int pos);
+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.
@@ -771,7 +771,7 @@ int iotcon_list_insert_double(iotcon_list_h list, double val, int pos);
  * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
  * @retval #IOTCON_ERROR_INVALID_TYPE  Invalid type
  */
-int iotcon_list_insert_str(iotcon_list_h list, char *val, int pos);
+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.
@@ -790,7 +790,7 @@ int iotcon_list_insert_str(iotcon_list_h list, char *val, int pos);
  * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
  * @retval #IOTCON_ERROR_INVALID_TYPE  Invalid type
  */
-int iotcon_list_insert_list(iotcon_list_h list, iotcon_list_h val, int pos);
+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.
@@ -809,7 +809,7 @@ int iotcon_list_insert_list(iotcon_list_h list, iotcon_list_h val, int pos);
  * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
  * @retval #IOTCON_ERROR_INVALID_TYPE  Invalid type
  */
-int iotcon_list_insert_state(iotcon_list_h list, iotcon_state_h val, int pos);
+int iotcon_list_add_state(iotcon_list_h list, iotcon_state_h val, int pos);
 
 /**
  * @brief Gets the integer value at the given position.
@@ -933,7 +933,7 @@ int iotcon_list_get_nth_state(iotcon_list_h list, int pos, iotcon_state_h *state
  * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
  * @retval #IOTCON_ERROR_NO_DATA  No data available
  */
-int iotcon_list_del_nth(iotcon_list_h list, int pos);
+int iotcon_list_remove_nth(iotcon_list_h list, int pos);
 
 /**
  * @brief Gets the type of the list.
index e3c7f12..a4a16db 100644 (file)
@@ -83,6 +83,156 @@ typedef struct icl_notify_msg* iotcon_notimsg_h;
 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
@@ -105,8 +255,8 @@ typedef struct icl_options* iotcon_options_h;
  * @retval #IOTCON_ERROR_INVALID_PARAMETER Invalid parameter
  *
  * @see iotcon_options_destroy()
- * @see iotcon_options_insert()
- * @see iotcon_options_delete()
+ * @see iotcon_options_add()
+ * @see iotcon_options_remove()
  * @see iotcon_options_lookup()
  */
 int iotcon_options_create(iotcon_options_h *options);
@@ -121,8 +271,8 @@ int iotcon_options_create(iotcon_options_h *options);
  * @return void
  *
  * @see iotcon_options_create()
- * @see iotcon_options_insert()
- * @see iotcon_options_delete()
+ * @see iotcon_options_add()
+ * @see iotcon_options_remove()
  * @see iotcon_options_lookup()
  */
 void iotcon_options_destroy(iotcon_options_h options);
@@ -146,10 +296,10 @@ void iotcon_options_destroy(iotcon_options_h options);
  *
  * @see iotcon_options_create()
  * @see iotcon_options_destroy()
- * @see iotcon_options_delete()
+ * @see iotcon_options_remove()
  * @see iotcon_options_lookup()
  */
-int iotcon_options_insert(iotcon_options_h options, unsigned short id,
+int iotcon_options_add(iotcon_options_h options, unsigned short id,
                const char *data);
 
 /**
@@ -166,10 +316,10 @@ int iotcon_options_insert(iotcon_options_h options, unsigned short id,
  *
  * @see iotcon_options_create()
  * @see iotcon_options_destroy()
- * @see iotcon_options_insert()
+ * @see iotcon_options_add()
  * @see iotcon_options_lookup()
  */
-int iotcon_options_delete(iotcon_options_h options, unsigned short id);
+int iotcon_options_remove(iotcon_options_h options, unsigned short id);
 
 /**
  * @brief Looks up data at the given id from the options.
@@ -186,8 +336,8 @@ int iotcon_options_delete(iotcon_options_h options, unsigned short id);
  *
  * @see iotcon_options_create()
  * @see iotcon_options_destroy()
- * @see iotcon_options_insert()
- * @see iotcon_options_delete()
+ * @see iotcon_options_add()
+ * @see iotcon_options_remove()
  */
 int iotcon_options_lookup(iotcon_options_h options, unsigned short id, char **data);
 
@@ -260,8 +410,8 @@ typedef struct icl_query* iotcon_query_h;
  * @retval #IOTCON_ERROR_INVALID_PARAMETER  Invalid parameter
  *
  * @see iotcon_query_destroy()
- * @see iotcon_query_insert()
- * @see iotcon_query_delete()
+ * @see iotcon_query_add()
+ * @see iotcon_query_remove()
  * @see iotcon_query_lookup()
  */
 int iotcon_query_create(iotcon_query_h *query);
@@ -276,207 +426,169 @@ int iotcon_query_create(iotcon_query_h *query);
  * @return void
  *
  * @see iotcon_query_create()
- * @see iotcon_query_insert()
- * @see iotcon_query_delete()
+ * @see iotcon_query_add()
+ * @see iotcon_query_remove()
  * @see iotcon_query_lookup()
  */
 void iotcon_query_destroy(iotcon_query_h query);
 
 /**
- * @brief Inserts a new key and correspoding value into the query.
+ * @brief Get resource types from the query.
  *
  * @since_tizen 3.0
- * @remarks The full length of query should be less than or equal to 64.
+ * @remarks @a types must not be released using iotcon_resource_types_destroy().
  *
  * @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
+ * @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_OUT_OF_MEMORY  Out of memory
  * @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_delete()
- * @see iotcon_query_lookup()
+ * @see iotcon_query_add()
+ * @see iotcon_query_remove()
+ * @see iotcon_query_set_resource_types()
  */
-int iotcon_query_insert(iotcon_query_h query, const char *key, const char *value);
+int iotcon_query_get_resource_tyeps(iotcon_query_h query, iotcon_resource_types_h *types);
 
 /**
- * @brief Deletes the key and its associated value from the query.
+ * @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[in] key The key of the option to delete
+ * @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_insert()
- * @see iotcon_query_lookup()
+ * @see iotcon_query_add()
+ * @see iotcon_query_remove()
+ * @see iotcon_query_set_interface()
  */
-int iotcon_query_delete(iotcon_query_h query, const char *key);
+int iotcon_query_get_interface(iotcon_query_h query, int *iface);
 
 /**
- * @brief Lookup data at the given key from the query.
+ * @brief Sets the resource types into 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
+ * @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_insert()
- * @see iotcon_query_delete()
- */
-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()
+ * @see iotcon_query_add()
+ * @see iotcon_query_remove()
+ * @see iotcon_query_lookup()
+ * @see iotcon_query_get_resource_tyeps()
  */
-typedef int (*iotcon_query_foreach_cb)(const char *key, const char *value,
-               void *user_data);
+int iotcon_query_set_resource_types(iotcon_query_h query, iotcon_resource_types_h types);
 
 /**
- * @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.
+ * @brief Sets the interface into the query.
  *
  * @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
+ * @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
  *
- * @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 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
+ * @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()
  */
-typedef struct icl_resource_types* iotcon_resource_types_h;
+int iotcon_query_set_interface(iotcon_query_h query, iotcon_interface_e iface);
 
 /**
- * @brief Creates a new resource types handle.
+ * @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[out] ret_types A newly allocated list of resource types handle
+ * @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_resource_types_destroy()
- * @see iotcon_resource_types_insert()
- * @see iotcon_resource_types_delete()
- * @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_insert()
- * @see iotcon_resource_types_delete()
- * @see iotcon_resource_types_clone()
+ * @see iotcon_query_create()
+ * @see iotcon_query_destroy()
+ * @see iotcon_query_remove()
+ * @see iotcon_query_lookup()
  */
-void iotcon_resource_types_destroy(iotcon_resource_types_h types);
+int iotcon_query_add(iotcon_query_h query, const char *key, const char *value);
 
 /**
- * @brief Inserts a resource type into the list.
+ * @brief Deletes the key and its associated value from the query.
  *
  * @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
+ * @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_resource_types_create()
- * @see iotcon_resource_types_destroy()
- * @see iotcon_resource_types_delete()
- * @see iotcon_resource_types_clone()
+ * @see iotcon_query_create()
+ * @see iotcon_query_destroy()
+ * @see iotcon_query_add()
+ * @see iotcon_query_lookup()
  */
-int iotcon_resource_types_insert(iotcon_resource_types_h types, const char *type);
+int iotcon_query_remove(iotcon_query_h query, const char *key);
 
 /**
- * @brief Delete a resource type form the list.
+ * @brief Lookup data at the given key from the query.
  *
  * @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
+ * @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
- * @retval #IOTCON_ERROR_NO_DATA  No data available
  *
- * @see iotcon_resource_types_create()
- * @see iotcon_resource_types_destroy()
- * @see iotcon_resource_types_insert()
- * @see iotcon_resource_types_clone()
+ * @see iotcon_query_create()
+ * @see iotcon_query_destroy()
+ * @see iotcon_query_add()
+ * @see iotcon_query_remove()
  */
-int iotcon_resource_types_delete(iotcon_resource_types_h types, const char *type);
+int iotcon_query_lookup(iotcon_query_h query, const char *key, char **data);
 
 /**
- * @brief Specifies the type of function passed to iotcon_resource_types_foreach()
+ * @brief Specifies the type of function passed to iotcon_query_foreach()
  *
  * @since_tizen 3.0
  *
- * @param[in] type The value of the resource types
+ * @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,
@@ -484,54 +596,34 @@ int iotcon_resource_types_delete(iotcon_resource_types_h types, const char *type
  * @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.
+ * @pre iotcon_query_foreach() will invoke this callback function.
  *
- * @see iotcon_resource_types_foreach()
+ * @see iotcon_query_foreach()
  */
-typedef int (*iotcon_resource_types_foreach_cb)(const char *type, void *user_data);
+typedef int (*iotcon_query_foreach_cb)(const char *key, const char *value,
+               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.
+ * @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] types The handle of resource types
+ * @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 pass to the function
+ * @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_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
+ * @post iotcon_query_foreach_cb() will be called for each query.
  *
- * @see iotcon_resource_types_create()
- * @see iotcon_resource_types_destroy()
- * @see iotcon_resource_types_insert()
- * @see iotcon_resource_types_delete()
+ * @see iotcon_query_foreach_cb()
  */
-int iotcon_resource_types_clone(iotcon_resource_types_h src,
-               iotcon_resource_types_h *dest);
+int iotcon_query_foreach(iotcon_query_h query, iotcon_query_foreach_cb cb,
+               void *user_data);
 
 /**
  * @brief The handle of observers.
@@ -554,8 +646,8 @@ typedef struct icl_observers* iotcon_observers_h;
  * @retval #IOTCON_ERROR_OUT_OF_MEMORY  Out of memory
  *
  * @see iotcon_observers_destroy()
- * @see iotcon_observers_insert()
- * @see iotcon_observers_delete()
+ * @see iotcon_observers_add()
+ * @see iotcon_observers_remove()
  */
 int iotcon_observers_create(iotcon_observers_h *ret_observers);
 
@@ -569,8 +661,8 @@ int iotcon_observers_create(iotcon_observers_h *ret_observers);
  * @return void
  *
  * @see iotcon_observers_create()
- * @see iotcon_observers_insert()
- * @see iotcon_observers_delete()
+ * @see iotcon_observers_add()
+ * @see iotcon_observers_remove()
  */
 void iotcon_observers_destroy(iotcon_observers_h observers);
 
@@ -590,9 +682,9 @@ void iotcon_observers_destroy(iotcon_observers_h observers);
  *
  * @see iotcon_observers_create()
  * @see iotcon_observers_destroy()
- * @see iotcon_observers_delete()
+ * @see iotcon_observers_remove()
  */
-int iotcon_observers_insert(iotcon_observers_h observers, int obs_id);
+int iotcon_observers_add(iotcon_observers_h observers, int obs_id);
 
 /**
  * @brief Remove id from the observers.
@@ -609,9 +701,9 @@ int iotcon_observers_insert(iotcon_observers_h observers, int obs_id);
  *
  * @see iotcon_observers_create()
  * @see iotcon_observers_destroy()
- * @see iotcon_observers_insert()
+ * @see iotcon_observers_add()
  */
-int iotcon_observers_delete(iotcon_observers_h observers, int obs_id);
+int iotcon_observers_remove(iotcon_observers_h observers, int obs_id);
 
 /**
  * @brief The handle of resource.
index 65b2158..ed180c7 100644 (file)
@@ -891,8 +891,8 @@ void iotcon_notimsg_destroy(iotcon_notimsg_h msg);
  * @see iotcon_notimsg_destroy()
  * @see iotcon_observers_create()
  * @see iotcon_observers_destroy()
- * @see iotcon_observers_insert()
- * @see iotcon_observers_delete()
+ * @see iotcon_observers_add()
+ * @see iotcon_observers_remove()
  */
 int iotcon_resource_notify(iotcon_resource_h resource, iotcon_notimsg_h msg,
                iotcon_observers_h observers);
index fa9b02c..7498997 100644 (file)
@@ -397,9 +397,9 @@ static void _found_resource(iotcon_remote_resource_h resource, int result, void
                        return;
                }
 
-               ret = iotcon_query_insert(query, "query_key", "query_value");
+               ret = iotcon_query_add(query, "query_key", "query_value");
                if (IOTCON_ERROR_NONE != ret) {
-                       ERR("iotcon_query_insert() Fail(%d)", ret);
+                       ERR("iotcon_query_add() Fail(%d)", ret);
                        iotcon_query_destroy(query);
                        device_id_list = g_list_remove(device_id_list, door_resource_device_id);
                        free(door_resource_device_id);
index 2472a26..ef586e9 100644 (file)
@@ -100,10 +100,10 @@ static iotcon_resource_h _create_door_resource(char *uri_path, char *type, int i
                return NULL;
        }
 
-       ret = iotcon_resource_types_insert(resource_types, type);
+       ret = iotcon_resource_types_add(resource_types, type);
        if (IOTCON_ERROR_NONE != ret) {
                iotcon_resource_types_destroy(resource_types);
-               ERR("iotcon_resource_types_insert() Fail(%d)", ret);
+               ERR("iotcon_resource_types_add() Fail(%d)", ret);
                return NULL;
        }
 
@@ -481,14 +481,14 @@ static void _request_handler(iotcon_resource_h resource, iotcon_request_h reques
                                ERR("iotcon_request_get_observer_id() Fail(%d)", ret);
                                return;
                        }
-                       ret = iotcon_observers_insert(door->observers, observer_id);
+                       ret = iotcon_observers_add(door->observers, observer_id);
                } else if (IOTCON_OBSERVE_DEREGISTER == observer_action) {
                        ret = iotcon_request_get_observer_id(request, &observer_id);
                        if (IOTCON_ERROR_NONE != ret) {
                                ERR("iotcon_request_get_observer_id() Fail(%d)", ret);
                                return;
                        }
-                       ret = iotcon_observers_delete(door->observers, observer_id);
+                       ret = iotcon_observers_remove(door->observers, observer_id);
                        if (IOTCON_ERROR_NONE != ret) {
                                ERR("iotcon_observers_remove() Fail(%d)", ret);
                                return;
index 01dced5..aa5117c 100644 (file)
@@ -183,9 +183,9 @@ static void _on_get_1st(iotcon_remote_resource_h resource,
                return;
        }
 
-       ret = iotcon_query_insert(query_params, "if", "oic.if.b");
+       ret = iotcon_query_add(query_params, "if", "oic.if.b");
        if (IOTCON_ERROR_NONE != ret) {
-               ERR("iotcon_query_insert() Fail(%d)", ret);
+               ERR("iotcon_query_add() Fail(%d)", ret);
                iotcon_query_destroy(query_params);
                return;
        }
index 1f9d951..42d3935 100644 (file)
@@ -137,41 +137,41 @@ static void _room_request_handler_get(iotcon_request_h request,
                return;
        }
 
-       ret = iotcon_list_insert_int(temperature_list, 22, -1);
+       ret = iotcon_list_add_int(temperature_list, 22, -1);
        if (IOTCON_ERROR_NONE != ret) {
-               ERR("iotcon_list_insert_int() Fail(%d)", ret);
+               ERR("iotcon_list_add_int() Fail(%d)", ret);
                iotcon_state_destroy(room_state);
                iotcon_representation_destroy(room_repr);
                return;
        }
 
-       ret = iotcon_list_insert_int(temperature_list, 23, -1);
+       ret = iotcon_list_add_int(temperature_list, 23, -1);
        if (IOTCON_ERROR_NONE != ret) {
-               ERR("iotcon_list_insert_int() Fail(%d)", ret);
+               ERR("iotcon_list_add_int() Fail(%d)", ret);
                iotcon_state_destroy(room_state);
                iotcon_representation_destroy(room_repr);
                return;
        }
 
-       ret = iotcon_list_insert_int(temperature_list, 24, -1);
+       ret = iotcon_list_add_int(temperature_list, 24, -1);
        if (IOTCON_ERROR_NONE != ret) {
-               ERR("iotcon_list_insert_int() Fail(%d)", ret);
+               ERR("iotcon_list_add_int() Fail(%d)", ret);
                iotcon_state_destroy(room_state);
                iotcon_representation_destroy(room_repr);
                return;
        }
 
-       ret = iotcon_list_insert_int(temperature_list, 25, -1);
+       ret = iotcon_list_add_int(temperature_list, 25, -1);
        if (IOTCON_ERROR_NONE != ret) {
-               ERR("iotcon_list_insert_int() Fail(%d)", ret);
+               ERR("iotcon_list_add_int() Fail(%d)", ret);
                iotcon_state_destroy(room_state);
                iotcon_representation_destroy(room_repr);
                return;
        }
 
-       ret = iotcon_list_insert_int(temperature_list, 26, -1);
+       ret = iotcon_list_add_int(temperature_list, 26, -1);
        if (IOTCON_ERROR_NONE != ret) {
-               ERR("iotcon_list_insert_int() Fail(%d)", ret);
+               ERR("iotcon_list_add_int() Fail(%d)", ret);
                iotcon_state_destroy(room_state);
                iotcon_representation_destroy(room_repr);
                return;
@@ -504,9 +504,9 @@ int main(int argc, char **argv)
                iotcon_close();
                return -1;
        }
-       ret = iotcon_resource_types_insert(room_rtypes, "core.room");
+       ret = iotcon_resource_types_add(room_rtypes, "core.room");
        if (IOTCON_ERROR_NONE != ret) {
-               ERR("iotcon_resource_types_insert(%s) Fail(%d)", "core.room", ret);
+               ERR("iotcon_resource_types_add(%s) Fail(%d)", "core.room", ret);
                iotcon_resource_types_destroy(room_rtypes);
                iotcon_close();
                return -1;
@@ -532,9 +532,9 @@ int main(int argc, char **argv)
                iotcon_close();
                return -1;
        }
-       ret = iotcon_resource_types_insert(light_rtypes, "core.light");
+       ret = iotcon_resource_types_add(light_rtypes, "core.light");
        if (IOTCON_ERROR_NONE != ret) {
-               ERR("iotcon_resource_types_insert(%s) Fail(%d)", "core.light", ret);
+               ERR("iotcon_resource_types_add(%s) Fail(%d)", "core.light", ret);
                iotcon_resource_types_destroy(light_rtypes);
                iotcon_resource_destroy(room_handle);
                iotcon_close();