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