12da13dad275f98cb59435b2d3d032400abacdd4
[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         msg_address_type_t              addressType;                                                                                                    /**< The type of an address in case of an Email or a mobile phone */
90         msg_recipient_type_t    recipientType;                                                                                                  /**< The type of recipient address in case of To, Cc, and Bcc */
91         msg_contact_id_t                        contactId;                                                                                                                      /**< The contact ID of address */
92         char                                                                            addressVal[MAX_ADDRESS_VAL_LEN+1];              /**< The actual value of an address */
93         char                                                                            displayName[MAX_DISPLAY_NAME_LEN+1];    /**< The display name of an address */
94 } MSG_ADDRESS_INFO_S;
95
96
97 /**
98  *      @brief  Represents port number information.
99  */
100 typedef struct {
101         bool                            valid;          /**< Indicates whether port information is used or not. */
102         unsigned short          dstPort;                /**< Recipient port number, not greater than 16 bit */
103         unsigned short          srcPort;                /**< Sender port number, not greater than 16 bit */
104 } MSG_PORT_INFO_S;
105
106
107 /**
108  *      @brief  Represents MMS Sending Option Structure in application.
109  */
110 typedef struct {
111         bool                                    bReadReq;
112         time_t                          expiryTime;
113         bool                                    bUseDeliveryCustomTime;
114         time_t                          deliveryTime;
115         msg_priority_type_t     priority;
116 } MMS_SENDINGOPT_S;
117
118
119 /**
120  *      @brief  Represents SMS Sending Option Structure in application.
121  */
122 typedef struct {
123         bool bReplyPath;
124 } SMS_SENDINGOPT_S;
125
126
127 /**
128  *      @brief  Represents MSG Sending Option Structure in application.
129  */
130 typedef struct {
131         bool bSetting;
132         bool bDeliverReq;
133         bool bKeepCopy;
134         msg_struct_t mmsSendOpt;
135         msg_struct_t smsSendOpt;
136 } MSG_SENDINGOPT_S;
137
138
139 typedef enum {
140         MMS_TIMETYPE_NONE               = -1,   /**< fixme: backward compatibility */
141         MMS_TIMETYPE_ERROR              = -1,   /**< error return in Get method */
142         MMS_TIMETYPE_RELATIVE   = 0,    /**< default */
143         MMS_TIMETYPE_ABSOLUTE   = 1
144 } MmsTimeType;
145
146
147 typedef struct {
148         MmsTimeType     type;
149         unsigned int    time;
150 } MmsTimeStruct;
151
152
153 /**
154  *      @brief  Represents MMS Sending Option Structure in framework.
155  */
156 typedef struct {
157         bool                                    bReadReq;
158         bool                                    bUseDeliveryCustomTime;
159         msg_priority_type_t     priority;
160         MmsTimeStruct                   expiryTime;
161         MmsTimeStruct                   deliveryTime;
162 } MMS_SENDINGOPT_INFO_S;
163
164
165 /**
166  *      @brief  Represents SMS Sending Option Structure in framework.
167  */
168 typedef struct {
169         bool    bReplyPath;
170 } SMS_SENDINGOPT_INFO_S;
171
172
173 /**
174  *      @brief  Represents MSG Sending Option Structure in framework.
175  */
176 typedef struct {
177         bool bSetting;
178         bool bDeliverReq;
179         bool bKeepCopy;
180
181         union {
182                 MMS_SENDINGOPT_INFO_S   mmsSendOptInfo;
183                 SMS_SENDINGOPT_INFO_S   smsSendOptInfo;
184         } option;
185 } MSG_SENDINGOPT_INFO_S;
186
187
188 /**
189  *      @brief  Represents a request in the application. \n
190  *      Applications compose a request and send it to the framework via Message handle. \n
191  *      This request ID is used to manage the request by the framework.
192  */
193 typedef struct {
194         msg_request_id_t        reqId;  /**< Indicates the request ID, which is unique.
195                                                                         When applications submit a request to the framework, this value will be set by the framework. */
196         msg_struct_t            msg;    /**< Indicates the message structure to be sent by applications. */
197         msg_struct_t            sendOpt;
198 } MSG_REQUEST_S;
199
200
201 /**
202  *      @brief  Represents Address information list.
203  */
204
205 typedef struct {
206         msg_contact_id_t                contactId;                      /**< The contact id of message common informatioin */
207         MSG_ADDRESS_INFO_S              msgAddrInfo;            /**< The pointer to message common informatioin */
208 } MSG_THREAD_LIST_INDEX_S;
209
210 typedef struct {
211         msg_contact_id_t                contactId;                      /**< The contact id of message common informatioin */
212         msg_struct_t                    msgAddrInfo;            /**< The pointer to message common informatioin */
213 } MSG_THREAD_LIST_INDEX_INFO_S;
214
215
216 /**
217  *      @brief  Represents Peer Count Info.
218  */
219 typedef struct {
220         int totalCount;                 /**< Indicates the total number of messages from the Peer. */
221         int unReadCount;                /**< Indicates the unread messages from the Peer. */
222         int smsMsgCount;                /**< Indicates the SMS messages from the Peer. */
223         int mmsMsgCount;                /**< Indicates the MMS messages from the Peer. */
224 } MSG_THREAD_COUNT_INFO_S;
225
226
227 /**
228  *      @brief  Represents the request information of Push Message (SI, SL).
229  */
230 typedef struct {
231         msg_push_action_t       action;
232         unsigned long                   received;
233         unsigned long                   created;
234         unsigned long                   expires;
235         char                                    id[MAX_WAPPUSH_ID_LEN + 1];
236         char                                    href[MAX_WAPPUSH_HREF_LEN + 1];
237         char                                    contents[MAX_WAPPUSH_CONTENTS_LEN + 1];
238 } MSG_PUSH_MESSAGE_S;
239
240
241 /**
242  *      @brief  Represents the request information of Push Message (CO).
243  */
244 typedef struct {
245         int             invalObjectCnt;
246         int             invalServiceCnt;
247         char            invalObjectUrl[MAX_PUSH_CACHEOP_INVALID_OBJECT_MAX][MAX_PUSH_CACHEOP_MAX_URL_LEN + 1];
248         char            invalServiceUrl[MAX_PUSH_CACHEOP_INVALID_SERVICE_MAX][MAX_PUSH_CACHEOP_MAX_URL_LEN + 1];
249 } MSG_PUSH_CACHEOP_S;
250
251
252 /**
253  *      @brief  Represents the SyncML Message Information.
254  */
255 typedef struct {
256         int                                     extId;
257         int                                     pinCode;
258         msg_struct_t            msg;
259 } MSG_SYNCML_MESSAGE_S;
260
261
262 /**
263  *      @brief  Represents the SyncML Message Data.
264  */
265 typedef struct {
266         msg_syncml_message_type_t       syncmlType;
267         int                                                             pushBodyLen;
268         char                                                    pushBody[MAX_WAPPUSH_CONTENTS_LEN + 1];
269         int                                                             wspHeaderLen;
270         char                                                    wspHeader[MAX_WAPPUSH_CONTENTS_LEN + 1];
271         int                                                     simIndex;
272 } MSG_SYNCML_MESSAGE_DATA_S;
273
274
275 /**
276  *      @brief  Represents the SyncML Message Data.
277  */
278 typedef struct {
279         char                                                    pushHeader[MAX_WAPPUSH_CONTENTS_LEN + 1];
280         int                                                     pushBodyLen;
281         char                                                    pushBody[MAX_WAPPUSH_CONTENTS_LEN + 1];
282 } MSG_LBS_MESSAGE_DATA_S;
283
284
285 typedef struct {
286         char                                                    pushHeader[MAX_WAPPUSH_CONTENTS_LEN + 1];
287         int                                                     pushBodyLen;
288         char                                                    pushBody[MAX_WAPPUSH_CONTENTS_LEN + 1];
289         char                                                    pushAppId[MAX_WAPPUSH_ID_LEN + 1];
290         char                                                    pushContentType[MAX_WAPPUSH_CONTENT_TYPE_LEN + 1];
291 } MSG_PUSH_MESSAGE_DATA_S;
292
293 /**
294  *      @brief  Represents the Report Status Data.
295  */
296 typedef struct {
297         char addressVal[MAX_ADDRESS_VAL_LEN + 1];
298         int type;
299         int status;
300         time_t statusTime;
301 } MSG_REPORT_STATUS_INFO_S;
302
303
304 typedef struct {
305         char contentType[MAX_WAPPUSH_CONTENT_TYPE_LEN + 1];
306         char appId[MAX_WAPPUSH_ID_LEN + 1];
307         char pkgName[MSG_FILEPATH_LEN_MAX + 1];
308         bool bLaunch;
309 } MSG_PUSH_EVENT_INFO_S;
310
311
312 typedef struct {
313         msg_message_id_t msg_id;
314         char mime_type[MAX_MIME_TYPE_LEN+1];
315         char media_item[MSG_FILEPATH_LEN_MAX+1];
316         char thumb_path[MSG_FILEPATH_LEN_MAX+1];
317 } MSG_MEDIA_INFO_S;
318
319 /**
320  *      @}
321  */
322
323 #endif /* MSG_TYPES_H */
324