4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
24 #include <sys/socket.h>
27 #include "email-ipc.h"
28 #include "email-ipc-param-list.h"
29 #include "email-ipc-build.h"
30 #include "email-stub-task.h"
31 #include "email-stub-main.h"
33 #include "email-api.h"
34 #include "email-debug-log.h"
36 EXPORT_API void emipc_free_email_task(emipc_email_task *task)
38 EM_DEBUG_FUNC_BEGIN("task [%p]", task);
41 EM_DEBUG_EXCEPTION("Invalid parameter.");
45 emipc_free_api_info(task->api_info);
49 EXPORT_API bool emipc_parse_stream_email_task(emipc_email_task *task, void *stream, int response_id)
51 EM_DEBUG_FUNC_BEGIN();
53 task->api_info = (emipc_email_api_info *)malloc(sizeof(emipc_email_api_info));
54 if (task->api_info == NULL) {
55 EM_DEBUG_EXCEPTION("Malloc failed.");
58 memset(task->api_info, 0x00, sizeof(emipc_email_api_info));
61 emipc_deserialize_api_info(task->api_info, ePARAMETER_IN, stream);
62 task->api_info->response_id = response_id;
68 EXPORT_API emipc_email_api_info *emipc_get_api_info(emipc_email_task *task)
70 return task->api_info;
73 EXPORT_API int emipc_get_response_channel(emipc_email_task *task)
75 return task->response_channel;
78 EXPORT_API bool emipc_run_task(emipc_email_task *task)
80 EM_DEBUG_LOG("[IPCLib] starting a new task...");
82 int api_id = task->api_info->api_id;
83 int app_id = task->api_info->app_id;
85 EM_DEBUG_LOG("[IPCLib] This task (%s) is for async. App id [%d], Response ID [%d]", EM_APIID_TO_STR(api_id), app_id, api_id);
87 if (!emipc_execute_api_proxy_to_stub(task->api_info)) {
88 EM_DEBUG_EXCEPTION("emipc_execute_api_proxy_to_stub failed");