From: sung.goo.kim Date: Thu, 19 May 2016 06:12:45 +0000 (+0900) Subject: Remove iface parameter on iotcon_response_set_representation() API X-Git-Tag: submit/tizen/20160603.003854~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e6e96006e98ba5c680f0da9a6af7b1663724ba6b;p=platform%2Fcore%2Fiot%2Fiotcon.git Remove iface parameter on iotcon_response_set_representation() API Change-Id: Iea8c78388ce5283d93322b446d5c5bdf35936234 --- diff --git a/doc/iotcon_doc.h b/doc/iotcon_doc.h index dea3859..52253bc 100644 --- a/doc/iotcon_doc.h +++ b/doc/iotcon_doc.h @@ -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); diff --git a/lib/icl-ioty-ocprocess.c b/lib/icl-ioty-ocprocess.c index 201a918..dcb8e72 100644 --- a/lib/icl-ioty-ocprocess.c +++ b/lib/icl-ioty-ocprocess.c @@ -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: diff --git a/lib/icl-response.c b/lib/icl-response.c index 43efe96..05f7011 100644 --- a/lib/icl-response.c +++ b/lib/icl-response.c @@ -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); diff --git a/lib/include/iotcon-list.h b/lib/include/iotcon-list.h index d123a0e..23a0896 100644 --- a/lib/include/iotcon-list.h +++ b/lib/include/iotcon-list.h @@ -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); diff --git a/lib/include/iotcon-response.h b/lib/include/iotcon-response.h index cd4a2f4..9c123e8 100644 --- a/lib/include/iotcon-response.h +++ b/lib/include/iotcon-response.h @@ -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); /** diff --git a/lib/include/iotcon-state.h b/lib/include/iotcon-state.h index 4ec71e4..f46a148 100644 --- a/lib/include/iotcon-state.h +++ b/lib/include/iotcon-state.h @@ -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); diff --git a/test/iotcon-test-basic-server.c b/test/iotcon-test-basic-server.c index 3219e17..9616de0 100644 --- a/test/iotcon-test-basic-server.c +++ b/test/iotcon-test-basic-server.c @@ -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); diff --git a/test/iotcon-test-iface-server.c b/test/iotcon-test-iface-server.c index 7b1c29c..c6de989 100644 --- a/test/iotcon-test-iface-server.c +++ b/test/iotcon-test-iface-server.c @@ -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); } }