Tizen 2.0 Release
[platform/core/messaging/email-service.git] / email-common-use / include / email-convert.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 #ifndef __EMAIL_CONVERT_H__
23 #define __EMAIL_CONVERT_H__
24
25 #include <time.h>
26 #include "email-internal-types.h"
27 #include "email-debug-log.h"
28 #include "email-storage.h"
29
30 /* Account */
31 INTERNAL_FUNC char* em_convert_account_to_byte_stream(email_account_t* account, int* stream_len);
32 INTERNAL_FUNC void  em_convert_byte_stream_to_account(char* stream,  int stream_len, email_account_t* account);
33 INTERNAL_FUNC int   em_convert_account_to_account_tbl(email_account_t *account, emstorage_account_tbl_t *account_tbl);
34 INTERNAL_FUNC int   em_convert_account_tbl_to_account(emstorage_account_tbl_t *account_tbl, email_account_t *account);
35
36
37 /* Mail */
38 INTERNAL_FUNC char* em_convert_mail_data_to_byte_stream(email_mail_data_t *mail_data, int *stream_size);
39 INTERNAL_FUNC void  em_convert_byte_stream_to_mail_data(char *stream, int stream_len, email_mail_data_t *mail_data);
40
41 INTERNAL_FUNC int   em_convert_mail_tbl_to_mail_data(emstorage_mail_tbl_t *mail_table_data, int item_count, email_mail_data_t **mail_data, int *error);
42 INTERNAL_FUNC int   em_convert_mail_data_to_mail_tbl(email_mail_data_t *mail_data, int item_count, emstorage_mail_tbl_t **mail_table_data, int *error);
43
44 /* Attachment */
45 INTERNAL_FUNC char* em_convert_attachment_data_to_byte_stream(email_attachment_data_t *attachment_data, int attachment_count, int* stream_len);
46 INTERNAL_FUNC void  em_convert_byte_stream_to_attachment_data(char *stream, int stream_len, email_attachment_data_t **attachment_data, int *attachment_count);
47
48 /* Mailbox */
49 INTERNAL_FUNC int   em_convert_mailbox_to_mailbox_tbl(email_mailbox_t *mailbox, emstorage_mailbox_tbl_t *mailbox_tbl);
50 INTERNAL_FUNC int   em_convert_mailbox_tbl_to_mailbox(emstorage_mailbox_tbl_t *mailbox_tbl, email_mailbox_t *mailbox);
51
52
53 INTERNAL_FUNC char* em_convert_mailbox_to_byte_stream(email_mailbox_t* mailbox, int* stream_len);
54 INTERNAL_FUNC void  em_convert_byte_stream_to_mailbox(char* stream, int stream_len, email_mailbox_t* mailbox);
55
56 /* Rule */
57 INTERNAL_FUNC char* em_convert_rule_to_byte_stream(email_rule_t* rule, int* stream_len);
58 INTERNAL_FUNC void  em_convert_byte_stream_to_rule(char *stream, int stream_len, email_rule_t *rule);
59
60 /* Sending options */
61 INTERNAL_FUNC char* em_convert_option_to_byte_stream(email_option_t* option, int* stream_len);
62 INTERNAL_FUNC void em_convert_byte_stream_to_option(char *stream, int stream_len, email_option_t *option);
63
64 /* time_t */
65 INTERNAL_FUNC int   em_convert_string_to_time_t(char *input_datetime_string, time_t *output_time);
66 INTERNAL_FUNC int   em_convert_time_t_to_string(time_t *input_time, char **output_datetime_string);
67
68 /* email_meeting_request_t */
69 INTERNAL_FUNC char* em_convert_meeting_req_to_byte_stream(email_meeting_request_t* meeting_req, int* nStreamSize);
70 INTERNAL_FUNC void  em_convert_byte_stream_to_meeting_req(char* stream, int stream_len, email_meeting_request_t* meeting_req);
71
72 INTERNAL_FUNC int   em_convert_mail_status_to_mail_tbl(int mail_status, emstorage_mail_tbl_t *result_mail_tbl_data, int* err_code);
73 INTERNAL_FUNC int   em_convert_mail_tbl_to_mail_status(emstorage_mail_tbl_t *mail_tbl_data, int *result_mail_status, int* err_code);
74
75 /* Search filter options */
76 INTERNAL_FUNC char* em_convert_search_filter_to_byte_stream(email_search_filter_t *input_search_filter_list, int input_search_filter_count, int *output_stream_size);
77 INTERNAL_FUNC void  em_convert_byte_stream_to_search_filter(char *input_stream, email_search_filter_t **output_search_filter_list, int *output_search_filter_count);
78
79 /* convert certificate */
80 INTERNAL_FUNC int em_convert_certificate_tbl_to_certificate(emstorage_certificate_tbl_t *certificate_tbl, email_certificate_t **certificate, int *error);
81
82 INTERNAL_FUNC int em_convert_certificate_to_certificate_tbl(email_certificate_t *certificate, emstorage_certificate_tbl_t *certificate_tbl);
83
84 #endif /* __EMAIL_CONVERT_H__ */