Tizen 2.0 Release
[platform/core/messaging/email-service.git] / email-ipc / include / email-ipc.h
1 /*
2 *  email-service
3 *
4 * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
5 *
6 * Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@samsung.com>
7
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
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
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.
19 *
20 */
21
22
23 #ifndef __IPC_LIBRARY_H
24 #define __IPC_LIBRARY_H
25
26 #include "email-types.h"
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
32 #define EM_PROXY_IF_NULL_RETURN_VALUE(expr1, expr2, val) {      \
33         if (!expr1&& expr2) {   \
34                 EM_DEBUG_LOG ("EM_PROXY_IF_NULL_RETURN_VALUE : PARAM IS NULL \n");      \
35                 emipc_destroy_email_api(expr2); \
36                 return val;     \
37         }; }
38
39         
40 /*  ------------------------------------------------------------------------------------------------------------ */
41 /*      Type Definitio */
42 /*  ------------------------------------------------------------------------------------------------------------ */
43 typedef enum {
44         ePARAMETER_IN = 0,
45         ePARAMETER_OUT,
46 } EPARAMETER_DIRECTION;
47
48 typedef void* HIPC_API;
49 typedef void* HIPC_PARAMETER;
50 typedef void (*PFN_PROXY_CALLBACK)      (HIPC_API input_api_handle, void* pParam1, void* pParam2);
51 typedef void (*PFN_EXECUTE_API)         (HIPC_API input_api_handle);
52
53 /*  ------------------------------------------------------------------------------------------------------------ */
54 /*      Proxy API */
55 /*  ------------------------------------------------------------------------------------------------------------ */
56 EXPORT_API int emipc_initialize_proxy();
57 EXPORT_API int emipc_finalize_proxy();
58 EXPORT_API int emipc_execute_proxy_api(HIPC_API input_api_handle);
59
60 /*  ------------------------------------------------------------------------------------------------------------ */
61 /*      Stub API */
62 /*  ------------------------------------------------------------------------------------------------------------ */
63 EXPORT_API bool emipc_initialize_stub(PFN_EXECUTE_API input_api_mapper);
64 EXPORT_API bool emipc_finalize_stub();
65 EXPORT_API bool emipc_execute_stub_api(HIPC_API input_api_handle);
66
67 /*  ------------------------------------------------------------------------------------------------------------ */
68 /*      API */
69 /*  ------------------------------------------------------------------------------------------------------------ */
70 EXPORT_API HIPC_API emipc_create_email_api(long api_id);
71 EXPORT_API void emipc_destroy_email_api(HIPC_API input_api_handle);
72
73 EXPORT_API long emipc_get_api_id(HIPC_API input_api_handle);
74 EXPORT_API long emipc_get_app_id(HIPC_API input_api_handle);
75
76 EXPORT_API bool emipc_add_parameter(HIPC_API api, EPARAMETER_DIRECTION direction, void *data, int data_length);
77 EXPORT_API bool emipc_add_dynamic_parameter(HIPC_API api, EPARAMETER_DIRECTION direction, void *data, int data_length);
78 EXPORT_API int emipc_get_parameter(HIPC_API input_api_handle, EPARAMETER_DIRECTION input_parameter_direction, int input_parameter_index, int input_parameter_buffer_size, void *output_parameter);
79 EXPORT_API void* emipc_get_nth_parameter_data(HIPC_API api_handle, EPARAMETER_DIRECTION direction, int param_index);
80 EXPORT_API int emipc_get_parameter_length(HIPC_API input_api_handle, EPARAMETER_DIRECTION input_parameter_direction, int input_parameter_index);
81 EXPORT_API int emipc_get_nth_parameter_length(HIPC_API input_api_handle, EPARAMETER_DIRECTION input_parameter_direction, int input_parameter_index);
82
83 EXPORT_API int emipc_execute_proxy_task(email_task_type_t input_task_type, void *input_task_parameter);
84 #ifdef __cplusplus
85 }
86 #endif
87 #endif
88
89