2.0_alpha release commit
[framework/messaging/email-service.git] / email-ipc / include / email-ipc.h
1 /*
2 *  email-service
3 *
4 * Copyright (c) 2000 - 2011 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 AP */
55 /*  ------------------------------------------------------------------------------------------------------------ */
56 EXPORT_API int emipc_initialize_proxy();
57
58 EXPORT_API int emipc_finalize_proxy();
59
60 EXPORT_API int emipc_execute_proxy_api(HIPC_API input_api_handle);
61
62 /*  ------------------------------------------------------------------------------------------------------------ */
63 /*      Stub AP */
64 /*  ------------------------------------------------------------------------------------------------------------ */
65 EXPORT_API bool emipc_initialize_stub(PFN_EXECUTE_API input_api_mapper);
66
67 EXPORT_API bool emipc_finalize_stub();
68
69 EXPORT_API bool emipc_execute_stub_api(HIPC_API input_api_handle);
70
71 /*  ------------------------------------------------------------------------------------------------------------ */
72 /*      AP */
73 /*  ------------------------------------------------------------------------------------------------------------ */
74 EXPORT_API HIPC_API emipc_create_email_api(long api_id);
75 EXPORT_API void     emipc_destroy_email_api(HIPC_API input_api_handle);
76
77 EXPORT_API long     emipc_get_api_id(HIPC_API input_api_handle);
78 EXPORT_API long     emipc_get_app_id(HIPC_API input_api_handle);
79
80 EXPORT_API bool emipc_add_parameter(HIPC_API api, EPARAMETER_DIRECTION direction, void *data, int data_length);
81 EXPORT_API bool emipc_add_dynamic_parameter(HIPC_API api, EPARAMETER_DIRECTION direction, void *data, int data_length);
82 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);
83 EXPORT_API void* emipc_get_nth_parameter_data(HIPC_API api_handle, EPARAMETER_DIRECTION direction, int param_index);
84 EXPORT_API int      emipc_get_parameter_length(HIPC_API input_api_handle, EPARAMETER_DIRECTION input_parameter_direction, int input_parameter_index);
85 EXPORT_API int   emipc_get_nth_parameter_length(HIPC_API input_api_handle, EPARAMETER_DIRECTION input_parameter_direction, int input_parameter_index);
86
87 #ifdef __cplusplus
88 }
89 #endif
90 #endif
91
92