2 * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef MMS_PLUGIN_CODEC_COMMON_H
18 #define MMS_PLUGIN_CODEC_COMMON_H
20 #include "MmsPluginCodecTypes.h"
22 #define MSG_CH_CR '\r'
23 #define MSG_CH_LF '\n'
25 #define MSG_CH_TAB '\t'
26 #define MSG_CH_NULL '\0'
27 #define MSG_CH_COLON ':'
28 #define MSG_CH_SEMICOLON ';'
29 #define MSG_CH_UNDERLINE '_'
30 #define MSG_CH_COMMA ','
31 #define MSG_CH_BASE64_LOWER 'b'
32 #define MSG_CH_BASE64_UPPER 'B'
33 #define MSG_CH_QPRINT_LOWER 'Q'
34 #define MSG_CH_QPRINT_UPPER 'q'
36 #define MSG_CH_QUESTION '?'
37 #define MSG_CH_QUOT '"'
38 #define MSG_CH_EQUAL '='
39 #define MSG_CH_BRACKET_S '<'
40 #define MSG_CH_BRACKET_E '>'
42 #define MSG_STR_DEC_START "=?"
43 #define MSG_STR_DEC_END "?="
44 #define MSG_STR_CRLF "\r\n"
45 #define MSG_END_OF_HEADER "\r\n\r\n"
46 #define MSG_STR_DOUBLE_HYPEN "--"
47 #define MSG_STR_BOUNDARY_DEL "\r\n--"
49 #define MSG_MMS_CH_EMAIL_AT '@'
51 /* character-set parameter value of content-type header field */
57 MSG_CHARSET_ISO_2022_KR,
58 MSG_CHARSET_KS_C_5601_1987,
60 MSG_CHARSET_ISO_2022_JP,
61 MSG_CHARSET_ISO_2022_JP_2,
62 MSG_CHARSET_ISO_8859_1,
63 MSG_CHARSET_ISO_8859_2,
64 MSG_CHARSET_ISO_8859_3,
65 MSG_CHARSET_ISO_8859_4,
66 MSG_CHARSET_ISO_8859_5,
67 MSG_CHARSET_ISO_8859_6,
68 MSG_CHARSET_ISO_8859_7,
69 MSG_CHARSET_ISO_8859_8,
70 MSG_CHARSET_ISO_8859_9,
71 MSG_CHARSET_ISO_8859_10,
72 MSG_CHARSET_ISO_8859_15,
73 MSG_CHARSET_Shift_JIS,
85 /* Content-Transfer-Encoding header field value */
91 MSG_ENCODING_QUOTE_PRINTABLE,
97 /* Content-Disposition header field value */
99 MSG_DISPOSITION_FORMDATA,
100 MSG_DISPOSITION_ATTACHMENT,
101 MSG_DISPOSITION_INLINE,
105 /* MIME header field */
107 MSG_FIELD_RETURN_PATH,
108 MSG_FIELD_MESSAGE_ID,
114 MSG_FIELD_MIME_VERSION,
115 MSG_FIELD_CONTENT_TYPE,
116 MSG_FIELD_CONTENT_TRANSFER_ENCODING,
117 MSG_FIELD_CONTENT_DISPOSITION, //If start param is given in multipart/related, this field will be ignored
118 MSG_FIELD_CONTENT_ID,
119 MSG_FIELD_CONTENT_LOCATION,
120 MSG_FIELD_CONTENT_NAME,
121 MSG_FIELD_CONTENT_DESCRIPTION,
122 MSG_FIELD_CONTENT_VENDOR,
123 MSG_FIELD_RIGHT_ISSUER,
125 MSG_FIELD_RETURN_RECEIPT_TO, /* for Delivery confirm */
126 MSG_FIELD_DISPOSITION_NOTIFICATION_TO, /* for Read confirm */
128 MSG_FILED_CONTENT_REPLACE_POS,
129 MSG_FILED_CONTENT_REPLACE_SIZE,
130 MSG_FILED_CONTENT_REPLACE_INDEX,
132 MSG_FIELD_DRM_CONVERTED,
138 /* MIME header field parameter */
143 MSG_PARAM_TYPE, // only used as parameter of Content-Type: multipart/related
144 MSG_PARAM_START, // Only if content-type is multipart/related
145 MSG_PARAM_START_INFO, // Only if content-type is multipart/related
147 MSG_PARAM_REPORT_TYPE, // only used as parameter of Content-Type: multipart/report; report-type=delivery-status;
148 #ifdef FEATURE_JAVA_MMS
149 MSG_PARAM_APPLICATION_ID,
150 MSG_PARAM_REPLY_TO_APPLICATION_ID,
156 const char *MmsGetTextByCode(MmsCode i, UINT16 code);
157 const char *MmsGetTextValue(MmsCode i, int j);
158 const char *MmsGetTextValuebyField(int field, int value);
159 int MmsGetBinaryType(MmsCode i, UINT16 value);
160 int MmsGetTextType(MmsCode i, char *pValue);
161 UINT16 MmsGetBinaryValue(MmsCode i, int j);
163 void *MsgDecodeBase64(unsigned char *pSrc, unsigned long srcLen, unsigned long *len);
164 bool MsgEncode2Base64(void *pSrc, unsigned long srcLen, unsigned long *len, unsigned char *ret);
165 unsigned char *MsgDecodeQuotePrintable(unsigned char *pSrc, unsigned long srcLen, unsigned long *len);
167 char *MsgDecodeText(const char *pOri);
169 const char *MmsDebugGetMimeType(MimeType mimeType);
170 const char *MmsDebugGetMmsReport(MmsReport report);
171 const char *MmsDebugGetMmsReportAllowed(MmsReportAllowed reportAllowed);
172 const char *MmsDebugGetMmsReadStatus(msg_read_report_status_t readStatus);
173 const char *MmsDebugGetMsgType(MmsMsgType msgType);
174 const char *MmsDebugGetResponseStatus(MmsResponseStatus responseStatus);
175 const char *MmsDebugGetRetrieveStatus(MmsRetrieveStatus retrieveStatus);
176 const char *MmsDebugGetMsgStatus(msg_delivery_report_status_t msgStatus);
177 const char *MmsDebugGetMsgClass(MmsMsgClass msgClass);
178 const char *MmsDebugGetDataType(MmsDataType dataType);
180 bool MmsInitMsgType(MsgType *pMsgType);
181 bool MmsInitMsgBody(MsgBody *pMsgBody);
182 bool MmsInitMsgContentParam(MsgContentParam *pMsgContentParam);
183 bool MmsInitMsgAttrib(MmsAttrib *pAttrib);
184 bool MmsInitMsgDRMInfo(MsgDRMInfo *pMsgDrmInfo);
186 bool MmsReleaseMsgBody(MsgBody *pBody, int type);
187 bool MmsReleaseMmsAttrib(MmsAttrib *pAttrib);
188 void MmsReleaseMsgDRMInfo(MsgDRMInfo *pDrmInfo);
189 void MmsReleaseMmsMsg(MmsMsg *pMmsMsg);
191 bool MmsIsTextType(int type);
192 bool MmsIsMultipart(int type);
193 bool MmsIsVitemContent(int type, char *pszName);
195 MsgMultipart *MmsAllocMultipart(void);
196 bool MmsPrintMulitpart(MsgMultipart *pMultipart, int index);
197 #endif //MMS_PLUGIN_CODEC_COMMON_H