Modify flora license version.
[platform/core/messaging/msg-service.git] / plugin / mms_plugin / include / MmsPluginDecode.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 MMS_PLUGIN_DECODE_H
18 #define MMS_PLUGIN_DECODE_H
19
20 #include "MmsPluginTypes.h"
21 #include "MmsPluginCodecTypes.h"
22
23 typedef struct _MsgHeaderAddress        MsgHeaderAddress;
24
25 typedef int MmsMsgID;
26
27 typedef enum {
28         MSG_PRESENTATION_NONE = -1,
29         MSG_PRESENTATION_FIRSTPART,             //Content-type == type parameter
30         MSG_PRESENTATION_TYPE_BASE,             //Content-type == type parameter
31         MSG_PRESENTATION_LOCATION,              //Content-Location == start parameter
32         MSG_PRESENTATION_ID,                    //Content-ID == start parameter
33 } MsgPresentationFactor;
34
35 typedef struct {
36         char *pData;
37         UINT32 length;
38 } EncodedPData;
39
40 typedef struct {
41         MsgPresentationFactor factor;
42         MsgMultipart *pPrevPart;
43         MsgMultipart *pCurPresentation;
44 } MsgPresentaionInfo;
45
46 struct _MsgHeaderAddress {
47         char *szAddr;
48         MsgHeaderAddress *pNext;
49 };
50
51 // for Decoding & Encoding
52 typedef struct {
53         bool bActive;
54         char *pszOwner;
55         int msgID;              // if noti.ind, msgID is -1.
56
57         MmsMsgType type;
58         char szTrID[MMS_TR_ID_LEN+1];
59         UINT8 version;
60         UINT32 date;
61
62         MsgHeaderAddress *pFrom;                //"/TYPE=PLMN", /"TYPE=IPv4", "/TYPE=IPv6"
63         MsgHeaderAddress *pTo;
64         MsgHeaderAddress *pCc;
65         MsgHeaderAddress *pBcc;
66         char szSubject[MSG_LOCALE_SUBJ_LEN + 1];
67         MmsResponseStatus responseStatus;
68         MmsRetrieveStatus retrieveStatus;
69         char szResponseText[MMS_LOCALE_RESP_TEXT_LEN + 1];
70         char szRetrieveText[MMS_LOCALE_RESP_TEXT_LEN + 1];
71
72         MmsMsgClass msgClass;
73         MmsTimeStruct expiryTime;
74         MmsTimeStruct deliveryTime;
75         MmsPriority priority;
76         MmsSenderVisible hideAddress;
77         MmsReport deliveryReport;
78         MmsReport readReply;
79         MmsReportAllowed reportAllowed;
80         char szContentLocation[MMS_LOCATION_LEN + 1];
81
82         msg_delivery_report_status_t msgStatus;
83         msg_read_report_status_t readStatus;
84
85         MmsReplyCharge replyCharge;
86
87         // only used at Decoding module
88         char szMsgID[MMS_MSG_ID_LEN + 1];
89         UINT32 msgSize;
90
91 #ifdef __SUPPORT_DRM__
92         MsgDrmType drmType;
93 #endif
94
95         // dependent to Client implementation
96         MsgType msgType;
97         MsgBody msgBody;
98 } MmsHeader;
99
100 extern MmsHeader mmsHeader;
101
102 /* Decoding */
103 void MmsInitHeader();
104 void MmsReleaseHeader(MmsHeader *mms);
105 void MmsRegisterDecodeBuffer();
106 void MmsUnregisterDecodeBuffer(void);
107 bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength);
108 bool MmsBinaryDecodeMsgBody(FILE *pFile, char *szFilePath, int totalLength);
109 bool MmsReadMsgBody(msg_message_id_t msgID, bool bSavePartsAsTempFiles, bool bRetrieved, char *retrievedPath);
110
111
112 char *MsgChangeHexString(char *pOrg);
113 char *MsgResolveContentURI(char *szSrc);
114 char *MsgRemoveQuoteFromFilename(char *pSrc);
115 bool MsgIsMultipart(int type);
116 bool MmsAddrUtilCompareAddr(char *pszAddr1, char *pszAddr2);
117 bool MmsDataUpdateLastStatus(MmsMsg *pMsg);
118 bool MmsAddrUtilRemovePlmnString(char *pszAddr);
119 bool MsgGetTypeByFileName(int *type, char *szFileName);
120 bool MsgGetFileNameWithoutExtension(char *szOutputName, char *szName);
121 int MmsGetMediaPartCount(msg_message_id_t msgId);
122 bool MmsGetMediaPartHeader(int index, MsgType *pHeader);
123 bool MmsGetMsgAttrib(MmsMsgID msgID, MmsAttrib *pAttrib);
124
125 #ifdef __SUPPORT_DRM__
126 bool MsgCopyDrmInfo(MsgType *pPartType);
127 bool MmsDrm2ConvertMsgBody(char *szOriginFilePath);
128 bool MmsDrm2ReadMsgConvertedBody(MSG_MESSAGE_INFO_S *pMsg, bool bSavePartsAsTempFiles, bool bRetrieved, char *retrievedPath);
129 #endif
130
131 #endif //MMS_PLUGIN_DECODE_H