merge from tizen_2.4
[platform/core/messaging/msg-service.git] / include / common / MsgTypes.h
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15 */
16
17 #ifndef MSG_TYPES_H
18 #define MSG_TYPES_H
19
20 /**
21  *      @file           MsgTypes.h
22  *      @brief          Defines common types of messaging framework
23  *      @version        1.0
24  */
25
26 /**
27  *      @section                Introduction
28  *      - Introduction : Overview on Message Common Types
29  *      @section                Program
30  *      - Program : Message Common Types Reference
31  */
32
33 /*==================================================================================================
34                                          INCLUDE FILES
35 ==================================================================================================*/
36 #include <stdlib.h>
37 #include <stdio.h>
38 #include <time.h>
39 #include <stdbool.h>
40
41 #include "msg_types.h"
42
43 /**
44  *      @ingroup                MESSAGING_FRAMEWORK
45  *      @defgroup       MESSAGING_COMMON_TYPES  Messaging Common Types
46  *      @{
47  */
48
49 /*==================================================================================================
50                                          TYPES
51 ==================================================================================================*/
52
53 /**
54  *      @brief  Defines the enabled MMS version
55  */
56 #define MMS_V1_2                                                                // MMS Version : MMS_V1_0 / MMS_V1_1 / MMS_V1_2
57
58
59 /**
60  * @brief Defines the notification method
61  */
62 #define MSG_NOTI_INTEGRATION
63
64 /**
65  * @brief Defines the enabled drm
66  */
67 #define MSG_DRM_SUPPORT (0)
68
69 #define MAX_TELEPHONY_HANDLE_CNT        (3)
70
71 /**
72  *      @brief  Defines message struct handle.
73  */
74
75 typedef struct _msg_struct{
76         int type;
77         void *data;
78 }msg_struct_s;
79
80 /*==================================================================================================
81                                          STRUCTURES
82 ==================================================================================================*/
83
84 /**
85  *      @brief  Represents address information.
86  */
87
88 typedef struct
89 {
90         msg_address_type_t              addressType;                                                                                                    /**< The type of an address in case of an Email or a mobile phone */
91         msg_recipient_type_t    recipientType;                                                                                                  /**< The type of recipient address in case of To, Cc, and Bcc */
92         msg_contact_id_t                        contactId;                                                                                                                      /**< The contact ID of address */
93         char                                                                            addressVal[MAX_ADDRESS_VAL_LEN+1];              /**< The actual value of an address */
94         char                                                                            displayName[MAX_DISPLAY_NAME_LEN+1];    /**< The display name of an address */
95 } MSG_ADDRESS_INFO_S;
96
97
98 /**
99  *      @brief  Represents port number information.
100  */
101 typedef struct
102 {
103         bool                            valid;          /**< Indicates whether port information is used or not. */
104         unsigned short          dstPort;                /**< Recipient port number, not greater than 16 bit */
105         unsigned short          srcPort;                /**< Sender port number, not greater than 16 bit */
106 } MSG_PORT_INFO_S;
107
108
109 /**
110  *      @brief  Represents MMS Sending Option Structure in application.
111  */
112 typedef struct
113 {
114         bool                                    bReadReq;
115         time_t                          expiryTime;
116         bool                                    bUseDeliveryCustomTime;
117         time_t                          deliveryTime;
118         msg_priority_type_t     priority;
119 } MMS_SENDINGOPT_S;
120
121
122 /**
123  *      @brief  Represents SMS Sending Option Structure in application.
124  */
125 typedef struct
126 {
127         bool bReplyPath;
128 } SMS_SENDINGOPT_S;
129
130
131 /**
132  *      @brief  Represents MSG Sending Option Structure in application.
133  */
134 typedef struct
135 {
136         bool bSetting;
137         bool bDeliverReq;
138         bool bKeepCopy;
139         msg_struct_t mmsSendOpt;
140         msg_struct_t smsSendOpt;
141
142 } MSG_SENDINGOPT_S;
143
144
145 typedef enum
146 {
147         MMS_TIMETYPE_NONE               = -1,   // fixme: backward compatibility
148         MMS_TIMETYPE_ERROR              = -1,   // error return in Get method
149         MMS_TIMETYPE_RELATIVE   = 0,    // default
150         MMS_TIMETYPE_ABSOLUTE   = 1
151 }MmsTimeType;
152
153
154 typedef struct
155 {
156         MmsTimeType     type;
157         unsigned int    time;
158 }MmsTimeStruct;
159
160
161 /**
162  *      @brief  Represents MMS Sending Option Structure in framework.
163  */
164 typedef struct
165 {
166         bool                                    bReadReq;
167         bool                                    bUseDeliveryCustomTime;
168         msg_priority_type_t     priority;
169         MmsTimeStruct                   expiryTime;
170         MmsTimeStruct                   deliveryTime;
171 } MMS_SENDINGOPT_INFO_S;
172
173
174 /**
175  *      @brief  Represents SMS Sending Option Structure in framework.
176  */
177 typedef struct
178 {
179         bool    bReplyPath;
180 } SMS_SENDINGOPT_INFO_S;
181
182
183 /**
184  *      @brief  Represents MSG Sending Option Structure in framework.
185  */
186 typedef struct
187 {
188         bool bSetting;
189         bool bDeliverReq;
190         bool bKeepCopy;
191
192         union
193         {
194                 MMS_SENDINGOPT_INFO_S   mmsSendOptInfo;
195                 SMS_SENDINGOPT_INFO_S   smsSendOptInfo;
196         } option;
197 } MSG_SENDINGOPT_INFO_S;
198
199
200 /**
201  *      @brief  Represents a request in the application. \n
202  *      Applications compose a request and send it to the framework via Message handle. \n
203  *      This request ID is used to manage the request by the framework.
204  */
205 typedef struct
206 {
207         msg_request_id_t        reqId;  /**< Indicates the request ID, which is unique.
208                                                                         When applications submit a request to the framework, this value will be set by the framework. */
209         msg_struct_t            msg;    /**< Indicates the message structure to be sent by applications. */
210         msg_struct_t            sendOpt;
211 } MSG_REQUEST_S;
212
213
214 /**
215  *      @brief  Represents Address information list.
216  */
217
218 typedef struct
219 {
220         msg_contact_id_t                contactId;                      /**< The contact id of message common informatioin */
221         MSG_ADDRESS_INFO_S              msgAddrInfo;            /**< The pointer to message common informatioin */
222 } MSG_THREAD_LIST_INDEX_S;
223
224 typedef struct
225 {
226         msg_contact_id_t                contactId;                      /**< The contact id of message common informatioin */
227         msg_struct_t                    msgAddrInfo;            /**< The pointer to message common informatioin */
228 } MSG_THREAD_LIST_INDEX_INFO_S;
229
230
231 /**
232  *      @brief  Represents Peer Count Info.
233  */
234 typedef struct
235 {
236         int totalCount;                 /**< Indicates the total number of messages from the Peer. */
237         int unReadCount;                /**< Indicates the unread messages from the Peer. */
238         int smsMsgCount;                /**< Indicates the SMS messages from the Peer. */
239         int mmsMsgCount;                /**< Indicates the MMS messages from the Peer. */
240 }MSG_THREAD_COUNT_INFO_S;
241
242
243 /**
244  *      @brief  Represents the request information of Push Message (SI, SL).
245  */
246 typedef struct
247 {
248         msg_push_action_t       action;
249         unsigned long                   received;
250         unsigned long                   created;
251         unsigned long                   expires;
252         char                                    id[MAX_WAPPUSH_ID_LEN + 1];
253         char                                    href[MAX_WAPPUSH_HREF_LEN + 1];
254         char                                    contents[MAX_WAPPUSH_CONTENTS_LEN + 1];
255 } MSG_PUSH_MESSAGE_S;
256
257
258 /**
259  *      @brief  Represents the request information of Push Message (CO).
260  */
261 typedef struct
262 {
263         int             invalObjectCnt;
264         int             invalServiceCnt;
265         char            invalObjectUrl[MAX_PUSH_CACHEOP_INVALID_OBJECT_MAX][MAX_PUSH_CACHEOP_MAX_URL_LEN + 1];
266         char            invalServiceUrl[MAX_PUSH_CACHEOP_INVALID_SERVICE_MAX][MAX_PUSH_CACHEOP_MAX_URL_LEN + 1];
267 } MSG_PUSH_CACHEOP_S;
268
269
270 /**
271  *      @brief  Represents the SyncML Message Information.
272  */
273 typedef struct
274 {
275         int                                     extId;
276         int                                     pinCode;
277         msg_struct_t            msg;
278 }MSG_SYNCML_MESSAGE_S;
279
280
281 /**
282  *      @brief  Represents the SyncML Message Data.
283  */
284  typedef struct
285 {
286         msg_syncml_message_type_t       syncmlType;
287         int                                                     pushBodyLen;
288         char                                                    pushBody[MAX_WAPPUSH_CONTENTS_LEN + 1];
289         int                                                             wspHeaderLen;
290         char                                                    wspHeader[MAX_WAPPUSH_CONTENTS_LEN + 1];
291         int                                                     simIndex;
292 }MSG_SYNCML_MESSAGE_DATA_S;
293
294
295 /**
296  *      @brief  Represents the SyncML Message Data.
297  */
298  typedef struct
299 {
300         char                                                    pushHeader[MAX_WAPPUSH_CONTENTS_LEN + 1];
301         int                                                     pushBodyLen;
302         char                                                    pushBody[MAX_WAPPUSH_CONTENTS_LEN + 1];
303 }MSG_LBS_MESSAGE_DATA_S;
304
305
306 typedef struct
307 {
308         char                                                    pushHeader[MAX_WAPPUSH_CONTENTS_LEN + 1];
309         int                                                     pushBodyLen;
310         char                                                    pushBody[MAX_WAPPUSH_CONTENTS_LEN + 1];
311         char                                                    pushAppId[MAX_WAPPUSH_ID_LEN + 1];
312         char                                                    pushContentType[MAX_WAPPUSH_CONTENT_TYPE_LEN + 1];
313 }MSG_PUSH_MESSAGE_DATA_S;
314
315 /**
316  *      @brief  Represents the Report Status Data.
317  */
318 typedef struct
319 {
320         char addressVal[MAX_ADDRESS_VAL_LEN + 1];
321         int type;
322         int status;
323         time_t statusTime;
324 } MSG_REPORT_STATUS_INFO_S;
325
326
327 typedef struct
328 {
329         char contentType[MAX_WAPPUSH_CONTENT_TYPE_LEN + 1];
330         char appId[MAX_WAPPUSH_ID_LEN + 1];
331         char pkgName[MSG_FILEPATH_LEN_MAX + 1];
332         bool bLaunch;
333 }MSG_PUSH_EVENT_INFO_S;
334
335
336 typedef struct
337 {
338         msg_message_id_t msg_id;
339         char mime_type[MAX_MIME_TYPE_LEN+1];
340         char media_item[MSG_FILEPATH_LEN_MAX+1];
341         char thumb_path[MSG_FILEPATH_LEN_MAX+1];
342 } MSG_MEDIA_INFO_S;
343
344 /**
345  *      @}
346  */
347
348 #endif // MSG_TYPES_H
349