##########################################################
SET(MMS-PLUGIN-SRCS
+ MmsPluginCodecCommon.cpp
+ MmsPluginDecode.cpp
+ MmsPluginEncode.cpp
MmsPluginTextConvert.cpp
MmsPluginTransport.cpp
MmsPluginMain.cpp
MmsPluginStorage.cpp
MmsPluginMessage.cpp
MmsPluginMIME.cpp
- MmsPluginDecode.cpp
MmsPluginAvCodec.cpp
MmsPluginDebug.cpp
MmsPluginConnManWrapper.cpp
MmsPluginUserAgent.cpp
MmsPluginHttp.cpp
- MmsPluginEncode.cpp
- MmsPluginCodec.cpp
MmsPluginInternal.cpp
- MmsPluginContentCodec.cpp
MmsPluginSmil.cpp
MmsPluginSMILValidate.cpp
MmsPluginDrm.cpp
#ADD_DEFINITIONS("-DWno-write-strings")
SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
+SET(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined")
ADD_LIBRARY(${MMS-PLUGIN-LIB} SHARED ${MMS-PLUGIN-SRCS})
TARGET_LINK_LIBRARIES(${MMS-PLUGIN-LIB} ${mms_plugin_pkgs_LDFLAGS} ${UTILS-LIB})
* limitations under the License.
*/
-#include "MmsPluginCodec.h"
-#include "MsgMmsTypes.h"
-#include "MmsPluginMessage.h"
-#include "MmsPluginMIME.h"
+#include <ctype.h>
#include "MsgDebug.h"
+#include "MmsPluginCodecCommon.h"
+#include "MmsPluginMIME.h"
+#include "MmsPluginUtil.h"
+#include "MmsPluginTextConvert.h"
+
+#define MMS_MAX_FIELD_VALUE_COUNT 74
+#define MMS_MAX_FIELD_TYPE_COUNT 21
+
+typedef struct {
+ const char *szText;
+ UINT16 binary;
+} MmsField;
/* Reference : MMS-209-Encapsulation & WAP-203-WSP-20000504.pdf Table 39 */
const MmsField gMmsField[MMS_MAX_FIELD_TYPE_COUNT][MMS_MAX_FIELD_VALUE_COUNT] =
}
};
-/* global variables */
-static char gszMmsVersion[5] = {0, };
-
-char *_MmsGetTextValue(MmsCode i, int j)
+const char *MmsGetTextValue(MmsCode i, int j)
{
if (i == MmsCodeContentType) {
//apply UtyMime
return MimeGetMimeStringFromMimeInt(j);
}
- return (char *)gMmsField[i][j].szText;
+ return (const char *)gMmsField[i][j].szText;
}
-char *_MmsGetTextValuebyField(int field, int value)
+const char *MmsGetTextValuebyField(int field, int value)
{
- char *szValue = NULL;
+ const char *szValue = NULL;
switch (field) {
case MMS_CODE_MSGTYPE:
- szValue = _MmsGetTextValue(MmsCodeMsgType, value);
+ szValue = MmsGetTextValue(MmsCodeMsgType, value);
break;
case MMS_CODE_MSGCLASS:
- szValue = _MmsGetTextValue(MmsCodeMsgClass, value);
+ szValue = MmsGetTextValue(MmsCodeMsgClass, value);
break;
case MMS_CODE_PRIORITY:
- szValue = _MmsGetTextValue(MmsCodePriority, value);
+ szValue = MmsGetTextValue(MmsCodePriority, value);
break;
case MMS_CODE_SENDERVISIBILLITY:
- szValue = _MmsGetTextValue(MmsCodeSenderVisibility, value);
+ szValue = MmsGetTextValue(MmsCodeSenderVisibility, value);
break;
case MMS_CODE_DELIVERYREPORT:
- szValue = _MmsGetTextValue(MmsCodeDeliveryReport, value);
+ szValue = MmsGetTextValue(MmsCodeDeliveryReport, value);
break;
case MMS_CODE_READREPLY:
- szValue = _MmsGetTextValue(MmsCodeReadReply, value);
+ szValue = MmsGetTextValue(MmsCodeReadReply, value);
break;
case MMS_CODE_MSGSTATUS:
- szValue = _MmsGetTextValue(MmsCodeMsgStatus, value);
+ szValue = MmsGetTextValue(MmsCodeMsgStatus, value);
break;
case MMS_CODE_REPORTALLOWED:
- szValue = _MmsGetTextValue(MmsCodeReportAllowed, value);
+ szValue = MmsGetTextValue(MmsCodeReportAllowed, value);
break;
case MMS_CODE_RESPONSESTATUS:
- szValue = _MmsGetTextValue(MmsCodeResponseStatus, value);
+ szValue = MmsGetTextValue(MmsCodeResponseStatus, value);
break;
/* Add by MMSENC v1.1 */
case MMS_CODE_READSTATUS:
- szValue = _MmsGetTextValue(MmsCodeReadStatus, value);
+ szValue = MmsGetTextValue(MmsCodeReadStatus, value);
break;
default:
return szValue;
}
-UINT16 _MmsGetBinaryValue(MmsCode i, int j)
+UINT16 MmsGetBinaryValue(MmsCode i, int j)
{
if (i == MmsCodeContentType) {
return MimeGetBinaryValueFromMimeInt((MimeType)j);
}
// getting mime type (int) by binary type
-int _MmsGetBinaryType(MmsCode i, UINT16 value)
+int MmsGetBinaryType(MmsCode i, UINT16 value)
{
MSG_BEGIN();
return MIME_UNKNOWN;
}
-int _MmsGetTextType(MmsCode i, char *pValue)
+int MmsGetTextType(MmsCode i, char *pValue)
{
int j = 0;
return -1;
}
-UINT8 _MmsGetVersion(MmsMsg *pMsg)
+const char *MmsGetTextByCode(MmsCode i, UINT16 code)
+{
+ for (int j = 0; j < MMS_MAX_FIELD_VALUE_COUNT; j++) {
+ if (gMmsField[i][j].binary == code) {
+ return gMmsField[i][j].szText;
+ }
+ }
+ return NULL;
+}
+
+
+
+/* ==================================================================
+ * Decode/Encode inline base64 string
+ *
+ * base64 : 3*8bit -> 4*6bit & convert the value into A~Z, a~z, 0~9, +, or /
+ * pad(=) is needed when the end of the string is < 24bit.
+ *
+ * Value Encoding Value Encoding Value Encoding Value Encoding
+ * 0 A 17 R 34 i 51 z
+ * 1 B 18 S 35 j 52 '0'
+ * 2 C 19 T 36 k 53 1
+ * 3 D 20 U 37 l 54 2
+ * 4 E 21 V 38 m 55 3
+ * 5 F 22 W 39 n 56 4
+ * 6 G 23 X 40 o 57 5
+ * 7 H 24 Y 41 p 58 6
+ * 8 I 25 Z 42 q 59 7
+ * 9 J 26 a 43 r 60 8
+ * 10 K 27 b 44 s 61 9
+ * 11 L 28 c 45 t 62 +
+ * 12 M 29 d 46 u 63 /
+ * 13 N 30 e 47 v
+ * 14 O 31 f 48 w (pad) =
+ * 15 P 32 g 49 x
+ * 16 Q 33 h 50 y
+ *
+ * (1) the final quantum = 24 bits : no "=" padding,
+ * (2) the final quantum = 8 bits : two "=" + two characters
+ * (3) the final quantum = 16 bits : one "=" + three characters
+ * ================================================================== */
+
+void *MsgDecodeBase64(unsigned char *pSrc, unsigned long srcLen, unsigned long *len)
{
- if (pMsg == NULL) {
- return MMS_VERSION;
+ char c;
+ void *ret = NULL;
+ char *d = NULL;
+ short e = 0;
+
+ ret = malloc((size_t)(*len = 4 + ((srcLen * 3) / 4)));
+ d = (char *)ret;
+
+ if (ret == NULL) {
+ MSG_DEBUG("_MsgDecodeBase64: ret malloc Fail \n");
+ return NULL;
+ }
+
+ memset(ret, 0, (size_t)*len);
+ *len = 0;
+
+ while (srcLen-- > 0) {
+ c = *pSrc++;
+
+ /* Convert base64 character into original value */
+
+ if (isupper(c))
+ c -= 'A';
+ else if (islower(c))
+ c -= 'a' - 26;
+ else if (isdigit(c))
+ c -= '0' - 52;
+ else if (c == '+')
+ c = 62;
+ else if (c == '/')
+ c = 63;
+ else if (c == '=') {
+ switch (e++) {
+ case 2:
+ if (*pSrc != '=') {
+ *len = d - (char *)ret;
+ return ret;
+ }
+ break;
+ case 3:
+ e = 0;
+ break;
+ default:
+ *len = d - (char *)ret;
+ return ret;
+ }
+ continue;
+ } else
+ continue; // Actually, never get here
+
+ /* Pad 4*6bit character into 3*8bit character */
+
+ switch (e++) {
+ case 0:
+ *d = c << 2; // byte 1: high 6 bits
+ break;
+
+ case 1:
+ *d++ |= c >> 4; // byte 1: low 2 bits
+ *d = c << 4; // byte 2: high 4 bits
+ break;
+
+ case 2:
+ *d++ |= c >> 2; // byte 2: low 4 bits
+ *d = c << 6; // byte 3: high 2 bits
+ break;
+
+ case 3:
+ *d++ |= c; // byte 3: low 6 bits
+ e = 0; // Calculate next unit.
+ break;
+
+ default:
+ MSG_DEBUG("_MsgDecodeBase64: Unknown paremeter\n");
+ break;
+ }
}
- return pMsg->mmsAttrib.version;
+ *len = d - (char *)ret; // Calculate the size of decoded string.
+
+ return ret;
}
-bool _MmsSetVersion(int majorVer, int minorVer)
+
+
+/* ==========================================
+ * Decode/Encode inline base64 string
+ *
+ * quoted-printable := ([*(ptext / SPACE / TAB) ptext] ["="] CRLF)
+ * ; Maximum line length of 76 characters excluding CRLF
+ *
+ * ptext := octet /<any ASCII character except "=", SPACE, or TAB>
+ * ; characters not listed as "mail-safe" in Appendix B
+ * ; are also not recommended.
+ *
+ * octet := "=" 2(DIGIT / "A" / "B" / "C" / "D" / "E" / "F")
+ * ; octet must be used for characters > 127, =, SPACE, or TAB.
+ *
+ * ==========================================*/
+
+
+unsigned char *MsgDecodeQuotePrintable(unsigned char *pSrc, unsigned long srcLen, unsigned long *len)
{
- snprintf(gszMmsVersion, sizeof(gszMmsVersion), "%d.%d", majorVer, minorVer);
+ unsigned char *ret = NULL;
+ unsigned char *d = NULL;
+ unsigned char *s = NULL; /* last non-blank */
+ unsigned char c;
+ unsigned char e;
+
+ d = s = ret = (unsigned char *)malloc((size_t)srcLen + 1);
+ if (ret == NULL) {
+ MSG_DEBUG("_MsgDecodeQuotePrintable: ret malloc Fail \n");
+ return NULL;
+ }
+
+ *len = 0;
+ pSrc[srcLen] = '\0';
+
+ while ((c = *pSrc++)!= '\0') {
+ switch (c) {
+ case '=': /* octet characters (> 127, =, SPACE, or TAB) */
+ switch (c = *pSrc++) {
+ case '\0': /* end of string -> postpone to while */
+ break;
+
+ case '\015': /* CRLF */
+ if (*pSrc == '\012')
+ pSrc++;
+ break;
+
+ default: /* two hexes */
+ if (!isxdigit(c)) {
+ *d = '\0';
+ *len = d - ret;
+ return ret;
+ }
+
+ if (isdigit(c))
+ e = c - '0';
+ else
+ e = c - (isupper(c) ? 'A' - 10 : 'a' - 10);
+
+ c = *pSrc++;
+ if (!isxdigit(c)) {
+ *d = '\0';
+ *len = d - ret;
+ return ret;
+ }
+
+ if (isdigit(c))
+ c -= '0';
+ else
+ c -= (isupper(c) ? 'A' - 10 : 'a' - 10);
+
+ *d++ = c + (e << 4);
+ s = d;
+ break;
+ }
+ break;
+
+ case ' ': /* skip the blank */
+ *d++ = c;
+ break;
+
+ case '\015': /* Line Feedback : to last non-blank character */
+ d = s;
+ break;
+
+ default:
+ *d++ = c; /* ASCII character */
+ s = d;
+ break;
+ }
+ }
+
+ *d = '\0';
+ *len = d - ret;
+
+ return ret;
+}
+
+
+/* ========================================
+ * Decode/Encode inline base64 string
+ * Inline base64 has no "\r\n" in it,
+ * and has charset and encoding sign in it
+ * ======================================== */
+bool MsgEncode2Base64(void *pSrc, unsigned long srcLen, unsigned long *len, unsigned char *ret)
+{
+ unsigned char *d = NULL;
+ unsigned char *s = (unsigned char *)pSrc;
+ char *v = (char *)"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+ unsigned long i = ((srcLen + 2) / 3) * 4;
+
+ i += 2 * ((i / 60) + 1);
+ *len = i;
+
+ if (ret == NULL) {
+ MSG_DEBUG("_MsgEncode2Base64: ret Memory Alloc Fail \n");
+ return false;
+ }
+ memset(ret, 0, i);
+
+ d = ret;
+
+ /* Convert 3*8bit into 4*6bit */
+ for (i = 0; srcLen > 0; s += 3) {
+ *d++ = v[s[0] >> 2]; // byte 1: high 6 bits of character-1
+ *d++ = v[((s[0] << 4) + (--srcLen ? (s[1] >> 4) : 0)) & 0x3f]; // byte 2: low 2 bits of character-1 and high 4 bits of character-2
+ *d++ = srcLen ? v[((s[1] << 2) + (--srcLen ? (s[2] >> 6) : 0)) & 0x3f] : '='; // byte 3: low 4 bits of charcter-2 and high 2 bits of character-3
+ *d++ = srcLen ? v[s[2] & 0x3f] : '='; // byte 4: low 6 bits of character-3
+
+ if (srcLen)
+ srcLen--;
+ }
+
+ *d = '\0';
+
+ if (((unsigned long)(d - ret)) != *len) {
+ *len = d - ret;
+ MSG_DEBUG("base64 encoding length = %d \n", *len);
+ }
+
return true;
}
-const char *MmsGetTextByCode(MmsCode i, UINT16 code)
+
+char *MsgDecodeText(char *pOri)
{
- for (int j = 0; j < MMS_MAX_FIELD_VALUE_COUNT; j++) {
- if (gMmsField[i][j].binary == code) {
- return gMmsField[i][j].szText;
+ MSG_BEGIN();
+
+ int size = 0;
+ int cnt = 0;
+ char *pSrc = NULL;
+ char *pTemp = NULL;
+ char *pRe = NULL;
+ char *pStrEnd = NULL;
+ char *pDecStart = NULL;
+ char *pDecEnd = NULL;
+ char *pDecQ = NULL;
+ char *pDecQ2 = NULL;
+ bool bEncoding = false;
+ int nCharset = MSG_CHARSET_UTF8;
+ int nTemp = 0;
+ char *pReturnStr = NULL;
+ char *pConvertedStr = NULL;
+
+ char szTempBuf[MSG_LOCAL_TEMP_BUF_SIZE] = {0};
+
+ // copy original string
+ if (strlen(pOri) >= MSG_LOCAL_TEMP_BUF_SIZE) {
+ pSrc = MsgStrCopy( pOri );
+ } else {
+ memset(szTempBuf, 0, MSG_LOCAL_TEMP_BUF_SIZE);
+ strcpy(szTempBuf, pOri);
+
+ pSrc = szTempBuf;
+ }
+
+ // it can be one or more encoding methods in a line
+ while (1) {
+ cnt++;
+
+ bEncoding = false;
+
+ /*
+ (ex) "=?euc-kr?B?Y2NqMjEyMw==?="
+
+ pDecStart: charset (=?euc-kr?B?Y2NqMjEyMw==?=)
+ pDecQ : Encoding type (B?Y2NqMjEyMw==?=)
+ pDecQ2 : Encoded text (Y2NqMjEyMw==?=)
+ pDecEnd : Encoded of text (?=)
+ */
+ if (pSrc == NULL)
+ goto __CATCH;
+
+ if (((pDecStart = strstr(pSrc, MSG_STR_DEC_START)) != NULL) //"=?"
+ && ((pDecQ = strchr(pDecStart + 2, MSG_CH_QUESTION)) != NULL) // '?'
+ && ((pDecQ2 = strchr(pDecQ + 1, MSG_CH_QUESTION))!= NULL) // '?'
+ && ((pDecEnd = strstr(pDecQ2 + 1, MSG_STR_DEC_END))!= NULL)) { //"=?"
+ bEncoding = true;
+
+ /* fixme: charset problem
+ * pDecStart ~ pDecQ : charSet & MSG_CHARSET_USC2 ~ MSG_CHARSET_UTF8 & LATIN
+ */
+
+ *pDecQ = '\0';
+ nCharset = _MsgGetCode(MSG_CHARSET, pDecStart + 2);
+ *pDecQ = MSG_CH_QUESTION;
+ }
+
+ // End of encoding
+ if (!bEncoding)
+ goto __RETURN;
+
+ // find end of string
+ pStrEnd = pSrc + strlen(pSrc);
+
+ // Decoding
+ if ((*(pDecQ2 - 1) == MSG_CH_BASE64_UPPER) ||
+ (*(pDecQ2 - 1) == MSG_CH_BASE64_LOWER) ||
+ (*(pDecQ + 1) == MSG_CH_BASE64_UPPER) ||
+ (*(pDecQ + 1) == MSG_CH_BASE64_LOWER)) {
+ pTemp = (char *)MsgDecodeBase64((UCHAR *)(pDecQ2 + 1), (ULONG)(pDecEnd - pDecQ2 - 1), (ULONG *)&size);
+
+ if (pTemp != NULL) {
+ pTemp[size] = MSG_CH_NULL;
+
+ if(pRe) {
+ free(pRe);
+ pRe = NULL;
+ }
+
+ pRe = (char *)malloc((pDecStart-pSrc) + size + (pStrEnd - (pDecEnd + 2)) + 1);
+ if (pRe == NULL) {
+ MSG_DEBUG("_MsgDecodeText: pRemalloc fail \n");
+ free(pTemp);
+ pTemp = NULL;
+
+ goto __RETURN;
+ }
+
+ memcpy(pRe, pSrc, pDecStart - pSrc);
+ memcpy(&pRe[pDecStart-pSrc], pTemp, size);
+ memcpy(&pRe[(pDecStart - pSrc) + size], pDecEnd + 2, pStrEnd - (pDecEnd + 2));
+ pRe[(pDecStart - pSrc) + size + (pStrEnd - (pDecEnd + 2))] = MSG_CH_NULL;
+
+ free(pTemp);
+ pTemp = NULL;
+
+ if (pSrc != NULL && pSrc != szTempBuf) {
+ free(pSrc);
+ pSrc = NULL;
+ }
+ }
+ } else if ((*(pDecQ2-1) == MSG_CH_QPRINT_UPPER) ||
+ (*(pDecQ2-1) == MSG_CH_QPRINT_LOWER) ||
+ (*(pDecQ+1) == MSG_CH_QPRINT_UPPER) ||
+ (*(pDecQ+1) == MSG_CH_QPRINT_LOWER)) {
+
+ pTemp = (char *)MsgDecodeQuotePrintable((UCHAR *)( pDecQ2 + 1 ), (ULONG)(pDecEnd - pDecQ2 - 1), (ULONG *)&size);
+
+ if (pTemp != NULL) {
+ int i;
+ pTemp[size] = MSG_CH_NULL;
+
+ for (i = 0; i < size; i++) {
+ if (pTemp[i] == MSG_CH_UNDERLINE) {
+ pTemp[i] = MSG_CH_SP; // change '_' to ' '
+ }
+ }
+
+ if(pRe) {
+ free(pRe);
+ pRe = NULL;
+ }
+
+ pRe = (char *)malloc((pDecStart - pSrc) + size + (pStrEnd - (pDecEnd + 2)) + 1);
+ if (pRe == NULL) {
+ MSG_DEBUG("_MsgDecodeText: pRemalloc fail \n");
+ free(pTemp);
+ pTemp = NULL;
+
+ goto __RETURN;
+ }
+
+ memcpy(pRe, pSrc, pDecStart - pSrc);
+ memcpy(&pRe[pDecStart - pSrc], pTemp, size);
+ memcpy(&pRe[(pDecStart - pSrc) + size], pDecEnd + 2, pStrEnd - (pDecEnd + 2));
+ pRe[(pDecStart - pSrc) + size + (pStrEnd - (pDecEnd + 2))] = MSG_CH_NULL;
+
+ if (pTemp) {
+ free(pTemp);
+ pTemp = NULL;
+ }
+
+ if (pSrc != NULL && pSrc != szTempBuf) {
+ free(pSrc);
+ pSrc = NULL;
+ }
+ }
+ } else {
+ goto __RETURN;
}
}
+
+
+
+__RETURN:
+
+ pTemp = strdup(pSrc);
+ nTemp = strlen(pSrc);
+
+ {//temp brace;
+ const char *pToCharSet = "UTF-8";
+
+ UINT16 charset_code = MmsGetBinaryValue(MmsCodeCharSet, nCharset);
+
+ const char *pFromCharSet = MmsPluginTextConvertGetCharSet(charset_code);
+
+ if (pFromCharSet != NULL && strcmp(pFromCharSet, pToCharSet) != 0) {//Not UTF-8
+ char *pDest = NULL;
+ int destLen = 0;
+
+ if (MmsPluginTextConvert(pToCharSet, pFromCharSet, pTemp, nTemp, &pDest, &destLen) == false) {
+ MSG_DEBUG("MmsPluginTextConvert Fail");
+ }
+
+ if (pDest) {
+ free(pTemp);
+ pTemp = strdup(pDest);
+ nTemp = destLen;
+ free(pDest);
+ }
+ }
+
+ }
+
+ pReturnStr = (char *)malloc(nTemp + 1);
+
+ if (pReturnStr == NULL) {
+ goto __CATCH;
+ }
+
+ memset(pReturnStr, 0, nTemp + 1);
+
+ if (pTemp) {
+ memcpy(pReturnStr, pTemp, nTemp);
+ free(pTemp);
+ pTemp = NULL;
+ }
+
+ if (pConvertedStr) {
+ free(pConvertedStr);
+ pConvertedStr = NULL;
+ }
+
+ if(pRe) {
+ free(pRe);
+ pRe = NULL;
+ }
+
+ if (pSrc != NULL && pSrc != szTempBuf) {
+ free(pSrc);
+ pSrc = NULL;
+ }
+
+ return pReturnStr;
+
+__CATCH:
+
+ if (pConvertedStr) {
+ free(pConvertedStr);
+ pConvertedStr = NULL;
+ }
+
+ if(pRe) {
+ free(pRe);
+ pRe = NULL;
+ }
+
+ if (pSrc != NULL && pSrc != szTempBuf) {
+ free(pSrc);
+ pSrc = NULL;
+ }
+
+ if (pTemp) {
+ free(pTemp);
+ pTemp = NULL;
+ }
+
return NULL;
}
+++ /dev/null
-/*
-* Copyright 2012 Samsung Electronics Co., Ltd
-*
-* Licensed under the Flora License, Version 1.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.tizenopensource.org/license
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-#include <stdlib.h>
-#include <ctype.h>
-#include "MsgDebug.h"
-#include "MmsPluginCodec.h"
-#include "MmsPluginTextConvert.h"
-#include "MmsPluginMIME.h"
-#include "MmsPluginMessage.h"
-#include "MmsPluginUtil.h"
-const int MSG_MAX_CH_PER_LINE = 75;
-
-/* ==================================================================
- * Decode/Encode inline base64 string
- *
- * base64 : 3*8bit -> 4*6bit & convert the value into A~Z, a~z, 0~9, +, or /
- * pad(=) is needed when the end of the string is < 24bit.
- *
- * Value Encoding Value Encoding Value Encoding Value Encoding
- * 0 A 17 R 34 i 51 z
- * 1 B 18 S 35 j 52 '0'
- * 2 C 19 T 36 k 53 1
- * 3 D 20 U 37 l 54 2
- * 4 E 21 V 38 m 55 3
- * 5 F 22 W 39 n 56 4
- * 6 G 23 X 40 o 57 5
- * 7 H 24 Y 41 p 58 6
- * 8 I 25 Z 42 q 59 7
- * 9 J 26 a 43 r 60 8
- * 10 K 27 b 44 s 61 9
- * 11 L 28 c 45 t 62 +
- * 12 M 29 d 46 u 63 /
- * 13 N 30 e 47 v
- * 14 O 31 f 48 w (pad) =
- * 15 P 32 g 49 x
- * 16 Q 33 h 50 y
- *
- * (1) the final quantum = 24 bits : no "=" padding,
- * (2) the final quantum = 8 bits : two "=" + two characters
- * (3) the final quantum = 16 bits : one "=" + three characters
- * ================================================================== */
-
-bool _MsgEncodeBase64(void *pSrc, unsigned long srcLen, unsigned long *len, unsigned char *ret)
-{
- unsigned char *d = NULL;
- unsigned char *s = (unsigned char *)pSrc;
-
- char *v = (char *)"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
- unsigned long i = ((srcLen + 2) / 3) * 4;
-
- i += 2 * ((i / 60) + 1);
- *len = i;
-
- if (ret == NULL) {
- MSG_DEBUG("_MsgEncodeBase64: ret Memory Alloc Fail \n");
- return false;
- }
- memset(ret, 0, i);
-
- d = ret;
-
- /* Convert 3*8bit into 4*6bit */
- for (i = 0; srcLen > 0; s += 3) {
- *d++ = v[s[0] >> 2]; // byte 1: high 6 bits of character-1
- *d++ = v[((s[0] << 4) + (--srcLen ? (s[1] >> 4) : 0)) & 0x3f]; // byte 2: low 2 bits of character-1 and high 4 bits of character-2
- *d++ = srcLen ? v[((s[1] << 2) + (--srcLen ? (s[2] >> 6) : 0)) & 0x3f] : '='; // byte 3: low 4 bits of charcter-2 and high 2 bits of character-3
- *d++ = srcLen ? v[s[2] & 0x3f] : '='; // byte 4: low 6 bits of character-3
-
- if (srcLen)
- srcLen--;
-
- /* Insert CRLF at every 60 characters */
- if ((++i) == 15) {
- i = 0;
- *d++ = '\015';
- *d++ = '\012';
- }
- }
-
- if (i == 15) {
- *d++ = '\015';
- *d++ = '\012';
- }
- *d = '\0';
-
- if (((unsigned long)(d - ret)) != *len) {
- *len = d - ret;
- MSG_DEBUG("base64 encoding length = %d \n", *len);
- }
-
- return true;
-}
-
-
-void *_MsgDecodeBase64(unsigned char *pSrc, unsigned long srcLen, unsigned long *len)
-{
- char c;
- void *ret = NULL;
- char *d = NULL;
- short e = 0;
-
- ret = malloc((size_t)(*len = 4 + ((srcLen * 3) / 4)));
- d = (char *)ret;
-
- if (ret == NULL) {
- MSG_DEBUG("_MsgDecodeBase64: ret malloc Fail \n");
- return NULL;
- }
-
- memset(ret, 0, (size_t)*len);
- *len = 0;
-
- while (srcLen-- > 0) {
- c = *pSrc++;
-
- /* Convert base64 character into original value */
-
- if (isupper(c))
- c -= 'A';
- else if (islower(c))
- c -= 'a' - 26;
- else if (isdigit(c))
- c -= '0' - 52;
- else if (c == '+')
- c = 62;
- else if (c == '/')
- c = 63;
- else if (c == '=') {
- switch (e++) {
- case 2:
- if (*pSrc != '=') {
- *len = d - (char *)ret;
- return ret;
- }
- break;
- case 3:
- e = 0;
- break;
- default:
- *len = d - (char *)ret;
- return ret;
- }
- continue;
- } else
- continue; // Actually, never get here
-
- /* Pad 4*6bit character into 3*8bit character */
-
- switch (e++) {
- case 0:
- *d = c << 2; // byte 1: high 6 bits
- break;
-
- case 1:
- *d++ |= c >> 4; // byte 1: low 2 bits
- *d = c << 4; // byte 2: high 4 bits
- break;
-
- case 2:
- *d++ |= c >> 2; // byte 2: low 4 bits
- *d = c << 6; // byte 3: high 2 bits
- break;
-
- case 3:
- *d++ |= c; // byte 3: low 6 bits
- e = 0; // Calculate next unit.
- break;
-
- default:
- MSG_DEBUG("_MsgDecodeBase64: Unknown paremeter\n");
- break;
- }
- }
-
- *len = d - (char *)ret; // Calculate the size of decoded string.
-
- return ret;
-}
-
-
-
-/* ==========================================
- * Decode/Encode inline base64 string
- *
- * quoted-printable := ([*(ptext / SPACE / TAB) ptext] ["="] CRLF)
- * ; Maximum line length of 76 characters excluding CRLF
- *
- * ptext := octet /<any ASCII character except "=", SPACE, or TAB>
- * ; characters not listed as "mail-safe" in Appendix B
- * ; are also not recommended.
- *
- * octet := "=" 2(DIGIT / "A" / "B" / "C" / "D" / "E" / "F")
- * ; octet must be used for characters > 127, =, SPACE, or TAB.
- *
- * ==========================================*/
-
-bool _MsgEncodeQuotePrintable(unsigned char *pSrc, unsigned long srcLen, unsigned long *len, unsigned char *ret)
-{
- unsigned long lp = 0;
- unsigned char *d = ret;
- char *hex = (char *)"0123456789ABCDEF";
- unsigned char c;
-
- if (ret == NULL) {
- MSG_DEBUG("_MsgEncodeQuotePrintable: ret malloc Fail \n");
- return false;
- }
-
- d = ret;
-
- /*
- * The type of srcLen is unsigned long
- * The value of srcLen is decreased by 1 -> We can't check by "srcLen > 0".
- */
- while (srcLen-- > 0) {
- /* Just copy CRLF */
- if (((c = *pSrc++) == '\015') && (*pSrc == '\012') && srcLen) {
- *d++ = '\015';
- *d++ = *pSrc++;
- srcLen--;
- lp = 0;
- } else {
- if (iscntrl(c) || (c == 0x7f) || (c & 0x80) || (c == '=') || ((c == ' ') && (*pSrc == '\015'))) {
- if ((lp += 3) > (unsigned long)MSG_MAX_CH_PER_LINE) {
- *d++ = '=';
- *d++ = '\015';
- *d++ = '\012';
- lp = 3;
- }
-
- *d++ = '='; /* quote character */
- *d++ = hex[c >> 4]; /* high order 4 bits */
- *d++ = hex[c & 0xf]; /* low order 4 bits */
- } else {
- /* Just copy ASCII character */
- if ((++lp) > (unsigned long)MSG_MAX_CH_PER_LINE) {
- *d++ = '=';
- *d++ = '\015';
- *d++ = '\012';
- lp = 1;
- }
- *d++ = c;
- }
- }
- }
-
- *d = '\0';
- *len = d - ret;
-
- return true;
-}
-
-
-unsigned char *_MsgDecodeQuotePrintable(unsigned char *pSrc, unsigned long srcLen, unsigned long *len)
-{
- unsigned char *ret = NULL;
- unsigned char *d = NULL;
- unsigned char *s = NULL; /* last non-blank */
- unsigned char c;
- unsigned char e;
-
- d = s = ret = (unsigned char *)malloc((size_t)srcLen + 1);
- if (ret == NULL) {
- MSG_DEBUG("_MsgDecodeQuotePrintable: ret malloc Fail \n");
- return NULL;
- }
-
- *len = 0;
- pSrc[srcLen] = '\0';
-
- while ((c = *pSrc++)!= '\0') {
- switch (c) {
- case '=': /* octet characters (> 127, =, SPACE, or TAB) */
- switch (c = *pSrc++) {
- case '\0': /* end of string -> postpone to while */
- break;
-
- case '\015': /* CRLF */
- if (*pSrc == '\012')
- pSrc++;
- break;
-
- default: /* two hexes */
- if (!isxdigit(c)) {
- *d = '\0';
- *len = d - ret;
- return ret;
- }
-
- if (isdigit(c))
- e = c - '0';
- else
- e = c - (isupper(c) ? 'A' - 10 : 'a' - 10);
-
- c = *pSrc++;
- if (!isxdigit(c)) {
- *d = '\0';
- *len = d - ret;
- return ret;
- }
-
- if (isdigit(c))
- c -= '0';
- else
- c -= (isupper(c) ? 'A' - 10 : 'a' - 10);
-
- *d++ = c + (e << 4);
- s = d;
- break;
- }
- break;
-
- case ' ': /* skip the blank */
- *d++ = c;
- break;
-
- case '\015': /* Line Feedback : to last non-blank character */
- d = s;
- break;
-
- default:
- *d++ = c; /* ASCII character */
- s = d;
- break;
- }
- }
-
- *d = '\0';
- *len = d - ret;
-
- return ret;
-}
-
-
-/* ========================================
- * Decode/Encode inline base64 string
- * Inline base64 has no "\r\n" in it,
- * and has charset and encoding sign in it
- * ======================================== */
-bool _MsgEncode2Base64(void *pSrc, unsigned long srcLen, unsigned long *len, unsigned char *ret)
-{
- unsigned char *d = NULL;
- unsigned char *s = (unsigned char *)pSrc;
- char *v = (char *)"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
- unsigned long i = ((srcLen + 2) / 3) * 4;
-
- i += 2 * ((i / 60) + 1);
- *len = i;
-
- if (ret == NULL) {
- MSG_DEBUG("_MsgEncode2Base64: ret Memory Alloc Fail \n");
- return false;
- }
- memset(ret, 0, i);
-
- d = ret;
-
- /* Convert 3*8bit into 4*6bit */
- for (i = 0; srcLen > 0; s += 3) {
- *d++ = v[s[0] >> 2]; // byte 1: high 6 bits of character-1
- *d++ = v[((s[0] << 4) + (--srcLen ? (s[1] >> 4) : 0)) & 0x3f]; // byte 2: low 2 bits of character-1 and high 4 bits of character-2
- *d++ = srcLen ? v[((s[1] << 2) + (--srcLen ? (s[2] >> 6) : 0)) & 0x3f] : '='; // byte 3: low 4 bits of charcter-2 and high 2 bits of character-3
- *d++ = srcLen ? v[s[2] & 0x3f] : '='; // byte 4: low 6 bits of character-3
-
- if (srcLen)
- srcLen--;
- }
-
- *d = '\0';
-
- if (((unsigned long)(d - ret)) != *len) {
- *len = d - ret;
- MSG_DEBUG("base64 encoding length = %d \n", *len);
- }
-
- return true;
-}
-
-
-char *_MsgDecodeText(char *pOri)
-{
- MSG_BEGIN();
-
- int size = 0;
- int cnt = 0;
- char *pSrc = NULL;
- char *pTemp = NULL;
- char *pRe = NULL;
- char *pStrEnd = NULL;
- char *pDecStart = NULL;
- char *pDecEnd = NULL;
- char *pDecQ = NULL;
- char *pDecQ2 = NULL;
- bool bEncoding = false;
- int nCharset = MSG_CHARSET_UTF8;
- int nTemp = 0;
- char *pReturnStr = NULL;
- char *pConvertedStr = NULL;
-
- char szTempBuf[MSG_LOCAL_TEMP_BUF_SIZE] = {0};
-
- // copy original string
- if (strlen(pOri) >= MSG_LOCAL_TEMP_BUF_SIZE) {
- pSrc = MsgStrCopy( pOri );
- } else {
- memset(szTempBuf, 0, MSG_LOCAL_TEMP_BUF_SIZE);
- strcpy(szTempBuf, pOri);
-
- pSrc = szTempBuf;
- }
-
- // it can be one or more encoding methods in a line
- while (1) {
- cnt++;
-
- bEncoding = false;
-
- /*
- (ex) "=?euc-kr?B?Y2NqMjEyMw==?="
-
- pDecStart: charset (=?euc-kr?B?Y2NqMjEyMw==?=)
- pDecQ : Encoding type (B?Y2NqMjEyMw==?=)
- pDecQ2 : Encoded text (Y2NqMjEyMw==?=)
- pDecEnd : Encoded of text (?=)
- */
- if (pSrc == NULL)
- goto __CATCH;
-
- if (((pDecStart = strstr(pSrc, MSG_STR_DEC_START)) != NULL) //"=?"
- && ((pDecQ = strchr(pDecStart + 2, MSG_CH_QUESTION)) != NULL) // '?'
- && ((pDecQ2 = strchr(pDecQ + 1, MSG_CH_QUESTION))!= NULL) // '?'
- && ((pDecEnd = strstr(pDecQ2 + 1, MSG_STR_DEC_END))!= NULL)) { //"=?"
- bEncoding = true;
-
- /* fixme: charset problem
- * pDecStart ~ pDecQ : charSet & MSG_CHARSET_USC2 ~ MSG_CHARSET_UTF8 & LATIN
- */
-
- *pDecQ = '\0';
- nCharset = _MsgGetCode(MSG_CHARSET, pDecStart + 2);
- *pDecQ = MSG_CH_QUESTION;
- }
-
- // End of encoding
- if (!bEncoding)
- goto __RETURN;
-
- // find end of string
- pStrEnd = pSrc + strlen(pSrc);
-
- // Decoding
- if ((*(pDecQ2 - 1) == MSG_CH_BASE64_UPPER) ||
- (*(pDecQ2 - 1) == MSG_CH_BASE64_LOWER) ||
- (*(pDecQ + 1) == MSG_CH_BASE64_UPPER) ||
- (*(pDecQ + 1) == MSG_CH_BASE64_LOWER)) {
- pTemp = (char *)_MsgDecodeBase64((UCHAR *)(pDecQ2 + 1), (ULONG)(pDecEnd - pDecQ2 - 1), (ULONG *)&size);
-
- if (pTemp != NULL) {
- pTemp[size] = MSG_CH_NULL;
-
- if(pRe) {
- free(pRe);
- pRe = NULL;
- }
-
- pRe = (char *)malloc((pDecStart-pSrc) + size + (pStrEnd - (pDecEnd + 2)) + 1);
- if (pRe == NULL) {
- MSG_DEBUG("_MsgDecodeText: pRemalloc fail \n");
- free(pTemp);
- pTemp = NULL;
-
- goto __RETURN;
- }
-
- memcpy(pRe, pSrc, pDecStart - pSrc);
- memcpy(&pRe[pDecStart-pSrc], pTemp, size);
- memcpy(&pRe[(pDecStart - pSrc) + size], pDecEnd + 2, pStrEnd - (pDecEnd + 2));
- pRe[(pDecStart - pSrc) + size + (pStrEnd - (pDecEnd + 2))] = MSG_CH_NULL;
-
- free(pTemp);
- pTemp = NULL;
-
- if (pSrc != NULL && pSrc != szTempBuf) {
- free(pSrc);
- pSrc = NULL;
- }
- }
- } else if ((*(pDecQ2-1) == MSG_CH_QPRINT_UPPER) ||
- (*(pDecQ2-1) == MSG_CH_QPRINT_LOWER) ||
- (*(pDecQ+1) == MSG_CH_QPRINT_UPPER) ||
- (*(pDecQ+1) == MSG_CH_QPRINT_LOWER)) {
-
- pTemp = (char *)_MsgDecodeQuotePrintable((UCHAR *)( pDecQ2 + 1 ), (ULONG)(pDecEnd - pDecQ2 - 1), (ULONG *)&size);
-
- if (pTemp != NULL) {
- int i;
- pTemp[size] = MSG_CH_NULL;
-
- for (i = 0; i < size; i++) {
- if (pTemp[i] == MSG_CH_UNDERLINE) {
- pTemp[i] = MSG_CH_SP; // change '_' to ' '
- }
- }
-
- if(pRe) {
- free(pRe);
- pRe = NULL;
- }
-
- pRe = (char *)malloc((pDecStart - pSrc) + size + (pStrEnd - (pDecEnd + 2)) + 1);
- if (pRe == NULL) {
- MSG_DEBUG("_MsgDecodeText: pRemalloc fail \n");
- free(pTemp);
- pTemp = NULL;
-
- goto __RETURN;
- }
-
- memcpy(pRe, pSrc, pDecStart - pSrc);
- memcpy(&pRe[pDecStart - pSrc], pTemp, size);
- memcpy(&pRe[(pDecStart - pSrc) + size], pDecEnd + 2, pStrEnd - (pDecEnd + 2));
- pRe[(pDecStart - pSrc) + size + (pStrEnd - (pDecEnd + 2))] = MSG_CH_NULL;
-
- if (pTemp) {
- free(pTemp);
- pTemp = NULL;
- }
-
- if (pSrc != NULL && pSrc != szTempBuf) {
- free(pSrc);
- pSrc = NULL;
- }
- }
- } else {
- goto __RETURN;
- }
- }
-
-
-
-__RETURN:
-
- pTemp = strdup(pSrc);
- nTemp = strlen(pSrc);
-
- {//temp brace;
- const char *pToCharSet = "UTF-8";
-
- UINT16 charset_code = _MmsGetBinaryValue(MmsCodeCharSet, nCharset);
-
- const char *pFromCharSet = MmsPluginTextConvertGetCharSet(charset_code);
-
- if (pFromCharSet != NULL && strcmp(pFromCharSet, pToCharSet) != 0) {//Not UTF-8
- char *pDest = NULL;
- int destLen = 0;
-
- if (MmsPluginTextConvert(pToCharSet, pFromCharSet, pTemp, nTemp, &pDest, &destLen) == false) {
- MSG_DEBUG("MmsPluginTextConvert Fail");
- }
-
- if (pDest) {
- free(pTemp);
- pTemp = strdup(pDest);
- nTemp = destLen;
- free(pDest);
- }
- }
-
- }
-
- pReturnStr = (char *)malloc(nTemp + 1);
-
- if (pReturnStr == NULL) {
- goto __CATCH;
- }
-
- memset(pReturnStr, 0, nTemp + 1);
-
- if (pTemp) {
- memcpy(pReturnStr, pTemp, nTemp);
- free(pTemp);
- pTemp = NULL;
- }
-
- if (pConvertedStr) {
- free(pConvertedStr);
- pConvertedStr = NULL;
- }
-
- if(pRe) {
- free(pRe);
- pRe = NULL;
- }
-
- if (pSrc != NULL && pSrc != szTempBuf) {
- free(pSrc);
- pSrc = NULL;
- }
-
- return pReturnStr;
-
-__CATCH:
-
- if (pConvertedStr) {
- free(pConvertedStr);
- pConvertedStr = NULL;
- }
-
- if(pRe) {
- free(pRe);
- pRe = NULL;
- }
-
- if (pSrc != NULL && pSrc != szTempBuf) {
- free(pSrc);
- pSrc = NULL;
- }
-
- if (pTemp) {
- free(pTemp);
- pTemp = NULL;
- }
-
- return NULL;
-}
-
-
-char *MsgEncodeText(char *pOri)
-{
- ULONG nLen = 0;
- char *szBuff = NULL;
- int length = 0;
-
- length = (strlen(pOri) * 4) / 3 + 2 + 12 + 1 + 30;
- szBuff = (char *)malloc(length + 1);
-
- if (szBuff == NULL) {
- // error handling
- MSG_DEBUG("_MsgEncodeText: szBuff alloc is failed \n");
- goto __CATCH;
- }
-
- memset(szBuff, 0 , length + 1);
-
- snprintf(szBuff, length+1, "%s%s%c%c%c", MSG_STR_DEC_START, "utf-8", MSG_CH_QUESTION, MSG_CH_BASE64_LOWER, MSG_CH_QUESTION);
-
- if (_MsgEncode2Base64((unsigned char *)pOri, strlen(pOri), &nLen, (unsigned char *)szBuff + 10) == false) {
- MSG_DEBUG("_MsgEncodeText: MsgEncodeBase64() is failed \n");
- goto __CATCH;
- }
-
- strcat(szBuff, MSG_STR_DEC_END);
-
- return szBuff;
-
-__CATCH:
- if (szBuff) {
- free(szBuff);
- }
-
- return false;
-}
-
* limitations under the License.
*/
-#include<stdio.h>
+#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#include <stdlib.h>
#include "MsgDebug.h"
#include "MsgException.h"
-#include "MmsPluginMessage.h"
+#include "MmsPluginDecode.h"
+#include "MmsPluginCodecCommon.h"
#include "MmsPluginStorage.h"
#include "MsgUtilFile.h"
-#include "MmsPluginCodec.h"
#include "MmsPluginDebug.h"
#include "MsgSettingTypes.h"
-#include "MsgSettingHandler.h"
-#include "MmsPluginInternal.h"
#include "MmsPluginAvCodec.h"
-#include "MmsPluginStorage.h"
#include "MmsPluginSmil.h"
#ifdef __SUPPORT_DRM__
#include "MmsPluginDrm.h"
#include "MmsPluginTextConvert.h"
#include "MmsPluginUtil.h"
-static bool _MmsBinaryDecodeGetBytes(FILE *pFile, char *szBuff, int bufLen, int totalLength); /* bufLen < gMmsDecodeMaxLen */
-static bool _MmsBinaryDecodeGetLongBytes(FILE *pFile, char *szBuff, int bufLen, int totalLength); /* no bufLen limit */
-static bool _MmsBinaryDecodeGetOneByte(FILE *pFile, UINT8 *pOneByte, int totalLength);
+/*Decode wsp*/
+static int __MmsGetDecodeOffset(void);
+static bool __MmsDecodeInitialize(void);
+static void __MmsCleanDecodeBuff(void);
+static bool __MmsBinaryDecodeMovePointer(FILE *pFile, int offset, int totalLength);
+static bool __MmsBinaryDecodeCheckAndDecreaseLength(int *pLength, int valueLength);
+
+static bool __MmsBinaryDecodeGetBytes(FILE *pFile, char *szBuff, int bufLen, int totalLength); /* bufLen < gMmsDecodeMaxLen */
+static bool __MmsBinaryDecodeGetLongBytes(FILE *pFile, char *szBuff, int bufLen, int totalLength); /* no bufLen limit */
+static bool __MmsBinaryDecodeGetOneByte(FILE *pFile, UINT8 *pOneByte, int totalLength);
+
+static UINT32 __MmsHeaderDecodeIntegerByLength(FILE *pFile, UINT32 length, int totalLength);
+static bool __MmsBinaryDecodeInteger(FILE *pFile, UINT32 *pInteger, int *pIntLen, int totalLength);
+static bool __MmsDecodeLongInteger(FILE *pFile, UINT32 *pLongInteger, int totalLength);
static int __MmsBinaryDecodeUintvar(FILE *pFile, UINT32 *pUintVar, int totalLength);
static int __MmsDecodeValueLength(FILE *pFile, UINT32 *pValueLength, int totalLength);
static int __MmsDecodeValueLength2(FILE *pFile, UINT32 *pValueLength, int totalLength);
+static int __MmsBinaryDecodeText(FILE *pFile, char *szBuff, int bufLen, int totalLength);
+static char *__MmsBinaryDecodeText2(FILE *pFile, int totalLength, int *pLength);
static int __MmsBinaryDecodeQuotedString(FILE *pFile, char *szBuff, int bufLen, int totalLength);
static bool __MmsBinaryDecodeEncodedString(FILE *pFile, char *szBuff, int bufLen, int totalLength);
-static bool __MmsBinaryDecodeInteger(FILE *pFile, UINT32 *pInteger, int *pIntLen, int totalLength);
+
static bool __MmsBinaryDecodeCharset(FILE *pFile, UINT32 *nCharSet, int *pCharSetLen, int totalLength);
-static char *__MmsBinaryDecodeText2(FILE *pFile, int totalLength, int *pLength);
-static int __MmsBinaryDecodeText(FILE *pFile, char *szBuff, int bufLen, int totalLength);
-static UINT32 __MmsHeaderDecodeIntegerByLength(FILE *pFile, UINT32 length, int totalLength);
-static bool __MmsDecodeLongInteger(FILE *pFile, UINT32 *pLongInteger, int totalLength);
static int __MmsDecodeGetFilename(FILE *pFile, char *szBuff, int bufLen, int totalLength);
static MsgHeaderAddress *__MmsDecodeEncodedAddress(FILE *pFile, int totalLength);
+static bool __MmsBinaryDecodeMultipart(FILE *pFile, char *szFilePath, MsgType *pMsgType, MsgBody *pMsgBody, int totalLength);
+static bool __MmsBinaryDecodeEachPart(FILE *pFile, char *szFilePath, MsgType *pMsgType, MsgBody *pMsgBody, int totalLength);
+static bool __MmsBinaryDecodePartHeader(FILE *pFile, MsgType *pMsgType, int headerLen, int totalLength);
+static bool __MmsBinaryDecodePartBody(FILE *pFile, UINT32 bodyLength, int totalLength);
+static bool __MmsBinaryDecodeEntries(FILE *pFile, UINT32 *npEntries, int totalLength);
+static bool __MmsBinaryDecodeParameter(FILE *pFile, MsgType *pMsgType, int valueLength, int totalLength);
+
+static int __MmsBinaryDecodeContentType(FILE *pFile, MsgType *pMsgType, int totalLength);
+
#ifdef __SUPPORT_DRM__
-bool __MmsParseDCFInfo(FILE *pFile, MsgDRMInfo *pDrmInfo, int totalLength);
-bool __MmsParseDCFHdr(FILE *pFile, MsgDRMInfo *pDrmInfo, UINT32 headerLen, int totalLength);
-bool MmsBinaryDecodeDRMMessage(FILE *pFile, char *szFilePath, MsgType *pMsgType, MsgBody *pMsgBody, unsigned int fullBodyLength, int totalLength);
-bool MmsBinaryDecodeDRMContent(FILE *pFile, char *szFilePath, MsgType *pMsgType, MsgBody *pMsgBody, unsigned int bodyLength, int totalLength);
+static bool __MmsBinaryDecodeDRMContent(FILE *pFile, char *szFilePath, MsgType *pMsgType, MsgBody *pMsgBody, unsigned int bodyLength, int totalLength);
#endif
-static bool MmsBinaryDecodeMovePointer(FILE *pFile, int offset, int totalLength);
-bool MmsBinaryIsTextEncodedPart(FILE *pFile, int totalLength);
-static bool __MmsBinaryDecodeCheckAndDecreaseLength(int *pLength, int valueLength);
+static bool __MsgInitMsgBody(MsgBody *pMsgBody);
+static bool __MsgInitMsgType(MsgType *pMsgType);
+
+//util funcion
+static void __MsgRemoveFilePath(char *pSrc);
+static bool __MsgChangeSpace(char *pOrg, char **ppNew);
+static void __MsgConfirmPresentationPart(MsgType *pMsgType, MsgBody *pMsgBody, MsgPresentaionInfo *pPresentationInfo);
+static MsgPresentationFactor __MsgIsPresentationEx(MsgType *multipartType, char* szStart, MimeType typeParam);
+static bool __MsgLoadDataToDecodeBuffer(FILE *pFile, char **ppBuf, int *pPtr, int *pOffset, char *pInBuf1, char *pInBuf2, int maxLen, int *npRead, int endOfFile);
+static bool __MsgFreeHeaderAddress(MsgHeaderAddress *pAddr);
+static bool __MsgCheckFileNameHasInvalidChar(char *szName);
+
+static bool __MsgReplaceInvalidFileNameChar(char *szInText, char replaceChar);
+static char *__MsgGetStringUntilDelimiter(char *pszString, char delimiter);
+static bool __MsgParseParameter(MsgType *pType, char *pSrc);
+static char *__MsgSkipWS(char *s);
+static char *__MsgSkipComment(char *s, long trim);
+static MsgMultipart *__MsgAllocMultipart(void);
+
+static char *__MsgConvertLatin2UTF8FileName(char *pSrc);
+static bool __MsgIsUTF8String(unsigned char *szSrc, int nChar);
+static bool __MsgIsPercentSign(char *pSrc);
+static bool __MsgIsMultipartRelated(int type);
+static bool __MsgIsPresentablePart(int type);
+static bool __MsgIsText(int type);
+static bool __MsgResolveNestedMultipart(MsgType *pPartType, MsgBody *pPartBody);
+static bool __MsgIsHexChar(char *pSrc);
+static char __MsgConvertHexValue(char *pSrc);
+static int __MsgConvertCharToInt(char ch);
+static bool __MsgInitMsgContentParam(MsgContentParam *pMsgContentParam);
+static bool __MsgCopyNestedMsgType(MsgType *pMsgType1, MsgType *pMsgType2);
+static bool __MsgCopyNestedMsgParam(MsgContentParam *pParam1, MsgContentParam *pParam2);
+static bool __MsgIsMultipartMixed(int type);
+
+static bool __MsgIsInvalidFileNameChar(char ch);
+
+static int __MsgGetLatin2UTFCodeSize(unsigned char *szSrc, int nChar);
+static int __MsgLatin5code2UTF(unsigned char *des, int outBufSize, unsigned char *szSrc, int nChar);
+static int __MsgGetLatin52UTFCodeSize(unsigned char *szSrc, int nChar);
+static int __MsgLatin2UTF(unsigned char *des, int outBufSize, unsigned char *szSrc, int nChar);
+static int __MsgLatin7code2UTF(unsigned char *des, int outBufSize, unsigned char *szSrc, int nChar);
+static int __MsgGetLatin72UTFCodeSize(unsigned char *szSrc, int nChar);
+static int __MsgUnicode2UTF(unsigned char *des, int outBufSize, unsigned short *szSrc, int nChar);
+static int __MsgGetUnicode2UTFCodeSize(unsigned short *szSrc, int nChar);
+static bool __MmsAddrUtilCheckEmailAddress(char *pszAddr);
+static int __MsgCutUTFString(unsigned char *des, int outBufSize, unsigned char *szSrc, int nChar);
+static void __MsgMIMERemoveQuote(char *szSrc);
+static bool __MmsMultipartSaveAsTempFile(MsgType *pPartType, MsgBody *pPartBody, char *pszMailboxPath, char *pszMsgFilename, int index, bool bSave);
+
+static bool __MmsGetMediaPartData(MsgType *pPartType, MsgBody *pPartBody, FILE *pFile);
+static char *__MmsGetBinaryUTF8Data(char *pData, int nRead, int msgEncodingValue, int msgTypeValue, int msgCharsetValue, int *npRead);
+
+#ifndef __SUPPORT_DRM__
+static bool __MsgMakeFileName(int iMsgType, char *szFileName, int nUntitleIndex);
+#else
+static bool __MsgMakeFileName(int iMsgType, char *szFileName, MsgDrmType drmType, int nUntitleIndex);
+#endif
-bool __MmsTextDecodeMsgHeader(FILE *pFile);
-bool MmsTextDecodeMsgBody(FILE *pFile);
+static bool __MmsDebugPrintMulitpartEntry(MsgMultipart *pMultipart, int index);
-char gszMmsLoadBuf1[MSG_MMS_DECODE_BUFFER_MAX + 1] = {0, };
-char gszMmsLoadBuf2[MSG_MMS_DECODE_BUFFER_MAX + 1] = {0, };
+static char gszMmsLoadBuf1[MSG_MMS_DECODE_BUFFER_MAX + 1] = {0, };
+static char gszMmsLoadBuf2[MSG_MMS_DECODE_BUFFER_MAX + 1] = {0, };
static char *gpCurMmsDecodeBuff = NULL;
static int gCurMmsDecodeBuffPos = 0; /* next decoding position in gpCurMmsDecodeBuff */
const UINT32 MMS_UINTVAR_LENGTH_1 = 0x0000007f; //7bit
const UINT32 MMS_UINTVAR_LENGTH_2 = 0x00003fff; //14bit
const UINT32 MMS_UINTVAR_LENGTH_3 = 0x001fffff; //21bit
-
#endif
-
-bool _MmsDecodeInitialize(void)
+static bool __MmsDecodeInitialize(void)
{
MmsInitMsgType(&mmsHeader.msgType);
MmsInitMsgBody(&mmsHeader.msgBody);
-
- return true;
-}
-
-bool __MmsSetMmsHeaderOwner(int msgID, char* pszNewOwner)
-{
- if (pszNewOwner) {
- // set new owner
- MSG_DEBUG("__MmsSetMmsHeaderOwner: set (%s, msgID=%d)\n", pszNewOwner, msgID);
-
- if ((mmsHeader.pszOwner = (char*)malloc(strlen(pszNewOwner) + 1)) == NULL)
- return false;
-
- memset (mmsHeader.pszOwner, 0, strlen(pszNewOwner) + 1) ;
-
- strcpy(mmsHeader.pszOwner, pszNewOwner);
- mmsHeader.bActive = true;
- mmsHeader.msgID = msgID;
- } else {
- // delete current owner
- if (mmsHeader.pszOwner) {
- MSG_DEBUG("__MmsSetMmsHeaderOwner: free (%s %d)\n", mmsHeader.pszOwner, msgID);
- free(mmsHeader.pszOwner);
- mmsHeader.pszOwner = NULL;
- }
- mmsHeader.bActive = false;
- mmsHeader.msgID = -1;
- }
-
return true;
}
-
-void _MmsInitHeader()
+void MmsInitHeader()
{
mmsHeader.type = MMS_MSGTYPE_ERROR;
mmsHeader.version = MMS_VERSION;
mmsHeader.date = 0;
- MsgFreeHeaderAddress(mmsHeader.pFrom);
- MsgFreeHeaderAddress(mmsHeader.pTo);
- MsgFreeHeaderAddress(mmsHeader.pCc);
- MsgFreeHeaderAddress(mmsHeader.pBcc);
+ __MsgFreeHeaderAddress(mmsHeader.pFrom);
+ __MsgFreeHeaderAddress(mmsHeader.pTo);
+ __MsgFreeHeaderAddress(mmsHeader.pCc);
+ __MsgFreeHeaderAddress(mmsHeader.pBcc);
mmsHeader.pFrom = NULL;
mmsHeader.pTo = NULL;
mmsHeader.drmType = MSG_DRM_TYPE_NONE;
#endif
- _MmsDecodeInitialize();
+ __MmsDecodeInitialize();
}
-
-
-void _MmsCleanDecodeBuff(void)
+static void __MmsCleanDecodeBuff(void)
{
memset(gpMmsDecodeBuf1, 0, gMmsDecodeMaxLen + 1);
memset(gpMmsDecodeBuf2, 0, gMmsDecodeMaxLen + 1);
gMmsDecodeBufLen = 0;
}
-
-void _MmsRegisterDecodeBuffer(char *pInBuff1, char *pInBuff2, int maxLen)
+void MmsRegisterDecodeBuffer()
{
- gpMmsDecodeBuf1 = pInBuff1;
- gpMmsDecodeBuf2 = pInBuff2;
+ gpMmsDecodeBuf1 = gszMmsLoadBuf1;
+ gpMmsDecodeBuf2 = gszMmsLoadBuf2;
gpCurMmsDecodeBuff = NULL;
gCurMmsDecodeBuffPos = 0;
- gMmsDecodeMaxLen = maxLen;
+ gMmsDecodeMaxLen = MSG_MMS_DECODE_BUFFER_MAX;
gMmsDecodeCurOffset = 0;
gMmsDecodeBufLen = 0;
}
-void _MmsUnregisterDecodeBuffer(void)
+void MmsUnregisterDecodeBuffer(void)
{
gpMmsDecodeBuf1 = NULL;
gpMmsDecodeBuf2 = NULL;
}
-int _MmsGetDecodeOffset(void)
+static int __MmsGetDecodeOffset(void)
{
return (gMmsDecodeCurOffset - gMmsDecodeBufLen + gCurMmsDecodeBuffPos);
}
-
static bool __MmsBinaryDecodeCheckAndDecreaseLength(int *pLength, int valueLength)
{
if (*pLength <= valueLength) {
char *pLimitData = NULL;
int nRead = 0;
- MSG_DEBUG("MmsBinaryDecodeMsgHeader: pFile=%d, total len=%d\n", pFile, totalLength);
+ MSG_DEBUG("pFile=%d, total len=%d\n", pFile, totalLength);
- _MmsCleanDecodeBuff();
+ __MmsCleanDecodeBuff();
- if (MsgLoadDataToDecodeBuffer(pFile, &gpCurMmsDecodeBuff, &gCurMmsDecodeBuffPos,
+ if (__MsgLoadDataToDecodeBuffer(pFile, &gpCurMmsDecodeBuff, &gCurMmsDecodeBuffPos,
&gMmsDecodeCurOffset, gpMmsDecodeBuf1, gpMmsDecodeBuf2,
gMmsDecodeMaxLen, &gMmsDecodeBufLen, totalLength) == false) {
- MSG_DEBUG("MmsBinaryDecodeMsgHeader: fail to load to buffer \n");
+ MSG_DEBUG("fail to load to buffer \n");
goto __CATCH;
}
- while (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength)) {
+ while (__MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength)) {
fieldCode = oneByte & 0x7f;
- switch (_MmsGetBinaryType(MmsCodeFieldCode, fieldCode)) {
+ switch (MmsGetBinaryType(MmsCodeFieldCode, fieldCode)) {
case MMS_CODE_RESPONSESTATUS:
- if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
- MSG_DEBUG("MmsBinaryDecodeMsgHeader: responseStatus GetOneByte fail\n");
+ if (__MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
+ MSG_DEBUG("responseStatus GetOneByte fail\n");
goto __CATCH;
}
- fieldValue = _MmsGetBinaryType(MmsCodeResponseStatus, (UINT16)(oneByte & 0x7F));
+ fieldValue = MmsGetBinaryType(MmsCodeResponseStatus, (UINT16)(oneByte & 0x7F));
if (fieldValue == 0xFFFF) {
- MSG_DEBUG("MmsBinaryDecodeMsgHeader: responseStatus error\n");
+ MSG_DEBUG("responseStatus error\n");
goto __CATCH;
}
mmsHeader.responseStatus = (MmsResponseStatus)fieldValue;
- MSG_DEBUG("MmsBinaryDecodeMsgHeader: response status = %s\n", MmsDebugGetResponseStatus(mmsHeader.responseStatus));
+ MSG_DEBUG("response status = %s\n", MmsDebugGetResponseStatus(mmsHeader.responseStatus));
break;
case MMS_CODE_RETRIEVESTATUS:
- if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
- MSG_DEBUG("MmsBinaryDecodeMsgHeader: retrieveStatus GetOneByte fail\n");
+ if (__MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
+ MSG_DEBUG("retrieveStatus GetOneByte fail\n");
goto __CATCH;
}
- fieldValue = _MmsGetBinaryType(MmsCodeRetrieveStatus, (UINT16)(oneByte & 0x7F));
+ fieldValue = MmsGetBinaryType(MmsCodeRetrieveStatus, (UINT16)(oneByte & 0x7F));
if (fieldValue == 0xFFFF) {
- MSG_DEBUG("MmsBinaryDecodeMsgHeader: retrieveStatus error\n");
+ MSG_DEBUG("retrieveStatus error\n");
goto __CATCH;
}
mmsHeader.retrieveStatus = (MmsRetrieveStatus)fieldValue;
- MSG_DEBUG("MmsBinaryDecodeMsgHeader: retrieve status = %s\n",
+ MSG_DEBUG("retrieve status = %s\n",
MmsDebugGetRetrieveStatus(mmsHeader.retrieveStatus));
break;
case MMS_CODE_RESPONSETEXT:
if (__MmsBinaryDecodeEncodedString(pFile, mmsHeader.szResponseText, MMS_LOCALE_RESP_TEXT_LEN + 1, totalLength) == false) {
- MSG_DEBUG("MmsBinaryDecodeMsgHeader : invalid MMS_CODE_RESPONSETEXT \n");
+ MSG_DEBUG("invalid MMS_CODE_RESPONSETEXT \n");
goto __CATCH;
}
- MSG_DEBUG("MmsBinaryDecodeMsgHeader: response text = %s\n", mmsHeader.szResponseText);
+ MSG_DEBUG("response text = %s\n", mmsHeader.szResponseText);
break;
case MMS_CODE_RETRIEVETEXT:
if (__MmsBinaryDecodeEncodedString(pFile, mmsHeader.szRetrieveText, MMS_LOCALE_RESP_TEXT_LEN + 1, totalLength) == false) {
- MSG_DEBUG("MmsBinaryDecodeMsgHeader : invalid MMS_CODE_RETRIEVETEXT \n");
+ MSG_DEBUG("invalid MMS_CODE_RETRIEVETEXT \n");
goto __CATCH;
}
- MSG_DEBUG("MmsBinaryDecodeMsgHeader: retrieve text = %s\n", mmsHeader.szResponseText);
+ MSG_DEBUG("retrieve text = %s\n", mmsHeader.szResponseText);
break;
case MMS_CODE_MSGID:
if (__MmsBinaryDecodeText(pFile, mmsHeader.szMsgID, MMS_MSG_ID_LEN + 1, totalLength) < 0) {
- MSG_DEBUG("MmsBinaryDecodeMsgHeader : MMS_CODE_MSGID is invalid\n");
+ MSG_DEBUG("MMS_CODE_MSGID is invalid\n");
goto __CATCH;
}
- MSG_DEBUG("MmsBinaryDecodeMsgHeader: msg id = %s\n", mmsHeader.szMsgID);
+ MSG_DEBUG("msg id = %s\n", mmsHeader.szMsgID);
if (MsgStrlen (mmsHeader.szMsgID) > 2)
- MsgMIMERemoveQuote (mmsHeader.szMsgID);
+ __MsgMIMERemoveQuote (mmsHeader.szMsgID);
break;
case MMS_CODE_SUBJECT:
if (__MmsBinaryDecodeEncodedString(pFile, mmsHeader.szSubject, MSG_LOCALE_SUBJ_LEN + 1, totalLength) == false) {
- MSG_DEBUG("MmsBinaryDecodeMsgHeader : invalid MMS_CODE_SUBJECT \n");
+ MSG_DEBUG("invalid MMS_CODE_SUBJECT \n");
goto __CATCH;
}
pLimitData = (char *)malloc(MSG_LOCALE_SUBJ_LEN + 1);
if (pLimitData == NULL) {
- MSG_DEBUG("MmsBinaryDecodeMsgHeader : pLimitData malloc fail \n");
+ MSG_DEBUG("pLimitData malloc fail \n");
goto __CATCH;
}
- nRead = MsgCutUTFString((unsigned char*)pLimitData, MSG_LOCALE_SUBJ_LEN + 1, (unsigned char*)mmsHeader.szSubject, MSG_SUBJ_LEN);
- MSG_DEBUG("MmsBinaryDecodeMsgHeader : Subject edit.. \n");
+ nRead = __MsgCutUTFString((unsigned char*)pLimitData, MSG_LOCALE_SUBJ_LEN + 1, (unsigned char*)mmsHeader.szSubject, MSG_SUBJ_LEN);
+ MSG_DEBUG("Subject edit.. \n");
if (nRead > MSG_LOCALE_SUBJ_LEN) {
memset(mmsHeader.szSubject, 0 , sizeof(mmsHeader.szSubject));
pLimitData = NULL;
}
- MSG_DEBUG("MmsBinaryDecodeMsgHeader: subject = %s\n", mmsHeader.szSubject);
+ MSG_DEBUG("subject = %s\n", mmsHeader.szSubject);
break;
case MMS_CODE_FROM:
/* Value-length (Address-present-token Encoded-string-value | Insert-address-token) */
if (__MmsDecodeValueLength(pFile, &valueLength, totalLength) <= 0) {
- MSG_DEBUG("MmsBinaryDecodeMsgHeader : MMS_CODE_FROM is invalid\n");
+ MSG_DEBUG("MMS_CODE_FROM is invalid\n");
goto __CATCH;
}
- if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
- MSG_DEBUG("MmsBinaryDecodeMsgHeader: MMS_CODE_FROM GetOneByte fail\n");
+ if (__MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
+ MSG_DEBUG("MMS_CODE_FROM GetOneByte fail\n");
goto __CATCH;
}
valueLength--;
- if (oneByte == (_MmsGetBinaryValue(MmsCodeAddressType, MMS_ADDRESS_PRESENT_TOKEN)|0x80)) {
+ if (oneByte == (MmsGetBinaryValue(MmsCodeAddressType, MMS_ADDRESS_PRESENT_TOKEN)|0x80)) {
if (valueLength > 0) {
mmsHeader.pFrom = __MmsDecodeEncodedAddress(pFile, totalLength);
if (mmsHeader.pFrom == NULL) {
- MSG_DEBUG("MmsBinaryDecodeMsgHeader : MMS_CODE_FROM __MmsDecodeEncodedAddress fail\n");
+ MSG_DEBUG("MMS_CODE_FROM __MmsDecodeEncodedAddress fail\n");
goto __CATCH;
}
} else {
mmsHeader.pFrom->pNext = NULL;
}
- MSG_DEBUG("MmsBinaryDecodeMsgHeader: from = %s\n", mmsHeader.pFrom->szAddr);
+ MSG_DEBUG("from = %s\n", mmsHeader.pFrom->szAddr);
// DRM_TEMPLATE - end
- } else if (oneByte == (_MmsGetBinaryValue(MmsCodeAddressType, MMS_INSERT_ADDRESS_TOKEN)|0x80)) {
+ } else if (oneByte == (MmsGetBinaryValue(MmsCodeAddressType, MMS_INSERT_ADDRESS_TOKEN)|0x80)) {
/* Present Token only */
- MSG_DEBUG("MmsBinaryDecodeMsgHeader : MMS_CODE_FROM insert token\n");
+ MSG_DEBUG("MMS_CODE_FROM insert token\n");
} else {
/* from data broken */
- MSG_DEBUG("MmsBinaryDecodeMsgHeader: from addr broken\n");
+ MSG_DEBUG("from addr broken\n");
gCurMmsDecodeBuffPos--;
goto __CATCH;
}
pAddr = __MmsDecodeEncodedAddress(pFile, totalLength);
if (pAddr == NULL) {
- MSG_DEBUG("MmsBinaryDecodeMsgHeader : MMS_CODE_TO __MmsDecodeEncodedAddress fail\n");
+ MSG_DEBUG("MMS_CODE_TO __MmsDecodeEncodedAddress fail\n");
goto __CATCH;
}
pLastTo = pAddr;
}
- MSG_DEBUG("MmsBinaryDecodeMsgHeader: to = %s\n", mmsHeader.pTo->szAddr);
+ MSG_DEBUG("to = %s\n", mmsHeader.pTo->szAddr);
break;
case MMS_CODE_BCC:
pAddr = __MmsDecodeEncodedAddress(pFile, totalLength);
if (pAddr == NULL) {
- MSG_DEBUG("MmsBinaryDecodeMsgHeader : MMS_CODE_BCC __MmsDecodeEncodedAddress fail\n");
+ MSG_DEBUG("MMS_CODE_BCC __MmsDecodeEncodedAddress fail\n");
goto __CATCH;
}
pLastBcc = pAddr;
}
- MSG_DEBUG("MmsBinaryDecodeMsgHeader: bcc = %s\n", mmsHeader.pBcc->szAddr);
+ MSG_DEBUG("bcc = %s\n", mmsHeader.pBcc->szAddr);
break;
case MMS_CODE_CC:
pAddr = __MmsDecodeEncodedAddress(pFile, totalLength);
if (pAddr == NULL) {
- MSG_DEBUG("MmsBinaryDecodeMsgHeader : MMS_CODE_CC __MmsDecodeEncodedAddress fail\n");
+ MSG_DEBUG("MMS_CODE_CC __MmsDecodeEncodedAddress fail\n");
goto __CATCH;
}
pLastCc->pNext = pAddr;
pLastCc = pAddr;
}
- MSG_DEBUG("MmsBinaryDecodeMsgHeader: cc = %s\n", mmsHeader.pCc->szAddr);
+ MSG_DEBUG("cc = %s\n", mmsHeader.pCc->szAddr);
break;
case MMS_CODE_CONTENTLOCATION:
if (__MmsBinaryDecodeText(pFile, mmsHeader.szContentLocation, MMS_LOCATION_LEN + 1, totalLength) < 0) {
- MSG_DEBUG("MmsBinaryDecodeMsgHeader : MMS_CODE_CONTENTLOCATION is invalid\n");
+ MSG_DEBUG("MMS_CODE_CONTENTLOCATION is invalid\n");
goto __CATCH;
}
- MSG_DEBUG("MmsBinaryDecodeMsgHeader: content location = %s\n", mmsHeader.szContentLocation);
+ MSG_DEBUG("content location = %s\n", mmsHeader.szContentLocation);
break;
case MMS_CODE_DATE:
if (__MmsDecodeLongInteger(pFile, (UINT32*)&mmsHeader.date, totalLength) == false) {
- MSG_DEBUG("MmsBinaryDecodeMsgHeader : MMS_CODE_DATE is invalid\n");
+ MSG_DEBUG("MMS_CODE_DATE is invalid\n");
goto __CATCH;
}
- MSG_DEBUG("MmsBinaryDecodeMsgHeader: date = %d\n", mmsHeader.date);
+ MSG_DEBUG("date = %d\n", mmsHeader.date);
break;
case MMS_CODE_DELIVERYREPORT:
- if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
- MSG_DEBUG("MmsBinaryDecodeMsgHeader: deliveryReport GetOneByte fail\n");
+ if (__MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
+ MSG_DEBUG("deliveryReport GetOneByte fail\n");
goto __CATCH;
}
- fieldValue = _MmsGetBinaryType(MmsCodeDeliveryReport, (UINT16)(oneByte & 0x7F));
+ fieldValue = MmsGetBinaryType(MmsCodeDeliveryReport, (UINT16)(oneByte & 0x7F));
if (fieldValue == 0xFFFF) {
- MSG_DEBUG("MmsBinaryDecodeMsgHeader: deliveryReport error\n");
+ MSG_DEBUG("deliveryReport error\n");
goto __CATCH;
}
mmsHeader.deliveryReport = (MmsReport)fieldValue;
- MSG_DEBUG("MmsBinaryDecodeMsgHeader: delivery report=%s\n", MmsDebugGetMmsReport(mmsHeader.deliveryReport));
+ MSG_DEBUG("delivery report=%s\n", MmsDebugGetMmsReport(mmsHeader.deliveryReport));
break;
case MMS_CODE_DELIVERYTIME:
/* value_length (absolute-token Long-integer | Relative-token Long-integer) */
if (__MmsDecodeValueLength(pFile, &valueLength, totalLength) <= 0) {
- MSG_DEBUG("MmsBinaryDecodeMsgHeader : invalid MMS_CODE_DELIVERYTIME \n");
+ MSG_DEBUG("invalid MMS_CODE_DELIVERYTIME \n");
goto __CATCH;
}
- if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
- MSG_DEBUG("MmsBinaryDecodeMsgHeader: delivery time GetOneByte fail\n");
+ if (__MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
+ MSG_DEBUG("delivery time GetOneByte fail\n");
goto __CATCH;
}
//DRM_TEMPLATE - start
valueLength--;
- if (oneByte == (_MmsGetBinaryValue(MmsCodeTimeType, MMS_TIMETYPE_ABSOLUTE)|0x80)) {
+ if (oneByte == (MmsGetBinaryValue(MmsCodeTimeType, MMS_TIMETYPE_ABSOLUTE)|0x80)) {
mmsHeader.deliveryTime.type = MMS_TIMETYPE_ABSOLUTE;
if (valueLength > 0) {
if (__MmsDecodeLongInteger(pFile, (UINT32*)&mmsHeader.deliveryTime.time, totalLength) == false) {
- MSG_DEBUG("MmsBinaryDecodeMsgHeader : invalid MMS_CODE_DELIVERYTIME\n");
+ MSG_DEBUG("invalid MMS_CODE_DELIVERYTIME\n");
goto __CATCH;
}
}
mmsHeader.deliveryTime.type = MMS_TIMETYPE_RELATIVE;
if (__MmsBinaryDecodeInteger(pFile, (UINT32*)&mmsHeader.deliveryTime.time, &tmpIntLen, totalLength) == false) {
- MSG_DEBUG("MmsBinaryDecodeMsgHeader : __MmsBinaryDecodeInteger fail...\n");
+ MSG_DEBUG("__MmsBinaryDecodeInteger fail...\n");
goto __CATCH;
}
}
- MSG_DEBUG("MmsBinaryDecodeMsgHeader: delivery type=%d, time=%d\n", mmsHeader.deliveryTime.type, mmsHeader.deliveryTime.time);
+ MSG_DEBUG("delivery type=%d, time=%d\n", mmsHeader.deliveryTime.type, mmsHeader.deliveryTime.time);
break;
case MMS_CODE_EXPIRYTIME:
/* value_length(absolute-token Long-integer | Relative-token Long-integer) */
if (__MmsDecodeValueLength(pFile, &valueLength, totalLength) <= 0) {
- MSG_DEBUG("MmsBinaryDecodeMsgHeader : invalid MMS_CODE_EXPIRYTIME \n");
+ MSG_DEBUG("invalid MMS_CODE_EXPIRYTIME \n");
goto __CATCH;
}
- if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
- MSG_DEBUG("MmsBinaryDecodeMsgHeader: expiry time GetOneByte fail\n");
+ if (__MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
+ MSG_DEBUG("expiry time GetOneByte fail\n");
goto __CATCH;
}
// DRM_TEMPLATE - start
valueLength--;
- if (oneByte == (_MmsGetBinaryValue(MmsCodeTimeType, MMS_TIMETYPE_ABSOLUTE)|0x80)) {
+ if (oneByte == (MmsGetBinaryValue(MmsCodeTimeType, MMS_TIMETYPE_ABSOLUTE)|0x80)) {
mmsHeader.expiryTime.type = MMS_TIMETYPE_ABSOLUTE;
if (valueLength > 0) {
if (__MmsDecodeLongInteger(pFile, (UINT32*)&mmsHeader.expiryTime.time, totalLength) == false) {
- MSG_DEBUG("MmsBinaryDecodeMsgHeader : MMS_CODE_EXPIRYTIME is invalid\n");
+ MSG_DEBUG("MMS_CODE_EXPIRYTIME is invalid\n");
goto __CATCH;
}
}
mmsHeader.expiryTime.type = MMS_TIMETYPE_RELATIVE;
if (__MmsBinaryDecodeInteger(pFile, (UINT32*)&mmsHeader.expiryTime.time, &tmpIntLen, totalLength) == false) {
- MSG_DEBUG("MmsBinaryDecodeMsgHeader : __MmsBinaryDecodeInteger fail...\n");
+ MSG_DEBUG("__MmsBinaryDecodeInteger fail...\n");
goto __CATCH;
}
}
- MSG_DEBUG("MmsBinaryDecodeMsgHeader: expiry = %d\n", mmsHeader.expiryTime.time);
+ MSG_DEBUG("expiry = %d\n", mmsHeader.expiryTime.time);
break;
case MMS_CODE_MSGCLASS:
/* Class-value = Class-identifier | Token Text */
- if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
- MSG_DEBUG("MmsBinaryDecodeMsgHeader: msgClass GetOneByte fail\n");
+ if (__MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
+ MSG_DEBUG("msgClass GetOneByte fail\n");
goto __CATCH;
}
if (oneByte > 0x7f) {
/* Class-identifier */
- mmsHeader.msgClass = (MmsMsgClass)_MmsGetBinaryType(MmsCodeMsgClass, (UINT16)(oneByte & 0x7F));
+ mmsHeader.msgClass = (MmsMsgClass)MmsGetBinaryType(MmsCodeMsgClass, (UINT16)(oneByte & 0x7F));
} else {
if (__MmsBinaryDecodeText(pFile, szGarbageBuff, MSG_STDSTR_LONG, totalLength) < 0) {
- MSG_DEBUG("MmsBinaryDecodeMsgHeader: 1. __MmsBinaryDecodeText fail. (class)\n");
+ MSG_DEBUG("1. __MmsBinaryDecodeText fail. (class)\n");
goto __CATCH;
}
}
- MSG_DEBUG("MmsBinaryDecodeMsgHeader: msg class=%s\n", MmsDebugGetMsgClass(mmsHeader.msgClass));
+ MSG_DEBUG("msg class=%s\n", MmsDebugGetMsgClass(mmsHeader.msgClass));
break;
case MMS_CODE_MSGSIZE:
if (__MmsDecodeLongInteger(pFile, (UINT32*)&mmsHeader.msgSize, totalLength) == false) {
- MSG_DEBUG("MmsBinaryDecodeMsgHeader : MMS_CODE_MSGSIZE is invalid\n");
+ MSG_DEBUG("MMS_CODE_MSGSIZE is invalid\n");
goto __CATCH;
}
- MSG_DEBUG("MmsBinaryDecodeMsgHeader: msg size = %d\n", mmsHeader.msgSize);
+ MSG_DEBUG("msg size = %d\n", mmsHeader.msgSize);
break;
case MMS_CODE_MSGSTATUS:
- if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
- MSG_DEBUG("MmsBinaryDecodeMsgHeader: msgStatus GetOneByte fail\n");
+ if (__MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
+ MSG_DEBUG("msgStatus GetOneByte fail\n");
goto __CATCH;
}
- mmsHeader.msgStatus = (msg_delivery_report_status_t)_MmsGetBinaryType(MmsCodeMsgStatus, (UINT16)(oneByte & 0x7F));
- MSG_DEBUG("MmsBinaryDecodeMsgHeader: msg status=%s \n", MmsDebugGetMsgStatus(mmsHeader.msgStatus)) ;
+ mmsHeader.msgStatus = (msg_delivery_report_status_t)MmsGetBinaryType(MmsCodeMsgStatus, (UINT16)(oneByte & 0x7F));
+ MSG_DEBUG("msg status=%s \n", MmsDebugGetMsgStatus(mmsHeader.msgStatus)) ;
break;
case MMS_CODE_MSGTYPE:
- if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
- MSG_DEBUG("MmsBinaryDecodeMsgHeader: msgStatus GetOneByte fail\n");
+ if (__MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
+ MSG_DEBUG("msgStatus GetOneByte fail\n");
goto __CATCH;
}
- mmsHeader.type = (MmsMsgType)_MmsGetBinaryType(MmsCodeMsgType, (UINT16)(oneByte & 0x7F));
- MSG_DEBUG("MmsBinaryDecodeMsgHeader: msg type=%s\n", MmsDebugGetMsgType(mmsHeader.type));
+ mmsHeader.type = (MmsMsgType)MmsGetBinaryType(MmsCodeMsgType, (UINT16)(oneByte & 0x7F));
+ MSG_DEBUG("msg type=%s\n", MmsDebugGetMsgType(mmsHeader.type));
break;
case MMS_CODE_PRIORITY:
- if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
- MSG_DEBUG("MmsBinaryDecodeMsgHeader: msgStatus GetOneByte fail\n");
+ if (__MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
+ MSG_DEBUG("msgStatus GetOneByte fail\n");
goto __CATCH;
}
- mmsHeader.priority = (MmsPriority)_MmsGetBinaryType(MmsCodePriority, (UINT16)(oneByte & 0x7F));
- MSG_DEBUG("MmsBinaryDecodeMsgHeader: priority=%d\n", mmsHeader.priority);
+ mmsHeader.priority = (MmsPriority)MmsGetBinaryType(MmsCodePriority, (UINT16)(oneByte & 0x7F));
+ MSG_DEBUG("priority=%d\n", mmsHeader.priority);
break;
case MMS_CODE_READREPLY:
- if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
- MSG_DEBUG("MmsBinaryDecodeMsgHeader: msgStatus GetOneByte fail\n");
+ if (__MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
+ MSG_DEBUG("msgStatus GetOneByte fail\n");
goto __CATCH;
}
- mmsHeader.readReply = (MmsReport)_MmsGetBinaryType(MmsCodeReadReply, (UINT16)(oneByte & 0x7F));
- MSG_DEBUG("MmsBinaryDecodeMsgHeader: read reply=%s \n", MmsDebugGetMmsReport(mmsHeader.readReply));
+ mmsHeader.readReply = (MmsReport)MmsGetBinaryType(MmsCodeReadReply, (UINT16)(oneByte & 0x7F));
+ MSG_DEBUG("read reply=%s \n", MmsDebugGetMmsReport(mmsHeader.readReply));
break;
case MMS_CODE_REPORTALLOWED:
- if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
- MSG_DEBUG("MmsBinaryDecodeMsgHeader: msgStatus GetOneByte fail\n");
+ if (__MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
+ MSG_DEBUG("msgStatus GetOneByte fail\n");
goto __CATCH;
}
- mmsHeader.reportAllowed = (MmsReportAllowed)_MmsGetBinaryType(MmsCodeReportAllowed, (UINT16)(oneByte & 0x7F));
- MSG_DEBUG("MmsBinaryDecodeMsgHeader: mmsHeader.reportAllowed=%d\n", MmsDebugGetMmsReportAllowed(mmsHeader.reportAllowed));
+ mmsHeader.reportAllowed = (MmsReportAllowed)MmsGetBinaryType(MmsCodeReportAllowed, (UINT16)(oneByte & 0x7F));
+ MSG_DEBUG("mmsHeader.reportAllowed=%d\n", MmsDebugGetMmsReportAllowed(mmsHeader.reportAllowed));
break;
case MMS_CODE_SENDERVISIBILLITY:
- if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
- MSG_DEBUG("MmsBinaryDecodeMsgHeader: msgStatus GetOneByte fail\n");
+ if (__MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
+ MSG_DEBUG("msgStatus GetOneByte fail\n");
goto __CATCH;
}
- mmsHeader.hideAddress= (MmsSenderVisible)!(_MmsGetBinaryType(MmsCodeSenderVisibility, (UINT16)(oneByte &0x7F)));
- MSG_DEBUG("MmsBinaryDecodeMsgHeader: sender visible=%d \n", mmsHeader.hideAddress);
+ mmsHeader.hideAddress= (MmsSenderVisible)!(MmsGetBinaryType(MmsCodeSenderVisibility, (UINT16)(oneByte &0x7F)));
+ MSG_DEBUG("sender visible=%d \n", mmsHeader.hideAddress);
break;
case MMS_CODE_TRID:
MSG_DEBUG("Transaction ID Too Long \n");
goto __CATCH;
}
- MSG_DEBUG("MmsBinaryDecodeMsgHeader: trID = %s\n", mmsHeader.szTrID);
+ MSG_DEBUG("trID = %s\n", mmsHeader.szTrID);
break;
case MMS_CODE_VERSION:
- if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
- MSG_DEBUG("MmsBinaryDecodeMsgHeader: msgStatus GetOneByte fail\n");
+ if (__MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
+ MSG_DEBUG("msgStatus GetOneByte fail\n");
goto __CATCH;
}
mmsHeader.version = oneByte;
- MSG_DEBUG("MmsBinaryDecodeMsgHeader: ver = 0x%x\n", mmsHeader.version);
+ MSG_DEBUG("ver = 0x%x\n", mmsHeader.version);
break;
case MMS_CODE_CONTENTTYPE:
/* Read-status-value = Read | Deleted without being read */
- if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
- MSG_DEBUG("MmsBinaryDecodeMsgHeader: msgStatus GetOneByte fail\n");
+ if (__MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
+ MSG_DEBUG("msgStatus GetOneByte fail\n");
goto __CATCH;
}
- mmsHeader.readStatus = (msg_read_report_status_t)_MmsGetBinaryType(MmsCodeReadStatus, (UINT16)(oneByte & 0x7F));
- MSG_DEBUG("MmsBinaryDecodeMsgHeader: read status=%s\n", MmsDebugGetMmsReadStatus(mmsHeader.readStatus));
+ mmsHeader.readStatus = (msg_read_report_status_t)MmsGetBinaryType(MmsCodeReadStatus, (UINT16)(oneByte & 0x7F));
+ MSG_DEBUG("read status=%s\n", MmsDebugGetMmsReadStatus(mmsHeader.readStatus));
break;
case MMS_CODE_REPLYCHARGING:
/* Reply-charging-value = Requested | Requested text only | Accepted | Accepted text only */
- if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
- MSG_DEBUG("MmsBinaryDecodeMsgHeader: msgStatus GetOneByte fail\n");
+ if (__MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
+ MSG_DEBUG("msgStatus GetOneByte fail\n");
goto __CATCH;
}
- mmsHeader.replyCharge.chargeType = (MmsReplyChargeType)_MmsGetBinaryType(MmsCodeReplyCharging, (UINT16)(oneByte & 0x7F));
- MSG_DEBUG("MmsBinaryDecodeMsgHeader: mmsHeader.reply charge=%d\n", mmsHeader.replyCharge.chargeType);
+ mmsHeader.replyCharge.chargeType = (MmsReplyChargeType)MmsGetBinaryType(MmsCodeReplyCharging, (UINT16)(oneByte & 0x7F));
+ MSG_DEBUG("mmsHeader.reply charge=%d\n", mmsHeader.replyCharge.chargeType);
break;
case MMS_CODE_REPLYCHARGINGDEADLINE:
/* Reply-charging-deadline-value = Value-length (Absolute-token Date-value | Relative-token Delta-seconds-value) */
if (__MmsDecodeValueLength(pFile, &valueLength, totalLength) <= 0) {
- MSG_DEBUG("MmsBinaryDecodeMsgHeader : invalid MMS_CODE_REPLYCHARGINGDEADLINE \n");
+ MSG_DEBUG("invalid MMS_CODE_REPLYCHARGINGDEADLINE \n");
goto __CATCH;
}
- if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
- MSG_DEBUG("MmsBinaryDecodeMsgHeader: msgStatus GetOneByte fail\n");
+ if (__MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
+ MSG_DEBUG("msgStatus GetOneByte fail\n");
goto __CATCH;
}
- if (oneByte == (_MmsGetBinaryValue(MmsCodeTimeType, MMS_TIMETYPE_ABSOLUTE) | 0x80)) {
+ if (oneByte == (MmsGetBinaryValue(MmsCodeTimeType, MMS_TIMETYPE_ABSOLUTE) | 0x80)) {
mmsHeader.replyCharge.deadLine.type = MMS_TIMETYPE_ABSOLUTE;
} else {
mmsHeader.replyCharge.deadLine.type = MMS_TIMETYPE_RELATIVE;
if (valueLength > 0) {
if (__MmsDecodeLongInteger(pFile, (UINT32*)&mmsHeader.replyCharge.deadLine.time, totalLength) == false) {
- MSG_DEBUG("MmsBinaryDecodeMsgHeader : MMS_CODE_REPLYCHARGINGDEADLINE is invalid\n");
+ MSG_DEBUG("MMS_CODE_REPLYCHARGINGDEADLINE is invalid\n");
goto __CATCH;
}
}
/* Reply-charging-ID-value = Text-string */
if (__MmsBinaryDecodeText(pFile, mmsHeader.replyCharge.szChargeID, MMS_MSG_ID_LEN + 1, totalLength) < 0) {
- MSG_DEBUG("MmsBinaryDecodeMsgHeader: 1. __MmsBinaryDecodeText fail. (szReplyChargingID)\n");
+ MSG_DEBUG("1. __MmsBinaryDecodeText fail. (szReplyChargingID)\n");
goto __CATCH;
}
break;
/* Reply-charging-size-value = Long-integer */
if (__MmsDecodeLongInteger(pFile, (UINT32*)&mmsHeader.replyCharge.chargeSize, totalLength) == false) {
- MSG_DEBUG("MmsBinaryDecodeMsgHeader : MMS_CODE_REPLYCHARGINGSIZE is invalid\n");
+ MSG_DEBUG("MMS_CODE_REPLYCHARGINGSIZE is invalid\n");
goto __CATCH;
}
break;
*/
if (__MmsDecodeValueLength(pFile, &valueLength, totalLength) <= 0) {
- MSG_DEBUG("MmsBinaryDecodeMsgHeader : 1. invalid MMS_CODE_PREVIOUSLYSENTBY \n");
+ MSG_DEBUG("1. invalid MMS_CODE_PREVIOUSLYSENTBY \n");
goto __CATCH;
}
if (__MmsBinaryDecodeInteger(pFile, &tmpInteger, &tmpIntLen, totalLength) == false) {
- MSG_DEBUG("MmsBinaryDecodeMsgHeader : 2. invalid MMS_CODE_PREVIOUSLYSENTBY \n");
+ MSG_DEBUG("2. invalid MMS_CODE_PREVIOUSLYSENTBY \n");
goto __CATCH;
}
if (__MmsBinaryDecodeEncodedString(pFile, szGarbageBuff, MSG_STDSTR_LONG, totalLength) == false) {
- MSG_DEBUG("MmsBinaryDecodeMsgHeader : invalid MMS_CODE_RETRIEVETEXT \n");
+ MSG_DEBUG("invalid MMS_CODE_RETRIEVETEXT \n");
goto __CATCH;
}
break;
*/
if (__MmsDecodeValueLength(pFile, &valueLength, totalLength) <= 0) {
- MSG_DEBUG("MmsBinaryDecodeMsgHeader : 1. invalid MMS_CODE_PREVIOUSLYSENTDATE \n");
+ MSG_DEBUG("1. invalid MMS_CODE_PREVIOUSLYSENTDATE \n");
goto __CATCH;
}
if (__MmsBinaryDecodeInteger(pFile, &tmpInteger, &tmpIntLen, totalLength) == false) {
- MSG_DEBUG("MmsBinaryDecodeMsgHeader : 2. invalid MS_CODE_PREVIOUSLYSENTDATE \n");
+ MSG_DEBUG("2. invalid MS_CODE_PREVIOUSLYSENTDATE \n");
goto __CATCH;
}
if (__MmsDecodeLongInteger(pFile, (UINT32*)&tmpInteger, totalLength) == false) {
- MSG_DEBUG("MmsBinaryDecodeMsgHeader : 3. invalid MMS_CODE_PREVIOUSLYSENTDATE \n");
+ MSG_DEBUG("3. invalid MMS_CODE_PREVIOUSLYSENTDATE \n");
goto __CATCH;
}
break;
-
default:
/*
oneByte = 0x00;
- offset = _MmsGetDecodeOffset();
+ offset = __MmsGetDecodeOffset();
if (offset >= totalLength)
goto __RETURN;
while ((oneByte < 0x80) && (remainLength > 0)) {
if (__MmsBinaryDecodeCheckAndDecreaseLength(&remainLength, 1) == false) {
- MSG_DEBUG("MmsBinaryDecodeMsgHeader: __MmsBinaryDecodeCheckAndDecreaseLength fail\n");
+ MSG_DEBUG("__MmsBinaryDecodeCheckAndDecreaseLength fail\n");
goto __CATCH;
}
- if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
- MSG_DEBUG("MmsBinaryDecodeMsgHeader: responseStatus GetOneByte fail\n");
+ if (__MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
+ MSG_DEBUG("responseStatus GetOneByte fail\n");
goto __CATCH;
}
}
break;
} /* switch */
- offset = _MmsGetDecodeOffset();
+ offset = __MmsGetDecodeOffset();
if (offset >= totalLength)
goto __RETURN;
free(pLastBcc);
}
- MSG_DEBUG("MmsBinaryDecodeMsgHeader: success\n");
+ MSG_DEBUG("success\n");
return true;
free(pLastBcc);
}
- MSG_DEBUG("MmsBinaryDecodeMsgHeader: failed\n");
+ MSG_DEBUG("failed\n");
return false;
}
-#ifdef FEATURE_JAVA_MMS
-// for JAVA MMS AppId - check later whether it can be handled by MmsBinaryDecodeMsgHeader
-bool MmsBinaryDecodeContentType(FILE *pFile, char *szFilePath, int totalLength)
-{
- int length = 0;
-
- MSG_DEBUG("MmsBinaryDecodeContentType:\n");
-
- if (szFilePath != NULL)
- strncpy(mmsHeader.msgType.szOrgFilePath, szFilePath, strlen(szFilePath));
- mmsHeader.msgType.offset = _MmsGetDecodeOffset() - 1; // + Content-Type code value
-
- // read data(2K) from msg file(/User/Msg/Inbox/5) to gpCurMmsDecodeBuff for decoding
- if (MsgLoadDataToDecodeBuffer(pFile, &gpCurMmsDecodeBuff, &gCurMmsDecodeBuffPos,
- &gMmsDecodeCurOffset, gpMmsDecodeBuf1, gpMmsDecodeBuf2,
- gMmsDecodeMaxLen, &gMmsDecodeBufLen, totalLength) == false) {
- MSG_DEBUG("MmsBinaryDecodeContentType: fail to load to buffer \n");
- goto __CATCH;
- }
-
- // msg's type [ex] related, mixed, single part (jpg, amr and etc)
- length = MmsBinaryDecodeContentType(pFile, &mmsHeader.msgType, totalLength);
- if (length == -1) {
- MSG_DEBUG("MmsBinaryDecodeContentType: MMS_CODE_CONTENTTYPE is fail\n");
- goto __CATCH;
- }
- MSG_DEBUG("Content-Type: Application-ID:%s Reply-To-Application-ID:%s",mmsHeader.msgType.param.szApplicationID, mmsHeader.msgType.param.szReplyToApplicationID);
-
- return true;
-
-__CATCH:
-
- /* fixme: Delete multipart using MmsDeleteMsg() */
-
- return false;
-}
-#endif
-
bool MmsBinaryDecodeMsgBody(FILE *pFile, char *szFilePath, int totalLength)
{
+ MSG_BEGIN();
+
int length = 0;
int offset = 0;
- MSG_DEBUG("MmsBinaryDecodeMsgBody:\n");
-
if (szFilePath != NULL)
strncpy(mmsHeader.msgType.szOrgFilePath, szFilePath , strlen(szFilePath));
- mmsHeader.msgType.offset = _MmsGetDecodeOffset() - 1; // + Content-Type code value
+ mmsHeader.msgType.offset = __MmsGetDecodeOffset() - 1; // + Content-Type code value
// read data(2K) from msg file(/User/Msg/Inbox/5) to gpCurMmsDecodeBuff for decoding
- if (MsgLoadDataToDecodeBuffer(pFile, &gpCurMmsDecodeBuff, &gCurMmsDecodeBuffPos,
+ if (__MsgLoadDataToDecodeBuffer(pFile, &gpCurMmsDecodeBuff, &gCurMmsDecodeBuffPos,
&gMmsDecodeCurOffset, gpMmsDecodeBuf1, gpMmsDecodeBuf2,
gMmsDecodeMaxLen, &gMmsDecodeBufLen, totalLength) == false) {
- MSG_DEBUG("MmsBinaryDecodeMsgBody: fail to load to buffer \n");
+ MSG_DEBUG("fail to load to buffer \n");
goto __CATCH;
}
// msg's type [ex] related, mixed, single part (jpg, amr and etc)
- length = MmsBinaryDecodeContentType(pFile, &mmsHeader.msgType, totalLength);
+ length = __MmsBinaryDecodeContentType(pFile, &mmsHeader.msgType, totalLength);
if (length == -1) {
- MSG_DEBUG("MmsBinaryDecodeMsgBody: MMS_CODE_CONTENTTYPE is fail\n");
+ MSG_DEBUG("MMS_CODE_CONTENTTYPE is fail\n");
goto __CATCH;
}
- mmsHeader.msgType.size = length + 1; // + Content-Type code value
- mmsHeader.msgBody.offset = _MmsGetDecodeOffset();
+ mmsHeader.msgType.size = length + 1; // + Content-Type code value
+ mmsHeader.msgBody.offset = __MmsGetDecodeOffset();
switch (mmsHeader.msgType.type) {
case MIME_APPLICATION_VND_WAP_MULTIPART_MIXED:
case MIME_APPLICATION_VND_OMA_DRM_MESSAGE:
case MIME_APPLICATION_VND_OMA_DRM_CONTENT:
- MSG_DEBUG("__MmsBinaryMsgBodyDecode: Decode multipart\n");
+ MSG_DEBUG("Decode multipart\n");
- offset = _MmsGetDecodeOffset();
+ offset = __MmsGetDecodeOffset();
if (offset >= totalLength)
goto __RETURN;
- if (MmsBinaryDecodeMultipart(pFile, szFilePath, &mmsHeader.msgType, &mmsHeader.msgBody, totalLength) == false) {
- MSG_DEBUG("__MmsBinaryMsgBodyDecode: MmsBinaryDecodeMultipart is fail.\n");
+ if (__MmsBinaryDecodeMultipart(pFile, szFilePath, &mmsHeader.msgType, &mmsHeader.msgBody, totalLength) == false) {
+ MSG_DEBUG("MmsBinaryDecodeMultipart is fail.\n");
goto __CATCH;
}
break;
if (szFilePath != NULL)
strcpy(mmsHeader.msgBody.szOrgFilePath, szFilePath);
- offset = _MmsGetDecodeOffset();
+ offset = __MmsGetDecodeOffset();
if (offset >= totalLength)
goto __RETURN;
- if (MmsBinaryDecodePartBody(pFile, totalLength - mmsHeader.msgBody.offset, totalLength) == false) {
- MSG_DEBUG("__MmsBinaryMsgBodyDecode: MmsBinaryDecodePartBody is fail.(Single Part)\n");
+ if (__MmsBinaryDecodePartBody(pFile, totalLength - mmsHeader.msgBody.offset, totalLength) == false) {
+ MSG_DEBUG("MmsBinaryDecodePartBody is fail.(Single Part)\n");
goto __CATCH;
}
#endif
__RETURN:
-
+ MSG_END();
return true;
__CATCH:
-
return false;
}
-#if MMS_ENABLE_EXTEND_CFM
-// DRM (Extended)CFM
-// Get Extended CFM value.
-static bool __MmsConvertString2Bool(char *pszValue)
-{
- if (!strcasecmp(pszValue, "no"))
- return true;
-
- return false;
-}
-#endif
-
-bool MmsBinaryDecodeParameter(FILE *pFile, MsgType *pMsgType, int valueLength, int totalLength)
+static bool __MmsBinaryDecodeParameter(FILE *pFile, MsgType *pMsgType, int valueLength, int totalLength)
{
UINT8 oneByte = 0;
int charSetLen = 0;
* WAP-230-WSP-20010118-p, Proposed Version 18 January 2001 (pp.107)
*/
- MSG_DEBUG("MmsBinaryDecodeParameter: \n");
+ MSG_BEGIN();
while (valueLength > 0) {
- if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
- MSG_DEBUG("MmsBinaryDecodeContentType: paramCode _MmsBinaryDecodeGetOneByte fail\n");
+ if (__MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
+ MSG_DEBUG("paramCode _MmsBinaryDecodeGetOneByte fail\n");
goto __CATCH;
}
goto __CATCH;
}
- if (MsgCheckFileNameHasInvalidChar(pMsgType->param.szName)) {
- _MsgReplaceInvalidFileNameChar(pMsgType->param.szName, '_');
+ if (__MsgCheckFileNameHasInvalidChar(pMsgType->param.szName)) {
+ __MsgReplaceInvalidFileNameChar(pMsgType->param.szName, '_');
}
if (__MmsBinaryDecodeCheckAndDecreaseLength(&valueLength, length) == false)
goto __CATCH;
}
- if (MsgCheckFileNameHasInvalidChar(pMsgType->param.szFileName)) {
- _MsgReplaceInvalidFileNameChar(pMsgType->param.szFileName, '_');
+ if (__MsgCheckFileNameHasInvalidChar(pMsgType->param.szFileName)) {
+ __MsgReplaceInvalidFileNameChar(pMsgType->param.szFileName, '_');
}
if (__MmsBinaryDecodeCheckAndDecreaseLength(&valueLength, length) == false)
case 0x89: //type = Constrained-encoding = Extension-Media | Short-integer
- if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
- MSG_DEBUG("MmsBinaryDecodeContentType: type _MmsBinaryDecodeGetOneByte fail\n");
+ if (__MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
+ MSG_DEBUG("type _MmsBinaryDecodeGetOneByte fail\n");
goto __CATCH;
}
if (oneByte > 0x7f) {
- pMsgType->param.type = _MmsGetBinaryType(MmsCodeContentType,
+ pMsgType->param.type = MmsGetBinaryType(MmsCodeContentType,
(UINT16)(oneByte & 0x7f));
if (__MmsBinaryDecodeCheckAndDecreaseLength(&valueLength, 1) == false)
goto __RETURN;
textLength = 0;
szTypeString = __MmsBinaryDecodeText2(pFile, totalLength, &textLength);
- pMsgType->param.type = _MmsGetTextType(MmsCodeContentType, szTypeString);
+ pMsgType->param.type = MmsGetTextType(MmsCodeContentType, szTypeString);
if (szTypeString) {
free(szTypeString);
default:
if (paramCode > 0x7F) {
- MSG_DEBUG("MmsBinaryDecodeContentType: Unsupported parameter\n");
+ MSG_DEBUG("Unsupported parameter\n");
// In case of the last byte of Parameter field, it should be returned without decreasing the gCurMmsDecodeBuffPos value.
valueLength++;
/* Text-value */
if (__MmsBinaryDecodeInteger(pFile, &integer, &intLen, totalLength) == true) {
- MSG_DEBUG("MmsBinaryDecodeContentType: Unsupported parameter(%d)\n", integer);
+ MSG_DEBUG("Unsupported parameter(%d)\n", integer);
if (__MmsBinaryDecodeCheckAndDecreaseLength(&valueLength, intLen) == false)
goto __RETURN;
} else {
free(szTypeValue);
szTypeValue = NULL;
- MSG_DEBUG("MmsBinaryDecodeContentType: Unsupported parameter(%s)\n", szTypeValue);
+ MSG_DEBUG("Unsupported parameter(%s)\n", szTypeValue);
if (__MmsBinaryDecodeCheckAndDecreaseLength(&valueLength, textLength) == false)
goto __RETURN;
}
}
if (szTypeString) {
- MSG_DEBUG("MmsBinaryDecodeContentType: Unsupported parameter(%s)\n", szTypeString);
+ MSG_DEBUG("Unsupported parameter(%s)\n", szTypeString);
free(szTypeString);
szTypeString = NULL;
}
return false;
}
-
-
/**
* Decode Encoded Content type
*
* @param pMsgType [out] Decoded MsgType
* @return Decoded address list
*/
-int MmsBinaryDecodeContentType(FILE *pFile, MsgType *pMsgType, int totalLength)
+static int __MmsBinaryDecodeContentType(FILE *pFile, MsgType *pMsgType, int totalLength)
{
UINT8 oneByte = 0;
char *szTypeString = NULL;
* Media-type = (Well-known-media | Extension-Media) *(Parameter)
*/
- MSG_DEBUG("MmsBinaryDecodeContentType: decoding content type..\n");
-
+ MSG_DEBUG("decoding content type..\n");
length = __MmsDecodeValueLength(pFile, (UINT32*)&valueLength, totalLength);
if (length <= 0) {
* Short-integer = OCTET(1xxx xxxx)
*/
- if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
- MSG_DEBUG("MmsBinaryDecodeContentType: Constrained-media _MmsBinaryDecodeGetOneByte fail\n");
+ if (__MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
+ MSG_DEBUG("Constrained-media _MmsBinaryDecodeGetOneByte fail\n");
goto __CATCH;
}
if (oneByte > 0x7F) {
/* Short-integer */
- pMsgType->type = _MmsGetBinaryType(MmsCodeContentType, (UINT16)(oneByte & 0x7F));
+ pMsgType->type = MmsGetBinaryType(MmsCodeContentType, (UINT16)(oneByte & 0x7F));
length = 1;
} else {
char *pszTemp = NULL;
szTypeString = __MmsBinaryDecodeText2(pFile, totalLength, &textLength);
if (szTypeString && (strchr(szTypeString, ';')) != NULL) {
- pszTemp = _MsgGetStringUntilDelimiter(szTypeString, ';');
+ pszTemp = __MsgGetStringUntilDelimiter(szTypeString, ';');
if (pszTemp) {
free(szTypeString);
szTypeString = pszTemp;
}
}
- pMsgType->type = _MmsGetTextType(MmsCodeContentType, szTypeString);
+ pMsgType->type = MmsGetTextType(MmsCodeContentType, szTypeString);
length = textLength;
length += valueLength;
- if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
- MSG_DEBUG("MmsBinaryDecodeContentType: Well-known-media _MmsBinaryDecodeGetOneByte fail\n");
+ if (__MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
+ MSG_DEBUG("Well-known-media _MmsBinaryDecodeGetOneByte fail\n");
goto __CATCH;
}
if (oneByte > 0x7F) {
/* Well-known-media */
- pMsgType->type = _MmsGetBinaryType(MmsCodeContentType, (UINT16)(oneByte & 0x7F));
+ pMsgType->type = MmsGetBinaryType(MmsCodeContentType, (UINT16)(oneByte & 0x7F));
valueLength--;
} else {
/* Extension-Media */
textLength = 0;
szTypeString = __MmsBinaryDecodeText2(pFile, totalLength, &textLength);
- pMsgType->type = _MmsGetTextType(MmsCodeContentType, szTypeString);
+ pMsgType->type = MmsGetTextType(MmsCodeContentType, szTypeString);
valueLength -= textLength;
if (szTypeString) {
}
}
- MSG_DEBUG("MmsBinaryDecodeContentType: content type=%s\n", MmsDebugGetMimeType((MimeType)pMsgType->type));
+ MSG_DEBUG("content type=%s\n", MmsDebugGetMimeType((MimeType)pMsgType->type));
- if (MmsBinaryDecodeParameter(pFile, pMsgType, valueLength, totalLength) == false) {
- MSG_DEBUG("MmsBinaryDecodeContentType: Content-Type parameter fail\n");
+ if (__MmsBinaryDecodeParameter(pFile, pMsgType, valueLength, totalLength) == false) {
+ MSG_DEBUG("Content-Type parameter fail\n");
goto __CATCH;
}
}
return -1;
}
-
-bool MmsBinaryDecodePartHeader(FILE *pFile, MsgType *pMsgType, int headerLen, int totalLength)
+static bool __MmsBinaryDecodePartHeader(FILE *pFile, MsgType *pMsgType, int headerLen, int totalLength)
{
UINT8 fieldCode = 0xff;
int length = 0;
*/
while (headerLen > 0) {
- if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
- MSG_DEBUG("MmsBinaryDecodePartHeader: field code GetOneByte fail\n");
+ if (__MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
+ MSG_DEBUG("field code GetOneByte fail\n");
goto __CATCH;
}
textLength = strlen(pLatinBuff);
- if (MsgLatin2UTF ((unsigned char*)pMsgType->szContentLocation, MMS_CONTENT_ID_LEN + 1, (unsigned char*)pLatinBuff, textLength) < 0) {
- MSG_DEBUG("MmsBinaryDecodePartHeader: MsgLatin2UTF fail \n");
+ if (__MsgLatin2UTF ((unsigned char*)pMsgType->szContentLocation, MMS_CONTENT_ID_LEN + 1, (unsigned char*)pLatinBuff, textLength) < 0) {
+ MSG_DEBUG("MsgLatin2UTF fail \n");
goto __CATCH;
}
}
textLength = strlen(pLatinBuff);
- if (MsgLatin2UTF ((unsigned char*)pMsgType->szContentID, MMS_CONTENT_ID_LEN + 1, (unsigned char*)pLatinBuff, textLength) < 0) {
- MSG_DEBUG("MmsBinaryDecodePartHeader: MsgLatin2UTF fail \n");
+ if (__MsgLatin2UTF ((unsigned char*)pMsgType->szContentID, MMS_CONTENT_ID_LEN + 1, (unsigned char*)pLatinBuff, textLength) < 0) {
+ MSG_DEBUG("MsgLatin2UTF fail \n");
goto __CATCH;
}
free(pLatinBuff);
}
- if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
- MSG_DEBUG("MmsBinaryDecodePartHeader: Disposition value GetOneByte fail\n");
+ if (__MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
+ MSG_DEBUG("Disposition value GetOneByte fail\n");
goto __CATCH;
}
valueLength--;
if (oneByte >= 0x80) {
- pMsgType->disposition = _MmsGetBinaryType(MmsCodeMsgDisposition, (UINT16)(oneByte & 0x7F));
+ pMsgType->disposition = MmsGetBinaryType(MmsCodeMsgDisposition, (UINT16)(oneByte & 0x7F));
if (pMsgType->disposition == INVALID_HOBJ) {
- MSG_DEBUG("MmsBinaryDecodePartHeader : Content-Disposition _MmsGetBinaryType fail.\n");
+ MSG_DEBUG("MmsBinaryDecodePartHeader : Content-Disposition MmsGetBinaryType fail.\n");
pMsgType->disposition = MSG_DISPOSITION_ATTACHMENT; // default
}
if (__MmsBinaryDecodeCheckAndDecreaseLength(&headerLen, 1) == false)
goto __RETURN;
- if (MmsBinaryDecodeParameter(pFile, pMsgType, valueLength, totalLength) == false) {
- MSG_DEBUG("MmsBinaryDecodePartHeader: Disposition parameter fail\n");
+ if (__MmsBinaryDecodeParameter(pFile, pMsgType, valueLength, totalLength) == false) {
+ MSG_DEBUG("Disposition parameter fail\n");
goto __CATCH;
}
valueLength -= textLength;
- if (MmsBinaryDecodeParameter(pFile, pMsgType, valueLength, totalLength) == false)
+ if (__MmsBinaryDecodeParameter(pFile, pMsgType, valueLength, totalLength) == false)
{
- MSG_DEBUG("MmsBinaryDecodePartHeader: Disposition parameter fail\n");
+ MSG_DEBUG("Disposition parameter fail\n");
goto __CATCH;
}
case 0x0B: //Content-Encoding
- if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
- MSG_DEBUG("MmsBinaryDecodePartHeader: Disposition value GetOneByte fail\n");
+ if (__MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
+ MSG_DEBUG("Disposition value GetOneByte fail\n");
goto __CATCH;
}
}
if (charset > 0)
- _MmsGetBinaryType(MmsCodeCharSet, (UINT16)charset);
+ MmsGetBinaryType(MmsCodeCharSet, (UINT16)charset);
if (__MmsBinaryDecodeCheckAndDecreaseLength(&headerLen, charSetLen) == false)
goto __RETURN;
if (szTemp == NULL)
goto __CATCH;
- if (_MmsBinaryDecodeGetBytes(pFile, szTemp, valueLength, totalLength) == false) {
+ if (__MmsBinaryDecodeGetBytes(pFile, szTemp, valueLength, totalLength) == false) {
MSG_DEBUG("MmsBinaryDecodePartHeader : default _MmsBinaryDecodeGetBytes() fail\n");
if (szTemp) {
free(szTemp);
* Application-specific-value = Text-string
*/
- MSG_DEBUG(" MmsBinaryDecodePartHeader: Application-header = Token-text Application-specific-value \n");
+ MSG_DEBUG(" Application-header = Token-text Application-specific-value \n");
gCurMmsDecodeBuffPos--;
textLength = 0;
pCode = __MmsBinaryDecodeText2(pFile, totalLength, &textLength);
if (pCode == NULL) {
- MSG_DEBUG("MmsBinaryDecodePartHeader: pCode is null\n");
+ MSG_DEBUG("pCode is null\n");
goto __CATCH;
}
if (__MmsBinaryDecodeCheckAndDecreaseLength(&headerLen, textLength) == false)
goto __RETURN;
- MSG_DEBUG(" MmsBinaryDecodePartHeader: Token-text (%s) \n", pCode);
+ MSG_DEBUG(" Token-text (%s) \n", pCode);
/* Application-specific-value */
textLength = 0;
pValue = __MmsBinaryDecodeText2(pFile, totalLength, &textLength);
if (pValue == NULL) {
- MSG_DEBUG("MmsBinaryDecodePartHeader: pValue is null\n");
+ MSG_DEBUG("pValue is null\n");
goto __CATCH;
}
- MSG_DEBUG(" MmsBinaryDecodePartHeader: Application-specific-value (%s) \n", pValue);
+ MSG_DEBUG(" Application-specific-value (%s) \n", pValue);
pParam = strchr(pValue, MSG_CH_ADDR_DELIMETER);
*pParam = '\0';
}
- switch (_MmsGetTextType(MmsCodeMsgBodyHeaderCode, pCode)) {
+ switch (MmsGetTextType(MmsCodeMsgBodyHeaderCode, pCode)) {
case MMS_BODYHDR_TRANSFERENCODING: // Content-Transfer-Encoding
- pMsgType->encoding = _MmsGetTextType(MmsCodeContentTransferEncoding, pValue);
+ pMsgType->encoding = MmsGetTextType(MmsCodeContentTransferEncoding, pValue);
break;
case MMS_BODYHDR_CONTENTID: // Content-ID
goto __CATCH;
}
- MsgMIMERemoveQuote (pValue);
+ __MsgMIMERemoveQuote (pValue);
strncpy(pLatinBuff, pValue, MMS_MSG_ID_LEN);
length = strlen(pLatinBuff);
- if (MsgLatin2UTF ((unsigned char*)pMsgType->szContentID, MMS_CONTENT_ID_LEN + 1, (unsigned char*)pLatinBuff, length) < 0)
+ if (__MsgLatin2UTF ((unsigned char*)pMsgType->szContentID, MMS_CONTENT_ID_LEN + 1, (unsigned char*)pLatinBuff, length) < 0)
{
- MSG_DEBUG("MmsBinaryDecodePartHeader: MsgLatin2UTF fail \n");
+ MSG_DEBUG("MsgLatin2UTF fail \n");
goto __CATCH;
}
strncpy(pLatinBuff, pValue, MMS_MSG_ID_LEN);
length = strlen(pLatinBuff);
- if (MsgLatin2UTF ((unsigned char*)pMsgType->szContentLocation, MMS_CONTENT_ID_LEN + 1, (unsigned char*)pLatinBuff, length) < 0) {
- MSG_DEBUG("MmsBinaryDecodePartHeader: MsgLatin2UTF fail \n");
+ if (__MsgLatin2UTF ((unsigned char*)pMsgType->szContentLocation, MMS_CONTENT_ID_LEN + 1, (unsigned char*)pLatinBuff, length) < 0) {
+ MSG_DEBUG("MsgLatin2UTF fail \n");
goto __CATCH;
}
break;
case MMS_BODYHDR_DISPOSITION: // Content-Disposition
- pMsgType->disposition = _MmsGetTextType(MmsCodeMsgDisposition, pValue);
+ pMsgType->disposition = MmsGetTextType(MmsCodeMsgDisposition, pValue);
break;
case MMS_BODYHDR_X_OMA_DRM_SEPARATE_DELIVERY: // DRM RO WAITING
}
if (pParam) {
- _MsgParseParameter(pMsgType, pParam + 1);
+ __MsgParseParameter(pMsgType, pParam + 1);
*pParam = ch;
}
if (pCode) {
return false;
}
-
-bool MmsBinaryDecodeEntries(FILE *pFile, UINT32 *npEntries, int totalLength)
+static bool __MmsBinaryDecodeEntries(FILE *pFile, UINT32 *npEntries, int totalLength)
{
int length = 0;
goto __CATCH;
}
- MSG_DEBUG("MmsBinaryDecodeEntries: Number of Entries = %d\n", *npEntries);
+ MSG_DEBUG("Number of Entries = %d\n", *npEntries);
return true;
return false;
}
-
-
-bool MmsBinaryDecodePartBody(FILE *pFile, UINT32 bodyLength, int totalLength)
+static bool __MmsBinaryDecodePartBody(FILE *pFile, UINT32 bodyLength, int totalLength)
{
int offset = 0;
* the only information used with msgBody.
* If you need, add here more information
*/
+ MSG_BEGIN();
- MSG_DEBUG("MmsBinaryDecodePartBody: \n");
-
- offset = _MmsGetDecodeOffset();
+ offset = __MmsGetDecodeOffset();
offset += bodyLength;
if (MsgFseek(pFile, offset, SEEK_SET) < 0) {
- MSG_DEBUG("MmsBinaryDecodePartBody: fail to seek file pointer \n");
+ MSG_DEBUG("fail to seek file pointer \n");
goto __CATCH;
}
- _MmsCleanDecodeBuff();
+ __MmsCleanDecodeBuff();
gMmsDecodeCurOffset = offset;
if (offset >= totalLength)
goto __RETURN;
- if (MsgLoadDataToDecodeBuffer(pFile, &gpCurMmsDecodeBuff, &gCurMmsDecodeBuffPos, &gMmsDecodeCurOffset,
+ if (__MsgLoadDataToDecodeBuffer(pFile, &gpCurMmsDecodeBuff, &gCurMmsDecodeBuffPos, &gMmsDecodeCurOffset,
gpMmsDecodeBuf1, gpMmsDecodeBuf2, gMmsDecodeMaxLen, &gMmsDecodeBufLen, totalLength) == false) {
- MSG_DEBUG("_MmsBinaryDecodeGetOneByte: fail to load to buffer \n");
+ MSG_DEBUG("fail to load to buffer \n");
goto __CATCH;
}
return false;
}
-
-static bool MmsBinaryDecodeMovePointer(FILE *pFile, int offset, int totalLength)
+static bool __MmsBinaryDecodeMovePointer(FILE *pFile, int offset, int totalLength)
{
if (offset > totalLength)
goto __RETURN;
if (MsgFseek(pFile, offset, SEEK_SET) < 0) {
- MSG_DEBUG("MmsBinaryDecodeMovePointer: fail to seek file pointer \n");
+ MSG_DEBUG("fail to seek file pointer \n");
goto __CATCH;
}
- _MmsCleanDecodeBuff();
+ __MmsCleanDecodeBuff();
gMmsDecodeCurOffset = offset;
if (offset == totalLength)
goto __RETURN;
- if (MsgLoadDataToDecodeBuffer(pFile, &gpCurMmsDecodeBuff, &gCurMmsDecodeBuffPos, &gMmsDecodeCurOffset,
+ if (__MsgLoadDataToDecodeBuffer(pFile, &gpCurMmsDecodeBuff, &gCurMmsDecodeBuffPos, &gMmsDecodeCurOffset,
gpMmsDecodeBuf1, gpMmsDecodeBuf2, gMmsDecodeMaxLen, &gMmsDecodeBufLen, totalLength) == false) {
- MSG_DEBUG("MmsBinaryDecodeMovePointer: fail to load to buffer \n");
+ MSG_DEBUG("fail to load to buffer \n");
goto __CATCH;
}
return false;
}
-
-bool MmsBinaryIsTextEncodedPart(FILE *pFile, int totalLength)
-{
- UINT8 oneByte = 0;
- int byteCount = 0;
-
- byteCount++; //check 0x0D
-
- if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false)
- goto __CATCH;
-
- if (oneByte != 0x0D) {
- //it can be started "--" without 0x0D 0x0A
- if (oneByte != 0x2D) {
- goto __CATCH;
- } else {
- byteCount++; // check 0x2D ('-')
- if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false)
- goto __CATCH;
-
- if (oneByte != 0x2D) {
- goto __CATCH;
- } else {
- goto __RETURN;
- }
- }
- } else {
- byteCount++; //check 0x0A
- if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false)
- goto __CATCH;
-
- if (oneByte != 0x0A) {
- goto __CATCH;
- } else {
- byteCount++; // check 0x2D ('-')
- if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false)
- goto __CATCH;
-
- if (oneByte != 0x2D) {
- goto __CATCH;
- } else {
- byteCount++; // check 0x2D ('-')
- if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false)
- goto __CATCH;
-
- if (oneByte != 0x2D) {
- goto __CATCH;
- } else {
- goto __RETURN;
- }
- }
- }
- }
-
-__RETURN:
- gCurMmsDecodeBuffPos -= byteCount;
- return true;
-
-__CATCH:
- gCurMmsDecodeBuffPos -= byteCount;
- return false;
-}
-
-
-bool MmsBinaryDecodeMultipart(FILE *pFile, char *szFilePath, MsgType *pMsgType, MsgBody *pMsgBody, int totalLength)
+static bool __MmsBinaryDecodeMultipart(FILE *pFile, char *szFilePath, MsgType *pMsgType, MsgBody *pMsgBody, int totalLength)
{
UINT32 nEntries = 0;
MsgMultipart *pMultipart = NULL;
MsgPresentationFactor factor = MSG_PRESENTATION_NONE;
MsgPresentaionInfo presentationInfo;
- MSG_DEBUG("MmsBinaryDecodeMultipart: total length=%d\n", totalLength);
+ MSG_DEBUG("total length=%d\n", totalLength);
presentationInfo.factor = MSG_PRESENTATION_NONE;
presentationInfo.pCurPresentation = NULL;
presentationInfo.pPrevPart = NULL;
- if (MmsBinaryDecodeEntries(pFile, &nEntries, totalLength) == false) {
- MSG_DEBUG("MmsBinaryDecodeMultipart: MmsBinaryDecodeEntries is fail.\n");
+ if (__MmsBinaryDecodeEntries(pFile, &nEntries, totalLength) == false) {
+ MSG_DEBUG("MmsBinaryDecodeEntries is fail.\n");
goto __CATCH;
}
while (nEntries) {
- MSG_DEBUG("MmsBinaryDecodeMultipart: decoding %dth multipart\n", index);
+ MSG_DEBUG("decoding %dth multipart\n", index);
- offset = _MmsGetDecodeOffset();
+ offset = __MmsGetDecodeOffset();
if (offset >= totalLength)
goto __RETURN;
- if ((pMultipart = MsgAllocMultipart()) == NULL) {
- MSG_DEBUG("MmsBinaryDecodeMultipart: MsgAllocMultipart Fail \n");
+ if ((pMultipart = __MsgAllocMultipart()) == NULL) {
+ MSG_DEBUG("MsgAllocMultipart Fail \n");
goto __CATCH;
}
- if (MmsBinaryDecodeEachPart(pFile, szFilePath, &(pMultipart->type), pMultipart->pBody, totalLength) == false) {
- MSG_DEBUG("MmsBinaryDecodeMultipart: MmsBinaryDecodeEachPart is fail.(nEntries = %d)\n", nEntries);
+ if (__MmsBinaryDecodeEachPart(pFile, szFilePath, &(pMultipart->type), pMultipart->pBody, totalLength) == false) {
+ MSG_DEBUG("MmsBinaryDecodeEachPart is fail.(nEntries = %d)\n", nEntries);
goto __CATCH;
}
if (pMsgType->param.type == MIME_APPLICATION_SMIL) {
- factor = MsgIsPresentationEx(&(pMultipart->type), pMsgType->param.szStart, (MimeType)pMsgType->param.type);
+ factor = __MsgIsPresentationEx(&(pMultipart->type), pMsgType->param.szStart, (MimeType)pMsgType->param.type);
} else {
factor = MSG_PRESENTATION_NONE;
}
nEntries--;
- MmsDebugPrintMulitpartEntry(pMultipart, index++);
+ __MmsDebugPrintMulitpartEntry(pMultipart, index++);
}
#ifdef __SUPPORT_DRM__
if (MmsDrm2GetConvertState() != MMS_DRM2_CONVERT_REQUIRED)
#endif
- MsgConfirmPresentationPart(pMsgType, pMsgBody, &presentationInfo);
+ __MsgConfirmPresentationPart(pMsgType, pMsgBody, &presentationInfo);
- if (MsgResolveNestedMultipart(pMsgType, pMsgBody) == false) {
+ if (__MsgResolveNestedMultipart(pMsgType, pMsgBody) == false) {
MSG_DEBUG("MmsBinaryDecodeMultipart : MsgResolveNestedMultipart failed \n");
goto __CATCH;
}
return false;
}
-
-bool MmsBinaryDecodeEachPart(FILE *pFile, char *szFilePath, MsgType *pMsgType, MsgBody *pMsgBody, int totalLength)
+static bool __MmsBinaryDecodeEachPart(FILE *pFile, char *szFilePath, MsgType *pMsgType, MsgBody *pMsgBody, int totalLength)
{
int length = 0;
bool bSuccess = false;
goto __CATCH;
}
- offset = _MmsGetDecodeOffset();
+ offset = __MmsGetDecodeOffset();
if (offset >= totalLength)
goto __RETURN;
}
- offset = _MmsGetDecodeOffset();
+ offset = __MmsGetDecodeOffset();
if (offset >= totalLength)
goto __RETURN;
if (szFilePath != NULL)
strncpy(pMsgType->szOrgFilePath, szFilePath, strlen(szFilePath));
- pMsgType->offset = _MmsGetDecodeOffset();
+ pMsgType->offset = __MmsGetDecodeOffset();
pMsgType->size = headerLength;
pMsgType->contentSize = bodyLength;
if (pMsgType->offset > totalLength)
goto __RETURN;
- length = MmsBinaryDecodeContentType(pFile, pMsgType, totalLength);
+ length = __MmsBinaryDecodeContentType(pFile, pMsgType, totalLength);
if (length <= 0) {
MSG_DEBUG("MmsBinaryDecodeEachPart: Decode contentType Fail \n");
goto __CATCH;
}
- offset = _MmsGetDecodeOffset();
+ offset = __MmsGetDecodeOffset();
if (offset >= totalLength)
goto __RETURN;
/* Part Header */
- if (MmsBinaryDecodePartHeader(pFile, pMsgType, headerLength - length, totalLength) == false) {
+ if (__MmsBinaryDecodePartHeader(pFile, pMsgType, headerLength - length, totalLength) == false) {
MSG_DEBUG("MmsBinaryDecodeEachPart: Decode contentHeader Fail \n");
goto __CATCH;
}
- offset = _MmsGetDecodeOffset();
+ offset = __MmsGetDecodeOffset();
if (offset >= totalLength)
goto __RETURN;
if (szFilePath != NULL)
strncpy(pMsgBody->szOrgFilePath, szFilePath, strlen(szFilePath));
- pMsgBody->offset = _MmsGetDecodeOffset();
+ pMsgBody->offset = __MmsGetDecodeOffset();
pMsgBody->size = bodyLength;
if (pMsgBody->offset > totalLength)
MSG_DEBUG("MmsBinaryDecodeEachPart: Decode multipart\n");
- if (MmsBinaryDecodeMultipart(pFile, szFilePath, pMsgType, pMsgBody, totalLength) == false) {
+ if (__MmsBinaryDecodeMultipart(pFile, szFilePath, pMsgType, pMsgBody, totalLength) == false) {
MSG_DEBUG("MmsBinaryDecodeEachPart: MmsBinaryDecodeMultipart is fail.\n");
goto __CATCH;
}
- offset = _MmsGetDecodeOffset();
+ offset = __MmsGetDecodeOffset();
if (offset >= totalLength)
goto __RETURN;
if (MmsDrm2GetConvertState() != MMS_DRM2_CONVERT_NOT_FIXED && MmsDrm2GetConvertState() != MMS_DRM2_CONVERT_REQUIRED) {
- if (MmsBinaryDecodeDRMContent(pFile, szFilePath, pMsgType, pMsgBody, bodyLength, totalLength) == false)
+ if (__MmsBinaryDecodeDRMContent(pFile, szFilePath, pMsgType, pMsgBody, bodyLength, totalLength) == false)
goto __CATCH;
} else {
MmsDrm2SetConvertState(MMS_DRM2_CONVERT_REQUIRED);
- bSuccess = MmsBinaryDecodePartBody(pFile, bodyLength, totalLength);
+ bSuccess = __MmsBinaryDecodePartBody(pFile, bodyLength, totalLength);
if (bSuccess == false) {
MSG_DEBUG("MmsBinaryDecodeEachPart: Decode contentBody Fail \n");
goto __CATCH;
}
}
- offset = _MmsGetDecodeOffset();
+ offset = __MmsGetDecodeOffset();
if (offset >= totalLength)
goto __RETURN;
MSG_DEBUG("MmsBinaryDecodeEachPart: MIME_APPLICATION_VND_OMA_DRM_CONTENT Part \n");
- if (MmsBinaryDecodeDRMContent(pFile, szFilePath, pMsgType, pMsgBody, bodyLength, totalLength) == false)
+ if (__MmsBinaryDecodeDRMContent(pFile, szFilePath, pMsgType, pMsgBody, bodyLength, totalLength) == false)
goto __CATCH;
- offset = _MmsGetDecodeOffset();
+ offset = __MmsGetDecodeOffset();
if (offset >= totalLength)
goto __RETURN;
default:
MSG_DEBUG("MmsBinaryDecodeEachPart: Other normal Part \n");
- bSuccess = MmsBinaryDecodePartBody(pFile, bodyLength, totalLength);
+ bSuccess = __MmsBinaryDecodePartBody(pFile, bodyLength, totalLength);
if (bSuccess == false) {
MSG_DEBUG("MmsBinaryDecodeEachPart: Decode contentBody Fail \n");
goto __CATCH;
}
- offset = _MmsGetDecodeOffset();
+ offset = __MmsGetDecodeOffset();
if (offset >= totalLength)
goto __RETURN;
}
#ifdef __SUPPORT_DRM__
-bool __MmsParseDCFInfo(FILE *pFile, MsgDRMInfo *pDrmInfo, int totalLength)
-{
- UINT8 version = 0;
- UINT8 contentTypeLen = 0;
- UINT8 contentURILen = 0;
- char *szContentType = NULL;
- char *szContentURI = NULL;
-
- if (_MmsBinaryDecodeGetOneByte(pFile, &version, totalLength) == false) {
- MSG_DEBUG("__MmsParseDCFInfo: [version] GetOneByte fail\n");
- goto __CATCH;
- }
-
- if (_MmsBinaryDecodeGetOneByte(pFile, &contentTypeLen, totalLength) == false) {
- MSG_DEBUG("__MmsParseDCFInfo: [contentTypeLen] GetOneByte fail\n");
- goto __CATCH;
- }
-
- if (_MmsBinaryDecodeGetOneByte(pFile, &contentURILen, totalLength) == false) {
- MSG_DEBUG("__MmsParseDCFInfo: [contentURILen] GetOneByte fail\n");
- goto __CATCH;
- }
-
- //Get media content-type (mime-type)
- szContentType = (char *)malloc(contentTypeLen + 1);
- if (szContentType == NULL)
- goto __CATCH;
-
- memset(szContentType, 0, contentTypeLen + 1);
-
- if (_MmsBinaryDecodeGetBytes(pFile, szContentType, contentTypeLen + 1, totalLength) < 0) {
- MSG_DEBUG("__MmsParseDCFInfo : contentType is invalid\n");
- goto __CATCH;
- }
- gCurMmsDecodeBuffPos--;
- pDrmInfo->contentType = (MsgContentType)_MsgGetCode(MSG_TYPE, szContentType);
-
-
- //Get content-ID - 1.remover "cid:", 2.resolve "%hexa", 3.and copy the string
- szContentURI = (char *)malloc(contentURILen + 1);
- if (szContentURI == NULL)
- goto __CATCH;
-
- memset(szContentURI, 0, contentURILen + 1);
-
- if (_MmsBinaryDecodeGetBytes(pFile, szContentURI, contentURILen + 1, totalLength) == false) {
- MSG_DEBUG("__MmsParseDCFInfo : contentType is invalid\n");
- goto __CATCH;
- }
- gCurMmsDecodeBuffPos--;
- pDrmInfo->szContentURI = MsgResolveContentURI(szContentURI);
-
-
- if (szContentType) {
- free(szContentType);
- szContentType = NULL;
- }
-
- if (szContentURI) {
- free(szContentURI);
- szContentURI = NULL;
- }
- return true;
-
-
-__CATCH:
-
- if (szContentType) {
- free(szContentType);
- szContentType = NULL;
- }
-
- if (szContentURI) {
- free(szContentURI);
- szContentURI = NULL;
- }
- return false;
-
-}
-
-
-bool __MmsParseDCFHdr(FILE *pFile, MsgDRMInfo *pDrmInfo, UINT32 headerLen, int totalLength)
-{
- char *szDCFHdr = NULL;
- MsgType partType;
- ULONG nRead = 0;
- int offset = 0;
-
- /* add to parse DCF header such as,
- * Right-Issuer, Content-Name, and Content-Description.
- */
-
- szDCFHdr = (char *)malloc(headerLen + 1);
- if (szDCFHdr == NULL) {
- MSG_DEBUG("__MmsParseDCFHdr: szDCFHdr alloc fail\n");
- goto __CATCH;
- }
- memset(szDCFHdr, 0, headerLen + 1);
-
- offset = _MmsGetDecodeOffset();
- if (offset >= totalLength)
- goto __RETURN;
-
- if (MsgFseek(pFile, offset, SEEK_SET) < 0)
- goto __CATCH;
-
- if ((nRead = MsgReadFile(szDCFHdr, sizeof(char), headerLen, pFile)) == 0){
- goto __CATCH;
- }
- szDCFHdr[nRead] = '\0';
-
- _MsgInitMsgType(&partType);
- _MsgParsePartHeader(&partType, szDCFHdr, headerLen);
-
- pDrmInfo->szContentName = partType.drmInfo.szContentName;
- pDrmInfo->szContentVendor = partType.drmInfo.szContentVendor;
- pDrmInfo->szContentDescription = partType.drmInfo.szContentDescription;
- pDrmInfo->szRightIssuer = partType.drmInfo.szRightIssuer;
-
- if (MmsBinaryDecodeMovePointer(pFile, offset + headerLen, totalLength) == false)
- goto __CATCH;
-
-__RETURN:
-
- if (szDCFHdr) {
- free(szDCFHdr);
- szDCFHdr = NULL;
- }
-
- return true;
-
-__CATCH:
-
- if (szDCFHdr) {
- free(szDCFHdr);
- szDCFHdr = NULL;
- }
-
- return false;
-}
-
-
-bool MmsBinaryDecodeDRMContent(FILE *pFile, char *szFilePath, MsgType *pMsgType, MsgBody *pMsgBody, unsigned int bodyLength, int totalLength)
+static bool __MmsBinaryDecodeDRMContent(FILE *pFile, char *szFilePath, MsgType *pMsgType, MsgBody *pMsgBody, unsigned int bodyLength, int totalLength)
{
int offset = 0;
char szTempFilePath[MSG_FILEPATH_LEN_MAX] = MSG_DATA_PATH"drm.dcf";
MSG_DEBUG("bodyLength: %d\n", bodyLength);
- offset = _MmsGetDecodeOffset();
+ offset = __MmsGetDecodeOffset();
if (offset >= totalLength)
goto __RETURN;
remove(szTempFilePath);
isFileCreated = false;
- if (MmsBinaryDecodeMovePointer(pFile, offset + bodyLength, totalLength) == false)
+ if (__MmsBinaryDecodeMovePointer(pFile, offset + bodyLength, totalLength) == false)
goto __CATCH;
__RETURN:
return false;
}
-
-bool MmsBinaryDecodeDRMMessage(FILE *pFile, char *szFilePath, MsgType *pMsgType, MsgBody *pMsgBody, unsigned int fullBodyLength, int totalLength)
-{
- int offset = 0;
- char szTempFilePath[MSG_FILEPATH_LEN_MAX] = "/User/Msg/Mms/Temp/drm.dm";
- char *pRawData = NULL;
- bool isFileCreated = false;
-
- offset = _MmsGetDecodeOffset();
- if (offset >= totalLength)
- goto __RETURN;
-
- if (szFilePath != NULL)
- strncpy(pMsgBody->szOrgFilePath, szFilePath, strlen(szFilePath));
- if (szFilePath != NULL)
- strncpy(pMsgType->szOrgFilePath, szFilePath, strlen(szFilePath));
-
- pRawData = (char *)malloc(fullBodyLength);
- if (pRawData == NULL) {
- MSG_DEBUG("pRawData alloc FAIL \n");
- goto __CATCH;
- }
-
- if (MsgFseek(pFile, offset, SEEK_SET) < 0) {
- MSG_DEBUG("MsgFseek() returns -1 \n");
- goto __CATCH;
- }
-
- if (MsgReadFile(pRawData, sizeof(char), fullBodyLength, pFile)!= (size_t)fullBodyLength) {
- MSG_DEBUG("FmReadFile() returns false \n");
- goto __CATCH;
- }
-
- if (MsgOpenCreateAndOverwriteFile(szTempFilePath, pRawData, fullBodyLength) == false) {
- MSG_DEBUG("MsgOpenCreateAndOverwriteFile() returns false \n");
- goto __CATCH;
- }
- isFileCreated = true;
-
- if (strstr(szTempFilePath, ".dm")) {
- char szConvertedFilePath[MSG_FILEPATH_LEN_MAX] = {0,};
-
- if (MsgDrmConvertDmtoDcfType(szTempFilePath, szConvertedFilePath)) {
- remove(szTempFilePath);
- memset(szTempFilePath, 0, MSG_FILEPATH_LEN_MAX);
- strncpy(szTempFilePath, szConvertedFilePath, MSG_FILEPATH_LEN_MAX-1);
- }
- }
-
- if (MsgDRM2GetDRMInfo(szTempFilePath, pMsgType) == false) {
- MSG_DEBUG("MsgDRM2GetDRMInfo() returns false \n");
- goto __CATCH;
- }
-
- if (remove(szTempFilePath) != 0)
- MSG_DEBUG("remove fail");
-
- isFileCreated = false;
-
- if (MmsBinaryDecodeMovePointer(pFile, offset + fullBodyLength, totalLength) == false)
- goto __CATCH;
-
-__RETURN:
-
- if (pRawData) {
- free(pRawData);
- pRawData = NULL;
- }
- return true;
-
-__CATCH:
- if (isFileCreated) {
- if (remove(szTempFilePath) != 0)
- MSG_DEBUG("remove fail");
- }
- if (pRawData) {
- free(pRawData);
- pRawData = NULL;
- }
- return false;
-}
-
static int __MmsDrm2BinaryEncodeUintvarLen(UINT32 integer)
{
UINT32 length = 0;
return length;
}
-
static bool __MmsDrm2BinaryEncodeUintvar(UINT32 integer, int length, char *pszOutput)
{
const char ZERO = 0x00;
return true;
}
-
static int __MmsDrm2GetEntriesValueLength(FILE *pFile, int orgOffset)
{
char szEntries[5] = {0, };
return j;
}
-
static bool __MmsDrm2WriteDataToConvertedFile(FILE *pSrcFile, FILE *pDestinationFile, char *pszMmsLoadTempBuf, int length, int bufLen)
{
int loadLen = 0, totalLoadLen = 0, nRead = 0;
return true;
}
-
/*************************************************************************
* description : make new message file converting CD & FL part of original message file to SD type
* argument : void
return false;
}
-
/*************************************************************************
* description : Function for decoding a converted file
* argument : void
* return value
- bool : result of converting
**************************************************************************/
-bool MmsDrm2DecodeConvertedMsg(int msgID, char *pszFullPath)
-{
- FILE *hConvertedFile = NULL;
- int nSize = 0;
-
- MSG_DEBUG("MmsDrm2DecodeConvertedMsg: start re-decoding~~~~~~\n");
-
- // free
- _MsgFreeDRMInfo(&mmsHeader.msgType.drmInfo);
- _MsgFreeBody(&mmsHeader.msgBody, mmsHeader.msgType.type);
-
- _MmsInitHeader();
- _MmsUnregisterDecodeBuffer();
-
- // start decoding
- _MmsRegisterDecodeBuffer(gszMmsLoadBuf1, gszMmsLoadBuf2, MSG_MMS_DECODE_BUFFER_MAX);
-
- // open converted file
- if ((hConvertedFile = MsgOpenFile(MMS_DECODE_DRM_CONVERTED_TEMP_FILE, "rb")) == NULL) {
- MSG_DEBUG("MmsDrm2ReDecodeMsg: opening temporary file failed\n");
- goto __CATCH;
- }
-
- if (MsgGetFileSize(MMS_DECODE_DRM_CONVERTED_TEMP_FILE, &nSize) == false) {
- MSG_DEBUG("MsgGetFileSize: failed\n");
- goto __CATCH;
- }
-
- if (!MmsBinaryDecodeMsgHeader(hConvertedFile, nSize)) {
- MSG_DEBUG("MmsDrm2ReDecodeMsg: decoding header(binary mode) failed\n");
- goto __CATCH;
- }
-
- if (!MmsBinaryDecodeMsgBody(hConvertedFile, pszFullPath, nSize)) {
- MSG_DEBUG("MmsDrm2ReDecodeMsg: decoding body failed\n");
- goto __CATCH;
- }
-
- if (hConvertedFile != NULL) {
- MsgCloseFile(hConvertedFile);
- hConvertedFile = NULL;
- }
-
- return true;
-
-__CATCH:
-
- if (hConvertedFile != NULL) {
- MsgCloseFile(hConvertedFile);
-
- if (remove(MMS_DECODE_DRM_CONVERTED_TEMP_FILE) != 0)
- MSG_DEBUG("remove fail");
-
- hConvertedFile = NULL;
- }
-
- return false;
-}
-
bool MmsDrm2ReadMsgConvertedBody(MSG_MESSAGE_INFO_S *pMsg, bool bSavePartsAsTempFiles, bool bRetrieved, char *retrievedPath)
{
MmsMsg *pMmsMsg;
MmsPluginStorage::instance()->getMmsMessage(&pMmsMsg);
- _MmsUnregisterDecodeBuffer();
+ MmsUnregisterDecodeBuffer();
#ifdef __SUPPORT_DRM__
- _MsgFreeDRMInfo(&pMmsMsg->msgType.drmInfo);
+ MsgFreeDRMInfo(&pMmsMsg->msgType.drmInfo);
#endif
- _MsgFreeBody(&pMmsMsg->msgBody, pMmsMsg->msgType.type);
+ MsgFreeBody(&pMmsMsg->msgBody, pMmsMsg->msgType.type);
- if (_MmsReadMsgBody(pMsg->msgId, bSavePartsAsTempFiles, bRetrieved, retrievedPath) == false) {
+ if (MmsReadMsgBody(pMsg->msgId, bSavePartsAsTempFiles, bRetrieved, retrievedPath) == false) {
MSG_DEBUG("MmsDrm2ReadMsgConvertedBody: _MmsReadMsgBody with converted file is failed\n");
return false;
}
*
* --------------------------------------------------------------------*/
-bool _MmsBinaryDecodeGetOneByte(FILE *pFile, UINT8 *pOneByte, int totalLength)
+bool __MmsBinaryDecodeGetOneByte(FILE *pFile, UINT8 *pOneByte, int totalLength)
{
int length = gMmsDecodeMaxLen - gCurMmsDecodeBuffPos;
}
if (length < 1) {
- if (MsgLoadDataToDecodeBuffer(pFile, &gpCurMmsDecodeBuff, &gCurMmsDecodeBuffPos, &gMmsDecodeCurOffset,
+ if (__MsgLoadDataToDecodeBuffer(pFile, &gpCurMmsDecodeBuff, &gCurMmsDecodeBuffPos, &gMmsDecodeCurOffset,
gpMmsDecodeBuf1, gpMmsDecodeBuf2, gMmsDecodeMaxLen, &gMmsDecodeBufLen, totalLength) == false) {
MSG_DEBUG("_MmsBinaryDecodeGetOneByte: fail to load to buffer \n");
goto __CATCH;
return false;
}
-
/*
* @remark: bufLen < gMmsDecodeMaxLen
*/
-bool _MmsBinaryDecodeGetBytes(FILE *pFile, char *szBuff, int bufLen, int totalLength)
+bool __MmsBinaryDecodeGetBytes(FILE *pFile, char *szBuff, int bufLen, int totalLength)
{
int length = gMmsDecodeMaxLen - gCurMmsDecodeBuffPos;
int i = 0;
memset(szBuff, 0, bufLen);
if (length < bufLen) {
- if (MsgLoadDataToDecodeBuffer(pFile, &gpCurMmsDecodeBuff, &gCurMmsDecodeBuffPos, &gMmsDecodeCurOffset,
+ if (__MsgLoadDataToDecodeBuffer(pFile, &gpCurMmsDecodeBuff, &gCurMmsDecodeBuffPos, &gMmsDecodeCurOffset,
gpMmsDecodeBuf1, gpMmsDecodeBuf2, gMmsDecodeMaxLen, &gMmsDecodeBufLen, totalLength) == false) {
MSG_DEBUG("_MmsBinaryDecodeGetBytes: fail to load to buffer \n");
goto __CATCH;
return false;
}
-
-
-bool _MmsBinaryDecodeGetLongBytes(FILE *pFile, char *szBuff, int bufLen, int totalLength)
+bool __MmsBinaryDecodeGetLongBytes(FILE *pFile, char *szBuff, int bufLen, int totalLength)
{
int iPos = 0;
memset(szBuff, 0, bufLen);
- if (MsgLoadDataToDecodeBuffer(pFile, &gpCurMmsDecodeBuff, &gCurMmsDecodeBuffPos, &gMmsDecodeCurOffset,
+ if (__MsgLoadDataToDecodeBuffer(pFile, &gpCurMmsDecodeBuff, &gCurMmsDecodeBuffPos, &gMmsDecodeCurOffset,
gpMmsDecodeBuf1, gpMmsDecodeBuf2, gMmsDecodeMaxLen, &gMmsDecodeBufLen, totalLength) == false) {
MSG_DEBUG("_MmsBinaryDecodeGetLongBytes: fail to load to buffer \n");
goto __CATCH;
}
while ((bufLen - iPos) >= gMmsDecodeMaxLen) {
- if (_MmsBinaryDecodeGetBytes(pFile, szBuff + iPos, gMmsDecodeMaxLen, totalLength) == false) {
+ if (__MmsBinaryDecodeGetBytes(pFile, szBuff + iPos, gMmsDecodeMaxLen, totalLength) == false) {
MSG_DEBUG("_MmsBinaryDecodeGetLongBytes: 1. _MmsBinaryDecodeGetBytes fail \n");
goto __CATCH;
}
}
if ((bufLen - iPos) > 0) {
- if (_MmsBinaryDecodeGetBytes(pFile, szBuff + iPos, (bufLen - iPos), totalLength) == false) {
+ if (__MmsBinaryDecodeGetBytes(pFile, szBuff + iPos, (bufLen - iPos), totalLength) == false) {
MSG_DEBUG("_MmsBinaryDecodeGetLongBytes: 2. _MmsBinaryDecodeGetBytes fail \n");
goto __CATCH;
}
return false;
}
-
/**
* Decode uintvar to 32bit unsigned integer
*
return -1;
if (length < 5) {
- if (MsgLoadDataToDecodeBuffer(pFile, &gpCurMmsDecodeBuff, &gCurMmsDecodeBuffPos, &gMmsDecodeCurOffset,
+ if (__MsgLoadDataToDecodeBuffer(pFile, &gpCurMmsDecodeBuff, &gCurMmsDecodeBuffPos, &gMmsDecodeCurOffset,
gpMmsDecodeBuf1, gpMmsDecodeBuf2, gMmsDecodeMaxLen, &gMmsDecodeBufLen, totalLength) == false) {
MSG_DEBUG("__MmsBinaryDecodeUintvar: fail to load to buffer \n");
goto __CATCH;
}
while (true) {
- if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false)
+ if (__MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false)
goto __CATCH;
if (oneByte > 0x7f) {
return -1;
}
-
/**
* Decode uintvar to 32bit unsigned integer by uintvar length
*
if (length == 1)
{
- if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
+ if (__MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
MSG_DEBUG("__MmsHeaderDecodeIntegerByLength: _MmsBinaryDecodeGetOneByte fail\n");
return oneByte;
}
}
memset(pData, 0, length + 1);
- if (_MmsBinaryDecodeGetBytes(pFile, pData, length + 1, totalLength) == false) {
+ if (__MmsBinaryDecodeGetBytes(pFile, pData, length + 1, totalLength) == false) {
MSG_DEBUG("__MmsHeaderDecodeIntegerByLength: _MmsBinaryDecodeGetOneByte fail\n");
goto __CATCH;
}
return returner.integer;
}
-
/**
* Decode uintvar to 32bit unsigned integer by uintvar length
*
returner.integer = 0;
*pIntLen = 0;
- if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
+ if (__MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
MSG_DEBUG("__MmsBinaryDecodeInteger: GetOneByte fail\n");
return false;
}
memset(pData, 0, oneByte + 1);
// Even NULL is copied in the _MmsBinaryDecodeGetBytes
- if (_MmsBinaryDecodeGetBytes(pFile, pData, oneByte + 1, totalLength) == false) {
+ if (__MmsBinaryDecodeGetBytes(pFile, pData, oneByte + 1, totalLength) == false) {
MSG_DEBUG("__MmsBinaryDecodeInteger: GetBytes fail\n");
goto __CATCH;
}
return false;
}
-
/**
* Decode uintvar to 32bit unsigned integer by uintvar length
*
*pValueLength = 0;
- if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
+ if (__MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
gCurMmsDecodeBuffPos--;
goto __CATCH;
}
return -1;
}
-
-
/**
* Decode uintvar to 32bit unsigned integer by uintvar length
*
*pValueLength = 0;
- if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
+ if (__MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
gCurMmsDecodeBuffPos--;
goto __CATCH;
}
return -1;
}
-
-
/**
* Decode QuotedString
*
memset(szBuff, 0, bufLen);
- if (MsgLoadDataToDecodeBuffer(pFile, &gpCurMmsDecodeBuff, &gCurMmsDecodeBuffPos, &gMmsDecodeCurOffset,
+ if (__MsgLoadDataToDecodeBuffer(pFile, &gpCurMmsDecodeBuff, &gCurMmsDecodeBuffPos, &gMmsDecodeCurOffset,
gpMmsDecodeBuf1, gpMmsDecodeBuf2, gMmsDecodeMaxLen, &gMmsDecodeBufLen, totalLength) == false) {
MSG_DEBUG("__MmsBinaryDecodeQuotedString: 1. fail to load to buffer \n");
goto __CATCH;
memset(pData, 0, gMmsDecodeBufLen + 1);
- if (_MmsBinaryDecodeGetBytes(pFile, pData, gMmsDecodeBufLen, totalLength) == false)
+ if (__MmsBinaryDecodeGetBytes(pFile, pData, gMmsDecodeBufLen, totalLength) == false)
goto __CATCH;
returnLength += gMmsDecodeBufLen;
pData = NULL;
}
- if (MsgLoadDataToDecodeBuffer(pFile, &gpCurMmsDecodeBuff, &gCurMmsDecodeBuffPos, &gMmsDecodeCurOffset,
+ if (__MsgLoadDataToDecodeBuffer(pFile, &gpCurMmsDecodeBuff, &gCurMmsDecodeBuffPos, &gMmsDecodeCurOffset,
gpMmsDecodeBuf1, gpMmsDecodeBuf2, gMmsDecodeMaxLen, &gMmsDecodeBufLen, totalLength) == false) {
MSG_DEBUG("__MmsBinaryDecodeText: 2. fail to load to buffer \n");
goto __CATCH;
if (pData == NULL)
goto __CATCH;
- if (_MmsBinaryDecodeGetBytes(pFile, pData, length, totalLength) == false)
+ if (__MmsBinaryDecodeGetBytes(pFile, pData, length, totalLength) == false)
goto __CATCH;
returnLength += length;
return -1;
}
-
/**
* Decode Text
*
if (pFile == NULL || szBuff == NULL || bufLen <= 0)
return -1;
- offset = _MmsGetDecodeOffset();
+ offset = __MmsGetDecodeOffset();
if (offset >= totalLength)
goto __RETURN;
memset(szBuff, 0, bufLen);
- if (MsgLoadDataToDecodeBuffer(pFile, &gpCurMmsDecodeBuff, &gCurMmsDecodeBuffPos, &gMmsDecodeCurOffset,
+ if (__MsgLoadDataToDecodeBuffer(pFile, &gpCurMmsDecodeBuff, &gCurMmsDecodeBuffPos, &gMmsDecodeCurOffset,
gpMmsDecodeBuf1, gpMmsDecodeBuf2, gMmsDecodeMaxLen, &gMmsDecodeBufLen, totalLength) == false) {
MSG_DEBUG("__MmsBinaryDecodeText: 1. fail to load to buffer \n");
goto __CATCH;
memset(pData, 0, gMmsDecodeBufLen + 1);
- if (_MmsBinaryDecodeGetBytes(pFile, pData, gMmsDecodeBufLen, totalLength) == false)
+ if (__MmsBinaryDecodeGetBytes(pFile, pData, gMmsDecodeBufLen, totalLength) == false)
goto __CATCH;
if ((bufLen - iPos) > 0) {
returnLength += gMmsDecodeBufLen;
- if (MsgLoadDataToDecodeBuffer(pFile, &gpCurMmsDecodeBuff, &gCurMmsDecodeBuffPos, &gMmsDecodeCurOffset,
+ if (__MsgLoadDataToDecodeBuffer(pFile, &gpCurMmsDecodeBuff, &gCurMmsDecodeBuffPos, &gMmsDecodeCurOffset,
gpMmsDecodeBuf1, gpMmsDecodeBuf2, gMmsDecodeMaxLen, &gMmsDecodeBufLen, totalLength) == false) {
MSG_DEBUG("__MmsBinaryDecodeText: 2. fail to load to buffer \n");
goto __CATCH;
memset(pData, 0, length);
- if (_MmsBinaryDecodeGetBytes(pFile, pData, length, totalLength) == false)
+ if (__MmsBinaryDecodeGetBytes(pFile, pData, length, totalLength) == false)
goto __CATCH;
if ((bufLen - iPos) > 0) {
szBuff[0] = '\0';
length = 0;
- MmsBinaryDecodeMovePointer(pFile, offset, totalLength);
+ __MmsBinaryDecodeMovePointer(pFile, offset, totalLength);
return length;
return -1;
}
-
static char* __MmsBinaryDecodeText2(FILE *pFile, int totalLength, int *pLength)
{
int length = 0;
goto __CATCH;
*pLength = 0;
- offset = _MmsGetDecodeOffset();
+ offset = __MmsGetDecodeOffset();
if (offset >= totalLength)
goto __RETURN;
- if (MsgLoadDataToDecodeBuffer(pFile, &gpCurMmsDecodeBuff, &gCurMmsDecodeBuffPos, &gMmsDecodeCurOffset,
+ if (__MsgLoadDataToDecodeBuffer(pFile, &gpCurMmsDecodeBuff, &gCurMmsDecodeBuffPos, &gMmsDecodeCurOffset,
gpMmsDecodeBuf1, gpMmsDecodeBuf2, gMmsDecodeMaxLen, &gMmsDecodeBufLen, totalLength) == false) {
MSG_DEBUG("__MmsBinaryDecodeTextLen: 1. fail to load to buffer \n");
goto __CATCH;
memset(pData, 0, gMmsDecodeBufLen + 1);
- if (_MmsBinaryDecodeGetBytes(pFile, pData, gMmsDecodeBufLen, totalLength) == false)
+ if (__MmsBinaryDecodeGetBytes(pFile, pData, gMmsDecodeBufLen, totalLength) == false)
goto __CATCH;
if (szBuff == NULL) {
*pLength += gMmsDecodeBufLen;
- if (MsgLoadDataToDecodeBuffer(pFile,
+ if (__MsgLoadDataToDecodeBuffer(pFile,
&gpCurMmsDecodeBuff,
&gCurMmsDecodeBuffPos,
&gMmsDecodeCurOffset,
goto __CATCH;
}
- if (_MmsBinaryDecodeGetBytes(pFile, pData, length, totalLength) == false) {
+ if (__MmsBinaryDecodeGetBytes(pFile, pData, length, totalLength) == false) {
goto __CATCH;
}
*pLength = 1;
- MmsBinaryDecodeMovePointer(pFile, offset, totalLength);
+ __MmsBinaryDecodeMovePointer(pFile, offset, totalLength);
return szBuff;
return NULL;
}
-
/**
* Decode Charset
*
return true;
}
- *nCharSet = _MmsGetBinaryType(MmsCodeCharSet, (UINT16)integer);
+ *nCharSet = MmsGetBinaryType(MmsCodeCharSet, (UINT16)integer);
if (*nCharSet == MIME_UNKNOWN) {
- MSG_DEBUG("__MmsBinaryDecodeCharset : _MmsGetBinaryType fail..\n");
+ MSG_DEBUG("__MmsBinaryDecodeCharset : MmsGetBinaryType fail..\n");
*nCharSet = MSG_CHARSET_UNKNOWN;
}
return false;
}
-
-
/**
* Decode EncodedString
*
goto __CATCH;
}
- if (_MmsBinaryDecodeGetLongBytes(pFile, pData, valueLength - charSetLen, totalLength) == false) {
+ if (__MmsBinaryDecodeGetLongBytes(pFile, pData, valueLength - charSetLen, totalLength) == false) {
MSG_DEBUG("__MmsBinaryDecodeEncodedString : _MmsBinaryDecodeGetLongBytes fail.\n");
goto __CATCH;
}
const char *pToCharSet = "UTF-8";
- UINT16 charset_code = _MmsGetBinaryValue(MmsCodeCharSet, charSet);
+ UINT16 charset_code = MmsGetBinaryValue(MmsCodeCharSet, charSet);
const char *pFromCharSet = MmsPluginTextConvertGetCharSet(charset_code);
if (pFromCharSet == NULL || !strcmp(pFromCharSet, pToCharSet)) {
goto __CATCH;
}
- if (_MmsBinaryDecodeGetLongBytes(pFile, pAddrStr, valueLength - charSetLen, totalLength) == false) {
+ if (__MmsBinaryDecodeGetLongBytes(pFile, pAddrStr, valueLength - charSetLen, totalLength) == false) {
MSG_DEBUG("__MmsDecodeEncodedAddress : _MmsBinaryDecodeGetLongBytes fail.\n");
goto __CATCH;
}
*pLongInteger = 0;
- if (_MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false)
+ if (__MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false)
goto __CATCH;
if (oneByte > 31)
szSrc2 = NULL;
}
- if (MsgIsUTF8String((unsigned char*)pLatinBuff, strlen(pLatinBuff)) == false) {
+ if (__MsgIsUTF8String((unsigned char*)pLatinBuff, strlen(pLatinBuff)) == false) {
length = strlen(pLatinBuff);
int utf8BufSize = 0;
- utf8BufSize = MsgGetLatin2UTFCodeSize((unsigned char*)pLatinBuff, length);
+ utf8BufSize = __MsgGetLatin2UTFCodeSize((unsigned char*)pLatinBuff, length);
if (utf8BufSize < 3)
utf8BufSize = 3;//min value
goto __CATCH;
}
- if (MsgLatin2UTF ((unsigned char*)pUTF8Buff, utf8BufSize + 1, (unsigned char*)pLatinBuff, length) < 0) {
+ if (__MsgLatin2UTF ((unsigned char*)pUTF8Buff, utf8BufSize + 1, (unsigned char*)pLatinBuff, length) < 0) {
MSG_DEBUG("__MmsDecodeGetFilename: MsgLatin2UTF fail \n");
goto __CATCH;
}
free(pLatinBuff);
pLatinBuff = NULL;
} else {
- pTmpBuff = _MsgDecodeText(pLatinBuff);
+ pTmpBuff = MsgDecodeText(pLatinBuff);
pUTF8Buff = pTmpBuff;
free (pLatinBuff);
pLatinBuff = NULL;
return -1;
}
-
-/* ==========================================================
-
- T E X T D E C O D I N G
-
- ==========================================================*/
-
-
-bool MmsTextDecodeMsgBody(FILE *pFile)
-{
- MSG_DEBUG("MmsTextDecodeMsgBody: \n");
- return false;
-}
-
-bool __MmsTextDecodeMsgHeader(FILE *pFile)
-{
- return true;
-}
-
-
/* ==========================================================
M M S D E C O D I N G
==========================================================*/
// to get message body this function should be modified from message raw file.
-bool _MmsReadMsgBody(msg_message_id_t msgID, bool bSavePartsAsTempFiles, bool bRetrieved, char *retrievedPath)
+bool MmsReadMsgBody(msg_message_id_t msgID, bool bSavePartsAsTempFiles, bool bRetrieved, char *retrievedPath)
{
FILE *pFile = NULL;
MmsMsg *pMsg = NULL;
MmsPluginStorage::instance()->getMmsMessage(&pMsg);
memset(pMsg, 0, sizeof(MmsMsg));
- _MmsInitHeader();
+ MmsInitHeader();
if (bRetrieved && (retrievedPath != NULL)) {
strncpy(szFullPath, retrievedPath, (strlen(retrievedPath) > MSG_FILEPATH_LEN_MAX ? MSG_FILEPATH_LEN_MAX:strlen(retrievedPath)));
goto __CATCH;
}
- _MmsRegisterDecodeBuffer(gszMmsLoadBuf1, gszMmsLoadBuf2, MSG_MMS_DECODE_BUFFER_MAX);
+ MmsRegisterDecodeBuffer();
if (MmsBinaryDecodeMsgHeader(pFile, nSize) == false) {
MSG_DEBUG("_MmsReadMsgBody: MmsBinaryDecodeMsgHeader fail...\n");
/* Set mmsHeader.msgType & msgBody to pMsg ----------- */
- pMsg->mmsAttrib.contentType = (MsgContentType)mmsHeader.msgType.type;
+ pMsg->mmsAttrib.contentType = (MimeType)mmsHeader.msgType.type;
memcpy(&(pMsg->msgType), &(mmsHeader.msgType), sizeof(MsgType));
memcpy(&(pMsg->msgBody), &(mmsHeader.msgBody), sizeof(MsgBody));
if ((mmsHeader.msgType.type == MIME_APPLICATION_VND_WAP_MULTIPART_MIXED)||(mmsHeader.msgType.type == MIME_MULTIPART_MIXED)) {
if ((pMsg->nPartCount >= attachmax)&&(pMultipart->pNext != NULL)) {
- _MsgFreeBody(pMultipart->pNext->pBody, pMultipart->pNext->type.type);
+ MsgFreeBody(pMultipart->pNext->pBody, pMultipart->pNext->type.type);
free(pMultipart->pNext->pBody);
pMultipart->pNext->pBody= NULL;
/* make temporary */
snprintf(szTempMediaDir, MSG_FILEPATH_LEN_MAX, MSG_DATA_PATH"%s.dir", pMsg->szFileName);
- ///////////////////////////////////////////////
- // call before processing urgent event.
- //_MmsInitHeader();
- //_MmsUnregisterDecodeBuffer();
- ///////////////////////////////////////////////
-
if (MsgIsMultipart(pMsg->msgType.type) == true) {
int partIndex = 0;
pMultipart = pMsg->msgBody.body.pMultipart;
while (pMultipart) {
- if (_MmsMultipartSaveAsTempFile(&pMultipart->type, pMultipart->pBody,
+ if (__MmsMultipartSaveAsTempFile(&pMultipart->type, pMultipart->pBody,
(char*)MSG_DATA_PATH, pMsg->szFileName, partIndex, bSavePartsAsTempFiles) == false)
goto __CATCH;
}
}
- if (_MmsMultipartSaveAsTempFile( &pMsg->msgType, &pMsg->msgBody,
+ if (__MmsMultipartSaveAsTempFile( &pMsg->msgType, &pMsg->msgBody,
(char*)MSG_DATA_PATH, pMsg->szFileName, 0, bSavePartsAsTempFiles) == false)
goto __CATCH;
}
__CATCH:
- _MmsInitHeader();
- _MmsUnregisterDecodeBuffer();
+ MmsInitHeader();
+ MmsUnregisterDecodeBuffer();
if (pFile != NULL) {
MsgCloseFile(pFile);
}
#ifdef __SUPPORT_DRM__
- _MsgFreeDRMInfo(&pMsg->msgType.drmInfo);
+ MsgFreeDRMInfo(&pMsg->msgType.drmInfo);
#endif
- _MsgFreeBody(&pMsg->msgBody, pMsg->msgType.type);
+ MsgFreeBody(&pMsg->msgBody, pMsg->msgType.type);
MSG_DEBUG("_MmsReadMsgBody: E N D (fail) ******************** \n");
return false;
}
-
-bool MsgFreeHeaderAddress(MsgHeaderAddress *pAddr)
+static bool __MsgFreeHeaderAddress(MsgHeaderAddress *pAddr)
{
MsgHeaderAddress *pTempAddr = NULL;
return true;
}
-bool MsgCheckFileNameHasInvalidChar(char *szName)
+static bool __MsgCheckFileNameHasInvalidChar(char *szName)
{
int strLen = 0;
int i = 0;
return false;
}
-bool _MsgReplaceInvalidFileNameChar(char *szInText, char replaceChar)
+static bool __MsgReplaceInvalidFileNameChar(char *szInText, char replaceChar)
{
int nCount = 0;
int totalLength = 0;
return true;
}
-char *_MsgGetStringUntilDelimiter(char *pszString, char delimiter)
+static char *__MsgGetStringUntilDelimiter(char *pszString, char delimiter)
{
char *pszBuffer = NULL;
char *pszStrDelimiter = NULL;
if (pOrg[cIndex+1] != 0 && pOrg[cIndex+2] != 0) {
snprintf(szBuf, sizeof(szBuf), "%c%c", pOrg[cIndex+1], pOrg[cIndex+2]); // read two chars after '%'
- if (MsgIsHexChar(szBuf) == true) { // check the two character is between 0 ~ F
- OneChar = _MsgConvertHexValue(szBuf);
+ if (__MsgIsHexChar(szBuf) == true) { // check the two character is between 0 ~ F
+ OneChar = __MsgConvertHexValue(szBuf);
pNew[index] = OneChar;
index++;
return pNew;
}
-bool _MsgParseParameter(MsgType *pType, char *pSrc)
+static bool __MsgParseParameter(MsgType *pType, char *pSrc)
{
char *pName = NULL;
char *pValue = NULL;
char *pUTF8Buff = NULL;
while (pSrc != NULL) {
- pSrc = _MsgSkipWS(pSrc);
+ pSrc = __MsgSkipWS(pSrc);
if (pSrc == NULL) {
/* End of parse parameter */
return true;
if ((pTest = strchr(pValue, MSG_CH_QUOT)) != NULL)
*pTest = MSG_CH_NULL;
- pDec = _MsgDecodeText(pValue); // Api is to long, consider Add to another file (MsgMIMECodec.c)
+ pDec = MsgDecodeText(pValue); // Api is to long, consider Add to another file (MsgMIMECodec.c)
} else {
- pDec = _MsgDecodeText(pName);
+ pDec = MsgDecodeText(pName);
}
switch (_MsgGetCode(MSG_PARAM, pSrc)) {
memset (pType->param.szName, 0, MSG_LOCALE_FILENAME_LEN_MAX + 1);
- pUTF8Buff = MsgConvertLatin2UTF8FileName(pDec);
+ pUTF8Buff = __MsgConvertLatin2UTF8FileName(pDec);
if (pUTF8Buff) {
if ((pExt = strrchr(pUTF8Buff, '.')) != NULL) {
free(pUTF8Buff);
pUTF8Buff = NULL;
- if (_MsgChangeSpace(pType->param.szName, &szSrc) == true) {
+ if (__MsgChangeSpace(pType->param.szName, &szSrc) == true) {
if (szSrc)
strncpy(pType->param.szName, szSrc , strlen(szSrc));
}
}
// Remvoe '/', ex) Content-Type: image/gif; name="images/vf7.gif"
- _MsgRemoveFilePath(pType->param.szName);
+ __MsgRemoveFilePath(pType->param.szName);
} else {
MSG_DEBUG("_MsgParseParameter: MsgConvertLatin2UTF8FileName(%s) return NULL\n", pDec);
}
memset (pType->param.szFileName, 0, MSG_FILENAME_LEN_MAX+1);
- pUTF8Buff = MsgConvertLatin2UTF8FileName(pDec);
+ pUTF8Buff = __MsgConvertLatin2UTF8FileName(pDec);
if (pUTF8Buff) {
if ((pExt = strrchr(pUTF8Buff, '.')) != NULL) {
free(pUTF8Buff);
pUTF8Buff = NULL;
- if (_MsgChangeSpace(pType->param.szFileName, &szSrc) == true)
+ if (__MsgChangeSpace(pType->param.szFileName, &szSrc) == true)
strcpy(pType->param.szFileName, szSrc);
if (szSrc) {
}
// Remvoe '/', ex) Content-Type: image/gif; name="images/vf7.gif"
- _MsgRemoveFilePath(pType->param.szFileName);
+ __MsgRemoveFilePath(pType->param.szFileName);
} else {
MSG_DEBUG("_MsgParseParameter: MsgConvertLatin2UTF8FileName(%s) return NULL\n", pDec);
}
return true;
}
-char *_MsgSkipWS(char *s)
+static char *__MsgSkipWS(char *s)
{
while (true) {
if ((*s == MSG_CH_CR) || (*s == MSG_CH_LF) || (*s == MSG_CH_SP) || (*s == MSG_CH_TAB)) {
}
}
-char *__MsgSkipComment (char *s,long trim)
+static char *__MsgSkipComment (char *s,long trim)
{
char *ret;
return NULL;
}
-char *MsgConvertLatin2UTF8FileName(char *pSrc)
+static char *__MsgConvertLatin2UTF8FileName(char *pSrc)
{
char *pUTF8Buff = NULL;
char *pData = NULL;
//convert utf8 string
- if (MsgIsUTF8String((unsigned char*)pSrc, strlen(pSrc)) == false) {
+ if (__MsgIsUTF8String((unsigned char*)pSrc, strlen(pSrc)) == false) {
int length = 0;
int utf8BufSize = 0;
length = strlen(pSrc);
- utf8BufSize = MsgGetLatin2UTFCodeSize((unsigned char*)pSrc, length);
+ utf8BufSize = __MsgGetLatin2UTFCodeSize((unsigned char*)pSrc, length);
if (utf8BufSize < 3)
utf8BufSize = 3; //min value
goto __CATCH;
}
- if (MsgLatin2UTF ((unsigned char*)pUTF8Buff, utf8BufSize + 1, (unsigned char*)pSrc, length) < 0) {
+ if (__MsgLatin2UTF ((unsigned char*)pUTF8Buff, utf8BufSize + 1, (unsigned char*)pSrc, length) < 0) {
MSG_DEBUG("MsgConvertLatin2UTF8FileName: MsgLatin2UTF fail \n");
goto __CATCH;
}
}
//convert hex string
- if (MsgIsPercentSign(pUTF8Buff) == true) {
+ if (__MsgIsPercentSign(pUTF8Buff) == true) {
pData = MsgChangeHexString(pUTF8Buff);
if (pData) {
strcpy(pUTF8Buff, pData);
return NULL;
}
-bool _MsgChangeSpace(char *pOrg, char **ppNew)
+static bool __MsgChangeSpace(char *pOrg, char **ppNew)
{
char *pNew = NULL;
int cLen = 0;
return true;
}
-void _MsgRemoveFilePath(char *pSrc)
+static void __MsgRemoveFilePath(char *pSrc)
{
// Remvoe '/', ex) Content-Type: image/gif; name="images/vf7.gif"
char *pPath = NULL;
}
}
-bool MsgIsUTF8String(unsigned char *szSrc, int nChar)
+static bool __MsgIsUTF8String(unsigned char *szSrc, int nChar)
{
MSG_DEBUG("MsgIsUTF8String: --------------- \n");
return false;
}
-bool MsgIsPercentSign(char *pSrc)
+static bool __MsgIsPercentSign(char *pSrc)
{
char *pCh = NULL;
bool bRet = false;
return bRet;
}
-MsgMultipart *MsgAllocMultipart(void)
+static MsgMultipart *__MsgAllocMultipart(void)
{
MsgMultipart *pMultipart = NULL;
goto __CATCH;
}
- _MsgInitMsgType(&pMultipart->type);
- _MsgInitMsgBody(pMultipart->pBody);
+ __MsgInitMsgType(&pMultipart->type);
+ __MsgInitMsgBody(pMultipart->pBody);
pMultipart->pNext = NULL;
return NULL;
}
-bool _MsgInitMsgType(MsgType *pMsgType)
+static bool __MsgInitMsgType(MsgType *pMsgType)
{
pMsgType->offset = 0;
pMsgType->size = 0;
return true;
}
-
-bool __MsgInitMsgContentParam(MsgContentParam *pMsgContentParam)
+static bool __MsgInitMsgContentParam(MsgContentParam *pMsgContentParam)
{
pMsgContentParam->charset = MSG_CHARSET_UNKNOWN;
pMsgContentParam->type = MIME_UNKNOWN;
return true;
}
-
-bool _MsgInitMsgBody(MsgBody *pMsgBody)
+static bool __MsgInitMsgBody(MsgBody *pMsgBody)
{
pMsgBody->offset = 0;
pMsgBody->size = 0;
pMsgBody->body.pText = NULL;
pMsgBody->szOrgFilePath[0] = '\0';
- _MsgInitMsgType(&pMsgBody->presentationType);
+ __MsgInitMsgType(&pMsgBody->presentationType);
pMsgBody->pPresentationBody = NULL;
memset(pMsgBody->szOrgFilePath, 0, MSG_FILEPATH_LEN_MAX);
return true;
}
-
-MsgPresentationFactor MsgIsPresentationEx(MsgType *multipartType, char* szStart, MsgContentType typeParam)
+static MsgPresentationFactor __MsgIsPresentationEx(MsgType *multipartType, char* szStart, MimeType typeParam)
{
char szTmpStart[MSG_MSG_ID_LEN + 3] = { 0, };
char szTmpContentID[MSG_MSG_ID_LEN + 3] = { 0, };
}
}
-void MsgConfirmPresentationPart(MsgType *pMsgType, MsgBody *pMsgBody, MsgPresentaionInfo *pPresentationInfo)
+static void __MsgConfirmPresentationPart(MsgType *pMsgType, MsgBody *pMsgBody, MsgPresentaionInfo *pPresentationInfo)
{
MSG_BEGIN();
MsgMultipart *pNextPart = NULL;
MsgMultipart *pRemovePart = NULL;
- if (MsgIsMultipartRelated(pMsgType->type)) {
+ if (__MsgIsMultipartRelated(pMsgType->type)) {
// assign the multipart to presentation part
// remove the multipart(pCurPresentation) which is presentation part from the linked list.
// if there is no presentation part -> assign first multipart to presentation part by force.
pPresentationInfo->factor = MSG_PRESENTATION_NONE;
}
- if (pPresentationInfo->pCurPresentation != NULL && MsgIsPresentablePart(pPresentationInfo->pCurPresentation->type.type)) {
+ if (pPresentationInfo->pCurPresentation != NULL && __MsgIsPresentablePart(pPresentationInfo->pCurPresentation->type.type)) {
/* Presentable Part is some MARK-UP page, such as SMIL, HTML, WML, XHTML.
* In this case, COPY the Presentation part and leave other multiparts.
*/
pMsgBody->size -= pPresentationInfo->pCurPresentation->pBody->size;
if (pPresentationInfo->pCurPresentation) {
#ifdef __SUPPORT_DRM__
- _MsgFreeDRMInfo(&pPresentationInfo->pCurPresentation->type.drmInfo);
+ MsgFreeDRMInfo(&pPresentationInfo->pCurPresentation->type.drmInfo);
#endif
free(pPresentationInfo->pCurPresentation);
pPresentationInfo->pCurPresentation = NULL;
pPresentationInfo->pCurPresentation = NULL;
}
}
- } else if (pPresentationInfo->pCurPresentation != NULL && MsgIsText(pPresentationInfo->pCurPresentation->type.type)) {
+ } else if (pPresentationInfo->pCurPresentation != NULL && __MsgIsText(pPresentationInfo->pCurPresentation->type.type)) {
/* NON-Presentable Part is some PLAIN part such as, text/plain, multipart/alternative.
* In this case, leave the Presentation part as a multipart and remove other multiparts.
*/
pNextPart = pNextPart->pNext;
if (pRemovePart->pBody) {
- _MsgFreeBody(pRemovePart->pBody, pRemovePart->type.type);
+ MsgFreeBody(pRemovePart->pBody, pRemovePart->type.type);
free(pRemovePart->pBody);
pRemovePart->pBody = NULL;
}
}
} else {
#ifdef __SUPPORT_DRM__
- _MsgFreeDRMInfo(&pMsgBody->presentationType.drmInfo);
+ MsgFreeDRMInfo(&pMsgBody->presentationType.drmInfo);
#endif
- _MsgInitMsgType(&pMsgBody->presentationType);
+ __MsgInitMsgType(&pMsgBody->presentationType);
pMsgBody->pPresentationBody = NULL;
}
}
MSG_END();
}
-bool MsgIsMultipartRelated(int type)
+static bool __MsgIsMultipartRelated(int type)
{
if (type == MIME_MULTIPART_RELATED || type == MIME_APPLICATION_VND_WAP_MULTIPART_RELATED) {
return true;
}
}
-bool MsgIsPresentablePart(int type)
+static bool __MsgIsPresentablePart(int type)
{
if (type == MIME_TEXT_HTML || type == MIME_TEXT_VND_WAP_WML || type == MIME_APPLICATION_SMIL) {
return true;
}
#ifdef __SUPPORT_DRM__
-void _MsgFreeDRMInfo(MsgDRMInfo *pDrmInfo)
+void MsgFreeDRMInfo(MsgDRMInfo *pDrmInfo)
{
MSG_DEBUG("_MsgFreeDRMInfo: S T A R T !!! \n");
pDrmInfo->szDrm2FullPath = NULL;
}
-#if MMS_ENABLE_EXTEND_CFM
- // DRM (Extended)CFM
- if (pDrmInfo->pszContentType) {
- free(pDrmInfo->pszContentType);
- pDrmInfo->pszContentType = NULL;
- }
-#endif
-
pDrmInfo->contentType = MIME_UNKNOWN;
pDrmInfo->drmType = MSG_DRM_TYPE_NONE;
}
strcpy (pPartType->param.szName + fileNameLen, pExt);
} else {
strncpy(pPartType->param.szName, pTmpBuf, MSG_LOCALE_FILENAME_LEN_MAX);
- MsgMakeFileName(pPartType->type, pPartType->param.szName, MSG_DRM_TYPE_NONE, 0);
+ __MsgMakeFileName(pPartType->type, pPartType->param.szName, MSG_DRM_TYPE_NONE, 0);
}
}
#endif
-bool MsgIsText(int type)
+static bool __MsgIsText(int type)
{
if (type == MIME_TEXT_PLAIN || type == MIME_TEXT_HTML || type == MIME_TEXT_VND_WAP_WML ||
type == MIME_TEXT_X_VNOTE || type == MIME_APPLICATION_SMIL || type == MIME_TEXT_X_IMELODY) {
return true;
}
-bool _MsgFreeBody(MsgBody *pBody, int type)
+bool MsgFreeBody(MsgBody *pBody, int type)
{
MSG_DEBUG("_MsgFreeBody: S T A R T !!! \n") ;
if (pCurrPart) {
#ifdef __SUPPORT_DRM__
- _MsgFreeDRMInfo(&pCurrPart->type.drmInfo);
+ MsgFreeDRMInfo(&pCurrPart->type.drmInfo);
#endif
if (pCurrPart->pBody) {
pBody->pPresentationBody = NULL;
}
- _MsgInitMsgType(&pBody->presentationType);
+ __MsgInitMsgType(&pBody->presentationType);
break;
}
}
-bool MsgResolveNestedMultipart(MsgType *pPartType, MsgBody *pPartBody)
+static bool __MsgResolveNestedMultipart(MsgType *pPartType, MsgBody *pPartBody)
{
MSG_BEGIN();
MsgMultipart *pTmpMultipart = NULL;
if (pRemoveList) {
#ifdef __SUPPORT_DRM__
- _MsgFreeDRMInfo(&pRemoveList->type.drmInfo);
+ MsgFreeDRMInfo(&pRemoveList->type.drmInfo);
#endif
- _MsgFreeBody(pRemoveList->pBody, pRemoveList->type.type);
+ MsgFreeBody(pRemoveList->pBody, pRemoveList->type.type);
free(pRemoveList->pBody);
free(pRemoveList);
}
- if (MsgCopyNestedMsgType(pPartType, &(pSelectedPart->type)) == false) {
+ if (__MsgCopyNestedMsgType(pPartType, &(pSelectedPart->type)) == false) {
MSG_DEBUG("MsgResolveNestedMultipart : MsgPriorityCopyMsgType failed \n");
goto __CATCH;
}
if (pSelectedPart != NULL) {
#ifdef __SUPPORT_DRM__
- _MsgFreeDRMInfo(&pSelectedPart->type.drmInfo);
+ MsgFreeDRMInfo(&pSelectedPart->type.drmInfo);
#endif
if (pSelectedPart->pBody != NULL) {
pSelectedPart = pPartBody->body.pMultipart;
while (pSelectedPart) {
- if (MsgIsMultipartMixed(pSelectedPart->type.type)) {
+ if (__MsgIsMultipartMixed(pSelectedPart->type.type)) {
if (pSelectedPart->pBody == NULL) {
MSG_DEBUG("MsgResolveNestedMultipart :pSelectedPart->pBody(1) is NULL\n");
if (pSelectedPart) {
#ifdef __SUPPORT_DRM__
- _MsgFreeDRMInfo(&pSelectedPart->type.drmInfo);
+ MsgFreeDRMInfo(&pSelectedPart->type.drmInfo);
#endif
free(pSelectedPart->pBody);
free(pSelectedPart);
}
pSelectedPart = pTmpMultipart;
- } else if (MsgIsMultipartRelated(pSelectedPart->type.type) && pPrevPart != NULL) {
+ } else if (__MsgIsMultipartRelated(pSelectedPart->type.type) && pPrevPart != NULL) {
pPrevPart->pNext = pTmpMultipart = pSelectedPart->pNext;
- _MsgFreeBody(pSelectedPart->pBody, pSelectedPart->type.type);
+ MsgFreeBody(pSelectedPart->pBody, pSelectedPart->type.type);
free(pSelectedPart->pBody);
free(pSelectedPart);
pPartType->type = pSelectedPart->type.type;
#ifdef __SUPPORT_DRM__
- _MsgFreeDRMInfo(&pSelectedPart->type.drmInfo);
+ MsgFreeDRMInfo(&pSelectedPart->type.drmInfo);
#endif
free(pSelectedPart->pBody);
free(pSelectedPart);
while (pTmpMultipart) {
#ifdef __SUPPORT_DRM__
- _MsgFreeDRMInfo(&pTmpMultipart->type.drmInfo);
+ MsgFreeDRMInfo(&pTmpMultipart->type.drmInfo);
#endif
- _MsgFreeBody(pTmpMultipart->pBody, pTmpMultipart->type.type);
+ MsgFreeBody(pTmpMultipart->pBody, pTmpMultipart->type.type);
pNextRemovePart = pTmpMultipart->pNext;
free(pTmpMultipart->pBody);
pTmpMultipart = pNextRemovePart;
}
- if (MsgCopyNestedMsgType(pPartType, &(pSelectedPart->type)) == false) {
+ if (__MsgCopyNestedMsgType(pPartType, &(pSelectedPart->type)) == false) {
MSG_DEBUG("MsgResolveNestedMultipart : MsgPriorityCopyMsgType failed \n");
goto __CATCH;
}
if (pSelectedPart != NULL) {
#ifdef __SUPPORT_DRM__
- _MsgFreeDRMInfo(&pSelectedPart->type.drmInfo);
+ MsgFreeDRMInfo(&pSelectedPart->type.drmInfo);
#endif
if (pSelectedPart->pBody != NULL) {
free(pSelectedPart->pBody);
return NULL;
}
-bool _MsgParsePartHeader(MsgType *pType, const char *pRawData, int nRawData)
-{
- char ch = '\0';
- int cRaw = nRawData;
- char *pFieldLine = NULL;
- char *pFieldValue = NULL;
- char *szFieldValue = NULL;
- char *szSrc = NULL;
- int nLen = 0;
- char fieldLine[MSG_LINE_LEN] = {0, }; //temporary line buffer
- int length = 0;
-
- char szTempBuf[MSG_LOCAL_TEMP_BUF_SIZE];
-
- while ((cRaw > 0) && *pRawData != MSG_CH_LF) {
- memset(fieldLine, 0, MSG_LINE_LEN);
- pFieldLine = fieldLine;
-
- ch = MSG_CH_SP; //remember previous character.
-
- while (ch) {
- switch (ch = *pRawData++) {
- case MSG_CH_CR: //'\r'
- if (*pRawData == MSG_CH_LF)
- break;
-
- case MSG_CH_LF: //'\n'
- if (*pRawData != MSG_CH_SP && *pRawData != MSG_CH_TAB) {
- ch = MSG_CH_NULL;
- *pFieldLine = ch;
- pFieldLine++;
- }
- break;
-
- case MSG_CH_TAB: //'\t'
- *pFieldLine = MSG_CH_SP;
- pFieldLine++;
- break;
-
- default:
- *pFieldLine = ch;
- pFieldLine++;
- break;
- }
-
- if (--cRaw <= 0) { //If is the last character of header
- *pFieldLine = MSG_CH_NULL;
- pFieldLine++;
- }
- }
-
-
- if ((pFieldValue = strchr(fieldLine, MSG_CH_COLON)) != NULL) {
- char* pTemp = pFieldValue;
- char* pValue = NULL;
-
- *pFieldValue++ = MSG_CH_NULL; //remove ':'
-
- while (*pFieldValue == MSG_CH_SP) //remove space ' '
- pFieldValue++;
-
- while ((fieldLine < pTemp--) && (*pTemp == MSG_CH_SP))
- *pTemp = MSG_CH_NULL;
-
- nLen = strlen(pFieldValue);
-
- if (nLen >= MSG_LOCAL_TEMP_BUF_SIZE) {
- szFieldValue = (char *)malloc(nLen + 1);
- memset(szFieldValue, 0 , nLen + 1);
- memcpy(szFieldValue, pFieldValue, nLen + 1);
- } else {
- memset(szTempBuf, 0, MSG_LOCAL_TEMP_BUF_SIZE);
- strcpy(szTempBuf, pFieldValue);
- szFieldValue = szTempBuf;
- }
-
- if (MsgStrcpyWithoutCRLF(szFieldValue, &szSrc) == true) {
- if (szSrc != NULL)
- strncpy(szFieldValue, szSrc, strlen(szSrc));
- }
- if (szSrc) {
- free(szSrc);
- szSrc = NULL;
- }
-
- switch (_MsgGetCode(MSG_FIELD, fieldLine)) {
- case MSG_FIELD_CONTENT_ID:
- if ((pTemp = strchr(szFieldValue, MSG_CH_SEMICOLON)) != NULL)
- *pTemp++ = MSG_CH_NULL;
-
- pValue = _MsgDecodeText(szFieldValue);
- memset (pType->szContentID, 0, MSG_MSG_ID_LEN + 1);
-
- if (pValue) {
- // support CD & SD
- length = MsgStrlen(pValue);
- if (pValue[0] == '<' && pValue[length-1] == '>') {
- strncpy(pType->szContentID, pValue + 1, length - 2);
- } else {
- strncpy(pType->szContentID, pValue, MSG_MSG_ID_LEN);
- }
-
- MSG_DEBUG("_MsgParsePartHeader: Content-ID = %s %s\n", pFieldValue, pType->szContentID);
-
- if (pTemp != NULL)
- _MsgParseParameter(pType, pTemp);
-
- free(pValue);
- pValue = NULL;
- }
-
- break;
-
- case MSG_FIELD_CONTENT_LOCATION:
- if ((pTemp = strchr(szFieldValue, MSG_CH_SEMICOLON)) != NULL)
- *pTemp++ = MSG_CH_NULL;
-
- pValue = _MsgDecodeText(szFieldValue);
- memset (pType->szContentLocation, 0, MSG_MSG_ID_LEN + 1);
-
- if (pValue) {
- strncpy(pType->szContentLocation, pValue, MSG_MSG_ID_LEN);
-
- MSG_DEBUG("_MsgParsePartHeader: Content-Location = %s %s\n", pFieldValue, pType->szContentLocation);
-
- if (pTemp != NULL)
- _MsgParseParameter(pType, pTemp);
-
- free(pValue);
- pValue = NULL;
- }
-
- break;
-
- case MSG_FIELD_CONTENT_TYPE:
- if ((pTemp = strchr(szFieldValue, MSG_CH_SEMICOLON)) == NULL) {
- if ((pTemp = strchr(szFieldValue, MSG_CH_SP)) != NULL)
- *pTemp++ = MSG_CH_NULL;
- } else {
- *pTemp++ = MSG_CH_NULL;
- }
-
- pType->type = _MsgGetCode(MSG_TYPE, szFieldValue);
-
- MSG_DEBUG("_MsgParsePartHeader: Content-Type = %s %d\n", pFieldValue, pType->type);
-
- if (pType->type == INVALID_HOBJ)
- pType->type = MIME_UNKNOWN;
-
- if (pTemp != NULL)
- _MsgParseParameter(pType, pTemp);
-
- break;
-
- case MSG_FIELD_CONTENT_TRANSFER_ENCODING:
- if ((pTemp = strchr(szFieldValue, MSG_CH_SEMICOLON)) == NULL) {
- if ((pTemp = strchr(szFieldValue, MSG_CH_SP)) != NULL)
- *pTemp++ = MSG_CH_NULL;
- } else {
- *pTemp++ = MSG_CH_NULL;
- }
-
- pType->encoding = _MsgGetCode(MSG_ENCODING, szFieldValue);
-
- MSG_DEBUG("_MsgParsePartHeader: Content-Encoding = %s %d\n", pFieldValue, pType->encoding);
-
- if (pTemp != NULL)
- _MsgParseParameter(pType, pTemp);
-
- break;
-
- case MSG_FIELD_CONTENT_DISPOSITION:
- if ((pTemp = strchr(szFieldValue, MSG_CH_SEMICOLON)) == NULL) {
- if ((pTemp = strchr(szFieldValue, MSG_CH_SP)) != NULL)
- *pTemp++ = MSG_CH_NULL;
- } else {
- *pTemp++ = MSG_CH_NULL;
- }
-
- pType->disposition = _MsgGetCode(MSG_DISPOSITION, szFieldValue);
-
- MSG_DEBUG("_MsgParsePartHeader: Content-Disposition = %s %d\n", pFieldValue, pType->disposition);
-
- if (pTemp != NULL)
- _MsgParseParameter(pType, pTemp);
-
- break;
-
-#ifdef __SUPPORT_DRM__
-
- case MSG_FIELD_CONTENT_NAME:
- /* add to parse DCF header such as,
- * Right-Issuer, Content-Name, and Content-Description.
- */
- MsgMIMERemoveQuote(szFieldValue);
- pType->drmInfo.szContentName = MsgStrCopy(szFieldValue);
- break;
-
- case MSG_FIELD_CONTENT_DESCRIPTION:
- MsgMIMERemoveQuote(szFieldValue);
- pType->drmInfo.szContentDescription = MsgStrCopy(szFieldValue);
- break;
-
- case MSG_FIELD_CONTENT_VENDOR:
- MsgMIMERemoveQuote(szFieldValue);
- pType->drmInfo.szContentVendor = MsgStrCopy(szFieldValue);
- break;
-
- case MSG_FIELD_RIGHT_ISSUER:
- MsgMIMERemoveQuote(szFieldValue);
- pType->drmInfo.szRightIssuer = MsgStrCopy(szFieldValue);
- break;
-
-
- case MSG_FIELD_DRM_CONVERTED:
- MsgMIMERemoveQuote(szFieldValue);
- pType->nDrmConvertedStatus = atoi(szFieldValue);
- break;
-
-#endif
- case MSG_FILED_CONTENT_REPLACE_POS:
- MsgMIMERemoveQuote(szFieldValue);
- strncpy(pType->szContentRepPos, szFieldValue, sizeof(pType->szContentRepPos) - 1);
- break;
-
- case MSG_FILED_CONTENT_REPLACE_SIZE:
- MsgMIMERemoveQuote(szFieldValue);
- strncpy(pType->szContentRepSize, szFieldValue, sizeof(pType->szContentRepSize) - 1);
- break;
-
- case MSG_FILED_CONTENT_REPLACE_INDEX:
- MsgMIMERemoveQuote(szFieldValue);
- strncpy(pType->szContentRepIndex, szFieldValue, sizeof(pType->szContentRepIndex) - 1);
- break;
-
- default:
- MSG_DEBUG("_MsgParsePartHeader: Unhandled field \n");
- break;
- }
- }
-
- if (szFieldValue != NULL && szFieldValue != szTempBuf) {
- free(szFieldValue);
- szFieldValue = NULL;
- }
-
- }
-
- return true;
-}
-
char *MsgRemoveQuoteFromFilename(char *pSrc)
{
int cLen = 0; // length of pBuff
}
-bool MsgIsHexChar(char *pSrc)
+static bool __MsgIsHexChar(char *pSrc)
{
int cIndex = 0;
int cLen = 0;
return bRet;
}
-char _MsgConvertHexValue(char *pSrc)
+static char __MsgConvertHexValue(char *pSrc)
{
int ch = 0;
int cIndex = 0;
return ResultChar;
}
-int __MsgConvertCharToInt(char ch)
+static int __MsgConvertCharToInt(char ch)
{
if (ch>='0' && ch<='9') {
return ch - '0';
}
}
-bool MsgCopyNestedMsgType(MsgType *pMsgType1, MsgType *pMsgType2)
+static bool __MsgCopyNestedMsgType(MsgType *pMsgType1, MsgType *pMsgType2)
{
if (pMsgType1->section == INVALID_HOBJ)
pMsgType1->section = pMsgType2->section;
pMsgType1->size = pMsgType2->size;
pMsgType1->type = pMsgType2->type;
- MsgCopyNestedMsgParam(&(pMsgType1->param), &(pMsgType2->param));
+ __MsgCopyNestedMsgParam(&(pMsgType1->param), &(pMsgType2->param));
if (pMsgType1->param.szName[0]) {
#ifdef __SUPPORT_DRM__
return true;
}
-
-bool MsgCopyNestedMsgParam(MsgContentParam *pParam1, MsgContentParam *pParam2)
+static bool __MsgCopyNestedMsgParam(MsgContentParam *pParam1, MsgContentParam *pParam2)
{
if (pParam1->charset == MSG_CHARSET_UNKNOWN)
pParam1->charset = pParam2->charset;
return true;
}
-bool MsgIsMultipartMixed(int type)
+static bool __MsgIsMultipartMixed(int type)
{
if (type == MIME_APPLICATION_VND_WAP_MULTIPART_MIXED || type == MIME_MULTIPART_MIXED) {
return true;
}
}
-bool MsgStrcpyWithoutCRLF(char *pOrg, char **ppNew)
-{
- int nLen = 0;
- int i = 0;
- int index = 0;
- char* pDest = NULL;
-
-
- nLen = strlen(pOrg);
-
- pDest = (char *)malloc(nLen + 1);
-
- if (pDest == NULL) {
- MSG_DEBUG("MsgStrcpyWithoutCRLF: malloc is failed\n");
- return false;
- }
-
- memset(pDest, 0 , (nLen + 1));
-
- for (i = 0; i < nLen ; i++) {
- if (i < nLen - 2) {
- if ((pOrg[i] == MSG_CH_CR && pOrg[i+1] == MSG_CH_LF && pOrg[i+2] == MSG_CH_TAB) ||
- (pOrg[i] == MSG_CH_CR && pOrg[i+1] == MSG_CH_LF && pOrg[i+2] == MSG_CH_SP)) {
- i+=2;
- continue;
- }
- }
- pDest[index++] = pOrg[i];
- }
- *ppNew = pDest;
-
- return true;
-}
-
bool MmsGetMsgAttrib(MmsMsgID msgID, MmsAttrib* pAttrib)
{
MmsMsg *pMsg = NULL;
return true;
}
-bool __MsgIsInvalidFileNameChar(char ch)
+static bool __MsgIsInvalidFileNameChar(char ch)
{
if ((ch == 0x5C /* \ */) ||
(ch == 0x2F /* / */) ||
return false;
}
-bool _MmsDataUpdateLastStatus(MmsMsg *pMsg)
+bool MmsDataUpdateLastStatus(MmsMsg *pMsg)
{
MmsMsgMultiStatus* pStatus = NULL;
return false;
}
-int MsgGetLatin2UTFCodeSize(unsigned char *szSrc, int nChar)
+static int __MsgGetLatin2UTFCodeSize(unsigned char *szSrc, int nChar)
{
int nCount = 0;
return nCount;
}
-int MsgLatin5code2UTF(unsigned char *des, int outBufSize, unsigned char *szSrc, int nChar)
+static int __MsgLatin5code2UTF(unsigned char *des, int outBufSize, unsigned char *szSrc, int nChar)
{
unsigned char *org;
unsigned char t1;
return(des-org);
}
-int MsgGetLatin52UTFCodeSize(unsigned char *szSrc, int nChar)
+static int __MsgGetLatin52UTFCodeSize(unsigned char *szSrc, int nChar)
{
int nCount = 0;
return nCount;
}
-int MsgLatin2UTF(unsigned char *des, int outBufSize, unsigned char *szSrc, int nChar)
+static int __MsgLatin2UTF(unsigned char *des, int outBufSize, unsigned char *szSrc, int nChar)
{
unsigned char* org;
unsigned char t1, t2;
}
-int MsgLatin7code2UTF(unsigned char *des, int outBufSize, unsigned char *szSrc, int nChar)
+static int __MsgLatin7code2UTF(unsigned char *des, int outBufSize, unsigned char *szSrc, int nChar)
{
unsigned char *org;
unsigned char t1;
return(des - org);
}
-int MsgGetLatin72UTFCodeSize(unsigned char *szSrc, int nChar)
+static int __MsgGetLatin72UTFCodeSize(unsigned char *szSrc, int nChar)
{
int nCount = 0;
return nCount;
}
-int MsgUnicode2UTF(unsigned char *des, int outBufSize, unsigned short *szSrc, int nChar)
+static int __MsgUnicode2UTF(unsigned char *des, int outBufSize, unsigned short *szSrc, int nChar)
{
unsigned char *org;
unsigned char t1;
return (des - org);
}
-int MsgGetUnicode2UTFCodeSize(unsigned short *szSrc, int nChar)
+static int __MsgGetUnicode2UTFCodeSize(unsigned short *szSrc, int nChar)
{
int nCount = 0;
return nCount;
}
-bool MmsAddrUtilCheckEmailAddress(char *pszAddr)
+static bool __MmsAddrUtilCheckEmailAddress(char *pszAddr)
{
if (!pszAddr || pszAddr[0] == 0)
return false;
char* pszStrEnd = NULL;
int addressLen = 0;
- if (MmsAddrUtilCheckEmailAddress(pszAddrCopy))
+ if (__MmsAddrUtilCheckEmailAddress(pszAddrCopy))
pszStrEnd = strstr(pszStrStart, "/TYPE=PLMN");
else
pszStrEnd = strstr(pszStrStart, "/");
return true;
}
-int MsgCutUTFString(unsigned char *des, int outBufSize, unsigned char *szSrc, int nChar)
+static int __MsgCutUTFString(unsigned char *des, int outBufSize, unsigned char *szSrc, int nChar)
{
unsigned char *org;
return (des - org);
}
-void MsgMIMERemoveQuote(char *szSrc)
+static void __MsgMIMERemoveQuote(char *szSrc)
{
int length = 0;
}
}
-bool MsgLoadDataToDecodeBuffer(FILE *pFile, char **ppBuf, int *pPtr, int *pOffset, char *pInBuf1, char *pInBuf2, int maxLen, int *pBufLen, int endOfFile)
+static bool __MsgLoadDataToDecodeBuffer(FILE *pFile, char **ppBuf, int *pPtr, int *pOffset, char *pInBuf1, char *pInBuf2, int maxLen, int *pBufLen, int endOfFile)
{
MSG_BEGIN();
int nRead = 0;
* @param index : used for file naming
* @param bSave : if true, file will be save otherwise just filename will be stored.
*/
-bool _MmsMultipartSaveAsTempFile(MsgType *pPartType, MsgBody *pPartBody, char *pszMailboxPath, char *pszMsgFilename, int index, bool bSave)
+static bool __MmsMultipartSaveAsTempFile(MsgType *pPartType, MsgBody *pPartBody, char *pszMailboxPath, char *pszMsgFilename, int index, bool bSave)
{
FILE *pFile = NULL;
// char *pExt = NULL;
#ifndef __SUPPORT_DRM__
- MsgMakeFileName(pPartType->type, szFileName, 0); //FL & CD -> extension(.dm) SD -> extension(.dcf)
+ __MsgMakeFileName(pPartType->type, szFileName, 0); //FL & CD -> extension(.dm) SD -> extension(.dcf)
#else
- MsgMakeFileName(pPartType->type, szFileName, pPartType->drmInfo.drmType, 0); //FL & CD -> extension(.dm) SD -> extension(.dcf)
+ __MsgMakeFileName(pPartType->type, szFileName, pPartType->drmInfo.drmType, 0); //FL & CD -> extension(.dm) SD -> extension(.dcf)
if (MsgDRMIsForwardLockType(pPartType->drmInfo.drmType))
MsgChangeDrm2FileName(szFileName);
#endif
goto __CATCH;
}
- if (MmsGetMediaPartData(pPartType, pPartBody, pFile) == false) {
+ if (__MmsGetMediaPartData(pPartType, pPartBody, pFile) == false) {
MSG_DEBUG("MmsGetMediaPartData fail [index:%d]\n", index);
goto __CATCH;
}
return false;
}
-
-
-bool MmsGetMediaPartData(MsgType *pPartType, MsgBody *pPartBody, FILE* pFile)
+static bool __MmsGetMediaPartData(MsgType *pPartType, MsgBody *pPartBody, FILE* pFile)
{
int nRead = 0;
int nRead2 = 0;
goto __RETURN;
}
- pNewData = MmsGetBinaryUTF8Data(pData, nRead, msgEncodingValue, msgTypeValue, msgCharsetValue, &nRead2);
+ pNewData = __MmsGetBinaryUTF8Data(pData, nRead, msgEncodingValue, msgTypeValue, msgCharsetValue, &nRead2);
pPartType->encoding = MSG_ENCODING_BINARY;
- if (MsgIsText(msgTypeValue))
+ if (__MsgIsText(msgTypeValue))
pPartType->param.charset = MSG_CHARSET_UTF8;
if (MsgWriteFile(pNewData, sizeof(char), nRead2, pFile) != (size_t)nRead2) {
return false;
}
-char *MmsGetBinaryUTF8Data(char *pData, int nRead, int msgEncodingValue, int msgTypeValue, int msgCharsetValue, int *npRead)
+static char *__MmsGetBinaryUTF8Data(char *pData, int nRead, int msgEncodingValue, int msgTypeValue, int msgCharsetValue, int *npRead)
{
int nChar = 0;
int nByte = 0;
switch (msgEncodingValue) {
case MSG_ENCODING_BASE64:
- pConvertedData = (char*)_MsgDecodeBase64((UCHAR*)pData, (ULONG)nRead, (ULONG*)&nByte);
+ pConvertedData = (char*)MsgDecodeBase64((UCHAR*)pData, (ULONG)nRead, (ULONG*)&nByte);
MSG_DEBUG("MmsGetBinaryUTF8Data : MSG_ENCODING_BASE64 bodyLength = %d \n", nByte);
pTemp = pConvertedData;
case MSG_ENCODING_QUOTE_PRINTABLE:
- pConvertedData = (char*)_MsgDecodeQuotePrintable((UCHAR*)pData, (ULONG)nRead, (ULONG*)&nByte);
+ pConvertedData = (char*)MsgDecodeQuotePrintable((UCHAR*)pData, (ULONG)nRead, (ULONG*)&nByte);
MSG_DEBUG("MmsGetBinaryUTF8Data: MSG_ENCODING_QUOTE_PRINTABLE bodyLength = %d \n", nByte);
pTemp = pConvertedData;
break;
}
- if (MsgIsText(msgTypeValue)) {
+ if (__MsgIsText(msgTypeValue)) {
/* charset converting */
switch (msgCharsetValue) {
memcpy(mszTempStr, ((unsigned short*)pTemp + 1), nChar * sizeof(unsigned short));
- nByte = MsgGetUnicode2UTFCodeSize(((unsigned short*)pTemp + 1), nChar);
+ nByte = __MsgGetUnicode2UTFCodeSize(((unsigned short*)pTemp + 1), nChar);
if (nByte < 3)
nByte = 3; //min value
pConvertedStr = (char *)malloc(nByte + 1);
if (pConvertedStr != NULL)
- MsgUnicode2UTF ((unsigned char*)pConvertedStr, nByte + 1, mszTempStr, nChar);
+ __MsgUnicode2UTF ((unsigned char*)pConvertedStr, nByte + 1, mszTempStr, nChar);
} else {
nChar = (nTemp / 2);
memcpy(mszTempStr, ((unsigned short*)pTemp), nChar * sizeof(unsigned short));
- nByte = MsgGetUnicode2UTFCodeSize(((unsigned short*)pTemp), nChar);
+ nByte = __MsgGetUnicode2UTFCodeSize(((unsigned short*)pTemp), nChar);
pConvertedStr = (char *)malloc(nByte + 1);
if (pConvertedStr)
- MsgUnicode2UTF ((unsigned char*)pConvertedStr, nByte + 1, mszTempStr, nChar);
+ __MsgUnicode2UTF ((unsigned char*)pConvertedStr, nByte + 1, mszTempStr, nChar);
}
if (pConvertedStr != NULL)
MSG_DEBUG("MmsGetBinaryUTF8Data: MSG_CHARSET_ISO_8859_7 \n");
- nByte = MsgGetLatin72UTFCodeSize((unsigned char*)pTemp, nTemp);
+ nByte = __MsgGetLatin72UTFCodeSize((unsigned char*)pTemp, nTemp);
pConvertedStr = (char *)malloc(nByte + 1);
if (pConvertedStr)
- MsgLatin7code2UTF((unsigned char*)pConvertedStr, nByte + 1, (unsigned char*)pTemp, nTemp);
+ __MsgLatin7code2UTF((unsigned char*)pConvertedStr, nByte + 1, (unsigned char*)pTemp, nTemp);
pNewData = pConvertedStr;
*npRead = nByte + 1;
/* Turkish */
MSG_DEBUG("MmsGetBinaryUTF8Data: MSG_CHARSET_ISO_8859_9 \n");
- nByte = MsgGetLatin52UTFCodeSize((unsigned char*)pTemp, nTemp);
+ nByte = __MsgGetLatin52UTFCodeSize((unsigned char*)pTemp, nTemp);
pConvertedStr = (char *)malloc(nByte + 1);
if (pConvertedStr)
- MsgLatin5code2UTF((unsigned char*)pConvertedStr, nByte + 1, (unsigned char*)pTemp, nTemp);
+ __MsgLatin5code2UTF((unsigned char*)pConvertedStr, nByte + 1, (unsigned char*)pTemp, nTemp);
pNewData = pConvertedStr;
*npRead = nByte + 1;
MSG_DEBUG("MmsGetBinaryUTF8Data: Other charsets \n");
- nByte = MsgGetLatin2UTFCodeSize((unsigned char*)pTemp, nTemp);
+ nByte = __MsgGetLatin2UTFCodeSize((unsigned char*)pTemp, nTemp);
pConvertedStr = (char *)malloc(nByte + 1);
if (pConvertedStr)
- MsgLatin2UTF((unsigned char*)pConvertedStr, nByte + 1, (unsigned char*)pTemp, nTemp);
+ __MsgLatin2UTF((unsigned char*)pConvertedStr, nByte + 1, (unsigned char*)pTemp, nTemp);
pNewData = pConvertedStr;
*npRead = nByte + 1;
}
#ifndef __SUPPORT_DRM__
-bool MsgMakeFileName(int iMsgType, char *szFileName, int nUntitleIndex)
+static bool __MsgMakeFileName(int iMsgType, char *szFileName, int nUntitleIndex)
{
char szText[MSG_FILENAME_LEN_MAX+1]={0,};
char szTemp[MSG_FILENAME_LEN_MAX+1]={0,};
}
}
#else
-bool MsgMakeFileName(int iMsgType, char *szFileName, MsgDrmType drmType, int nUntitleIndex)
+static bool __MsgMakeFileName(int iMsgType, char *szFileName, MsgDrmType drmType, int nUntitleIndex)
{
char szText[MSG_FILENAME_LEN_MAX+1]={0,};
char szTemp[MSG_FILENAME_LEN_MAX+1]={0,};
MmsPluginStorage::instance()->getMmsMessage(&pMsg);
- _MsgInitMsgType(pHeader);
+ __MsgInitMsgType(pHeader);
/* Requires header of non-presentation */
return true;
}
-bool MmsDebugPrintMulitpartEntry(MsgMultipart *pMultipart, int index)
+static bool __MmsDebugPrintMulitpartEntry(MsgMultipart *pMultipart, int index)
{
MSG_DEBUG("------------------------------\n");
MSG_DEBUG("%dth multipart info\n", index);
MSG_DEBUG("------------------------------\n");
return true;
}
-
switch (drmType) {
case MSG_DRM_FORWARD_LOCK:
pMsgType->drmInfo.drmType = MSG_DRM_TYPE_FL;
- pMsgType->drmInfo.contentType = (MsgContentType)_MsgGetCode(MSG_TYPE, szMimeType);
+ pMsgType->drmInfo.contentType = (MimeType)_MsgGetCode(MSG_TYPE, szMimeType);
if (MsgCopyDrmInfo(pMsgType) == false) {
MSG_DEBUG("MsgDRM2GetDRMInfo : MsgCopyDrmInfo failed");
return false;
case MSG_DRM_SEPARATE_DELIVERY:
pMsgType->drmInfo.drmType = MSG_DRM_TYPE_SD;
- pMsgType->drmInfo.contentType = (MsgContentType)_MsgGetCode(MSG_TYPE, szMimeType);
+ pMsgType->drmInfo.contentType = (MimeType)_MsgGetCode(MSG_TYPE, szMimeType);
drm_content_info_s dcfHdrInfo;
bzero(&dcfHdrInfo, sizeof(drm_content_info_s));
#include <time.h>
#include <stdlib.h>
-#include "MmsPluginMessage.h"
-#include "MmsPluginCodec.h"
+#include "MmsPluginEncode.h"
+#include "MmsPluginCodecTypes.h"
+#include "MmsPluginCodecCommon.h"
#include "MsgDebug.h"
#include "MsgUtilFile.h"
#include "MmsPluginMIME.h"
#include "MmsPluginUtil.h"
-gint _g_time_rev_set = 0;
-gint _g_time_rev = 0;
-
/** Sending message related variables ------------------------ */
-
static char gszMmsEncodeBuf[MSG_MMS_ENCODE_BUFFER_MAX] = {0, };
static int gCurMmsEncodeBuffPos = 0; /* number of characters on gpMmsEncodeBuf */
static int gMmsEncodeMaxLen = 0;
static int gMmsEncodeCurOffset = 0; /* offset in file */
static char *gpMmsEncodeBuf = NULL;
-
/* Acknowledge.ind & NotifyResp.ind related variables ------------------------ */
-
static char gszMmsEncodeBuf2[MSG_MMS_ENCODE_BUFFER_MAX] = {0, };
static int gCurMmsEncodeBuffPos2 = 0; /* number of characters on gpMmsEncodeBuf */
static int gMmsEncodeMaxLen2 = 0;
static int gMmsEncodeCurOffset2 = 0; /* offset in file */
static char *gpMmsEncodeBuf2 = NULL;
-
-bool _MmsBinaryEncodeSendReqHdr(FILE *pFile, MmsMsg *pMsg);
-bool _MmsBinaryEncodeAckIndHdr(FILE *pFile, char *pTrID, bool bReportAllowed);
-bool _MmsBinaryEncodeNotiRespIndHdr(FILE* pFile, char *pTrID, msg_delivery_report_status_t iStatus, bool bReportAllowed);
-bool _MmsBinaryEncodeForwardReqHdr(FILE *pFile, char *szContentLocation, char *szForwardTo, char *szForwardCc, char *szForwardBcc);
-bool _MmsBinaryEncodeReadReport10Hdr(FILE *pFile, MmsMsg *pMsg, msg_read_report_status_t mmsReadStatus);
-bool _MmsBinaryEncodeReadReport11Hdr(FILE *pFile, MmsMsg *pMsg, msg_read_report_status_t mmsReadStatus);
-
-static bool __MmsEncodeSendReq(FILE *pFile, MmsMsg *pMsg, bool bIncludeSendReqHeader);
-static int MmsBinaryEncodeUintvarLen(UINT32 integer);
-static bool MmsBinaryEncodeUintvar(FILE *pFile, UINT32 integer, int length);
-static int MmsBinaryEncodeValueLengthLen(UINT32 integer);
-static bool MmsBinaryEncodeValueLength(FILE *pFile, UINT32 integer, int length);
-static int MmsBinaryEncodeIntegerLen(UINT32 integer);
-static bool MmsBinaryEncodeInteger(FILE *pFile, UINT32 integer, int length);
-static int MmsBinaryEncodeLongIntegerLen(UINT32 integer);
-static bool MmsBinaryEncodeLongInteger(FILE *pFile, UINT32 integer, int length);
-static int MmsBinaryEncodeTextStringLen(UINT8 *source);
-static bool MmsBinaryEncodeTextString(FILE *pFile, UINT8 *source, int length);
-static int MmsBinaryEncodeQuotedStringLen(UINT8 *pSrc);
-static bool MmsBinaryEncodeQuotedString(FILE *pFile, UINT8 *source, int length);
-static int MmsBinaryEncodeEncodedStringLen(UINT8 *source);
-static bool MmsBinaryEncodeEncodedString(FILE *pFile, UINT8 *source, int length);
-bool MmsBinaryEncodeSendReqHdrwithinBufRegi(FILE *pFile, MmsMsg *pMsg);
-bool MmsBinaryEncodeSendReqHdrContTypeFildCode(FILE *pFile, int msgID);
-
-static bool __MmsBinaryEncodeFieldCodeAndValue(FILE *pFile, UINT8 fieldCode, UINT8 fieldValue);
+static int __MmsGetEncodeOffset(void);
+static void __MmsRegisterEncodeBuffer2(char *pInBuff, int maxLen);
+static void __MmsUnregisterEncodeBuffer2(void);
+
+static int __MmsBinaryEncodeUintvarLen(UINT32 integer);
+static bool __MmsBinaryEncodeUintvar(FILE *pFile, UINT32 integer, int length);
+static int __MmsBinaryEncodeValueLengthLen(UINT32 integer);
+static bool __MmsBinaryEncodeValueLength(FILE *pFile, UINT32 integer, int length);
+static int __MmsBinaryEncodeIntegerLen(UINT32 integer);
+static bool __MmsBinaryEncodeInteger(FILE *pFile, UINT32 integer, int length);
+static int __MmsBinaryEncodeLongIntegerLen(UINT32 integer);
+static bool __MmsBinaryEncodeLongInteger(FILE *pFile, UINT32 integer, int length);
+static int __MmsBinaryEncodeTextStringLen(UINT8 *source);
+static bool __MmsBinaryEncodeTextString(FILE *pFile, UINT8 *source, int length);
+static int __MmsBinaryEncodeQuotedStringLen(UINT8 *pSrc);
+static bool __MmsBinaryEncodeQuotedString(FILE *pFile, UINT8 *source, int length);
+static int __MmsBinaryEncodeEncodedStringLen(UINT8 *source);
+static bool __MmsBinaryEncodeEncodedString(FILE *pFile, UINT8 *source, int length);
+
+static int __MmsBinaryEncodeContentTypeLen(MsgType *pType);
+static bool __MmsBinaryEncodeContentType(FILE *pFile, MsgType *pType, int typeLength);
+static int __MmsBinaryEncodeContentHeaderLen(MimeType contentType, MsgType *pType, bool bMultipart);
+static bool __MmsBinaryEncodeContentHeader(FILE *pFile, MimeType contentType, MsgType *pType, bool bMultipart);
+
+static bool __MmsBinaryEncodeContentBody(FILE *pFile, MsgBody *pBody);
+static bool __MmsBinaryEncodeMsgPart(FILE *pFile, int contentType, MsgType *pType, MsgBody *pBody);
static bool __MmsBinaryEncodeMmsVersion(FILE *pFile);
static bool __MmsBinaryEncodeTrID(FILE *pFile, char *szTrID, int bufLen);
static bool __MmsBinaryEncodeOneAddress(FILE *pFile, MmsFieldCode addrType, char *szAddrStr);
static bool __MmsBinaryEncodeAddress(FILE *pFile, MmsFieldCode addrType, char *szAddr);
+static bool __MmsBinaryEncodeFieldCodeAndValue(FILE *pFile, UINT8 fieldCode, UINT8 fieldValue);
+static bool __MmsBinaryEncodeSendReqHdr(FILE *pFile, MmsMsg *pMsg);
+static bool __MmsBinaryEncodeAckIndHdr(FILE *pFile, char *pTrID, bool bReportAllowed);
+static bool __MmsBinaryEncodeNotiRespIndHdr(FILE* pFile, char *pTrID, msg_delivery_report_status_t iStatus, bool bReportAllowed);
+static bool __MmsBinaryEncodeReadReport10Hdr(FILE *pFile, MmsMsg *pMsg, msg_read_report_status_t mmsReadStatus);
+static bool __MmsBinaryEncodeReadReport11Hdr(FILE *pFile, MmsMsg *pMsg, msg_read_report_status_t mmsReadStatus);
-/* Functions for Acknowledge.ind & NotifyResp.ind ------------------------ */
+static bool __MmsBinaryEncodeMsgBody(FILE *pFile, MsgType *pType, MsgBody *pBody, int nPartCount, bool bTemplate);//NEW_TEMPLATE
+static bool __MmsEncodeSendReq(FILE *pFile, MmsMsg *pMsg, bool bIncludeSendReqHeader);
-static bool MmsBinaryEncodeTextString2(FILE *pFile, UINT8 *source, int length);
+/* Functions for Acknowledge.ind & NotifyResp.ind ------------------------ */
+static bool __MmsBinaryEncodeTextString2(FILE *pFile, UINT8 *source, int length);
static bool __MmsBinaryEncodeMmsVersion2(FILE *pFile);
static bool __MmsBinaryEncodeFieldCodeAndValue2(FILE *pFile, UINT8 fieldCode, UINT8 fieldValue);
-extern int MsgProcessUrgentEvent(int iMode);
-
/** -----------------------------------------------------------------
* M M S E N C O D E
* * -----------------------------------------------------------------*/
-
static void __MmsCleanEncodeBuff(void)
{
memset(gpMmsEncodeBuf, 0, MSG_MMS_ENCODE_BUFFER_MAX);
}
-void _MmsRegisterEncodeBuffer(char *pInBuff, int maxLen)
+void MmsRegisterEncodeBuffer(char *pInBuff, int maxLen)
{
gpMmsEncodeBuf = pInBuff;
gCurMmsEncodeBuffPos = 0;
gMmsEncodeCurOffset = 0;
}
-void _MmsUnregisterEncodeBuffer(void)
+void MmsUnregisterEncodeBuffer(void)
{
gpMmsEncodeBuf = NULL;
gCurMmsEncodeBuffPos = 0;
gMmsEncodeCurOffset = 0;
}
-int _MmsGetEncodeOffset(void)
+static int __MmsGetEncodeOffset(void)
{
return (gMmsEncodeCurOffset + gCurMmsEncodeBuffPos);
}
-
-bool _MmsEncodeMsg(void)
-{
- MSG_DEBUG("_MmsEncodeMsg: Start Binary Encoding now ============= \n");
- return true;
-}
-
-
-bool _MmsEncodeSendReq(FILE *pFile, MmsMsg *pMsg)
+bool MmsEncodeSendReq(FILE *pFile, MmsMsg *pMsg)
{
return __MmsEncodeSendReq(pFile, pMsg, true);
}
-
-bool _MmsEncodeTemplate(FILE *pFile, MmsMsg *pMsg)
+bool MmsEncodeTemplate(FILE *pFile, MmsMsg *pMsg)
{
return __MmsEncodeSendReq(pFile, pMsg, false);
}
-
static bool __MmsEncodeSendReq(FILE* pFile, MmsMsg* pMsg, bool bIncludeSendReqHeader)
{
- _MmsRegisterEncodeBuffer(gszMmsEncodeBuf, MSG_MMS_ENCODE_BUFFER_MAX);
+ MmsRegisterEncodeBuffer(gszMmsEncodeBuf, MSG_MMS_ENCODE_BUFFER_MAX);
if (bIncludeSendReqHeader) {
- if (_MmsBinaryEncodeSendReqHdr(pFile, pMsg) == false) {
- _MmsUnregisterEncodeBuffer();
+ if (__MmsBinaryEncodeSendReqHdr(pFile, pMsg) == false) {
+ MmsUnregisterEncodeBuffer();
return false;
}
}
- if (MmsBinaryEncodeMsgBody(pFile, &pMsg->msgType, &pMsg->msgBody, pMsg->nPartCount, !bIncludeSendReqHeader) == false) {
- _MmsUnregisterEncodeBuffer();
+ if (__MmsBinaryEncodeMsgBody(pFile, &pMsg->msgType, &pMsg->msgBody, pMsg->nPartCount, !bIncludeSendReqHeader) == false) {
+ MmsUnregisterEncodeBuffer();
return false;
}
- _MmsUnregisterEncodeBuffer();
+ MmsUnregisterEncodeBuffer();
return true;
}
-
/* Functions for Acknowledge.ind & NotifyResp.ind ------------------------ */
static void __MmsCleanEncodeBuff2(void)
gCurMmsEncodeBuffPos2 = 0;
}
-
-void _MmsRegisterEncodeBuffer2(char *pInBuff, int maxLen)
+static void __MmsRegisterEncodeBuffer2(char *pInBuff, int maxLen)
{
gpMmsEncodeBuf2 = pInBuff;
gCurMmsEncodeBuffPos2 = 0;
gMmsEncodeCurOffset2 = 0;
}
-void _MmsUnregisterEncodeBuffer2(void)
+static void __MmsUnregisterEncodeBuffer2(void)
{
gpMmsEncodeBuf2 = NULL;
gCurMmsEncodeBuffPos2 = 0;
gMmsEncodeCurOffset2 = 0;
}
-
/**
* @param source [in] originam string
* @param length [in] gotten from MmsBinaryEncodeTextStringLen()
* @param dest [in] buffer to store quted string
* @return changed string length
*/
-static bool MmsBinaryEncodeTextString2(FILE *pFile, UINT8 *source, int length)
+static bool __MmsBinaryEncodeTextString2(FILE *pFile, UINT8 *source, int length)
{
MSG_DEBUG("MmsBinaryEncodeTextString2: \n");
return false;
}
-
static bool __MmsBinaryEncodeFieldCodeAndValue2(FILE *pFile, UINT8 fieldCode, UINT8 fieldValue)
{
if ((gMmsEncodeMaxLen2 - gCurMmsEncodeBuffPos2) < 2) {
return false;
}
-
static bool __MmsBinaryEncodeMmsVersion2(FILE *pFile)
{
UINT8 majorVer = MMS_MAJOR_VERSION;
}
}
- gpMmsEncodeBuf2[gCurMmsEncodeBuffPos2++] = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_VERSION) | 0x80;
+ gpMmsEncodeBuf2[gCurMmsEncodeBuffPos2++] = MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_VERSION) | 0x80;
gpMmsEncodeBuf2[gCurMmsEncodeBuffPos2] = (majorVer << 4) | (minorVer & 0x0f) | MSB;
if (gpMmsEncodeBuf2[gCurMmsEncodeBuffPos2] < 0x80) {
return false;
}
-
-bool _MmsBinaryEncodeAckIndHdr(FILE *pFile, char *szTrID, bool bReportAllowed)
+static bool __MmsBinaryEncodeAckIndHdr(FILE *pFile, char *szTrID, bool bReportAllowed)
{
int length = 0;
UINT8 fieldCode = 0xff;
__MmsCleanEncodeBuff2();
/* msgType */
- fieldCode = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_MSGTYPE) | 0x80;
- fieldValue = _MmsGetBinaryValue(MmsCodeMsgType, MMS_MSGTYPE_ACKNOWLEDGE_IND) | 0x80;
+ fieldCode = MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_MSGTYPE) | 0x80;
+ fieldValue = MmsGetBinaryValue(MmsCodeMsgType, MMS_MSGTYPE_ACKNOWLEDGE_IND) | 0x80;
if (__MmsBinaryEncodeFieldCodeAndValue2(pFile, fieldCode, fieldValue) == false) {
MSG_DEBUG("_MmsBinaryEncodeAckIndHdr: msgType error\n");
goto __CATCH;
}
/* trID (other type of message) */
- length = MmsBinaryEncodeTextStringLen((UINT8*)szTrID);
+ length = __MmsBinaryEncodeTextStringLen((UINT8*)szTrID);
if (length == -1) {
MSG_DEBUG("_MmsBinaryEncodeAckIndHdr: MmsBinaryEncodeTextStringLen fail \n");
goto __CATCH;
}
}
- gpMmsEncodeBuf2[gCurMmsEncodeBuffPos2++] = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_TRID) | 0x80;
+ gpMmsEncodeBuf2[gCurMmsEncodeBuffPos2++] = MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_TRID) | 0x80;
- if (MmsBinaryEncodeTextString2(pFile, (UINT8*)szTrID, length) == false) {
+ if (__MmsBinaryEncodeTextString2(pFile, (UINT8*)szTrID, length) == false) {
MSG_DEBUG("_MmsBinaryEncodeAckIndHdr: MmsBinaryEncodeTextString fail\n");
goto __CATCH;
}
/* Report Allowed */
- fieldCode = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_REPORTALLOWED) | 0x80;
+ fieldCode = MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_REPORTALLOWED) | 0x80;
if (bReportAllowed) {
- fieldValue = _MmsGetBinaryValue(MmsCodeReportAllowed, MMS_REPORTALLOWED_YES) | 0x80;
+ fieldValue = MmsGetBinaryValue(MmsCodeReportAllowed, MMS_REPORTALLOWED_YES) | 0x80;
} else {
- fieldValue = _MmsGetBinaryValue(MmsCodeReportAllowed, MMS_REPORTALLOWED_NO) | 0x80;
+ fieldValue = MmsGetBinaryValue(MmsCodeReportAllowed, MMS_REPORTALLOWED_NO) | 0x80;
}
if (__MmsBinaryEncodeFieldCodeAndValue2(pFile, fieldCode, fieldValue) == false) {
return false;
}
-
-
-bool _MmsBinaryEncodeNotiRespIndHdr(FILE *pFile, char *szTrID, msg_delivery_report_status_t iStatus, bool bReportAllowed)
+static bool __MmsBinaryEncodeNotiRespIndHdr(FILE *pFile, char *szTrID, msg_delivery_report_status_t iStatus, bool bReportAllowed)
{
int length = 0;
UINT8 fieldCode = 0xff;
__MmsCleanEncodeBuff2();
/* msgType */
- fieldCode = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_MSGTYPE) | 0x80;
- fieldValue = _MmsGetBinaryValue(MmsCodeMsgType, MMS_MSGTYPE_NOTIFYRESP_IND) | 0x80;
+ fieldCode = MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_MSGTYPE) | 0x80;
+ fieldValue = MmsGetBinaryValue(MmsCodeMsgType, MMS_MSGTYPE_NOTIFYRESP_IND) | 0x80;
if (__MmsBinaryEncodeFieldCodeAndValue2(pFile, fieldCode, fieldValue) == false) {
MSG_DEBUG("_MmsBinaryEncodeNotiRespIndHdr: msgType error\n");
/* trID (other type of message) */
- length = MmsBinaryEncodeTextStringLen((UINT8*)szTrID);
+ length = __MmsBinaryEncodeTextStringLen((UINT8*)szTrID);
if (length == -1) {
MSG_DEBUG("_MmsBinaryEncodeNotiRespIndHdr: MmsBinaryEncodeTextStringLen fail \n");
goto __CATCH;
}
}
- gpMmsEncodeBuf2[gCurMmsEncodeBuffPos2++] = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_TRID) | 0x80;
- if (MmsBinaryEncodeTextString2(pFile, (UINT8*)szTrID, length) == false) {
+ gpMmsEncodeBuf2[gCurMmsEncodeBuffPos2++] = MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_TRID) | 0x80;
+ if (__MmsBinaryEncodeTextString2(pFile, (UINT8*)szTrID, length) == false) {
MSG_DEBUG("_MmsBinaryEncodeNotiRespIndHdr: MmsBinaryEncodeTextString fail\n");
goto __CATCH;
}
MSG_DEBUG("_MmsBinaryEncodeNotiRespIndHdr: MsgStatus = %d\n", iStatus);
if (iStatus != MSG_DELIVERY_REPORT_NONE) {
- fieldCode = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_MSGSTATUS) | 0x80;
- fieldValue = _MmsGetBinaryValue(MmsCodeMsgStatus, iStatus) | 0x80;
+ fieldCode = MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_MSGSTATUS) | 0x80;
+ fieldValue = MmsGetBinaryValue(MmsCodeMsgStatus, iStatus) | 0x80;
if (__MmsBinaryEncodeFieldCodeAndValue2(pFile, fieldCode, fieldValue) == false) {
MSG_DEBUG("_MmsBinaryEncodeNotiRespIndHdr: MsgStatus error\n");
goto __CATCH;
/* Report Allowed */
- fieldCode = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_REPORTALLOWED) | 0x80;
+ fieldCode = MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_REPORTALLOWED) | 0x80;
if (bReportAllowed) {
- fieldValue = _MmsGetBinaryValue(MmsCodeReportAllowed, MMS_REPORTALLOWED_YES) | 0x80;
+ fieldValue = MmsGetBinaryValue(MmsCodeReportAllowed, MMS_REPORTALLOWED_YES) | 0x80;
} else {
- fieldValue = _MmsGetBinaryValue(MmsCodeReportAllowed, MMS_REPORTALLOWED_NO) | 0x80;
+ fieldValue = MmsGetBinaryValue(MmsCodeReportAllowed, MMS_REPORTALLOWED_NO) | 0x80;
}
if (__MmsBinaryEncodeFieldCodeAndValue2(pFile, fieldCode, fieldValue) == false) {
return false;
}
-
-bool _MmsEncodeAckInd(FILE *pFile, char *pTrID, bool bReportAllowed)
+bool MmsEncodeAckInd(FILE *pFile, char *pTrID, bool bReportAllowed)
{
- _MmsRegisterEncodeBuffer2(gszMmsEncodeBuf2, MSG_MMS_ENCODE_BUFFER_MAX);
+ __MmsRegisterEncodeBuffer2(gszMmsEncodeBuf2, MSG_MMS_ENCODE_BUFFER_MAX);
MSG_DEBUG("_MmsEncodeAckInd: Start Binary Encoding now ============= \n");
- if (_MmsBinaryEncodeAckIndHdr(pFile, pTrID, bReportAllowed) == false) {
+ if (__MmsBinaryEncodeAckIndHdr(pFile, pTrID, bReportAllowed) == false) {
MSG_DEBUG("_MmsEncodeAckInd: SendReq Binary encoding fail \n");
goto __CATCH;
}
- _MmsUnregisterEncodeBuffer2();
+ __MmsUnregisterEncodeBuffer2();
return true;
__CATCH:
MSG_DEBUG("## _MmsEncodeAckInd: failed");
- _MmsUnregisterEncodeBuffer2();
+ __MmsUnregisterEncodeBuffer2();
return false;
}
-
-
-bool _MmsEncodeNotiRespInd(FILE *pFile, char *pTrID, msg_delivery_report_status_t iStatus, bool bReportAllowed)
+bool MmsEncodeNotiRespInd(FILE *pFile, char *pTrID, msg_delivery_report_status_t iStatus, bool bReportAllowed)
{
- _MmsRegisterEncodeBuffer2(gszMmsEncodeBuf2, MSG_MMS_ENCODE_BUFFER_MAX);
+ __MmsRegisterEncodeBuffer2(gszMmsEncodeBuf2, MSG_MMS_ENCODE_BUFFER_MAX);
MSG_DEBUG("_MmsEncodeNotiRespInd: Start Binary Encoding now ============= \n");
- if (_MmsBinaryEncodeNotiRespIndHdr(pFile, pTrID, iStatus, bReportAllowed) == false) {
+ if (__MmsBinaryEncodeNotiRespIndHdr(pFile, pTrID, iStatus, bReportAllowed) == false) {
MSG_DEBUG("_MmsEncodeNotiRespInd: SendReq Binary encoding fail \n");
goto __CATCH;
}
- _MmsUnregisterEncodeBuffer2();
+ __MmsUnregisterEncodeBuffer2();
return true;
return false;
}
-
/* Functions for Acknowledge.ind & NotifyResp.ind (END) ------------------------ */
-bool _MmsEncodeReadReport10(FILE *pFile, MmsMsg *pMsg, msg_read_report_status_t mmsReadStatus)
+bool MmsEncodeReadReport10(FILE *pFile, MmsMsg *pMsg, msg_read_report_status_t mmsReadStatus)
{
char *pText = NULL;
MsgMultipart *pPart = NULL;
time_t RawTime = 0;
time_t dateSec = 0;
- _MmsRegisterEncodeBuffer(gszMmsEncodeBuf, MSG_MMS_ENCODE_BUFFER_MAX);
+ MmsRegisterEncodeBuffer(gszMmsEncodeBuf, MSG_MMS_ENCODE_BUFFER_MAX);
MSG_DEBUG("_MmsEncodeMsg: Start Binary Encoding now V1.0============= \n");
- if (_MmsBinaryEncodeReadReport10Hdr(pFile, pMsg, mmsReadStatus) == false) {
+ if (__MmsBinaryEncodeReadReport10Hdr(pFile, pMsg, mmsReadStatus) == false) {
MSG_DEBUG("_MmsEncodeReadReport10: SendReq Binary encoding fail \n");
goto __CATCH;
}
msgBody.body.pMultipart = pPart;
- if (MmsBinaryEncodeMsgBody(pFile, &msgType, &msgBody, 1, false) == false) {
+ if (__MmsBinaryEncodeMsgBody(pFile, &msgType, &msgBody, 1, false) == false) {
MSG_DEBUG("__MmsSendReadReportV10: MmsBinaryEncodeMsgBody fail \n");
goto __CATCH;
}
pPart = NULL;
}
- _MmsUnregisterEncodeBuffer();
+ MmsUnregisterEncodeBuffer();
return true;
pPart = NULL;
}
- _MmsUnregisterEncodeBuffer();
+ MmsUnregisterEncodeBuffer();
return false;
}
-
-bool _MmsEncodeReadReport11(FILE *pFile, MmsMsg *pMsg, msg_read_report_status_t mmsReadStatus)
+bool MmsEncodeReadReport11(FILE *pFile, MmsMsg *pMsg, msg_read_report_status_t mmsReadStatus)
{
- _MmsRegisterEncodeBuffer(gszMmsEncodeBuf, MSG_MMS_ENCODE_BUFFER_MAX);
+ MmsRegisterEncodeBuffer(gszMmsEncodeBuf, MSG_MMS_ENCODE_BUFFER_MAX);
MSG_DEBUG("_MmsEncodeMsg: Start Binary Encoding now V1.1============= \n");
- if (_MmsBinaryEncodeReadReport11Hdr(pFile, pMsg, mmsReadStatus) == false) {
+ if (__MmsBinaryEncodeReadReport11Hdr(pFile, pMsg, mmsReadStatus) == false) {
MSG_DEBUG("_MmsEncodeMsg: SendReq Binary encoding fail \n");
goto __CATCH;
}
- _MmsUnregisterEncodeBuffer();
+ MmsUnregisterEncodeBuffer();
return true;
__CATCH:
- _MmsUnregisterEncodeBuffer();
+ MmsUnregisterEncodeBuffer();
return false;
}
-
-
/* ==========================================================
B I N A R Y E N C O D I N G
* | Data | | Data Length
* ----------------------------- -
*/
-
-bool _MmsBinaryEncodeSendReqHdr(FILE *pFile, MmsMsg *pMsg)
+static bool __MmsBinaryEncodeSendReqHdr(FILE *pFile, MmsMsg *pMsg)
{
UINT8 fieldCode = 0xff;
UINT8 fieldValue = 0xff;
__MmsCleanEncodeBuff();
/* msgType */
- fieldCode = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_MSGTYPE) | 0x80;
- fieldValue = _MmsGetBinaryValue(MmsCodeMsgType, MMS_MSGTYPE_SEND_REQ) | 0x80;
+ fieldCode = MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_MSGTYPE) | 0x80;
+ fieldValue = MmsGetBinaryValue(MmsCodeMsgType, MMS_MSGTYPE_SEND_REQ) | 0x80;
if (__MmsBinaryEncodeFieldCodeAndValue(pFile, fieldCode, fieldValue) == false) {
MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: msgType error\n");
goto __CATCH;
/* Subject = Encoded-string-value */
if (pMsg->mmsAttrib.szSubject[0]) {
- length = MmsBinaryEncodeEncodedStringLen((UINT8*)pMsg->mmsAttrib.szSubject);
+ length = __MmsBinaryEncodeEncodedStringLen((UINT8*)pMsg->mmsAttrib.szSubject);
if (length == -1) {
MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: subject MmsBinaryEncodeEncodedStringLen fail \n");
goto __CATCH;
}
}
- fieldCode = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_SUBJECT) | 0x80;
+ fieldCode = MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_SUBJECT) | 0x80;
gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = fieldCode;
- if (MmsBinaryEncodeEncodedString(pFile, (UINT8*)pMsg->mmsAttrib.szSubject, length) == false) {
+ if (__MmsBinaryEncodeEncodedString(pFile, (UINT8*)pMsg->mmsAttrib.szSubject, length) == false) {
MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: subject MmsBinaryEncodeEncodedString fail \n");
goto __CATCH;
}
/* MMS-1.3-con-739 */
/* Msg class */
- fieldCode = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_MSGCLASS) | 0x80;
- fieldValue = _MmsGetBinaryValue(MmsCodeMsgClass, (int)pMsg->mmsAttrib.msgClass) | 0x80;
+ fieldCode = MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_MSGCLASS) | 0x80;
+ fieldValue = MmsGetBinaryValue(MmsCodeMsgClass, (int)pMsg->mmsAttrib.msgClass) | 0x80;
if (__MmsBinaryEncodeFieldCodeAndValue(pFile, fieldCode, fieldValue) == false) {
MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: msgClass error\n");
goto __CATCH;
if (pMsg->mmsAttrib.priority!= MMS_PRIORITY_ERROR && pMsg->mmsAttrib.priority!= MMS_PRIORITY_NORMAL) {
/* MMS_PRIORITY_NORMAL is default : don't send optional field */
- fieldCode = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_PRIORITY)|0x80;
- fieldValue = _MmsGetBinaryValue(MmsCodePriority, pMsg->mmsAttrib.priority)|0x80;
+ fieldCode = MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_PRIORITY)|0x80;
+ fieldValue = MmsGetBinaryValue(MmsCodePriority, pMsg->mmsAttrib.priority)|0x80;
if (__MmsBinaryEncodeFieldCodeAndValue(pFile, fieldCode, fieldValue) == false) {
MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: priority error\n");
/* Sender Visible (hide | show) */
if (pMsg->mmsAttrib.bHideAddress == true) {
- fieldCode = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_SENDERVISIBILLITY) | MSB;
- fieldValue = _MmsGetBinaryValue(MmsCodeSenderVisibility, MMS_SENDER_HIDE) | 0x80;
+ fieldCode = MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_SENDERVISIBILLITY) | MSB;
+ fieldValue = MmsGetBinaryValue(MmsCodeSenderVisibility, MMS_SENDER_HIDE) | 0x80;
if (__MmsBinaryEncodeFieldCodeAndValue(pFile, fieldCode, fieldValue) == false) {
MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: sender visibility error\n");
}
/* Delivery Report (yes | no) */
- fieldCode = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_DELIVERYREPORT)|0x80;
+ fieldCode = MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_DELIVERYREPORT)|0x80;
if (pMsg->mmsAttrib.bAskDeliveryReport) {
- fieldValue = _MmsGetBinaryValue(MmsCodeDeliveryReport, MMS_REPORT_YES) | 0x80;
+ fieldValue = MmsGetBinaryValue(MmsCodeDeliveryReport, MMS_REPORT_YES) | 0x80;
} else {
- fieldValue = _MmsGetBinaryValue(MmsCodeDeliveryReport, MMS_REPORT_NO) | 0x80;
+ fieldValue = MmsGetBinaryValue(MmsCodeDeliveryReport, MMS_REPORT_NO) | 0x80;
}
if (__MmsBinaryEncodeFieldCodeAndValue(pFile, fieldCode, fieldValue) == false) {
}
/* Read Reply (Yes | no) */
- fieldCode = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_READREPLY)|0x80;
+ fieldCode = MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_READREPLY)|0x80;
if (pMsg->mmsAttrib.bAskReadReply) {
- fieldValue = _MmsGetBinaryValue(MmsCodeReadReply, MMS_REPORT_YES)|0x80;
+ fieldValue = MmsGetBinaryValue(MmsCodeReadReply, MMS_REPORT_YES)|0x80;
} else {
- fieldValue = _MmsGetBinaryValue(MmsCodeReadReply, MMS_REPORT_NO)|0x80;
+ fieldValue = MmsGetBinaryValue(MmsCodeReadReply, MMS_REPORT_NO)|0x80;
}
if (__MmsBinaryEncodeFieldCodeAndValue(pFile, fieldCode, fieldValue) == false) {
(pMsg->mmsAttrib.replyCharge.chargeType == MMS_REPLY_REQUESTED_TEXT_ONLY)) {
// reply charging
- fieldCode = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_REPLYCHARGING)|0x80;
- fieldValue = _MmsGetBinaryValue(MmsCodeReadReply, pMsg->mmsAttrib.replyCharge.chargeType)|0x80;
+ fieldCode = MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_REPLYCHARGING)|0x80;
+ fieldValue = MmsGetBinaryValue(MmsCodeReadReply, pMsg->mmsAttrib.replyCharge.chargeType)|0x80;
if (__MmsBinaryEncodeFieldCodeAndValue(pFile, fieldCode, fieldValue) == false) {
MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: replyCharging error\n");
/** fixme: Reply-charging-size */
if (pMsg->mmsAttrib.replyCharge.chargeSize > 0) {
- length = MmsBinaryEncodeIntegerLen(pMsg->mmsAttrib.replyCharge.chargeSize);
+ length = __MmsBinaryEncodeIntegerLen(pMsg->mmsAttrib.replyCharge.chargeSize);
if ((gMmsEncodeMaxLen - gCurMmsEncodeBuffPos) < (length + 1)) {
if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos,
}
}
- gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_REPLYCHARGINGSIZE) | 0x80;
+ gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_REPLYCHARGINGSIZE) | 0x80;
- if (MmsBinaryEncodeInteger(pFile, pMsg->mmsAttrib.replyCharge.chargeSize, length) == false) {
+ if (__MmsBinaryEncodeInteger(pFile, pMsg->mmsAttrib.replyCharge.chargeSize, length) == false) {
MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: replyChargingSize MmsBinaryEncodeInteger error\n");
goto __CATCH;
}
/** fixme: Reply-charging-ID ----> used only when reply message */
if (pMsg->mmsAttrib.replyCharge.szChargeID[0]) {
- length = MmsBinaryEncodeTextStringLen((UINT8*)pMsg->mmsAttrib.replyCharge.szChargeID);
+ length = __MmsBinaryEncodeTextStringLen((UINT8*)pMsg->mmsAttrib.replyCharge.szChargeID);
if (length == -1) {
MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: szReplyChargingID MmsBinaryEncodeTextStringLen fail\n");
goto __CATCH;
}
}
- gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_REPLYCHARGINGID) | 0x80;
+ gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_REPLYCHARGINGID) | 0x80;
- if (MmsBinaryEncodeTextString(pFile, (UINT8*)pMsg->mmsAttrib.replyCharge.szChargeID, length) == false) {
- MSG_DEBUG("_MmsBinaryEncodeForwardReqHdr: szContentLocation MmsBinaryEncodeTextString fail\n");
+ if (__MmsBinaryEncodeTextString(pFile, (UINT8*)pMsg->mmsAttrib.replyCharge.szChargeID, length) == false) {
+ MSG_DEBUG("szContentLocation MmsBinaryEncodeTextString fail\n");
goto __CATCH;
}
}
return false;
}
-bool MmsBinaryEncodeSendReqHdrwithinBufRegi(FILE *pFile, MmsMsg *pMsg)
-{
- bool ret = false;
-
- _MmsRegisterEncodeBuffer(gszMmsEncodeBuf, MSG_MMS_ENCODE_BUFFER_MAX);
- ret = _MmsBinaryEncodeSendReqHdr(pFile, pMsg);
- _MmsUnregisterEncodeBuffer();
-
- return ret;
-}
-
-bool _MmsBinaryEncodeContentTypeFieldCode(FILE *pFile, int msgID)
-{
- if ((gMmsEncodeMaxLen - gCurMmsEncodeBuffPos) < 2) {
- if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos,
- gMmsEncodeMaxLen, &gMmsEncodeCurOffset) == false) {
- MSG_DEBUG("__MmsBinaryEncodeMmsVersion: MsgWriteDataFromEncodeBuffer fail \n");
- return false;
- }
- }
-
- gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_CONTENTTYPE) | 0x80;
-
- if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos, gMmsEncodeMaxLen, &gMmsEncodeCurOffset) == false) {
- MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: remained data MsgWriteDataFromEncodeBuffer fail \n");
- return false;
- }
-
- return true;
-}
-
-bool MmsBinaryEncodeSendReqHdrContTypeFildCode(FILE *pFile, int msgID)
-{
- bool ret = false;
-
- _MmsRegisterEncodeBuffer(gszMmsEncodeBuf, MSG_MMS_ENCODE_BUFFER_MAX);
-
- ret = _MmsBinaryEncodeContentTypeFieldCode(pFile, msgID);
-
- _MmsUnregisterEncodeBuffer();
-
-
- return ret;
-}
-
-#if 0
-bool
-_MmsBinaryEncodeForwardReqHdr(FILE* pFile, char* szContentLocation, char* szForwardTo, char* szForwardCc, char* szForwardBcc)
-{
- int length = 0;
- UINT8 fieldCode = 0xff;
- UINT8 fieldValue = 0xff;
- UINT32 date = 0;
-
-
- __MmsCleanEncodeBuff();
-
- /* msgType */
- fieldCode = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_MSGTYPE) | 0x80;
- fieldValue = _MmsGetBinaryValue(MmsCodeMsgType, MMS_MSGTYPE_FORWARD_REQ) | 0x80;
- if (__MmsBinaryEncodeFieldCodeAndValue(pFile, fieldCode, fieldValue) == false)
- {
- MSG_DEBUG("_MmsBinaryEncodeForwardReqHdr: msgType error\n");
- goto __CATCH;
- }
-
-
- /* trID (other type of message) */
- if (__MmsBinaryEncodeTrID(pFile, NULL, 0) == false)
- {
- MSG_DEBUG("_MmsBinaryEncodeForwardReqHdr: __MmsBinaryEncodeTrID error\n");
- goto __CATCH;
- }
-
-
- /* MMS version (currently we use 1.0 : VDF Spain's version) */
- if (__MmsBinaryEncodeMmsVersion(pFile) == false)
- {
- MSG_DEBUG("_MmsBinaryEncodeForwardReqHdr: __MmsBinaryEncodeMmsVersion error\n");
- goto __CATCH;
- }
-
-
- /* Date = Long-integer */
- if (!__MmsBinaryEncodeDate(pFile))
- {
- MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: __MmsBinaryEncodeDate error\n");
- goto __CATCH;
- }
-
- /* From : Insert Token mode */
- if (__MmsBinaryEncodeFrom(pFile) == false)
- {
- MSG_DEBUG("_MmsBinaryEncodeForwardReqHdr: __MmsBinaryEncodeFrom fail\n");
- goto __CATCH;
- }
-
-
- /* To = Encoded-string */
- if (__MmsBinaryEncodeAddress(pFile,
- MMS_CODE_TO,
- szForwardTo) == false)
- {
- MSG_DEBUG("_MmsBinaryEncodeForwardReqHdr: To __MmsBinaryEncodeAddress fail\n");
- goto __CATCH;
- }
-
-
- /* Cc = Encoded-string */
- if (__MmsBinaryEncodeAddress(pFile,
- MMS_CODE_CC,
- szForwardCc) == false)
- {
- MSG_DEBUG("_MmsBinaryEncodeForwardReqHdr: Cc __MmsBinaryEncodeAddress fail\n");
- goto __CATCH;
- }
-
-
- /* Bcc = Encoded-string */
- if (__MmsBinaryEncodeAddress(pFile,
- MMS_CODE_BCC,
- szForwardBcc) == false)
- {
- MSG_DEBUG("_MmsBinaryEncodeForwardReqHdr: Bcc __MmsBinaryEncodeAddress fail\n");
- goto __CATCH;
- }
-
-
- /* Expiry Time : Value-length Absolute-token Date-value */
- if (gMmsSetup.sendSetup.bExpiryUseCustomTime == true) //jhlee expiry time use custom time
- {
- if (__MmsBinaryEncodeTime(pFile,
- MMS_CODE_EXPIRYTIME,
- gMmsSetup.sendSetup.expiryCustomTime) == false)
- {
- MSG_DEBUG("_MmsBinaryEncodeForwardReqHdr: expiryTime __MmsBinaryEncodeTime fail\n");
- goto __CATCH;
- }
- }
- else
- {
- if (__MmsBinaryEncodeTime(pFile,
- MMS_CODE_EXPIRYTIME,
- gMmsSetup.sendSetup.expiryTime) == false)
- {
- MSG_DEBUG("_MmsBinaryEncodeForwardReqHdr: expiryTime __MmsBinaryEncodeTime fail\n");
- goto __CATCH;
- }
-
- }
-
-
- /* Delivery Time : Value-length Absolute-token Date-value */
- if (__MmsBinaryEncodeTime(pFile,
- MMS_CODE_DELIVERYTIME,
- gMmsSetup.sendSetup.deliveryTime) == false)
- {
- MSG_DEBUG("_MmsBinaryEncodeForwardReqHdr: deliveryTime __MmsBinaryEncodeTime fail\n");
- goto __CATCH;
- }
-
-
- /* Report Allowed */
- fieldCode = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_REPORTALLOWED) | 0x80;
- if (gMmsSetup.recvSetup.bSendDeliveryReport)
- fieldValue = _MmsGetBinaryValue(MmsCodeReportAllowed,
- MMS_REPORTALLOWED_YES) | 0x80;
- else
- fieldValue = _MmsGetBinaryValue(MmsCodeReportAllowed,
- MMS_REPORTALLOWED_NO) | 0x80;
- if (__MmsBinaryEncodeFieldCodeAndValue(pFile, fieldCode, fieldValue) == false)
- {
- MSG_DEBUG("_MmsBinaryEncodeForwardReqHdr: Report Allowed error\n");
- goto __CATCH;
- }
-
-
- /* Delivery Report */
- fieldCode = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_DELIVERYREPORT) | 0x80;
- if (gMmsSetup.recvSetup.bSendDeliveryReport)
- fieldValue = _MmsGetBinaryValue(MmsCodeDeliveryReport,
- MMS_REPORT_YES) | 0x80;
- else
- fieldValue = _MmsGetBinaryValue(MmsCodeDeliveryReport,
- MMS_REPORT_NO) | 0x80;
- if (__MmsBinaryEncodeFieldCodeAndValue(pFile, fieldCode, fieldValue) == false)
- {
- MSG_DEBUG("_MmsBinaryEncodeForwardReqHdr: Report Allowed error\n");
- goto __CATCH;
- }
-
-
- /* Read Reply */
- fieldCode = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_READREPLY) | 0x80;
- if (gMmsSetup.recvSetup.bSendDeliveryReport)
- fieldValue = _MmsGetBinaryValue(MmsCodeReadReply,
- MMS_REPORT_YES) | 0x80;
- else
- fieldValue = _MmsGetBinaryValue(MmsCodeReadReply,
- MMS_REPORT_NO) | 0x80;
- if (__MmsBinaryEncodeFieldCodeAndValue(pFile, fieldCode, fieldValue) == false)
- {
- MSG_DEBUG("_MmsBinaryEncodeForwardReqHdr: Read Reply error\n");
- goto __CATCH;
- }
-
-
- /* Content Location */
- if (szContentLocation[0])
- {
- length = MmsBinaryEncodeTextStringLen((UINT8*)szContentLocation);
- if (length == -1)
- {
- MSG_DEBUG("_MmsBinaryEncodeForwardReqHdr: szContentLocation MmsBinaryEncodeTextStringLen fail\n");
- goto __CATCH;
- }
-
- if ((gMmsEncodeMaxLen - gCurMmsEncodeBuffPos) < (length + 1)) // + fieldCode
- {
- if (MsgWriteDataFromEncodeBuffer(pFile,
- gpMmsEncodeBuf,
- &gCurMmsEncodeBuffPos,
- gMmsEncodeMaxLen,
- &gMmsEncodeCurOffset) == false)
- {
- MSG_DEBUG("_MmsBinaryEncodeSendReqHdr: MsgWriteDataFromEncodeBuffer fail \n");
- goto __CATCH;
- }
- }
-
- gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = _MmsGetBinaryValue(MmsCodeFieldCode,
- MMS_CODE_CONTENTLOCATION) | 0x80;
- if (MmsBinaryEncodeTextString(pFile, (UINT8*)szContentLocation, length) == false)
- {
- MSG_DEBUG("_MmsBinaryEncodeForwardReqHdr: szContentLocation MmsBinaryEncodeTextString fail\n");
- goto __CATCH;
- }
- }
-
- /* flush remained data on encoding file */
- if (MsgWriteDataFromEncodeBuffer(pFile,
- gpMmsEncodeBuf,
- &gCurMmsEncodeBuffPos,
- gMmsEncodeMaxLen,
- &gMmsEncodeCurOffset) == false)
- {
- MSG_DEBUG("_MmsBinaryEncodeForwardReqHdr: remained data MsgWriteDataFromEncodeBuffer fail \n");
- goto __CATCH;
- }
-
- return true;
-
-__CATCH:
-
- MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos, gMmsEncodeMaxLen, &gMmsEncodeCurOffset);
- return false;
-}
-#endif
-
-
-bool _MmsBinaryEncodeReadReport10Hdr(FILE *pFile, MmsMsg *pMsg, msg_read_report_status_t mmsReadStatus)
+static bool __MmsBinaryEncodeReadReport10Hdr(FILE *pFile, MmsMsg *pMsg, msg_read_report_status_t mmsReadStatus)
{
int length = 0;
char *szTo = NULL;
__MmsCleanEncodeBuff();
/* msgType */
- fieldCode = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_MSGTYPE) | 0x80;
- fieldValue = _MmsGetBinaryValue(MmsCodeMsgType, MMS_MSGTYPE_SEND_REQ) | 0x80;
+ fieldCode = MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_MSGTYPE) | 0x80;
+ fieldValue = MmsGetBinaryValue(MmsCodeMsgType, MMS_MSGTYPE_SEND_REQ) | 0x80;
if (__MmsBinaryEncodeFieldCodeAndValue(pFile, fieldCode, fieldValue) == false) {
MSG_DEBUG("_MmsBinaryEncodeReadReport10Hdr: msgType error\n");
goto __CATCH;
}
}
- length = MmsBinaryEncodeEncodedStringLen((UINT8*)szSubject);
+ length = __MmsBinaryEncodeEncodedStringLen((UINT8*)szSubject);
if (length == -1) {
MSG_DEBUG("_MmsBinaryEncodeReadReport10Hdr: subject MmsBinaryEncodeEncodedStringLen fail \n");
goto __CATCH;
}
}
- fieldCode = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_SUBJECT) | 0x80;
+ fieldCode = MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_SUBJECT) | 0x80;
gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = fieldCode;
- if (MmsBinaryEncodeEncodedString(pFile, (UINT8*)szSubject, length) == false) {
+ if (__MmsBinaryEncodeEncodedString(pFile, (UINT8*)szSubject, length) == false) {
MSG_DEBUG("_MmsBinaryEncodeReadReport10Hdr: subject MmsBinaryEncodeEncodedString fail \n");
goto __CATCH;
}
/* Msg class */
- fieldCode = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_MSGCLASS) | 0x80;
- fieldValue = _MmsGetBinaryValue(MmsCodeMsgClass, MMS_MSGCLASS_AUTO) | 0x80;
+ fieldCode = MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_MSGCLASS) | 0x80;
+ fieldValue = MmsGetBinaryValue(MmsCodeMsgClass, MMS_MSGCLASS_AUTO) | 0x80;
if (__MmsBinaryEncodeFieldCodeAndValue(pFile, fieldCode, fieldValue) == false) {
MSG_DEBUG("_MmsBinaryEncodeReadReport10Hdr: msgClass error\n");
goto __CATCH;
/* Delivery Report (yes | no) */
- fieldCode = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_DELIVERYREPORT) | 0x80;
- fieldValue = _MmsGetBinaryValue(MmsCodeDeliveryReport, MMS_REPORT_NO) | 0x80;
+ fieldCode = MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_DELIVERYREPORT) | 0x80;
+ fieldValue = MmsGetBinaryValue(MmsCodeDeliveryReport, MMS_REPORT_NO) | 0x80;
if (__MmsBinaryEncodeFieldCodeAndValue(pFile, fieldCode, fieldValue) == false) {
MSG_DEBUG("_MmsBinaryEncodeReadReport10Hdr: Delivery Report error\n");
goto __CATCH;
/* Read Reply (Yes | no) */
- fieldCode = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_READREPLY) | 0x80;
- fieldValue = _MmsGetBinaryValue(MmsCodeReadReply, MMS_REPORT_NO) | 0x80;
+ fieldCode = MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_READREPLY) | 0x80;
+ fieldValue = MmsGetBinaryValue(MmsCodeReadReply, MMS_REPORT_NO) | 0x80;
if (__MmsBinaryEncodeFieldCodeAndValue(pFile, fieldCode, fieldValue) == false) {
MSG_DEBUG("_MmsBinaryEncodeReadReport10Hdr: Read Reply error\n");
goto __CATCH;
/* Sender Visible (hide | show) */
- fieldCode = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_SENDERVISIBILLITY) | 0x80;
- fieldValue = _MmsGetBinaryValue(MmsCodeSenderVisibility, MMS_SENDER_SHOW) | 0x80;
+ fieldCode = MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_SENDERVISIBILLITY) | 0x80;
+ fieldValue = MmsGetBinaryValue(MmsCodeSenderVisibility, MMS_SENDER_SHOW) | 0x80;
if (__MmsBinaryEncodeFieldCodeAndValue(pFile, fieldCode, fieldValue) == false) {
MSG_DEBUG("_MmsBinaryEncodeReadReport10Hdr: Sender Visible error\n");
goto __CATCH;
}
- /* fixme: msgContentType */
+ /* fixme: MimeType */
/* fixme: msgHeader */
/* fixme: msgBody */
return false;
}
-
-
-bool _MmsBinaryEncodeReadReport11Hdr(FILE *pFile, MmsMsg *pMsg, msg_read_report_status_t mmsReadStatus)
+static bool __MmsBinaryEncodeReadReport11Hdr(FILE *pFile, MmsMsg *pMsg, msg_read_report_status_t mmsReadStatus)
{
UINT8 fieldCode = 0xff;
UINT8 fieldValue = 0xff;
__MmsCleanEncodeBuff();
/* msgType */
- fieldCode = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_MSGTYPE) | 0x80;
- fieldValue = _MmsGetBinaryValue(MmsCodeMsgType, MMS_MSGTYPE_READREC_IND) | 0x80;
+ fieldCode = MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_MSGTYPE) | 0x80;
+ fieldValue = MmsGetBinaryValue(MmsCodeMsgType, MMS_MSGTYPE_READREC_IND) | 0x80;
if (__MmsBinaryEncodeFieldCodeAndValue(pFile, fieldCode, fieldValue) == false) {
MSG_DEBUG("_MmsBinaryEncodeReadReport11Hdr: msgType error\n");
goto __CATCH;
}
/* Read Status (Yes | no) */
- fieldCode = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_READSTATUS) | 0x80;
- fieldValue = _MmsGetBinaryValue(MmsCodeReadStatus, mmsReadStatus) | 0x80;
+ fieldCode = MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_READSTATUS) | 0x80;
+ fieldValue = MmsGetBinaryValue(MmsCodeReadStatus, mmsReadStatus) | 0x80;
if (__MmsBinaryEncodeFieldCodeAndValue(pFile, fieldCode, fieldValue) == false) {
MSG_DEBUG("_MmsBinaryEncodeReadReport11Hdr: Read Status error\n");
return false;
}
-bool MmsBinaryEncodeMsgBody(FILE *pFile, MsgType *pType, MsgBody *pBody, int nPartCount, bool bTemplate)
+static bool __MmsBinaryEncodeMsgBody(FILE *pFile, MsgType *pType, MsgBody *pBody, int nPartCount, bool bTemplate)
{
int length = 0;
MsgMultipart *pMultipart = NULL;
* Multipart message
* ---------------------------*/
- pType->offset = _MmsGetEncodeOffset();
+ pType->offset = __MmsGetEncodeOffset();
/* Content type */
- length = MmsBinaryEncodeContentTypeLen(pType);
+ length = __MmsBinaryEncodeContentTypeLen(pType);
if (length == -1) {
MSG_DEBUG("MmsBinaryEncodeMsgBody: MmsBinaryEncodeContentTypeLen fail \n");
goto __CATCH;
}
if (bTemplate == false)
- gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_CONTENTTYPE) | 0x80;
+ gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_CONTENTTYPE) | 0x80;
- if (MmsBinaryEncodeContentType(pFile, pType, length) == false) {
+ if (__MmsBinaryEncodeContentType(pFile, pType, length) == false) {
MSG_DEBUG("MmsBinaryEncodeMsgBody: MmsBinaryEncodeContentType fail \n");
goto __CATCH;
}
- pBody->offset = _MmsGetEncodeOffset();
+ pBody->offset = __MmsGetEncodeOffset();
/* nEntries */
if (pBody->pPresentationBody) {
}
if (nEntries >= 0) {
- length = MmsBinaryEncodeUintvarLen(nEntries);
+ length = __MmsBinaryEncodeUintvarLen(nEntries);
if (length == -1) {
MSG_DEBUG("MmsBinaryEncodeMsgBody: nEntries MmsBinaryEncodeUintvarLen fail \n");
goto __CATCH;
}
- if (MmsBinaryEncodeUintvar(pFile, nEntries, length) == false) {
+ if (__MmsBinaryEncodeUintvar(pFile, nEntries, length) == false) {
MSG_DEBUG("MmsBinaryEncodeMsgBody: nEntries MmsBinaryEncodeUintvar fail \n");
goto __CATCH;
}
- pType->size = _MmsGetEncodeOffset() - pType->offset;
+ pType->size = __MmsGetEncodeOffset() - pType->offset;
}
if (nEntries > 0) {
if (nEntries && pBody->pPresentationBody) {
- if (MmsBinaryEncodeMsgPart(pFile, pType->type, &pBody->presentationType, pBody->pPresentationBody) == false) {
+ if (__MmsBinaryEncodeMsgPart(pFile, pType->type, &pBody->presentationType, pBody->pPresentationBody) == false) {
MSG_DEBUG("MmsBinaryEncodeMsgBody: __MmsBinaryEncodeMsgPart fail \n");
goto __CATCH;
}
pMultipart = pBody->body.pMultipart;
while (nEntries && pMultipart) {
- if (MmsBinaryEncodeMsgPart(pFile, pType->type, &pMultipart->type, pMultipart->pBody) == false) {
+ if (__MmsBinaryEncodeMsgPart(pFile, pType->type, &pMultipart->type, pMultipart->pBody) == false) {
MSG_DEBUG("MmsBinaryEncodeMsgBody: __MmsBinaryEncodeMsgPart fail \n");
goto __CATCH;
}
}
}
- pBody->size = _MmsGetEncodeOffset() - pBody->offset;
+ pBody->size = __MmsGetEncodeOffset() - pBody->offset;
} else {
/* ---------------------------
* Singlepart message
* ---------------------------*/
- pType->offset = _MmsGetEncodeOffset();
+ pType->offset = __MmsGetEncodeOffset();
- if (MmsBinaryEncodeContentHeader(pFile, (MimeType)pType->type, pType, false) == false)
+ if (__MmsBinaryEncodeContentHeader(pFile, (MimeType)pType->type, pType, false) == false)
goto __CATCH;
- length = MmsBinaryEncodeContentTypeLen(pType);
+ length = __MmsBinaryEncodeContentTypeLen(pType);
if (length == -1) {
MSG_DEBUG("MmsBinaryEncodeMsgBody: Singlepart MmsBinaryEncodeContentTypeLen fail \n");
goto __CATCH;
}
- if (MmsBinaryEncodeContentType(pFile, pType, length) == false)
+ if (__MmsBinaryEncodeContentType(pFile, pType, length) == false)
goto __CATCH;
- pType->size = _MmsGetEncodeOffset() - pType->offset;
+ pType->size = __MmsGetEncodeOffset() - pType->offset;
- if (MmsBinaryEncodeContentBody(pFile, pBody) == false)
+ if (__MmsBinaryEncodeContentBody(pFile, pBody) == false)
goto __CATCH;
}
return false;
}
-
-int MmsBinaryEncodeContentTypeLen(MsgType *pType)
+static int __MmsBinaryEncodeContentTypeLen(MsgType *pType)
{
int length = 0;
int totalLength = 0;
UINT16 fieldValue = 0xffff;
- char *szTextType = NULL;
+ const char *szTextType = NULL;
int contentType = MIME_UNKNOWN;
MSG_DEBUG("MSmsBinaryEncodeContentTypeLen: type\n");
contentType = pType->type;
- fieldValue = _MmsGetBinaryValue(MmsCodeContentType, contentType);
+ fieldValue = MmsGetBinaryValue(MmsCodeContentType, contentType);
if (fieldValue == UNDEFINED_BINARY || fieldValue == 0x0049) {
/* Extension-media type */
- szTextType = _MmsGetTextValue(MmsCodeContentType, contentType);
+ szTextType = MmsGetTextValue(MmsCodeContentType, contentType);
if (szTextType != NULL) {
- length = MmsBinaryEncodeTextStringLen((UINT8*)szTextType);
+ length = __MmsBinaryEncodeTextStringLen((UINT8*)szTextType);
if (length == -1) {
MSG_DEBUG("MSmsBinaryEncodeContentTypeLen: szTextType MmsBinaryEncodeTextStringLen fail \n");
goto __CATCH;
/* Well-known-charset = Any-charset | Integer-value ----------------------- */
if (pType->param.charset != MSG_CHARSET_UNKNOWN) {
- fieldValue = _MmsGetBinaryValue(MmsCodeCharSet, pType->param.charset);
- length = MmsBinaryEncodeIntegerLen(fieldValue);
+ fieldValue = MmsGetBinaryValue(MmsCodeCharSet, pType->param.charset);
+ length = __MmsBinaryEncodeIntegerLen(fieldValue);
if (length == -1) {
MSG_DEBUG("MmsBinaryEncodeContentTypeLen: charSet MmsBinaryEncodeIntegerLen fail \n");
goto __CATCH;
MSG_DEBUG("MmsBinaryEncodeContentTypeLen: pszName : %s\n", pszName);
}
- length = MmsBinaryEncodeTextStringLen((UINT8*)pszName);
+ length = __MmsBinaryEncodeTextStringLen((UINT8*)pszName);
free(pszName);
if (length == -1) {
#ifdef FEATURE_JAVA_MMS
if (pType->param.szApplicationID) {
- length = MmsBinaryEncodeTextStringLen((UINT8*)pType->param.szApplicationID);
+ length = __MmsBinaryEncodeTextStringLen((UINT8*)pType->param.szApplicationID);
if (length == -1) {
MSG_DEBUG("MmsBinaryEncodeContentTypeLen: szApplicationID MmsBinaryEncodeTextStrinLen fail \n");
goto __CATCH;
}
totalLength += (length);
- if (_MmsGetBinaryValue(MmsCodeParameterCode, MSG_PARAM_APPLICATION_ID) == UNDEFINED_BINARY) {
- totalLength += strlen(_MmsGetTextValue(MmsCodeParameterCode, MSG_PARAM_APPLICATION_ID)) + 1; /* NULL */
+ if (MmsGetBinaryValue(MmsCodeParameterCode, MSG_PARAM_APPLICATION_ID) == UNDEFINED_BINARY) {
+ totalLength += strlen(MmsGetTextValue(MmsCodeParameterCode, MSG_PARAM_APPLICATION_ID)) + 1; /* NULL */
} else {
totalLength++;
}
}
if (pType->param.szReplyToApplicationID) {
- length = MmsBinaryEncodeTextStringLen((UINT8*)pType->param.szReplyToApplicationID);
+ length = __MmsBinaryEncodeTextStringLen((UINT8*)pType->param.szReplyToApplicationID);
if (length == -1) {
MSG_DEBUG("MmsBinaryEncodeContentTypeLen: szApplicationID MmsBinaryEncodeTextStrinLen fail \n");
goto __CATCH;
}
totalLength += (length);
- if (_MmsGetBinaryValue(MmsCodeParameterCode, MSG_PARAM_REPLY_TO_APPLICATION_ID) == UNDEFINED_BINARY) {
- totalLength += strlen(_MmsGetTextValue(MmsCodeParameterCode, MSG_PARAM_REPLY_TO_APPLICATION_ID)) + 1; /* NULL */
+ if (MmsGetBinaryValue(MmsCodeParameterCode, MSG_PARAM_REPLY_TO_APPLICATION_ID) == UNDEFINED_BINARY) {
+ totalLength += strlen(MmsGetTextValue(MmsCodeParameterCode, MSG_PARAM_REPLY_TO_APPLICATION_ID)) + 1; /* NULL */
} else {
totalLength++;
}
/* type, start, & startInfo : multipart/related only parameters -------------- */
if (contentType == MIME_MULTIPART_RELATED || contentType == MIME_APPLICATION_VND_WAP_MULTIPART_RELATED) {
/* type ------------------------------------- */
- fieldValue = _MmsGetBinaryValue(MmsCodeContentType, pType->param.type);
+ fieldValue = MmsGetBinaryValue(MmsCodeContentType, pType->param.type);
if (fieldValue == UNDEFINED_BINARY || fieldValue == 0x0049) {
/* Extension-media type */
- szTextType = _MmsGetTextValue(MmsCodeContentType, pType->param.type);
+ szTextType = MmsGetTextValue(MmsCodeContentType, pType->param.type);
if (szTextType != NULL) {
- length = MmsBinaryEncodeTextStringLen((UINT8*)szTextType);
+ length = __MmsBinaryEncodeTextStringLen((UINT8*)szTextType);
if (length == -1) {
MSG_DEBUG("MmsBinaryEncodeContentTypeLen: type param MmsBinaryEncodeTextStringLen fail \n");
goto __CATCH;
/* start = Text-string ----------------------- */
if (pType->param.szStart[0]) {
/* start = Text-string */
- length = MmsBinaryEncodeTextStringLen((UINT8*)pType->param.szStart);
+ length = __MmsBinaryEncodeTextStringLen((UINT8*)pType->param.szStart);
if (length == -1) {
MSG_DEBUG("MmsBinaryEncodeContentType: szStart MmsBinaryEncodeTextStringLen fail \n");
goto __CATCH;
/* startInfo = Text-string -------------------- */
if (pType->param.szStartInfo[0]) {
/* StartInfo (with multipart/related) = Text-string */
- length = MmsBinaryEncodeTextStringLen((UINT8*)pType->param.szStartInfo);
+ length = __MmsBinaryEncodeTextStringLen((UINT8*)pType->param.szStartInfo);
if (length == -1) {
MSG_DEBUG("MmsBinaryEncodeContentType: szStartInfo MmsBinaryEncodeTextStringLen fail \n");
goto __CATCH;
return -1;
}
-
-
-bool MmsBinaryEncodeContentType(FILE *pFile, MsgType *pType, int typeLength)
+static bool __MmsBinaryEncodeContentType(FILE *pFile, MsgType *pType, int typeLength)
{
int length = 0;
UINT16 fieldValue = 0xffff;
- char *szTextType = NULL;
+ const char *szTextType = NULL;
int contentType = MIME_UNKNOWN;
#ifdef FEATURE_JAVA_MMS
- char *szParameter = NULL;
+ const char *szParameter = NULL;
#endif
MSG_DEBUG("************************************************************************************\n");
/* Content-Type = Content-general-form ------------------------------- */
- length = MmsBinaryEncodeValueLengthLen(typeLength);
+ length = __MmsBinaryEncodeValueLengthLen(typeLength);
if (length == -1) {
MSG_DEBUG("MSmsBinaryEncodeContentType : MmsBinaryEncodeValueLengthLen fail.\n");
goto __CATCH;
}
- if (MmsBinaryEncodeValueLength(pFile, typeLength, length) == false) {
+ if (__MmsBinaryEncodeValueLength(pFile, typeLength, length) == false) {
MSG_DEBUG("MSmsBinaryEncodeContentType : MmsBinaryEncodeValueLength fail.\n");
goto __CATCH;
}
contentType = pType->type;
- fieldValue = _MmsGetBinaryValue(MmsCodeContentType, (int)contentType);
+ fieldValue = MmsGetBinaryValue(MmsCodeContentType, (int)contentType);
if (fieldValue == UNDEFINED_BINARY || fieldValue == 0x0049) {
/* Extension-media type */
- szTextType = _MmsGetTextValue(MmsCodeContentType, (int)contentType);
+ szTextType = MmsGetTextValue(MmsCodeContentType, (int)contentType);
if (szTextType == NULL)
fieldValue = 0x00;
}
if (szTextType == NULL) {
gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = (UINT8)fieldValue | 0x80;
} else {
- length = MmsBinaryEncodeTextStringLen((UINT8*)szTextType);
+ length = __MmsBinaryEncodeTextStringLen((UINT8*)szTextType);
if (length == -1) {
MSG_DEBUG("MSmsBinaryEncodeContentType: szTextType MmsBinaryEncodeTextStringLen fail \n");
goto __CATCH;
}
- if (MmsBinaryEncodeTextString(pFile, (UINT8*)szTextType, length) == false) {
+ if (__MmsBinaryEncodeTextString(pFile, (UINT8*)szTextType, length) == false) {
MSG_DEBUG("MmsBinaryEncodeContentType: szTextType MmsBinaryEncodeTextString fail \n");
goto __CATCH;
}
MSG_DEBUG("MmsBinaryEncodeContentType: pszName : %s\n", pszName);
}
- length = MmsBinaryEncodeTextStringLen((UINT8*)pszName);
+ length = __MmsBinaryEncodeTextStringLen((UINT8*)pszName);
if (length == -1) {
MSG_DEBUG("MmsBinaryEncodeContentType: szName MmsBinaryEncodeIntegerLen fail \n");
free(pszName);
goto __CATCH;
}
- gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = _MmsGetBinaryValue(MmsCodeParameterCode, MSG_PARAM_NAME) | 0x80;
+ gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = MmsGetBinaryValue(MmsCodeParameterCode, MSG_PARAM_NAME) | 0x80;
- if (MmsBinaryEncodeTextString(pFile, (UINT8*)pszName, length) == false) {
+ if (__MmsBinaryEncodeTextString(pFile, (UINT8*)pszName, length) == false) {
MSG_DEBUG("MmsBinaryEncodeContentType: szName MmsBinaryEncodeTextString fail\n");
free(pszName);
goto __CATCH;
/* Application-ID: Text-string */
if (pType->param.szApplicationID) {
- length = MmsBinaryEncodeTextStringLen((UINT8*) pType->param.szApplicationID);
+ length = __MmsBinaryEncodeTextStringLen((UINT8*) pType->param.szApplicationID);
if (length == -1) {
MSG_DEBUG("MmsBinaryEncodeContentType: szApplicationID MmsBinaryEncodeIntegerLen Fail \n");
goto __CATCH;
}
- fieldValue = _MmsGetBinaryValue(MmsCodeParameterCode, MSG_PARAM_APPLICATION_ID);
+ fieldValue = MmsGetBinaryValue(MmsCodeParameterCode, MSG_PARAM_APPLICATION_ID);
if (fieldValue == UNDEFINED_BINARY)
- szParameter = _MmsGetTextValue(MmsCodeParameterCode, MSG_PARAM_APPLICATION_ID);
+ szParameter = MmsGetTextValue(MmsCodeParameterCode, MSG_PARAM_APPLICATION_ID);
if (szParameter == NULL) {
MSG_DEBUG("MmsBinaryEncodeContentType: szParameter is NULL \n");
gCurMmsEncodeBuffPos += strlen(szParameter);
gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] =(UINT8)NULL;
- if (MmsBinaryEncodeTextString(pFile, (UINT8*) pType->param.szApplicationID, length) == false) {
+ if (__MmsBinaryEncodeTextString(pFile, (UINT8*) pType->param.szApplicationID, length) == false) {
MSG_DEBUG(" MmsBinaryEncodeContentType: szApplicationID MmsBinaryEncodeTextString fail\n");
goto __CATCH;
}
/* ReplyToApplicationID: Text-string */
if (pType->param.szReplyToApplicationID) {
- length = MmsBinaryEncodeTextStringLen((UINT8*) pType->param.szReplyToApplicationID);
+ length = __MmsBinaryEncodeTextStringLen((UINT8*) pType->param.szReplyToApplicationID);
if (length == -1) {
MSG_DEBUG("MmsBinaryEncodeContentType: szReplyToApplicationID MmsBinaryEncodeIntegerLen Fail \n");
goto __CATCH;
}
- fieldValue = _MmsGetBinaryValue(MmsCodeParameterCode, MSG_PARAM_REPLY_TO_APPLICATION_ID);
+ fieldValue = MmsGetBinaryValue(MmsCodeParameterCode, MSG_PARAM_REPLY_TO_APPLICATION_ID);
if (fieldValue == UNDEFINED_BINARY)
- szParameter = _MmsGetTextValue(MmsCodeParameterCode, MSG_PARAM_REPLY_TO_APPLICATION_ID);
+ szParameter = MmsGetTextValue(MmsCodeParameterCode, MSG_PARAM_REPLY_TO_APPLICATION_ID);
if (szParameter == NULL) {
MSG_DEBUG("MmsBinaryEncodeContentType: szParameter is NULL \n");
gCurMmsEncodeBuffPos += strlen(szParameter);
gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] =(UINT8)NULL;
- if (MmsBinaryEncodeTextString(pFile, (UINT8*) pType->param.szReplyToApplicationID, length) == false) {
+ if (__MmsBinaryEncodeTextString(pFile, (UINT8*) pType->param.szReplyToApplicationID, length) == false) {
MSG_DEBUG(" MmsBinaryEncodeContentType: szApplicationID MmsBinaryEncodeTextString fail\n");
goto __CATCH;
}
/* Well-known-charset = Any-charset | Integer-value ----------------------- */
if (pType->param.charset != MSG_CHARSET_UNKNOWN) {
- fieldValue = _MmsGetBinaryValue(MmsCodeCharSet, pType->param.charset);
- length = MmsBinaryEncodeIntegerLen(fieldValue);
+ fieldValue = MmsGetBinaryValue(MmsCodeCharSet, pType->param.charset);
+ length = __MmsBinaryEncodeIntegerLen(fieldValue);
if (length == -1) {
MSG_DEBUG("MmsBinaryEncodeContentType: charSet MmsBinaryEncodeIntegerLen fail \n");
goto __CATCH;
}
- gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = _MmsGetBinaryValue(MmsCodeParameterCode, MSG_PARAM_CHARSET) | 0x80;
- if (MmsBinaryEncodeInteger(pFile, fieldValue, length) == false) {
+ gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = MmsGetBinaryValue(MmsCodeParameterCode, MSG_PARAM_CHARSET) | 0x80;
+ if (__MmsBinaryEncodeInteger(pFile, fieldValue, length) == false) {
MSG_DEBUG("MmsBinaryEncodeContentType: charSet MmsBinaryEncodeInteger fail\n");
goto __CATCH;
}
/* Any-charset */
if (MmsIsText(contentType)) {
if (!MmsIsVitemContent (contentType, pType->param.szName)) {
- gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = _MmsGetBinaryValue(MmsCodeParameterCode, MSG_PARAM_CHARSET) | 0x80;
+ gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = MmsGetBinaryValue(MmsCodeParameterCode, MSG_PARAM_CHARSET) | 0x80;
fieldValue = 0x0000; //laconic_warning, just to remove warning message
gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = (UINT8)fieldValue | 0x80;
}
/* type, start, & startInfo : multipart/related only parameters -------------- */
if (contentType == MIME_MULTIPART_RELATED || contentType == MIME_APPLICATION_VND_WAP_MULTIPART_RELATED) {
/* type ------------------------------------- */
- fieldValue = _MmsGetBinaryValue(MmsCodeContentType, pType->param.type);
+ fieldValue = MmsGetBinaryValue(MmsCodeContentType, pType->param.type);
if (fieldValue == UNDEFINED_BINARY || fieldValue == 0x0049) {
/* Extension-media type */
- szTextType = _MmsGetTextValue(MmsCodeContentType, pType->param.type);
+ szTextType = MmsGetTextValue(MmsCodeContentType, pType->param.type);
if (szTextType == NULL)
fieldValue = 0x00;
}
if (szTextType == NULL) {
gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = (UINT8)fieldValue | 0x80;
- gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = _MmsGetBinaryValue(MmsCodeParameterCode, MSG_PARAM_TYPE) | 0x80;
+ gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = MmsGetBinaryValue(MmsCodeParameterCode, MSG_PARAM_TYPE) | 0x80;
} else {
- length = MmsBinaryEncodeTextStringLen((UINT8*)szTextType);
+ length = __MmsBinaryEncodeTextStringLen((UINT8*)szTextType);
if (length == -1) {
MSG_DEBUG("MmsBinaryEncodeContentType: type param MmsBinaryEncodeTextStringLen fail \n");
goto __CATCH;
}
- gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = _MmsGetBinaryValue(MmsCodeParameterCode, MSG_PARAM_TYPE) | 0x80;
- if (MmsBinaryEncodeTextString(pFile, (UINT8*)szTextType, length) == false) {
+ gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = MmsGetBinaryValue(MmsCodeParameterCode, MSG_PARAM_TYPE) | 0x80;
+ if (__MmsBinaryEncodeTextString(pFile, (UINT8*)szTextType, length) == false) {
MSG_DEBUG("MmsBinaryEncodeContentType: type param MmsBinaryEncodeTextString fail \n");
goto __CATCH;
}
/* start = Text-string ----------------------- */
if (pType->param.szStart[0]) {
/* start = Text-string */
- length = MmsBinaryEncodeTextStringLen((UINT8*)pType->param.szStart);
+ length = __MmsBinaryEncodeTextStringLen((UINT8*)pType->param.szStart);
if (length == -1) {
MSG_DEBUG("MmsBinaryEncodeContentType: szStart MmsBinaryEncodeTextStringLen fail \n");
goto __CATCH;
}
- gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = _MmsGetBinaryValue(MmsCodeParameterCode,
+ gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = MmsGetBinaryValue(MmsCodeParameterCode,
MSG_PARAM_START) | 0x80;
- if (MmsBinaryEncodeTextString(pFile, (UINT8*)pType->param.szStart, length) == false) {
+ if (__MmsBinaryEncodeTextString(pFile, (UINT8*)pType->param.szStart, length) == false) {
MSG_DEBUG("MmsBinaryEncodeContentType: szStart MmsBinaryEncodeTextString fail \n");
goto __CATCH;
}
/* startInfo = Text-string -------------------- */
if (pType->param.szStartInfo[0]) {
/* StartInfo (with multipart/related) = Text-string */
- length = MmsBinaryEncodeTextStringLen((UINT8*)pType->param.szStartInfo);
+ length = __MmsBinaryEncodeTextStringLen((UINT8*)pType->param.szStartInfo);
if (length == -1) {
MSG_DEBUG("MmsBinaryEncodeContentType: szStartInfo MmsBinaryEncodeTextStringLen fail \n");
goto __CATCH;
}
- gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = _MmsGetBinaryValue(MmsCodeParameterCode, MSG_PARAM_START_INFO) | 0x80;
- if (MmsBinaryEncodeTextString(pFile, (UINT8*)pType->param.szStartInfo, length) == false) {
+ gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = MmsGetBinaryValue(MmsCodeParameterCode, MSG_PARAM_START_INFO) | 0x80;
+ if (__MmsBinaryEncodeTextString(pFile, (UINT8*)pType->param.szStartInfo, length) == false) {
MSG_DEBUG("MmsBinaryEncodeContentType: szStartInfo MmsBinaryEncodeTextString fail \n");
goto __CATCH;
}
return false;
}
-
-
-bool MmsBinaryEncodeMsgPart(FILE *pFile, int contentType, MsgType *pType, MsgBody *pBody)
+static bool __MmsBinaryEncodeMsgPart(FILE *pFile, int contentType, MsgType *pType, MsgBody *pBody)
{
FILE *pFile2 = NULL;
char *pData = NULL;
if (pType->offset && pType->size) {
/* header length & body length --------------------------- */
- length = MmsBinaryEncodeUintvarLen(pType->size);
+ length = __MmsBinaryEncodeUintvarLen(pType->size);
if (length == -1) {
MSG_DEBUG("MmsBinaryEncodeMsgPart: 1. headerLeng MmsBinaryEncodeUintvarLen fail \n");
goto __CATCH;
}
- if (MmsBinaryEncodeUintvar(pFile, pType->size, length) == false) {
+ if (__MmsBinaryEncodeUintvar(pFile, pType->size, length) == false) {
MSG_DEBUG("MmsBinaryEncodeMsgPart: 1. eaderLeng fail \n");
goto __CATCH;
}
- length = MmsBinaryEncodeUintvarLen(pBody->size);
+ length = __MmsBinaryEncodeUintvarLen(pBody->size);
if (length == -1) {
MSG_DEBUG("MmsBinaryEncodeMsgPart: 1. bodyLeng MmsBinaryEncodeUintvarLen fail \n");
goto __CATCH;
}
- if (MmsBinaryEncodeUintvar(pFile, pBody->size, length) == false) {
+ if (__MmsBinaryEncodeUintvar(pFile, pBody->size, length) == false) {
MSG_DEBUG("MmsBinaryEncodeMsgPart: 1. bodyLeng fail \n");
goto __CATCH;
}
MSG_DEBUG("MmsBinaryEncodeMsgPart: 1. header MsgWriteDataFromEncodeBuffer fail \n");
goto __CATCH;
}
- pType->offset = _MmsGetEncodeOffset();
+ pType->offset = __MmsGetEncodeOffset();
if(MsgWriteFile(pData, sizeof(char), nRead, pFile) != (size_t)nRead) {
MSG_DEBUG("MsgWriteFile failed");
goto __CATCH;
int contentHdrLen = 0;
/* header length & body length --------------------------- */
- contentTypeLen = MmsBinaryEncodeContentTypeLen(pType);
- length = MmsBinaryEncodeValueLengthLen(contentTypeLen);
- contentHdrLen = MmsBinaryEncodeContentHeaderLen((MimeType)contentType, pType, true);
+ contentTypeLen = __MmsBinaryEncodeContentTypeLen(pType);
+ length = __MmsBinaryEncodeValueLengthLen(contentTypeLen);
+ contentHdrLen = __MmsBinaryEncodeContentHeaderLen((MimeType)contentType, pType, true);
if (contentTypeLen == -1 || length == -1 || contentHdrLen == -1) {
MSG_DEBUG("MmsBinaryEncodeMsgPart: headerLeng calculation fail \n");
}
headerLeng = contentTypeLen + contentHdrLen + length;
- length = MmsBinaryEncodeUintvarLen(headerLeng);
+ length = __MmsBinaryEncodeUintvarLen(headerLeng);
if (length == -1) {
MSG_DEBUG("MmsBinaryEncodeMsgPart: headerLeng MmsBinaryEncodeUintvarLen fail \n");
goto __CATCH;
}
- if (MmsBinaryEncodeUintvar(pFile, headerLeng, length) == false) {
+ if (__MmsBinaryEncodeUintvar(pFile, headerLeng, length) == false) {
MSG_DEBUG("MmsBinaryEncodeMsgPart: headerLeng fail \n");
goto __CATCH;
}
- length = MmsBinaryEncodeUintvarLen(pBody->size);
+ length = __MmsBinaryEncodeUintvarLen(pBody->size);
if (length == -1) {
MSG_DEBUG("MmsBinaryEncodeMsgPart: bodyLeng MmsBinaryEncodeUintvarLen fail \n");
goto __CATCH;
}
- if (MmsBinaryEncodeUintvar(pFile, pBody->size, length) == false) {
+ if (__MmsBinaryEncodeUintvar(pFile, pBody->size, length) == false) {
MSG_DEBUG("MmsBinaryEncodeMsgPart: bodyLeng fail \n");
goto __CATCH;
}
}
/* content-type & header --------------------------- */
- pType->offset = _MmsGetEncodeOffset();
+ pType->offset = __MmsGetEncodeOffset();
- if (MmsBinaryEncodeContentType(pFile, pType, contentTypeLen) == false) {
+ if (__MmsBinaryEncodeContentType(pFile, pType, contentTypeLen) == false) {
MSG_DEBUG("MmsBinaryEncodeMsgPart: MmsBinaryEncodeContentType fail \n");
goto __CATCH;
}
- if (MmsBinaryEncodeContentHeader(pFile, (MsgContentType)contentType, pType, true) == false) {
+ if (__MmsBinaryEncodeContentHeader(pFile, (MimeType)contentType, pType, true) == false) {
MSG_DEBUG("MmsBinaryEncodeMsgPart: MmsBinaryEncodeContentHeader fail \n");
goto __CATCH;
}
- pType->size = _MmsGetEncodeOffset() - pType->offset;
+ pType->size = __MmsGetEncodeOffset() - pType->offset;
}
if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos, gMmsEncodeMaxLen, &gMmsEncodeCurOffset) == false) {
}
/* content-body --------------------------- */
- if (MmsBinaryEncodeContentBody(pFile, pBody) == false) {
- MSG_DEBUG("MmsBinaryEncodeMsgPart: MmsBinaryEncodeContentBody fail \n");
+ if (__MmsBinaryEncodeContentBody(pFile, pBody) == false) {
+ MSG_DEBUG("MmsBinaryEncodeMsgPart: __MmsBinaryEncodeContentBody fail \n");
goto __CATCH;
}
return false;
}
-
-int MmsBinaryEncodeContentHeaderLen(MsgContentType contentType, MsgType *pType, bool bMultipart)
+static int __MmsBinaryEncodeContentHeaderLen(MimeType contentType, MsgType *pType, bool bMultipart)
{
int length = 0;
int totalLength = 0;
- char *szTextValue = NULL;
+ const char *szTextValue = NULL;
MSG_DEBUG("MmsBinaryEncodeContentHeaderLen: S T A R T \n\n");
totalLength++;
} else {
/* content-id = Quoted-string */
- length = MmsBinaryEncodeTextStringLen((UINT8*)"Content-ID");
+ length = __MmsBinaryEncodeTextStringLen((UINT8*)"Content-ID");
if (length == -1) {
MSG_DEBUG("MmsBinaryEncodeContentHeaderLen: Content-ID MmsBinaryEncodeTextStringLen fail.\n");
goto __CATCH;
totalLength += length;
}
- length = MmsBinaryEncodeQuotedStringLen((UINT8*)pType->szContentID);
+ length = __MmsBinaryEncodeQuotedStringLen((UINT8*)pType->szContentID);
if (length == -1) {
MSG_DEBUG("MmsBinaryEncodeContentHeader: pType->szContentID MmsBinaryEncodeQuotedStringLen fail.\n");
goto __CATCH;
totalLength++;
} else {
/* content-location = Quoted-string */
- length = MmsBinaryEncodeTextStringLen((UINT8*)"Content-Location");
+ length = __MmsBinaryEncodeTextStringLen((UINT8*)"Content-Location");
if (length == -1) {
MSG_DEBUG("MmsBinaryEncodeContentHeader: Content-Location MmsBinaryEncodeTextStringLen fail.\n");
goto __CATCH;
totalLength += length;
}
- length = MmsBinaryEncodeTextStringLen((UINT8*)pType->szContentLocation);
+ length = __MmsBinaryEncodeTextStringLen((UINT8*)pType->szContentLocation);
if (length == -1) {
MSG_DEBUG("MmsBinaryEncodeContentHeader: pType->szContentLocation MmsBinaryEncodeTextStringLen fail.\n");
goto __CATCH;
totalLength += 3;
} else {
/* content-disposition = Quoted-string */
- szTextValue = _MmsGetTextValue(MmsCodeMsgDisposition, pType->disposition);
+ szTextValue = MmsGetTextValue(MmsCodeMsgDisposition, pType->disposition);
if (szTextValue) {
- length = MmsBinaryEncodeTextStringLen((UINT8*)"Content-Disposition");
+ length = __MmsBinaryEncodeTextStringLen((UINT8*)"Content-Disposition");
if (length == -1) {
MSG_DEBUG("MmsBinaryEncodeContentHeader: Content-Disposition MmsBinaryEncodeTextStringLen fail.\n");
goto __CATCH;
totalLength += length;
- length = MmsBinaryEncodeTextStringLen((UINT8*)szTextValue);
+ length = __MmsBinaryEncodeTextStringLen((UINT8*)szTextValue);
if (length == -1) {
MSG_DEBUG("MmsBinaryEncodeContentHeader: Content-Disposition MmsBinaryEncodeTextStringLen fail.\n");
goto __CATCH;
return -1;
}
-
-
-bool MmsBinaryEncodeContentHeader(FILE *pFile, MsgContentType contentType, MsgType *pType, bool bMultipart)
+static bool __MmsBinaryEncodeContentHeader(FILE *pFile, MimeType contentType, MsgType *pType, bool bMultipart)
{
int length = 0;
- char *szTextValue = NULL;
+ const char *szTextValue = NULL;
MSG_DEBUG("MmsBinaryEncodeContentHeader: S T A R T \n\n");
/* content-id ------------------------------------------------- */
if (pType->szContentID[0]) {
if (bMultipart) { //Binary Encoding
- gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = _MmsGetBinaryValue(MmsCodeMsgBodyHeaderCode, MMS_BODYHDR_CONTENTID) | 0x80;
+ gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = MmsGetBinaryValue(MmsCodeMsgBodyHeaderCode, MMS_BODYHDR_CONTENTID) | 0x80;
} else {
/* content-id = Quoted-string */
- length = MmsBinaryEncodeTextStringLen((UINT8*)"Content-ID");
+ length = __MmsBinaryEncodeTextStringLen((UINT8*)"Content-ID");
if (length == -1) {
MSG_DEBUG("MmsBinaryEncodeContentHeader: Content-ID MmsBinaryEncodeTextStringLen fail.\n");
goto __CATCH;
}
- if (MmsBinaryEncodeTextString(pFile, (UINT8*)"Content-ID", length) == false) {
+ if (__MmsBinaryEncodeTextString(pFile, (UINT8*)"Content-ID", length) == false) {
MSG_DEBUG("MmsBinaryEncodeContentHeader: Content-ID MmsBinaryEncodeTextString fail.\n");
goto __CATCH;
}
}
- length = MmsBinaryEncodeQuotedStringLen((UINT8*)pType->szContentID);
+ length = __MmsBinaryEncodeQuotedStringLen((UINT8*)pType->szContentID);
if (length == -1) {
MSG_DEBUG("MmsBinaryEncodeContentHeader: pType->szContentID MmsBinaryEncodeQuotedStringLen fail.\n");
goto __CATCH;
}
- if (MmsBinaryEncodeQuotedString(pFile, (UINT8*)pType->szContentID, length) == false) {
+ if (__MmsBinaryEncodeQuotedString(pFile, (UINT8*)pType->szContentID, length) == false) {
MSG_DEBUG("MmsBinaryEncodeContentHeader: pType->szContentID MmsBinaryEncodeQuotedString fail.\n");
goto __CATCH;
}
if (pType->szContentLocation[0]) {
if (bMultipart) { //Binary Encoding
- gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = _MmsGetBinaryValue(MmsCodeMsgBodyHeaderCode, MMS_BODYHDR_CONTENTLOCATION) | 0x80;
+ gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = MmsGetBinaryValue(MmsCodeMsgBodyHeaderCode, MMS_BODYHDR_CONTENTLOCATION) | 0x80;
} else {
/* content-location = Quoted-string */
- length = MmsBinaryEncodeTextStringLen((UINT8*)"Content-Location");
+ length = __MmsBinaryEncodeTextStringLen((UINT8*)"Content-Location");
if (length == -1) {
MSG_DEBUG("MmsBinaryEncodeContentHeader: Content-Location MmsBinaryEncodeTextStringLen fail.\n");
goto __CATCH;
}
- if (MmsBinaryEncodeTextString(pFile, (UINT8*)"Content-Location", length) == false) {
+ if (__MmsBinaryEncodeTextString(pFile, (UINT8*)"Content-Location", length) == false) {
MSG_DEBUG("MmsBinaryEncodeContentHeader: Content-Location MmsBinaryEncodeTextString fail.\n");
goto __CATCH;
}
}
- length = MmsBinaryEncodeTextStringLen((UINT8*)pType->szContentLocation);
+ length = __MmsBinaryEncodeTextStringLen((UINT8*)pType->szContentLocation);
if (length == -1) {
MSG_DEBUG("MmsBinaryEncodeContentHeader: pType->szContentLocation MmsBinaryEncodeTextStringLen fail.\n");
goto __CATCH;
}
- if (MmsBinaryEncodeTextString(pFile, (UINT8*)pType->szContentLocation, length) == false) {
+ if (__MmsBinaryEncodeTextString(pFile, (UINT8*)pType->szContentLocation, length) == false) {
MSG_DEBUG("MmsBinaryEncodeContentHeader: pType->szContentLocation MmsBinaryEncodeTextString fail.\n");
goto __CATCH;
}
if (bMultipart) {//Binary Encoding
UINT8 fieldValue = 0xff;
- gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = _MmsGetBinaryValue(MmsCodeMsgBodyHeaderCode, MMS_BODYHDR_DISPOSITION) | 0x80;
+ gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = MmsGetBinaryValue(MmsCodeMsgBodyHeaderCode, MMS_BODYHDR_DISPOSITION) | 0x80;
- fieldValue = _MmsGetBinaryValue(MmsCodeMsgDisposition, pType->disposition) | 0x80;
+ fieldValue = MmsGetBinaryValue(MmsCodeMsgDisposition, pType->disposition) | 0x80;
if (fieldValue == 0xff)
fieldValue = 0x81;
} else {
/* content-disposition = Disposition (no support parameter) */
- szTextValue = _MmsGetTextValue(MmsCodeMsgDisposition, pType->disposition);
+ szTextValue = MmsGetTextValue(MmsCodeMsgDisposition, pType->disposition);
if (szTextValue) {
- length = MmsBinaryEncodeTextStringLen((UINT8*)"Content-Disposition");
+ length = __MmsBinaryEncodeTextStringLen((UINT8*)"Content-Disposition");
if (length == -1) {
MSG_DEBUG("MmsBinaryEncodeContentHeader: Content-Disposition MmsBinaryEncodeTextStringLen fail.\n");
goto __CATCH;
}
- if (MmsBinaryEncodeTextString(pFile, (UINT8*)"Content-Disposition", length) == false) {
+ if (__MmsBinaryEncodeTextString(pFile, (UINT8*)"Content-Disposition", length) == false) {
MSG_DEBUG("MmsBinaryEncodeContentHeader: Content-Disposition MmsBinaryEncodeTextString fail.\n");
goto __CATCH;
}
- length = MmsBinaryEncodeTextStringLen((UINT8*)szTextValue);
+ length = __MmsBinaryEncodeTextStringLen((UINT8*)szTextValue);
if (length == -1) {
MSG_DEBUG("MmsBinaryEncodeContentHeader: Content-Disposition MmsBinaryEncodeTextStringLen fail.\n");
goto __CATCH;
}
- if (MmsBinaryEncodeTextString(pFile, (UINT8*)szTextValue, length) == false) {
+ if (__MmsBinaryEncodeTextString(pFile, (UINT8*)szTextValue, length) == false) {
MSG_DEBUG("MmsBinaryEncodeContentHeader: Content-Disposition MmsBinaryEncodeTextString fail.\n");
goto __CATCH;
}
return false;
}
-
-
-bool MmsBinaryEncodeContentBody(FILE *pFile, MsgBody *pBody)
+static bool __MmsBinaryEncodeContentBody(FILE *pFile, MsgBody *pBody)
{
int nRead = 0;
char *pData = NULL;
if (pData == NULL)
goto __CATCH;
- pBody->offset = _MmsGetEncodeOffset();
+ pBody->offset = __MmsGetEncodeOffset();
if(MsgWriteFile(pData, sizeof(char), nRead, pFile) != (size_t)nRead) {
MSG_DEBUG("MsgWriteFile failed");
goto __CATCH;
pData = NULL;
}
} else if (pBody->body.pText && pBody->size) {
- pBody->offset = _MmsGetEncodeOffset();
+ pBody->offset = __MmsGetEncodeOffset();
if (MsgWriteFile(pBody->body.pText, sizeof(char),(size_t)pBody->size, pFile) != (size_t)pBody->size) {
MSG_DEBUG("MsgWriteFile failed");
goto __CATCH;
return true;
__CATCH:
- MSG_DEBUG("## MmsBinaryEncodeContentBody: failed\n");
+ MSG_DEBUG("## __MmsBinaryEncodeContentBody: failed\n");
if (pData) {
free(pData);
pData = NULL;
return false;
}
-
-
/* =========================================================================
B I N A R Y E N C O D I N G U T I L I T Y
=========================================================================*/
-
-static int MmsBinaryEncodeIntegerLen(UINT32 integer)
+static int __MmsBinaryEncodeIntegerLen(UINT32 integer)
{
if (integer < 0x80) {
/* short-integer */
*
* @param length [in] gotten from MmsBinaryEncodeIntegerLen()
*/
-static bool MmsBinaryEncodeInteger(FILE *pFile, UINT32 integer, int length)
+static bool __MmsBinaryEncodeInteger(FILE *pFile, UINT32 integer, int length)
{
union {
UINT32 integer;
return false;
}
-
-static int MmsBinaryEncodeLongIntegerLen(UINT32 integer)
+static int __MmsBinaryEncodeLongIntegerLen(UINT32 integer)
{
int length = 0;
return length;
}
-
/*
* This makes value-length by specified integer value
*
* @param length [in] gotten from MmsBinaryEncodeIntegerLen()
*/
-static bool MmsBinaryEncodeLongInteger(FILE *pFile, UINT32 integer, int length)
+static bool __MmsBinaryEncodeLongInteger(FILE *pFile, UINT32 integer, int length)
{
int i = 0;
union {
return false;
}
-
-
-static int MmsBinaryEncodeTextStringLen(UINT8 *source)
+static int __MmsBinaryEncodeTextStringLen(UINT8 *source)
{
int length = 0;
return length;
}
-
/*
* @param source [in] originam string
* @param length [in] gotten from MmsBinaryEncodeTextStringLen()
* @param dest [in] buffer to store quted string
* @return changed string length
*/
-static bool MmsBinaryEncodeTextString(FILE *pFile, UINT8 *source, int length)
+static bool __MmsBinaryEncodeTextString(FILE *pFile, UINT8 *source, int length)
{
MSG_DEBUG("MmsBinaryEncodeTextString: \n");
return false;
}
-
-
/*
* Encode 28bit unsigned integer(Maximum) to uintvar
*
const UINT32 UINTVAR_LENGTH_3 = 0x001fffff; //21bit
-static int MmsBinaryEncodeUintvarLen(UINT32 integer)
+static int __MmsBinaryEncodeUintvarLen(UINT32 integer)
{
UINT32 length = 0;
return length;
}
-
-static bool MmsBinaryEncodeUintvar(FILE *pFile, UINT32 integer, int length)
+static bool __MmsBinaryEncodeUintvar(FILE *pFile, UINT32 integer, int length)
{
const char ZERO = 0x00;
int i = 2;
return false;
}
-
-
-static int MmsBinaryEncodeValueLengthLen(UINT32 integer)
+static int __MmsBinaryEncodeValueLengthLen(UINT32 integer)
{
int length = 0;
if (integer < 0x1f) {
length = 1;
} else {
- length = MmsBinaryEncodeUintvarLen(integer) + 1; //LENGTH_QUOTE
+ length = __MmsBinaryEncodeUintvarLen(integer) + 1; //LENGTH_QUOTE
}
return length;
}
-
/*
* This makes value-length by specified integer value
*
* @param length [in] from MmsBinaryEncodeValueLengthLen()
* @return encoded value-length
*/
-static bool MmsBinaryEncodeValueLength(FILE *pFile, UINT32 integer, int length)
+static bool __MmsBinaryEncodeValueLength(FILE *pFile, UINT32 integer, int length)
{
/*
* Value-length = Short-length | (Length-quote Length)
gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = (UINT8)integer;
} else {
gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = (UINT8)LENGTH_QUOTE;
- if (MmsBinaryEncodeUintvar(pFile, integer, length - 1) == false) { // LENGTH_QUOTE
+ if (__MmsBinaryEncodeUintvar(pFile, integer, length - 1) == false) { // LENGTH_QUOTE
MSG_DEBUG("MmsBinaryEncodeValueLength: MmsBinaryEncodeUintvar fail\n");
goto __CATCH;
}
return false;
}
-
-static int MmsBinaryEncodeQuotedStringLen(UINT8 *pSrc)
+static int __MmsBinaryEncodeQuotedStringLen(UINT8 *pSrc)
{
if (pSrc == NULL) {
MSG_DEBUG("MmsBinaryEncodeQuotedStringLen: invalid file\n");
return -1;
}
-
/*
* make quoted string
* Quoted-string = <Octet 34> *TEXT End-of-string
* @param dest [out] buffer to store quted string
* @return changed string length
*/
-static bool MmsBinaryEncodeQuotedString(FILE *pFile, UINT8 *source, int length)
+static bool __MmsBinaryEncodeQuotedString(FILE *pFile, UINT8 *source, int length)
{
if (source == NULL || pFile == NULL) {
MSG_DEBUG("MmsBinaryEncodeQuotedString: invalid file\n");
return false;
}
-
-
-static int MmsBinaryEncodeEncodedStringLen(UINT8 *source)
+static int __MmsBinaryEncodeEncodedStringLen(UINT8 *source)
{
UINT32 charset = 0x6A; // default = utf-8
int charLeng = 0;
/* value-length charSet text-string */
/* Estimate charset value length and text string length */
- charLeng = MmsBinaryEncodeIntegerLen(charset);
+ charLeng = __MmsBinaryEncodeIntegerLen(charset);
if (charLeng == -1) {
MSG_DEBUG("MmsBinaryEncodeEncodedStringLen : charLeng MmsBinaryEncodeTextStringLen fail.\n");
goto __CATCH;;
}
- textLeng = MmsBinaryEncodeTextStringLen((UINT8*)source);
+ textLeng = __MmsBinaryEncodeTextStringLen((UINT8*)source);
if (textLeng == -1) {
MSG_DEBUG("MmsBinaryEncodeEncodedStringLen : textLeng MmsBinaryEncodeTextStringLen fail.\n");
goto __CATCH;;
}
- valueLengthLen = MmsBinaryEncodeValueLengthLen(charLeng + textLeng);
+ valueLengthLen = __MmsBinaryEncodeValueLengthLen(charLeng + textLeng);
if (valueLengthLen == -1) {
MSG_DEBUG("MmsBinaryEncodeEncodedStringLen : valLengthLen MmsBinaryEncodeTextStringLen fail.\n");
goto __CATCH;
return -1;
}
-
/*
* This makes value-length by specified integer value
*
* @param length [in] from MmsBinaryEncodeEncodedStringLen()
* @return encoded encoded-string
*/
-static bool MmsBinaryEncodeEncodedString(FILE *pFile, UINT8 *source, int length)
+static bool __MmsBinaryEncodeEncodedString(FILE *pFile, UINT8 *source, int length)
{
UINT32 charset = 0x6A; // default = utf-8
int charLeng = 0;
}
/* Estimate charset value length and text string length */
- charLeng = MmsBinaryEncodeIntegerLen(charset);
+ charLeng = __MmsBinaryEncodeIntegerLen(charset);
if (charLeng == -1) {
MSG_DEBUG("MmsBinaryEncodeEncodedString : charLeng MmsBinaryEncodeTextStringLen fail.\n");
goto __CATCH;;
}
- textLeng = MmsBinaryEncodeTextStringLen((UINT8*)source);
+ textLeng = __MmsBinaryEncodeTextStringLen((UINT8*)source);
if (textLeng == -1) {
MSG_DEBUG("MmsBinaryEncodeEncodedString : textLeng MmsBinaryEncodeTextStringLen fail.\n");
goto __CATCH;;
}
- valLengthLen = MmsBinaryEncodeValueLengthLen(charLeng + textLeng);
+ valLengthLen = __MmsBinaryEncodeValueLengthLen(charLeng + textLeng);
if (valLengthLen == -1) {
MSG_DEBUG("MmsBinaryEncodeEncodedString : MmsBinaryEncodeValueLengthLen fail.\n");
goto __CATCH;
}
/* Value length of charset value and text string */
- if (MmsBinaryEncodeValueLength(pFile, charLeng + textLeng, valLengthLen) == false) {
+ if (__MmsBinaryEncodeValueLength(pFile, charLeng + textLeng, valLengthLen) == false) {
MSG_DEBUG("MmsBinaryEncodeEncodedString : MmsBinaryEncodeValueLength fail.\n");
goto __CATCH;
}
/* fixme: Write charset on buffer -> integer value not long-integer */
- if (MmsBinaryEncodeInteger(pFile, charset, charLeng) == false) {
+ if (__MmsBinaryEncodeInteger(pFile, charset, charLeng) == false) {
MSG_DEBUG("MmsBinaryEncodeEncodedString : MmsBinaryEncodeInteger fail.\n");
goto __CATCH;
}
/* Write text string on buffer */
- if (MmsBinaryEncodeTextString(pFile, (UINT8*)source, textLeng) == false) {
+ if (__MmsBinaryEncodeTextString(pFile, (UINT8*)source, textLeng) == false) {
MSG_DEBUG("MmsBinaryEncodeEncodedString : MmsBinaryEncodeTextString fail.\n");
goto __CATCH;
}
return false;
}
-
static bool __MmsBinaryEncodeFieldCodeAndValue(FILE *pFile, UINT8 fieldCode, UINT8 fieldValue)
{
if ((gMmsEncodeMaxLen - gCurMmsEncodeBuffPos) < 2) {
return false;
}
-
-
static bool __MmsBinaryEncodeTrID(FILE *pFile, char *szTrID, int bufLen)
{
int length = 0;
dateSec = mktime(dateTime);
- fieldCode = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_TRID) | 0x80;
+ fieldCode = MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_TRID) | 0x80;
if (fieldCode == 0xff) {
MSG_DEBUG("__MmsBinaryEncodeTrID: invalid fieldCode \n");
goto __CATCH;
snprintf(szBuff, MMS_TR_ID_LEN + 1, "%lu.%lu", dateSec, (unsigned long)random());
MSG_DEBUG("__MmsBinaryEncodeTrID: 2. szBuff = %s\n", szBuff);
- length = MmsBinaryEncodeTextStringLen((UINT8*)szBuff);
+ length = __MmsBinaryEncodeTextStringLen((UINT8*)szBuff);
if (length == -1) {
MSG_DEBUG("__MmsBinaryEncodeTrID: MmsBinaryEncodeTextStringLen fail \n");
goto __CATCH;
gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = fieldCode;
- if (MmsBinaryEncodeTextString(pFile, (UINT8*)szBuff, length) == false) {
+ if (__MmsBinaryEncodeTextString(pFile, (UINT8*)szBuff, length) == false) {
MSG_DEBUG("__MmsBinaryEncodeTrID: MmsBinaryEncodeTextString fail\n");
goto __CATCH;
}
int length = 0;
UINT8 fieldCode = 0xff;
- fieldCode = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_MSGID) | 0x80;
+ fieldCode = MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_MSGID) | 0x80;
if (fieldCode == 0xff) {
MSG_DEBUG("__MmsBinaryEncodeTrID: invalid fieldCode \n");
goto __CATCH;
MSG_DEBUG("__MmsBinaryEncodeMsgID: 2. szBuff = %s\n", szMsgID);
- length = MmsBinaryEncodeTextStringLen((UINT8*)szMsgID);
+ length = __MmsBinaryEncodeTextStringLen((UINT8*)szMsgID);
if (length == -1) {
MSG_DEBUG("__MmsBinaryEncodeMsgID: MmsBinaryEncodeTextStringLen fail \n");
goto __CATCH;
}
gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = fieldCode;
- if (MmsBinaryEncodeTextString(pFile, (UINT8*)szMsgID, length) == false) {
+ if (__MmsBinaryEncodeTextString(pFile, (UINT8*)szMsgID, length) == false) {
MSG_DEBUG("__MmsBinaryEncodeTrID: MmsBinaryEncodeTextString fail\n");
goto __CATCH;
}
return false;
}
-
-
static bool __MmsBinaryEncodeMmsVersion(FILE *pFile)
{
UINT8 majorVer = MMS_MAJOR_VERSION;
}
}
- gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_VERSION) | 0x80;
+ gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_VERSION) | 0x80;
MSG_DEBUG("__MmsBinaryEncodeMmsVersion: major version (%d)\n", majorVer);
MSG_DEBUG("__MmsBinaryEncodeMmsVersion: minor version (%d)\n", minorVer);
return false;
}
-
-
static bool __MmsBinaryEncodeDate(FILE *pFile)
{
struct tm *dateTime = NULL;
if (dateSec > 0) {
int length = 0;
- length = MmsBinaryEncodeLongIntegerLen(dateSec);
+ length = __MmsBinaryEncodeLongIntegerLen(dateSec);
if ((gMmsEncodeMaxLen - gCurMmsEncodeBuffPos) < (length + 1)) { // + fieldCode
if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos,
}
}
- gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_DATE) | 0x80;
+ gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_DATE) | 0x80;
- if (MmsBinaryEncodeLongInteger(pFile, dateSec, length) == false) {
+ if (__MmsBinaryEncodeLongInteger(pFile, dateSec, length) == false) {
MSG_DEBUG("__MmsBinaryEncodeDate: date MmsBinaryEncodeLongInteger error\n");
goto __CATCH;
}
return false;
}
-
-
static bool __MmsBinaryEncodeFrom(FILE *pFile)
{
if (pFile == NULL) {
}
}
- gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = _MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_FROM) | 0x80;
+ gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_FROM) | 0x80;
/* length of MMS_INSERT_ADDRESS_TOKEN value */
gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = 0x01;
- gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = _MmsGetBinaryValue(MmsCodeAddressType, MMS_INSERT_ADDRESS_TOKEN) | 0x80;
+ gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = MmsGetBinaryValue(MmsCodeAddressType, MMS_INSERT_ADDRESS_TOKEN) | 0x80;
return true;
__CATCH:
return false;
}
-
static bool __MmsBinaryEncodeOneAddress(FILE *pFile, MmsFieldCode addrType, char *szAddrStr)
{
int length = 0;
}
/* EncodedString */
- length = MmsBinaryEncodeEncodedStringLen((UINT8*)szAddrStr);
+ length = __MmsBinaryEncodeEncodedStringLen((UINT8*)szAddrStr);
if (length == -1) {
MSG_DEBUG("__MmsBinaryEncodeOneAddress: MmsBinaryEncodeEncodedStringLen fail \n");
}
}
- gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = _MmsGetBinaryValue(MmsCodeFieldCode, addrType) | 0x80;
+ gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = MmsGetBinaryValue(MmsCodeFieldCode, addrType) | 0x80;
- if (MmsBinaryEncodeEncodedString(pFile, (UINT8*)szAddrStr, length) == false) {
+ if (__MmsBinaryEncodeEncodedString(pFile, (UINT8*)szAddrStr, length) == false) {
MSG_DEBUG("__MmsBinaryEncodeOneAddress: MmsBinaryEncodeEncodedString fail \n");
goto __CATCH;
}
return false;
}
-
static bool __MmsBinaryEncodeAddress(FILE *pFile, MmsFieldCode addrType, char *szAddr)
{
char *pSingleAddr = NULL;
return false;
}
-
-
static bool __MmsBinaryEncodeTime(FILE *pFile, MmsFieldCode fieldCode, MmsTimeStruct time)
{
int timeLen = 0;
*/
if (time.type == MMS_TIMETYPE_RELATIVE) {
- timeLen = MmsBinaryEncodeIntegerLen(time.time);
+ timeLen = __MmsBinaryEncodeIntegerLen(time.time);
} else {
- timeLen = MmsBinaryEncodeLongIntegerLen(time.time);
+ timeLen = __MmsBinaryEncodeLongIntegerLen(time.time);
}
if (timeLen <= 0) {
goto __CATCH;
}
- length = MmsBinaryEncodeValueLengthLen(timeLen + 1); //time length + time type token
+ length = __MmsBinaryEncodeValueLengthLen(timeLen + 1); //time length + time type token
if (length == -1) {
MSG_DEBUG("__MmsBinaryEncodeTime: MmsBinaryEncodeValueLengthLen fail \n");
goto __CATCH;
}
/* fieldCode */
- gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = _MmsGetBinaryValue(MmsCodeFieldCode, fieldCode) | 0x80;
+ gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = MmsGetBinaryValue(MmsCodeFieldCode, fieldCode) | 0x80;
/* value length */
- if (MmsBinaryEncodeValueLength(pFile, timeLen + 1, length) == false) {
+ if (__MmsBinaryEncodeValueLength(pFile, timeLen + 1, length) == false) {
MSG_DEBUG("__MmsBinaryEncodeTime: MmsBinaryEncodeValueLength fail \n");
goto __CATCH;
}
/* time type & value */
if (time.type == MMS_TIMETYPE_RELATIVE) {
- gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = _MmsGetBinaryValue(MmsCodeTimeType, MMS_TIMETYPE_RELATIVE) | 0x80;
- if (MmsBinaryEncodeInteger(pFile, time.time, timeLen) == false) {
+ gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = MmsGetBinaryValue(MmsCodeTimeType, MMS_TIMETYPE_RELATIVE) | 0x80;
+ if (__MmsBinaryEncodeInteger(pFile, time.time, timeLen) == false) {
MSG_DEBUG("__MmsBinaryEncodeTime: MmsBinaryEncodeLongInteger fail \n");
goto __CATCH;
}
} else {
- gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = _MmsGetBinaryValue(MmsCodeTimeType, MMS_TIMETYPE_ABSOLUTE) | 0x80;
- if (MmsBinaryEncodeLongInteger(pFile, time.time, timeLen) == false) {
+ gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = MmsGetBinaryValue(MmsCodeTimeType, MMS_TIMETYPE_ABSOLUTE) | 0x80;
+ if (__MmsBinaryEncodeLongInteger(pFile, time.time, timeLen) == false) {
MSG_DEBUG("__MmsBinaryEncodeTime: MmsBinaryEncodeLongInteger fail \n");
goto __CATCH;
}
__CATCH:
return false;
}
-
#include "MsgStorageHandler.h"
#include "MmsPluginTypes.h"
#include "MmsPluginCodec.h"
-#include "MmsPluginSetup.h"
#include "MmsPluginInternal.h"
#include "MmsPluginStorage.h"
#include "MmsPluginHttp.h"
#include "MmsPluginCodec.h"
-
#include "MsgNotificationWrapper.h"
#include "MmsPluginSmil.h"
-MmsSetup gMmsSetup;
-
/*==================================================================================================
IMPLEMENTATION OF MmsPluginInternal - Member Functions
==================================================================================================*/
void MmsPluginInternal::processReceivedInd(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQUEST_INFO_S *pRequest, bool *bReject)
{
- MSG_DEBUG("processReceivedInd \r\n");
+ MSG_BEGIN();
FILE *pFile = NULL;
char fileName[MSG_FILENAME_LEN_MAX] = {0,};
if(MsgCreateFileName(fileName) == false)
THROW(MsgException::FILE_ERROR, "MsgCreateFileName error");
- MSG_DEBUG(" File name = %s", fileName);
+ MSG_DEBUG("File name = %s", fileName);
if(MsgWriteIpcFile(fileName, pMsgInfo->msgText, pMsgInfo->dataSize) == false)
THROW(MsgException::FILE_ERROR, "MsgWriteIpcFile error");
MSG_DEBUG("MMS File Path = %s", pMsgInfo->msgData);
- _MmsInitHeader();
- _MmsRegisterDecodeBuffer(gszMmsLoadBuf1, gszMmsLoadBuf2, MSG_MMS_DECODE_BUFFER_MAX);
+ MmsInitHeader();
+ MmsRegisterDecodeBuffer();
if ((pFile = MsgOpenFile(pMsgInfo->msgData, "rb+")) == NULL) {
MSG_DEBUG("File Open Error: %s", pMsgInfo->msgData);
switch (mmsHeader.type) {
case MMS_MSGTYPE_NOTIFICATION_IND:
- MSG_DEBUG("MmsProcessNewMsgInd: process noti.ind\n");
+ MSG_DEBUG("process noti.ind\n");
// For Set Value pMsgInfo
if (processNotiInd(pMsgInfo, pRequest) == false)
*bReject = true;
break;
case MMS_MSGTYPE_DELIVERY_IND:
- MSG_DEBUG("MmsProcessNewMsgInd: process delivery.ind\n");
+ MSG_DEBUG("process delivery.ind\n");
// For Set Value pMsgInfo
processDeliveryInd(pMsgInfo);
break;
case MMS_MSGTYPE_READORG_IND:
- MSG_DEBUG("MmsProcessNewMsgInd: process readorig.ind\n");
+ MSG_DEBUG("process readorig.ind\n");
processReadOrgInd(pMsgInfo);
break;
default:
MsgCloseFile(pFile);
}
- //Check Msg Type & Process(Save ...)
+
+ MSG_END();
}
bool MmsPluginInternal::processNotiInd(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQUEST_INFO_S *pRequest)
MmsMsg *pMsg = NULL;
MmsPluginStorage::instance()->getMmsMessage(&pMsg);
- _MmsInitHeader();
+ MmsInitHeader();
#ifdef __SUPPORT_DRM__
- _MsgFreeDRMInfo(&pMsg->msgType.drmInfo);
+ MsgFreeDRMInfo(&pMsg->msgType.drmInfo);
#endif
- _MsgFreeBody(&pMsg->msgBody, pMsg->msgType.type);
+ MsgFreeBody(&pMsg->msgBody, pMsg->msgType.type);
MSG_END();
MmsMsg *pMsg = NULL;
pStorage->getMmsMessage(&pMsg);
- _MmsInitHeader();
+ MmsInitHeader();
#ifdef __SUPPORT_DRM__
- _MsgFreeDRMInfo(&pMsg->msgType.drmInfo);
+ MsgFreeDRMInfo(&pMsg->msgType.drmInfo);
#endif
- _MsgFreeBody(&pMsg->msgBody, pMsg->msgType.type);
+ MsgFreeBody(&pMsg->msgBody, pMsg->msgType.type);
MSG_END();
}
return false;
}
- if (_MmsEncodeNotiRespInd(pFile, szTrID, iStatus, bReportAllowed) == false) {
- MSG_DEBUG("MmsEncodeNotifyRespInd: _MmsEncodeNotiRespInd fail");
+ if (MmsEncodeNotiRespInd(pFile, szTrID, iStatus, bReportAllowed) == false) {
+ MSG_DEBUG("MmsEncodeNotifyRespInd: MmsEncodeNotiRespInd fail");
MsgCloseFile(pFile);
return false;
}
return false;
}
- if (_MmsEncodeAckInd(pFile, szTrID, bReportAllowed) == false) {
- MSG_DEBUG("MmsEncodeAckInd: _MmsEncodeAckInd fail \n" );
+ if (MmsEncodeAckInd(pFile, szTrID, bReportAllowed) == false) {
+ MSG_DEBUG("MmsEncodeAckInd: MmsEncodeAckInd fail \n" );
MsgCloseFile(pFile);
return false;
}
if (pMsgInfo->msgType.subType == MSG_NOTIFICATIONIND_MMS) {
FILE *pFile;
- _MmsInitHeader();
- _MmsRegisterDecodeBuffer(gszMmsLoadBuf1, gszMmsLoadBuf2, MSG_MMS_DECODE_BUFFER_MAX);
+
+ MmsInitHeader();
+ MmsRegisterDecodeBuffer();
if ((pFile = MsgOpenFile(pMsgInfo->msgData, "rb+")) == NULL) {
MSG_DEBUG("File Open Error: %s", pMsgInfo->msgData);
}
-bool MmsInsertPresentation(MmsMsg *pMsg, MsgContentType mimeType, char *pData, int size)
+bool MmsInsertPresentation(MmsMsg *pMsg, MimeType mimeType, char *pData, int size)
{
MSG_DEBUG("MmsInsertPresentation");
MsgMultipart *pMultipart = NULL;
MsgMultipart *pLastPart = NULL;
int nFileSize;
- MsgContentType mimeType = MIME_UNKNOWN;
+ MimeType mimeType = MIME_UNKNOWN;
char *pExt = NULL;
pExt = strrchr(szOrgFilePath, '.');
-MsgMultipart *MmsMakeMultipart(MsgContentType mimeType, char *szTitleName, char *szOrgFilePath, void *pData, int offset, int size, char *szContentID)
+MsgMultipart *MmsMakeMultipart(MimeType mimeType, char *szTitleName, char *szOrgFilePath, void *pData, int offset, int size, char *szContentID)
{
MsgMultipart *pMultipart = NULL;
goto __CATCH;
}
- _MmsRegisterDecodeBuffer(gszMmsLoadBuf1,
- gszMmsLoadBuf2,
- MSG_MMS_DECODE_BUFFER_MAX);
+ MmsRegisterDecodeBuffer();
if (MmsBinaryDecodeMsgHeader(pFile, nSize) == false) {
MSG_DEBUG( "_MmsReadMsgBody: MmsBinaryDecodeMsgHeader fail...\n");
/* Set mmsHeader.msgType & msgBody to pMsg ----------- */
- pMmsMsg->mmsAttrib.contentType = (MsgContentType)mmsHeader.msgType.type;
+ pMmsMsg->mmsAttrib.contentType = (MimeType)mmsHeader.msgType.type;
memcpy(&(pMmsMsg->msgType), &(mmsHeader.msgType), sizeof(MsgType));
memcpy(&(pMmsMsg->msgBody), &(mmsHeader.msgBody), sizeof(MsgBody));
if ((mmsHeader.msgType.type == MIME_APPLICATION_VND_WAP_MULTIPART_MIXED) ||
(mmsHeader.msgType.type == MIME_MULTIPART_MIXED)) {
if ((pMmsMsg->nPartCount >= attachmax ) && (pMultipart->pNext != NULL)) {
- _MsgFreeBody(pMultipart->pNext->pBody, pMultipart->pNext->type.type);
+ MsgFreeBody(pMultipart->pNext->pBody, pMultipart->pNext->type.type);
free(pMultipart->pNext->pBody);
pMultipart->pNext->pBody = NULL;
}
//call before processing urgent event.
- _MmsInitHeader();
- _MmsUnregisterDecodeBuffer();
+ MmsInitHeader();
+ MmsUnregisterDecodeBuffer();
return true;
__CATCH:
- _MmsInitHeader();
- _MmsUnregisterDecodeBuffer();
+ MmsInitHeader();
+ MmsUnregisterDecodeBuffer();
if (pFile != NULL) {
MsgCloseFile(pFile);
pFile = NULL;
}
- _MsgFreeBody(&pMmsMsg->msgBody, pMmsMsg->msgType.type);
+ MsgFreeBody(&pMmsMsg->msgBody, pMmsMsg->msgType.type);
MSG_DEBUG("_MmsReadMsgBody: E N D ( fail ) ******************** \n");
return false;
#include "MsgMmsMessage.h"
#include "MsgTypes.h"
-#include "MmsPluginSetup.h"
#include "MsgUtilFile.h"
+#define MSG_STDSTR_SHORT 0x7F
+
/* static variables */
static char gszEmptyRawDoc[] = "<smil><head><layout></layout></head><body></body></smil>";
static MmsSmilDoc *__gpaMmsSmilDoc[MMS_SMIL_MAX_DOC]={NULL, };
#include "MsgMmsMessage.h"
#include "MsgNotificationWrapper.h"
#include "MsgUtilStorage.h"
-
-#include "MmsPluginStorage.h"
-#include "MmsPluginSetup.h"
#include "MmsPluginStorage.h"
#include "MmsPluginCodec.h"
#include "MmsPluginSmil.h"
MMS_MESSAGE_DATA_S mmsMsgData;
bzero(&mmsMsgData,sizeof(MMS_MESSAGE_DATA_S));
if (MmsComposeMessage(&mmsMsg, pMsgInfo, pSendOptInfo, &mmsMsgData, pFileData) != true) {
- _MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
MsgFreeAttrib(&mmsMsg.mmsAttrib);
__MmsReleaseMmsLists(&mmsMsgData);
snprintf((char *)pMsgInfo->msgData, MAX_MSG_DATA_LEN+1, MSG_DATA_PATH"%d.mms", pMsgInfo->msgId);
if (addMmsMsgToDB(&mmsMsg, pMsgInfo, _MsgMmsGetAttachCount(&mmsMsgData)) != MSG_SUCCESS) {
- _MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
MsgFreeAttrib(&mmsMsg.mmsAttrib);
__MmsReleaseMmsLists(&mmsMsgData);
pFile = MsgOpenMMSFile(fileName);
if (!pFile) {
- _MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
MsgFreeAttrib(&mmsMsg.mmsAttrib);
__MmsReleaseMmsLists(&mmsMsgData);
THROW(MsgException::MMS_PLG_ERROR, "MMS File open Error");
}
if (fchmod(fileno(pFile), file_mode) < 0) {
- _MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
MsgFreeAttrib(&mmsMsg.mmsAttrib);
__MmsReleaseMmsLists(&mmsMsgData);
MsgCloseFile(pFile);
THROW(MsgException::MMS_PLG_ERROR, "chmod() error: %s", strerror(errno));
}
- if (_MmsEncodeSendReq(pFile, &mmsMsg) != true) {
- _MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ if (MmsEncodeSendReq(pFile, &mmsMsg) != true) {
+ MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
MsgFreeAttrib(&mmsMsg.mmsAttrib);
__MmsReleaseMmsLists(&mmsMsgData);
MsgCloseFile(pFile);
pMsgInfo->dataSize = size;
- _MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
MsgFreeAttrib(&mmsMsg.mmsAttrib);
__MmsReleaseMmsLists(&mmsMsgData);
//Need to store mms specific data (contents location, TrID, ExpiryTime, Delivery Report, message ID)
if (addMmsMsgToDB(&mmsMsg, pMsgInfo) != MSG_SUCCESS) {
- _MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
THROW(MsgException::MMS_PLG_ERROR, "MMS Stroage Error");
}
} else if (pMsgInfo->msgType.subType == MSG_SENDCONF_MMS || pMsgInfo->msgType.subType == MSG_RETRIEVE_AUTOCONF_MMS) {
MmsMsg *pMsg = NULL;
char szTemp[MAX_MSG_DATA_LEN + 1]= {0, };
- if (!_MmsReadMsgBody(pMsgInfo->msgId, true, true, pFileData))
+ if (!MmsReadMsgBody(pMsgInfo->msgId, true, true, pFileData))
THROW(MsgException::MMS_PLG_ERROR, "_MmsReadMsgBody Error");
MmsPluginStorage::instance()->getMmsMessage(&pMsg);
}
if (addMmsMsgToDB(pMsg, pMsgInfo) != MSG_SUCCESS) {
- _MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
THROW(MsgException::MMS_PLG_ERROR, "MMS Stroage Error");
}
memset(pMsgInfo->msgData, 0, MAX_MSG_DATA_LEN + 1);
strcpy((char *)pMsgInfo->msgData,szTemp);
- _MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
} else if (pMsgInfo->msgType.subType == MSG_READREPLY_MMS || pMsgInfo->msgType.subType == MSG_READRECIND_MMS) {
MSG_DEBUG("######## MmsPlgAddMessage -> MSG_READREPLY_MMS || MSG_READRECIND_MMS ###########");
MmsComposeReadReportMessage(&mmsMsg, pMsgInfo, selectedMsgId);
if (addMmsMsgToDB(&mmsMsg, pMsgInfo) != MSG_SUCCESS) {
- _MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
MsgFreeAttrib(&mmsMsg.mmsAttrib);
THROW(MsgException::MMS_PLG_ERROR, "MMS Stroage Error");
snprintf(filePath, MAX_FULL_PATH_SIZE+1, MSG_DATA_PATH"%d", mmsMsg.msgID);
pFile = MsgOpenMMSFile(filePath);
if (!pFile) {
- _MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
MsgFreeAttrib(&mmsMsg.mmsAttrib);
MsgCloseFile(pFile);
pFile = NULL;
}
if (fchmod(fileno(pFile), file_mode) < 0) {
- _MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
MsgFreeAttrib(&mmsMsg.mmsAttrib);
MsgCloseFile(pFile);
pFile = NULL;
if (version == 0x90) {
MSG_DEBUG("### version 1.0 ###");
- if (_MmsEncodeReadReport10(pFile, &mmsMsg, readStatus) != true) {
+ if (MmsEncodeReadReport10(pFile, &mmsMsg, readStatus) != true) {
MsgFreeAttrib(&mmsMsg.mmsAttrib);
MsgCloseFile(pFile);
pFile = NULL;
}
} else {
MSG_DEBUG("### version 1.1 ###");
- if (_MmsEncodeReadReport11(pFile, &mmsMsg, readStatus) != true) {
+ if (MmsEncodeReadReport11(pFile, &mmsMsg, readStatus) != true) {
MsgFreeAttrib(&mmsMsg.mmsAttrib);
MsgCloseFile(pFile);
pFile = NULL;
MsgCloseFile(pFile);
pFile = NULL;
- _MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
MsgFreeAttrib(&mmsMsg.mmsAttrib);
MMS_MESSAGE_DATA_S mmsMsgData;
if (MmsComposeMessage(&mmsMsg, pMsgInfo, pSendOptInfo, &mmsMsgData, pFileData) != true) {
- _MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
MsgFreeAttrib(&mmsMsg.mmsAttrib);
__MmsReleaseMmsLists(&mmsMsgData);
snprintf((char *)pMsgInfo->msgData, MAX_MSG_DATA_LEN + 1, MSG_DATA_PATH"%d.mms", pMsgInfo->msgId);
if (addMmsMsgToDB(&mmsMsg, pMsgInfo, _MsgMmsGetAttachCount(&mmsMsgData)) != MSG_SUCCESS) {
- _MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
MsgFreeAttrib(&mmsMsg.mmsAttrib);
__MmsReleaseMmsLists(&mmsMsgData);
pFile = MsgOpenMMSFile(filePath);
if (!pFile) {
- _MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
MsgFreeAttrib(&mmsMsg.mmsAttrib);
__MmsReleaseMmsLists(&mmsMsgData);
MsgCloseFile(pFile);
}
if (fchmod(fileno(pFile), file_mode) < 0) {
- _MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
MsgFreeAttrib(&mmsMsg.mmsAttrib);
__MmsReleaseMmsLists(&mmsMsgData);
MsgCloseFile(pFile);
THROW(MsgException::MMS_PLG_ERROR, "chmod() error: %s", strerror(errno));
}
- if (_MmsEncodeSendReq(pFile, &mmsMsg) != true) {
- _MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ if (MmsEncodeSendReq(pFile, &mmsMsg) != true) {
+ MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
MsgFreeAttrib(&mmsMsg.mmsAttrib);
__MmsReleaseMmsLists(&mmsMsgData);
MsgCloseFile(pFile);
MsgCloseFile(pFile);
pFile = NULL;
- _MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
MsgFreeAttrib(&mmsMsg.mmsAttrib);
__MmsReleaseMmsLists(&mmsMsgData);
}
if (version == 0x90) {
MSG_DEBUG("### version 1.0 ###");
- if (_MmsEncodeReadReport10(pFile, &mmsMsg, readStatus) != true) {
+ if (MmsEncodeReadReport10(pFile, &mmsMsg, readStatus) != true) {
MsgCloseFile(pFile);
THROW(MsgException::MMS_PLG_ERROR, "MMS Encode Read Report 1.0 Error");
}
} else {
MSG_DEBUG("### version 1.1 ###");
- if (_MmsEncodeReadReport11(pFile, &mmsMsg, readStatus) != true) {
+ if (MmsEncodeReadReport11(pFile, &mmsMsg, readStatus) != true) {
MsgCloseFile(pFile);
THROW(MsgException::MMS_PLG_ERROR, "MMS Encode Read Report 1.1 Error");
}
dbHandle.finalizeQuery();
}
- if (_MmsReadMsgBody(pMsg->msgId, true, false, NULL) == false) {
+ if (MmsReadMsgBody(pMsg->msgId, true, false, NULL) == false) {
MSG_DEBUG("The MMS Message might include drm contents!!!");
#ifdef __SUPPORT_DRM__
MmsMsg *pStoMmsMsg;
MmsPluginStorage::instance()->getMmsMessage(&pStoMmsMsg);
- _MmsInitHeader();
- _MmsUnregisterDecodeBuffer();
+ MmsInitHeader();
+ MmsUnregisterDecodeBuffer();
#ifdef __SUPPORT_DRM__
- _MsgFreeDRMInfo(&pStoMmsMsg->msgType.drmInfo);
+ MsgFreeDRMInfo(&pStoMmsMsg->msgType.drmInfo);
#endif
- _MsgFreeBody(&pStoMmsMsg->msgBody, pStoMmsMsg->msgType.type);
+ MsgFreeBody(&pStoMmsMsg->msgBody, pStoMmsMsg->msgType.type);
pMsg->dataSize = nSize;
{
MmsMsg *pMsg;
MmsPluginStorage::instance()->getMmsMessage(&pMsg);
- _MmsInitHeader();
+ MmsInitHeader();
- _MmsUnregisterDecodeBuffer();
+ MmsUnregisterDecodeBuffer();
#ifdef __SUPPORT_DRM__
- _MsgFreeDRMInfo(&pMsg->msgType.drmInfo);
+ MsgFreeDRMInfo(&pMsg->msgType.drmInfo);
#endif
- _MsgFreeBody(&pMsg->msgBody, pMsg->msgType.type);
+ MsgFreeBody(&pMsg->msgBody, pMsg->msgType.type);
return MSG_ERR_STORAGE_ERROR;
}
MMS_MESSAGE_DATA_S mmsMsgData;
if (MmsComposeMessage(&mmsMsg, pMsgInfo, pSendOptInfo, &mmsMsgData, pFileData) != true) {
- _MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
MsgFreeAttrib(&mmsMsg.mmsAttrib);
__MmsReleaseMmsLists(&mmsMsgData);
pFile = MsgOpenMMSFile(filePath);
- if (_MmsEncodeSendReq(pFile, &mmsMsg) != true) {
- _MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ if (MmsEncodeSendReq(pFile, &mmsMsg) != true) {
+ MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
MsgFreeAttrib(&mmsMsg.mmsAttrib);
__MmsReleaseMmsLists(&mmsMsgData);
MsgCloseFile(pFile);
MsgCloseFile(pFile);
- _MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
+ MsgFreeBody(&mmsMsg.msgBody, mmsMsg.msgType.type);
MsgFreeAttrib(&mmsMsg.mmsAttrib);
__MmsReleaseMmsLists(&mmsMsgData);
return MSG_SUCCESS;
}
-
-/* This API is not used anywhere now */
-msg_error_t MmsPluginStorage::plgGetRestoreMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pSendOptInfo, MMS_MESSAGE_DATA_S *pMmsMsg, char **pDestMsg, char *filePath)
-{
- MSG_BEGIN();
-
- msg_error_t err = MSG_SUCCESS;
- int partCnt = 0;
- MsgType partHeader;
- MmsAttrib pMmsAttrib;
- char szBuf[MSG_FILEPATH_LEN_MAX] = {0, };
- unsigned int nSize;
- bool bMultipartRelated = false;
-
- if (_MmsReadMsgBody(pMsg->msgId, true, true, filePath) == false) {
- MSG_DEBUG("The MMS Message might include drm contents!!!");
-
-#ifdef __SUPPORT_DRM__
- if (MmsDrm2GetConvertState() == MMS_DRM2_CONVERT_REQUIRED) {
- bool bRetToConvert = true;
-
- bRetToConvert = MmsDrm2ConvertMsgBody(mmsHeader.msgType.szOrgFilePath);
-
- MmsDrm2SetConvertState(MMS_DRM2_CONVERT_FINISH);
-
- if (bRetToConvert) {
- int ret;
- ret = remove(mmsHeader.msgType.szOrgFilePath);
- if (ret != 0) {
- MSG_DEBUG("remove fail\n");
- }
-
- ret = rename(MMS_DECODE_DRM_CONVERTED_TEMP_FILE, mmsHeader.msgType.szOrgFilePath);
- if (ret != 0) {
- MSG_DEBUG("rename fail\n");
- }
-
- if (MmsDrm2ReadMsgConvertedBody(pMsg, true, false, NULL) == false) {
- MSG_DEBUG("MmsLoadMsg:MmsDrm2ReadMsgConvertedBody() returns false\n");
- goto L_CATCH;
- }
- } else {
- goto L_CATCH;
- }
- }
-#endif
- }
-
- MmsGetMsgAttrib(pMsg->msgId, &pMmsAttrib);
-
- pMmsMsg->regionCnt = 0;
- pMmsMsg->pageCnt = 0;
- pMmsMsg->attachCnt = 0;
- pMmsMsg->transitionCnt = 0;
- pMmsMsg->metaCnt = 0;
- memset(pMmsMsg->szSmilFilePath, 0, MSG_FILEPATH_LEN_MAX);
-
- if (pMmsAttrib.contentType == MIME_MULTIPART_RELATED || pMmsAttrib.contentType == MIME_APPLICATION_VND_WAP_MULTIPART_RELATED) {
- char *pSmilDoc = NULL;
-
- pSmilDoc = MmsSmilGetPresentationData(pMsg->msgId);
- if (!pSmilDoc) {
- goto L_CATCH;
- }
-
- MmsSmilParseSmilDoc(pMmsMsg, pSmilDoc);
- bMultipartRelated = true;
- }
-
- partCnt = MmsGetMediaPartCount(pMsg->msgId);
- MSG_DEBUG("MmsUiGetMediaAttachInfo: partCnt=%d\n", partCnt);
-
- if (partCnt < 0) {
- MSG_DEBUG("MmsUiGetMediaAttachInfo: partCnt=%d\n", partCnt);
- goto FREE_CATCH;
- }
-
- for (int i = 0; i < partCnt; ++i) {
- if (!MmsGetMediaPartHeader(i, &partHeader)) {
- MSG_DEBUG("MmsUiGetMediaAttachInfo: MmsGetMediaPartHeader failed\n");
- goto FREE_CATCH;
- }
-
- if (partHeader.contentSize > 0) {
- if (!strcasecmp(partHeader.param.szFileName, "cid:")) {
- strncpy((char *)szBuf, &partHeader.param.szFileName[4], MSG_FILEPATH_LEN_MAX - 1);
- } else {
- strcpy((char *)szBuf, partHeader.param.szFileName);
- }
- sprintf(partHeader.param.szFileName, MSG_DATA_PATH"%s", szBuf);
-
- if (!bMultipartRelated || MmsCheckAdditionalMedia(pMmsMsg, &partHeader)) {
- MMS_ATTACH_S *attachment = NULL;
- int tempType;
-
- attachment = (MMS_ATTACH_S *)calloc(sizeof(MMS_ATTACH_S), 1);
-
- MsgGetTypeByFileName(&tempType, partHeader.param.szFileName);
- attachment->mediatype = (MimeType)tempType;
-
- strcpy(attachment->szFilePath, partHeader.param.szFileName);
-
- strncpy(attachment->szFileName, partHeader.param.szName, MSG_FILENAME_LEN_MAX - 1);
-
- attachment->fileSize = partHeader.contentSize;
-
- _MsgMmsAddAttachment(pMmsMsg, attachment);
- }
- }
- }
-
- *pDestMsg = _MsgMmsSerializeMessageData(pMmsMsg, &nSize);
-
- __MmsReleaseMmsLists(pMmsMsg);
-
- MmsMsg *pStoMmsMsg;
- MmsPluginStorage::instance()->getMmsMessage(&pStoMmsMsg);
- _MmsInitHeader();
- _MmsUnregisterDecodeBuffer();
-#ifdef __SUPPORT_DRM__
- _MsgFreeDRMInfo(&pStoMmsMsg->msgType.drmInfo);
-#endif
- _MsgFreeBody(&pStoMmsMsg->msgBody, pStoMmsMsg->msgType.type);
-
-
- pMsg->dataSize = nSize;
- MSG_END();
-
- return err;
-
-FREE_CATCH:
- if (bMultipartRelated) {
- __MmsReleaseMmsLists(pMmsMsg);
-
- }
-
-L_CATCH:
- MSG_DEBUG("MmsPlgUpdateMessage : Update MMS Message Failed");
- MSG_END();
- {
- MmsMsg *pMsg;
- MmsPluginStorage::instance()->getMmsMessage(&pMsg);
- _MmsInitHeader();
-
- _MmsUnregisterDecodeBuffer();
-#ifdef __SUPPORT_DRM__
- _MsgFreeDRMInfo(&pMsg->msgType.drmInfo);
-#endif
- _MsgFreeBody(&pMsg->msgBody, pMsg->msgType.type);
-
- return MSG_ERR_STORAGE_ERROR;
- }
-}
-/* This API is not used anywhere now */
-
* limitations under the License.
*/
#include <glib.h>
-#include <stdlib.h>
-#include <ctype.h>
#include "MmsPluginMIME.h"
#include "MmsPluginCodec.h"
#include "MmsPluginTextConvert.h"
MSG_DEBUG(":::%d :%s ", rcvdBodyLen, pRcvdBody);
- _MmsInitHeader();
- _MmsRegisterDecodeBuffer(gszMmsLoadBuf1, gszMmsLoadBuf2, MSG_MMS_DECODE_BUFFER_MAX);
+ MmsInitHeader();
+ MmsRegisterDecodeBuffer();
if (MsgCreateFileName(fileName) == false)
return false;
return false;
}
- if (_MmsReadMsgBody(msgId, true, true, retrievedFilePath) == false) {
+ if (MmsReadMsgBody(msgId, true, true, retrievedFilePath) == false) {
MSG_DEBUG("The MMS Message might include drm contents!!!");
#ifdef __SUPPORT_DRM__
MmsPluginStorage::instance()->getMmsMessage(&pMsg);
- _MmsInitHeader();
- _MmsUnregisterDecodeBuffer();
+ MmsInitHeader();
+ MmsUnregisterDecodeBuffer();
#ifdef __SUPPORT_DRM__
- _MsgFreeDRMInfo(&pMsg->msgType.drmInfo);
+ MsgFreeDRMInfo(&pMsg->msgType.drmInfo);
#endif
- _MsgFreeBody(&pMsg->msgBody, pMsg->msgType.type);
+ MsgFreeBody(&pMsg->msgBody, pMsg->msgType.type);
return false;
}
#ifndef MMS_PLUGIN_CODEC_H
#define MMS_PLUGIN_CODEC_H
-
-
/*==================================================================================================
HEADER
==================================================================================================*/
-
-#include <glib.h>
-#include <vconf.h>
-#include "MsgMmsTypes.h"
-#include "MmsPluginMessage.h"
-#include "MsgTransportTypes.h"
-
-/*==================================================================================================
- DEFINE
-==================================================================================================*/
-
-#define MMS_MAJOR_VERSION 1
-
-#if defined(MMS_V1_1)
-#define MMS_MINOR_VERSION 1
-#define MMS_VERSION 0x91
-
-#elif defined(MMS_V1_2)
-#define MMS_MINOR_VERSION 2
-#define MMS_VERSION 0x92
-
-#else
-#define MMS_MINOR_VERSION 0
-#define MMS_VERSION 0x90
-#endif
-
-#define MMS_SIGN_TEXT_LEN 100
-#define MMS_MAX_FIELD_VALUE_COUNT 74
-#define MMS_MAX_FIELD_TYPE_COUNT 21
-#define MSG_MMS_ENCODE_BUFFER_MAX (2 * 1024)
-#define MSG_MMS_DECODE_BUFFER_MAX (2 * 1024)
-#define MSB 0x80
-#define QUOTE 0x7F
-#define MARK 0x22 // "
-#define NO_VALUE 0x00
-#define LENGTH_QUOTE 0x1F
-#define MSG_STDSTR_LONG 0xFF
-#define INVALID_VALUE -1
-#define MSG_INVALID_VALUE -1
-
-#define MMS_MAX_FIELD_VALUE_COUNT 74
-#define MMS_MAX_FIELD_TYPE_COUNT 21
-
-#define MSG_LOCAL_TEMP_BUF_SIZE 1024
-#define MSG_INBOX_DIRECTORY "/User/Msg/Inbox"
-/*==================================================================================================
- ENUMS
-==================================================================================================*/
-
-typedef enum {
- MMS_CODE_BCC,
- MMS_CODE_CC,
- MMS_CODE_CONTENTLOCATION,
- MMS_CODE_CONTENTTYPE,
- MMS_CODE_DATE,
- MMS_CODE_DELIVERYREPORT,
- MMS_CODE_DELIVERYTIME,
- MMS_CODE_EXPIRYTIME,
- MMS_CODE_FROM,
- MMS_CODE_MSGCLASS,
- MMS_CODE_MSGID,
- MMS_CODE_MSGTYPE,
- MMS_CODE_VERSION,
- MMS_CODE_MSGSIZE,
- MMS_CODE_PRIORITY,
- MMS_CODE_READREPLY,
- MMS_CODE_REPORTALLOWED,
- MMS_CODE_RESPONSESTATUS,
- MMS_CODE_RETRIEVESTATUS, /* Add by MMSENC v1.1 */
- MMS_CODE_RESPONSETEXT,
- MMS_CODE_RETRIEVETEXT, /* Add by MMSENC v1.1 */
- MMS_CODE_SENDERVISIBILLITY,
- MMS_CODE_MSGSTATUS,
- MMS_CODE_SUBJECT,
- MMS_CODE_TO,
- MMS_CODE_TRID,
-
- /* Add by MMSENC v1.1 */
- MMS_CODE_READSTATUS,
- MMS_CODE_REPLYCHARGING,
- MMS_CODE_REPLYCHARGINGDEADLINE,
- MMS_CODE_REPLYCHARGINGID,
- MMS_CODE_REPLYCHARGINGSIZE,
- MMS_CODE_PREVIOUSLYSENTBY,
- MMS_CODE_PREVIOUSLYSENTDATE,
-
- MMS_CODE_TRANSFERENCODING,
- MMS_CODE_DISPOSITION,
- MMS_CODE_CONTENT_ID
-} MmsFieldCode;
-
-enum {
- MMS_BODYHDR_TRANSFERENCODING,
- MMS_BODYHDR_DISPOSITION,
- MMS_BODYHDR_CONTENTID,
- MMS_BODYHDR_CONTENTLOCATION,
- MMS_BODYHDR_X_OMA_DRM_SEPARATE_DELIVERY, // DRM RO WAITING
-};
-
-typedef enum {
- //code
- MmsCodeFieldCode,
- MmsCodeParameterCode,
- MmsCodeMsgBodyHeaderCode,
-
- //Data
- MmsCodeMsgType,
- MmsCodeDeliveryReport,
- MmsCodeTimeType,
- MmsCodeMsgClass,
- MmsCodePriority,
- MmsCodeResponseStatus,
- MmsCodeRetrieveStatus,
- MmsCodeReadReply,
- MmsCodeReportAllowed,
- MmsCodeSenderVisibility,
- MmsCodeMsgStatus,
- MmsCodeReadStatus,
- MmsCodeAddressType,
- MmsCodeCharSet,
- MmsCodeReplyCharging,
-
- MmsCodeContentType,
-
- MmsCodeMsgDisposition,
- MmsCodeContentTransferEncoding
-} MmsCode;
-
-typedef enum {
- MSG_PRESENTATION_NONE = -1,
- MSG_PRESENTATION_FIRSTPART, //Content-type == type parameter
- MSG_PRESENTATION_TYPE_BASE, //Content-type == type parameter
- MSG_PRESENTATION_LOCATION, //Content-Location == start parameter
- MSG_PRESENTATION_ID, //Content-ID == start parameter
-} MsgPresentationFactor;
-
-/*==================================================================================================
- Structures
-==================================================================================================*/
-
-typedef struct {
- const char *szText;
- UINT16 binary;
-} MmsField;
-
-
-typedef struct {
- char *pData;
- UINT32 length;
-} EncodedPData;
-
-typedef struct {
- MsgPresentationFactor factor;
- MsgMultipart *pPrevPart;
- MsgMultipart *pCurPresentation;
-} MsgPresentaionInfo;
-
-// for Decoding & Encoding
-typedef struct {
- bool bActive;
- char *pszOwner;
- int msgID; // if noti.ind, msgID is -1.
-
- MmsMsgType type;
- char szTrID[MMS_TR_ID_LEN+1];
- UINT8 version;
- UINT32 date;
-
- MsgHeaderAddress *pFrom; //"/TYPE=PLMN", /"TYPE=IPv4", "/TYPE=IPv6"
- MsgHeaderAddress *pTo;
- MsgHeaderAddress *pCc;
- MsgHeaderAddress *pBcc;
- char szSubject[MSG_LOCALE_SUBJ_LEN + 1];
- MmsResponseStatus responseStatus;
- MmsRetrieveStatus retrieveStatus;
- char szResponseText[MMS_LOCALE_RESP_TEXT_LEN + 1];
- char szRetrieveText[MMS_LOCALE_RESP_TEXT_LEN + 1];
-
- MmsMsgClass msgClass;
- MmsTimeStruct expiryTime;
- MmsTimeStruct deliveryTime;
- MmsPriority priority;
- MmsSenderVisible hideAddress;
- MmsReport deliveryReport;
- MmsReport readReply;
- MmsReportAllowed reportAllowed;
- char szContentLocation[MMS_LOCATION_LEN + 1];
-
- msg_delivery_report_status_t msgStatus;
- msg_read_report_status_t readStatus;
-
- MmsReplyCharge replyCharge;
-
- // only used at Decoding module
- char szMsgID[MMS_MSG_ID_LEN + 1];
- UINT32 msgSize;
-
-#ifdef __SUPPORT_DRM__
- MsgDrmType drmType;
-#endif
-
- // dependent to Client implementation
- MsgType msgType;
- MsgBody msgBody;
-} MmsHeader;
-
-extern const MmsField gMmsField[MMS_MAX_FIELD_TYPE_COUNT][MMS_MAX_FIELD_VALUE_COUNT];
-extern char gszMmsLoadBuf1[MSG_MMS_DECODE_BUFFER_MAX + 1];
-extern char gszMmsLoadBuf2[MSG_MMS_DECODE_BUFFER_MAX + 1];
-
-extern MmsHeader mmsHeader;
-
-/* Common */
-char *_MmsGetTextValue(MmsCode i, int j);
-char *_MmsGetTextValuebyField(int field, int value);
-int _MmsGetTextType(MmsCode i, char *pValue);
-UINT16 _MmsGetBinaryValue(MmsCode i, int j);
-int _MmsGetBinaryType(MmsCode i, UINT16 value);
-UINT8 _MmsGetVersion(MmsMsg *pMsg);
-bool _MmsSetVersion(int majorVer, int minorVer);
-const char *MmsGetTextByCode(MmsCode i, UINT16 code);
-
-
-/* Decoding */
-void _MmsInitHeader();
-void _MmsCleanDecodeBuff(void);
-bool _MmsDecodeInitialize(void);
-void _MmsRegisterDecodeBuffer(char *pInBuff1, char *pInBuffer2, int maxLen);
-void _MmsUnregisterDecodeBuffer(void);
-int _MmsGetDecodeOffset(void);
-
-bool MmsBinaryDecodeMsgBody(FILE *pFile, char *szFilePath, int totalLength);
-bool MmsBinaryDecodeContentType(FILE *pFile, char *szFilePath, int totalLength); // for JAVA MMS AppId
-
-bool MmsBinaryDecodeEachPart(FILE *pFile, char *szFilePath, MsgType *pMsgType, MsgBody *pMsgBody, int totalLength);
-int MmsBinaryDecodeContentType(FILE *pFile, MsgType *pMsgType, int totalLength);
-bool MmsBinaryDecodePartHeader(FILE *pFile, MsgType *pMsgType, int headerLen, int totalLength);
-bool MmsBinaryDecodePartBody(FILE *pFile, UINT32 bodyLength, int totalLength);
-bool MmsBinaryDecodeEntries(FILE *pFile, UINT32 *npEntries, int totalLength);
-bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength);
-
-bool MmsBinaryDecodeMultipart(FILE *pFile, char *szFilePath, MsgType *pMsgType, MsgBody *pMsgBody, int totalLength);
-
-
-/* Encoding */
-void _MmsRegisterEncodeBuffer(char *pInBuff, int maxLen);
-void _MmsUnregisterEncodeBuffer(void);
-int _MmsGetEncodeOffset(void);
-
-bool _MmsEncodeMsg(void);
-bool _MmsEncodeSendReq(FILE *pFile, MmsMsg *pMsg);
-bool _MmsEncodeTemplate(FILE *pFile, MmsMsg *pMsg); // just encode MMS Body without any header.
-bool _MmsEncodeAckInd(FILE *pFile, char *szTrID, bool bReportAllowed);
-bool _MmsEncodeNotiRespInd(FILE *pFile, char *szTrID, msg_delivery_report_status_t iStatus, bool bReportAllowed);
-bool _MmsEncodeForwardReq(FILE *pFile, char *szContentLocation, char *szForwardTo, char *szForwardCc, char *szForwardBcc);
-bool _MmsEncodeReadReport10(FILE *pFile, MmsMsg *pMsg, msg_read_report_status_t mmsReadStatus);
-bool _MmsEncodeReadReport11(FILE *pFile, MmsMsg *pMsg, msg_read_report_status_t mmsReadStatus);
-
-
-bool MmsBinaryEncodeMsgBody(FILE *pFile, MsgType *pType, MsgBody *pBody, int nPartCount, bool bTemplate);//NEW_TEMPLATE
-
-int MmsBinaryEncodeContentTypeLen(MsgType *pType);
-bool MmsBinaryEncodeContentType(FILE *pFile, MsgType *pType, int typeLength);
-int MmsBinaryEncodeContentHeaderLen(MsgContentType contentType, MsgType *pType, bool bMultipart);
-bool MmsBinaryEncodeContentHeader(FILE *pFile, MsgContentType contentType, MsgType *pType, bool bMultipart);
-bool MmsBinaryEncodeContentBody(FILE *pFile, MsgBody *pBody);
-bool MmsBinaryEncodeMsgPart(FILE *pFile, int contentType, MsgType *pType, MsgBody *pBody);
-bool MmsBinaryEncodeSendReqHdrwithinBufRegi(FILE *pFile, MmsMsg *pMsg);
-bool MsgWriteDataFromEncodeBuffer(FILE *pFile, char *pInBuffer, int *pPtr, int maxLen, int *pOffset);
-bool MsgLoadDataToDecodeBuffer(FILE *pFile, char **ppBuf, int *pPtr, int *pOffset, char *pInBuf1, char *pInBuf2, int maxLen, int *npRead, int endOfFile);
-bool MsgFreeHeaderAddress(MsgHeaderAddress *pAddr);
-bool MsgCheckFileNameHasInvalidChar(char *szName);
-bool _MsgReplaceInvalidFileNameChar(char *szInText, char replaceChar);
-char *_MsgGetStringUntilDelimiter(char *pszString, char delimiter);
-char *MsgChangeHexString(char *pOrg);
-bool _MsgParseParameter(MsgType *pType, char *pSrc);
-char *_MsgSkipWS(char *s);
-char *__MsgSkipComment(char *s, long trim);
-int _MsgGetCode(MsgHeaderField tableId, char *pStr);
-char *MsgConvertLatin2UTF8FileName(char *pSrc);
-bool _MsgChangeSpace(char *pOrg, char **ppNew);
-void _MsgRemoveFilePath(char *pSrc);
-bool MsgIsUTF8String(unsigned char *szSrc, int nChar);
-bool MsgIsPercentSign(char *pSrc);
-MsgMultipart *MsgAllocMultipart(void);
-bool _MsgInitMsgType(MsgType *pMsgType);
-bool _MsgInitMsgBody(MsgBody *pMsgBody);
-MsgPresentationFactor MsgIsPresentationEx(MsgType *multipartType, char *szStart, MsgContentType typeParam);
-void MsgConfirmPresentationPart(MsgType *pMsgType, MsgBody *pMsgBody, MsgPresentaionInfo *pPresentationInfo);
-bool MsgIsMultipartRelated(int type);
-bool MsgIsPresentablePart(int type);
-bool MsgIsText(int type);
-bool _MsgFreeBody(MsgBody *pBody, int type);
-bool MsgFreeAttrib(MmsAttrib *pAttrib);
-bool MsgResolveNestedMultipart(MsgType *pPartType, MsgBody *pPartBody);
-char *MsgResolveContentURI(char *szSrc);
-bool _MsgParsePartHeader(MsgType *pType, const char *pRawData, int nRawData);
-char *MsgRemoveQuoteFromFilename(char *pSrc);
-MmsMsg *MmsGetMsgById(MmsMsgID msgID, bool msgLock);
-bool MsgIsMultipart(int type);
-bool MsgIsHexChar(char *pSrc);
-char _MsgConvertHexValue(char *pSrc);
-int __MsgConvertCharToInt(char ch);
-bool __MsgInitMsgContentParam(MsgContentParam *pMsgContentParam);
-bool MsgCopyNestedMsgType(MsgType *pMsgType1, MsgType *pMsgType2);
-bool MsgCopyNestedMsgParam(MsgContentParam *pParam1, MsgContentParam *pParam2);
-bool MsgIsMultipartMixed(int type);
-bool MsgStrcpyWithoutCRLF(char *pOrg, char **ppNew);
-bool __MsgIsInvalidFileNameChar(char ch);
-bool MmsAddrUtilCompareAddr(char *pszAddr1, char *pszAddr2);
-bool _MmsDataUpdateLastStatus(MmsMsg *pMsg);
-
-bool _MsgEncodeBase64(void *pSrc, unsigned long srcLen, unsigned long *len, unsigned char *ret);
-void *_MsgDecodeBase64(unsigned char *pSrc, unsigned long srcLen, unsigned long *len);
-bool _MsgEncodeQuotePrintable(unsigned char *pSrc, unsigned long srcLen, unsigned long *len, unsigned char *ret);
-unsigned char *_MsgDecodeQuotePrintable(unsigned char *pSrc, unsigned long srcLen, unsigned long *len);
-bool _MsgEncode2Base64(void *pSrc, unsigned long srcLen, unsigned long *len, unsigned char *ret);
-char *_MsgDecodeText(char *pOri);
-char *MsgEncodeText(char *pOri);
-int MsgGetLatin2UTFCodeSize(unsigned char *szSrc, int nChar);
-int MsgLatin5code2UTF(unsigned char *des, int outBufSize, unsigned char *szSrc, int nChar);
-int MsgGetLatin52UTFCodeSize(unsigned char *szSrc, int nChar);
-int MsgLatin2UTF(unsigned char *des, int outBufSize, unsigned char *szSrc, int nChar);
-int MsgLatin7code2UTF(unsigned char *des, int outBufSize, unsigned char *szSrc, int nChar);
-int MsgGetLatin72UTFCodeSize(unsigned char *szSrc, int nChar);
-int MsgUnicode2UTF(unsigned char *des, int outBufSize, unsigned short *szSrc, int nChar);
-int MsgGetUnicode2UTFCodeSize(unsigned short *szSrc, int nChar);
-bool MmsAddrUtilCheckEmailAddress(char *pszAddr);
-bool MmsAddrUtilRemovePlmnString(char *pszAddr);
-int MsgCutUTFString(unsigned char *des, int outBufSize, unsigned char *szSrc, int nChar);
-void MsgMIMERemoveQuote(char *szSrc);
-bool _MmsMultipartSaveAsTempFile(MsgType *pPartType, MsgBody *pPartBody, char *pszMailboxPath, char *pszMsgFilename, int index, bool bSave);
-bool MsgGetTypeByFileName(int *type, char *szFileName);
-bool MmsGetMediaPartData(MsgType *pPartType, MsgBody *pPartBody, FILE *pFile);
-char *MmsGetBinaryUTF8Data(char *pData, int nRead, int msgEncodingValue, int msgTypeValue, int msgCharsetValue, int *npRead);
-#ifndef __SUPPORT_DRM__
-bool MsgMakeFileName(int iMsgType, char *szFileName, int nUntitleIndex);
-#else
-bool MsgMakeFileName(int iMsgType, char *szFileName, MsgDrmType drmType, int nUntitleIndex);
-#endif
-bool MsgGetFileNameWithoutExtension(char *szOutputName, char *szName);
-int MmsGetMediaPartCount(msg_message_id_t msgId);
-bool MmsGetMediaPartHeader(int index, MsgType *pHeader);
-bool MmsGetMsgAttrib(MmsMsgID msgID, MmsAttrib *pAttrib);
-bool _MmsReadMsgBody(msg_message_id_t msgID, bool bSavePartsAsTempFiles, bool bRetrieved, char *retrievedPath);
-
-#ifdef __SUPPORT_DRM__
-void _MsgFreeDRMInfo(MsgDRMInfo *pDrmInfo);
-bool MsgCopyDrmInfo(MsgType *pPartType);
-bool MmsDrm2ConvertMsgBody(char *szOriginFilePath);
-bool MmsDrm2ReadMsgConvertedBody(MSG_MESSAGE_INFO_S *pMsg, bool bSavePartsAsTempFiles, bool bRetrieved, char *retrievedPath);
-bool MmsDrm2DecodeConvertedMsg(int msgID, char *pszFullPath);
-#endif
-
-bool MmsDebugPrintMulitpartEntry(MsgMultipart *pMultipart, int index);
+#include "MmsPluginCodecTypes.h"
+#include "MmsPluginCodecCommon.h"
+#include "MmsPluginEncode.h"
+#include "MmsPluginDecode.h"
#endif
--- /dev/null
+/*
+* Copyright 2012 Samsung Electronics Co., Ltd
+*
+* Licensed under the Flora License, Version 1.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.tizenopensource.org/license
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+#ifndef MMS_PLUGIN_CODEC_COMMON_H
+#define MMS_PLUGIN_CODEC_COMMON_H
+
+#include "MmsPluginCodecTypes.h"
+
+const char *MmsGetTextByCode(MmsCode i, UINT16 code);
+const char *MmsGetTextValue(MmsCode i, int j);
+const char *MmsGetTextValuebyField(int field, int value);
+int MmsGetBinaryType(MmsCode i, UINT16 value);
+int MmsGetTextType(MmsCode i, char *pValue);
+UINT16 MmsGetBinaryValue(MmsCode i, int j);
+
+void *MsgDecodeBase64(unsigned char *pSrc, unsigned long srcLen, unsigned long *len);
+bool MsgEncode2Base64(void *pSrc, unsigned long srcLen, unsigned long *len, unsigned char *ret);
+unsigned char *MsgDecodeQuotePrintable(unsigned char *pSrc, unsigned long srcLen, unsigned long *len);
+
+char *MsgDecodeText(char *pOri);
+
+
+#endif
--- /dev/null
+/*
+* Copyright 2012 Samsung Electronics Co., Ltd
+*
+* Licensed under the Flora License, Version 1.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.tizenopensource.org/license
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+#ifndef MMS_PLUGIN_CODEC_TYPE_H
+#define MMS_PLUGIN_CODEC_TYPE_H
+
+#include "msg_types.h"
+#include "MsgTypes.h"
+
+#define MMS_MAJOR_VERSION 1
+
+#if defined(MMS_V1_1)
+#define MMS_MINOR_VERSION 1
+#define MMS_VERSION 0x91
+
+#elif defined(MMS_V1_2)
+#define MMS_MINOR_VERSION 2
+#define MMS_VERSION 0x92
+
+#else
+#define MMS_MINOR_VERSION 0
+#define MMS_VERSION 0x90
+#endif
+
+#define MSG_MMS_ENCODE_BUFFER_MAX (2 * 1024)
+#define MSG_MMS_DECODE_BUFFER_MAX (2 * 1024)
+#define MSB 0x80
+#define QUOTE 0x7F
+#define MARK 0x22 // "
+#define LENGTH_QUOTE 0x1F
+#define MSG_STDSTR_LONG 0xFF
+#define INVALID_VALUE -1
+
+#define MMS_CONTENT_ID_LEN 100
+#define MSG_DATE_LEN 50
+#define MSG_SUBJ_LEN 40
+#define MSG_LOCALE_SUBJ_LEN (3 * MSG_SUBJ_LEN)
+#define MSG_LOCAL_TEMP_BUF_SIZE 1024
+#define MSG_ADDR_LEN MAX_ADDRESS_VAL_LEN
+#define MMS_LOCALE_RESP_TEXT_LEN 90
+#define MSG_LOCALE_ADDR_LEN (3 * MAX_ADDRESS_VAL_LEN)
+#define MSG_BOUNDARY_LEN 70
+#define MSG_LOCALE_NAME_LEN 150
+#define MSG_LOCALE_FILENAME_LEN_MAX (3 * 255)
+
+typedef unsigned int UINT;
+typedef unsigned long int UINT32;
+typedef unsigned char UINT8;
+typedef unsigned short int UINT16;
+typedef unsigned long ULONG;
+typedef unsigned char UCHAR;
+typedef unsigned short MCHAR;
+typedef unsigned short USHORT;
+
+typedef struct _MsgAddress MsgAddress;
+typedef struct _MsgBody MsgBody;
+typedef struct _MsgMultipart MsgMultipart;
+typedef struct _MsgMessage MsgMessage;
+
+typedef enum {
+ MMS_CODE_BCC,
+ MMS_CODE_CC,
+ MMS_CODE_CONTENTLOCATION,
+ MMS_CODE_CONTENTTYPE,
+ MMS_CODE_DATE,
+ MMS_CODE_DELIVERYREPORT,
+ MMS_CODE_DELIVERYTIME,
+ MMS_CODE_EXPIRYTIME,
+ MMS_CODE_FROM,
+ MMS_CODE_MSGCLASS,
+ MMS_CODE_MSGID,
+ MMS_CODE_MSGTYPE,
+ MMS_CODE_VERSION,
+ MMS_CODE_MSGSIZE,
+ MMS_CODE_PRIORITY,
+ MMS_CODE_READREPLY,
+ MMS_CODE_REPORTALLOWED,
+ MMS_CODE_RESPONSESTATUS,
+ MMS_CODE_RETRIEVESTATUS, /* Add by MMSENC v1.1 */
+ MMS_CODE_RESPONSETEXT,
+ MMS_CODE_RETRIEVETEXT, /* Add by MMSENC v1.1 */
+ MMS_CODE_SENDERVISIBILLITY,
+ MMS_CODE_MSGSTATUS,
+ MMS_CODE_SUBJECT,
+ MMS_CODE_TO,
+ MMS_CODE_TRID,
+
+ /* Add by MMSENC v1.1 */
+ MMS_CODE_READSTATUS,
+ MMS_CODE_REPLYCHARGING,
+ MMS_CODE_REPLYCHARGINGDEADLINE,
+ MMS_CODE_REPLYCHARGINGID,
+ MMS_CODE_REPLYCHARGINGSIZE,
+ MMS_CODE_PREVIOUSLYSENTBY,
+ MMS_CODE_PREVIOUSLYSENTDATE,
+
+ MMS_CODE_TRANSFERENCODING,
+ MMS_CODE_DISPOSITION,
+ MMS_CODE_CONTENT_ID
+} MmsFieldCode;
+
+enum {
+ MMS_BODYHDR_TRANSFERENCODING,
+ MMS_BODYHDR_DISPOSITION,
+ MMS_BODYHDR_CONTENTID,
+ MMS_BODYHDR_CONTENTLOCATION,
+ MMS_BODYHDR_X_OMA_DRM_SEPARATE_DELIVERY, // DRM RO WAITING
+};
+
+typedef enum {
+ //code
+ MmsCodeFieldCode,
+ MmsCodeParameterCode,
+ MmsCodeMsgBodyHeaderCode,
+
+ //Data
+ MmsCodeMsgType,
+ MmsCodeDeliveryReport,
+ MmsCodeTimeType,
+ MmsCodeMsgClass,
+ MmsCodePriority,
+ MmsCodeResponseStatus,
+ MmsCodeRetrieveStatus,
+ MmsCodeReadReply,
+ MmsCodeReportAllowed,
+ MmsCodeSenderVisibility,
+ MmsCodeMsgStatus,
+ MmsCodeReadStatus,
+ MmsCodeAddressType,
+ MmsCodeCharSet,
+ MmsCodeReplyCharging,
+
+ MmsCodeContentType,
+
+ MmsCodeMsgDisposition,
+ MmsCodeContentTransferEncoding
+} MmsCode;
+
+typedef enum {
+ MMS_DATATYPE_NONE = -1,
+ MMS_DATATYPE_READ = 0,
+ MMS_DATATYPE_SENT = 1,
+ MMS_DATATYPE_NOTIFY = 2,
+ MMS_DATATYPE_UNSENT = 3,
+ MMS_DATATYPE_DRAFT = 4,
+ MMS_DATATYPE_SENDING = 6,
+ MMS_DATATYPE_RETRIEVING = 7,
+ MMS_DATATYPE_UNRETV = 8,
+ MMS_DATATYPE_TEMPLATE = 9,
+ MMS_DATATYPE_DRM_RO_WAITING = 10 // DRM RO WAITING
+} MmsDataType;
+
+typedef enum {
+ MMS_MSGTYPE_ERROR = -1, // error return in Get method
+ MMS_MSGTYPE_SEND_REQ = 0, // default
+ MMS_MSGTYPE_SEND_CONF = 1,
+ MMS_MSGTYPE_NOTIFICATION_IND = 2,
+ MMS_MSGTYPE_NOTIFYRESP_IND = 3,
+ MMS_MSGTYPE_RETRIEVE_CONF = 4,
+ MMS_MSGTYPE_ACKNOWLEDGE_IND = 5,
+ MMS_MSGTYPE_DELIVERY_IND = 6,
+ MMS_MSGTYPE_READREC_IND = 7,
+ MMS_MSGTYPE_READORG_IND = 8,
+ MMS_MSGTYPE_FORWARD_REQ = 9,
+ MMS_MSGTYPE_FORWARD_CONF = 10,
+ MMS_MSGTYPE_READ_REPLY = 11, // for internal use
+ MMS_MSGTYPE_MAX
+} MmsMsgType;
+
+typedef enum {
+ MMS_PRIORITY_ERROR = -1, // error return in Get method
+ MMS_PRIORITY_LOW = 0, // default
+ MMS_PRIORITY_NORMAL = 1,
+ MMS_PRIORITY_HIGH = 2
+} MmsPriority;
+
+typedef enum {
+ MMS_SENDER_VISIBLE_ERROR = -1, // error return in Get method
+ MMS_SENDER_SHOW = 0,
+ MMS_SENDER_HIDE = 1
+} MmsSenderVisible;
+
+typedef enum {
+ MMS_REPORT_ERROR = -1, // error return in Get method
+ MMS_REPORT_YES = 0,
+ MMS_REPORT_NO = 1
+} MmsReport;
+
+typedef enum {
+ MMS_REPORTALLOWED_ERROR = -1, // error return in Get method
+ MMS_REPORTALLOWED_YES = 0,
+ MMS_REPORTALLOWED_NO = 1
+} MmsReportAllowed;
+
+typedef enum {
+ MMS_RECEIVE_READ_REPORT_ALLOWED,
+ MMS_RECEIVE_READ_REPORT_PROMPT,
+ MMS_RECEIVE_READ_REPORT_NOT_ALLOWED,
+} MmsRecvReadReportType ;
+
+typedef enum {
+ MMS_MSGSTATUS_NONE = -1, // backward compatibility
+ MMS_MSGSTATUS_ERROR = -1, // error return in Get method
+ MMS_MSGSTATUS_EXPIRED = 0, // This value SHOULD not be used in the M-NotifyResp.ind PDU.
+ MMS_MSGSTATUS_RETRIEVED = 1,
+ MMS_MSGSTATUS_REJECTED = 2,
+ MMS_MSGSTATUS_DEFERRED = 3,
+ MMS_MSGSTATUS_UNRECOGNISED = 4, // This value SHALL not be used in the M-Delivery.ind PDU.
+ MMS_MSGSTATUS_INDETERMINATE = 5,
+ MMS_MSGSTATUS_FORWARDED = 6,
+ MMS_MSGSTATUS_UNREACHABLE = 7
+} MmsMsgStatus;
+
+typedef enum {
+ MMS_READSTATUS_NONE = -1, // no touch status
+ MMS_IS_READ = 0,
+ MMS_IS_DELETED = 1 // Deleted without being read
+} MmsReadStatus;
+
+typedef enum {
+ MMS_ADDRESS_PRESENT_TOKEN,
+ MMS_INSERT_ADDRESS_TOKEN
+} MmsAddressType;
+
+typedef enum {
+ MSG_PARAM_REPORT_TYPE_DELIVERY_STATUS,
+ MSG_PARAM_REPORT_TYPE_NUM,
+ MSG_PARAM_REPORT_TYPE_UNKNOWN,
+} MsgParamReportType;
+
+/* Response status */
+typedef enum {
+ MMS_RESPSTATUS_ERROR = -1, // error return in Get method
+ MMS_RESPSTATUS_OK = 0, // default value
+ MMS_RESPSTAUTS_ERROR_UNSPECIFIED = 1,
+ MMS_RESPSTAUTS_ERROR_SERVICEDENIED = 2,
+ MMS_RESPSTAUTS_ERROR_MESSAGEFORMATCORRUPT = 3,
+ MMS_RESPSTAUTS_ERROR_SENDINGADDRESSUNRESOLVED = 4,
+ MMS_RESPSTAUTS_ERROR_MESSAGENOTFOUND = 5,
+ MMS_RESPSTAUTS_ERROR_NETWORKPROBLEM = 6,
+ MMS_RESPSTAUTS_ERROR_CONTENTNOTACCEPTED = 7,
+ MMS_RESPSTAUTS_ERROR_UNSUPPORTEDMESSAGE = 8,
+
+ MMS_RESPSTAUTS_ERROR_TRANSIENT_FAILURE = 9,
+ MMS_RESPSTAUTS_ERROR_TRANSIENT_SENDING_ADDRESS_UNRESOLVED = 10,
+ MMS_RESPSTAUTS_ERROR_TRANSIENT_MESSAGE_NOT_FOUND = 11,
+ MMS_RESPSTAUTS_ERROR_TRANSIENT_NETWORK_PROBLEM = 12,
+
+ MMS_RESPSTAUTS_ERROR_PERMANENT_FAILURE = 13,
+ MMS_RESPSTAUTS_ERROR_PERMANENT_SERVICE_DENIED = 14,
+ MMS_RESPSTAUTS_ERROR_PERMANENT_MESSAGE_FORMAT_CORRUPT = 15,
+ MMS_RESPSTAUTS_ERROR_PERMANENT_SENDING_ADDRESS_UNRESOLVED = 16,
+ MMS_RESPSTAUTS_ERROR_PERMANENT_MESSAGE_NOT_FOUND = 17,
+ MMS_RESPSTAUTS_ERROR_PERMANENT_CONTENT_NOT_ACCEPTED = 18,
+ MMS_RESPSTAUTS_ERROR_PERMANENT_REPLY_CHARGING_LIMITATIONS_NOT_MET = 19,
+ MMS_RESPSTAUTS_ERROR_PERMANENT_REPLY_CHARGING_REQUEST_NOT_ACCEPTED = 20,
+ MMS_RESPSTAUTS_ERROR_PERMANENT_REPLY_CHARGING_FORWARDING_DENIED = 21,
+ MMS_RESPSTAUTS_ERROR_PERMANENT_REPLY_CHARGING_NOT_SUPPORTED = 22
+} MmsResponseStatus;
+
+typedef enum {
+ MMS_RETRSTATUS_ERROR = -1, // error return in Get method
+ MMS_RETRSTATUS_OK = 0,
+ MMS_RETRSTATUS_TRANSIENT_FAILURE = 1,
+ MMS_RETRSTATUS_TRANSIENT_MESSAGE_NOT_FOUND = 2,
+ MMS_RETRSTATUS_TRANSIENT_NETWORK_PROBLEM = 3,
+ MMS_RETRSTATUS_PERMANENT_FAILURE = 4,
+ MMS_RETRSTATUS_PERMANENT_SERVICE_DENIED = 5,
+ MMS_RETRSTATUS_PERMANENT_MESSAGE_NOT_FOUND = 6,
+ MMS_RETRSTATUS_PERMANENT_CONTENT_UNSUPPORT = 7
+} MmsRetrieveStatus;
+
+typedef enum {
+ MMS_REPLY_NONE = -1, // error return in Get method
+ MMS_REPLY_REQUESTED = 0,
+ MMS_REPLY_REQUESTED_TEXT_ONLY = 1,
+ MMS_REPLY_ACCEPTED = 2,
+ MMS_REPLY_ACCEPTED_TEXT_ONLY = 3
+} MmsReplyChargeType;
+
+typedef enum {
+ MMS_STATUS_ERROR = -1, // error return in Get method
+ MMS_STATUS_INITIAL = 0,
+ MMS_STATUS_REQUESTING = 1,
+ MMS_STATUS_SUCCESS = 2,
+ MMS_STATUS_FAIL = 3,
+ MMS_STATUS_NUM = 4,
+} MmsDataStatus;
+
+typedef enum {
+ MMS_EDIT_STYLE_THIS_PAGE = 0,
+ MMS_EDIT_STYLE_ALL_PAGE,
+} MmsEditStyleMode;
+
+typedef enum {
+ MMS_SPECIAL_MSG_TYPE_NONE = 0,
+ MMS_SPECIAL_MSG_TYPE_SYSTEM_TEMPLATE, // system template .
+ MMS_SPECIAL_MSG_TYPE_VOICE_MESSAGE, //voice message service
+
+ MMS_SPECIAL_MSG_TYPE_VDF_POSTCARD, //postcard service, or Generic Postcard Service
+ MMS_SPECIAL_MSG_TYPE_POSTCARD_EXT1, //Stickers Service
+ MMS_SPECIAL_MSG_TYPE_POSTCARD_EXT2, //Photo 10x15
+ MMS_SPECIAL_MSG_TYPE_POSTCARD_EXT3, //8 Photos
+ MMS_SPECIAL_MSG_TYPE_POSTCARD_EXT4, // 4 Photos
+} MmsSpecialMsgType;
+
+typedef enum {
+ MMS_MM_CLASS_TEXT,
+ MMS_MM_CLASS_IMAGE_BASIC,
+ MMS_MM_CLASS_IMAGE_RICH,
+ MMS_MM_CLASS_VIDEO_BASIC,
+ MMS_MM_CLASS_VIDEO_RICH,
+ MMS_MM_CLASS_MEGAPIXEL,
+ MMS_MM_CLASS_CONTENT_BASIC,
+ MMS_MM_CLASS_CONTENT_RICH,
+ MMS_MM_CLASS_OTHER
+} MmsUiMmClass;
+
+typedef enum {
+ MMS_MSGCLASS_ERROR = -1, // error return in Get method
+ MMS_MSGCLASS_PERSONAL = 0, // default
+ MMS_MSGCLASS_ADVERTISEMENT = 1,
+ MMS_MSGCLASS_INFORMATIONAL = 2,
+ MMS_MSGCLASS_AUTO = 3
+} MmsMsgClass;
+
+
+/*==================================================================================================
+ Structures
+==================================================================================================*/
+
+typedef struct {
+ MmsReplyChargeType chargeType;
+ MmsTimeStruct deadLine;
+ int chargeSize;
+ char szChargeID[MMS_MSG_ID_LEN + 1];
+} MmsReplyCharge;
+
+typedef struct _MmsMsgMultiStatus {
+ char szTo[MAX_ADDRESS_VAL_LEN + 1];
+ bool bDeliveryReportIsRead;
+ bool bDeliveyrReportIsLast;
+ msg_delivery_report_status_t msgStatus;
+ UINT32 handledTime;
+ bool bReadReplyIsRead;
+ bool bReadReplyIsLast;
+ msg_read_report_status_t readStatus;
+ UINT32 readTime;
+
+ struct _MmsMsgMultiStatus *pNext;
+} MmsMsgMultiStatus;
+
+typedef struct _MMS_ATTRIB_S {
+ MimeType contentType;
+ MmsDataType dataType;
+ UINT32 date;
+ UINT8 version;
+
+ char szFrom[MSG_LOCALE_ADDR_LEN + 11]; //"/TYPE=PLMN", /"TYPE=IPv4", "/TYPE=IPv6"
+ char szSubject[MSG_LOCALE_SUBJ_LEN + 1];
+ char *szTo;
+ char *szCc;
+ char *szBcc;
+
+ MmsPriority priority;
+
+ MmsReplyCharge replyCharge;
+ bool bChargingMsgReplied;
+
+ bool bHideAddress;
+ bool bAskDeliveryReport;
+ bool bReportAllowed;
+ MmsRecvReadReportType readReportAllowedType;
+
+ bool bAskReadReply;
+ bool bRead;
+
+ MmsRecvReadReportSendStatus readReportSendStatus;
+
+ bool bReadReportSent;
+
+ bool bLeaveCopy;
+ bool bUseExpiryCustomTime; // for expiry custom time
+ bool bUseDeliveryCustomTime; // for expiry custom time
+ MmsEditStyleMode editStyleMode; //editStyle on All Page
+
+ MmsSpecialMsgType specialMsgType; // instead of bPostcard
+
+#ifdef __SUPPORT_DRM__
+ MsgDrmType drmType;
+ int roWaitingTimerMax; // DRM RO WAITING
+ char *pszDrmData; // DRM Data to draw mailbox icon
+#endif
+
+ int msgSize;
+ MmsMsgClass msgClass;
+ MmsTimeStruct expiryTime;
+ MmsTimeStruct expiryCustomTime;
+ MmsTimeStruct deliveryTime;
+ MmsTimeStruct deliveryCustomTime;
+
+ //for ReadMsg, When Sending notifyResp.ind
+ msg_delivery_report_status_t msgStatus;
+
+ MmsResponseStatus responseStatus;
+ MmsRetrieveStatus retrieveStatus;
+ char szResponseText[MMS_LOCALE_RESP_TEXT_LEN + 1];
+ char szRetrieveText[MMS_LOCALE_RESP_TEXT_LEN + 1];
+
+ MmsMsgMultiStatus *pMultiStatus;
+ bool bRetrieveNow;
+} MmsAttrib;
+
+typedef struct _MsgContentParam {
+ int charset;
+ char szBoundary[MSG_BOUNDARY_LEN + 1];
+ char szFileName[MSG_FILENAME_LEN_MAX + 1];
+ char szName[MSG_LOCALE_FILENAME_LEN_MAX + 1];
+
+#ifdef FEATURE_JAVA_MMS
+ char *szApplicationID;
+ char *szReplyToApplicationID;
+#endif
+
+ int type;
+ void *pPresentation;
+ char szStart[MSG_MSG_ID_LEN + 1];
+ char szStartInfo[MSG_MSG_ID_LEN + 1];
+
+ MsgParamReportType reportType; //only used as parameter of Content-Type: multipart/report; report-type=delivery-status;
+} MsgContentParam;
+
+#ifdef __SUPPORT_DRM__
+typedef struct _MsgDRMInfo {
+ MsgDrmType drmType;
+ MimeType contentType;
+ char *szContentURI;
+ char *szContentName;
+ char *szContentDescription;
+ char *szContentVendor;
+ char *szRightIssuer;
+ char *szDrm2FullPath;
+ int roWaitingTimerMax; // DRM RO WAITING
+ bool bFwdLock;
+ char *pszContentType;
+ bool bNoRingTone;
+ bool bNoScreen;
+} MsgDRMInfo;
+#endif
+
+typedef struct _MsgType {
+ int offset;
+ int size;
+ int contentSize;
+ int section;
+ int type;
+#ifdef __SUPPORT_DRM__
+ MsgDRMInfo drmInfo;
+#endif
+ int encoding;
+ int disposition;
+ char szContentID[MSG_MSG_ID_LEN + 1];
+ char szContentLocation[MSG_MSG_ID_LEN + 1];
+ char szOrgFilePath[MSG_FILEPATH_LEN_MAX];
+
+ char szContentRepPos[30];
+ char szContentRepSize[30];
+ char szContentRepIndex[8];
+#ifdef __SUPPORT_DRM__
+ int nDrmConvertedStatus;
+#endif
+
+ MsgContentParam param;
+} MsgType;
+
+struct _MsgAddress {
+ int type; //MSG_ADDR_TYPE_PHONE/EMAIL/IPV4/IPV6
+ int recipientType; // TO, CC, BCC
+ char szName[MSG_LOCALE_NAME_LEN + 1];
+ char szAddr[MSG_ADDR_LEN + 1];
+ MsgAddress *pNext;
+ bool bDoNotShow; // temporary clip
+
+ // sorting
+ ULONG uLastRecentTime; // last recent time save item
+ ULONG uMostUseCount; // most use count item.
+ int index; // index sorting..
+};
+
+typedef struct _MsgHeader {
+ MsgAddress *pFrom;
+ MsgAddress *pTo;
+ MsgAddress *pCC;
+ char szReturnPath[MSG_ADDR_LEN + 1];
+ char szDate[MSG_DATE_LEN];
+ char szSubject[MSG_LOCALE_SUBJ_LEN + 1];
+ char szMsgID[MSG_MSG_ID_LEN + 1];
+} MsgHeader;
+
+struct _MsgBody {
+ int offset;
+ int size;
+ char szOrgFilePath[MSG_FILEPATH_LEN_MAX];
+ MsgType presentationType;
+ MsgBody *pPresentationBody;
+
+ union {
+ char *pText;
+ void *pBinary;
+ MsgMultipart *pMultipart;
+ MsgMessage *pMessage;
+ } body;
+};
+
+struct _MsgMultipart {
+ MsgType type;
+ MsgBody *pBody;
+ MsgMultipart *pNext;
+};
+
+struct _MsgMessage {
+ MsgHeader header;
+ MsgType type;
+ MsgBody *pBody;
+};
+
+typedef struct _MMS_MESSAGE_S {
+ MmsAttrib mmsAttrib;
+ msg_message_id_t msgID;
+ int mailbox; // mailbox type,MMS_MAILBOX_XXX
+ char szFileName[MSG_FILENAME_LEN_MAX];
+ char szTrID[MMS_TR_ID_LEN + 1];
+ char szMsgID[MMS_MSG_ID_LEN + 1];
+ char szForwardMsgID[MMS_MSG_ID_LEN + 1];
+ char szContentLocation[MMS_LOCATION_LEN + 1];
+ int nPartCount;
+ MsgType msgType;
+ MsgBody msgBody;
+} MmsMsg;
+
+#endif
+++ /dev/null
-/*
-* Copyright 2012 Samsung Electronics Co., Ltd
-*
-* Licensed under the Flora License, Version 1.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.tizenopensource.org/license
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-#define MMS_INVALID_MSG_ID -1
-
-/* Mailbox type */
-#define MSG_UI_MAILBOX_MY_FOLDER_MAX 10
-
-typedef enum {
- MSG_MAILBOX_ROOT = -1,
- MSG_MAILBOX_WRITE = 0,
- MSG_MAILBOX_INBOX = 1,
- MSG_MAILBOX_DRAFT = 2,
- MSG_MAILBOX_SENT = 3,
- MSG_MAILBOX_MAILBOX = 4,
-#ifdef _MSG_DB_INCLUDE_OUTBOX
- MSG_MAILBOX_OUTBOX = 5,
-#endif
- MSG_MAILBOX_TEMPLATE = 6, //NEW_TEMPLATE
- MSG_MAILBOX_MYFOLDER = 7,
- MSG_MAILBOX_MYFOLDER_LIST = 8,
-
-
- MSG_MAILBOX_PRESET = (MSG_MAILBOX_MYFOLDER_LIST + MSG_UI_MAILBOX_MY_FOLDER_MAX),
-
- MSG_MAILBOX_NONE
-
-} MsgMailboxType;
-
--- /dev/null
+/*
+* Copyright 2012 Samsung Electronics Co., Ltd
+*
+* Licensed under the Flora License, Version 1.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.tizenopensource.org/license
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+#ifndef MMS_PLUGIN_DECODE_H
+#define MMS_PLUGIN_DECODE_H
+
+#include "MmsPluginMessage.h"
+
+typedef struct _MsgHeaderAddress MsgHeaderAddress;
+
+typedef int MmsMsgID;
+
+/*==================================================================================================
+ Structures
+==================================================================================================*/
+typedef enum {
+ MSG_PRESENTATION_NONE = -1,
+ MSG_PRESENTATION_FIRSTPART, //Content-type == type parameter
+ MSG_PRESENTATION_TYPE_BASE, //Content-type == type parameter
+ MSG_PRESENTATION_LOCATION, //Content-Location == start parameter
+ MSG_PRESENTATION_ID, //Content-ID == start parameter
+} MsgPresentationFactor;
+
+typedef struct {
+ char *pData;
+ UINT32 length;
+} EncodedPData;
+
+typedef struct {
+ MsgPresentationFactor factor;
+ MsgMultipart *pPrevPart;
+ MsgMultipart *pCurPresentation;
+} MsgPresentaionInfo;
+
+struct _MsgHeaderAddress {
+ char *szAddr;
+ MsgHeaderAddress *pNext;
+};
+
+// for Decoding & Encoding
+typedef struct {
+ bool bActive;
+ char *pszOwner;
+ int msgID; // if noti.ind, msgID is -1.
+
+ MmsMsgType type;
+ char szTrID[MMS_TR_ID_LEN+1];
+ UINT8 version;
+ UINT32 date;
+
+ MsgHeaderAddress *pFrom; //"/TYPE=PLMN", /"TYPE=IPv4", "/TYPE=IPv6"
+ MsgHeaderAddress *pTo;
+ MsgHeaderAddress *pCc;
+ MsgHeaderAddress *pBcc;
+ char szSubject[MSG_LOCALE_SUBJ_LEN + 1];
+ MmsResponseStatus responseStatus;
+ MmsRetrieveStatus retrieveStatus;
+ char szResponseText[MMS_LOCALE_RESP_TEXT_LEN + 1];
+ char szRetrieveText[MMS_LOCALE_RESP_TEXT_LEN + 1];
+
+ MmsMsgClass msgClass;
+ MmsTimeStruct expiryTime;
+ MmsTimeStruct deliveryTime;
+ MmsPriority priority;
+ MmsSenderVisible hideAddress;
+ MmsReport deliveryReport;
+ MmsReport readReply;
+ MmsReportAllowed reportAllowed;
+ char szContentLocation[MMS_LOCATION_LEN + 1];
+
+ msg_delivery_report_status_t msgStatus;
+ msg_read_report_status_t readStatus;
+
+ MmsReplyCharge replyCharge;
+
+ // only used at Decoding module
+ char szMsgID[MMS_MSG_ID_LEN + 1];
+ UINT32 msgSize;
+
+#ifdef __SUPPORT_DRM__
+ MsgDrmType drmType;
+#endif
+
+ // dependent to Client implementation
+ MsgType msgType;
+ MsgBody msgBody;
+} MmsHeader;
+
+extern MmsHeader mmsHeader;
+
+/* Decoding */
+void MmsInitHeader();
+void MmsRegisterDecodeBuffer();
+void MmsUnregisterDecodeBuffer(void);
+bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength);
+bool MmsBinaryDecodeMsgBody(FILE *pFile, char *szFilePath, int totalLength);
+bool MmsReadMsgBody(msg_message_id_t msgID, bool bSavePartsAsTempFiles, bool bRetrieved, char *retrievedPath);
+
+bool MsgFreeBody(MsgBody *pBody, int type);
+bool MsgFreeAttrib(MmsAttrib *pAttrib);
+
+char *MsgChangeHexString(char *pOrg);
+char *MsgResolveContentURI(char *szSrc);
+char *MsgRemoveQuoteFromFilename(char *pSrc);
+bool MsgIsMultipart(int type);
+bool MmsAddrUtilCompareAddr(char *pszAddr1, char *pszAddr2);
+bool MmsDataUpdateLastStatus(MmsMsg *pMsg);
+bool MmsAddrUtilRemovePlmnString(char *pszAddr);
+bool MsgGetTypeByFileName(int *type, char *szFileName);
+bool MsgGetFileNameWithoutExtension(char *szOutputName, char *szName);
+int MmsGetMediaPartCount(msg_message_id_t msgId);
+bool MmsGetMediaPartHeader(int index, MsgType *pHeader);
+bool MmsGetMsgAttrib(MmsMsgID msgID, MmsAttrib *pAttrib);
+
+#ifdef __SUPPORT_DRM__
+void MsgFreeDRMInfo(MsgDRMInfo *pDrmInfo);
+bool MsgCopyDrmInfo(MsgType *pPartType);
+bool MmsDrm2ConvertMsgBody(char *szOriginFilePath);
+bool MmsDrm2ReadMsgConvertedBody(MSG_MESSAGE_INFO_S *pMsg, bool bSavePartsAsTempFiles, bool bRetrieved, char *retrievedPath);
+#endif
+
+#endif
--- /dev/null
+/*
+* Copyright 2012 Samsung Electronics Co., Ltd
+*
+* Licensed under the Flora License, Version 1.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.tizenopensource.org/license
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+#ifndef MMS_PLUGIN_ENCODE_H
+#define MMS_PLUGIN_ENCODE_H
+
+#include "MmsPluginCodecTypes.h"
+#include "MmsPluginCodecCommon.h"
+#include "MmsPluginMessage.h"
+
+/* Encoding */
+void MmsRegisterEncodeBuffer(char *pInBuff, int maxLen);
+void MmsUnregisterEncodeBuffer(void);
+
+bool MmsEncodeSendReq(FILE *pFile, MmsMsg *pMsg);
+bool MmsEncodeTemplate(FILE *pFile, MmsMsg *pMsg);
+bool MmsEncodeAckInd(FILE *pFile, char *szTrID, bool bReportAllowed);
+bool MmsEncodeNotiRespInd(FILE *pFile, char *szTrID, msg_delivery_report_status_t iStatus, bool bReportAllowed);
+
+bool MmsEncodeReadReport10(FILE *pFile, MmsMsg *pMsg, msg_read_report_status_t mmsReadStatus);
+bool MmsEncodeReadReport11(FILE *pFile, MmsMsg *pMsg, msg_read_report_status_t mmsReadStatus);
+
+#endif
#include "MsgMmsTypes.h"
#include "MsgSettingTypes.h"
#include "MmsPluginMIME.h"
-#include "MsgMmsTypes.h"
-
+#include "MmsPluginCodec.h"
/*==================================================================================================
DEFINES
==================================================================================================*/
-#define MMS_CONTENT_ID_LEN 100
-#define MMS_LOCALE_RESP_TEXT_LEN 90
#define MMS_TEXT_LEN 2000
#define MMS_READ_REPORT_STRING_READ "Read:"
#define MMS_READ_REPORT_STRING_DELETED "Deleted:"
#define MSG_ATTACH_MAX 20
-#define MSG_LINE_LEN 1024
-#define MSG_SUBJ_LEN 40
-#define MSG_DATE_LEN 50
-#define MSG_BOUNDARY_LEN 70
-#define MSG_LOCALE_NAME_LEN 150
-#define MSG_LOCALE_SUBJ_LEN (3 * MSG_SUBJ_LEN)
-#define MSG_ADDR_LEN MAX_ADDRESS_VAL_LEN
-#define MSG_LOCALE_ADDR_LEN (3 * MAX_ADDRESS_VAL_LEN)
-#define MSG_LOCALE_FILENAME_LEN_MAX (3 * 255)
-#define MSG_LOCALE_SIGN_LEN (3 * MAX_SIGN_VAL_LEN)
-#define MSG_MAILBOX_NAME_LEN 10
-
-#define MsgContentType MimeType
-#define MsgRecipientType msg_recipient_type_t
-#define MMS_VERSION 0x92
#define MSG_STR_ADDR_DELIMETER ";"
#define MSG_CH_ADDR_DELIMETER ';'
-#ifdef __SUPPORT_DRM__
-#define MSG_DRM_MAX_CMD (2 * 1024)
-#endif
-
-#define MSG_MMS_DECODE_BUFFER_MAX (2 * 1024)
-#define MSG_MMS_ENCODE_BUFFER_MAX (2 * 1024)
-
-/*==================================================================================================
- TYPES
-==================================================================================================*/
-typedef unsigned int UINT;
-typedef unsigned long int UINT32;
-typedef unsigned char UINT8;
-typedef unsigned short int UINT16;
-typedef unsigned long ULONG;
-typedef unsigned char UCHAR;
-typedef unsigned short MCHAR;
-typedef unsigned short USHORT;
-
-typedef int MmsMsgID;
-
-typedef struct _MsgAddress MsgAddress;
-typedef struct _MsgBody MsgBody;
-typedef struct _MsgMultipart MsgMultipart;
-typedef struct _MsgMessage MsgMessage;
-
-typedef struct _MsgHeaderAddress MsgHeaderAddress;
-
-/*==================================================================================================
- ENUMS
-==================================================================================================*/
-
-typedef enum {
- MMS_DATATYPE_NONE = -1,
- MMS_DATATYPE_READ = 0,
- MMS_DATATYPE_SENT = 1,
- MMS_DATATYPE_NOTIFY = 2,
- MMS_DATATYPE_UNSENT = 3,
- MMS_DATATYPE_DRAFT = 4,
- MMS_DATATYPE_SENDING = 6,
- MMS_DATATYPE_RETRIEVING = 7,
- MMS_DATATYPE_UNRETV = 8,
- MMS_DATATYPE_TEMPLATE = 9,
- MMS_DATATYPE_DRM_RO_WAITING = 10 // DRM RO WAITING
-
-} MmsDataType;
-
-typedef enum {
- MMS_MSGTYPE_ERROR = -1, // error return in Get method
- MMS_MSGTYPE_SEND_REQ = 0, // default
- MMS_MSGTYPE_SEND_CONF = 1,
- MMS_MSGTYPE_NOTIFICATION_IND = 2,
- MMS_MSGTYPE_NOTIFYRESP_IND = 3,
- MMS_MSGTYPE_RETRIEVE_CONF = 4,
- MMS_MSGTYPE_ACKNOWLEDGE_IND = 5,
- MMS_MSGTYPE_DELIVERY_IND = 6,
- MMS_MSGTYPE_READREC_IND = 7,
- MMS_MSGTYPE_READORG_IND = 8,
- MMS_MSGTYPE_FORWARD_REQ = 9,
- MMS_MSGTYPE_FORWARD_CONF = 10,
- MMS_MSGTYPE_READ_REPLY = 11, // for internal use
-
- MMS_MSGTYPE_MAX
-} MmsMsgType;
-
-typedef enum {
- MMS_PRIORITY_ERROR = -1, // error return in Get method
- MMS_PRIORITY_LOW = 0, // default
- MMS_PRIORITY_NORMAL = 1,
- MMS_PRIORITY_HIGH = 2
-} MmsPriority;
-
-
-typedef enum {
- MMS_SENDER_VISIBLE_ERROR = -1, // error return in Get method
- MMS_SENDER_SHOW = 0,
- MMS_SENDER_HIDE = 1
-} MmsSenderVisible;
-
-
-typedef enum {
- MMS_REPORT_ERROR = -1, // error return in Get method
- MMS_REPORT_YES = 0,
- MMS_REPORT_NO = 1
-} MmsReport;
-
-
-typedef enum {
- MMS_REPORTALLOWED_ERROR = -1, // error return in Get method
- MMS_REPORTALLOWED_YES = 0,
- MMS_REPORTALLOWED_NO = 1
-} MmsReportAllowed;
-
-
-typedef enum {
- MMS_RECEIVE_READ_REPORT_ALLOWED,
- MMS_RECEIVE_READ_REPORT_PROMPT,
- MMS_RECEIVE_READ_REPORT_NOT_ALLOWED,
-} MmsRecvReadReportType ;
-
-
-typedef enum {
- MMS_MSGSTATUS_NONE = -1, // backward compatibility
- MMS_MSGSTATUS_ERROR = -1, // error return in Get method
- MMS_MSGSTATUS_EXPIRED = 0, // This value SHOULD not be used in the M-NotifyResp.ind PDU.
- MMS_MSGSTATUS_RETRIEVED = 1,
- MMS_MSGSTATUS_REJECTED = 2,
- MMS_MSGSTATUS_DEFERRED = 3,
- MMS_MSGSTATUS_UNRECOGNISED = 4, // This value SHALL not be used in the M-Delivery.ind PDU.
- MMS_MSGSTATUS_INDETERMINATE = 5,
- MMS_MSGSTATUS_FORWARDED = 6,
- MMS_MSGSTATUS_UNREACHABLE = 7
-} MmsMsgStatus;
-
-
-typedef enum {
- MMS_READSTATUS_NONE = -1, // no touch status
- MMS_IS_READ = 0,
- MMS_IS_DELETED = 1 // Deleted without being read
-} MmsReadStatus;
-
-
-typedef enum {
- MMS_ADDRESS_PRESENT_TOKEN,
- MMS_INSERT_ADDRESS_TOKEN
-} MmsAddressType;
-
-typedef enum {
- MSG_PARAM_REPORT_TYPE_DELIVERY_STATUS,
- MSG_PARAM_REPORT_TYPE_NUM,
- MSG_PARAM_REPORT_TYPE_UNKNOWN,
-} MsgParamReportType;
-
-/* Response status */
-typedef enum {
- MMS_RESPSTATUS_ERROR = -1, // error return in Get method
- MMS_RESPSTATUS_OK = 0, // default value
- MMS_RESPSTAUTS_ERROR_UNSPECIFIED = 1,
- MMS_RESPSTAUTS_ERROR_SERVICEDENIED = 2,
- MMS_RESPSTAUTS_ERROR_MESSAGEFORMATCORRUPT = 3,
- MMS_RESPSTAUTS_ERROR_SENDINGADDRESSUNRESOLVED = 4,
- MMS_RESPSTAUTS_ERROR_MESSAGENOTFOUND = 5,
- MMS_RESPSTAUTS_ERROR_NETWORKPROBLEM = 6,
- MMS_RESPSTAUTS_ERROR_CONTENTNOTACCEPTED = 7,
- MMS_RESPSTAUTS_ERROR_UNSUPPORTEDMESSAGE = 8,
-
- MMS_RESPSTAUTS_ERROR_TRANSIENT_FAILURE = 9,
- MMS_RESPSTAUTS_ERROR_TRANSIENT_SENDING_ADDRESS_UNRESOLVED = 10,
- MMS_RESPSTAUTS_ERROR_TRANSIENT_MESSAGE_NOT_FOUND = 11,
- MMS_RESPSTAUTS_ERROR_TRANSIENT_NETWORK_PROBLEM = 12,
-
- MMS_RESPSTAUTS_ERROR_PERMANENT_FAILURE = 13,
- MMS_RESPSTAUTS_ERROR_PERMANENT_SERVICE_DENIED = 14,
- MMS_RESPSTAUTS_ERROR_PERMANENT_MESSAGE_FORMAT_CORRUPT = 15,
- MMS_RESPSTAUTS_ERROR_PERMANENT_SENDING_ADDRESS_UNRESOLVED = 16,
- MMS_RESPSTAUTS_ERROR_PERMANENT_MESSAGE_NOT_FOUND = 17,
- MMS_RESPSTAUTS_ERROR_PERMANENT_CONTENT_NOT_ACCEPTED = 18,
- MMS_RESPSTAUTS_ERROR_PERMANENT_REPLY_CHARGING_LIMITATIONS_NOT_MET = 19,
- MMS_RESPSTAUTS_ERROR_PERMANENT_REPLY_CHARGING_REQUEST_NOT_ACCEPTED = 20,
- MMS_RESPSTAUTS_ERROR_PERMANENT_REPLY_CHARGING_FORWARDING_DENIED = 21,
- MMS_RESPSTAUTS_ERROR_PERMANENT_REPLY_CHARGING_NOT_SUPPORTED = 22
-} MmsResponseStatus;
-
-
-typedef enum {
- MMS_RETRSTATUS_ERROR = -1, // error return in Get method
- MMS_RETRSTATUS_OK = 0,
- MMS_RETRSTATUS_TRANSIENT_FAILURE = 1,
- MMS_RETRSTATUS_TRANSIENT_MESSAGE_NOT_FOUND = 2,
- MMS_RETRSTATUS_TRANSIENT_NETWORK_PROBLEM = 3,
- MMS_RETRSTATUS_PERMANENT_FAILURE = 4,
- MMS_RETRSTATUS_PERMANENT_SERVICE_DENIED = 5,
- MMS_RETRSTATUS_PERMANENT_MESSAGE_NOT_FOUND = 6,
- MMS_RETRSTATUS_PERMANENT_CONTENT_UNSUPPORT = 7
-} MmsRetrieveStatus;
-
-
-typedef enum {
- MMS_REPLY_NONE = -1, // error return in Get method
- MMS_REPLY_REQUESTED = 0,
- MMS_REPLY_REQUESTED_TEXT_ONLY = 1,
- MMS_REPLY_ACCEPTED = 2,
- MMS_REPLY_ACCEPTED_TEXT_ONLY = 3
-} MmsReplyChargeType;
-
-
-typedef enum {
- MMS_STATUS_ERROR = -1, // error return in Get method
- MMS_STATUS_INITIAL = 0,
- MMS_STATUS_REQUESTING = 1,
- MMS_STATUS_SUCCESS = 2,
- MMS_STATUS_FAIL = 3,
- MMS_STATUS_NUM = 4,
-} MmsDataStatus;
-
-
-typedef enum {
- MMS_EDIT_STYLE_THIS_PAGE = 0,
- MMS_EDIT_STYLE_ALL_PAGE,
-} MmsEditStyleMode;
-
-typedef enum {
- MMS_SPECIAL_MSG_TYPE_NONE = 0,
- MMS_SPECIAL_MSG_TYPE_SYSTEM_TEMPLATE, // system template .
- MMS_SPECIAL_MSG_TYPE_VOICE_MESSAGE, //voice message service
-
- MMS_SPECIAL_MSG_TYPE_VDF_POSTCARD, //postcard service, or Generic Postcard Service
- MMS_SPECIAL_MSG_TYPE_POSTCARD_EXT1, //Stickers Service
- MMS_SPECIAL_MSG_TYPE_POSTCARD_EXT2, //Photo 10x15
- MMS_SPECIAL_MSG_TYPE_POSTCARD_EXT3, //8 Photos
- MMS_SPECIAL_MSG_TYPE_POSTCARD_EXT4, // 4 Photos
-} MmsSpecialMsgType;
-
-typedef enum {
- MMS_MM_CLASS_TEXT,
- MMS_MM_CLASS_IMAGE_BASIC,
- MMS_MM_CLASS_IMAGE_RICH,
- MMS_MM_CLASS_VIDEO_BASIC,
- MMS_MM_CLASS_VIDEO_RICH,
- MMS_MM_CLASS_MEGAPIXEL,
- MMS_MM_CLASS_CONTENT_BASIC,
- MMS_MM_CLASS_CONTENT_RICH,
- MMS_MM_CLASS_OTHER
-} MmsUiMmClass;
-
-typedef enum {
- MMS_MSGCLASS_ERROR = -1, // error return in Get method
- MMS_MSGCLASS_PERSONAL = 0, // default
- MMS_MSGCLASS_ADVERTISEMENT = 1,
- MMS_MSGCLASS_INFORMATIONAL = 2,
- MMS_MSGCLASS_AUTO = 3
-} MmsMsgClass;
-
-
-/*==================================================================================================
- Structures
-==================================================================================================*/
-
-typedef struct {
- MmsReplyChargeType chargeType;
- MmsTimeStruct deadLine;
- int chargeSize;
- char szChargeID[MMS_MSG_ID_LEN + 1];
-} MmsReplyCharge;
-
-
-typedef struct _MmsMsgMultiStatus {
- char szTo[MAX_ADDRESS_VAL_LEN + 1];
- bool bDeliveryReportIsRead;
- bool bDeliveyrReportIsLast;
- msg_delivery_report_status_t msgStatus;
- UINT32 handledTime;
-
- bool bReadReplyIsRead;
- bool bReadReplyIsLast;
- msg_read_report_status_t readStatus;
- UINT32 readTime;
-
- struct _MmsMsgMultiStatus *pNext;
-} MmsMsgMultiStatus;
-
-typedef struct _MMS_ATTRIB_S {
- MsgContentType contentType;
- MmsDataType dataType;
- UINT32 date;
- UINT8 version;
-
- char szFrom[MSG_LOCALE_ADDR_LEN + 11]; //"/TYPE=PLMN", /"TYPE=IPv4", "/TYPE=IPv6"
- char szSubject[MSG_LOCALE_SUBJ_LEN + 1];
- char *szTo;
- char *szCc;
- char *szBcc;
-
- MmsPriority priority;
-
- MmsReplyCharge replyCharge;
- bool bChargingMsgReplied;
-
- bool bHideAddress;
- bool bAskDeliveryReport;
- bool bReportAllowed;
- MmsRecvReadReportType readReportAllowedType;
-
- bool bAskReadReply;
- bool bRead;
-
- MmsRecvReadReportSendStatus readReportSendStatus;
-
- bool bReadReportSent;
-
- bool bLeaveCopy;
- bool bUseExpiryCustomTime; // for expiry custom time
- bool bUseDeliveryCustomTime; // for expiry custom time
- MmsEditStyleMode editStyleMode; //editStyle on All Page
-
- MmsSpecialMsgType specialMsgType; // instead of bPostcard
-
-#ifdef __SUPPORT_DRM__
- MsgDrmType drmType;
- int roWaitingTimerMax; // DRM RO WAITING
- char *pszDrmData; // DRM Data to draw mailbox icon
-#endif
-
- int msgSize;
- MmsMsgClass msgClass;
- MmsTimeStruct expiryTime;
- MmsTimeStruct expiryCustomTime;
- MmsTimeStruct deliveryTime;
- MmsTimeStruct deliveryCustomTime;
-
- //for ReadMsg, When Sending notifyResp.ind
- msg_delivery_report_status_t msgStatus;
-
- MmsResponseStatus responseStatus;
- MmsRetrieveStatus retrieveStatus;
- char szResponseText[MMS_LOCALE_RESP_TEXT_LEN + 1];
- char szRetrieveText[MMS_LOCALE_RESP_TEXT_LEN + 1];
-
- MmsMsgMultiStatus *pMultiStatus;
- bool bRetrieveNow;
-} MmsAttrib;
-
-
-typedef struct _MsgContentParam {
- int charset;
- char szBoundary[MSG_BOUNDARY_LEN + 1];
- char szFileName[MSG_FILENAME_LEN_MAX + 1];
- char szName[MSG_LOCALE_FILENAME_LEN_MAX + 1];
-
-#ifdef FEATURE_JAVA_MMS
- char *szApplicationID;
- char *szReplyToApplicationID;
-#endif
-
- int type;
- void *pPresentation;
- char szStart[MSG_MSG_ID_LEN + 1];
- char szStartInfo[MSG_MSG_ID_LEN + 1];
-
- MsgParamReportType reportType; //only used as parameter of Content-Type: multipart/report; report-type=delivery-status;
-} MsgContentParam;
-
-#ifdef __SUPPORT_DRM__
-typedef struct _MsgDRMInfo {
- MsgDrmType drmType;
- MsgContentType contentType;
- char *szContentURI;
- char *szContentName;
- char *szContentDescription;
- char *szContentVendor;
- char *szRightIssuer;
- char *szDrm2FullPath;
- int roWaitingTimerMax; // DRM RO WAITING
- bool bFwdLock;
- char *pszContentType;
- bool bNoRingTone;
- bool bNoScreen;
-} MsgDRMInfo;
-#endif
-
-typedef struct _MsgType {
- int offset;
- int size;
- int contentSize;
- int section;
- int type;
-#ifdef __SUPPORT_DRM__
- MsgDRMInfo drmInfo;
-#endif
- int encoding;
- int disposition;
- char szContentID[MSG_MSG_ID_LEN + 1];
- char szContentLocation[MSG_MSG_ID_LEN + 1];
- char szOrgFilePath[MSG_FILEPATH_LEN_MAX];
-
- char szContentRepPos[30];
- char szContentRepSize[30];
- char szContentRepIndex[8];
-#ifdef __SUPPORT_DRM__
- int nDrmConvertedStatus;
-#endif
-
- MsgContentParam param;
-} MsgType;
-
-struct _MsgAddress {
- int type; //MSG_ADDR_TYPE_PHONE/EMAIL/IPV4/IPV6
- MsgRecipientType recipientType; // TO, CC, BCC
- char szName[MSG_LOCALE_NAME_LEN + 1];
- char szAddr[MSG_ADDR_LEN + 1];
- MsgAddress *pNext;
- bool bDoNotShow; // temporary clip
-
- // sorting
- ULONG uLastRecentTime; // last recent time save item
- ULONG uMostUseCount; // most use count item.
- int index; // index sorting..
-};
-
-typedef struct _MsgHeader {
- MsgAddress *pFrom;
- MsgAddress *pTo;
- MsgAddress *pCC;
- char szReturnPath[MSG_ADDR_LEN + 1];
- char szDate[MSG_DATE_LEN];
- char szSubject[MSG_LOCALE_SUBJ_LEN + 1];
- char szMsgID[MSG_MSG_ID_LEN + 1];
-} MsgHeader;
-
-
-struct _MsgBody {
- int offset;
- int size;
- char szOrgFilePath[MSG_FILEPATH_LEN_MAX];
- MsgType presentationType;
- MsgBody *pPresentationBody;
-
- union {
- char *pText;
- void *pBinary;
- MsgMultipart *pMultipart;
- MsgMessage *pMessage;
- } body;
-};
-
-struct _MsgMultipart {
- MsgType type;
- MsgBody *pBody;
- MsgMultipart *pNext;
-};
-
-struct _MsgMessage {
- MsgHeader header;
- MsgType type;
- MsgBody *pBody;
-};
-
-
-typedef struct _MMS_MESSAGE_S {
- MmsAttrib mmsAttrib;
- msg_message_id_t msgID;
- int mailbox; // mailbox type,MMS_MAILBOX_XXX
- char szFileName[MSG_FILENAME_LEN_MAX];
- char szTrID[MMS_TR_ID_LEN + 1];
- char szMsgID[MMS_MSG_ID_LEN + 1];
- char szForwardMsgID[MMS_MSG_ID_LEN + 1];
- char szContentLocation[MMS_LOCATION_LEN + 1];
- int nPartCount;
- MsgType msgType;
- MsgBody msgBody;
-} MmsMsg;
-
-struct _MsgHeaderAddress {
- char *szAddr;
- MsgHeaderAddress *pNext;
-};
-
bool MmsInitMsgType(MsgType *pMsgType);
bool MmsInitMsgBody(MsgBody *pMsgBody);
char *MmsComposeAddress(const MSG_MESSAGE_INFO_S *pMsgInfo, int recipientType);
bool MmsGetMsgBodyfromMsgInfo(const MSG_MESSAGE_INFO_S *pMsgInfo, MMS_MESSAGE_DATA_S *pMsgBody, char *pFileData);
bool MmsGetSmilRawData(MMS_MESSAGE_DATA_S *pMsgBody, char *pRawData, int *nSize);
-bool MmsInsertPresentation(MmsMsg *pMsg, MsgContentType mimeType, char *pData, int size);
+bool MmsInsertPresentation(MmsMsg *pMsg, MimeType mimeType, char *pData, int size);
bool MmsInsertPartFromFile(MmsMsg *pMsg, char *szTitleName, char *szOrgFilePath, char *szContentID);
bool MmsIsMultipart(int type);
bool MmsGetTypeByFileName(int *type, char *szFileName);
-MsgMultipart *MmsMakeMultipart(MsgContentType mimeType, char *szTitleName, char *szOrgFilePath, void *pData, int offset, int size, char *szContentID);
+MsgMultipart *MmsMakeMultipart(MimeType mimeType, char *szTitleName, char *szOrgFilePath, void *pData, int offset, int size, char *szContentID);
bool MmsIsText(int type);
bool MmsIsVitemContent(int type, char *pszName);
bool MmsComposeMessage(MmsMsg *pMmsMsg, MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S *pSendOptInfo, MMS_MESSAGE_DATA_S *pMsgData, char *pFileData);
+++ /dev/null
-/*
-* Copyright 2012 Samsung Electronics Co., Ltd
-*
-* Licensed under the Flora License, Version 1.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.tizenopensource.org/license
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-#include "MmsPluginMessage.h"
-
-#define MSG_STDSTR_SHORT 0x7F
-
-/*
- * structures for setup
- */
-
-typedef enum {
- MMS_RECEIVE_AUTO,
- MMS_RECEIVE_MANUAL,
- MMS_RECEIVE_RESTRICT,
- MMS_RECEIVE_REJECT,
- MMS_RECEIVE_CNT,
-} MmsRecvType;
-
-typedef enum {
- MMS_RESTRICTED_MODE,
- MMS_WARNING_MODE,
- MMS_FREE_MODE
-} MmsUiMsgCreationMode;
-
-typedef enum {
- MMS_OPCO_DEFAULT = 0,
- MMS_OPCO_FRANCE = 1,
- MMS_OPCO_GERMAN = 2,
- MMS_OPCO_GREECE = 3,
- MMS_OPCO_IRELANDS = 4,
- MMS_OPCO_ITALY = 5,
- MMS_OPCO_NETHERLANDS = 6,
- MMS_OPCO_PORTUGAL = 7,
- MMS_OPCO_SPAIN = 8,
- MMS_OPCO_SWEDEN = 9,
- MMS_OPCO_SWISS = 10,
- MMS_OPCO_UK = 11,
- MMS_OPCO_AUSTRIA = 12,
- MMS_OPCO_BELGIUM = 13,
- MMS_OPCO_HUNGARY = 14,
- MMS_OPCO_NUM
-} MmsOpCo;
-
-typedef struct {
- bool bHideAddress;
- bool bAskDeliveyReport;
- bool bAskReadReply;
- MmsPriority priority;
- char szFrom[MSG_LOCALE_ADDR_LEN + 10];
- MmsMsgClass msgClass;
- MmsTimeStruct expiryTime;
- MmsTimeStruct deliveryTime;
- bool bLeaveCopy;
- bool bAttachVcard;
- bool bAttachSign;
- bool bExpiryUseCustomTime;
-
- bool bDeliveryUseCustomTime;
-
- MmsTimeStruct expiryCustomTime;
- MmsTimeStruct deliveryCustomTime;
-
- char szSign[MSG_LOCALE_SIGN_LEN + 1];
-
- //MMS_V1_1
- MmsReplyCharge replyCharge;
-
- int creationMode; // Creation Mode
-} MmsSendSetup;
-
-typedef struct {
- bool bSendDeliveryReport;
- bool bSendReadReply;
- bool bAnonymousReject;
- bool bRejectAdvertisement;
- MmsRecvType recvHomeNetwork;
- MmsRecvType recvRoamingNetwork;
-} MmsRecvSetup;
-
-typedef struct {
- bool bUserSettingMsgMaxSize;
- int msgMmsMaxSize;
-} MmsMsgSizeSetup;
-
-
-typedef struct {
- MmsUiMsgCreationMode creationMode;
-} MmsCreationModeSetup;
-
-
-typedef struct {
- bool bCustomTime;
- int slideIntervalTime;
- int customTime;
-} MmsSlideSetup;
-
-typedef struct {
- int postcardName;
- int postcardAdditionalInfo;
- int postcardStreet;
- int postcardZip;
- int postcardCity;
- int postcardStateNProvince;
- int postcardCountry;
-} MmsPostcardSetup;
-
-typedef struct {
- MmsSendSetup sendSetup;
- MmsRecvSetup recvSetup;
- MmsMsgSizeSetup msgSizeSetup;
- MmsPostcardSetup postcardSetup[5]; // ref) POSTCARD_EDIT_TYPE_EXTENDED4
-
- MmsCreationModeSetup creationModeSetup;
-
- int autoResizeSize;
-
- /* UI not-visible fields ------------------------------------ */
-
- MmsOpCo nOpCo;
- int maxSendSize;
- char szPostcardOffice[MSG_STDSTR_SHORT + 1]; // Only Privosioning can change this field
- char szPostcardOfficeExtend01[MSG_STDSTR_SHORT + 1];
- char szPostcardOfficeExtend02[MSG_STDSTR_SHORT + 1];
- char szPostcardOfficeExtend03[MSG_STDSTR_SHORT + 1];
- char szPostcardOfficeExtend04[MSG_STDSTR_SHORT + 1];
- bool bPostcardAvailable; // Only Privosioning can change this field
- char szMmlUrl[MSG_STDSTR_SHORT + 1]; //MML Home Url
- char szMmlPhoneNumber[MSG_STDSTR_SHORT + 1]; //MML Upload phonenumber
-
- char szMmsTmplDownloadURL[MSG_STDSTR_SHORT + 1]; // for MMS More Templates
-
-} MmsSetup;
-
-/* global Setting */
-extern MmsSetup gMmsSetup;
-
#include "MsgSqliteWrapper.h"
#include "MmsPluginMessage.h"
-
/*==================================================================================================
CLASS DEFINITIONS
==================================================================================================*/
msg_error_t plgGetMmsMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pSendOptInfo, MMS_MESSAGE_DATA_S *pMmsMsg, char **pDestMsg);
msg_error_t getContentLocation(MSG_MESSAGE_INFO_S *pMsgInfo);
msg_error_t getMmsRawFilePath(msg_message_id_t msgId, char *pFilepath);
- msg_error_t plgGetRestoreMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pSendOptInfo, MMS_MESSAGE_DATA_S *pMmsMsg, char **pDestMsg, char *filePath);
+
/* reject_msg_support */
msg_error_t getTrID(MSG_MESSAGE_INFO_S *pMsgInfo, char *pszTrID, int nBufferLen);
/* reject_msg_support */
#include <glib.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
const char *MmsPluginTextConvertGetCharSet(int MIBEnum);
bool MmsPluginTextConvert(const char *pToCodeSet, const char *pFromCodeSet, const char *pSrc, int srcLen, char **ppDest, int *pDestLen);
+#ifdef __cplusplus
+}
+#endif
+
#endif