Remove iface parameter on iotcon_response_set_representation() API 01/70401/7
authorsung.goo.kim <sung.goo.kim@samsung.com>
Thu, 19 May 2016 06:12:45 +0000 (15:12 +0900)
committerSunggoo Kim <sung.goo.kim@samsung.com>
Thu, 26 May 2016 04:54:52 +0000 (21:54 -0700)
Change-Id: Iea8c78388ce5283d93322b446d5c5bdf35936234

doc/iotcon_doc.h
lib/icl-ioty-ocprocess.c
lib/icl-response.c
lib/include/iotcon-list.h
lib/include/iotcon-response.h
lib/include/iotcon-state.h
test/iotcon-test-basic-server.c
test/iotcon-test-iface-server.c

index dea385968359ee4b61a79a370302733086fc3b1e..52253bcd08dd1112336f961075a2c8a5bbcd7940 100644 (file)
@@ -101,7 +101,7 @@ static void _request_handler(iotcon_resource_h resource, iotcon_request_h reques
                        return;
                }
 
-               ret = iotcon_response_set_representation(response, IOTCON_INTERFACE_DEFAULT, resp_repr);
+               ret = iotcon_response_set_representation(response, resp_repr);
                if (IOTCON_ERROR_NONE != ret) {
                        iotcon_state_destroy(state);
                        iotcon_representation_destroy(resp_repr);
index 201a91800f07ac7c4f7e5585e8d1cd3c1a10895e..dcb8e72ca5c95454f09d70bedb0590136532e8bf 100644 (file)
@@ -808,7 +808,6 @@ OCEntityHandlerResult icl_ioty_ocprocess_lite_request_cb(OCEntityHandlerFlag fla
        }
        res->oic_request_h = IC_POINTER_TO_INT64(request->requestHandle);
        res->oic_resource_h = IC_POINTER_TO_INT64(request->resource);
-       res->iface = strdup(IOTCON_INTERFACE_DEFAULT);
 
        switch (req_type) {
        case IOTCON_REQUEST_GET:
index 43efe96807cc2c1e4575d9c503454fe24befa519..05f7011862b2c6f0e4d09b87a06482b8d4c4d6d7 100644 (file)
@@ -63,8 +63,6 @@ API void iotcon_response_destroy(iotcon_response_h resp)
                iotcon_representation_destroy(resp->repr);
        if (resp->header_options)
                iotcon_options_destroy(resp->header_options);
-       if (resp->iface)
-               free(resp->iface);
        free(resp);
 }
 
@@ -124,14 +122,10 @@ API int iotcon_response_set_result(iotcon_response_h resp,
 
 
 API int iotcon_response_set_representation(iotcon_response_h resp,
-               const char *iface, iotcon_representation_h repr)
+               iotcon_representation_h repr)
 {
        RETV_IF(false == ic_utils_check_oic_feature(), IOTCON_ERROR_NOT_SUPPORTED);
        RETV_IF(NULL == resp, IOTCON_ERROR_INVALID_PARAMETER);
-       RETV_IF(NULL == iface, IOTCON_ERROR_INVALID_PARAMETER);
-
-       free(resp->iface);
-       resp->iface = strdup(iface);
 
        if (repr)
                repr = icl_representation_ref(repr);
index d123a0ef73ba8cf1e79afacef720050ae0428e9b..23a0896bbc592724971b4326ef60c86229d2c315 100644 (file)
@@ -126,8 +126,7 @@ static void _request_handler(iotcon_resource_h resource, iotcon_request_h reques
 
                ...
 
-               ret = iotcon_response_set_representation(response, IOTCON_INTERFACE_DEFAULT,
-                               representation);
+               ret = iotcon_response_set_representation(response, representation);
                if (IOTCON_ERROR_NONE != ret) {
                        iotcon_list_destroy(list);
                        iotcon_state_destroy(state);
index cd4a2f4308537fcb86b2bd78254ffda6f09ea66d..9c123e8293787489a213f6fc99b1fa80765e93ee 100644 (file)
@@ -154,7 +154,7 @@ static void _request_handler(iotcon_resource_h resource, iotcon_request_h reques
                        return;
                }
 
-               ret = iotcon_response_set_representation(response, IOTCON_INTERFACE_DEFAULT, repr);
+               ret = iotcon_response_set_representation(response, repr);
                if (IOTCON_ERROR_NONE != ret) {
                        iotcon_representation_destroy(repr);
                        iotcon_response_destroy(response);
@@ -309,10 +309,7 @@ int iotcon_response_set_result(iotcon_response_h resp, iotcon_response_result_e
  *
  * @since_tizen 3.0
  *
- * @remarks @a iface could be a value such as #IOTCON_INTERFACE_DEFAULT.
- *
  * @param[in] resp The handle of the response
- * @param[in] iface The interface of the representation
  * @param[in] repr The representation of the response
  *
  * @return 0 on success, otherwise a negative error value.
@@ -324,7 +321,7 @@ int iotcon_response_set_result(iotcon_response_h resp, iotcon_response_result_e
  * @see iotcon_response_create()
  * @see iotcon_response_destroy()
  */
-int iotcon_response_set_representation(iotcon_response_h resp, const char *iface,
+int iotcon_response_set_representation(iotcon_response_h resp,
                iotcon_representation_h repr);
 
 /**
index 4ec71e49d72eedc263ebb80082b9575ca6bbfc7f..f46a148d1691b573b1ab1987d1f7bc78f4a0cc3d 100644 (file)
@@ -98,8 +98,7 @@ static void _request_handler(iotcon_resource_h resource, iotcon_request_h reques
 
                ...
 
-               ret = iotcon_response_set_representation(response, IOTCON_INTERFACE_DEFAULT,
-                               representation);
+               ret = iotcon_response_set_representation(response, representation);
                if (IOTCON_ERROR_NONE != ret) {
                        iotcon_state_destroy(state);
                        iotcon_representation_destroy(representation);
index 3219e17e9dd2cb2e0b3afccc2c4849b3184c7246..9616de07ba0314434365dbcdf9e7ead5bba4f80e 100644 (file)
@@ -160,7 +160,7 @@ static int _send_response(iotcon_request_h request, iotcon_representation_h repr
                return -1;
        }
 
-       ret = iotcon_response_set_representation(response, IOTCON_INTERFACE_DEFAULT, repr);
+       ret = iotcon_response_set_representation(response, repr);
        if (IOTCON_ERROR_NONE != ret) {
                ERR("iotcon_response_set_representation() Fail(%d)", ret);
                iotcon_response_destroy(response);
index 7b1c29c0b4ab9efb185fc068cbb0e0be5caf7d16..c6de989efcfdb37869276dfd5483cf85a50e419d 100644 (file)
@@ -267,7 +267,7 @@ static iotcon_resource_h _create_resource(char *uri_path,
 }
 
 static int _send_response(iotcon_request_h request, iotcon_representation_h repr,
-               const char *iface, iotcon_response_result_e result)
+               iotcon_response_result_e result)
 {
        int ret;
        iotcon_response_h response;
@@ -278,7 +278,7 @@ static int _send_response(iotcon_request_h request, iotcon_representation_h repr
                return -1;
        }
 
-       ret = iotcon_response_set_representation(response, iface, repr);
+       ret = iotcon_response_set_representation(response, repr);
        if (IOTCON_ERROR_NONE != ret) {
                ERR("iotcon_response_set_representation() Fail(%d)", ret);
                iotcon_response_destroy(response);
@@ -369,7 +369,7 @@ static int _light_request_handler_get(light_resource_s *light,
                return -1;
        }
 
-       ret = _send_response(request, repr, IOTCON_INTERFACE_DEFAULT, IOTCON_RESPONSE_OK);
+       ret = _send_response(request, repr, IOTCON_RESPONSE_OK);
        if (0 != ret) {
                ERR("_send_response() Fail(%d)", ret);
                iotcon_representation_destroy(repr);
@@ -445,8 +445,7 @@ static int _fan_request_handler_get(fan_resource_s *fan, iotcon_request_h reques
                return -1;
        }
 
-       ret = _send_response(request, repr, IOTCON_INTERFACE_DEFAULT,
-                       IOTCON_RESPONSE_OK);
+       ret = _send_response(request, repr, IOTCON_RESPONSE_OK);
        if (0 != ret) {
                ERR("_send_response() Fail(%d)", ret);
                iotcon_representation_destroy(repr);
@@ -622,7 +621,6 @@ static int _room_request_handler_get(room_resource_s *room,
        int ret;
        iotcon_query_h query;
        iotcon_representation_h repr;
-       char *iface = IOTCON_INTERFACE_DEFAULT;
 
        INFO("GET request - Room");
 
@@ -639,18 +637,7 @@ static int _room_request_handler_get(room_resource_s *room,
                return -1;
        }
 
-       if (query) {
-               ret = iotcon_query_get_interface(query, &iface);
-               if (IOTCON_ERROR_NO_DATA == ret) {
-                       iface = IOTCON_INTERFACE_DEFAULT;
-               } else if (IOTCON_ERROR_NONE != ret) {
-                       ERR("iotcon_query_get_interface() Fail(%d)", ret);
-                       iotcon_representation_destroy(repr);
-                       return -1;
-               }
-       }
-
-       ret = _send_response(request, repr, iface, IOTCON_RESPONSE_OK);
+       ret = _send_response(request, repr, IOTCON_RESPONSE_OK);
        if (0 != ret) {
                ERR("_send_response() Fail(%d)", ret);
                iotcon_representation_destroy(repr);
@@ -668,23 +655,22 @@ static void _light_request_handler(iotcon_resource_h resource,
        int ret;
        iotcon_request_type_e type;
        light_resource_s *light = user_data;
-       char *iface = IOTCON_INTERFACE_DEFAULT;
 
        RET_IF(NULL == request);
 
        ret = iotcon_request_get_request_type(request, &type);
        if (IOTCON_ERROR_NONE != ret) {
                ERR("iotcon_request_get_request_type() Fail(%d)", ret);
-               _send_response(request, NULL, iface, IOTCON_RESPONSE_ERROR);
+               _send_response(request, NULL, IOTCON_RESPONSE_ERROR);
                return;
        }
 
        if (IOTCON_REQUEST_GET == type) {
                ret = _light_request_handler_get(light, request);
                if (0 != ret)
-                       _send_response(request, NULL, iface, IOTCON_RESPONSE_ERROR);
+                       _send_response(request, NULL, IOTCON_RESPONSE_ERROR);
        } else {
-               _send_response(request, NULL, iface, IOTCON_RESPONSE_FORBIDDEN);
+               _send_response(request, NULL, IOTCON_RESPONSE_FORBIDDEN);
        }
 }
 
@@ -694,23 +680,22 @@ static void _fan_request_handler(iotcon_resource_h resource,
        int ret;
        iotcon_request_type_e type;
        fan_resource_s *fan = user_data;
-       char *iface = IOTCON_INTERFACE_DEFAULT;
 
        RET_IF(NULL == request);
 
        ret = iotcon_request_get_request_type(request, &type);
        if (IOTCON_ERROR_NONE != ret) {
                ERR("iotcon_request_get_request_type() Fail(%d)", ret);
-               _send_response(request, NULL, iface, IOTCON_RESPONSE_ERROR);
+               _send_response(request, NULL, IOTCON_RESPONSE_ERROR);
                return;
        }
 
        if (IOTCON_REQUEST_GET == type) {
                ret = _fan_request_handler_get(fan, request);
                if (0 != ret)
-                       _send_response(request, NULL, iface, IOTCON_RESPONSE_ERROR);
+                       _send_response(request, NULL, IOTCON_RESPONSE_ERROR);
        } else {
-               _send_response(request, NULL, iface, IOTCON_RESPONSE_FORBIDDEN);
+               _send_response(request, NULL, IOTCON_RESPONSE_FORBIDDEN);
        }
 }
 
@@ -722,14 +707,13 @@ static void _room_request_handler(iotcon_resource_h resource,
        iotcon_request_type_e type;
        char *host_address;
        room_resource_s *room = user_data;
-       char *iface = IOTCON_INTERFACE_DEFAULT;
 
        RET_IF(NULL == request);
 
        ret = iotcon_request_get_host_address(request, &host_address);
        if (IOTCON_ERROR_NONE != ret) {
                ERR("iotcon_request_get_host_address() Fail(%d)", ret);
-               _send_response(request, NULL, iface, IOTCON_RESPONSE_ERROR);
+               _send_response(request, NULL, IOTCON_RESPONSE_ERROR);
                return;
        }
        INFO("host address : %s", host_address);
@@ -737,16 +721,16 @@ static void _room_request_handler(iotcon_resource_h resource,
        ret = iotcon_request_get_request_type(request, &type);
        if (IOTCON_ERROR_NONE != ret) {
                ERR("iotcon_request_get_request_type() Fail(%d)", ret);
-               _send_response(request, NULL, iface, IOTCON_RESPONSE_ERROR);
+               _send_response(request, NULL, IOTCON_RESPONSE_ERROR);
                return;
        }
 
        if (IOTCON_REQUEST_GET == type) {
                ret = _room_request_handler_get(room, request);
                if (0 != ret)
-                       _send_response(request, NULL, iface, IOTCON_RESPONSE_ERROR);
+                       _send_response(request, NULL, IOTCON_RESPONSE_ERROR);
        } else {
-               _send_response(request, NULL, iface, IOTCON_RESPONSE_FORBIDDEN);
+               _send_response(request, NULL, IOTCON_RESPONSE_FORBIDDEN);
        }
 }