summaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
Diffstat (limited to 'plugin')
-rwxr-xr-xplugin/mms_plugin/CMakeLists.txt4
-rwxr-xr-xplugin/mms_plugin/MmsPluginAppBase.cpp51
-rwxr-xr-xplugin/mms_plugin/MmsPluginCodecCommon.cpp197
-rwxr-xr-xplugin/mms_plugin/MmsPluginComposer.cpp26
-rwxr-xr-xplugin/mms_plugin/MmsPluginConnManWrapper.cpp48
-rwxr-xr-xplugin/mms_plugin/MmsPluginDecode.cpp539
-rwxr-xr-xplugin/mms_plugin/MmsPluginDrm.cpp1
-rwxr-xr-xplugin/mms_plugin/MmsPluginEncode.cpp229
-rwxr-xr-xplugin/mms_plugin/MmsPluginEventHandler.cpp129
-rwxr-xr-xplugin/mms_plugin/MmsPluginHttp.cpp153
-rwxr-xr-xplugin/mms_plugin/MmsPluginInternal.cpp157
-rwxr-xr-xplugin/mms_plugin/MmsPluginMIME.cpp882
-rwxr-xr-xplugin/mms_plugin/MmsPluginMain.cpp18
-rwxr-xr-xplugin/mms_plugin/MmsPluginMessage.cpp158
-rwxr-xr-xplugin/mms_plugin/MmsPluginSMILValidate.cpp83
-rwxr-xr-xplugin/mms_plugin/MmsPluginStorage.cpp275
-rwxr-xr-xplugin/mms_plugin/MmsPluginTcs.cpp85
-rwxr-xr-xplugin/mms_plugin/MmsPluginTextConvert.cpp4
-rwxr-xr-xplugin/mms_plugin/MmsPluginTransport.cpp22
-rwxr-xr-xplugin/mms_plugin/MmsPluginUserAgent.cpp109
-rwxr-xr-xplugin/mms_plugin/MmsPluginUtil.cpp224
-rwxr-xr-xplugin/mms_plugin/include/MmsPluginAppBase.h4
-rwxr-xr-xplugin/mms_plugin/include/MmsPluginCodec.h2
-rwxr-xr-xplugin/mms_plugin/include/MmsPluginCodecCommon.h12
-rwxr-xr-xplugin/mms_plugin/include/MmsPluginCodecTypes.h67
-rwxr-xr-xplugin/mms_plugin/include/MmsPluginComposer.h4
-rwxr-xr-xplugin/mms_plugin/include/MmsPluginConnManWrapper.h10
-rwxr-xr-xplugin/mms_plugin/include/MmsPluginDebug.h2
-rwxr-xr-xplugin/mms_plugin/include/MmsPluginDecode.h18
-rwxr-xr-xplugin/mms_plugin/include/MmsPluginDrm.h2
-rwxr-xr-xplugin/mms_plugin/include/MmsPluginEncode.h2
-rwxr-xr-xplugin/mms_plugin/include/MmsPluginEventHandler.h9
-rwxr-xr-xplugin/mms_plugin/include/MmsPluginHttp.h8
-rwxr-xr-xplugin/mms_plugin/include/MmsPluginInternal.h5
-rwxr-xr-xplugin/mms_plugin/include/MmsPluginMIME.h53
-rwxr-xr-xplugin/mms_plugin/include/MmsPluginMain.h2
-rwxr-xr-xplugin/mms_plugin/include/MmsPluginMessage.h16
-rwxr-xr-xplugin/mms_plugin/include/MmsPluginStorage.h17
-rwxr-xr-xplugin/mms_plugin/include/MmsPluginTcs.h23
-rwxr-xr-xplugin/mms_plugin/include/MmsPluginTextConvert.h2
-rwxr-xr-xplugin/mms_plugin/include/MmsPluginTransport.h5
-rwxr-xr-xplugin/mms_plugin/include/MmsPluginTypes.h18
-rwxr-xr-xplugin/mms_plugin/include/MmsPluginUserAgent.h11
-rwxr-xr-xplugin/mms_plugin/include/MmsPluginUtil.h10
-rwxr-xr-xplugin/sms_cdma_plugin/CMakeLists.txt2
-rwxr-xr-xplugin/sms_cdma_plugin/SmsCdmaPluginCallback.cpp175
-rwxr-xr-xplugin/sms_cdma_plugin/SmsCdmaPluginCodec.cpp1928
-rwxr-xr-xplugin/sms_cdma_plugin/SmsCdmaPluginEventHandler.cpp334
-rwxr-xr-xplugin/sms_cdma_plugin/SmsCdmaPluginMain.cpp84
-rwxr-xr-xplugin/sms_cdma_plugin/SmsCdmaPluginParamCodec.cpp8
-rwxr-xr-xplugin/sms_cdma_plugin/SmsCdmaPluginSetting.cpp181
-rwxr-xr-xplugin/sms_cdma_plugin/SmsCdmaPluginStorage.cpp111
-rwxr-xr-xplugin/sms_cdma_plugin/SmsCdmaPluginTransport.cpp215
-rwxr-xr-xplugin/sms_cdma_plugin/SmsCdmaPluginUAManager.cpp15
-rwxr-xr-xplugin/sms_cdma_plugin/SmsCdmaPluginWapPushHandler.cpp1696
-rwxr-xr-xplugin/sms_cdma_plugin/include/SmsCdmaPluginCallback.h3
-rwxr-xr-xplugin/sms_cdma_plugin/include/SmsCdmaPluginCodec.h2
-rwxr-xr-xplugin/sms_cdma_plugin/include/SmsCdmaPluginEventHandler.h13
-rwxr-xr-xplugin/sms_cdma_plugin/include/SmsCdmaPluginMain.h3
-rwxr-xr-xplugin/sms_cdma_plugin/include/SmsCdmaPluginSetting.h3
-rwxr-xr-xplugin/sms_cdma_plugin/include/SmsCdmaPluginStorage.h3
-rwxr-xr-xplugin/sms_cdma_plugin/include/SmsCdmaPluginTransport.h2
-rwxr-xr-xplugin/sms_cdma_plugin/include/SmsCdmaPluginTypes.h268
-rwxr-xr-xplugin/sms_cdma_plugin/include/SmsCdmaPluginUAManager.h5
-rwxr-xr-xplugin/sms_cdma_plugin/include/SmsCdmaPluginWapPushHandler.h7
-rwxr-xr-xplugin/sms_plugin/CMakeLists.txt2
-rwxr-xr-xplugin/sms_plugin/SmsPluginCallback.cpp449
-rwxr-xr-xplugin/sms_plugin/SmsPluginCbMsgHandler.cpp710
-rwxr-xr-xplugin/sms_plugin/SmsPluginConcatHandler.cpp274
-rwxr-xr-xplugin/sms_plugin/SmsPluginDSHandler.cpp22
-rwxr-xr-xplugin/sms_plugin/SmsPluginEventHandler.cpp380
-rwxr-xr-xplugin/sms_plugin/SmsPluginMain.cpp142
-rwxr-xr-xplugin/sms_plugin/SmsPluginParamCodec.cpp243
-rwxr-xr-xplugin/sms_plugin/SmsPluginSatHandler.cpp138
-rwxr-xr-xplugin/sms_plugin/SmsPluginSetting.cpp623
-rwxr-xr-xplugin/sms_plugin/SmsPluginSimMsg.cpp230
-rwxr-xr-xplugin/sms_plugin/SmsPluginStorage.cpp225
-rwxr-xr-xplugin/sms_plugin/SmsPluginTpduCodec.cpp268
-rwxr-xr-xplugin/sms_plugin/SmsPluginTransport.cpp436
-rwxr-xr-xplugin/sms_plugin/SmsPluginUAManager.cpp14
-rwxr-xr-xplugin/sms_plugin/SmsPluginUDCodec.cpp638
-rwxr-xr-xplugin/sms_plugin/SmsPluginWapPushHandler.cpp1955
-rwxr-xr-xplugin/sms_plugin/include/SmsPluginCallback.h2
-rwxr-xr-xplugin/sms_plugin/include/SmsPluginCbMsgHandler.h2
-rwxr-xr-xplugin/sms_plugin/include/SmsPluginConcatHandler.h10
-rwxr-xr-xplugin/sms_plugin/include/SmsPluginDSHandler.h6
-rwxr-xr-xplugin/sms_plugin/include/SmsPluginEventHandler.h13
-rwxr-xr-xplugin/sms_plugin/include/SmsPluginMain.h6
-rwxr-xr-xplugin/sms_plugin/include/SmsPluginParamCodec.h4
-rwxr-xr-xplugin/sms_plugin/include/SmsPluginSatHandler.h12
-rwxr-xr-xplugin/sms_plugin/include/SmsPluginSetting.h50
-rwxr-xr-xplugin/sms_plugin/include/SmsPluginSimMsg.h2
-rwxr-xr-xplugin/sms_plugin/include/SmsPluginStorage.h3
-rwxr-xr-xplugin/sms_plugin/include/SmsPluginTpduCodec.h2
-rwxr-xr-xplugin/sms_plugin/include/SmsPluginTransport.h2
-rwxr-xr-xplugin/sms_plugin/include/SmsPluginTypes.h202
-rwxr-xr-xplugin/sms_plugin/include/SmsPluginUAManager.h2
-rwxr-xr-xplugin/sms_plugin/include/SmsPluginUDCodec.h2
-rwxr-xr-xplugin/sms_plugin/include/SmsPluginWapPushHandler.h10
99 files changed, 7148 insertions, 8685 deletions
diff --git a/plugin/mms_plugin/CMakeLists.txt b/plugin/mms_plugin/CMakeLists.txt
index d3ffda1..d11059c 100755
--- a/plugin/mms_plugin/CMakeLists.txt
+++ b/plugin/mms_plugin/CMakeLists.txt
@@ -22,14 +22,12 @@ SET(MMS-PLUGIN-SRCS
MmsPluginEventHandler.cpp
MmsPluginStorage.cpp
MmsPluginMessage.cpp
- MmsPluginMIME.cpp
MmsPluginConnManWrapper.cpp
MmsPluginUserAgent.cpp
MmsPluginHttp.cpp
MmsPluginInternal.cpp
MmsPluginDrm.cpp
MmsPluginUtil.cpp
-# MmsPluginTcs.cpp
MmsPluginComposer.cpp
MmsPluginAppBase.cpp
)
@@ -44,7 +42,7 @@ INCLUDE_DIRECTORIES(
)
INCLUDE(FindPkgConfig)
-pkg_check_modules(mms_plugin_pkgs REQUIRED glib-2.0 libcurl mm-fileinfo mmutil-imgp mmutil-jpeg vconf dlog capi-media-thumbnail-util capi-media-image-util capi-network-connection db-util)
+pkg_check_modules(mms_plugin_pkgs REQUIRED glib-2.0 libcurl vconf dlog capi-network-connection capi-telephony)
FOREACH(flag ${mms_plugin_pkgs_CFLAGS})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
diff --git a/plugin/mms_plugin/MmsPluginAppBase.cpp b/plugin/mms_plugin/MmsPluginAppBase.cpp
index 11e4a23..69d9271 100755
--- a/plugin/mms_plugin/MmsPluginAppBase.cpp
+++ b/plugin/mms_plugin/MmsPluginAppBase.cpp
@@ -18,11 +18,10 @@
#include "MmsPluginDebug.h"
#include "MmsPluginStorage.h"
#include "MmsPluginMessage.h"
-#include "MmsPluginMIME.h"
#include "MmsPluginAppBase.h"
#include "MmsPluginUtil.h"
-#include "MmsPluginTcs.h"
#include "MsgUtilFile.h"
+#include "MsgUtilMime.h"
msg_error_t MmsMakePreviewInfo(int msgId, MMS_MESSAGE_DATA_S *pMmsMsg, bool allow_malware, const char *raw_filepath);
@@ -72,7 +71,7 @@ void MmsPluginAppBase::getFirstPageTextFilePath(char *textBuf, int textBufSize)
if (pMmsMsgData == NULL)
return;
- // Get the text data from the 1st slide.
+ /* Get the text data from the 1st slide. */
if (pMmsMsgData->pageCnt > 0) {
pPage = _MsgMmsGetPage(pMmsMsgData, 0);
@@ -87,25 +86,41 @@ void MmsPluginAppBase::getFirstPageTextFilePath(char *textBuf, int textBufSize)
MimeType mimeType = MIME_UNKNOWN;
- MmsGetMimeTypeFromFileName(MIME_MAINTYPE_UNKNOWN, pMedia->szFilePath, &mimeType, NULL);
+ MsgGetMimeTypeFromFileName(MIME_MAINTYPE_UNKNOWN, pMedia->szFilePath, &mimeType, NULL);
if (mimeType == MIME_TEXT_X_VCALENDAR || mimeType == MIME_TEXT_X_VCARD || mimeType == MIME_TEXT_X_VTODO || mimeType == MIME_TEXT_X_VNOTE) {
- MSG_DEBUG("Media Type is Text, but Vobject file [%s]", pMedia->szFilePath);
+ MSG_SEC_DEBUG("Media Type is Text, but Vobject file [%s]", pMedia->szFilePath);
} else {
- MSG_DEBUG("Text path : [%s]", pMedia->szFilePath);
- snprintf(textBuf, textBufSize, "%s", pMedia->szFilePath);//Set Text Filepath of First Pages
+ MSG_SEC_DEBUG("Text path : [%s]", pMedia->szFilePath);
+ snprintf(textBuf, textBufSize, "%s", pMedia->szFilePath); /* Set Text Filepath of First Pages */
}
break;
}
}
}
+ } else {
+ /* (P151014-01246)
+ * Set filepath of the first text/plain attachment to display preview text on notification */
+ if (pMmsMsgData->attachlist) {
+ GList *l = pMmsMsgData->attachlist;
+ while (l) {
+ MMS_ATTACH_S *attach = (MMS_ATTACH_S *)l->data;
+ if (g_strcmp0(attach->szContentType, "text/plain") == 0) {
+ MSG_SEC_DEBUG("The first text filepath for multipart: (%s)", attach->szFilePath);
+ snprintf(textBuf, textBufSize, "%s", attach->szFilePath);
+ break;
+ }
+
+ l = g_list_next(l);
+ }
+ }
}
return;
}
-//FIXME::need to move AppBase
+/* FIXME::need to move AppBase */
msg_error_t MmsMakePreviewInfo(int msgId, MMS_MESSAGE_DATA_S *pMmsMsg, bool allow_malware, const char *raw_filepath)
{
MMS_PAGE_S *pPage = NULL;
@@ -118,9 +133,9 @@ msg_error_t MmsMakePreviewInfo(int msgId, MMS_MESSAGE_DATA_S *pMmsMsg, bool allo
if (pMmsMsg == NULL)
return MSG_ERR_NULL_POINTER;
- MmsPluginStorage::instance()->removePreviewInfo(msgId); //remove exist previnfo
+ MmsPluginStorage::instance()->removePreviewInfo(msgId); /* remove exist previnfo */
- //scan malware in raw file
+ /* scan malware in raw file */
if (raw_filepath && strlen(raw_filepath) > 0 && MsgAccessFile(raw_filepath, F_OK) == true) {
int tcs_ret = 0; // MmsPluginTcsScanFile(raw_filepath, &bc_level);
if (tcs_ret == 0) {
@@ -131,17 +146,17 @@ msg_error_t MmsMakePreviewInfo(int msgId, MMS_MESSAGE_DATA_S *pMmsMsg, bool allo
}
}
- //check ref type and increase attach count
+ /* check ref type and increase attach count */
if (pMmsMsg->pageCnt > 0) {
for (int i = 0; i < pMmsMsg->pageCnt; i++) {
pPage = _MsgMmsGetPage(pMmsMsg, i);
if (pPage) {
for (int j = 0; j < pPage->mediaCnt; j++) {
pMedia = _MsgMmsGetMedia(pPage, j);
- if (pMedia) { //IF Vobject type add to Attach in Preview data
+ if (pMedia) { /* IF Vobject type add to Attach in Preview data */
MimeType mimeType = MIME_UNKNOWN;
- MmsGetMimeTypeFromFileName(MIME_MAINTYPE_UNKNOWN, pMedia->szFilePath, &mimeType, NULL);
+ MsgGetMimeTypeFromFileName(MIME_MAINTYPE_UNKNOWN, pMedia->szFilePath, &mimeType, NULL);
if (mimeType == MIME_TEXT_X_VCALENDAR || mimeType == MIME_TEXT_X_VCARD) {
MSG_DEBUG("Unsupported File [%s] It will be add to attach list", pMedia->szFilePath);
@@ -184,7 +199,7 @@ msg_error_t MmsMakePreviewInfo(int msgId, MMS_MESSAGE_DATA_S *pMmsMsg, bool allo
}
} else {
- if (j == 0) { //First Page, First Media
+ if (j == 0) { /* First Page, First Media */
MmsPluginStorage::instance()->insertPreviewInfo(msgId, MSG_MMS_ITEM_TYPE_1ST_MEDIA, pMedia->szFilePath);
}
@@ -196,7 +211,7 @@ msg_error_t MmsMakePreviewInfo(int msgId, MMS_MESSAGE_DATA_S *pMmsMsg, bool allo
memset(szFileName, 0x00, MSG_FILENAME_LEN_MAX+1);
memset(thumbPath, 0x00, MSG_FILEPATH_LEN_MAX);
- MSG_DEBUG("drm type = %d, %s", pMedia->drmType, pMedia->szFilePath);
+ MSG_SEC_DEBUG("drm type = %d, %s", pMedia->drmType, pMedia->szFilePath);
if (pMedia->drmType == MSG_DRM_TYPE_NONE) {
@@ -208,7 +223,7 @@ msg_error_t MmsMakePreviewInfo(int msgId, MMS_MESSAGE_DATA_S *pMmsMsg, bool allo
snprintf(thumbPath, MSG_FILEPATH_LEN_MAX, "%s%s.jpg", MSG_THUMBNAIL_PATH, szFileName);
}
- if (MmsMakeImageThumbnail(pMedia->szFilePath, thumbPath) == true) {
+ if (MakeThumbnail(pMedia->szFilePath, thumbPath) == true) {
if (pMedia->mediatype == MMS_SMIL_MEDIA_IMG) {
MmsPluginStorage::instance()->insertPreviewInfo(msgId, MSG_MMS_ITEM_TYPE_IMG, thumbPath);
} else {
@@ -223,7 +238,7 @@ msg_error_t MmsMakePreviewInfo(int msgId, MMS_MESSAGE_DATA_S *pMmsMsg, bool allo
}
}
}
- } // end for
+ } /* end for */
} else {
MSG_DEBUG("There is no page");
}
@@ -234,7 +249,7 @@ msg_error_t MmsMakePreviewInfo(int msgId, MMS_MESSAGE_DATA_S *pMmsMsg, bool allo
MMS_ATTACH_S *pAttach = _MsgMmsGetAttachment(pMmsMsg, 0);
MmsPluginStorage::instance()->insertPreviewInfo(msgId, MSG_MMS_ITEM_TYPE_ATTACH, pAttach->szFileName, attachCnt);
- MmsPluginStorage::instance()->updateMmsAttachCount(msgId, attachCnt); // for Get Message
+ MmsPluginStorage::instance()->updateMmsAttachCount(msgId, attachCnt); /* for Get Message */
if (attachment_name == NULL) {
attachment_name = pAttach->szFileName;
diff --git a/plugin/mms_plugin/MmsPluginCodecCommon.cpp b/plugin/mms_plugin/MmsPluginCodecCommon.cpp
index c8078d2..47610e1 100755
--- a/plugin/mms_plugin/MmsPluginCodecCommon.cpp
+++ b/plugin/mms_plugin/MmsPluginCodecCommon.cpp
@@ -17,7 +17,7 @@
#include <ctype.h>
#include "MmsPluginDebug.h"
#include "MmsPluginCodecCommon.h"
-#include "MmsPluginMIME.h"
+#include "MsgUtilMime.h"
#include "MmsPluginUtil.h"
#include "MmsPluginTextConvert.h"
@@ -33,13 +33,12 @@ typedef struct {
} 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] =
-{
+const MmsField gMmsField[MMS_MAX_FIELD_TYPE_COUNT][MMS_MAX_FIELD_VALUE_COUNT] = {
/* MMS Specific (MsgMmsMsg.h / MsgMmsUA.h) -----------------------*/
/* MmsCodeFieldCode */
{
- {"Bcc", 0x01}, //0
+ {"Bcc", 0x01}, /* 0 */
{"Cc", 0x02},
{"X-Mms-Content-Location", 0x03},
{"Content-Type", 0x04},
@@ -49,7 +48,7 @@ const MmsField gMmsField[MMS_MAX_FIELD_TYPE_COUNT][MMS_MAX_FIELD_VALUE_COUNT] =
{"X-Mms-Expiry", 0x08},
{"From", 0x09},
{"X-Mms-Message-Class", 0x0A},
- {"Message-ID", 0x0B}, // 10
+ {"Message-ID", 0x0B}, /* 10 */
{"X-Mms-Message-Type", 0x0C},
{"X-Mms-MMS-Version", 0x0D},
{"X-Mms-Message-Size", 0x0E},
@@ -59,7 +58,7 @@ const MmsField gMmsField[MMS_MAX_FIELD_TYPE_COUNT][MMS_MAX_FIELD_VALUE_COUNT] =
{"X-Mms-Response-Status", 0x12},
{"X-Mms-Retrieve-Status", 0x19}, /* Add by MMSENC v1.1 */
{"X-Mms-Response-Text", 0x13},
- {"X-Mms-Retrieve-Text", 0x1A}, // 20 /* Add by MMSENC v1.1 */
+ {"X-Mms-Retrieve-Text", 0x1A}, /* 20 */ /* Add by MMSENC v1.1 */
{"X-Mms-Sender-Visibility", 0x14},
{"X-Mms-Status", 0x15},
{"Subject", 0x16},
@@ -69,7 +68,7 @@ const MmsField gMmsField[MMS_MAX_FIELD_TYPE_COUNT][MMS_MAX_FIELD_VALUE_COUNT] =
/* Add by MMSENC v1.1 */
{"X-Mms-Read-Status", 0x1B},
{"X-Mms-Reply-Charging", 0x1C},
- {"X-Mms-Reply-Charging-Deadline", 0x1D}, // 30
+ {"X-Mms-Reply-Charging-Deadline", 0x1D}, /* 30 */
{"X-Mms-Reply-Charging-ID", 0x1E},
{"X-Mms-Reply-Charging-Size", 0x1F},
{"X-Mms-Previously-Sent-By", 0x20},
@@ -78,14 +77,14 @@ const MmsField gMmsField[MMS_MAX_FIELD_TYPE_COUNT][MMS_MAX_FIELD_VALUE_COUNT] =
/* MmsCodeParameterCode ( By WSP Table 38. Wellknown parameter Assignments ) */
{
- {"Charset", 0x01}, // v1.1 base
- {"Name", 0x05}, // v1.1 base. 0x17 at v1.4
- {"FileName", 0x06}, // v1.1 base. ox18 at v1.4
- {"Type", 0x09}, // v1.2 base
- {"Start", 0x0A}, // v1.2 base. 0x19 at v1.4
- {"Start-Info", 0x0B}, // v1.2 base. 0x1A at v1.4
- {"boundary", 0xFF}, //laconic_javaParamFix
- {"report-type", 0xFF}, // only used as parameter of Content-Type: multipart/report; report-type=delivery-status;
+ {"Charset", 0x01}, /* v1.1 base */
+ {"Name", 0x05}, /* v1.1 base. 0x17 at v1.4 */
+ {"FileName", 0x06}, /* v1.1 base. ox18 at v1.4 */
+ {"Type", 0x09}, /* v1.2 base */
+ {"Start", 0x0A}, /* v1.2 base. 0x19 at v1.4 */
+ {"Start-Info", 0x0B}, /* v1.2 base. 0x1A at v1.4 */
+ {"boundary", 0xFF}, /* laconic_javaParamFix */
+ {"report-type", 0xFF}, /* only used as parameter of Content-Type: multipart/report; report-type=delivery-status; */
#ifdef FEATURE_JAVA_MMS
{"Application-ID", 0xFF},
{"Reply-To-Application-ID", 0xFF},
@@ -94,11 +93,11 @@ const MmsField gMmsField[MMS_MAX_FIELD_TYPE_COUNT][MMS_MAX_FIELD_VALUE_COUNT] =
/* MmsCodeMsgBodyHeaderCode ( By WSP Table 39. Header Field Name Assignments ) */
{
- {"Content-Transfer-Encoding", 0xFFFF}, // only text encoding, no binary number
- {"Content-Disposition", 0x2E}, // v1.1 base. 0x45 at v1.4
- {"Content-ID", 0x40}, // v1.3 base
- {"Content-Location", 0x0E}, // v1.3 base
- {"X-Oma-Drm-Separate-Delivery", 0xFF }, // DRM RO WAITING
+ {"Content-Transfer-Encoding", 0xFFFF}, /* only text encoding, no binary number */
+ {"Content-Disposition", 0x2E}, /* v1.1 base. 0x45 at v1.4 */
+ {"Content-ID", 0x40}, /* v1.3 base */
+ {"Content-Location", 0x0E}, /* v1.3 base */
+ {"X-Oma-Drm-Separate-Delivery", 0xFF }, /* DRM RO WAITING */
},
/* MmsCodeMsgType */
@@ -268,10 +267,10 @@ const MmsField gMmsField[MMS_MAX_FIELD_TYPE_COUNT][MMS_MAX_FIELD_VALUE_COUNT] =
},
-// OMNA WSP Content Type Numbers
-// http://technical.openmobilealliance.org/tech/omna/omna-wsp-content-type.aspx
+/* OMNA WSP Content Type Numbers */
+/* http://technical.openmobilealliance.org/tech/omna/omna-wsp-content-type.aspx */
{
- //NOT USED THIS TABLE
+ /* NOT USED THIS TABLE */
},
/* MmsCodeMsgDisposition : Wsp Header (By Wsp 8.4.2.53) */
@@ -294,7 +293,7 @@ const MmsField gMmsField[MMS_MAX_FIELD_TYPE_COUNT][MMS_MAX_FIELD_VALUE_COUNT] =
const char *MmsGetTextValue(MmsCode i, int j)
{
if (i == MmsCodeContentType) {
- //apply UtyMime
+ /* apply UtyMime */
return MimeGetMimeStringFromMimeInt(j);
}
@@ -357,16 +356,14 @@ const char *MmsGetTextValuebyField(int field, int value)
UINT16 MmsGetBinaryValue(MmsCode i, int j)
{
- if (i == MmsCodeContentType) {
+ if (i == MmsCodeContentType)
return MimeGetBinaryValueFromMimeInt((MimeType)j);
- }
return gMmsField[i][j].binary;
}
int MmsGetBinaryType(MmsCode i, UINT16 value)
{
-
for (int j = 0; j < MMS_MAX_FIELD_VALUE_COUNT; j++) {
if (gMmsField[i][j].binary == value) {
MSG_DEBUG("code [%d], value [0x%02x], ret type [%d]", i, value, j);
@@ -490,28 +487,28 @@ void *MsgDecodeBase64(unsigned char *pSrc, unsigned long srcLen, unsigned long *
}
continue;
} else
- continue; // Actually, never get here
+ 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
+ *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
+ *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
+ *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.
+ *d++ |= c; /* byte 3: low 6 bits */
+ e = 0; /* Calculate next unit. */
break;
default:
@@ -520,7 +517,7 @@ void *MsgDecodeBase64(unsigned char *pSrc, unsigned long srcLen, unsigned long *
}
}
- *len = d - (char *)ret; // Calculate the size of decoded string.
+ *len = d - (char *)ret; /* Calculate the size of decoded string. */
return ret;
}
@@ -649,10 +646,10 @@ bool MsgEncode2Base64(void *pSrc, unsigned long srcLen, unsigned long *len, unsi
/* 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
+ *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--;
@@ -689,13 +686,13 @@ int extract_encoded_word_param(char *encoded_word, char **charset, char **encod
start_ptr = encoded_word;
- if ( (encoded_word[0] == '=' && encoded_word[1] == '?') //"=?"
- && ((q1_ptr = strchr(start_ptr + 2, MSG_CH_QUESTION)) != NULL) // '?'
- && ((q2_ptr = strchr(q1_ptr + 1, MSG_CH_QUESTION))!= NULL) // '?'
- && ((end_ptr = strstr(q2_ptr + 1, MSG_STR_DEC_END))!= NULL)) //"?="
+ if ( (encoded_word[0] == '=' && encoded_word[1] == '?') /* "=?" */
+ && ((q1_ptr = strchr(start_ptr + 2, MSG_CH_QUESTION)) != NULL) /* '?' */
+ && ((q2_ptr = strchr(q1_ptr + 1, MSG_CH_QUESTION))!= NULL) /* '?' */
+ && ((end_ptr = strstr(q2_ptr + 1, MSG_STR_DEC_END))!= NULL)) /* "?=" */
{
- //extract character set
+ /* extract character set */
if ( q1_ptr - (start_ptr + 2) > 0 ) {
char_set = (char*)calloc(1, q1_ptr - (start_ptr + 2) + 1);
@@ -712,7 +709,7 @@ int extract_encoded_word_param(char *encoded_word, char **charset, char **encod
goto __CATCH;
}
- //extract encode type
+ /* extract encode type */
if ((*(q2_ptr - 1) == MSG_CH_BASE64_UPPER) || (*(q2_ptr - 1) == MSG_CH_BASE64_LOWER)
|| (*(q1_ptr + 1) == MSG_CH_BASE64_UPPER) || (*(q1_ptr + 1) == MSG_CH_BASE64_LOWER))
{
@@ -720,7 +717,7 @@ int extract_encoded_word_param(char *encoded_word, char **charset, char **encod
} else if ((*(q2_ptr-1) == MSG_CH_QPRINT_UPPER) || (*(q2_ptr-1) == MSG_CH_QPRINT_LOWER)
|| (*(q1_ptr+1) == MSG_CH_QPRINT_UPPER) || (*(q1_ptr+1) == MSG_CH_QPRINT_LOWER))
{
- //QPRINT
+ /* QPRINT */
l_encoding[0] = MSG_CH_QPRINT_UPPER;
} else {
@@ -728,7 +725,7 @@ int extract_encoded_word_param(char *encoded_word, char **charset, char **encod
goto __CATCH;
}
- //extract encoded text
+ /* extract encoded text */
if (end_ptr - q2_ptr > 1) {
l_encoded_text = (char*)calloc(1, end_ptr - q2_ptr);
if (l_encoded_text == NULL)
@@ -782,7 +779,7 @@ char *MsgDecodeText(const char *pOri)
unsigned int total_len = 0;
unsigned int decoded_len = 0;
- // copy original string
+ /* copy original string */
if (pOri == NULL || strlen(pOri) <= 0) {
MSG_DEBUG("Invalid parameter : [%s]", pOri);
return NULL;
@@ -801,7 +798,7 @@ char *MsgDecodeText(const char *pOri)
b_encoded_word = false;
- //Find encoded word
+ /* Find encoded word */
while (b_encoded_word == false && encoded_word_start_ptr != NULL ) {
if (extract_encoded_word_param(encoded_word_start_ptr, &charset, &encoding, &encoded_text, &encoded_word_size) == 0) {
@@ -818,13 +815,13 @@ char *MsgDecodeText(const char *pOri)
encoded_word_size = 0;
}
- encoded_word_start_ptr = strstr(encoded_word_start_ptr+1, MSG_STR_DEC_START); //find next encoded_start_ptr
+ encoded_word_start_ptr = strstr(encoded_word_start_ptr+1, MSG_STR_DEC_START); /* find next encoded_start_ptr */
- } // end of while
+ } /* end of while */
if (b_encoded_word) {
- //copy normal text
+ /* copy normal text */
if (encoded_word_start_ptr - normal_word_start_ptr > 0) {
result_string.append(normal_word_start_ptr, encoded_word_start_ptr - normal_word_start_ptr);
MSG_DEBUG("copy normal text : [%s]", result_string.c_str());
@@ -847,7 +844,7 @@ char *MsgDecodeText(const char *pOri)
MSG_DEBUG("MmsPluginTextConvert Fail");
}
- if(result_text) {
+ if (result_text) {
MSG_DEBUG("Text convert result [%s][%d]", result_text, strlen(result_text));
result_string.append(result_text, result_text_len);
@@ -878,7 +875,7 @@ char *MsgDecodeText(const char *pOri)
MSG_DEBUG("MmsPluginTextConvert Fail");
}
- if(result_text) {
+ if (result_text) {
MSG_DEBUG("Text convert result [%s][%d]", result_text, strlen(result_text));
result_string.append(result_text, result_text_len);
@@ -893,7 +890,7 @@ char *MsgDecodeText(const char *pOri)
MSG_FREE(decoded_text);
}
- normal_word_start_ptr = encoded_word_start_ptr+encoded_word_size; //next
+ normal_word_start_ptr = encoded_word_start_ptr+encoded_word_size; /* next */
MSG_FREE(charset);
MSG_FREE(encoding);
@@ -901,7 +898,7 @@ char *MsgDecodeText(const char *pOri)
encoded_word_size = 0;
} else {
- //copy remain normal text
+ /* copy remain normal text */
MSG_DEBUG("last text : [%s]", normal_word_start_ptr);
@@ -910,7 +907,7 @@ char *MsgDecodeText(const char *pOri)
break;
}
- } //end of while
+ } /* end of while */
if (result_string.length() > 0) {
return_string = g_strdup(result_string.c_str());
@@ -1102,6 +1099,10 @@ const char *MmsDebugGetMimeType(MimeType mimeType)
return "MIME_AUDIO_X_PN_MULTIRATE_REALAUDIO_LIVE";
case MIME_AUDIO_X_WAV:
return "MIME_AUDIO_X_WAV";
+ case MIME_AUDIO_MOBILE_XMF:
+ return "MIME_AUDIO_MOBILE_XMF";
+ case MIME_AUDIO_OGG:
+ return "MIME_AUDIO_OGG";
case MIME_IMAGE_GIF:
return "MIME_IMAGE_GIF";
@@ -1478,6 +1479,7 @@ bool MmsInitMsgType(MsgType *pMsgType)
pMsgType->szOrgFilePath[0] = '\0';
pMsgType->szContentID[0] = '\0';
pMsgType->szContentLocation[0] = '\0';
+ pMsgType->szLocation[0] = '\0';
MmsInitMsgContentParam(&pMsgType->param);
MmsInitMsgDRMInfo(&pMsgType->drmInfo);
@@ -1511,7 +1513,7 @@ bool MmsInitMsgContentParam(MsgContentParam *pMsgContentParam)
pMsgContentParam->szStart[0] = '\0';
pMsgContentParam->szStartInfo[0] = '\0';
pMsgContentParam->pPresentation = NULL;
- pMsgContentParam->reportType = MSG_PARAM_REPORT_TYPE_UNKNOWN; // only used as parameter of Content-Type: multipart/report; report-type
+ pMsgContentParam->reportType = MSG_PARAM_REPORT_TYPE_UNKNOWN; /* only used as parameter of Content-Type: multipart/report; report-type */
#ifdef FEATURE_JAVA_MMS
pMsgContentParam->szApplicationID = NULL;
pMsgContentParam->szReplyToApplicationID = NULL;
@@ -1660,7 +1662,7 @@ bool MmsReleaseMmsAttrib(MmsAttrib *pAttrib)
pAttrib->szBcc = NULL;
}
- //check if pMultiStatus should be freed or not, because pMultiStatus is not allocated
+ /* check if pMultiStatus should be freed or not, because pMultiStatus is not allocated */
if (pAttrib->pMultiStatus) {
MmsMsgMultiStatus *pMultiStatus = pAttrib->pMultiStatus;
MmsMsgMultiStatus *pCurStatus = NULL;
@@ -1678,7 +1680,6 @@ bool MmsReleaseMmsAttrib(MmsAttrib *pAttrib)
pAttrib->pMultiStatus = NULL;
}
-
MSG_END();
return true;
@@ -1704,49 +1705,47 @@ bool MmsReleaseMsgBody(MsgBody *pBody, int type)
case MIME_MULTIPART_MIXED:
case MIME_MULTIPART_RELATED:
case MIME_MULTIPART_ALTERNATIVE:
- case MIME_APPLICATION_VND_WAP_MULTIPART_ALTERNATIVE:
- {
- MsgMultipart *pMulti = pBody->body.pMultipart;
- MsgMultipart *pCurrPart = NULL;
- MsgBody *pPresentation = pBody->pPresentationBody;
- while (pMulti != NULL) {
- pCurrPart = pMulti;
-
- pMulti = pMulti->pNext;
-
- if (pCurrPart) {
- MmsReleaseMsgDRMInfo(&pCurrPart->type.drmInfo);
-
- if (pCurrPart->pBody) {
- if (pCurrPart->pBody->body.pText) {
- free(pCurrPart->pBody->body.pText);
- pCurrPart->pBody->body.pText = NULL;
- }
-
- free(pCurrPart->pBody);
- pCurrPart->pBody = NULL;
+ case MIME_APPLICATION_VND_WAP_MULTIPART_ALTERNATIVE: {
+ MsgMultipart *pMulti = pBody->body.pMultipart;
+ MsgMultipart *pCurrPart = NULL;
+ MsgBody *pPresentation = pBody->pPresentationBody;
+ while (pMulti != NULL) {
+ pCurrPart = pMulti;
+
+ pMulti = pMulti->pNext;
+
+ if (pCurrPart) {
+ MmsReleaseMsgDRMInfo(&pCurrPart->type.drmInfo);
+
+ if (pCurrPart->pBody) {
+ if (pCurrPart->pBody->body.pText) {
+ free(pCurrPart->pBody->body.pText);
+ pCurrPart->pBody->body.pText = NULL;
}
- free(pCurrPart);
- pCurrPart = NULL;
- }
- }
- pBody->body.pMultipart = NULL;
-
- if (pPresentation) {
- if (pPresentation->body.pText) {
- free(pPresentation->body.pText);
- pPresentation->body.pText = NULL;
+ free(pCurrPart->pBody);
+ pCurrPart->pBody = NULL;
}
- free(pPresentation);
- pBody->pPresentationBody = NULL;
+ free(pCurrPart);
+ pCurrPart = NULL;
}
+ }
- MmsInitMsgType(&pBody->presentationType);
+ pBody->body.pMultipart = NULL;
- break;
+ if (pPresentation) {
+ if (pPresentation->body.pText) {
+ free(pPresentation->body.pText);
+ pPresentation->body.pText = NULL;
+ }
+ free(pPresentation);
+ pBody->pPresentationBody = NULL;
}
+ MmsInitMsgType(&pBody->presentationType);
+
+ break;
+ }
default:
/* Any single part */
if (pBody->body.pText) {
@@ -1831,16 +1830,16 @@ bool MmsIsVitemContent(int type, char *pszName)
switch (type) {
case MIME_TEXT_X_VCARD:
case MIME_TEXT_X_VCALENDAR:
- case MIME_TEXT_X_VNOTE: // vnt
+ case MIME_TEXT_X_VNOTE: /* vnt */
case MIME_TEXT_X_VTODO:
- case MIME_TEXT_PLAIN: // vbm - It SHOULD be distinguished from a normal text file.
+ case MIME_TEXT_PLAIN: /* vbm - It SHOULD be distinguished from a normal text file. */
{
char *pszExt = NULL;
if (!pszName)
break;
- // search file extension.
+ /* search file extension. */
if ((pszExt = strrchr(pszName, '.')) == NULL)
break;
diff --git a/plugin/mms_plugin/MmsPluginComposer.cpp b/plugin/mms_plugin/MmsPluginComposer.cpp
index dea1b2f..555b8ef 100755
--- a/plugin/mms_plugin/MmsPluginComposer.cpp
+++ b/plugin/mms_plugin/MmsPluginComposer.cpp
@@ -30,10 +30,9 @@
#include "MmsPluginTypes.h"
#include "MmsPluginDebug.h"
#include "MmsPluginMessage.h"
-#include "MmsPluginMIME.h"
+#include "MsgUtilMime.h"
#include "MmsPluginStorage.h"
#include "MmsPluginUtil.h"
-#include "MmsPluginTcs.h"
#include "MsgSmil.h"
@@ -60,13 +59,13 @@ void MmsPluginComposer::composeSendReq(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDING
if (pMsgInfo->msgType.subType == MSG_SENDREQ_MMS) {
- if (pMmsData->header == NULL) {//send req from user
+ if (pMmsData->header == NULL) { /* send req from user */
pMmsData->header = MsgMmsCreateHeader();
}
if (pMmsData->header) {
composeSendReqHeader(pMsgInfo, pSendOptInfo, pMmsData);
- //TODO:: apply MmsReplaceNonAsciiUtf8 to all multipart FileName;
+ /* TODO:: apply MmsReplaceNonAsciiUtf8 to all multipart FileName; */
}
int len = g_list_length(pMmsData->multipartlist);
@@ -77,12 +76,17 @@ void MmsPluginComposer::composeSendReq(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDING
if (multipart) {
if (multipart->type == MIME_UNKNOWN && strlen(multipart->szContentType) == 0) {
+ MimeMainType mainType;
+
+ if (!MsgGetMainTypeFromMetaData(multipart->szFilePath, &mainType))
+ mainType = MIME_MAINTYPE_UNKNOWN;
+
const char *content_type = NULL;
- MmsGetMimeTypeFromFileName(MIME_MAINTYPE_UNKNOWN, multipart->szFileName, &multipart->type, &content_type);
+ MsgGetMimeTypeFromFileName(mainType, multipart->szFileName, &multipart->type, &content_type);
snprintf(multipart->szContentType, sizeof(multipart->szContentType), "%s", content_type);
}
}
- } //end for
+ } /* end for */
}
}
@@ -96,7 +100,7 @@ MMSList *getAddressList(const MSG_MESSAGE_INFO_S *pMsgInfo, int recipientType)
nAddressCnt = pMsgInfo->nAddressCnt;
- // Calculate allocated buffer size
+ /* Calculate allocated buffer size */
for (int i = 0; i < nAddressCnt; ++i) {
MSG_SEC_DEBUG("recipientType: %d, address value: %s", pMsgInfo->addressList[i].recipientType, pMsgInfo->addressList[i].addressVal);
@@ -112,7 +116,7 @@ MMSList *getAddressList(const MSG_MESSAGE_INFO_S *pMsgInfo, int recipientType)
} else if (pMsgInfo->addressList[i].addressType == MSG_ADDRESS_TYPE_EMAIL) {
pAddressData = MsgMmsCreateAddress(MSG_ADDRESS_TYPE_EMAIL, pMsgInfo->addressList[i].addressVal);
} else
- ; // Need to consider IPV4, IPV6, and Alias formatted address
+ ; /* Need to consider IPV4, IPV6, and Alias formatted address */
if (pAddressData)
addressList = g_list_append(addressList, pAddressData);
@@ -180,7 +184,7 @@ bool composeSendReqHeader(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S *p
msgClass = (MmsMsgClass)MsgSettingGetInt(MMS_SEND_MSG_CLASS);
- //set Header
+ /* set Header */
time(&RawTime);
localtime_r(&RawTime, &timeInfo);
nTimeInSecs = mktime(&timeInfo);
@@ -214,12 +218,10 @@ bool composeSendReqHeader(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S *p
snprintf(pHeaderData->szSubject, sizeof(pHeaderData->szSubject), "%s", pMsgInfo->subject);
- //setting adddress
+ /* setting adddress */
pHeaderData->to = getAddressList(pMsgInfo, MSG_RECIPIENTS_TYPE_TO);
pHeaderData->cc = getAddressList(pMsgInfo, MSG_RECIPIENTS_TYPE_CC);
pHeaderData->bcc = getAddressList(pMsgInfo, MSG_RECIPIENTS_TYPE_BCC);
- //snprintf(pHeaderData->szFrom, sizeof(pHeaderData->szFrom), "%s", pMmsMsg->mmsAttrib.szFrom);
-
return true;
}
diff --git a/plugin/mms_plugin/MmsPluginConnManWrapper.cpp b/plugin/mms_plugin/MmsPluginConnManWrapper.cpp
index bb02aa6..80039b5 100755
--- a/plugin/mms_plugin/MmsPluginConnManWrapper.cpp
+++ b/plugin/mms_plugin/MmsPluginConnManWrapper.cpp
@@ -415,6 +415,7 @@ MmsPluginCmAgent::MmsPluginCmAgent()
home_url = NULL;
interface_name = NULL;
proxy_address = NULL;
+ dns_address_list = NULL;
MSG_END();
}
@@ -423,6 +424,7 @@ MmsPluginCmAgent::~MmsPluginCmAgent()
MSG_FREE(home_url);
MSG_FREE(interface_name);
MSG_FREE(proxy_address);
+ MSG_FREE(dns_address_list);
}
bool MmsPluginCmAgent::open()
@@ -434,7 +436,7 @@ bool MmsPluginCmAgent::open()
int time_ret = 0;
lock();
- //create connection
+ /* create connection */
context_invoke(__connection_create, &bConnection);
if (bConnection == false || g_connection == NULL) {
@@ -444,8 +446,8 @@ bool MmsPluginCmAgent::open()
if (g_profile) {
MSG_WARN("connection profile already exist");
- //TODO:: get data;
- //goto __RETURN;
+ /* TODO:: get data; */
+ /* goto __RETURN; */
}
waitProfileOpen = true;
@@ -459,10 +461,7 @@ bool MmsPluginCmAgent::open()
MSG_INFO("## WAITING UNTIL __connection_profile_state CONNECT. ##");
-// cv.wait(mx.pMutex());
-// MSG_INFO("## WAKE by SIGNAL ##");
-
- time_ret = cv.timedwait(mx.pMutex(), MMS_CONNECTION_API_WAIT_TIME); // isCmOpened will changed by processCBdatas
+ time_ret = cv.timedwait(mx.pMutex(), MMS_CONNECTION_API_WAIT_TIME); /* isCmOpened will changed by processCBdatas */
if (time_ret == ETIMEDOUT) {
MSG_WARN("## WAKE by timeout ##");
@@ -470,12 +469,12 @@ bool MmsPluginCmAgent::open()
MSG_INFO("## WAKE by SIGNAL ##");
}
- if(isCmOpened == false) {
+ if (isCmOpened == false) {
MSG_WARN("");
goto __ERR_RETURN;
}
-//__RETURN:
+/* __RETURN: */
unlock();
MSG_END();
return isCmOpened;
@@ -533,13 +532,14 @@ __RETURN:
MSG_FREE(this->home_url);
MSG_FREE(this->interface_name);
MSG_FREE(this->proxy_address);
+ MSG_FREE(this->dns_address_list);
unlock();
MSG_END();
}
-//profile open callback
+/* profile open callback */
void MmsPluginCmAgent::connection_profile_open_callback(connection_error_e result, void* user_data)
{
lock();
@@ -573,6 +573,7 @@ void MmsPluginCmAgent::connection_profile_open_callback(connection_error_e resul
MSG_FREE(this->home_url);
MSG_FREE(this->interface_name);
MSG_FREE(this->proxy_address);
+ MSG_FREE(this->dns_address_list);
err = connection_profile_get_cellular_home_url(profile, &this->home_url);
if (err != CONNECTION_ERROR_NONE) {
@@ -591,10 +592,10 @@ void MmsPluginCmAgent::connection_profile_open_callback(connection_error_e resul
isCmOpened = true;
- goto __SIGNAL_RETURN; //open success
+ goto __SIGNAL_RETURN; /* open success */
} else {
- goto __NO_SIGNAL_RETURN; //Just open success
+ goto __NO_SIGNAL_RETURN; /* Just open success */
}
} else {
@@ -604,17 +605,17 @@ void MmsPluginCmAgent::connection_profile_open_callback(connection_error_e resul
}
-__NO_SIGNAL_RETURN: //Just Open
+__NO_SIGNAL_RETURN: /* Just Open */
if (profile)
connection_profile_destroy(profile);
unlock();
return;
-__SIGNAL_RETURN: //Error or Already connected
+__SIGNAL_RETURN: /* Error or Already connected */
if (profile)
connection_profile_destroy(profile);
- if (waitProfileOpen == true) {//open fail
+ if (waitProfileOpen == true) { /* open fail */
waitProfileOpen = false;
MSG_INFO("## SIGNAL ##");
signal();
@@ -669,6 +670,7 @@ void MmsPluginCmAgent::connection_profile_state_changed_cb(connection_profile_st
MSG_FREE(this->home_url);
MSG_FREE(this->interface_name);
MSG_FREE(this->proxy_address);
+ MSG_FREE(this->dns_address_list);
err = connection_profile_get_cellular_home_url(profile, &this->home_url);
if (err != CONNECTION_ERROR_NONE) {
@@ -693,7 +695,7 @@ __NO_SIGNAL_RETURN://Default
unlock();
return;
-__SIGNAL_RETURN: //Error or connected
+__SIGNAL_RETURN: /* Error or connected */
if (profile)
connection_profile_destroy(profile);
@@ -745,3 +747,17 @@ bool MmsPluginCmAgent::getProxyAddr(const char **proxyAddr)
return true;
}
+
+
+bool MmsPluginCmAgent::getDnsAddrList(const char **dnsAddrList)
+{
+ if (!isCmOpened)
+ return false;
+
+ if (dnsAddrList == NULL)
+ return false;
+
+ *dnsAddrList = dns_address_list;
+
+ return true;
+}
diff --git a/plugin/mms_plugin/MmsPluginDecode.cpp b/plugin/mms_plugin/MmsPluginDecode.cpp
index d204d11..73c0f85 100755
--- a/plugin/mms_plugin/MmsPluginDecode.cpp
+++ b/plugin/mms_plugin/MmsPluginDecode.cpp
@@ -21,6 +21,7 @@
#include <errno.h>
#include "MsgUtilFile.h"
+#include "MsgUtilMime.h"
#include "MsgSmil.h"
#include "MsgMmsMessage.h"
@@ -29,7 +30,6 @@
#include "MmsPluginCodecCommon.h"
#include "MmsPluginStorage.h"
#include "MmsPluginDebug.h"
-#include "MmsPluginMIME.h"
#include "MmsPluginTextConvert.h"
#include "MmsPluginUtil.h"
@@ -73,7 +73,7 @@ static bool __MmsBinaryDecodeParameter(FILE *pFile, MsgType *pMsgType, int value
static int __MmsBinaryDecodeContentType(FILE *pFile, MsgType *pMsgType, int totalLength);
-//util funcion
+/* util funcion */
static void __MsgRemoveFilePath(char *pSrc);
static bool __MsgChangeSpace(char *pOrg, char **ppNew);
static void __MsgConfirmPresentationPart(MsgType *pMsgType, MsgBody *pMsgBody, MsgPresentaionInfo *pPresentationInfo);
@@ -90,7 +90,7 @@ static char *__MsgSkipComment(char *s, long trim);
static char *__MsgConvertLatin2UTF8FileName(char *pSrc);
-//static bool __MsgIsPercentSign(char *pSrc);
+/* static bool __MsgIsPercentSign(char *pSrc); */
static bool __MsgIsMultipartRelated(int type);
static bool __MsgIsPresentablePart(int type);
static bool __MsgResolveNestedMultipart(MsgType *pPartType, MsgBody *pPartBody);
@@ -129,57 +129,56 @@ __thread char *gpMmsDecodeBuf2 = NULL;
__thread MmsHeader mmsHeader =
{
- (MmsMsgType)MMS_MSGTYPE_ERROR, //MmsMsgType iType;
- "", //char[] szTrID;
- //"", //short int version;
- 0, //short int version;
- 0, //UINT32 date;
-
- NULL, //MsgHeaderAddress* pFrom;
- NULL, //MsgHeaderAddress* pTo;
- NULL, //MsgHeaderAddress* pCc;
- NULL, //MsgHeaderAddress* pBcc;
- "", //char[] szSubject;
- (MmsResponseStatus)MMS_RESPSTATUS_OK, //MmsResponseStatus iResponseStatus;
- (MmsRetrieveStatus)MMS_RETRSTATUS_OK, //MmsRetrieveStatus iRetrieveStatus;
- "", //char[] szResponseText;
- "", //char[] szRetrieveText;
+ (MmsMsgType)MMS_MSGTYPE_ERROR, /* MmsMsgType iType; */
+ "", /* char[] szTrID; */
+ 0, /* short int version; */
+ 0, /* UINT32 date; */
+
+ NULL, /* MsgHeaderAddress* pFrom; */
+ NULL, /* MsgHeaderAddress* pTo; */
+ NULL, /* MsgHeaderAddress* pCc; */
+ NULL, /* MsgHeaderAddress* pBcc; */
+ "", /* char[] szSubject; */
+ (MmsResponseStatus)MMS_RESPSTATUS_OK, /* MmsResponseStatus iResponseStatus; */
+ (MmsRetrieveStatus)MMS_RETRSTATUS_OK, /* MmsRetrieveStatus iRetrieveStatus; */
+ "", /* char[] szResponseText; */
+ "", /* char[] szRetrieveText; */
/* has default value in specification */
- (MmsMsgClass)MMS_MSGCLASS_PERSONAL, //MmsMsgClass msgClass;
- {MMS_TIMETYPE_RELATIVE, 0}, //MmsTimeStruct expiryTime;
- {MMS_TIMETYPE_RELATIVE, 0}, //MmsTimeStruct deliveryTime;
- (MmsPriority)MMS_PRIORITY_NORMAL, //MmsPriority priority; // Refer [OMA-MMS-ENC-v1_2-20030915-C]
- (MmsSenderVisible)MMS_SENDER_SHOW, //MmsSenderVisible senderVisible;
- (MmsReport)MMS_REPORT_NO, //MmsReport deliveryReport;
- (MmsReport)MMS_REPORT_NO, //MmsReport readReply;
- (MmsReportAllowed)MMS_REPORTALLOWED_NO,//MmsReportAllowed iReportAllowed;
- "", //char[] szContentLocation;
+ (MmsMsgClass)MMS_MSGCLASS_PERSONAL, /* MmsMsgClass msgClass; */
+ {MMS_TIMETYPE_RELATIVE, 0}, /* MmsTimeStruct expiryTime; */
+ {MMS_TIMETYPE_RELATIVE, 0}, /* MmsTimeStruct deliveryTime; */
+ (MmsPriority)MMS_PRIORITY_NORMAL, /* MmsPriority priority; */ /* Refer [OMA-MMS-ENC-v1_2-20030915-C] */
+ (MmsSenderVisible)MMS_SENDER_SHOW, /* MmsSenderVisible senderVisible; */
+ (MmsReport)MMS_REPORT_NO, /* MmsReport deliveryReport; */
+ (MmsReport)MMS_REPORT_NO, /* MmsReport readReply; */
+ (MmsReportAllowed)MMS_REPORTALLOWED_NO, /* MmsReportAllowed iReportAllowed; */
+ "", /* char[] szContentLocation; */
/* there is no right default value */
- (msg_delivery_report_status_t)MSG_DELIVERY_REPORT_NONE, //MmsMsgStatus iMsgStatus;
- (msg_read_report_status_t)MSG_READ_REPORT_NONE, //MmsReadStatus readStatus;
+ (msg_delivery_report_status_t)MSG_DELIVERY_REPORT_NONE, /* MmsMsgStatus iMsgStatus; */
+ (msg_read_report_status_t)MSG_READ_REPORT_NONE, /* MmsReadStatus readStatus; */
/* MMS v1.1 ReplyCharge */
{
- (MmsReplyChargeType)MMS_REPLY_NONE, //MmsReplyChargeType chargeType;
- {MMS_TIMETYPE_RELATIVE, 0}, //MmsTimeStruct deadLine;
- 0, //int chargeSize;
- "" , //char szChargeID;
+ (MmsReplyChargeType)MMS_REPLY_NONE, /* MmsReplyChargeType chargeType; */
+ {MMS_TIMETYPE_RELATIVE, 0}, /* MmsTimeStruct deadLine; */
+ 0, /* int chargeSize; */
+ "" , /* char szChargeID; */
},
- "", //char[] szMsgID;
- 0, //UINT32 msgSize;
+ "", /* char[] szMsgID; */
+ 0, /* UINT32 msgSize; */
};
#define MMS_DRM2_CONVERT_BUFFER_MAX 4*1024
-const UINT32 MMS_UINTVAR_LENGTH_1 = 0x0000007f; //7bit
-const UINT32 MMS_UINTVAR_LENGTH_2 = 0x00003fff; //14bit
-const UINT32 MMS_UINTVAR_LENGTH_3 = 0x001fffff; //21bit
+const UINT32 MMS_UINTVAR_LENGTH_1 = 0x0000007f; /* 7bit */
+const UINT32 MMS_UINTVAR_LENGTH_2 = 0x00003fff; /* 14bit */
+const UINT32 MMS_UINTVAR_LENGTH_3 = 0x001fffff; /* 21bit */
static bool __MmsDecodeInitialize(void)
{
@@ -219,7 +218,7 @@ void MmsInitHeader()
mmsHeader.expiryTime.time = 0;
mmsHeader.deliveryTime.type = MMS_TIMETYPE_RELATIVE;
mmsHeader.deliveryTime.time = 0;
- mmsHeader.priority = (MmsPriority)MMS_PRIORITY_NORMAL; // Refer [OMA-MMS-ENC-v1_2-20030915-C]
+ mmsHeader.priority = (MmsPriority)MMS_PRIORITY_NORMAL; /* Refer [OMA-MMS-ENC-v1_2-20030915-C] */
mmsHeader.hideAddress =(MmsSenderVisible)MMS_SENDER_SHOW;
mmsHeader.deliveryReport = (MmsReport)MMS_REPORT_NO;
mmsHeader.readReply = (MmsReport)MMS_REPORT_NO;
@@ -384,8 +383,7 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength)
fieldCode = oneByte & 0x7f;
switch (MmsGetBinaryType(MmsCodeFieldCode, fieldCode)) {
- case MMS_CODE_RESPONSESTATUS:
- {
+ case MMS_CODE_RESPONSESTATUS: {
MmsResponseStatus resposeStatus = MMS_RESPSTATUS_ERROR;
if (__MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
@@ -395,8 +393,8 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength)
fieldValue = oneByte;
- // range 197 to 223 as it does to the value 192 (Error-transient-failure).
- // range 236 to 255 as it does to the value 224 (Error-permanent-failure).
+ /* range 197 to 223 as it does to the value 192 (Error-transient-failure). */
+ /* range 236 to 255 as it does to the value 224 (Error-permanent-failure). */
if (fieldValue >= 197 && fieldValue <= 223) {
fieldValue = 192;
} else if (fieldValue >= 236 && fieldValue <= 255) {
@@ -410,8 +408,7 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength)
MSG_SEC_INFO("X-Mms-Response-Status = [0x%02x][0x%02x][%s]", oneByte, fieldValue, MmsDebugGetResponseStatus(mmsHeader.responseStatus));
break;
}
- case MMS_CODE_RETRIEVESTATUS:
- {
+ case MMS_CODE_RETRIEVESTATUS: {
MmsRetrieveStatus RetrieveStatus = MMS_RETRSTATUS_ERROR;
if (__MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
@@ -421,12 +418,12 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength)
fieldValue = oneByte;
- //195 to 223 as it does to the value 192 (Error-transient-failure).
- //228 to 255 as it does to the value 224 (Error-permanent-failure).
+ /* 195 to 223 as it does to the value 192 (Error-transient-failure). */
+ /* 228 to 255 as it does to the value 224 (Error-permanent-failure). */
if (fieldValue >= 195 && fieldValue <= 223) {
- fieldValue = 192; // 192; Error-transient-failure
+ fieldValue = 192; /* 192; Error-transient-failure */
} else if (fieldValue >= 228 && fieldValue <= 255) {
- fieldValue = 224; //224; Error-permanent-failure
+ fieldValue = 224; /* 224; Error-permanent-failure */
}
RetrieveStatus = (MmsRetrieveStatus)MmsGetBinaryType(MmsCodeRetrieveStatus, (UINT16)(fieldValue & 0x7F));
@@ -518,7 +515,7 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength)
goto __CATCH;
}
- // DRM_TEMPLATE - start
+ /* DRM_TEMPLATE - start */
valueLength--;
@@ -546,7 +543,7 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength)
}
MSG_SEC_INFO("From = [%s]", mmsHeader.pFrom->szAddr);
- // DRM_TEMPLATE - end
+ /* DRM_TEMPLATE - end */
} else if (oneByte == (MmsGetBinaryValue(MmsCodeAddressType, MMS_INSERT_ADDRESS_TOKEN)|0x80)) {
/* Present Token only */
MSG_SEC_INFO("From = [insert token]");
@@ -669,7 +666,7 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength)
goto __CATCH;
}
- //DRM_TEMPLATE - start
+ /* DRM_TEMPLATE - start */
valueLength--;
if (oneByte == (MmsGetBinaryValue(MmsCodeTimeType, MMS_TIMETYPE_ABSOLUTE)|0x80)) {
@@ -681,7 +678,7 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength)
goto __CATCH;
}
}
- // DRM_TEMPLATE - end
+ /* DRM_TEMPLATE - end */
} else {
mmsHeader.deliveryTime.type = MMS_TIMETYPE_RELATIVE;
@@ -707,7 +704,7 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength)
goto __CATCH;
}
- // DRM_TEMPLATE - start
+ /* DRM_TEMPLATE - start */
valueLength--;
if (oneByte == (MmsGetBinaryValue(MmsCodeTimeType, MMS_TIMETYPE_ABSOLUTE)|0x80)) {
@@ -719,7 +716,7 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength)
goto __CATCH;
}
}
- // DRM_TEMPLATE - end
+ /* DRM_TEMPLATE - end */
} else {
mmsHeader.expiryTime.type = MMS_TIMETYPE_RELATIVE;
@@ -903,7 +900,7 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength)
mmsHeader.replyCharge.deadLine.type = MMS_TIMETYPE_RELATIVE;
}
- // DRM_TEMPLATE - start
+ /* DRM_TEMPLATE - start */
valueLength--;
if (valueLength > 0) {
@@ -914,7 +911,7 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength)
}
MSG_SEC_INFO("X-Mms-Reply-Charging-Deadline : type = [%d], time = [%u]", mmsHeader.replyCharge.deadLine.type, mmsHeader.replyCharge.deadLine.time);
- // DRM_TEMPLATE - end
+ /* DRM_TEMPLATE - end */
break;
case MMS_CODE_REPLYCHARGINGID:
@@ -995,7 +992,7 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength)
}
break;
- default:
+ default: {
/*
* Application-header = Token-text Application-specific-value
@@ -1007,32 +1004,32 @@ bool MmsBinaryDecodeMsgHeader(FILE *pFile, int totalLength)
* Read one byte and check the value >= 0x80
* (check these value can be field code)
*/
- {
- int remainLength = 0;
- oneByte = 0x00;
+ int remainLength = 0;
- offset = __MmsGetDecodeOffset();
- if (offset >= totalLength)
- goto __RETURN;
+ oneByte = 0x00;
- remainLength = totalLength - offset;
+ offset = __MmsGetDecodeOffset();
+ if (offset >= totalLength)
+ goto __RETURN;
- while ((oneByte < 0x80) && (remainLength > 0)) {
- if (__MmsBinaryDecodeCheckAndDecreaseLength(&remainLength, 1) == false) {
- MSG_DEBUG("__MmsBinaryDecodeCheckAndDecreaseLength fail");
- goto __CATCH;
- }
- if (__MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
- MSG_DEBUG("responseStatus GetOneByte fail");
- goto __CATCH;
- }
+ remainLength = totalLength - offset;
+
+ while ((oneByte < 0x80) && (remainLength > 0)) {
+ if (__MmsBinaryDecodeCheckAndDecreaseLength(&remainLength, 1) == false) {
+ MSG_DEBUG("__MmsBinaryDecodeCheckAndDecreaseLength fail");
+ goto __CATCH;
}
- gCurMmsDecodeBuffPos--;
+ if (__MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
+ MSG_DEBUG("responseStatus GetOneByte fail");
+ goto __CATCH;
+ }
}
+ gCurMmsDecodeBuffPos--;
break;
+ }
} /* switch */
offset = __MmsGetDecodeOffset();
@@ -1090,9 +1087,9 @@ bool MmsBinaryDecodeMsgBody(FILE *pFile, char *szFilePath, int totalLength)
if (szFilePath != NULL)
snprintf(mmsHeader.msgType.szOrgFilePath, sizeof(mmsHeader.msgType.szOrgFilePath), "%s", 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
+ /* 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) {
@@ -1100,14 +1097,14 @@ bool MmsBinaryDecodeMsgBody(FILE *pFile, char *szFilePath, int totalLength)
goto __CATCH;
}
- // msg's type [ex] related, mixed, single part (jpg, amr and etc)
+ /* msg's type [ex] related, mixed, single part (jpg, amr and etc) */
length = __MmsBinaryDecodeContentType(pFile, &mmsHeader.msgType, totalLength);
if (length == -1) {
MSG_DEBUG("MMS_CODE_CONTENTTYPE is fail");
goto __CATCH;
}
- mmsHeader.msgType.size = length + 1; // + Content-Type code value
+ mmsHeader.msgType.size = length + 1; /* + Content-Type code value */
mmsHeader.msgBody.offset = __MmsGetDecodeOffset();
switch (mmsHeader.msgType.type) {
@@ -1190,7 +1187,7 @@ static bool __MmsBinaryDecodeParameter(FILE *pFile, MsgType *pMsgType, int value
valueLength--;
switch (paramCode) {
- case 0x81: // charset
+ case 0x81: /* charset */
if (__MmsBinaryDecodeCharset(pFile, (UINT32*)&(pMsgType->param.charset), &charSetLen, totalLength) == false) {
MSG_DEBUG("__MmsBinaryDecodeCharset fail.");
@@ -1202,11 +1199,11 @@ static bool __MmsBinaryDecodeParameter(FILE *pFile, MsgType *pMsgType, int value
break;
- case 0x85: //name = Text-string
- case 0x97: //name = Text-value = No-value | Token-text | Quoted-string
+ case 0x85: /* name = Text-string */
+ case 0x97: /* name = Text-value = No-value | Token-text | Quoted-string */
memset(pMsgType->param.szName, 0, sizeof(pMsgType->param.szName));
length = __MmsDecodeGetFilename(pFile, pMsgType->param.szName,
- MSG_FILENAME_LEN_MAX -5, // MSG_LOCALE_FILENAME_LEN_MAX + 1, : change @ 110(Ui code have to change for this instead of DM)
+ MSG_FILENAME_LEN_MAX -5, /* MSG_LOCALE_FILENAME_LEN_MAX + 1, : change @ 110(Ui code have to change for this instead of DM) */
totalLength);
if (length < 0) {
MSG_DEBUG("__MmsDecodeGetFilename fail. (name parameter)");
@@ -1222,8 +1219,8 @@ static bool __MmsBinaryDecodeParameter(FILE *pFile, MsgType *pMsgType, int value
break;
- case 0x86: //filename = Text-string
- case 0x98: //filename = Text-value = No-value | Token-text | Quoted-string
+ case 0x86: /* filename = Text-string */
+ case 0x98: /* filename = Text-value = No-value | Token-text | Quoted-string */
memset(pMsgType->param.szFileName, 0, sizeof(pMsgType->param.szFileName));
length = __MmsDecodeGetFilename(pFile, pMsgType->param.szFileName, MSG_FILENAME_LEN_MAX -5, totalLength);
if (length < 0) {
@@ -1240,7 +1237,7 @@ static bool __MmsBinaryDecodeParameter(FILE *pFile, MsgType *pMsgType, int value
break;
- case 0x89: //type = Constrained-encoding = Extension-Media | Short-integer
+ case 0x89: /* type = Constrained-encoding = Extension-Media | Short-integer */
if (__MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
MSG_DEBUG("type _MmsBinaryDecodeGetOneByte fail");
@@ -1248,7 +1245,8 @@ static bool __MmsBinaryDecodeParameter(FILE *pFile, MsgType *pMsgType, int value
}
if (oneByte > 0x7f) {
- pMsgType->param.type = MimeGetMimeIntFromBi((UINT16)(oneByte & 0x7f));//MmsGetBinaryType(MmsCodeContentType,(UINT16)(oneByte & 0x7f));
+ pMsgType->param.type = MimeGetMimeIntFromBi((UINT16)(oneByte & 0x7f));
+ /* MmsGetBinaryType(MmsCodeContentType,(UINT16)(oneByte & 0x7f)); */
if (__MmsBinaryDecodeCheckAndDecreaseLength(&valueLength, 1) == false)
goto __RETURN;
} else {
@@ -1268,8 +1266,8 @@ static bool __MmsBinaryDecodeParameter(FILE *pFile, MsgType *pMsgType, int value
break;
- case 0x8A: //start encoding version 1.2
- case 0x99: //start encoding version 1.4
+ case 0x8A: /* start encoding version 1.2 */
+ case 0x99: /* start encoding version 1.4 */
textLength = 0;
szTypeString = __MmsBinaryDecodeText2(pFile, totalLength, &textLength);
@@ -1285,8 +1283,8 @@ static bool __MmsBinaryDecodeParameter(FILE *pFile, MsgType *pMsgType, int value
break;
- case 0x8B: //startInfo encoding version 1.2
- case 0x9A: //startInfo encoding version 1.4
+ case 0x8B: /* startInfo encoding version 1.2 */
+ case 0x9A: /* startInfo encoding version 1.4 */
textLength = 0;
szTypeString = __MmsBinaryDecodeText2(pFile, totalLength, &textLength);
@@ -1309,7 +1307,7 @@ static bool __MmsBinaryDecodeParameter(FILE *pFile, MsgType *pMsgType, int value
if (paramCode > 0x7F) {
MSG_DEBUG("Unsupported parameter");
- // In case of the last byte of Parameter field, it should be returned without decreasing the gCurMmsDecodeBuffPos value.
+ /* In case of the last byte of Parameter field, it should be returned without decreasing the gCurMmsDecodeBuffPos value. */
valueLength++;
if (__MmsBinaryDecodeCheckAndDecreaseLength(&valueLength, 1) == false)
goto __RETURN;
@@ -1553,6 +1551,7 @@ static bool __MmsBinaryDecodePartHeader(FILE *pFile, MsgType *pMsgType, int head
char *szSrc = NULL;
char *szTemp = NULL;
+ MSG_INFO("headerLen[%d] totalLength[%d]", headerLen, totalLength);
if (pFile == NULL || pMsgType == NULL)
return false;
@@ -1580,8 +1579,8 @@ static bool __MmsBinaryDecodePartHeader(FILE *pFile, MsgType *pMsgType, int head
fieldCode = oneByte & 0x7f;
switch (fieldCode) {
- case 0x0E: //Content-Location
- case 0x04: //Content-Location
+ case 0x0E: /* Content-Location */
+ case 0x04: /* Content-Location */
{
pLatinBuff = (char *)calloc(1, MMS_CONTENT_ID_LEN + 1);
if (pLatinBuff == NULL)
@@ -1596,7 +1595,7 @@ static bool __MmsBinaryDecodePartHeader(FILE *pFile, MsgType *pMsgType, int head
szSrc = __MsgConvertLatin2UTF8FileName(pLatinBuff);
if (szSrc) {
snprintf(pMsgType->szContentLocation, sizeof(pMsgType->szContentLocation), "%s", szSrc);
- MSG_DEBUG("Content Location : [%s]", pMsgType->szContentLocation);
+ MSG_SEC_DEBUG("Content Location : [%s]", pMsgType->szContentLocation);
free(szSrc);
szSrc = NULL;
}
@@ -1609,7 +1608,7 @@ static bool __MmsBinaryDecodePartHeader(FILE *pFile, MsgType *pMsgType, int head
}
break;
- case 0x40: // Content-ID
+ case 0x40: /* Content-ID */
{
char szContentID[MMS_CONTENT_ID_LEN + 1] = {0, };
@@ -1627,7 +1626,7 @@ static bool __MmsBinaryDecodePartHeader(FILE *pFile, MsgType *pMsgType, int head
szSrc = __MsgConvertLatin2UTF8FileName(pLatinBuff);
if (szSrc) {
snprintf(szContentID, sizeof(szContentID), "%s", szSrc);
- MSG_DEBUG("Content ID : [%s]", szContentID);
+ MSG_SEC_DEBUG("Content ID : [%s]", szContentID);
free(szSrc);
szSrc = NULL;
}
@@ -1635,15 +1634,15 @@ static bool __MmsBinaryDecodePartHeader(FILE *pFile, MsgType *pMsgType, int head
free(pLatinBuff);
pLatinBuff = NULL;
- MmsRemoveLessGreaterChar(szContentID, pMsgType->szContentID, sizeof(pMsgType->szContentID));//remove "< >"
+ MmsRemoveLessGreaterChar(szContentID, pMsgType->szContentID, sizeof(pMsgType->szContentID)); /* remove "< >" */
if (__MmsBinaryDecodeCheckAndDecreaseLength(&headerLen, length) == false)
goto __RETURN;
}
break;
- case 0x2E: // Content-Disposition
- case 0x45: // Content-Disposition
+ case 0x2E: /* Content-Disposition */
+ case 0x45: /* Content-Disposition */
/*
* Content-disposition-value = Value-length Disposition *(Parameter)
@@ -1674,7 +1673,7 @@ static bool __MmsBinaryDecodePartHeader(FILE *pFile, MsgType *pMsgType, int head
if (pMsgType->disposition == -1) {
MSG_DEBUG("Content-Disposition MmsGetBinaryType fail.");
- pMsgType->disposition = MSG_DISPOSITION_ATTACHMENT; // default
+ pMsgType->disposition = MSG_DISPOSITION_ATTACHMENT; /* default */
}
if (__MmsBinaryDecodeCheckAndDecreaseLength(&headerLen, 1) == false)
@@ -1725,7 +1724,7 @@ static bool __MmsBinaryDecodePartHeader(FILE *pFile, MsgType *pMsgType, int head
break;
- case 0x0B: //Content-Encoding
+ case 0x0B: /* Content-Encoding */
if (__MmsBinaryDecodeGetOneByte(pFile, &oneByte, totalLength) == false) {
MSG_DEBUG("Disposition value GetOneByte fail");
@@ -1737,7 +1736,7 @@ static bool __MmsBinaryDecodePartHeader(FILE *pFile, MsgType *pMsgType, int head
break;
- case 0x0C: //Content-Language
+ case 0x0C: /* Content-Language */
if (__MmsBinaryDecodeInteger(pFile, (UINT32*)&tmpInt, &tmpIntLen, totalLength) == true) {
if (__MmsBinaryDecodeCheckAndDecreaseLength(&headerLen, tmpIntLen) == false)
@@ -1765,7 +1764,7 @@ static bool __MmsBinaryDecodePartHeader(FILE *pFile, MsgType *pMsgType, int head
break;
- case 0x0D: //Content-Length
+ case 0x0D: /* Content-Length */
if (__MmsBinaryDecodeInteger(pFile, (UINT32*)&tmpInt, &tmpIntLen, totalLength) == false) {
MSG_DEBUG("__MmsBinaryDecodeInteger fail...");
@@ -1777,7 +1776,35 @@ static bool __MmsBinaryDecodePartHeader(FILE *pFile, MsgType *pMsgType, int head
break;
- case 0x30: //X-Wap-Content-URI skip this value
+ case 0x1C: /* Location */
+
+ pLatinBuff = (char *)calloc(1, MMS_LOCATION_URL_LEN + 1);
+ if (pLatinBuff == NULL)
+ goto __CATCH;
+
+ length = __MmsBinaryDecodeText(pFile, pLatinBuff, MMS_LOCATION_URL_LEN, totalLength);
+ if (length == -1) {
+ MSG_DEBUG("__MmsBinaryDecodeQuotedString fail.");
+ goto __CATCH;
+ }
+
+ szSrc = __MsgConvertLatin2UTF8FileName(pLatinBuff);
+ if (szSrc) {
+ snprintf(pMsgType->szLocation, sizeof(pMsgType->szLocation), "%s", szSrc);
+ MSG_INFO("Location : [%s]", pMsgType->szLocation);
+ free(szSrc);
+ szSrc = NULL;
+ }
+
+ free(pLatinBuff);
+ pLatinBuff = NULL;
+
+ if (__MmsBinaryDecodeCheckAndDecreaseLength(&headerLen, length) == false)
+ goto __RETURN;
+
+ break;
+
+ case 0x30: /* X-Wap-Content-URI skip this value */
MSG_DEBUG("X-Wap-Content-URI header.");
pLatinBuff = (char *)calloc(1, MMS_TEXT_LEN);
@@ -1802,8 +1829,8 @@ static bool __MmsBinaryDecodePartHeader(FILE *pFile, MsgType *pMsgType, int head
break;
- case 0x01: // Accept-charset
- //if (NvGetInt(NV_SI_ADM_GCF_STATE) == 1)
+ case 0x01: /* Accept-charset */
+/* if (NvGetInt(NV_SI_ADM_GCF_STATE) == 1) */
{
/* WAP-230-WSP-200010705-a.pdf
8.4.2.8 Accept charset field
@@ -1830,7 +1857,7 @@ static bool __MmsBinaryDecodePartHeader(FILE *pFile, MsgType *pMsgType, int head
}
if (__MmsBinaryDecodeInteger(pFile, (UINT32*)&charset, &charSetLen, totalLength) == false) {
- // We only support the well-known-charset format
+ /* We only support the well-known-charset format */
MSG_DEBUG("__MmsBinaryDecodeInteger fail...");
goto __CATCH;
}
@@ -1921,11 +1948,11 @@ static bool __MmsBinaryDecodePartHeader(FILE *pFile, MsgType *pMsgType, int head
}
switch (MmsGetTextType(MmsCodeMsgBodyHeaderCode, pCode)) {
- case MMS_BODYHDR_TRANSFERENCODING: // Content-Transfer-Encoding
+ case MMS_BODYHDR_TRANSFERENCODING: /* Content-Transfer-Encoding */
pMsgType->encoding = MmsGetTextType(MmsCodeContentTransferEncoding, pValue);
break;
- case MMS_BODYHDR_CONTENTID: // Content-ID
+ case MMS_BODYHDR_CONTENTID: /* Content-ID */
{
char szContentID[MMS_CONTENT_ID_LEN + 1];
@@ -1945,13 +1972,13 @@ static bool __MmsBinaryDecodePartHeader(FILE *pFile, MsgType *pMsgType, int head
goto __CATCH;
}
- MmsRemoveLessGreaterChar(szContentID, pMsgType->szContentID, sizeof(pMsgType->szContentID));//remove "< >"
+ MmsRemoveLessGreaterChar(szContentID, pMsgType->szContentID, sizeof(pMsgType->szContentID)); /* remove "< >" */
free(pLatinBuff);
pLatinBuff = NULL;
break;
}
- case MMS_BODYHDR_CONTENTLOCATION: // Content-Location
+ case MMS_BODYHDR_CONTENTLOCATION: /* Content-Location */
pLatinBuff = (char *)calloc(1, MMS_CONTENT_ID_LEN + 1);
if (pLatinBuff == NULL)
@@ -1969,11 +1996,11 @@ static bool __MmsBinaryDecodePartHeader(FILE *pFile, MsgType *pMsgType, int head
pLatinBuff = NULL;
break;
- case MMS_BODYHDR_DISPOSITION: // Content-Disposition
+ case MMS_BODYHDR_DISPOSITION: /* Content-Disposition */
pMsgType->disposition = MmsGetTextType(MmsCodeMsgDisposition, pValue);
break;
- case MMS_BODYHDR_X_OMA_DRM_SEPARATE_DELIVERY: // DRM RO WAITING
+ case MMS_BODYHDR_X_OMA_DRM_SEPARATE_DELIVERY: /* DRM RO WAITING */
break;
default:
@@ -1998,7 +2025,7 @@ static bool __MmsBinaryDecodePartHeader(FILE *pFile, MsgType *pMsgType, int head
goto __RETURN;
}
- } //while
+ } /* while */
__RETURN:
@@ -2130,7 +2157,6 @@ static bool __MmsBinaryDecodeMultipart(FILE *pFile, char *szFilePath, MsgType *p
UINT32 nEntries = 0;
MsgMultipart *pMultipart = NULL;
MsgMultipart *pLastMultipart = NULL;
-// MsgMultipart *pPreMultipart = NULL;
int offset = 0;
int index = 0;
@@ -2175,6 +2201,10 @@ static bool __MmsBinaryDecodeMultipart(FILE *pFile, char *szFilePath, MsgType *p
}
if (pMultipart->type.type == MIME_APPLICATION_SMIL) {
+ /* P151019-00477 : received mms message is type of multipart mixed, but among multiparts if there's smil part then set it multipart related */
+ if (pMsgType->type == MIME_APPLICATION_VND_WAP_MULTIPART_MIXED)
+ pMsgType->type = MIME_APPLICATION_VND_WAP_MULTIPART_RELATED;
+
factor = __MsgIsPresentationEx(&(pMultipart->type), pMsgType->param.szStart, (MimeType)pMsgType->param.type);
if (factor == MSG_PRESENTATION_NONE) {
factor = MSG_PRESENTATION_TYPE_BASE;
@@ -2183,9 +2213,9 @@ static bool __MmsBinaryDecodeMultipart(FILE *pFile, char *szFilePath, MsgType *p
factor = MSG_PRESENTATION_NONE;
}
- // priority 1 : content type match, 2: content location, 3: type
+ /* priority 1 : content type match, 2: content location, 3: type */
if (presentationInfo.factor < factor) {
- // Presentation part
+ /* Presentation part */
presentationInfo.factor = factor;
presentationInfo.pPrevPart = pLastMultipart;
presentationInfo.pCurPresentation = pMultipart;
@@ -2195,11 +2225,9 @@ static bool __MmsBinaryDecodeMultipart(FILE *pFile, char *szFilePath, MsgType *p
if (pLastMultipart == NULL) {
pMsgBody->body.pMultipart = pMultipart;
pLastMultipart = pMultipart;
-// pPreMultipart = NULL;
} else {
pLastMultipart->pNext = pMultipart;
pLastMultipart = pMultipart;
-// pPreMultipart = pMultipart;
}
pMsgType->contentSize += pMultipart->pBody->size;
@@ -2219,7 +2247,6 @@ static bool __MmsBinaryDecodeMultipart(FILE *pFile, char *szFilePath, MsgType *p
goto __CATCH;
}
-//__RETURN:
return true;
__CATCH:
@@ -2418,7 +2445,7 @@ bool __MmsBinaryDecodeGetBytes(FILE *pFile, char *szBuff, int bufLen, int totalL
szBuff[i] = gpCurMmsDecodeBuff[gCurMmsDecodeBuffPos++];
}
- gCurMmsDecodeBuffPos++; //NULL
+ gCurMmsDecodeBuffPos++; /* NULL */
return true;
@@ -2577,7 +2604,7 @@ static UINT32 __MmsHeaderDecodeIntegerByLength(FILE *pFile, UINT32 length, int t
goto __CATCH;
}
- gCurMmsDecodeBuffPos--; // - NULL
+ gCurMmsDecodeBuffPos--; /* - NULL */
for (i= 0; i < length; i++)
returner.seg[length - (i+1)] = pData[i];
@@ -2636,13 +2663,13 @@ static bool __MmsBinaryDecodeInteger(FILE *pFile, UINT32 *pInteger, int *pIntLen
}
memset(pData, 0, oneByte + 1);
- // Even NULL is copied in the _MmsBinaryDecodeGetBytes
+ /* Even NULL is copied in the _MmsBinaryDecodeGetBytes */
if (__MmsBinaryDecodeGetBytes(pFile, pData, oneByte + 1, totalLength) == false) {
MSG_DEBUG("GetBytes fail");
goto __CATCH;
}
- gCurMmsDecodeBuffPos--; // - NULL
+ gCurMmsDecodeBuffPos--; /* - NULL */
int length = 0;
if (oneByte > 4) {
@@ -2726,7 +2753,7 @@ static int __MmsDecodeValueLength(FILE *pFile, UINT32 *pValueLength, int totalLe
MSG_DEBUG(" __MmsBinaryDecodeUintvar fail..");
goto __CATCH;
}
- length ++; // + length-quote
+ length ++; /* + length-quote */
*pValueLength = uintvar;
} else {
MSG_DEBUG("not a value length type data");
@@ -2784,7 +2811,7 @@ static int __MmsDecodeValueLength2(FILE *pFile, UINT32 *pValueLength, int totalL
MSG_DEBUG("__MmsBinaryDecodeUintvar fail..");
goto __CATCH;
}
- length ++; // + length-quote
+ length ++; /* + length-quote */
*pValueLength = uintvar;
} else {
MSG_DEBUG("there is not length-quote, consider it as short length.");
@@ -2831,7 +2858,7 @@ static int __MmsBinaryDecodeQuotedString(FILE *pFile, char *szBuff, int bufLen,
goto __CATCH;
}
- length = strlen(gpCurMmsDecodeBuff) + 1; // + NULL
+ length = strlen(gpCurMmsDecodeBuff) + 1; /* + NULL */
if (length == 0)
goto __RETURN;
@@ -2888,7 +2915,7 @@ static int __MmsBinaryDecodeQuotedString(FILE *pFile, char *szBuff, int bufLen,
MSG_DEBUG("fail to load to buffer");
goto __CATCH;
}
- length = strlen(gpCurMmsDecodeBuff) + 1; // + NULL
+ length = strlen(gpCurMmsDecodeBuff) + 1; /* + NULL */
} /* while */
if (length > 0) {
@@ -2909,7 +2936,7 @@ static int __MmsBinaryDecodeQuotedString(FILE *pFile, char *szBuff, int bufLen,
strncpy(szBuff + iPos, (char*)pData + 1, readBytes - 1);
iPos += (readBytes - 1);
} else {
- strncpy(szBuff + iPos, (char*)pData, readBytes - 1); // + NULL
+ strncpy(szBuff + iPos, (char*)pData, readBytes - 1); /* + NULL */
iPos += readBytes;
}
}
@@ -2977,7 +3004,7 @@ static int __MmsBinaryDecodeText(FILE *pFile, char *szBuff, int bufLen, int tota
goto __CATCH;
}
- length = strlen(gpCurMmsDecodeBuff) + 1; // + NULL
+ length = strlen(gpCurMmsDecodeBuff) + 1; /* + NULL */
if (length == 0)
goto __RETURN;
@@ -3031,7 +3058,7 @@ static int __MmsBinaryDecodeText(FILE *pFile, char *szBuff, int bufLen, int tota
MSG_DEBUG("fail to load to buffer");
goto __CATCH;
}
- length = strlen(gpCurMmsDecodeBuff) + 1; // + NULL
+ length = strlen(gpCurMmsDecodeBuff) + 1; /* + NULL */
} /* while */
if (length > 0) {
@@ -3053,7 +3080,7 @@ static int __MmsBinaryDecodeText(FILE *pFile, char *szBuff, int bufLen, int tota
iPos += (readBytes - 1);
bQuote = true;
} else {
- strncpy(szBuff + iPos, (char*)pData, readBytes - 1); // + NULL
+ strncpy(szBuff + iPos, (char*)pData, readBytes - 1); /* + NULL */
iPos += readBytes;
}
}
@@ -3063,7 +3090,7 @@ static int __MmsBinaryDecodeText(FILE *pFile, char *szBuff, int bufLen, int tota
pData = NULL;
}
- returnLength += length; // + NULL
+ returnLength += length; /* + NULL */
}
szBuff[bufLen - 1] = '\0';
@@ -3156,7 +3183,7 @@ static char* __MmsBinaryDecodeText2(FILE *pFile, int totalLength, int *pLength)
} else {
szTempPtr = (char *)realloc(szBuff, curLen + gMmsDecodeBufLen + 1);
- //NULL pointer check for realloc
+ /* NULL pointer check for realloc */
if (szTempPtr == NULL) {
goto __CATCH;
} else {
@@ -3194,8 +3221,7 @@ static char* __MmsBinaryDecodeText2(FILE *pFile, int totalLength, int *pLength)
gpMmsDecodeBuf2,
gMmsDecodeMaxLen,
&gMmsDecodeBufLen,
- totalLength) == false)
- {
+ totalLength) == false) {
MSG_DEBUG("fail to load to buffer");
goto __CATCH;
}
@@ -3217,7 +3243,7 @@ static char* __MmsBinaryDecodeText2(FILE *pFile, int totalLength, int *pLength)
} else {
szTempPtr = (char *)realloc(szBuff, curLen + length);
- //NULL pointer check for realloc
+ /* NULL pointer check for realloc */
if (szTempPtr == NULL)
goto __CATCH;
else
@@ -3246,7 +3272,7 @@ static char* __MmsBinaryDecodeText2(FILE *pFile, int totalLength, int *pLength)
pData = NULL;
}
- *pLength += length; // + NULL
+ *pLength += length; /* + NULL */
}
return szBuff;
@@ -3394,7 +3420,7 @@ static bool __MmsBinaryDecodeEncodedString(FILE *pFile, char *szBuff, int bufLen
strncpy(szBuff, pData, bufLen - 1);
}
- {//temp brace
+ { /* temp brace */
nTemp = strlen(szBuff);
@@ -3606,7 +3632,7 @@ static int __MmsDecodeGetFilename(FILE *pFile, char *szBuff, int bufLen, int tot
textLength = 0;
pLatinBuff = __MmsBinaryDecodeText2(pFile, totalLength, &textLength);
- //remove ""
+ /* remove "" */
if (pLatinBuff) {
szSrc = MsgRemoveQuoteFromFilename(pLatinBuff);
if (szSrc) {
@@ -3628,7 +3654,7 @@ static int __MmsDecodeGetFilename(FILE *pFile, char *szBuff, int bufLen, int tot
int utf8BufSize = 0;
utf8BufSize = __MsgGetLatin2UTFCodeSize((unsigned char*)pLatinBuff, length);
if (utf8BufSize < 3)
- utf8BufSize = 3;//min value
+ utf8BufSize = 3; /* min value */
pUTF8Buff = (char *)calloc(1, utf8BufSize + 1);
if (pUTF8Buff == NULL) {
@@ -3694,7 +3720,7 @@ __CATCH:
==========================================================*/
-// to get message body this function should be modified from message raw file.
+/* 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)
{
FILE *pFile = NULL;
@@ -3753,7 +3779,7 @@ bool MmsReadMsgBody(msg_message_id_t msgID, bool bSavePartsAsTempFiles, bool bRe
memcpy(&(pMsg->msgType), &(mmsHeader.msgType), sizeof(MsgType));
memcpy(&(pMsg->msgBody), &(mmsHeader.msgBody), sizeof(MsgBody));
-{//attribute convert mmsHeader -> mmsAttribute
+{ /* attribute convert mmsHeader -> mmsAttribute */
pMsg->mmsAttrib.contentType = (MimeType)mmsHeader.msgType.type;
@@ -3789,11 +3815,11 @@ bool MmsReadMsgBody(msg_message_id_t msgID, bool bSavePartsAsTempFiles, bool bRe
pMsg->mmsAttrib.retrieveStatus = mmsHeader.retrieveStatus;
- //FIXME:: mmsHeader will release after delete global mmsHeader
- //memset(&(mmsHeader.msgBody), 0x00, sizeof(MsgBody));//After copy to MmsMsg
+ /* FIXME:: mmsHeader will release after delete global mmsHeader */
+ /* memset(&(mmsHeader.msgBody), 0x00, sizeof(MsgBody)); */ /* After copy to MmsMsg */
}
if (pMsg->msgBody.pPresentationBody) {
- if(MsgFseek(pFile, pMsg->msgBody.pPresentationBody->offset, SEEK_SET) < 0)
+ if (MsgFseek(pFile, pMsg->msgBody.pPresentationBody->offset, SEEK_SET) < 0)
goto __CATCH;
pMsg->msgBody.pPresentationBody->body.pText = (char *)calloc(1, pMsg->msgBody.pPresentationBody->size + 1);
@@ -3863,7 +3889,7 @@ bool MmsReadMsgBody(msg_message_id_t msgID, bool bSavePartsAsTempFiles, bool bRe
partIndex ++;
}
- } else { //single part
+ } else { /* single part */
if (pMsg->nPartCount > 0) {
if (bSavePartsAsTempFiles) {
@@ -4015,10 +4041,10 @@ char *MsgChangeHexString(char *pOrg)
for (cIndex = 0; cIndex< cLen ; cIndex++) {
if (pOrg[cIndex] == '%') {
- 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 (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
+ if (__MsgIsHexChar(szBuf) == true) { /* check the two character is between 0 ~ F */
OneChar = __MsgConvertHexValue(szBuf);
pNew[index] = OneChar;
@@ -4087,7 +4113,7 @@ static bool __MsgParseParameter(MsgType *pType, char *pSrc)
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);
}
@@ -4144,7 +4170,7 @@ static bool __MsgParseParameter(MsgType *pType, char *pSrc)
szSrc = NULL;
}
- // Remvoe '/', ex) Content-Type: image/gif; name="images/vf7.gif"
+ /* Remvoe '/', ex) Content-Type: image/gif; name="images/vf7.gif" */
__MsgRemoveFilePath(pType->param.szName);
} else {
MSG_SEC_DEBUG("MsgConvertLatin2UTF8FileName(%s) return NULL", pDec);
@@ -4184,7 +4210,7 @@ static bool __MsgParseParameter(MsgType *pType, char *pSrc)
szSrc = NULL;
}
- // Remvoe '/', ex) Content-Type: image/gif; name="images/vf7.gif"
+ /* Remvoe '/', ex) Content-Type: image/gif; name="images/vf7.gif" */
__MsgRemoveFilePath(pType->param.szFileName);
} else {
MSG_SEC_DEBUG("MsgConvertLatin2UTF8FileName(%s) return NULL", pDec);
@@ -4214,7 +4240,7 @@ static bool __MsgParseParameter(MsgType *pType, char *pSrc)
break;
- case MSG_PARAM_START_INFO :
+ case MSG_PARAM_START_INFO:
/* Only if content-type is multipart/related */
@@ -4225,11 +4251,11 @@ static bool __MsgParseParameter(MsgType *pType, char *pSrc)
break;
- case MSG_PARAM_REPORT_TYPE :
+ case MSG_PARAM_REPORT_TYPE:
- // only used as parameter of Content-Type: multipart/report; report-type=delivery-status;
+ /* only used as parameter of Content-Type: multipart/report; report-type=delivery-status; */
- if (pDec != NULL && strcasecmp(pDec, "delivery-status") == 0) {
+ if (strcasecmp(pDec, "delivery-status") == 0) {
pType->param.reportType = MSG_PARAM_REPORT_TYPE_DELIVERY_STATUS;
} else {
pType->param.reportType = MSG_PARAM_REPORT_TYPE_UNKNOWN;
@@ -4271,11 +4297,11 @@ static char *__MsgSkipComment (char *s,long trim)
char *s1 = s;
char *t = NULL;
- // ignore empty space
+ /* ignore empty space */
for (ret = ++s1; *ret == ' '; ret++)
;
- // handle '(', ')', '\', '\0'
+ /* handle '(', ')', '\', '\0' */
do {
switch (*s1) {
case '(':
@@ -4314,10 +4340,10 @@ __NULL_RETURN:
static char *__MsgConvertLatin2UTF8FileName(char *pSrc)
{
char *pUTF8Buff = NULL;
-// char *pData = NULL;
+/* char *pData = NULL; */
- //convert utf8 string
+ /* convert utf8 string */
if (MmsIsUtf8String((unsigned char*)pSrc, strlen(pSrc)) == false) {
int length = 0;
int utf8BufSize = 0;
@@ -4325,7 +4351,7 @@ static char *__MsgConvertLatin2UTF8FileName(char *pSrc)
length = strlen(pSrc);
utf8BufSize = __MsgGetLatin2UTFCodeSize((unsigned char*)pSrc, length);
if (utf8BufSize < 3)
- utf8BufSize = 3; //min value
+ utf8BufSize = 3; /* min value */
pUTF8Buff = (char *)calloc(1, utf8BufSize + 1);
@@ -4350,14 +4376,16 @@ static char *__MsgConvertLatin2UTF8FileName(char *pSrc)
memcpy(pUTF8Buff, pSrc, length);
}
- //convert hex string
-// if (__MsgIsPercentSign(pUTF8Buff) == true) {
-// pData = MsgChangeHexString(pUTF8Buff);
-// if (pData) {
-// free(pUTF8Buff);
-// pUTF8Buff = pData;
-// }
-// }
+ /* convert hex string */
+/*
+ if (__MsgIsPercentSign(pUTF8Buff) == true) {
+ pData = MsgChangeHexString(pUTF8Buff);
+ if (pData) {
+ free(pUTF8Buff);
+ pUTF8Buff = pData;
+ }
+ }
+*/
return pUTF8Buff;
@@ -4406,7 +4434,7 @@ static bool __MsgChangeSpace(char *pOrg, char **ppNew)
static void __MsgRemoveFilePath(char *pSrc)
{
- // Remvoe '/', ex) Content-Type: image/gif; name="images/vf7.gif"
+ /* Remvoe '/', ex) Content-Type: image/gif; name="images/vf7.gif" */
char *pTemp = NULL;
char *tmp_name = NULL;
@@ -4417,9 +4445,9 @@ static void __MsgRemoveFilePath(char *pSrc)
tmp_name = NULL;
}
- // Remove additional file information
- // ex) Content-type: application/octet-stream; name="060728gibson_210.jpg?size=s"
- // if "?size=" exist, insert NULL char.
+ /* Remove additional file information
+ * ex) Content-type: application/octet-stream; name="060728gibson_210.jpg?size=s"
+ * if "?size=" exist, insert NULL char. */
{
pTemp = strcasestr(pSrc, "?size=");
if (pTemp != NULL)
@@ -4452,7 +4480,7 @@ static MsgPresentationFactor __MsgIsPresentationEx(MsgType *multipartType, char*
char szTmpContentLO[MSG_MSG_ID_LEN + 3] = { 0, };
int strLen = 0;
- // remove '<' and '>' in Start Param : contentID ex] <0_1.jpg> or <1233445>
+ /* remove '<' and '>' in Start Param : contentID ex] <0_1.jpg> or <1233445> */
if (szStart && szStart[0]) {
int startLen = 0;
startLen = strlen(szStart);
@@ -4463,7 +4491,7 @@ static MsgPresentationFactor __MsgIsPresentationEx(MsgType *multipartType, char*
}
}
- // remove '<' and '>' in ContentID : contentID ex] <0_1.jpg> or <1233445>
+ /* remove '<' and '>' in ContentID : contentID ex] <0_1.jpg> or <1233445> */
if (multipartType->szContentID[0]) {
strLen = strlen(multipartType->szContentID);
if (multipartType->szContentID[0] == '<' && multipartType->szContentID[strLen - 1] == '>') {
@@ -4473,7 +4501,7 @@ static MsgPresentationFactor __MsgIsPresentationEx(MsgType *multipartType, char*
}
}
- // remove '<' and '>' in ContentLocation : contentID ex] <0_1.jpg> or <1233445>
+ /* remove '<' and '>' in ContentLocation : contentID ex] <0_1.jpg> or <1233445> */
if (multipartType->szContentLocation[0]) {
strLen = strlen(multipartType->szContentLocation);
if (multipartType->szContentLocation[0] == '<' && multipartType->szContentLocation[strLen - 1] == '>') {
@@ -4486,9 +4514,9 @@ static MsgPresentationFactor __MsgIsPresentationEx(MsgType *multipartType, char*
if ((szTmpContentID[0] == '\0') && (szTmpContentLO[0] == '\0') && (multipartType->type == MIME_UNKNOWN))
return MSG_PRESENTATION_NONE;
- // exception handling
+ /* exception handling */
if (szTmpStart[0] != '\0') {
- // presentation part : 1.compare with contentID 2.compare with content Location 3. compare with type
+ /* presentation part : 1.compare with contentID 2.compare with content Location 3. compare with type */
if (strcmp(szTmpStart, szTmpContentID) == 0) {
return MSG_PRESENTATION_ID;
} else if (strcmp(szTmpStart, szTmpContentLO) == 0) {
@@ -4514,9 +4542,9 @@ static void __MsgConfirmPresentationPart(MsgType *pMsgType, MsgBody *pMsgBody, M
MsgMultipart *pRemovePart = NULL;
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.
+ /* 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. */
if (pPresentationInfo->pCurPresentation == NULL) {
pPresentationInfo->pCurPresentation = pMsgBody->body.pMultipart;
pPresentationInfo->pPrevPart = NULL;
@@ -4530,9 +4558,9 @@ static void __MsgConfirmPresentationPart(MsgType *pMsgType, MsgBody *pMsgBody, M
memcpy(&pMsgBody->presentationType, &pPresentationInfo->pCurPresentation->type, sizeof(MsgType));
pMsgBody->pPresentationBody = pPresentationInfo->pCurPresentation->pBody;
- // remove pCurPresentation from multipart linked list
+ /* remove pCurPresentation from multipart linked list */
if ((pPresentationInfo->factor == MSG_PRESENTATION_NONE)||(pPresentationInfo->pPrevPart == NULL)) {
- // first part
+ /* first part */
pMsgBody->body.pMultipart = pPresentationInfo->pCurPresentation->pNext;
pMsgType->contentSize -= pPresentationInfo->pCurPresentation->pBody->size;
pMsgBody->size -= pPresentationInfo->pCurPresentation->pBody->size;
@@ -4544,7 +4572,7 @@ static void __MsgConfirmPresentationPart(MsgType *pMsgType, MsgBody *pMsgBody, M
pPresentationInfo->pCurPresentation = NULL;
}
} else {
- // not a first part
+ /* not a first part */
pPresentationInfo->pPrevPart->pNext = pPresentationInfo->pCurPresentation->pNext;
pMsgType->contentSize -= pPresentationInfo->pCurPresentation->pBody->size;
pMsgBody->size -= pPresentationInfo->pCurPresentation->pBody->size;
@@ -4558,14 +4586,14 @@ static void __MsgConfirmPresentationPart(MsgType *pMsgType, MsgBody *pMsgBody, M
* In this case, leave the Presentation part as a multipart and remove other multiparts.
*/
- // Backup the multipart link information
+ /* Backup the multipart link information */
pNextPart = pMsgBody->body.pMultipart;
- // Copy presentation part as a main part
+ /* Copy presentation part as a main part */
memcpy(pMsgType, &pPresentationInfo->pCurPresentation->type, sizeof(MsgType));
memcpy(pMsgBody, pPresentationInfo->pCurPresentation->pBody, sizeof(MsgBody));
- // Remove multipart linked list
+ /* Remove multipart linked list */
while (pNextPart) {
pRemovePart = pNextPart;
pNextPart = pNextPart->pNext;
@@ -4635,7 +4663,7 @@ static bool __MsgResolveNestedMultipart(MsgType *pPartType, MsgBody *pPartBody)
pSelectedPart = pPartBody->body.pMultipart;
- // NULL Pointer check!!
+ /* NULL Pointer check!! */
if (pSelectedPart == NULL) {
MSG_DEBUG("multipart(ALTERNATIVE) does not exist");
break;
@@ -4786,7 +4814,7 @@ static bool __MsgResolveNestedMultipart(MsgType *pPartType, MsgBody *pPartBody)
pFirstPart = pSelectedPart->pBody->body.pMultipart;
- // NULL Pointer check!!
+ /* NULL Pointer check!! */
if (pFirstPart == NULL) {
MSG_DEBUG("multipart does not exist");
break;
@@ -4865,7 +4893,7 @@ static bool __MsgResolveNestedMultipart(MsgType *pPartType, MsgBody *pPartBody)
}
} else {
if (pPrevPart == NULL) {
- // first part is selected
+ /* first part is selected */
pRemoveList = pPartBody->body.pMultipart->pNext;
} else {
pRemoveList = pPartBody->body.pMultipart->pNext;
@@ -4971,7 +4999,7 @@ __CATCH:
char *MsgRemoveQuoteFromFilename(char *pSrc)
{
- int cLen = 0; // length of pBuff
+ int cLen = 0; /* length of pBuff */
char *pBuff = NULL;
if (pSrc == NULL) {
@@ -4989,21 +5017,19 @@ char *MsgRemoveQuoteFromFilename(char *pSrc)
}
memset(pBuff, 0 , sizeof(char)*(cLen + 1));
- // remove front quote
+ /* remove front quote */
if (pSrc[0] == MSG_CH_QUOT) {
cLen--;
strncpy(pBuff, &pSrc[1], cLen);
pBuff[cLen] = '\0';
- }
-
- if (pSrc[0] == MSG_CH_LF) {
+ } else if (pSrc[0] == MSG_CH_LF) {
cLen--;
strncpy(pBuff, &pSrc[1], cLen);
} else {
strncpy(pBuff, pSrc, cLen);
}
- // remove last qoute
+ /* remove last qoute */
if (pBuff[cLen-1] == MSG_CH_QUOT) {
pBuff[cLen-1] = '\0';
}
@@ -5079,10 +5105,10 @@ static int __MsgConvertCharToInt(char ch)
static bool __MsgCopyNestedMsgType(MsgType *pMsgType1, MsgType *pMsgType2)
{
- if(!pMsgType1 || !pMsgType2)
+ if (!pMsgType1 || !pMsgType2)
return false;
- //if (pMsgType1->section == INVALID_HOBJ)
+/* if (pMsgType1->section == INVALID_HOBJ) */
pMsgType1->section = pMsgType2->section;
int length = 0;
@@ -5231,7 +5257,7 @@ static int __MsgLatin2UTF(unsigned char *des, int outBufSize, unsigned char *szS
MSG_DEBUG("---------------");
org = des;
- outBufSize--; // NULL character
+ outBufSize--; /* NULL character */
while ((nChar > 0) && (*szSrc != '\0')) {
if (0x01 <= *szSrc && *szSrc <= 0x7F) {
@@ -5253,8 +5279,8 @@ static int __MsgLatin2UTF(unsigned char *des, int outBufSize, unsigned char *szS
if (outBufSize < 0)
goto __RETURN;
- t2 = (unsigned char) (*szSrc & 0x003F); // right most 6 bit
- t1 = (unsigned char) ((*szSrc & 0xC0) >> 6); // right most 2 bit
+ t2 = (unsigned char) (*szSrc & 0x003F); /* right most 6 bit */
+ t1 = (unsigned char) ((*szSrc & 0xC0) >> 6); /* right most 2 bit */
*des = 0xC0 | (t1 & 0x1F);
*(des + 1) = 0x80 | (t2 & 0x3F);
@@ -5319,37 +5345,36 @@ bool MmsAddrUtilRemovePlmnString(char *pszAddr)
if (!pszStrEnd) {
char *pszStart = NULL;
char *pszEnd = NULL;
- // "/TYPE=PLMN" not found
+ /* "/TYPE=PLMN" not found */
int remainedLen = strlen(pszStrStart);
if (remainedLen <= 0)
break;
- //Email address can occur with Sender Name<email-address> format
- //remove the Sender name and only retain the email address.
+ /* Email address can occur with Sender Name<email-address> format */
+ /* remove the Sender name and only retain the email address. */
pszStart = strstr(pszStrStart, "<");
if (pszStart) {
pszEnd = strstr(pszStrStart, ">");
if (pszEnd) {
- pszStart++; //skip "<"
+ pszStart++; /* skip "<" */
g_strlcat(pszAddr, pszStart, pszEnd - pszStart + 1);
break;
}
}
- //strcat(pszAddr, pszStrStart);
g_strlcat(pszAddr, pszStrStart, strLen + 1);
break;
}
- // Get one address length
+ /* Get one address length */
addressLen = pszStrEnd - pszStrStart;
strncat(pszAddr, pszStrStart, addressLen);
- // Find next address
+ /* Find next address */
pszStrStart = pszStrEnd;
pszStrTemp = strstr(pszStrStart, MSG_MMS_STR_ADDR_DELIMETER);
@@ -5361,12 +5386,12 @@ bool MmsAddrUtilRemovePlmnString(char *pszAddr)
pszStrStart += strlen(pszStrEnd);
}
- if (pszStrStart[0] == 0) // end of string
+ if (pszStrStart[0] == 0) /* end of string */
break;
- g_strlcat(pszAddr, MSG_MMS_STR_ADDR_DELIMETER, strLen + 1); // add ';'
- pszStrStart++; // remove ';'
+ g_strlcat(pszAddr, MSG_MMS_STR_ADDR_DELIMETER, strLen + 1); /* add ';' */
+ pszStrStart++; /* remove ';' */
}
if (pszAddr[0] == 0)
@@ -5384,7 +5409,7 @@ static int __MsgCutUTFString(unsigned char *des, int outBufSize, unsigned char *
MSG_DEBUG("---------------");
org = des;
- outBufSize--; // NULL character
+ outBufSize--; /* NULL character */
while ((nChar > 0) && (*szSrc != '\0')) {
if (*szSrc < 0x80) {
@@ -5536,8 +5561,8 @@ static bool __MsgLoadDataToDecodeBuffer(FILE *pFile, char **ppBuf, int *pPtr, in
static bool __MmsMultipartSaveAsTempFile(MsgType *pPartType, MsgBody *pPartBody, char *pszMailboxPath, char *pszMsgFilename, int index, bool bSave)
{
FILE *pFile = NULL;
- char szFileName[MSG_FILENAME_LEN_MAX+1] = {0, }; // file name of temp file
- char szFullPath[MSG_FILEPATH_LEN_MAX] = {0, }; // full absolute path of temp file.
+ char szFileName[MSG_FILENAME_LEN_MAX+1] = {0, }; /* file name of temp file */
+ char szFullPath[MSG_FILEPATH_LEN_MAX] = {0, }; /* full absolute path of temp file. */
bool bFileExist = false;
MSG_BEGIN();
@@ -5561,15 +5586,15 @@ static bool __MmsMultipartSaveAsTempFile(MsgType *pPartType, MsgBody *pPartBody,
}
}
- // make full path for save
- __MsgMakeFileName(pPartType->type, szFileName, pPartType->drmInfo.drmType, 0, szFileName, sizeof(szFileName)); //FL & CD -> extension(.dm) SD -> extension(.dcf)
+ /* make full path for save */
+ __MsgMakeFileName(pPartType->type, szFileName, pPartType->drmInfo.drmType, 0, szFileName, sizeof(szFileName)); /* FL & CD -> extension(.dm) SD -> extension(.dcf) */
- snprintf(szFullPath, MSG_FILEPATH_LEN_MAX, "%s%s.dir/%s", pszMailboxPath, pszMsgFilename, szFileName); // get absolute path of each temp file of each part
+ snprintf(szFullPath, MSG_FILEPATH_LEN_MAX, "%s%s.dir/%s", pszMailboxPath, pszMsgFilename, szFileName); /* get absolute path of each temp file of each part */
if (pPartType->type == MIME_APPLICATION_OCTET_STREAM)
- MmsGetMimeTypeFromFileName(MIME_MAINTYPE_UNKNOWN, szFullPath, (MimeType *)&pPartType->type, NULL);
+ MsgGetMimeTypeFromFileName(MIME_MAINTYPE_UNKNOWN, szFullPath, (MimeType *)&pPartType->type, NULL);
- // save file
+ /* save file */
bFileExist = MsgAccessFile(szFullPath, F_OK);
MSG_SEC_DEBUG("save flag [%d], filepath [%s], file exist [%d]", bSave, szFullPath, bFileExist);
@@ -5591,7 +5616,7 @@ static bool __MmsMultipartSaveAsTempFile(MsgType *pPartType, MsgBody *pPartBody,
snprintf(pPartBody->szOrgFilePath, sizeof(pPartBody->szOrgFilePath), "%s", szFullPath);
- //IF DRM type Convert to dcf
+ /* IF DRM type Convert to dcf */
if (pPartType->type == MIME_APPLICATION_VND_OMA_DRM_MESSAGE
|| pPartType->type == MIME_APPLICATION_VND_OMA_DRM_CONTENT)
{
@@ -5635,7 +5660,7 @@ static bool __MmsMultipartSaveAsTempFile(MsgType *pPartType, MsgBody *pPartBody,
} else {
snprintf(pPartBody->szOrgFilePath, sizeof(pPartBody->szOrgFilePath), "%s", szFullPath);
- //IF DRM type check dcf exist
+ /* IF DRM type check dcf exist */
if (pPartType->type == MIME_APPLICATION_VND_OMA_DRM_MESSAGE
|| pPartType->type == MIME_APPLICATION_VND_OMA_DRM_CONTENT)
{
@@ -5661,9 +5686,9 @@ static bool __MmsMultipartSaveAsTempFile(MsgType *pPartType, MsgBody *pPartBody,
MSG_SEC_DEBUG("Set Part File to [%s]", pPartBody->szOrgFilePath);
}
- //file name fix
+ /* file name fix */
if (szFileName[0] != '\0') {
- snprintf(pPartType->param.szFileName, MSG_FILENAME_LEN_MAX+1, "%s.dir/%s", pszMsgFilename, szFileName);// store relative path of each temp file of each part including sub folder.
+ snprintf(pPartType->param.szFileName, MSG_FILENAME_LEN_MAX+1, "%s.dir/%s", pszMsgFilename, szFileName); /* store relative path of each temp file of each part including sub folder. */
snprintf(pPartType->param.szName, MSG_LOCALE_FILENAME_LEN_MAX+1, "%s", szFileName);
MSG_SEC_DEBUG("Set Name : %s", pPartType->param.szName);
}
@@ -5821,7 +5846,7 @@ char *__MmsGetBinaryUTF8Data(char *pData, int nRead, int msgEncodingValue, int m
*npRead = nTemp;
} else if (msgCharsetValue == MSG_CHARSET_UTF8) {
- // skip BOM (Byte Order Mark) bytes .. (Please refer to the http://www.unicode.org/faq/utf_bom.html#BOM)
+ /* skip BOM (Byte Order Mark) bytes .. (Please refer to the http://www.unicode.org/faq/utf_bom.html#BOM) */
if (nTemp >= 3) {
if (((UINT8)pTemp[0]) == 0xEF && ((UINT8)pTemp[1]) == 0xBB && ((UINT8)pTemp[2]) == 0xBF) {
pTemp += 3;
@@ -5850,7 +5875,7 @@ char *__MmsGetBinaryUTF8Data(char *pData, int nRead, int msgEncodingValue, int m
*npRead = nTemp;
}
- } else {//unsupported charset
+ } else { /* unsupported charset */
MSG_DEBUG("unsupported charset");
pNewData = pTemp;
*npRead = nTemp;
@@ -5906,12 +5931,12 @@ static bool __MsgMakeFileName(int iMsgType, char *szFileName, MsgDrmType drmType
char szTempFileName[MSG_FILENAME_LEN_MAX+1]={0,};
const char *pExt = NULL;
- SECURE_SLOGD("Input : type [0x%x], drmType [%d], filename [%s]", iMsgType, drmType, szFileName);
+ MSG_SEC_DEBUG("Input : type [0x%x], drmType [%d], filename [%s]", iMsgType, drmType, szFileName);
if (szFileName == NULL)
return false;
- //Filename
+ /* Filename */
int inp_len = strlen(szFileName);
if (inp_len > 0) {
@@ -5932,13 +5957,13 @@ static bool __MsgMakeFileName(int iMsgType, char *szFileName, MsgDrmType drmType
}
}
- //extension
+ /* extension */
if (iMsgType == MIME_APPLICATION_VND_OMA_DRM_MESSAGE)
pExt = "dm";
else if (iMsgType == MIME_APPLICATION_VND_OMA_DRM_CONTENT)
pExt = "dcf";
- if (pExt == NULL) { // find ext from content type
+ if (pExt == NULL) { /* find ext from content type */
if (iMsgType == MIME_APPLICATION_OCTET_STREAM || iMsgType == MIME_UNKNOWN) {
MSG_DEBUG("unsupported MsgType [%d]", iMsgType);
@@ -5948,7 +5973,7 @@ static bool __MsgMakeFileName(int iMsgType, char *szFileName, MsgDrmType drmType
pExt = MimeGetExtFromMimeInt((MimeType)iMsgType);
}
- //Filename + extension
+ /* Filename + extension */
if (pExt) {
snprintf(szTemp, sizeof(szTemp), "%s.%s", szTempFileName, pExt);
} else {
@@ -5957,7 +5982,7 @@ static bool __MsgMakeFileName(int iMsgType, char *szFileName, MsgDrmType drmType
}
snprintf(outBuf, outBufLen, "%s", szTemp);
- SECURE_SLOGD("Result : filename [%s]", outBuf);
+ MSG_SEC_DEBUG("Result : filename [%s]", outBuf);
return true;
__CATCH:
@@ -6100,7 +6125,7 @@ void MmsPluginDecoder::decodeMmsPdu(MmsMsg *pMsg, msg_message_id_t msgID, const
memcpy(&(pMsg->msgType), &(mmsHeader.msgType), sizeof(MsgType));
memcpy(&(pMsg->msgBody), &(mmsHeader.msgBody), sizeof(MsgBody));
-{//attribute convert mmsHeader -> mmsAttribute
+{ /* attribute convert mmsHeader -> mmsAttribute */
pMsg->mmsAttrib.contentType = (MimeType)mmsHeader.msgType.type;
@@ -6138,11 +6163,11 @@ void MmsPluginDecoder::decodeMmsPdu(MmsMsg *pMsg, msg_message_id_t msgID, const
pMsg->mmsAttrib.retrieveStatus = mmsHeader.retrieveStatus;
- //FIXME:: mmsHeader will release after delete global mmsHeader
- //memset(&(mmsHeader.msgBody), 0x00, sizeof(MsgBody));//After copy to MmsMsg
+ /* FIXME:: mmsHeader will release after delete global mmsHeader */
+ /* memset(&(mmsHeader.msgBody), 0x00, sizeof(MsgBody)); */ /* After copy to MmsMsg */
}
if (pMsg->msgBody.pPresentationBody) {
- if(MsgFseek(pFile, pMsg->msgBody.pPresentationBody->offset, SEEK_SET) < 0)
+ if (MsgFseek(pFile, pMsg->msgBody.pPresentationBody->offset, SEEK_SET) < 0)
goto __CATCH;
pMsg->msgBody.pPresentationBody->body.pText = (char *)calloc(1, pMsg->msgBody.pPresentationBody->size + 1);
@@ -6181,18 +6206,16 @@ void MmsPluginDecoder::decodeMmsPdu(MmsMsg *pMsg, msg_message_id_t msgID, const
int partIndex = 0;
pMultipart = pMsg->msgBody.body.pMultipart;
- //if (bSavePartsAsTempFiles) {
- if (mkdir(szTempMediaDir, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) < 0) {
- if (errno == EEXIST) {
- MSG_SEC_DEBUG("exist dir : [%s]", szTempMediaDir);
- } else {
- MSG_SEC_DEBUG("Fail to Create Dir [%s]", szTempMediaDir);
- goto __CATCH;
- }
+ if (mkdir(szTempMediaDir, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) < 0) {
+ if (errno == EEXIST) {
+ MSG_SEC_DEBUG("exist dir : [%s]", szTempMediaDir);
} else {
- MSG_SEC_DEBUG("make dir : [%s]", szTempMediaDir);
+ MSG_SEC_DEBUG("Fail to Create Dir [%s]", szTempMediaDir);
+ goto __CATCH;
}
- //}
+ } else {
+ MSG_SEC_DEBUG("make dir : [%s]", szTempMediaDir);
+ }
if (pMsg->msgBody.pPresentationBody) {
if (__MmsMultipartSaveAsTempFile(&pMsg->msgBody.presentationType, pMsg->msgBody.pPresentationBody,
@@ -6212,21 +6235,19 @@ void MmsPluginDecoder::decodeMmsPdu(MmsMsg *pMsg, msg_message_id_t msgID, const
partIndex ++;
}
- } else { //single part
+ } else { /* single part */
if (pMsg->nPartCount > 0) {
- //if (bSavePartsAsTempFiles) {
- if (mkdir(szTempMediaDir, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) < 0) {
- if (errno == EEXIST) {
- MSG_DEBUG("exist dir : [%s]", szTempMediaDir);
- } else {
- MSG_DEBUG("Fail to Create Dir [%s]", szTempMediaDir);
- goto __CATCH;
- }
+ if (mkdir(szTempMediaDir, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) < 0) {
+ if (errno == EEXIST) {
+ MSG_DEBUG("exist dir : [%s]", szTempMediaDir);
} else {
- MSG_DEBUG("make dir : [%s]", szTempMediaDir);
+ MSG_DEBUG("Fail to Create Dir [%s]", szTempMediaDir);
+ goto __CATCH;
}
- //}
+ } else {
+ MSG_DEBUG("make dir : [%s]", szTempMediaDir);
+ }
if (__MmsMultipartSaveAsTempFile(&pMsg->msgType, &pMsg->msgBody,
(char*)MSG_DATA_PATH, pMsg->szFileName, 0, true) == false)
@@ -6258,7 +6279,7 @@ __CATCH:
}
-//CID 41989: Removed function decodeMmsPdu which is unused.
+/* CID 41989: Removed function decodeMmsPdu which is unused. */
#if 0
void MmsPluginDecoder::decodeMmsPdu(MMS_DATA_S *pMmsData, const char *pduFilePath)
{
diff --git a/plugin/mms_plugin/MmsPluginDrm.cpp b/plugin/mms_plugin/MmsPluginDrm.cpp
index 160abdb..c71c2e4 100755
--- a/plugin/mms_plugin/MmsPluginDrm.cpp
+++ b/plugin/mms_plugin/MmsPluginDrm.cpp
@@ -24,7 +24,6 @@
#include "MsgDrmWrapper.h"
#include "MmsPluginDrm.h"
#include "MmsPluginCodec.h"
-#include "MmsPluginMIME.h"
#include "MmsPluginDebug.h"
bool MmsPluginDrmGetInfo(const char *szFilePath, MsgType *pMsgType)
diff --git a/plugin/mms_plugin/MmsPluginEncode.cpp b/plugin/mms_plugin/MmsPluginEncode.cpp
index abf59b1..b6edf29 100755
--- a/plugin/mms_plugin/MmsPluginEncode.cpp
+++ b/plugin/mms_plugin/MmsPluginEncode.cpp
@@ -22,48 +22,48 @@
#include "MsgCppTypes.h"
#include "MsgUtilFile.h"
+#include "MsgUtilMime.h"
#include "MmsPluginDebug.h"
#include "MmsPluginEncode.h"
#include "MmsPluginCodecTypes.h"
#include "MmsPluginCodecCommon.h"
-#include "MmsPluginMIME.h"
#include "MmsPluginUtil.h"
using namespace std;
/** 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;
+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;
+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;
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 __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);
@@ -73,29 +73,29 @@ static bool __MmsBinaryEncodeContentHeader(FILE *pFile, MimeType contentType, Ms
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 __MmsBinaryEncodeMsgID(FILE *pFile, const char *szMsgID); /** 2005-05-24, added for read-reply PDU 1.2 */
-static bool __MmsBinaryEncodeFrom(FILE *pFile);
-static bool __MmsBinaryEncodeTime(FILE *pFile, MmsFieldCode fieldCode, MmsTimeStruct time);
-static bool __MmsBinaryEncodeDate(FILE *pFile, time_t inpDateSec);
-static bool __MmsBinaryEncodeOneAddress(FILE *pFile, MmsFieldCode addrType, char *szAddrStr);
-static bool __MmsBinaryEncodeAddress(FILE *pFile, MmsFieldCode addrType, char *szAddr);
+static bool __MmsBinaryEncodeMmsVersion(FILE *pFile);
+static bool __MmsBinaryEncodeTrID(FILE *pFile, char *szTrID, int bufLen);
+static bool __MmsBinaryEncodeMsgID(FILE *pFile, const char *szMsgID); /** 2005-05-24, added for read-reply PDU 1.2 */
+static bool __MmsBinaryEncodeFrom(FILE *pFile);
+static bool __MmsBinaryEncodeTime(FILE *pFile, MmsFieldCode fieldCode, MmsTimeStruct time);
+static bool __MmsBinaryEncodeDate(FILE *pFile, time_t inpDateSec);
+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 __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);
-static bool __MmsBinaryEncodeMsgBody(FILE *pFile, MsgType *pType, MsgBody *pBody, int nPartCount, bool bTemplate);//NEW_TEMPLATE
+static bool __MmsBinaryEncodeMsgBody(FILE *pFile, MsgType *pType, MsgBody *pBody, int nPartCount, bool bTemplate); /* NEW_TEMPLATE */
static bool __MmsEncodeSendReq(FILE *pFile, MmsMsg *pMsg, bool bIncludeSendReqHeader);
/* 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);
+static bool __MmsBinaryEncodeTextString2(FILE *pFile, UINT8 *source, int length);
+static bool __MmsBinaryEncodeMmsVersion2(FILE *pFile);
+static bool __MmsBinaryEncodeFieldCodeAndValue2(FILE *pFile, UINT8 fieldCode, UINT8 fieldValue);
static char *_MsgSkipWS3(char *s);
@@ -103,7 +103,7 @@ static char *_MsgSkipWS3(char *s);
* M M S E N C O D E
* * -----------------------------------------------------------------*/
-static void __MmsCleanEncodeBuff(void)
+static void __MmsCleanEncodeBuff(void)
{
memset(gpMmsEncodeBuf, 0, MSG_MMS_ENCODE_BUFFER_MAX);
gCurMmsEncodeBuffPos = 0;
@@ -164,7 +164,7 @@ static bool __MmsEncodeSendReq(FILE* pFile, MmsMsg* pMsg, bool bIncludeSendReqHe
/* Functions for Acknowledge.ind & NotifyResp.ind ------------------------ */
-static void __MmsCleanEncodeBuff2(void)
+static void __MmsCleanEncodeBuff2(void)
{
memset(gpMmsEncodeBuf2, 0, MSG_MMS_ENCODE_BUFFER_MAX);
gCurMmsEncodeBuffPos2 = 0;
@@ -231,7 +231,7 @@ __CATCH:
return false;
}
-static bool __MmsBinaryEncodeFieldCodeAndValue2(FILE *pFile, UINT8 fieldCode, UINT8 fieldValue)
+static bool __MmsBinaryEncodeFieldCodeAndValue2(FILE *pFile, UINT8 fieldCode, UINT8 fieldValue)
{
if ((gMmsEncodeMaxLen2 - gCurMmsEncodeBuffPos2) < 2) {
if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf2, &gCurMmsEncodeBuffPos2,
@@ -543,14 +543,14 @@ bool MmsEncodeReadReport10(FILE *pFile, MmsMsg *pMsg, msg_read_report_status_t m
time(&RawTime);
localtime_r(&RawTime, &dateTime);
- // get report message
+ /* get report message */
if (mmsReadStatus == MSG_READ_REPORT_IS_DELETED) {
pszReportMsg = (char*)"Your message has been deleted " ;
} else {
pszReportMsg = (char*)"Your message has been read " ;
}
- // make report body ..
+ /* make report body .. */
maxLen = strlen (pszReportMsg) +16 /* date string */ + 8 /* enter chars */ ;
if (maxLen > MSG_STDSTR_LONG) {
@@ -560,12 +560,12 @@ bool MmsEncodeReadReport10(FILE *pFile, MmsMsg *pMsg, msg_read_report_status_t m
pszReportMsg, dateTime.tm_year+1900, dateTime.tm_mon+1, dateTime.tm_mday, dateTime.tm_hour, dateTime.tm_min);
}
- // make header
+ /* make header */
msgType.type = MIME_APPLICATION_VND_WAP_MULTIPART_MIXED;
msgType.contentSize = strlen(pText);
msgType.param.charset = MSG_CHARSET_UNKNOWN;
- // make body
+ /* make body */
if ((pPart = MmsAllocMultipart()) == NULL) {
MSG_DEBUG("MsgAllocMultipart Fail");
goto __CATCH;
@@ -795,7 +795,8 @@ static bool __MmsBinaryEncodeSendReqHdr(FILE *pFile, MmsMsg *pMsg)
/* MMS-1.3-con-733 */
/* Expiry Time : Value-length Absolute-token Date-value */
- if (pMsg->mmsAttrib.expiryTime.type != MMS_TIMETYPE_NONE) { // for avoiding the creation of the expiry field in case the user selects the maximum
+ if (pMsg->mmsAttrib.expiryTime.type != MMS_TIMETYPE_NONE) {
+ /* for avoiding the creation of the expiry field in case the user selects the maximum */
if (__MmsBinaryEncodeTime(pFile, MMS_CODE_EXPIRYTIME, pMsg->mmsAttrib.expiryTime) == false) {
MSG_DEBUG("expiryTime __MmsBinaryEncodeTime fail");
goto __CATCH;
@@ -875,7 +876,7 @@ static bool __MmsBinaryEncodeSendReqHdr(FILE *pFile, MmsMsg *pMsg)
if ((pMsg->mmsAttrib.replyCharge.chargeType == MMS_REPLY_REQUESTED) ||
(pMsg->mmsAttrib.replyCharge.chargeType == MMS_REPLY_REQUESTED_TEXT_ONLY)) {
- // reply charging
+ /* reply charging */
fieldCode = MmsGetBinaryValue(MmsCodeFieldCode, MMS_CODE_REPLYCHARGING)|0x80;
fieldValue = MmsGetBinaryValue(MmsCodeReadReply, pMsg->mmsAttrib.replyCharge.chargeType)|0x80;
@@ -1394,7 +1395,7 @@ static int __MmsBinaryEncodeContentTypeLen(MsgType *pType)
}
totalLength += (length + 1);
} else {
- if (MmsIsTextType(contentType)) { // Any-charset
+ if (MmsIsTextType(contentType)) { /* Any-charset */
if (!MmsIsVitemContent (contentType, pType->param.szName))
totalLength += 2;
}
@@ -1414,27 +1415,29 @@ static int __MmsBinaryEncodeContentTypeLen(MsgType *pType)
pszName = g_strdup(pType->param.szName);
- //change empty space to '_' in the file name
- MmsReplaceSpaceChar(pszName);
+ if (pszName) {
+ /* change empty space to '_' in the file name */
+ MmsReplaceSpaceChar(pszName);
- if (isAscii == false) {
- if (MsgEncode2Base64(pszName, strlen(pszName), &tmpLength, tmpFileName) == true) {
- g_free(pszName);
- pszName = g_strdup_printf("=?UTF-8?B?%s?=", tmpFileName);
- MSG_DEBUG("base64 encode filename=[%s]", pszName);
+ if (isAscii == false) {
+ if (MsgEncode2Base64(pszName, strlen(pszName), &tmpLength, tmpFileName) == true) {
+ g_free(pszName);
+ pszName = g_strdup_printf("=?UTF-8?B?%s?=", tmpFileName);
+ MSG_DEBUG("base64 encode filename=[%s]", pszName);
+ }
}
- }
- length = __MmsBinaryEncodeTextStringLen((UINT8*)pszName);
+ length = __MmsBinaryEncodeTextStringLen((UINT8*)pszName);
- if (length == -1) {
- MSG_DEBUG("szName MmsBinaryEncodeIntegerLen fail");
- goto __CATCH;
- }
+ if (length == -1) {
+ MSG_DEBUG("szName MmsBinaryEncodeIntegerLen fail");
+ goto __CATCH;
+ }
- g_free(pszName);
+ g_free(pszName);
- totalLength += (length + 1);
+ totalLength += (length + 1);
+ }
}
#ifdef FEATURE_JAVA_MMS
@@ -1606,7 +1609,7 @@ static bool __MmsBinaryEncodeContentType(FILE *pFile, MsgType *pType, int typeLe
pszName = g_strdup(pType->param.szName);
- //change empty space to '_' in the file name
+ /* change empty space to '_' in the file name */
MmsReplaceSpaceChar(pszName);
gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = MmsGetBinaryValue(MmsCodeParameterCode, MSG_PARAM_NAME) | 0x80;
@@ -1717,7 +1720,7 @@ static bool __MmsBinaryEncodeContentType(FILE *pFile, MsgType *pType, int typeLe
if (MmsIsTextType(contentType)) {
if (!MmsIsVitemContent (contentType, pType->param.szName)) {
gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = MmsGetBinaryValue(MmsCodeParameterCode, MSG_PARAM_CHARSET) | 0x80;
- fieldValue = 0x0000; //laconic_warning, just to remove warning message
+ fieldValue = 0x0000; /* laconic_warning, just to remove warning message */
gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = (UINT8)fieldValue | 0x80;
}
}
@@ -1847,12 +1850,12 @@ static bool __MmsBinaryEncodeMsgPart(FILE *pFile, int contentType, MsgType *pTyp
goto __CATCH;
}
pType->offset = __MmsGetEncodeOffset();
- if(MsgWriteFile(pData, sizeof(char), nRead, pFile) != (size_t)nRead) {
+ if (MsgWriteFile(pData, sizeof(char), nRead, pFile) != (size_t)nRead) {
MSG_DEBUG("MsgWriteFile failed");
goto __CATCH;
}
gMmsEncodeCurOffset = MsgFtell(pFile);
- if(gMmsEncodeCurOffset < 0) {
+ if (gMmsEncodeCurOffset < 0) {
MSG_DEBUG("MsgFtell returns negative value [%ld]", gMmsEncodeCurOffset);
goto __CATCH;
}
@@ -1963,7 +1966,7 @@ static int __MmsBinaryEncodeContentHeaderLen(MimeType contentType, MsgType *pTyp
/* content-id ------------------------------------------------- */
if (pType->szContentID[0]) {
- if (bMultipart) { //Binary Encoding
+ if (bMultipart) { /* Binary Encoding */
totalLength++;
} else {
/* content-id = Quoted-string */
@@ -1986,7 +1989,7 @@ static int __MmsBinaryEncodeContentHeaderLen(MimeType contentType, MsgType *pTyp
if (pType->szContentLocation[0]) {
- if (bMultipart) { //Binary Encoding
+ if (bMultipart) { /* Binary Encoding */
totalLength++;
} else {
/* content-location = Quoted-string */
@@ -2023,7 +2026,7 @@ static int __MmsBinaryEncodeContentHeaderLen(MimeType contentType, MsgType *pTyp
* Inline = <Octet 130> : 0x82
*/
- if (bMultipart) { //Binary Encoding
+ if (bMultipart) { /* Binary Encoding */
totalLength += 3;
} else {
/* content-disposition = Quoted-string */
@@ -2059,13 +2062,16 @@ static bool __MmsBinaryEncodeContentHeader(FILE *pFile, MimeType contentType, Ms
{
int length = 0;
const char *szTextValue = NULL;
+ bool isAscii = true;
+ unsigned long tmpLength = 0;
+ unsigned char tmpFileName[MSG_LOCALE_FILENAME_LEN_MAX+1];
/* content-id ------------------------------------------------- */
if (pType->szContentID[0]) {
MSG_SEC_DEBUG("Content ID : %s", pType->szContentID);
- if (bMultipart) { //Binary Encoding
+ if (bMultipart) { /* Binary Encoding */
gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = MmsGetBinaryValue(MmsCodeMsgBodyHeaderCode, MMS_BODYHDR_CONTENTID) | 0x80;
} else {
/* content-id = Quoted-string */
@@ -2094,10 +2100,16 @@ static bool __MmsBinaryEncodeContentHeader(FILE *pFile, MimeType contentType, Ms
}
if (pType->szContentLocation[0]) {
-
MSG_SEC_DEBUG("Content Location : %s", pType->szContentLocation);
- if (bMultipart) { //Binary Encoding
+ if (MmsIsAsciiString (pType->szContentLocation)) {
+ MSG_DEBUG("Name is consisted of ascii char-set chars.");
+ } else {
+ isAscii = false;
+ MSG_DEBUG("Name is NOT consisted of ascii char-set chars.");
+ }
+
+ if (bMultipart) { /* Binary Encoding */
gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = MmsGetBinaryValue(MmsCodeMsgBodyHeaderCode, MMS_BODYHDR_CONTENTLOCATION) | 0x80;
} else {
/* content-location = Quoted-string */
@@ -2113,16 +2125,31 @@ static bool __MmsBinaryEncodeContentHeader(FILE *pFile, MimeType contentType, Ms
}
}
- length = __MmsBinaryEncodeTextStringLen((UINT8*)pType->szContentLocation);
+ char* pszName = g_strdup(pType->szContentLocation);
+ MmsReplaceSpaceChar(pszName);
+
+ if (isAscii == false) {
+ if (MsgEncode2Base64(pszName, strlen(pszName), &tmpLength, tmpFileName) == true) {
+ g_free(pszName);
+ pszName = g_strdup_printf("=?UTF-8?B?%s?=", tmpFileName);
+ MSG_DEBUG("base64 encode filename=[%s]", pszName);
+ }
+ }
+
+ length = __MmsBinaryEncodeTextStringLen((UINT8*)pszName);
if (length == -1) {
MSG_DEBUG("pType->szContentLocation MmsBinaryEncodeTextStringLen fail.");
+ g_free(pszName);
goto __CATCH;
}
- if (__MmsBinaryEncodeTextString(pFile, (UINT8*)pType->szContentLocation, length) == false) {
+ if (__MmsBinaryEncodeTextString(pFile, (UINT8*)pszName, length) == false) {
MSG_DEBUG("pType->szContentLocation MmsBinaryEncodeTextString fail.");
+ g_free(pszName);
goto __CATCH;
}
+
+ g_free(pszName);
}
/* MIME_APPLICATION_VND_WAP_MULTIPART_RELATED requires always "inline" */
@@ -2140,7 +2167,7 @@ static bool __MmsBinaryEncodeContentHeader(FILE *pFile, MimeType contentType, Ms
* Inline = <Octet 130> : 0x82
*/
- if (bMultipart) {//Binary Encoding
+ if (bMultipart) { /* Binary Encoding */
UINT8 fieldValue = 0xff;
gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = MmsGetBinaryValue(MmsCodeMsgBodyHeaderCode, MMS_BODYHDR_DISPOSITION) | 0x80;
@@ -2208,7 +2235,7 @@ static bool __MmsBinaryEncodeContentBody(FILE *pFile, MsgBody *pBody)
goto __CATCH;
pBody->offset = __MmsGetEncodeOffset();
- if(MsgWriteFile(pData, sizeof(char), nRead, pFile) != (size_t)nRead) {
+ if (MsgWriteFile(pData, sizeof(char), nRead, pFile) != (size_t)nRead) {
MSG_DEBUG("MsgWriteFile failed");
goto __CATCH;
}
@@ -2231,7 +2258,7 @@ static bool __MmsBinaryEncodeContentBody(FILE *pFile, MsgBody *pBody)
}
gMmsEncodeCurOffset = MsgFtell(pFile);
- if(gMmsEncodeCurOffset < 0) {
+ if (gMmsEncodeCurOffset < 0) {
MSG_DEBUG("MsgFtell returns negative value [%ld]", gMmsEncodeCurOffset);
goto __CATCH;
}
@@ -2272,7 +2299,7 @@ static int __MmsBinaryEncodeIntegerLen(UINT32 integer)
integer = (integer >> 8);
}
- length++; // + Short-length
+ length++; /* + Short-length */
return length;
}
@@ -2314,7 +2341,7 @@ static bool __MmsBinaryEncodeInteger(FILE *pFile, UINT32 integer, int length)
* The Short-length indicates the length of the Multi-octet-integer
*/
changer.integer = integer;
- length--; // - "Short-length"
+ length--; /* - "Short-length" */
gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = (UINT8)length;
@@ -2348,7 +2375,7 @@ static int __MmsBinaryEncodeLongIntegerLen(UINT32 integer)
integer = (integer >> 8);
}
- length++; // + Short-length
+ length++; /* + Short-length */
return length;
}
@@ -2386,7 +2413,7 @@ static bool __MmsBinaryEncodeLongInteger(FILE *pFile, UINT32 integer, int length
}
changer.integer = integer;
- length--; // - "Short-length"
+ length--; /* - "Short-length" */
gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = (UINT8)length;
@@ -2412,9 +2439,9 @@ static int __MmsBinaryEncodeTextStringLen(UINT8 *source)
length = (int)strlen((char*)source);
if (source[0] > 0x7F) {
- length += 2; // + NULL
+ length += 2; /* + NULL */
} else {
- length++; // + NULL
+ length++; /* + NULL */
}
return length;
@@ -2455,8 +2482,8 @@ static bool __MmsBinaryEncodeTextString(FILE *pFile, UINT8 *source, int length)
length--;
}
- strncpy(gpMmsEncodeBuf + gCurMmsEncodeBuffPos, (char*)source, (length - 1)); // except NULL
- gCurMmsEncodeBuffPos += (length - 1); // except NULL
+ strncpy(gpMmsEncodeBuf + gCurMmsEncodeBuffPos, (char*)source, (length - 1)); /* except NULL */
+ gCurMmsEncodeBuffPos += (length - 1); /* except NULL */
gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = (UINT8)NULL;
return true;
@@ -2471,9 +2498,9 @@ __CATCH:
* @param interger [in] integer to be encoded
* @return encoded UINTVAR stream
*/
-const UINT32 UINTVAR_LENGTH_1 = 0x0000007f; //7bit
-const UINT32 UINTVAR_LENGTH_2 = 0x00003fff; //14bit
-const UINT32 UINTVAR_LENGTH_3 = 0x001fffff; //21bit
+const UINT32 UINTVAR_LENGTH_1 = 0x0000007f; /* 7bit */
+const UINT32 UINTVAR_LENGTH_2 = 0x00003fff; /* 14bit */
+const UINT32 UINTVAR_LENGTH_3 = 0x001fffff; /* 21bit */
static int __MmsBinaryEncodeUintvarLen(UINT32 integer)
@@ -2530,7 +2557,7 @@ static bool __MmsBinaryEncodeUintvar(FILE *pFile, UINT32 integer, int length)
szReverse[0] = source.bytes[0];
szReverse[0] = szReverse[0] & 0x7f;
- while (length >= i) { // initially, i = 2
+ while (length >= i) { /* initially, i = 2 */
/* Move integer bit to proper position */
source.integer = source.integer << 1;
source.integer = source.integer >> 8;
@@ -2558,7 +2585,7 @@ static int __MmsBinaryEncodeValueLengthLen(UINT32 integer)
if (integer < 0x1f) {
length = 1;
} else {
- length = __MmsBinaryEncodeUintvarLen(integer) + 1; //LENGTH_QUOTE
+ length = __MmsBinaryEncodeUintvarLen(integer) + 1; /* LENGTH_QUOTE */
}
return length;
@@ -2597,7 +2624,7 @@ static bool __MmsBinaryEncodeValueLength(FILE *pFile, UINT32 integer, int 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("MmsBinaryEncodeUintvar fail");
goto __CATCH;
}
@@ -2616,7 +2643,7 @@ static int __MmsBinaryEncodeQuotedStringLen(UINT8 *pSrc)
goto __CATCH;
}
- return (strlen((char*)pSrc) + 2); // QUOTE + NULL
+ return (strlen((char*)pSrc) + 2); /* QUOTE + NULL */
__CATCH:
return -1;
@@ -2647,7 +2674,7 @@ static bool __MmsBinaryEncodeQuotedString(FILE *pFile, UINT8 *source, int length
}
gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = '\"';
- strncpy(gpMmsEncodeBuf + gCurMmsEncodeBuffPos, (char*)source, length - 2); // except '\"' & NULL
+ strncpy(gpMmsEncodeBuf + gCurMmsEncodeBuffPos, (char*)source, length - 2); /* except '\"' & NULL */
gCurMmsEncodeBuffPos += (length - 2);
gpMmsEncodeBuf[gCurMmsEncodeBuffPos++] = (UINT8)NULL;
@@ -2659,7 +2686,7 @@ __CATCH:
static int __MmsBinaryEncodeEncodedStringLen(UINT8 *source)
{
- UINT32 charset = 0x6A; // default = utf-8
+ UINT32 charset = 0x6A; /* default = utf-8 */
int charLeng = 0;
int textLeng = 0;
int valueLengthLen = 0;
@@ -2698,7 +2725,7 @@ __CATCH:
*/
static bool __MmsBinaryEncodeEncodedString(FILE *pFile, UINT8 *source, int length)
{
- UINT32 charset = 0x6A; // default = utf-8
+ UINT32 charset = 0x6A; /* default = utf-8 */
int charLeng = 0;
int textLeng = 0;
int valLengthLen = 0;
@@ -2766,7 +2793,7 @@ __CATCH:
return false;
}
-static bool __MmsBinaryEncodeFieldCodeAndValue(FILE *pFile, UINT8 fieldCode, UINT8 fieldValue)
+static bool __MmsBinaryEncodeFieldCodeAndValue(FILE *pFile, UINT8 fieldCode, UINT8 fieldValue)
{
if ((gMmsEncodeMaxLen - gCurMmsEncodeBuffPos) < 2) {
if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos,
@@ -2953,7 +2980,7 @@ static bool __MmsBinaryEncodeDate(FILE *pFile, time_t inpDateSec)
int length = 0;
length = __MmsBinaryEncodeLongIntegerLen(dateSec);
- if ((gMmsEncodeMaxLen - gCurMmsEncodeBuffPos) < (length + 1)) { // + fieldCode
+ if ((gMmsEncodeMaxLen - gCurMmsEncodeBuffPos) < (length + 1)) { /* + fieldCode */
if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos,
gMmsEncodeMaxLen, &gMmsEncodeCurOffset) == false) {
MSG_DEBUG("MsgWriteDataFromEncodeBuffer fail");
@@ -3128,13 +3155,13 @@ static bool __MmsBinaryEncodeTime(FILE *pFile, MmsFieldCode fieldCode, MmsTimeSt
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("MmsBinaryEncodeValueLengthLen fail");
goto __CATCH;
}
- if ((gMmsEncodeMaxLen - gCurMmsEncodeBuffPos) < (length + timeLen + 2)) { // + fieldCode + timeType
+ if ((gMmsEncodeMaxLen - gCurMmsEncodeBuffPos) < (length + timeLen + 2)) { /* + fieldCode + timeType */
if (MsgWriteDataFromEncodeBuffer(pFile, gpMmsEncodeBuf, &gCurMmsEncodeBuffPos,
gMmsEncodeMaxLen, &gMmsEncodeCurOffset) == false) {
@@ -3229,7 +3256,7 @@ static bool __EncodeMmsMessage(MmsMsg *pMmsMsg, const char *raw_filepath)
break;
}
- MsgFsync(pFile); //file is written to device immediately, it prevents missing file data from unexpected power off
+ MsgFsync(pFile); /* file is written to device immediately, it prevents missing file data from unexpected power off */
MsgCloseFile(pFile);
return true;
diff --git a/plugin/mms_plugin/MmsPluginEventHandler.cpp b/plugin/mms_plugin/MmsPluginEventHandler.cpp
index 15c4490..0a4893d 100755
--- a/plugin/mms_plugin/MmsPluginEventHandler.cpp
+++ b/plugin/mms_plugin/MmsPluginEventHandler.cpp
@@ -16,15 +16,27 @@
#include <stdio.h>
#include <stdlib.h>
+#include <ITapiCall.h>
+#include <ITapiNetwork.h>
+#include <tapi_common.h>
#include "MmsPluginTypes.h"
#include "MmsPluginDebug.h"
#include "MmsPluginEventHandler.h"
#include "MmsPluginInternal.h"
+#include "MsgGconfWrapper.h"
/*==================================================================================================
IMPLEMENTATION OF MmsPluginEventHandler - Member Functions
==================================================================================================*/
+
+typedef struct {
+ int count;
+ TapiHandle *handle[MAX_TELEPHONY_HANDLE_CNT]; /* max is 3 */
+} SMS_TELEPHONY_HANDLE_LIST_S;
+
+SMS_TELEPHONY_HANDLE_LIST_S handle_list;
+
MmsPluginEventHandler *MmsPluginEventHandler::pInstance = NULL;
@@ -54,25 +66,84 @@ void MmsPluginEventHandler::registerListener(MSG_PLUGIN_LISTENER_S *pListener)
listener = *pListener;
}
+int MmsPluginEventHandler::initTelHandle()
+{
+ int cnt = 0;
+ memset(&handle_list, 0x00, sizeof(handle_list));
+
+ char **cp_list = NULL;
+ cp_list = tel_get_cp_name_list();
+
+ if (!cp_list) {
+ MSG_FATAL("tel_get_cp_name_list returns null");
+ goto FINISH;
+ }
+
+ while (cp_list[cnt] && cnt < MAX_TELEPHONY_HANDLE_CNT) {
+ MSG_SEC_INFO("cp_list[%d]:[%s]", cnt, cp_list[cnt]);
+ handle_list.handle[cnt]= tel_init(cp_list[cnt]);
+ cnt++;
+ }
+
+ g_strfreev(cp_list);
+ cp_list = NULL;
+
+FINISH:
+ handle_list.count = cnt;
+ return cnt;
+}
+
+void MmsPluginEventHandler::deinitTelHandle()
+{
+ int ret = 0;
+
+ for (int i = 0; i < handle_list.count; i++) {
+ ret = tel_deinit(handle_list.handle[i]);
+ MSG_DEBUG("tel_deinit ret=[%d]", ret);
+ handle_list.handle[i] = NULL;
+ }
+
+ handle_list.count = 0;
+ return;
+}
+
+TapiHandle *MmsPluginEventHandler::getTelHandle(int sim_idx)
+{
+ if (sim_idx > 0 && sim_idx < MAX_TELEPHONY_HANDLE_CNT) {
+ return handle_list.handle[sim_idx-1];
+ } else {
+ int SIM_Status = 0;
+ SIM_Status = MsgSettingGetInt(VCONFKEY_TELEPHONY_SIM_SLOT);
+ if (SIM_Status == 1) {
+ return handle_list.handle[0];
+ }
+
+ SIM_Status = MsgSettingGetInt(VCONFKEY_TELEPHONY_SIM_SLOT2);
+ if (SIM_Status == 1) {
+ return handle_list.handle[1];
+ }
+ }
+
+ return handle_list.handle[handle_list.count - 1];
+}
void MmsPluginEventHandler::handleMmsReceivedData(mmsTranQEntity *pRequest, char *pRetrievedFilePath)
{
MSG_MESSAGE_INFO_S msgInfo = {0,};
switch (pRequest->eMmsPduType) {
- // received data is send-conf
+ /* received data is send-conf */
case eMMS_SEND_CONF:
MmsPluginInternal::instance()->processSendConf(&msgInfo, pRequest);
- // callback to MSG FW
+ /* callback to MSG FW */
listener.pfMmsConfIncomingCb(&msgInfo, &pRequest->reqID);
- //MsgDeleteFile(pRetrievedFilePath + strlen(MSG_DATA_PATH)); // not ipc
if (remove(pRetrievedFilePath) != 0)
MSG_DEBUG("remove fail");
break;
- // received data is retrieve-conf
+ /* received data is retrieve-conf */
case eMMS_RETRIEVE_AUTO_CONF:
case eMMS_RETRIEVE_MANUAL_CONF:
MSG_ADDRESS_INFO_S addrInfo;
@@ -81,7 +152,7 @@ void MmsPluginEventHandler::handleMmsReceivedData(mmsTranQEntity *pRequest, char
MmsPluginInternal::instance()->processRetrieveConf(&msgInfo, pRequest, pRetrievedFilePath);
- // callback to MSG FW
+ /* callback to MSG FW */
listener.pfMmsConfIncomingCb(&msgInfo, &pRequest->reqID);
break;
@@ -114,12 +185,13 @@ void MmsPluginEventHandler::handleMmsError(mmsTranQEntity *pRequest)
curTime = time(NULL);
msgInfo.displayTime = curTime;
+ msgInfo.sim_idx = pRequest->simId;
switch (pRequest->eMmsPduType) {
case eMMS_SEND_REQ:
case eMMS_SEND_CONF:
msgInfo.msgId = pRequest->msgId;
- //Set only changed members
+ /* Set only changed members */
msgInfo.msgType.mainType = MSG_MMS_TYPE;
if (pRequest->eMmsPduType == eMMS_SEND_REQ)
@@ -131,41 +203,70 @@ void MmsPluginEventHandler::handleMmsError(mmsTranQEntity *pRequest)
msgInfo.folderId = MSG_OUTBOX_ID;
- listener.pfMmsConfIncomingCb(&msgInfo, &pRequest->reqID);
break;
case eMMS_RETRIEVE_AUTO:
case eMMS_RETRIEVE_AUTO_CONF:
msgInfo.msgId = pRequest->msgId;
- //Set only changed members
+ /* Set only changed members */
msgInfo.msgType.mainType = MSG_MMS_TYPE;
msgInfo.msgType.subType = MSG_RETRIEVE_AUTOCONF_MMS;
msgInfo.networkStatus = MSG_NETWORK_RETRIEVE_FAIL;
msgInfo.folderId = MSG_INBOX_ID;
- err = listener.pfMmsConfIncomingCb(&msgInfo, &pRequest->reqID);
-
break;
case eMMS_RETRIEVE_MANUAL:
case eMMS_RETRIEVE_MANUAL_CONF:
msgInfo.msgId = pRequest->msgId;
- //Set only changed members
+ /* Set only changed members */
msgInfo.msgType.mainType = MSG_MMS_TYPE;
msgInfo.msgType.subType = MSG_RETRIEVE_MANUALCONF_MMS;
msgInfo.networkStatus = MSG_NETWORK_RETRIEVE_FAIL;
msgInfo.folderId = MSG_INBOX_ID;
- err = listener.pfMmsConfIncomingCb(&msgInfo, &pRequest->reqID);
-
break;
default:
- break;
+ MSG_WARN("No matching MMS pdu type [%d]", pRequest->eMmsPduType);
+ return;
}
+ int dnet_state = 0;
+ if (msgInfo.sim_idx == 1)
+ dnet_state = MsgSettingGetInt(VCONFKEY_DNET_STATE);
+ else if (msgInfo.sim_idx == 2)
+ dnet_state = MsgSettingGetInt(VCONFKEY_DNET_STATE2);
+
+ int net_cell_type = 0;
+
+ initTelHandle();
+
+ TapiHandle *handle = getTelHandle(msgInfo.sim_idx);
+ tel_get_property_int(handle, TAPI_PROP_NETWORK_SERVICE_TYPE, &net_cell_type);
+
+ deinitTelHandle();
+
+ bool data_enable = FALSE;
+ int call_status = MsgSettingGetInt(MSG_MESSAGE_DURING_CALL);
+
+ MsgSettingGetBool(VCONFKEY_3G_ENABLE, &data_enable);
+
+ MSG_INFO("Call[%d], Data[%d], SubType[%d]", call_status, data_enable, msgInfo.msgType.subType);
+ MSG_INFO("sim_idx[%d], dnet_state[%d], net_cell_type[%d]", msgInfo.sim_idx, dnet_state, net_cell_type);
+
+ if (pRequest->eMmsTransactionStatus == eMMS_CM_DISCONNECTED || ((call_status || net_cell_type <= TAPI_NETWORK_SERVICE_TYPE_SEARCH || dnet_state <= VCONFKEY_DNET_OFF) && data_enable)) {
+ MSG_INFO("MMS network status goes to pending for subtype [%d]", msgInfo.msgType.subType);
+ if (msgInfo.msgType.subType == MSG_RETRIEVE_AUTOCONF_MMS || msgInfo.msgType.subType == MSG_RETRIEVE_MANUALCONF_MMS)
+ msgInfo.networkStatus = MSG_NETWORK_RETRIEVE_PENDING;
+ else if (msgInfo.msgType.subType == MSG_SENDREQ_MMS)
+ msgInfo.networkStatus = MSG_NETWORK_SEND_PENDING;
+ }
+
+ err = listener.pfMmsConfIncomingCb(&msgInfo, &pRequest->reqID);
+
MSG_DEBUG("Error value of MsgMmsConfIncomingListner [%d]", err);
MSG_END();
diff --git a/plugin/mms_plugin/MmsPluginHttp.cpp b/plugin/mms_plugin/MmsPluginHttp.cpp
index 9eb8398..73c03e2 100755
--- a/plugin/mms_plugin/MmsPluginHttp.cpp
+++ b/plugin/mms_plugin/MmsPluginHttp.cpp
@@ -34,15 +34,10 @@ static void __httpGetHost(char *szUrl, char *szHost, int nBufferLen);
/*==================================================================================================
FUNCTION IMPLEMENTATION
==================================================================================================*/
-//static int __http_progress_cb(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow)
-//{
-// MSG_INFO("download(%.0f/%.0f) : upload(%.0f/%.0f)", dlnow, dltotal, ulnow, ultotal);
-// return 0;
-//}
static int __http_debug_cb (CURL *input_curl, curl_infotype input_info_type, char *input_data , size_t input_size, void *input_void)
{
- MSG_INFO("curl_infotype [%d] : %s", input_info_type, input_data);
+ MSG_SEC_INFO("curl_infotype [%d] : %s", input_info_type, input_data);
return 0;
}
@@ -68,15 +63,15 @@ static void __http_print_profile(CURL *curl)
MSG_DEBUG("**************************************************************************************************");
- //time
+ /* time */
curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME, &total_time);
MSG_SEC_INFO("profile http Time: total %.3f seconds", total_time);
- //url
+ /* url */
curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_URL, &url);
MSG_SEC_INFO("profile http Url: %s", url);
- //size
+ /* size */
curl_easy_getinfo(curl, CURLINFO_SIZE_UPLOAD, &size_up);
MSG_SEC_INFO("profile http Size: upload %.3f bytes", size_up);
@@ -89,14 +84,14 @@ static void __http_print_profile(CURL *curl)
curl_easy_getinfo(curl, CURLINFO_REQUEST_SIZE, &size);
MSG_SEC_INFO("profile http Size: request %ld bytes", size);
- //speed
+ /* speed */
curl_easy_getinfo(curl, CURLINFO_SPEED_UPLOAD, &speed_upload);
MSG_SEC_INFO("profile http Speed: upload %.3f bytes/sec", speed_upload);
curl_easy_getinfo(curl, CURLINFO_SPEED_DOWNLOAD, &speed_download);
MSG_SEC_INFO("profile http Speed: download %.3f bytes/sec", speed_download);
- //content
+ /* content */
curl_easy_getinfo(curl, CURLINFO_CONTENT_TYPE, &content_type);
MSG_SEC_INFO("profile http Content: type %s", content_type);
@@ -106,7 +101,7 @@ static void __http_print_profile(CURL *curl)
curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_UPLOAD, &content_length);
MSG_SEC_INFO("profile http Content: length upload %.3f", content_length);
- //ip & port
+ /* ip & port */
curl_easy_getinfo(curl, CURLINFO_PRIMARY_IP, &ip);
MSG_SEC_INFO("profile http primary: ip %s", ip);
@@ -205,7 +200,7 @@ static void __httpAllocHeaderInfo(curl_slist **responseHeaders, char *szUrl, int
nResult = __httpGetHeaderField(MMS_HH_UA_PROFILE, szBuffer);
if (nResult) {
snprintf(pcheader, HTTP_REQUEST_LEN, "X-wap-profile: %s", szBuffer);
- MSG_INFO("%s", pcheader);
+ MSG_SEC_INFO("%s", pcheader);
*responseHeaders = curl_slist_append(*responseHeaders, pcheader);
}
@@ -214,10 +209,10 @@ static void __httpAllocHeaderInfo(curl_slist **responseHeaders, char *szUrl, int
memset(pcheader, 0, HTTP_REQUEST_LEN);
nResult = __httpGetHeaderField(MMS_HH_MDN, szBuffer);
- // TODO : if it needs to check http header mdn value, add code to below.
+ /* TODO : if it needs to check http header mdn value, add code to below. */
#endif
- if (ulContentLen > 0)//if post transaction then Disable 'Expect: 100-contine' option
+ if (ulContentLen > 0) /* if post transaction then Disable 'Expect: 100-contine' option */
*responseHeaders = curl_slist_append(*responseHeaders, "Expect:");
}
@@ -240,7 +235,11 @@ static bool __httpGetHeaderField(MMS_HTTP_HEADER_FIELD_T httpHeaderItem, char *s
case MMS_HH_ACCEPT_CHARSET:
snprintf((char *)szHeaderBuffer, 1024, "%s", MSG_MMS_HH_CHARSET);
+#if defined(FEATURE_SMS_CDMA)
+ result = false;
+#else
result = true;
+#endif
break;
case MMS_HH_ACCEPT_LANGUAGE:
@@ -253,8 +252,7 @@ static bool __httpGetHeaderField(MMS_HTTP_HEADER_FIELD_T httpHeaderItem, char *s
result = true;
break;
- case MMS_HH_USER_AGENT:
- {
+ case MMS_HH_USER_AGENT: {
#if 0
char szUserAgent[1024 + 1];
char *uagent = NULL;
@@ -282,8 +280,7 @@ static bool __httpGetHeaderField(MMS_HTTP_HEADER_FIELD_T httpHeaderItem, char *s
}
break;
- case MMS_HH_UA_PROFILE:
- {
+ case MMS_HH_UA_PROFILE: {
char *szUAProfile = MsgSettingGetString(MSG_MMS_UA_PROFILE);
snprintf((char *)szHeaderBuffer, 1024, "%s", szUAProfile);
@@ -296,22 +293,22 @@ static bool __httpGetHeaderField(MMS_HTTP_HEADER_FIELD_T httpHeaderItem, char *s
break;
#if defined(FEATURE_SMS_CDMA)
- case MMS_HH_MDN:
-// {
-// char *mdn = MsgSettingGetString(MSG_SIM_MSISDN);
-//
-// if (mdn != NULL && strlen(mdn) > 0) {
-// result = true;
-// snprintf((char *)szHeaderBuffer, 1024, "%s", mdn);
-// } else {
-// result = false;
-// }
-// if (mdn) {
-// free(mdn);
-// mdn = NULL;
-// }
-// }
+ case MMS_HH_MDN: {
+/*
+ char *mdn = MsgSettingGetString(MSG_SIM_MSISDN);
+ if (mdn != NULL && strlen(mdn) > 0) {
+ result = true;
+ snprintf((char *)szHeaderBuffer, 1024, "%s", mdn);
+ } else {
+ result = false;
+ }
+ if (mdn) {
+ free(mdn);
+ mdn = NULL;
+ }
break;
+*/
+ }
#endif
default:
MSG_WARN("invalid param [%d]", httpHeaderItem);
@@ -335,34 +332,34 @@ static void __httpGetHost(char *szUrl, char *szHost, int nBufferLen)
char *startPtr = szUrl;
char *movePtr = NULL;
- MSG_DEBUG("startPtr(%s)", startPtr);
+ MSG_SEC_DEBUG("startPtr(%s)", startPtr);
if (strncasecmp(startPtr, prefixString, prefixLength) == 0) {
- MSG_DEBUG("(%s) exist", prefixString);
+ MSG_SEC_DEBUG("(%s) exist", prefixString);
startPtr += prefixLength;
movePtr = startPtr;
movePtr = strpbrk(movePtr, delim);
- MSG_DEBUG("strpbrk --> movePtr(%s)", movePtr);
+ MSG_SEC_DEBUG("strpbrk --> movePtr(%s)", movePtr);
if (movePtr == NULL) {
strncpy(szHost, startPtr, nBufferLen);
- MSG_DEBUG("szHost(%s)", szHost);
+ MSG_SEC_DEBUG("szHost(%s)", szHost);
} else {
int nCopyLen = movePtr - startPtr;
strncpy(szHost, startPtr, nCopyLen);
- MSG_DEBUG("szHost(%s)", szHost);
+ MSG_SEC_DEBUG("szHost(%s)", szHost);
}
} else {
- MSG_DEBUG("(%s) not exist", prefixString);
+ MSG_SEC_DEBUG("(%s) not exist", prefixString);
movePtr = startPtr;
movePtr = strpbrk(movePtr, delim);
- MSG_DEBUG("strpbrk --> movePtr(%s)", movePtr);
+ MSG_SEC_DEBUG("strpbrk --> movePtr(%s)", movePtr);
if (movePtr == NULL) {
strncpy(szHost, startPtr, nBufferLen);
- MSG_DEBUG("szHost(%s)", szHost);
+ MSG_SEC_DEBUG("szHost(%s)", szHost);
} else {
int nCopyLen = movePtr - startPtr;
strncpy(szHost, startPtr, nCopyLen);
- MSG_DEBUG("szHost(%s)", szHost);
+ MSG_SEC_DEBUG("szHost(%s)", szHost);
}
}
}
@@ -394,54 +391,35 @@ static int __http_multi_perform(void *session)
MSG_INFO("curl_multi_perform first end : rcm = %d, still_running = %d", rcm, still_running);
do {
+ int retval;
struct timeval timeout;
- int rc; /* select() return code */
- fd_set fdread;
- fd_set fdwrite;
- fd_set fdexcep;
- int maxfd = -1;
+ int max_fd = -1;
+ fd_set fd_r;
+ fd_set fd_w;
+ fd_set fd_excp;
-// long curl_timeo = -1;
+ FD_ZERO(&fd_r);
+ FD_ZERO(&fd_w);
+ FD_ZERO(&fd_excp);
- FD_ZERO(&fdread);
- FD_ZERO(&fdwrite);
- FD_ZERO(&fdexcep);
-
- /* set a suitable timeout to play around with */
timeout.tv_sec = 120;
timeout.tv_usec = 0;
-// curl_multi_timeout(multi_handle, &curl_timeo);
-// if(curl_timeo >= 0) {
-// MSG_DEBUG("curl_timeo = %ld", curl_timeo);
-// timeout.tv_sec = curl_timeo / 1000;
-// if(timeout.tv_sec > 1)
-// timeout.tv_sec = 1;
-// else
-// timeout.tv_usec = (curl_timeo % 1000) * 1000;
-// }
-
- curl_multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd);
-
- /* In a real-world program you OF COURSE check the return code of the
- function calls. On success, the value of maxfd is guaranteed to be
- greater or equal than -1. We call select(maxfd + 1, ...), specially in
- case of (maxfd == -1), we call select(0, ...), which is basically equal
- to sleep. */
+ curl_multi_fdset(multi_handle, &fd_r, &fd_w, &fd_excp, &max_fd);
- rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout);
+ retval = select(max_fd+1, &fd_r, &fd_w, &fd_excp, &timeout);
- if (rc == -1){/* select error */
+ if (retval == -1){ /* select error */
MSG_ERR("select error");
ret = -1;
break;
- } else if (rc == 0){ /* timeout */
+ } else if (retval == 0){ /* timeout */
MSG_ERR("time out");
ret = -1;
break;
- } else {/* action */
- MSG_DEBUG("rc = %d", rc);
+ } else { /* action */
+ MSG_DEBUG("retval = %d", retval);
rcm = curl_multi_perform(multi_handle, &still_running);
}
@@ -453,7 +431,7 @@ static int __http_multi_perform(void *session)
MSG_INFO("curl_multi_perform end : rcm = %d, still_running = %d, cm_open = %d", rcm, still_running, connection_open_flag);
- } while(still_running && (connection_open_flag == true));
+ } while (still_running && (connection_open_flag == true));
while ((msg = curl_multi_info_read(multi_handle, &msgs_left))) {
if (msg->msg == CURLMSG_DONE) {
@@ -583,7 +561,7 @@ MMS_HTTP_ERROR_E MmsPluginHttpAgent::setSession(http_request_info_s &request_inf
int content_len = 0;
char *url = NULL;
- // Verify request info
+ /* Verify request info */
if (request_info.transaction_type != MMS_HTTP_TRANSACTION_TYPE_GET
&& request_info.transaction_type != MMS_HTTP_TRANSACTION_TYPE_POST)
{
@@ -607,14 +585,14 @@ MMS_HTTP_ERROR_E MmsPluginHttpAgent::setSession(http_request_info_s &request_inf
goto __CATCH;
}
- //Set type
+ /* Set type */
this->transaction_type = request_info.transaction_type;
MSG_DEBUG("set transaction type [%d]", this->transaction_type);
- //Set http Headers
+ /* Set http Headers */
if (this->transaction_type == MMS_HTTP_TRANSACTION_TYPE_POST) {
content_len = request_info.post_data_len;
- } else { //MMS_HTTP_TRANSACTION_TYPE_GET
+ } else { /* MMS_HTTP_TRANSACTION_TYPE_GET */
content_len = 0;
}
@@ -636,7 +614,7 @@ MMS_HTTP_ERROR_E MmsPluginHttpAgent::setSession(http_request_info_s &request_inf
}
- //Set curl option
+ /* Set curl option */
session_option = curl_easy_init();
if (session_option == NULL) {
MSG_ERR("curl_easy_init() failed");
@@ -651,7 +629,6 @@ MMS_HTTP_ERROR_E MmsPluginHttpAgent::setSession(http_request_info_s &request_inf
curl_easy_setopt(session_option, CURLOPT_HTTPHEADER, session_header);
curl_easy_setopt(session_option, CURLOPT_DEBUGFUNCTION , __http_debug_cb);
curl_easy_setopt(session_option, CURLOPT_INTERFACE, request_info.interface);
- //curl_easy_setopt(httpConfigData.session, CURLOPT_PROGRESSFUNCTION, __http_progress_cb); //for debug
if (respfile) {
curl_easy_setopt(session_option, CURLOPT_WRITEFUNCTION, __http_write_response_cb);
@@ -662,14 +639,14 @@ MMS_HTTP_ERROR_E MmsPluginHttpAgent::setSession(http_request_info_s &request_inf
curl_easy_setopt(session_option, CURLOPT_POST, true);
curl_easy_setopt(session_option, CURLOPT_POSTFIELDS, request_info.post_data);
curl_easy_setopt(session_option, CURLOPT_POSTFIELDSIZE, request_info.post_data_len);
- // curl_easy_setopt(session_option, CURLOPT_TCP_NODELAY, 1);
+/* curl_easy_setopt(session_option, CURLOPT_TCP_NODELAY, 1); */
}
MSG_END();
return http_error;
__CATCH:
- //CID 338211: freeing url (with check) in case of error
+ /* CID 338211: freeing url (with check) in case of error */
if (url) {
free(url);
url = NULL;
@@ -709,14 +686,14 @@ MMS_HTTP_ERROR_E MmsPluginHttpAgent::httpRequest(http_request_info_s &request_in
respfile = fopen(conf_filename, "wb");
- //set session
+ /* set session */
http_error = this->setSession(request_info);
if (http_error != MMS_HTTP_ERROR_NONE) {
MSG_ERR("Fail to setSession");
goto __CATCH;
}
- //transaction
+ /* transaction */
http_error = this->startTransaction();
if (http_error != MMS_HTTP_ERROR_NONE) {
@@ -724,7 +701,7 @@ MMS_HTTP_ERROR_E MmsPluginHttpAgent::httpRequest(http_request_info_s &request_in
goto __CATCH;
}
- //close conf file & load response data
+ /* close conf file & load response data */
if (respfile) {
fclose(respfile);
diff --git a/plugin/mms_plugin/MmsPluginInternal.cpp b/plugin/mms_plugin/MmsPluginInternal.cpp
index 4d4cb87..e704e72 100755
--- a/plugin/mms_plugin/MmsPluginInternal.cpp
+++ b/plugin/mms_plugin/MmsPluginInternal.cpp
@@ -27,6 +27,7 @@
#include "MsgStorageHandler.h"
#include "MsgSerialize.h"
#include "MsgSpamFilter.h"
+#include "MsgUtilMime.h"
#include "MmsPluginDebug.h"
#include "MmsPluginTypes.h"
@@ -34,7 +35,6 @@
#include "MmsPluginInternal.h"
#include "MmsPluginStorage.h"
#include "MmsPluginAppBase.h"
-#include "MmsPluginMIME.h"
/*==================================================================================================
IMPLEMENTATION OF MmsPluginInternal - Member Functions
@@ -70,12 +70,12 @@ void MmsPluginInternal::processReceivedInd(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQ
if (pMsgInfo->bTextSms == true) {
char fullPath[MAX_FULL_PATH_SIZE+1] = {0,};
- if(MsgCreateFileName(fileName) == false)
+ if (MsgCreateFileName(fileName) == false)
THROW(MsgException::FILE_ERROR, "MsgCreateFileName error");
MSG_SEC_DEBUG("File name = %s", fileName);
- if(MsgWriteIpcFile(fileName, pMsgInfo->msgText, pMsgInfo->dataSize) == false)
+ if (MsgWriteIpcFile(fileName, pMsgInfo->msgText, pMsgInfo->dataSize) == false)
THROW(MsgException::FILE_ERROR, "MsgWriteIpcFile error");
snprintf(fullPath, MAX_FULL_PATH_SIZE+1, "%s%s", MSG_IPC_DATA_PATH, fileName);
@@ -93,7 +93,7 @@ void MmsPluginInternal::processReceivedInd(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQ
if ((pFile = MsgOpenFile(pMsgInfo->msgData, "rb+")) == NULL) {
MSG_DEBUG("File Open Error: %s", pMsgInfo->msgData);
} else {
- //Decode Header
+ /* Decode Header */
if (!MmsBinaryDecodeMsgHeader(pFile, pMsgInfo->dataSize))
MSG_DEBUG("Decoding Header Failed \r\n");
@@ -105,7 +105,7 @@ void MmsPluginInternal::processReceivedInd(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQ
switch (mmsHeader.type) {
case MMS_MSGTYPE_NOTIFICATION_IND:
MSG_DEBUG("process noti.ind\n");
- // For Set Value pMsgInfo
+ /* For Set Value pMsgInfo */
if (processNotiInd(pMsgInfo, pRequest) == false)
*bReject = true;
else
@@ -114,7 +114,7 @@ void MmsPluginInternal::processReceivedInd(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQ
case MMS_MSGTYPE_DELIVERY_IND:
MSG_DEBUG("process delivery.ind\n");
- // For Set Value pMsgInfo
+ /* For Set Value pMsgInfo */
processDeliveryInd(pMsgInfo);
break;
@@ -149,14 +149,16 @@ bool MmsPluginInternal::processNotiInd(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQUEST
MSG_DEBUG("pMsgInfo->subject [%s]", pMsgInfo->subject);
+#if 0 // P150826-01612, P150910-05427 : we do not need to add empty subject text any more.
if (strlen(pMsgInfo->subject) < 1)
snprintf(pMsgInfo->subject, MAX_SUBJECT_LEN, "MMS Notification Message.");
+#endif
attrib.expiryTime = mmsHeader.expiryTime;
if (mmsHeader.pFrom) {
MmsAddrUtilRemovePlmnString(mmsHeader.pFrom->szAddr);
- // From
+ /* From */
strncpy(pMsgInfo->addressList[0].addressVal, mmsHeader.pFrom->szAddr, MAX_ADDRESS_VAL_LEN);
if (MmsAddrUtilCheckEmailAddress(pMsgInfo->addressList[0].addressVal)) {
pMsgInfo->addressList[0].addressType = MSG_ADDRESS_TYPE_EMAIL;
@@ -164,7 +166,8 @@ bool MmsPluginInternal::processNotiInd(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQUEST
}
MMS_DATA_S *mms_data = MsgMmsCreate();
- if (mms_data == NULL) return false;
+ if (mms_data == NULL)
+ return false;
{
mms_data->header = MsgMmsCreateHeader();
@@ -181,24 +184,24 @@ bool MmsPluginInternal::processNotiInd(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQUEST
pHeader->mmsVersion = mmsHeader.version;
- //From
+ /* From */
if (mmsHeader.pFrom) {
MmsAddrUtilRemovePlmnString(mmsHeader.pFrom->szAddr);
snprintf(pHeader->szFrom, sizeof(pHeader->szFrom), "%s", mmsHeader.pFrom->szAddr);
}
- //Subject
+ /* Subject */
snprintf(pHeader->szSubject, sizeof(pHeader->szSubject), "%s", mmsHeader.szSubject);
- //Delivery Report
+ /* Delivery Report */
pHeader->bDeliveryReport = (mmsHeader.deliveryReport != MMS_REPORT_YES);
- //Message Class
+ /* Message Class */
pHeader->messageClass = mmsHeader.msgClass;
- //Priority
+ /* Priority */
pHeader->mmsPriority = mmsHeader.priority;
- //Message Size : pMmsMsg->mmsAttrib.msgSize = mmsHeader.msgSize;
- //Expiry
+ /* Message Size : pMmsMsg->mmsAttrib.msgSize = mmsHeader.msgSize; */
+ /* Expiry */
pHeader->expiry.type = mmsHeader.expiryTime.type;
pHeader->expiry.time = mmsHeader.expiryTime.time;
@@ -209,9 +212,9 @@ bool MmsPluginInternal::processNotiInd(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQUEST
pHeader->expiry.time += curTime;
}
- //Charge
- //contentclass
- //int contentClass;//text | image-basic| image-rich | video-basic | video-rich | megapixel | content-basic | content-rich
+ /* Charge */
+ /* contentclass */
+ /* int contentClass;//text | image-basic| image-rich | video-basic | video-rich | megapixel | content-basic | content-rich */
strncpy(pHeader->contentLocation, mmsHeader.szContentLocation, MMS_LOCATION_LEN);
pHeader->messageSize = mmsHeader.msgSize;
@@ -230,11 +233,11 @@ bool MmsPluginInternal::processNotiInd(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQUEST
if (MsgCreateFileName(pTempFileName) == true) {
pMsgInfo->bTextSms = false;
- snprintf(pTempFilePath, sizeof(pTempFilePath), MSG_IPC_DATA_PATH"%s", pTempFileName);
+ snprintf(pTempFilePath, sizeof(pTempFilePath), "%s%s", MSG_IPC_DATA_PATH, pTempFileName);
MsgOpenCreateAndOverwriteFile(pTempFilePath, pSerializedMms, serializeDataSize);
- //set file name
+ /* set file name */
snprintf(pMsgInfo->msgData, sizeof(pMsgInfo->msgData), "%s", pTempFileName);
}
@@ -243,7 +246,7 @@ bool MmsPluginInternal::processNotiInd(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQUEST
}
MsgMmsRelease(&mms_data);
- // Check contents-location is in noti.ind
+ /* Check contents-location is in noti.ind */
if (mmsHeader.szContentLocation[0] == '\0') {
THROW(MsgException::INCOMING_MSG_ERROR, "######## Contents-location is empty in MMS-Noti-Ind #######");
return false;
@@ -266,7 +269,7 @@ bool MmsPluginInternal::processNotiInd(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQUEST
return false;
}
- if (MsgCheckFilter(dbHandle, pMsgInfo)){
+ if (MsgCheckFilter(dbHandle, pMsgInfo)) {
encodeNotifyRespInd(mmsHeader.szTrID, MSG_DELIVERY_REPORT_DEFERRED, bReportAllowed, pPduFilePath);
pMsgInfo->dataSize = strlen(pPduFilePath);
@@ -276,7 +279,7 @@ bool MmsPluginInternal::processNotiInd(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQUEST
memcpy(&pRequest->msgInfo, pMsgInfo, sizeof(MSG_MESSAGE_INFO_S));
snprintf(pRequest->msgInfo.msgData, sizeof(pRequest->msgInfo.msgData), "%s", pPduFilePath);
- MSG_DEBUG("pRequest->msgInfo.msgData = %s", pRequest->msgInfo.msgData);
+ MSG_SEC_DEBUG("pRequest->msgInfo.msgData = %s", pRequest->msgInfo.msgData);
pRequest->msgInfo.msgType.subType = MSG_NOTIFYRESPIND_MMS;
pRequest->msgInfo.folderId = MSG_SPAMBOX_ID;
@@ -292,7 +295,7 @@ bool MmsPluginInternal::processNotiInd(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQUEST
if (retrieveType == MSG_ABROAD_RESTRICTED) {
MSG_DEBUG("MMS Receiving Setting Restricted was selected.");
- // m-notify-resp-ind encoding process
+ /* m-notify-resp-ind encoding process */
encodeNotifyRespInd(mmsHeader.szTrID, MSG_DELIVERY_REPORT_DEFERRED, bReportAllowed, pPduFilePath);
pMsgInfo->dataSize = strlen(pPduFilePath);
@@ -309,10 +312,10 @@ bool MmsPluginInternal::processNotiInd(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQUEST
}
}
- // should send http 'GET'
+ /* should send http 'GET' */
if (retrieveType == MSG_HOME_AUTO_DOWNLOAD || retrieveType == MSG_ABROAD_AUTO_DOWNLOAD) {
- //Check if current request sim index is different from default network SIM
- //Convert auto-retrieve to manual retrieve in case sim indexes are different
+ /* Check if current request sim index is different from default network SIM */
+ /* Convert auto-retrieve to manual retrieve in case sim indexes are different */
int default_sim = 0;
default_sim = MsgSettingGetInt(MSG_NETWORK_SIM);
@@ -333,6 +336,9 @@ bool MmsPluginInternal::processNotiInd(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQUEST
MSG_SEC_DEBUG("MSG SUBTYPE = %d msg data %s bTextsms %d", pRequest->msgInfo.msgType.subType, pRequest->msgInfo.msgData, pRequest->msgInfo.bTextSms);
} else {
+ /* should send m-notify-resp-ind */
+ MSG_DEBUG("=========== START MANUAL RETRIEVE MODE ===========");
+ /* m-notify-resp-ind encoding process */
encodeNotifyRespInd(mmsHeader.szTrID, MSG_DELIVERY_REPORT_DEFERRED, bReportAllowed, pPduFilePath);
pMsgInfo->dataSize = strlen(pPduFilePath);
@@ -343,12 +349,13 @@ bool MmsPluginInternal::processNotiInd(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQUEST
snprintf(pRequest->msgInfo.msgData, sizeof(pRequest->msgInfo.msgData), "%s", pPduFilePath);
MSG_SEC_DEBUG("pRequest->msgInfo.msgData = %s", pRequest->msgInfo.msgData);
+ snprintf(pRequest->msgInfo.msgURL, sizeof(pRequest->msgInfo.msgURL), "%s", mmsHeader.szContentLocation);
pRequest->msgInfo.msgType.subType = MSG_NOTIFYRESPIND_MMS;
}
} else {
- // should send m-notify-resp-ind
+ /* should send m-notify-resp-ind */
MSG_DEBUG("=========== START MANUAL RETRIEVE MODE ===========");
- // m-notify-resp-ind encoding process
+ /* m-notify-resp-ind encoding process */
if (retrieveType == MSG_HOME_MANUAL || retrieveType == MSG_ABROAD_MANUAL) {
encodeNotifyRespInd(mmsHeader.szTrID, MSG_DELIVERY_REPORT_DEFERRED, bReportAllowed, pPduFilePath);
@@ -361,7 +368,8 @@ bool MmsPluginInternal::processNotiInd(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_REQUEST
memcpy(&pRequest->msgInfo, pMsgInfo, sizeof(MSG_MESSAGE_INFO_S));
snprintf(pRequest->msgInfo.msgData, sizeof(pRequest->msgInfo.msgData), "%s", pPduFilePath);
- MSG_DEBUG("pRequest->msgInfo.msgData = %s", pRequest->msgInfo.msgData);
+ MSG_SEC_DEBUG("pRequest->msgInfo.msgData = %s", pRequest->msgInfo.msgData);
+ snprintf(pRequest->msgInfo.msgURL, sizeof(pRequest->msgInfo.msgURL), "%s", mmsHeader.szContentLocation);
pRequest->msgInfo.msgType.subType = MSG_NOTIFYRESPIND_MMS;
}
@@ -381,7 +389,7 @@ void MmsPluginInternal::processDeliveryInd(MSG_MESSAGE_INFO_S *pMsgInfo)
status.bDeliveyrReportIsLast= true;
MmsAddrUtilRemovePlmnString(mmsHeader.pTo->szAddr);
- MSG_DEBUG("[INFO] [ADDR: %s, MMSID: %s]",mmsHeader.pTo->szAddr, mmsHeader.szMsgID);
+ MSG_SEC_DEBUG("[INFO] [ADDR: %s, MMSID: %s]",mmsHeader.pTo->szAddr, mmsHeader.szMsgID);
pMsgInfo->msgType.mainType = MSG_MMS_TYPE;
pMsgInfo->msgType.subType = MSG_DELIVERYIND_MMS;
@@ -399,7 +407,7 @@ void MmsPluginInternal::processDeliveryInd(MSG_MESSAGE_INFO_S *pMsgInfo)
if (tmpId > 0) {
MSG_DEBUG("Found MSG_ID = %d", tmpId);
- //Insert to Delievery DB
+ /* Insert to Delievery DB */
MmsPluginStorage::instance()->insertDeliveryReport(tmpId, mmsHeader.pTo->szAddr, &status);
pMsgInfo->msgId = (msg_message_id_t)tmpId;
@@ -433,7 +441,7 @@ void MmsPluginInternal::processReadOrgInd(MSG_MESSAGE_INFO_S *pMsgInfo)
strncpy(pMsgInfo->msgData, getMmsReadStatus(mmsHeader.readStatus), MAX_MSG_DATA_LEN);
pMsgInfo->dataSize = strlen(pMsgInfo->msgData);
- MSG_DEBUG("read Status = %s", pMsgInfo->msgData);
+ MSG_SEC_DEBUG("read Status = %s", pMsgInfo->msgData);
strncpy(pMsgInfo->addressList[0].addressVal, mmsHeader.pFrom->szAddr, MAX_ADDRESS_VAL_LEN);
int tmpId = MmsPluginStorage::instance()->searchMsgId(mmsHeader.pFrom->szAddr, mmsHeader.szMsgID);
@@ -462,7 +470,7 @@ void MmsPluginInternal::processSendConf(MSG_MESSAGE_INFO_S *pMsgInfo, mmsTranQEn
pMsgInfo->msgId = pRequest->msgId;
- //Set only changed members
+ /* Set only changed members */
pMsgInfo->msgType.mainType = MSG_MMS_TYPE;
pMsgInfo->msgType.subType = MSG_SENDCONF_MMS;
@@ -486,12 +494,15 @@ void MmsPluginInternal::processSendConf(MSG_MESSAGE_INFO_S *pMsgInfo, mmsTranQEn
}
MSG_ADDRESS_INFO_S addressinfo = {0,};
- char *msisdn = NULL;
- msisdn = MsgSettingGetString(MSG_SIM_MSISDN);
+ char keyName[MAX_VCONFKEY_NAME_LEN];
+ memset(keyName, 0x00, sizeof(keyName));
+
+ snprintf(keyName, sizeof(keyName), "%s/%d", MSG_SIM_MSISDN, pMsgInfo->sim_idx);
+ char *msisdn = MsgSettingGetString(keyName);
MmsPluginStorage::instance()->getAddressInfo(pMsgInfo->msgId, &addressinfo);
- MSG_MMS_VLD_INFO("%d, MMS Send End %s->%s %s", pMsgInfo->msgId
+ MSG_SEC_DEBUG("%d, MMS Send End %s->%s %s", pMsgInfo->msgId
, (msisdn == NULL)?"ME":msisdn
, addressinfo.addressVal
, (pMsgInfo->networkStatus == MSG_NETWORK_SEND_SUCCESS)?"Success":"Fail");
@@ -501,7 +512,7 @@ void MmsPluginInternal::processSendConf(MSG_MESSAGE_INFO_S *pMsgInfo, mmsTranQEn
msisdn = NULL;
}
- // set message-id from mmsc
+ /* set message-id from mmsc */
strncpy(recvData.szMsgID, mmsHeader.szMsgID, MMS_MSG_ID_LEN);
strncpy(recvData.szTrID, mmsHeader.szTrID, MMS_TR_ID_LEN);
@@ -538,7 +549,7 @@ void MmsPluginInternal::processRetrieveConf(MSG_MESSAGE_INFO_S *pMsgInfo, mmsTra
attrib.bAskDeliveryReport = getMmsReport(mmsHeader.deliveryReport);
attrib.bAskReadReply = getMmsReport(mmsHeader.readReply);
- //Set only changed members
+ /* Set only changed members */
pMsgInfo->msgId = pRequest->msgId;
MSG_DEBUG("@@@@@ msgId = %d @@@@@", pMsgInfo->msgId);
pMsgInfo->msgType.mainType = MSG_MMS_TYPE;
@@ -563,18 +574,21 @@ void MmsPluginInternal::processRetrieveConf(MSG_MESSAGE_INFO_S *pMsgInfo, mmsTra
} else {
pMsgInfo->networkStatus = MSG_NETWORK_RETRIEVE_FAIL;
pMsgInfo->folderId = MSG_INBOX_ID;
- // If failed MMS Retrieve, then saved as MMS Noti Ind Message.
- // It will changed in MsgHandleMmsConfIncomingMsg
- //pMsgInfo->msgType.subType = MSG_NOTIFICATIONIND_MMS;
+ /* If failed MMS Retrieve, then saved as MMS Noti Ind Message.
+ * It will changed in MsgHandleMmsConfIncomingMsg */
+/* pMsgInfo->msgType.subType = MSG_NOTIFICATIONIND_MMS; */
}
- char *msisdn = NULL;
- msisdn = MsgSettingGetString(MSG_SIM_MSISDN);
+ char keyName[MAX_VCONFKEY_NAME_LEN];
+ memset(keyName, 0x00, sizeof(keyName));
+
+ snprintf(keyName, sizeof(keyName), "%s/%d", MSG_SIM_MSISDN, pMsgInfo->sim_idx);
+ char *msisdn = MsgSettingGetString(keyName);
if (mmsHeader.pFrom)
MmsAddrUtilRemovePlmnString(mmsHeader.pFrom->szAddr);
- MSG_MMS_VLD_INFO("%d, MMS Receive %s End %s->%s %s", pMsgInfo->msgId
+ MSG_SEC_DEBUG("%d, MMS Receive %s End %s->%s %s", pMsgInfo->msgId
, (pRequest->eMmsPduType == eMMS_RETRIEVE_AUTO_CONF)?"Auto":"Manual"
, (mmsHeader.pFrom)?mmsHeader.pFrom->szAddr:"YOU"
, (msisdn == NULL)?"ME":msisdn
@@ -594,7 +608,7 @@ void MmsPluginInternal::processRetrieveConf(MSG_MESSAGE_INFO_S *pMsgInfo, mmsTra
pMsgInfo->dataSize = pRequest->getDataLen;
- // set message-id & MMS TPDU file path
+ /* set message-id & MMS TPDU file path */
snprintf(recvData.szMsgID, sizeof(recvData.szMsgID), "%s", mmsHeader.szMsgID);
if (pRetrievedFilePath)
@@ -626,10 +640,10 @@ void MmsPluginInternal::processRetrieveConf(MSG_MESSAGE_INFO_S *pMsgInfo, mmsTra
#endif
memcpy(pMsgInfo->msgData, &recvData, sizeof(MMS_RECV_DATA_S));
- MSG_DEBUG("@@@@@ MsgData = %s @@@@@", pMsgInfo->msgData);
- MSG_DEBUG("@@@@@ retrievedFilePath = %s @@@@@", recvData.retrievedFilePath);
+ MSG_SEC_DEBUG("@@@@@ MsgData = %s @@@@@", pMsgInfo->msgData);
+ MSG_SEC_DEBUG("@@@@@ retrievedFilePath = %s @@@@@", recvData.retrievedFilePath);
MSG_DEBUG("@@@@@ szMsgID = %s @@@@@", recvData.szMsgID);
- //update delivery report, read reply
+ /* update delivery report, read reply */
MmsPluginStorage *pStorage = MmsPluginStorage::instance();
@@ -637,7 +651,7 @@ void MmsPluginInternal::processRetrieveConf(MSG_MESSAGE_INFO_S *pMsgInfo, mmsTra
MSG_DEBUG("Error value of updateMmsAttrib [%d]", err);
- {//make MmsData & insert multipart
+ { /* make MmsData & insert multipart */
MmsMsg *pMmsMsg = NULL;
MmsPluginStorage::instance()->getMmsMessage(&pMmsMsg);
@@ -650,11 +664,12 @@ void MmsPluginInternal::processRetrieveConf(MSG_MESSAGE_INFO_S *pMsgInfo, mmsTra
pMmsData->header = MsgMmsCreateHeader();
MmsConvertMmsData(pMmsMsg, pMmsData);
- //CID 41996 : MmsConvertMmsData always returns true
- /*if (MmsConvertMmsData(pMmsMsg, pMmsData) != true) {
+ /* CID 41996 : MmsConvertMmsData always returns true */
+ /*
+ if (MmsConvertMmsData(pMmsMsg, pMmsData) != true) {
MSG_DEBUG("Fail to Compose MMS Message");
goto __CATCH;
- }*/
+ } */
bool bFiltered = checkFilterMmsBody(pMmsData);
if (bFiltered == true) {
@@ -673,7 +688,7 @@ void MmsPluginInternal::processRetrieveConf(MSG_MESSAGE_INFO_S *pMsgInfo, mmsTra
MmsPluginStorage::instance()->insertMultipart(pMsgInfo->msgId, pMultipart);
}
- {//make Preview info for APP
+ { /* make Preview info for APP */
MmsPluginAppBase *appBase;
appBase = new MmsPluginAppBase(pMmsData);
appBase->makePreviewInfo(pMsgInfo->msgId, false, pRetrievedFilePath);
@@ -687,7 +702,7 @@ void MmsPluginInternal::processRetrieveConf(MSG_MESSAGE_INFO_S *pMsgInfo, mmsTra
MSG_SEC_DEBUG("Fail to get mms file size [%s]", pRetrievedFilePath);
goto __CATCH;
}
- }//make MmsData & insert multipart
+ } /* make MmsData & insert multipart */
__CATCH:
{
@@ -700,7 +715,7 @@ __CATCH:
}
MSG_END();
}
-#else //NEW process RetrieveConf
+#else /* NEW process RetrieveConf */
void MmsPluginInternal::processRetrieveConf(MSG_MESSAGE_INFO_S *pMsgInfo, mmsTranQEntity *pRequest, char *pRetrievedFilePath)
{
MSG_BEGIN();
@@ -729,9 +744,9 @@ void MmsPluginInternal::processRetrieveConf(MSG_MESSAGE_INFO_S *pMsgInfo, mmsTra
} else {
pMsgInfo->networkStatus = MSG_NETWORK_RETRIEVE_FAIL;
pMsgInfo->folderId = MSG_INBOX_ID;
- // If failed MMS Retrieve, then saved as MMS Noti Ind Message.
- // It will changed in MsgHandleMmsConfIncomingMsg
- //pMsgInfo->msgType.subType = MSG_NOTIFICATIONIND_MMS;
+ /* If failed MMS Retrieve, then saved as MMS Noti Ind Message.
+ * It will changed in MsgHandleMmsConfIncomingMsg */
+/* pMsgInfo->msgType.subType = MSG_NOTIFICATIONIND_MMS; */
}
char *msisdn = NULL;
@@ -845,7 +860,7 @@ bool MmsPluginInternal::encodeNotifyRespInd(char *szTrID, msg_delivery_report_st
MsgCloseFile(pFile);
if (pSendFilePath) {
- //CID 41993: replaced size 'MAX_MSG_DATA_LEN+1' with MAX_FULL_PATH_SIZE
+ /* CID 41993: replaced size 'MAX_MSG_DATA_LEN+1' with MAX_FULL_PATH_SIZE */
snprintf(pSendFilePath, MAX_FULL_PATH_SIZE, "%s.mms", pTempFilePath);
} else {
MSG_DEBUG("[ERROR] pSendFilePath is NULL");
@@ -877,12 +892,12 @@ bool MmsPluginInternal::encodeAckInd(char *szTrID, bool bReportAllowed, char *pS
pFile = MsgOpenMMSFile(pTempFilePath);
if (!pFile) {
- MSG_DEBUG("[ERROR] MsgOpenMMSFile fail \n" );
+ MSG_ERR("MsgOpenMMSFile fail \n" );
return false;
}
if (MmsEncodeAckInd(pFile, szTrID, bReportAllowed) == false) {
- MSG_DEBUG("MmsEncodeAckInd: MmsEncodeAckInd fail \n" );
+ MSG_ERR("MmsEncodeAckInd: MmsEncodeAckInd fail \n" );
MsgCloseFile(pFile);
return false;
}
@@ -892,7 +907,7 @@ bool MmsPluginInternal::encodeAckInd(char *szTrID, bool bReportAllowed, char *pS
if (pSendFilePath) {
snprintf(pSendFilePath, MAX_MSG_DATA_LEN+1, "%s.mms", pTempFilePath);
} else {
- MSG_DEBUG("[ERROR] pSendFilePath is NULL");
+ MSG_ERR("pSendFilePath is NULL");
return false;
}
@@ -911,7 +926,7 @@ bool MmsPluginInternal::checkRejectNotiInd(int roamState, bool bReportAllowed, c
MsgSettingGetBool(MMS_RECV_REJECT_UNKNOWN, &bRejectAnonymous);
MsgSettingGetBool(MMS_RECV_REJECT_ADVERTISE, &bRejectAdvertisement);
- // Anonymous Reject
+ /* Anonymous Reject */
if (bRejectAnonymous &&
(mmsHeader.pFrom == NULL || mmsHeader.pFrom->szAddr[0] == '\0')) {
MSG_DEBUG("Anonymous Reject... ");
@@ -920,7 +935,7 @@ bool MmsPluginInternal::checkRejectNotiInd(int roamState, bool bReportAllowed, c
return true;
}
- // Advertisement Reject
+ /* Advertisement Reject */
if (bRejectAdvertisement && mmsHeader.msgClass == MMS_MSGCLASS_ADVERTISEMENT) {
MSG_DEBUG("Advertisement Reject... ");
encodeNotifyRespInd(mmsHeader.szTrID, MSG_DELIVERY_REPORT_REJECTED, bReportAllowed, pSendFilePath);
@@ -928,7 +943,7 @@ bool MmsPluginInternal::checkRejectNotiInd(int roamState, bool bReportAllowed, c
return true;
}
- // Message Reject - Roaming Case
+ /* Message Reject - Roaming Case */
if (roamState == VCONFKEY_TELEPHONY_SVC_ROAM_ON) {
retrieveType = (MSG_MMS_HOME_RETRIEVE_TYPE_T)MsgSettingGetInt(MMS_RECV_ABROAD_NETWORK);
if (retrieveType == MSG_ABROAD_REJECT) {
@@ -947,7 +962,7 @@ bool MmsPluginInternal::checkRejectNotiInd(int roamState, bool bReportAllowed, c
}
}
- //Duplicate MMS notification
+ /* Duplicate MMS notification */
int msgId = 0;
msgId = MmsPluginStorage::instance()->checkDuplicateNotification(mmsHeader.szTrID, mmsHeader.szContentLocation);
@@ -956,7 +971,7 @@ bool MmsPluginInternal::checkRejectNotiInd(int roamState, bool bReportAllowed, c
if (msgId > 0)
return true;
- // Not Rejected
+ /* Not Rejected */
MSG_END();
return false;
@@ -983,7 +998,7 @@ bool MmsPluginInternal::checkFilterMmsBody(MMS_DATA_S *pMmsData)
MsgMmsConvertMmsDataToMmsMessageData(pMmsData, mmsMsg);
- // Get the text data from the 1st slide.
+ /* Get the text data from the 1st slide. */
if (mmsMsg->pageCnt <= 0) {
MSG_WARN("pageCnt : %d", mmsMsg->pageCnt);
MsgMmsReleaseMmsLists(mmsMsg);
@@ -1003,10 +1018,10 @@ bool MmsPluginInternal::checkFilterMmsBody(MMS_DATA_S *pMmsData)
if (pMedia && pMedia->mediatype == MMS_SMIL_MEDIA_TEXT) {
- MmsGetMimeTypeFromFileName(MIME_MAINTYPE_UNKNOWN, pMedia->szFilePath, &mimeType, NULL);
+ MsgGetMimeTypeFromFileName(MIME_MAINTYPE_UNKNOWN, pMedia->szFilePath, &mimeType, NULL);
if (mimeType == MIME_TEXT_X_VCALENDAR || mimeType == MIME_TEXT_X_VCARD || mimeType == MIME_TEXT_X_VTODO || mimeType == MIME_TEXT_X_VNOTE) {
- MSG_DEBUG("Media Type is Text, but Vobject file [%s]", pMedia->szFilePath);
+ MSG_SEC_DEBUG("Media Type is Text, but Vobject file [%s]", pMedia->szFilePath);
} else {
strncpy(filePath, pMedia->szFilePath, MSG_FILEPATH_LEN_MAX);
diff --git a/plugin/mms_plugin/MmsPluginMIME.cpp b/plugin/mms_plugin/MmsPluginMIME.cpp
deleted file mode 100755
index af59880..0000000
--- a/plugin/mms_plugin/MmsPluginMIME.cpp
+++ /dev/null
@@ -1,882 +0,0 @@
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved
- *
- * Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
- *
- * 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 <string>
-#include <stdlib.h>
-#include "MmsPluginMIME.h"
-#include "MmsPluginDebug.h"
-
-typedef enum _MimeAppType {
- MIME_APPLICATION_NONE,
-
- MIME_APPLICATION_CAMERA,
- MIME_APPLICATION_VIDEORECORDER,
-
- MIME_APPLICATION_IMAGEVIEWER,
- MIME_APPLICATION_FLASHVIEWER,
- MIME_APPLICATION_IMAGEEDITOR,
- MIME_APPLICATION_THEMEVIEWER,
-
- MIME_APPLICATION_SOUNDPLAYER,
- MIME_APPLICATION_MEDIAPLAYER,
- MIME_APPLICATION_VOICEMEMO,
-
- MIME_APPLICATION_PICSELVIEWER,
-
- MIME_APPLICATION_CONTACT,
- MIME_APPLICATION_ORGANIZER,
-
- MIME_APPLICATION_MAX
-} MimeAppType;
-
-
-typedef struct _MimeTable {
- const char *szMIME;
- const char *szExt;
- bool bDownloadable;
- MimeType mime; /* index of mime type */
- MimeType contentType; /* representative mime type */
- MimeAppType appType;
- MimeMainType mainType;
- int binary;
-} MimeTable;
-
-/************************************************** MIME definition ***************************************************/
-static const MimeTable mimeTable[] = {
- // 0
- {"*/*", "", false, MIME_ASTERISK, MIME_ASTERISK, MIME_APPLICATION_NONE, MIME_MAINTYPE_ETC, UNDEFINED_BINARY },
-
- // 1
- {"application/xml", "", false, MIME_APPLICATION_XML, MIME_APPLICATION_XML, MIME_APPLICATION_NONE, MIME_MAINTYPE_TEXT, 0x27 },
- {"application/wml+xml", "", false, MIME_APPLICATION_WML_XML, MIME_APPLICATION_WML_XML, MIME_APPLICATION_NONE, MIME_MAINTYPE_TEXT, 0x3c },
- {"application/xhtml+xml", "xhtml", false, MIME_APPLICATION_XHTML_XML, MIME_APPLICATION_XHTML_XML, MIME_APPLICATION_NONE, MIME_MAINTYPE_TEXT, 0x3b },
- {"application/java-vm", "", false, MIME_APPLICATION_JAVA_VM, MIME_APPLICATION_JAVA_VM, MIME_APPLICATION_NONE, MIME_MAINTYPE_APPLICATION, 0x11 },
- {"application/smil", "smil", true, MIME_APPLICATION_SMIL, MIME_APPLICATION_SMIL, MIME_APPLICATION_NONE, MIME_MAINTYPE_APPLICATION, UNDEFINED_BINARY },
- {"application/java-archive", "jar", true, MIME_APPLICATION_JAVA_ARCHIVE, MIME_APPLICATION_JAVA_ARCHIVE, MIME_APPLICATION_NONE, MIME_MAINTYPE_ETC, UNDEFINED_BINARY },
- {"application/java", "jar", true, MIME_APPLICATION_JAVA, MIME_APPLICATION_JAVA, MIME_APPLICATION_NONE, MIME_MAINTYPE_ETC, UNDEFINED_BINARY },
- {"application/octet-stream", "", false, MIME_APPLICATION_OCTET_STREAM, MIME_APPLICATION_OCTET_STREAM, MIME_APPLICATION_NONE, MIME_MAINTYPE_ETC, UNDEFINED_BINARY },
- {"application/studiom", "smp", true, MIME_APPLICATION_STUDIOM, MIME_APPLICATION_STUDIOM, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY },
- {"application/funMedia", "smp", true, MIME_APPLICATION_FUNMEDIA, MIME_APPLICATION_FUNMEDIA, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY },
- {"application/msword", "doc", true, MIME_APPLICATION_MSWORD, MIME_APPLICATION_MSWORD, MIME_APPLICATION_PICSELVIEWER, MIME_MAINTYPE_APPLICATION, UNDEFINED_BINARY },
- {"application/pdf", "pdf", true, MIME_APPLICATION_PDF, MIME_APPLICATION_PDF, MIME_APPLICATION_PICSELVIEWER, MIME_MAINTYPE_APPLICATION, UNDEFINED_BINARY },
- {"application/sdp", "sdp", true, MIME_APPLICATION_SDP, MIME_APPLICATION_SDP, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_VIDEO, UNDEFINED_BINARY },
- {"application/ram", "ram", true, MIME_APPLICATION_RAM, MIME_APPLICATION_RAM, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY },
- {"application/*", "", false, MIME_APPLICATION_ASTERIC, MIME_APPLICATION_ASTERIC, MIME_APPLICATION_NONE, MIME_MAINTYPE_APPLICATION, 0x10 },
-
- //16
- {"application/vnd.wap.xhtml+xml", "", false, MIME_APPLICATION_VND_WAP_XHTMLXML, MIME_APPLICATION_VND_WAP_XHTMLXML, MIME_APPLICATION_NONE, MIME_MAINTYPE_TEXT, 0x45 },
- {"application/vnd.wap.wmlc", "", false, MIME_APPLICATION_VND_WAP_WMLC, MIME_APPLICATION_VND_WAP_WMLC, MIME_APPLICATION_NONE, MIME_MAINTYPE_TEXT, 0x14 },
- {"application/vnd.wap.wmlscriptc", "", false, MIME_APPLICATION_VND_WAP_WMLSCRIPTC, MIME_APPLICATION_VND_WAP_WMLSCRIPTC, MIME_APPLICATION_NONE, MIME_MAINTYPE_TEXT, 0x15 },
- {"application/vnd.wap.wta-eventc", "", false, MIME_APPLICATION_VND_WAP_WTA_EVENTC, MIME_APPLICATION_VND_WAP_WTA_EVENTC, MIME_APPLICATION_NONE, MIME_MAINTYPE_TEXT, 0x16 },
- {"application/vnd.wap.uaprof", "", false, MIME_APPLICATION_VND_WAP_UAPROF, MIME_APPLICATION_VND_WAP_UAPROF, MIME_APPLICATION_NONE, MIME_MAINTYPE_TEXT, 0x17 },
- {"application/vnd.wap.sic", "", false, MIME_APPLICATION_VND_WAP_SIC, MIME_APPLICATION_VND_WAP_SIC, MIME_APPLICATION_NONE, MIME_MAINTYPE_TEXT, 0x2e },
- {"application/vnd.wap.slc", "", false, MIME_APPLICATION_VND_WAP_SLC, MIME_APPLICATION_VND_WAP_SLC, MIME_APPLICATION_NONE, MIME_MAINTYPE_TEXT, 0x30 },
- {"application/vnd.wap.coc", "", false, MIME_APPLICATION_VND_WAP_COC, MIME_APPLICATION_VND_WAP_COC, MIME_APPLICATION_NONE, MIME_MAINTYPE_TEXT, 0x32 },
- {"application/vnd.wap.sia", "", false, MIME_APPLICATION_VND_WAP_SIA, MIME_APPLICATION_VND_WAP_SIA, MIME_APPLICATION_NONE, MIME_MAINTYPE_TEXT, 0x34 },
- {"application/vnd.wap,connectivity-wbxml", "", false, MIME_APPLICATION_VND_WAP_CONNECTIVITY_WBXML, MIME_APPLICATION_VND_WAP_CONNECTIVITY_WBXML, MIME_APPLICATION_NONE, MIME_MAINTYPE_TEXT, UNDEFINED_BINARY },
- {"application/vnd.wap.multipart.form-data", "", false, MIME_APPLICATION_VND_WAP_MULTIPART_FORM_DATA, MIME_MULTIPART_FORM_DATA, MIME_APPLICATION_NONE, MIME_MAINTYPE_APPLICATION, 0x24 },
- {"application/vnd.wap.multipart.byteranges", "", false, MIME_APPLICATION_VND_WAP_MULTIPART_BYTERANGES, MIME_MULTIPART_BYTERANGE, MIME_APPLICATION_NONE, MIME_MAINTYPE_APPLICATION, 0x25 },
- {"application/vnd.wap.multipart.mixed", "", false, MIME_APPLICATION_VND_WAP_MULTIPART_MIXED, MIME_MULTIPART_MIXED, MIME_APPLICATION_NONE, MIME_MAINTYPE_APPLICATION, 0x23 },
- {"application/vnd.wap.multipart.related", "", false, MIME_APPLICATION_VND_WAP_MULTIPART_RELATED, MIME_MULTIPART_RELATED, MIME_APPLICATION_NONE, MIME_MAINTYPE_APPLICATION, 0x33 },
- {"application/vnd.wap.multipart.alternative", "", false, MIME_APPLICATION_VND_WAP_MULTIPART_ALTERNATIVE, MIME_MULTIPART_ALTERNATIVE, MIME_APPLICATION_NONE, MIME_MAINTYPE_APPLICATION, 0x26 },
- {"application/vnd.wap.multipart.*", "", false, MIME_APPLICATION_VND_WAP_MULTIPART_ASTERIC, MIME_APPLICATION_VND_WAP_MULTIPART_ASTERIC, MIME_APPLICATION_NONE, MIME_MAINTYPE_APPLICATION, 0x22 },
- {"application/vnd.wap.wbxml", "", false, MIME_APPLICATION_VND_WAP_WBXML, MIME_APPLICATION_VND_WAP_WBXML, MIME_APPLICATION_NONE, MIME_MAINTYPE_APPLICATION, 0x29 },
- {"application/vnd.oma.dd+xml", "dd", true, MIME_APPLICATION_VND_OMA_DD_XML, MIME_APPLICATION_VND_OMA_DD_XML, MIME_APPLICATION_NONE, MIME_MAINTYPE_ETC, 0x47 },
- {"application/vnd.oma.drm.message", "dm", true, MIME_APPLICATION_VND_OMA_DRM_MESSAGE, MIME_APPLICATION_VND_OMA_DRM_MESSAGE, MIME_APPLICATION_NONE, MIME_MAINTYPE_ETC, 0x48 },
- {"application/vnd.oma.drm.content", "dcf", true, MIME_APPLICATION_VND_OMA_DRM_CONTENT, MIME_APPLICATION_VND_OMA_DRM_CONTENT, MIME_APPLICATION_NONE, MIME_MAINTYPE_ETC, 0x49 },
- {"application/vnd.oma.drm.rights+xml", "ro", true, MIME_APPLICATION_VND_OMA_DRM_RIGHTS_XML, MIME_APPLICATION_VND_OMA_DRM_RIGHTS_XML, MIME_APPLICATION_NONE, MIME_MAINTYPE_ETC, 0x4a },
- {"application/vnd.oma.drm.rights+wbxml", "ro", true, MIME_APPLICATION_VND_OMA_DRM_RIGHTS_WBXML, MIME_APPLICATION_VND_OMA_DRM_RIGHTS_WBXML, MIME_APPLICATION_NONE, MIME_MAINTYPE_ETC, 0x4b },
- {"application/vnd.oma.drm.ro+xml", "oro", true, MIME_APPLICATION_VND_OMA_DRM_RO_XML, MIME_APPLICATION_VND_OMA_DRM_RO_XML, MIME_APPLICATION_NONE, MIME_MAINTYPE_ETC, 0x4b },
- {"application/vnd.oma.drm.dcf", "odf", true, MIME_APPLICATION_VND_OMA_DRM_DCF, MIME_APPLICATION_VND_OMA_DRM_DCF, MIME_APPLICATION_NONE, MIME_MAINTYPE_ETC, 0x4b },
- {"application/vnd.oma.drm.roap-pdu+xml", "xml", true, MIME_APPLICATION_VND_OMA_ROAPPDU_XML, MIME_APPLICATION_VND_OMA_ROAPPDU_XML, MIME_APPLICATION_NONE, MIME_MAINTYPE_ETC, 0x4b },
- {"application/vnd.oma.drm.roap-trigger+xml", "xml", true, MIME_APPLICATION_VND_OMA_ROAPTRIGGER_XML, MIME_APPLICATION_VND_OMA_ROAPTRIGGER_XML, MIME_APPLICATION_NONE, MIME_MAINTYPE_ETC, 0x4b },
- {"application/vnd.smaf", "mmf", true, MIME_APPLICATION_VND_SMAF, MIME_APPLICATION_X_SMAF, MIME_APPLICATION_SOUNDPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY },
- {"application/vnd.rn-realmedia", "rm", true, MIME_APPLICATION_VND_RN_REALMEDIA, MIME_APPLICATION_VND_RN_REALMEDIA, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_VIDEO, UNDEFINED_BINARY },
- {"application/vnd.sun.j2me.java-archive", "jar", true, MIME_APPLICATION_VND_SUN_J2ME_JAVA_ARCHIVE, MIME_APPLICATION_JAVA_ARCHIVE, MIME_APPLICATION_NONE, MIME_MAINTYPE_ETC, UNDEFINED_BINARY },
- {"application/vnd.samsung.theme", "thm", true, MIME_APPLICATION_VND_SAMSUNG_THEME, MIME_APPLICATION_VND_SAMSUNG_THEME, MIME_APPLICATION_THEMEVIEWER, MIME_MAINTYPE_THEME, UNDEFINED_BINARY },
- {"application/vnd.ms-excel", "xls", true, MIME_APPLICATION_VND_EXCEL, MIME_APPLICATION_X_EXCEL, MIME_APPLICATION_NONE, MIME_MAINTYPE_APPLICATION, UNDEFINED_BINARY },
- {"application/vnd.ms-powerpoint", "ppt", true, MIME_APPLICATION_VND_POWERPOINT, MIME_APPLICATION_VND_POWERPOINT, MIME_APPLICATION_NONE, MIME_MAINTYPE_APPLICATION, UNDEFINED_BINARY },
- {"applcation/vnd.ms-word", "doc", true, MIME_APPLICATION_VND_MSWORD, MIME_APPLICATION_MSWORD, MIME_APPLICATION_NONE, MIME_MAINTYPE_APPLICATION, UNDEFINED_BINARY },
-
- //49
- {"application/x-hdmlc", "", false, MIME_APPLICATION_X_HDMLC, MIME_APPLICATION_X_HDMLC, MIME_APPLICATION_NONE, MIME_MAINTYPE_TEXT, 0x13 },
- {"application/x-x968-user-cert", "", false, MIME_APPLICATION_X_X968_USERCERT, MIME_APPLICATION_X_X968_USERCERT, MIME_APPLICATION_NONE, MIME_MAINTYPE_TEXT, 0x2c },
- {"application/x-www-form-urlencoded", "", false, MIME_APPLICATION_X_WWW_FORM_URLENCODED, MIME_APPLICATION_X_WWW_FORM_URLENCODED, MIME_APPLICATION_NONE, MIME_MAINTYPE_APPLICATION, 0x12 },
- {"application/x-smaf", "mmf", true, MIME_APPLICATION_X_SMAF, MIME_APPLICATION_X_SMAF, MIME_APPLICATION_SOUNDPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY },
- {"application/x-shockwave-flash", "swf", true, MIME_APPLICATION_X_FLASH, MIME_APPLICATION_X_FLASH, MIME_APPLICATION_IMAGEVIEWER, MIME_MAINTYPE_IMAGE, UNDEFINED_BINARY },
- {"application/x-msexcel", "xls", true, MIME_APPLICATION_X_EXCEL, MIME_APPLICATION_X_EXCEL, MIME_APPLICATION_NONE, MIME_MAINTYPE_APPLICATION, UNDEFINED_BINARY },
- {"application/x-mspowerpoint", "ppt", true, MIME_APPLICATION_X_POWERPOINT, MIME_APPLICATION_X_POWERPOINT, MIME_APPLICATION_PICSELVIEWER, MIME_MAINTYPE_APPLICATION, UNDEFINED_BINARY },
-
-
- //56
- {"audio/basic", "snd"/*,au"*/, false, MIME_AUDIO_BASIC, MIME_AUDIO_BASIC, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY },
- {"audio/mpeg", "mp3", true, MIME_AUDIO_MPEG, MIME_AUDIO_MP3, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY },
- {"audio/mp3", "mp3", true, MIME_AUDIO_MP3, MIME_AUDIO_MP3, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY },
- {"audio/mpg3", "mp3", true, MIME_AUDIO_MPG3, MIME_AUDIO_MP3, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY },
- {"audio/mpeg3", "mp3", true, MIME_AUDIO_MPEG3, MIME_AUDIO_MP3, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY },
- {"audio/mpg", "mp3", true, MIME_AUDIO_MPG, MIME_AUDIO_MP3, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY },
- {"audio/aac", "aac", true, MIME_AUDIO_AAC, MIME_AUDIO_AAC, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY },
- {"audio/g72", "aac", true, MIME_AUDIO_G72, MIME_AUDIO_AAC, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY },
- {"audio/amr", "amr", true, MIME_AUDIO_AMR, MIME_AUDIO_AMR, MIME_APPLICATION_VOICEMEMO, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY },
- {"audio/amr-wb", "amr", true, MIME_AUDIO_AMR_WB, MIME_AUDIO_AMR_WB, MIME_APPLICATION_VOICEMEMO, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY },
- {"audio/mmf", "mmf", true, MIME_AUDIO_MMF, MIME_AUDIO_MMF, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY },
- {"audio/smaf", "mmf", true, MIME_AUDIO_SMAF, MIME_AUDIO_SMAF, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY },
- {"audio/imelody", "imy", true, MIME_AUDIO_IMELODY, MIME_AUDIO_IMELODY, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY },
- {"audio/iMelody", "imy", true, MIME_AUDIO_IMELODY2, MIME_AUDIO_IMELODY, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY },
- {"audio/melody", "imy", true, MIME_AUDIO_MELODY, MIME_AUDIO_IMELODY, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY },
- {"audio/mid", "mid", true, MIME_AUDIO_MID, MIME_AUDIO_MID, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY },
- {"audio/midi", "mid"/*,midi"*/, true, MIME_AUDIO_MIDI, MIME_AUDIO_MID, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY },
- {"audio/sp-midi", "spm"/*,midi"*/, true, MIME_AUDIO_SP_MIDI, MIME_AUDIO_SP_MIDI, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY },
- {"audio/wave", "wav", true, MIME_AUDIO_WAVE, MIME_AUDIO_WAVE, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY },
- {"audio/wav", "wav", true, MIME_AUDIO_WAV, MIME_AUDIO_WAVE, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY },
- {"audio/3gpp", "3gp", true, MIME_AUDIO_3GPP, MIME_AUDIO_3GPP, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY },
- {"audio/mp4", "mp4", true, MIME_AUDIO_MP4, MIME_AUDIO_MP4, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY },
- {"audio/MP4A-LATM", "mp4", true, MIME_AUDIO_MP4A_LATM, MIME_AUDIO_MP4A_LATM, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY },
- {"audio/m4a", "m4a", true, MIME_AUDIO_M4A, MIME_AUDIO_M4A, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY },
- {"audio/mpeg4", "mp4", true, MIME_AUDIO_MPEG4, MIME_AUDIO_MPEG4, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY },
- {"audio/wma", "wma", true, MIME_AUDIO_WMA, MIME_AUDIO_WMA, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY },
- {"audio/xmf", "xmf", true, MIME_AUDIO_XMF, MIME_AUDIO_XMF, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY },
- {"audio/imy", "imy", true, MIME_AUDIO_IMY, MIME_AUDIO_IMY, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY },
- {"audio/mobile-xmf", "mxmf", true, MIME_AUDIO_MOBILE_XMF, MIME_AUDIO_XMF, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY },
-
- // 85
- {"audio/vnd.rn-realaudio", "rm"/*,ram,ra"*/, true, MIME_AUDIO_VND_RN_REALAUDIO, MIME_AUDIO_VND_RN_REALAUDIO, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY },
-
- //86
- {"audio/x-mpeg", "mp3", true, MIME_AUDIO_X_MPEG, MIME_AUDIO_MP3, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY },
- {"audio/x-mp3", "mp3", true, MIME_AUDIO_X_MP3, MIME_AUDIO_MP3, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY },
- {"audio/x-mpeg3", "mp3", true, MIME_AUDIO_X_MPEG3, MIME_AUDIO_MP3, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY },
- {"audio/x-mpg", "mp3", true, MIME_AUDIO_X_MPG, MIME_AUDIO_MP3, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY },
- {"audio/x-amr", "amr", true, MIME_AUDIO_X_AMR, MIME_AUDIO_AMR, MIME_APPLICATION_VOICEMEMO, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY },
- {"audio/x-mmf", "mmf", true, MIME_AUDIO_X_MMF, MIME_AUDIO_MMF, MIME_APPLICATION_VOICEMEMO, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY },
- {"audio/x-smaf", "mmf", true, MIME_AUDIO_X_SMAF, MIME_AUDIO_SMAF, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY },
- {"audio/x-iMelody", "imy", true, MIME_AUDIO_X_IMELODY, MIME_AUDIO_IMELODY, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY },
- {"audio/x-midi", "mid"/*,midi"*/, true, MIME_AUDIO_X_MIDI, MIME_AUDIO_MID, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY },
- {"audio/x-mpegaudio", "mp3", true, MIME_AUDIO_X_MPEGAUDIO, MIME_AUDIO_MP3, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY },
- {"audio/x-pn-realaudio", "ra"/*,ram,ra"*/, true, MIME_AUDIO_X_PN_REALAUDIO, MIME_AUDIO_VND_RN_REALAUDIO, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY },
- {"audio/x-pn-multirate-realaudio", "rm"/*,ram,ra"*/, true, MIME_AUDIO_X_PN_MULTIRATE_REALAUDIO, MIME_AUDIO_VND_RN_REALAUDIO, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY },
- {"audio/x-pn-multirate-realaudio-live", "rm"/*,ram,ra"*/, true, MIME_AUDIO_X_PN_MULTIRATE_REALAUDIO_LIVE, MIME_AUDIO_VND_RN_REALAUDIO, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY },
- {"audio/x-wave", "wav", true, MIME_AUDIO_X_WAVE, MIME_AUDIO_WAVE, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY },
- {"audio/x-wav", "wav", true, MIME_AUDIO_X_WAV, MIME_AUDIO_WAVE, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY },
- {"audio/x-ms-wma", "wma", true, MIME_AUDIO_X_MS_WMA, MIME_AUDIO_WAVE, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY },
- {"audio/x-mid", "mid", true, MIME_AUDIO_X_MID, MIME_AUDIO_MID, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY },
- {"audio/x-ms-asf", "asf", true, MIME_AUDIO_X_MS_ASF, MIME_AUDIO_X_MS_ASF, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY },
- {"audio/x-xmf", "xmf", true, MIME_AUDIO_X_XMF, MIME_AUDIO_XMF, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY },
-
- //105
- {"image/gif", "gif", false, MIME_IMAGE_GIF, MIME_IMAGE_GIF, MIME_APPLICATION_IMAGEVIEWER, MIME_MAINTYPE_IMAGE, 0x1d },
- {"image/jpeg", "jpg"/*,jpeg,jpe,jpz"*/, false, MIME_IMAGE_JPEG, MIME_IMAGE_JPG, MIME_APPLICATION_IMAGEVIEWER, MIME_MAINTYPE_IMAGE, 0x1e },
- {"image/jpg", "jpg", false, MIME_IMAGE_JPG, MIME_IMAGE_JPG, MIME_APPLICATION_IMAGEVIEWER, MIME_MAINTYPE_IMAGE, UNDEFINED_BINARY },
- {"image/tiff", "tif"/*,tiff"*/, false, MIME_IMAGE_TIFF, MIME_IMAGE_TIF, MIME_APPLICATION_IMAGEVIEWER, MIME_MAINTYPE_IMAGE, 0x1f },
- {"image/tif", "tif", false, MIME_IMAGE_TIF, MIME_IMAGE_TIF, MIME_APPLICATION_IMAGEVIEWER, MIME_MAINTYPE_IMAGE, UNDEFINED_BINARY },
- {"image/png", "png"/*,pnz"*/, false, MIME_IMAGE_PNG, MIME_IMAGE_PNG, MIME_APPLICATION_IMAGEVIEWER, MIME_MAINTYPE_IMAGE, 0x20 },
- {"image/wbmp", "wbmp", false, MIME_IMAGE_WBMP, MIME_IMAGE_WBMP, MIME_APPLICATION_IMAGEVIEWER, MIME_MAINTYPE_IMAGE, UNDEFINED_BINARY },
- {"image/pjpeg", "jpg", false, MIME_IMAGE_PJPEG, MIME_IMAGE_JPG, MIME_APPLICATION_IMAGEVIEWER, MIME_MAINTYPE_IMAGE, UNDEFINED_BINARY },
- {"image/bmp", "bmp", false, MIME_IMAGE_BMP, MIME_IMAGE_BMP, MIME_APPLICATION_IMAGEVIEWER, MIME_MAINTYPE_IMAGE, UNDEFINED_BINARY },
- {"image/svg+xml", "svg", false, MIME_IMAGE_SVG, MIME_IMAGE_SVG, MIME_APPLICATION_IMAGEVIEWER, MIME_MAINTYPE_IMAGE, UNDEFINED_BINARY },
- {"image/svg-xml", "svg", false, MIME_IMAGE_SVG1, MIME_IMAGE_SVG, MIME_APPLICATION_IMAGEVIEWER, MIME_MAINTYPE_IMAGE, UNDEFINED_BINARY },
-
- //116
- {"image/vnd.wap.wbmp", "wbmp", false, MIME_IMAGE_VND_WAP_WBMP, MIME_IMAGE_WBMP, MIME_APPLICATION_IMAGEVIEWER, MIME_MAINTYPE_IMAGE, 0x21 },
- {"image/vnd.tmo.my5-gif", "gif", false, MIME_IMAGE_VND_TMO_GIF, MIME_IMAGE_GIF, MIME_APPLICATION_IMAGEVIEWER, MIME_MAINTYPE_IMAGE, UNDEFINED_BINARY },
- {"image/vnd.tmo.my5-jpg", "jpg", false, MIME_IMAGE_VND_TMO_JPG, MIME_IMAGE_JPG, MIME_APPLICATION_IMAGEVIEWER, MIME_MAINTYPE_IMAGE, UNDEFINED_BINARY },
-
- // 119
- {"image/x-bmp", "bmp", false, MIME_IMAGE_X_BMP, MIME_IMAGE_BMP, MIME_APPLICATION_IMAGEVIEWER, MIME_MAINTYPE_IMAGE, UNDEFINED_BINARY },
-
- // 120
- {"message/rfc822", "elm", false, MIME_MESSAGE_RFC822, MIME_MESSAGE_RFC822, MIME_APPLICATION_NONE, MIME_MAINTYPE_MESSAGE, UNDEFINED_BINARY },
-
- //121
- {"multipart/mixed", "", false, MIME_MULTIPART_MIXED, MIME_MULTIPART_MIXED, MIME_APPLICATION_NONE, MIME_MAINTYPE_APPLICATION, 0x0c },
- {"multipart/related", "", false, MIME_MULTIPART_RELATED, MIME_MULTIPART_RELATED, MIME_APPLICATION_NONE, MIME_MAINTYPE_APPLICATION, UNDEFINED_BINARY },
- {"multipart/alternative", "", false, MIME_MULTIPART_ALTERNATIVE, MIME_MULTIPART_ALTERNATIVE, MIME_APPLICATION_NONE, MIME_MAINTYPE_APPLICATION, 0x0f },
- {"multipart/form-data", "", false, MIME_MULTIPART_FORM_DATA, MIME_MULTIPART_FORM_DATA, MIME_APPLICATION_NONE, MIME_MAINTYPE_APPLICATION, 0x0d },
- {"multipart/byterange", "", false, MIME_MULTIPART_BYTERANGE, MIME_MULTIPART_BYTERANGE, MIME_APPLICATION_NONE, MIME_MAINTYPE_APPLICATION, 0x0e },
- {"multipart/report", "", false, MIME_MULTIPART_REPORT, MIME_MULTIPART_REPORT, MIME_APPLICATION_NONE, MIME_MAINTYPE_APPLICATION, UNDEFINED_BINARY },
- {"multipart/voice-message", "", false, MIME_MULTIPART_VOICE_MESSAGE, MIME_MULTIPART_VOICE_MESSAGE, MIME_APPLICATION_NONE, MIME_MAINTYPE_APPLICATION, UNDEFINED_BINARY },
-
- //128
- {"text/txt", "", false, MIME_TEXT_TXT, MIME_TEXT_TXT, MIME_APPLICATION_PICSELVIEWER, MIME_MAINTYPE_TEXT, UNDEFINED_BINARY },
- {"text/html", "html"/*,htm"*/, false, MIME_TEXT_HTML, MIME_TEXT_HTML, MIME_APPLICATION_NONE, MIME_MAINTYPE_TEXT, 0x02 },
- {"text/plain", "txt"/*,vbm,url"*/, false, MIME_TEXT_PLAIN, MIME_TEXT_PLAIN, MIME_APPLICATION_PICSELVIEWER, MIME_MAINTYPE_TEXT, 0x03 },
- {"text/css", "", false, MIME_TEXT_CSS, MIME_TEXT_CSS, MIME_APPLICATION_NONE, MIME_MAINTYPE_TEXT, 0x3d },
- {"text/xml", "", false, MIME_TEXT_XML, MIME_TEXT_XML, MIME_APPLICATION_NONE, MIME_MAINTYPE_TEXT, 0x28 },
- {"text/iMelody", "imy", true, MIME_TEXT_IMELODY, MIME_TEXT_IMELODY, MIME_APPLICATION_SOUNDPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY },
- {"text/calendar", "ics", true, MIME_TEXT_CALENDAR, MIME_TEXT_CALENDAR, MIME_APPLICATION_NONE, MIME_MAINTYPE_TEXT, UNDEFINED_BINARY },
-
- //135
- {"text/vnd.wap.wmlscript", "", false, MIME_TEXT_VND_WAP_WMLSCRIPT, MIME_TEXT_VND_WAP_WMLSCRIPT, MIME_APPLICATION_NONE, MIME_MAINTYPE_TEXT, 0x09 },
- {"text/vnd.wap.wml", "wml", false, MIME_TEXT_VND_WAP_WML, MIME_TEXT_VND_WAP_WML, MIME_APPLICATION_NONE, MIME_MAINTYPE_TEXT, 0x08 },
- {"text/vnd.wap.wta-event", "", false, MIME_TEXT_VND_WAP_WTA_EVENT, MIME_TEXT_VND_WAP_WTA_EVENT, MIME_APPLICATION_NONE, MIME_MAINTYPE_TEXT, 0x0a },
- {"text/vnd.wap.connectivity-xml", "", false, MIME_TEXT_VND_WAP_CONNECTIVITY_XML, MIME_TEXT_VND_WAP_CONNECTIVITY_XML, MIME_APPLICATION_NONE, MIME_MAINTYPE_TEXT, 0x35 },
- {"text/vnd.wap.si", "", false, MIME_TEXT_VND_WAP_SI, MIME_TEXT_VND_WAP_SI, MIME_APPLICATION_NONE, MIME_MAINTYPE_TEXT, 0x2d },
- {"text/vnd.wap.sl", "", false, MIME_TEXT_VND_WAP_SL, MIME_TEXT_VND_WAP_SL, MIME_APPLICATION_NONE, MIME_MAINTYPE_TEXT, 0x2f },
- {"text/vnd.wap.co", "", false, MIME_TEXT_VND_WAP_CO, MIME_TEXT_VND_WAP_CO, MIME_APPLICATION_NONE, MIME_MAINTYPE_TEXT, 0x31 },
- {"text/vnd.sun.j2me.app-descriptor", "jad", true, MIME_TEXT_VND_SUN_J2ME_APP_DESCRIPTOR, MIME_TEXT_VND_SUN_J2ME_APP_DESCRIPTOR, MIME_APPLICATION_NONE, MIME_MAINTYPE_ETC, UNDEFINED_BINARY },
-
-
- //143
- {"text/x-hdml", "", false, MIME_TEXT_X_HDML, MIME_TEXT_X_HDML, MIME_APPLICATION_NONE, MIME_MAINTYPE_TEXT, 0x04 },
- {"text/x-vCalendar", "vcs", true, MIME_TEXT_X_VCALENDAR, MIME_TEXT_X_VCALENDAR, MIME_APPLICATION_NONE, MIME_MAINTYPE_ETC, 0x06 },
- {"text/x-vCard", "vcf", true, MIME_TEXT_X_VCARD, MIME_TEXT_X_VCARD, MIME_APPLICATION_NONE, MIME_MAINTYPE_ETC, 0x07 },
- {"text/x-iMelody", "imy", true, MIME_TEXT_X_IMELODY, MIME_TEXT_X_IMELODY, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY },
- {"text/x-imelody", "imy", true, MIME_TEXT_X_IMELODY2, MIME_TEXT_X_IMELODY, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_AUDIO, UNDEFINED_BINARY },
- {"text/x-vnote", "vnt", true, MIME_TEXT_X_VNOTE, MIME_TEXT_X_VNOTE, MIME_APPLICATION_NONE, MIME_MAINTYPE_TEXT, UNDEFINED_BINARY },
- {"text/x-vtodo", "vts", true, MIME_TEXT_X_VTODO, MIME_TEXT_X_VNOTE, MIME_APPLICATION_NONE, MIME_MAINTYPE_TEXT, UNDEFINED_BINARY },
-
- //150
- {"video/mpeg4", "mp4", true, MIME_VIDEO_MPEG4, MIME_VIDEO_MP4, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_VIDEO, UNDEFINED_BINARY },
- {"video/mp4", "mp4", true, MIME_VIDEO_MP4, MIME_VIDEO_MP4, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_VIDEO, UNDEFINED_BINARY },
- {"video/h263", ""/*,3gpp,mp4"*/,true, MIME_VIDEO_H263, MIME_VIDEO_H263, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_VIDEO, UNDEFINED_BINARY },
- {"video/3gpp", "3gp"/*,3gpp"*/, true, MIME_VIDEO_3GPP, MIME_VIDEO_3GPP, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_VIDEO, UNDEFINED_BINARY },
- {"video/3gp", "3gp"/*,3gpp"*/, true, MIME_VIDEO_3GP, MIME_VIDEO_3GP, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_VIDEO, UNDEFINED_BINARY },
- {"video/avi", "avi", false, MIME_VIDEO_AVI, MIME_VIDEO_AVI, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_VIDEO, UNDEFINED_BINARY },
- {"video/sdp", "sdp", true, MIME_VIDEO_SDP, MIME_APPLICATION_SDP, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_VIDEO, UNDEFINED_BINARY },
- {"video/mp4v-es", "3gp", true, MIME_VIDEO_MP4_ES, MIME_VIDEO_3GP, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_VIDEO, UNDEFINED_BINARY },
- {"video/mpeg", "3gp", true, MIME_VIDEO_MPEG, MIME_VIDEO_3GP, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_VIDEO, UNDEFINED_BINARY },
- {"video/quicktime", "mov", true, MIME_VIDEO_MOV, MIME_VIDEO_3GP, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_VIDEO, UNDEFINED_BINARY },
-
- // 160
- {"video/vnd.rn-realvideo", "rm", true, MIME_VIDEO_VND_RN_REALVIDEO, MIME_VIDEO_VND_RN_REALVIDEO, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_VIDEO, UNDEFINED_BINARY },
- {"video/vnd.rn-realmedia", "rm", true, MIME_VIDEO_VND_RN_REALMEDIA, MIME_VIDEO_VND_RN_REALMEDIA, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_VIDEO, UNDEFINED_BINARY },
-
- //162
- {"video/x-mp4", "mp4", true, MIME_VIDEO_X_MP4, MIME_VIDEO_MP4, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_VIDEO, UNDEFINED_BINARY },
- {"video/x-pv-mp4", "mp4", true, MIME_VIDEO_X_PV_MP4, MIME_VIDEO_MP4, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_VIDEO, UNDEFINED_BINARY },
- {"video/x-pn-realvideo", "rv", true, MIME_VIDEO_X_PN_REALVIDEO, MIME_VIDEO_VND_RN_REALVIDEO, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_VIDEO, UNDEFINED_BINARY },
- {"video/x-pn-multirate-realvideo", "rm", true, MIME_VIDEO_X_PN_MULTIRATE_REALVIDEO, MIME_VIDEO_VND_RN_REALVIDEO, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_VIDEO, UNDEFINED_BINARY },
- {"video/x-ms-wmv", "wmv", true, MIME_VIDEO_X_MS_WMV, MIME_VIDEO_X_MS_WMV, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_VIDEO, UNDEFINED_BINARY },
- {"video/x-ms-asf", "asf", true, MIME_VIDEO_X_MS_ASF, MIME_VIDEO_X_MS_ASF, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_VIDEO, UNDEFINED_BINARY },
- {"video/x-pv-pvx", "pvx", true, MIME_VIDEO_X_PV_PVX, MIME_VIDEO_X_PV_PVX, MIME_APPLICATION_MEDIAPLAYER, MIME_MAINTYPE_VIDEO, UNDEFINED_BINARY }
-
-};
-
-/********** MIME table information ***********/
-static const int mimeTableIndex[] = {
- 1, 16, 49,
- 56, 85, 86,
- 105, 116, 119,
- 120, 120, 120,
- 121, 121, 121,
- 128, 135, 143,
- 150, 160, 162
-};
-
-static int mimeTableEnum[] =
-{
- MIME_ASTERISK ,
-
- MIME_APPLICATION_XML ,
- MIME_APPLICATION_WML_XML ,
- MIME_APPLICATION_XHTML_XML ,
- MIME_APPLICATION_JAVA_VM ,
- MIME_APPLICATION_SMIL ,
- MIME_APPLICATION_JAVA_ARCHIVE ,
- MIME_APPLICATION_JAVA ,
- MIME_APPLICATION_OCTET_STREAM ,
- MIME_APPLICATION_STUDIOM ,
- MIME_APPLICATION_FUNMEDIA ,
- MIME_APPLICATION_MSWORD ,
- MIME_APPLICATION_PDF ,
- MIME_APPLICATION_SDP ,
- MIME_APPLICATION_RAM ,
- MIME_APPLICATION_ASTERIC ,
-
-
- MIME_APPLICATION_VND_WAP_XHTMLXML ,
- MIME_APPLICATION_VND_WAP_WMLC ,
- MIME_APPLICATION_VND_WAP_WMLSCRIPTC ,
- MIME_APPLICATION_VND_WAP_WTA_EVENTC ,
- MIME_APPLICATION_VND_WAP_UAPROF ,
- MIME_APPLICATION_VND_WAP_SIC ,
- MIME_APPLICATION_VND_WAP_SLC ,
- MIME_APPLICATION_VND_WAP_COC ,
- MIME_APPLICATION_VND_WAP_SIA ,
- MIME_APPLICATION_VND_WAP_CONNECTIVITY_WBXML ,
- MIME_APPLICATION_VND_WAP_MULTIPART_FORM_DATA ,
- MIME_APPLICATION_VND_WAP_MULTIPART_BYTERANGES ,
- MIME_APPLICATION_VND_WAP_MULTIPART_MIXED ,
- MIME_APPLICATION_VND_WAP_MULTIPART_RELATED ,
- MIME_APPLICATION_VND_WAP_MULTIPART_ALTERNATIVE ,
- MIME_APPLICATION_VND_WAP_MULTIPART_ASTERIC ,
- MIME_APPLICATION_VND_WAP_WBXML ,
- MIME_APPLICATION_VND_OMA_DD_XML ,
- MIME_APPLICATION_VND_OMA_DRM_MESSAGE ,
- MIME_APPLICATION_VND_OMA_DRM_CONTENT ,
- MIME_APPLICATION_VND_OMA_DRM_RIGHTS_XML ,
- MIME_APPLICATION_VND_OMA_DRM_RIGHTS_WBXML ,
- MIME_APPLICATION_VND_OMA_DRM_RO_XML ,
- MIME_APPLICATION_VND_OMA_DRM_DCF ,
- MIME_APPLICATION_VND_OMA_ROAPPDU_XML ,
- MIME_APPLICATION_VND_OMA_ROAPTRIGGER_XML,
- MIME_APPLICATION_VND_SMAF ,
- MIME_APPLICATION_VND_RN_REALMEDIA ,
- MIME_APPLICATION_VND_SUN_J2ME_JAVA_ARCHIVE ,
- MIME_APPLICATION_VND_SAMSUNG_THEME ,
- MIME_APPLICATION_VND_EXCEL ,
- MIME_APPLICATION_VND_POWERPOINT,
- MIME_APPLICATION_VND_MSWORD,
-
-
- MIME_APPLICATION_X_HDMLC ,
- MIME_APPLICATION_X_X968_USERCERT ,
- MIME_APPLICATION_X_WWW_FORM_URLENCODED ,
- MIME_APPLICATION_X_SMAF ,
- MIME_APPLICATION_X_FLASH ,
- MIME_APPLICATION_X_EXCEL ,
- MIME_APPLICATION_X_POWERPOINT ,
-
-
- MIME_AUDIO_BASIC,
- MIME_AUDIO_MPEG ,
- MIME_AUDIO_MP3 ,
- MIME_AUDIO_MPG3 ,
- MIME_AUDIO_MPEG3 ,
- MIME_AUDIO_MPG ,
- MIME_AUDIO_AAC ,
- MIME_AUDIO_G72 ,
- MIME_AUDIO_AMR ,
- MIME_AUDIO_AMR_WB ,
- MIME_AUDIO_MMF ,
- MIME_AUDIO_SMAF ,
- MIME_AUDIO_IMELODY ,
- MIME_AUDIO_IMELODY2 ,
- MIME_AUDIO_MELODY ,
- MIME_AUDIO_MID ,
- MIME_AUDIO_MIDI ,
- MIME_AUDIO_SP_MIDI ,
- MIME_AUDIO_WAVE ,
- MIME_AUDIO_WAV ,
- MIME_AUDIO_3GPP ,
- MIME_AUDIO_MP4 ,
- MIME_AUDIO_MP4A_LATM ,
- MIME_AUDIO_M4A ,
- MIME_AUDIO_MPEG4,
- MIME_AUDIO_WMA,
- MIME_AUDIO_XMF,
- MIME_AUDIO_IMY,
- MIME_AUDIO_MOBILE_XMF,
-
-
- MIME_AUDIO_VND_RN_REALAUDIO ,
-
-
- MIME_AUDIO_X_MPEG ,
- MIME_AUDIO_X_MP3 ,
- MIME_AUDIO_X_MPEG3 ,
- MIME_AUDIO_X_MPG ,
- MIME_AUDIO_X_AMR ,
- MIME_AUDIO_X_MMF ,
- MIME_AUDIO_X_SMAF ,
- MIME_AUDIO_X_IMELODY ,
- MIME_AUDIO_X_MIDI ,
- MIME_AUDIO_X_MPEGAUDIO ,
- MIME_AUDIO_X_PN_REALAUDIO ,
- MIME_AUDIO_X_PN_MULTIRATE_REALAUDIO ,
- MIME_AUDIO_X_PN_MULTIRATE_REALAUDIO_LIVE ,
- MIME_AUDIO_X_WAVE ,
- MIME_AUDIO_X_WAV ,
- MIME_AUDIO_X_MS_WMA ,
- MIME_AUDIO_X_MID ,
- MIME_AUDIO_X_MS_ASF ,
- MIME_AUDIO_X_XMF,
-
-
- MIME_IMAGE_GIF ,
- MIME_IMAGE_JPEG ,
- MIME_IMAGE_JPG ,
- MIME_IMAGE_TIFF ,
- MIME_IMAGE_TIF ,
- MIME_IMAGE_PNG ,
- MIME_IMAGE_WBMP ,
- MIME_IMAGE_PJPEG ,
- MIME_IMAGE_BMP ,
- MIME_IMAGE_SVG ,
- MIME_IMAGE_SVG1 ,
- MIME_IMAGE_VND_WAP_WBMP ,
- MIME_IMAGE_VND_TMO_GIF,
- MIME_IMAGE_VND_TMO_JPG,
- MIME_IMAGE_X_BMP ,
-
-
- MIME_MESSAGE_RFC822 ,
-
-
- MIME_MULTIPART_MIXED ,
- MIME_MULTIPART_RELATED ,
- MIME_MULTIPART_ALTERNATIVE ,
- MIME_MULTIPART_FORM_DATA ,
- MIME_MULTIPART_BYTERANGE ,
- MIME_MULTIPART_REPORT ,
- MIME_MULTIPART_VOICE_MESSAGE ,
-
-
- MIME_TEXT_TXT ,
- MIME_TEXT_HTML ,
- MIME_TEXT_PLAIN ,
- MIME_TEXT_CSS ,
- MIME_TEXT_XML ,
- MIME_TEXT_IMELODY ,
- MIME_TEXT_CALENDAR,
- MIME_TEXT_VND_WAP_WMLSCRIPT ,
- MIME_TEXT_VND_WAP_WML ,
- MIME_TEXT_VND_WAP_WTA_EVENT ,
- MIME_TEXT_VND_WAP_CONNECTIVITY_XML ,
- MIME_TEXT_VND_WAP_SI ,
- MIME_TEXT_VND_WAP_SL ,
- MIME_TEXT_VND_WAP_CO ,
- MIME_TEXT_VND_SUN_J2ME_APP_DESCRIPTOR ,
- MIME_TEXT_X_HDML ,
- MIME_TEXT_X_VCALENDAR ,
- MIME_TEXT_X_VCARD ,
- MIME_TEXT_X_IMELODY ,
- MIME_TEXT_X_IMELODY2 ,
- MIME_TEXT_X_VNOTE ,
- MIME_TEXT_X_VTODO,
-
- MIME_VIDEO_MPEG4 ,
- MIME_VIDEO_MP4 ,
- MIME_VIDEO_H263 ,
- MIME_VIDEO_3GPP ,
- MIME_VIDEO_3GP ,
- MIME_VIDEO_AVI ,
- MIME_VIDEO_SDP ,
- MIME_VIDEO_MP4_ES,
- MIME_VIDEO_MPEG ,
- MIME_VIDEO_MOV ,
- MIME_VIDEO_VND_RN_REALVIDEO ,
- MIME_VIDEO_VND_RN_REALMEDIA ,
- MIME_VIDEO_X_MP4 ,
- MIME_VIDEO_X_PV_MP4 ,
- MIME_VIDEO_X_PN_REALVIDEO ,
- MIME_VIDEO_X_PN_MULTIRATE_REALVIDEO ,
- MIME_VIDEO_X_MS_WMV ,
- MIME_VIDEO_X_MS_ASF,
- MIME_VIDEO_X_PV_PVX ,
-
- MIME_UNKNOWN // MIME_MAX
-};
-
-
-#define MIME_MAX_NUM 167
-#define EXT_MAX 68
-#define MIME_SUB_TYPE_VND 1
-#define MIME_SUB_TYPE_X 2
-
-int __MimeGetTableIndexInt(MimeType mime);
-int __MimeGetTableIndexString(const char *szMime);
-MimeMainType __MimeGetMainTypeName(const char *szType);
-
-/*
- * This function checks main type of a MIME.
- *
- * @param mime [in] Enumeration number for a MIME type.
- * @return This function returns main type of a MIME.
- */
-MimeMainType MimeGetMainTypeInt(MimeType mime)
-{
- int index;
-
- index = __MimeGetTableIndexInt(mime);
- if (index == MIME_UNKNOWN)
- return MIME_MAINTYPE_ETC;
-
- return mimeTable[index].mainType;
-}
-
-
-/*
- * This function returns a extension name for a specified MIME.
- *
- * @param mime [in] Enumeration number for a MIME type.
- * @return This function returns Extension string.
- */
-char *MimeGetExtFromMimeInt(MimeType mime)
-{
- int index;
-
- index = __MimeGetTableIndexInt(mime);
- if (index == MIME_UNKNOWN)
- return NULL;
-
- return (char *)mimeTable[index].szExt;
-}
-
-/*
- * This function returns index number in MIME definition table with MIME enumeration.
- * Internal function.
- */
-int __MimeGetTableIndexInt(MimeType mime)
-{
- int type;
- int subtype;
- int index;
- int tableIndex;
-
- if (mime == MIME_UNKNOWN)
- return MIME_UNKNOWN;
-
- type = (mime & 0xf000) >> 12;
- subtype = (mime & 0x0f00) >> 8;
- index = (mime & 0x003f);
-
- //If 'type' is zero, mimeTableIndex's array value have a minus value
- //If 'type' is zero, mime type is '*/*'
- if (type == 0)
- tableIndex = 0;
- else
- tableIndex = mimeTableIndex[(type - 1) * 3 + subtype] + index;
-
- return tableIndex;
-}
-
-/*
- * This function returns index number in MIME definition table with MIME string.
- * Internal function.
- */
-int __MimeGetTableIndexString(const char *szMime)
-{
- int type;
- int subtype;
- char szType[50];
- char szSubType[50];
- char *szTmpStart = NULL;
- char c;
- int i = 0;
- int j = 0;
- int start;
- int end;
- char *szMIMEType = NULL;
- int len;
-
- if (szMime == NULL) {
- MSG_DEBUG("szMime is NULL");
- return MIME_UNKNOWN;
- }
-
- szMIMEType = (char * )malloc(strlen(szMime) + 1);
-
- if (szMIMEType == NULL) {
- MSG_DEBUG("szMime is NULL");
- return MIME_UNKNOWN;
- }
-
- memset(szMIMEType, 0, strlen(szMime) + 1);
-
- if (!strcmp(szMime, "*/*")) {
- free(szMIMEType);
- return 0;
- }
-
- strncpy(szMIMEType, szMime, strlen(szMime));
- type = 0;
- subtype = 0;
-
- szTmpStart = szMIMEType;
- len = strlen(szTmpStart);
-
- while (true) {
- if (i >= len) {
- free(szMIMEType);
- return MIME_UNKNOWN;
- }
-
- c = szTmpStart[i++];
-
- if (c == '/') {
- szType[j] = '\0';
- type = __MimeGetMainTypeName(szType);
- szTmpStart = &szTmpStart[i];
- break;
- } else
- szType[j++] = c;
- }
-
- i = 0;
- j = 0;
- len = strlen(szTmpStart);
-
- while (true) {
- c = szTmpStart[i++];
- if (i > len) {
- szSubType[j] = '\0';
- break;
- }
-
- if (c == '.') {
- szSubType[j] = '\0';
- if (!strcasecmp(szSubType, "vnd"))
- subtype = MIME_SUB_TYPE_VND;
- break;
- } else if (c == '-') {
- szSubType[j] = '\0';
- if (!strcasecmp(szSubType, "x"))
- subtype = MIME_SUB_TYPE_X;
- break;
- } else
- szSubType[j++] = c;
- }
-
-
- start = mimeTableIndex[type * 3 + subtype];
-
- if (type == MIME_MAINTYPE_VIDEO && subtype == MIME_SUB_TYPE_X)
- end = MIME_MAX_NUM;
- else
- end = mimeTableIndex[type * 3 + subtype + 1];
-
- if (start == end && type < MIME_MAINTYPE_VIDEO) {
- end = mimeTableIndex[(type + 1) * 3 + subtype + 1];
- }
-
-
- for (i = start; i < end; i++) {
- if (i >= MIME_MAX_NUM)
- break;
-
- if (!strcasecmp(mimeTable[i].szMIME, szMime)) {
- free(szMIMEType);
- return i;
- }
- }
-
- free(szMIMEType);
- return MIME_UNKNOWN;
-}
-
-/*
- * This function returns main type of MIME : Internal function.
- */
-MimeMainType __MimeGetMainTypeName(const char *szType)
-{
- if (szType == NULL )
- return MIME_MAINTYPE_APPLICATION;
-
- if (!strcasecmp(szType, "application"))
- return MIME_MAINTYPE_APPLICATION;
- else if (!strcasecmp(szType, "audio"))
- return MIME_MAINTYPE_AUDIO;
- else if (!strcasecmp(szType, "image"))
- return MIME_MAINTYPE_IMAGE;
- else if (!strcasecmp(szType, "message"))
- return MIME_MAINTYPE_MESSAGE;
- else if (!strcasecmp(szType, "multipart"))
- return MIME_MAINTYPE_MULTIPART;
- else if (!strcasecmp(szType, "text"))
- return MIME_MAINTYPE_TEXT;
- else if (!strcasecmp(szType, "video"))
- return MIME_MAINTYPE_VIDEO;
-
- return MIME_MAINTYPE_APPLICATION;
-}
-
-
-//For Decode
-// MimeString -> MimeInt
-MimeType MimeGetMimeIntFromMimeString(char *szMimeStr)
-{
- int index = __MimeGetTableIndexString(szMimeStr);
- if (index == MIME_UNKNOWN) {
- return MIME_UNKNOWN;
- } else {
- return (MimeType)mimeTableEnum[index];
- }
-}
-
-// MimeInt -> MimeString
-char *MimeGetMimeStringFromMimeInt(int mimeType)
-{
- int idx = __MimeGetTableIndexInt((MimeType)mimeType);
-
- if (idx == MIME_UNKNOWN)
- return NULL;
-
- return (char *)mimeTable[idx].szMIME;
-}
-
-
-// BinaryCode -> MimeInt
-MimeType MimeGetMimeIntFromBi(int binCode)
-{
- int index;
-
- if (binCode < 0x00 || binCode > 0x4b)
- return MIME_UNKNOWN;
-
- for (index = 0; index < MIME_MAX_NUM; index++) {
- if (binCode == mimeTable[index].binary)
- return (MimeType)mimeTableEnum[index];
- }
-
- return MIME_UNKNOWN;
-}
-
-// Mimeint -> Binary Value
-int MimeGetBinaryValueFromMimeInt(MimeType mime)
-{
- int index;
-
- index = __MimeGetTableIndexInt(mime);
- if (index == MIME_UNKNOWN)
- return UNDEFINED_BINARY;
-
- return mimeTable[index].binary;
-}
-
-typedef struct {
- const char *szExt;
- int mainType;
- int enumMime;
- const char *szContentType;
-} ExtTableItem;
-
-#define EXT_TABLE_SIZE (56)
-
-const ExtTableItem extTable[EXT_TABLE_SIZE] = {
-
- //text
- {"txt", MIME_MAINTYPE_TEXT, MIME_TEXT_PLAIN, "text/plain"},
- {"html", MIME_MAINTYPE_TEXT, MIME_TEXT_HTML, "text/html"},
- {"xhtml", MIME_MAINTYPE_TEXT, MIME_APPLICATION_XHTML_XML, "application/xhtml+xml"},
- {"vcs", MIME_MAINTYPE_TEXT, MIME_TEXT_X_VCALENDAR, "text/x-vCalendar"},
- {"vcf", MIME_MAINTYPE_TEXT, MIME_TEXT_X_VCARD, "text/x-vCard"},
- {"vnt", MIME_MAINTYPE_TEXT, MIME_TEXT_X_VNOTE, "text/x-vnote"},
- {"vts", MIME_MAINTYPE_TEXT, MIME_TEXT_X_VTODO, "text/x-vtodo"},
- {"ics", MIME_MAINTYPE_TEXT, MIME_TEXT_CALENDAR, "text/calendar"},
-
- //image
- {"gif", MIME_MAINTYPE_IMAGE, MIME_IMAGE_GIF, "image/gif"},
- //{"jpg", MIME_MAINTYPE_IMAGE, MIME_IMAGE_JPG, "image/jpg"},
- {"jpg", MIME_MAINTYPE_IMAGE, MIME_IMAGE_JPEG, "image/jpeg"},
- {"jpeg", MIME_MAINTYPE_IMAGE, MIME_IMAGE_JPEG, "image/jpeg"},
- {"tiff", MIME_MAINTYPE_IMAGE, MIME_IMAGE_TIFF, "image/tiff"},
- {"tif", MIME_MAINTYPE_IMAGE, MIME_IMAGE_TIF, "image/tif"},
- {"png", MIME_MAINTYPE_IMAGE, MIME_IMAGE_PNG, "image/png"},
- {"wbmp", MIME_MAINTYPE_IMAGE, MIME_IMAGE_VND_WAP_WBMP, "image/vnd.wap.wbmp"},
- {"bmp", MIME_MAINTYPE_IMAGE, MIME_IMAGE_BMP, "image/bmp"},
- {"svg", MIME_MAINTYPE_IMAGE, MIME_IMAGE_SVG, "image/svg+xml"},
-
- //audio
- {"snd", MIME_MAINTYPE_AUDIO, MIME_AUDIO_BASIC, "audio/basic"},
- {"amr", MIME_MAINTYPE_AUDIO, MIME_AUDIO_AMR, "audio/amr"},
- {"m4a", MIME_MAINTYPE_AUDIO, MIME_AUDIO_M4A, "audio/m4a"},
- {"3gp", MIME_MAINTYPE_AUDIO, MIME_AUDIO_3GPP, "audio/3gpp"},
- {"3gpp", MIME_MAINTYPE_AUDIO, MIME_AUDIO_3GPP, "audio/3gpp"},
- {"mp3", MIME_MAINTYPE_AUDIO, MIME_AUDIO_MPEG, "audio/mpeg"},
- {"aac", MIME_MAINTYPE_AUDIO, MIME_AUDIO_AAC, "audio/aac"},
- {"imy", MIME_MAINTYPE_AUDIO, MIME_AUDIO_IMELODY, "audio/imelody"},
- {"mid", MIME_MAINTYPE_AUDIO, MIME_AUDIO_MID, "audio/mid"},
- {"mmf", MIME_MAINTYPE_AUDIO, MIME_AUDIO_MMF, "audio/mmf"},
- {"spm", MIME_MAINTYPE_AUDIO, MIME_AUDIO_SP_MIDI, "audio/sp-midi"},
- {"wav", MIME_MAINTYPE_AUDIO, MIME_AUDIO_WAV, "audio/wav"},
- {"mp4", MIME_MAINTYPE_AUDIO, MIME_AUDIO_MP4, "audio/mp4"},
- {"wma", MIME_MAINTYPE_AUDIO, MIME_AUDIO_X_MS_WMA, "audio/x-ms-wma"},
- {"rm", MIME_MAINTYPE_AUDIO, MIME_AUDIO_VND_RN_REALAUDIO, "audio/vnd.rn-realaudio"},
- {"ra", MIME_MAINTYPE_AUDIO, MIME_AUDIO_VND_RN_REALAUDIO, "audio/vnd.rn-realaudio"},
-
- //video
- {"3gp", MIME_MAINTYPE_VIDEO, MIME_VIDEO_3GPP, "video/3gpp"},
- {"3gpp", MIME_MAINTYPE_VIDEO, MIME_VIDEO_3GPP, "video/3gpp"},
- {"mp4", MIME_MAINTYPE_VIDEO, MIME_VIDEO_MP4, "video/mp4"},
- {"rm", MIME_MAINTYPE_VIDEO, MIME_VIDEO_VND_RN_REALVIDEO, "video/vnd.rn-realvideo"},
- {"rv", MIME_MAINTYPE_VIDEO, MIME_VIDEO_VND_RN_REALVIDEO, "video/vnd.rn-realvideo"},
- {"avi", MIME_MAINTYPE_VIDEO, MIME_VIDEO_AVI, "video/avi"},
- {"asf", MIME_MAINTYPE_VIDEO, MIME_VIDEO_X_MS_ASF, "video/x-ms-asf"},
- {"mov", MIME_MAINTYPE_VIDEO, MIME_VIDEO_MOV, "video/quicktime"},
-
- //application
- {"smil", MIME_MAINTYPE_APPLICATION, MIME_APPLICATION_SMIL, "application/smil"},
- {"rm", MIME_MAINTYPE_APPLICATION, MIME_APPLICATION_VND_RN_REALMEDIA, "application/vnd.rn-realmedia"},
- {"ram", MIME_MAINTYPE_APPLICATION, MIME_APPLICATION_RAM, "application/ram"},
- {"ppt", MIME_MAINTYPE_APPLICATION, MIME_APPLICATION_VND_POWERPOINT, "application/vnd.ms-powerpoint"},
- {"xls", MIME_MAINTYPE_APPLICATION, MIME_APPLICATION_VND_EXCEL, "application/vnd.ms-excel"},
- {"doc", MIME_MAINTYPE_APPLICATION, MIME_APPLICATION_VND_MSWORD, "applcation/vnd.ms-word"},
- {"pdf", MIME_MAINTYPE_APPLICATION, MIME_APPLICATION_PDF, "application/pdf"},
- {"swf", MIME_MAINTYPE_APPLICATION, MIME_APPLICATION_X_FLASH, "application/x-shockwave-flash"},
- {"dm", MIME_MAINTYPE_APPLICATION, MIME_APPLICATION_VND_OMA_DRM_MESSAGE, "application/vnd.oma.drm.message"},
- {"dcf", MIME_MAINTYPE_APPLICATION, MIME_APPLICATION_VND_OMA_DRM_CONTENT, "application/vnd.oma.drm.content"},
- {"dd", MIME_MAINTYPE_APPLICATION, MIME_APPLICATION_VND_OMA_DD_XML, "application/vnd.oma.dd+xml"},
- {"ro", MIME_MAINTYPE_APPLICATION, MIME_APPLICATION_VND_OMA_DRM_RIGHTS_XML, "application/vnd.oma.drm.rights+xml"},
- {"ro", MIME_MAINTYPE_APPLICATION, MIME_APPLICATION_VND_OMA_DRM_RIGHTS_WBXML, "application/vnd.oma.drm.rights+wbxml"},
- {"oro", MIME_MAINTYPE_APPLICATION, MIME_APPLICATION_VND_OMA_DRM_RO_XML, "application/vnd.oma.drm.ro+xml"},
- {"odf", MIME_MAINTYPE_APPLICATION, MIME_APPLICATION_VND_OMA_DRM_DCF, "application/vnd.oma.drm.dcf"},
-
-};
-
-//GetMimeType from File Extension
-bool MmsGetMimeTypeFromExt(MimeMainType mainType, const char *pExt, MimeType *pMimeType, const char **ppszMimeType)
-{
- const ExtTableItem *matchedItem = NULL;
-
- if (pExt == NULL)
- return false;
-
- if (pMimeType == NULL && ppszMimeType == NULL)
- return false;
-
- int extTableMainSize = sizeof(extTable)/sizeof(ExtTableItem);
-
- for (int i = 0; i < extTableMainSize; i++) {
-
- if (strcasecmp(extTable[i].szExt, pExt) == 0) {
-
- matchedItem = &extTable[i];
-
- if (mainType == extTable[i].mainType) {
- break;
- }
- }
- }
-
- if (matchedItem) {
- MSG_DEBUG("Found ext = [%s], mainType = [%d], mimeType = [0x%04x], ContentType = [%s]"
- , matchedItem->szExt
- , matchedItem->mainType
- , matchedItem->enumMime
- , matchedItem->szContentType);
-
- if (pMimeType)
- *pMimeType = (MimeType)matchedItem->enumMime;
-
- if (ppszMimeType)
- *ppszMimeType = matchedItem->szContentType;
-
- return true;
- }
-
- return false;
-}
-
-bool MmsGetMimeTypeFromFileName(MimeMainType mainType, const char *pFileName, MimeType *pMimeType, const char **ppszMimeType)
-{
- const char *pExt = NULL;
-
- if (pFileName == NULL)
- return false;
-
- if (pMimeType == NULL && ppszMimeType == NULL)
- return false;
-
- pExt = strrchr(pFileName, '.');
-
- if (pExt == NULL || *(pExt + 1) == '\0')
- return false;
-
- pExt = pExt + 1;
-
- return MmsGetMimeTypeFromExt(mainType, pExt, pMimeType, ppszMimeType);
-}
diff --git a/plugin/mms_plugin/MmsPluginMain.cpp b/plugin/mms_plugin/MmsPluginMain.cpp
index f3db2cf..c3471dc 100755
--- a/plugin/mms_plugin/MmsPluginMain.cpp
+++ b/plugin/mms_plugin/MmsPluginMain.cpp
@@ -77,8 +77,8 @@ msg_error_t MmsInitialize()
{
MSG_BEGIN();
- // remove temp files
- //MsgMmsInitDir();
+ /* remove temp files */
+/* MsgMmsInitDir(); */
MSG_END();
@@ -181,14 +181,14 @@ msg_error_t MmsUpdateMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S
msg_error_t err = MSG_SUCCESS;
try {
- if (pMsgInfo->networkStatus == MSG_NETWORK_NOT_SEND || pMsgInfo->networkStatus == MSG_NETWORK_SENDING) { //draft update
+ if (pMsgInfo->networkStatus == MSG_NETWORK_NOT_SEND || pMsgInfo->networkStatus == MSG_NETWORK_SENDING) { /* draft update */
err = MmsPluginStorage::instance()->updateMessage(pMsgInfo, pSendOptInfo, pFileData);
} else {
- //[Update Message ID & File path only in case of retrieve. Else update Message ID]
- if (pMsgInfo->msgType.subType == MSG_RETRIEVE_AUTOCONF_MMS || pMsgInfo->msgType.subType == MSG_RETRIEVE_MANUALCONF_MMS) { //retrieve conf
+ /* [Update Message ID & File path only in case of retrieve. Else update Message ID] */
+ if (pMsgInfo->msgType.subType == MSG_RETRIEVE_AUTOCONF_MMS || pMsgInfo->msgType.subType == MSG_RETRIEVE_MANUALCONF_MMS) { /* retrieve conf */
err = MmsPluginStorage::instance()->updateConfMessage(pMsgInfo);
} else {
- err = MmsPluginStorage::instance()->updateMsgServerID(pMsgInfo, pSendOptInfo); //update send conf
+ err = MmsPluginStorage::instance()->updateMsgServerID(pMsgInfo, pSendOptInfo); /* update send conf */
}
}
} catch (MsgException& e) {
@@ -285,7 +285,7 @@ msg_error_t MmsComposeReadReport(MSG_MESSAGE_INFO_S *pMsgInfo)
return MSG_SUCCESS;
}
-//FIXME::It used for kies but not now
+/* FIXME::It used for kies but not now */
msg_error_t MmsRestoreMsg(MSG_MESSAGE_INFO_S *pMsgInfo, char *pRcvBody, int rcvdBodyLen, char *filePath)
{
MSG_BEGIN();
@@ -299,7 +299,7 @@ msg_error_t MmsRestoreMsg(MSG_MESSAGE_INFO_S *pMsgInfo, char *pRcvBody, int rcvd
if ((pFile = MsgOpenFile(pMsgInfo->msgData, "rb+")) == NULL) {
MSG_DEBUG("File Open Error: %s", pMsgInfo->msgData);
} else {
- //Decode Header
+ /* Decode Header */
if (!MmsBinaryDecodeMsgHeader(pFile, rcvdBodyLen))
MSG_DEBUG("Decoding Header Failed \r\n");
@@ -314,7 +314,7 @@ msg_error_t MmsRestoreMsg(MSG_MESSAGE_INFO_S *pMsgInfo, char *pRcvBody, int rcvd
return MSG_ERR_NULL_POINTER;
}
- // create temp file
+ /* create temp file */
if (!MsgOpenCreateAndOverwriteFile(filePath, (char*)pRcvBody,rcvdBodyLen))
return MSG_ERR_PLUGIN_STORAGE;
}
diff --git a/plugin/mms_plugin/MmsPluginMessage.cpp b/plugin/mms_plugin/MmsPluginMessage.cpp
index 0e6a4e0..5e27b6c 100755
--- a/plugin/mms_plugin/MmsPluginMessage.cpp
+++ b/plugin/mms_plugin/MmsPluginMessage.cpp
@@ -30,12 +30,12 @@
#include "MmsPluginTypes.h"
#include "MmsPluginDebug.h"
#include "MmsPluginMessage.h"
-#include "MmsPluginMIME.h"
+#include "MsgUtilMime.h"
#include "MmsPluginStorage.h"
#include "MmsPluginUtil.h"
-#include "MmsPluginTcs.h"
#include "MsgSmil.h"
#include "MmsPluginAppBase.h"
+#include "MsgUtilFunction.h"
#define PRINT_KEY_VAL_STR(key, val)\
if (val) {\
@@ -109,7 +109,7 @@ char *MmsComposeAddress(const MSG_MESSAGE_INFO_S *pMsgInfo, int recipientType)
nAddressCnt = pMsgInfo->nAddressCnt;
- // Calculate allocated buffer size
+ /* Calculate allocated buffer size */
for (int i = 0; i < nAddressCnt; ++i) {
MSG_SEC_DEBUG("recipientType: %d, address value: %s", pMsgInfo->addressList[i].recipientType, pMsgInfo->addressList[i].addressVal);
@@ -124,7 +124,7 @@ char *MmsComposeAddress(const MSG_MESSAGE_INFO_S *pMsgInfo, int recipientType)
} else if (pMsgInfo->addressList[i].addressType == MSG_ADDRESS_TYPE_EMAIL) {
addrLen += strlen(pMsgInfo->addressList[i].addressVal);
} else
- ; // Need to consider IPV4, IPV6, and Alias formatted address
+ ; /* Need to consider IPV4, IPV6, and Alias formatted address */
nRecpCnt++;
}
@@ -134,7 +134,7 @@ char *MmsComposeAddress(const MSG_MESSAGE_INFO_S *pMsgInfo, int recipientType)
addrLen = addrLen + nRecpCnt - 1;
szCompose = (char *)calloc(addrLen + 1, 1);
- // Address String copy
+ /* Address String copy */
for (int i = 0; i < nAddressCnt; ++i) {
if (pMsgInfo->addressList[i].recipientType == recipientType) {
if (szCompose && strlen(szCompose) > 0)
@@ -147,7 +147,7 @@ char *MmsComposeAddress(const MSG_MESSAGE_INFO_S *pMsgInfo, int recipientType)
} else if (pMsgInfo->addressList[i].addressType == MSG_ADDRESS_TYPE_EMAIL) {
snprintf(pString, MSG_LOCALE_NAME_LEN + MSG_ADDR_LEN + 3, "%s", pMsgInfo->addressList[i].addressVal);
} else
- ; // Need to consider IPV4, IPV6, and Alias formatted address
+ ; /* Need to consider IPV4, IPV6, and Alias formatted address */
g_strlcat(szCompose, pString, addrLen + 1);
}
@@ -187,7 +187,7 @@ bool MmsInsertPresentation(MmsMsg *pMsg, MimeType mimeType, const char *content_
if (content_id && strlen(content_id) > 0) {
snprintf(pMsg->msgBody.presentationType.szContentID, MSG_MSG_ID_LEN + 1, "%s", content_id);
} else {
- snprintf(pMsg->msgBody.presentationType.szContentID, MSG_MSG_ID_LEN + 1, "<_S_>");//default
+ snprintf(pMsg->msgBody.presentationType.szContentID, MSG_MSG_ID_LEN + 1, "<_S_>"); /* default */
}
snprintf(pMsg->msgType.param.szStart, MSG_MSG_ID_LEN + 1, "%s", pMsg->msgBody.presentationType.szContentID);
@@ -226,7 +226,17 @@ MsgMultipart *MmsMakeMultipart(MimeType mimeType, char *szTitleName, char *szOrg
if (szTitleName && szTitleName[0]) {
memset(pMultipart->type.param.szName, 0, MSG_LOCALE_FILENAME_LEN_MAX + 1);
- strncpy(pMultipart->type.param.szName, szTitleName, MSG_LOCALE_FILENAME_LEN_MAX);
+
+ gchar *tmpTitleName = msg_replace_non_ascii_char(szTitleName, '_');
+ if (tmpTitleName) {
+ MSG_SEC_DEBUG("tmpTitleName = [%s]", tmpTitleName);
+ snprintf(pMultipart->type.param.szName, MSG_LOCALE_FILENAME_LEN_MAX + 1, "%s", tmpTitleName);
+ g_free(tmpTitleName);
+ tmpTitleName = NULL;
+ } else {
+ MSG_WARN("tmpTitleName is NULL.");
+ snprintf(pMultipart->type.param.szName, MSG_LOCALE_FILENAME_LEN_MAX + 1, "%s", szTitleName);
+ }
}
if (szContentID && szContentID[0]) {
@@ -236,7 +246,14 @@ MsgMultipart *MmsMakeMultipart(MimeType mimeType, char *szTitleName, char *szOrg
if (szContentLocation && szContentLocation[0]) {
memset(pMultipart->type.szContentLocation, 0, MSG_MSG_ID_LEN + 1);
- snprintf(pMultipart->type.szContentLocation, MSG_MSG_ID_LEN + 1, "%s", szContentLocation);
+
+ gchar *tmpContentLocation = msg_replace_non_ascii_char(szContentLocation, '_');
+ if (tmpContentLocation ) {
+ MSG_SEC_DEBUG("tmpContentLocation = [%s]", tmpContentLocation);
+ snprintf(pMultipart->type.szContentLocation, MSG_MSG_ID_LEN + 1, "%s", tmpContentLocation);
+ g_free(tmpContentLocation);
+ tmpContentLocation = NULL;
+ }
}
if (MmsIsTextType(mimeType) == true) {
@@ -273,7 +290,7 @@ void MmsComposeNotiMessage(MmsMsg *pMmsMsg, msg_message_id_t msgID)
pMmsMsg->mmsAttrib.version = mmsHeader.version;
- // setting date
+ /* setting date */
time(&RawTime);
localtime_r(&RawTime, &timeInfo);
nTimeInSecs = mktime(&timeInfo);
@@ -325,7 +342,7 @@ void MmsComposeReadReportMessage(MmsMsg *pMmsMsg, const MSG_MESSAGE_INFO_S *pMsg
MmsInitMsgType(&pMmsMsg->msgType);
MmsInitMsgBody(&pMmsMsg->msgBody);
- // setting mmsMsg structure
+ /* setting mmsMsg structure */
pMmsMsg->mailbox = pMsgInfo->folderId;
pMmsMsg->msgID = pMsgInfo->msgId;
@@ -335,19 +352,19 @@ void MmsComposeReadReportMessage(MmsMsg *pMmsMsg, const MSG_MESSAGE_INFO_S *pMsg
pMmsMsg->mmsAttrib.dataType = MMS_DATATYPE_DRAFT;
- // setting date
+ /* setting date */
time(&RawTime);
localtime_r(&RawTime, &timeInfo);
nTimeInSecs = mktime(&timeInfo);
pMmsMsg->mmsAttrib.date = nTimeInSecs;
- // setting szMsgId
+ /* setting szMsgId */
MmsPluginStorage::instance()->getMmsMessageId(selectedMsgId, pMmsMsg);
- //setting subject
+ /* setting subject */
snprintf(pMmsMsg->mmsAttrib.szSubject, sizeof(pMmsMsg->mmsAttrib.szSubject), "%s", pMsgInfo->subject);
- //setting adddress
+ /* setting adddress */
MmsSetMsgAddressList(&pMmsMsg->mmsAttrib, pMsgInfo);
if (pMmsMsg->mmsAttrib.szTo)
@@ -359,8 +376,10 @@ msg_error_t MmsMakeMultipartThumbnailInfo(MMS_MULTIPART_DATA_S *pMultipart, char
if (pMultipart == NULL || thumbnail_path == NULL)
return MSG_ERR_NULL_POINTER;
-// if (MimeGetMainTypeString(MimeGetMimeStringFromMimeInt(pMultipart->type)) != MIME_MAINTYPE_VIDEO)
-// return MSG_ERR_INVALID_PARAMETER;
+/*
+ if (MimeGetMainTypeString(MimeGetMimeStringFromMimeInt(pMultipart->type)) != MIME_MAINTYPE_VIDEO)
+ return MSG_ERR_INVALID_PARAMETER;
+*/
char szFileName[MSG_FILENAME_LEN_MAX+1] = {0, };
char szFileNameWoExt[MSG_FILENAME_LEN_MAX+1] = {0, };
@@ -371,32 +390,40 @@ msg_error_t MmsMakeMultipartThumbnailInfo(MMS_MULTIPART_DATA_S *pMultipart, char
memset(szFileName, 0x00, MSG_FILENAME_LEN_MAX+1);
memset(thumbPath, 0x00, MSG_FILEPATH_LEN_MAX);
- MSG_DEBUG("drm type = %d, %s", pMultipart->drmType, pMultipart->szFilePath);
+ MSG_SEC_DEBUG("drm type = %d, %s", pMultipart->drmType, pMultipart->szFilePath);
if (pMultipart->drmType == MSG_DRM_TYPE_NONE) {
pszOrgFileName = strrchr(pMultipart->szFilePath, '/');
- pszExt = strrchr(pMultipart->szFilePath, '.');
- if (NULL == pszOrgFileName || NULL == pszExt) {
+ if (pszOrgFileName) {
+ pszExt = strrchr(pszOrgFileName, '.');
+ } else {
MSG_DEBUG("Fail in getting filename without extension string");
return MSG_ERR_PLUGIN_STORAGE;
}
- strncpy(szFileNameWoExt, pszOrgFileName + 1, strlen(pszOrgFileName + 1) - strlen(pszExt));
+ if (pszExt) {
+ strncpy(szFileNameWoExt, pszOrgFileName + 1, strlen(pszOrgFileName + 1) - strlen(pszExt));
+ } else {
+ if (strlen(pszOrgFileName + 1) <= sizeof(szFileNameWoExt))
+ strncpy(szFileNameWoExt, pszOrgFileName + 1, strlen(pszOrgFileName + 1));
+ else
+ strncpy(szFileNameWoExt, pszOrgFileName + 1, sizeof(szFileNameWoExt));
+ }
snprintf(szFileName, MSG_FILENAME_LEN_MAX+1, "thumb_msg_%s", szFileNameWoExt);
- if (!strcasecmp(pszExt, ".png")) {
+ if (pszExt && !strcasecmp(pszExt, ".png")) {
snprintf(thumbPath, MSG_FILEPATH_LEN_MAX, MSG_THUMBNAIL_PATH"%s.png", szFileName);
} else {
snprintf(thumbPath, MSG_FILEPATH_LEN_MAX, MSG_THUMBNAIL_PATH"%s.jpg", szFileName);
}
- if (MmsMakeImageThumbnail(pMultipart->szFilePath, thumbPath) == true) {
+ if (MakeThumbnail(pMultipart->szFilePath, thumbPath) == true) {
memcpy(thumbnail_path, &thumbPath, strlen(thumbPath));
- MSG_DEBUG("Generated thumbnail: %s ", thumbnail_path);
+ MSG_SEC_DEBUG("Generated thumbnail: %s ", thumbnail_path);
return MSG_SUCCESS;
} else {
- MSG_DEBUG("Fail of generating thumbnail: %s to %s", pMultipart->szFilePath, thumbPath);
+ MSG_SEC_DEBUG("Fail of generating thumbnail: %s to %s", pMultipart->szFilePath, thumbPath);
}
}
@@ -433,8 +460,8 @@ void MmsPrintFileInfoForVLD(MMS_MESSAGE_DATA_S *pMmsMsg)
int attachCnt = _MsgMmsGetAttachCount(pMmsMsg);
if (attachCnt > 0) {
for (int i = 0; i < pMmsMsg->attachCnt; i++) {
- MMS_ATTACH_S *pAttach = _MsgMmsGetAttachment(pMmsMsg, i);
- MSG_MMS_VLD_FILE("[%s], %d", pAttach->szFilePath, MsgGetFileSize(pAttach->szFilePath));
+ MMS_ATTACH_S *pAttach = _MsgMmsGetAttachment(pMmsMsg, i);
+ MSG_SEC_DEBUG("[%s], %d", pAttach->szFilePath, MsgGetFileSize(pAttach->szFilePath));
}
}
}
@@ -465,7 +492,7 @@ bool IsMatchedMedia(MMS_MEDIA_S *media, MMS_MULTIPART_DATA_S *pMultipart)
}
}
- MSG_DEBUG("There is not matched media cid [%s], cl, [%s], multipart cid [%s], cl, [%s]", media->szContentID, media->szContentLocation, pMultipart->szContentID, pMultipart->szContentLocation);
+ MSG_SEC_DEBUG("There is not matched media cid [%s], cl, [%s], multipart cid [%s], cl, [%s]", media->szContentID, media->szContentLocation, pMultipart->szContentID, pMultipart->szContentLocation);
return false;
}
@@ -509,13 +536,14 @@ bool MmsFindAndInsertPart(MMS_MESSAGE_DATA_S *pMsgData, MMS_MULTIPART_DATA_S *pM
MMS_MEDIA_S *media = (MMS_MEDIA_S *)g_list_nth_data(page->medialist, mediaIdx);
- if (media) { // add media
- if (IsMatchedMedia(media, pMultipart) == true) { //matched media
-
-// if (media->mediatype == MMS_SMIL_MEDIA_IMG_OR_VIDEO) { // ref type is not insert part
-// MSG_DEBUG("## Matched but media type is ref ##");
-// return false;
-// }
+ if (media) { /* add media */
+ if (IsMatchedMedia(media, pMultipart) == true) { /* matched media */
+#if 0
+ if (media->mediatype == MMS_SMIL_MEDIA_IMG_OR_VIDEO) { /* ref type is not insert part */
+ MSG_DEBUG("## Matched but media type is ref ##");
+ return false;
+ }
+#endif
insert_media = true;
media->drmType = pMultipart->drmType;
@@ -529,9 +557,9 @@ bool MmsFindAndInsertPart(MMS_MESSAGE_DATA_S *pMsgData, MMS_MULTIPART_DATA_S *pM
, pageIdx, mediaIdx, media, media->szFilePath, media->szFileName, media->szContentID, media->szContentLocation, media->szContentType);
}
}
- } //end for media list
+ } /* end for media list */
}
- } //end for page list
+ } /* end for page list */
}
return insert_media;
@@ -604,7 +632,7 @@ bool MmsInsertMixedPartToMmsData(MMS_MESSAGE_DATA_S *pMsgData, MMS_MULTIPART_DAT
case MIME_MAINTYPE_VIDEO:
mediatype = MMS_SMIL_MEDIA_VIDEO;
break;
- default :
+ default:
mediatype = MMS_SMIL_MEDIA_INVALID;
break;
}
@@ -636,8 +664,8 @@ bool MmsInsertMixedPartToMmsData(MMS_MESSAGE_DATA_S *pMsgData, MMS_MULTIPART_DAT
return false;
}
} else {
- if (pPage) g_free(pPage);
- if (media) g_free(media);
+ g_free(pPage);
+ g_free(media);
return false;
}
} else {
@@ -725,7 +753,7 @@ bool MmsConvertMsgData(MmsMsg *pMsg, MMS_MESSAGE_DATA_S *pMmsMsg)
{
MSG_BEGIN();
- //bzero(pMmsMsg, sizeof(MMS_MESSAGE_DATA_S));
+/* bzero(pMmsMsg, sizeof(MMS_MESSAGE_DATA_S)); */
pMmsMsg->regionCnt = 0;
pMmsMsg->pageCnt = 0;
pMmsMsg->attachCnt = 0;
@@ -919,7 +947,7 @@ int MmsUpdatePreviewData(MSG_MESSAGE_INFO_S *pMsgInfo)
MmsPluginStorage::instance()->getMmsRawFilePath(pMsgInfo->msgId, szFullPath, sizeof(szFullPath));
MmsPluginDecoder::instance()->decodeMmsPdu(mmsMsg, pMsgInfo->msgId, szFullPath);
- {//make Preview info for APP
+ { /* make Preview info for APP */
MmsPluginAppBase appBase(mmsMsg);
appBase.makePreviewInfo(pMsgInfo->msgId, true, szFullPath);
appBase.getFirstPageTextFilePath(pMsgInfo->msgText, sizeof(pMsgInfo->msgText));
@@ -929,7 +957,7 @@ int MmsUpdatePreviewData(MSG_MESSAGE_INFO_S *pMsgInfo)
return 0;
}
-//MmsMsg -> MMS_DATA_S
+/* MmsMsg -> MMS_DATA_S */
bool MmsConvertMmsData(MmsMsg *pMmsMsg, MMS_DATA_S *pMmsData)
{
MSG_BEGIN();
@@ -1014,12 +1042,12 @@ bool MmsConvertMmsData(MmsMsg *pMmsMsg, MMS_DATA_S *pMmsData)
return true;
}
-//For Encode raw file
+/* For Encode raw file */
bool MmsConvertMmsMsg(MmsMsg *pMmsMsg, MMS_DATA_S *pMmsData)
{
MSG_BEGIN();
- // Initialize mmsMsg structure
+ /* Initialize mmsMsg structure */
MmsInitMsgAttrib(&pMmsMsg->mmsAttrib);
MmsInitMsgType(&pMmsMsg->msgType);
MmsInitMsgBody(&pMmsMsg->msgBody);
@@ -1066,7 +1094,7 @@ bool MmsConvertMmsMsg(MmsMsg *pMmsMsg, MMS_DATA_S *pMmsData)
pMmsMsg->mmsAttrib.szBcc = MmsConvertAddressToOldStyle(pHeaderData->bcc);
snprintf(pMmsMsg->mmsAttrib.szFrom, sizeof(pMmsMsg->mmsAttrib.szFrom), "%s", pHeaderData->szFrom);
- } //CID 41988: Moving all de-referencing of pHeaderData inside null-check block
+ } /* CID 41988: Moving all de-referencing of pHeaderData inside null-check block */
printMmsAttribute(&pMmsMsg->mmsAttrib);
@@ -1117,7 +1145,7 @@ bool MmsConvertMmsMsg(MmsMsg *pMmsMsg, MMS_DATA_S *pMmsData)
return false;
}
}
- } //end for
+ } /* end for */
}
MSG_END();
@@ -1134,7 +1162,7 @@ char *MmsConvertAddressToOldStyle(MMSList *pAddressList)
nAddressCnt = g_list_length(pAddressList);
- // Calculate allocated buffer size
+ /* Calculate allocated buffer size */
for (int i = 0; i < nAddressCnt; ++i) {
MMS_ADDRESS_DATA_S * pAddressData = (MMS_ADDRESS_DATA_S *)g_list_nth_data(pAddressList, i);
@@ -1155,13 +1183,13 @@ char *MmsConvertAddressToOldStyle(MMSList *pAddressList)
szCompose = (char *)calloc(addrLen + 1, 1);
if (szCompose) {
- // Address String copy
+ /* Address String copy */
for (int i = 0; i < nAddressCnt; ++i) {
MMS_ADDRESS_DATA_S * pAddressData = (MMS_ADDRESS_DATA_S *)g_list_nth_data(pAddressList, i);
if (pAddressData) {
if (strlen(szCompose) > 0)
- g_strlcat(szCompose, MSG_STR_ADDR_DELIMETER, addrLen + 1 - strlen(szCompose));
+ g_strlcat(szCompose, MSG_STR_ADDR_DELIMETER, addrLen + 1);
memset(pString, 0x00, (MSG_LOCALE_NAME_LEN + MSG_ADDR_LEN + 3) * sizeof(char));
if (pAddressData->address_type == MSG_ADDRESS_TYPE_PLMN) {
@@ -1171,7 +1199,7 @@ char *MmsConvertAddressToOldStyle(MMSList *pAddressList)
snprintf(pString, MSG_LOCALE_NAME_LEN + MSG_ADDR_LEN + 3, "%s", pAddressData->address_val);
}
- g_strlcat(szCompose, pString, addrLen + 1 - strlen(szCompose));
+ g_strlcat(szCompose, pString, addrLen + 1);
}
}
}
@@ -1274,7 +1302,7 @@ bool convertMediaToMultipart(MMS_MEDIA_S *pSrcMedia, MMS_MULTIPART_DATA_S *pDest
else if (pSrcMedia->mediatype == MMS_SMIL_MEDIA_TEXT)
mainType = MIME_MAINTYPE_TEXT;
- MmsGetMimeTypeFromFileName(mainType, pSrcMedia->szFilePath, &pMimeType, &pszMimeType);
+ MsgGetMimeTypeFromFileName(mainType, pSrcMedia->szFilePath, &pMimeType, &pszMimeType);
if (pszMimeType) {
snprintf(pDestMultipart->szContentType, sizeof(pDestMultipart->szContentType), "%s", pszMimeType);
@@ -1304,7 +1332,7 @@ bool convertAttachToMultipart(MMS_ATTACH_S *pSrcMedia, MMS_MULTIPART_DATA_S *pDe
MimeType pMimeType = MIME_UNKNOWN;
const char *pszMimeType = NULL;
- MmsGetMimeTypeFromFileName(mainType, pSrcMedia->szFilePath, &pMimeType, &pszMimeType);
+ MsgGetMimeTypeFromFileName(mainType, pSrcMedia->szFilePath, &pMimeType, &pszMimeType);
if (pszMimeType) {
snprintf(pDestMultipart->szContentType, sizeof(pDestMultipart->szContentType), "%s", pszMimeType);
@@ -1342,15 +1370,15 @@ gint __compare_str(gconstpointer a, gconstpointer b)
return g_strcmp0((char *)a, (char *)b);
}
-// change file name to Ascii & space -> '_'
-// If replaced filename is duplicated, then it append number
+/* change file name to Ascii & space -> '_' */
+/* If replaced filename is duplicated, then it append number */
bool MmsChangeFileNameToAscii(MMS_MESSAGE_DATA_S *pMsgData)
{
int pageCnt;
int mediaCnt;
int attachCnt;
- GList *r_list = NULL;//renamed file list
+ GList *r_list = NULL; /* renamed file list */
pageCnt = g_list_length(pMsgData->pagelist);
@@ -1358,7 +1386,7 @@ bool MmsChangeFileNameToAscii(MMS_MESSAGE_DATA_S *pMsgData)
MMS_PAGE_S *pPage = NULL;
pPage = (MMS_PAGE_S *)g_list_nth_data(pMsgData->pagelist, i);
if (pPage == NULL) {
- //CID 355351: Freeing r_list in case of error too to prevent memory leak
+ /* CID 355351: Freeing r_list in case of error too to prevent memory leak */
if (r_list != NULL)
g_list_free(r_list);
return false;
@@ -1369,7 +1397,7 @@ bool MmsChangeFileNameToAscii(MMS_MESSAGE_DATA_S *pMsgData)
MMS_MEDIA_S *pMedia = NULL;
pMedia = (MMS_MEDIA_S *)g_list_nth_data(pPage->medialist, j);
if (pMedia == NULL) {
- //CID 355351: Freeing r_list in case of error too to prevent memory leak
+ /* CID 355351: Freeing r_list in case of error too to prevent memory leak */
if (r_list != NULL)
g_list_free(r_list);
return false;
@@ -1408,23 +1436,23 @@ bool MmsChangeFileNameToAscii(MMS_MESSAGE_DATA_S *pMsgData)
snprintf(pMedia->szFileName, sizeof(pMedia->szFileName), "%s", str2);
- MSG_DEBUG("replace filename [%s]", pMedia->szFileName);
+ MSG_SEC_DEBUG("replace filename [%s]", pMedia->szFileName);
r_list = g_list_append(r_list, pMedia->szFileName);
g_free(str2);
}
}
- }//end for media
- }//end for page
+ } /* end for media */
+ } /* end for page */
attachCnt = g_list_length(pMsgData->attachlist);
for (int i = 0; i < attachCnt; i++) {
MMS_ATTACH_S *pAttach = NULL;
pAttach = (MMS_ATTACH_S *)g_list_nth_data(pMsgData->attachlist, i);
if (pAttach == NULL) {
- //CID 355351: Freeing r_list in case of error too to prevent memory leak
- if(r_list != NULL)
+ /* CID 355351: Freeing r_list in case of error too to prevent memory leak */
+ if (r_list != NULL)
g_list_free(r_list);
return false;
}
@@ -1461,13 +1489,13 @@ bool MmsChangeFileNameToAscii(MMS_MESSAGE_DATA_S *pMsgData)
snprintf(pAttach->szFileName, sizeof(pAttach->szFileName), "%s", str2);
- MSG_DEBUG("replace filename [%s]", pAttach->szFileName);
+ MSG_SEC_DEBUG("replace filename [%s]", pAttach->szFileName);
g_free(str2);
}
}
- }//end for attach
+ } /* end for attach */
g_list_free(r_list);
diff --git a/plugin/mms_plugin/MmsPluginSMILValidate.cpp b/plugin/mms_plugin/MmsPluginSMILValidate.cpp
index 3c5ab54..40cf869 100755
--- a/plugin/mms_plugin/MmsPluginSMILValidate.cpp
+++ b/plugin/mms_plugin/MmsPluginSMILValidate.cpp
@@ -408,57 +408,51 @@ MSG_SMIL_ERR_E _MsgMMSValidateSMILPage(MMS_MESSAGE_DATA_S *pMsgData, bool bRegA
MSG_RETURN_VAL_IF_FAIL((strlen(pMedia->szFilePath) > 0), MSG_SMIL_ERR_INVALID_PAGE_INFO);
switch (pMedia->mediatype) {
- case MMS_SMIL_MEDIA_IMG:
- {
- if ((bImgExists == true) || (bVidExists == true) ||
- (bImgOrVidExists== true)) {
- eRet = MSG_SMIL_ERR_SIMILAR_MEDIA_EXISTS;
- } else
- bImgExists = true;
- }
+ case MMS_SMIL_MEDIA_IMG: {
+ if ((bImgExists == true) || (bVidExists == true) ||
+ (bImgOrVidExists== true)) {
+ eRet = MSG_SMIL_ERR_SIMILAR_MEDIA_EXISTS;
+ } else
+ bImgExists = true;
break;
- case MMS_SMIL_MEDIA_AUDIO:
- {
- if ((bAudExists == true) || (bVidExists == true) ||
- (bImgOrVidExists== true)) {
- eRet = MSG_SMIL_ERR_SIMILAR_MEDIA_EXISTS;
- } else
- bAudExists = true;
- }
+ }
+ case MMS_SMIL_MEDIA_AUDIO: {
+ if ((bAudExists == true) || (bVidExists == true) ||
+ (bImgOrVidExists== true)) {
+ eRet = MSG_SMIL_ERR_SIMILAR_MEDIA_EXISTS;
+ } else
+ bAudExists = true;
break;
- case MMS_SMIL_MEDIA_VIDEO:
- {
- if ((bImgExists == true) || (bVidExists == true) ||
- (bImgOrVidExists== true)) {
- eRet = MSG_SMIL_ERR_SIMILAR_MEDIA_EXISTS;
- } else
- bVidExists = true;
- }
+ }
+ case MMS_SMIL_MEDIA_VIDEO: {
+ if ((bImgExists == true) || (bVidExists == true) ||
+ (bImgOrVidExists== true)) {
+ eRet = MSG_SMIL_ERR_SIMILAR_MEDIA_EXISTS;
+ } else
+ bVidExists = true;
break;
- case MMS_SMIL_MEDIA_TEXT:
- {
- if (bTxtExists == true) {
- eRet = MSG_SMIL_ERR_SIMILAR_MEDIA_EXISTS;
- } else
- bTxtExists = true;
- }
+ }
+ case MMS_SMIL_MEDIA_TEXT: {
+ if (bTxtExists == true) {
+ eRet = MSG_SMIL_ERR_SIMILAR_MEDIA_EXISTS;
+ } else
+ bTxtExists = true;
break;
- case MMS_SMIL_MEDIA_IMG_OR_VIDEO:
- {
- if ((bImgExists == true) || (bVidExists == true) ||
- (bImgOrVidExists== true)) {
- eRet = MSG_SMIL_ERR_SIMILAR_MEDIA_EXISTS;
- } else
- bImgOrVidExists = true;
- }
+ }
+ case MMS_SMIL_MEDIA_IMG_OR_VIDEO: {
+ if ((bImgExists == true) || (bVidExists == true) ||
+ (bImgOrVidExists== true)) {
+ eRet = MSG_SMIL_ERR_SIMILAR_MEDIA_EXISTS;
+ } else
+ bImgOrVidExists = true;
break;
- default:
- {
- MSG_DEBUG("_MsgMMSValidateSMILRegion: Invalid Media Information\n");
- return eRet;
- }
+ }
+ default: {
+ MSG_DEBUG("_MsgMMSValidateSMILRegion: Invalid Media Information\n");
+ return eRet;
break;
}
+ }
if (eRet == MSG_SMIL_ERR_SIMILAR_MEDIA_EXISTS) {
MSG_DEBUG("_MsgMMSValidateSMILRegion: Similar Media Exists\n");
@@ -489,4 +483,3 @@ MSG_SMIL_ERR_E _MsgMMSValidateSMILPage(MMS_MESSAGE_DATA_S *pMsgData, bool bRegA
return eRet;
}
-
diff --git a/plugin/mms_plugin/MmsPluginStorage.cpp b/plugin/mms_plugin/MmsPluginStorage.cpp
index 3ac92f5..1579755 100755
--- a/plugin/mms_plugin/MmsPluginStorage.cpp
+++ b/plugin/mms_plugin/MmsPluginStorage.cpp
@@ -25,13 +25,12 @@
#include "MsgStorageTypes.h"
#include "MsgSmil.h"
#include "MsgSerialize.h"
+#include "MsgUtilMime.h"
#include "MmsPluginDebug.h"
#include "MmsPluginStorage.h"
#include "MmsPluginMessage.h"
#include "MmsPluginDrm.h"
-#include "MmsPluginMIME.h"
-#include "MmsPluginTcs.h"
#include "MmsPluginUtil.h"
#include "MmsPluginComposer.h"
#include "MmsPluginAppBase.h"
@@ -116,7 +115,7 @@ msg_error_t MmsPluginStorage::addMmsMsgToDB(MmsMsg *pMmsMsg, const char *raw_fil
char sqlQuery[MAX_QUERY_LEN + 1];
- // Add Message
+ /* Add Message */
memset(sqlQuery, 0x00, sizeof(sqlQuery));
snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, '%s', '%s', '%s', '%s', '%s', %d, %d, %ld, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d);",
MMS_PLUGIN_MESSAGE_TABLE_NAME, pMmsMsg->msgID, pMmsMsg->szTrID, pMmsMsg->szMsgID, pMmsMsg->szForwardMsgID, pMmsMsg->szContentLocation,
@@ -124,7 +123,7 @@ msg_error_t MmsPluginStorage::addMmsMsgToDB(MmsMsg *pMmsMsg, const char *raw_fil
pMmsMsg->mmsAttrib.bAskDeliveryReport, pMmsMsg->mmsAttrib.bReportAllowed, pMmsMsg->mmsAttrib.readReportAllowedType,
pMmsMsg->mmsAttrib.bAskReadReply, pMmsMsg->mmsAttrib.bRead, pMmsMsg->mmsAttrib.readReportSendStatus, pMmsMsg->mmsAttrib.bReadReportSent,
pMmsMsg->mmsAttrib.priority, pMmsMsg->mmsAttrib.bLeaveCopy, pMmsMsg->mmsAttrib.msgSize, pMmsMsg->mmsAttrib.msgClass,
- pMmsMsg->mmsAttrib.expiryTime.time, 0/*pMmsMsg->mmsAttrib.bUseDeliveryCustomTime*/, pMmsMsg->mmsAttrib.deliveryTime.time, pMmsMsg->mmsAttrib.msgStatus);
+ pMmsMsg->mmsAttrib.expiryTime.time, 0 /*pMmsMsg->mmsAttrib.bUseDeliveryCustomTime*/, pMmsMsg->mmsAttrib.deliveryTime.time, pMmsMsg->mmsAttrib.msgStatus);
MSG_DEBUG("\n!!!!!!!!! QUERY : %s\n", sqlQuery);
@@ -136,7 +135,7 @@ msg_error_t MmsPluginStorage::addMmsMsgToDB(MmsMsg *pMmsMsg, const char *raw_fil
return MSG_SUCCESS;
}
-#if 1 //old
+#if 1 /* old */
msg_error_t MmsPluginStorage::updateConfMessage(MSG_MESSAGE_INFO_S *pMsgInfo)
{
MSG_BEGIN();
@@ -147,13 +146,13 @@ msg_error_t MmsPluginStorage::updateConfMessage(MSG_MESSAGE_INFO_S *pMsgInfo)
MMS_RECV_DATA_S *pMmsRecvData = (MMS_RECV_DATA_S *)pMsgInfo->msgData;
- MSG_DEBUG("###### pMsgInfo->msgData = %s #######", pMmsRecvData->retrievedFilePath);
+ MSG_SEC_DEBUG("###### pMsgInfo->msgData = %s #######", pMmsRecvData->retrievedFilePath);
memset(sqlQuery, 0x00, sizeof(sqlQuery));
snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET MESSAGE_ID = '%s', FILE_PATH = '%s' WHERE MSG_ID = %d;",
MMS_PLUGIN_MESSAGE_TABLE_NAME, pMmsRecvData->szMsgID, pMmsRecvData->retrievedFilePath, pMsgInfo->msgId);
- MSG_DEBUG("SQLQuery = %s", sqlQuery);
+ MSG_SEC_DEBUG("SQLQuery = %s", sqlQuery);
if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS)
return MSG_ERR_DB_EXEC;
@@ -163,7 +162,7 @@ msg_error_t MmsPluginStorage::updateConfMessage(MSG_MESSAGE_INFO_S *pMsgInfo)
return MSG_SUCCESS;
}
-#else //new
+#else /* new */
msg_error_t MmsPluginStorage::updateRetriveConf(msg_message_id_t msgId, MMS_DATA_S *pMmsData)
{
@@ -208,7 +207,7 @@ msg_error_t MmsPluginStorage::updateConfMessage(MSG_MESSAGE_INFO_S *pMsgInfo)
char working_dir[MSG_FILENAME_LEN_MAX+1] = {0,};
MMS_DATA_S *pMmsData = NULL;
- //pMsgInfo->msgData is Filepath of json
+ /* pMsgInfo->msgData is Filepath of json */
g_file_get_contents((gchar*)pMsgInfo->msgData, (gchar**)&pSerializedMms, (gsize*)&pSerializedMmsSize, NULL);
if (MsgDeserializeMmsData(pSerializedMms, strlen(pSerializedMms), &pMmsData) != 0) {
@@ -220,9 +219,9 @@ msg_error_t MmsPluginStorage::updateConfMessage(MSG_MESSAGE_INFO_S *pMsgInfo)
snprintf(working_dir, sizeof(working_dir), MSG_DATA_PATH"%d.mms.dir", pMsgInfo->msgId);
- MsgMmsSetMultipartListData(pMmsData);//app file -> data
+ MsgMmsSetMultipartListData(pMmsData); /* app file -> data */
- MsgMmsSetMultipartListFilePath(working_dir, pMmsData);//data -> svc file
+ MsgMmsSetMultipartListFilePath(working_dir, pMmsData); /* data -> svc file */
MMS_MULTIPART_DATA_S *pSmilMultipart = pMmsData->smil;
if (pSmilMultipart) {
@@ -236,7 +235,7 @@ msg_error_t MmsPluginStorage::updateConfMessage(MSG_MESSAGE_INFO_S *pMsgInfo)
MmsPluginStorage::instance()->insertMultipart(pMsgInfo->msgId, pMultipart);
}
- {//make Preview info for APP
+ { /* make Preview info for APP */
MmsPluginAppBase appBase(pMmsData);
appBase.makePreviewInfo(pMsgInfo->msgId, true, NULL);
appBase.getFirstPageTextFilePath(pMsgInfo->msgText, sizeof(pMsgInfo->msgText));
@@ -281,8 +280,6 @@ msg_error_t MmsPluginStorage::updateMsgServerID(MSG_MESSAGE_INFO_S *pMsgInfo, MS
}
}
- //dbHandle->finalizeQuery();
-
MSG_END();
return MSG_SUCCESS;
@@ -295,7 +292,7 @@ msg_error_t MmsPluginStorage::insertDeliveryReport(msg_message_id_t msgId, char
char sqlQuery[MAX_QUERY_LEN + 1];
memset(sqlQuery, 0x00, sizeof(sqlQuery));
- //( MSG_ID INTEGER , ADDRESS_VAL TEXT , STATUS_TYPE INTEGER , STATUS INTEGER DEFAULT 0 , TIME DATETIME);
+ /* ( MSG_ID INTEGER , ADDRESS_VAL TEXT , STATUS_TYPE INTEGER , STATUS INTEGER DEFAULT 0 , TIME DATETIME); */
snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s "
"(MSG_ID, ADDRESS_VAL, STATUS_TYPE, STATUS, TIME) "
"VALUES (%d, '%s', %d, %d, %d);",
@@ -316,7 +313,7 @@ msg_error_t MmsPluginStorage::insertReadReport(msg_message_id_t msgId, char *add
char sqlQuery[MAX_QUERY_LEN + 1];
memset(sqlQuery, 0x00, sizeof(sqlQuery));
- //( MSG_ID INTEGER , ADDRESS_VAL TEXT , STATUS_TYPE INTEGER , STATUS INTEGER DEFAULT 0 , TIME DATETIME);
+ /* ( MSG_ID INTEGER , ADDRESS_VAL TEXT , STATUS_TYPE INTEGER , STATUS INTEGER DEFAULT 0 , TIME DATETIME); */
snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s "
"(MSG_ID, ADDRESS_VAL, STATUS_TYPE, STATUS, TIME) "
"VALUES (%d, '%s', %d, %d, %d);",
@@ -415,7 +412,7 @@ void MmsPluginStorage::getMmsFromDB(msg_message_id_t msgId, MmsMsg *pMmsMsg)
pMmsMsg->mmsAttrib.msgSize = dbHandle->columnInt(i++);
pMmsMsg->mmsAttrib.msgClass = (MmsMsgClass)dbHandle->columnInt(i++);
pMmsMsg->mmsAttrib.expiryTime.time = dbHandle->columnInt(i++);
- i++;//CUSTOM_DELIVERY_TIME
+ i++; /* CUSTOM_DELIVERY_TIME */
pMmsMsg->mmsAttrib.deliveryTime.time = dbHandle->columnInt(i++);
pMmsMsg->mmsAttrib.msgStatus = (msg_delivery_report_status_t)dbHandle->columnInt(i++);
snprintf(pMmsMsg->szMsgID, sizeof(pMmsMsg->szMsgID), "%s", dbHandle->columnText(i++));
@@ -540,7 +537,7 @@ msg_error_t MmsPluginStorage::getAddressInfo(msg_message_id_t msgId, MSG_ADDRESS
char sqlQuery[MAX_QUERY_LEN+1];
- // Add Address
+ /* Add Address */
memset(sqlQuery, 0x00, sizeof(sqlQuery));
snprintf(sqlQuery, sizeof(sqlQuery), "SELECT "
@@ -644,7 +641,7 @@ msg_error_t MmsPluginStorage::getMsgText(MMS_MESSAGE_DATA_S *pMmsMsg, char *pMsg
if (pMmsMsg == NULL)
return MSG_ERR_NULL_POINTER;
- // Get the text data from the 1st slide.
+ /* Get the text data from the 1st slide. */
if (pMmsMsg->pageCnt > 0) {
pPage = _MsgMmsGetPage(pMmsMsg, 0);
@@ -657,7 +654,7 @@ msg_error_t MmsPluginStorage::getMsgText(MMS_MESSAGE_DATA_S *pMmsMsg, char *pMsg
if (pMedia && pMedia->mediatype == MMS_SMIL_MEDIA_TEXT) {
MimeType mimeType = MIME_UNKNOWN;
- MmsGetMimeTypeFromFileName(MIME_MAINTYPE_UNKNOWN, pMedia->szFilePath, &mimeType, NULL);
+ MsgGetMimeTypeFromFileName(MIME_MAINTYPE_UNKNOWN, pMedia->szFilePath, &mimeType, NULL);
if (mimeType == MIME_TEXT_X_VCALENDAR || mimeType == MIME_TEXT_X_VCARD || mimeType == MIME_TEXT_X_VTODO || mimeType == MIME_TEXT_X_VNOTE) {
MSG_DEBUG("Media Type is Text, but Vobject file [%s]", pMedia->szFilePath);
@@ -687,7 +684,7 @@ msg_error_t MmsPluginStorage::insertPreviewInfo(int msgId, int type, const char
"VALUES (%d, %d, \"%s\", %d);",
MSGFW_MMS_PREVIEW_TABLE_NAME, msgId, type, value, count);
- MSG_DEBUG("QUERY : [%s]", sqlQuery);
+ MSG_SEC_DEBUG("QUERY : [%s]", sqlQuery);
if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS)
return MSG_ERR_DB_EXEC;
@@ -702,7 +699,7 @@ msg_error_t MmsPluginStorage::removePreviewInfo(int msgId)
char sqlQuery[MAX_QUERY_LEN + 1];
char filePath[MSG_FILEPATH_LEN_MAX + 1] = {0,};
- // remove thumbnail file
+ /* remove thumbnail file */
memset(sqlQuery, 0x00, sizeof(sqlQuery));
snprintf(sqlQuery, sizeof(sqlQuery),
"SELECT VALUE FROM %s "
@@ -726,7 +723,7 @@ msg_error_t MmsPluginStorage::removePreviewInfo(int msgId)
dbHandle->finalizeQuery();
memset(sqlQuery, 0x00, sizeof(sqlQuery));
- //(MSG_ID INTEGER, TYPE INTEGER, INFO TEXT)
+ /* (MSG_ID INTEGER, TYPE INTEGER, INFO TEXT) */
snprintf(sqlQuery, sizeof(sqlQuery),
"DELETE FROM %s WHERE MSG_ID= %d;",
MSGFW_MMS_PREVIEW_TABLE_NAME, msgId);
@@ -747,7 +744,7 @@ msg_error_t MmsPluginStorage::deleteMmsMessage(int msgId)
char filePath[MSG_FILEPATH_LEN_MAX + 1] = {0,};
char dirPath[MSG_FILEPATH_LEN_MAX + 1]= {0,};
- //remove DB Preview
+ /* remove DB Preview */
removePreviewInfo(msgId);
deleteMultipartList(msgId);
@@ -765,16 +762,16 @@ msg_error_t MmsPluginStorage::deleteMmsMessage(int msgId)
snprintf(dirPath, MSG_FILEPATH_LEN_MAX, "%s.dir", filePath);
- //delete pdu file
+ /* delete pdu file */
if (remove(filePath) == -1)
MSG_SEC_DEBUG("Fail to delete file [%s]", filePath);
else
MSG_SEC_DEBUG("Success to delete file [%s]", filePath);
- //delete multipart files
+ /* delete multipart files */
MsgRmRf(dirPath);
- //delete multipart dir
+ /* delete multipart dir */
rmdir(dirPath);
} else {
@@ -786,7 +783,7 @@ msg_error_t MmsPluginStorage::deleteMmsMessage(int msgId)
dbHandle->finalizeQuery();
- // Delete Data from MMS table
+ /* Delete Data from MMS table */
memset(sqlQuery, 0x00, sizeof(sqlQuery));
snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;",
MMS_PLUGIN_MESSAGE_TABLE_NAME, msgId);
@@ -795,7 +792,7 @@ msg_error_t MmsPluginStorage::deleteMmsMessage(int msgId)
return MSG_ERR_DB_EXEC;
}
- // Delete Data from MMS STATUS table
+ /* Delete Data from MMS STATUS table */
memset(sqlQuery, 0x00, sizeof(sqlQuery));
snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;",
MSGFW_REPORT_TABLE_NAME, msgId);
@@ -822,14 +819,14 @@ msg_error_t MmsPluginStorage::insertMultipart(msg_message_id_t msgId, MMS_MULTIP
}
#if 0
- //( MSG_ID INTEGER NOT NULL , SEQ INTEGER DEFAULT 0, CONTENT_TYPE TEXT, NAME TEXT, CHARSET INTEGER, CONTENT_ID TEXT, CONTENT_LOCATION TEXT, FILE_PATH TEXT, TEXT TEXT,);
- if (pMultipart->type == MIME_APPLICATION_SMIL) {//Smil
+ /* ( MSG_ID INTEGER NOT NULL , SEQ INTEGER DEFAULT 0, CONTENT_TYPE TEXT, NAME TEXT, CHARSET INTEGER, CONTENT_ID TEXT, CONTENT_LOCATION TEXT, FILE_PATH TEXT, TEXT TEXT,); */
+ if (pMultipart->type == MIME_APPLICATION_SMIL) { /* Smil */
snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s "
"(MSG_ID, SEQ, CONTENT_TYPE, NAME, CONTENT_ID, CONTENT_LOCATION, TEXT) "
"VALUES (%d, -1, '%s', '%s', '%s', '%s' , '%s');",
MSGFW_MMS_MULTIPART_TABLE_NAME, msgId, pMultipart->szContentType, pMultipart->szFileName, pMultipart->szContentID, pMultipart->szContentLocation, (char *)pMultipart->data);
- } else if (MmsIsText(pMultipart->type)) {//Text
+ } else if (MmsIsText(pMultipart->type)) { /* Text */
snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s "
"(MSG_ID, CONTENT_TYPE, NAME, CHARSET, CONTENT_ID, CONTENT_LOCATION, TEXT) "
"VALUES (%d, '%s', '%s', %d, '%s', '%s' ,'%s');",
@@ -842,27 +839,31 @@ msg_error_t MmsPluginStorage::insertMultipart(msg_message_id_t msgId, MMS_MULTIP
}
#else
- if (pMultipart->type == MIME_APPLICATION_SMIL) {//Smil
+ if (pMultipart->type == MIME_APPLICATION_SMIL) { /* Smil */
snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s "
"(MSG_ID, SEQ, CONTENT_TYPE, NAME, CONTENT_ID, CONTENT_LOCATION, FILE_PATH) "
"VALUES (%d, -1, \"%s\", \"%s\", \"%s\", \"%s\", \"%s\");",
MSGFW_MMS_MULTIPART_TABLE_NAME, msgId, pMultipart->szContentType, pMultipart->szFileName, pMultipart->szContentID, pMultipart->szContentLocation, (char *)pMultipart->szFilePath);
+ MSG_SEC_DEBUG("QUERY : [%s]", sqlQuery);
+
+ if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS)
+ return MSG_ERR_DB_EXEC;
} else {
const char *pszMimeType = NULL;
if (strlen(pMultipart->szContentType) == 0) {
- MmsGetMimeTypeFromFileName(MIME_MAINTYPE_UNKNOWN, pMultipart->szFilePath, &pMultipart->type, &pszMimeType);
+ MsgGetMimeTypeFromFileName(MIME_MAINTYPE_UNKNOWN, pMultipart->szFilePath, &pMultipart->type, &pszMimeType);
snprintf(pMultipart->szContentType, sizeof(pMultipart->szContentType), "%s", pszMimeType);
MSG_DEBUG("pMultipart->szContentType = %s", pMultipart->szContentType);
}
/* make tcs_bc_level & malware_allow value */
pMultipart->tcs_bc_level = -1;
- //CID 41991: pMultipart->szFilePath is an array, hence checking for null is not required
+ /* CID 41991: pMultipart->szFilePath is an array, hence checking for null is not required */
if (strlen(pMultipart->szFilePath) > 0 && MsgAccessFile(pMultipart->szFilePath, F_OK) == true) {
int bc_level = -1;
- int tcs_ret = 0; // MmsPluginTcsScanFile(pMultipart->szFilePath, &bc_level);
+ int tcs_ret = 0; // MsgTcsScanFile(pMultipart->szFilePath, &bc_level);
if (tcs_ret == 0) {
if (bc_level > -1) {
MSG_DEBUG("This content is malware, level = %d", bc_level);
@@ -874,7 +875,7 @@ msg_error_t MmsPluginStorage::insertMultipart(msg_message_id_t msgId, MMS_MULTIP
if (pMultipart->tcs_bc_level < 0 || pMultipart->malware_allow) {
- if (g_str_has_prefix(pMultipart->szContentType, "video")) {
+ if (g_str_has_prefix(pMultipart->szContentType, "video") || g_str_has_prefix(pMultipart->szContentType, "image")) {
char thumbPath[MSG_FILEPATH_LEN_MAX+1] = {0, };
if (MmsMakeMultipartThumbnailInfo(pMultipart, thumbPath) == MSG_SUCCESS)
@@ -882,16 +883,52 @@ msg_error_t MmsPluginStorage::insertMultipart(msg_message_id_t msgId, MMS_MULTIP
}
}
- snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s "
+ if (!g_strcmp0(pMultipart->szContentType, "text/plain")) {
+ gchar *contents = NULL;
+ gsize length = 0;
+
+ if (MsgAccessFile(pMultipart->szFilePath, F_OK))
+ g_file_get_contents((gchar*)pMultipart->szFilePath, (gchar**)&contents, (gsize*)&length, NULL);
+
+ if (contents) {
+ snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s "
+ "(MSG_ID, CONTENT_TYPE, NAME, CONTENT_ID, CONTENT_LOCATION, FILE_PATH, TCS_LEVEL, MALWARE_ALLOW, TEXT) "
+ "VALUES (%d, \"%s\", \"%s\", \"%s\", \"%s\", \"%s\", '%d', '%d', ?);",
+ MSGFW_MMS_MULTIPART_TABLE_NAME, msgId, pMultipart->szContentType, pMultipart->szFileName, pMultipart->szContentID, pMultipart->szContentLocation, pMultipart->szFilePath, pMultipart->tcs_bc_level, pMultipart->malware_allow);
+
+ MSG_SEC_DEBUG("QUERY : [%s]", sqlQuery);
+
+ if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) {
+ g_free(contents);
+ return MSG_ERR_DB_EXEC;
+ }
+
+ dbHandle->bindText(contents, 1);
+
+ if (dbHandle->stepQuery() != MSG_ERR_DB_DONE) {
+ dbHandle->finalizeQuery();
+ g_free(contents);
+ return MSG_ERR_DB_EXEC;
+ }
+
+ dbHandle->finalizeQuery();
+ g_free(contents);
+ } else {
+ MSG_ERR("file contents is null!");
+ }
+ } else {
+ snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s "
"(MSG_ID, CONTENT_TYPE, NAME, CONTENT_ID, CONTENT_LOCATION, FILE_PATH, TCS_LEVEL, MALWARE_ALLOW, THUMB_FILE_PATH) "
"VALUES (%d, \"%s\", \"%s\", \"%s\", \"%s\" ,\"%s\", '%d', '%d', \"%s\");",
- MSGFW_MMS_MULTIPART_TABLE_NAME, msgId, pMultipart->szContentType, pMultipart->szFileName, pMultipart->szContentID, pMultipart->szContentLocation, (char *)pMultipart->szFilePath, pMultipart->tcs_bc_level, pMultipart->malware_allow, (char *)pMultipart->szThumbFilePath);
+ MSGFW_MMS_MULTIPART_TABLE_NAME, msgId, pMultipart->szContentType, pMultipart->szFileName, pMultipart->szContentID, pMultipart->szContentLocation, pMultipart->szFilePath, pMultipart->tcs_bc_level, pMultipart->malware_allow, pMultipart->szThumbFilePath);
+
+ MSG_SEC_DEBUG("QUERY : [%s]", sqlQuery);
+
+ if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS)
+ return MSG_ERR_DB_EXEC;
+ }
}
#endif
- MSG_DEBUG("QUERY : [%s]", sqlQuery);
-
- if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS)
- return MSG_ERR_DB_EXEC;
MSG_END();
return MSG_SUCCESS;
@@ -917,7 +954,7 @@ msg_error_t MmsPluginStorage::updateMultipart(msg_message_id_t msgId, int allow_
if (pMultipart->tcs_bc_level >= 0 || pMultipart->malware_allow) {
- if (!strcasecmp(pMultipart->szContentType, "video")) {
+ if (!strcasecmp(pMultipart->szContentType, "video") || !strcasecmp(pMultipart->szContentType, "image")) {
char thumbPath[MSG_FILEPATH_LEN_MAX+1] = {0, };
if (MmsMakeMultipartThumbnailInfo(pMultipart, thumbPath) == MSG_SUCCESS)
@@ -946,8 +983,8 @@ msg_error_t MmsPluginStorage::deleteMultipartList(int msgId)
MsgDbHandler *dbHandle = getDbHandle();
char sqlQuery[MAX_QUERY_LEN + 1];
- //char filePath[MSG_FILEPATH_LEN_MAX + 1] = {0,};
- const char * filePath = NULL;
+/* char filePath[MSG_FILEPATH_LEN_MAX + 1] = {0,}; */
+ const char *filePath = NULL;
memset(sqlQuery, 0x00, sizeof(sqlQuery));
snprintf(sqlQuery, sizeof(sqlQuery), "SELECT FILE_PATH FROM %s WHERE MSG_ID = %d;",
MSGFW_MMS_MULTIPART_TABLE_NAME, msgId);
@@ -994,7 +1031,7 @@ msg_error_t MmsPluginStorage::deleteMultipartList(int msgId)
dbHandle->finalizeQuery();
- // Delete Data from Multipart table
+ /* Delete Data from Multipart table */
memset(sqlQuery, 0x00, sizeof(sqlQuery));
snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;",
MSGFW_MMS_MULTIPART_TABLE_NAME, msgId);
@@ -1085,17 +1122,17 @@ msg_error_t MmsPluginStorage::addMmsData(msg_message_id_t msgId, const char *raw
, MMS_PLUGIN_MESSAGE_TABLE_NAME
, msgId, pHeader->trID, pHeader->messageID, "", pHeader->contentLocation
, raw_filepath, pHeader->mmsVersion, MMS_DATATYPE_NONE, pHeader->date, pHeader->bHideAddress
- , pHeader->bDeliveryReport, 0 /*pMmsMsg->mmsAttrib.bReportAllowed*/, 0/*pMmsMsg->mmsAttrib.readReportAllowedType*/
- , pHeader->bReadReport, 0 /*pMmsMsg->mmsAttrib.bRead*/, 0/*pMmsMsg->mmsAttrib.readReportSendStatus*/, 0 /*pMmsMsg->mmsAttrib.bReadReportSent*/
- , pHeader->mmsPriority, true/*pMmsMsg->mmsAttrib.bLeaveCopy*/,pHeader->messageSize, pHeader->messageClass
+ , pHeader->bDeliveryReport, 0 /*pMmsMsg->mmsAttrib.bReportAllowed*/, 0 /*pMmsMsg->mmsAttrib.readReportAllowedType*/
+ , pHeader->bReadReport, 0 /*pMmsMsg->mmsAttrib.bRead*/, 0 /*pMmsMsg->mmsAttrib.readReportSendStatus*/, 0 /*pMmsMsg->mmsAttrib.bReadReportSent*/
+ , pHeader->mmsPriority, true /*pMmsMsg->mmsAttrib.bLeaveCopy*/,pHeader->messageSize, pHeader->messageClass
, pHeader->expiry.time, 0, pHeader->delivery.time, pHeader->mmsStatus);
msg_error_t db_err = dbHandle->execQuery(sqlQuery);
if (db_err != MSG_SUCCESS) {
- MSG_ERR("execute query fail [%s], err = [%d]", sqlQuery, db_err);
+ MSG_SEC_ERR("execute query fail [%s], err = [%d]", sqlQuery, db_err);
return MSG_ERR_DB_EXEC;
} else {
- MSG_DEBUG("execute query success [%s]", sqlQuery);
+ MSG_SEC_DEBUG("execute query success [%s]", sqlQuery);
}
MMS_MULTIPART_DATA_S *smil = pMmsData->smil;
@@ -1153,34 +1190,33 @@ msg_error_t MmsPluginStorage::getMmsData(msg_message_id_t msgId, MMS_DATA_S *pMm
if (db_err != MSG_SUCCESS) {
MSG_ERR("prepare query fail [%s], err = [%d]", sqlQuery, db_err);
- //dbHandle->finalizeQuery();
return MSG_ERR_PLUGIN_STORAGE;
}
if (dbHandle->stepQuery() == MSG_ERR_DB_ROW) {
int i = 0;
pHeader->mmsVersion = dbHandle->columnInt(i++);
- i++;//pMmsMsg->mmsAttrib.dataType = (MmsDataType)dbHandle->columnInt(i++);
+ i++; /* pMmsMsg->mmsAttrib.dataType = (MmsDataType)dbHandle->columnInt(i++); */
pHeader->date = dbHandle->columnInt(i++);
pHeader->bHideAddress = dbHandle->columnInt(i++);
pHeader->bDeliveryReport = dbHandle->columnInt(i++);
- i++;//pMmsMsg->mmsAttrib.bReportAllowed = dbHandle->columnInt(i++);
- i++;//pMmsMsg->mmsAttrib.readReportAllowedType = (MmsRecvReadReportType)dbHandle->columnInt(i++);
+ i++; /* pMmsMsg->mmsAttrib.bReportAllowed = dbHandle->columnInt(i++); */
+ i++; /* pMmsMsg->mmsAttrib.readReportAllowedType = (MmsRecvReadReportType)dbHandle->columnInt(i++); */
pHeader->bReadReport = dbHandle->columnInt(i++);
- i++;//pMmsMsg->mmsAttrib.bRead = dbHandle->columnInt(i++);
- i++;//pMmsMsg->mmsAttrib.readReportSendStatus = (MmsRecvReadReportSendStatus)dbHandle->columnInt(i++);
- i++;//pMmsMsg->mmsAttrib.bReadReportSent = dbHandle->columnInt(i++);
+ i++; /* pMmsMsg->mmsAttrib.bRead = dbHandle->columnInt(i++); */
+ i++; /* pMmsMsg->mmsAttrib.readReportSendStatus = (MmsRecvReadReportSendStatus)dbHandle->columnInt(i++); */
+ i++; /* pMmsMsg->mmsAttrib.bReadReportSent = dbHandle->columnInt(i++); */
pHeader->mmsPriority = (MmsPriority)dbHandle->columnInt(i++);
pHeader->messageSize = dbHandle->columnInt(i++);
pHeader->messageClass = (MmsMsgClass)dbHandle->columnInt(i++);
pHeader->expiry.time = dbHandle->columnInt(i++);
- i++;//CUSTOM_DELIVERY_TIME
+ i++; /* CUSTOM_DELIVERY_TIME */
pHeader->delivery.time = dbHandle->columnInt(i++);
- i++;//pMmsMsg->mmsAttrib.msgStatus = (msg_delivery_report_status_t)dbHandle->columnInt(i++);
+ i++; /* pMmsMsg->mmsAttrib.msgStatus = (msg_delivery_report_status_t)dbHandle->columnInt(i++); */
snprintf(pHeader->messageID, sizeof(pHeader->messageID), "%s", dbHandle->columnText(i++));
snprintf(pHeader->trID, sizeof(pHeader->trID), "%s", dbHandle->columnText(i++));
snprintf(pHeader->contentLocation, sizeof(pHeader->contentLocation), "%s", dbHandle->columnText(i++));
- i++;//snprintf(pMmsMsg->szFileName, sizeof(pMmsMsg->szFileName), "%s", dbHandle->columnText(i++));
+ i++; /* snprintf(pMmsMsg->szFileName, sizeof(pMmsMsg->szFileName), "%s", dbHandle->columnText(i++)); */
}
dbHandle->finalizeQuery();
@@ -1206,7 +1242,7 @@ msg_error_t MmsPluginStorage::getMmsData(msg_message_id_t msgId, MMS_DATA_S *pMm
gchar *contents = NULL;
gsize length = 0;
- g_file_get_contents ((gchar*)smil_multipart->szFilePath, (gchar**)&contents, (gsize*)&length, NULL);
+ g_file_get_contents((gchar*)smil_multipart->szFilePath, (gchar**)&contents, (gsize*)&length, NULL);
smil_multipart->pMultipartData = contents;
smil_multipart->nMultipartDataLen = length;
@@ -1232,7 +1268,7 @@ msg_error_t MmsPluginStorage::getMmsData(msg_message_id_t msgId, MMS_DATA_S *pMm
}
msg_error_t MmsPluginStorage::addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S *pSendOptInfo, char *pSerializedMms)
-{//send request or notification ind
+{ /* send request or notification ind */
MSG_BEGIN();
msg_error_t err = MSG_SUCCESS;
@@ -1248,33 +1284,33 @@ msg_error_t MmsPluginStorage::addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDI
char raw_filepath[MSG_FILENAME_LEN_MAX+1] = {0,};
char working_dir[MSG_FILENAME_LEN_MAX+1] = {0,};
- //compose
+ /* compose */
MmsPluginComposer::instance()->composeSendReq(pMsgInfo, pSendOptInfo, pMmsData);
- //encode
+ /* encode */
snprintf(working_dir, sizeof(working_dir), MSG_DATA_PATH"%d.mms.dir", pMsgInfo->msgId);
- MsgMmsSetMultipartListData(pMmsData);//app file -> data
+ MsgMmsSetMultipartListData(pMmsData); /* app file -> data */
- MsgMmsSetMultipartListFilePath(working_dir, pMmsData);//data -> svc file
+ MsgMmsSetMultipartListFilePath(working_dir, pMmsData); /* data -> svc file */
snprintf(raw_filepath, sizeof(raw_filepath), "%s%d.mms", MSG_DATA_PATH, pMsgInfo->msgId);
MmsPluginEncoder::instance()->encodeMmsPdu(pMmsData, pMsgInfo->msgId, raw_filepath);
- //add to db
+ /* add to db */
if (addMmsData(pMsgInfo->msgId, raw_filepath, pMmsData) != MSG_SUCCESS) {
MSG_DEBUG("Fail to add db message");
goto __CATCH;
}
- //set
+ /* set */
if (MsgGetFileSize(raw_filepath, (int *)&pMsgInfo->dataSize) == false) {
MSG_SEC_DEBUG("Fail to get mms file size [%s]", raw_filepath);
goto __CATCH;
}
- {//make Preview info for APP
+ { /* make Preview info for APP */
MmsPluginAppBase appBase(pMmsData);
appBase.makePreviewInfo(pMsgInfo->msgId, true, raw_filepath);
appBase.getFirstPageTextFilePath(pMsgInfo->msgText, sizeof(pMsgInfo->msgText));
@@ -1287,33 +1323,33 @@ msg_error_t MmsPluginStorage::addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDI
char raw_filepath[MSG_FILENAME_LEN_MAX+1] = {0,};
char working_dir[MSG_FILENAME_LEN_MAX+1] = {0,};
- //compose
+ /* compose */
MmsPluginComposer::instance()->composeRetrieveConf(pMsgInfo, pSendOptInfo, pMmsData);
- //encode
+ /* encode */
snprintf(working_dir, sizeof(working_dir), MSG_DATA_PATH"%d.mms.dir", pMsgInfo->msgId);
- MsgMmsSetMultipartListData(pMmsData);//app file -> data
+ MsgMmsSetMultipartListData(pMmsData); /* app file -> data */
- MsgMmsSetMultipartListFilePath(working_dir, pMmsData);//data -> svc file
+ MsgMmsSetMultipartListFilePath(working_dir, pMmsData); /* data -> svc file */
snprintf(raw_filepath, sizeof(raw_filepath), "%s%d.mms", MSG_DATA_PATH, pMsgInfo->msgId);
MmsPluginEncoder::instance()->encodeMmsPdu(pMmsData, pMsgInfo->msgId, raw_filepath);
- //add to db
+ /* add to db */
if (addMmsData(pMsgInfo->msgId, raw_filepath, pMmsData) != MSG_SUCCESS) {
MSG_DEBUG("Fail to add db message");
goto __CATCH;
}
- //set
+ /* set */
if (MsgGetFileSize(raw_filepath, (int *)&pMsgInfo->dataSize) == false) {
MSG_SEC_DEBUG("Fail to get mms file size [%s]", raw_filepath);
goto __CATCH;
}
- {//make Preview info for APP
+ { /* make Preview info for APP */
MmsPluginAppBase *appBase;
appBase = new MmsPluginAppBase(pMmsData);
appBase->makePreviewInfo(pMsgInfo->msgId, true, raw_filepath);
@@ -1359,7 +1395,8 @@ msg_error_t MmsPluginStorage::updateMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SE
MMS_DATA_S *pMmsData = NULL;
- if (MsgDeserializeMmsData(pSerializedMms, strlen(pSerializedMms), &pMmsData) != 0) {
+ /* CID 12917: strlen will give exception in case of NULL, hence the check of pSerializedMms */
+ if (pSerializedMms == NULL || MsgDeserializeMmsData(pSerializedMms, strlen(pSerializedMms), &pMmsData) != 0) {
MSG_DEBUG("Fail to Deserialize Message Data");
goto __CATCH;
}
@@ -1370,15 +1407,15 @@ msg_error_t MmsPluginStorage::updateMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SE
char raw_filepath[MSG_FILENAME_LEN_MAX+1] = {0,};
char working_dir[MSG_FILENAME_LEN_MAX+1] = {0,};
- //compose
+ /* compose */
MmsPluginComposer::instance()->composeSendReq(pMsgInfo, pSendOptInfo, pMmsData);
- //encode
+ /* encode */
snprintf(raw_filepath, sizeof(raw_filepath), "%s%d.mms", MSG_DATA_PATH, pMsgInfo->msgId);
MmsPluginEncoder::instance()->encodeMmsPdu(pMmsData, pMsgInfo->msgId, raw_filepath);
- //add to db
+ /* add to db */
memset(sqlQuery, 0x00, sizeof(sqlQuery));
snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET ASK_DELIVERY_REPORT = %d, KEEP_COPY = %d, ASK_READ_REPLY = %d, EXPIRY_TIME = %d, CUSTOM_DELIVERY_TIME = %d, DELIVERY_TIME= %d, PRIORITY = %d \
WHERE MSG_ID = %d;", MMS_PLUGIN_MESSAGE_TABLE_NAME, pSendOptInfo->bDeliverReq, pSendOptInfo->bKeepCopy, pSendOptInfo->option.mmsSendOptInfo.bReadReq,
@@ -1386,20 +1423,20 @@ msg_error_t MmsPluginStorage::updateMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SE
pSendOptInfo->option.mmsSendOptInfo.priority, pMsgInfo->msgId);
if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) {
- //CID 41997: Releasing pMmsDta in case of failure
+ /* CID 41997: Releasing pMmsDta in case of failure */
MsgMmsRelease(&pMmsData);
return MSG_ERR_DB_EXEC;
}
snprintf(working_dir, sizeof(working_dir), MSG_DATA_PATH"%d.mms.dir", pMsgInfo->msgId);
- MsgMmsSetMultipartListData(pMmsData);//app file -> data
+ MsgMmsSetMultipartListData(pMmsData); /* app file -> data */
- MmsPluginStorage::instance()->deleteMultipartList(pMsgInfo->msgId); //remove exist multipart
+ MmsPluginStorage::instance()->deleteMultipartList(pMsgInfo->msgId); /* remove exist multipart */
- MsgMmsSetMultipartListFilePath(working_dir, pMmsData);//data -> svc file
+ MsgMmsSetMultipartListFilePath(working_dir, pMmsData); /* data -> svc file */
- {//add multipart list
+ { /* add multipart list */
if (pMmsData->smil) {
pMmsData->smil->type = MIME_APPLICATION_SMIL;
insertMultipart(pMsgInfo->msgId, pMmsData->smil);
@@ -1419,15 +1456,15 @@ msg_error_t MmsPluginStorage::updateMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SE
}
}
- //set
+ /* set */
if (MsgGetFileSize(raw_filepath, (int *)&pMsgInfo->dataSize) == false) {
MSG_SEC_DEBUG("Fail to get mms file size [%s]", raw_filepath);
- //CID 41997: Releasing pMmsDta in case of failure
+ /* CID 41997: Releasing pMmsDta in case of failure */
MsgMmsRelease(&pMmsData);
goto __CATCH;
}
- {//make Preview info for APP
+ { /* make Preview info for APP */
MmsPluginAppBase *appBase;
appBase = new MmsPluginAppBase(pMmsData);
appBase->makePreviewInfo(pMsgInfo->msgId, true, raw_filepath);
@@ -1471,29 +1508,29 @@ msg_error_t MmsPluginStorage::getMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOP
pMmsData->header = pHeader;
switch(pMsg->msgType.subType) {
- case MSG_SENDREQ_MMS:
- pHeader->messageType = MMS_MSGTYPE_SEND_REQ;
- break;
- case MSG_SENDCONF_MMS:
- pHeader->messageType = MMS_MSGTYPE_SEND_CONF;
- break;
- case MSG_RETRIEVE_MMS:
- pHeader->messageType = MMS_MSGTYPE_RETRIEVE_CONF;
- break;
- case MSG_RETRIEVE_AUTOCONF_MMS:
- pHeader->messageType = MMS_MSGTYPE_RETRIEVE_CONF;
- break;
- case MSG_RETRIEVE_MANUALCONF_MMS:
- pHeader->messageType = MMS_MSGTYPE_RETRIEVE_CONF;
- break;
- case MSG_NOTIFICATIONIND_MMS:
- pHeader->messageType = MMS_MSGTYPE_NOTIFICATION_IND;
- break;
- default:
- break;
+ case MSG_SENDREQ_MMS:
+ pHeader->messageType = MMS_MSGTYPE_SEND_REQ;
+ break;
+ case MSG_SENDCONF_MMS:
+ pHeader->messageType = MMS_MSGTYPE_SEND_CONF;
+ break;
+ case MSG_RETRIEVE_MMS:
+ pHeader->messageType = MMS_MSGTYPE_RETRIEVE_CONF;
+ break;
+ case MSG_RETRIEVE_AUTOCONF_MMS:
+ pHeader->messageType = MMS_MSGTYPE_RETRIEVE_CONF;
+ break;
+ case MSG_RETRIEVE_MANUALCONF_MMS:
+ pHeader->messageType = MMS_MSGTYPE_RETRIEVE_CONF;
+ break;
+ case MSG_NOTIFICATIONIND_MMS:
+ pHeader->messageType = MMS_MSGTYPE_NOTIFICATION_IND;
+ break;
+ default:
+ break;
}
- err = getMmsData(pMsg->msgId, pMmsData); // get MmsData Info from DB
+ err = getMmsData(pMsg->msgId, pMmsData); /* get MmsData Info from DB */
if (err == MSG_SUCCESS) {
@@ -1507,7 +1544,7 @@ msg_error_t MmsPluginStorage::getMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOP
pSendOptInfo->option.mmsSendOptInfo.deliveryTime.time = pHeader->delivery.time;
}
- //MsgMmsSetMultipartListData(pMmsData);
+ /* MsgMmsSetMultipartListData(pMmsData); */
int mmsDataSize = MsgSerializeMms(pMmsData, pSerializedMms);
if (mmsDataSize > 0) {
pMsg->dataSize = mmsDataSize;
@@ -1519,7 +1556,7 @@ msg_error_t MmsPluginStorage::getMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOP
MSG_ERR("getMmsData fail, err = [%d]", err);
}
- //Release pMmsData
+ /* Release pMmsData */
MsgMmsRelease(&pMmsData);
MSG_END();
@@ -1530,7 +1567,7 @@ msg_error_t MmsPluginStorage::updateMessage(MSG_MESSAGE_INFO_S *pMsgInfo)
{
MSG_BEGIN();
- //update multipart list
+ /* update multipart list */
MMSList *multipart_list = NULL;
if (MmsPluginStorage::instance()->getMultipartList(pMsgInfo->msgId, &multipart_list) != MSG_SUCCESS)
return -1;
@@ -1540,7 +1577,7 @@ msg_error_t MmsPluginStorage::updateMessage(MSG_MESSAGE_INFO_S *pMsgInfo)
MmsPluginStorage::instance()->updateMultipart(pMsgInfo->msgId, true, pMultipart);
}
- //update preview
+ /* update preview */
char szFullPath[MSG_FILEPATH_LEN_MAX] = {0, };
MmsMsg *mmsMsg = NULL;
unique_ptr<MmsMsg*, void(*)(MmsMsg**)> buf(&mmsMsg, unique_ptr_deleter);
@@ -1549,7 +1586,7 @@ msg_error_t MmsPluginStorage::updateMessage(MSG_MESSAGE_INFO_S *pMsgInfo)
MmsPluginStorage::instance()->getMmsRawFilePath(pMsgInfo->msgId, szFullPath, sizeof(szFullPath));
MmsPluginDecoder::instance()->decodeMmsPdu(mmsMsg, pMsgInfo->msgId, szFullPath);
- {//make Preview info for APP
+ { /* make Preview info for APP */
MmsPluginAppBase *appBase;
appBase = new MmsPluginAppBase(mmsMsg);
appBase->makePreviewInfo(pMsgInfo->msgId, true, szFullPath);
@@ -1569,10 +1606,10 @@ int MmsPluginStorage::checkDuplicateNotification(char* pszTrID, char* pszContent
if (!pszTrID || strlen(pszTrID) == 0)
return 0;
- if(!pszContentLocation || strlen(pszContentLocation) == 0)
+ if (!pszContentLocation || strlen(pszContentLocation) == 0)
return 0;
- MSG_DEBUG("Trans Id = %s, Content Loc = %s", pszTrID, pszContentLocation);
+ MSG_SEC_DEBUG("Trans Id = %s, Content Loc = %s", pszTrID, pszContentLocation);
int msgId = 0;
msg_error_t err = MSG_SUCCESS;
@@ -1588,7 +1625,7 @@ int MmsPluginStorage::checkDuplicateNotification(char* pszTrID, char* pszContent
WHERE TRANSACTION_ID LIKE '%s' AND CONTENTS_LOCATION LIKE '%s'",
MMS_PLUGIN_MESSAGE_TABLE_NAME, pszTrID, pszContentLocation);
- MSG_DEBUG("sqlQuery [%s]", sqlQuery);
+ MSG_SEC_DEBUG("sqlQuery [%s]", sqlQuery);
err = dbHandle->getTable(sqlQuery, &rowCnt, NULL);
diff --git a/plugin/mms_plugin/MmsPluginTcs.cpp b/plugin/mms_plugin/MmsPluginTcs.cpp
deleted file mode 100755
index 5a9ca7b..0000000
--- a/plugin/mms_plugin/MmsPluginTcs.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved
- *
- * Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
- *
- * 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 "TCSImpl.h"
-#include "TCSErrorCodes.h"
-#include "MmsPluginDebug.h"
-#include "MsgUtilFile.h"
-#include "MmsPluginTcs.h"
-
-int MmsPluginTcsScanFile(const char *filepath, int *bLevel)
-{
- MSG_BEGIN();
- TCSLIB_HANDLE hLib;
- TCSScanResult result;
- TCSDetected* pDetected;
- int rtn, i;
- int ret_b_level = -1;
-
- if (MsgAccessFile(filepath, R_OK) == false) {
- MSG_SEC_DEBUG("not exist source file [%s]", filepath);
- return -1;
- }
-
- MSG_SEC_DEBUG("Scanning file name : %s\n", filepath);
-
- hLib = TCSLibraryOpen();
- if(hLib == INVALID_TCSLIB_HANDLE) {
- MSG_DEBUG("TCSLibraryOpen error\n");
- return -1;
- }
-
- rtn = TCSScanFile(hLib, filepath, TCS_DTYPE_UNKNOWN, TCS_SA_SCANONLY, 1, &result);
- if(rtn == 0)
- {
- MSG_DEBUG("Detected malware number: %d\n", result.iNumDetected);
- i = result.iNumDetected;
- pDetected = result.pDList;
- while(i && pDetected)
- {
- int temp_b_level;
- int temp_s_class;
- MSG_SEC_DEBUG(" +-- Malware [%d] Name: %s\n", i, pDetected->pszName);
- MSG_DEBUG(" +-- Malware [%d] uAction: %u : 0x%04x\n", i, pDetected->uAction, pDetected->uAction);
-
- temp_b_level = (pDetected->uAction & 0xFF00) >> 8;
- MSG_DEBUG(" +-- Malware [%d] Behavior level: %u\n", i, temp_b_level);
-
- if (ret_b_level == -1 || ret_b_level < temp_b_level) {
- ret_b_level = temp_b_level;
- }
-
- temp_s_class = (pDetected->uAction & 0x00FF);
- MSG_DEBUG(" +-- Malware [%d] Severity class: %u\n", i, temp_s_class);
-
- pDetected = pDetected->pNext;
- i --;
- }
-
- result.pfFreeResult(&result);
- } else {
- MSG_DEBUG("TCSScanFile fail: err = %d\n", rtn);
- }
-
- TCSLibraryClose(hLib);
-
- if (bLevel)
- *bLevel = ret_b_level;
-
- MSG_END();
-
- return 0;
-}
diff --git a/plugin/mms_plugin/MmsPluginTextConvert.cpp b/plugin/mms_plugin/MmsPluginTextConvert.cpp
index bd79ac6..9369296 100755
--- a/plugin/mms_plugin/MmsPluginTextConvert.cpp
+++ b/plugin/mms_plugin/MmsPluginTextConvert.cpp
@@ -16,7 +16,7 @@
#include <glib.h>
#include "MmsPluginDebug.h"
-#include "MmsPluginMIME.h"
+#include "MsgUtilMime.h"
#include "MmsPluginCodec.h"
#include "MmsPluginTextConvert.h"
#include "MmsPluginUtil.h"
@@ -51,7 +51,7 @@ bool MmsPluginTextConvert(const char *pToCodeSet, const char *pFromCodeset, cons
goto __CATCH;
}
- if (strcasecmp("utf-16", pFromCodeset) == 0) {//check utf-8 str though utf-16
+ if (strcasecmp("utf-16", pFromCodeset) == 0) { /* check utf-8 str though utf-16 */
MSG_DEBUG("Codeset [%s] check utf-8 type", pFromCodeset);
diff --git a/plugin/mms_plugin/MmsPluginTransport.cpp b/plugin/mms_plugin/MmsPluginTransport.cpp
index 5af58cf..5b79262 100755
--- a/plugin/mms_plugin/MmsPluginTransport.cpp
+++ b/plugin/mms_plugin/MmsPluginTransport.cpp
@@ -57,8 +57,11 @@ void MmsPluginTransport::submitRequest(const MSG_REQUEST_INFO_S *pReqInfo)
reqItem.reqID = pReqInfo->reqId;
reqItem.simId = pReqInfo->msgInfo.sim_idx;
- char *msisdn = NULL;
- msisdn = MsgSettingGetString(MSG_SIM_MSISDN);
+ char keyName[MAX_VCONFKEY_NAME_LEN];
+ memset(keyName, 0x00, sizeof(keyName));
+
+ snprintf(keyName, sizeof(keyName), "%s/%d", MSG_SIM_MSISDN, pReqInfo->msgInfo.sim_idx);
+ char *msisdn = MsgSettingGetString(keyName);
MSG_DEBUG("pReqInfo->msgInfo.msgType.subType [%d]", pReqInfo->msgInfo.msgType.subType);
@@ -82,16 +85,18 @@ void MmsPluginTransport::submitRequest(const MSG_REQUEST_INFO_S *pReqInfo)
reqItem.pGetData = (char *)malloc(reqItem.getDataLen);
if (reqItem.pGetData)
memcpy(reqItem.pGetData, pReqInfo->msgInfo.msgData, reqItem.getDataLen);
+ memcpy(reqItem.url, pReqInfo->msgInfo.msgURL, MMS_LOCATION_LEN);
MSG_MMS_VLD_INFO("%d, MMS Receive Auto Start %s->%s, Success", pReqInfo->msgInfo.msgId, pReqInfo->msgInfo.addressList[0].addressVal, (msisdn == NULL)?"ME":msisdn);
break;
- case MSG_NOTIFYRESPIND_MMS: //reject
+ case MSG_NOTIFYRESPIND_MMS: /* reject */
{
MSG_DEBUG("######### MANUAL RETRIEVE : SEND NOTIFY RESPONSE IND");
reqItem.msgId = pReqInfo->msgInfo.msgId;
reqItem.eMmsPduType = eMMS_NOTIFYRESP_IND;
reqItem.eHttpCmdType = eHTTP_CMD_POST_TRANSACTION;
reqItem.pPostData = MsgOpenAndReadMmsFile(pReqInfo->msgInfo.msgData, 0, -1, &reqItem.postDataLen);
+ memcpy(reqItem.url, pReqInfo->msgInfo.msgURL, MMS_LOCATION_LEN);
int ret = remove(pReqInfo->msgInfo.msgData);
if (ret != 0) {
MSG_DEBUG("remove fail\n");
@@ -107,31 +112,30 @@ void MmsPluginTransport::submitRequest(const MSG_REQUEST_INFO_S *pReqInfo)
reqItem.pGetData = (char *)malloc(reqItem.getDataLen);
if (reqItem.pGetData)
memcpy(reqItem.pGetData, pReqInfo->msgInfo.msgData, reqItem.getDataLen);
+ memcpy(reqItem.url, pReqInfo->msgInfo.msgData, MMS_LOCATION_LEN);
MSG_MMS_VLD_INFO("%d, MMS Receive Manual Start %s->%s, Success", pReqInfo->msgInfo.msgId, pReqInfo->msgInfo.addressList[0].addressVal, (msisdn == NULL)?"ME":msisdn);
break;
- case MSG_READREPLY_MMS:
- {
+ case MSG_READREPLY_MMS: {
MSG_DEBUG("######### SEND READ REPORT : POST TRANSACTION");
reqItem.msgId = pReqInfo->msgInfo.msgId;
reqItem.eMmsPduType = eMMS_READREPORT_REQ;
reqItem.eHttpCmdType = eHTTP_CMD_POST_TRANSACTION;
reqItem.pPostData = MsgOpenAndReadMmsFile(pReqInfo->msgInfo.msgData, 0, -1, &reqItem.postDataLen);
- // remove x-Read-Rec.ind file
+ /* remove x-Read-Rec.ind file */
int ret = remove(pReqInfo->msgInfo.msgData);
if (ret != 0) {
MSG_DEBUG("remove fail\n");
}
break;
}
- case MSG_READRECIND_MMS:
- {
+ case MSG_READRECIND_MMS: {
MSG_DEBUG("######### SEND READREC IND : POST TRANSACTION");
reqItem.msgId = pReqInfo->msgInfo.msgId;
reqItem.eMmsPduType = eMMS_READREC_IND;
reqItem.eHttpCmdType = eHTTP_CMD_POST_TRANSACTION;
reqItem.pPostData = MsgOpenAndReadMmsFile(pReqInfo->msgInfo.msgData, 0, -1, &reqItem.postDataLen);
- // remove x-Read-Rec.ind file
+ /* remove x-Read-Rec.ind file */
int ret = remove(pReqInfo->msgInfo.msgData);
if (ret != 0) {
MSG_DEBUG("remove fail\n");
diff --git a/plugin/mms_plugin/MmsPluginUserAgent.cpp b/plugin/mms_plugin/MmsPluginUserAgent.cpp
index ff4d13b..b7ce3ff 100755
--- a/plugin/mms_plugin/MmsPluginUserAgent.cpp
+++ b/plugin/mms_plugin/MmsPluginUserAgent.cpp
@@ -124,7 +124,7 @@ void PRINT_QUEUE_ENTITY(mmsTranQEntity *entity)
MSG_DEBUG("Entity: eMmsPduType: %d", entity->eMmsPduType);
MSG_DEBUG("Entity: eHttpCmdType: %d", entity->eHttpCmdType);
MSG_DEBUG("Entity: GetLen: %d", entity->getDataLen);
- MSG_DEBUG("Entity: GetData: (%s)", entity->pGetData);
+ MSG_SEC_DEBUG("Entity: GetData: (%s)", entity->pGetData);
MSG_DEBUG("Entity: postLen: %d", entity->postDataLen);
MSG_DEBUG("Entity: pPostData: (%s)", entity->pPostData);
}
@@ -227,7 +227,7 @@ MmsPluginUaManager *MmsPluginUaManager::instance()
void MmsPluginUaManager::start()
{
-// bool bStart = true;
+/* bool bStart = true; */
MutexLocker lock(mx);
@@ -247,6 +247,7 @@ MMS_NET_ERROR_T MmsPluginUaManager::submitHandler(mmsTranQEntity *qEntity)
char *http_url = NULL;
const char *home_url = NULL;
const char *proxy_addr = NULL;
+ const char *dns_list = NULL;
const char *interfaceName = NULL;
bool cm_ret;
@@ -267,6 +268,10 @@ MMS_NET_ERROR_T MmsPluginUaManager::submitHandler(mmsTranQEntity *qEntity)
if (cm_ret == false)
return eMMS_EXCEPTIONAL_ERROR;
+ cm_ret = MmsPluginCmAgent::instance()->getDnsAddrList(&dns_list);
+ if (cm_ret == false)
+ return eMMS_EXCEPTIONAL_ERROR;
+
memset(&request_info, 0x00, sizeof(request_info));
if (qEntity->eHttpCmdType == eHTTP_CMD_POST_TRANSACTION) {
@@ -277,6 +282,8 @@ MMS_NET_ERROR_T MmsPluginUaManager::submitHandler(mmsTranQEntity *qEntity)
request_info.proxy = proxy_addr;
+ request_info.dns_list = dns_list;
+
request_info.interface = interfaceName;
request_info.post_data = qEntity->pPostData;
@@ -295,6 +302,8 @@ MMS_NET_ERROR_T MmsPluginUaManager::submitHandler(mmsTranQEntity *qEntity)
request_info.proxy = proxy_addr;
+ request_info.dns_list = dns_list;
+
request_info.interface = interfaceName;
}
@@ -314,8 +323,14 @@ MMS_NET_ERROR_T MmsPluginUaManager::submitHandler(mmsTranQEntity *qEntity)
qEntity->getDataLen = request_info.response_data_len;
ret = eMMS_SUCCESS;
} else {
- MSG_DEBUG("Unexpected Error http_ret = [%d]", http_ret);
- ret = eMMS_HTTP_ERROR_NETWORK;
+ bool cm_status = MmsPluginCmAgent::instance()->getCmStatus();
+ if (cm_status == false) {
+ MSG_INFO("PDP disconnected while MMS transaction in progress. cm status [%d]", cm_status);
+ ret = eMMS_CM_DISCONNECTED;
+ } else {
+ MSG_DEBUG("Unexpected Error http_ret = [%d]", http_ret);
+ ret = eMMS_HTTP_ERROR_NETWORK;
+ }
}
if (http_url)
@@ -343,16 +358,15 @@ void MmsPluginUaManager::run()
}
unlock();
- // Request CM Open
+ /* Request CM Open */
if (!(cmAgent->open())) {
MSG_FATAL("Cm Open Failed");
- // delete all request from reqQEntities
+ /* delete all request from reqQEntities */
lock();
int qSize = mmsTranQ.size();
unlock();
if (qSize > 0) {
- MSG_DEBUG("CLEANUP");
- MSG_DEBUG("clear mmsTranQ");
+ MSG_DEBUG("remove an entity from mmsTranQ");
mmsTranQEntity reqEntity;
memset(&reqEntity, 0, sizeof(mmsTranQEntity));
@@ -360,7 +374,7 @@ void MmsPluginUaManager::run()
lock();
mmsTranQ.front(&reqEntity);
unlock();
- // notify send fail to APP
+ /* notify send fail to APP */
MmsPluginEventHandler::instance()->handleMmsError(&reqEntity);
if (reqEntity.pGetData) {
@@ -376,13 +390,11 @@ void MmsPluginUaManager::run()
}
lock();
mmsTranQ.remove(reqEntity, compare_func_for_removal);
- //mmsTranQ.pop_front();
+/* mmsTranQ.pop_front(); */
unlock();
}
- lock();
- running = false;
- unlock();
- break;
+
+ continue;
}
bool transaction = true;
@@ -407,20 +419,22 @@ void MmsPluginUaManager::run()
PRINT_QUEUE_ENTITY(&reqEntity);
- // MMS Transaction
+ /* MMS Transaction */
MSG_DEBUG("\n\n =================== MMS Transaction Start ========================");
do {
- if (submitHandler(&reqEntity) != eMMS_SUCCESS) {
+ MMS_NET_ERROR_T mms_net_status = submitHandler(&reqEntity);
+ reqEntity.eMmsTransactionStatus = mms_net_status;
+ if (mms_net_status != eMMS_SUCCESS) {
MSG_DEBUG("Transaction Error: submit failed");
MmsPluginEventHandler::instance()->handleMmsError(&reqEntity);
lock();
mmsTranQ.remove(reqEntity, compare_func_for_removal);
- //mmsTranQ.pop_front();
+/* mmsTranQ.pop_front(); */
unlock();
- //try to next mmsTranQ
+ /* try to next mmsTranQ */
break;
}
@@ -435,19 +449,19 @@ void MmsPluginUaManager::run()
reqEntity.isCompleted = true;
lock();
mmsTranQ.remove(reqEntity, compare_func_for_removal);
- //mmsTranQ.pop_front();
+/* mmsTranQ.pop_front(); */
unlock();
MSG_DEBUG("Transaction Completed");
break;
} else {
- // change MmsPduType from XXX.req to XXX.conf for waiting
+ /* change MmsPduType from XXX.req to XXX.conf for waiting */
MSG_DEBUG("Update Pdutype");
updatePduType(&reqEntity);
MSG_DEBUG("Waiting Conf");
}
lock();
mmsTranQ.remove(reqEntity, compare_func_for_removal);
- //mmsTranQ.pop_front();
+/* mmsTranQ.pop_front(); */
unlock();
//////// Waiting Conf //////////////////////
MMS_NET_ERROR_T networkErr;
@@ -456,7 +470,7 @@ void MmsPluginUaManager::run()
bool bReportAllowed;
char retrievedFilePath[MAX_FULL_PATH_SIZE+1] = {0,};
- // process Http data
+ /* process Http data */
try {
if (processReceivedData(reqEntity.msgId, reqEntity.pGetData, reqEntity.getDataLen, retrievedFilePath) == false) {
MmsPluginEventHandler::instance()->handleMmsError(&reqEntity);
@@ -498,21 +512,21 @@ void MmsPluginUaManager::run()
MSG_DEBUG("conf received successfully -2");
MSG_DEBUG("reqEntity.eMmsPduType [%d]", reqEntity.eMmsPduType);
- // send NotifyResponseInd
+ /* send NotifyResponseInd */
if (reqEntity.eMmsPduType == eMMS_RETRIEVE_AUTO_CONF) {
char filepath[MAX_FULL_PATH_SIZE] = {0};
- // change MmsPduType for ind or ack
- // make the PDU and then attach to reqEntity also.
+ /* change MmsPduType for ind or ack */
+ /* make the PDU and then attach to reqEntity also. */
updatePduType(&reqEntity);
MSG_DEBUG("#### eMmsPduType:%d ####", reqEntity.eMmsPduType);
- //update http command type & encode m-notify-response-ind
+ /* update http command type & encode m-notify-response-ind */
reqEntity.eHttpCmdType = eHTTP_CMD_POST_TRANSACTION;
try {
MmsPluginInternal::instance()->encodeNotifyRespInd(reqEntity.transactionId, MMS_MSGSTATUS_RETRIEVED, bReportAllowed, filepath);
- //m-notification-resp-ind encoding if err is not MSG_SUCCESS then should set x-mms-status to deferred
+ /* m-notification-resp-ind encoding if err is not MSG_SUCCESS then should set x-mms-status to deferred */
if (MsgGetFileSize(filepath, &reqEntity.postDataLen) == false) {
MSG_DEBUG("MsgGetFileSize: failed");
break;
@@ -539,19 +553,17 @@ void MmsPluginUaManager::run()
}
MSG_DEBUG("Submit Ind");
- }
- else if (reqEntity.eMmsPduType == eMMS_RETRIEVE_MANUAL_CONF)
- {
- /* saved msg trId should be checked */
- // Send Acknowledge Ind
+ } else if (reqEntity.eMmsPduType == eMMS_RETRIEVE_MANUAL_CONF) {
+ /* saved msg trId should be checked
+ * Send Acknowledge Ind */
char filepath[MAX_FULL_PATH_SIZE] = {0};
- // change MmsPduType for ind or ack
- // make the PDU and then attach to reqEntity also.
+ /* change MmsPduType for ind or ack
+ * make the PDU and then attach to reqEntity also. */
updatePduType(&reqEntity);
MSG_DEBUG("#### eMmsPduType:%d ####", reqEntity.eMmsPduType);
- //update http command type & encode m-notify-response-ind
+ /* update http command type & encode m-notify-response-ind */
reqEntity.eHttpCmdType = eHTTP_CMD_POST_TRANSACTION;
try {
@@ -577,7 +589,7 @@ void MmsPluginUaManager::run()
lock();
mmsTranQ.push_front(reqEntity);
unlock();
- remove(filepath); // not ipc
+ remove(filepath); /* not ipc */
MSG_DEBUG("Submit Ack");
} else {
@@ -606,7 +618,7 @@ void MmsPluginUaManager::run()
}
- // Request CM Close
+ /* Request CM Close */
cmAgent->close();
}
@@ -642,12 +654,11 @@ bool MmsPluginUaManager::processReceivedData(int msgId, char *pRcvdBody, int rcv
{
MSG_BEGIN();
- //CID 317909 : replacing MSG_FILENAME_LEN_MAX with MAX_FULL_PATH_SIZE as the latter is max length for internal file path
- // and size of retrievedFilePath in calling function is same i.e. MAX_FULL_PATH_SIZE+1
- //CID 358483 : Making fileName smaller causes buffer overflow in MsgCreateFileName function.
- // So We will keep it 1024 as before but only copy 320 out of it which is the size of retrievedFilePath buffer.
+ /* CID 317909 : replacing MSG_FILENAME_LEN_MAX with MAX_FULL_PATH_SIZE as the latter is max length for internal file path
+ * and size of retrievedFilePath in calling function is same i.e. MAX_FULL_PATH_SIZE+1
+ * CID 358483 : Making fileName smaller causes buffer overflow in MsgCreateFileName function.
+ * So We will keep it 1024 as before but only copy 320 out of it which is the size of retrievedFilePath buffer. */
char fileName[MSG_FILENAME_LEN_MAX] = {0};
- //char fileName[MAX_FULL_PATH_SIZE] = {0};
MSG_DEBUG(":::%d :%s ", rcvdBodyLen, pRcvdBody);
@@ -657,19 +668,19 @@ bool MmsPluginUaManager::processReceivedData(int msgId, char *pRcvdBody, int rcv
if (MsgCreateFileName(fileName) == false)
return false;
- //CID 317909 : replacing MSG_FILENAME_LEN_MAX with MAX_FULL_PATH_SIZE as the latter is max length for internal file path
- // and size of retrievedFilePath in calling function is same i.e. MAX_FULL_PATH_SIZE+1
- //snprintf(retrievedFilePath, MSG_FILEPATH_LEN_MAX, "%s%s", MSG_DATA_PATH, fileName);
+ /* CID 317909 : replacing MSG_FILENAME_LEN_MAX with MAX_FULL_PATH_SIZE as the latter is max length for internal file path
+ * and size of retrievedFilePath in calling function is same i.e. MAX_FULL_PATH_SIZE+1
+ * snprintf(retrievedFilePath, MSG_FILEPATH_LEN_MAX, "%s%s", MSG_DATA_PATH, fileName); */
snprintf(retrievedFilePath, MAX_FULL_PATH_SIZE, "%s%s", MSG_DATA_PATH, fileName);
- MSG_INFO("retrievedFilePaths [%s]", retrievedFilePath);
+ MSG_SEC_INFO("retrievedFilePaths [%s]", retrievedFilePath);
- // create temp file
+ /* create temp file */
if (!MsgOpenCreateAndOverwriteFile(retrievedFilePath, (char *)pRcvdBody, rcvdBodyLen)) {
MSG_ERR( "_MmsUaInitMsgDecoder: creating temporary file failed(msgID=%d)\n", msgId);
return false;
}
-#if 1 //
+#if 1
MmsMsg *pMsg;
MmsPluginStorage::instance()->getMmsMessage(&pMsg);
@@ -677,7 +688,7 @@ bool MmsPluginUaManager::processReceivedData(int msgId, char *pRcvdBody, int rcv
memset(pMsg, 0, sizeof(MmsMsg));
MmsPluginDecoder::instance()->decodeMmsPdu(pMsg, msgId, retrievedFilePath);
-#else //
+#else
if (MmsReadMsgBody(msgId, true, true, retrievedFilePath) == false) {
MSG_INFO("The MMS Message might include drm contents!!!");
diff --git a/plugin/mms_plugin/MmsPluginUtil.cpp b/plugin/mms_plugin/MmsPluginUtil.cpp
index 6db2c2c..1753b5f 100755
--- a/plugin/mms_plugin/MmsPluginUtil.cpp
+++ b/plugin/mms_plugin/MmsPluginUtil.cpp
@@ -14,203 +14,17 @@
* limitations under the License.
*/
-#include <mm_file.h>
-#include <mm_util_jpeg.h>
-#include <mm_util_imgp.h>
-#include <thumbnail_util.h>
-#include <image_util.h>
-
#include <ctype.h>
#include <errno.h>
#include <sys/stat.h>
+#include <glib.h>
#include "MsgUtilFile.h"
-#include "MsgMutex.h"
#include "MmsPluginDebug.h"
#include "MmsPluginUtil.h"
#include <string>
using namespace std;
-Mutex g_mx;
-CndVar g_cv;
-
-void thumbnail_completed_cb(thumbnail_util_error_e error, const char *request_id,
- int thumb_width, int thumb_height,
- unsigned char *thumb_data, int thumb_size, void *user_data)
-{
- if (!user_data) {
- MSG_DEBUG("dstPath is NULL");
- return;
- }
-
- MSG_BEGIN();
-
- g_mx.lock();
- MSG_DEBUG("=================[RESULT]");
- MSG_DEBUG("error_code [%d]", error);
- MSG_DEBUG("request id [%s]", request_id);
- MSG_DEBUG("width [%d], height [%d]", thumb_width, thumb_height);
- MSG_DEBUG("raw_data [0x%x], size [%d]", *thumb_data, thumb_size);
-
- int ret = 0;
- ret = image_util_encode_jpeg(thumb_data, thumb_width, thumb_height, IMAGE_UTIL_COLORSPACE_BGRA8888, 90, (char *)user_data);;
- if (ret != IMAGE_UTIL_ERROR_NONE)
- MSG_DEBUG("image_util_encode_jpeg() is failed");
-
- g_cv.signal();
- g_mx.unlock();
-
- MSG_END();
-}
-
-bool MmsMakeImageThumbnail(char *srcPath, char *dstPath)
-{
- if (srcPath == NULL || dstPath == NULL) {
- MSG_DEBUG(MMS_DEBUG_STR_INVALID_PARAM" src = %p, dst = %p", srcPath, dstPath);
- return false;
- }
-
- if (MsgAccessFile(srcPath, R_OK) == false) {
- MSG_DEBUG("not exist source file [%s]", srcPath);
- return false;
- }
-
- g_mx.lock();
-
- int time_ret = 0;
-
- int ret = THUMBNAIL_UTIL_ERROR_NONE;
- char *req_id = NULL;
- thumbnail_h thumb_h;
- thumbnail_util_create(&thumb_h);
-// thumbnail_util_set_size(thumb_h, 240, 240);
- thumbnail_util_set_path(thumb_h, srcPath);
- MSG_DEBUG("thumbnail_util_extract");
-
- ret = thumbnail_util_extract(thumb_h, thumbnail_completed_cb, dstPath, &req_id);
- thumbnail_util_destroy(thumb_h);
- if (req_id) {
- g_free(req_id);
- req_id = NULL;
- }
-
- if (ret != THUMBNAIL_UTIL_ERROR_NONE) {
- MSG_DEBUG("thumbnail_util_extract is failed");
- g_mx.unlock();
- return false;
- }
-
- time_ret = g_cv.timedwait(g_mx.pMutex(), 5);
-
- g_mx.unlock();
-
- if (time_ret == ETIMEDOUT) {
- MSG_INFO("@@ WAKE by timeout@@");
- return false;
- }
-
- if (MsgAccessFile(dstPath, F_OK) == false) {
- MSG_DEBUG("not exist result file [%s]", dstPath);
- return false;
- }
-
- MSG_DEBUG("Make thumbnail: success [%s]", dstPath);
- return true;
-}
-
-bool MmsMakeVideoThumbnail(char *srcPath, char *dstPath)
-{
- MMHandleType content_attrs = (MMHandleType)NULL;
- char *err_attr_name = NULL;
- int fileRet = 0;
- int trackCount = 0;
-
- if (srcPath == NULL || dstPath == NULL) {
- MSG_DEBUG(MMS_DEBUG_STR_INVALID_PARAM" src = %p, dst = %p", srcPath, dstPath);
- return false;
- }
-
- if (MsgAccessFile(srcPath, R_OK) == false) {
- MSG_DEBUG("not exist source file [%s]", srcPath);
- return false;
- }
-
- fileRet = mm_file_create_content_attrs(&content_attrs, srcPath);
- if (fileRet != 0) {
- mm_file_destroy_content_attrs(content_attrs);
- MSG_DEBUG("mm_file_create_content_attrs fail [%d]", fileRet);
- return false;
- }
-
- fileRet = mm_file_get_attrs(content_attrs, &err_attr_name, MM_FILE_CONTENT_VIDEO_TRACK_COUNT, &trackCount, NULL);
- if (fileRet != 0) {
- MSG_SEC_DEBUG("mm_file_get_attrs fails [%s]", err_attr_name);
-
- if (err_attr_name) {
- free(err_attr_name);
- err_attr_name = NULL;
- }
-
- mm_file_destroy_content_attrs(content_attrs);
-
- return false;
- }
-
- MSG_DEBUG("video track num: %d", trackCount);
-
- if (trackCount <= 0) {
- mm_file_destroy_content_attrs(content_attrs);
- return false;
- }
-
-
- int thumbnailWidth = 0;
- int thumbnailHeight = 0;
- int thumbnailSize = 0;
- void *thumbnail = NULL;
-
- fileRet = mm_file_get_attrs(content_attrs, &err_attr_name, MM_FILE_CONTENT_VIDEO_WIDTH, &thumbnailWidth,
- MM_FILE_CONTENT_VIDEO_HEIGHT, &thumbnailHeight,
- MM_FILE_CONTENT_VIDEO_THUMBNAIL, &thumbnail, &thumbnailSize,
- NULL);
-
- if (fileRet != 0) {
- MSG_SEC_DEBUG("mm_file_get_attrs fails [%s]", err_attr_name);
- if (err_attr_name) {
- free(err_attr_name);
- err_attr_name = NULL;
- }
-
- mm_file_destroy_content_attrs(content_attrs);
- return false;
- }
-
- MSG_DEBUG("video width: %d", thumbnailWidth);
- MSG_DEBUG("video height: %d", thumbnailHeight);
- MSG_DEBUG("video thumbnail: %p", thumbnail);
-
- if (thumbnail == NULL) {
- mm_file_destroy_content_attrs(content_attrs);
- return false;
- }
-
- fileRet = mm_util_jpeg_encode_to_file (dstPath, thumbnail, thumbnailWidth, thumbnailHeight, MM_UTIL_JPEG_FMT_RGB888, 70);
- if (fileRet != 0) {
- MSG_DEBUG("mm_util_jpeg_encode_to_file fails [%d]", fileRet);
- mm_file_destroy_content_attrs(content_attrs);
- return false;
- }
-
- if (MsgAccessFile(dstPath, F_OK) == false) {
- MSG_DEBUG("not exist result file [%s]", dstPath);
- mm_file_destroy_content_attrs(content_attrs);
- return false;
- }
-
- MSG_DEBUG("Make thumbnail: success [%s]", dstPath);
- mm_file_destroy_content_attrs(content_attrs);
- return true;
-}
FILE *MmsFileOpen(char *pFileName)
{
@@ -326,7 +140,7 @@ bool MmsRemoveMarkup(const char *src, char *dst, int dstsize)
return true;
}
-//change character ' ' to '_'
+/* change character ' ' to '_' */
bool MmsReplaceSpaceChar(char *pszText)
{
if (!pszText) {
@@ -365,16 +179,16 @@ char *MmsReplaceNonAsciiUtf8(const char *szSrc, char replaceChar)
ptr = (const unsigned char*)szSrc;
- while(offset < srcLen && *(ptr) != '\0') {
+ while (offset < srcLen && *(ptr) != '\0') {
b1 = *(ptr);
- if ((b1 & 0x80) == 0) { //1byte : 0xxx xxxx
+ if ((b1 & 0x80) == 0) { /* 1byte : 0xxx xxxx */
offset += 1;
ptr += 1;
str += b1;
- } else if ((b1 & 0xE0) == 0xC0) { //2byte : 110x xxxx
+ } else if ((b1 & 0xE0) == 0xC0) { /* 2byte : 110x xxxx */
offset += 2;
if (offset > srcLen)
@@ -382,14 +196,14 @@ char *MmsReplaceNonAsciiUtf8(const char *szSrc, char replaceChar)
b2 = *(ptr + 1);
- if (b2 >= 0x80) { //10xx xxxx
+ if (b2 >= 0x80) { /* 10xx xxxx */
ptr += 2;
str += replaceChar;
} else {
return NULL;
}
- } else if ((b1 & 0xF0) == 0xE0) { //3byte : 1110 xxxx
+ } else if ((b1 & 0xF0) == 0xE0) { /* 3byte : 1110 xxxx */
offset += 3;
@@ -399,14 +213,14 @@ char *MmsReplaceNonAsciiUtf8(const char *szSrc, char replaceChar)
b2 = *(ptr + 1);
b3 = *(ptr + 2);
- if (b2 >= 0x80 && b3 >= 0x80) { //10xx xxxx
+ if (b2 >= 0x80 && b3 >= 0x80) { /* 10xx xxxx */
ptr += 3;
str += replaceChar;
} else {
return NULL;
}
- } else if ((b1 & 0xF8) == 0xF0) { //4byte : 1111 xxxx
+ } else if ((b1 & 0xF8) == 0xF0) { /* 4byte : 1111 xxxx */
offset += 4;
@@ -417,7 +231,7 @@ char *MmsReplaceNonAsciiUtf8(const char *szSrc, char replaceChar)
b3 = *(ptr + 2);
b4 = *(ptr + 3);
- if (b2 >= 0x80 && b3 >= 0x80 && b4 >= 0x80) { //10xx xxxx
+ if (b2 >= 0x80 && b3 >= 0x80 && b4 >= 0x80) { /* 10xx xxxx */
ptr += 4;
str += replaceChar;
@@ -458,14 +272,14 @@ bool MmsIsUtf8String(const unsigned char *szSrc, int nChar)
ptr = (const unsigned char*)szSrc;
- while(offset < srcLen && *(ptr) != '\0') {
+ while (offset < srcLen && *(ptr) != '\0') {
b1 = *(ptr);
- if ((b1 & 0x80) == 0) { //1byte : 0xxx xxxx
+ if ((b1 & 0x80) == 0) { /* 1byte : 0xxx xxxx */
offset += 1;
ptr += 1;
- } else if ((b1 & 0xE0) == 0xC0) { //2byte : 110x xxxx
+ } else if ((b1 & 0xE0) == 0xC0) { /* 2byte : 110x xxxx */
offset += 2;
if (offset > srcLen)
@@ -473,13 +287,13 @@ bool MmsIsUtf8String(const unsigned char *szSrc, int nChar)
b2 = *(ptr + 1);
- if (b2 >= 0x80) { //10xx xxxx
+ if (b2 >= 0x80) { /* 10xx xxxx */
ptr += 2;
} else {
return false;
}
- } else if ((b1 & 0xF0) == 0xE0) { //3byte : 1110 xxxx
+ } else if ((b1 & 0xF0) == 0xE0) { /* 3byte : 1110 xxxx */
offset += 3;
@@ -489,13 +303,13 @@ bool MmsIsUtf8String(const unsigned char *szSrc, int nChar)
b2 = *(ptr + 1);
b3 = *(ptr + 2);
- if (b2 >= 0x80 && b3 >= 0x80) { //10xx xxxx
+ if (b2 >= 0x80 && b3 >= 0x80) { /* 10xx xxxx */
ptr += 3;
} else {
return false;
}
- } else if ((b1 & 0xF8) == 0xF0) { //4byte : 1111 xxxx
+ } else if ((b1 & 0xF8) == 0xF0) { /* 4byte : 1111 xxxx */
offset += 4;
@@ -506,7 +320,7 @@ bool MmsIsUtf8String(const unsigned char *szSrc, int nChar)
b3 = *(ptr + 2);
b4 = *(ptr + 3);
- if (b2 >= 0x80 && b3 >= 0x80 && b4 >= 0x80) { //10xx xxxx
+ if (b2 >= 0x80 && b3 >= 0x80 && b4 >= 0x80) { /* 10xx xxxx */
ptr += 4;
} else {
return false;
@@ -514,7 +328,7 @@ bool MmsIsUtf8String(const unsigned char *szSrc, int nChar)
} else {
return false;
}
- }//while
+ } /* while */
return true;
}
diff --git a/plugin/mms_plugin/include/MmsPluginAppBase.h b/plugin/mms_plugin/include/MmsPluginAppBase.h
index f1e2c28..0dc81ea 100755
--- a/plugin/mms_plugin/include/MmsPluginAppBase.h
+++ b/plugin/mms_plugin/include/MmsPluginAppBase.h
@@ -19,7 +19,7 @@
#include "MmsPluginTypes.h"
-//Set Data for Message App
+/* Set Data for Message App */
class MmsPluginAppBase {
public:
MmsPluginAppBase();
@@ -36,4 +36,4 @@ public:
private:
MMS_MESSAGE_DATA_S mmsMsgData;
};
-#endif //MMS_PLUGIN_APPBASE_H
+#endif /* MMS_PLUGIN_APPBASE_H */
diff --git a/plugin/mms_plugin/include/MmsPluginCodec.h b/plugin/mms_plugin/include/MmsPluginCodec.h
index 0633099..aca21fe 100755
--- a/plugin/mms_plugin/include/MmsPluginCodec.h
+++ b/plugin/mms_plugin/include/MmsPluginCodec.h
@@ -22,4 +22,4 @@
#include "MmsPluginEncode.h"
#include "MmsPluginDecode.h"
-#endif //MMS_PLUGIN_CODEC_H
+#endif /* MMS_PLUGIN_CODEC_H */
diff --git a/plugin/mms_plugin/include/MmsPluginCodecCommon.h b/plugin/mms_plugin/include/MmsPluginCodecCommon.h
index 4b5006b..335682e 100755
--- a/plugin/mms_plugin/include/MmsPluginCodecCommon.h
+++ b/plugin/mms_plugin/include/MmsPluginCodecCommon.h
@@ -114,7 +114,7 @@ enum {
MSG_FIELD_MIME_VERSION,
MSG_FIELD_CONTENT_TYPE,
MSG_FIELD_CONTENT_TRANSFER_ENCODING,
- MSG_FIELD_CONTENT_DISPOSITION, //If start param is given in multipart/related, this field will be ignored
+ MSG_FIELD_CONTENT_DISPOSITION, /* If start param is given in multipart/related, this field will be ignored */
MSG_FIELD_CONTENT_ID,
MSG_FIELD_CONTENT_LOCATION,
MSG_FIELD_CONTENT_NAME,
@@ -140,11 +140,11 @@ enum {
MSG_PARAM_CHARSET,
MSG_PARAM_NAME,
MSG_PARAM_FILENAME,
- MSG_PARAM_TYPE, // only used as parameter of Content-Type: multipart/related
- MSG_PARAM_START, // Only if content-type is multipart/related
- MSG_PARAM_START_INFO, // Only if content-type is multipart/related
+ MSG_PARAM_TYPE, /* only used as parameter of Content-Type: multipart/related */
+ MSG_PARAM_START, /* Only if content-type is multipart/related */
+ MSG_PARAM_START_INFO, /* Only if content-type is multipart/related */
MSG_PARAM_BOUNDARY,
- MSG_PARAM_REPORT_TYPE, // only used as parameter of Content-Type: multipart/report; report-type=delivery-status;
+ MSG_PARAM_REPORT_TYPE, /* only used as parameter of Content-Type: multipart/report; report-type=delivery-status; */
#ifdef FEATURE_JAVA_MMS
MSG_PARAM_APPLICATION_ID,
MSG_PARAM_REPLY_TO_APPLICATION_ID,
@@ -194,4 +194,4 @@ bool MmsIsVitemContent(int type, char *pszName);
MsgMultipart *MmsAllocMultipart(void);
bool MmsPrintMulitpart(MsgMultipart *pMultipart, int index);
-#endif //MMS_PLUGIN_CODEC_COMMON_H
+#endif /* MMS_PLUGIN_CODEC_COMMON_H */
diff --git a/plugin/mms_plugin/include/MmsPluginCodecTypes.h b/plugin/mms_plugin/include/MmsPluginCodecTypes.h
index 0be998b..569b356 100755
--- a/plugin/mms_plugin/include/MmsPluginCodecTypes.h
+++ b/plugin/mms_plugin/include/MmsPluginCodecTypes.h
@@ -38,12 +38,14 @@
#define MSG_MMS_DECODE_BUFFER_MAX (2 * 1024)
#define MSB 0x80
#define QUOTE 0x7F
-#define MARK 0x22 // "
+#define MARK 0x22 /* " */
#define LENGTH_QUOTE 0x1F
#define MSG_STDSTR_LONG 0xFF
#define INVALID_VALUE -1
#define MMS_CONTENT_ID_LEN 100
+#define MMS_LOCATION_URL_LEN 1024
+
#define MSG_DATE_LEN 50
#define MSG_SUBJ_LEN 40
#define MSG_LOCALE_SUBJ_LEN (3 * MSG_SUBJ_LEN)
@@ -125,16 +127,16 @@ enum {
MMS_BODYHDR_DISPOSITION,
MMS_BODYHDR_CONTENTID,
MMS_BODYHDR_CONTENTLOCATION,
- MMS_BODYHDR_X_OMA_DRM_SEPARATE_DELIVERY, // DRM RO WAITING
+ MMS_BODYHDR_X_OMA_DRM_SEPARATE_DELIVERY, /* DRM RO WAITING */
};
typedef enum {
- //code
+ /* code */
MmsCodeFieldCode,
MmsCodeParameterCode,
MmsCodeMsgBodyHeaderCode,
- //Data
+ /* Data */
MmsCodeMsgType,
MmsCodeDeliveryReport,
MmsCodeTimeType,
@@ -168,12 +170,12 @@ typedef enum {
MMS_DATATYPE_RETRIEVING = 7,
MMS_DATATYPE_UNRETV = 8,
MMS_DATATYPE_TEMPLATE = 9,
- MMS_DATATYPE_DRM_RO_WAITING = 10 // DRM RO WAITING
+ 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_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,
@@ -184,31 +186,31 @@ typedef enum {
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_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_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_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_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_ERROR = -1, /* error return in Get method */
MMS_REPORTALLOWED_YES = 0,
MMS_REPORTALLOWED_NO = 1
} MmsReportAllowed;
@@ -220,22 +222,22 @@ typedef enum {
} 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_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_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_READSTATUS_NONE = -1, /* no touch status */
MMS_IS_READ = 0,
- MMS_IS_DELETED = 1 // Deleted without being read
+ MMS_IS_DELETED = 1 /* Deleted without being read */
} MmsReadStatus;
typedef enum {
@@ -251,8 +253,8 @@ typedef enum {
/* Response status */
typedef enum {
- MMS_RESPSTATUS_ERROR = -1, // error return in Get method
- MMS_RESPSTATUS_OK = 0, // default value
+ 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,
@@ -280,7 +282,7 @@ typedef enum {
} MmsResponseStatus;
typedef enum {
- MMS_RETRSTATUS_ERROR = -1, // error return in Get method
+ 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,
@@ -292,7 +294,7 @@ typedef enum {
} MmsRetrieveStatus;
typedef enum {
- MMS_REPLY_NONE = -1, // error return in Get method
+ MMS_REPLY_NONE = -1, /* error return in Get method */
MMS_REPLY_REQUESTED = 0,
MMS_REPLY_REQUESTED_TEXT_ONLY = 1,
MMS_REPLY_ACCEPTED = 2,
@@ -300,8 +302,8 @@ typedef enum {
} MmsReplyChargeType;
typedef enum {
- MMS_MSGCLASS_ERROR = -1, // error return in Get method
- MMS_MSGCLASS_PERSONAL = 0, // default
+ 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
@@ -340,7 +342,7 @@ typedef struct _MMS_ATTRIB_S {
UINT32 date;
UINT8 version;
- char szFrom[MSG_LOCALE_ADDR_LEN + 11]; //"/TYPE=PLMN", /"TYPE=IPv4", "/TYPE=IPv6"
+ char szFrom[MSG_LOCALE_ADDR_LEN + 11]; /* "/TYPE=PLMN", /"TYPE=IPv4", "/TYPE=IPv6" */
char szSubject[MSG_LOCALE_SUBJ_LEN + 1];
char *szTo;
char *szCc;
@@ -356,7 +358,7 @@ typedef struct _MMS_ATTRIB_S {
MmsRecvReadReportType readReportAllowedType;
bool bAskReadReply;
- bool bRead;//FIXME : remove this value
+ bool bRead; /* FIXME : remove this value */
MmsRecvReadReportSendStatus readReportSendStatus;
@@ -369,7 +371,7 @@ typedef struct _MMS_ATTRIB_S {
MmsTimeStruct expiryTime;
MmsTimeStruct deliveryTime;
- //for ReadMsg, When Sending notifyResp.ind
+ /* for ReadMsg, When Sending notifyResp.ind */
msg_delivery_report_status_t msgStatus;
MmsResponseStatus responseStatus;
@@ -397,7 +399,7 @@ typedef struct _MsgContentParam {
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;
+ MsgParamReportType reportType; /* only used as parameter of Content-Type: multipart/report; report-type=delivery-status; */
} MsgContentParam;
typedef struct _MsgDRMInfo {
@@ -409,7 +411,7 @@ typedef struct _MsgDRMInfo {
char *szContentVendor;
char *szRightIssuer;
char *szDrm2FullPath;
- int roWaitingTimerMax; // DRM RO WAITING
+ int roWaitingTimerMax; /* DRM RO WAITING */
bool bFwdLock;
char *pszContentType;
bool bNoRingTone;
@@ -429,6 +431,7 @@ typedef struct _MsgType {
int disposition;
char szContentID[MSG_MSG_ID_LEN + 1];
char szContentLocation[MSG_MSG_ID_LEN + 1];
+ char szLocation[MSG_MSG_ID_LEN + 1];
char szOrgFilePath[MSG_FILEPATH_LEN_MAX + 1];
MsgContentParam param;
@@ -456,7 +459,7 @@ struct _MsgMultipart {
typedef struct _MMS_MESSAGE_S {
MmsAttrib mmsAttrib;
msg_message_id_t msgID;
- int mailbox; // mailbox type,MMS_MAILBOX_XXX
+ 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];
@@ -467,4 +470,4 @@ typedef struct _MMS_MESSAGE_S {
MsgBody msgBody;
} MmsMsg;
-#endif //MMS_PLUGIN_CODEC_TYPE_H
+#endif /* MMS_PLUGIN_CODEC_TYPE_H */
diff --git a/plugin/mms_plugin/include/MmsPluginComposer.h b/plugin/mms_plugin/include/MmsPluginComposer.h
index c354d28..f82ed7e 100755
--- a/plugin/mms_plugin/include/MmsPluginComposer.h
+++ b/plugin/mms_plugin/include/MmsPluginComposer.h
@@ -20,7 +20,7 @@
#include "MmsPluginTypes.h"
#include "MmsPluginCodec.h"
-//make MMS_DATA_S for DB & Encoding
+/* make MMS_DATA_S for DB & Encoding */
class MmsPluginComposer {
public:
static MmsPluginComposer *instance();
@@ -43,4 +43,4 @@ private:
~MmsPluginComposer();
};
-#endif //MMS_PLUGIN_COMPOSER_H
+#endif /* MMS_PLUGIN_COMPOSER_H */
diff --git a/plugin/mms_plugin/include/MmsPluginConnManWrapper.h b/plugin/mms_plugin/include/MmsPluginConnManWrapper.h
index f8402d1..a6e66b0 100755
--- a/plugin/mms_plugin/include/MmsPluginConnManWrapper.h
+++ b/plugin/mms_plugin/include/MmsPluginConnManWrapper.h
@@ -25,8 +25,7 @@ typedef enum {
MSG_CM_ERR_UNKNOWN,
} cm_error_e;
-class MmsPluginCmAgent
-{
+class MmsPluginCmAgent {
public:
static MmsPluginCmAgent *instance();
@@ -41,6 +40,8 @@ public:
bool getInterfaceName(const char **deviceName);
bool getProxyAddr(const char **proxyAddr);
bool getHomeUrl(const char **homeURL);
+ bool getDnsAddrList(const char **dnsAddrList);
+
private:
MmsPluginCmAgent();
~MmsPluginCmAgent();
@@ -54,14 +55,15 @@ private:
void setCmStatus() { isCmOpened = true; }
void resetCmStatus() { isCmOpened = false; }
- bool isCmOpened; //connection & profile connect
+ bool isCmOpened; /* connection & profile connect */
bool waitProfileOpen;
char *home_url;
char *interface_name;
char *proxy_address;
+ char *dns_address_list;
Mutex mx;
CndVar cv;
};
-#endif //MMS_PLUGIN_CONNMAN_H
+#endif /* MMS_PLUGIN_CONNMAN_H */
diff --git a/plugin/mms_plugin/include/MmsPluginDebug.h b/plugin/mms_plugin/include/MmsPluginDebug.h
index d77485e..da0518d 100755
--- a/plugin/mms_plugin/include/MmsPluginDebug.h
+++ b/plugin/mms_plugin/include/MmsPluginDebug.h
@@ -25,4 +25,4 @@
#define MMS_DEBUG_STR_FILE_NOT_EXIST "File not exist"
-#endif //MMS_PLUGIN_DEBUG_H
+#endif /* MMS_PLUGIN_DEBUG_H */
diff --git a/plugin/mms_plugin/include/MmsPluginDecode.h b/plugin/mms_plugin/include/MmsPluginDecode.h
index ddd3b3e..e85057e 100755
--- a/plugin/mms_plugin/include/MmsPluginDecode.h
+++ b/plugin/mms_plugin/include/MmsPluginDecode.h
@@ -26,10 +26,10 @@ typedef int MmsMsgID;
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
+ 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 {
@@ -43,14 +43,14 @@ struct _MsgHeaderAddress {
MsgHeaderAddress *pNext;
};
-// for Decoding & Encoding
+/* for Decoding & Encoding */
typedef struct {
MmsMsgType type;
char szTrID[MMS_TR_ID_LEN+1];
UINT8 version;
UINT32 date;
- MsgHeaderAddress *pFrom; //"/TYPE=PLMN", /"TYPE=IPv4", "/TYPE=IPv6"
+ MsgHeaderAddress *pFrom; /* "/TYPE=PLMN", /"TYPE=IPv4", "/TYPE=IPv6" */
MsgHeaderAddress *pTo;
MsgHeaderAddress *pCc;
MsgHeaderAddress *pBcc;
@@ -75,13 +75,13 @@ typedef struct {
MmsReplyCharge replyCharge;
- // only used at Decoding module
+ /* only used at Decoding module */
char szMsgID[MMS_MSG_ID_LEN + 1];
UINT32 msgSize;
MsgDrmType drmType;
- // dependent to Client implementation
+ /* dependent to Client implementation */
MsgType msgType;
MsgBody msgBody;
} MmsHeader;
@@ -120,4 +120,4 @@ private:
~MmsPluginDecoder();
};
-#endif //MMS_PLUGIN_DECODE_H
+#endif /* MMS_PLUGIN_DECODE_H */
diff --git a/plugin/mms_plugin/include/MmsPluginDrm.h b/plugin/mms_plugin/include/MmsPluginDrm.h
index f40112b..fff050c 100755
--- a/plugin/mms_plugin/include/MmsPluginDrm.h
+++ b/plugin/mms_plugin/include/MmsPluginDrm.h
@@ -21,4 +21,4 @@
bool MmsPluginDrmGetInfo(const char *szFilePath, MsgType *pMsgType);
-#endif //MMS_PLUGIN_DRM_H
+#endif /* MMS_PLUGIN_DRM_H */
diff --git a/plugin/mms_plugin/include/MmsPluginEncode.h b/plugin/mms_plugin/include/MmsPluginEncode.h
index 235b45b..3a7ee31 100755
--- a/plugin/mms_plugin/include/MmsPluginEncode.h
+++ b/plugin/mms_plugin/include/MmsPluginEncode.h
@@ -47,4 +47,4 @@ private:
~MmsPluginEncoder();
};
-#endif //MMS_PLUGIN_ENCODE_H
+#endif /* MMS_PLUGIN_ENCODE_H */
diff --git a/plugin/mms_plugin/include/MmsPluginEventHandler.h b/plugin/mms_plugin/include/MmsPluginEventHandler.h
index 2aa676b..0421770 100755
--- a/plugin/mms_plugin/include/MmsPluginEventHandler.h
+++ b/plugin/mms_plugin/include/MmsPluginEventHandler.h
@@ -19,9 +19,9 @@
#include "MsgPluginInterface.h"
#include "MmsPluginTypes.h"
+#include <tapi_common.h>
-class MmsPluginEventHandler
-{
+class MmsPluginEventHandler {
public:
static MmsPluginEventHandler *instance();
@@ -32,10 +32,13 @@ public:
private:
MmsPluginEventHandler();
virtual ~MmsPluginEventHandler();
+ int initTelHandle();
+ void deinitTelHandle();
+ TapiHandle *getTelHandle(int sim_idx);
static MmsPluginEventHandler *pInstance;
MSG_PLUGIN_LISTENER_S listener;
};
-#endif //MMS_PLUGIN_EVENT_HANDLER_H
+#endif /* MMS_PLUGIN_EVENT_HANDLER_H */
diff --git a/plugin/mms_plugin/include/MmsPluginHttp.h b/plugin/mms_plugin/include/MmsPluginHttp.h
index 2292337..239ff85 100755
--- a/plugin/mms_plugin/include/MmsPluginHttp.h
+++ b/plugin/mms_plugin/include/MmsPluginHttp.h
@@ -23,7 +23,7 @@
#define MSG_MMS_HH_CONTENT_TYPE "application/vnd.wap.mms-message"
#define MSG_MMS_HH_ACCEPT "application/vnd.wap.mms-message, */*"
-#define MSG_MMS_HH_CHARSET "utf-8"
+#define MSG_MMS_HH_CHARSET "utf-8, us-ascii"
#define MSG_MMS_HH_LANGUAGE "zh-cn, en"
#define MSG_MMS_HH_ENCODING "deflate,gzip"
@@ -63,6 +63,7 @@ typedef struct _http_session_info_s {
MMS_HTTP_TRANSACTION_TYPE_E transaction_type;
const char *url;
const char *proxy;
+ const char *dns_list;
const char *interface;
const char *post_data;
unsigned int post_data_len;
@@ -70,8 +71,7 @@ typedef struct _http_session_info_s {
unsigned int response_data_len;
} http_request_info_s;
-class MmsPluginHttpAgent
-{
+class MmsPluginHttpAgent {
public:
static MmsPluginHttpAgent *instance();
@@ -113,4 +113,4 @@ class MmsPluginHttpAgent
Mutex mx;
};
-#endif //MMS_PLUGIN_HTTP_H
+#endif /* MMS_PLUGIN_HTTP_H */
diff --git a/plugin/mms_plugin/include/MmsPluginInternal.h b/plugin/mms_plugin/include/MmsPluginInternal.h
index 53550f3..8bed1c4 100755
--- a/plugin/mms_plugin/include/MmsPluginInternal.h
+++ b/plugin/mms_plugin/include/MmsPluginInternal.h
@@ -20,8 +20,7 @@
#include "MmsPluginTypes.h"
#include "MmsPluginCodecTypes.h"
-class MmsPluginInternal
-{
+class MmsPluginInternal {
public:
static MmsPluginInternal *instance();
@@ -48,4 +47,4 @@ class MmsPluginInternal
const char *getMmsReadStatus(msg_read_report_status_t readStatus);
};
-#endif //MMS_PLUGIN_INTERNAL_H
+#endif /* MMS_PLUGIN_INTERNAL_H */
diff --git a/plugin/mms_plugin/include/MmsPluginMIME.h b/plugin/mms_plugin/include/MmsPluginMIME.h
deleted file mode 100755
index fe53ff8..0000000
--- a/plugin/mms_plugin/include/MmsPluginMIME.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved
- *
- * Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
- *
- * 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_MIME_H
-#define MMS_PLUGIN_MIME_H
-
-#include "MmsPluginTypes.h"
-
-#define UNDEFINED_BINARY 0xFF
-
-typedef enum _MimeMainType {
- MIME_MAINTYPE_UNKNOWN = -1,
- MIME_MAINTYPE_APPLICATION,
- MIME_MAINTYPE_AUDIO,
- MIME_MAINTYPE_IMAGE,
- MIME_MAINTYPE_MESSAGE,
- MIME_MAINTYPE_MULTIPART,
- MIME_MAINTYPE_TEXT,
- MIME_MAINTYPE_VIDEO,
- MIME_MAINTYPE_THEME,
- MIME_MAINTYPE_ETC
-} MimeMainType;
-
-char *MimeGetExtFromMimeInt(MimeType mime);
-
-MimeMainType MimeGetMainTypeInt(MimeType mime);
-
-MimeType MimeGetMimeIntFromBi(int binCode);
-
-int MimeGetBinaryValueFromMimeInt(MimeType mime);
-
-MimeType MimeGetMimeIntFromMimeString(char *szMimeStr);
-
-char *MimeGetMimeStringFromMimeInt(int mimeType);
-
-bool MmsGetMimeTypeFromExt(MimeMainType mainType, const char *pExt, MimeType *pMimeType, const char **ppszMimeType);
-
-bool MmsGetMimeTypeFromFileName(MimeMainType mainType, const char *pFileName, MimeType *pMimeType, const char **ppszMimeType);
-
-#endif // MMS_PLUGIN_MIME_H
diff --git a/plugin/mms_plugin/include/MmsPluginMain.h b/plugin/mms_plugin/include/MmsPluginMain.h
index 527dff8..3deac7c 100755
--- a/plugin/mms_plugin/include/MmsPluginMain.h
+++ b/plugin/mms_plugin/include/MmsPluginMain.h
@@ -54,5 +54,5 @@ msg_error_t MmsDeleteMessage(msg_message_id_t msgId);
}
#endif
-#endif //MMS_PLUGIN_MAIN_H
+#endif /* MMS_PLUGIN_MAIN_H */
diff --git a/plugin/mms_plugin/include/MmsPluginMessage.h b/plugin/mms_plugin/include/MmsPluginMessage.h
index a12ad04..06501fe 100755
--- a/plugin/mms_plugin/include/MmsPluginMessage.h
+++ b/plugin/mms_plugin/include/MmsPluginMessage.h
@@ -24,21 +24,21 @@
void MmsComposeNotiMessage(MmsMsg *pMmsMsg, msg_message_id_t msgID);
void MmsComposeReadReportMessage(MmsMsg *pMmsMsg, const MSG_MESSAGE_INFO_S *pMsgInfo, msg_message_id_t selectedMsgId);
+/*
+int MmsUpdatePreviewData(MSG_MESSAGE_INFO_S *pMsgInfo);
-//int MmsUpdatePreviewData(MSG_MESSAGE_INFO_S *pMsgInfo);
-//
-//int MmsUpdateMultipartList(MSG_MESSAGE_INFO_S *pMsgInfo);
+int MmsUpdateMultipartList(MSG_MESSAGE_INFO_S *pMsgInfo);
-//void MmsPrintFileInfoForVLD(MMS_MESSAGE_DATA_S *pMmsMsg);
-//
-//bool MmsChangeFileNameToAscii(MMS_MESSAGE_DATA_S *pMsgData);
+void MmsPrintFileInfoForVLD(MMS_MESSAGE_DATA_S *pMmsMsg);
+bool MmsChangeFileNameToAscii(MMS_MESSAGE_DATA_S *pMsgData);
+*/
bool MmsConvertMsgData(MmsMsg *pMsg, MMS_MESSAGE_DATA_S *pMmsMsg);
-bool MmsConvertMmsData(MmsMsg *pMsg, MMS_DATA_S *pMmsData);//temp func for supporting new mmsdata
+bool MmsConvertMmsData(MmsMsg *pMsg, MMS_DATA_S *pMmsData); /* temp func for supporting new mmsdata */
bool MmsConvertMmsMsg(MmsMsg *pMmsMsg, MMS_DATA_S *pMsgData);
msg_error_t MmsMakeMultipartThumbnailInfo(MMS_MULTIPART_DATA_S *pMultipart, char *thumbnail_path);
-#endif //MMS_PLUGIN_MESSAGE_H
+#endif /* MMS_PLUGIN_MESSAGE_H */
diff --git a/plugin/mms_plugin/include/MmsPluginStorage.h b/plugin/mms_plugin/include/MmsPluginStorage.h
index 8086d2f..c260c47 100755
--- a/plugin/mms_plugin/include/MmsPluginStorage.h
+++ b/plugin/mms_plugin/include/MmsPluginStorage.h
@@ -20,37 +20,36 @@
#include "MsgSqliteWrapper.h"
#include "MmsPluginCodecTypes.h"
-class MmsPluginStorage
-{
+class MmsPluginStorage {
public:
static MmsPluginStorage *instance();
MmsPluginStorage();
~MmsPluginStorage();
- //MMS message operation
+ /* MMS message operation */
msg_error_t addMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S *pSendOptInfo, char *pSerializedMms);
msg_error_t getMessage(MSG_MESSAGE_INFO_S *pMsg, MSG_SENDINGOPT_INFO_S *pSendOptInfo, char **pSerializedMms);
msg_error_t updateMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S *pSendOptInfo, char *pSerializedMms);
- msg_error_t updateMessage(MSG_MESSAGE_INFO_S *pMsgInfo);//malware allowed
+ msg_error_t updateMessage(MSG_MESSAGE_INFO_S *pMsgInfo); /* malware allowed */
msg_error_t deleteMmsMessage(int msgId);
- //MMS message preview info
+ /* MMS message preview info */
msg_error_t insertPreviewInfo(int msgId, int type, const char *value, int count = 0);
msg_error_t removePreviewInfo(int msgId);
- //MMS message multipart list
+ /* MMS message multipart list */
msg_error_t insertMultipart(msg_message_id_t msgId, MMS_MULTIPART_DATA_S *pMultipart);
msg_error_t updateMultipart(msg_message_id_t msgId, int allow_malware, MMS_MULTIPART_DATA_S *pMultipart);
msg_error_t getMultipartList(msg_message_id_t msgId, MMSList **multipart_list);
msg_error_t deleteMultipartList(int msgId);
- //MMS message report
+ /* MMS message report */
msg_error_t insertDeliveryReport(msg_message_id_t msgId, char *address, MmsMsgMultiStatus *pStatus);
msg_error_t insertReadReport(msg_message_id_t msgId, char *address, MmsMsgMultiStatus *pStatus);
- //etc
+ /* etc */
void getMmsMessage(MmsMsg **pMmsMsg);
msg_error_t getMmsMessageId(msg_message_id_t selectedMsgId, MmsMsg *pMmsMsg);
void composeReadReport(MSG_MESSAGE_INFO_S *pMsgInfo);
@@ -87,5 +86,5 @@ private:
MmsMsg mmsMsg;
};
-#endif //MMS_PLUGIN_STORAGE_H
+#endif /* MMS_PLUGIN_STORAGE_H */
diff --git a/plugin/mms_plugin/include/MmsPluginTcs.h b/plugin/mms_plugin/include/MmsPluginTcs.h
deleted file mode 100755
index 449a000..0000000
--- a/plugin/mms_plugin/include/MmsPluginTcs.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved
- *
- * Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
- *
- * 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_TCS_H
-#define MMS_PLUGIN_TCS_H
-
-//Scan content on file system.
-int MmsPluginTcsScanFile(const char *filepath, int *bLevel);
-
-#endif //MMS_PLUGIN_TCS_H
diff --git a/plugin/mms_plugin/include/MmsPluginTextConvert.h b/plugin/mms_plugin/include/MmsPluginTextConvert.h
index 50cf1d0..2da1f63 100755
--- a/plugin/mms_plugin/include/MmsPluginTextConvert.h
+++ b/plugin/mms_plugin/include/MmsPluginTextConvert.h
@@ -21,4 +21,4 @@ const char *MmsPluginTextConvertGetCharSet(int MIBEnum);
bool MmsPluginTextConvert(const char *pToCodeSet, const char *pFromCodeSet, const char *pSrc, int srcLen, char **ppDest, int *pDestLen);
-#endif //MMS_PLUGIN_TEXT_CONVERT_H
+#endif /* MMS_PLUGIN_TEXT_CONVERT_H */
diff --git a/plugin/mms_plugin/include/MmsPluginTransport.h b/plugin/mms_plugin/include/MmsPluginTransport.h
index 28cc34e..d3b2f1c 100755
--- a/plugin/mms_plugin/include/MmsPluginTransport.h
+++ b/plugin/mms_plugin/include/MmsPluginTransport.h
@@ -19,8 +19,7 @@
#include "MmsPluginTypes.h"
-class MmsPluginTransport
-{
+class MmsPluginTransport {
public:
static MmsPluginTransport *instance();
@@ -34,4 +33,4 @@ class MmsPluginTransport
static MmsPluginTransport *pInstance;
};
-#endif //MMS_PLUGIN_TRANSPORT_H
+#endif /* MMS_PLUGIN_TRANSPORT_H */
diff --git a/plugin/mms_plugin/include/MmsPluginTypes.h b/plugin/mms_plugin/include/MmsPluginTypes.h
index 8cafe1a..9b9bf05 100755
--- a/plugin/mms_plugin/include/MmsPluginTypes.h
+++ b/plugin/mms_plugin/include/MmsPluginTypes.h
@@ -37,23 +37,24 @@ enum _MMS_NET_ERROR_E {
eMMS_CM_OPEN_FAILED,
eMMS_CM_CLOSE_IND,
eMMS_CM_CLOSE_RSP,
- eMMS_CM_CLOSE_FAILED, //5
+ eMMS_CM_CLOSE_FAILED, /* 5 */
eMMS_CM_KILL_RSP,
eMMS_CM_KILL_FAILED,
+ eMMS_CM_DISCONNECTED,
eMMS_HTTP_SESSION_INIT,
eMMS_HTTP_SESSION_CLOSED,
- eMMS_HTTP_SESSION_OPEN_FAILED, //10
+ eMMS_HTTP_SESSION_OPEN_FAILED, /* 11 */
eMMS_HTTP_SENT_SUCCESS,
eMMS_HTTP_CONF_SUCCESS,
eMMS_HTTP_ERROR_NETWORK,
eMMS_HTTP_CONF_RECEIVED_TIMEOUT,
- eMMS_HTTP_RECV_DATA, //15
+ eMMS_HTTP_RECV_DATA, /* 16 */
eMMS_HTTP_EVENT_RECV_DATA_PROGRESS,
eMMS_HTTP_EVENT_RECV_DATA_ERROR,
eMMS_HTTP_EVENT_SENT_ACK_COMPLETED,
eMMS_HTTP_ERROR_UNKNOWN,
- eMMS_EXCEPTIONAL_ERROR, //20
+ eMMS_EXCEPTIONAL_ERROR, /* 21 */
eMMS_UNKNOWN
};
@@ -69,7 +70,7 @@ enum _MMS_PDU_TYPE_E {
eMMS_READREC_IND,
eMMS_READORIG_IND,
eMMS_READREPORT_REQ,
- eMMS_READREPORT_CONF, //10
+ eMMS_READREPORT_CONF, /* 10 */
eMMS_FORWARD_REQ,
eMMS_FORWARD_CONF,
eMMS_RETRIEVE_AUTO,
@@ -79,7 +80,7 @@ enum _MMS_PDU_TYPE_E {
eMMS_CANCEL_CONF,
eMMS_DELETE_REQ,
eMMS_DELETE_CONF,
- eMMS_MBOX_STORE_REQ, // 20
+ eMMS_MBOX_STORE_REQ, /* 20 */
eMMS_MBOX_STORE_CONF,
eMMS_MBOX_VIEW_REQ,
eMMS_MBOX_VIEW_CONF,
@@ -112,14 +113,15 @@ typedef struct _mmsTranQEntity {
MMS_PDU_TYPE_T eMmsPduType;
MMS_HTTP_CMD_TYPE_T eHttpCmdType;
- MMS_PDU_TYPE_T eMmsTransactionStatus;
+ MMS_NET_ERROR_T eMmsTransactionStatus;
int postDataLen;
char *pPostData;
int getDataLen;
char *pGetData;
+ char url[MMS_LOCATION_LEN+1];
} mmsTranQEntity;
-#endif //MMS_PLUGIN_TYPES_H
+#endif /* MMS_PLUGIN_TYPES_H */
diff --git a/plugin/mms_plugin/include/MmsPluginUserAgent.h b/plugin/mms_plugin/include/MmsPluginUserAgent.h
index 3df0340..8368d4a 100755
--- a/plugin/mms_plugin/include/MmsPluginUserAgent.h
+++ b/plugin/mms_plugin/include/MmsPluginUserAgent.h
@@ -22,8 +22,7 @@
#include "MsgQueue.h"
#include "MmsPluginTypes.h"
-class MmsPluginUaManager: public MsgThread
-{
+class MmsPluginUaManager: public MsgThread {
public:
static MmsPluginUaManager *instance();
virtual void start();
@@ -50,10 +49,10 @@ class MmsPluginUaManager: public MsgThread
MMS_NET_ERROR_T submitHandler(mmsTranQEntity *qEntity);
MMS_NET_ERROR_T waitingConf(mmsTranQEntity *qEntity);
- // condition values
- bool running; // flag for thread running
+ /* condition values */
+ bool running; /* flag for thread running */
- MsgSimpleQ<mmsTranQEntity> mmsTranQ; // transaction q for mms plugin
+ MsgSimpleQ<mmsTranQEntity> mmsTranQ; /* transaction q for mms plugin */
};
-#endif //MMS_PLUGIN_USERAGENT_H
+#endif /* MMS_PLUGIN_USERAGENT_H */
diff --git a/plugin/mms_plugin/include/MmsPluginUtil.h b/plugin/mms_plugin/include/MmsPluginUtil.h
index 1e08034..7b9068c 100755
--- a/plugin/mms_plugin/include/MmsPluginUtil.h
+++ b/plugin/mms_plugin/include/MmsPluginUtil.h
@@ -19,14 +19,10 @@
#include <stdio.h>
-//File Util
-bool MmsMakeImageThumbnail(char *srcPath, char *dstPath);
-
-bool MmsMakeVideoThumbnail(char *srcPath, char *dstPath);
-
+/* File Util */
FILE *MmsFileOpen(char *pFileName);
-//Text Util
+/* Text Util */
bool MmsIsAsciiString(const char *szSrc);
bool MmsIsUtf8String(const unsigned char *szSrc, int nChar);
@@ -39,4 +35,4 @@ bool MmsReplaceSpaceChar(char *pszText);
char *MmsReplaceNonAsciiUtf8(const char *szSrc, char replaceChar);
-#endif //MMS_PLUGIN_UTIL_H
+#endif /* MMS_PLUGIN_UTIL_H */
diff --git a/plugin/sms_cdma_plugin/CMakeLists.txt b/plugin/sms_cdma_plugin/CMakeLists.txt
index bac61c7..35a7fbe 100755
--- a/plugin/sms_cdma_plugin/CMakeLists.txt
+++ b/plugin/sms_cdma_plugin/CMakeLists.txt
@@ -36,7 +36,7 @@ INCLUDE_DIRECTORIES(
)
INCLUDE(FindPkgConfig)
-pkg_check_modules(sms_plugin_pkgs REQUIRED db-util glib-2.0 tapi libxml-2.0 libwbxml2 dlog vconf gio-2.0)
+pkg_check_modules(sms_plugin_pkgs REQUIRED glib-2.0 tapi libxml-2.0 libwbxml2 dlog vconf gio-2.0)
FOREACH(flag ${sms_plugin_pkgs_CFLAGS})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
diff --git a/plugin/sms_cdma_plugin/SmsCdmaPluginCallback.cpp b/plugin/sms_cdma_plugin/SmsCdmaPluginCallback.cpp
index 5a5cc48..d374c7c 100755
--- a/plugin/sms_cdma_plugin/SmsCdmaPluginCallback.cpp
+++ b/plugin/sms_cdma_plugin/SmsCdmaPluginCallback.cpp
@@ -79,14 +79,13 @@ void SmsPluginCallback::registerEvent()
MSG_DEBUG("tel_register_noti_event is failed : [%s]", TAPI_NOTI_SIM_REFRESHED);
MsgSettingRegVconfCBCommon(VCONFKEY_DNET_STATE, _dnet_state_changed_cb);
-// MsgSettingRegVconfCBCommon(VCONFKEY_TELEPHONY_MDN, _TapiMdnChangedCb);
+ /* MsgSettingRegVconfCBCommon(VCONFKEY_TELEPHONY_MDN, _TapiMdnChangedCb); */
}
void SmsPluginCallback::deRegisterEvent()
{
-
}
@@ -94,18 +93,15 @@ void TapiEventDeviceReady(TapiHandle *handle, const char *noti_id, void *data, v
{
MSG_DEBUG("TapiEventDeviceReady is called. : noti_id = [%d]", noti_id);
- try
- {
- // Call Event Handler
+ try {
+ /* Call Event Handler */
SmsPluginEventHandler::instance()->setDeviceStatus();
if (SmsPluginEventHandler::instance()->getNeedInitConfig() == true) {
SmsPluginEventHandler::instance()->setNeedInitConfig(false);
SmsPluginSetting::instance()->SimRefreshCb();
}
- }
- catch (MsgException& e)
- {
+ } catch (MsgException& e) {
MSG_FATAL("%s", e.what());
return;
}
@@ -142,7 +138,8 @@ void TapiEventMsgIncoming(TapiHandle *handle, const char *noti_id, void *data, v
sms_trans_msg_s sms_trans_msg;
memset(&sms_trans_msg, 0x00, sizeof(sms_trans_msg_s));
- if (pDataPackage->format == (TelSmsNetType_t)0x03) { // voice mail notification
+ if (pDataPackage->format == (TelSmsNetType_t)0x03) {
+ /* voice mail notification */
sms_trans_msg.data.p2p_msg.telesvc_msg.type = SMS_TYPE_DELIVER;
sms_trans_msg.data.p2p_msg.telesvc_id = SMS_TRANS_TELESVC_VMN_95;
@@ -164,21 +161,20 @@ void TapiEventMsgIncoming(TapiHandle *handle, const char *noti_id, void *data, v
} else {
bool bInvalid = SmsPluginMsgCodec::checkInvalidPDU(pDataPackage->szData, pDataPackage->MsgLength);
if (bInvalid == true) {
- // Decode Incoming Message
+ /* Decode Incoming Message */
SmsPluginMsgCodec::decodeMsg(pDataPackage->szData, pDataPackage->MsgLength, &sms_trans_msg);
if (sms_trans_msg.data.cb_msg.telesvc_msg.data.deliver.cmas_data.is_wrong_recode_type) {
MSG_WARN("Invalid CMAS Record Type");
return;
}
- }
- else {
+ } else {
MSG_WARN("Invalid PDU");
return;
}
}
- /// Print tpdu
+ /* Print tpdu */
if (sms_trans_msg.type == SMS_TRANS_P2P_MSG) {
MSG_DEBUG("############# SMS_TRANS_P2P_MSG Incoming decoded tpdu values ####################");
MSG_DEBUG("------------------------------ transport layer data -----------------------------");
@@ -217,8 +213,7 @@ void TapiEventMsgIncoming(TapiHandle *handle, const char *noti_id, void *data, v
MSG_DEBUG("deliver_msg->callback_number.number_type= [%d]", deliver_msg->callback_number.number_type);
MSG_DEBUG("deliver_msg->callback_number.szData= [%s]", deliver_msg->callback_number.szData);
MSG_DEBUG("#####################################################");
- }
- else if (sms_trans_msg.type == SMS_TRANS_BROADCAST_MSG) {
+ } else if (sms_trans_msg.type == SMS_TRANS_BROADCAST_MSG) {
MSG_DEBUG("############# SMS_TRANS_BROADCAST_MSG Incoming decoded tpdu values ####################");
MSG_DEBUG("------------------------------ transport layer data -----------------------------");
MSG_DEBUG("sms_trans_msg.data.cb_msg.svc_ctg = [%d]", sms_trans_msg.data.cb_msg.svc_ctg);
@@ -253,27 +248,26 @@ void TapiEventMsgIncoming(TapiHandle *handle, const char *noti_id, void *data, v
MSG_DEBUG("deliver_msg->callback_number.szData= [%s]", deliver_msg->callback_number.szData);
MSG_DEBUG("#####################################################");
} else if (sms_trans_msg.type == SMS_TRANS_ACK_MSG) {
- // DLOG
+ /* DLOG */
MSG_DEBUG("#####################################################");
}
- try
- {
+ try {
if (sms_trans_msg.type == SMS_TRANS_P2P_MSG) {
if (sms_trans_msg.data.p2p_msg.telesvc_id == SMS_TRANS_TELESVC_WAP) {
SmsPluginEventHandler::instance()->handleWapMsgIncoming(&(sms_trans_msg.data.p2p_msg));
- }
- else {
- SmsPluginEventHandler::instance()->handleMsgIncoming(&(sms_trans_msg.data.p2p_msg)); // Call Event Handler
+ } else {
+ /* Call Event Handler */
+ SmsPluginEventHandler::instance()->handleMsgIncoming(&(sms_trans_msg.data.p2p_msg));
}
} else if (sms_trans_msg.type == SMS_TRANS_BROADCAST_MSG) {
- SmsPluginEventHandler::instance()->handleCbMsgIncoming(&(sms_trans_msg.data.cb_msg)); // Call Event Handler
+ /* Call Event Handler */
+ SmsPluginEventHandler::instance()->handleCbMsgIncoming(&(sms_trans_msg.data.cb_msg));
} else if (sms_trans_msg.type == SMS_TRANS_ACK_MSG) {
- //SmsPluginEventHandler::instance()->handleAckMsgIncoming(&(sms_trans_msg.data.ack_msg)); // Call Event Handler
+ /* Call Event Handler */
+ /* SmsPluginEventHandler::instance()->handleAckMsgIncoming(&(sms_trans_msg.data.ack_msg)); */
}
- }
- catch (MsgException& e)
- {
+ } catch (MsgException& e) {
MSG_FATAL("%s", e.what());
return;
}
@@ -293,9 +287,9 @@ void TapiEventNetworkStatusChange(TapiHandle *handle, const char *noti_id, void
MSG_DEBUG("network status type [%d]", *type);
- if(*type > TAPI_NETWORK_SERVICE_TYPE_SEARCH)
- {
- SmsPluginEventHandler::instance()->handleResendMessage(); // Call Event Handler
+ if (*type > TAPI_NETWORK_SERVICE_TYPE_SEARCH) {
+ /* Call Event Handler */
+ SmsPluginEventHandler::instance()->handleResendMessage();
}
}
@@ -311,8 +305,7 @@ void TapiEventSimRefreshed(TapiHandle *handle, const char *noti_id, void *data,
void TapiEventMemoryStatus(TapiHandle *handle, int result, void *data, void *user_data)
{
MSG_DEBUG("Tapi result is [%d]", result);
- if(result == TAPI_API_SUCCESS)
- {
+ if (result == TAPI_API_SUCCESS) {
isMemAvailable = true;
}
}
@@ -326,42 +319,41 @@ void TapiEventSentStatus(TapiHandle *handle, int result, void *data, void *user_
/* Convert TAPI status -> SMS network status */
switch ((TelSmsResponse_t)result) {
- case TAPI_NETTEXT_SENDSMS_SUCCESS :
- sentStatus = SMS_NETWORK_SEND_SUCCESS;
- break;
- case TAPI_NETTEXT_INVALID_MANDATORY_INFO :
- sentStatus = SMS_NETWORK_SEND_FAIL_MANDATORY_INFO_MISSING;
- break;
- case TAPI_NETTEXT_DESTINAITION_OUTOFSERVICE :
- case TAPI_NETTEXT_TEMPORARY_FAILURE :
- case TAPI_NETTEXT_CONGESTION :
- case TAPI_NETTEXT_RESOURCES_UNAVAILABLE :
- case TAPI_NETTEXT_MESSAGE_NOT_COMPAT_PROTOCOL :
- sentStatus = SMS_NETWORK_SEND_FAIL_TEMPORARY;
- break;
- case TAPI_NETTEXT_DEST_ADDRESS_FDN_RESTRICTED :
- case TAPI_NETTEXT_SCADDRESS_FDN_RESTRICTED :
- sentStatus = SMS_NETWORK_SEND_FAIL_FDN_RESTRICED;
- break;
- default :
- sentStatus = SMS_NETWORK_SEND_FAIL;
- break;
+ case TAPI_NETTEXT_SENDSMS_SUCCESS:
+ sentStatus = SMS_NETWORK_SEND_SUCCESS;
+ break;
+ case TAPI_NETTEXT_INVALID_MANDATORY_INFO:
+ sentStatus = SMS_NETWORK_SEND_FAIL_MANDATORY_INFO_MISSING;
+ break;
+ case TAPI_NETTEXT_DESTINAITION_OUTOFSERVICE:
+ case TAPI_NETTEXT_TEMPORARY_FAILURE:
+ case TAPI_NETTEXT_CONGESTION:
+ case TAPI_NETTEXT_RESOURCES_UNAVAILABLE:
+ case TAPI_NETTEXT_MESSAGE_NOT_COMPAT_PROTOCOL:
+ sentStatus = SMS_NETWORK_SEND_FAIL_TEMPORARY;
+ break;
+ case TAPI_NETTEXT_DEST_ADDRESS_FDN_RESTRICTED:
+ case TAPI_NETTEXT_SCADDRESS_FDN_RESTRICTED:
+ sentStatus = SMS_NETWORK_SEND_FAIL_FDN_RESTRICED;
+ break;
+ default:
+ sentStatus = SMS_NETWORK_SEND_FAIL;
+ break;
}
MSG_DEBUG("SMS Network Status = [%d]", sentStatus);
- if(sentStatus == SMS_NETWORK_SEND_FAIL_TEMPORARY ||
- sentStatus == SMS_NETWORK_SEND_FAIL_BY_MO_CONTROL_WITH_MOD ||
+ if (sentStatus == SMS_NETWORK_SEND_FAIL_TEMPORARY ||
+ sentStatus == SMS_NETWORK_SEND_FAIL_MANDATORY_INFO_MISSING ||
sentStatus == SMS_NETWORK_SEND_FAIL_FDN_RESTRICED) {
SmsPluginTransport::instance()->setNetStatus(sentStatus);
return;
}
- if(sentStatus == SMS_NETWORK_SEND_FAIL)
- {
+ if (sentStatus == SMS_NETWORK_SEND_FAIL) {
int svc_type;
tel_get_property_int(handle, TAPI_PROP_NETWORK_SERVICE_TYPE, &svc_type);
- if(svc_type < TAPI_NETWORK_SERVICE_TYPE_2G){
+ if (svc_type < TAPI_NETWORK_SERVICE_TYPE_2G){
sentStatus = SMS_NETWORK_SEND_PENDING;
}
}
@@ -385,14 +377,11 @@ void TapiEventSentStatus(TapiHandle *handle, int result, void *data, void *user_
netStatus = MSG_NETWORK_SEND_FAIL;
}
- try
- {
+ try {
SmsPluginEventHandler::instance()->handleSentStatus(netStatus);
SmsPluginTransport::instance()->setNetStatus(sentStatus);
- }
- catch (MsgException& e)
- {
+ } catch (MsgException& e) {
MSG_FATAL("%s", e.what());
return;
}
@@ -412,8 +401,7 @@ void TapiEventSetConfigData(TapiHandle *handle, int result, void *data, void *us
{
MSG_DEBUG("TapiEventSetConfigData is called.");
- if (data == NULL)
- {
+ if (data == NULL) {
MSG_DEBUG("Error. data is NULL.");
return;
}
@@ -422,30 +410,24 @@ void TapiEventSetConfigData(TapiHandle *handle, int result, void *data, void *us
MSG_DEBUG("responseType : [%d]", *responseType);
- switch (*responseType)
- {
- case TAPI_NETTEXT_SETPREFERREDBEARER_RSP :
- MSG_DEBUG("TAPI_NETTEXT_SETPREFERREDBEARER_RSP is called");
+ switch (*responseType) {
+ case TAPI_NETTEXT_SETPREFERREDBEARER_RSP:
+ MSG_DEBUG("TAPI_NETTEXT_SETPREFERREDBEARER_RSP is called");
break;
-
- case TAPI_NETTEXT_SETPARAMETERS_RSP :
- MSG_DEBUG("TAPI_NETTEXT_SETPARAMETERS_RSP is called");
+ case TAPI_NETTEXT_SETPARAMETERS_RSP:
+ MSG_DEBUG("TAPI_NETTEXT_SETPARAMETERS_RSP is called");
break;
-
- case TAPI_NETTEXT_CBSETCONFIG_RSP :
- MSG_DEBUG("TAPI_NETTEXT_CBSETCONFIG_RSP is called");
+ case TAPI_NETTEXT_CBSETCONFIG_RSP:
+ MSG_DEBUG("TAPI_NETTEXT_CBSETCONFIG_RSP is called");
break;
-
- case TAPI_NETTEXT_SETMEMORYSTATUS_RSP :
- MSG_DEBUG("TAPI_NETTEXT_SETMEMORYSTATUS_RSP is called");
+ case TAPI_NETTEXT_SETMEMORYSTATUS_RSP:
+ MSG_DEBUG("TAPI_NETTEXT_SETMEMORYSTATUS_RSP is called");
break;
-
- case TAPI_NETTEXT_SETMESSAGESTATUS_RSP :
- MSG_DEBUG("TAPI_NETTEXT_SETMESSAGESTATUS_RSP is called");
+ case TAPI_NETTEXT_SETMESSAGESTATUS_RSP:
+ MSG_DEBUG("TAPI_NETTEXT_SETMESSAGESTATUS_RSP is called");
break;
-
- default :
- MSG_DEBUG("Unknown Response is called [%d]", *responseType);
+ default:
+ MSG_DEBUG("Unknown Response is called [%d]", *responseType);
break;
}
@@ -466,8 +448,7 @@ void TapiEventGetCBConfig(TapiHandle *handle, int result, void *data, void *user
MSG_CBMSG_OPT_S cbOpt = {0};
- if (result != TAPI_API_SUCCESS || data == NULL)
- {
+ if (result != TAPI_API_SUCCESS || data == NULL) {
MSG_DEBUG("Error. data is NULL.");
SmsPluginSetting::instance()->setCbConfigEvent(NULL, false);
@@ -479,23 +460,21 @@ void TapiEventGetCBConfig(TapiHandle *handle, int result, void *data, void *user
cbOpt.bReceive = (bool)pCBConfig->CBEnabled;
-// cbOpt.maxSimCnt = pCBConfig->MsgIdMaxCount;
+ /* cbOpt.maxSimCnt = pCBConfig->MsgIdMaxCount; */
+ /* MSG_DEBUG("Receive [%d], Max SIM Count [%d]", cbOpt.bReceive, cbOpt.maxSimCnt); */
-// MSG_DEBUG("Receive [%d], Max SIM Count [%d]", cbOpt.bReceive, cbOpt.maxSimCnt);
MSG_DEBUG("Receive [%d]", cbOpt.bReceive);
cbOpt.channelData.channelCnt = pCBConfig->MsgIdRangeCount;
- if (cbOpt.channelData.channelCnt > CB_CHANNEL_MAX)
- {
+ if (cbOpt.channelData.channelCnt > CB_CHANNEL_MAX) {
MSG_DEBUG("Channel Count [%d] from TAPI is over MAX", cbOpt.channelData.channelCnt);
cbOpt.channelData.channelCnt = CB_CHANNEL_MAX;
}
MSG_DEBUG("Channel Count [%d]", cbOpt.channelData.channelCnt);
- for (int i = 0; i < cbOpt.channelData.channelCnt; i++)
- {
+ for (int i = 0; i < cbOpt.channelData.channelCnt; i++) {
cbOpt.channelData.channelInfo[i].bActivate = pCBConfig->MsgIDs[i].Net3gpp2.Selected;
cbOpt.channelData.channelInfo[i].ctg = pCBConfig->MsgIDs[i].Net3gpp2.CBCategory;
cbOpt.channelData.channelInfo[i].lang = pCBConfig->MsgIDs[i].Net3gpp2.CBLanguage;
@@ -507,6 +486,7 @@ void TapiEventGetCBConfig(TapiHandle *handle, int result, void *data, void *user
SmsPluginSetting::instance()->setCbConfigEvent(&cbOpt, true);
}
+
void TapiEventGetMsisdnInfo(TapiHandle *handle, int result, void *data, void *user_data)
{
MSG_DEBUG("TapiEventGetMsisdnInfo is called.");
@@ -542,15 +522,18 @@ void TapiEventGetMsisdnInfo(TapiHandle *handle, int result, void *data, void *us
SmsPluginSetting::instance()->setResultFromSim(bRet);
}
+
void _dnet_state_changed_cb(keynode_t *key, void* data)
{
int dnet_state = MsgSettingGetInt(VCONFKEY_DNET_STATE);
if (dnet_state > VCONFKEY_DNET_OFF) {
- SmsPluginEventHandler::instance()->handleResendMessage(); // Call Event Handler
+ /* Call Event Handler */
+ SmsPluginEventHandler::instance()->handleResendMessage();
}
}
+
void _TapiMdnChangedCb(keynode_t *key, void *data)
{
MSG_INFO("_TapiMdnChangedCb is called.");
@@ -562,11 +545,13 @@ void _TapiMdnChangedCb(keynode_t *key, void *data)
MSG_INFO("bNeedToUpdateVoicemail:%d, mdn:[%s]", bNeedToUpdateVoicemail, mdn);
if (bNeedToUpdateVoicemail) {
- if (MsgSettingSetString(VOICEMAIL_NUMBER, mdn) != MSG_SUCCESS)
- MSG_DEBUG("MsgSettingSetInt is failed!!");
+ char keyName[MAX_VCONFKEY_NAME_LEN];
+ int sim_idx = 1;
- if (MsgSettingSetString(VOICEMAIL_DEFAULT_NUMBER, mdn) != MSG_SUCCESS)
- MSG_DEBUG("Error to set config data [%s]", VOICEMAIL_DEFAULT_NUMBER);
+ memset(keyName, 0x00, sizeof(keyName));
+ snprintf(keyName, sizeof(keyName), "%s/%d", VOICEMAIL_NUMBER, sim_idx);
+ if (MsgSettingSetString(keyName, mdn) != MSG_SUCCESS)
+ MSG_DEBUG("Error to set config data [%s]", keyName);
}
free(mdn);
diff --git a/plugin/sms_cdma_plugin/SmsCdmaPluginCodec.cpp b/plugin/sms_cdma_plugin/SmsCdmaPluginCodec.cpp
index 8ed6c16..b5fe7a7 100755
--- a/plugin/sms_cdma_plugin/SmsCdmaPluginCodec.cpp
+++ b/plugin/sms_cdma_plugin/SmsCdmaPluginCodec.cpp
@@ -24,9 +24,9 @@
#include "SmsCdmaPluginCodec.h"
-
SmsPluginMsgCodec* SmsPluginMsgCodec::pInstance = NULL;
+
SmsPluginMsgCodec::SmsPluginMsgCodec()
{
@@ -96,28 +96,27 @@ int UnpackGSM7bitData(unsigned char *src, unsigned char *dest, unsigned int data
MSG_DEBUG("dataLen = %d", dataLen);
- for (; dstIdx < dataLen; dstIdx++)
- {
- if (shift == 0)
- {
+ for (; dstIdx < dataLen; dstIdx++) {
+ if (shift == 0) {
dest[dstIdx] = src[srcIdx] & 0x7F;
shift = 7;
srcIdx++;
dstIdx++;
- if (dstIdx >= dataLen) break;
+ if (dstIdx >= dataLen)
+ break;
}
- if (shift > 0)
- {
+ if (shift > 0) {
dest[dstIdx] = (src[srcIdx-1] >> shift) + (src[srcIdx] << (8 - shift));
dest[dstIdx] &= 0x7F;
shift--;
- if (shift > 0) srcIdx++;
+ if (shift > 0)
+ srcIdx++;
}
}
@@ -132,30 +131,26 @@ int PackGSM7bitData(const unsigned char *pUserData, unsigned char *pPackData, in
if (shift > 0)
dstIdx = 1;
- while (srcIdx < dataLen)
- {
- if (shift == 0)
- {
+ while (srcIdx < dataLen) {
+ if (shift == 0) {
pPackData[dstIdx] = pUserData[srcIdx];
shift = 7;
srcIdx++;
dstIdx++;
- if (srcIdx >= dataLen) break;
+ if (srcIdx >= dataLen)
+ break;
}
- if (shift > 1)
- {
+ if (shift > 1) {
pPackData[dstIdx-1] |= pUserData[srcIdx] << shift;
pPackData[dstIdx] = pUserData[srcIdx] >> (8-shift);
shift--;
srcIdx++;
dstIdx++;
- }
- else if (shift == 1)
- {
+ } else if (shift == 1) {
pPackData[dstIdx-1] |= pUserData[srcIdx] << shift;
srcIdx++;
@@ -182,15 +177,15 @@ bool SmsPluginMsgCodec::checkInvalidPDU(const unsigned char *p_pkg_str, const in
while (offset < p_pkg_len) {
switch (p_pkg_str[offset]) {
- case 0x00 :
- case 0x01 :
- case 0x02 :
- case 0x03 :
- case 0x04 :
- case 0x05 :
- case 0x06 :
- case 0x07 :
- case 0x08 :
+ case 0x00:
+ case 0x01:
+ case 0x02:
+ case 0x03:
+ case 0x04:
+ case 0x05:
+ case 0x06:
+ case 0x07:
+ case 0x08:
offset += (p_pkg_str[offset+1]+2);
break;
default:
@@ -213,18 +208,18 @@ int SmsPluginMsgCodec::encodeMsg(const sms_trans_msg_s *p_msg, unsigned char *p_
int encode_size = 0;
- switch(p_msg->type) {
- case SMS_TRANS_P2P_MSG:
- encode_size = encodeP2PMsg(&(p_msg->data.p2p_msg), p_pkg_str);
- break;
- case SMS_TRANS_BROADCAST_MSG:
- encode_size = encodeCBMsg(&(p_msg->data.cb_msg), p_pkg_str);
- break;
- case SMS_TRANS_ACK_MSG :
- encode_size = encodeAckMsg(&(p_msg->data.ack_msg), p_pkg_str);
- break;
- default :
- break;
+ switch (p_msg->type) {
+ case SMS_TRANS_P2P_MSG:
+ encode_size = encodeP2PMsg(&(p_msg->data.p2p_msg), p_pkg_str);
+ break;
+ case SMS_TRANS_BROADCAST_MSG:
+ encode_size = encodeCBMsg(&(p_msg->data.cb_msg), p_pkg_str);
+ break;
+ case SMS_TRANS_ACK_MSG:
+ encode_size = encodeAckMsg(&(p_msg->data.ack_msg), p_pkg_str);
+ break;
+ default:
+ break;
}
@@ -244,29 +239,32 @@ int SmsPluginMsgCodec::encodeP2PMsg(const sms_trans_p2p_msg_s *p_msg, unsigned c
p_pkg_str[offset++] = SMS_TRANS_P2P_MSG;
- // 1. teleservice id
+ /* 1. teleservice id */
p_pkg_str[offset++] = SMS_TRANS_PARAM_TELESVC_IDENTIFIER;
- p_pkg_str[offset++] = 2; // fixed
- //memcpy(p_pkg_str+offset, &(p_msg->telesvc_id), sizeof(sms_trans_telesvc_id_t));
+ p_pkg_str[offset++] = 2;
+ /* fixed */
+ /* memcpy(p_pkg_str+offset, &(p_msg->telesvc_id), sizeof(sms_trans_telesvc_id_t)); */
_copy_short_to_char(p_pkg_str+offset, &(p_msg->telesvc_id));
offset += sizeof(sms_trans_telesvc_id_t);
- // 2. Service category
- if(p_msg->svc_ctg < SMS_TRANS_SVC_CTG_UNDEFINED) {
+ /* 2. Service category */
+ if (p_msg->svc_ctg < SMS_TRANS_SVC_CTG_UNDEFINED) {
p_pkg_str[offset++] = SMS_TRANS_PARAM_SERVICE_CATEGORY;
- p_pkg_str[offset++] = 0x02; // fixed
+ p_pkg_str[offset++] = 0x02;
+ /* fixed */
_copy_short_to_char(&p_pkg_str[offset],&(p_msg->svc_ctg));
}
- // 3. Address
+ /* 3. Address */
p_pkg_str[offset++] = SMS_TRANS_PARAM_DEST_ADDRESS;
- len_index = offset++; // Will be set to param length
+ /* Will be set to param length */
+ len_index = offset++;
p_pkg_str[offset] = p_msg->address.digit_mode ? 0x80 : 0x00;
p_pkg_str[offset] |= (p_msg->address.number_mode ? 0x40 : 0x00);
- if(p_msg->address.digit_mode == false) {
+ if (p_msg->address.digit_mode == false) {
index = offset++;
p_pkg_str[offset++] = p_msg->address.addr_len;
@@ -279,11 +277,10 @@ int SmsPluginMsgCodec::encodeP2PMsg(const sms_trans_p2p_msg_s *p_msg, unsigned c
offset += addr_len;
_shiftNBit(&p_pkg_str[index], offset-index+1, 6);
- }
- else if(p_msg->address.digit_mode == true) {
+ } else if (p_msg->address.digit_mode == true) {
p_pkg_str[offset] |= p_msg->address.number_type << 3;
- if(p_msg->address.number_mode == false) {
+ if (p_msg->address.number_mode == false) {
p_pkg_str[offset++] |= p_msg->address.number_plan >> 1;
p_pkg_str[offset++] |= p_msg->address.number_plan << 7;
index = offset-1;
@@ -294,8 +291,7 @@ int SmsPluginMsgCodec::encodeP2PMsg(const sms_trans_p2p_msg_s *p_msg, unsigned c
offset += p_msg->address.addr_len;
_shiftNBit(&p_pkg_str[index], offset-index+1, 7);
- }
- else if(p_msg->address.number_mode == true) {
+ } else if (p_msg->address.number_mode == true) {
index = offset++;
p_pkg_str[offset++] = p_msg->address.addr_len;
memcpy(p_pkg_str+offset, p_msg->address.szData, p_msg->address.addr_len);
@@ -309,8 +305,8 @@ int SmsPluginMsgCodec::encodeP2PMsg(const sms_trans_p2p_msg_s *p_msg, unsigned c
p_pkg_str[len_index] = offset - len_index - 1 ;
MSG_DEBUG("Address subparam length field = [%d]", p_pkg_str[len_index]);
- // 4. Sub address (optional)
- if(p_msg->sub_address.addr_len > 0) {
+ /* 4. Sub address (optional) */
+ if (p_msg->sub_address.addr_len > 0) {
p_pkg_str[offset++] = SMS_TRANS_PARAM_ORG_SUB_ADDRESS;
p_pkg_str[offset] = p_msg->sub_address.addr_len + 2;
index = offset++;
@@ -319,27 +315,29 @@ int SmsPluginMsgCodec::encodeP2PMsg(const sms_trans_p2p_msg_s *p_msg, unsigned c
p_pkg_str[offset++] = p_msg->sub_address.addr_len;
memcpy(p_pkg_str+offset, p_msg->sub_address.szData, p_msg->sub_address.addr_len);
- offset+=p_msg->sub_address.addr_len;
+ offset += p_msg->sub_address.addr_len;
_shiftNBit(&p_pkg_str[index], offset-index+1, 4);
}
- // 5. Bearer reply option (optional)
- if(p_msg->reply_seq > 0) {
+ /* 5. Bearer reply option (optional) */
+ if (p_msg->reply_seq > 0) {
p_pkg_str[offset++] = SMS_TRANS_PARAM_BEARER_REPLY_OPTION;
p_pkg_str[offset++] = 1;
p_pkg_str[offset++] = (unsigned char)(p_msg->reply_seq << 2);
MSG_DEBUG("Reply sequnce number = [%d]", p_msg->reply_seq);
}
- // 6. Bearer data
+ /* 6. Bearer data */
p_pkg_str[offset++] = SMS_TRANS_PARAM_BEARER_DATA;
- index = offset++; // PARAMETER_LEN field should be filled at the last part.
+ /* PARAMETER_LEN field should be filled at the last part. */
+ index = offset++;
unsigned char *encode_data = &p_pkg_str[offset];
encode_size = encodeTelesvcMsg(&(p_msg->telesvc_msg), encode_data);
- p_pkg_str[index] = encode_size; // PARAMETER_LEN
+ /* PARAMETER_LEN */
+ p_pkg_str[index] = encode_size;
offset += encode_size;
@@ -356,21 +354,23 @@ int SmsPluginMsgCodec::encodeCBMsg(const sms_trans_broadcast_msg_s *p_msg, unsig
int offset = 0, encode_size = 0;
int len_index = 0;
- // 1. Service Category(Mandatory)
+ /* 1. Service Category(Mandatory) */
p_pkg_str[offset++] = SMS_TRANS_PARAM_SERVICE_CATEGORY;
p_pkg_str[offset++] = 0x02;
_copy_short_to_char(&p_pkg_str[offset],&p_msg->svc_ctg);
- // 2. Bearer Data(Optional)
- // TODO: give condition
+ /* 2. Bearer Data(Optional) */
+ /* TODO: give condition */
p_pkg_str[offset++] = SMS_TRANS_PARAM_BEARER_DATA;
- len_index = offset++; // PARAMETER_LEN field should be filled at the last part.
+ /* PARAMETER_LEN field should be filled at the last part. */
+ len_index = offset++;
unsigned char *encode_data = &p_pkg_str[offset];
encode_size = encodeTelesvcMsg(&(p_msg->telesvc_msg), encode_data);
- p_pkg_str[len_index] = encode_size; // PARAMETER_LEN
+ /* PARAMETER_LEN */
+ p_pkg_str[len_index] = encode_size;
offset += encode_size;
@@ -388,17 +388,18 @@ int SmsPluginMsgCodec::encodeAckMsg(const sms_trans_ack_msg_s *p_msg, unsigned c
int addr_len = 0, len_index = 0;
int index = 0;
- // 1. Address
+ /* 1. Address */
p_pkg_str[offset++] = SMS_TRANS_PARAM_DEST_ADDRESS;
- len_index = offset++; // Will be set to param length
+ /* Will be set to param length */
+ len_index = offset++;
p_pkg_str[offset] = p_msg->address.digit_mode ? 0x80 : 0x00;
p_pkg_str[offset] |= (p_msg->address.number_mode ? 0x40 : 0x00);
index = offset++;
- if(p_msg->address.digit_mode == false) {
+ if (p_msg->address.digit_mode == false) {
p_pkg_str[offset++] = p_msg->address.addr_len;
addr_len = SmsPluginParamCodec::instance()->convertDigitToDTMF(p_msg->address.szData, p_msg->address.addr_len, 0, p_pkg_str+offset);
@@ -410,11 +411,10 @@ int SmsPluginMsgCodec::encodeAckMsg(const sms_trans_ack_msg_s *p_msg, unsigned c
offset += addr_len;
_shiftNBit(&p_pkg_str[index], offset-index+1, 6);
- }
- else if(p_msg->address.digit_mode == true) {
+ } else if (p_msg->address.digit_mode == true) {
p_pkg_str[offset] |= p_msg->address.number_type << 3;
- if(p_msg->address.number_mode == false) {
+ if (p_msg->address.number_mode == false) {
p_pkg_str[offset++] |= p_msg->address.number_plan >> 1;
p_pkg_str[offset++] |= p_msg->address.number_plan << 7;
index++;
@@ -425,8 +425,7 @@ int SmsPluginMsgCodec::encodeAckMsg(const sms_trans_ack_msg_s *p_msg, unsigned c
offset += p_msg->address.addr_len;
_shiftNBit(&p_pkg_str[index], offset-index+1, 7);
- }
- else if(p_msg->address.number_mode == true) {
+ } else if (p_msg->address.number_mode == true) {
p_pkg_str[++offset] = p_msg->address.addr_len;
offset++;
memcpy(p_pkg_str+offset, p_msg->address.szData, p_msg->address.addr_len);
@@ -440,8 +439,8 @@ int SmsPluginMsgCodec::encodeAckMsg(const sms_trans_ack_msg_s *p_msg, unsigned c
p_pkg_str[len_index] = offset - len_index - 1 ;
MSG_DEBUG("Address subparam length field = [%d]", p_pkg_str[len_index]);
- // 2. Sub address
- if(p_msg->sub_address.addr_len > 0) {
+ /* 2. Sub address */
+ if (p_msg->sub_address.addr_len > 0) {
p_pkg_str[offset++] = SMS_TRANS_PARAM_ORG_SUB_ADDRESS;
p_pkg_str[offset] = p_msg->sub_address.addr_len + 2;
index = offset++;
@@ -450,12 +449,12 @@ int SmsPluginMsgCodec::encodeAckMsg(const sms_trans_ack_msg_s *p_msg, unsigned c
p_pkg_str[offset++] = p_msg->sub_address.addr_len;
memcpy(p_pkg_str+offset, p_msg->sub_address.szData, p_msg->sub_address.addr_len);
- offset+=p_msg->sub_address.addr_len;
+ offset += p_msg->sub_address.addr_len;
_shiftNBit(&p_pkg_str[index], offset-index+1, 4);
}
- // 3. Cause code
+ /* 3. Cause code */
p_pkg_str[offset++] = SMS_TRANS_PARAM_CAUSE_CODES;
index = offset++;
p_pkg_str[offset] |= p_msg->cause_code.reply_seq << 2;
@@ -471,6 +470,7 @@ int SmsPluginMsgCodec::encodeAckMsg(const sms_trans_ack_msg_s *p_msg, unsigned c
}
+
int SmsPluginMsgCodec::encodeTelesvcMsg(const sms_telesvc_msg_s *p_msg, unsigned char *p_pkg_str)
{
MSG_BEGIN();
@@ -478,38 +478,42 @@ int SmsPluginMsgCodec::encodeTelesvcMsg(const sms_telesvc_msg_s *p_msg, unsigned
MSG_DEBUG("Teleservice msg type = [%d]", p_msg->type);
- switch(p_msg->type) {
-// case SMS_TYPE_DELIVER :
-// encode_size = encodeTelesvcDeliverMsg(&(p_msg->data.delever), p_pkg_str);
-// break;
- case SMS_TYPE_SUBMIT :
- encode_size = encodeTelesvcSubmitMsg(&(p_msg->data.submit), p_pkg_str);
- break;
- case SMS_TYPE_CANCEL :
- encode_size = encodeTelesvcCancelMsg(&(p_msg->data.cancel), p_pkg_str);
- break;
- case SMS_TYPE_USER_ACK :
- encode_size = encodeTelesvcUserAckMsg(&(p_msg->data.user_ack), p_pkg_str);
- break;
- case SMS_TYPE_READ_ACK :
- encode_size = encodeTelesvcReadAckMsg(&(p_msg->data.read_ack), p_pkg_str);
- break;
- case SMS_TYPE_DELIVER_REPORT :
- encode_size = encodeTelesvcDeliverReportMsg(&(p_msg->data.report), p_pkg_str);
- break;
- default :
- MSG_DEBUG("No matching type for [%d]", p_msg->type);
- break;
+ switch (p_msg->type) {
+ /* case SMS_TYPE_DELIVER:
+ encode_size = encodeTelesvcDeliverMsg(&(p_msg->data.delever), p_pkg_str);
+ break; */
+ case SMS_TYPE_SUBMIT:
+ encode_size = encodeTelesvcSubmitMsg(&(p_msg->data.submit), p_pkg_str);
+ break;
+ case SMS_TYPE_CANCEL:
+ encode_size = encodeTelesvcCancelMsg(&(p_msg->data.cancel), p_pkg_str);
+ break;
+ case SMS_TYPE_USER_ACK:
+ encode_size = encodeTelesvcUserAckMsg(&(p_msg->data.user_ack), p_pkg_str);
+ break;
+ case SMS_TYPE_READ_ACK:
+ encode_size = encodeTelesvcReadAckMsg(&(p_msg->data.read_ack), p_pkg_str);
+ break;
+ case SMS_TYPE_DELIVER_REPORT:
+ encode_size = encodeTelesvcDeliverReportMsg(&(p_msg->data.report), p_pkg_str);
+ break;
+ default:
+ MSG_DEBUG("No matching type for [%d]", p_msg->type);
+ break;
}
MSG_END();
return encode_size;
}
-//int SmsPluginMsgCodec::encodeTelesvcDeliverMsg(const sms_telesvc_deliver_s *p_msg, char *p_pkg_str)
-//{
-//
-//}
+
+/*
+int SmsPluginMsgCodec::encodeTelesvcDeliverMsg(const sms_telesvc_deliver_s *p_msg, char *p_pkg_str)
+{
+
+}
+*/
+
int SmsPluginMsgCodec::encodeTelesvcReadAckMsg(const sms_telesvc_read_ack_s *p_msg, unsigned char *p_pkg_str)
{
@@ -517,7 +521,6 @@ int SmsPluginMsgCodec::encodeTelesvcReadAckMsg(const sms_telesvc_read_ack_s *p_m
int offset = 0;
-
MSG_END();
return offset;
@@ -543,29 +546,29 @@ int SmsPluginMsgCodec::encodeTelesvcDeliverReportMsg(const sms_telesvc_report_s
int offset = 0, len_index = 0, encode_size = 0;
bool delReservedBit = false;
- // 1. Message Identifier (Mandatory)
+ /* 1. Message Identifier (Mandatory) */
p_pkg_str[offset++] = SMS_BEARER_MESSAGE_IDENTIFIER;
p_pkg_str[offset++] = 3;
_copy_short_to_char(p_pkg_str+offset+1, &(p_msg->msg_id.msg_id));
_shiftNBit(&p_pkg_str[offset], 3, 4);
p_pkg_str[offset] |= SMS_TYPE_SUBMIT << 4;
- offset+=2;
+ offset += 2;
p_pkg_str[offset++] |= (p_msg->msg_id.header_ind ? 0x08 : 0x00);
- // 2. TP-Failure Cause (Conditional)
- if(p_msg->tp_fail_cause >= 0x8000) {
+ /* 2. TP-Failure Cause (Conditional) */
+ if (p_msg->tp_fail_cause >= 0x8000) {
p_pkg_str[offset++] = SMS_BEARER_TP_FAILURE_CAUSE;
p_pkg_str[offset++] = 1;
p_pkg_str[offset++] = p_msg->tp_fail_cause;
}
- // 3. User Data (Optional)
- if(p_msg->user_data.data_len > 0) {
+ /* 3. User Data (Optional) */
+ if (p_msg->user_data.data_len > 0) {
p_pkg_str[offset++] = SMS_BEARER_USER_DATA;
len_index = offset;
offset++;
- if(p_msg->user_data.encode_type == 0x01 || p_msg->user_data.encode_type == 0x0a)
+ if (p_msg->user_data.encode_type == 0x01 || p_msg->user_data.encode_type == 0x0a)
p_pkg_str[offset++] = p_msg->user_data.msg_type;
p_pkg_str[offset++] = p_msg->user_data.encode_type << 3;
@@ -574,7 +577,7 @@ int SmsPluginMsgCodec::encodeTelesvcDeliverReportMsg(const sms_telesvc_report_s
if (p_msg->user_data.encode_type == SMS_ENCODE_7BIT_ASCII || p_msg->user_data.encode_type == SMS_ENCODE_GSM7BIT) {
encode_size = encodeUserData(p_msg->user_data.user_data, &p_pkg_str[offset], p_msg->user_data.data_len);
offset += encode_size;
- if(p_msg->user_data.data_len % 8 > 4)
+ if (p_msg->user_data.data_len % 8 > 4)
delReservedBit = true;
} else {
memcpy(p_pkg_str+offset, p_msg->user_data.user_data, p_msg->user_data.data_len);
@@ -589,15 +592,16 @@ int SmsPluginMsgCodec::encodeTelesvcDeliverReportMsg(const sms_telesvc_report_s
}
- // 4. Language Indicator (Optional)
- // TODO : give condition
-// p_pkg_str[offset++] = SMS_BEARER_ALERT_ON_MSG_DELIVERY;
-// p_pkg_str[offset++] = 1;
-// p_pkg_str[offset++] = p_msg->language;
+ /* 4. Language Indicator (Optional) */
+ /* TODO : give condition */
+ /*
+ p_pkg_str[offset++] = SMS_BEARER_ALERT_ON_MSG_DELIVERY;
+ p_pkg_str[offset++] = 1;
+ p_pkg_str[offset++] = p_msg->language;
+ */
-
- // 5. Multiple Encoding User Data (Optional)
- // Omitted
+ /* 5. Multiple Encoding User Data (Optional) */
+ /* Omitted */
MSG_END();
@@ -611,13 +615,13 @@ int SmsPluginMsgCodec::encodeTelesvcCancelMsg(const sms_telesvc_cancel_s *p_msg,
int offset = 0;
- // 1. Message Identifier
+ /* 1. Message Identifier */
p_pkg_str[offset++] = SMS_BEARER_MESSAGE_IDENTIFIER;
p_pkg_str[offset++] = 3;
_copy_short_to_char(p_pkg_str+offset+1, &(p_msg->msg_id.msg_id));
_shiftNBit(&p_pkg_str[offset], 3, 4);
p_pkg_str[offset] |= SMS_TYPE_SUBMIT << 4;
- offset+=2;
+ offset += 2;
p_pkg_str[offset++] |= (p_msg->msg_id.header_ind ? 0x08 : 0x00);
MSG_END();
@@ -634,21 +638,21 @@ int SmsPluginMsgCodec::encodeTelesvcSubmitMsg(const sms_telesvc_submit_s *p_msg,
int encode_size = 0;
bool delReservedBit = false;
- // 1. Message Identifier
+ /* 1. Message Identifier */
p_pkg_str[offset++] = SMS_BEARER_MESSAGE_IDENTIFIER;
p_pkg_str[offset++] = 3;
_copy_short_to_char(p_pkg_str+offset+1, &(p_msg->msg_id.msg_id));
_shiftNBit(&p_pkg_str[offset], 3, 4);
p_pkg_str[offset] |= SMS_TYPE_SUBMIT << 4;
- offset+=2;
+ offset += 2;
p_pkg_str[offset++] |= (p_msg->msg_id.header_ind ? 0x08 : 0x00);
- // 2. User Data
- if(p_msg->user_data.data_len > 0) {
+ /* 2. User Data */
+ if (p_msg->user_data.data_len > 0) {
p_pkg_str[offset++] = SMS_BEARER_USER_DATA;
len_index = offset;
offset++;
- if(p_msg->user_data.encode_type == 0x01 || p_msg->user_data.encode_type == 0x0a)
+ if (p_msg->user_data.encode_type == 0x01 || p_msg->user_data.encode_type == 0x0a)
p_pkg_str[offset++] = p_msg->user_data.msg_type;
p_pkg_str[offset++] = p_msg->user_data.encode_type << 3;
@@ -657,12 +661,12 @@ int SmsPluginMsgCodec::encodeTelesvcSubmitMsg(const sms_telesvc_submit_s *p_msg,
if (p_msg->user_data.encode_type == SMS_ENCODE_7BIT_ASCII) {
encode_size = encodeUserData(p_msg->user_data.user_data, &p_pkg_str[offset], p_msg->user_data.data_len);
offset += encode_size;
- if(p_msg->user_data.data_len % 8 > 4)
+ if (p_msg->user_data.data_len % 8 > 4)
delReservedBit = true;
} else if (p_msg->user_data.encode_type == SMS_ENCODE_GSM7BIT) {
encode_size = PackGSM7bitData(p_msg->user_data.user_data, &p_pkg_str[offset], p_msg->user_data.data_len);
offset += encode_size;
- if(p_msg->user_data.data_len % 8 > 4)
+ if (p_msg->user_data.data_len % 8 > 4)
delReservedBit = true;
} else if (p_msg->user_data.encode_type == SMS_ENCODE_UNICODE) {
MsgTextConvert *textCvt = MsgTextConvert::instance();
@@ -681,8 +685,9 @@ int SmsPluginMsgCodec::encodeTelesvcSubmitMsg(const sms_telesvc_submit_s *p_msg,
p_pkg_str[len_index] = offset - len_index - 1;
}
-/* Sprint and Verizon issue
- // 3. Validity Period
+ /* Sprint and Verizon issue */
+ /* 3. Validity Period */
+ /*
if (p_msg->val_period.format == SMS_TIME_RELATIVE) {
p_pkg_str[offset++] = SMS_BEARER_VALIDITY_PERIOD_RELATIVE;
p_pkg_str[offset++] = 1;
@@ -698,8 +703,9 @@ int SmsPluginMsgCodec::encodeTelesvcSubmitMsg(const sms_telesvc_submit_s *p_msg,
p_pkg_str[offset++] = _convert_to_BCD(p_msg->val_period.time.abs_time.minutes);
p_pkg_str[offset++] = _convert_to_BCD(p_msg->val_period.time.abs_time.seconds);
}
-*/
- // 4. Deferred Delivery Time
+ */
+
+ /* 4. Deferred Delivery Time */
if (p_msg->defer_val_period.format == SMS_TIME_RELATIVE) {
p_pkg_str[offset++] = SMS_BEARER_DEFERRED_DELIVERY_TIME_RELATIVE;
p_pkg_str[offset++] = 1;
@@ -716,22 +722,24 @@ int SmsPluginMsgCodec::encodeTelesvcSubmitMsg(const sms_telesvc_submit_s *p_msg,
p_pkg_str[offset++] = _convert_to_BCD(p_msg->defer_val_period.time.abs_time.seconds);
}
- // 5. Priority Indicator
+ /* 5. Priority Indicator */
if (p_msg->priority >= SMS_PRIORITY_NORMAL && p_msg->priority <= SMS_PRIORITY_EMERGENCY) {
p_pkg_str[offset++] = SMS_BEARER_PRIORITY_INDICATOR;
p_pkg_str[offset++] = 1;
p_pkg_str[offset++] = p_msg->priority << 6;
}
-/* Sprint and Verizon issue
- // 6. Privacy Indicator
+ /* Sprint and Verizon issue */
+ /* 6. Privacy Indicator */
+ /*
if (p_msg->privacy >= SMS_PRIVACY_NOT_RESTRICTED && p_msg->privacy <= SMS_PRIVACY_SECRET) {
p_pkg_str[offset++] = SMS_BEARER_PRIVACY_INDICATOR;
p_pkg_str[offset++] = 1;
p_pkg_str[offset++] = p_msg->privacy << 6;
}
-*/
- // 7. Reply Option
+ */
+
+ /* 7. Reply Option */
if (p_msg->reply_opt.user_ack_req | p_msg->reply_opt.deliver_ack_req | p_msg->reply_opt.read_ack_req | p_msg->reply_opt.report_req) {
p_pkg_str[offset++] = SMS_BEARER_REPLY_OPTION;
p_pkg_str[offset++] = 1;
@@ -741,19 +749,23 @@ int SmsPluginMsgCodec::encodeTelesvcSubmitMsg(const sms_telesvc_submit_s *p_msg,
p_pkg_str[offset++] |= p_msg->reply_opt.report_req << 4;
}
- // 8. Alert on Message Delivery
- // TODO : give condition
-// p_pkg_str[offset++] = SMS_BEARER_ALERT_ON_MSG_DELIVERY;
-// p_pkg_str[offset++] = 1;
-// p_pkg_str[offset++] = p_msg->alert_priority << 6;
-
- // 9. Language Indicator
- // TODO : give condition
-// p_pkg_str[offset++] = SMS_BEARER_ALERT_ON_MSG_DELIVERY;
-// p_pkg_str[offset++] = 1;
-// p_pkg_str[offset++] = p_msg->language;
-
- // 10. Call-back Number
+ /* 8. Alert on Message Delivery */
+ /* TODO : give condition */
+ /*
+ p_pkg_str[offset++] = SMS_BEARER_ALERT_ON_MSG_DELIVERY;
+ p_pkg_str[offset++] = 1;
+ p_pkg_str[offset++] = p_msg->alert_priority << 6;
+ */
+
+ /* 9. Language Indicator */
+ /* TODO : give condition */
+ /*
+ p_pkg_str[offset++] = SMS_BEARER_ALERT_ON_MSG_DELIVERY;
+ p_pkg_str[offset++] = 1;
+ p_pkg_str[offset++] = p_msg->language;
+ */
+
+ /* 10. Call-back Number */
if (p_msg->callback_number.addr_len > 0) {
p_pkg_str[offset++] = SMS_BEARER_CALLBACK_NUMBER;
@@ -761,13 +773,12 @@ int SmsPluginMsgCodec::encodeTelesvcSubmitMsg(const sms_telesvc_submit_s *p_msg,
p_pkg_str[offset] |= p_msg->callback_number.digit_mode << 7;
- if(p_msg->callback_number.digit_mode == false) {
+ if (p_msg->callback_number.digit_mode == false) {
p_pkg_str[offset++] |= (p_msg->callback_number.addr_len & 0xfe) >> 1;
p_pkg_str[offset] |= (p_msg->callback_number.addr_len & 0x01) << 7;
int addr_len = SmsPluginParamCodec::instance()->convertDigitToDTMF(p_msg->callback_number.szData, p_msg->callback_number.addr_len, 1, p_pkg_str+offset);
offset += addr_len;
- }
- else if(p_msg->callback_number.digit_mode == true) {
+ } else if (p_msg->callback_number.digit_mode == true) {
p_pkg_str[offset] |= p_msg->callback_number.number_type << 6;
p_pkg_str[offset++] |= p_msg->callback_number.number_plan;
p_pkg_str[offset++] = p_msg->callback_number.addr_len;
@@ -778,14 +789,14 @@ int SmsPluginMsgCodec::encodeTelesvcSubmitMsg(const sms_telesvc_submit_s *p_msg,
p_pkg_str[len_index] = offset- len_index - 1;
}
- // 11. Multiple Encoding User Data
- // Omitted
+ /* 11. Multiple Encoding User Data */
+ /* Omitted */
- // 12. Message Deposit Index
- // Omitted
+ /* 12. Message Deposit Index */
+ /* Omitted */
- // 13. Service Category Program Results
- // Omitted
+ /* 13. Service Category Program Results */
+ /* Omitted */
MSG_END();
return offset;
@@ -800,22 +811,22 @@ int SmsPluginMsgCodec::decodeMsg(const unsigned char *p_pkg_str, int pkg_len, sm
char mti = p_pkg_str[0] & 0xff;
- switch(mti) {
- case SMS_TRANS_P2P_MSG:
- p_msg->type = SMS_TRANS_P2P_MSG;
- decodelen = decodeP2PMsg(p_pkg_str+1, pkg_len-1, &(p_msg->data.p2p_msg));
- break;
- case SMS_TRANS_BROADCAST_MSG:
- p_msg->type = SMS_TRANS_BROADCAST_MSG;
- decodelen = decodeCBMsg(p_pkg_str+1, pkg_len-1, &(p_msg->data.cb_msg));
- break;
- case SMS_TRANS_ACK_MSG:
- p_msg->type = SMS_TRANS_ACK_MSG;
- decodelen = decodeAckMsg(p_pkg_str+1, pkg_len-1, &(p_msg->data.ack_msg));
- break;
- default:
- p_msg->type = SMS_TRANS_TYPE_RESERVED;
- break;
+ switch (mti) {
+ case SMS_TRANS_P2P_MSG:
+ p_msg->type = SMS_TRANS_P2P_MSG;
+ decodelen = decodeP2PMsg(p_pkg_str+1, pkg_len-1, &(p_msg->data.p2p_msg));
+ break;
+ case SMS_TRANS_BROADCAST_MSG:
+ p_msg->type = SMS_TRANS_BROADCAST_MSG;
+ decodelen = decodeCBMsg(p_pkg_str+1, pkg_len-1, &(p_msg->data.cb_msg));
+ break;
+ case SMS_TRANS_ACK_MSG:
+ p_msg->type = SMS_TRANS_ACK_MSG;
+ decodelen = decodeAckMsg(p_pkg_str+1, pkg_len-1, &(p_msg->data.ack_msg));
+ break;
+ default:
+ p_msg->type = SMS_TRANS_TYPE_RESERVED;
+ break;
}
MSG_END();
@@ -832,36 +843,36 @@ int SmsPluginMsgCodec::decodeP2PMsg(const unsigned char *p_pkg_str, int pkg_len,
while (offset < pkg_len) {
switch (p_pkg_str[offset]) {
- case 0x00: // Teleservice Identifier
+ case 0x00:
+ /* Teleservice Identifier */
offset += decodeTeleId(p_pkg_str+offset, pkg_len, &(p_p2p->telesvc_id));
break;
-
- case 0x01: // Service Category
+ case 0x01:
+ /* Service Category */
offset += decodeSvcCtg(p_pkg_str+offset, pkg_len, &(p_p2p->svc_ctg));
break;
-
case 0x02:
- case 0x04: // Address
+ case 0x04:
+ /* Address */
offset += decodeAddress(p_pkg_str+offset, pkg_len, &(p_p2p->address));
break;
-
case 0x03:
- case 0x05: // Subaddress
+ case 0x05:
+ /* Subaddress */
offset += decodeSubAddress(p_pkg_str+offset, pkg_len, &(p_p2p->sub_address));
break;
-
- case 0x06: // Bearer Reply Option
- offset+=2;
+ case 0x06:
+ /* Bearer Reply Option*/
+ offset += 2;
p_p2p->reply_seq = (sms_trans_reply_seq_t)(p_pkg_str[offset] >> 2);
offset++;
break;
-
- case 0x08: // Bearer Data
+ case 0x08:
+ /* Bearer Data */
tmp_len = p_pkg_str[++offset];
decodeP2PTelesvcMsg(p_pkg_str+offset+1, tmp_len, &p_p2p->telesvc_msg);
- offset+=(tmp_len+1);
+ offset += (tmp_len+1);
break;
-
default:
break;
}
@@ -879,20 +890,20 @@ int SmsPluginMsgCodec::decodeCBMsg(const unsigned char *p_pkg_str, int pkg_len,
int offset = 0, tmp_len = 0;
- while(offset < pkg_len) {
- if(p_pkg_str[offset] == 0x01) { // Service Category
+ while (offset < pkg_len) {
+ if (p_pkg_str[offset] == 0x01) {
+ /* Service Category */
offset += decodeTeleId(p_pkg_str+offset, pkg_len, &(p_cb->svc_ctg));
- }
- else if(p_pkg_str[offset] == 0x08) { // Bearer Data
+ } else if (p_pkg_str[offset] == 0x08) {
+ /* Bearer Data */
tmp_len = p_pkg_str[++offset];
- if(p_cb->svc_ctg >= SMS_TRANS_SVC_CTG_CMAS_PRESIDENTIAL && p_cb->svc_ctg <= SMS_TRANS_SVC_CTG_CMAS_TEST) {
+ if (p_cb->svc_ctg >= SMS_TRANS_SVC_CTG_CMAS_PRESIDENTIAL && p_cb->svc_ctg <= SMS_TRANS_SVC_CTG_CMAS_TEST) {
decodeCBBearerData(p_pkg_str+offset+1, tmp_len, &(p_cb->telesvc_msg), true);
- }
- else {
+ } else {
decodeCBBearerData(p_pkg_str+offset+1, tmp_len, &(p_cb->telesvc_msg), false);
}
- offset+=(tmp_len+1);
+ offset += (tmp_len+1);
}
}
@@ -909,16 +920,17 @@ int SmsPluginMsgCodec::decodeAckMsg(const unsigned char *p_pkg_str, int pkg_len,
int offset = 0;
while (offset < pkg_len) {
- if(p_pkg_str[offset] == 0x04) { // Destination Address
+ if (p_pkg_str[offset] == 0x04) {
+ /* Destination Address */
offset += decodeAddress(p_pkg_str+offset, pkg_len, &(p_ack->address));
- }
- else if(p_pkg_str[offset] == 0x05) { // Destination Subaddress
+ } else if (p_pkg_str[offset] == 0x05) {
+ /* Destination Subaddress */
offset += decodeSubAddress(p_pkg_str+offset, pkg_len, &(p_ack->sub_address));
- }
- else if(p_pkg_str[offset] == 0x07) { // Cause Codes
- offset+=2;
+ } else if (p_pkg_str[offset] == 0x07) {
+ /* Cause Codes */
+ offset += 2;
p_ack->cause_code.reply_seq = (sms_trans_reply_seq_t)p_pkg_str[offset] >> 2;
- switch(p_pkg_str[offset++] & 0x03) {
+ switch (p_pkg_str[offset++] & 0x03) {
case 0x00:
p_ack->cause_code.error_class = SMS_TRANS_ERR_CLASS_NONE;
break;
@@ -932,7 +944,7 @@ int SmsPluginMsgCodec::decodeAckMsg(const unsigned char *p_pkg_str, int pkg_len,
break;
}
- if(p_ack->cause_code.error_class != SMS_TRANS_ERR_CLASS_NONE) {
+ if (p_ack->cause_code.error_class != SMS_TRANS_ERR_CLASS_NONE) {
p_ack->cause_code.cause_code = (sms_trans_cause_code_t)p_pkg_str[offset++];
}
}
@@ -969,7 +981,7 @@ void SmsPluginMsgCodec::decodeP2PTelesvcMsg(const unsigned char *p_pkg_str, int
decodeP2PReadAckMsg(p_pkg_str, pkg_len, &p_telesvc->data.read_ack);
break;
case SMS_TYPE_SUBMIT_REPORT:
-// decodeP2PSubmitReportMsg(p_pkg_str, pkg_len, &p_telesvc->data.report);
+ /* decodeP2PSubmitReportMsg(p_pkg_str, pkg_len, &p_telesvc->data.report); */
break;
default:
break;
@@ -990,280 +1002,271 @@ void SmsPluginMsgCodec::decodeP2PDeliverMsg(const unsigned char *p_pkg_str, int
while (offset < pkg_len) {
MSG_DEBUG("current offset = [%d] [%x]", offset, p_pkg_str[offset]);
- switch (p_pkg_str[offset])
- {
- case 0x00: // Message Identifier
- offset += decodeMsgId(p_pkg_str+offset, 5, &(p_del->msg_id));
- break;
-
- case 0x01: // User Data
- offset += 2;
- tmp_len = p_pkg_str[offset-1];
- memset(tmp_str, 0x00, sizeof(tmp_str));
- memcpy(tmp_str, p_pkg_str+offset, tmp_len);
- decodeUserData(tmp_str, tmp_len, &(p_del->user_data));
- offset += tmp_len;
- break;
-
- case 0x03: // Message Center Time Stamp
- offset+=2;
- offset += decodeAbsTime(p_pkg_str+offset, &(p_del->time_stamp));
- break;
-
- case 0x04: // Validity Period - Absolute
- offset+=2;
- p_del->val_period.format = SMS_TIME_ABSOLUTE;
- offset += decodeAbsTime(p_pkg_str+offset, &(p_del->val_period.time.abs_time));
- break;
-
- case 0x05: // Validity Period - Relative
- offset+=2;
- p_del->val_period.format = SMS_TIME_RELATIVE;
- p_del->val_period.time.rel_time.rel_time = (sms_relative_time_t)p_pkg_str[offset++];
- break;
-
- case 0x08: // Priority Indicator
- offset+=2;
- p_del->priority = (sms_priority_indicator_t)((p_pkg_str[offset++] & 0xc0) >> 6);
- break;
-
- case 0x09: // Privacy Indicator
- offset+=2;
- p_del->privacy = (sms_privacy_indicator_t)((p_pkg_str[offset++] & 0xc0) >> 6);
- break;
-
- case 0x0a: // Reply Option
- offset+=2;
-
- if(p_pkg_str[offset] & 0x80)
- p_del->reply_opt.user_ack_req = true;
- else
- p_del->reply_opt.user_ack_req = false;
-
- if(p_pkg_str[offset] & 0x40)
- p_del->reply_opt.deliver_ack_req = true;
- else
- p_del->reply_opt.deliver_ack_req = false;
-
- if(p_pkg_str[offset] & 0x20)
- p_del->reply_opt.read_ack_req = true;
- else
- p_del->reply_opt.read_ack_req = false;
-
- if(p_pkg_str[offset] & 0x10)
- p_del->reply_opt.report_req = true;
- else
- p_del->reply_opt.report_req = false;
-
- offset++;
- break;
-
- case 0x0b: // Number of Message
- offset+=2;
- p_del->num_msg = (((p_pkg_str[offset] & 0xf0) >> 4) * 10) + (p_pkg_str[offset] & 0x0f);
- offset++;
- break;
-
- case 0x0c: // Alert on Message Delivery
- offset+=2;
- tmp_len = p_pkg_str[offset-1];
- if (tmp_len > 0)
- p_del->alert_priority = (sms_alert_priority_t)((p_pkg_str[offset] & 0xc0) >> 6);
- offset+=tmp_len;
- break;
-
- case 0x0d: // Language Indicator
- offset+=2;
- p_del->language = (sms_language_type_t)p_pkg_str[offset++];
- break;
-
- case 0x0e: // Call-Back Number
- offset+=2;
- tmp_len = p_pkg_str[offset-1];
-
- decodeCallBackNum(&p_pkg_str[offset], tmp_len, &(p_del->callback_number));
-
- offset+=tmp_len;
- break;
+ switch (p_pkg_str[offset]) {
+ case 0x00:
+ /* Message Identifier */
+ offset += decodeMsgId(p_pkg_str+offset, 5, &(p_del->msg_id));
+ break;
+ case 0x01:
+ /* User Data */
+ offset += 2;
+ tmp_len = p_pkg_str[offset-1];
+ memset(tmp_str, 0x00, sizeof(tmp_str));
+ memcpy(tmp_str, p_pkg_str+offset, tmp_len);
+ decodeUserData(tmp_str, tmp_len, &(p_del->user_data));
+ offset += tmp_len;
+ break;
+ case 0x03:
+ /* Message Center Time Stamp */
+ offset += 2;
+ offset += decodeAbsTime(p_pkg_str+offset, &(p_del->time_stamp));
+ break;
+ case 0x04:
+ /* Validity Period - Absolute */
+ offset += 2;
+ p_del->val_period.format = SMS_TIME_ABSOLUTE;
+ offset += decodeAbsTime(p_pkg_str+offset, &(p_del->val_period.time.abs_time));
+ break;
+ case 0x05:
+ /* Validity Period - Relative */
+ offset += 2;
+ p_del->val_period.format = SMS_TIME_RELATIVE;
+ p_del->val_period.time.rel_time.rel_time = (sms_relative_time_t)p_pkg_str[offset++];
+ break;
+ case 0x08:
+ /* Priority Indicator */
+ offset += 2;
+ p_del->priority = (sms_priority_indicator_t)((p_pkg_str[offset++] & 0xc0) >> 6);
+ break;
+ case 0x09:
+ /* Privacy Indicator */
+ offset += 2;
+ p_del->privacy = (sms_privacy_indicator_t)((p_pkg_str[offset++] & 0xc0) >> 6);
+ break;
+ case 0x0a:
+ /* Reply Option */
+ offset += 2;
- case 0x0f: // Message Display Mode
- offset+=2;
+ if (p_pkg_str[offset] & 0x80)
+ p_del->reply_opt.user_ack_req = true;
+ else
+ p_del->reply_opt.user_ack_req = false;
- p_del->display_mode = (sms_display_mode_t)((p_pkg_str[offset++] & 0xc0) >> 6);
- break;
+ if (p_pkg_str[offset] & 0x40)
+ p_del->reply_opt.deliver_ack_req = true;
+ else
+ p_del->reply_opt.deliver_ack_req = false;
- case 0x10: // Multiple Encoding User Data
- offset+=2;
- tmp_len = p_pkg_str[offset-1];
+ if (p_pkg_str[offset] & 0x20)
+ p_del->reply_opt.read_ack_req = true;
+ else
+ p_del->reply_opt.read_ack_req = false;
+ if (p_pkg_str[offset] & 0x10)
+ p_del->reply_opt.report_req = true;
+ else
+ p_del->reply_opt.report_req = false;
- // TODO
+ offset++;
+ break;
+ case 0x0b:
+ /* Number of Message */
+ offset += 2;
+ p_del->num_msg = (((p_pkg_str[offset] & 0xf0) >> 4) * 10) + (p_pkg_str[offset] & 0x0f);
+ offset++;
+ break;
+ case 0x0c:
+ /* Alert on Message Delivery */
+ offset += 2;
+ tmp_len = p_pkg_str[offset-1];
+ if (tmp_len > 0)
+ p_del->alert_priority = (sms_alert_priority_t)((p_pkg_str[offset] & 0xc0) >> 6);
+ offset += tmp_len;
+ break;
+ case 0x0d:
+ /* Language Indicator */
+ offset += 2;
+ p_del->language = (sms_language_type_t)p_pkg_str[offset++];
+ break;
+ case 0x0e:
+ /* Call-Back Number */
+ offset += 2;
+ tmp_len = p_pkg_str[offset-1];
+ decodeCallBackNum(&p_pkg_str[offset], tmp_len, &(p_del->callback_number));
+ offset += tmp_len;
+ break;
+ case 0x0f:
+ /* Message Display Mode */
+ offset += 2;
- offset+=tmp_len;
- break;
+ p_del->display_mode = (sms_display_mode_t)((p_pkg_str[offset++] & 0xc0) >> 6);
+ break;
+ case 0x10:
+ /* Multiple Encoding User Data */
+ offset += 2;
+ tmp_len = p_pkg_str[offset-1];
- case 0x11: // Message Deposit Index
- offset+=2;
+ /* TODO */
- memset(&tmp_param_s, 0x00, sizeof(unsigned short));
- _copy_char_to_short(&tmp_param_s, p_pkg_str+offset);
- p_del->deposit_id = tmp_param_s;
+ offset += tmp_len;
+ break;
+ case 0x11:
+ /* Message Deposit Index */
+ offset += 2;
- offset+=2;
- break;
+ memset(&tmp_param_s, 0x00, sizeof(unsigned short));
+ _copy_char_to_short(&tmp_param_s, p_pkg_str+offset);
+ p_del->deposit_id = tmp_param_s;
- case 0x16: // Enhanced VMN
- offset++;
- tmp_len = p_pkg_str[offset++];
- memset(tmp_str, 0x00, sizeof(tmp_str));
- memcpy(tmp_str, p_pkg_str+offset, tmp_len);
- tmp_off = 0;
+ offset += 2;
+ break;
+ case 0x16:
+ /* Enhanced VMN */
+ offset++;
+ tmp_len = p_pkg_str[offset++];
+ memset(tmp_str, 0x00, sizeof(tmp_str));
+ memcpy(tmp_str, p_pkg_str+offset, tmp_len);
+ tmp_off = 0;
- p_del->enhanced_vmn.priority = (sms_priority_indicator_t)(p_pkg_str[offset] >> 6);
- p_del->enhanced_vmn.password_req = p_pkg_str[offset] & 0x20 ? true : false;
- p_del->enhanced_vmn.setup_req = p_pkg_str[offset] & 0x10 ? true : false;
- p_del->enhanced_vmn.pw_change_req = p_pkg_str[offset] & 0x08 ? true : false;
- _shiftNBit_for_decode(tmp_str, tmp_len, 5);
+ p_del->enhanced_vmn.priority = (sms_priority_indicator_t)(p_pkg_str[offset] >> 6);
+ p_del->enhanced_vmn.password_req = p_pkg_str[offset] & 0x20 ? true : false;
+ p_del->enhanced_vmn.setup_req = p_pkg_str[offset] & 0x10 ? true : false;
+ p_del->enhanced_vmn.pw_change_req = p_pkg_str[offset] & 0x08 ? true : false;
+ _shiftNBit_for_decode(tmp_str, tmp_len, 5);
- if(p_del->enhanced_vmn.setup_req || p_del->enhanced_vmn.pw_change_req) {
- p_del->enhanced_vmn.min_pw_len = tmp_str[tmp_off] >> 4;
- p_del->enhanced_vmn.max_pw_len = tmp_str[tmp_off++] & 0x0f;
- }
+ if (p_del->enhanced_vmn.setup_req || p_del->enhanced_vmn.pw_change_req) {
+ p_del->enhanced_vmn.min_pw_len = tmp_str[tmp_off] >> 4;
+ p_del->enhanced_vmn.max_pw_len = tmp_str[tmp_off++] & 0x0f;
+ }
- p_del->enhanced_vmn.vm_num_unheard_msg = tmp_str[tmp_off++];
- p_del->enhanced_vmn.vm_mailbox_alm_full = tmp_str[tmp_off] & 0x80 ? true : false;
- p_del->enhanced_vmn.vm_mailbox_full = tmp_str[tmp_off] & 0x40 ? true : false;
- p_del->enhanced_vmn.reply_allowed = tmp_str[tmp_off] & 0x20 ? true : false;
- p_del->enhanced_vmn.fax_included = tmp_str[tmp_off] & 0x10 ? true : false;
- p_del->enhanced_vmn.vm_len = ((tmp_str[tmp_off] >> 0x0f) << 8) | tmp_str[tmp_off+1];
- tmp_off+=2;
- p_del->enhanced_vmn.vm_ret_day = tmp_str[tmp_off] >> 1;
- _shiftNBit_for_decode(tmp_str, tmp_len, 7);
- p_del->enhanced_vmn.vm_msg_id = (tmp_str[tmp_off] << 8) | tmp_str[tmp_off+1];
- tmp_off+=2;
- p_del->enhanced_vmn.vm_mailbox_id = (tmp_str[tmp_off] << 8) | tmp_str[tmp_off+1];
- tmp_off+=2;
-
- p_del->enhanced_vmn.an_digit_mode = (sms_digit_mode_t)(tmp_str[tmp_off] & 0x80 ? true : false);
- p_del->enhanced_vmn.an_number_type = (sms_number_type_t)((tmp_str[tmp_off] & 0x70) >> 4);
- if (p_del->enhanced_vmn.an_digit_mode) {
- p_del->enhanced_vmn.an_number_plan = (sms_number_plan_t)(tmp_str[tmp_off++] & 0x0f);
- p_del->enhanced_vmn.an_num_field = tmp_str[tmp_off++];
- for(int i=0; i<p_del->enhanced_vmn.an_num_field; i++) {
- switch(tmp_str[tmp_off] & 0xf0)
- {
- case 0x10:
- case 0x20:
- case 0x30:
- case 0x40:
- case 0x50:
- case 0x60:
- case 0x70:
- case 0x80:
- case 0x90:
- p_del->enhanced_vmn.an_char[i] = ((tmp_str[tmp_off] & 0xf0) >> 4) + '0';
- break;
- case 0xa0:
- p_del->enhanced_vmn.an_char[i] = '0';
- break;
- case 0xb0:
- p_del->enhanced_vmn.an_char[i] = '*';
- break;
- case 0xc0:
- p_del->enhanced_vmn.an_char[i] = '#';
- break;
- default:
- break;
- }
-
- _shiftNBit_for_decode(tmp_str, tmp_len, 4);
+ p_del->enhanced_vmn.vm_num_unheard_msg = tmp_str[tmp_off++];
+ p_del->enhanced_vmn.vm_mailbox_alm_full = tmp_str[tmp_off] & 0x80 ? true : false;
+ p_del->enhanced_vmn.vm_mailbox_full = tmp_str[tmp_off] & 0x40 ? true : false;
+ p_del->enhanced_vmn.reply_allowed = tmp_str[tmp_off] & 0x20 ? true : false;
+ p_del->enhanced_vmn.fax_included = tmp_str[tmp_off] & 0x10 ? true : false;
+ p_del->enhanced_vmn.vm_len = ((tmp_str[tmp_off] >> 0x0f) << 8) | tmp_str[tmp_off+1];
+ tmp_off += 2;
+ p_del->enhanced_vmn.vm_ret_day = tmp_str[tmp_off] >> 1;
+ _shiftNBit_for_decode(tmp_str, tmp_len, 7);
+ p_del->enhanced_vmn.vm_msg_id = (tmp_str[tmp_off] << 8) | tmp_str[tmp_off+1];
+ tmp_off += 2;
+ p_del->enhanced_vmn.vm_mailbox_id = (tmp_str[tmp_off] << 8) | tmp_str[tmp_off+1];
+ tmp_off += 2;
+
+ p_del->enhanced_vmn.an_digit_mode = (sms_digit_mode_t)(tmp_str[tmp_off] & 0x80 ? true : false);
+ p_del->enhanced_vmn.an_number_type = (sms_number_type_t)((tmp_str[tmp_off] & 0x70) >> 4);
+ if (p_del->enhanced_vmn.an_digit_mode) {
+ p_del->enhanced_vmn.an_number_plan = (sms_number_plan_t)(tmp_str[tmp_off++] & 0x0f);
+ p_del->enhanced_vmn.an_num_field = tmp_str[tmp_off++];
+ for (int i=0; i<p_del->enhanced_vmn.an_num_field; i++) {
+ switch (tmp_str[tmp_off] & 0xf0) {
+ case 0x10:
+ case 0x20:
+ case 0x30:
+ case 0x40:
+ case 0x50:
+ case 0x60:
+ case 0x70:
+ case 0x80:
+ case 0x90:
+ p_del->enhanced_vmn.an_char[i] = ((tmp_str[tmp_off] & 0xf0) >> 4) + '0';
+ break;
+ case 0xa0:
+ p_del->enhanced_vmn.an_char[i] = '0';
+ break;
+ case 0xb0:
+ p_del->enhanced_vmn.an_char[i] = '*';
+ break;
+ case 0xc0:
+ p_del->enhanced_vmn.an_char[i] = '#';
+ break;
+ default:
+ break;
}
- }
- else {
- _shiftNBit_for_decode(tmp_str, tmp_len, 4);
- p_del->enhanced_vmn.an_num_field = tmp_str[tmp_off++];
- memset(p_del->enhanced_vmn.an_char, 0x00, sizeof(p_del->enhanced_vmn.an_char));
- memcpy(p_del->enhanced_vmn.an_char, tmp_str+tmp_off, p_del->enhanced_vmn.an_num_field);
- tmp_off+=p_del->enhanced_vmn.an_num_field;
- }
- p_del->enhanced_vmn.cli_digit_mode = (sms_digit_mode_t)(tmp_str[offset] & 0x80 ? true : false);
- p_del->enhanced_vmn.cli_number_type = (sms_number_type_t)(tmp_str[offset] & 0x70 >> 4);
- if (p_del->enhanced_vmn.cli_digit_mode) {
- p_del->enhanced_vmn.cli_number_plan = (sms_number_plan_t)(tmp_str[tmp_off++] & 0x0f);
- p_del->enhanced_vmn.cli_num_field = tmp_str[tmp_off++];
- for(int i=0; i<p_del->enhanced_vmn.cli_num_field; i++) {
- switch(tmp_str[tmp_off] & 0xf0)
- {
- case 0x10:
- case 0x20:
- case 0x30:
- case 0x40:
- case 0x50:
- case 0x60:
- case 0x70:
- case 0x80:
- case 0x90:
- p_del->enhanced_vmn.cli_char[i] = ((tmp_str[tmp_off] & 0xf0) >> 4) + '0';
- break;
- case 0xa0:
- p_del->enhanced_vmn.cli_char[i] = '0';
- break;
- case 0xb0:
- p_del->enhanced_vmn.cli_char[i] = '*';
- break;
- case 0xc0:
- p_del->enhanced_vmn.cli_char[i] = '#';
- break;
- default:
- break;
- }
-
- _shiftNBit_for_decode(tmp_str, tmp_len, 4);
- }
- }
- else {
_shiftNBit_for_decode(tmp_str, tmp_len, 4);
- p_del->enhanced_vmn.cli_num_field = tmp_str[tmp_off++];
- memset(p_del->enhanced_vmn.cli_char, 0x00, sizeof(p_del->enhanced_vmn.cli_char));
- memcpy(p_del->enhanced_vmn.cli_char, tmp_str+tmp_off, p_del->enhanced_vmn.cli_num_field);
- tmp_off+=p_del->enhanced_vmn.cli_num_field;
}
+ } else {
+ _shiftNBit_for_decode(tmp_str, tmp_len, 4);
+ p_del->enhanced_vmn.an_num_field = tmp_str[tmp_off++];
+ memset(p_del->enhanced_vmn.an_char, 0x00, sizeof(p_del->enhanced_vmn.an_char));
+ memcpy(p_del->enhanced_vmn.an_char, tmp_str+tmp_off, p_del->enhanced_vmn.an_num_field);
+ tmp_off += p_del->enhanced_vmn.an_num_field;
+ }
- offset+=tmp_len;
- break;
+ p_del->enhanced_vmn.cli_digit_mode = (sms_digit_mode_t)(tmp_str[offset] & 0x80 ? true : false);
+ p_del->enhanced_vmn.cli_number_type = (sms_number_type_t)(tmp_str[offset] & 0x70 >> 4);
+ if (p_del->enhanced_vmn.cli_digit_mode) {
+ p_del->enhanced_vmn.cli_number_plan = (sms_number_plan_t)(tmp_str[tmp_off++] & 0x0f);
+ p_del->enhanced_vmn.cli_num_field = tmp_str[tmp_off++];
+ for (int i=0; i<p_del->enhanced_vmn.cli_num_field; i++) {
+ switch (tmp_str[tmp_off] & 0xf0) {
+ case 0x10:
+ case 0x20:
+ case 0x30:
+ case 0x40:
+ case 0x50:
+ case 0x60:
+ case 0x70:
+ case 0x80:
+ case 0x90:
+ p_del->enhanced_vmn.cli_char[i] = ((tmp_str[tmp_off] & 0xf0) >> 4) + '0';
+ break;
+ case 0xa0:
+ p_del->enhanced_vmn.cli_char[i] = '0';
+ break;
+ case 0xb0:
+ p_del->enhanced_vmn.cli_char[i] = '*';
+ break;
+ case 0xc0:
+ p_del->enhanced_vmn.cli_char[i] = '#';
+ break;
+ default:
+ break;
+ }
- case 0x17: // Enhanced VMN Ack
- offset++;
- tmp_len = p_pkg_str[offset++];
- memset(tmp_str, 0x00, sizeof(tmp_str));
- memcpy(tmp_str, p_pkg_str+offset, tmp_len);
- p_del->enhanced_vmn_ack.vm_mailbox_id = tmp_str[offset] << 8 | tmp_str[offset+1];
- offset+=2;
- p_del->enhanced_vmn_ack.vm_num_unheard_msg = tmp_str[offset++];
- p_del->enhanced_vmn_ack.num_delete_ack = tmp_str[offset] >> 5;
- p_del->enhanced_vmn_ack.num_play_ack = (tmp_str[offset] & 0x1c) >> 2;
- _shiftNBit_for_decode(tmp_str, tmp_len, 6);
- for(int i=0; i<p_del->enhanced_vmn_ack.num_delete_ack; i++) {
- p_del->enhanced_vmn_ack.da_vm_msg_id[i] = tmp_str[offset] << 8 | tmp_str[offset+1];
- offset+=2;
- }
- for(int i=0; i<p_del->enhanced_vmn_ack.num_play_ack; i++) {
- p_del->enhanced_vmn_ack.pa_vm_msg_id[i] = tmp_str[offset] << 8 | tmp_str[offset+1];
- offset+=2;
+ _shiftNBit_for_decode(tmp_str, tmp_len, 4);
}
- break;
+ } else {
+ _shiftNBit_for_decode(tmp_str, tmp_len, 4);
+ p_del->enhanced_vmn.cli_num_field = tmp_str[tmp_off++];
+ memset(p_del->enhanced_vmn.cli_char, 0x00, sizeof(p_del->enhanced_vmn.cli_char));
+ memcpy(p_del->enhanced_vmn.cli_char, tmp_str+tmp_off, p_del->enhanced_vmn.cli_num_field);
+ tmp_off += p_del->enhanced_vmn.cli_num_field;
+ }
- default:
- /* skip unrecognized sub parameters */
- offset++;
- tmp_len = p_pkg_str[offset++];
- offset += tmp_len;
- break;
+ offset += tmp_len;
+ break;
+ case 0x17:
+ /* Enhanced VMN Ack */
+ offset++;
+ tmp_len = p_pkg_str[offset++];
+ memset(tmp_str, 0x00, sizeof(tmp_str));
+ memcpy(tmp_str, p_pkg_str+offset, tmp_len);
+ p_del->enhanced_vmn_ack.vm_mailbox_id = tmp_str[offset] << 8 | tmp_str[offset+1];
+ offset += 2;
+ p_del->enhanced_vmn_ack.vm_num_unheard_msg = tmp_str[offset++];
+ p_del->enhanced_vmn_ack.num_delete_ack = tmp_str[offset] >> 5;
+ p_del->enhanced_vmn_ack.num_play_ack = (tmp_str[offset] & 0x1c) >> 2;
+ _shiftNBit_for_decode(tmp_str, tmp_len, 6);
+ for (int i=0; i<p_del->enhanced_vmn_ack.num_delete_ack; i++) {
+ p_del->enhanced_vmn_ack.da_vm_msg_id[i] = tmp_str[offset] << 8 | tmp_str[offset+1];
+ offset += 2;
+ }
+ for (int i=0; i<p_del->enhanced_vmn_ack.num_play_ack; i++) {
+ p_del->enhanced_vmn_ack.pa_vm_msg_id[i] = tmp_str[offset] << 8 | tmp_str[offset+1];
+ offset += 2;
+ }
+ break;
+ default:
+ /* skip unrecognized sub parameters */
+ offset++;
+ tmp_len = p_pkg_str[offset++];
+ offset += tmp_len;
+ break;
}
-
}
MSG_END();
@@ -1277,11 +1280,11 @@ void SmsPluginMsgCodec::decodeP2PSubmitMsg(const unsigned char *p_pkg_str, int p
unsigned char tmp_str[pkg_len+1];
while (offset < pkg_len) {
- if(p_pkg_str[offset] == 0x00) { // Message Identifier
+ if (p_pkg_str[offset] == 0x00) {
+ /* Message Identifier */
offset += decodeMsgId(p_pkg_str+offset, 5, &(p_sub->msg_id));
- }
-
- else if(p_pkg_str[offset] == 0x01) { // User Data
+ } else if (p_pkg_str[offset] == 0x01) {
+ /* User Data */
offset += 2;
tmp_len = p_pkg_str[offset-1];
memset(tmp_str, 0x00, sizeof(tmp_str));
@@ -1290,112 +1293,96 @@ void SmsPluginMsgCodec::decodeP2PSubmitMsg(const unsigned char *p_pkg_str, int p
decodeUserData(tmp_str, tmp_len, &(p_sub->user_data));
offset += tmp_len;
- }
-
- else if(p_pkg_str[offset] == 0x04) { // Validity Period - Absolute
- offset+=2;
+ } else if (p_pkg_str[offset] == 0x04) {
+ /* Validity Period - Absolute */
+ offset += 2;
p_sub->val_period.format = SMS_TIME_ABSOLUTE;
offset += decodeAbsTime(p_pkg_str+offset, &(p_sub->val_period.time.abs_time));
- }
-
- else if(p_pkg_str[offset] == 0x05) { // Validity Period - Relative
- offset+=2;
+ } else if (p_pkg_str[offset] == 0x05) {
+ /* Validity Period - Relative */
+ offset += 2;
p_sub->val_period.format = SMS_TIME_RELATIVE;
p_sub->val_period.time.rel_time.rel_time = (sms_relative_time_t)p_pkg_str[offset++];
- }
-
- else if(p_pkg_str[offset] == 0x06) { // Deferred Delivery Time - Absolute
- offset+=2;
+ } else if (p_pkg_str[offset] == 0x06) {
+ /* Deferred Delivery Time - Absolute */
+ offset += 2;
p_sub->defer_val_period.format = SMS_TIME_ABSOLUTE;
offset += decodeAbsTime(p_pkg_str+offset, &(p_sub->defer_val_period.time.abs_time));
- }
-
- else if(p_pkg_str[offset] == 0x07) { // Deferred Delivery Time - Relative
- offset+=2;
+ } else if (p_pkg_str[offset] == 0x07) {
+ /* Deferred Delivery Time - Relative */
+ offset += 2;
p_sub->defer_val_period.format = SMS_TIME_RELATIVE;
p_sub->defer_val_period.time.rel_time.rel_time = (sms_relative_time_t)p_pkg_str[offset++];
- }
-
- else if(p_pkg_str[offset] == 0x08) { // Priority indicator
- offset+=2;
+ } else if (p_pkg_str[offset] == 0x08) {
+ /* Priority indicator */
+ offset += 2;
p_sub->priority = (sms_priority_indicator_t)((p_pkg_str[offset++] & 0xc0) >> 6);
- }
-
- else if(p_pkg_str[offset] == 0x09) { // Privacy indicator
- offset+=2;
+ } else if (p_pkg_str[offset] == 0x09) {
+ /* Privacy indicator */
+ offset += 2;
p_sub->privacy = (sms_privacy_indicator_t)((p_pkg_str[offset++] & 0xc0) >> 6);
- }
-
- else if(p_pkg_str[offset] == 0x0a) { // Reply Option
- offset+=2;
+ } else if (p_pkg_str[offset] == 0x0a) {
+ /* Reply Option */
+ offset += 2;
- if(p_pkg_str[offset] & 0x80)
+ if (p_pkg_str[offset] & 0x80)
p_sub->reply_opt.user_ack_req = true;
else
p_sub->reply_opt.user_ack_req = false;
- if(p_pkg_str[offset] & 0x40)
+ if (p_pkg_str[offset] & 0x40)
p_sub->reply_opt.deliver_ack_req = true;
else
p_sub->reply_opt.deliver_ack_req = false;
- if(p_pkg_str[offset] & 0x20)
+ if (p_pkg_str[offset] & 0x20)
p_sub->reply_opt.read_ack_req = true;
else
p_sub->reply_opt.read_ack_req = false;
- if(p_pkg_str[offset] & 0x10)
+ if (p_pkg_str[offset] & 0x10)
p_sub->reply_opt.report_req = true;
else
p_sub->reply_opt.report_req = false;
offset++;
- }
-
- else if(p_pkg_str[offset] == 0x0c) { // Alert on Message Delivery
- offset+=2;
+ } else if (p_pkg_str[offset] == 0x0c) {
+ /* Alert on Message Delivery */
+ offset += 2;
p_sub->alert_priority = (sms_alert_priority_t)((p_pkg_str[offset++] & 0xc0) >> 6);
- }
-
- else if(p_pkg_str[offset] == 0x0d) { // Language Indicator
- offset+=2;
+ } else if (p_pkg_str[offset] == 0x0d) {
+ /* Language Indicator */
+ offset += 2;
p_sub->language = (sms_language_type_t)p_pkg_str[offset++];
- }
-
- else if(p_pkg_str[offset] == 0x0e) { // Call-Back Number
- offset+=2;
+ } else if (p_pkg_str[offset] == 0x0e) {
+ /* Call-Back Number */
+ offset += 2;
tmp_len = p_pkg_str[offset-1];
decodeCallBackNum(&p_pkg_str[offset], tmp_len, &(p_sub->callback_number));
- offset+=tmp_len;
- }
-
- else if(p_pkg_str[offset] == 0x10) { // Multiple Encoding User Data
- offset+=2;
+ offset += tmp_len;
+ } else if (p_pkg_str[offset] == 0x10) {
+ /* Multiple Encoding User Data */
+ offset += 2;
tmp_len = p_pkg_str[offset-1];
+ /* TODO */
- // TODO
-
-
-
- offset+=tmp_len;
- }
-
- else if(p_pkg_str[offset] == 0x11) { // Message Deposit Index
- offset+=2;
+ offset += tmp_len;
+ } else if (p_pkg_str[offset] == 0x11) {
+ /* Message Deposit Index */
+ offset += 2;
memset(&tmp_param_s, 0x00, sizeof(unsigned short));
_copy_char_to_short(&tmp_param_s, p_pkg_str+offset);
p_sub->deposit_id = tmp_param_s;
- offset+=2;
+ offset += 2;
}
}
-
}
@@ -1408,11 +1395,11 @@ void SmsPluginMsgCodec::decodeP2PUserAckMsg(const unsigned char *p_pkg_str, int
unsigned char tmp_str[pkg_len+1];
while (offset < pkg_len) {
- if(p_pkg_str[offset] == 0x00) { // Message Identifier
+ if (p_pkg_str[offset] == 0x00) {
+ /* Message Identifier */
offset += decodeMsgId(p_pkg_str+offset, 5, &(p_user_ack->msg_id));
- }
-
- else if(p_pkg_str[offset] == 0x01) { // User Data
+ } else if (p_pkg_str[offset] == 0x01) {
+ /* User Data */
offset += 2;
tmp_len = p_pkg_str[offset-1];
memset(tmp_str, 0x00, sizeof(tmp_str));
@@ -1421,38 +1408,31 @@ void SmsPluginMsgCodec::decodeP2PUserAckMsg(const unsigned char *p_pkg_str, int
decodeUserData(tmp_str, tmp_len, &(p_user_ack->user_data));
offset += tmp_len;
- }
-
- else if(p_pkg_str[offset] == 0x02) { // User Response Code
+ } else if (p_pkg_str[offset] == 0x02) {
+ /* User Response Code */
offset += 2;
p_user_ack->resp_code = p_pkg_str[offset++];
- }
-
- else if(p_pkg_str[offset] == 0x03) { // Message Center Time Stamp
- offset+=2;
+ } else if (p_pkg_str[offset] == 0x03) {
+ /* Message Center Time Stamp */
+ offset += 2;
offset += decodeAbsTime(p_pkg_str+offset, &(p_user_ack->time_stamp));
- }
-
- else if(p_pkg_str[offset] == 0x10) { // Multiple Encoding User Data
- offset+=2;
+ } else if (p_pkg_str[offset] == 0x10) {
+ /* Multiple Encoding User Data */
+ offset += 2;
tmp_len = p_pkg_str[offset-1];
+ /* TODO */
- // TODO
-
-
-
- offset+=tmp_len;
- }
-
- else if(p_pkg_str[offset] == 0x11) { // Message Deposit Index
- offset+=2;
+ offset += tmp_len;
+ } else if (p_pkg_str[offset] == 0x11) {
+ /* Message Deposit Index */
+ offset += 2;
memset(&tmp_param_s, 0x00, sizeof(unsigned short));
_copy_char_to_short(&tmp_param_s, p_pkg_str+offset);
p_user_ack->deposit_id = tmp_param_s;
- offset+=2;
+ offset += 2;
}
}
@@ -1469,11 +1449,11 @@ void SmsPluginMsgCodec::decodeP2PReadAckMsg(const unsigned char *p_pkg_str, int
unsigned char tmp_str[pkg_len+1];
while (offset < pkg_len) {
- if(p_pkg_str[offset] == 0x00) { // Message Identifier
+ if (p_pkg_str[offset] == 0x00) {
+ /* Message Identifier */
offset += decodeMsgId(p_pkg_str+offset, 5, &(p_read_ack->msg_id));
- }
-
- else if(p_pkg_str[offset] == 0x01) { // User Data
+ } else if (p_pkg_str[offset] == 0x01) {
+ /* User Data */
offset += 2;
tmp_len = p_pkg_str[offset-1];
memset(tmp_str, 0x00, sizeof(tmp_str));
@@ -1482,33 +1462,27 @@ void SmsPluginMsgCodec::decodeP2PReadAckMsg(const unsigned char *p_pkg_str, int
decodeUserData(tmp_str, tmp_len, &(p_read_ack->user_data));
offset += tmp_len;
- }
-
- else if(p_pkg_str[offset] == 0x03) { // Message Center Time Stamp
- offset+=2;
+ } else if (p_pkg_str[offset] == 0x03) {
+ /* Message Center Time Stamp */
+ offset += 2;
offset += decodeAbsTime(p_pkg_str+offset, &(p_read_ack->time_stamp));
- }
-
- else if(p_pkg_str[offset] == 0x10) { // Multiple Encoding User Data
- offset+=2;
+ } else if (p_pkg_str[offset] == 0x10) {
+ /* Multiple Encoding User Data */
+ offset += 2;
tmp_len = p_pkg_str[offset-1];
+ /* TODO */
- // TODO
-
-
-
- offset+=tmp_len;
- }
-
- else if(p_pkg_str[offset] == 0x11) { // Message Deposit Index
- offset+=2;
+ offset += tmp_len;
+ } else if (p_pkg_str[offset] == 0x11) {
+ /* Message Deposit Index */
+ offset += 2;
memset(&tmp_param_s, 0x00, sizeof(unsigned short));
_copy_char_to_short(&tmp_param_s, p_pkg_str+offset);
p_read_ack->deposit_id = tmp_param_s;
- offset+=2;
+ offset += 2;
}
}
@@ -1525,11 +1499,12 @@ void SmsPluginMsgCodec::decodeP2PSubmitReportMsg(const unsigned char *p_pkg_str,
while (offset < pkg_len) {
switch (p_pkg_str[offset]) {
- case 0x00: // Message Identifier
+ case 0x00:
+ /* Message Identifier */
offset += decodeMsgId(p_pkg_str+offset, 5, &(p_sub_report->msg_id));
break;
-
- case 0x01: // User Data
+ case 0x01:
+ /* User Data */
offset += 2;
tmp_len = p_pkg_str[offset-1];
memset(tmp_str, 0x00, sizeof(tmp_str));
@@ -1537,29 +1512,25 @@ void SmsPluginMsgCodec::decodeP2PSubmitReportMsg(const unsigned char *p_pkg_str,
decodeUserData(tmp_str, tmp_len, &(p_sub_report->user_data));
offset += tmp_len;
break;
-
- case 0x0d: // Language Indicator
- offset+=2;
+ case 0x0d:
+ /* Language Indicator */
+ offset += 2;
p_sub_report->language = (sms_language_type_t)p_pkg_str[offset++];
break;
-
- case 0x10: // Multiple Encoding User Data
- offset+=2;
+ case 0x10:
+ /* Multiple Encoding User Data */
+ offset += 2;
tmp_len = p_pkg_str[offset-1];
+ /* TODO */
- // TODO
-
-
-
- offset+=tmp_len;
+ offset += tmp_len;
break;
-
- case 0x15: // TP-Failure Cause
+ case 0x15:
+ /* TP-Failure Cause */
offset += 2;
p_sub_report->tp_fail_cause = p_pkg_str[offset++];
break;
-
default:
break;
}
@@ -1576,13 +1547,14 @@ void SmsPluginMsgCodec::decodeP2PDeliveryAckMsg(const unsigned char *p_pkg_str,
int offset = 0, tmp_len;
unsigned char tmp_str[pkg_len+1];
- while(offset < pkg_len) {
+ while (offset < pkg_len) {
switch (p_pkg_str[offset]) {
- case 0x00: // Message Identifier
+ case 0x00:
+ /* Message Identifier */
offset += decodeMsgId(p_pkg_str+offset, 5, &(p_del_ack->msg_id));
break;
-
- case 0x01: // User Data
+ case 0x01:
+ /* User Data */
offset += 2;
tmp_len = p_pkg_str[offset-1];
memset(tmp_str, 0x00, sizeof(tmp_str));
@@ -1592,29 +1564,25 @@ void SmsPluginMsgCodec::decodeP2PDeliveryAckMsg(const unsigned char *p_pkg_str,
offset += tmp_len;
break;
-
- case 0x03: // Message Center Time Stamp
- offset+=2;
+ case 0x03:
+ /* Message Center Time Stamp */
+ offset += 2;
offset += decodeAbsTime(p_pkg_str+offset, &(p_del_ack->time_stamp));
break;
-
- case 0x10: // Multiple Encoding User Data
- offset+=2;
+ case 0x10:
+ /* Multiple Encoding User Data */
+ offset += 2;
tmp_len = p_pkg_str[offset-1];
+ /* TODO */
- // TODO
-
-
-
- offset+=tmp_len;
+ offset += tmp_len;
break;
-
- case 0x14: // Message Status
- offset+=2;
+ case 0x14:
+ /* Message Status */
+ offset += 2;
p_del_ack->msg_status = (sms_status_code_t)p_pkg_str[offset++];
break;
-
default:
break;
}
@@ -1632,84 +1600,72 @@ void SmsPluginMsgCodec::decodeCBBearerData(const unsigned char *p_pkg_str, int p
unsigned char tmp_str[pkg_len+1];
while (offset < pkg_len) {
- if(p_pkg_str[offset] == 0x00) { // Message Identifier
+ if (p_pkg_str[offset] == 0x00) {
+ /* Message Identifier */
p_telesvc->type = SMS_TYPE_DELIVER;
offset += decodeMsgId(p_pkg_str+offset, 5, &(p_telesvc->data.deliver.msg_id));
- }
-
- else if(p_pkg_str[offset] == 0x01) { // User Data
+ } else if (p_pkg_str[offset] == 0x01) {
+ /* User Data */
offset += 2;
tmp_len = p_pkg_str[offset-1];
memset(tmp_str, 0x00, sizeof(tmp_str));
memcpy(tmp_str, p_pkg_str+offset, tmp_len);
- if(isCMAS)
+ if (isCMAS)
decodeCMASData(tmp_str, tmp_len, &(p_telesvc->data.deliver.cmas_data));
else
decodeUserData(tmp_str, tmp_len, &(p_telesvc->data.deliver.user_data));
offset += tmp_len;
- }
-
- else if(p_pkg_str[offset] == 0x03) { // Message Center Time Stamp
+ } else if (p_pkg_str[offset] == 0x03) {
+ /* Message Center Time Stamp */
offset += 2;
offset += decodeAbsTime(p_pkg_str+offset, &(p_telesvc->data.deliver.time_stamp));
- }
-
- else if(p_pkg_str[offset] == 0x04) { // Validity Period - Absolute
+ } else if (p_pkg_str[offset] == 0x04) {
+ /* Validity Period - Absolute */
offset += 2;
p_telesvc->data.deliver.val_period.format = SMS_TIME_ABSOLUTE;
offset += decodeAbsTime(p_pkg_str+offset, &(p_telesvc->data.deliver.val_period.time.abs_time));
- }
-
- else if(p_pkg_str[offset] == 0x05) { // Validity Period - Relative
- offset+=2;
+ } else if (p_pkg_str[offset] == 0x05) {
+ /* Validity Period - Relative */
+ offset += 2;
p_telesvc->data.deliver.val_period.format = SMS_TIME_RELATIVE;
p_telesvc->data.deliver.val_period.time.rel_time.rel_time = (sms_relative_time_t)p_pkg_str[offset++];
- }
-
- else if(p_pkg_str[offset] == 0x08) { // Priority indicator
- offset+=2;
+ } else if (p_pkg_str[offset] == 0x08) {
+ /* Priority indicator */
+ offset += 2;
p_telesvc->data.deliver.priority = (sms_priority_indicator_t)((p_pkg_str[offset++] & 0xc0) >> 6);
- }
-
- else if(p_pkg_str[offset] == 0x0c) { // Alert on Message Delivery
- offset+=2;
+ } else if (p_pkg_str[offset] == 0x0c) {
+ /* Alert on Message Delivery */
+ offset += 2;
p_telesvc->data.deliver.alert_priority = (sms_alert_priority_t)((p_pkg_str[offset++] & 0xc0) >> 6);
- }
-
- else if(p_pkg_str[offset] == 0x0d) { // Language Indicator
- offset+=2;
+ } else if (p_pkg_str[offset] == 0x0d) {
+ /* Language Indicator */
+ offset += 2;
p_telesvc->data.deliver.language = (sms_language_type_t)p_pkg_str[offset++];
- }
-
- else if(p_pkg_str[offset] == 0x0e) { // Call-Back Number
- offset+=2;
+ } else if (p_pkg_str[offset] == 0x0e) {
+ /* Call-Back Number */
+ offset += 2;
tmp_len = p_pkg_str[offset-1];
decodeCallBackNum(&p_pkg_str[offset], tmp_len, &(p_telesvc->data.deliver.callback_number));
- offset+=tmp_len;
- }
-
- else if(p_pkg_str[offset] == 0x0f) { // Message Display Mode
- offset+=2;
+ offset += tmp_len;
+ } else if (p_pkg_str[offset] == 0x0f) {
+ /* Message Display Mode */
+ offset += 2;
p_telesvc->data.deliver.display_mode = (sms_display_mode_t)((p_pkg_str[offset++] & 0xc0) >> 6);
- }
-
- else if(p_pkg_str[offset] == 0x10) { // Multiple Encoding User Data
- offset+=2;
+ } else if (p_pkg_str[offset] == 0x10) {
+ /* Multiple Encoding User Data */
+ offset += 2;
tmp_len = p_pkg_str[offset-1];
+ /* TODO */
- // TODO
-
-
-
- offset+=tmp_len;
+ offset += tmp_len;
}
}
@@ -1722,38 +1678,38 @@ int SmsPluginMsgCodec::decodeTeleId(const unsigned char *p_pkg_str, int pkg_len,
int offset = 0;
unsigned short tmp_param_s;
- offset+=2;
+ offset += 2;
_copy_char_to_short(&tmp_param_s, &p_pkg_str[offset]);
- switch(tmp_param_s) {
- case SMS_TRANS_TELESVC_CMT_91:
- *tele_id = SMS_TRANS_TELESVC_CMT_91;
- break;
- case SMS_TRANS_TELESVC_CPT_95:
- *tele_id = SMS_TRANS_TELESVC_CPT_95;
- break;
- case SMS_TRANS_TELESVC_CMT_95:
- *tele_id = SMS_TRANS_TELESVC_CMT_95;
- break;
- case SMS_TRANS_TELESVC_VMN_95:
- *tele_id = SMS_TRANS_TELESVC_VMN_95;
- break;
- case SMS_TRANS_TELESVC_WAP:
- *tele_id = SMS_TRANS_TELESVC_WAP;
- break;
- case SMS_TRANS_TELESVC_WEMT:
- *tele_id = SMS_TRANS_TELESVC_WEMT;
- break;
- case SMS_TRANS_TELESVC_SCPT:
- *tele_id = SMS_TRANS_TELESVC_SCPT;
- break;
- case SMS_TRANS_TELESVC_CATPT:
- *tele_id = SMS_TRANS_TELESVC_CATPT;
- break;
- default:
- *tele_id = SMS_TRANS_TELESVC_RESERVED;
- break;
+ switch (tmp_param_s) {
+ case SMS_TRANS_TELESVC_CMT_91:
+ *tele_id = SMS_TRANS_TELESVC_CMT_91;
+ break;
+ case SMS_TRANS_TELESVC_CPT_95:
+ *tele_id = SMS_TRANS_TELESVC_CPT_95;
+ break;
+ case SMS_TRANS_TELESVC_CMT_95:
+ *tele_id = SMS_TRANS_TELESVC_CMT_95;
+ break;
+ case SMS_TRANS_TELESVC_VMN_95:
+ *tele_id = SMS_TRANS_TELESVC_VMN_95;
+ break;
+ case SMS_TRANS_TELESVC_WAP:
+ *tele_id = SMS_TRANS_TELESVC_WAP;
+ break;
+ case SMS_TRANS_TELESVC_WEMT:
+ *tele_id = SMS_TRANS_TELESVC_WEMT;
+ break;
+ case SMS_TRANS_TELESVC_SCPT:
+ *tele_id = SMS_TRANS_TELESVC_SCPT;
+ break;
+ case SMS_TRANS_TELESVC_CATPT:
+ *tele_id = SMS_TRANS_TELESVC_CATPT;
+ break;
+ default:
+ *tele_id = SMS_TRANS_TELESVC_RESERVED;
+ break;
}
return offset+2;
@@ -1765,15 +1721,14 @@ int SmsPluginMsgCodec::decodeSvcCtg(const unsigned char *p_pkg_str, int pkg_len,
int offset = 0;
unsigned short tmp_param_s;
- offset+=2;
+ offset += 2;
_copy_char_to_short(&tmp_param_s, &p_pkg_str[offset]);
- if((tmp_param_s >= SMS_TRANS_SVC_CTG_UNKNOWN && tmp_param_s <= SMS_TRANS_SVC_CTG_KDDI_CORP_MAX1)
+ if ((tmp_param_s >= SMS_TRANS_SVC_CTG_UNKNOWN && tmp_param_s <= SMS_TRANS_SVC_CTG_KDDI_CORP_MAX1)
|| (tmp_param_s >= SMS_TRANS_SVC_CTG_KDDI_CORP_MIN2 && tmp_param_s <= SMS_TRANS_SVC_CTG_KDDI_CORP_MAX2)
|| (tmp_param_s >= SMS_TRANS_SVC_CTG_KDDI_CORP_MIN3 && tmp_param_s <= SMS_TRANS_SVC_CTG_KDDI_CORP_MAX3)) {
*svc_ctg = (sms_trans_svc_ctg_t)tmp_param_s;
- }
- else {
+ } else {
*svc_ctg = SMS_TRANS_SVC_CTG_RESERVED;
}
@@ -1793,121 +1748,122 @@ int SmsPluginMsgCodec::decodeAddress(const unsigned char *p_pkg_str, int pkg_len
offset += (tmp_len+1);
- if(tmp_str[0] & 0x80)
+ if (tmp_str[0] & 0x80)
addr->digit_mode = true;
else
addr->digit_mode = false;
- if(tmp_str[0] & 0x40)
+ if (tmp_str[0] & 0x40)
addr->number_mode = true;
else
addr->number_mode = false;
_shiftNBit_for_decode(tmp_str, tmp_len, 2);
- if(addr->digit_mode == false) {
+ if (addr->digit_mode == false) {
addr->addr_len = tmp_str[0];
memset(addr->szData, 0x00, sizeof(addr->szData));
- for(unsigned int i = 0; i < addr->addr_len; i++) {
- switch(tmp_str[1] & 0xf0) {
- case 0x10:
- case 0x20:
- case 0x30:
- case 0x40:
- case 0x50:
- case 0x60:
- case 0x70:
- case 0x80:
- case 0x90:
- addr->szData[i] = ((tmp_str[1] & 0xf0) >> 4) + '0';
- break;
- case 0x00://sprint issue
- case 0xa0:
- addr->szData[i] = '0';
- break;
- case 0xb0:
- addr->szData[i] = '*';
- break;
- case 0xc0:
- addr->szData[i] = '#';
- break;
- default:
- break;
+ for (unsigned int i = 0; i < addr->addr_len; i++) {
+ switch (tmp_str[1] & 0xf0) {
+ case 0x10:
+ case 0x20:
+ case 0x30:
+ case 0x40:
+ case 0x50:
+ case 0x60:
+ case 0x70:
+ case 0x80:
+ case 0x90:
+ addr->szData[i] = ((tmp_str[1] & 0xf0) >> 4) + '0';
+ break;
+ case 0x00:
+ /* sprint issue */
+ case 0xa0:
+ addr->szData[i] = '0';
+ break;
+ case 0xb0:
+ addr->szData[i] = '*';
+ break;
+ case 0xc0:
+ addr->szData[i] = '#';
+ break;
+ default:
+ break;
}
_shiftNBit_for_decode(tmp_str, tmp_len, 4);
}
- }
- else if(addr->digit_mode == true) {
- if(addr->number_mode == false) { // digit mode = 1, number mode = 0
- switch(tmp_str[0] & 0xe0) {
- case 0x00:
- addr->number_type = SMS_NUMBER_TYPE_UNKNOWN;
- break;
- case 0x20:
- addr->number_type = SMS_NUMBER_TYPE_INTERNATIONAL;
- break;
- case 0x40:
- addr->number_type = SMS_NUMBER_TYPE_NATIONAL;
- break;
- case 0x60:
- addr->number_type = SMS_NUMBER_TYPE_NETWORK_SPECIFIC;
- break;
- case 0x80:
- addr->number_type = SMS_NUMBER_TYPE_SUBSCRIBER;
- break;
- case 0xa0:
- addr->number_type = SMS_NUMBER_TYPE_RESERVED_5;
- break;
- case 0xc0:
- addr->number_type = SMS_NUMBER_TYPE_ABBREVIATED;
- break;
- case 0xe0:
- addr->number_type = SMS_NUMBER_TYPE_RESERVED_7;
- break;
+ } else if (addr->digit_mode == true) {
+ if (addr->number_mode == false) {
+ /* digit mode = 1, number mode = 0 */
+ switch (tmp_str[0] & 0xe0) {
+ case 0x00:
+ addr->number_type = SMS_NUMBER_TYPE_UNKNOWN;
+ break;
+ case 0x20:
+ addr->number_type = SMS_NUMBER_TYPE_INTERNATIONAL;
+ break;
+ case 0x40:
+ addr->number_type = SMS_NUMBER_TYPE_NATIONAL;
+ break;
+ case 0x60:
+ addr->number_type = SMS_NUMBER_TYPE_NETWORK_SPECIFIC;
+ break;
+ case 0x80:
+ addr->number_type = SMS_NUMBER_TYPE_SUBSCRIBER;
+ break;
+ case 0xa0:
+ addr->number_type = SMS_NUMBER_TYPE_RESERVED_5;
+ break;
+ case 0xc0:
+ addr->number_type = SMS_NUMBER_TYPE_ABBREVIATED;
+ break;
+ case 0xe0:
+ addr->number_type = SMS_NUMBER_TYPE_RESERVED_7;
+ break;
}
_shiftNBit_for_decode(tmp_str, tmp_len, 3);
- switch(tmp_str[0] & 0xf0) {
- case 0x00:
- addr->number_plan = SMS_NPI_UNKNOWN;
- break;
- case 0x10:
- addr->number_plan = SMS_NPI_ISDN;
- break;
- case 0x30:
- addr->number_plan = SMS_NPI_DATA;
- break;
- case 0x40:
- addr->number_plan = SMS_NPI_TELEX;
- break;
- case 0x90:
- addr->number_plan = SMS_NPI_PRIVATE;
- break;
- default:
- addr->number_plan = SMS_NPI_RESERVED;
- break;
+ switch (tmp_str[0] & 0xf0) {
+ case 0x00:
+ addr->number_plan = SMS_NPI_UNKNOWN;
+ break;
+ case 0x10:
+ addr->number_plan = SMS_NPI_ISDN;
+ break;
+ case 0x30:
+ addr->number_plan = SMS_NPI_DATA;
+ break;
+ case 0x40:
+ addr->number_plan = SMS_NPI_TELEX;
+ break;
+ case 0x90:
+ addr->number_plan = SMS_NPI_PRIVATE;
+ break;
+ default:
+ addr->number_plan = SMS_NPI_RESERVED;
+ break;
}
_shiftNBit_for_decode(tmp_str, tmp_len, 4);
- }
- else if(addr->number_mode == true) { // digit mode = 1, number mode = 1
- switch(tmp_str[0] & 0xe0) {
- case 0x00:
- addr->number_type = SMS_TRANS_DNET_UNKNOWN;
- break;
- case 0x20:
- addr->number_type = SMS_TRANS_DNET_INTERNET_PROTOCOL;
- break;
- case 0x40:
- addr->number_type = SMS_TRANS_DNET_INTERNET_MAIL_ADDR;
- break;
- default:
- addr->number_type = SMS_TRANS_DNET_RESERVED;
- break;
+ } else if (addr->number_mode == true) {
+ /* digit mode = 1, number mode = 1 */
+ switch (tmp_str[0] & 0xe0) {
+ case 0x00:
+ addr->number_type = SMS_TRANS_DNET_UNKNOWN;
+ break;
+ case 0x20:
+ addr->number_type = SMS_TRANS_DNET_INTERNET_PROTOCOL;
+ break;
+ case 0x40:
+ addr->number_type = SMS_TRANS_DNET_INTERNET_MAIL_ADDR;
+ break;
+ default:
+ addr->number_type = SMS_TRANS_DNET_RESERVED;
+ break;
}
_shiftNBit_for_decode(tmp_str, tmp_len, 3);
@@ -1934,19 +1890,19 @@ int SmsPluginMsgCodec::decodeSubAddress(const unsigned char *p_pkg_str, int pkg_
offset += (tmp_len+1);
- switch(tmp_str[0] & 0xe0) {
- case 0x00:
- sub_addr->type = SMS_TRANS_SUB_ADDR_NSAP;
- break;
- case 0x20:
- sub_addr->type = SMS_TRANS_SUB_ADDR_USER;
- break;
- default:
- sub_addr->type = SMS_TRANS_SUB_ADDR_RESERVED;
- break;
+ switch (tmp_str[0] & 0xe0) {
+ case 0x00:
+ sub_addr->type = SMS_TRANS_SUB_ADDR_NSAP;
+ break;
+ case 0x20:
+ sub_addr->type = SMS_TRANS_SUB_ADDR_USER;
+ break;
+ default:
+ sub_addr->type = SMS_TRANS_SUB_ADDR_RESERVED;
+ break;
}
- if(tmp_str[0] & 0x10)
+ if (tmp_str[0] & 0x10)
sub_addr->odd = true;
else
sub_addr->odd = false;
@@ -1974,12 +1930,12 @@ int SmsPluginMsgCodec::decodeMsgId(const unsigned char *p_pkg_str, int pkg_len,
_copy_char_to_short(&tmp_param_s, tmp_str);
p_msg_id->msg_id = tmp_param_s;
- if(tmp_str[2] & 0x80)
+ if (tmp_str[2] & 0x80)
p_msg_id->header_ind = true;
else
p_msg_id->header_ind = false;
- offset+=5;
+ offset += 5;
return offset;
}
@@ -1990,39 +1946,39 @@ void SmsPluginMsgCodec::decodeCallBackNum(const unsigned char *p_pkg_str, int pk
int offset = 0;
unsigned char tmp_str[pkg_len+1];
- if(p_pkg_str[offset] & 0x80) {
+ if (p_pkg_str[offset] & 0x80) {
p_callback->digit_mode = true;
- switch(p_pkg_str[offset] & 0x70) {
- case 0x00:
- p_callback->number_type = SMS_NUMBER_TYPE_UNKNOWN;
- break;
- case 0x10:
- p_callback->number_type = SMS_NUMBER_TYPE_INTERNATIONAL;
- break;
- case 0x20:
- p_callback->number_type = SMS_NUMBER_TYPE_NATIONAL;
- break;
- case 0x30:
- p_callback->number_type = SMS_NUMBER_TYPE_NETWORK_SPECIFIC;
- break;
- case 0x40:
- p_callback->number_type = SMS_NUMBER_TYPE_SUBSCRIBER;
- break;
- case 0x50:
- p_callback->number_type = SMS_NUMBER_TYPE_RESERVED_5;
- break;
- case 0x60:
- p_callback->number_type = SMS_NUMBER_TYPE_ABBREVIATED;
- break;
- case 0x70:
- p_callback->number_type = SMS_NUMBER_TYPE_RESERVED_7;
- break;
- default:
- break;
+ switch (p_pkg_str[offset] & 0x70) {
+ case 0x00:
+ p_callback->number_type = SMS_NUMBER_TYPE_UNKNOWN;
+ break;
+ case 0x10:
+ p_callback->number_type = SMS_NUMBER_TYPE_INTERNATIONAL;
+ break;
+ case 0x20:
+ p_callback->number_type = SMS_NUMBER_TYPE_NATIONAL;
+ break;
+ case 0x30:
+ p_callback->number_type = SMS_NUMBER_TYPE_NETWORK_SPECIFIC;
+ break;
+ case 0x40:
+ p_callback->number_type = SMS_NUMBER_TYPE_SUBSCRIBER;
+ break;
+ case 0x50:
+ p_callback->number_type = SMS_NUMBER_TYPE_RESERVED_5;
+ break;
+ case 0x60:
+ p_callback->number_type = SMS_NUMBER_TYPE_ABBREVIATED;
+ break;
+ case 0x70:
+ p_callback->number_type = SMS_NUMBER_TYPE_RESERVED_7;
+ break;
+ default:
+ break;
}
- switch(p_pkg_str[offset++] & 0x0f) {
+ switch (p_pkg_str[offset++] & 0x0f) {
case 0x00:
p_callback->number_plan = SMS_NPI_UNKNOWN;
break;
@@ -2049,15 +2005,13 @@ void SmsPluginMsgCodec::decodeCallBackNum(const unsigned char *p_pkg_str, int pk
if (p_callback->number_type == SMS_NUMBER_TYPE_INTERNATIONAL) {
memcpy(&(p_callback->szData[1]), p_pkg_str+offset, p_callback->addr_len);
- if(p_callback->szData[1] != '\0') {
+ if (p_callback->szData[1] != '\0') {
p_callback->szData[0] = '+';
}
- }
- else {
+ } else {
memcpy(p_callback->szData, p_pkg_str+offset, p_callback->addr_len);
}
- }
- else {
+ } else {
p_callback->digit_mode = false;
memset(tmp_str, 0x00, sizeof(tmp_str));
@@ -2069,30 +2023,30 @@ void SmsPluginMsgCodec::decodeCallBackNum(const unsigned char *p_pkg_str, int pk
memset(p_callback->szData, 0x00, sizeof(p_callback->szData));
- for(unsigned int i = 0; i < p_callback->addr_len; i++) {
- switch(tmp_str[1] & 0xf0) {
- case 0x10:
- case 0x20:
- case 0x30:
- case 0x40:
- case 0x50:
- case 0x60:
- case 0x70:
- case 0x80:
- case 0x90:
- p_callback->szData[i] = ((tmp_str[1] & 0xf0) >> 4) + '0';
- break;
- case 0xa0:
- p_callback->szData[i] = '0';
- break;
- case 0xb0:
- p_callback->szData[i] = '*';
- break;
- case 0xc0:
- p_callback->szData[i] = '#';
- break;
- default :
- break;
+ for (unsigned int i = 0; i < p_callback->addr_len; i++) {
+ switch (tmp_str[1] & 0xf0) {
+ case 0x10:
+ case 0x20:
+ case 0x30:
+ case 0x40:
+ case 0x50:
+ case 0x60:
+ case 0x70:
+ case 0x80:
+ case 0x90:
+ p_callback->szData[i] = ((tmp_str[1] & 0xf0) >> 4) + '0';
+ break;
+ case 0xa0:
+ p_callback->szData[i] = '0';
+ break;
+ case 0xb0:
+ p_callback->szData[i] = '*';
+ break;
+ case 0xc0:
+ p_callback->szData[i] = '#';
+ break;
+ default :
+ break;
}
_shiftNBit_for_decode(tmp_str, pkg_len, 4);
@@ -2138,7 +2092,7 @@ int SmsPluginMsgCodec::encodeUserData(const unsigned char* src, unsigned char *d
for (i = 0; i < src_size; i++) {
shift = j % 7;
dest[j++] = (tmp[i] << shift) + (tmp[i+1] >> (7-shift));
- if(shift == 6) {
+ if (shift == 6) {
i++;
}
}
@@ -2162,8 +2116,7 @@ void SmsPluginMsgCodec::decodeCMASData(unsigned char *p_pkg_str, int pkg_len, sm
if ((p_pkg_str[offset] & 0xf8) != 0x00) {
MSG_ERR("Wrong Encode Type = [%d]!! The type must be 0", (p_pkg_str[offset]&0xf8)>>3);
return;
- }
- else {
+ } else {
_shiftNBit_for_decode(p_pkg_str, pkg_len, 5);
offset++;
@@ -2183,77 +2136,76 @@ void SmsPluginMsgCodec::decodeCMASData(unsigned char *p_pkg_str, int pkg_len, sm
memset(tmp_str, 0x00, sizeof(tmp_str));
memcpy(tmp_str, p_pkg_str+offset, tmp_len);
- switch(tmp_str[0] & 0xf8) {
- case 0x00:
- p_cmas->encode_type = SMS_ENCODE_OCTET;
- break;
- case 0x08:
- p_cmas->encode_type = SMS_ENCODE_EPM;
- break;
- case 0x10:
- p_cmas->encode_type = SMS_ENCODE_7BIT_ASCII;
- break;
- case 0x18:
- p_cmas->encode_type = SMS_ENCODE_IA5;
- break;
- case 0x20:
- p_cmas->encode_type = SMS_ENCODE_UNICODE;
- break;
- case 0x28:
- p_cmas->encode_type = SMS_ENCODE_SHIFT_JIS;
- break;
- case 0x30:
- p_cmas->encode_type = SMS_ENCODE_KOREAN;
- break;
- case 0x38:
- p_cmas->encode_type = SMS_ENCODE_LATIN_HEBREW;
- break;
- case 0x40:
- p_cmas->encode_type = SMS_ENCODE_LATIN;
- break;
- case 0x48:
- p_cmas->encode_type = SMS_ENCODE_GSM7BIT;
- break;
- case 0x50:
- p_cmas->encode_type = SMS_ENCODE_GSMDCS;
- break;
- case 0x80: // reserved value, but SKT use this value for KSC5601
- p_cmas->encode_type = SMS_ENCODE_EUCKR;
- break;
- default :
- p_cmas->encode_type = SMS_ENCODE_RESERVED;
- break;
+ switch (tmp_str[0] & 0xf8) {
+ case 0x00:
+ p_cmas->encode_type = SMS_ENCODE_OCTET;
+ break;
+ case 0x08:
+ p_cmas->encode_type = SMS_ENCODE_EPM;
+ break;
+ case 0x10:
+ p_cmas->encode_type = SMS_ENCODE_7BIT_ASCII;
+ break;
+ case 0x18:
+ p_cmas->encode_type = SMS_ENCODE_IA5;
+ break;
+ case 0x20:
+ p_cmas->encode_type = SMS_ENCODE_UNICODE;
+ break;
+ case 0x28:
+ p_cmas->encode_type = SMS_ENCODE_SHIFT_JIS;
+ break;
+ case 0x30:
+ p_cmas->encode_type = SMS_ENCODE_KOREAN;
+ break;
+ case 0x38:
+ p_cmas->encode_type = SMS_ENCODE_LATIN_HEBREW;
+ break;
+ case 0x40:
+ p_cmas->encode_type = SMS_ENCODE_LATIN;
+ break;
+ case 0x48:
+ p_cmas->encode_type = SMS_ENCODE_GSM7BIT;
+ break;
+ case 0x50:
+ p_cmas->encode_type = SMS_ENCODE_GSMDCS;
+ break;
+ case 0x80:
+ /* reserved value, but SKT use this value for KSC5601 */
+ p_cmas->encode_type = SMS_ENCODE_EUCKR;
+ break;
+ default :
+ p_cmas->encode_type = SMS_ENCODE_RESERVED;
+ break;
}
_shiftNBit_for_decode(tmp_str, tmp_len, 5);
- switch(p_cmas->encode_type) {
- case SMS_ENCODE_7BIT_ASCII:
- case SMS_ENCODE_IA5:
- case SMS_ENCODE_GSM7BIT:
- memset(p_cmas->alert_text, 0x00, sizeof(p_cmas->alert_text));
- p_cmas->data_len = (tmp_len*8-5) / 7;
- for(unsigned int i = 0; i < p_cmas->data_len; i++) {
- p_cmas->alert_text[i] = tmp_str[0] >> 1;
- _shiftNBit_for_decode(tmp_str, tmp_len, 7);
- }
- break;
- case SMS_ENCODE_EPM:
- break;
- case SMS_ENCODE_GSMDCS:
- break;
- default:
- p_cmas->data_len = tmp_len - 1;
- memset(p_cmas->alert_text, 0x00, sizeof(p_cmas->alert_text));
- memcpy(p_cmas->alert_text, tmp_str+offset, tmp_len-1);
- break;
+ switch (p_cmas->encode_type) {
+ case SMS_ENCODE_7BIT_ASCII:
+ case SMS_ENCODE_IA5:
+ case SMS_ENCODE_GSM7BIT:
+ memset(p_cmas->alert_text, 0x00, sizeof(p_cmas->alert_text));
+ p_cmas->data_len = (tmp_len*8-5) / 7;
+ for (unsigned int i = 0; i < p_cmas->data_len; i++) {
+ p_cmas->alert_text[i] = tmp_str[0] >> 1;
+ _shiftNBit_for_decode(tmp_str, tmp_len, 7);
+ }
+ break;
+ case SMS_ENCODE_EPM:
+ break;
+ case SMS_ENCODE_GSMDCS:
+ break;
+ default:
+ p_cmas->data_len = tmp_len - 1;
+ memset(p_cmas->alert_text, 0x00, sizeof(p_cmas->alert_text));
+ memcpy(p_cmas->alert_text, tmp_str+offset, tmp_len-1);
+ break;
}
- offset+=tmp_len;
- }
-
- else if (p_pkg_str[offset] == 0x01) {
+ offset += tmp_len;
+ } else if (p_pkg_str[offset] == 0x01) {
MSG_DEBUG("Type 1 Decode!");
- offset+=2;
+ offset += 2;
tmp_len = p_pkg_str[offset-1];
MSG_DEBUG("Type 1 length = [%d]", tmp_len);
p_cmas->category = (sms_cmae_category_t)p_pkg_str[offset++];
@@ -2261,15 +2213,13 @@ void SmsPluginMsgCodec::decodeCMASData(unsigned char *p_pkg_str, int pkg_len, sm
p_cmas->severity = (sms_cmae_severity_t)(p_pkg_str[offset] >> 4);
p_cmas->urgency = (sms_cmae_urgency_t)(p_pkg_str[offset++] & 0x0f);
p_cmas->certainty = (sms_cmae_certainty_t)(p_pkg_str[offset++] >> 4);
- }
-
- else if (p_pkg_str[offset] == 0x02) {
+ } else if (p_pkg_str[offset] == 0x02) {
MSG_DEBUG("Type 2 Decode!");
- offset+=2;
+ offset += 2;
tmp_len = p_pkg_str[offset-1];
MSG_DEBUG("Type 2 length = [%d]", tmp_len);
_copy_char_to_short(&(p_cmas->id), p_pkg_str+offset);
- offset+=2;
+ offset += 2;
p_cmas->alert_handle = (sms_cmae_alert_handle_t)p_pkg_str[offset++];
offset += decodeAbsTime(p_pkg_str+offset, &(p_cmas->expires));
p_cmas->language = (sms_language_type_t)p_pkg_str[offset++];
@@ -2285,95 +2235,95 @@ void SmsPluginMsgCodec::decodeCMASData(unsigned char *p_pkg_str, int pkg_len, sm
void SmsPluginMsgCodec::decodeUserData(unsigned char *p_pkg_str, int pkg_len, sms_telesvc_userdata_s *p_user)
{
- switch(p_pkg_str[0] & 0xf8) {
- case 0x00:
- p_user->encode_type = SMS_ENCODE_OCTET;
- break;
- case 0x08:
- p_user->encode_type = SMS_ENCODE_EPM;
- break;
- case 0x10:
- p_user->encode_type = SMS_ENCODE_7BIT_ASCII;
- break;
- case 0x18:
- p_user->encode_type = SMS_ENCODE_IA5;
- break;
- case 0x20:
- p_user->encode_type = SMS_ENCODE_UNICODE;
- break;
- case 0x28:
- p_user->encode_type = SMS_ENCODE_SHIFT_JIS;
- break;
- case 0x30:
- p_user->encode_type = SMS_ENCODE_KOREAN;
- break;
- case 0x38:
- p_user->encode_type = SMS_ENCODE_LATIN_HEBREW;
- break;
- case 0x40:
- p_user->encode_type = SMS_ENCODE_LATIN;
- break;
- case 0x48:
- p_user->encode_type = SMS_ENCODE_GSM7BIT;
- break;
- case 0x50:
- p_user->encode_type = SMS_ENCODE_GSMDCS;
- break;
- case 0x80: // reserved value, but SKT use this value for KSC5601
- p_user->encode_type = SMS_ENCODE_EUCKR;
- break;
- default :
- p_user->encode_type = SMS_ENCODE_RESERVED;
- break;
+ switch (p_pkg_str[0] & 0xf8) {
+ case 0x00:
+ p_user->encode_type = SMS_ENCODE_OCTET;
+ break;
+ case 0x08:
+ p_user->encode_type = SMS_ENCODE_EPM;
+ break;
+ case 0x10:
+ p_user->encode_type = SMS_ENCODE_7BIT_ASCII;
+ break;
+ case 0x18:
+ p_user->encode_type = SMS_ENCODE_IA5;
+ break;
+ case 0x20:
+ p_user->encode_type = SMS_ENCODE_UNICODE;
+ break;
+ case 0x28:
+ p_user->encode_type = SMS_ENCODE_SHIFT_JIS;
+ break;
+ case 0x30:
+ p_user->encode_type = SMS_ENCODE_KOREAN;
+ break;
+ case 0x38:
+ p_user->encode_type = SMS_ENCODE_LATIN_HEBREW;
+ break;
+ case 0x40:
+ p_user->encode_type = SMS_ENCODE_LATIN;
+ break;
+ case 0x48:
+ p_user->encode_type = SMS_ENCODE_GSM7BIT;
+ break;
+ case 0x50:
+ p_user->encode_type = SMS_ENCODE_GSMDCS;
+ break;
+ case 0x80:
+ /* reserved value, but SKT use this value for KSC5601 */
+ p_user->encode_type = SMS_ENCODE_EUCKR;
+ break;
+ default :
+ p_user->encode_type = SMS_ENCODE_RESERVED;
+ break;
}
_shiftNBit_for_decode(p_pkg_str, pkg_len, 5);
- if(p_user->encode_type == SMS_ENCODE_EPM || p_user->encode_type == SMS_ENCODE_GSMDCS) {
+ if (p_user->encode_type == SMS_ENCODE_EPM || p_user->encode_type == SMS_ENCODE_GSMDCS) {
p_user->msg_type = p_pkg_str[0];
_shiftNBit_for_decode(p_pkg_str, pkg_len, 8);
}
p_user->data_len = p_pkg_str[0];
- switch(p_user->encode_type) {
- case SMS_ENCODE_7BIT_ASCII:
- memset(p_user->user_data, 0x00, sizeof(p_user->user_data));
- for(unsigned int i = 0; i < p_user->data_len; i++) {
- p_user->user_data[i] = p_pkg_str[1] >> 1;
- _shiftNBit_for_decode(p_pkg_str, pkg_len, 7);
- }
- break;
- case SMS_ENCODE_IA5:
- case SMS_ENCODE_GSM7BIT:
- memset(p_user->user_data, 0x00, sizeof(p_user->user_data));
- UnpackGSM7bitData(&(p_pkg_str[1]), p_user->user_data, p_user->data_len);
- break;
- case SMS_ENCODE_EPM:
- break;
- case SMS_ENCODE_GSMDCS:
- break;
- case SMS_ENCODE_UNICODE:
- p_user->data_len*=2;
- memset(p_user->user_data, 0x00, sizeof(p_user->user_data));
- memcpy(p_user->user_data, p_pkg_str+1, p_user->data_len);
- break;
- default:
- memset(p_user->user_data, 0x00, sizeof(p_user->user_data));
- memcpy(p_user->user_data, p_pkg_str+1, p_user->data_len);
- break;
+ switch (p_user->encode_type) {
+ case SMS_ENCODE_7BIT_ASCII:
+ case SMS_ENCODE_IA5:
+ memset(p_user->user_data, 0x00, sizeof(p_user->user_data));
+ for (unsigned int i = 0; i < p_user->data_len; i++) {
+ p_user->user_data[i] = p_pkg_str[1] >> 1;
+ _shiftNBit_for_decode(p_pkg_str, pkg_len, 7);
+ }
+ break;
+ case SMS_ENCODE_GSM7BIT:
+ memset(p_user->user_data, 0x00, sizeof(p_user->user_data));
+ UnpackGSM7bitData(&(p_pkg_str[1]), p_user->user_data, p_user->data_len);
+ break;
+ case SMS_ENCODE_EPM:
+ break;
+ case SMS_ENCODE_GSMDCS:
+ break;
+ case SMS_ENCODE_UNICODE:
+ p_user->data_len*=2;
+ memset(p_user->user_data, 0x00, sizeof(p_user->user_data));
+ memcpy(p_user->user_data, p_pkg_str+1, p_user->data_len);
+ break;
+ default:
+ memset(p_user->user_data, 0x00, sizeof(p_user->user_data));
+ memcpy(p_user->user_data, p_pkg_str+1, p_user->data_len);
+ break;
}
-
}
sms_message_type_t SmsPluginMsgCodec::findMsgType(const unsigned char *p_pkg_str, int pkg_len)
{
int offset = 0;
- while(offset < pkg_len) {
- if(p_pkg_str[offset] == 0x00) {
+ while (offset < pkg_len) {
+ if (p_pkg_str[offset] == 0x00) {
return (sms_message_type_t)((p_pkg_str[offset+2]&0xf0)>>4);
}
- offset+=(p_pkg_str[offset+1]+2);
+ offset += (p_pkg_str[offset+1]+2);
}
return SMS_TYPE_MAX_VALUE;
diff --git a/plugin/sms_cdma_plugin/SmsCdmaPluginEventHandler.cpp b/plugin/sms_cdma_plugin/SmsCdmaPluginEventHandler.cpp
index b8736e4..37112bd 100755
--- a/plugin/sms_cdma_plugin/SmsCdmaPluginEventHandler.cpp
+++ b/plugin/sms_cdma_plugin/SmsCdmaPluginEventHandler.cpp
@@ -41,7 +41,7 @@ SmsPluginEventHandler* SmsPluginEventHandler::pInstance = NULL;
SmsPluginEventHandler::SmsPluginEventHandler()
{
- /** Initialize global parameters */
+ /* Initialize global parameters */
memset(&listener, 0x00, sizeof(MSG_PLUGIN_LISTENER_S));
memset(&sentInfo, 0x00, sizeof(sms_sent_info_s));
devStatus = false;
@@ -62,6 +62,7 @@ SmsPluginEventHandler* SmsPluginEventHandler::instance()
return pInstance;
}
+
void SmsPluginEventHandler::registerListener(MSG_PLUGIN_LISTENER_S *pListener)
{
listener = *pListener;
@@ -72,7 +73,7 @@ void SmsPluginEventHandler::convertTpduToMsginfo(sms_trans_p2p_msg_s *p_p2p_msg,
{
MSG_BEGIN();
- // Address
+ /* Address */
if (p_p2p_msg->telesvc_msg.data.deliver.callback_number.szData[0] != '\0')
p_msg_info->nAddressCnt = 2;
else
@@ -82,14 +83,14 @@ void SmsPluginEventHandler::convertTpduToMsginfo(sms_trans_p2p_msg_s *p_p2p_msg,
if (p_msg_info->addressList) {
switch (p_msg_info->nAddressCnt) {
- case 2 :
- memset(p_msg_info->addressList[1].addressVal, 0x00, MAX_ADDRESS_VAL_LEN+1);
- case 1 :
- memset(p_msg_info->addressList[0].addressVal, 0x00, MAX_ADDRESS_VAL_LEN+1);
- break;
- default :
- MSG_ERR("Invalid case");
- memset(p_msg_info->addressList[0].addressVal, 0x00, MAX_ADDRESS_VAL_LEN+1);
+ case 2:
+ memset(p_msg_info->addressList[1].addressVal, 0x00, MAX_ADDRESS_VAL_LEN+1);
+ case 1:
+ memset(p_msg_info->addressList[0].addressVal, 0x00, MAX_ADDRESS_VAL_LEN+1);
+ break;
+ default:
+ MSG_ERR("Invalid case");
+ memset(p_msg_info->addressList[0].addressVal, 0x00, MAX_ADDRESS_VAL_LEN+1);
}
}
@@ -100,24 +101,23 @@ void SmsPluginEventHandler::convertTpduToMsginfo(sms_trans_p2p_msg_s *p_p2p_msg,
}
- // Teleservice message
- switch(p_p2p_msg->telesvc_msg.type)
- {
- case SMS_TYPE_DELIVER :
- p_msg_info->msgType.subType = MSG_NORMAL_SMS;
- p_msg_info->folderId = MSG_INBOX_ID;
-
- convertDeliverMsgToMsgInfo(&(p_p2p_msg->telesvc_msg.data.deliver), p_msg_info);
- break;
- case SMS_TYPE_DELIVERY_ACK :
- convertAckMsgToMsgInfo(&(p_p2p_msg->telesvc_msg.data.delivery_ack), p_msg_info);
- break;
- case SMS_TYPE_SUBMIT_REPORT :
- convertReportMsgToMsgInfo(&(p_p2p_msg->telesvc_msg.data.report), p_msg_info);
- break;
- default :
- MSG_DEBUG("No matching type = [%d]", p_p2p_msg->telesvc_msg.type);
- break;
+ /* Teleservice message */
+ switch (p_p2p_msg->telesvc_msg.type) {
+ case SMS_TYPE_DELIVER:
+ p_msg_info->msgType.subType = MSG_NORMAL_SMS;
+ p_msg_info->folderId = MSG_INBOX_ID;
+
+ convertDeliverMsgToMsgInfo(&(p_p2p_msg->telesvc_msg.data.deliver), p_msg_info);
+ break;
+ case SMS_TYPE_DELIVERY_ACK:
+ convertAckMsgToMsgInfo(&(p_p2p_msg->telesvc_msg.data.delivery_ack), p_msg_info);
+ break;
+ case SMS_TYPE_SUBMIT_REPORT:
+ convertReportMsgToMsgInfo(&(p_p2p_msg->telesvc_msg.data.report), p_msg_info);
+ break;
+ default:
+ MSG_DEBUG("No matching type = [%d]", p_p2p_msg->telesvc_msg.type);
+ break;
}
MSG_END();
@@ -128,7 +128,7 @@ void SmsPluginEventHandler::convertTpduToMsginfo(sms_trans_broadcast_msg_s *p_cb
{
MSG_BEGIN();
- // Address
+ /* Address */
p_msg_info->nAddressCnt = 0;
p_msg_info->addressList = (MSG_ADDRESS_INFO_S *)new char[sizeof(MSG_ADDRESS_INFO_S)];
@@ -136,8 +136,8 @@ void SmsPluginEventHandler::convertTpduToMsginfo(sms_trans_broadcast_msg_s *p_cb
memset(p_msg_info->addressList[0].addressVal, 0x00, MAX_ADDRESS_VAL_LEN+1);
}
- // Bearer Data
- if(p_cb_msg->telesvc_msg.type == SMS_TYPE_DELIVER) {
+ /* Bearer Data */
+ if (p_cb_msg->telesvc_msg.type == SMS_TYPE_DELIVER) {
p_msg_info->msgType.subType = MSG_CB_SMS;
p_msg_info->folderId = MSG_CBMSGBOX_ID;
@@ -145,8 +145,7 @@ void SmsPluginEventHandler::convertTpduToMsginfo(sms_trans_broadcast_msg_s *p_cb
convertCMASMsgToMsgInfo(&(p_cb_msg->telesvc_msg.data.deliver), p_msg_info);
else
convertDeliverMsgToMsgInfo(&(p_cb_msg->telesvc_msg.data.deliver), p_msg_info);
- }
- else {
+ } else {
MSG_DEBUG("No matching type = [%d]", p_cb_msg->telesvc_msg.type);
}
@@ -186,7 +185,8 @@ void SmsPluginEventHandler::convertCMASMsgToMsgInfo(sms_telesvc_deliver_s *p_del
p_msg_info->direction = MSG_DIRECTION_TYPE_MT;
p_msg_info->bTextSms = true;
- if (p_deliver->callback_number.szData[0] != '\0') { // If callback number is in received pdu, replace the address value.
+ if (p_deliver->callback_number.szData[0] != '\0') {
+ /* If callback number is in received pdu, replace the address value. */
memset(p_msg_info->addressList[0].addressVal, 0x00, MAX_ADDRESS_VAL_LEN+1);
p_msg_info->nAddressCnt = 1;
p_msg_info->addressList[0].addressType = MSG_ADDRESS_TYPE_UNKNOWN;
@@ -197,7 +197,7 @@ void SmsPluginEventHandler::convertCMASMsgToMsgInfo(sms_telesvc_deliver_s *p_del
time_t rawtime = 0;
p_msg_info->storageId = MSG_STORAGE_PHONE;
-#if 0 // Save Timestamp of message center.
+#if 0 /* Save Timestamp of message center. */
char displayTime[32];
struct tm * timeTM;
@@ -270,28 +270,24 @@ void SmsPluginEventHandler::convertCMASMsgToMsgInfo(sms_telesvc_deliver_s *p_del
p_msg_info->dataSize = strlen(p_msg_info->msgData);
return;
} else {
- if(p_msg_info->encodeType == MSG_ENCODE_UCS2) {
+ if (p_msg_info->encodeType == MSG_ENCODE_UCS2) {
MSG_DEBUG("Encode Type = UCS2");
MsgTextConvert *textCvt = MsgTextConvert::instance();
p_msg_info->dataSize = textCvt->convertUCS2ToUTF8((unsigned char*)&p_msg_info->msgText, MAX_MSG_TEXT_LEN, (unsigned char*)&p_deliver->cmas_data.alert_text, p_deliver->cmas_data.data_len);
- }
- else if(p_msg_info->encodeType == MSG_ENCODE_EUCKR) {
+ } else if (p_msg_info->encodeType == MSG_ENCODE_EUCKR) {
MSG_DEBUG("Encode Type = EUCKR");
MsgTextConvert *textCvt = MsgTextConvert::instance();
p_msg_info->dataSize = textCvt->convertEUCKRToUTF8((unsigned char*)&p_msg_info->msgText, MAX_MSG_TEXT_LEN, (unsigned char*)&p_deliver->cmas_data.alert_text, p_deliver->cmas_data.data_len);
- }
- else if(p_msg_info->encodeType == MSG_ENCODE_SHIFT_JIS) {
+ } else if (p_msg_info->encodeType == MSG_ENCODE_SHIFT_JIS) {
MSG_DEBUG("Encode Type = Shift-JIS");
MsgTextConvert *textCvt = MsgTextConvert::instance();
p_msg_info->dataSize = textCvt->convertSHIFTJISToUTF8((unsigned char*)&p_msg_info->msgText, MAX_MSG_TEXT_LEN, (unsigned char*)&p_deliver->cmas_data.alert_text, p_deliver->cmas_data.data_len);
- }
- else if(p_msg_info->encodeType == MSG_ENCODE_GSM7BIT) {
+ } else if (p_msg_info->encodeType == MSG_ENCODE_GSM7BIT) {
MSG_DEBUG("Encode Type = GSM7BIT");
MSG_LANG_INFO_S langinfo = {0,};
MsgTextConvert *textCvt = MsgTextConvert::instance();
p_msg_info->dataSize = textCvt->convertGSM7bitToUTF8((unsigned char*)&p_msg_info->msgText, MAX_MSG_TEXT_LEN, (unsigned char*)&p_deliver->cmas_data.alert_text, p_deliver->cmas_data.data_len, &langinfo);
- }
- else {
+ } else {
snprintf(p_msg_info->msgText, sizeof(p_msg_info->msgText), "%s", p_deliver->cmas_data.alert_text);
p_msg_info->dataSize = p_deliver->cmas_data.data_len;
}
@@ -306,10 +302,10 @@ void SmsPluginEventHandler::convertDeliverMsgToMsgInfo(sms_telesvc_deliver_s *p_
MSG_BEGIN();
p_msg_info->msgType.mainType = MSG_SMS_TYPE;
-// p_msg_info->msgType.subType = MSG_NORMAL_SMS;
-
-// p_msg_info->folderId = MSG_INBOX_ID;
-
+ /*
+ p_msg_info->msgType.subType = MSG_NORMAL_SMS;
+ p_msg_info->folderId = MSG_INBOX_ID;
+ */
p_msg_info->msgType.classType = MSG_CLASS_NONE;
p_msg_info->networkStatus = MSG_NETWORK_RECEIVED;
p_msg_info->bRead = false;
@@ -317,7 +313,8 @@ void SmsPluginEventHandler::convertDeliverMsgToMsgInfo(sms_telesvc_deliver_s *p_
p_msg_info->direction = MSG_DIRECTION_TYPE_MT;
p_msg_info->bTextSms = true;
- if (p_deliver->callback_number.szData[0] != '\0') { // If callback number is in received pdu, replace the address value.
+ if (p_deliver->callback_number.szData[0] != '\0') {
+ /* If callback number is in received pdu, replace the address value. */
memset(p_msg_info->addressList[1].addressVal, 0x00, MAX_ADDRESS_VAL_LEN+1);
p_msg_info->addressList[1].addressType = MSG_ADDRESS_TYPE_UNKNOWN;
memcpy(p_msg_info->addressList[1].addressVal, p_deliver->callback_number.szData, MAX_ADDRESS_VAL_LEN);
@@ -327,7 +324,7 @@ void SmsPluginEventHandler::convertDeliverMsgToMsgInfo(sms_telesvc_deliver_s *p_
time_t rawtime = 0;
p_msg_info->storageId = MSG_STORAGE_PHONE;
-#if 0 // Save Timestamp of message center.
+#if 0 /* Save Timestamp of message center. */
char displayTime[32];
struct tm * timeTM;
@@ -400,28 +397,24 @@ void SmsPluginEventHandler::convertDeliverMsgToMsgInfo(sms_telesvc_deliver_s *p_
p_msg_info->dataSize = strlen(p_msg_info->msgData);
return;
} else {
- if(p_msg_info->encodeType == MSG_ENCODE_UCS2) {
+ if (p_msg_info->encodeType == MSG_ENCODE_UCS2) {
MSG_DEBUG("Encode Type = UCS2");
MsgTextConvert *textCvt = MsgTextConvert::instance();
p_msg_info->dataSize = textCvt->convertUCS2ToUTF8((unsigned char*)&p_msg_info->msgText, MAX_MSG_TEXT_LEN, (unsigned char*)&p_deliver->user_data.user_data, p_deliver->user_data.data_len);
- }
- else if(p_msg_info->encodeType == MSG_ENCODE_EUCKR) {
+ } else if (p_msg_info->encodeType == MSG_ENCODE_EUCKR) {
MSG_DEBUG("Encode Type = EUCKR");
MsgTextConvert *textCvt = MsgTextConvert::instance();
p_msg_info->dataSize = textCvt->convertEUCKRToUTF8((unsigned char*)&p_msg_info->msgText, MAX_MSG_TEXT_LEN, (unsigned char*)&p_deliver->user_data.user_data, p_deliver->user_data.data_len);
- }
- else if(p_msg_info->encodeType == MSG_ENCODE_SHIFT_JIS) {
+ } else if (p_msg_info->encodeType == MSG_ENCODE_SHIFT_JIS) {
MSG_DEBUG("Encode Type = Shift-JIS");
MsgTextConvert *textCvt = MsgTextConvert::instance();
p_msg_info->dataSize = textCvt->convertSHIFTJISToUTF8((unsigned char*)&p_msg_info->msgText, MAX_MSG_TEXT_LEN, (unsigned char*)&p_deliver->user_data.user_data, p_deliver->user_data.data_len);
- }
- else if(p_msg_info->encodeType == MSG_ENCODE_GSM7BIT) {
+ } else if (p_msg_info->encodeType == MSG_ENCODE_GSM7BIT) {
MSG_DEBUG("Encode Type = GSM7BIT");
MSG_LANG_INFO_S langinfo = {0,};
MsgTextConvert *textCvt = MsgTextConvert::instance();
p_msg_info->dataSize = textCvt->convertGSM7bitToUTF8((unsigned char*)&p_msg_info->msgText, MAX_MSG_TEXT_LEN, (unsigned char*)&p_deliver->user_data.user_data, p_deliver->user_data.data_len, &langinfo);
- }
- else {
+ } else {
snprintf(p_msg_info->msgText, sizeof(p_msg_info->msgText), "%s", p_deliver->user_data.user_data);
p_msg_info->dataSize = p_deliver->user_data.data_len;
}
@@ -459,7 +452,7 @@ void SmsPluginEventHandler::handleSentStatus(msg_network_status_t NetStatus)
MSG_DEBUG("NetStatus[%d]", NetStatus);
if (sentInfo.bLast == true || NetStatus != MSG_NETWORK_SEND_SUCCESS) {
- /** Update Msg Status */
+ /* Update Msg Status */
if (sentInfo.reqInfo.msgInfo.msgPort.valid == false) {
sentInfo.reqInfo.msgInfo.networkStatus = NetStatus;
@@ -477,12 +470,12 @@ void SmsPluginEventHandler::handleSentStatus(msg_network_status_t NetStatus)
MSG_DEBUG("sentInfo.reqInfo.sendOptInfo.bSetting [%d]", sentInfo.reqInfo.sendOptInfo.bSetting);
MSG_DEBUG("sentInfo.reqInfo.sendOptInfo.bKeepCopy [%d]", sentInfo.reqInfo.sendOptInfo.bKeepCopy);
- /** Check sending options */
+ /* Check sending options */
if (sentInfo.reqInfo.sendOptInfo.bSetting && !sentInfo.reqInfo.sendOptInfo.bKeepCopy && NetStatus == MSG_NETWORK_SEND_SUCCESS) {
callbackStorageChange(MSG_STORAGE_CHANGE_DELETE, &(sentInfo.reqInfo.msgInfo));
}
- /** Callback to MSG FW */
+ /* Callback to MSG FW */
MSG_SENT_STATUS_S msgStatus;
msgStatus.reqId = sentInfo.reqInfo.reqId;
@@ -499,16 +492,16 @@ void SmsPluginEventHandler::handleSentStatus(msg_network_status_t NetStatus)
void SmsPluginEventHandler::handleMsgIncoming(sms_trans_p2p_msg_s *p_p2p_msg)
{
- /** Make MSG_MESSAGE_INFO_S */
+ /* Make MSG_MESSAGE_INFO_S */
MSG_MESSAGE_INFO_S msgInfo;
- /** initialize msgInfo */
+ /* initialize msgInfo */
memset(&msgInfo, 0x00, sizeof(MSG_MESSAGE_INFO_S));
msgInfo.addressList = NULL;
unique_ptr<MSG_ADDRESS_INFO_S*, void(*)(MSG_ADDRESS_INFO_S**)> addressListBuf(&msgInfo.addressList, unique_ptr_deleter);
- /** convert to msgInfo */
+ /* convert to msgInfo */
convertTpduToMsginfo(p_p2p_msg, &msgInfo);
if (p_p2p_msg->telesvc_id == SMS_TRANS_TELESVC_RESERVED) {
@@ -517,7 +510,7 @@ void SmsPluginEventHandler::handleMsgIncoming(sms_trans_p2p_msg_s *p_p2p_msg)
return;
}
- /** Check for Voice Mail Notification */
+ /* Check for Voice Mail Notification */
if (p_p2p_msg->telesvc_id == SMS_TRANS_TELESVC_VMN_95) {
if (p_p2p_msg->telesvc_msg.data.deliver.enhanced_vmn.fax_included)
msgInfo.msgType.subType = MSG_MWI_FAX_SMS;
@@ -529,7 +522,7 @@ void SmsPluginEventHandler::handleMsgIncoming(sms_trans_p2p_msg_s *p_p2p_msg)
int voice_cnt = MsgSettingGetInt(VOICEMAIL_COUNT);
- // repeated msg check for voicemail
+ /* repeated msg check for voicemail */
if (voice_cnt == p_p2p_msg->telesvc_msg.data.deliver.num_msg) {
SmsPluginTransport::instance()->sendDeliverReport(MSG_SUCCESS, p_p2p_msg);
return;
@@ -541,9 +534,8 @@ void SmsPluginEventHandler::handleMsgIncoming(sms_trans_p2p_msg_s *p_p2p_msg)
snprintf(msgInfo.msgText, sizeof(msgInfo.msgText), "%d", p_p2p_msg->telesvc_msg.data.deliver.num_msg);
msgInfo.dataSize = strlen(msgInfo.msgText);
- }
- /** Check for EMS(Unsupported) */
- else if (p_p2p_msg->telesvc_id == SMS_TRANS_TELESVC_WEMT) {
+ } else if (p_p2p_msg->telesvc_id == SMS_TRANS_TELESVC_WEMT) {
+ /* Check for EMS(Unsupported) */
char *msg_text = getTranslateText(MSG_APP_PACKAGE_NAME, MSG_APP_LOCALEDIR, "IDS_MSGF_POP_ERROR_UNSUPPORTED_MSG");
memset(msgInfo.msgText, 0x00, sizeof(msgInfo.msgText));
snprintf(msgInfo.msgText, sizeof(msgInfo.msgText), "%s", msg_text);
@@ -555,7 +547,7 @@ void SmsPluginEventHandler::handleMsgIncoming(sms_trans_p2p_msg_s *p_p2p_msg)
}
}
- /** Print MSG_MESSAGE_INFO_S */
+ /* Print MSG_MESSAGE_INFO_S */
MSG_DEBUG("############# Convert tpdu values to Message Info values ####################");
MSG_DEBUG("msgInfo.nAddressCnt : %d", msgInfo.nAddressCnt);
MSG_DEBUG("msgInfo.addressList[0].addressType : %d", msgInfo.addressList[0].addressType);
@@ -589,19 +581,21 @@ void SmsPluginEventHandler::handleMsgIncoming(sms_trans_p2p_msg_s *p_p2p_msg)
memset(&unq_ind, 0x00, sizeof(MSG_UNIQUE_INDEX_S));
if (msgInfo.msgType.subType == MSG_STATUS_REPORT_SMS) {
-// /** Status Report Message */
-// err = SmsPluginStorage::instance()->updateMsgDeliverStatus(&msgInfo, pTpdu->data.statusRep.msgRef);
-//
-// if (err == MSG_SUCCESS)
-// err = listener.pfMsgIncomingCb(&msgInfo);
-// else
-// MSG_DEBUG("updateMsgDeliverStatus is failed [%d]", err);
-//
-// /** Handling of Fail Case ?? */
-// SmsPluginTransport::instance()->sendDeliverReport(MSG_SUCCESS);
- } else { /** SMS Deliver */
-
- /** Add message to DB */
+ /* Status Report Message */
+ /*
+ err = SmsPluginStorage::instance()->updateMsgDeliverStatus(&msgInfo, pTpdu->data.statusRep.msgRef);
+
+ if (err == MSG_SUCCESS)
+ err = listener.pfMsgIncomingCb(&msgInfo);
+ else
+ MSG_DEBUG("updateMsgDeliverStatus is failed [%d]", err);
+ */
+
+ /* Handling of Fail Case ?? */
+ /* SmsPluginTransport::instance()->sendDeliverReport(MSG_SUCCESS); */
+ } else { /* SMS Deliver */
+
+ /* Add message to DB */
if (msgInfo.msgPort.valid == false) {
if (p_p2p_msg->telesvc_id != SMS_TRANS_TELESVC_VMN_95) {
memcpy(unq_ind.address, p_p2p_msg->address.szData, sizeof(p_p2p_msg->address.szData));
@@ -618,13 +612,12 @@ void SmsPluginEventHandler::handleMsgIncoming(sms_trans_p2p_msg_s *p_p2p_msg)
if (isUnique) {
err = SmsPluginStorage::instance()->checkMessage(&msgInfo);
- }
- else {
+ } else {
SmsPluginTransport::instance()->sendDeliverReport(MSG_SUCCESS, p_p2p_msg);
return;
}
- /** Callback to MSG FW */
+ /* Callback to MSG FW */
if (err == MSG_SUCCESS) {
MSG_DEBUG("callback to msg fw");
err = listener.pfMsgIncomingCb(&msgInfo);
@@ -639,14 +632,14 @@ void SmsPluginEventHandler::handleMsgIncoming(sms_trans_p2p_msg_s *p_p2p_msg)
if (err == MSG_SUCCESS && p_p2p_msg->telesvc_id != SMS_TRANS_TELESVC_VMN_95)
listener.pfCheckUniquenessCb(&unq_ind, msgInfo.msgId, true);
- /** Send Deliver Report */
+ /* Send Deliver Report */
if (p_p2p_msg->telesvc_id == SMS_TRANS_TELESVC_WEMT) {
SmsPluginTransport::instance()->sendDeliverReport(MSG_ERR_INVALID_MSG_TYPE, p_p2p_msg);
} else {
SmsPluginTransport::instance()->sendDeliverReport(err, p_p2p_msg);
}
- // Tizen Validation System
+ /* Tizen Validation System */
char *msisdn = NULL;
char keyName[MAX_VCONFKEY_NAME_LEN];
int simIndex = 1;
@@ -681,20 +674,20 @@ void SmsPluginEventHandler::handleCbMsgIncoming(sms_trans_broadcast_msg_s *p_cb_
return;
}
- /** Make MSG_MESSAGE_INFO_S */
+ /* Make MSG_MESSAGE_INFO_S */
MSG_MESSAGE_INFO_S msgInfo;
- /** initialize msgInfo */
+ /* initialize msgInfo */
memset(&msgInfo, 0x00, sizeof(MSG_MESSAGE_INFO_S));
msgInfo.addressList = NULL;
unique_ptr<MSG_ADDRESS_INFO_S*, void(*)(MSG_ADDRESS_INFO_S**)> addressListBuf(&msgInfo.addressList, unique_ptr_deleter);
- /** convert to msgInfo */
+ /* convert to msgInfo */
convertTpduToMsginfo(p_cb_msg, &msgInfo);
msgInfo.msgId = p_cb_msg->telesvc_msg.data.deliver.msg_id.msg_id;
- /** Print MSG_MESSAGE_INFO_S */
+ /* Print MSG_MESSAGE_INFO_S */
MSG_DEBUG("############# Convert tpdu values to Message Info values ####################");
MSG_DEBUG("msgInfo.priority : %d", msgInfo.priority);
MSG_DEBUG("msgInfo.bProtected : %d", msgInfo.bProtected);
@@ -721,18 +714,17 @@ void SmsPluginEventHandler::handleCbMsgIncoming(sms_trans_broadcast_msg_s *p_cb_
msg_error_t err = MSG_SUCCESS;
- /** Add message to DB */
+ /* Add message to DB */
if (msgInfo.msgPort.valid == false) {
err = SmsPluginStorage::instance()->checkMessage(&msgInfo);
}
- if (!checkCbOpt(p_cb_msg->svc_ctg))
- {
+ if (!checkCbOpt(p_cb_msg->svc_ctg)) {
MSG_DEBUG("The CB Msg is not supported by option.");
return;
}
- /** Callback to MSG FW */
+ /* Callback to MSG FW */
if (err == MSG_SUCCESS) {
#if 1
@@ -740,49 +732,46 @@ void SmsPluginEventHandler::handleCbMsgIncoming(sms_trans_broadcast_msg_s *p_cb_
bool is_duplicate = false;
switch (p_cb_msg->svc_ctg) {
- case SMS_TRANS_SVC_CTG_CMAS_PRESIDENTIAL :
- msgInfo.msgType.subType = MSG_CMAS_PRESIDENTIAL;
- break;
- case SMS_TRANS_SVC_CTG_CMAS_EXTREME :
- msgInfo.msgType.subType = MSG_CMAS_EXTREME;
- break;
- case SMS_TRANS_SVC_CTG_CMAS_SEVERE :
- msgInfo.msgType.subType = MSG_CMAS_SEVERE;
- break;
- case SMS_TRANS_SVC_CTG_CMAS_AMBER :
- msgInfo.msgType.subType = MSG_CMAS_AMBER;
- break;
- case SMS_TRANS_SVC_CTG_CMAS_TEST :
- msgInfo.msgType.subType = MSG_CMAS_TEST;
- break;
- default :
- msgInfo.msgType.subType = MSG_CB_SMS;
- break;
+ case SMS_TRANS_SVC_CTG_CMAS_PRESIDENTIAL :
+ msgInfo.msgType.subType = MSG_CMAS_PRESIDENTIAL;
+ break;
+ case SMS_TRANS_SVC_CTG_CMAS_EXTREME :
+ msgInfo.msgType.subType = MSG_CMAS_EXTREME;
+ break;
+ case SMS_TRANS_SVC_CTG_CMAS_SEVERE :
+ msgInfo.msgType.subType = MSG_CMAS_SEVERE;
+ break;
+ case SMS_TRANS_SVC_CTG_CMAS_AMBER :
+ msgInfo.msgType.subType = MSG_CMAS_AMBER;
+ break;
+ case SMS_TRANS_SVC_CTG_CMAS_TEST :
+ msgInfo.msgType.subType = MSG_CMAS_TEST;
+ break;
+ default :
+ msgInfo.msgType.subType = MSG_CB_SMS;
+ break;
}
cbOutMsg.type = msgInfo.msgType.subType;
cbOutMsg.receivedTime = msgInfo.displayTime;
- cbOutMsg.serialNum = 0;//encodeCbSerialNum (CbMsgPage.pageHeader.serialNum);
+ /* encodeCbSerialNum (CbMsgPage.pageHeader.serialNum); */
+ cbOutMsg.serialNum = 0;
cbOutMsg.messageId = msgInfo.msgId;
-// cbOutMsg.dcs = CbMsgPage.pageHeader.dcs.rawData;
+ /* cbOutMsg.dcs = CbMsgPage.pageHeader.dcs.rawData; */
memset (cbOutMsg.cbText, 0x00, sizeof(cbOutMsg.cbText));
cbOutMsg.cbTextLen= msgInfo.dataSize;
memset(cbOutMsg.language_type, 0x00, sizeof(cbOutMsg.language_type));
-// memcpy(cbOutMsg.language_type, CbMsgPage.pageHeader.dcs.iso639Lang, 3);
+ /* memcpy(cbOutMsg.language_type, CbMsgPage.pageHeader.dcs.iso639Lang, 3); */
- if (!is_duplicate)
- {
+ if (!is_duplicate) {
MSG_DEBUG("callback to msg fw");
err = listener.pfCBMsgIncomingCb(&cbOutMsg, &msgInfo);
- if (err != MSG_SUCCESS)
- {
+ if (err != MSG_SUCCESS) {
MSG_WARN("callbackMsgIncoming() Error !! [%d]", err);
}
- }
- else
- {
+ } else {
MSG_WARN("duplicate cb serialNum[%d] messageId[%d]", cbOutMsg.serialNum, cbOutMsg.messageId);
}
@@ -791,10 +780,10 @@ void SmsPluginEventHandler::handleCbMsgIncoming(sms_trans_broadcast_msg_s *p_cb_
#endif
}
- /** Send Deliver Report */
-// SmsPluginTransport::instance()->sendDeliverReport(err, p_cb_msg);
+ /* Send Deliver Report */
+ /* SmsPluginTransport::instance()->sendDeliverReport(err, p_cb_msg); */
- // Tizen Validation System
+ /* Tizen Validation System */
char *msisdn = NULL;
char keyName[MAX_VCONFKEY_NAME_LEN];
int simIndex = 1;
@@ -879,8 +868,7 @@ void SmsPluginEventHandler::handleWapMsgIncoming(sms_trans_p2p_msg_s *p_p2p_msg)
((pTmpUserData[6] << 8 | pTmpUserData[7]) == 0x0b84)) {
dataSize -= 8;
memcpy(pUserData, &pTmpUserData[8], dataSize);
- }
- else {
+ } else {
dataSize -= 4;
memcpy(pUserData, &pTmpUserData[4], dataSize);
}
@@ -895,13 +883,12 @@ void SmsPluginEventHandler::handleWapMsgIncoming(sms_trans_p2p_msg_s *p_p2p_msg)
msgInfo.msgType.mainType = MSG_SMS_TYPE;
SmsPluginWapPushHandler::instance()->copyDeliverData(&(p_p2p_msg->address));
SmsPluginWapPushHandler::instance()->handleWapPushMsg(pUserData, dataSize);
- }
- else {
+ } else {
MSG_DEBUG("not supported wap push port [%x]", dstPort);
}
}
- // remove from waplist
+ /* remove from waplist */
for (int index = wapList.size()-1; index >= 0 ; index--) {
if (wapList[index].msgId == msg.msgId) {
MSG_DEBUG("remove waplist of the index [%d]", index);
@@ -911,7 +898,7 @@ void SmsPluginEventHandler::handleWapMsgIncoming(sms_trans_p2p_msg_s *p_p2p_msg)
}
}
- /** Send Deliver Report */
+ /* Send Deliver Report */
SmsPluginTransport::instance()->sendDeliverReport(MSG_SUCCESS, p_p2p_msg);
MSG_END();
@@ -930,7 +917,7 @@ msg_error_t SmsPluginEventHandler::callbackMsgIncoming(MSG_MESSAGE_INFO_S *pMsgI
msg_error_t err = MSG_SUCCESS;
- /** Callback to MSG FW */
+ /* Callback to MSG FW */
err = listener.pfMsgIncomingCb(pMsgInfo);
MSG_END();
@@ -941,7 +928,7 @@ msg_error_t SmsPluginEventHandler::callbackMsgIncoming(MSG_MESSAGE_INFO_S *pMsgI
msg_error_t SmsPluginEventHandler::callbackStorageChange(msg_storage_change_type_t storageChangeType, MSG_MESSAGE_INFO_S *pMsgInfo)
{
- /** Callback to MSG FW */
+ /* Callback to MSG FW */
listener.pfStorageChangeCb(storageChangeType, pMsgInfo);
return MSG_SUCCESS;
@@ -974,37 +961,42 @@ bool SmsPluginEventHandler::getDeviceStatus()
return devStatus;
}
+
void SmsPluginEventHandler::setNeedInitConfig(bool bNeeded)
{
bNeedInitConfig = bNeeded;
}
+
bool SmsPluginEventHandler::getNeedInitConfig()
{
return bNeedInitConfig;
}
+
msg_encode_type_t SmsPluginEventHandler::getEncodeType(sms_encoding_type_t encode_type)
{
- switch(encode_type) {
- case SMS_ENCODE_IA5 :
- case SMS_ENCODE_GSM7BIT :
- return MSG_ENCODE_GSM7BIT;
- case SMS_ENCODE_KOREAN :
- case SMS_ENCODE_EUCKR :
- return MSG_ENCODE_EUCKR;
- case SMS_ENCODE_7BIT_ASCII :
- case SMS_ENCODE_LATIN_HEBREW :
- case SMS_ENCODE_LATIN :
- case SMS_ENCODE_OCTET :
- return MSG_ENCODE_8BIT;
- case SMS_ENCODE_SHIFT_JIS :
- return MSG_ENCODE_SHIFT_JIS;
-// case SMS_ENCODE_EPM :
-// case SMS_ENCODE_UNICODE :
-// case SMS_ENCODE_GSMDCS :
- default :
- return MSG_ENCODE_UCS2;
+ switch (encode_type) {
+ case SMS_ENCODE_GSM7BIT:
+ return MSG_ENCODE_GSM7BIT;
+ case SMS_ENCODE_KOREAN:
+ case SMS_ENCODE_EUCKR:
+ return MSG_ENCODE_EUCKR;
+ case SMS_ENCODE_IA5:
+ case SMS_ENCODE_7BIT_ASCII:
+ case SMS_ENCODE_LATIN_HEBREW:
+ case SMS_ENCODE_LATIN:
+ case SMS_ENCODE_OCTET:
+ return MSG_ENCODE_8BIT;
+ case SMS_ENCODE_SHIFT_JIS:
+ return MSG_ENCODE_SHIFT_JIS;
+ /*
+ case SMS_ENCODE_EPM :
+ case SMS_ENCODE_UNICODE :
+ case SMS_ENCODE_GSMDCS :
+ */
+ default:
+ return MSG_ENCODE_UCS2;
}
return MSG_ENCODE_UCS2;
@@ -1045,7 +1037,7 @@ unsigned short SmsPluginEventHandler::checkWapMsg(sms_wap_msg_s *pMsg, sms_teles
}
}
- /** New Wap Push Msg */
+ /* New Wap Push Msg */
if (bFind == false) {
sms_wap_info_s tmpInfo;
tmpInfo.msgId = pMsg->msgId;
@@ -1113,7 +1105,7 @@ void SmsPluginEventHandler::handleSyncMLMsgIncoming(msg_syncml_message_type_t ms
memset(&syncMLData, 0x00, sizeof(MSG_SYNCML_MESSAGE_DATA_S));
- /** set syncML data */
+ /* set syncML data */
syncMLData.syncmlType = msgType;
syncMLData.pushBodyLen = PushBodyLen;
@@ -1122,7 +1114,7 @@ void SmsPluginEventHandler::handleSyncMLMsgIncoming(msg_syncml_message_type_t ms
syncMLData.wspHeaderLen= WspHeaderLen;
memcpy(syncMLData.wspHeader, pWspHeader, WspHeaderLen);
- /** Callback to MSG FW */
+ /* Callback to MSG FW */
listener.pfSyncMLMsgIncomingCb(&syncMLData);
}
@@ -1133,13 +1125,13 @@ void SmsPluginEventHandler::handleLBSMsgIncoming(char* pPushHeader, char* pPushB
memset(&lBSData, 0x00, sizeof(MSG_LBS_MESSAGE_DATA_S));
- /** set LBA data */
+ /* set LBA data */
memcpy(lBSData.pushHeader, pPushHeader, strlen(pPushHeader));
lBSData.pushBodyLen = pushBodyLen;
memcpy(lBSData.pushBody, pPushBody, pushBodyLen);
- /** Callback to MSG FW */
+ /* Callback to MSG FW */
listener.pfLBSMsgIncomingCb(&lBSData);
}
@@ -1150,7 +1142,7 @@ void SmsPluginEventHandler::handlePushMsgIncoming(char* pPushHeader, char* pPush
memset(&pushData, 0x00, sizeof(MSG_PUSH_MESSAGE_DATA_S));
- /** set PUSH data */
+ /* set PUSH data */
memcpy(pushData.pushHeader, pPushHeader, strlen(pPushHeader));
pushData.pushBodyLen = pushBodyLen;
@@ -1159,7 +1151,7 @@ void SmsPluginEventHandler::handlePushMsgIncoming(char* pPushHeader, char* pPush
memcpy(pushData.pushAppId, application_id, MAX_WAPPUSH_ID_LEN);
memcpy(pushData.pushContentType, content_type, MAX_WAPPUSH_CONTENT_TYPE_LEN);
- /** Callback to MSG FW */
+ /* Callback to MSG FW */
listener.pfPushMsgIncomingCb(&pushData);
}
@@ -1167,11 +1159,15 @@ void SmsPluginEventHandler::handlePushMsgIncoming(char* pPushHeader, char* pPush
bool SmsPluginEventHandler::checkCbOpt(sms_trans_svc_ctg_t svc_ctg)
{
bool bReceive = false;
- MsgSettingGetBool(CB_RECEIVE, &bReceive);
+ char keyName[MAX_VCONFKEY_NAME_LEN] = {0, };
+ int sim_idx = 1;
+
+ memset(keyName, 0x00, sizeof(keyName));
+ snprintf(keyName, sizeof(keyName), "%s/%d", CB_RECEIVE, sim_idx);
+ MsgSettingGetBool(keyName, &bReceive);
- // Receive CB Msg = FALSE
- if (!bReceive)
- {
+ /* Receive CB Msg = FALSE */
+ if (!bReceive) {
MSG_DEBUG("RECEIVE CB = FALSE");
return false;
}
@@ -1189,13 +1185,11 @@ bool SmsPluginEventHandler::checkCbOpt(sms_trans_svc_ctg_t svc_ctg)
return false;
}
- for (int i = 0; i < cbChannelInfo.channelCnt; i++)
- {
+ for (int i = 0; i < cbChannelInfo.channelCnt; i++) {
bActivate = cbChannelInfo.channelInfo[i].bActivate;
Category = cbChannelInfo.channelInfo[i].ctg;
- if (bActivate == true && svc_ctg == Category)
- {
+ if (bActivate == true && svc_ctg == Category) {
MSG_DEBUG("FIND CHANNEL = [%d]", svc_ctg);
return true;
}
diff --git a/plugin/sms_cdma_plugin/SmsCdmaPluginMain.cpp b/plugin/sms_cdma_plugin/SmsCdmaPluginMain.cpp
index f597b7d..fb4d7e2 100755
--- a/plugin/sms_cdma_plugin/SmsCdmaPluginMain.cpp
+++ b/plugin/sms_cdma_plugin/SmsCdmaPluginMain.cpp
@@ -70,15 +70,13 @@ static void MsgTapiInitCB(keynode_t *key, void* data)
mx.unlock();
}
+
msg_error_t MsgPlgCreateHandle(MSG_PLUGIN_HANDLER_S *pPluginHandle)
{
- if (pPluginHandle == NULL)
- {
+ if (pPluginHandle == NULL) {
MSG_DEBUG("SMS plugin: create handler error ");
return MSG_ERR_NULL_POINTER;
- }
- else
- {
+ } else {
pPluginHandle->pfInitialize = SmsPlgInitialize;
pPluginHandle->pfFinalize = SmsPlgFinalize;
pPluginHandle->pfRegisterListener = SmsPlgRegisterListener;
@@ -101,8 +99,7 @@ msg_error_t MsgPlgCreateHandle(MSG_PLUGIN_HANDLER_S *pPluginHandle)
msg_error_t MsgPlgDestroyHandle(MSG_PLUGIN_HANDLER_S *pPluginHandle)
{
- if (pPluginHandle != NULL)
- {
+ if (pPluginHandle != NULL) {
free(pPluginHandle);
pPluginHandle = NULL;
}
@@ -123,7 +120,7 @@ msg_error_t SmsPlgInitialize()
MsgSettingGetBool(VCONFKEY_TELEPHONY_READY, &bReady);
MSG_DEBUG("Get VCONFKEY_TELEPHONY_READY [%d].", bReady ? 1 : 0);
- if(bReady)
+ if (bReady)
break;
sleep(1);
@@ -137,14 +134,14 @@ msg_error_t SmsPlgInitialize()
pTapiHandle = tel_init(NULL);
if (pTapiHandle) {
- // register event.
+ /* register event. */
SmsPluginCallback::instance()->registerEvent();
- // set sim change status.
+ /* set sim change status. */
MSG_DEBUG("Try to initialize SIM on init");
SmsPluginSetting::instance()->setSimChangeStatus();
- // set resource monitor
+ /* set resource monitor */
MsgResourceMonitorInit();
}
@@ -189,7 +186,7 @@ msg_error_t SmsPlgSubmitRequest(MSG_REQUEST_INFO_S *pReqInfo)
{
msg_error_t err = MSG_SUCCESS;
- // Add Submit SMS into DB
+ /* Add Submit SMS into DB */
if (pReqInfo->msgInfo.msgId == 0) {
if (pReqInfo->msgInfo.msgPort.valid == false) {
@@ -213,19 +210,19 @@ msg_error_t SmsPlgSubmitRequest(MSG_REQUEST_INFO_S *pReqInfo)
}
}
- // Check SIM is present or not
-// MSG_SIM_STATUS_T simStatus = (MSG_SIM_STATUS_T)MsgSettingGetInt(MSG_SIM_CHANGED);
-//
-// if (simStatus == MSG_SIM_STATUS_NOT_FOUND)
-// {
-// MSG_DEBUG("SIM is not present..");
-//
-// // Update Msg Status
-// if (pReqInfo->msgInfo.msgPort.valid == false)
-// SmsPluginStorage::instance()->updateSentMsg(&(pReqInfo->msgInfo), MSG_NETWORK_SEND_FAIL);
-//
-// return MSG_ERR_NO_SIM;
-// }
+ /* Check SIM is present or not */
+ /*
+ MSG_SIM_STATUS_T simStatus = (MSG_SIM_STATUS_T)MsgSettingGetInt(MSG_SIM_CHANGED);
+
+ if (simStatus == MSG_SIM_STATUS_NOT_FOUND) {
+ MSG_DEBUG("SIM is not present..");
+
+ if (pReqInfo->msgInfo.msgPort.valid == false)
+ SmsPluginStorage::instance()->updateSentMsg(&(pReqInfo->msgInfo), MSG_NETWORK_SEND_FAIL);
+
+ return MSG_ERR_NO_SIM;
+ }
+ */
sms_request_info_s *request = NULL;
@@ -275,8 +272,7 @@ msg_error_t SmsPlgSetMemoryStatus(msg_error_t Error)
int tapiRet = TAPI_API_SUCCESS;
int status = TAPI_NETTEXT_PDA_MEMORY_STATUS_AVAILABLE;
- if (Error == MSG_ERR_SIM_STORAGE_FULL || Error == MSG_ERR_MESSAGE_COUNT_FULL)
- {
+ if (Error == MSG_ERR_SIM_STORAGE_FULL || Error == MSG_ERR_MESSAGE_COUNT_FULL) {
status = TAPI_NETTEXT_PDA_MEMORY_STATUS_FULL;
}
@@ -284,12 +280,9 @@ msg_error_t SmsPlgSetMemoryStatus(msg_error_t Error)
tapiRet = tel_set_sms_memory_status(pTapiHandle, status, TapiEventMemoryStatus, NULL);
- if (tapiRet == TAPI_API_SUCCESS)
- {
+ if (tapiRet == TAPI_API_SUCCESS) {
MSG_DEBUG("######## tel_set_sms_memory_status() Success !!! #######");
- }
- else
- {
+ } else {
MSG_DEBUG("######## tel_set_sms_memory_status() Success !!! return : [%d] #######", tapiRet);
}
@@ -299,17 +292,12 @@ msg_error_t SmsPlgSetMemoryStatus(msg_error_t Error)
msg_error_t SmsPlgSetConfigData(const MSG_SETTING_S *pSetting)
{
- try
- {
+ try {
SmsPluginSetting::instance()->setConfigData(pSetting);
- }
- catch (MsgException& e)
- {
+ } catch (MsgException& e) {
MSG_FATAL("%s", e.what());
return MSG_ERR_PLUGIN_SETTING;
- }
- catch (exception& e)
- {
+ } catch (exception& e) {
MSG_FATAL("%s", e.what());
return MSG_ERR_PLUGIN_SETTING;
}
@@ -320,17 +308,12 @@ msg_error_t SmsPlgSetConfigData(const MSG_SETTING_S *pSetting)
msg_error_t SmsPlgGetConfigData(MSG_SETTING_S *pSetting)
{
- try
- {
+ try {
SmsPluginSetting::instance()->getConfigData(pSetting);
- }
- catch (MsgException& e)
- {
+ } catch (MsgException& e) {
MSG_FATAL("%s", e.what());
return MSG_ERR_PLUGIN_SETTING;
- }
- catch (exception& e)
- {
+ } catch (exception& e) {
MSG_FATAL("%s", e.what());
return MSG_ERR_PLUGIN_SETTING;
}
@@ -345,6 +328,7 @@ msg_error_t SmsPlgAddMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_
return MSG_SUCCESS;
}
+
static void on_change_received(GDBusConnection *connection, const gchar *sender_name,
const gchar *object_path, const gchar *interface_name, const gchar *signal_name,
GVariant *parameters, gpointer user_data)
@@ -355,12 +339,13 @@ static void on_change_received(GDBusConnection *connection, const gchar *sender_
gint memStatus;
g_variant_get(parameters, "(i)", &memStatus);
MSG_DEBUG("memStatus = [%d]", memStatus);
- if(memStatus == 0) {
+ if (memStatus == 0) {
SmsPlgSetMemoryStatus(MSG_SUCCESS);
}
}
}
+
void MsgResourceMonitorInit(void)
{
MSG_BEGIN();
@@ -415,7 +400,6 @@ _DBUS_ERROR:
MSG_END();
return;
-
}
diff --git a/plugin/sms_cdma_plugin/SmsCdmaPluginParamCodec.cpp b/plugin/sms_cdma_plugin/SmsCdmaPluginParamCodec.cpp
index 274cf6d..9f9cb0f 100755
--- a/plugin/sms_cdma_plugin/SmsCdmaPluginParamCodec.cpp
+++ b/plugin/sms_cdma_plugin/SmsCdmaPluginParamCodec.cpp
@@ -39,6 +39,7 @@ SmsPluginParamCodec::~SmsPluginParamCodec()
}
+
SmsPluginParamCodec* SmsPluginParamCodec::instance()
{
if (!pInstance)
@@ -80,6 +81,7 @@ int SmsPluginParamCodec::convertDigitToBcd(char *pDigit, int DigitLen, unsigned
return offset;
}
+
int SmsPluginParamCodec::convertBcdToDigit(const unsigned char *pBcd, int BcdLen, char *pDigit)
{
int offset = 0;
@@ -119,6 +121,7 @@ int SmsPluginParamCodec::convertBcdToDigit(const unsigned char *pBcd, int BcdLen
return offset;
}
+
int SmsPluginParamCodec::convertDigitToDTMF(const char *pDigit, int DigitLen, int startBit, unsigned char *pDtmf)
{
int shift = startBit;
@@ -171,6 +174,7 @@ int SmsPluginParamCodec::convertDigitToDTMF(const char *pDigit, int DigitLen, in
return offset;
}
+
int SmsPluginParamCodec::convertDTMFToDigit(const unsigned char *pDtmf, int DtmfLen, int startBit, char *pDigit)
{
int shift = startBit;
@@ -220,6 +224,7 @@ int SmsPluginParamCodec::convertDTMFToDigit(const unsigned char *pDtmf, int Dtmf
return offset;
}
+
bool SmsPluginParamCodec::isDtmfNumber(const char *pDigit, int DigitLen)
{
bool isDtmf = true;
@@ -235,6 +240,3 @@ bool SmsPluginParamCodec::isDtmfNumber(const char *pDigit, int DigitLen)
return isDtmf;
}
-
-
-
diff --git a/plugin/sms_cdma_plugin/SmsCdmaPluginSetting.cpp b/plugin/sms_cdma_plugin/SmsCdmaPluginSetting.cpp
index c4f4b08..ef594c5 100755
--- a/plugin/sms_cdma_plugin/SmsCdmaPluginSetting.cpp
+++ b/plugin/sms_cdma_plugin/SmsCdmaPluginSetting.cpp
@@ -55,7 +55,7 @@ SmsPluginSetting* SmsPluginSetting::pInstance = NULL;
SmsPluginSetting::SmsPluginSetting()
{
- // Initialize member variables
+ /* Initialize member variables */
memset(&cbOpt, 0x00, sizeof(MSG_CBMSG_OPT_S));
memset(&meImei, 0x00, sizeof(meImei));
@@ -86,11 +86,11 @@ void* SmsPluginSetting::initSimInfo(void *data)
int tapiRet = TAPI_API_SUCCESS;
- // Get IMSI
+ /* Get IMSI */
char imsi[17];
memset(imsi, 0x00, sizeof(imsi));
- // Get IMSI
+ /* Get IMSI */
TelSimImsiInfo_t imsiInfo;
memset(&imsiInfo, 0x00, sizeof(TelSimImsiInfo_t));
@@ -112,6 +112,7 @@ void* SmsPluginSetting::initSimInfo(void *data)
return NULL;
}
+
void SmsPluginSetting::updateSimStatus()
{
MSG_BEGIN();
@@ -145,7 +146,7 @@ void SmsPluginSetting::updateSimStatus()
}
}
- // init config data.
+ /* init config data. */
initConfigData();
MSG_END();
@@ -160,7 +161,7 @@ void SmsPluginSetting::setSimChangeStatus()
pthread_t thd;
- if(pthread_create(&thd, NULL, &initSimInfo, NULL) < 0) {
+ if (pthread_create(&thd, NULL, &initSimInfo, NULL) < 0) {
MSG_DEBUG("pthread_create() error");
}
@@ -170,19 +171,19 @@ void SmsPluginSetting::setSimChangeStatus()
}
-
void SmsPluginSetting::initConfigData()
{
MSG_BEGIN();
msg_error_t err = MSG_SUCCESS;
+ char keyName[MAX_VCONFKEY_NAME_LEN];
+ int sim_idx = 1;
-#if 1
/*==================== CB configuration ====================*/
-// if (simStatus != MSG_SIM_STATUS_NOT_FOUND)
-// {
-// MSG_DEBUG("simStatus == [%d]", simStatus);
-
+ /*
+ if (simStatus != MSG_SIM_STATUS_NOT_FOUND) {
+ MSG_DEBUG("simStatus == [%d]", simStatus);
+ */
MSG_CBMSG_OPT_S cbMsgOpt = {0,};
if (getCbConfig(&cbMsgOpt) == true) {
@@ -199,22 +200,6 @@ void SmsPluginSetting::initConfigData()
}
} else {
MSG_DEBUG("######## getCbConfig Fail !!! #######");
-#endif
-
-#if 0
- // CSC doesn't support CB Info any longer
- if (MsgCscGetCBInfo(&cbMsgOpt) == true) {
- err = addCbOpt(&cbMsgOpt);
-
- if (err == MSG_SUCCESS) {
- MSG_DEBUG("######## Add CB Option From CSC Success !!! #######");
- } else {
- MSG_DEBUG("######## Add CB Option from CSC Fail !!! return : %d #######", err);
- }
- } else {
- MSG_DEBUG("######## MsgCscGetCBInfo Fail !!! #######");
- }
-#endif
}
/*==================== MSISDN update ====================*/
@@ -223,37 +208,21 @@ void SmsPluginSetting::initConfigData()
} else {
MSG_DEBUG("######## getMsisdnInfo Fail !!! #######");
}
-#if 1
- /*==================== Default Voice mail Setting ====================*/
- char *num = MsgSettingGetString(VOICEMAIL_DEFAULT_NUMBER);
-
- if (num) {
- MSG_DEBUG("Voicemail Default Number [%s]", num);
- if (MsgSettingSetString(VOICEMAIL_NUMBER, num) != MSG_SUCCESS)
- MSG_DEBUG("MsgSettingSetInt is failed!!");
- free(num);
- num = NULL;
- }
- else {
- MSG_DEBUG("Voicemail Default Number is NULL");
- if (MsgSettingSetString(VOICEMAIL_NUMBER, "") != MSG_SUCCESS)
- MSG_DEBUG("MsgSettingSetInt is failed!!");
- }
-
- char *voiceNumber = MsgSettingGetString(VOICEMAIL_NUMBER);
- if (!voiceNumber || (voiceNumber && voiceNumber[0] == '\0')) {
- MSG_DEBUG("Voice Number is Empty");
- }
+ /*==================== Default Voice mail Setting ====================*/
+ MSG_DEBUG("Voicemail Default Number is NULL");
+ memset(keyName, 0x00, sizeof(keyName));
+ snprintf(keyName, sizeof(keyName), "%s/%d", VOICEMAIL_NUMBER, sim_idx);
+ if (MsgSettingSetString(keyName, VOICEMAIL_DEFAULT_NUMBER) != MSG_SUCCESS)
+ MSG_DEBUG("Error to set config data [%s]", keyName);
- if (voiceNumber) {
- free(voiceNumber);
- voiceNumber = NULL;
- }
+ memset(keyName, 0x00, sizeof(keyName));
+ snprintf(keyName, sizeof(keyName), "%s/%d", VOICEMAIL_NUMBER, sim_idx);
- if (MsgSettingSetString(VOICEMAIL_ALPHA_ID, VOICEMAIL_DEFAULT_ALPHA_ID) != MSG_SUCCESS)
- MSG_DEBUG("MsgSettingSetString is failed!!");
-#endif
+ memset(keyName, 0x00, sizeof(keyName));
+ snprintf(keyName, sizeof(keyName), "%s/%d", VOICEMAIL_ALPHA_ID, sim_idx);
+ if (MsgSettingSetString(keyName, VOICEMAIL_DEFAULT_ALPHA_ID) != MSG_SUCCESS)
+ MSG_DEBUG("Error to set config data [%s]", keyName);
MSG_END();
}
@@ -263,7 +232,7 @@ void SmsPluginSetting::SimRefreshCb()
{
pthread_t thd;
- if(pthread_create(&thd, NULL, &init_config_data, NULL) < 0) {
+ if (pthread_create(&thd, NULL, &init_config_data, NULL) < 0) {
MSG_DEBUG("pthread_create() error");
}
@@ -283,26 +252,25 @@ void SmsPluginSetting::setConfigData(const MSG_SETTING_S *pSetting)
{
MSG_DEBUG("Setting Type : [%d]", pSetting->type);
- switch (pSetting->type)
- {
+ switch (pSetting->type) {
#if 0
- case MSG_SMS_SENDOPT :
- setNetworkMode(&pSetting->option.smsSendOpt);
- break;
- case MSG_SMSC_LIST :
- setParamList(&pSetting->option.smscList);
- break;
+ case MSG_SMS_SENDOPT :
+ setNetworkMode(&pSetting->option.smsSendOpt);
+ break;
+ case MSG_SMSC_LIST :
+ setParamList(&pSetting->option.smscList);
+ break;
#endif
- case MSG_VOICEMAIL_OPT:
- setVoiceMailInfo(&pSetting->option.voiceMailOpt);
- break;
-
- case MSG_CBMSG_OPT :
- setCbConfig(&pSetting->option.cbMsgOpt);
- break;
- default :
- THROW(MsgException::SMS_PLG_ERROR, "The Setting type is not supported. [%d]", pSetting->type);
- break;
+ case MSG_VOICEMAIL_OPT:
+ setVoiceMailInfo(&pSetting->option.voiceMailOpt);
+ break;
+
+ case MSG_CBMSG_OPT :
+ setCbConfig(&pSetting->option.cbMsgOpt);
+ break;
+ default :
+ THROW(MsgException::SMS_PLG_ERROR, "The Setting type is not supported. [%d]", pSetting->type);
+ break;
}
}
@@ -311,20 +279,19 @@ void SmsPluginSetting::getConfigData(MSG_SETTING_S *pSetting)
{
MSG_DEBUG("Setting Type : [%d]", pSetting->type);
- switch (pSetting->type)
- {
+ switch (pSetting->type) {
#if 0
- case MSG_SMSC_LIST :
- getParamList(&pSetting->option.smscList);
- break;
+ case MSG_SMSC_LIST :
+ getParamList(&pSetting->option.smscList);
+ break;
#endif
- case MSG_CBMSG_OPT :
- getCbConfig(&pSetting->option.cbMsgOpt);
- break;
+ case MSG_CBMSG_OPT :
+ getCbConfig(&pSetting->option.cbMsgOpt);
+ break;
- default :
- THROW(MsgException::SMS_PLG_ERROR, "The Setting type is not supported. [%d]", pSetting->type);
- break;
+ default :
+ THROW(MsgException::SMS_PLG_ERROR, "The Setting type is not supported. [%d]", pSetting->type);
+ break;
}
}
@@ -333,17 +300,16 @@ msg_error_t SmsPluginSetting::addCbOpt(MSG_CBMSG_OPT_S *pCbOpt)
{
msg_error_t err = MSG_SUCCESS;
-// MSG_DEBUG("Receive [%d], Max SIM Count [%d]", pCbOpt->bReceive, pCbOpt->maxSimCnt);
+ /* MSG_DEBUG("Receive [%d], Max SIM Count [%d]", pCbOpt->bReceive, pCbOpt->maxSimCnt); */
MSG_DEBUG("Receive [%d], Channel Count [%d]", pCbOpt->bReceive, pCbOpt->channelData.channelCnt);
- for (int i = 0; i < pCbOpt->channelData.channelCnt; i++)
- {
+ for (int i = 0; i < pCbOpt->channelData.channelCnt; i++) {
MSG_DEBUG("Channel Category [%d], Channel Language [%d]", pCbOpt->channelData.channelInfo[i].ctg, pCbOpt->channelData.channelInfo[i].lang);
}
#if 0
- // Set Setting Data into Vconf
+ /* Set Setting Data into Vconf */
if (MsgSettingSetBool(CB_RECEIVE, pCbOpt->bReceive) != MSG_SUCCESS) {
MSG_DEBUG("Error to set config data [%s]", CB_RECEIVE);
return MSG_ERR_SET_SETTING;
@@ -379,7 +345,7 @@ void SmsPluginSetting::getCbOpt(MSG_SETTING_S *pSetting)
MsgSettingGetBool(CB_RECEIVE, &pSetting->option.cbMsgOpt.bReceive);
-// pSetting->option.cbMsgOpt.maxSimCnt = MsgSettingGetInt(CB_MAX_SIM_COUNT);
+ /* pSetting->option.cbMsgOpt.maxSimCnt = MsgSettingGetInt(CB_MAX_SIM_COUNT); */
err = MsgStoGetCBChannelInfo(&dbHandle, &pSetting->option.cbMsgOpt.channelData);
MSG_DEBUG("MsgStoAddCBChannelInfo : err=[%d]", err);
@@ -394,9 +360,9 @@ void SmsPluginSetting::getCbOpt(MSG_SETTING_S *pSetting)
MsgSettingGetBool(keyName, &pSetting->option.cbMsgOpt.bLanguage[i]);
}
#endif
-
}
+
void SmsPluginSetting::setVoiceMailInfo(const MSG_VOICEMAIL_OPT_S *pVoiceOpt)
{
bUpdateVoicemailByMdn = false;
@@ -404,6 +370,7 @@ void SmsPluginSetting::setVoiceMailInfo(const MSG_VOICEMAIL_OPT_S *pVoiceOpt)
return;
}
+
bool SmsPluginSetting::setCbConfig(const MSG_CBMSG_OPT_S *pCbOpt)
{
int ret = TAPI_API_SUCCESS;
@@ -413,7 +380,7 @@ bool SmsPluginSetting::setCbConfig(const MSG_CBMSG_OPT_S *pCbOpt)
cbConfig.CBEnabled = (int)pCbOpt->bReceive;
cbConfig.Net3gppType = TAPI_NETTEXT_NETTYPE_3GPP2;
-// cbConfig.MsgIdMaxCount = pCbOpt->maxSimCnt;
+ /* cbConfig.MsgIdMaxCount = pCbOpt->maxSimCnt; */
cbConfig.MsgIdRangeCount = pCbOpt->channelData.channelCnt;
for (int i = 0; i < cbConfig.MsgIdRangeCount; i++) {
@@ -602,23 +569,23 @@ void SmsPluginSetting::setMwiInfo(MSG_SUB_TYPE_T type, int count)
if (MsgSettingSetInt(VOICEMAIL_COUNT, count) != MSG_SUCCESS)
MSG_DEBUG("MsgSettingSetInt is failed!!");
+ /*
+ if (count == 0) {
+ MsgStoClearUniquenessTable();
+ }
-// if (count == 0) {
-// MsgStoClearUniquenessTable();
-// }
-
-// if(count <= 0) {
-// if (type == MSG_MWI_VOICE_SMS)
-// MsgCleanAndResetNotification(MSG_NOTI_TYPE_VOICE_1);
-// else if (type == MSG_MWI_VOICE2_SMS)
-// MsgCleanAndResetNotification(MSG_NOTI_TYPE_VOICE_2);
-// }
-
-// if (bMbdnEnable == false) {
-// MSG_DEBUG("MBDN service is disable.");
-// return;
-// }
+ if (count <= 0) {
+ if (type == MSG_MWI_VOICE_SMS)
+ MsgCleanAndResetNotification(MSG_NOTI_TYPE_VOICE_1);
+ else if (type == MSG_MWI_VOICE2_SMS)
+ MsgCleanAndResetNotification(MSG_NOTI_TYPE_VOICE_2);
+ }
+ if (bMbdnEnable == false) {
+ MSG_DEBUG("MBDN service is disable.");
+ return;
+ }
+ */
return;
}
diff --git a/plugin/sms_cdma_plugin/SmsCdmaPluginStorage.cpp b/plugin/sms_cdma_plugin/SmsCdmaPluginStorage.cpp
index dc0064c..582650c 100755
--- a/plugin/sms_cdma_plugin/SmsCdmaPluginStorage.cpp
+++ b/plugin/sms_cdma_plugin/SmsCdmaPluginStorage.cpp
@@ -119,7 +119,7 @@ msg_error_t SmsPluginStorage::updateMsgDeliverStatus(MSG_MESSAGE_INFO_S *pMsgInf
pMsgInfo->msgId = msgId;
- /** Update Status - MSG_MESSAGE_TABLE */
+ /* Update Status - MSG_MESSAGE_TABLE */
memset(sqlQuery, 0x00, sizeof(sqlQuery));
snprintf(sqlQuery, sizeof(sqlQuery), "SELECT * FROM %s WHERE MSG_ID = %d AND MSG_REF > 0;",
MSGFW_SMS_REPORT_TABLE_NAME, msgId);
@@ -141,7 +141,7 @@ msg_error_t SmsPluginStorage::updateMsgDeliverStatus(MSG_MESSAGE_INFO_S *pMsgInf
}
}
- /** Update Status - MSG_REPORT_TABLE */
+ /* Update Status - MSG_REPORT_TABLE */
if (pMsgInfo->networkStatus == MSG_NETWORK_DELIVER_SUCCESS) {
memset(sqlQuery, 0x00, sizeof(sqlQuery));
snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET MSG_REF = -1, STATUS = %d, TIME = %d WHERE MSG_ID = %d and ADDRESS_VAL = '%s';",
@@ -152,7 +152,7 @@ msg_error_t SmsPluginStorage::updateMsgDeliverStatus(MSG_MESSAGE_INFO_S *pMsgInf
MSG_DEBUG("Query Failed : [%s]", sqlQuery);
return MSG_ERR_DB_EXEC;
}
- } else if(pMsgInfo->networkStatus == MSG_NETWORK_DELIVER_EXPIRED) {
+ } else if (pMsgInfo->networkStatus == MSG_NETWORK_DELIVER_EXPIRED) {
memset(sqlQuery, 0x00, sizeof(sqlQuery));
snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET MSG_REF = -1, STATUS = %d, TIME = %d WHERE MSG_ID = %d and ADDRESS_VAL = '%s';",
MSGFW_SMS_REPORT_TABLE_NAME, 0, (int)pMsgInfo->displayTime, msgId, normalNum);
@@ -162,7 +162,7 @@ msg_error_t SmsPluginStorage::updateMsgDeliverStatus(MSG_MESSAGE_INFO_S *pMsgInf
MSG_DEBUG("Query Failed : [%s]", sqlQuery);
return MSG_ERR_DB_EXEC;
}
- } else if(pMsgInfo->networkStatus == MSG_NETWORK_DELIVER_PENDING) {
+ } else if (pMsgInfo->networkStatus == MSG_NETWORK_DELIVER_PENDING) {
memset(sqlQuery, 0x00, sizeof(sqlQuery));
snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET MSG_REF = -1, STATUS = %d, TIME = %d WHERE MSG_ID = %d and ADDRESS_VAL = '%s';",
MSGFW_SMS_REPORT_TABLE_NAME, 3, (int)pMsgInfo->displayTime, msgId, normalNum);
@@ -172,7 +172,7 @@ msg_error_t SmsPluginStorage::updateMsgDeliverStatus(MSG_MESSAGE_INFO_S *pMsgInf
MSG_DEBUG("Query Failed : [%s]", sqlQuery);
return MSG_ERR_DB_EXEC;
}
- } else if(pMsgInfo->networkStatus == MSG_NETWORK_DELIVER_FAIL) {
+ } else if (pMsgInfo->networkStatus == MSG_NETWORK_DELIVER_FAIL) {
memset(sqlQuery, 0x00, sizeof(sqlQuery));
snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET MSG_REF = -1, STATUS = %d, TIME = %d WHERE MSG_ID = %d and ADDRESS_VAL = '%s';",
MSGFW_SMS_REPORT_TABLE_NAME, 8, (int)pMsgInfo->displayTime, msgId, normalNum);
@@ -206,7 +206,7 @@ msg_error_t SmsPluginStorage::updateSentMsg(MSG_MESSAGE_INFO_S *pMsgInfo, msg_ne
MSG_DEBUG("Update Msg ID : [%d], Network Status : [%d] ", pMsgInfo->msgId, status);
- /** Move Msg to SENTBOX */
+ /* Move Msg to SENTBOX */
if (status == MSG_NETWORK_SEND_SUCCESS) {
snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET NETWORK_STATUS = %d, FOLDER_ID = %d WHERE MSG_ID = %d;",
MSGFW_MESSAGE_TABLE_NAME, status, MSG_SENTBOX_ID, pMsgInfo->msgId);
@@ -237,7 +237,7 @@ msg_error_t SmsPluginStorage::checkMessage(MSG_MESSAGE_INFO_S *pMsgInfo)
msg_error_t err = MSG_SUCCESS;
- /** Check whether storage is full or not */
+ /* Check whether storage is full or not */
err = checkStorageStatus(pMsgInfo);
if (err != MSG_SUCCESS) {
@@ -245,24 +245,26 @@ msg_error_t SmsPluginStorage::checkMessage(MSG_MESSAGE_INFO_S *pMsgInfo)
pMsgInfo->folderId = 0;
err = MSG_SUCCESS;
}
-// else if(pMsgInfo->msgType.classType == MSG_CLASS_2 &&
-// (pMsgInfo->msgType.subType == MSG_NORMAL_SMS || pMsgInfo->msgType.subType == MSG_REJECT_SMS)) {
-// err = addClass2Message(pMsgInfo);
-// }
+ /*
+ else if (pMsgInfo->msgType.classType == MSG_CLASS_2 &&
+ (pMsgInfo->msgType.subType == MSG_NORMAL_SMS || pMsgInfo->msgType.subType == MSG_REJECT_SMS)) {
+ err = addClass2Message(pMsgInfo);
+ }
+ */
else if (pMsgInfo->msgType.subType == MSG_NOTIFICATIONIND_MMS){
err = MSG_SUCCESS;
}
return err;
}
- /** Amend message information for type **/
+ /* Amend message information for type */
if (pMsgInfo->msgType.subType == MSG_NORMAL_SMS || pMsgInfo->msgType.subType == MSG_REJECT_SMS) {
MSG_DEBUG("Normal SMS");
if (pMsgInfo->msgType.classType == MSG_CLASS_2) {
-// err = addClass2Message(pMsgInfo);
+ /* err = addClass2Message(pMsgInfo); */
} else if (pMsgInfo->msgType.classType == MSG_CLASS_0) {
- /** Class 0 Msg should be saved in hidden folder */
+ /* Class 0 Msg should be saved in hidden folder */
pMsgInfo->folderId = 0;
}
@@ -270,9 +272,9 @@ msg_error_t SmsPluginStorage::checkMessage(MSG_MESSAGE_INFO_S *pMsgInfo)
MSG_DEBUG("Replace SM Type [%d]", pMsgInfo->msgType.subType-3);
if (pMsgInfo->msgType.classType == MSG_CLASS_2) {
-// err = addClass2Message(pMsgInfo);
+ /* err = addClass2Message(pMsgInfo); */
} else if (pMsgInfo->msgType.classType == MSG_CLASS_0) {
- /** Class 0 Msg should be saved in hidden folder */
+ /* Class 0 Msg should be saved in hidden folder */
pMsgInfo->folderId = 0;
pMsgInfo->msgType.subType = MSG_NORMAL_SMS;
}
@@ -280,10 +282,11 @@ msg_error_t SmsPluginStorage::checkMessage(MSG_MESSAGE_INFO_S *pMsgInfo)
} else if ((pMsgInfo->msgType.subType >= MSG_MWI_VOICE_SMS) && (pMsgInfo->msgType.subType <= MSG_MWI_OTHER_SMS)) {
if (pMsgInfo->bStore == true) {
MSG_DEBUG("MWI Message");
-
-// if (pMsgInfo->msgType.classType == MSG_CLASS_2) {
-// err = addClass2Message(pMsgInfo);
-// }
+ /*
+ if (pMsgInfo->msgType.classType == MSG_CLASS_2) {
+ err = addClass2Message(pMsgInfo);
+ }
+ */
}
} else {
MSG_DEBUG("No matching type [%d]", pMsgInfo->msgType.subType);
@@ -321,7 +324,7 @@ msg_error_t SmsPluginStorage::addSmsMessage(MSG_MESSAGE_INFO_S *pMsgInfo)
pMsgInfo->threadId = convId;
}
- /** Add Message Table */
+ /* Add Message Table */
rowId = MsgStoAddMessageTable(dbHandle, pMsgInfo);
if (rowId <= 0) {
@@ -329,7 +332,7 @@ msg_error_t SmsPluginStorage::addSmsMessage(MSG_MESSAGE_INFO_S *pMsgInfo)
return MSG_ERR_DB_ROW;
}
- /** Update conversation table */
+ /* Update conversation table */
err = MsgStoUpdateConversation(dbHandle, convId);
if (err != MSG_SUCCESS) {
@@ -357,7 +360,7 @@ msg_error_t SmsPluginStorage::deleteSmsMessage(msg_message_id_t msgId)
MsgDbHandler *dbHandle = getDbHandle();
char sqlQuery[MAX_QUERY_LEN+1];
- /** Get SUB_TYPE, STORAGE_ID */
+ /* Get SUB_TYPE, STORAGE_ID */
memset(sqlQuery, 0x00, sizeof(sqlQuery));
snprintf(sqlQuery, sizeof(sqlQuery), "SELECT MAIN_TYPE, SUB_TYPE, FOLDER_ID, CONV_ID, SIM_INDEX \
FROM %s WHERE MSG_ID = %d;",
@@ -393,7 +396,7 @@ msg_error_t SmsPluginStorage::deleteSmsMessage(msg_message_id_t msgId)
memset(sqlQuery, 0x00, sizeof(sqlQuery));
snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;", MSGFW_SMS_SENDOPT_TABLE_NAME, msgId);
- /** Delete SMS Send Option */
+ /* Delete SMS Send Option */
if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) {
dbHandle->endTrans(false);
return MSG_ERR_DB_EXEC;
@@ -403,7 +406,7 @@ msg_error_t SmsPluginStorage::deleteSmsMessage(msg_message_id_t msgId)
memset(sqlQuery, 0x00, sizeof(sqlQuery));
snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;", MSGFW_CB_MSG_TABLE_NAME, msgId);
- /** Delete Push Message from push table */
+ /* Delete Push Message from push table */
if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) {
dbHandle->endTrans(false);
return MSG_ERR_DB_EXEC;
@@ -412,7 +415,7 @@ msg_error_t SmsPluginStorage::deleteSmsMessage(msg_message_id_t msgId)
memset(sqlQuery, 0x00, sizeof(sqlQuery));
snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;", MSGFW_PUSH_MSG_TABLE_NAME, msgId);
- /** Delete Push Message from push table */
+ /* Delete Push Message from push table */
if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) {
dbHandle->endTrans(false);
return MSG_ERR_DB_EXEC;
@@ -421,14 +424,14 @@ msg_error_t SmsPluginStorage::deleteSmsMessage(msg_message_id_t msgId)
memset(sqlQuery, 0x00, sizeof(sqlQuery));
snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;", MSGFW_SYNCML_MSG_TABLE_NAME, msgId);
- /** Delete SyncML Message from syncML table */
+ /* Delete SyncML Message from syncML table */
if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) {
dbHandle->endTrans(false);
return MSG_ERR_DB_EXEC;
}
}
- /** Delete Message from msg table */
+ /* Delete Message from msg table */
memset(sqlQuery, 0x00, sizeof(sqlQuery));
snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;", MSGFW_MESSAGE_TABLE_NAME, msgId);
if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) {
@@ -436,7 +439,7 @@ msg_error_t SmsPluginStorage::deleteSmsMessage(msg_message_id_t msgId)
return MSG_ERR_DB_EXEC;
}
- /** Delete Message from msg_report table */
+ /* Delete Message from msg_report table */
memset(sqlQuery, 0x00, sizeof(sqlQuery));
snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;", MSGFW_SMS_REPORT_TABLE_NAME, msgId);
if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) {
@@ -444,7 +447,7 @@ msg_error_t SmsPluginStorage::deleteSmsMessage(msg_message_id_t msgId)
return MSG_ERR_DB_EXEC;
}
- /** Delete Message from msg_sim table */
+ /* Delete Message from msg_sim table */
memset(sqlQuery, 0x00, sizeof(sqlQuery));
snprintf(sqlQuery, sizeof(sqlQuery), "DELETE FROM %s WHERE MSG_ID = %d;", MSGFW_SIM_MSG_TABLE_NAME, msgId);
if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) {
@@ -452,13 +455,13 @@ msg_error_t SmsPluginStorage::deleteSmsMessage(msg_message_id_t msgId)
return MSG_ERR_DB_EXEC;
}
- /** Clear Conversation table */
+ /* Clear Conversation table */
if (MsgStoClearConversationTable(dbHandle) != MSG_SUCCESS) {
dbHandle->endTrans(false);
return MSG_ERR_DB_EXEC;
}
- /** Update conversation table.*/
+ /* Update conversation table.*/
if (MsgStoUpdateConversation(dbHandle, convId) != MSG_SUCCESS) {
dbHandle->endTrans(false);
return MSG_ERR_STORAGE_ERROR;
@@ -469,14 +472,14 @@ msg_error_t SmsPluginStorage::deleteSmsMessage(msg_message_id_t msgId)
if (folderId == MSG_INBOX_ID) {
msgType.classType = MSG_CLASS_NONE;
- /** Set memory status in SIM */
+ /* Set memory status in SIM */
if (MsgStoCheckMsgCntFull(dbHandle, &msgType, folderId) == MSG_SUCCESS) {
MSG_DEBUG("Set Memory Status");
SmsPlgSetMemoryStatus(MSG_SUCCESS);
}
}
-// MsgRefreshAllNotification(true, false, false);
+ /* MsgRefreshAllNotification(true, false, false); */
return MSG_SUCCESS;
}
@@ -492,14 +495,15 @@ msg_error_t SmsPluginStorage::addSmsSendOption(MSG_MESSAGE_INFO_S *pMsg, MSG_SEN
if (pSendOptInfo->bSetting == false) {
MsgSettingGetBool(SMS_SEND_DELIVERY_REPORT, &pSendOptInfo->bDeliverReq);
MsgSettingGetBool(SMS_SEND_REPLY_PATH, &pSendOptInfo->option.smsSendOptInfo.bReplyPath);
-
-// if (pSendOptInfo->bDeliverReq || pSendOptInfo->option.smsSendOptInfo.bReplyPath) {
-// pSendOptInfo->bSetting = true;
+ /*
+ if (pSendOptInfo->bDeliverReq || pSendOptInfo->option.smsSendOptInfo.bReplyPath) {
+ pSendOptInfo->bSetting = true;
+ */
MsgSettingGetBool(MSG_KEEP_COPY, &pSendOptInfo->bKeepCopy);
-// }
+ /* } */
}
-// if (pSendOptInfo->bSetting == true) {
+ /* if (pSendOptInfo->bSetting == true) { */
char sqlQuery[MAX_QUERY_LEN+1];
memset(sqlQuery, 0x00, sizeof(sqlQuery));
@@ -512,7 +516,7 @@ msg_error_t SmsPluginStorage::addSmsSendOption(MSG_MESSAGE_INFO_S *pMsg, MSG_SEN
if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) {
err = MSG_ERR_DB_EXEC;
}
-// }
+ /* } */
MSG_END();
@@ -539,13 +543,13 @@ msg_error_t SmsPluginStorage::checkStorageStatus(MSG_MESSAGE_INFO_S *pMsgInfo)
if (bAutoErase == true) {
msg_message_id_t msgId;
- /** Find the oldest message's msgId */
+ /* Find the oldest message's msgId */
err = MsgStoGetOldestMessage(dbHandle, pMsgInfo, &msgId);
if (err != MSG_SUCCESS)
return err;
- /** Delete the corresponding message. */
+ /* Delete the corresponding message. */
err = deleteSmsMessage(msgId);
}
}
@@ -577,8 +581,7 @@ msg_error_t SmsPluginStorage::getRegisteredPushEvent(char* pPushHeader, int *cou
if (err == MSG_ERR_DB_NORECORD) {
dbHandle->freeTable();
return MSG_SUCCESS;
- }
- else if ( err != MSG_SUCCESS) {
+ } else if ( err != MSG_SUCCESS) {
dbHandle->freeTable();
return err;
}
@@ -599,14 +602,14 @@ msg_error_t SmsPluginStorage::getRegisteredPushEvent(char* pPushHeader, int *cou
dbHandle->getColumnToString(index++, MAX_WAPPUSH_ID_LEN + 1, appId);
appcode = dbHandle->getColumnToInt(index++);
- //MSG_DEBUG("content_type: %s, app_id: %s", content_type, app_id);
+ /* MSG_DEBUG("content_type: %s, app_id: %s", content_type, app_id); */
_content_type = strcasestr(pPushHeader, contentType);
- if(_content_type) {
+ if (_content_type) {
_app_id = strcasestr(pPushHeader, appId);
- if(appcode)
+ if (appcode)
default_appcode = appcode;
- if(_app_id) {
+ if (_app_id) {
PUSH_APPLICATION_INFO_S pInfo = {0, };
pInfo.appcode = appcode;
MSG_SEC_DEBUG("appcode: %d, app_id: %s", pInfo.appcode, appId);
@@ -619,9 +622,8 @@ msg_error_t SmsPluginStorage::getRegisteredPushEvent(char* pPushHeader, int *cou
}
}
- if(!found && default_appcode != SMS_WAP_APPLICATION_LBS)
- {
- // perform default action.
+ if (!found && default_appcode != SMS_WAP_APPLICATION_LBS) {
+ /* perform default action. */
PUSH_APPLICATION_INFO_S pInfo = {0, };
pInfo.appcode = default_appcode;
memset(appId, 0, MAX_WAPPUSH_ID_LEN + 1);
@@ -639,14 +641,13 @@ msg_error_t SmsPluginStorage::getRegisteredPushEvent(char* pPushHeader, int *cou
msg_error_t SmsPluginStorage::getnthPushEvent(int index, int *appcode)
{
msg_error_t err = MSG_SUCCESS;
- if((unsigned int)index > pushAppInfoList.size() - 1)
+ if ((unsigned int)index > pushAppInfoList.size() - 1)
return MSG_ERR_INVALID_PARAMETER;
std::list<PUSH_APPLICATION_INFO_S>::iterator it = pushAppInfoList.begin();
int count = 0;
- for (; it != pushAppInfoList.end(); it++)
- {
- if(index == count){
+ for (; it != pushAppInfoList.end(); it++) {
+ if (index == count){
*appcode = it->appcode;
break;
}
diff --git a/plugin/sms_cdma_plugin/SmsCdmaPluginTransport.cpp b/plugin/sms_cdma_plugin/SmsCdmaPluginTransport.cpp
index 43020d4..25b8b27 100755
--- a/plugin/sms_cdma_plugin/SmsCdmaPluginTransport.cpp
+++ b/plugin/sms_cdma_plugin/SmsCdmaPluginTransport.cpp
@@ -98,17 +98,17 @@ unsigned char SmsPluginTransport::getSubmitMsgId()
void SmsPluginTransport::convertMsgInfoToTelesvcMsg(const MSG_MESSAGE_INFO_S *pMsgInfo, sms_trans_msg_s *pTransMsg)
{
switch (pTransMsg->type) {
- case SMS_TRANS_P2P_MSG:
- {
- MSG_DEBUG("Convert MSG_MESSAGE_INFO_S data to SMS_TRANS_MSG_S data.");
- sms_trans_p2p_msg_s *pPtpMsg = (sms_trans_p2p_msg_s *)&(pTransMsg->data.p2p_msg);
+ case SMS_TRANS_P2P_MSG:
+ {
+ MSG_DEBUG("Convert MSG_MESSAGE_INFO_S data to SMS_TRANS_MSG_S data.");
+ sms_trans_p2p_msg_s *pPtpMsg = (sms_trans_p2p_msg_s *)&(pTransMsg->data.p2p_msg);
- convertMsgInfoToPtp(pMsgInfo, pPtpMsg);
- }
- break;
- default:
- MSG_DEBUG("Error Unsupported Transport Type");
- break;
+ convertMsgInfoToPtp(pMsgInfo, pPtpMsg);
+ }
+ break;
+ default:
+ MSG_DEBUG("Error Unsupported Transport Type");
+ break;
}
}
@@ -133,24 +133,23 @@ void SmsPluginTransport::convertMsgInfoToPtp(const MSG_MESSAGE_INFO_S *pMsgInfo,
if (pMsgInfo->addressList[0].addressVal[0] == '+') {
pPtpMsg->address.digit_mode = SMS_DIGIT_8BIT;
pPtpMsg->address.number_type = SMS_NUMBER_TYPE_INTERNATIONAL;
- }
- else {
+ } else {
pPtpMsg->address.number_type = SMS_NUMBER_TYPE_NATIONAL;
}
/* 4. Convert Sub-address values */
- // TODO
+ /* TODO */
/* 5. Set Reply sequence number. */
pPtpMsg->reply_seq = getSeqNum();
/* convert msgInfo to Teleservice Message */
switch (pPtpMsg->telesvc_msg.type) {
- case SMS_TYPE_SUBMIT:
- convertMsgInfoToSubmit(pMsgInfo, &(pPtpMsg->telesvc_msg.data.submit));
- break;
- default:
- break;
+ case SMS_TYPE_SUBMIT:
+ convertMsgInfoToSubmit(pMsgInfo, &(pPtpMsg->telesvc_msg.data.submit));
+ break;
+ default:
+ break;
}
}
@@ -175,28 +174,19 @@ void SmsPluginTransport::convertMsgInfoToSubmit(const MSG_MESSAGE_INFO_S *pMsgIn
if (pMsgInfo->bTextSms == true) {
- if (pMsgInfo->encodeType == MSG_ENCODE_GSM7BIT)
- {
+ if (pMsgInfo->encodeType == MSG_ENCODE_GSM7BIT) {
pSubmit->user_data.encode_type = SMS_ENCODE_GSM7BIT;
- }
- else if (pMsgInfo->encodeType == MSG_ENCODE_8BIT)
- {
+ } else if (pMsgInfo->encodeType == MSG_ENCODE_8BIT) {
pSubmit->user_data.encode_type = SMS_ENCODE_OCTET;
- }
- else if (pMsgInfo->encodeType == MSG_ENCODE_UCS2)
- {
+ } else if (pMsgInfo->encodeType == MSG_ENCODE_UCS2) {
pSubmit->user_data.encode_type = SMS_ENCODE_UNICODE;
- }
- else if (pMsgInfo->encodeType == MSG_ENCODE_AUTO)
- {
+ } else if (pMsgInfo->encodeType == MSG_ENCODE_AUTO) {
textCvt->convertUTF8ToAuto(decodeData, SMS_MAX_USER_DATA_LEN + 1, (unsigned char*)pMsgInfo->msgText, (int)pMsgInfo->dataSize, &encodeType);
if (encodeType == MSG_ENCODE_ASCII7BIT) {
pSubmit->user_data.encode_type = SMS_ENCODE_7BIT_ASCII;
- }
- else if (encodeType == MSG_ENCODE_8BIT) {
+ } else if (encodeType == MSG_ENCODE_8BIT) {
pSubmit->user_data.encode_type = SMS_ENCODE_OCTET;
- }
- else if (encodeType == MSG_ENCODE_UCS2) {
+ } else if (encodeType == MSG_ENCODE_UCS2) {
pSubmit->user_data.encode_type = SMS_ENCODE_UNICODE;
}
}
@@ -223,16 +213,16 @@ void SmsPluginTransport::convertMsgInfoToSubmit(const MSG_MESSAGE_INFO_S *pMsgIn
#endif
/* 4. Set Defer valid period */
- // TODO
+ /* TODO */
/* 5. Set Priority */
switch (pMsgInfo->priority) {
- case MSG_MESSAGE_PRIORITY_HIGH:
- pSubmit->priority = SMS_PRIORITY_URGENT;
- break;
- default:
- pSubmit->priority = SMS_PRIORITY_NORMAL;
- break;
+ case MSG_MESSAGE_PRIORITY_HIGH:
+ pSubmit->priority = SMS_PRIORITY_URGENT;
+ break;
+ default:
+ pSubmit->priority = SMS_PRIORITY_NORMAL;
+ break;
}
/* 6. Set Privacy */
@@ -248,21 +238,20 @@ void SmsPluginTransport::convertMsgInfoToSubmit(const MSG_MESSAGE_INFO_S *pMsgIn
pSubmit->language = SMS_LAN_UNKNOWN;
/* 10. Set Callback number */
- // TODO :: Set callback number to MSISDN
+ /* TODO :: Set callback number to MSISDN */
/* 11. Set Multi encode data */
- // TODO
+ /* TODO */
/* 12. Set Deposit id */
- // TODO
+ /* TODO */
/* 13. Set Service category program data */
- // TODO
+ /* TODO */
}
-
void SmsPluginTransport::submitRequest(sms_request_info_s *pReqInfo)
{
int tapiRet = TAPI_API_SUCCESS;
@@ -271,19 +260,19 @@ void SmsPluginTransport::submitRequest(sms_request_info_s *pReqInfo)
THROW(MsgException::SMS_PLG_ERROR, "pReqInfo is NULL");
}
- // Get address informations.
+ /* Get address informations. */
MsgDbHandler *dbHandle = getDbHandle();
- //contacts-service is not used for gear
+ /* contacts-service is not used for gear */
#ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED
MsgStoGetAddressByMsgId(dbHandle, pReqInfo->msgInfo.msgId, 0, &pReqInfo->msgInfo.nAddressCnt, &pReqInfo->msgInfo.addressList);
#else
- //contactNameOrder is never used
+ /*contactNameOrder is never used */
MsgStoGetAddressByMsgId(dbHandle, pReqInfo->msgInfo.msgId, &pReqInfo->msgInfo.nAddressCnt, &pReqInfo->msgInfo.addressList);
-#endif //MSG_CONTACTS_SERVICE_NOT_SUPPORTED
+#endif /* MSG_CONTACTS_SERVICE_NOT_SUPPORTED */
MSG_DEBUG("pReqInfo->msgInfo.nAddressCnt [%d]", pReqInfo->msgInfo.nAddressCnt);
- // Get MSISDN
+ /* Get MSISDN */
char *msisdn = NULL;
char keyName[MAX_VCONFKEY_NAME_LEN];
int simIndex = 1;
@@ -293,7 +282,7 @@ void SmsPluginTransport::submitRequest(sms_request_info_s *pReqInfo)
msisdn = MsgSettingGetString(keyName);
- // Tapi Data Structure
+ /* Tapi Data Structure */
TelSmsDatapackageInfo_t tapi_data_pkg;
memset(&tapi_data_pkg, 0x00, sizeof(TelSmsDatapackageInfo_t));
@@ -326,71 +315,72 @@ void SmsPluginTransport::submitRequest(sms_request_info_s *pReqInfo)
}
MSG_DEBUG("Encode PDU= [%s]", pduDbg);
- /* send request */
sms_network_status_t retStatus;
- sms_sent_info_s sent_info;
- memset(&sent_info, 0x00, sizeof(sms_sent_info_s));
- memcpy(&sent_info.reqInfo, pReqInfo, sizeof(sent_info.reqInfo));
- sent_info.bLast = true;
+ for (int cnt = 0; cnt < MAX_SMS_SEND_RETRY; ++cnt) {
+ /* send request */
+ sms_sent_info_s sent_info;
+ memset(&sent_info, 0x00, sizeof(sms_sent_info_s));
+ memcpy(&sent_info.reqInfo, pReqInfo, sizeof(sent_info.reqInfo));
- SmsPluginEventHandler::instance()->SetSentInfo(&sent_info);
+ sent_info.bLast = true;
- int svc_type;
- tel_get_property_int(pTapiHandle, TAPI_PROP_NETWORK_SERVICE_TYPE, &svc_type);
+ SmsPluginEventHandler::instance()->SetSentInfo(&sent_info);
- if(svc_type < TAPI_NETWORK_SERVICE_TYPE_2G){
- MSG_DEBUG("Network service is not available : [%d]", svc_type);
- SmsPluginEventHandler::instance()->handleSentStatus(MSG_NETWORK_SEND_PENDING);
- goto _RETURN_FUNC;
- }
+ int svc_type;
+ tel_get_property_int(pTapiHandle, TAPI_PROP_NETWORK_SERVICE_TYPE, &svc_type);
- curStatus = SMS_NETWORK_SENDING;
+ if (svc_type < TAPI_NETWORK_SERVICE_TYPE_2G) {
+ MSG_DEBUG("Network service is not available : [%d]", svc_type);
+ SmsPluginEventHandler::instance()->handleSentStatus(MSG_NETWORK_SEND_PENDING);
+ goto _RETURN_FUNC;
+ }
- // Send SMS
- tapiRet = tel_send_sms(pTapiHandle, &tapi_data_pkg, bMoreMsgToSend, TapiEventSentStatus, NULL);
+ curStatus = SMS_NETWORK_SENDING;
- if (tapiRet == TAPI_API_SUCCESS)
- {
- MSG_DEBUG("######## tel_send_sms Success !!! return : [%d] #######", tapiRet);
- }
- else
- {
- SmsPluginEventHandler::instance()->handleSentStatus(MSG_NETWORK_SEND_FAIL);
- THROW(MsgException::SMS_PLG_ERROR, "######## tel_send_sms Fail !!! return : [%d] #######", tapiRet);
- }
+ /* Send SMS */
+ tapiRet = tel_send_sms(pTapiHandle, &tapi_data_pkg, bMoreMsgToSend, TapiEventSentStatus, NULL);
+
+ if (tapiRet == TAPI_API_SUCCESS) {
+ MSG_DEBUG("######## tel_send_sms Success !!! return : [%d] #######", tapiRet);
+ } else {
+ SmsPluginEventHandler::instance()->handleSentStatus(MSG_NETWORK_SEND_FAIL);
+ THROW(MsgException::SMS_PLG_ERROR, "######## tel_send_sms Fail !!! return : [%d] #######", tapiRet);
+ }
- // Tizen Validation System
- MSG_SMS_VLD_INFO("%d, SMS Send Start, %s->%s, %s", pReqInfo->msgInfo.msgId, \
- (msisdn == NULL)?"ME":msisdn, \
- pReqInfo->msgInfo.addressList[0].addressVal, \
- (tapiRet == TAPI_API_SUCCESS)?"Success":"Fail");
+ /* Tizen Validation System */
+ MSG_SMS_VLD_INFO("%d, SMS Send Start, %s->%s, %s", pReqInfo->msgInfo.msgId, \
+ (msisdn == NULL)?"ME":msisdn, \
+ pReqInfo->msgInfo.addressList[0].addressVal, \
+ (tapiRet == TAPI_API_SUCCESS)?"Success":"Fail");
- MSG_SMS_VLD_TXT("%d, [%s]", pReqInfo->msgInfo.msgId, pReqInfo->msgInfo.msgText);
+ MSG_SMS_VLD_TXT("%d, [%s]", pReqInfo->msgInfo.msgId, pReqInfo->msgInfo.msgText);
- retStatus = getNetStatus();
+ retStatus = getNetStatus();
+
+ if (retStatus != SMS_NETWORK_SEND_FAIL_TEMPORARY)
+ break;
+ }
MSG_SMS_VLD_INFO("%d, SMS Send End, %s->%s, %s", pReqInfo->msgInfo.msgId, \
(msisdn == NULL)?"ME":msisdn, \
pReqInfo->msgInfo.addressList[0].addressVal, \
(retStatus == SMS_NETWORK_SEND_SUCCESS)?"Success":"Fail");
- if (retStatus == SMS_NETWORK_SEND_SUCCESS)
- {
+ if (retStatus == SMS_NETWORK_SEND_SUCCESS) {
MSG_DEBUG("######## Msg Sent was Successful !!! #######");
- }
- else
- {
- if (retStatus == SMS_NETWORK_SEND_FAIL_TIMEOUT)
+ } else {
+ if (retStatus == SMS_NETWORK_SEND_FAIL_TIMEOUT || retStatus == SMS_NETWORK_SEND_FAIL_TEMPORARY
+ || retStatus == SMS_NETWORK_SEND_FAIL_MANDATORY_INFO_MISSING || retStatus == SMS_NETWORK_SEND_FAIL_FDN_RESTRICED)
SmsPluginEventHandler::instance()->handleSentStatus(MSG_NETWORK_SEND_FAIL);
- if (retStatus == SMS_NETWORK_SEND_FAIL_FDN_RESTRICED) {
+ if (retStatus == SMS_NETWORK_SEND_FAIL_FDN_RESTRICED)
MsgInsertTicker("Unable to send the message while Fixed dialling mode is enabled", SMS_FDN_RESTRICTED, true, 0);
- } else if(retStatus == SMS_NETWORK_SEND_PENDING) {
+ else if (retStatus == SMS_NETWORK_SEND_PENDING)
MsgInsertTicker("Unable to send message. It will be sent when service available.", SMS_MESSAGE_SENDING_PENDING, true, 0);
- }else {
+ else
MsgInsertTicker("Sending SMS is failed", SMS_MESSAGE_SENDING_FAIL, true, pReqInfo->msgInfo.msgId);
- }
+
}
_RETURN_FUNC :
@@ -404,6 +394,7 @@ _RETURN_FUNC :
return;
}
+
void SmsPluginTransport::sendDeliverReport(msg_error_t err, sms_trans_p2p_msg_s *p_p2p_msg)
{
MSG_BEGIN();
@@ -426,24 +417,19 @@ void SmsPluginTransport::sendDeliverReport(msg_error_t err, sms_trans_p2p_msg_s
cause_code.reply_seq = p_p2p_msg->reply_seq;
- if (err == MSG_SUCCESS)
- {
+ if (err == MSG_SUCCESS) {
cause_code.error_class = SMS_TRANS_ERR_CLASS_NONE;
response = TAPI_NETTEXT_SENDSMS_SUCCESS;
- if(isMemAvailable == false)
- {
+ if (isMemAvailable == false) {
tapiRet = tel_set_sms_memory_status(pTapiHandle, TAPI_NETTEXT_PDA_MEMORY_STATUS_AVAILABLE, TapiEventMemoryStatus, NULL);
if (tapiRet == TAPI_API_SUCCESS)
- {
MSG_DEBUG("######## tel_set_sms_memory_status() Success !!! #######");
- }
else
- {
MSG_DEBUG("######## tel_set_sms_memory_status() Failed !!! return : [%d] #######", tapiRet);
- }
+
}
} else if (err == MSG_ERR_MESSAGE_COUNT_FULL) {
@@ -451,18 +437,15 @@ void SmsPluginTransport::sendDeliverReport(msg_error_t err, sms_trans_p2p_msg_s
cause_code.error_class = SMS_TRANS_ERR_CLASS_TEMPORARY;
response = TAPI_NETTEXT_ME_FULL;
-// MsgInsertTicker("Not enough memory. Delete some items.", SMS_MESSAGE_MEMORY_FULL, true, 0);
+ /* MsgInsertTicker("Not enough memory. Delete some items.", SMS_MESSAGE_MEMORY_FULL, true, 0); */
tapiRet = tel_set_sms_memory_status(pTapiHandle, TAPI_NETTEXT_PDA_MEMORY_STATUS_FULL, TapiEventMemoryStatus, NULL);
if (tapiRet == TAPI_API_SUCCESS)
- {
MSG_DEBUG("######## tel_set_sms_memory_status() Success !!! #######");
- }
else
- {
MSG_DEBUG("######## tel_set_sms_memory_status() Failed !!! return : [%d] #######", tapiRet);
- }
+
} else if (err == MSG_ERR_UNKNOWN) {
cause_code.error_class = SMS_TRANS_ERR_CLASS_TEMPORARY;
cause_code.cause_code = SMS_CAUSE_CODE_SERVICE_TERMINATION_DENIED;
@@ -474,9 +457,7 @@ void SmsPluginTransport::sendDeliverReport(msg_error_t err, sms_trans_p2p_msg_s
cause_code.cause_code = SMS_CAUSE_CODE_INVAILD_TELESERVICE_ID;
response = TAPI_NETTEXT_INVALID_MSG;
- }
- else
- {
+ } else {
cause_code.error_class = SMS_TRANS_ERR_CLASS_TEMPORARY;
response = TAPI_NETTEXT_SIM_FULL;
@@ -494,18 +475,17 @@ void SmsPluginTransport::sendDeliverReport(msg_error_t err, sms_trans_p2p_msg_s
MSG_DEBUG("######## DeliverReport tpdu #########");
- for(int i=0; i < bufLen; i++)
- {
+ for (int i=0; i < bufLen; i++) {
printf("[%02x] ", buf[i]);
}
MSG_DEBUG("#################################");
- // Make Telephony Structure
+ /* Make Telephony Structure */
TelSmsDatapackageInfo_t pkgInfo;
pkgInfo.format = TAPI_NETTEXT_NETTYPE_3GPP2;
- // Set TPDU data
+ /* Set TPDU data */
memset((void*)pkgInfo.szData, 0x00, sizeof(pkgInfo.szData));
memcpy((void*)pkgInfo.szData, buf, bufLen);
@@ -513,17 +493,13 @@ void SmsPluginTransport::sendDeliverReport(msg_error_t err, sms_trans_p2p_msg_s
pkgInfo.MsgLength = bufLen;
- // Send Deliver Report
+ /* Send Deliver Report */
tapiRet = tel_send_sms_deliver_report(pTapiHandle, &pkgInfo, response, TapiEventDeliveryReportCNF, NULL);
if (tapiRet == TAPI_API_SUCCESS)
- {
MSG_DEBUG("######## tel_send_sms_deliver_report() Success !!! #######");
- }
else
- {
MSG_DEBUG("######## tel_send_sms_deliver_report() Fail !!! return : [%d] #######", tapiRet);
- }
MSG_END();
}
@@ -549,8 +525,7 @@ sms_network_status_t SmsPluginTransport::getNetStatus()
mx.unlock();
- if (ret == ETIMEDOUT)
- {
+ if (ret == ETIMEDOUT) {
MSG_DEBUG("WARNING: SENT STATUS TIME-OUT");
curStatus = SMS_NETWORK_SEND_FAIL_TIMEOUT;
}
diff --git a/plugin/sms_cdma_plugin/SmsCdmaPluginUAManager.cpp b/plugin/sms_cdma_plugin/SmsCdmaPluginUAManager.cpp
index 4fc98b4..1b4f52f 100755
--- a/plugin/sms_cdma_plugin/SmsCdmaPluginUAManager.cpp
+++ b/plugin/sms_cdma_plugin/SmsCdmaPluginUAManager.cpp
@@ -48,8 +48,7 @@ SmsPluginUAManager* SmsPluginUAManager::instance()
void SmsPluginUAManager::run()
{
- while (1)
- {
+ while (1) {
lock();
while (smsTranQ.empty()) {
wait();
@@ -61,21 +60,16 @@ void SmsPluginUAManager::run()
request.msgInfo.addressList = NULL;
unique_ptr<MSG_ADDRESS_INFO_S*, void(*)(MSG_ADDRESS_INFO_S**)> addressListBuf(&request.msgInfo.addressList, unique_ptr_deleter);
- try
- {
+ try {
SmsPluginTransport::instance()->submitRequest(&request);
- }
- catch (MsgException& e)
- {
+ } catch (MsgException& e) {
MSG_FATAL("%s", e.what());
lock();
smsTranQ.pop_front();
unlock();
continue;
- }
- catch (exception& e)
- {
+ } catch (exception& e) {
MSG_FATAL("%s", e.what());
lock();
smsTranQ.pop_front();
@@ -101,4 +95,3 @@ void SmsPluginUAManager::addReqEntity(sms_request_info_s *request)
cv.signal();
unlock();
}
-
diff --git a/plugin/sms_cdma_plugin/SmsCdmaPluginWapPushHandler.cpp b/plugin/sms_cdma_plugin/SmsCdmaPluginWapPushHandler.cpp
index 63126eb..aa1fb9f 100755
--- a/plugin/sms_cdma_plugin/SmsCdmaPluginWapPushHandler.cpp
+++ b/plugin/sms_cdma_plugin/SmsCdmaPluginWapPushHandler.cpp
@@ -43,8 +43,7 @@ const unsigned long wspLanguageCount = 0x11a;
const unsigned char wspSecurityTypeCount = 0x04;
-static const SMS_WSP_CONTENTS_TYPE_S wspExtendedContentsType[] =
-{
+static const SMS_WSP_CONTENTS_TYPE_S wspExtendedContentsType[] = {
{ (char*)"text/vnd/wap/connectivity-xml", 0x35 },
{ (char*)"application/vnd.wap.connectivity-wbxml", 0x36 },
{ (char*)"application/pkcs7-mime", 0x37 },
@@ -77,81 +76,79 @@ static const SMS_WSP_CONTENTS_TYPE_S wspExtendedContentsType[] =
};
-const char* wspHeaderFieldName[] =
-{
- (char*)"Accept", //0x00
+const char* wspHeaderFieldName[] = {
+ (char*)"Accept", /* 0x00 */
(char*)"Accept-Charset",
(char*)"Accept-Encoding",
(char*)"Accept-Language",
(char*)"Accept-Ranges",
- (char*)"Age", //0x05
+ (char*)"Age", /* 0x05 */
(char*)"Allow",
(char*)"Authorization",
(char*)"Cache-Control",
(char*)"Connection",
- (char*)"Content-Base", //0x0a
+ (char*)"Content-Base", /* 0x0a */
(char*)"Content-Encoding",
(char*)"Content-Language",
(char*)"Content-Length",
(char*)"Content-Location",
(char*)"Content-MD5",
- (char*)"Content-Range", //0x10
+ (char*)"Content-Range", /* 0x10 */
(char*)"Content-Type",
(char*)"Date",
(char*)"ETag",
(char*)"Expires",
- (char*)"From", //0x15
+ (char*)"From", /* 0x15 */
(char*)"Host",
(char*)"If-Modified-Since",
(char*)"If-Match",
(char*)"If-None-Match",
- (char*)"If-Range", //0x1a
+ (char*)"If-Range", /* 0x1a */
(char*)"If-Unmodified-Since",
(char*)"Location",
(char*)"Last-Modified",
(char*)"Max-Forwards",
(char*)"Pragma",
- (char*)"Proxy-Authenticate", //0x20
+ (char*)"Proxy-Authenticate", /* 0x20 */
(char*)"Proxy-Authorization",
(char*)"Public",
(char*)"Range",
(char*)"Referer",
- (char*)"Retry-After", //0x25
+ (char*)"Retry-After", /* 0x25 */
(char*)"Server",
(char*)"Transfer-Encodig",
(char*)"Upgrade",
(char*)"User-Agent",
- (char*)"Vary", //0x2a
+ (char*)"Vary", /* 0x2a */
(char*)"Via",
(char*)"Warning",
(char*)"Www-Authenticate",
(char*)"Content-Disposition",
(char*)"X-Wap-Application-Id",
- (char*)"X-Wap-Content-URI", //0x30
+ (char*)"X-Wap-Content-URI", /* 0x30 */
(char*)"X-Wap-Iinitiator-URI",
- (char*)"Accept-Application", // Back
+ (char*)"Accept-Application", /* Back */
(char*)"Bearer-Indication",
(char*)"Push-Flag",
- (char*)"Profile", //0x35
+ (char*)"Profile", /* 0x35 */
(char*)"Profile-Diff",
- (char*)"Profile-Warning", // end of WAP 1.2
+ (char*)"Profile-Warning", /* end of WAP 1.2 */
(char*)"Expect",
(char*)"Te",
- (char*)"Trailer", //0x3a
- (char*)"Accept-Charset", //Back
- (char*)"Accept-Encoding", // Back
- (char*)"Cache-Control", // back
+ (char*)"Trailer", /* 0x3a */
+ (char*)"Accept-Charset", /* Back */
+ (char*)"Accept-Encoding", /* Back */
+ (char*)"Cache-Control", /* back */
(char*)"Content-Range",
(char*)"X-Wap-Tod",
- (char*)"Content-ID", //x40
+ (char*)"Content-ID", /*x40 */
(char*)"Set-Cookie",
(char*)"Cookie",
(char*)"Encoding-Version"
};
-const SMS_WSP_CHARSET_S wspCharset[] =
-{
+const SMS_WSP_CHARSET_S wspCharset[] = {
{ (char*)"big5", 0x07ea },
{ (char*)"iso-10646-ucs-2", 0x03e8 },
{ (char*)"iso-8859-1", 0x04 },
@@ -171,17 +168,14 @@ const SMS_WSP_CHARSET_S wspCharset[] =
};
-
-const char* wspEncodeMethod[] =
-{
+const char* wspEncodeMethod[] = {
(char*)"Gzip",
(char*)"Compress",
(char*)"Deflate"
};
-const SMS_WSP_CONTENTS_TYPE_S wspContentsType[] =
-{
+const SMS_WSP_CONTENTS_TYPE_S wspContentsType[] = {
{ (char*)"*/*", 0x00 },
{ (char*)"text/*", 0x01 },
{ (char*)"text/html", 0x02 },
@@ -258,17 +252,18 @@ const SMS_WSP_CONTENTS_TYPE_S wspContentsType[] =
{ (char*)"application/vnd.wv.csp.cir", 0x46 }
};
-static const SMS_WAP_UNREGISTER_CONTENTS_TYPE_S wspUnregisterContentsType[]=
-{
+
+static const SMS_WAP_UNREGISTER_CONTENTS_TYPE_S wspUnregisterContentsType[]= {
{ (char*)"application/vnd.wap.emn+wbxml", 0x30A},
{ (char*)"application/vnd.omaloc-supl-init", 0x312},
{ (char*)"application/vnd.oma.drm.roap-trigger+wbxml", 0x316}
};
+
const unsigned long wspUnregisteredContentsTypeCount = sizeof(wspUnregisterContentsType)/sizeof(SMS_WAP_UNREGISTER_CONTENTS_TYPE_S);
-const SMS_WSP_LANGUAGE_S wspLanguage[] =
-{
+
+const SMS_WSP_LANGUAGE_S wspLanguage[] = {
{ (char*)"English", 0x19 },
{ (char*)"en", 0x19 },
{ (char*)"Korean", 0x3d },
@@ -555,8 +550,7 @@ const SMS_WSP_LANGUAGE_S wspLanguage[] =
};
-const SMS_WSP_HEADER_PARAMETER_S wspHeaderApplId[] =
-{
+const SMS_WSP_HEADER_PARAMETER_S wspHeaderApplId[] = {
{ (char*)"x-wap-application:*", 0x00 },
{ (char*)"x-wap-application:push.sia", 0x01},
{ (char*)"x-wap-application:wml.ua", 0x02 },
@@ -585,8 +579,7 @@ const SMS_WSP_HEADER_PARAMETER_S wspHeaderApplId[] =
};
-const char* wspCacheControl[] =
-{
+const char* wspCacheControl[] = {
(char*)"No-cache",
(char*)"No-store",
(char*)"Max-age",
@@ -600,8 +593,7 @@ const char* wspCacheControl[] =
(char*)"Proxy-revalidate"
};
-const SMS_WSP_METHOD_TYPE_S wspMethodType[] =
-{
+const SMS_WSP_METHOD_TYPE_S wspMethodType[] = {
{ (char*)"GET", 0x40 },
{ (char*)"OPTIONS", 0x41 },
{ (char*)"HEAD", 0x42 },
@@ -612,8 +604,7 @@ const SMS_WSP_METHOD_TYPE_S wspMethodType[] =
};
-const SMS_WSP_SECURITY_TYPE_S wspSecurityType[] =
-{
+const SMS_WSP_SECURITY_TYPE_S wspSecurityType[] = {
{(char*)"NETWPIN",0x00},
{(char*)"USERPIN",0x01},
{(char*)"USERNETWPIN",0x02},
@@ -622,8 +613,7 @@ const SMS_WSP_SECURITY_TYPE_S wspSecurityType[] =
-const char* wspWeek[] =
-{
+const char* wspWeek[] = {
(char*)"Sun",
(char*)"Mon",
(char*)"Tue",
@@ -634,8 +624,7 @@ const char* wspWeek[] =
};
-const char* wspWeekDay[] =
-{
+const char* wspWeekDay[] = {
(char*)"Sunday",
(char*)"Monday",
(char*)"Tuesday",
@@ -645,8 +634,7 @@ const char* wspWeekDay[] =
(char*)"Saturday"
};
-const char* wspMonth[] =
-{
+const char* wspMonth[] = {
(char*)"Jan",
(char*)"Feb",
(char*)"Mar",
@@ -689,6 +677,7 @@ SmsPluginWapPushHandler* SmsPluginWapPushHandler::instance()
return pInstance;
}
+
bool SmsPluginWapPushHandler::IsWapPushMsg(unsigned short dstport)
{
MSG_BEGIN();
@@ -770,8 +759,7 @@ void SmsPluginWapPushHandler::handleWapPushMsg(const char *pUserData, int DataSi
MSG_DEBUG("DataSize [%d]", DataSize);
MSG_DEBUG("[pUserData]");
- for (int i = 0; i < DataSize; i++)
- {
+ for (int i = 0; i < DataSize; i++) {
printf("[%02x]", pUserData[i]);
}
printf("\n\n");
@@ -798,7 +786,7 @@ void SmsPluginWapPushHandler::handleWapPushMsg(const char *pUserData, int DataSi
unique_ptr<char*, void(*)(char**)> WspBodyBuf(&pWspBody, unique_ptr_deleter);
unsigned long wspBodyLen = 0;
- /** pass PDU type */
+ /* pass PDU type */
iPDU++;
pushHeaderLen = wspRetriveUintvarDecode( pPDUTypeData, &iPDU );
@@ -827,20 +815,19 @@ void SmsPluginWapPushHandler::handleWapPushMsg(const char *pUserData, int DataSi
MSG_DEBUG("wspHeaderLen [%d]", wspHeaderLen);
MSG_DEBUG("[pWspHeader]");
- for (int i = 0; i < wspHeaderLen; i++)
- {
+ for (int i = 0; i < wspHeaderLen; i++) {
printf("[%02x]", pWspHeader[i]);
}
printf("\n\n");
#endif
- /** return if it is below case error */
+ /* return if it is below case error */
if (PDUTypeDataLen < wspHeaderLen) {
MSG_DEBUG("PDUTypeDataLen < wspHeaderLen !!!");
return;
}
- /** Finding wspBody Information */
+ /* Finding wspBody Information */
wspBodyLen = PDUTypeDataLen - wspHeaderLen;
if (wspBodyLen > 0) {
@@ -866,7 +853,7 @@ void SmsPluginWapPushHandler::handleWapPushMsg(const char *pUserData, int DataSi
if (pushBodyLen > 0) {
pPushBody = new char[pushBodyLen];
- if (pPushBody == NULL) {
+ if (pPushBody == NULL) {
MSG_DEBUG("pPushBody Memory Allocation Failed");
return;
} else {
@@ -894,7 +881,7 @@ void SmsPluginWapPushHandler::handleWapPushCallback(char* pPushHeader, char* pPu
SMS_WAP_APP_CODE_T appCode = getAppCode(pPushHeader);
- /** check Push message receive setting */
+ /* check Push message receive setting */
bool bPushRecv = false;
MsgSettingGetBool(PUSH_RECV_OPTION, &bPushRecv);
@@ -909,118 +896,95 @@ void SmsPluginWapPushHandler::handleWapPushCallback(char* pPushHeader, char* pPu
MSG_DEBUG("Received MMS Notification");
handleMMSNotification(pPushBody, PushBodyLen);
break;
-
case SMS_WAP_APPLICATION_PUSH_SI:
MSG_DEBUG("Received WAP Push (Service Indication Textual form)");
handleSIMessage(pPushBody, PushBodyLen, true);
break;
-
case SMS_WAP_APPLICATION_PUSH_SIC:
MSG_DEBUG("Received WAP Push (Service Indication Tokenised form)");
handleSIMessage(pPushBody, PushBodyLen, false);
- break;
-
+ break;
case SMS_WAP_APPLICATION_PUSH_SL:
MSG_DEBUG("Received WAP Push (Service Loading Textual form)");
handleSLMessage(pPushBody, PushBodyLen, true);
break;
-
case SMS_WAP_APPLICATION_PUSH_SLC:
MSG_DEBUG("Received WAP Push (Service Loading Tokenised form)");
handleSLMessage(pPushBody, PushBodyLen, false);
- break;
-
+ break;
case SMS_WAP_APPLICATION_PUSH_CO:
MSG_DEBUG("Received WAP Push (Cache Operation Textual form)");
handleCOMessage(pPushBody, PushBodyLen, true);
break;
-
case SMS_WAP_APPLICATION_PUSH_COC:
MSG_DEBUG("Received WAP Push (Cache Operation Tokenised form)");
handleCOMessage(pPushBody, PushBodyLen, false);
break;
-
case SMS_WAP_APPLICATION_SYNCML_DM_BOOTSTRAP:
MSG_DEBUG("Received DM BOOTSTRAP");
SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(DM_WBXML, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen);
break;
-
case SMS_WAP_APPLICATION_SYNCML_DM_BOOTSTRAP_XML:
MSG_DEBUG("Received DM BOOTSTRAP");
SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(DM_XML, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen);
break;
-
case SMS_WAP_APPLICATION_PUSH_PROVISIONING_XML:
MSG_DEBUG("Received Provisioning");
SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(CP_XML, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen);
break;
-
case SMS_WAP_APPLICATION_PUSH_PROVISIONING_WBXML:
MSG_DEBUG("Received Provisioning");
SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(CP_WBXML, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen);
break;
-
case SMS_WAP_APPLICATION_PUSH_BROWSER_SETTINGS:
case SMS_WAP_APPLICATION_PUSH_BROWSER_BOOKMARKS:
MSG_DEBUG("Received Provisioning");
SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(OTHERS, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen);
break;
-
case SMS_WAP_APPLICATION_SYNCML_DM_NOTIFICATION:
MSG_DEBUG("Received DM Notification");
SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(DM_NOTIFICATION, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen);
break;
-
case SMS_WAP_APPLICATION_SYNCML_DS_NOTIFICATION:
MSG_DEBUG("Received DS Notification");
SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(DS_NOTIFICATION, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen);
break;
-
case SMS_WAP_APPLICATION_SYNCML_DS_NOTIFICATION_WBXML:
MSG_DEBUG("Received DS Notification");
SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(DS_WBXML, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen);
break;
-
case SMS_WAP_APPLICATION_DRM_UA_RIGHTS_XML:
case SMS_WAP_APPLICATION_DRM_UA_RIGHTS_WBXML:
MSG_DEBUG("Received DRM UA");
-
if (pPushBody != NULL)
handleDrmVer1(pPushBody, PushBodyLen);
-
break;
-
case SMS_WAP_APPLICATION_DRM_V2_RO_XML:
case SMS_WAP_APPLICATION_DRM_V2_ROAP_PDU_XML:
case SMS_WAP_APPLICATION_DRM_V2_ROAP_TRIGGER_XML:
case SMS_WAP_APPLICATION_DRM_V2_ROAP_TRIGGER_WBXML:
MSG_DEBUG("Received DRM V2");
- // TODO: DRM V2
+ /* TODO: DRM V2 */
break;
-
case SMS_WAP_APPLICATION_PUSH_EMAIL:
case SMS_WAP_APPLICATION_PUSH_EMAIL_XML:
case SMS_WAP_APPLICATION_PUSH_EMAIL_WBXML:
MSG_DEBUG("Received Email");
- // TODO: Email
+ /* TODO: Email */
break;
-
case SMS_WAP_APPLICATION_PUSH_IMPS_CIR:
MSG_DEBUG("Received IMPS CIR");
- // TODO: IMPS CIR
+ /* TODO: IMPS CIR */
break;
-
- case SMS_WAP_APPLICATION_LBS :
+ case SMS_WAP_APPLICATION_LBS:
MSG_DEBUG("Received LBS related message");
SmsPluginEventHandler::instance()->handleLBSMsgIncoming(pPushHeader, pPushBody, PushBodyLen);
- // TODO: LBS
+ /* TODO: LBS */
break;
-
- case SMS_WAP_APPLICATION_PUSH_SIA :
+ case SMS_WAP_APPLICATION_PUSH_SIA:
MSG_DEBUG("Received SIA");
- // TODO: SIA
+ /* TODO: SIA */
break;
-
default:
MSG_DEBUG("Unknown Application [%d]", appCode);
break;
@@ -1041,91 +1005,83 @@ static void launchProcessByAppcode(int appcode)
GVariant *result_agent = NULL;
GVariant *result_service = NULL;
- switch(appcode){
- case SMS_WAP_APPLICATION_SYNCML_DM_BOOTSTRAP:
- case SMS_WAP_APPLICATION_SYNCML_DM_BOOTSTRAP_XML:
- case SMS_WAP_APPLICATION_PUSH_PROVISIONING_XML:
- case SMS_WAP_APPLICATION_PUSH_PROVISIONING_WBXML:
- case SMS_WAP_APPLICATION_PUSH_BROWSER_SETTINGS:
- case SMS_WAP_APPLICATION_PUSH_BROWSER_BOOKMARKS:
- case SMS_WAP_APPLICATION_SYNCML_DM_NOTIFICATION:
- {
- connection_agent = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
- if (error) {
- MSG_DEBUG("Connecting to system bus failed: %s\n", error->message);
- goto _DBUS_ERROR;
- }
-
+ switch (appcode) {
+ case SMS_WAP_APPLICATION_SYNCML_DM_BOOTSTRAP:
+ case SMS_WAP_APPLICATION_SYNCML_DM_BOOTSTRAP_XML:
+ case SMS_WAP_APPLICATION_PUSH_PROVISIONING_XML:
+ case SMS_WAP_APPLICATION_PUSH_PROVISIONING_WBXML:
+ case SMS_WAP_APPLICATION_PUSH_BROWSER_SETTINGS:
+ case SMS_WAP_APPLICATION_PUSH_BROWSER_BOOKMARKS:
+ case SMS_WAP_APPLICATION_SYNCML_DM_NOTIFICATION:
+ {
+ connection_agent = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
+ if (error) {
+ MSG_DEBUG("Connecting to system bus failed: %s\n", error->message);
+ goto _DBUS_ERROR;
+ }
dbus_proxy_agent = g_dbus_proxy_new_sync(connection_agent, G_DBUS_PROXY_FLAGS_NONE,
- NULL, "org.tizen.omadmagent", "/org/tizen/omadmagent",
- "org.tizen.omadmagent", NULL, &error);
- if (error) {
- MSG_DEBUG("Connecting to agent proxy failed: %s\n", error->message);
- goto _DBUS_ERROR;
- }
-
+ NULL, "org.tizen.omadmagent", "/org/tizen/omadmagent",
+ "org.tizen.omadmagent", NULL, &error);
+ if (error) {
+ MSG_DEBUG("Connecting to agent proxy failed: %s\n", error->message);
+ goto _DBUS_ERROR;
+ }
result_agent = g_dbus_proxy_call_sync(dbus_proxy_agent, "Hello_Agent", NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
- if (error) {
- MSG_DEBUG("invoking agent proxy call failed: %s\n", error->message);
- goto _DBUS_ERROR;
- }
-
+ if (error) {
+ MSG_DEBUG("invoking agent proxy call failed: %s\n", error->message);
+ goto _DBUS_ERROR;
+ }
connection_service = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
- if (error) {
- MSG_DEBUG("Connecting to system bus failed: %s\n", error->message);
- goto _DBUS_ERROR;
- }
-
+ if (error) {
+ MSG_DEBUG("Connecting to system bus failed: %s\n", error->message);
+ goto _DBUS_ERROR;
+ }
dbus_proxy_service =g_dbus_proxy_new_sync(connection_service, G_DBUS_PROXY_FLAGS_NONE, NULL,
- "org.tizen.omadmservice", "/org/tizen/omadmservice",
- "org.tizen.omadmservice", NULL, &error);
- if (error) {
- MSG_DEBUG("Connecting to service proxy failed: %s\n", error->message);
- goto _DBUS_ERROR;
- }
-
+ "org.tizen.omadmservice", "/org/tizen/omadmservice",
+ "org.tizen.omadmservice", NULL, &error);
+ if (error) {
+ MSG_DEBUG("Connecting to service proxy failed: %s\n", error->message);
+ goto _DBUS_ERROR;
+ }
result_service = g_dbus_proxy_call_sync(dbus_proxy_service, "wakeup", NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
- if (error) {
- MSG_DEBUG("invoking service proxy call failed: %s\n", error->message);
- goto _DBUS_ERROR;
- }
-
- Mutex mx;
- CndVar cv;
- mx.lock();
- cv.timedwait(mx.pMutex(), 2);
- mx.unlock();
-
- MSG_END();
+ if (error) {
+ MSG_DEBUG("invoking service proxy call failed: %s\n", error->message);
+ goto _DBUS_ERROR;
+ }
+ Mutex mx;
+ CndVar cv;
+ mx.lock();
+ cv.timedwait(mx.pMutex(), 2);
+ mx.unlock();
+ MSG_END();
+ }
+ break;
+ case SMS_WAP_APPLICATION_SYNCML_DS_NOTIFICATION:
+ case SMS_WAP_APPLICATION_SYNCML_DS_NOTIFICATION_WBXML:
+ {
+ connection_agent = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
+ if (error) {
+ MSG_DEBUG("Connecting to system bus failed: %s\n", error->message);
+ goto _DBUS_ERROR;
}
- break;
- case SMS_WAP_APPLICATION_SYNCML_DS_NOTIFICATION:
- case SMS_WAP_APPLICATION_SYNCML_DS_NOTIFICATION_WBXML:
- {
- connection_agent = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
- if (error) {
- MSG_DEBUG("Connecting to system bus failed: %s\n", error->message);
- goto _DBUS_ERROR;
- }
-
- dbus_proxy_agent = g_dbus_proxy_new_sync(connection_agent, G_DBUS_PROXY_FLAGS_NONE, NULL,
- "org.tizen.omadsagent", "/org/tizen/omadsagent",
- "org.tizen.omadsagent", NULL, &error);
- if (error) {
- MSG_DEBUG("Connecting to agent proxy failed: %s\n", error->message);
- goto _DBUS_ERROR;
- }
- result_agent = g_dbus_proxy_call_sync(dbus_proxy_agent, "Hello_Agent", NULL,
+ dbus_proxy_agent = g_dbus_proxy_new_sync(connection_agent, G_DBUS_PROXY_FLAGS_NONE, NULL,
+ "org.tizen.omadsagent", "/org/tizen/omadsagent",
+ "org.tizen.omadsagent", NULL, &error);
+ if (error) {
+ MSG_DEBUG("Connecting to agent proxy failed: %s\n", error->message);
+ goto _DBUS_ERROR;
+ }
+ result_agent = g_dbus_proxy_call_sync(dbus_proxy_agent, "Hello_Agent", NULL,
G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
- if (error) {
- MSG_DEBUG("invoking service error: %s\n", error->message);
- goto _DBUS_ERROR;
- }
+ if (error) {
+ MSG_DEBUG("invoking service error: %s\n", error->message);
+ goto _DBUS_ERROR;
}
- break;
- default:
- break;
+ }
+ break;
+ default:
+ break;
}
_DBUS_ERROR:
@@ -1190,9 +1146,9 @@ void SmsPluginWapPushHandler::handleWapPushCallback(char* pPushHeader, char* pPu
return;
}
- for(int i = 0; i < pushEvt_cnt; ++i) {
+ for (int i = 0; i < pushEvt_cnt; ++i) {
- /** check Push message receive setting */
+ /* check Push message receive setting */
bool bPushRecv = false;
int appcode = 0;
MsgSettingGetBool(PUSH_RECV_OPTION, &bPushRecv);
@@ -1205,7 +1161,7 @@ void SmsPluginWapPushHandler::handleWapPushCallback(char* pPushHeader, char* pPu
}
#ifdef FEATURE_MMS_DISABLE
- if (appcode == SMS_WAP_APPLICATION_MMS_UA){
+ if (appcode == SMS_WAP_APPLICATION_MMS_UA) {
MSG_DEBUG("Drop MMS Notification for DOCOMO");
return;
}
@@ -1218,119 +1174,95 @@ void SmsPluginWapPushHandler::handleWapPushCallback(char* pPushHeader, char* pPu
MSG_DEBUG("Received MMS Notification");
handleMMSNotification(pPushBody, PushBodyLen);
break;
-
case SMS_WAP_APPLICATION_PUSH_SI:
MSG_DEBUG("Received WAP Push (Service Indication Textual form)");
-// handleSIMessage(pPushBody, PushBodyLen, true);
+ /* handleSIMessage(pPushBody, PushBodyLen, true); */
break;
-
case SMS_WAP_APPLICATION_PUSH_SIC:
MSG_DEBUG("Received WAP Push (Service Indication Tokenised form)");
-// handleSIMessage(pPushBody, PushBodyLen, false);
+ /* handleSIMessage(pPushBody, PushBodyLen, false); */
break;
-
case SMS_WAP_APPLICATION_PUSH_SL:
MSG_DEBUG("Received WAP Push (Service Loading Textual form)");
-// handleSLMessage(pPushBody, PushBodyLen, true);
+ /* handleSLMessage(pPushBody, PushBodyLen, true); */
break;
-
case SMS_WAP_APPLICATION_PUSH_SLC:
MSG_DEBUG("Received WAP Push (Service Loading Tokenised form)");
-// handleSLMessage(pPushBody, PushBodyLen, false);
+ /* handleSLMessage(pPushBody, PushBodyLen, false); */
break;
-
case SMS_WAP_APPLICATION_PUSH_CO:
MSG_DEBUG("Received WAP Push (Cache Operation Textual form)");
-// handleCOMessage(pPushBody, PushBodyLen, true);
+ /* handleCOMessage(pPushBody, PushBodyLen, true); */
break;
-
case SMS_WAP_APPLICATION_PUSH_COC:
MSG_DEBUG("Received WAP Push (Cache Operation Tokenised form)");
-// handleCOMessage(pPushBody, PushBodyLen, false);
+ /* handleCOMessage(pPushBody, PushBodyLen, false); */
break;
-
case SMS_WAP_APPLICATION_SYNCML_DM_BOOTSTRAP:
MSG_DEBUG("Received DM BOOTSTRAP");
SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(DM_WBXML, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen);
break;
-
case SMS_WAP_APPLICATION_SYNCML_DM_BOOTSTRAP_XML:
MSG_DEBUG("Received DM BOOTSTRAP");
SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(DM_XML, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen);
break;
-
case SMS_WAP_APPLICATION_PUSH_PROVISIONING_XML:
MSG_DEBUG("Received Provisioning");
SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(CP_XML, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen);
break;
-
case SMS_WAP_APPLICATION_PUSH_PROVISIONING_WBXML:
MSG_DEBUG("Received Provisioning");
SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(CP_WBXML, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen);
break;
-
case SMS_WAP_APPLICATION_PUSH_BROWSER_SETTINGS:
case SMS_WAP_APPLICATION_PUSH_BROWSER_BOOKMARKS:
MSG_DEBUG("Received Provisioning");
SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(OTHERS, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen);
break;
-
case SMS_WAP_APPLICATION_SYNCML_DM_NOTIFICATION:
MSG_DEBUG("Received DM Notification");
SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(DM_NOTIFICATION, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen);
break;
-
case SMS_WAP_APPLICATION_SYNCML_DS_NOTIFICATION:
MSG_DEBUG("Received DS Notification");
SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(DS_NOTIFICATION, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen);
break;
-
case SMS_WAP_APPLICATION_SYNCML_DS_NOTIFICATION_WBXML:
MSG_DEBUG("Received DS Notification");
SmsPluginEventHandler::instance()->handleSyncMLMsgIncoming(DS_WBXML, pPushBody, PushBodyLen, pWspHeader, WspHeaderLen);
break;
-
case SMS_WAP_APPLICATION_DRM_UA_RIGHTS_XML:
case SMS_WAP_APPLICATION_DRM_UA_RIGHTS_WBXML:
MSG_DEBUG("Received DRM UA");
-
if (pPushBody != NULL)
handleDrmVer1(pPushBody, PushBodyLen);
-
break;
-
case SMS_WAP_APPLICATION_DRM_V2_RO_XML:
case SMS_WAP_APPLICATION_DRM_V2_ROAP_PDU_XML:
case SMS_WAP_APPLICATION_DRM_V2_ROAP_TRIGGER_XML:
case SMS_WAP_APPLICATION_DRM_V2_ROAP_TRIGGER_WBXML:
MSG_DEBUG("Received DRM V2");
- // TODO: DRM V2
+ /* TODO: DRM V2 */
break;
-
case SMS_WAP_APPLICATION_PUSH_EMAIL:
case SMS_WAP_APPLICATION_PUSH_EMAIL_XML:
case SMS_WAP_APPLICATION_PUSH_EMAIL_WBXML:
MSG_DEBUG("Received Email");
- // TODO: Email
+ /* TODO: Email */
break;
-
-
case SMS_WAP_APPLICATION_PUSH_IMPS_CIR:
MSG_DEBUG("Received IMPS CIR");
- // TODO: IMPS CIR
+ /* TODO: IMPS CIR */
break;
-
- case SMS_WAP_APPLICATION_LBS :
+ case SMS_WAP_APPLICATION_LBS:
MSG_DEBUG("Received LBS related message");
SmsPluginEventHandler::instance()->handleLBSMsgIncoming(pPushHeader, pPushBody, PushBodyLen);
- // TODO: LBS
+ /* TODO: LBS */
break;
-
- case SMS_WAP_APPLICATION_PUSH_SIA :
+ case SMS_WAP_APPLICATION_PUSH_SIA:
MSG_DEBUG("Received SIA");
- // TODO: SIA
+ /* TODO: SIA */
break;
-
default:
SmsPluginEventHandler::instance()->handlePushMsgIncoming(pPushHeader, pPushBody, PushBodyLen, app_id, content_type);
break;
@@ -1349,14 +1281,13 @@ void SmsPluginWapPushHandler::handleMMSNotification(const char *pPushBody, int P
#ifdef MSG_FW_FOR_DEBUG
printf("\n\n[handleMMSNotification] Push Body.\n");
- for (int i = 0; i < PushBodyLen; i++)
- {
+ for (int i = 0; i < PushBodyLen; i++) {
printf(" [%02x]", pPushBody[i]);
}
printf("\n\n");
#endif
- /** Make MSG_MESSAGE_INFO_S */
+ /* Make MSG_MESSAGE_INFO_S */
MSG_MESSAGE_INFO_S msgInfo;
memset(&msgInfo, 0x00, sizeof(MSG_MESSAGE_INFO_S));
@@ -1365,7 +1296,7 @@ void SmsPluginWapPushHandler::handleMMSNotification(const char *pPushBody, int P
createMsgInfo(&msgInfo);
- /** Convert Type values */
+ /* Convert Type values */
msgInfo.msgType.mainType = MSG_MMS_TYPE;
msgInfo.msgType.subType = MSG_NOTIFICATIONIND_MMS;
msgInfo.msgType.classType = MSG_CLASS_NONE;
@@ -1375,7 +1306,7 @@ void SmsPluginWapPushHandler::handleMMSNotification(const char *pPushBody, int P
if (msgInfo.dataSize > MAX_MSG_TEXT_LEN) {
msgInfo.bTextSms = false;
- /** Save Message Data into File */
+ /* Save Message Data into File */
char fileName[MSG_FILENAME_LEN_MAX+1];
memset(fileName, 0x00, sizeof(fileName));
@@ -1397,16 +1328,16 @@ void SmsPluginWapPushHandler::handleMMSNotification(const char *pPushBody, int P
msg_error_t err = MSG_SUCCESS;
- /** Add MMS Noti Msg into DB */
+ /* Add MMS Noti Msg into DB */
err = SmsPluginStorage::instance()->checkMessage(&msgInfo);
if (err == MSG_SUCCESS) {
- /** Callback */
+ /* Callback */
err = SmsPluginEventHandler::instance()->callbackMsgIncoming(&msgInfo);
- if (err != MSG_SUCCESS) {
+ if (err != MSG_SUCCESS)
MSG_DEBUG("callbackMsgIncoming() Error !! [%d]", err);
- }
+
} else {
MSG_DEBUG("checkMessage() Error !! [%d]", err);
}
@@ -1414,6 +1345,7 @@ void SmsPluginWapPushHandler::handleMMSNotification(const char *pPushBody, int P
MSG_END();
}
+
void SmsPluginWapPushHandler::handleSIMessage(char* pPushBody, int PushBodyLen, bool isText)
{
MSG_BEGIN();
@@ -1462,10 +1394,10 @@ void SmsPluginWapPushHandler::handleSIMessage(char* pPushBody, int PushBodyLen,
return;
}
- /** temporary set to max. */
+ /* temporary set to max. */
pushMsg.expires = 0xFFFFFFFF;
- /** setting received time */
+ /* setting received time */
time_t t = time(NULL);
time_t utfTime = time(&t);
@@ -1512,7 +1444,7 @@ void SmsPluginWapPushHandler::handleSIMessage(char* pPushBody, int PushBodyLen,
strncpy(pushMsg.contents, (char*)tmpXmlChar, MAX_WAPPUSH_CONTENTS_LEN-1);
- /** Write push Msg to file */
+ /* Write push Msg to file */
char fileName[MSG_FILENAME_LEN_MAX+1];
memset(fileName, 0x00, sizeof(fileName));
@@ -1528,7 +1460,7 @@ void SmsPluginWapPushHandler::handleSIMessage(char* pPushBody, int PushBodyLen,
THROW(MsgException::FILE_ERROR, "MsgWriteIpcFile error");
}
- /** Pack Message Info Structure */
+ /* Pack Message Info Structure */
MSG_MESSAGE_INFO_S msgInfo;
memset(&msgInfo, 0, sizeof(MSG_MESSAGE_INFO_S));
@@ -1539,7 +1471,7 @@ void SmsPluginWapPushHandler::handleSIMessage(char* pPushBody, int PushBodyLen,
strncpy(msgInfo.msgData, fileName, MAX_MSG_DATA_LEN);
- /** Convert Type values */
+ /* Convert Type values */
msgInfo.msgType.mainType = MSG_SMS_TYPE;
msgInfo.msgType.subType = MSG_WAP_SI_SMS;
@@ -1550,14 +1482,14 @@ void SmsPluginWapPushHandler::handleSIMessage(char* pPushBody, int PushBodyLen,
msg_error_t err = MSG_SUCCESS;
- /** Add WAP Push Msg into DB */
+ /* Add WAP Push Msg into DB */
err = SmsPluginStorage::instance()->checkMessage(&msgInfo);
if (err == MSG_SUCCESS) {
- /** Callback */
+ /* Callback */
err = SmsPluginEventHandler::instance()->callbackMsgIncoming(&msgInfo);
- if (err != MSG_SUCCESS){
+ if (err != MSG_SUCCESS) {
MSG_DEBUG("callbackMsgIncoming() Error !! [%d]", err);
}
} else {
@@ -1617,7 +1549,7 @@ void SmsPluginWapPushHandler::handleSLMessage(char* pPushBody, int PushBodyLen,
indNode = indNode->next;
}
- /** setting received time setting */
+ /* setting received time setting */
time_t t = time(NULL);
time_t utfTime = time(&t);
@@ -1635,9 +1567,9 @@ void SmsPluginWapPushHandler::handleSLMessage(char* pPushBody, int PushBodyLen,
tmpXmlChar = xmlGetProp(indNode, (xmlChar*)SMS_PUSH_XML_ACTION_TAG);
pushMsg.action = convertSLActionStrToEnum((char*)tmpXmlChar);
- /** Setting other parameters in default values */
+ /* Setting other parameters in default values */
pushMsg.created = pushMsg.received;
- /** temporary set to MAX value. */
+ /* temporary set to MAX value. */
pushMsg.expires = 0xFFFFFFFF;
MSG_DEBUG("check pushMsg data");
@@ -1649,7 +1581,7 @@ void SmsPluginWapPushHandler::handleSLMessage(char* pPushBody, int PushBodyLen,
MSG_DEBUG("pushMsg.href : [%s]", pushMsg.href);
MSG_DEBUG("pushMsg.contents : [%s]", pushMsg.contents);
- /** Write push Msg to file */
+ /* Write push Msg to file */
char fileName[MSG_FILENAME_LEN_MAX+1];
memset(fileName, 0x00, sizeof(fileName));
@@ -1659,7 +1591,7 @@ void SmsPluginWapPushHandler::handleSLMessage(char* pPushBody, int PushBodyLen,
if (MsgWriteIpcFile(fileName, (char*)(&pushMsg), sizeof(pushMsg)) == false)
THROW(MsgException::FILE_ERROR, "MsgWriteIpcFile error");
- /** Pack Message Info Structure */
+ /* Pack Message Info Structure */
MSG_MESSAGE_INFO_S msgInfo;
memset(&msgInfo, 0, sizeof(MSG_MESSAGE_INFO_S));
@@ -1670,22 +1602,22 @@ void SmsPluginWapPushHandler::handleSLMessage(char* pPushBody, int PushBodyLen,
strncpy(msgInfo.msgData, fileName, MAX_MSG_DATA_LEN);
- /** Convert Type values */
+ /* Convert Type values */
msgInfo.msgType.mainType = MSG_SMS_TYPE;
msgInfo.msgType.subType = MSG_WAP_SL_SMS;
- /** Update Msg Text */
+ /* Update Msg Text */
strncpy(msgInfo.msgText, pushMsg.href, MAX_MSG_TEXT_LEN);
msgInfo.dataSize = sizeof(pushMsg);
MSG_DEBUG("dataSize : %d", msgInfo.dataSize);
- /** Add WAP Push Msg into DB */
+ /* Add WAP Push Msg into DB */
err = SmsPluginStorage::instance()->checkMessage(&msgInfo);
if (err == MSG_SUCCESS) {
- /** Callback to MSG FW */
+ /* Callback to MSG FW */
err = SmsPluginEventHandler::instance()->callbackMsgIncoming(&msgInfo);
if (err != MSG_SUCCESS)
@@ -1702,6 +1634,7 @@ void SmsPluginWapPushHandler::handleSLMessage(char* pPushBody, int PushBodyLen,
return;
}
+
void SmsPluginWapPushHandler::handleCOMessage(char* pPushBody, int PushBodyLen, bool isText)
{
MSG_PUSH_CACHEOP_S cacheOp;
@@ -1735,8 +1668,7 @@ void SmsPluginWapPushHandler::handleCOMessage(char* pPushBody, int PushBodyLen,
indNode = topNode->xmlChildrenNode;
-
- while(indNode != NULL) {
+ while (indNode != NULL) {
xmlChar* tmpUrl = NULL;
if (!xmlStrcmp(indNode->name, (const xmlChar*) SMS_PUSH_XML_INVAL_OBJ)) {
@@ -1769,7 +1701,7 @@ void SmsPluginWapPushHandler::handleCOMessage(char* pPushBody, int PushBodyLen,
indNode = indNode->next;
}
- /** Write push Msg to file */
+ /* Write push Msg to file */
char fileName[MSG_FILENAME_LEN_MAX+1];
memset(fileName, 0x00, sizeof(fileName));
@@ -1783,7 +1715,7 @@ void SmsPluginWapPushHandler::handleCOMessage(char* pPushBody, int PushBodyLen,
THROW(MsgException::FILE_ERROR, "MsgWriteIpcFile error");
}
- /** Pack Message Info Structure */
+ /* Pack Message Info Structure */
MSG_MESSAGE_INFO_S msgInfo;
memset(&msgInfo, 0, sizeof(MSG_MESSAGE_INFO_S));
@@ -1794,7 +1726,7 @@ void SmsPluginWapPushHandler::handleCOMessage(char* pPushBody, int PushBodyLen,
strncpy(msgInfo.msgData, fileName, MAX_MSG_DATA_LEN);
- /** Convert Type values */
+ /* Convert Type values */
msgInfo.msgType.mainType = MSG_SMS_TYPE;
msgInfo.msgType.subType = MSG_WAP_CO_SMS;
@@ -1802,11 +1734,11 @@ void SmsPluginWapPushHandler::handleCOMessage(char* pPushBody, int PushBodyLen,
msg_error_t err = MSG_SUCCESS;
- /** Add WAP Push Msg into DB */
+ /* Add WAP Push Msg into DB */
err = SmsPluginStorage::instance()->checkMessage(&msgInfo);
if (err == MSG_SUCCESS) {
- /** Callback */
+ /* Callback */
err = SmsPluginEventHandler::instance()->callbackMsgIncoming(&msgInfo);
if (err != MSG_SUCCESS) {
@@ -1857,10 +1789,10 @@ void SmsPluginWapPushHandler::handleDrmVer1(char* pPushBody, int PushBodyLen)
void SmsPluginWapPushHandler::createMsgInfo(MSG_MESSAGE_INFO_S* pMsgInfo)
{
- /** Convert class Type values */
+ /* Convert class Type values */
pMsgInfo->msgType.classType = MSG_CLASS_NONE;
- /** set folder id (temporary) */
+ /* set folder id (temporary) */
pMsgInfo->folderId = MSG_INBOX_ID;
pMsgInfo->networkStatus = MSG_NETWORK_RECEIVED;
@@ -1870,9 +1802,8 @@ void SmsPluginWapPushHandler::createMsgInfo(MSG_MESSAGE_INFO_S* pMsgInfo)
pMsgInfo->direction = MSG_DIRECTION_TYPE_MT;
time_t rawtime = time(NULL);
-
-/*** Comment below lines to save local UTC time..... (it could be used later.)
-
+ /* Comment below lines to save local UTC time..... (it could be used later.) */
+ /*
if (tmpTimeStamp.format == SMS_TIME_ABSOLUTE) {
MSG_DEBUG("year : %d", tmpTimeStamp.time.absolute.year);
@@ -1922,12 +1853,11 @@ void SmsPluginWapPushHandler::createMsgInfo(MSG_MESSAGE_INFO_S* pMsgInfo)
strftime(displayTime, 32, "%Y-%02m-%02d %T %z", timeTM);
MSG_DEBUG("displayTime [%s]", displayTime);
}
-
-***/
+ */
pMsgInfo->displayTime = rawtime;
- /** Convert Address values */
+ /* Convert Address values */
pMsgInfo->nAddressCnt = 1;
pMsgInfo->addressList = (MSG_ADDRESS_INFO_S *)new char[sizeof(MSG_ADDRESS_INFO_S)];
@@ -1942,6 +1872,7 @@ void SmsPluginWapPushHandler::createMsgInfo(MSG_MESSAGE_INFO_S* pMsgInfo)
}
+
void SmsPluginWapPushHandler::getXmlDoc(const char* pPushBody, const int PushBodyLen, xmlDocPtr *pXmlDoc, const bool isText)
{
if (pPushBody == NULL) {
@@ -1949,7 +1880,6 @@ void SmsPluginWapPushHandler::getXmlDoc(const char* pPushBody, const int PushBod
return;
}
-
if (isText) {
*pXmlDoc = xmlParseMemory(pPushBody, AcStrlen(pPushBody));
} else {
@@ -1977,6 +1907,7 @@ void SmsPluginWapPushHandler::getXmlDoc(const char* pPushBody, const int PushBod
}
+
unsigned long SmsPluginWapPushHandler::convertXmlCharToSec(char* pDate)
{
struct tm timeStruct;
@@ -1987,13 +1918,13 @@ unsigned long SmsPluginWapPushHandler::convertXmlCharToSec(char* pDate)
memset(tmpBuf, 0x00, sizeof(tmpBuf));
memset(&timeStruct, 0x00, sizeof(struct tm));
- /** check pDate */
+ /* check pDate */
if (AcStrlen(pDate)<20)
return 0;
MSG_DEBUG("pDate [%s]", pDate);
- /** Year */
+ /* Year */
for (i = 0; i < 4; i++) {
tmpBuf[i] = pDate[index++];
}
@@ -2001,7 +1932,7 @@ unsigned long SmsPluginWapPushHandler::convertXmlCharToSec(char* pDate)
index++;
timeStruct.tm_year = (atoi( tmpBuf)-1900);
- /** Month */
+ /* Month */
for (i = 0; i < 2; i++) {
tmpBuf[i] = pDate[index++];
}
@@ -2009,7 +1940,7 @@ unsigned long SmsPluginWapPushHandler::convertXmlCharToSec(char* pDate)
index++;
timeStruct.tm_mon = (atoi( tmpBuf) - 1);
- /** Date */
+ /* Date */
for (i = 0; i < 2; i++) {
tmpBuf[i] = pDate[index++];
}
@@ -2017,7 +1948,7 @@ unsigned long SmsPluginWapPushHandler::convertXmlCharToSec(char* pDate)
index++;
timeStruct.tm_mday = atoi( tmpBuf);
- /** Hours */
+ /* Hours */
for (i = 0; i < 2; i++) {
tmpBuf[i] = pDate[index++];
}
@@ -2025,7 +1956,7 @@ unsigned long SmsPluginWapPushHandler::convertXmlCharToSec(char* pDate)
index++;
timeStruct.tm_hour = atoi( tmpBuf);
- /** Minites */
+ /* Minites */
for (i = 0; i < 2; i++) {
tmpBuf[i] = pDate[index++];
}
@@ -2033,7 +1964,7 @@ unsigned long SmsPluginWapPushHandler::convertXmlCharToSec(char* pDate)
index++;
timeStruct.tm_min = atoi( tmpBuf);
- /** Seconds */
+ /* Seconds */
for (i = 0; i < 2; i++) {
tmpBuf[i] = pDate[index++];
}
@@ -2046,6 +1977,7 @@ unsigned long SmsPluginWapPushHandler::convertXmlCharToSec(char* pDate)
return nTimeInSec;
}
+
msg_push_action_t SmsPluginWapPushHandler::convertSIActionStrToEnum(char* pAction)
{
int comp = 0;
@@ -2055,36 +1987,37 @@ msg_push_action_t SmsPluginWapPushHandler::convertSIActionStrToEnum(char* pActio
return MSG_PUSH_SI_ACTION_SIGNAL_MEDIUM;
}
- /** compare with signal-none. */
+ /* compare with signal-none. */
comp = g_strcmp0( "signal-none", pAction );
if (comp == 0)
return MSG_PUSH_SI_ACTION_SIGNAL_NONE;
- /** compare with signal-low. */
+ /* compare with signal-low. */
comp = g_strcmp0( "signal-low", pAction );
if (comp == 0)
return MSG_PUSH_SI_ACTION_SIGNAL_LOW;
- /** compare with signal-medium. */
+ /* compare with signal-medium. */
comp = g_strcmp0( "signal-medium", pAction );
if (comp == 0)
return MSG_PUSH_SI_ACTION_SIGNAL_MEDIUM;
- /** compare with signal-high. */
+ /* compare with signal-high. */
comp = g_strcmp0( "signal-high", pAction );
if (comp == 0)
return MSG_PUSH_SI_ACTION_SIGNAL_HIGH;
- /** compare with delete. */
+ /* compare with delete. */
comp = g_strcmp0( "delete", pAction );
if (comp == 0)
return MSG_PUSH_SI_ACTION_DELETE;
- /** signal-medium is default action value. */
+ /* signal-medium is default action value. */
return MSG_PUSH_SI_ACTION_SIGNAL_MEDIUM;
}
+
msg_push_action_t SmsPluginWapPushHandler::convertSLActionStrToEnum(char* pAction)
{
int comp = 0;
@@ -2094,22 +2027,22 @@ msg_push_action_t SmsPluginWapPushHandler::convertSLActionStrToEnum(char* pActio
return MSG_PUSH_SL_ACTION_EXECUTE_LOW;
}
- /** compare pSrcStr with execute-low. */
+ /* compare pSrcStr with execute-low. */
comp = g_strcmp0( "execute-low", pAction );
if (comp == 0)
return MSG_PUSH_SL_ACTION_EXECUTE_LOW;
- /** compare pSrcStr with execute-high. */
+ /* compare pSrcStr with execute-high. */
comp = g_strcmp0( "execute-high", pAction );
if (comp == 0)
return MSG_PUSH_SL_ACTION_EXECUTE_HIGH;
- /** compare pSrcStr with cache. */
+ /* compare pSrcStr with cache. */
comp = g_strcmp0( "cache", pAction );
if (comp == 0)
return MSG_PUSH_SL_ACTION_CACHE;
- /** default SL action value is execute-low. */
+ /* default SL action value is execute-low. */
return MSG_PUSH_SL_ACTION_EXECUTE_LOW;
}
@@ -2201,7 +2134,7 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un
if (fContentType) {
encodedHeader = new char[ encodedHeaderLen + 1 ];
- if (encodedHeader == NULL) {
+ if (encodedHeader == NULL) {
MSG_DEBUG("encodedHeader Memory allocation is failed.\n" );
return;
}
@@ -2209,7 +2142,7 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un
memcpy( encodedHeader + 1, sEncodedHeader, (size_t)encodedHeaderLen );
} else {
encodedHeader = new char[ encodedHeaderLen ];
- if (encodedHeader == NULL) {
+ if (encodedHeader == NULL) {
MSG_DEBUG("encodedHeader Memory allocation is failed.\n" );
return;
}
@@ -2273,8 +2206,7 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un
unsigned char fieldValue[1275];
fieldCode = track & 0x7f;
/*
- if (( fieldValueLen == 0 ) || ( fieldValueLen == 0x80 ))
- {
+ if (( fieldValueLen == 0 ) || ( fieldValueLen == 0x80 )) {
dprint( DNET_WAP,DNET_DBG_HIGH, "%X %X %X %X %X %X\n" , fieldCode, encodedHeader[iEncodedHeader + 1], encodedHeader[iEncodedHeader + 2],encodedHeader[iEncodedHeader + 3],encodedHeader[iEncodedHeader + 4], encodedHeader[iEncodedHeader + 5] );
}
*/
@@ -2328,7 +2260,7 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un
if (fieldValueLen == 1) {
/* field value is one byte integer over 0x80 */
- /** make it two byte integer */
+ /* make it two byte integer */
fieldValue[0] = 0x00;
memcpy( fieldValue + 1, encodedHeader + iEncodedHeader + 2, (size_t)fieldValueLen);
fieldValueLen = 2;
@@ -2361,560 +2293,554 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un
}
- switch ( fieldCode )
- {
- /* accept charset */
- /* It's normal way of field process. */
- case 0x01 :
- {
- unsigned long i = 0;
- unsigned long code;
-
- /* Case of length of charset greater than 1 are two thigins.
- 1. code length of charset is greater than 1.
- 2. It include parameter.
- 3. Or both of two
- */
- if (1 != fieldValueLen) {
- code = wspHeaderDecodeInteger( fieldValue );
- /* Calculate iField. */
- if (fieldValue[0] < 0x80 )
- iField = fieldValue[0];
- else
- iField = 1;
-
- while ( wspCharset[i].charsetCode != code )
- i++;
- strncat( (char*)temper, (char*)wspCharset[i].charsetName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
- /* If parameter exist */
- if (iField < fieldValueLen) {
- char* param = NULL;
- unique_ptr<char*, void(*)(char**)> parambuf(&param, unique_ptr_deleter);
- wspHeaderDecodeQValue( fieldValueLen - iField, fieldValue + iField, &param);
- strncat( (char*)temper, (char*)param, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
- }
- } else {
- code = fieldValue[0] & 0x7f;
+ switch (fieldCode) {
+ /* accept charset */
+ /* It's normal way of field process. */
+ case 0x01:
+ {
+ unsigned long i = 0;
+ unsigned long code;
+
+ /* Case of length of charset greater than 1 are two thigins.
+ 1. code length of charset is greater than 1.
+ 2. It include parameter.
+ 3. Or both of two
+ */
+ if (1 != fieldValueLen) {
+ code = wspHeaderDecodeInteger( fieldValue );
+ /* Calculate iField. */
+ if (fieldValue[0] < 0x80 )
+ iField = fieldValue[0];
+ else
+ iField = 1;
- while (( wspCharset[i].charsetCode != code ) && ( wspCharset[i].charsetCode != 0xffff )) i++;
- strncat( (char*)temper, (char*)wspCharset[i].charsetName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+ while ( wspCharset[i].charsetCode != code )
+ i++;
+ strncat( (char*)temper, (char*)wspCharset[i].charsetName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+ /* If parameter exist */
+ if (iField < fieldValueLen) {
+ char* param = NULL;
+ unique_ptr<char*, void(*)(char**)> parambuf(&param, unique_ptr_deleter);
+ wspHeaderDecodeQValue( fieldValueLen - iField, fieldValue + iField, &param);
+ strncat( (char*)temper, (char*)param, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
}
+ } else {
+ code = fieldValue[0] & 0x7f;
+ while (( wspCharset[i].charsetCode != code ) && ( wspCharset[i].charsetCode != 0xffff )) i++;
+ strncat( (char*)temper, (char*)wspCharset[i].charsetName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
}
- break;
- /* type encoding */
- /* Like below routine, Same decoding routine process together. */
- /* Accept-encoding */
- case 0x02 :
- /* content-encoding */
- case 0x0b :
- {
- int integerValue;
-
- integerValue = wspHeaderDecodeIntegerByLength(fieldValue, fieldValueLen );
- if (integerValue > 2) {
- MSG_DEBUG("WspLDecodeHeader: integerValue is over limit(2).\n");
- break;
- }
- strncat( (char*)temper, (char*)wspEncodeMethod[integerValue], (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
+ }
+ break;
+
+ /* type encoding */
+ /* Like below routine, Same decoding routine process together. */
+ /* Accept-encoding */
+ case 0x02:
+ /* content-encoding */
+ case 0x0b:
+ {
+ int integerValue;
+
+ integerValue = wspHeaderDecodeIntegerByLength(fieldValue, fieldValueLen );
+ if (integerValue > 2) {
+ MSG_DEBUG("WspLDecodeHeader: integerValue is over limit(2).\n");
+ break;
+ }
+ strncat( (char*)temper, (char*)wspEncodeMethod[integerValue], (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
+ }
+ break;
+ /* contents type decoder */
+ /* accept */
+ case 0x00:
+ /* content-type */
+ case 0x11:
+ {
+ unsigned long contentsTypeCode;
+ unsigned long i = 0;
+ /* encoded content type length body */
+ unsigned long tempLen;
+ MSG_DEBUG("fieldValueLen: %d", fieldValueLen);
+
+ /* Like HTTP result state 304, it's for processing without Content type. This part doesn't defined. */
+ if (0 == fieldValueLen) {
+ strncat( (char*)temper, (char*)"None" , (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
+ break;
+ }
+ /* 01 AE --> 00 AE --> AE*/
+ if (fieldValueLen == 2 && fieldValue[0] == 0) {
+ memcpy( fieldValue, encodedHeader + iEncodedHeader -1, (size_t)fieldValueLen-1 );
+ MSG_DEBUG("WspLDecodeHeader:For mmO2 problem\r\n" );
}
- break;
- /* contents type decoder */
- /* accept */
- case 0x00 :
- /* content-type */
- case 0x11 :
- {
- unsigned long contentsTypeCode;
- unsigned long i = 0;
- /* encoded content type length body */
- unsigned long tempLen;
- MSG_DEBUG("fieldValueLen: %d", fieldValueLen);
-
- /* Like HTTP result state 304, it's for processing without Content type. This part doesn't defined. */
- if (0 == fieldValueLen) {
- strncat( (char*)temper, (char*)"None" , (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
- break;
- }
- /* 01 AE --> 00 AE --> AE*/
- if (fieldValueLen == 2 && fieldValue[0] == 0) {
- memcpy( fieldValue, encodedHeader + iEncodedHeader -1, (size_t)fieldValueLen-1 );
- MSG_DEBUG("WspLDecodeHeader:For mmO2 problem\r\n" );
- }
-
- if ((fieldValue[0] < 0x20 ) || (fieldValue[0] >= 0x80 )) {
- if (fieldValue[0] >= 0x80) {
- tempLen = 1;
- } else if (fieldValueLen == 2 && fieldValue[0] == 0x03 && fieldValue[1] == 0x0A) { /** 06 05 02 03 0A AF 89 */
- fieldValue[3] = fieldValue[2];
- fieldValue[2] = fieldValue[1];
- fieldValue[1] = fieldValue[0];
- fieldValue[0] = 0x02;
- tempLen = 2;
- fieldValueLen = 3;
- MSG_DEBUG("WspLDecodeHeader:For CPE problem\r\n" );
- } else {
- tempLen = fieldValue[0]; /** 06 06 03 02 03 16 AF 88 */
- }
-
- if (tempLen == 1) {
-
- char* szExtendedContent;
-
- contentsTypeCode = fieldValue[0] & 0x7f;
- while (( wspContentsType[i].contentsTypeCode != contentsTypeCode ) && ( i < wspContentsTypeCount )) i++;
- /* If specified content type doesn't exist */
- if (i < wspContentsTypeCount)
- strncat( (char*)temper, (char*)wspContentsType[i].contentsTypeName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+ if ((fieldValue[0] < 0x20 ) || (fieldValue[0] >= 0x80 )) {
+ if (fieldValue[0] >= 0x80) {
+ tempLen = 1;
+ } else if (fieldValueLen == 2 && fieldValue[0] == 0x03 && fieldValue[1] == 0x0A) { /* 06 05 02 03 0A AF 89 */
+ fieldValue[3] = fieldValue[2];
+ fieldValue[2] = fieldValue[1];
+ fieldValue[1] = fieldValue[0];
+ fieldValue[0] = 0x02;
+ tempLen = 2;
+ fieldValueLen = 3;
+ MSG_DEBUG("WspLDecodeHeader:For CPE problem\r\n" );
+ } else {
+ tempLen = fieldValue[0]; /* 06 06 03 02 03 16 AF 88 */
+ }
- szExtendedContent = wspExtendedDecodeType( (char)contentsTypeCode );
+ if (tempLen == 1) {
+ char* szExtendedContent;
- if (szExtendedContent != NULL) {
- MSG_DEBUG("WspLDecodeHeader: Tele2 server problem \n " );
- strncat( (char*)temper, (char*)szExtendedContent, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
- }
- } else {
- contentsTypeCode = wspHeaderDecodeInteger(fieldValue);
+ contentsTypeCode = fieldValue[0] & 0x7f;
+ while (( wspContentsType[i].contentsTypeCode != contentsTypeCode ) && ( i < wspContentsTypeCount )) i++;
- while ((i < wspUnregisteredContentsTypeCount) && (wspUnregisterContentsType[i].contentsTypeCode != contentsTypeCode)) i++;
+ /* If specified content type doesn't exist */
+ if (i < wspContentsTypeCount)
+ strncat( (char*)temper, (char*)wspContentsType[i].contentsTypeName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
- /** If there is a Content-Type assigned, */
- if (i < wspUnregisteredContentsTypeCount)
- strncat ((char*)temper, (char*)wspUnregisterContentsType[i].contentsTypeName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
+ szExtendedContent = wspExtendedDecodeType( (char)contentsTypeCode );
- tempLen +=1;
+ if (szExtendedContent != NULL) {
+ MSG_DEBUG("WspLDecodeHeader: Tele2 server problem \n " );
+ strncat( (char*)temper, (char*)szExtendedContent, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
}
} else {
- tempLen = AcStrlen( (char*)fieldValue ) + 1;
+ contentsTypeCode = wspHeaderDecodeInteger(fieldValue);
- strncat ((char*)temper, (char*)fieldValue, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
- MSG_DEBUG("WspLDecodeHeader: Attention, Decoding Check of Content-Type\n ", tempLen);
- }
+ while ((i < wspUnregisteredContentsTypeCount) && (wspUnregisterContentsType[i].contentsTypeCode != contentsTypeCode))
+ i++;
- /* If there is a parameter */
- if (tempLen < fieldValueLen) {
- char* param = NULL;
- unique_ptr<char*, void(*)(char**)> parambuf(&param, unique_ptr_deleter);
- wspHeaderDecodeParameter( fieldValue + tempLen, fieldValueLen - tempLen, &param);
- if (param != NULL) {
- strncat( (char*)temper, "; ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
- strncat( (char*)temper, (char*)param, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
- }
- }
- }
- break;
+ /* If there is a Content-Type assigned, */
+ if (i < wspUnregisteredContentsTypeCount)
+ strncat ((char*)temper, (char*)wspUnregisterContentsType[i].contentsTypeName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
- /* language */
- /* content-language */
- case 0x0c :
- /* accept-language */
- case 0x03 :
- {
- unsigned long i = 0;
- unsigned long code;
- unsigned long tempLen;
- if ((fieldValue[0] < 0x20 ) || (fieldValue[0] > 0x80 )) {
- if (fieldValue[0] > 0x80 )
- tempLen = 1;
- else
- tempLen = fieldValue[0];
- } else {
- tempLen = AcStrlen( (char*)fieldValue ) + 1;
+ tempLen +=1;
}
+ } else {
+ tempLen = AcStrlen( (char*)fieldValue ) + 1;
- if (tempLen == 1) {
-
- code = wspHeaderDecodeInteger( fieldValue );
- while ( wspLanguage[i].languageCode != code) {
- i++;
- if (i == wspLanguageCount)
- break;
- }
-
- if (i < wspLanguageCount) {
- strncat( (char*)temper, (char*)wspLanguage[i].languageName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
- }
- } else {
- strncat( (char*)temper, (char*)fieldValue, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
- }
+ strncat ((char*)temper, (char*)fieldValue, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
+ MSG_DEBUG("WspLDecodeHeader: Attention, Decoding Check of Content-Type\n ", tempLen);
+ }
- if (tempLen < fieldValueLen) {
- char* param = NULL;
- unique_ptr<char*, void(*)(char**)> parambuf(&param, unique_ptr_deleter);
- wspHeaderDecodeQValue( fieldValueLen - tempLen, fieldValue + tempLen, &param );
+ /* If there is a parameter */
+ if (tempLen < fieldValueLen) {
+ char* param = NULL;
+ unique_ptr<char*, void(*)(char**)> parambuf(&param, unique_ptr_deleter);
+ wspHeaderDecodeParameter( fieldValue + tempLen, fieldValueLen - tempLen, &param);
+ if (param != NULL) {
+ strncat( (char*)temper, "; ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
strncat( (char*)temper, (char*)param, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
}
}
- break;
-
- /* integer */
- /* Max-forwards */
- case 0x1e :
- /* content-length */
- case 0x0d :
- /* age */
- case 0x05 :
- /* Bearer-indication */
- case 0x33 :
- /* Push-Flag */
- case 0x34 :
- {
-
- unsigned char temp[16];
- /*
- if (( fieldValueLen == 2 ) && ( fieldValue[0] > 0x7f ))
- AcSprintf( (char*)temp, "%u", (unsigned int)fieldValue[1]);
+ }
+ break;
+
+ /* language */
+ /* content-language */
+ case 0x0c:
+ /* accept-language */
+ case 0x03:
+ {
+ unsigned long i = 0;
+ unsigned long code;
+ unsigned long tempLen;
+ if ((fieldValue[0] < 0x20 ) || (fieldValue[0] > 0x80 )) {
+ if (fieldValue[0] > 0x80 )
+ tempLen = 1;
else
- */
- snprintf( (char*)temp, sizeof(temp), "%u", (unsigned int)wspHeaderDecodeIntegerByLength( fieldValue, fieldValueLen ));
- strncat( (char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+ tempLen = fieldValue[0];
+ } else {
+ tempLen = AcStrlen( (char*)fieldValue ) + 1;
}
- break;
- /* X-Wap-Application-Id */
- case 0x2f :
- {
- unsigned char temp[64];
- int integerValue;
-
- if (fieldValueLen == 2 && fieldValue[0] == 0) {
- memcpy( fieldValue, encodedHeader + iEncodedHeader -1, (size_t)fieldValueLen-1 );
- MSG_DEBUG("WspLDecodeHeader:For mmO2 problem\r\n" );
- fieldValueLen = 1;
- }
- integerValue = wspHeaderDecodeIntegerByLength(fieldValue, fieldValueLen);
+ if (tempLen == 1) {
- int count = sizeof(wspHeaderApplId)/sizeof(SMS_WSP_HEADER_PARAMETER_S);
- for(int i = 0; i < count ; ++i)
- {
- if ((unsigned int)integerValue == wspHeaderApplId[i].parameterCode)
- {
- snprintf((char*)temp, 64, "%s", wspHeaderApplId[i].parameterToken);
- strncat((char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1);
+ code = wspHeaderDecodeInteger( fieldValue );
+ while ( wspLanguage[i].languageCode != code) {
+ i++;
+ if (i == wspLanguageCount)
break;
- }
}
- }
- break;
- /* Accept-Application */
- case 0x32 :
- if (0x80 == fieldValue[0]) {
- strncat( (char*)temper, "*", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1 );
- } else {
-
- unsigned char temp[16];
- /*
- if (( fieldValueLen == 2 ) && ( fieldValue[0] == 1 ))
- AcSprintf( (char*)temp, "%u", (unsigned int)fieldValue[0]);
- else
- */
- snprintf( (char*)temp, sizeof(temp), "%u", (unsigned int)wspHeaderDecodeIntegerByLength( fieldValue, fieldValueLen ));
- strncat( (char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1);
- }
- break;
-
-
- /* date */
- /* last-modified */
- case 0x1d :
- /* if-unmodified-since */
- case 0x1b :
- /* if-range */
- case 0x1a :
- /* if-modified-since */
- case 0x17 :
- /* expires */
- case 0x14 :
- /* date */
- case 0x12 :
- {
- char* decodedString = NULL;
- unique_ptr<char*, void(*)(char**)> decodedStringbuf(&decodedString, unique_ptr_deleter);
- wspHeaderDecodeDateValue( fieldValueLen, fieldValue, &decodedString);
- strncat( (char*)temper, (char*)decodedString, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1 );
- }
- break;
-
- /* connection */
- case 0x09 :
- if (fieldValue[0] == 0x80 )
- strncat( (char*)temper, "Close", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1 );
- break;
- /* accept-ranges */
- case 0x04 :
- if (fieldValue[0] == 0x80 )
- strncat( (char*)temper, "None", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1 );
- if (fieldValue[0] == 0x81 )
- strncat( (char*)temper, "Bytes", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1 );
- break;
- /* content-md5 */
- case 0x0f :
- {
- unsigned char temp[1275];
- memcpy( temp, fieldValue, (size_t)fieldValueLen );
- temp[fieldValueLen] = 0;
- wspHeaderCopyDecodedString( temp, &currentLength, &temper );
- }
- break;
- /* Credential */
- /* authorization */
- case 0x07 :
- /* proxy - authorization */
- case 0x21 :
- if (fieldValue[0] == 0x80) {
- char* addString = NULL;
- unique_ptr<char*, void(*)(char**)> addStringbuf(&addString, unique_ptr_deleter);
- wspHeaderDecodeAuth(fieldValueLen, fieldValue, &addString );
- strncat( (char*)temper, addString, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
- } else {
- iField = AcStrlen( (char*)fieldValue) + 1;
- strncat( (char*)temper, (char*)fieldValue, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
- if (iField < fieldValueLen) {
- char* param = NULL;
- unique_ptr<char*, void(*)(char**)> parambuf(&param, unique_ptr_deleter);
- wspHeaderDecodeParameter( fieldValue + 1, fieldValueLen - 1, &param );
- if (param != NULL) {
- strncat( (char*)temper, ", ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
- strncat( (char*)temper, (char*)param, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
- }
+ if (i < wspLanguageCount) {
+ strncat( (char*)temper, (char*)wspLanguage[i].languageName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
}
- }
- break;
-
-
- /* Challenge */
- /* www - auth */
- case 0x2d :
- /* Proxy-authenticate */
- case 0x20 :
- if (0 == fieldValueLen )
- break;
- if (fieldValue[0] == 0x80) {
- char* addString = NULL;
- unique_ptr<char*, void(*)(char**)> addStringbuf(&addString, unique_ptr_deleter);
- wspHeaderDecodeChallenge(fieldValueLen, fieldValue, &addString );
- strncat( (char*)temper, addString, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
} else {
- unsigned char authScheme[WSP_STANDARD_STR_LEN_MAX + 1];
- unsigned char realmValue[WSP_STANDARD_STR_LEN_MAX];
- unsigned char addedString[WSP_STANDARD_STR_LEN_MAX];
-
- strncpy( (char*)authScheme, (char*)fieldValue, WSP_STANDARD_STR_LEN_MAX -1);
- iField = AcStrlen( (char*)authScheme ) + 1;
- strncpy( (char*)realmValue, (char*)(fieldValue + iField ), WSP_STANDARD_STR_LEN_MAX-1);
- iField = iField + AcStrlen( (char*)realmValue ) + 1;
- snprintf( (char*)addedString, sizeof(addedString), "%s %s", authScheme, realmValue );
- wspHeaderCopyDecodedString( addedString, &currentLength, &temper );
-
- if (iField < fieldValueLen) {
- char* param = NULL;
- unique_ptr<char*, void(*)(char**)> parambuf(&param, unique_ptr_deleter);
- wspHeaderDecodeParameter( fieldValue + iField, fieldValueLen - iField, &param );
- if (param != NULL) {
- strncat( (char*)temper, ", ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
- wspHeaderCopyDecodedString( (unsigned char*)param, &currentLength, &temper );
- }
- }
+ strncat( (char*)temper, (char*)fieldValue, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
}
- break;
-
- /* content -range */
- case 0x10 :
- {
- unsigned long first, len, last;
-
- unsigned char temp[16];
- iField = 0;
-
- strncat( (char*)temper," bytes ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
- first = wspRetriveUintvarDecode( fieldValue, &iField );
- len = wspRetriveUintvarDecode( fieldValue, &iField );
- /* Originally range of HTTP include entity length. But WSP omit it. Finally to calculate this, it should be get content length from export. If this field is included without content length, then it can get wrong result. This content length can be get by calculating PDU length.
- */
- last = first + contentsLength - 1;
-
- snprintf( (char*)temp, sizeof(temp), "%u-%u/%u", (unsigned int)first, (unsigned int)last, (unsigned int)len );
- strncat( (char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+ if (tempLen < fieldValueLen) {
+ char* param = NULL;
+ unique_ptr<char*, void(*)(char**)> parambuf(&param, unique_ptr_deleter);
+ wspHeaderDecodeQValue( fieldValueLen - tempLen, fieldValue + tempLen, &param );
+ strncat( (char*)temper, (char*)param, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
}
- break;
-
- /* cache-control */
- case 0x08 :
- {
- char* cacheString = NULL;
- unique_ptr<char*, void(*)(char**)> cacheStringbuf(&cacheString, unique_ptr_deleter);
-
- wspHeaderDecodeCacheControl( fieldValue, fieldValueLen, &cacheString );
- strncat( (char*)temper, (char*)cacheString, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+ }
+ break;
+
+ /* integer */
+ /* Max-forwards */
+ case 0x1e:
+ /* content-length */
+ case 0x0d:
+ /* age */
+ case 0x05:
+ /* Bearer-indication */
+ case 0x33:
+ /* Push-Flag */
+ case 0x34:
+ {
+
+ unsigned char temp[16];
+ /*
+ if (( fieldValueLen == 2 ) && ( fieldValue[0] > 0x7f ))
+ AcSprintf( (char*)temp, "%u", (unsigned int)fieldValue[1]);
+ else
+ */
+ snprintf( (char*)temp, sizeof(temp), "%u", (unsigned int)wspHeaderDecodeIntegerByLength( fieldValue, fieldValueLen ));
+ strncat( (char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+ }
+ break;
+ /* X-Wap-Application-Id */
+ case 0x2f:
+ {
+ unsigned char temp[64];
+ int integerValue;
+
+ if (fieldValueLen == 2 && fieldValue[0] == 0) {
+ memcpy( fieldValue, encodedHeader + iEncodedHeader -1, (size_t)fieldValueLen-1 );
+ MSG_DEBUG("WspLDecodeHeader:For mmO2 problem\r\n" );
+ fieldValueLen = 1;
}
- break;
- /* pragma */
- case 0x1f :
- if (fieldValue[0] == 0x80) {
- strncat( (char*)temper, (char*)wspCacheControl[0], (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
- } else {
- if (1 < fieldValueLen) {
- char* param = NULL;
- unique_ptr<char*, void(*)(char**)> parambuf(&param, unique_ptr_deleter);
- wspHeaderDecodeParameter( fieldValue, fieldValueLen, &param );
+ integerValue = wspHeaderDecodeIntegerByLength(fieldValue, fieldValueLen);
- if (param != NULL) {
- strncat( (char*)temper, "; ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
- strncat( (char*)temper, (char*)param, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
- }
+ int count = sizeof(wspHeaderApplId)/sizeof(SMS_WSP_HEADER_PARAMETER_S);
+ for (int i = 0; i < count ; ++i) {
+ if ((unsigned int)integerValue == wspHeaderApplId[i].parameterCode) {
+ snprintf((char*)temp, 64, "%s", wspHeaderApplId[i].parameterToken);
+ strncat((char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1);
+ break;
}
}
+ }
+ break;
+ /* Accept-Application */
+ case 0x32:
+ if (0x80 == fieldValue[0]) {
+ strncat( (char*)temper, "*", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1 );
+ } else {
- break;
- /* public */
- case 0x22 :
- /* allow */
- case 0x06 :
- {
- unsigned long i = 0;
- while ( wspHeaderDecodeIntegerByLength( fieldValue, fieldValueLen ) != wspMethodType[i].methodCode ) i++;
- strncat( (char*)temper, (char*)wspMethodType[i].methodName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
- }
- break;
- /* range */
- case 0x23 :
- strncat( (char*)temper, "bytes=", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
- if (fieldValue[0] == 0x80) {
- unsigned char temp[16];
- unsigned long first, last;
- iField = 0;
-
- first = wspRetriveUintvarDecode( fieldValue, &iField );
- last = wspRetriveUintvarDecode( fieldValue, &iField );
-
- snprintf( (char*)temp, sizeof(temp), "%u-%u", (unsigned int)first, (unsigned int)last );
- strncat( (char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
- }
- if (fieldValue[0] == 0x81) {
- unsigned char temp[16];
- unsigned long suffix;
-
- suffix = wspRetriveUintvarDecode( fieldValue, &iField );
-
- snprintf( (char*)temp, sizeof(temp), "-%u", (unsigned int)suffix );
+ unsigned char temp[16];
+ /*
+ if (( fieldValueLen == 2 ) && ( fieldValue[0] == 1 ))
+ AcSprintf( (char*)temp, "%u", (unsigned int)fieldValue[0]);
+ else
+ */
+ snprintf( (char*)temp, sizeof(temp), "%u", (unsigned int)wspHeaderDecodeIntegerByLength( fieldValue, fieldValueLen ));
+ strncat( (char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1);
+ }
+ break;
+
+
+ /* date */
+ /* last-modified */
+ case 0x1d:
+ /* if-unmodified-since */
+ case 0x1b:
+ /* if-range */
+ case 0x1a:
+ /* if-modified-since */
+ case 0x17:
+ /* expires */
+ case 0x14:
+ /* date */
+ case 0x12:
+ {
+ char* decodedString = NULL;
+ unique_ptr<char*, void(*)(char**)> decodedStringbuf(&decodedString, unique_ptr_deleter);
+ wspHeaderDecodeDateValue( fieldValueLen, fieldValue, &decodedString);
+ strncat( (char*)temper, (char*)decodedString, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1 );
+ }
+ break;
+
+ /* connection */
+ case 0x09:
+ if (fieldValue[0] == 0x80 )
+ strncat( (char*)temper, "Close", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1 );
+ break;
+ /* accept-ranges */
+ case 0x04:
+ if (fieldValue[0] == 0x80 )
+ strncat( (char*)temper, "None", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1 );
+ if (fieldValue[0] == 0x81 )
+ strncat( (char*)temper, "Bytes", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1 );
+ break;
+ /* content-md5 */
+ case 0x0f:
+ {
+ unsigned char temp[1275];
+ memcpy( temp, fieldValue, (size_t)fieldValueLen );
+ temp[fieldValueLen] = 0;
+ wspHeaderCopyDecodedString( temp, &currentLength, &temper );
+ }
+ break;
+ /* Credential */
+ /* authorization */
+ case 0x07:
+ /* proxy - authorization */
+ case 0x21:
+ if (fieldValue[0] == 0x80) {
+ char* addString = NULL;
+ unique_ptr<char*, void(*)(char**)> addStringbuf(&addString, unique_ptr_deleter);
+ wspHeaderDecodeAuth(fieldValueLen, fieldValue, &addString );
+ strncat( (char*)temper, addString, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+ } else {
+ iField = AcStrlen( (char*)fieldValue) + 1;
+ strncat( (char*)temper, (char*)fieldValue, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+ if (iField < fieldValueLen) {
+ char* param = NULL;
+ unique_ptr<char*, void(*)(char**)> parambuf(&param, unique_ptr_deleter);
+ wspHeaderDecodeParameter( fieldValue + 1, fieldValueLen - 1, &param );
+ if (param != NULL) {
+ strncat( (char*)temper, ", ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+ strncat( (char*)temper, (char*)param, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+ }
}
+ }
+ break;
+
+ /* Challenge */
+ /* www - auth */
+ case 0x2d:
+ /* Proxy-authenticate */
+ case 0x20:
+ if (0 == fieldValueLen )
break;
- /* retry-after */
- case 0x25 :
- if (fieldValue[0] == 0x80) {
- char* temp = NULL;
- unique_ptr<char*, void(*)(char**)> tempbuf(&temp, unique_ptr_deleter);
-
- wspHeaderDecodeDateValue( fieldValueLen - 1, fieldValue + 1, &temp );
- strncat( (char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+ if (fieldValue[0] == 0x80) {
+ char* addString = NULL;
+ unique_ptr<char*, void(*)(char**)> addStringbuf(&addString, unique_ptr_deleter);
+ wspHeaderDecodeChallenge(fieldValueLen, fieldValue, &addString );
+ strncat( (char*)temper, addString, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+ } else {
+ unsigned char authScheme[WSP_STANDARD_STR_LEN_MAX + 1];
+ unsigned char realmValue[WSP_STANDARD_STR_LEN_MAX];
+ unsigned char addedString[WSP_STANDARD_STR_LEN_MAX];
+
+ strncpy( (char*)authScheme, (char*)fieldValue, WSP_STANDARD_STR_LEN_MAX -1);
+ iField = AcStrlen( (char*)authScheme ) + 1;
+ strncpy( (char*)realmValue, (char*)(fieldValue + iField ), WSP_STANDARD_STR_LEN_MAX-1);
+ iField = iField + AcStrlen( (char*)realmValue ) + 1;
+ snprintf( (char*)addedString, sizeof(addedString), "%s %s", authScheme, realmValue );
+ wspHeaderCopyDecodedString( addedString, &currentLength, &temper );
+
+ if (iField < fieldValueLen) {
+ char* param = NULL;
+ unique_ptr<char*, void(*)(char**)> parambuf(&param, unique_ptr_deleter);
+ wspHeaderDecodeParameter( fieldValue + iField, fieldValueLen - iField, &param );
+ if (param != NULL) {
+ strncat( (char*)temper, ", ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+ wspHeaderCopyDecodedString( (unsigned char*)param, &currentLength, &temper );
+ }
}
+ }
+ break;
- if (fieldValue[0] == 0x81) {
- unsigned char temp[16];
+ /* content -range */
+ case 0x10:
+ {
+ unsigned long first, len, last;
- snprintf( (char*)temp, sizeof(temp), "%u", (unsigned int)wspHeaderDecodeIntegerByLength( fieldValue,fieldValueLen ));
- strncat( (char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
- }
- break;
- /* transfer-encoding */
- case 0x27 :
- /* No other cases allowed */
- if (fieldValue[0] == 0x80 )
- strncat( (char*)temper, "chunked", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+ unsigned char temp[16];
+ iField = 0;
- break;
- /* vary */
- case 0x2a :
- {
- int integerValue = wspHeaderDecodeIntegerByLength(fieldValue,fieldValueLen );
- if (integerValue > wspHeaderFieldCount) {
- MSG_DEBUG("WspLDecodeHeader: integerValue is over limit(0x%x).\n",wspHeaderFieldCount);
- break;
- }
- strncat( (char*)temper, (char*)wspHeaderFieldName[integerValue], (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
- }
- break;
- /* warning */
- case 0x2c :
- {
- unsigned char temp[WSP_STANDARD_STR_LEN_MAX];
+ strncat( (char*)temper," bytes ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
- if (fieldValue[0] < 0x20 )
- iField = fieldValue[0];
- else
- iField = 1;
+ first = wspRetriveUintvarDecode( fieldValue, &iField );
+ len = wspRetriveUintvarDecode( fieldValue, &iField );
+ /* Originally range of HTTP include entity length. But WSP omit it. Finally to calculate this, it should be get content length from export. If this field is included without content length, then it can get wrong result. This content length can be get by calculating PDU length. */
+ last = first + contentsLength - 1;
- snprintf( (char*)temp, sizeof(temp), "%u", (unsigned int)wspHeaderDecodeIntegerByLength( fieldValue, iField ));
- strncat( (char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
- if (iField < fieldValueLen) {
- unsigned char agent[WSP_STANDARD_STR_LEN_MAX];
- unsigned char text[WSP_STANDARD_STR_LEN_MAX];
- strncpy( (char*)agent, (char*)(fieldValue + iField ),WSP_STANDARD_STR_LEN_MAX-1);
- iField = iField + AcStrlen((char*)agent ) + 1;
- strncpy((char*)text, (char*)(fieldValue + iField ),WSP_STANDARD_STR_LEN_MAX-1);
- snprintf( (char*)temp, sizeof(temp), " %s %s", agent, text );
- wspHeaderCopyDecodedString( temp, &currentLength, &temper );
- }
- }
- break;
- /* content-disposition */
- case 0x2e :
- if (fieldValue[0] == 0x80 )
- strncat( (char*)temper, "form-data", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+ snprintf( (char*)temp, sizeof(temp), "%u-%u/%u", (unsigned int)first, (unsigned int)last, (unsigned int)len );
+ strncat( (char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+ }
+ break;
- if (fieldValue[0] == 0x81 )
- strncat( (char*)temper, "attachment", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+ /* cache-control */
+ case 0x08:
+ {
+ char* cacheString = NULL;
+ unique_ptr<char*, void(*)(char**)> cacheStringbuf(&cacheString, unique_ptr_deleter);
+
+ wspHeaderDecodeCacheControl( fieldValue, fieldValueLen, &cacheString );
+ strncat( (char*)temper, (char*)cacheString, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+ }
+ break;
+ /* pragma */
+ case 0x1f:
+ if (fieldValue[0] == 0x80) {
+ strncat( (char*)temper, (char*)wspCacheControl[0], (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+ } else {
if (1 < fieldValueLen) {
char* param = NULL;
unique_ptr<char*, void(*)(char**)> parambuf(&param, unique_ptr_deleter);
- wspHeaderDecodeParameter( fieldValue + 1, fieldValueLen - 1, &param );
+ wspHeaderDecodeParameter( fieldValue, fieldValueLen, &param );
if (param != NULL) {
strncat( (char*)temper, "; ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
strncat( (char*)temper, (char*)param, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
}
}
- break;
- /* Profile-diff */
- case 0x36 :
- temper[AcStrlen((char*)temper) + fieldValueLen] = '\0';
- memcpy( temper, fieldValue, (size_t)fieldValueLen );
- break;
- /* Profile-Warning */
- case 0x37 :
- {
- unsigned char temp[WSP_STANDARD_STR_LEN_MAX];
-
- snprintf( (char*)temp, sizeof(temp), "%lX", wspHeaderDecodeInteger(fieldValue ));
- temp[2] = temp[1];
- temp[1] = (unsigned char)0x30;
- temp[3] = '\0';
- if (fieldValueLen > 1) {
- /* copy warn-target - URI */
- strncat( (char*)temp, (char*)(fieldValue + 1), WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)temp)-1 );
- if (fieldValueLen > ( AcStrlen( (char*)(fieldValue + 1)) + 1 )) {
- /* copy warn-date */
- char* decodedString = NULL;
- unique_ptr<char*, void(*)(char**)> decodedStringbuf(&decodedString, unique_ptr_deleter);
- wspHeaderDecodeDateValue( fieldValueLen - ( AcStrlen( (char*)(fieldValue + 1)) + 2 ), fieldValue + AcStrlen( (char*)(fieldValue + 1)) + 1, &decodedString );
- strncat( (char*)temp, (char*)decodedString, WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)temp)-1 );
- }
+ }
+ break;
+
+ /* public */
+ case 0x22:
+ /* allow */
+ case 0x06:
+ {
+ unsigned long i = 0;
+ while ( wspHeaderDecodeIntegerByLength( fieldValue, fieldValueLen ) != wspMethodType[i].methodCode ) i++;
+ strncat( (char*)temper, (char*)wspMethodType[i].methodName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+ }
+ break;
+ /* range */
+ case 0x23:
+ strncat( (char*)temper, "bytes=", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+ if (fieldValue[0] == 0x80) {
+ unsigned char temp[16];
+ unsigned long first, last;
+ iField = 0;
+
+ first = wspRetriveUintvarDecode( fieldValue, &iField );
+ last = wspRetriveUintvarDecode( fieldValue, &iField );
+
+ snprintf( (char*)temp, sizeof(temp), "%u-%u", (unsigned int)first, (unsigned int)last );
+ strncat( (char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+ }
+ if (fieldValue[0] == 0x81) {
+ unsigned char temp[16];
+ unsigned long suffix;
+
+ suffix = wspRetriveUintvarDecode( fieldValue, &iField );
+
+ snprintf( (char*)temp, sizeof(temp), "-%u", (unsigned int)suffix );
+
+ }
+ break;
+ /* retry-after */
+ case 0x25:
+ if (fieldValue[0] == 0x80) {
+ char* temp = NULL;
+ unique_ptr<char*, void(*)(char**)> tempbuf(&temp, unique_ptr_deleter);
+
+ wspHeaderDecodeDateValue( fieldValueLen - 1, fieldValue + 1, &temp );
+ strncat( (char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+ }
+
+ if (fieldValue[0] == 0x81) {
+ unsigned char temp[16];
+
+ snprintf( (char*)temp, sizeof(temp), "%u", (unsigned int)wspHeaderDecodeIntegerByLength( fieldValue,fieldValueLen ));
+ strncat( (char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+ }
+ break;
+ /* transfer-encoding */
+ case 0x27:
+ /* No other cases allowed */
+ if (fieldValue[0] == 0x80 )
+ strncat( (char*)temper, "chunked", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+
+ break;
+ /* vary */
+ case 0x2a:
+ {
+ int integerValue = wspHeaderDecodeIntegerByLength(fieldValue,fieldValueLen );
+ if (integerValue > wspHeaderFieldCount) {
+ MSG_DEBUG("WspLDecodeHeader: integerValue is over limit(0x%x).\n",wspHeaderFieldCount);
+ break;
+ }
+ strncat( (char*)temper, (char*)wspHeaderFieldName[integerValue], (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+ }
+ break;
+ /* warning */
+ case 0x2c:
+ {
+ unsigned char temp[WSP_STANDARD_STR_LEN_MAX];
+
+ if (fieldValue[0] < 0x20 )
+ iField = fieldValue[0];
+ else
+ iField = 1;
+
+ snprintf( (char*)temp, sizeof(temp), "%u", (unsigned int)wspHeaderDecodeIntegerByLength( fieldValue, iField ));
+ strncat( (char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+ if (iField < fieldValueLen) {
+ unsigned char agent[WSP_STANDARD_STR_LEN_MAX];
+ unsigned char text[WSP_STANDARD_STR_LEN_MAX];
+ strncpy( (char*)agent, (char*)(fieldValue + iField ),WSP_STANDARD_STR_LEN_MAX-1);
+ iField = iField + AcStrlen((char*)agent ) + 1;
+ strncpy((char*)text, (char*)(fieldValue + iField ),WSP_STANDARD_STR_LEN_MAX-1);
+ snprintf( (char*)temp, sizeof(temp), " %s %s", agent, text );
+ wspHeaderCopyDecodedString( temp, &currentLength, &temper );
+ }
+ }
+ break;
+ /* content-disposition */
+ case 0x2e:
+ if (fieldValue[0] == 0x80 )
+ strncat( (char*)temper, "form-data", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+
+ if (fieldValue[0] == 0x81 )
+ strncat( (char*)temper, "attachment", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+
+ if (1 < fieldValueLen) {
+ char* param = NULL;
+ unique_ptr<char*, void(*)(char**)> parambuf(&param, unique_ptr_deleter);
+ wspHeaderDecodeParameter( fieldValue + 1, fieldValueLen - 1, &param );
+
+ if (param != NULL) {
+ strncat( (char*)temper, "; ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+ strncat( (char*)temper, (char*)param, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+ }
+ }
+ break;
+ /* Profile-diff */
+ case 0x36:
+ temper[AcStrlen((char*)temper) + fieldValueLen] = '\0';
+ memcpy( temper, fieldValue, (size_t)fieldValueLen );
+ break;
+ /* Profile-Warning */
+ case 0x37:
+ {
+ unsigned char temp[WSP_STANDARD_STR_LEN_MAX];
+
+ snprintf( (char*)temp, sizeof(temp), "%lX", wspHeaderDecodeInteger(fieldValue ));
+ temp[2] = temp[1];
+ temp[1] = (unsigned char)0x30;
+ temp[3] = '\0';
+ if (fieldValueLen > 1) {
+ /* copy warn-target - URI */
+ strncat( (char*)temp, (char*)(fieldValue + 1), WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)temp)-1 );
+ if (fieldValueLen > ( AcStrlen( (char*)(fieldValue + 1)) + 1 )) {
+ /* copy warn-date */
+ char* decodedString = NULL;
+ unique_ptr<char*, void(*)(char**)> decodedStringbuf(&decodedString, unique_ptr_deleter);
+ wspHeaderDecodeDateValue( fieldValueLen - ( AcStrlen( (char*)(fieldValue + 1)) + 2 ), fieldValue + AcStrlen( (char*)(fieldValue + 1)) + 1, &decodedString );
+ strncat( (char*)temp, (char*)decodedString, WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)temp)-1 );
}
- strncat( (char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
}
- break;
+ strncat( (char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+ }
+ break;
- default :
- break;
+ default:
+ break;
}
-
}
}
}
@@ -3081,92 +3007,92 @@ void SmsPluginWapPushHandler::wspHeaderDecodeParameter( unsigned char* data, uns
return;
}
- switch ( data[0] & 0x7f )
- {
- case 0x00 :
- wspHeaderDecodeQValue( length - 1, data + 1, &param);
- break;
- case 0x01 :
- wspHeaderDecodeCharset( length - 1 , data + 1, &param);
- break;
- case 0x02 :
- wspHeaderDecodeVersion( length - 1, data + 1, &param);
- break;
- /* integer */
- case 0x03 :
- //param = (unsigned char *)malloc( (size_t)WSP_STANDARD_STR_LEN_MAX );
- param = new char[WSP_STANDARD_STR_LEN_MAX];
- if (param == NULL) {
- MSG_DEBUG("WspLHeaderDecodeParameter: 0x03 MemAlloc failed\n");
- return;
- } else {
- sprintf( (char*)param, "Type=%i", (int)wspHeaderDecodeInteger( data + 1 ));
- }
- break;
- case 0x08 :
- param = new char[WSP_STANDARD_STR_LEN_MAX];
+ switch (data[0] & 0x7f) {
+ case 0x00:
+ wspHeaderDecodeQValue( length - 1, data + 1, &param);
+ break;
+ case 0x01:
+ wspHeaderDecodeCharset( length - 1 , data + 1, &param);
+ break;
+ case 0x02:
+ wspHeaderDecodeVersion( length - 1, data + 1, &param);
+ break;
+ /* integer */
+ case 0x03:
+ /* param = (unsigned char *)malloc( (size_t)WSP_STANDARD_STR_LEN_MAX ); */
+ param = new char[WSP_STANDARD_STR_LEN_MAX];
+ if (param == NULL) {
+ MSG_DEBUG("WspLHeaderDecodeParameter: 0x03 MemAlloc failed\n");
+ return;
+ } else {
+ sprintf( (char*)param, "Type=%i", (int)wspHeaderDecodeInteger( data + 1 ));
+ }
+ break;
+ case 0x08:
+ param = new char[WSP_STANDARD_STR_LEN_MAX];
- if (param == NULL) {
- MSG_DEBUG("WspLHeaderDecodeParameter:0x08 MemAlloc failed\n");
- return;
- } else {
- sprintf( (char*)param, "Padding=%i", (int)wspHeaderDecodeInteger( data + 1 ));
- }
- break;
- case 0x05 :
- param = new char[WSP_STANDARD_STR_LEN_MAX];
+ if (param == NULL) {
+ MSG_DEBUG("WspLHeaderDecodeParameter:0x08 MemAlloc failed\n");
+ return;
+ } else {
+ sprintf( (char*)param, "Padding=%i", (int)wspHeaderDecodeInteger( data + 1 ));
+ }
+ break;
+ case 0x05:
+ param = new char[WSP_STANDARD_STR_LEN_MAX];
- if (param == NULL) {
- MSG_DEBUG("WspLHeaderDecodeParameter:0x05 MemAlloc failed\n");
- return;
- } else {
- strncpy( (char*)param, "Name=", WSP_STANDARD_STR_LEN_MAX-1);
- memcpy( param + 5, data + 1, length - 1 );
- param[5 + length - 1] = '\0';
- }
- break;
- case 0x06 :
- param = new char[WSP_STANDARD_STR_LEN_MAX];
+ if (param == NULL) {
+ MSG_DEBUG("WspLHeaderDecodeParameter:0x05 MemAlloc failed\n");
+ return;
+ } else {
+ strncpy( (char*)param, "Name=", WSP_STANDARD_STR_LEN_MAX-1);
+ memcpy( param + 5, data + 1, length - 1 );
+ param[5 + length - 1] = '\0';
+ }
+ break;
+ case 0x06:
+ param = new char[WSP_STANDARD_STR_LEN_MAX];
- if (param == NULL) {
- MSG_DEBUG("WspLHeaderDecodeParameter:0x06 MemAlloc failed\n");
- return;
- } else {
- strncpy( (char*)param, "Filename=", WSP_STANDARD_STR_LEN_MAX-1);
- memcpy( param + 9, (char*)(data + 1), (size_t)(length - 1) );
- param[9 + length - 1] = '\0';
- }
- break;
- case 0x07 :
- param = NULL;
- /* TBI */
- break;
- /*OMA Provisioning*/
- case 0x11 :
- param = new char[WSP_STANDARD_STR_LEN_MAX];
+ if (param == NULL) {
+ MSG_DEBUG("WspLHeaderDecodeParameter:0x06 MemAlloc failed\n");
+ return;
+ } else {
+ strncpy( (char*)param, "Filename=", WSP_STANDARD_STR_LEN_MAX-1);
+ memcpy( param + 9, (char*)(data + 1), (size_t)(length - 1) );
+ param[9 + length - 1] = '\0';
+ }
+ break;
+ case 0x07:
+ param = NULL;
+ /* TBI */
+ break;
+ /*OMA Provisioning*/
+ case 0x11:
+ param = new char[WSP_STANDARD_STR_LEN_MAX];
- if (param == NULL) {
- MSG_DEBUG("WspLHeaderDecodeParameter:0x11 MemAlloc failed\n");
- return;
- } else {
- strncpy((char*)param, "SEC=", WSP_STANDARD_STR_LEN_MAX-1);
- SecurityTypeCode = data[1] & 0x7f;
- while (( i < wspSecurityTypeCount ) && ( wspSecurityType[i].SecurityTypeCode != SecurityTypeCode )) i++;
+ if (param == NULL) {
+ MSG_DEBUG("WspLHeaderDecodeParameter:0x11 MemAlloc failed\n");
+ return;
+ } else {
+ strncpy((char*)param, "SEC=", WSP_STANDARD_STR_LEN_MAX-1);
+ SecurityTypeCode = data[1] & 0x7f;
+ while (( i < wspSecurityTypeCount ) && ( wspSecurityType[i].SecurityTypeCode != SecurityTypeCode ))
+ i++;
- if (i < wspSecurityTypeCount) {
- strncat( (char*)param, (char*)wspSecurityType[i].SecurityTypeName, WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)param)-1);
- }
+ if (i < wspSecurityTypeCount) {
+ strncat( (char*)param, (char*)wspSecurityType[i].SecurityTypeName, WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)param)-1);
+ }
- if (0x12 == (data[2] & 0x7f)) {
- strncat( (char*)param, "; MAC=", WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)param)-1 );
- memcpy(param+AcStrlen( (char*)param),(char*)(data+3),(size_t)length-3 );
- }
+ if (0x12 == (data[2] & 0x7f)) {
+ strncat( (char*)param, "; MAC=", WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)param)-1 );
+ memcpy(param+AcStrlen( (char*)param),(char*)(data+3),(size_t)length-3 );
}
- break;
+ }
+ break;
- default :
- param = NULL;
- break;
+ default:
+ param = NULL;
+ break;
}
*pParam = param;
@@ -3206,7 +3132,6 @@ void SmsPluginWapPushHandler::wspHeaderDecodeCharset( unsigned long length, unsi
}
-
void SmsPluginWapPushHandler::wspHeaderDecodeVersion( unsigned long length, unsigned char* data, char** pDecodedString )
{
*pDecodedString = new char[WSP_STANDARD_STR_LEN_MAX];
@@ -3256,8 +3181,7 @@ void SmsPluginWapPushHandler::wspHeaderDecodeDateValue( unsigned long length, un
/* check date value validity */
{
- if (( pTMData->tm_wday > 6 ) || (pTMData->tm_mon > 11 ) || (pTMData->tm_mday > 31 ))
- {
+ if (( pTMData->tm_wday > 6 ) || (pTMData->tm_mon > 11 ) || (pTMData->tm_mday > 31 )) {
MSG_DEBUG( "WspLHeaderDecodeDateValue: Date decode fail %d, %d, %d \n", pTMData->tm_wday, pTMData->tm_mon, pTMData->tm_mday );
strncpy( (char*)*pDecodedString, "Decoding Failed", WSP_STANDARD_STR_LEN_MAX-1);
return;
@@ -3265,28 +3189,26 @@ void SmsPluginWapPushHandler::wspHeaderDecodeDateValue( unsigned long length, un
}
#ifdef MSG_FW_FOR_DEBUG
- /** Date type selection */
- switch ( wspMachineStatus.dateType )
- {
- /* UNIX asciitime function */
- case UNIX_DATE_TYPE :
- snprintf( (char*)decodedString, sizeof(decodedString), "%s %s %-2u %u:%u:%u %u GMT", wspWeek[pTMData->tm_wday], wspMonth[pTMData->tm_mon],
- pTMData->tm_mday, pTMData->tm_hour, pTMData->tm_min, pTMData->tm_sec, pTMData->tm_year + 1900 );
- break;
- case RFC1123_DATE_TYPE :
- snprintf( (char*)decodedString, sizeof(decodedString), "%s, %u %s %u %u:%u:%u GMT", wspWeek[pTMData->tm_wday], pTMData->tm_mday,
- wspMonth[pTMData->tm_mon], pTMData->tm_year + 1900, pTMData->tm_hour, pTMData->tm_min, pTMData->tm_sec );
- break;
- case RFC850_DATE_TYPE :
- /* Have some Y2K Problems */
- /* In RFC 850, date is represented like 11-May-99. So Y2K problem always can be occured. So remainer (year divided by 100) is used. */
- snprintf( (char*)decodedString, sizeof(decodedString), "%s, %2u-%s-%2u %u:%u:%u GMT", wspWeekDay[pTMData->tm_wday], pTMData->tm_mday,
- wspMonth[pTMData->tm_mon], pTMData->tm_year % CENTURY, pTMData->tm_hour, pTMData->tm_min, pTMData->tm_sec );
-
- break;
+ /* Date type selection */
+ switch (wspMachineStatus.dateType) {
+ /* UNIX asciitime function */
+ case UNIX_DATE_TYPE:
+ snprintf( (char*)decodedString, sizeof(decodedString), "%s %s %-2u %u:%u:%u %u GMT", wspWeek[pTMData->tm_wday], wspMonth[pTMData->tm_mon],
+ pTMData->tm_mday, pTMData->tm_hour, pTMData->tm_min, pTMData->tm_sec, pTMData->tm_year + 1900 );
+ break;
+ case RFC1123_DATE_TYPE:
+ snprintf( (char*)decodedString, sizeof(decodedString), "%s, %u %s %u %u:%u:%u GMT", wspWeek[pTMData->tm_wday], pTMData->tm_mday,
+ wspMonth[pTMData->tm_mon], pTMData->tm_year + 1900, pTMData->tm_hour, pTMData->tm_min, pTMData->tm_sec );
+ break;
+ case RFC850_DATE_TYPE:
+ /* Have some Y2K Problems */
+ /* In RFC 850, date is represented like 11-May-99. So Y2K problem always can be occured. So remainer (year divided by 100) is used. */
+ snprintf( (char*)decodedString, sizeof(decodedString), "%s, %2u-%s-%2u %u:%u:%u GMT", wspWeekDay[pTMData->tm_wday], pTMData->tm_mday,
+ wspMonth[pTMData->tm_mon], pTMData->tm_year % CENTURY, pTMData->tm_hour, pTMData->tm_min, pTMData->tm_sec );
+ break;
}
#endif
- /**UNIX_DATE_TYPE : */
+ /*UNIX_DATE_TYPE : */
snprintf( (char*)*pDecodedString, (sizeof(char)*WSP_STANDARD_STR_LEN_MAX), "%s %s %-2u %u:%u:%u %u GMT", wspWeek[pTMData->tm_wday], wspMonth[pTMData->tm_mon],
pTMData->tm_mday, pTMData->tm_hour, pTMData->tm_min, pTMData->tm_sec, pTMData->tm_year + 1900 );
@@ -3294,12 +3216,13 @@ void SmsPluginWapPushHandler::wspHeaderDecodeDateValue( unsigned long length, un
}
+
void SmsPluginWapPushHandler::wspHeaderCopyDecodedString( unsigned char* szDecodedString, unsigned long* currentLen, char** pTemper )
{
unsigned long elementLen = AcStrlen( (char*)szDecodedString );
char* temper2 = NULL;
- /** // CR+LF */
+ /* CR+LF */
*currentLen = *currentLen + elementLen + 2;
if ( *currentLen > AcStrlen( (char*)* pTemper ) + 2) {
@@ -3399,35 +3322,32 @@ void SmsPluginWapPushHandler::wspHeaderDecodeCacheControl(unsigned char* fieldVa
if (fieldValue[0] > 0x7f) {
/* directive that has parameter */
cacheCode = fieldValue[0] & 0x7f;
- switch ( cacheCode )
- {
- /* field name */
- /* no-cache */
- case 0x00 :
- /* private */
- case 0x07 :
- if (fieldValue[1] > 0x7f) {
- /* well known field name */
- strncpy( (char*)paramString, (char*)wspHeaderFieldName[fieldValue[1] & 0x7f],WSP_STANDARD_STR_LEN_MAX-1 );
- paramString[WSP_STANDARD_STR_LEN_MAX-1] = '\0';
- } else {
- /* unknown field name */
- strncpy( (char*)paramString, (char*)fieldValue + 1 , WSP_STANDARD_STR_LEN_MAX-1);
- }
- break;
- /* secound */
- /* max-age */
- case 0x02 :
- /* max- stale */
- case 0x03 :
- /* min-fresh */
- case 0x04 :
- snprintf( (char*)paramString, sizeof(paramString), "%u", (unsigned int)wspHeaderDecodeInteger( fieldValue + 1));
- break;
-
- default :
- break;
-
+ switch (cacheCode) {
+ /* field name */
+ /* no-cache */
+ case 0x00:
+ /* private */
+ case 0x07:
+ if (fieldValue[1] > 0x7f) {
+ /* well known field name */
+ strncpy( (char*)paramString, (char*)wspHeaderFieldName[fieldValue[1] & 0x7f],WSP_STANDARD_STR_LEN_MAX-1 );
+ paramString[WSP_STANDARD_STR_LEN_MAX-1] = '\0';
+ } else {
+ /* unknown field name */
+ strncpy( (char*)paramString, (char*)fieldValue + 1 , WSP_STANDARD_STR_LEN_MAX-1);
+ }
+ break;
+ /* secound */
+ /* max-age */
+ case 0x02:
+ /* max- stale */
+ case 0x03:
+ /* min-fresh */
+ case 0x04:
+ snprintf( (char*)paramString, sizeof(paramString), "%u", (unsigned int)wspHeaderDecodeInteger( fieldValue + 1));
+ break;
+ default:
+ break;
}
snprintf((char*)*pCacheString, (sizeof(char)*WSP_STANDARD_STR_LEN_MAX), "%s=%s", (char*)wspCacheControl[cacheCode], (char*)paramString );
} else {
diff --git a/plugin/sms_cdma_plugin/include/SmsCdmaPluginCallback.h b/plugin/sms_cdma_plugin/include/SmsCdmaPluginCallback.h
index 79e2c30..0e3e1f5 100755
--- a/plugin/sms_cdma_plugin/include/SmsCdmaPluginCallback.h
+++ b/plugin/sms_cdma_plugin/include/SmsCdmaPluginCallback.h
@@ -76,5 +76,4 @@ private:
static SmsPluginCallback* pInstance;
};
-#endif //SMS_CDMA_PLUGIN_CALLBACK_H
-
+#endif /* SMS_CDMA_PLUGIN_CALLBACK_H */
diff --git a/plugin/sms_cdma_plugin/include/SmsCdmaPluginCodec.h b/plugin/sms_cdma_plugin/include/SmsCdmaPluginCodec.h
index 3396bff..a71a311 100755
--- a/plugin/sms_cdma_plugin/include/SmsCdmaPluginCodec.h
+++ b/plugin/sms_cdma_plugin/include/SmsCdmaPluginCodec.h
@@ -84,4 +84,4 @@ private:
static sms_message_type_t findMsgType(const unsigned char *p_pkg_str, int pkg_len);
};
-#endif //SMS_CDMA_PLUGIN_CODEC_H
+#endif /* SMS_CDMA_PLUGIN_CODEC_H */
diff --git a/plugin/sms_cdma_plugin/include/SmsCdmaPluginEventHandler.h b/plugin/sms_cdma_plugin/include/SmsCdmaPluginEventHandler.h
index 977a250..6772c77 100755
--- a/plugin/sms_cdma_plugin/include/SmsCdmaPluginEventHandler.h
+++ b/plugin/sms_cdma_plugin/include/SmsCdmaPluginEventHandler.h
@@ -37,23 +37,20 @@ using namespace std;
/*==================================================================================================
VARIABLES AND DEFINES
==================================================================================================*/
-struct wap_data_s
-{
+struct wap_data_s {
int length;
char data[SMS_MAX_USER_DATA_LEN+1];
};
typedef map<unsigned char, wap_data_s> wapDataMap;
-typedef struct _sms_wap_msg_s
-{
+typedef struct _sms_wap_msg_s {
unsigned short msgId;
unsigned char totalSeg;
unsigned char segNum;
} sms_wap_msg_s;
-typedef struct _sms_wap_info_s
-{
+typedef struct _sms_wap_info_s {
unsigned short msgId;
unsigned char totalSeg;
unsigned char segNum;
@@ -63,7 +60,6 @@ typedef struct _sms_wap_info_s
} sms_wap_info_s;
-
/*==================================================================================================
CLASS DEFINITIONS
==================================================================================================*/
@@ -128,5 +124,4 @@ private:
};
-#endif //SMS_CDMA_PLUGIN_EVENT_HANDLER_H
-
+#endif /* SMS_CDMA_PLUGIN_EVENT_HANDLER_H */
diff --git a/plugin/sms_cdma_plugin/include/SmsCdmaPluginMain.h b/plugin/sms_cdma_plugin/include/SmsCdmaPluginMain.h
index f4f1253..4fe2916 100755
--- a/plugin/sms_cdma_plugin/include/SmsCdmaPluginMain.h
+++ b/plugin/sms_cdma_plugin/include/SmsCdmaPluginMain.h
@@ -62,5 +62,4 @@ msg_error_t SmsPlgAddMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_
}
#endif
-#endif //SMS_CDMA_PLUGIN_MAIN_H
-
+#endif /* SMS_CDMA_PLUGIN_MAIN_H */
diff --git a/plugin/sms_cdma_plugin/include/SmsCdmaPluginSetting.h b/plugin/sms_cdma_plugin/include/SmsCdmaPluginSetting.h
index bdcc06c..466b588 100755
--- a/plugin/sms_cdma_plugin/include/SmsCdmaPluginSetting.h
+++ b/plugin/sms_cdma_plugin/include/SmsCdmaPluginSetting.h
@@ -89,5 +89,4 @@ private:
CndVar cv;
};
-#endif //SMS_CDMA_PLUGIN_SETTING_H
-
+#endif /* SMS_CDMA_PLUGIN_SETTING_H */
diff --git a/plugin/sms_cdma_plugin/include/SmsCdmaPluginStorage.h b/plugin/sms_cdma_plugin/include/SmsCdmaPluginStorage.h
index 30f6222..c42631e 100755
--- a/plugin/sms_cdma_plugin/include/SmsCdmaPluginStorage.h
+++ b/plugin/sms_cdma_plugin/include/SmsCdmaPluginStorage.h
@@ -72,5 +72,4 @@ private:
std::list<PUSH_APPLICATION_INFO_S> pushAppInfoList;
};
-#endif //SMS_CDMA_PLUGIN_STORAGE_H
-
+#endif /* SMS_CDMA_PLUGIN_STORAGE_H */
diff --git a/plugin/sms_cdma_plugin/include/SmsCdmaPluginTransport.h b/plugin/sms_cdma_plugin/include/SmsCdmaPluginTransport.h
index e486209..607f71f 100755
--- a/plugin/sms_cdma_plugin/include/SmsCdmaPluginTransport.h
+++ b/plugin/sms_cdma_plugin/include/SmsCdmaPluginTransport.h
@@ -72,4 +72,4 @@ private:
CndVar cv;
};
-#endif //SMS_PLUGIN_TRANSPORT_H
+#endif /* SMS_PLUGIN_TRANSPORT_H */
diff --git a/plugin/sms_cdma_plugin/include/SmsCdmaPluginTypes.h b/plugin/sms_cdma_plugin/include/SmsCdmaPluginTypes.h
index 8d1bc57..ee83bc9 100755
--- a/plugin/sms_cdma_plugin/include/SmsCdmaPluginTypes.h
+++ b/plugin/sms_cdma_plugin/include/SmsCdmaPluginTypes.h
@@ -21,87 +21,80 @@
#ifndef SMS_CDMA_PLUGIN_TYPES_H
#define SMS_CDMA_PLUGIN_TYPES_H
-#define SMS_MAX_MESSAGE_ID 65536
-#define SMS_SEQ_NUM_MAX 64
-#define SMS_MAX_USER_DATA_LEN 160
-#define SMS_MAX_SUBMIT_MESSAGE_ID 256
+#define MAX_SMS_SEND_RETRY 4
+#define SMS_MAX_MESSAGE_ID 65536
+#define SMS_SEQ_NUM_MAX 64
+#define SMS_MAX_USER_DATA_LEN 160
+#define SMS_MAX_SUBMIT_MESSAGE_ID 256
-#define SMS_TRANS_ADDRESS_MAX_LEN 256
+#define SMS_TRANS_ADDRESS_MAX_LEN 256
-#define SMS_MAX_NUMBER_OF_ACK 8
+#define SMS_MAX_NUMBER_OF_ACK 8
-#define SMS_PUSH_XML_HREF_TAG "href"
-#define SMS_PUSH_XML_SI_ID_TAG "si-id"
-#define SMS_PUSH_XML_CREATED_TAG "created"
-#define SMS_PUSH_XML_EXPIRES_TAG "si-expires"
-#define SMS_PUSH_XML_ACTION_TAG "action"
+#define SMS_PUSH_XML_HREF_TAG "href"
+#define SMS_PUSH_XML_SI_ID_TAG "si-id"
+#define SMS_PUSH_XML_CREATED_TAG "created"
+#define SMS_PUSH_XML_EXPIRES_TAG "si-expires"
+#define SMS_PUSH_XML_ACTION_TAG "action"
-#define SMS_PUSH_XML_INVAL_OBJ "invalidate-object"
-#define SMS_PUSH_XML_INVAL_SVC "invalidate-service"
-#define SMS_PUSH_XML_CO_URI "uri"
+#define SMS_PUSH_XML_INVAL_OBJ "invalidate-object"
+#define SMS_PUSH_XML_INVAL_SVC "invalidate-service"
+#define SMS_PUSH_XML_CO_URI "uri"
typedef unsigned char sms_wap_app_code_t; /* _sms_wap_app_code_e */
-typedef struct _SMS_WSP_CONTENTS_TYPE_S
-{
+typedef struct _SMS_WSP_CONTENTS_TYPE_S {
char* contentsTypeName;
unsigned char contentsTypeCode;
} SMS_WSP_CONTENTS_TYPE_S;
-typedef struct _SMS_WSP_CHARSET_S
-{
+typedef struct _SMS_WSP_CHARSET_S {
char* charsetName;
unsigned short charsetCode;
} SMS_WSP_CHARSET_S;
-typedef struct _SMS_WAP_UNREGISTER_CONTENTS_TYPE_S
-{
+typedef struct _SMS_WAP_UNREGISTER_CONTENTS_TYPE_S {
char* contentsTypeName;
unsigned short contentsTypeCode;
} SMS_WAP_UNREGISTER_CONTENTS_TYPE_S;
-typedef struct _SMS_WSP_LANGUAGE_S
-{
+typedef struct _SMS_WSP_LANGUAGE_S {
char* languageName;
unsigned char languageCode;
} SMS_WSP_LANGUAGE_S;
-typedef struct _SMS_WSP_HEADER_PARAMETER_S
-{
+typedef struct _SMS_WSP_HEADER_PARAMETER_S {
char* parameterToken;
unsigned int parameterCode;
} SMS_WSP_HEADER_PARAMETER_S;
-typedef struct _SMS_WSP_METHOD_TYPE_S
-{
+typedef struct _SMS_WSP_METHOD_TYPE_S {
char* methodName;
unsigned char methodCode;
} SMS_WSP_METHOD_TYPE_S;
-typedef struct _SMS_WSP_SECURITY_TYPE_S
-{
+typedef struct _SMS_WSP_SECURITY_TYPE_S {
char* SecurityTypeName;
unsigned char SecurityTypeCode;
}SMS_WSP_SECURITY_TYPE_S;
-typedef struct
-{
- msg_request_id_t reqId; /**< Indicates the request ID, which is unique. When applications submit a request to the framework, this value will be set by the framework. */
- MSG_MESSAGE_INFO_S msgInfo; /**< Indicates the message structure to be sent by applications. */
+
+typedef struct {
+ msg_request_id_t reqId; /* < Indicates the request ID, which is unique. When applications submit a request to the framework, this value will be set by the framework. */
+ MSG_MESSAGE_INFO_S msgInfo; /* < Indicates the message structure to be sent by applications. */
MSG_SENDINGOPT_INFO_S sendOptInfo;
} sms_request_info_s;
-typedef struct _sms_sent_info_s
-{
- sms_request_info_s reqInfo; /**< Indicates the corresponding request structure. */
+typedef struct _sms_sent_info_s {
+ sms_request_info_s reqInfo; /* < Indicates the corresponding request structure. */
bool bLast;
} sms_sent_info_s;
@@ -122,8 +115,8 @@ enum _sms_network_status_e {
SMS_NETWORK_SEND_FAIL_NETWORK_NOT_READY,
};
-enum _sms_wap_app_code_e
-{
+
+enum _sms_wap_app_code_e {
SMS_WAP_APPLICATION_DEFAULT = 0x00,
SMS_WAP_APPLICATION_PUSH_SI,
@@ -205,23 +198,21 @@ typedef unsigned char sms_number_type_t; /* _sms_number_type_e */
typedef unsigned char sms_number_plan_t; /* _sms_number_plan_e */
-typedef enum _sms_message_type_e
-{
- SMS_TYPE_RESERVED = 0x00, // reserved
- SMS_TYPE_DELIVER, // mobile-terminated only
- SMS_TYPE_SUBMIT, // mobile-originated only
- SMS_TYPE_CANCEL, // mobile-originated only
- SMS_TYPE_DELIVERY_ACK, // mobile-terminated only
- SMS_TYPE_USER_ACK, // either direction
- SMS_TYPE_READ_ACK, // either direction
- SMS_TYPE_DELIVER_REPORT, // mobile-originated only
- SMS_TYPE_SUBMIT_REPORT = 0x08, // mobile-terminated only
+typedef enum _sms_message_type_e {
+ SMS_TYPE_RESERVED = 0x00, /* reserved */
+ SMS_TYPE_DELIVER, /* mobile-terminated only */
+ SMS_TYPE_SUBMIT, /* mobile-originated only */
+ SMS_TYPE_CANCEL, /* mobile-originated only */
+ SMS_TYPE_DELIVERY_ACK, /* mobile-terminated only*/
+ SMS_TYPE_USER_ACK, /* either direction */
+ SMS_TYPE_READ_ACK, /* either direction */
+ SMS_TYPE_DELIVER_REPORT, /* mobile-originated only */
+ SMS_TYPE_SUBMIT_REPORT = 0x08, /* mobile-terminated only */
SMS_TYPE_MAX_VALUE
}sms_message_type_t;
-typedef enum _sms_alert_option_e
-{
+typedef enum _sms_alert_option_e {
SMS_ALERT_NO_ALERT = 0,
SMS_ALERT_DEFAULT_ALERT,
SMS_ALERT_VIBRATE_ONCE,
@@ -250,8 +241,7 @@ typedef enum _sms_language_type_e {
}sms_language_type_t;
-typedef enum _sms_priority_indicator_e
-{
+typedef enum _sms_priority_indicator_e {
SMS_PRIORITY_NORMAL = 0x00,
SMS_PRIORITY_INTERACTIVE,
SMS_PRIORITY_URGENT,
@@ -259,8 +249,7 @@ typedef enum _sms_priority_indicator_e
}sms_priority_indicator_t;
-typedef enum _sms_privacy_indicator_e
-{
+typedef enum _sms_privacy_indicator_e {
SMS_PRIVACY_NOT_RESTRICTED = 0x00,
SMS_PRIVACY_RESTRICTED,
SMS_PRIVACY_CONFIDENTIAL,
@@ -268,8 +257,7 @@ typedef enum _sms_privacy_indicator_e
}sms_privacy_indicator_t;
-typedef enum _sms_alert_priority_e
-{
+typedef enum _sms_alert_priority_e {
SMS_ALERT_MOBILE_DEFAULT = 0x00,
SMS_ALERT_LOW_PRIORITY,
SMS_ALERT_MEDIUM_PRIORITY,
@@ -277,8 +265,7 @@ typedef enum _sms_alert_priority_e
}sms_alert_priority_t;
-typedef enum _sms_display_mode_e
-{
+typedef enum _sms_display_mode_e {
SMS_DISPLAY_IMMEDIATE = 0x00,
SMS_DISPLAY_DEFAULT_SETTING,
SMS_DISPLAY_USER_INVOKE,
@@ -286,8 +273,7 @@ typedef enum _sms_display_mode_e
}sms_display_mode_t;
-typedef enum _sms_encoding_type_e
-{
+typedef enum _sms_encoding_type_e {
SMS_ENCODE_OCTET = 0x0,
SMS_ENCODE_EPM = 0x1, /*IS-91 Extended Protocol Message*/
SMS_ENCODE_7BIT_ASCII = 0x2,
@@ -304,8 +290,7 @@ typedef enum _sms_encoding_type_e
}sms_encoding_type_t;
-typedef enum _sms_relative_time_e
-{
+typedef enum _sms_relative_time_e {
SMS_REL_TIME_5_MINS = 0,
SMS_REL_TIME_12_HOURS = 143,
SMS_REL_TIME_1_DAY = 167,
@@ -320,8 +305,7 @@ typedef enum _sms_relative_time_e
}sms_relative_time_t;
-typedef enum _sms_status_code_e
-{
+typedef enum _sms_status_code_e {
/* ERROR_CLASS = '00' (no error) */
SMS_STATUS_ACCEPTED = 0x00,
SMS_STATUS_DEPOSITED = 0x01,
@@ -407,8 +391,7 @@ typedef enum _sms_cmae_alert_handle_e {
}sms_cmae_alert_handle_t;
-enum _sms_bearer_sub_param_e
-{
+enum _sms_bearer_sub_param_e {
SMS_BEARER_MESSAGE_IDENTIFIER = 0x00,
SMS_BEARER_USER_DATA = 0x01,
SMS_BEARER_USER_RESPONSE_CODE = 0x02,
@@ -437,8 +420,7 @@ enum _sms_bearer_sub_param_e
};
-enum _sms_svc_ctg_result_e
-{
+enum _sms_svc_ctg_result_e {
SMS_SVC_RESULT_SUCCESS = 0x00,
SMS_SVC_RESULT_MEMORY_LIMIT_EXCEEDED,
SMS_SVC_RESULT_LIMIT_EXCEEDED,
@@ -451,6 +433,7 @@ enum _sms_svc_ctg_result_e
SMS_SVC_RESULT_RESERVED
};
+
enum _SMS_TIME_FORMAT_E {
SMS_TIME_EMPTY = 0,
SMS_TIME_RELATIVE ,
@@ -504,15 +487,13 @@ enum _sms_tp_failure_cause_e {
};
-typedef struct _sms_trans_msg_id_s
-{
+typedef struct _sms_trans_msg_id_s {
unsigned short msg_id;
bool header_ind;
}sms_trans_msg_id_s;
-typedef struct _sms_telesvc_addr_s
-{
+typedef struct _sms_telesvc_addr_s {
sms_digit_mode_t digit_mode;
sms_number_type_t number_type;
sms_number_plan_t number_plan;
@@ -521,8 +502,7 @@ typedef struct _sms_telesvc_addr_s
}sms_telesvc_addr_s;
-typedef struct _sms_reply_option_s
-{
+typedef struct _sms_reply_option_s {
bool user_ack_req;
bool deliver_ack_req;
bool read_ack_req;
@@ -530,24 +510,21 @@ typedef struct _sms_reply_option_s
}sms_reply_option_s;
-typedef struct _sms_time_relative_s
-{
+typedef struct _sms_time_relative_s {
sms_relative_time_t rel_time;
}sms_time_rel_s;
-typedef struct _sms_time_stamp_s
-{
- unsigned char year; // range 00-99 (96~99 : 19xx, 00~95 : 20xx)
- unsigned char month; // range 1-12
+typedef struct _sms_time_stamp_s {
+ unsigned char year; /* range 00-99 (96~99 : 19xx, 00~95 : 20xx) */
+ unsigned char month; /* range 1-12 */
unsigned char day;
- unsigned char hours; // range 0-23
- unsigned char minutes; // range 0-59
- unsigned char seconds; // range 0-59
+ unsigned char hours; /* range 0-23 */
+ unsigned char minutes; /* range 0-59 */
+ unsigned char seconds; /* range 0-59 */
}sms_time_abs_s;
-typedef struct _sms_val_period_s
-{
+typedef struct _sms_val_period_s {
unsigned char format;
union {
sms_time_rel_s rel_time;
@@ -556,16 +533,14 @@ typedef struct _sms_val_period_s
}sms_val_period_s;
-typedef struct _sms_encoding_specific_s
-{
+typedef struct _sms_encoding_specific_s {
sms_encoding_type_t encode_type;
unsigned int data_len;
char user_data[SMS_MAX_USER_DATA_LEN +1];
}sms_encoding_specific_s;
-typedef struct _sms_ctg_specific_s
-{
+typedef struct _sms_ctg_specific_s {
unsigned char operation_code;
unsigned short category;
sms_language_type_t language;
@@ -576,16 +551,14 @@ typedef struct _sms_ctg_specific_s
}sms_ctg_specific_s;
-typedef struct _sms_svc_ctg_program_data_s
-{
+typedef struct _sms_svc_ctg_program_data_s {
sms_encoding_type_t encode_type;
unsigned int num_data;
sms_ctg_specific_s *specific_data;
}sms_svc_ctg_program_data_s;
-typedef struct _sms_telesvc_userdata_s
-{
+typedef struct _sms_telesvc_userdata_s {
sms_encoding_type_t encode_type;
unsigned char msg_type;
unsigned int data_len;
@@ -593,8 +566,7 @@ typedef struct _sms_telesvc_userdata_s
}sms_telesvc_userdata_s;
-typedef struct _sms_telesvc_cmasdata_s
-{
+typedef struct _sms_telesvc_cmasdata_s {
unsigned int data_len;
sms_encoding_type_t encode_type;
unsigned char alert_text[SMS_MAX_USER_DATA_LEN +1];
@@ -611,8 +583,7 @@ typedef struct _sms_telesvc_cmasdata_s
}sms_telesvc_cmasdata_s;
-typedef struct _sms_enhanced_vmn_s
-{
+typedef struct _sms_enhanced_vmn_s {
sms_priority_indicator_t priority;
bool password_req;
bool setup_req;
@@ -643,8 +614,7 @@ typedef struct _sms_enhanced_vmn_s
}sms_enhanced_vmn_s;
-typedef struct _sms_enhanced_vmn_ack_s
-{
+typedef struct _sms_enhanced_vmn_ack_s {
unsigned short vm_mailbox_id;
unsigned char vm_num_unheard_msg;
unsigned char num_delete_ack;
@@ -655,8 +625,7 @@ typedef struct _sms_enhanced_vmn_ack_s
}sms_enhanced_vmn_ack_s;
-typedef struct _sms_telesvc_deliver_s
-{
+typedef struct _sms_telesvc_deliver_s {
sms_trans_msg_id_s msg_id;
sms_telesvc_userdata_s user_data;
sms_telesvc_cmasdata_s cmas_data;
@@ -673,14 +642,13 @@ typedef struct _sms_telesvc_deliver_s
sms_display_mode_t display_mode;
sms_encoding_specific_s multi_encode_data;
unsigned short deposit_id;
- //sms_svc_ctg_program_data_s svc_ctg;
+ /* sms_svc_ctg_program_data_s svc_ctg; */
sms_enhanced_vmn_s enhanced_vmn;
sms_enhanced_vmn_ack_s enhanced_vmn_ack;
}sms_telesvc_deliver_s;
-typedef struct _sms_telesvc_submit_s
-{
+typedef struct _sms_telesvc_submit_s {
sms_trans_msg_id_s msg_id;
sms_telesvc_userdata_s user_data;
sms_val_period_s val_period;
@@ -693,18 +661,16 @@ typedef struct _sms_telesvc_submit_s
sms_telesvc_addr_s callback_number;
sms_encoding_specific_s multi_encode_data;
unsigned char deposit_id;
- //sms_svc_ctg_program_data_s svc_ctg;
+ /* sms_svc_ctg_program_data_s svc_ctg; */
}sms_telesvc_submit_s;
-typedef struct _sms_telesvc_cancel_s
-{
+typedef struct _sms_telesvc_cancel_s {
sms_trans_msg_id_s msg_id;
}sms_telesvc_cancel_s;
-typedef struct _sms_telesvc_user_ack_s
-{
+typedef struct _sms_telesvc_user_ack_s {
sms_trans_msg_id_s msg_id;
sms_telesvc_userdata_s user_data;
unsigned char resp_code;
@@ -714,8 +680,7 @@ typedef struct _sms_telesvc_user_ack_s
}sms_telesvc_user_ack_s;
-typedef struct _sms_telesvc_deliver_ack_s
-{
+typedef struct _sms_telesvc_deliver_ack_s {
sms_trans_msg_id_s msg_id;
sms_telesvc_userdata_s user_data;
sms_time_abs_s time_stamp;
@@ -724,8 +689,7 @@ typedef struct _sms_telesvc_deliver_ack_s
}sms_telesvc_deliver_ack_s;
-typedef struct _sms_telesvc_read_ack_s
-{
+typedef struct _sms_telesvc_read_ack_s {
sms_trans_msg_id_s msg_id;
sms_telesvc_userdata_s user_data;
sms_time_abs_s time_stamp;
@@ -733,8 +697,7 @@ typedef struct _sms_telesvc_read_ack_s
unsigned char deposit_id;
}sms_telesvc_read_ack_s;
-typedef struct _sms_telesvc_deliver_report_s
-{
+typedef struct _sms_telesvc_deliver_report_s {
sms_trans_msg_id_s msg_id;
unsigned char tp_fail_cause;
sms_telesvc_userdata_s user_data;
@@ -743,8 +706,7 @@ typedef struct _sms_telesvc_deliver_report_s
}sms_telesvc_report_s;
-typedef struct _sms_telesvc_msg_s
-{
+typedef struct _sms_telesvc_msg_s {
sms_message_type_t type;
union {
@@ -773,8 +735,7 @@ typedef unsigned short sms_trans_svc_ctg_t; /* _sms_trans_svc_ctg_e */
typedef unsigned char sms_trans_reply_seq_t;
-typedef enum _sms_trans_msg_type_e
-{
+typedef enum _sms_trans_msg_type_e {
SMS_TRANS_P2P_MSG = 0x00,
SMS_TRANS_BROADCAST_MSG = 0x01,
SMS_TRANS_ACK_MSG = 0x02,
@@ -782,8 +743,7 @@ typedef enum _sms_trans_msg_type_e
}sms_trans_msg_type_t;
-enum _sms_trans_param_id_e
-{
+enum _sms_trans_param_id_e {
SMS_TRANS_PARAM_TELESVC_IDENTIFIER = 0x00,
SMS_TRANS_PARAM_SERVICE_CATEGORY = 0x01,
SMS_TRANS_PARAM_ORG_ADDRESS = 0x02,
@@ -797,8 +757,7 @@ enum _sms_trans_param_id_e
};
-enum _sms_trans_telesvc_id_e
-{
+enum _sms_trans_telesvc_id_e {
SMS_TRANS_TELESVC_CMT_91 = 0x1000, /* IS-91 Extended Protocol Enhanced Services */
SMS_TRANS_TELESVC_CPT_95 = 0x1001, /* Wireless Paging Teleservice */
SMS_TRANS_TELESVC_CMT_95 = 0x1002, /* Wireless Messaging Teleservice */
@@ -811,8 +770,7 @@ enum _sms_trans_telesvc_id_e
};
-enum _sms_trans_svc_ctg_e
-{
+enum _sms_trans_svc_ctg_e {
SMS_TRANS_SVC_CTG_UNKNOWN = 0x0000,
SMS_TRANS_SVC_CTG_EMERGENCY = 0x0001,
SMS_TRANS_SVC_CTG_ADMINISTRATIVE = 0x0002,
@@ -848,7 +806,7 @@ enum _sms_trans_svc_ctg_e
SMS_TRANS_SVC_CTG_CATPT = 0x0020,
SMS_TRANS_SVC_CTG_KDDI_CORP_MIN1 = 0x0021,
SMS_TRANS_SVC_CTG_KDDI_CORP_MAX1 = 0x003f,
- SMS_TRANS_SVC_CTG_CMAS_PRESIDENTIAL = 0x1000,
+ SMS_TRANS_SVC_CTG_CMAS_PRESIDENTIAL = 0x1000,
SMS_TRANS_SVC_CTG_CMAS_EXTREME = 0x1001,
SMS_TRANS_SVC_CTG_CMAS_SEVERE = 0x1002,
SMS_TRANS_SVC_CTG_CMAS_AMBER = 0x1003,
@@ -862,24 +820,21 @@ enum _sms_trans_svc_ctg_e
};
-typedef enum _sms_trans_err_class_e
-{
+typedef enum _sms_trans_err_class_e {
SMS_TRANS_ERR_CLASS_NONE = 0x00,
SMS_TRANS_ERR_CLASS_TEMPORARY = 0x02,
SMS_TRANS_ERR_CLASS_PERMANENT = 0x03
}sms_trans_err_class_t;
-typedef enum _sms_trans_cause_code_e
-{
- SMS_CAUSE_CODE_INVAILD_TELESERVICE_ID = 0x04,
- SMS_CAUSE_CODE_SERVICE_TERMINATION_DENIED = 0x62,
+typedef enum _sms_trans_cause_code_e {
+ SMS_CAUSE_CODE_INVAILD_TELESERVICE_ID = 0x04,
+ SMS_CAUSE_CODE_SERVICE_TERMINATION_DENIED = 0x62,
SMS_TODO_FILL_THIS_ENUMS
}sms_trans_cause_code_t;
-typedef enum _sms_trans_sub_addr_type_e
-{
+typedef enum _sms_trans_sub_addr_type_e {
SMS_TRANS_SUB_ADDR_NSAP = 0x00,
SMS_TRANS_SUB_ADDR_USER = 0x01,
SMS_TRANS_SUB_ADDR_RESERVED
@@ -887,8 +842,7 @@ typedef enum _sms_trans_sub_addr_type_e
-enum _sms_trans_dnet_addr_type_e
-{
+enum _sms_trans_dnet_addr_type_e {
SMS_TRANS_DNET_UNKNOWN = 0x00,
SMS_TRANS_DNET_INTERNET_PROTOCOL = 0x01,
SMS_TRANS_DNET_INTERNET_MAIL_ADDR = 0x02,
@@ -898,20 +852,20 @@ enum _sms_trans_dnet_addr_type_e
enum _sms_digit_mode_e {
SMS_DIGIT_4BIT_DTMF = 0,
- SMS_DIGIT_8BIT = 1
+ SMS_DIGIT_8BIT = 1
};
enum _sms_number_mode_e {
SMS_NUMBER_MODE_NONE_DATANETWORK = 0,
- SMS_NUMBER_MODE_DATANETWORK = 1, /*using data network address format*/
+ SMS_NUMBER_MODE_DATANETWORK = 1, /*using data network address format*/
};
enum _sms_dnet_number_type_e {
- SMS_ADDRESS_TYPE_UNKNOWN = 0x00,
+ SMS_ADDRESS_TYPE_UNKNOWN = 0x00,
SMS_ADDRESS_TYPE_INTERNET_PROTOCOL = 0x01,
- SMS_ADDRESS_TYPE_EMAIL_ADDRESS = 0x02,
+ SMS_ADDRESS_TYPE_EMAIL_ADDRESS = 0x02,
};
@@ -933,17 +887,16 @@ enum _sms_number_type_e {
enum _sms_number_plan_e {
- SMS_NPI_UNKNOWN = 0,
- SMS_NPI_ISDN = 1,
- SMS_NPI_DATA = 3,
- SMS_NPI_TELEX = 4,
- SMS_NPI_PRIVATE = 9,
+ SMS_NPI_UNKNOWN = 0,
+ SMS_NPI_ISDN = 1,
+ SMS_NPI_DATA = 3,
+ SMS_NPI_TELEX = 4,
+ SMS_NPI_PRIVATE = 9,
SMS_NPI_RESERVED = 15,
};
-typedef struct _sms_trans_addr_s
-{
+typedef struct _sms_trans_addr_s {
sms_digit_mode_t digit_mode;
sms_number_mode_t number_mode;
sms_number_type_t number_type;
@@ -953,8 +906,7 @@ typedef struct _sms_trans_addr_s
}sms_trans_addr_s;
-typedef struct _sms_trans_sub_addr_s
-{
+typedef struct _sms_trans_sub_addr_s {
sms_trans_sub_addr_type_t type;
bool odd;
unsigned int addr_len;
@@ -962,16 +914,14 @@ typedef struct _sms_trans_sub_addr_s
}sms_trans_sub_addr_s;
-typedef struct _sms_trans_cause_code_s
-{
+typedef struct _sms_trans_cause_code_s {
sms_trans_reply_seq_t reply_seq;
sms_trans_err_class_t error_class;
sms_trans_cause_code_t cause_code;
}sms_trans_cause_code_s;
-typedef struct _sms_trans_p2p_msg_s
-{
+typedef struct _sms_trans_p2p_msg_s {
sms_trans_telesvc_id_t telesvc_id;
sms_trans_svc_ctg_t svc_ctg;
sms_trans_addr_s address;
@@ -981,23 +931,20 @@ typedef struct _sms_trans_p2p_msg_s
}sms_trans_p2p_msg_s;
-typedef struct _sms_trans_broadcast_msg_s
-{
+typedef struct _sms_trans_broadcast_msg_s {
sms_trans_svc_ctg_t svc_ctg;
sms_telesvc_msg_s telesvc_msg;
}sms_trans_broadcast_msg_s;
-typedef struct _sms_trans_ack_msg_s
-{
+typedef struct _sms_trans_ack_msg_s {
sms_trans_addr_s address;
sms_trans_sub_addr_s sub_address;
sms_trans_cause_code_s cause_code;
}sms_trans_ack_msg_s;
-typedef struct _sms_trans_msg_s
-{
+typedef struct _sms_trans_msg_s {
sms_trans_msg_type_t type;
union {
sms_trans_p2p_msg_s p2p_msg;
@@ -1007,5 +954,4 @@ typedef struct _sms_trans_msg_s
}sms_trans_msg_s;
-#endif //SMS_CDMA_PLUGIN_TYPES_H
-
+#endif /* SMS_CDMA_PLUGIN_TYPES_H */
diff --git a/plugin/sms_cdma_plugin/include/SmsCdmaPluginUAManager.h b/plugin/sms_cdma_plugin/include/SmsCdmaPluginUAManager.h
index c14d59a..04f92f6 100755
--- a/plugin/sms_cdma_plugin/include/SmsCdmaPluginUAManager.h
+++ b/plugin/sms_cdma_plugin/include/SmsCdmaPluginUAManager.h
@@ -35,7 +35,7 @@ class SmsPluginUAManager : public MsgThread
public:
static SmsPluginUAManager* instance();
- //virtual void start();
+ /* virtual void start(); */
void addReqEntity(sms_request_info_s *request);
@@ -59,5 +59,4 @@ private:
CndVar cv;
};
-#endif //SMS_CDMA_PLUGIN_UA_MANAGER_H
-
+#endif /* SMS_CDMA_PLUGIN_UA_MANAGER_H */
diff --git a/plugin/sms_cdma_plugin/include/SmsCdmaPluginWapPushHandler.h b/plugin/sms_cdma_plugin/include/SmsCdmaPluginWapPushHandler.h
index f2aac5c..f2142fb 100755
--- a/plugin/sms_cdma_plugin/include/SmsCdmaPluginWapPushHandler.h
+++ b/plugin/sms_cdma_plugin/include/SmsCdmaPluginWapPushHandler.h
@@ -50,7 +50,7 @@ class SmsPluginWapPushHandler
public:
static SmsPluginWapPushHandler* instance();
- //void registerPushCallback();
+ /* void registerPushCallback(); */
bool IsWapPushMsg(unsigned short dstport);
void copyDeliverData(sms_trans_addr_s *pAddr);
@@ -94,8 +94,7 @@ private:
sms_trans_addr_s tmpAddress;
-// SMS_TIMESTAMP_S tmpTimeStamp;
+ /* SMS_TIMESTAMP_S tmpTimeStamp; */
};
-#endif //SmsPluginWapPushHandler
-
+#endif /* SmsPluginWapPushHandler */
diff --git a/plugin/sms_plugin/CMakeLists.txt b/plugin/sms_plugin/CMakeLists.txt
index 32fc48c..5ecebab 100755
--- a/plugin/sms_plugin/CMakeLists.txt
+++ b/plugin/sms_plugin/CMakeLists.txt
@@ -42,7 +42,7 @@ INCLUDE_DIRECTORIES(
)
INCLUDE(FindPkgConfig)
-pkg_check_modules(sms_plugin_pkgs REQUIRED glib-2.0 tapi libxml-2.0 libwbxml2 dlog vconf gio-2.0 db-util capi-telephony)
+pkg_check_modules(sms_plugin_pkgs REQUIRED glib-2.0 tapi libxml-2.0 libwbxml2 dlog vconf gio-2.0 capi-telephony)
FOREACH(flag ${sms_plugin_pkgs_CFLAGS})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
diff --git a/plugin/sms_plugin/SmsPluginCallback.cpp b/plugin/sms_plugin/SmsPluginCallback.cpp
index 038d40f..99bb053 100755
--- a/plugin/sms_plugin/SmsPluginCallback.cpp
+++ b/plugin/sms_plugin/SmsPluginCallback.cpp
@@ -31,6 +31,7 @@
#include "SmsPluginSimMsg.h"
#include "SmsPluginSetting.h"
#include "MsgGconfWrapper.h"
+#include "MsgDevicedWrapper.h"
#include "SmsPluginCallback.h"
#include "SmsPluginDSHandler.h"
@@ -44,13 +45,10 @@ void TapiEventDeviceReady(TapiHandle *handle, const char *noti_id, void *data, v
{
MSG_DEBUG("TapiEventDeviceReady is called. : noti_id = [%d]", noti_id);
- try
- {
- // Call Event Handler
+ try {
+ /* Call Event Handler */
SmsPluginEventHandler::instance()->setDeviceStatus(handle);
- }
- catch (MsgException& e)
- {
+ } catch (MsgException& e) {
MSG_FATAL("%s", e.what());
return;
}
@@ -63,38 +61,39 @@ SMS_NETWORK_STATUS_T convertTapiRespToSmsPlugin(int result)
/* Convert TAPI status -> SMS network status */
switch ((TelSmsResponse_t)result) {
- case TAPI_NETTEXT_SENDSMS_SUCCESS :
- sentStatus = SMS_NETWORK_SEND_SUCCESS;
- break;
+ case TAPI_NETTEXT_SENDSMS_SUCCESS :
+ sentStatus = SMS_NETWORK_SEND_SUCCESS;
+ break;
- case TAPI_NETTEXT_INVALID_MANDATORY_INFO :
- sentStatus = SMS_NETWORK_SEND_FAIL_MANDATORY_INFO_MISSING;
- break;
+ case TAPI_NETTEXT_INVALID_MANDATORY_INFO :
+ sentStatus = SMS_NETWORK_SEND_FAIL_MANDATORY_INFO_MISSING;
+ break;
- case TAPI_NETTEXT_DESTINAITION_OUTOFSERVICE :
- case TAPI_NETTEXT_TEMPORARY_FAILURE :
- case TAPI_NETTEXT_CONGESTION :
- case TAPI_NETTEXT_RESOURCES_UNAVAILABLE :
- case TAPI_NETTEXT_MESSAGE_NOT_COMPAT_PROTOCOL :
- case TAPI_NETTEXT_NETWORK_OUTOFORDER:
- sentStatus = SMS_NETWORK_SEND_FAIL_TEMPORARY;
- break;
+ case TAPI_NETTEXT_DESTINAITION_OUTOFSERVICE :
+ case TAPI_NETTEXT_TEMPORARY_FAILURE :
+ case TAPI_NETTEXT_CONGESTION :
+ case TAPI_NETTEXT_RESOURCES_UNAVAILABLE :
+ case TAPI_NETTEXT_MESSAGE_NOT_COMPAT_PROTOCOL :
+ case TAPI_NETTEXT_NETWORK_OUTOFORDER:
+ sentStatus = SMS_NETWORK_SEND_FAIL_TEMPORARY;
+ break;
- case TAPI_NETTEXT_MESSAGE_TRANSFER_REJECTED :
- sentStatus = SMS_NETWORK_SEND_FAIL_BY_MO_CONTROL_NOT_ALLOWED;
- break;
+ case TAPI_NETTEXT_MESSAGE_TRANSFER_REJECTED :
+ sentStatus = SMS_NETWORK_SEND_FAIL_BY_MO_CONTROL_NOT_ALLOWED;
+ break;
- case TAPI_NETTEXT_DEST_ADDRESS_FDN_RESTRICTED :
- case TAPI_NETTEXT_SCADDRESS_FDN_RESTRICTED :
- sentStatus = SMS_NETWORK_SEND_FAIL_FDN_RESTRICED;
- break;
- case TAPI_NETTEXT_ROUTING_NOT_AVAILABLE :
- sentStatus = SMS_NETWORK_SEND_FAIL_NO_ROUTING;
- break;
- default :
- sentStatus = SMS_NETWORK_SEND_FAIL;
- break;
+ case TAPI_NETTEXT_DEST_ADDRESS_FDN_RESTRICTED :
+ case TAPI_NETTEXT_SCADDRESS_FDN_RESTRICTED :
+ sentStatus = SMS_NETWORK_SEND_FAIL_FDN_RESTRICED;
+ break;
+ case TAPI_NETTEXT_ROUTING_NOT_AVAILABLE :
+ sentStatus = SMS_NETWORK_SEND_FAIL_NO_ROUTING;
+ break;
+ default :
+ sentStatus = SMS_NETWORK_SEND_FAIL;
+ break;
}
+
return sentStatus;
}
@@ -120,7 +119,8 @@ void TapiEventSentStatus(TapiHandle *handle, int result, void *data, void *user_
/* only temporary errors should be returned without calling handleSentStatus() in order to resend sms */
if (sentStatus == SMS_NETWORK_SEND_FAIL_TEMPORARY ||
- sentStatus == SMS_NETWORK_SEND_FAIL_BY_MO_CONTROL_WITH_MOD) {
+ sentStatus == SMS_NETWORK_SEND_FAIL_BY_MO_CONTROL_WITH_MOD ||
+ sentStatus == SMS_NETWORK_SEND_FAIL_FDN_RESTRICED) {
SmsPluginTransport::instance()->setNetStatus(sentStatus);
return;
}
@@ -128,9 +128,8 @@ void TapiEventSentStatus(TapiHandle *handle, int result, void *data, void *user_
if (sentStatus == SMS_NETWORK_SEND_FAIL) {
int svc_type;
tel_get_property_int(handle, TAPI_PROP_NETWORK_SERVICE_TYPE, &svc_type);
- if (svc_type < TAPI_NETWORK_SERVICE_TYPE_2G) {
+ if (svc_type < TAPI_NETWORK_SERVICE_TYPE_2G)
sentStatus = SMS_NETWORK_SEND_PENDING;
- }
}
/* Convert SMS status -> Messaging network status */
@@ -146,14 +145,11 @@ void TapiEventSentStatus(TapiHandle *handle, int result, void *data, void *user_
netStatus = MSG_NETWORK_SEND_FAIL;
}
- try
- {
+ try {
SmsPluginEventHandler::instance()->handleSentStatus(netStatus);
SmsPluginTransport::instance()->setNetStatus(sentStatus);
- }
- catch (MsgException& e)
- {
+ } catch (MsgException& e) {
MSG_FATAL("%s", e.what());
return;
}
@@ -162,7 +158,7 @@ void TapiEventSentStatus(TapiHandle *handle, int result, void *data, void *user_
void TapiEventSatSmsSentStatus(TapiHandle *handle, int result, void *data, void *user_data)
{
- MSG_DEBUG("TapiEventSatSmsSentStatus is called. : result = [%d]", result);
+ MSG_INFO("TapiEventSatSmsSentStatus is called. : result = [%d]", result);
SMS_NETWORK_STATUS_T sentStatus;
@@ -170,21 +166,16 @@ void TapiEventSatSmsSentStatus(TapiHandle *handle, int result, void *data, void
MSG_DEBUG("SMS Network Status = [%d]", sentStatus);
- if (sentStatus == SMS_NETWORK_SEND_FAIL && result != TAPI_NETTEXT_DEVICE_FAILURE)
- {
+ if (sentStatus == SMS_NETWORK_SEND_FAIL && result != TAPI_NETTEXT_DEVICE_FAILURE) {
int svc_type;
tel_get_property_int(handle, TAPI_PROP_NETWORK_SERVICE_TYPE, &svc_type);
- if (svc_type < TAPI_NETWORK_SERVICE_TYPE_2G){
+ if (svc_type < TAPI_NETWORK_SERVICE_TYPE_2G)
sentStatus = SMS_NETWORK_SEND_PENDING;
- }
}
- try
- {
+ try {
SmsPluginSatHandler::instance()->ctrlSms(handle, sentStatus);
- }
- catch (MsgException& e)
- {
+ } catch (MsgException& e) {
MSG_FATAL("%s", e.what());
return;
}
@@ -195,24 +186,26 @@ void TapiEventMsgIncoming(TapiHandle *handle, const char *noti_id, void *data, v
MSG_SEC_DEBUG("TapiEventMsgIncoming is called. noti_id [%s]", noti_id);
if (data == NULL) {
- MSG_DEBUG("Error. evt->pData is NULL.");
+ MSG_ERR("Error. data is NULL.");
return;
}
#if 0
SmsPluginCbMsgHandler::instance()->handleCbMsg(handle, NULL);
return;
#endif
+ /* make a margin timeout(500ms) till suspending status */
+ MsgDisplayLock();
+
TelSmsDatapackageInfo_t* pDataPackage = (TelSmsDatapackageInfo_t*)data;
SMS_TPDU_S tpdu;
memset(&tpdu, 0x00, sizeof(SMS_TPDU_S));
- // Decode Incoming Message
+ /* Decode Incoming Message */
SmsPluginTpduCodec::decodeTpdu(pDataPackage->szData, pDataPackage->MsgLength, &tpdu);
- /// Print tpdu
- if (tpdu.tpduType == SMS_TPDU_DELIVER)
- {
+ /* Print tpdu */
+ if (tpdu.tpduType == SMS_TPDU_DELIVER) {
MSG_DEBUG("############# SMS_TPDU_DELIVER Incoming decoded tpdu values ####################");
MSG_DEBUG("tpdu.data.deliver.bMoreMsg : %d", tpdu.data.deliver.bMoreMsg);
MSG_DEBUG("tpdu.data.deliver.bStatusReport : %d", tpdu.data.deliver.bStatusReport);
@@ -231,9 +224,7 @@ void TapiEventMsgIncoming(TapiHandle *handle, const char *noti_id, void *data, v
MSG_DEBUG("tpdu.data.deliver.userData.length : %d", tpdu.data.deliver.userData.length);
MSG_DEBUG("tpdu.data.deliver.userData.data : %s", tpdu.data.deliver.userData.data);
MSG_DEBUG("#####################################################");
- }
- else if (tpdu.tpduType == SMS_TPDU_STATUS_REP)
- {
+ } else if (tpdu.tpduType == SMS_TPDU_STATUS_REP) {
MSG_DEBUG("############# SMS_TPDU_STATUS_REP Incoming decoded tpdu values ####################");
MSG_DEBUG("tpdu.data.statusRep.msgRef : %d", tpdu.data.statusRep.msgRef);
MSG_DEBUG("tpdu.data.statusRep.bMoreMsg : %d", tpdu.data.statusRep.bMoreMsg);
@@ -256,36 +247,31 @@ void TapiEventMsgIncoming(TapiHandle *handle, const char *noti_id, void *data, v
MSG_DEBUG("#####################################################");
}
- try
- {
- if (tpdu.tpduType == SMS_TPDU_DELIVER)
- {
+ MsgDisplayUnlock();
+
+ try {
+ if (tpdu.tpduType == SMS_TPDU_DELIVER) {
if (tpdu.data.deliver.dcs.msgClass == SMS_MSG_CLASS_2) {
- // For GCF test, 34.2.5.3
+ /* For GCF test, 34.2.5.3 */
SmsPluginSimMsg::instance()->setSmsData((const char*)pDataPackage->Sca, (const char *)pDataPackage->szData, pDataPackage->MsgLength);
}
if (SmsPluginConcatHandler::instance()->IsConcatMsg(&(tpdu.data.deliver.userData)) == true ||
- SmsPluginWapPushHandler::instance()->IsWapPushMsg(&(tpdu.data.deliver.userData)) == true)
- {
- SmsPluginConcatHandler::instance()->handleConcatMsg(handle, &tpdu); // Call Concat Msg Handler
- }
- else
- {
- SmsPluginEventHandler::instance()->handleMsgIncoming(handle, &tpdu); // Call Event Handler
+ SmsPluginWapPushHandler::instance()->IsWapPushMsg(&(tpdu.data.deliver.userData)) == true) {
+ /* Call Concat Msg Handler */
+ SmsPluginConcatHandler::instance()->handleConcatMsg(handle, &tpdu);
+ } else {
+ /* Call Event Handler */
+ SmsPluginEventHandler::instance()->handleMsgIncoming(handle, &tpdu);
}
+ } else if (tpdu.tpduType == SMS_TPDU_STATUS_REP) {
+ /* Call Event Handler */
+ SmsPluginEventHandler::instance()->handleMsgIncoming(handle, &tpdu);
}
- else if (tpdu.tpduType == SMS_TPDU_STATUS_REP)
- {
- SmsPluginEventHandler::instance()->handleMsgIncoming(handle, &tpdu); // Call Event Handler
- }
- }
- catch (MsgException& e)
- {
+ } catch (MsgException& e) {
MSG_FATAL("%s", e.what());
return;
}
-
}
@@ -294,22 +280,18 @@ void TapiEventCbMsgIncoming(TapiHandle *handle, const char *noti_id, void *data,
MSG_SEC_DEBUG("TapiEventCbMsgIncoming is called. noti_id [%s]", noti_id);
if (data == NULL) {
- MSG_DEBUG("Error. evt->pData is NULL.");
+ MSG_ERR("Error. data is NULL.");
return;
}
TelSmsCbMsg_t *pCbMsg = (TelSmsCbMsg_t*)data;
- try
- {
+ try {
SmsPluginCbMsgHandler::instance()->handleCbMsg(handle, pCbMsg);
- }
- catch (MsgException& e)
- {
+ } catch (MsgException& e) {
MSG_FATAL("%s", e.what());
return;
}
-
}
@@ -318,18 +300,15 @@ void TapiEventEtwsMsgIncoming(TapiHandle *handle, const char *noti_id, void *dat
MSG_SEC_DEBUG("TapiEventEtwsMsgIncoming is called. noti_id [%s]", noti_id);
if (data == NULL) {
- MSG_DEBUG("Error. evt->pData is NULL.");
+ MSG_ERR("Error. data is NULL.");
return;
}
TelSmsEtwsMsg_t *pEtwsMsg = (TelSmsEtwsMsg_t*)data;
- try
- {
+ try {
SmsPluginCbMsgHandler::instance()->handleEtwsMsg(handle, pEtwsMsg);
- }
- catch (MsgException& e)
- {
+ } catch (MsgException& e) {
MSG_FATAL("%s", e.what());
return;
}
@@ -348,9 +327,8 @@ void TapiEventGetSimMsgCnt(TapiHandle *handle, int result, void *data, void *use
{
MSG_DEBUG("TapiEventGetSimMsgCnt is called.");
- if (result != TAPI_API_SUCCESS || data == NULL)
- {
- MSG_DEBUG("Error. data is NULL.");
+ if (result != TAPI_API_SUCCESS || data == NULL) {
+ MSG_ERR("Error. data is NULL. result:[0x%x]", result);
MSG_SIM_COUNT_S simCnt;
memset(&simCnt, 0x00, sizeof(MSG_SIM_COUNT_S));
SmsPluginSimMsg::instance()->setSimMsgCntEvent(handle, &simCnt);
@@ -366,9 +344,8 @@ void TapiEventGetSimMsg(TapiHandle *handle, int result, void *data, void *user_d
{
MSG_DEBUG("TapiEventGetSimMsg is called.");
- if (result != TAPI_API_SUCCESS || data == NULL)
- {
- MSG_DEBUG("Error!! pEvent->Status [%d]", result);
+ if (result != TAPI_API_SUCCESS || data == NULL) {
+ MSG_ERR("Error!! result [0x%x]", result);
SmsPluginSimMsg::instance()->setSimMsgEvent(handle, NULL, false);
@@ -377,17 +354,16 @@ void TapiEventGetSimMsg(TapiHandle *handle, int result, void *data, void *user_d
TelSmsData_t* pSmsTpdu = (TelSmsData_t*)data;
- //SmsPluginSimMsg::instance()->deleteSimMessage((msg_sim_id_t)pSmsTpdu->SimIndex);
int *simIdList = (int *)user_data;
- // Reading TelSmsData_t
- MSG_DEBUG ("sim index %d", pSmsTpdu->SimIndex);
- MSG_DEBUG ("status %d", pSmsTpdu->MsgStatus);
+ /* Reading TelSmsData_t */
+ MSG_DEBUG("sim index %d", pSmsTpdu->SimIndex);
+ MSG_DEBUG("status %d", pSmsTpdu->MsgStatus);
+ MSG_DEBUG("sim msg [%s]", pSmsTpdu->SmsData.szData);
- // Reading TelSmsDatapackageInfo_t
- if (pSmsTpdu->SmsData.MsgLength > MAX_TPDU_DATA_LEN)
- {
+ /* Reading TelSmsDatapackageInfo_t */
+ if (pSmsTpdu->SmsData.MsgLength > MAX_TPDU_DATA_LEN) {
MSG_DEBUG ("WARNING: tpdu_len > MAX_SMS_TPDU_SIZE [%d] bytes. setting to 0.", pSmsTpdu->SmsData.MsgLength);
SmsPluginSimMsg::instance()->setSimMsgEvent(handle, NULL, false);
@@ -397,21 +373,20 @@ void TapiEventGetSimMsg(TapiHandle *handle, int result, void *data, void *user_d
SMS_TPDU_S tpdu;
- // decode Tpdu
+ /* decode Tpdu */
SmsPluginTpduCodec::decodeTpdu(pSmsTpdu->SmsData.szData, pSmsTpdu->SmsData.MsgLength, &tpdu);
MSG_DEBUG("Sim Message Type [%d]", tpdu.tpduType);
bool bRead = false;
- // set read status
+ /* set read status */
if (pSmsTpdu->MsgStatus == TAPI_NETTEXT_STATUS_READ)
bRead = true;
else if (pSmsTpdu->MsgStatus == TAPI_NETTEXT_STATUS_UNREAD)
bRead = false;
- if (tpdu.tpduType == SMS_TPDU_DELIVER)
- {
+ if (tpdu.tpduType == SMS_TPDU_DELIVER) {
if (tpdu.data.deliver.dcs.codingScheme == SMS_CHARSET_8BIT && tpdu.data.deliver.pid == 0x11) {
MSG_DEBUG("Unsupported message!!");
SmsPluginSimMsg::instance()->setSimMsgEvent(handle, NULL, false);
@@ -419,13 +394,11 @@ void TapiEventGetSimMsg(TapiHandle *handle, int result, void *data, void *user_d
}
MSG_DEBUG("headerCnt [%d]", tpdu.data.deliver.userData.headerCnt);
- for (int i = 0; i < tpdu.data.deliver.userData.headerCnt; i++)
- {
- // Handler Concatenated Message
+ for (int i = 0; i < tpdu.data.deliver.userData.headerCnt; i++) {
+ /* Handler Concatenated Message */
if (tpdu.data.deliver.userData.header[i].udhType == SMS_UDH_CONCAT_8BIT ||
tpdu.data.deliver.userData.header[i].udhType == SMS_UDH_CONCAT_16BIT) {
SmsPluginConcatHandler::instance()->handleSimConcatMsg(handle, &tpdu, pSmsTpdu->SimIndex, bRead, simIdList);
- //SmsPluginSimMsg::instance()->setSimMsgEvent(NULL, false);
return;
}
@@ -435,9 +408,7 @@ void TapiEventGetSimMsg(TapiHandle *handle, int result, void *data, void *user_d
return;
}
}
- }
- else if (tpdu.tpduType == SMS_TPDU_SUBMIT)
- {
+ } else if (tpdu.tpduType == SMS_TPDU_SUBMIT) {
if (tpdu.data.submit.dcs.codingScheme == SMS_CHARSET_8BIT && tpdu.data.submit.pid == 0x11) {
MSG_DEBUG("Unsupported message!!");
SmsPluginSimMsg::instance()->setSimMsgEvent(handle, NULL, false);
@@ -445,23 +416,21 @@ void TapiEventGetSimMsg(TapiHandle *handle, int result, void *data, void *user_d
}
MSG_DEBUG("headerCnt [%d]", tpdu.data.submit.userData.headerCnt);
- for (int i = 0; i < tpdu.data.submit.userData.headerCnt; i++)
- {
- // Handler Concatenated Message
+ for (int i = 0; i < tpdu.data.submit.userData.headerCnt; i++) {
+ /* Handler Concatenated Message */
if (tpdu.data.submit.userData.header[i].udhType == SMS_UDH_CONCAT_8BIT ||
- tpdu.data.submit.userData.header[i].udhType == SMS_UDH_CONCAT_16BIT)
- {
+ tpdu.data.submit.userData.header[i].udhType == SMS_UDH_CONCAT_16BIT) {
SmsPluginConcatHandler::instance()->handleSimConcatMsg(handle, &tpdu, pSmsTpdu->SimIndex, bRead, simIdList);
return;
}
}
}
- // Make MSG_MESSAGE_INFO_S
+ /* Make MSG_MESSAGE_INFO_S */
MSG_MESSAGE_INFO_S msgInfo;
memset(&msgInfo, 0x00, sizeof(MSG_MESSAGE_INFO_S));
- // set storage id
+ /* set storage id */
msgInfo.storageId = MSG_STORAGE_SIM;
msgInfo.addressList = NULL;
@@ -503,16 +472,15 @@ void TapiEventGetSimMsg(TapiHandle *handle, int result, void *data, void *user_d
memset(msgInfo.msgText, 0x00, sizeof(msgInfo.msgText));
snprintf(msgInfo.msgText, sizeof(msgInfo.msgText), "Voice message");
}
- }
- else if (tpdu.tpduType == SMS_TPDU_SUBMIT) {
+ } else if (tpdu.tpduType == SMS_TPDU_SUBMIT) {
msgInfo.displayTime = time(NULL);
}
- // set read status
+ /* set read status */
msgInfo.bRead = bRead;
simIdList[0] = pSmsTpdu->SimIndex + 1;
- /// Print MSG_MESSAGE_INFO_S
+ /* Print MSG_MESSAGE_INFO_S */
MSG_DEBUG("############# Convert tpdu values to Message Info values ####################");
MSG_DEBUG("msgInfo.msgId : %d", msgInfo.msgId);
MSG_DEBUG("msgInfo.nAddressCnt : %d", msgInfo.nAddressCnt);
@@ -536,7 +504,8 @@ void TapiEventGetSimMsg(TapiHandle *handle, int result, void *data, void *user_d
MSG_DEBUG("msgInfo.sim_idx : %d", msgInfo.sim_idx);
MSG_DEBUG("###############################################################");
- SmsPluginSimMsg::instance()->setSimMsgEvent(handle, &msgInfo, true); // Call Event Handler
+ /* Call Event Handler */
+ SmsPluginSimMsg::instance()->setSimMsgEvent(handle, &msgInfo, true);
}
@@ -551,7 +520,7 @@ void TapiEventSaveSimMsg(TapiHandle *handle, int result, void *data, void *user_
if (data != NULL)
simId = *((int*)data);
else
- MSG_DEBUG("Data(SIM Msg ID) is NULL");
+ MSG_ERR("Data(SIM Msg ID) is NULL");
SmsPluginSimMsg::instance()->setSaveSimMsgEvent(handle, simId, result);
}
@@ -567,21 +536,17 @@ void TapiEventSaveClass2Msg(TapiHandle *handle, int result, void *data, void *us
simId = *((int*)data);
MSG_DEBUG("SIM Msg ID : %d", simId);
} else {
- MSG_DEBUG("Data(SIM Msg ID) is NULL");
+ MSG_ERR("Data(SIM Msg ID) is NULL");
}
MSG_MESSAGE_INFO_S *pMsgInfo = (MSG_MESSAGE_INFO_S *)user_data;
SmsPluginSimMsg::instance()->setSaveClass2MsgEvent(handle, simId, result, pMsgInfo);
- if(result == TAPI_NETTEXT_SENDSMS_SUCCESS)
- {
+ if (result == TAPI_NETTEXT_SENDSMS_SUCCESS)
SmsPluginSimMsg::instance()->setSimEvent((msg_sim_id_t)simId, true);
- }
else
- {
SmsPluginSimMsg::instance()->setSimEvent((msg_sim_id_t)0, false);
- }
if (pMsgInfo) {
if (pMsgInfo->addressList) {
@@ -598,9 +563,8 @@ void TapiEventDeleteSimMsg(TapiHandle *handle, int result, void *data, void *use
{
MSG_DEBUG("TapiEventDeleteSimMsg is called. result [%d]", result);
- if (result != TAPI_API_SUCCESS || data == NULL)
- {
- MSG_DEBUG("Error. data is NULL.");
+ if (result != TAPI_API_SUCCESS || data == NULL) {
+ MSG_ERR("Error. data is NULL. result:0x%x", result);
SmsPluginSimMsg::instance()->setDelSimEvent(-1, false);
return;
}
@@ -616,9 +580,8 @@ void TapiEventSetConfigData(TapiHandle *handle, int result, void *data, void *us
{
MSG_DEBUG("TapiEventSetConfigData is called.");
- if (data == NULL)
- {
- MSG_DEBUG("Error. data is NULL.");
+ if (data == NULL) {
+ MSG_ERR("Error. data is NULL. result:%d", result);
return;
}
@@ -626,30 +589,29 @@ void TapiEventSetConfigData(TapiHandle *handle, int result, void *data, void *us
MSG_DEBUG("responseType : [%d]", *responseType);
- switch (*responseType)
- {
- case TAPI_NETTEXT_SETPREFERREDBEARER_RSP :
- MSG_DEBUG("TAPI_NETTEXT_SETPREFERREDBEARER_RSP is called");
+ switch (*responseType) {
+ case TAPI_NETTEXT_SETPREFERREDBEARER_RSP :
+ MSG_DEBUG("TAPI_NETTEXT_SETPREFERREDBEARER_RSP is called");
break;
- case TAPI_NETTEXT_SETPARAMETERS_RSP :
- MSG_DEBUG("TAPI_NETTEXT_SETPARAMETERS_RSP is called");
+ case TAPI_NETTEXT_SETPARAMETERS_RSP :
+ MSG_DEBUG("TAPI_NETTEXT_SETPARAMETERS_RSP is called");
break;
- case TAPI_NETTEXT_CBSETCONFIG_RSP :
- MSG_DEBUG("TAPI_NETTEXT_CBSETCONFIG_RSP is called");
+ case TAPI_NETTEXT_CBSETCONFIG_RSP :
+ MSG_DEBUG("TAPI_NETTEXT_CBSETCONFIG_RSP is called");
break;
- case TAPI_NETTEXT_SETMEMORYSTATUS_RSP :
- MSG_DEBUG("TAPI_NETTEXT_SETMEMORYSTATUS_RSP is called");
+ case TAPI_NETTEXT_SETMEMORYSTATUS_RSP :
+ MSG_DEBUG("TAPI_NETTEXT_SETMEMORYSTATUS_RSP is called");
break;
- case TAPI_NETTEXT_SETMESSAGESTATUS_RSP :
- MSG_DEBUG("TAPI_NETTEXT_SETMESSAGESTATUS_RSP is called");
+ case TAPI_NETTEXT_SETMESSAGESTATUS_RSP :
+ MSG_DEBUG("TAPI_NETTEXT_SETMESSAGESTATUS_RSP is called");
break;
- default :
- MSG_DEBUG("Unknown Response is called [%d]", *responseType);
+ default :
+ MSG_DEBUG("Unknown Response is called [%d]", *responseType);
break;
}
@@ -671,9 +633,8 @@ void TapiEventGetParamCnt(TapiHandle *handle, int result, void *data, void *user
{
MSG_DEBUG("TapiEventGetParamCnt is called.");
- if (result != TAPI_API_SUCCESS || data == NULL)
- {
- MSG_DEBUG("Error. evt->pData is NULL.");
+ if (result != TAPI_API_SUCCESS || data == NULL) {
+ MSG_ERR("Error. data is NULL. result:0x%x", result);
SmsPluginSetting::instance()->setParamCntEvent(0);
return;
}
@@ -690,9 +651,8 @@ void TapiEventGetParam(TapiHandle *handle, int result, void *data, void *user_da
{
MSG_DEBUG("TapiEventGetConfigData is called.");
- if (result != TAPI_API_SUCCESS || data == NULL)
- {
- MSG_DEBUG("Error. data is NULL.");
+ if (result != TAPI_API_SUCCESS || data == NULL) {
+ MSG_ERR("Error. data is NULL. result:0x%x", result);
SmsPluginSetting::instance()->setParamEvent(handle, NULL, -1, false);
return;
}
@@ -707,8 +667,7 @@ void TapiEventGetParam(TapiHandle *handle, int result, void *data, void *user_da
alphaIdLen = smsParam->AlphaIdLen;
MSG_DEBUG("alphaId_len[%d]", alphaIdLen);
- if (alphaIdLen < 0 || alphaIdLen > SMSC_NAME_MAX)
- {
+ if (alphaIdLen < 0 || alphaIdLen > SMSC_NAME_MAX) {
MSG_DEBUG("Wrong Alpha ID Length[%d]", alphaIdLen);
SmsPluginSetting::instance()->setParamEvent(handle, NULL, -1, false);
@@ -720,14 +679,11 @@ void TapiEventGetParam(TapiHandle *handle, int result, void *data, void *user_da
/*Check Address value*/
addrLen = smsParam->TpSvcCntrAddr.DialNumLen;
- if(addrLen > SMSC_ADDR_MAX)
- {
+ if (addrLen > SMSC_ADDR_MAX) {
MSG_DEBUG("addrLen is too long: %d", addrLen);
SmsPluginSetting::instance()->setParamEvent(handle, NULL, -1, false);
return;
- }
- else if(addrLen < 2)
- {
+ } else if (addrLen < 2) {
MSG_DEBUG("addrLen is too short: %d", addrLen);
SmsPluginSetting::instance()->setParamEvent(handle, NULL, -1, false);
return;
@@ -735,13 +691,11 @@ void TapiEventGetParam(TapiHandle *handle, int result, void *data, void *user_da
MSG_DEBUG("addrLen : %d", addrLen);
-
/*SMSP Parameter Indicator value*/
MSG_DEBUG("ParamIndicator[%02x]", smsParam->ParamIndicator);
/*Get SMSC Address*/
- if(0x00 == (0x02 & smsParam->ParamIndicator))
- {
+ if (0x00 == (0x02 & smsParam->ParamIndicator)) {
MSG_DEBUG("record index[%d]", (int)smsParam->RecordIndex);
MSG_DEBUG("TON : %d", smsParam->TpSvcCntrAddr.Ton);
@@ -762,58 +716,46 @@ void TapiEventGetParam(TapiHandle *handle, int result, void *data, void *user_da
smscData.name[alphaIdLen] = '\0';
MSG_SEC_DEBUG("SMSC Name : [%s]", smscData.name);
- }
- else
- {
+ } else {
MSG_DEBUG("SMSC Address is not present");
-// smscData.smscAddr.ton = MSG_TON_UNKNOWN;
-// smscData.smscAddr.npi = MSG_NPI_UNKNOWN;
-//
-// memset(smscData.smscAddr.address, 0x00, SMSC_ADDR_MAX+1);
-// memset(smscData.name, 0x00, SMSC_NAME_MAX+1);
-
SmsPluginSetting::instance()->setParamEvent(handle, NULL, -1, false);
return;
}
/*Get the PID value*/
- if (0x00 == (0x04 & smsParam->ParamIndicator))
- {
+ if (0x00 == (0x04 & smsParam->ParamIndicator)) {
SMS_PID_T pid = (SMS_PID_T)smsParam->TpProtocolId;
MSG_DEBUG("smsParam->TpProtocolId : %d", smsParam->TpProtocolId);
- switch (pid)
- {
- case SMS_PID_NORMAL:
- smscData.pid = MSG_PID_TEXT;
+ switch (pid) {
+ case SMS_PID_NORMAL:
+ smscData.pid = MSG_PID_TEXT;
break;
- case SMS_PID_VOICE:
- smscData.pid = MSG_PID_VOICE;
+ case SMS_PID_VOICE:
+ smscData.pid = MSG_PID_VOICE;
break;
- case SMS_PID_TELEX:
- smscData.pid = MSG_PID_FAX;
+ case SMS_PID_TELEX:
+ smscData.pid = MSG_PID_FAX;
break;
- case SMS_PID_x400:
- smscData.pid = MSG_PID_X400;
+ case SMS_PID_x400:
+ smscData.pid = MSG_PID_X400;
break;
- case SMS_PID_ERMES:
- smscData.pid = MSG_PID_ERMES;
+ case SMS_PID_ERMES:
+ smscData.pid = MSG_PID_ERMES;
break;
- case SMS_PID_EMAIL:
- smscData.pid = MSG_PID_EMAIL;
+ case SMS_PID_EMAIL:
+ smscData.pid = MSG_PID_EMAIL;
break;
- default:
- smscData.pid = MSG_PID_TEXT;
+ default:
+ smscData.pid = MSG_PID_TEXT;
break;
}
MSG_DEBUG("smscData.pid : %d", smscData.pid);
- }
- else
- {
+ } else {
MSG_DEBUG("PID is not present");
smscData.pid = MSG_PID_TEXT;
MSG_DEBUG("MSG_PID_TEXT is inserted to PID");
@@ -834,21 +776,16 @@ void TapiEventGetParam(TapiHandle *handle, int result, void *data, void *user_da
#endif
/*Get the ValidityPeriod value*/
- if (0x00 == (0x10 & smsParam->ParamIndicator))
- {
+ if (0x00 == (0x10 & smsParam->ParamIndicator)) {
smscData.valPeriod = smsParam->TpValidityPeriod;
MSG_DEBUG("valPeriod : %d", smscData.valPeriod);
- }
- else
- {
-
+ } else {
smscData.valPeriod = 0;
MSG_DEBUG("Validity Period is not present");
}
SmsPluginSetting::instance()->setParamEvent(handle, &smscData, (int)smsParam->RecordIndex, true);
-
}
@@ -856,11 +793,10 @@ void TapiEventSetSmscInfo(TapiHandle *handle, int result, void *data, void *user
{
MSG_DEBUG("TapiEventSetSmscInfo is called. result=[%d]", result);
- if (result != TAPI_API_SUCCESS) {
+ if (result != TAPI_API_SUCCESS)
SmsPluginSetting::instance()->setResultFromSim(false);
- } else {
+ else
SmsPluginSetting::instance()->setResultFromSim(true);
- }
}
@@ -872,9 +808,8 @@ void TapiEventGetCBConfig(TapiHandle *handle, int result, void *data, void *user
int simIndex = SmsPluginDSHandler::instance()->getSimIndex(handle);
- if (result != TAPI_API_SUCCESS || data == NULL || simIndex == 0)
- {
- MSG_DEBUG("Error. data is NULL.");
+ if (result != TAPI_API_SUCCESS || data == NULL || simIndex == 0) {
+ MSG_ERR("Error. data is NULL. result:0x%x, simIndex:%d", result, simIndex);
SmsPluginSetting::instance()->setCbConfigEvent(handle, NULL, false);
@@ -893,16 +828,14 @@ void TapiEventGetCBConfig(TapiHandle *handle, int result, void *data, void *user
cbOpt.channelData.channelCnt = pCBConfig->MsgIdRangeCount;
- if (cbOpt.channelData.channelCnt > CB_CHANNEL_MAX)
- {
+ if (cbOpt.channelData.channelCnt > CB_CHANNEL_MAX) {
MSG_DEBUG("Channel Count [%d] from TAPI is over MAX", cbOpt.channelData.channelCnt);
cbOpt.channelData.channelCnt = CB_CHANNEL_MAX;
}
MSG_DEBUG("Channel Count [%d]", cbOpt.channelData.channelCnt);
- for (int i = 0; i < cbOpt.channelData.channelCnt; i++)
- {
+ for (int i = 0; i < cbOpt.channelData.channelCnt; i++) {
cbOpt.channelData.channelInfo[i].bActivate = pCBConfig->MsgIDs[i].Net3gpp.Selected;
cbOpt.channelData.channelInfo[i].from = pCBConfig->MsgIDs[i].Net3gpp.FromMsgId;
cbOpt.channelData.channelInfo[i].to = pCBConfig->MsgIDs[i].Net3gpp.ToMsgId;
@@ -999,9 +932,8 @@ void TapiEventGetMwiInfo(TapiHandle *handle, int result, void *data, void *user_
{
MSG_DEBUG("TapiEventGetMwiInfo is called.");
- if (result != TAPI_SIM_ACCESS_SUCCESS || data == NULL)
- {
- MSG_DEBUG("Error. data is NULL.");
+ if (result != TAPI_SIM_ACCESS_SUCCESS || data == NULL) {
+ MSG_ERR("Error. data is NULL. result:0x%x", result);
SmsPluginSetting::instance()->setMwiInfoEvent(handle, NULL, false);
return;
@@ -1022,7 +954,7 @@ void TapiEventGetMsisdnInfo(TapiHandle *handle, int result, void *data, void *us
bool bRet = false;
if (result != TAPI_SIM_ACCESS_SUCCESS || data == NULL) {
- MSG_DEBUG("Error. data is NULL.");
+ MSG_ERR("Error. data is NULL. result:0x%x", result);
SmsPluginSetting::instance()->setResultFromSim(bRet);
return;
}
@@ -1038,7 +970,7 @@ void TapiEventGetMsisdnInfo(TapiHandle *handle, int result, void *data, void *us
snprintf(keyName, sizeof(keyName), "%s/%d", MSG_SIM_MSISDN, simIndex);
if (MsgSettingSetString(keyName, list->list[i].num) == MSG_SUCCESS) {
- MSG_SEC_DEBUG("Get MSISDN from SIM : [%s]", list->list[i].num);
+ MSG_SEC_INFO("Get MSISDN from SIM : [%s]", list->list[i].num);
bRet = true;
} else {
MSG_DEBUG("Getting MSISDN is failed!");
@@ -1059,8 +991,7 @@ void TapiEventGetSimServiceTable(TapiHandle *handle, int result, void *data, voi
bool bRet = true;
- if (access_rt != TAPI_SIM_ACCESS_SUCCESS || svct == NULL)
- {
+ if (access_rt != TAPI_SIM_ACCESS_SUCCESS || svct == NULL) {
MSG_ERR("Error. data is NULL and access_rt [%d] failed", access_rt);
SmsPluginSetting::instance()->setResultFromSim(false);
return;
@@ -1095,14 +1026,14 @@ void TapiEventGetSimServiceTable(TapiHandle *handle, int result, void *data, voi
MSG_DEBUG("Setting result = [%d]", err);
} else if (svct->sim_type == TAPI_SIM_CARD_TYPE_USIM) {
- if (svct->table.sst.service[TAPI_SIM_UST_SMS] == 1) {
+ if (svct->table.ust.service[TAPI_SIM_UST_SMS] == 1) {
err = MsgSettingSetBool(sstKey, true);
} else {
err = MsgSettingSetBool(sstKey, false);
}
MSG_DEBUG("Setting result = [%d]", err);
- if (svct->table.sst.service[TAPI_SIM_UST_MO_SMS_CTRL] == 1){
+ if (svct->table.ust.service[TAPI_SIM_UST_MO_SMS_CTRL] == 1){
err = MsgSettingSetBool(moCtrlKey, true);
} else {
err = MsgSettingSetBool(moCtrlKey, false);
@@ -1120,22 +1051,17 @@ void TapiEventSatSmsRefresh(TapiHandle *handle, int result, void *data, void *us
{
MSG_DEBUG("TapiEventSatSmsRefresh is called.");
- if (result != TAPI_API_SUCCESS || data == NULL)
- {
- MSG_DEBUG("Error. data is NULL.");
+ if (result != TAPI_API_SUCCESS || data == NULL) {
+ MSG_ERR("Error. data is NULL. result:0x%x", result);
return;
}
- try
- {
+ try {
SmsPluginSatHandler::instance()->refreshSms(handle, data);
- }
- catch (MsgException& e)
- {
+ } catch (MsgException& e) {
MSG_FATAL("%s", e.what());
return;
}
-
}
@@ -1143,22 +1069,17 @@ void TapiEventSatSendSms(TapiHandle *handle, const char *noti_id, void *data, vo
{
MSG_DEBUG("TapiEventSatSendSms is called.");
- if (data == NULL)
- {
- MSG_DEBUG("Error. data is NULL.");
+ if (data == NULL) {
+ MSG_ERR("Error. data is NULL.");
return;
}
- try
- {
+ try {
SmsPluginSatHandler::instance()->sendSms(handle, data);
- }
- catch (MsgException& e)
- {
+ } catch (MsgException& e) {
MSG_FATAL("%s", e.what());
return;
}
-
}
@@ -1166,40 +1087,32 @@ void TapiEventSatMoSmsCtrl(TapiHandle *handle, const char *noti_id, void *data,
{
MSG_DEBUG("TapiEventSatMoSmsCtrl is called.");
- if (data == NULL)
- {
- MSG_DEBUG("Error. data is NULL.");
+ if (data == NULL) {
+ MSG_ERR("Error. data is NULL.");
return;
}
- try
- {
+ try {
SmsPluginSatHandler::instance()->ctrlSms(handle, data);
- }
- catch (MsgException& e)
- {
+ } catch (MsgException& e) {
MSG_FATAL("%s", e.what());
return;
}
-
}
void TapiEventMemoryStatus(TapiHandle *handle, int result, void *data, void *user_data)
{
MSG_DEBUG("Tapi result is [%d]", result);
- if(result == TAPI_API_SUCCESS)
- {
+ if (result == TAPI_API_SUCCESS)
isMemAvailable = true;
- }
}
void TapiEventSetMsgStatus(TapiHandle *handle, int result, void *data, void *user_data)
{
MSG_DEBUG("TapiEventSetMsgStatus is called. result [%d]", result);
- if (result != TAPI_API_SUCCESS || data == NULL)
- {
- MSG_DEBUG("Error. data is NULL.");
+ if (result != TAPI_API_SUCCESS || data == NULL) {
+ MSG_ERR("Error. data is NULL. result:0x%x", result);
SmsPluginSimMsg::instance()->setSimEvent((msg_sim_id_t)0, false);
return;
}
@@ -1214,9 +1127,8 @@ void TapiEventGetMeImei(TapiHandle *handle, int result, void *data, void *user_d
{
MSG_SEC_DEBUG("TapiEventGetMeImei is called. result [%d]", result);
- if (result != TAPI_API_SUCCESS || data == NULL)
- {
- MSG_DEBUG("Error. data is NULL.");
+ if (result != TAPI_API_SUCCESS || data == NULL) {
+ MSG_ERR("Error. data is NULL. result:0x%x", result);
SmsPluginSetting::instance()->setResultImei(false, NULL);
return;
}
@@ -1232,7 +1144,7 @@ void TapiEventSimStatusChange(TapiHandle *handle, const char *noti_id, void *dat
MSG_DEBUG("TapiEventSimStatusChange is called.");
if (data == NULL) {
- MSG_DEBUG("Error. data is NULL.");
+ MSG_ERR("Error. data is NULL.");
return;
}
@@ -1251,7 +1163,7 @@ void TapiEventNetworkStatusChange(TapiHandle *handle, const char *noti_id, void
MSG_DEBUG("TapiEventNetworkStatusChange is called.");
if (data == NULL) {
- MSG_DEBUG("Error. data is NULL.");
+ MSG_ERR("Error. data is NULL.");
return;
}
@@ -1260,7 +1172,8 @@ void TapiEventNetworkStatusChange(TapiHandle *handle, const char *noti_id, void
MSG_INFO("network status type [%d]", *type);
if (*type > TAPI_NETWORK_SERVICE_TYPE_SEARCH) {
- SmsPluginEventHandler::instance()->handleResendMessage(); // Call Event Handler
+ /* Call Event Handler */
+ SmsPluginEventHandler::instance()->handleResendMessage();
}
}
@@ -1304,13 +1217,13 @@ SmsPluginCallback* SmsPluginCallback::instance()
void SmsPluginCallback::registerEvent()
{
- struct tapi_handle *pTapiHandle;
+ TapiHandle *pTapiHandle;
int count = SmsPluginDSHandler::instance()->getTelHandleCount();
for (int i = 1; i <= count; ++i) {
pTapiHandle = SmsPluginDSHandler::instance()->getTelHandle(i);
- int simIndex = SmsPluginDSHandler::instance()->getSimIndex(pTapiHandle);
+// int simIndex = SmsPluginDSHandler::instance()->getSimIndex(pTapiHandle);
if (tel_register_noti_event(pTapiHandle, TAPI_NOTI_SMS_DEVICE_READY, TapiEventDeviceReady, NULL) != TAPI_API_SUCCESS)
MSG_DEBUG("tel_register_noti_event is failed : [%s]", TAPI_NOTI_SMS_DEVICE_READY);
diff --git a/plugin/sms_plugin/SmsPluginCbMsgHandler.cpp b/plugin/sms_plugin/SmsPluginCbMsgHandler.cpp
index ce9e959..4ab8907 100755
--- a/plugin/sms_plugin/SmsPluginCbMsgHandler.cpp
+++ b/plugin/sms_plugin/SmsPluginCbMsgHandler.cpp
@@ -29,7 +29,7 @@
#include "SmsPluginDSHandler.h"
/*==================================================================================================
- IMPLEMENTATION OF SmsPluginCbMsgHandler - Member Functions
+ IMPLEMENTATION OF SmsPluginCbMsgHandler - Member Functions
==================================================================================================*/
SmsPluginCbMsgHandler* SmsPluginCbMsgHandler::pInstance = NULL;
@@ -69,56 +69,49 @@ void SmsPluginCbMsgHandler::handleCbMsg(TapiHandle *handle, TelSmsCbMsg_t *pCbMs
SMS_CB_NETWORK_TYPE_T type = pCbMsg->EtwsMsgType;
SMS_CBMSG_PAGE_S CbMsgPage = {0};
- switch (type)
- {
- case SMS_CB_NETWORK_TYPE_2G_GSM :
- Decode2gCbMsg((TelSmsCbMsg_t *)pCbMsg, &CbMsgPage);
+ switch (type) {
+ case SMS_CB_NETWORK_TYPE_2G_GSM :
+ Decode2gCbMsg((TelSmsCbMsg_t *)pCbMsg, &CbMsgPage);
break;
- case SMS_CB_NETWORK_TYPE_3G_UMTS :
- Decode3gCbMsg((TelSmsCbMsg_t *)pCbMsg, &CbMsgPage);
+ case SMS_CB_NETWORK_TYPE_3G_UMTS :
+ Decode3gCbMsg((TelSmsCbMsg_t *)pCbMsg, &CbMsgPage);
break;
-
}
#else
SMS_CB_NETWORK_TYPE_T type = pCbMsg->CbMsgType;
SMS_CBMSG_PAGE_S CbMsgPage = {0};
- switch (type)
- {
- case SMS_CB_NETWORK_TYPE_2G_GSM :
- Decode2gCbMsg(pCbMsg, &CbMsgPage);
+ switch (type) {
+ case SMS_CB_NETWORK_TYPE_2G_GSM :
+ Decode2gCbMsg(pCbMsg, &CbMsgPage);
break;
- case SMS_CB_NETWORK_TYPE_3G_UMTS :
- Decode3gCbMsg(pCbMsg, &CbMsgPage);
+ case SMS_CB_NETWORK_TYPE_3G_UMTS :
+ Decode3gCbMsg(pCbMsg, &CbMsgPage);
break;
-
}
#endif
- // Check CB Msg Options
+ /* Check CB Msg Options */
bool bJavaMsg = false;
int simIndex = SmsPluginDSHandler::instance()->getSimIndex(handle);
- if (!checkCbOpt(&CbMsgPage, &bJavaMsg, simIndex))
- {
+ if (!checkCbOpt(&CbMsgPage, &bJavaMsg, simIndex)) {
MSG_DEBUG("The CB Msg is not supported by option.");
return;
}
- if (bJavaMsg == true)
- {
+ if (bJavaMsg == true) {
MSG_DEBUG("JAVA CB Msg.");
CbMsgPage.cbMsgType = SMS_CBMSG_TYPE_JAVACBS;
}
- // Check CB Pages
+ /* Check CB Pages */
unsigned char pageCnt = checkCbPage(&CbMsgPage);
- if (pageCnt == CbMsgPage.pageHeader.totalPages)
- {
+ if (pageCnt == CbMsgPage.pageHeader.totalPages) {
MSG_DEBUG("RECEIVED LAST MSG : %d", pageCnt);
SMS_CBMSG_S *cbMsg = NULL;
@@ -134,22 +127,22 @@ void SmsPluginCbMsgHandler::handleCbMsg(TapiHandle *handle, TelSmsCbMsg_t *pCbMs
msgInfo.addressList = NULL;
unique_ptr<MSG_ADDRESS_INFO_S*, void(*)(MSG_ADDRESS_INFO_S**)> addressListBuf(&msgInfo.addressList, unique_ptr_deleter);
- // Make CB Msg Structure
+ /* Make CB Msg Structure */
MakeCbMsg(&CbMsgPage, cbMsg);
- // Convert to MSG_MESSAGE_INFO_S
+ /* Convert to MSG_MESSAGE_INFO_S */
convertCbMsgToMsginfo(cbMsg, &msgInfo, simIndex);
- // Add CB Msg into DB
+ /* Add CB Msg into DB */
msg_error_t err = MSG_SUCCESS;
err = SmsPluginStorage::instance()->checkMessage(&msgInfo);
- if (err == MSG_SUCCESS)
- {
+ if (err == MSG_SUCCESS) {
MSG_CB_MSG_S cbOutMsg = {0, };
- cbOutMsg.type = MSG_CB_SMS;
+// cbOutMsg.type = MSG_CB_SMS;
+ cbOutMsg.type = msgInfo.msgType.subType;
cbOutMsg.receivedTime = cbMsg->recvTime;
cbOutMsg.serialNum = encodeCbSerialNum (CbMsgPage.pageHeader.serialNum);
cbOutMsg.messageId = cbMsg->msgId;
@@ -161,13 +154,9 @@ void SmsPluginCbMsgHandler::handleCbMsg(TapiHandle *handle, TelSmsCbMsg_t *pCbMs
memcpy(cbOutMsg.language_type, CbMsgPage.pageHeader.dcs.iso639Lang, 3);
err = SmsPluginEventHandler::instance()->callbackCBMsgIncoming(&cbOutMsg, &msgInfo);
if (err != MSG_SUCCESS)
- {
- MSG_DEBUG("callbackMsgIncoming() Error !! [%d]", err);
- }
- }
- else
- {
- MSG_DEBUG("checkMessage() Error !! [%d]", err);
+ MSG_WARN("callbackMsgIncoming() Error !! [%d]", err);
+ } else {
+ MSG_WARN("checkMessage() Error !! [%d]", err);
}
#if 0
@@ -179,7 +168,7 @@ void SmsPluginCbMsgHandler::handleCbMsg(TapiHandle *handle, TelSmsCbMsg_t *pCbMs
MSG_DEBUG("insertReceivedCBMessage() Error !! [%d]", err);
}
#endif
- // Remove From List
+ /* Remove From List */
removeFromPageList(&CbMsgPage);
}
MSG_END();
@@ -195,8 +184,7 @@ void SmsPluginCbMsgHandler::handleEtwsMsg(TapiHandle *handle, TelSmsEtwsMsg_t *p
SMS_ETWS_PRIMARY_S etwsPn = {0, };
MSG_CB_MSG_S cbOutMsg = {0, };
- if(type != TAPI_NETTEXT_ETWS_PRIMARY)
- {
+ if (type != TAPI_NETTEXT_ETWS_PRIMARY) {
MSG_DEBUG("The Etws secondary Message");
handleCbMsg(handle, (TelSmsCbMsg_t *)pEtwsMsg);
return;
@@ -213,9 +201,7 @@ void SmsPluginCbMsgHandler::handleEtwsMsg(TapiHandle *handle, TelSmsEtwsMsg_t *p
err = SmsPluginEventHandler::instance()->callbackCBMsgIncoming(&cbOutMsg, NULL);
if (err != MSG_SUCCESS)
- {
MSG_DEBUG("callbackMsgIncoming() Error !! [%d]", err);
- }
MSG_END();
}
@@ -229,7 +215,7 @@ void SmsPluginCbMsgHandler::Decode2gCbMsg(TelSmsCbMsg_t *pCbMsg, SMS_CBMSG_PAGE_
memcpy(cbData, pCbMsg->szMsgData, pCbMsg->Length);
cbData[pCbMsg->Length] = '\0';
- // print cb data
+ /* print cb data */
MSG_INFO("Received CB length:%d", pCbMsg->Length);
char cbDataTmp[(pCbMsg->Length*2)+1];
memset(cbDataTmp, 0x00, sizeof(cbDataTmp));
@@ -241,7 +227,7 @@ void SmsPluginCbMsgHandler::Decode2gCbMsg(TelSmsCbMsg_t *pCbMsg, SMS_CBMSG_PAGE_
pCbPage->cbMsgType = SMS_CBMSG_TYPE_CBS;
- // Serial Number
+ /* Serial Number */
pCbPage->pageHeader.serialNum.geoScope = (cbData[0] & 0xC0) >> 6;
pCbPage->pageHeader.serialNum.msgCode = (cbData[0] & 0x3F) << 4;
@@ -255,10 +241,10 @@ void SmsPluginCbMsgHandler::Decode2gCbMsg(TelSmsCbMsg_t *pCbMsg, SMS_CBMSG_PAGE_
MSG_DEBUG("MSG ID : [%d]", pCbPage->pageHeader.msgId);
- // DCS
+ /* DCS */
decodeCbMsgDCS(cbData[4], (unsigned char*)cbData + 6, &(pCbPage->pageHeader.dcs));
- // Page Parameter
+ /* Page Parameter */
pCbPage->pageHeader.totalPages = cbData[5] & 0x0F;
pCbPage->pageHeader.page = (cbData[5] & 0xF0) >> 4;
@@ -267,64 +253,61 @@ void SmsPluginCbMsgHandler::Decode2gCbMsg(TelSmsCbMsg_t *pCbMsg, SMS_CBMSG_PAGE_
MSG_DEBUG("Total Page : [%d], Page : [%d]", pCbPage->pageHeader.totalPages, pCbPage->pageHeader.page);
- // Convert Language Type
+ /* Convert Language Type */
convertLangType(pCbPage->pageHeader.dcs.langType, &(pCbPage->pageHeader.langType));
MSG_DEBUG("In Language Type : [%d], Out Language Type : [%d]", pCbPage->pageHeader.dcs.langType, pCbPage->pageHeader.langType);
MSG_DEBUG("iso639Lang : [%s]", pCbPage->pageHeader.dcs.iso639Lang);
- // Get Receive Time
+ /* Get Receive Time */
pCbPage->pageHeader.recvTime = getRecvTime();
- // Decode CB Data
+ /* Decode CB Data */
int dataLen = pCbMsg->Length - 6;
MSG_DEBUG("codingScheme:[%d]", pCbPage->pageHeader.dcs.codingScheme);
- switch (pCbPage->pageHeader.dcs.codingScheme)
+ switch (pCbPage->pageHeader.dcs.codingScheme) {
+ case SMS_CHARSET_7BIT :
{
- case SMS_CHARSET_7BIT :
- {
- MSG_DEBUG("GSM 7 BIT");
+ MSG_DEBUG("GSM 7 BIT");
- dataLen = (dataLen*8) / 7;
-
- SmsPluginUDCodec udCodec;
- char pageData[MAX_CBMSG_PAGE_SIZE+1];
- int unpackLen = udCodec.unpack7bitChar(&cbData[6], dataLen, 0, pageData);
-
- if(pCbPage->pageHeader.dcs.iso639Lang[0])
- {
- unpackLen = unpackLen - 3;
- if (unpackLen > 0)
- memcpy(pCbPage->pageData, &pageData[3], unpackLen);
- else
- unpackLen = 0;
- } else {
- memcpy(pCbPage->pageData, &pageData, unpackLen);
- }
+ dataLen = (dataLen*8) / 7;
- MSG_DEBUG("unpackLen : [%d]", unpackLen);
+ SmsPluginUDCodec udCodec;
+ char pageData[MAX_CBMSG_PAGE_SIZE+1];
+ int unpackLen = udCodec.unpack7bitChar(&cbData[6], dataLen, 0, pageData);
- pCbPage->pageLength = unpackLen;
- pCbPage->pageData[unpackLen] = '\0';
+ if (pCbPage->pageHeader.dcs.iso639Lang[0]) {
+ unpackLen = unpackLen - 3;
+ if (unpackLen > 0)
+ memcpy(pCbPage->pageData, &pageData[3], unpackLen);
+ else
+ unpackLen = 0;
+ } else {
+ memcpy(pCbPage->pageData, &pageData, unpackLen);
}
- break;
- case SMS_CHARSET_8BIT :
- case SMS_CHARSET_UCS2 :
- {
- MSG_DEBUG("UCS2 or 8BIT");
+ MSG_DEBUG("unpackLen : [%d]", unpackLen);
- if(pCbPage->pageHeader.dcs.iso639Lang[0])
- {
- memcpy(pCbPage->pageData, &cbData[8], dataLen - 2);
- pCbPage->pageLength = dataLen - 2;
- } else {
- memcpy(pCbPage->pageData, &cbData[6], dataLen);
- pCbPage->pageLength = dataLen;
- }
+ pCbPage->pageLength = unpackLen;
+ pCbPage->pageData[unpackLen] = '\0';
+ }
+ break;
+
+ case SMS_CHARSET_8BIT :
+ case SMS_CHARSET_UCS2 :
+ {
+ MSG_DEBUG("UCS2 or 8BIT");
+
+ if (pCbPage->pageHeader.dcs.iso639Lang[0]) {
+ memcpy(pCbPage->pageData, &cbData[8], dataLen - 2);
+ pCbPage->pageLength = dataLen - 2;
+ } else {
+ memcpy(pCbPage->pageData, &cbData[6], dataLen);
+ pCbPage->pageLength = dataLen;
}
- break;
+ }
+ break;
}
MSG_DEBUG("Page Length : [%d], Page Data : [%s]", pCbPage->pageLength, pCbPage->pageData);
@@ -345,7 +328,7 @@ void SmsPluginCbMsgHandler::DecodeEtwsMsg(TelSmsEtwsMsg_t *pEtwsMsg, SMS_ETWS_PR
memcpy(EtwsData, pEtwsMsg->szMsgData, pEtwsMsg->Length);
EtwsData[pEtwsMsg->Length] = '\0';
- // print received msg data
+ /* print received msg data */
MSG_INFO("Received Etws length:%d", pEtwsMsg->Length);
char EtwsDataTmp[(pEtwsMsg->Length*2)+1];
memset(EtwsDataTmp, 0x00, sizeof(EtwsDataTmp));
@@ -355,10 +338,10 @@ void SmsPluginCbMsgHandler::DecodeEtwsMsg(TelSmsEtwsMsg_t *pEtwsMsg, SMS_ETWS_PR
}
MSG_INFO("[%s]", EtwsDataTmp);
- // received time
+ /* received time */
pEtwsPn->recvTime = getRecvTime();
- // Serial Number
+ /* Serial Number */
pEtwsPn->serialNum.geoScope = (EtwsData[0] & 0xC0) >> 6;
pEtwsPn->serialNum.msgCode = (EtwsData[0] & 0x3F) << 4;
pEtwsPn->serialNum.msgCode |= (EtwsData[1] & 0xF0) >> 4;
@@ -366,18 +349,17 @@ void SmsPluginCbMsgHandler::DecodeEtwsMsg(TelSmsEtwsMsg_t *pEtwsMsg, SMS_ETWS_PR
MSG_DEBUG("geoScope : [%d], msgCode : [%d], updateNum : [%d]", pEtwsPn->serialNum.geoScope, pEtwsPn->serialNum.msgCode, pEtwsPn->serialNum.updateNum);
- // Message Identifier
+ /* Message Identifier */
pEtwsPn->msgId = (EtwsData[2] << 8) | EtwsData[3];
MSG_DEBUG("MSG ID : [%d]", pEtwsPn->msgId);
- // warning type
+ /* warning type */
pEtwsPn->warningType = (EtwsData[4] << 8) | EtwsData[5];
MSG_DEBUG("warningType : [0x%04x]", pEtwsPn->msgId);
- // warning security information
- memcpy(pEtwsPn->warningSecurityInfo, &EtwsData[6], sizeof(pEtwsPn->warningSecurityInfo)); // 50bytes
- for (unsigned int i = 0; i < sizeof(pEtwsPn->warningSecurityInfo); i++)
- {
+ /* warning security information */
+ memcpy(pEtwsPn->warningSecurityInfo, &EtwsData[6], sizeof(pEtwsPn->warningSecurityInfo)); /* 50bytes */
+ for (unsigned int i = 0; i < sizeof(pEtwsPn->warningSecurityInfo); i++) {
MSG_DEBUG("warning secu info [%02x]", pEtwsPn->warningSecurityInfo[i] );
}
}
@@ -390,7 +372,7 @@ void SmsPluginCbMsgHandler::Decode3gCbMsg(TelSmsCbMsg_t *pCbMsg, SMS_CBMSG_PAGE_
memcpy(cbData, pCbMsg->szMsgData, pCbMsg->Length);
cbData[pCbMsg->Length] = '\0';
- // print cb data
+ /* print cb data */
MSG_INFO("Received CB length:%d", pCbMsg->Length);
char cbDataTmp[(pCbMsg->Length*2)+1];
memset(cbDataTmp, 0x00, sizeof(cbDataTmp));
@@ -406,7 +388,7 @@ void SmsPluginCbMsgHandler::Decode3gCbMsg(TelSmsCbMsg_t *pCbMsg, SMS_CBMSG_PAGE_
MSG_DEBUG("MSG ID : [%d]", pCbPage->pageHeader.msgId);
- // Serial Number
+ /* Serial Number */
pCbPage->pageHeader.serialNum.geoScope = (cbData[3] & 0xC0) >> 6;
pCbPage->pageHeader.serialNum.msgCode = (cbData[3] & 0x3F) << 4;
@@ -416,90 +398,84 @@ void SmsPluginCbMsgHandler::Decode3gCbMsg(TelSmsCbMsg_t *pCbMsg, SMS_CBMSG_PAGE_
MSG_DEBUG("geoScope : [%d], msgCode : [%d], updateNum : [%d]", pCbPage->pageHeader.serialNum.geoScope, pCbPage->pageHeader.serialNum.msgCode, pCbPage->pageHeader.serialNum.updateNum);
- // DCS
+ /* DCS */
decodeCbMsgDCS(cbData[5], (unsigned char*)cbData + 6, &(pCbPage->pageHeader.dcs));
- // Convert Language Type
+ /* Convert Language Type */
convertLangType(pCbPage->pageHeader.dcs.langType, &(pCbPage->pageHeader.langType));
MSG_DEBUG("In Language Type : [%d], Out Language Type : [%d]", pCbPage->pageHeader.dcs.langType, pCbPage->pageHeader.langType);
- // Get Receive Time
+ /* Get Receive Time */
pCbPage->pageHeader.recvTime = getRecvTime();
pCbPage->pageHeader.totalPages = cbData[6];
- // Decode CB Data
+ /* Decode CB Data */
int dataLen = 0;
int offset = 0;
- switch (pCbPage->pageHeader.dcs.codingScheme)
+ switch (pCbPage->pageHeader.dcs.codingScheme) {
+ case SMS_CHARSET_7BIT :
{
- case SMS_CHARSET_7BIT :
- {
- for(int i = 0; i < pCbPage->pageHeader.totalPages; ++i)
- {
- char cbMessage[MAX_CBMSG_PAGE_SIZE]= {0,};
- dataLen = cbData[7+(i+1)*82 + i];
- memcpy(cbMessage, &cbData[7+(i*82)+ i], dataLen);
+ for (int i = 0; i < pCbPage->pageHeader.totalPages; ++i) {
+ char cbMessage[MAX_CBMSG_PAGE_SIZE]= {0,};
+ dataLen = cbData[7+(i+1)*82 + i];
+ memcpy(cbMessage, &cbData[7+(i*82)+ i], dataLen);
- dataLen = (dataLen*8) / 7;
+ dataLen = (dataLen*8) / 7;
- if (dataLen > MAX_CBMSG_PAGE_SIZE)
- THROW(MsgException::SMS_PLG_ERROR, "CB Msg Size is over MAX [%d]", dataLen);
+ if (dataLen > MAX_CBMSG_PAGE_SIZE)
+ THROW(MsgException::SMS_PLG_ERROR, "CB Msg Size is over MAX [%d]", dataLen);
- SmsPluginUDCodec udCodec;
- int unpackLen = udCodec.unpack7bitChar((const unsigned char *)cbMessage, dataLen, 0, pCbPage->pageData + offset);
- offset += unpackLen;
- }
- pCbPage->pageLength = offset;
+ SmsPluginUDCodec udCodec;
+ int unpackLen = udCodec.unpack7bitChar((const unsigned char *)cbMessage, dataLen, 0, pCbPage->pageData + offset);
+ offset += unpackLen;
}
- break;
+ pCbPage->pageLength = offset;
+ }
+ break;
- case SMS_CHARSET_8BIT :
- case SMS_CHARSET_UCS2 :
- {
+ case SMS_CHARSET_8BIT :
+ case SMS_CHARSET_UCS2 :
+ {
#if 0
- char cbMessage[MAX_CBMSG_PAGE_SIZE]= {0,};
+ char cbMessage[MAX_CBMSG_PAGE_SIZE]= {0,};
- for(int i = 0; i < pCbPage->pageHeader.totalPages; ++i)
- {
- dataLen = cbData[7+(i+1)*82 + i];
- memcpy(cbMessage + offset, &cbData[7+(i*82)+ i], dataLen);
- offset += dataLen;
- }
- dataLen = offset;
+ for (int i = 0; i < pCbPage->pageHeader.totalPages; ++i) {
+ dataLen = cbData[7+(i+1)*82 + i];
+ memcpy(cbMessage + offset, &cbData[7+(i*82)+ i], dataLen);
+ offset += dataLen;
+ }
+ dataLen = offset;
- if(pCbPage->pageHeader.dcs.iso639Lang[0])
- {
- int tmpDataLen = (dataLen > 2)?(dataLen - 2):0;
- memcpy(pCbPage->pageData, cbMessage + 2, tmpDataLen);
- pCbPage->pageLength = tmpDataLen;
- } else {
- memcpy(pCbPage->pageData, cbMessage, dataLen);
- pCbPage->pageLength = dataLen;
- }
+ if (pCbPage->pageHeader.dcs.iso639Lang[0]) {
+ int tmpDataLen = (dataLen > 2)?(dataLen - 2):0;
+ memcpy(pCbPage->pageData, cbMessage + 2, tmpDataLen);
+ pCbPage->pageLength = tmpDataLen;
+ } else {
+ memcpy(pCbPage->pageData, cbMessage, dataLen);
+ pCbPage->pageLength = dataLen;
+ }
#else
- char cbMessage[MAX_CBMSG_PAGE_SIZE]= {0,};
+ char cbMessage[MAX_CBMSG_PAGE_SIZE]= {0,};
- for(int i = 0; i < pCbPage->pageHeader.totalPages; ++i)
- {
- if(pCbPage->pageHeader.dcs.iso639Lang[0])
- {
- dataLen = cbData[7+(i+1)*82 + i] - 2;
- memcpy(cbMessage + offset, &cbData[7+(i*82)+ i + 2], dataLen);
- offset += dataLen;
- } else {
- dataLen = cbData[7+(i+1)*82 + i];
- memcpy(cbMessage + offset, &cbData[7+(i*82)+ i], dataLen);
- offset += dataLen;
- }
+ for (int i = 0; i < pCbPage->pageHeader.totalPages; ++i) {
+ if (pCbPage->pageHeader.dcs.iso639Lang[0]) {
+ dataLen = cbData[7+(i+1)*82 + i] - 2;
+ memcpy(cbMessage + offset, &cbData[7+(i*82)+ i + 2], dataLen);
+ offset += dataLen;
+ } else {
+ dataLen = cbData[7+(i+1)*82 + i];
+ memcpy(cbMessage + offset, &cbData[7+(i*82)+ i], dataLen);
+ offset += dataLen;
}
- dataLen = offset;
- memcpy(pCbPage->pageData, cbMessage, dataLen);
- pCbPage->pageLength = dataLen;
-#endif
}
- break;
+ dataLen = offset;
+ memcpy(pCbPage->pageData, cbMessage, dataLen);
+ pCbPage->pageLength = dataLen;
+#endif
+ }
+ break;
}
pCbPage->pageHeader.totalPages = 1;
@@ -522,46 +498,48 @@ int SmsPluginCbMsgHandler::CMAS_class(unsigned short message_id)
switch (message_id)
{
- case 4370 :
- case 4383 :
- ret = MSG_CMAS_PRESIDENTIAL;
- break;
- case 4371 :
- case 4372 :
- case 4384 :
- case 4385 :
- ret = MSG_CMAS_EXTREME;
- break;
- case 4373 :
- case 4374 :
- case 4375 :
- case 4376 :
- case 4377 :
- case 4378 :
- case 4386 :
- case 4387 :
- case 4388 :
- case 4389 :
- case 4390 :
- case 4391 :
- ret = MSG_CMAS_SEVERE;
- break;
- case 4379 :
- case 4392 :
- ret = MSG_CMAS_AMBER;
- break;
- case 4380 :
- case 4381 :
- case 4393 :
- case 4394 :
- ret = MSG_CMAS_TEST;
- break;
- case 4382 :
- case 4395 :
- ret = MSG_CMAS_OPERATOR_DEFINED;
- break;
- default :
- break;
+ case 4370 :
+ case 4383 :
+ ret = MSG_CMAS_PRESIDENTIAL;
+ break;
+ case 4371 :
+ case 4372 :
+ case 4384 :
+ case 4385 :
+ ret = MSG_CMAS_EXTREME;
+ break;
+ case 4373 :
+ case 4374 :
+ case 4375 :
+ case 4376 :
+ case 4377 :
+ case 4378 :
+ case 4386 :
+ case 4387 :
+ case 4388 :
+ case 4389 :
+ case 4390 :
+ case 4391 :
+ ret = MSG_CMAS_SEVERE;
+ break;
+ case 4379 :
+ case 4392 :
+ ret = MSG_CMAS_AMBER;
+ break;
+ case 4380 :
+ case 4393 :
+ ret = MSG_CMAS_TEST;
+ break;
+ case 4381 :
+ case 4394 :
+ ret = MSG_CMAS_EXERCISE;
+ break;
+ case 4382 :
+ case 4395 :
+ ret = MSG_CMAS_OPERATOR_DEFINED;
+ break;
+ default :
+ break;
}
return ret;
@@ -575,24 +553,22 @@ bool SmsPluginCbMsgHandler::checkCbOpt(SMS_CBMSG_PAGE_S *CbPage, bool *pJavaMsg,
snprintf(keyName, sizeof(keyName), "%s/%d", CB_RECEIVE, simIndex);
MsgSettingGetBool(keyName, &bReceive);
- // Receive CB Msg = FALSE
- if (!bReceive)
- {
+ /* Receive CB Msg = FALSE */
+ if (!bReceive) {
MSG_DEBUG("RECEIVE CB = FALSE");
return false;
}
#if 0
char keyname[128];
- // check Language
+ /* check Language */
memset(keyName, 0x00, sizeof(keyName));
snprintf(keyName, sizeof(keyname), "%s/%d", CB_LANGUAGE, MSG_CBLANG_TYPE_ALL);
bool bAllLang = false;
MsgSettingGetBool(keyName, &bAllLang);
- if (!bAllLang)
- {
+ if (!bAllLang) {
MSG_DEBUG("ALL LANGUAGE = FALSE");
memset(keyName, 0x00, sizeof(keyName));
@@ -602,8 +578,7 @@ bool SmsPluginCbMsgHandler::checkCbOpt(SMS_CBMSG_PAGE_S *CbPage, bool *pJavaMsg,
MsgSettingGetBool(keyName, &bLang);
- if (!bLang || CbPage.pageHeader.langType == MSG_CBLANG_TYPE_MAX)
- {
+ if (!bLang || CbPage.pageHeader.langType == MSG_CBLANG_TYPE_MAX) {
MSG_DEBUG("LANGUAGE [%d] = FALSE", CbPage.pageHeader.langType);
return false;
}
@@ -620,14 +595,12 @@ bool SmsPluginCbMsgHandler::checkCbOpt(SMS_CBMSG_PAGE_S *CbPage, bool *pJavaMsg,
if (err != MSG_SUCCESS)
MSG_ERR("Error value of MsgStoGetCBChannelInfo [%d]", err);
- for (int i = 0; i < cbChannelInfo.channelCnt; i++)
- {
+ for (int i = 0; i < cbChannelInfo.channelCnt; i++) {
bActivate = cbChannelInfo.channelInfo[i].bActivate;
MsgId_from = cbChannelInfo.channelInfo[i].from;
MsgId_to = cbChannelInfo.channelInfo[i].to;
- if (bActivate == true && CbPage->pageHeader.msgId >= MsgId_from && CbPage->pageHeader.msgId <= MsgId_to)
- {
+ if (bActivate == true && CbPage->pageHeader.msgId >= MsgId_from && CbPage->pageHeader.msgId <= MsgId_to) {
MSG_DEBUG("FIND CHANNEL = [%d]", CbPage->pageHeader.msgId);
return true;
}
@@ -648,33 +621,25 @@ unsigned char SmsPluginCbMsgHandler::checkCbPage(SMS_CBMSG_PAGE_S *CbPage)
SmsPluginStorage *storageHandler = SmsPluginStorage::instance();
err = storageHandler->isReceivedCBMessage(CbPage);
// check existing message with cb internal table;
- if(err != MSG_ERR_DB_NORECORD)
+ if (err != MSG_ERR_DB_NORECORD)
{
MSG_DEBUG("already received message: [%d]", CbPage.pageHeader.msgId);
return 0;
}
#endif
- if (CbPage->pageHeader.totalPages > 0)
- {
- for (unsigned int i = 0; i < pageList.size(); i++)
- {
- if (pageList[i].geoScope == CbPage->pageHeader.serialNum.geoScope && pageList[i].msgCode == CbPage->pageHeader.serialNum.msgCode)
- {
+ if (CbPage->pageHeader.totalPages > 0) {
+ for (unsigned int i = 0; i < pageList.size(); i++) {
+ if (pageList[i].geoScope == CbPage->pageHeader.serialNum.geoScope && pageList[i].msgCode == CbPage->pageHeader.serialNum.msgCode) {
MSG_DEBUG("geoScope [%d], msgCode [%d]", pageList[i].geoScope, pageList[i].msgCode);
- if (pageList[i].msgId == CbPage->pageHeader.msgId)
- {
+ if (pageList[i].msgId == CbPage->pageHeader.msgId) {
int updateNum = CbPage->pageHeader.serialNum.updateNum - pageList[i].updateNum;
- if (updateNum > 0) // New Message Content
- {
+ if (updateNum > 0) { /* New Message Content */
break;
- }
- else if (updateNum == 0) // Same Message Content
- {
- if (pageList[i].data.count(CbPage->pageHeader.page) != 0)
- {
+ } else if (updateNum == 0) { /* Same Message Content */
+ if (pageList[i].data.count(CbPage->pageHeader.page) != 0) {
MSG_DEBUG("The Page Number already exists [%d]", CbPage->pageHeader.page);
return 0;
}
@@ -693,9 +658,7 @@ unsigned char SmsPluginCbMsgHandler::checkCbPage(SMS_CBMSG_PAGE_S *CbPage)
bFind = true;
break;
- }
- else // Old Message Content
- {
+ } else { /* Old Message Content */
return 0;
}
}
@@ -703,8 +666,7 @@ unsigned char SmsPluginCbMsgHandler::checkCbPage(SMS_CBMSG_PAGE_S *CbPage)
}
}
- if (bFind == false || CbPage->pageHeader.totalPages == 1)
- {
+ if (bFind == false || CbPage->pageHeader.totalPages == 1) {
addToPageList(CbPage);
return 1;
}
@@ -724,17 +686,12 @@ void SmsPluginCbMsgHandler::MakeCbMsg(SMS_CBMSG_PAGE_S *CbPage, SMS_CBMSG_S *pCb
cbPageMap::iterator it;
int offset = 0;
- for (unsigned int i = 0; i < pageList.size(); i++)
- {
- if (pageList[i].geoScope == CbPage->pageHeader.serialNum.geoScope && pageList[i].msgCode == CbPage->pageHeader.serialNum.msgCode)
- {
+ for (unsigned int i = 0; i < pageList.size(); i++) {
+ if (pageList[i].geoScope == CbPage->pageHeader.serialNum.geoScope && pageList[i].msgCode == CbPage->pageHeader.serialNum.msgCode) {
MSG_DEBUG("geoScope [%d], msgCode [%d]", pageList[i].geoScope, pageList[i].msgCode);
- if (pageList[i].msgId == CbPage->pageHeader.msgId)
- {
-
- for (it = pageList[i].data.begin(); it != pageList[i].data.end(); it++)
- {
+ if (pageList[i].msgId == CbPage->pageHeader.msgId) {
+ for (it = pageList[i].data.begin(); it != pageList[i].data.end(); it++) {
memcpy(pCbMsg->msgData + offset, it->second.pageData, it->second.pageLength);
pCbMsg->msgLength += it->second.pageLength;
offset = pCbMsg->msgLength;
@@ -760,7 +717,7 @@ void SmsPluginCbMsgHandler::convertCbMsgToMsginfo(SMS_CBMSG_S *pCbMsg, MSG_MESSA
pMsgInfo->folderId = MSG_CBMSGBOX_ID;
- // Convert Type values
+ /* Convert Type values */
pMsgInfo->msgType.mainType = MSG_SMS_TYPE;
if (pCbMsg->cbMsgType == SMS_CBMSG_TYPE_CBS) {
@@ -770,28 +727,26 @@ void SmsPluginCbMsgHandler::convertCbMsgToMsginfo(SMS_CBMSG_S *pCbMsg, MSG_MESSA
pMsgInfo->msgType.subType = MSG_CB_SMS;
else
pMsgInfo->msgType.subType = (MSG_SUB_TYPE_T)cmas_class;
- }
- else if (pCbMsg->cbMsgType == SMS_CBMSG_TYPE_JAVACBS) {
+ } else if (pCbMsg->cbMsgType == SMS_CBMSG_TYPE_JAVACBS) {
pMsgInfo->msgType.subType = MSG_JAVACB_SMS;
}
- switch(pCbMsg->classType)
- {
- case SMS_MSG_CLASS_0:
- pMsgInfo->msgType.classType = MSG_CLASS_0;
- break;
- case SMS_MSG_CLASS_1:
- pMsgInfo->msgType.classType = MSG_CLASS_1;
- break;
- case SMS_MSG_CLASS_2:
- pMsgInfo->msgType.classType = MSG_CLASS_2;
- break;
- case SMS_MSG_CLASS_3:
- pMsgInfo->msgType.classType = MSG_CLASS_3;
- break;
- default:
- pMsgInfo->msgType.classType = MSG_CLASS_NONE;
- break;
+ switch (pCbMsg->classType) {
+ case SMS_MSG_CLASS_0:
+ pMsgInfo->msgType.classType = MSG_CLASS_0;
+ break;
+ case SMS_MSG_CLASS_1:
+ pMsgInfo->msgType.classType = MSG_CLASS_1;
+ break;
+ case SMS_MSG_CLASS_2:
+ pMsgInfo->msgType.classType = MSG_CLASS_2;
+ break;
+ case SMS_MSG_CLASS_3:
+ pMsgInfo->msgType.classType = MSG_CLASS_3;
+ break;
+ default:
+ pMsgInfo->msgType.classType = MSG_CLASS_NONE;
+ break;
}
pMsgInfo->storageId = MSG_STORAGE_PHONE;
@@ -801,7 +756,7 @@ void SmsPluginCbMsgHandler::convertCbMsgToMsginfo(SMS_CBMSG_S *pCbMsg, MSG_MESSA
pMsgInfo->priority = MSG_MESSAGE_PRIORITY_NORMAL;
pMsgInfo->direction = MSG_DIRECTION_TYPE_MT;
- // Temporary
+ /* Temporary */
pMsgInfo->nAddressCnt = 1;
pMsgInfo->addressList = (MSG_ADDRESS_INFO_S *)new char[sizeof(MSG_ADDRESS_INFO_S)];
@@ -811,7 +766,7 @@ void SmsPluginCbMsgHandler::convertCbMsgToMsginfo(SMS_CBMSG_S *pCbMsg, MSG_MESSA
pMsgInfo->addressList[0].recipientType = MSG_RECIPIENTS_TYPE_UNKNOWN;
pMsgInfo->sim_idx = simIndex;
- // TODO :: MSG ID should be used to get CB message type
+ /* TODO :: MSG ID should be used to get CB message type */
getDisplayName(pCbMsg->msgId, pMsgInfo->addressList[0].addressVal, simIndex);
MSG_SEC_DEBUG("%s", pMsgInfo->addressList[0].addressVal);
@@ -842,14 +797,13 @@ void SmsPluginCbMsgHandler::convertCbMsgToMsginfo(SMS_CBMSG_S *pCbMsg, MSG_MESSA
MSG_DEBUG("LENGTH %d CB MSG %s", pCbMsg->msgLength, pCbMsg->msgData);
- // Convert Data values
+ /* Convert Data values */
pMsgInfo->dataSize = convertTextToUtf8((unsigned char*)tmpBuf, bufSize, pCbMsg);
- if (pMsgInfo->dataSize > MAX_MSG_TEXT_LEN)
- {
+ if (pMsgInfo->dataSize > MAX_MSG_TEXT_LEN) {
pMsgInfo->bTextSms = false;
- // Save Message Data into File
+ /* Save Message Data into File */
char fileName[MSG_FILENAME_LEN_MAX+1];
memset(fileName, 0x00, sizeof(fileName));
@@ -861,9 +815,7 @@ void SmsPluginCbMsgHandler::convertCbMsgToMsginfo(SMS_CBMSG_S *pCbMsg, MSG_MESSA
THROW(MsgException::FILE_ERROR, "MsgWriteIpcFile error");
strncpy(pMsgInfo->msgData, fileName, MAX_MSG_DATA_LEN);
- }
- else
- {
+ } else {
pMsgInfo->bTextSms = true;
memset(pMsgInfo->msgText, 0x00, sizeof(pMsgInfo->msgText));
@@ -880,7 +832,7 @@ void SmsPluginCbMsgHandler::convertEtwsMsgToMsginfo(SMS_CBMSG_PAGE_S *EtwsMsg, M
pMsgInfo->folderId = MSG_CBMSGBOX_ID;
- // Convert Type values
+ /* Convert Type values */
pMsgInfo->msgType.mainType = MSG_SMS_TYPE;
if (EtwsMsg->cbMsgType == SMS_CBMSG_TYPE_ETWS)
@@ -893,7 +845,7 @@ void SmsPluginCbMsgHandler::convertEtwsMsgToMsginfo(SMS_CBMSG_PAGE_S *EtwsMsg, M
pMsgInfo->priority = MSG_MESSAGE_PRIORITY_NORMAL;
pMsgInfo->direction = MSG_DIRECTION_TYPE_MT;
- // Temporary
+ /* Temporary */
pMsgInfo->nAddressCnt = 1;
pMsgInfo->addressList[0].addressType = MSG_ADDRESS_TYPE_UNKNOWN;
@@ -922,8 +874,7 @@ int SmsPluginCbMsgHandler::convertTextToUtf8 (unsigned char* outBuf, int outBufS
MsgTextConvert *textCvt = MsgTextConvert::instance();
- if (!outBuf || !pCbMsg)
- {
+ if (!outBuf || !pCbMsg) {
MSG_DEBUG ("invalid param.\n");
return 0;
}
@@ -932,7 +883,7 @@ int SmsPluginCbMsgHandler::convertTextToUtf8 (unsigned char* outBuf, int outBufS
langInfo.bLockingShift = false;
- // Convert Data values
+ /* Convert Data values */
if (pCbMsg->codingScheme == SMS_CHARSET_7BIT)
convertedTextSize = textCvt->convertGSM7bitToUTF8(outBuf, outBufSize, (unsigned char*)pCbMsg->msgData, pCbMsg->msgLength, &langInfo);
else if (pCbMsg->codingScheme == SMS_CHARSET_UCS2)
@@ -968,13 +919,12 @@ void SmsPluginCbMsgHandler::removeFromPageList(SMS_CBMSG_PAGE_S *CbPage)
{
unsigned int index;
- for (index = 0; index < pageList.size(); index++)
- {
- if (pageList[index].geoScope == CbPage->pageHeader.serialNum.geoScope && pageList[index].msgCode == CbPage->pageHeader.serialNum.msgCode)
- {
+ for (index = 0; index < pageList.size(); index++) {
+ if (pageList[index].geoScope == CbPage->pageHeader.serialNum.geoScope && pageList[index].msgCode == CbPage->pageHeader.serialNum.msgCode) {
MSG_DEBUG("geoScope [%d], msgCode [%d]", pageList[index].geoScope, pageList[index].msgCode);
- if (pageList[index].msgId == CbPage->pageHeader.msgId) break;
+ if (pageList[index].msgId == CbPage->pageHeader.msgId)
+ break;
}
}
@@ -997,97 +947,92 @@ void SmsPluginCbMsgHandler::decodeCbMsgDCS(unsigned char dcsData, const unsigned
unsigned char codingGrp = (dcsData & 0xF0) >> 4;
- switch (codingGrp)
+ switch (codingGrp) {
+ case 0x00 :
+ case 0x02 :
+ case 0x03 :
{
- case 0x00 :
- case 0x02 :
- case 0x03 :
- {
- pDcs->codingGroup = SMS_CBMSG_CODGRP_GENERAL_DCS;
- pDcs->langType = (SMS_CBMSG_LANG_TYPE_T)dcsData;
- }
- break;
+ pDcs->codingGroup = SMS_CBMSG_CODGRP_GENERAL_DCS;
+ pDcs->langType = (SMS_CBMSG_LANG_TYPE_T)dcsData;
+ }
+ break;
- case 0x01 :
- {
- if (dcsData == 0x10 || dcsData == 0x11)
- {
- pDcs->codingGroup = SMS_CBMSG_CODGRP_GENERAL_DCS;
- pDcs->codingScheme = (dcsData & 0x01) ? SMS_CHARSET_UCS2 : SMS_CHARSET_7BIT;
- pDcs->langType = SMS_CBMSG_LANG_ISO639;
- MSG_DEBUG("codingScheme: [%d]", pDcs->codingScheme);
- if (pMsgData[0] && pMsgData[1])
- {
- pDcs->iso639Lang[0] = pMsgData[0] & 0x7F;
- pDcs->iso639Lang[1] = (pMsgData[0] & 0X80) >> 7;
- pDcs->iso639Lang[1] |= (pMsgData[1] & 0X3F) << 1;
- pDcs->iso639Lang[2] = 0x13; /* CR */
- }
- else
- {
- /* Default it to English if pMsgData is NULL */
- pDcs->iso639Lang[0] = 0x45; /* E */
- pDcs->iso639Lang[1] = 0x4E; /* N */
- pDcs->iso639Lang[2] = 0x13; /* CR */
- }
+ case 0x01 :
+ {
+ if (dcsData == 0x10 || dcsData == 0x11) {
+ pDcs->codingGroup = SMS_CBMSG_CODGRP_GENERAL_DCS;
+ pDcs->codingScheme = (dcsData & 0x01) ? SMS_CHARSET_UCS2 : SMS_CHARSET_7BIT;
+ pDcs->langType = SMS_CBMSG_LANG_ISO639;
+ MSG_DEBUG("codingScheme: [%d]", pDcs->codingScheme);
+ if (pMsgData[0] && pMsgData[1]) {
+ pDcs->iso639Lang[0] = pMsgData[0] & 0x7F;
+ pDcs->iso639Lang[1] = (pMsgData[0] & 0X80) >> 7;
+ pDcs->iso639Lang[1] |= (pMsgData[1] & 0X3F) << 1;
+ pDcs->iso639Lang[2] = 0x13; /* CR */
+ } else {
+ /* Default it to English if pMsgData is NULL */
+ pDcs->iso639Lang[0] = 0x45; /* E */
+ pDcs->iso639Lang[1] = 0x4E; /* N */
+ pDcs->iso639Lang[2] = 0x13; /* CR */
}
}
- break;
+ }
+ break;
- case 0x04 :
- case 0x05 :
- case 0x06 :
- case 0x07 :
- {
- pDcs->codingGroup = SMS_CBMSG_CODGRP_GENERAL_DCS;
+ case 0x04 :
+ case 0x05 :
+ case 0x06 :
+ case 0x07 :
+ {
+ pDcs->codingGroup = SMS_CBMSG_CODGRP_GENERAL_DCS;
- pDcs->bCompressed = (dcsData & 0x20) ? true : false;
-
- if (dcsData & 0x10)
- pDcs->classType = (SMS_MSG_CLASS_T)(dcsData & 0x03);
-
- unsigned char tmpScheme = (dcsData & 0x0C) >> 2;
-
- switch (tmpScheme) {
- case 0x00:
- pDcs->codingScheme = SMS_CHARSET_7BIT;
- break;
- case 0x01:
- pDcs->codingScheme = SMS_CHARSET_8BIT;
- break;
- case 0x02:
- pDcs->codingScheme = SMS_CHARSET_UCS2;
- break;
- default:
- MSG_DEBUG("tmpScheme: [%d]", tmpScheme);
- break;
- }
- }
- break;
+ pDcs->bCompressed = (dcsData & 0x20) ? true : false;
- case 0x09 :
- {
- pDcs->bUDH = true;
- pDcs->classType = (MSG_CLASS_TYPE_T)(dcsData & 0x03);
- pDcs->codingScheme = (SMS_CODING_SCHEME_T)((dcsData & 0x0C) >> 2);
- }
- break;
+ if (dcsData & 0x10)
+ pDcs->classType = (SMS_MSG_CLASS_T)(dcsData & 0x03);
- case 0x0E :
- {
- pDcs->codingGroup = SMS_CBMSG_CODGRP_WAP;
- }
- break;
+ unsigned char tmpScheme = (dcsData & 0x0C) >> 2;
- case 0x0F :
- {
- pDcs->codingGroup = SMS_CBMSG_CODGRP_CLASS_CODING;
- pDcs->codingScheme = (dcsData & 0x04) ? SMS_CHARSET_8BIT : SMS_CHARSET_7BIT;
- pDcs->classType = (MSG_CLASS_TYPE_T)(dcsData & 0x03);
- }
- break;
+ switch (tmpScheme) {
+ case 0x00:
+ pDcs->codingScheme = SMS_CHARSET_7BIT;
+ break;
+ case 0x01:
+ pDcs->codingScheme = SMS_CHARSET_8BIT;
+ break;
+ case 0x02:
+ pDcs->codingScheme = SMS_CHARSET_UCS2;
+ break;
default:
- MSG_DEBUG("codingGrp: [0x%x]", codingGrp);
+ MSG_DEBUG("tmpScheme: [%d]", tmpScheme);
+ break;
+ }
+ }
+ break;
+
+ case 0x09 :
+ {
+ pDcs->bUDH = true;
+ pDcs->classType = (MSG_CLASS_TYPE_T)(dcsData & 0x03);
+ pDcs->codingScheme = (SMS_CODING_SCHEME_T)((dcsData & 0x0C) >> 2);
+ }
+ break;
+
+ case 0x0E :
+ {
+ pDcs->codingGroup = SMS_CBMSG_CODGRP_WAP;
+ }
+ break;
+
+ case 0x0F :
+ {
+ pDcs->codingGroup = SMS_CBMSG_CODGRP_CLASS_CODING;
+ pDcs->codingScheme = (dcsData & 0x04) ? SMS_CHARSET_8BIT : SMS_CHARSET_7BIT;
+ pDcs->classType = (MSG_CLASS_TYPE_T)(dcsData & 0x03);
+ }
+ break;
+ default:
+ MSG_DEBUG("codingGrp: [0x%x]", codingGrp);
break;
}
}
@@ -1095,46 +1040,45 @@ void SmsPluginCbMsgHandler::decodeCbMsgDCS(unsigned char dcsData, const unsigned
void SmsPluginCbMsgHandler::convertLangType(SMS_CBMSG_LANG_TYPE_T InType , MSG_CB_LANGUAGE_TYPE_T *pOutType)
{
- switch (InType)
- {
- case SMS_CBMSG_LANG_GERMAN :
- *pOutType = MSG_CBLANG_TYPE_GER;
+ switch (InType) {
+ case SMS_CBMSG_LANG_GERMAN :
+ *pOutType = MSG_CBLANG_TYPE_GER;
break;
- case SMS_CBMSG_LANG_ENGLISH :
- *pOutType = MSG_CBLANG_TYPE_ENG;
+ case SMS_CBMSG_LANG_ENGLISH :
+ *pOutType = MSG_CBLANG_TYPE_ENG;
break;
- case SMS_CBMSG_LANG_ITALIAN :
- *pOutType = MSG_CBLANG_TYPE_ITA;
+ case SMS_CBMSG_LANG_ITALIAN :
+ *pOutType = MSG_CBLANG_TYPE_ITA;
break;
- case SMS_CBMSG_LANG_FRENCH :
- *pOutType = MSG_CBLANG_TYPE_FRE;
+ case SMS_CBMSG_LANG_FRENCH :
+ *pOutType = MSG_CBLANG_TYPE_FRE;
break;
- case SMS_CBMSG_LANG_SPANISH :
- *pOutType = MSG_CBLANG_TYPE_SPA;
+ case SMS_CBMSG_LANG_SPANISH :
+ *pOutType = MSG_CBLANG_TYPE_SPA;
break;
- case SMS_CBMSG_LANG_DUTCH :
- *pOutType = MSG_CBLANG_TYPE_NED;
+ case SMS_CBMSG_LANG_DUTCH :
+ *pOutType = MSG_CBLANG_TYPE_NED;
break;
- case SMS_CBMSG_LANG_SWEDISH :
- *pOutType = MSG_CBLANG_TYPE_SWE;
+ case SMS_CBMSG_LANG_SWEDISH :
+ *pOutType = MSG_CBLANG_TYPE_SWE;
break;
- case SMS_CBMSG_LANG_PORTUGUESE :
- *pOutType = MSG_CBLANG_TYPE_POR;
+ case SMS_CBMSG_LANG_PORTUGUESE :
+ *pOutType = MSG_CBLANG_TYPE_POR;
break;
- case SMS_CBMSG_LANG_TURKISH :
- *pOutType = MSG_CBLANG_TYPE_TUR;
+ case SMS_CBMSG_LANG_TURKISH :
+ *pOutType = MSG_CBLANG_TYPE_TUR;
break;
- default :
- *pOutType = MSG_CBLANG_TYPE_MAX;
+ default :
+ *pOutType = MSG_CBLANG_TYPE_MAX;
break;
}
}
@@ -1159,10 +1103,8 @@ void SmsPluginCbMsgHandler::getDisplayName(unsigned short MsgId, char *pDisplayN
err = MsgStoGetCBChannelInfo(dbHandle, &cbChannelInfo, simIndex);
MSG_DEBUG("MsgStoGetCBChannelInfo [err = %d]", err);
- for (int i = 0; i < cbChannelInfo.channelCnt; i++)
- {
- if (MsgId >= cbChannelInfo.channelInfo[i].from && MsgId <= cbChannelInfo.channelInfo[i].to)
- {
+ for (int i = 0; i < cbChannelInfo.channelCnt; i++) {
+ if (MsgId >= cbChannelInfo.channelInfo[i].from && MsgId <= cbChannelInfo.channelInfo[i].to) {
MSG_DEBUG("FIND MSG ID = [%d]", MsgId);
#if 0
char strTmp[CB_CHANNEL_NAME_MAX + 1];
@@ -1183,11 +1125,9 @@ void SmsPluginCbMsgHandler::getDisplayName(unsigned short MsgId, char *pDisplayN
#endif
#endif
-
return;
}
}
snprintf(pDisplayName, MAX_ADDRESS_VAL_LEN + 1, "[%d]", MsgId);
}
-
diff --git a/plugin/sms_plugin/SmsPluginConcatHandler.cpp b/plugin/sms_plugin/SmsPluginConcatHandler.cpp
index 07101ac..b965cc4 100755
--- a/plugin/sms_plugin/SmsPluginConcatHandler.cpp
+++ b/plugin/sms_plugin/SmsPluginConcatHandler.cpp
@@ -76,7 +76,7 @@ bool SmsPluginConcatHandler::IsConcatMsg(SMS_USERDATA_S *pUserData)
}
-void SmsPluginConcatHandler::handleConcatMsg(struct tapi_handle *handle, SMS_TPDU_S *pTpdu)
+void SmsPluginConcatHandler::handleConcatMsg(TapiHandle *handle, SMS_TPDU_S *pTpdu)
{
MSG_BEGIN();
@@ -153,14 +153,19 @@ void SmsPluginConcatHandler::handleConcatMsg(struct tapi_handle *handle, SMS_TPD
unique_ptr<MSG_ADDRESS_INFO_S*, void(*)(MSG_ADDRESS_INFO_S**)> addressListBuf(&msgInfo.addressList, unique_ptr_deleter);
msgInfo.sim_idx = msg.simIndex;
- dataSize = makeConcatUserData(msg.msgRef, msg.simIndex, &pUserData);
+ dataSize = makeConcatUserData(msg.msgRef, msg.simIndex, &pUserData, msg.originAddress.address);
if (dataSize > 0) {
if (SmsPluginWapPushHandler::instance()->IsWapPushMsg(&(pTpdu->data.deliver.userData)) == true) {
SmsPluginWapPushHandler::instance()->copyDeliverData(&(pTpdu->data.deliver));
msgInfo.msgType.mainType = MSG_SMS_TYPE;
if (err == MSG_SUCCESS) {
- SmsPluginWapPushHandler::instance()->handleWapPushMsg(pUserData, dataSize, msg.simIndex);
+ time_t sent_time = 0;
+ if (pTpdu->data.deliver.timeStamp.format == SMS_TIME_ABSOLUTE) {
+ sent_time = time(NULL);
+ }
+
+ SmsPluginWapPushHandler::instance()->handleWapPushMsg(pUserData, dataSize, msg.simIndex, sent_time);
}
} else {
convertConcatToMsginfo(&(pTpdu->data.deliver), pUserData, dataSize, &msgInfo);
@@ -193,7 +198,7 @@ void SmsPluginConcatHandler::handleConcatMsg(struct tapi_handle *handle, SMS_TPD
int totalCnt = MsgSettingGetInt(keyName);
if (segCnt > totalCnt) {
- //send DeliveryResport as MSG_SUCCESS and return when total sim storage cnt is less than segment cnt.
+ /* send DeliveryResport as MSG_SUCCESS and return when total sim storage cnt is less than segment cnt. */
MSG_INFO("SIM slot total count [%d] is less than total sement count of Class2 message [%d], send delivery report as SUCCESS and save it only PHONE", totalCnt, segCnt);
SmsPluginTransport::instance()->sendDeliverReport(handle, MSG_SUCCESS);
@@ -216,7 +221,7 @@ void SmsPluginConcatHandler::handleConcatMsg(struct tapi_handle *handle, SMS_TPD
err = SmsPluginEventHandler::instance()->callbackMsgIncoming(&msgInfo);
if (err != MSG_SUCCESS) {
- MSG_DEBUG("callbackMsgIncoming() Error !! [%d]", err);
+ MSG_WARN("callbackMsgIncoming() Error !! [%d]", err);
}
}
} else {
@@ -225,7 +230,7 @@ void SmsPluginConcatHandler::handleConcatMsg(struct tapi_handle *handle, SMS_TPD
}
}
- removeFromConcatList(msg.msgRef, msg.simIndex);
+ removeFromConcatList(msg.msgRef, msg.simIndex, msg.originAddress.address);
}
/** Send Deliver Report */
@@ -234,7 +239,7 @@ void SmsPluginConcatHandler::handleConcatMsg(struct tapi_handle *handle, SMS_TPD
MSG_END();
}
-void SmsPluginConcatHandler::handleSimConcatMsg(struct tapi_handle *handle, SMS_TPDU_S *pTpdu, int msgId, int bRead, int *simIdList)
+void SmsPluginConcatHandler::handleSimConcatMsg(TapiHandle *handle, SMS_TPDU_S *pTpdu, int msgId, int bRead, int *simIdList)
{
MSG_BEGIN();
@@ -293,21 +298,22 @@ void SmsPluginConcatHandler::handleSimConcatMsg(struct tapi_handle *handle, SMS_
unique_ptr<MSG_ADDRESS_INFO_S*, void(*)(MSG_ADDRESS_INFO_S**)> addressListBuf(&msgInfo.addressList, unique_ptr_deleter);
msgInfo.sim_idx = msg.simIndex;
- dataSize = makeConcatUserData(msg.msgRef, msg.simIndex, &pUserData);
+ dataSize = makeConcatUserData(msg.msgRef, msg.simIndex, &pUserData, msg.originAddress.address);
if (dataSize > 0) {
convertConcatToMsginfo(&(pTpdu->data.deliver), pUserData, dataSize, &msgInfo);
- // set Sim Message ID
+ /* set Sim Message ID */
msgInfo.msgId = msgId;
- // set read status
+ /* set read status */
msgInfo.bRead = bRead;
- // set storage id
+ /* set storage id */
msgInfo.storageId = MSG_STORAGE_SIM;
}
for (int index = concatList.size(); index >= 0 ; index--) {
- if (concatList[index].msgRef == msg.msgRef && concatList[index].simIndex == msg.simIndex) {
+ if (concatList[index].msgRef == msg.msgRef && concatList[index].simIndex == msg.simIndex
+ && g_strcmp0(concatList[index].originAddress.address, msg.originAddress.address) == 0) {
memcpy(simIdList, concatList[index].simIdList, sizeof(int) * MAX_SIM_SMS_NUM);
for (int i = 0; i < 255; ++i)
{
@@ -316,11 +322,13 @@ void SmsPluginConcatHandler::handleSimConcatMsg(struct tapi_handle *handle, SMS_
break;
}
}
- removeFromConcatList(msg.msgRef, msg.simIndex);
- SmsPluginSimMsg::instance()->setSimMsgEvent(handle, &msgInfo, true); // Call Event Handler
+ removeFromConcatList(msg.msgRef, msg.simIndex, msg.originAddress.address);
+ /* Call Event Handler */
+ SmsPluginSimMsg::instance()->setSimMsgEvent(handle, &msgInfo, true);
return;
}
- SmsPluginSimMsg::instance()->setSimMsgEvent(handle, NULL, false); // Call Event Handler
+ /* Call Event Handler */
+ SmsPluginSimMsg::instance()->setSimMsgEvent(handle, NULL, false);
} else {
SMS_CONCAT_MSG_S msg = {0};
@@ -373,32 +381,35 @@ void SmsPluginConcatHandler::handleSimConcatMsg(struct tapi_handle *handle, SMS_
unique_ptr<MSG_ADDRESS_INFO_S*, void(*)(MSG_ADDRESS_INFO_S**)> addressListBuf(&msgInfo.addressList, unique_ptr_deleter);
msgInfo.sim_idx = msg.simIndex;
- dataSize = makeConcatUserData(msg.msgRef, msg.simIndex, &pUserData);
+ dataSize = makeConcatUserData(msg.msgRef, msg.simIndex, &pUserData, msg.originAddress.address);
if (dataSize > 0) {
convertConcatToMsginfo(&(pTpdu->data.submit), pUserData, dataSize, &msgInfo);
- // set Sim Message ID
+ /* set Sim Message ID */
msgInfo.msgId = msgId;
- // set read status
+ /* set read status */
msgInfo.bRead = bRead;
msgInfo.msgType.subType = MSG_CONCAT_SIM_SMS;
- // set storage id
+ /* set storage id */
msgInfo.storageId = MSG_STORAGE_SIM;
}
for (int index = concatList.size(); index >= 0 ; index--) {
- if (concatList[index].msgRef == msg.msgRef && concatList[index].simIndex == msg.simIndex) {
+ if (concatList[index].msgRef == msg.msgRef && concatList[index].simIndex == msg.simIndex
+ && g_strcmp0(concatList[index].originAddress.address, msg.originAddress.address) == 0) {
memcpy(simIdList, concatList[index].simIdList, sizeof(int) * MAX_SIM_SMS_NUM);
break;
}
}
- SmsPluginSimMsg::instance()->setSimMsgEvent(handle, &msgInfo, true); // Call Event Handler
- removeFromConcatList(msg.msgRef, msg.simIndex);
+ /* Call Event Handler */
+ SmsPluginSimMsg::instance()->setSimMsgEvent(handle, &msgInfo, true);
+ removeFromConcatList(msg.msgRef, msg.simIndex, msg.originAddress.address);
return;
}
- SmsPluginSimMsg::instance()->setSimMsgEvent(handle, NULL, false); // Call Event Handler
+ /* Call Event Handler */
+ SmsPluginSimMsg::instance()->setSimMsgEvent(handle, NULL, false);
}
MSG_END();
@@ -409,8 +420,7 @@ void SmsPluginConcatHandler::handleConcatMsg(SMS_TPDU_S *pTpdu, msg_sim_id_t Sim
{
MSG_BEGIN();
- if (pTpdu->tpduType != SMS_TPDU_DELIVER)
- {
+ if (pTpdu->tpduType != SMS_TPDU_DELIVER) {
MSG_DEBUG("The TPDU type is not deliver [%d]", pTpdu->tpduType);
return;
}
@@ -418,10 +428,8 @@ void SmsPluginConcatHandler::handleConcatMsg(SMS_TPDU_S *pTpdu, msg_sim_id_t Sim
SMS_CONCAT_MSG_S msg;
memset(&msg, 0x00, sizeof(SMS_CONCAT_MSG_S));
- for (int i = 0; i < pTpdu->data.deliver.userData.headerCnt; i++)
- {
- if (pTpdu->data.deliver.userData.header[i].udhType == SMS_UDH_CONCAT_8BIT)
- {
+ for (int i = 0; i < pTpdu->data.deliver.userData.headerCnt; i++) {
+ if (pTpdu->data.deliver.userData.header[i].udhType == SMS_UDH_CONCAT_8BIT) {
msg.msgRef = (unsigned short)pTpdu->data.deliver.userData.header[i].udh.concat8bit.msgRef;
msg.totalSeg = pTpdu->data.deliver.userData.header[i].udh.concat8bit.totalSeg;
msg.seqNum = pTpdu->data.deliver.userData.header[i].udh.concat8bit.seqNum;
@@ -432,16 +440,13 @@ void SmsPluginConcatHandler::handleConcatMsg(SMS_TPDU_S *pTpdu, msg_sim_id_t Sim
msg.bRead = bRead;
- if (msg.totalSeg > MAX_SEGMENT_NUM)
- {
+ if (msg.totalSeg > MAX_SEGMENT_NUM) {
MSG_DEBUG("Total Segment Count is over Maximum [%d]", msg.totalSeg);
return;
}
break;
- }
- else if (pTpdu->data.deliver.userData.header[i].udhType == SMS_UDH_CONCAT_16BIT)
- {
+ } else if (pTpdu->data.deliver.userData.header[i].udhType == SMS_UDH_CONCAT_16BIT) {
msg.msgRef = (unsigned short)pTpdu->data.deliver.userData.header[i].udh.concat16bit.msgRef;
msg.totalSeg = pTpdu->data.deliver.userData.header[i].udh.concat16bit.totalSeg;
msg.seqNum = pTpdu->data.deliver.userData.header[i].udh.concat16bit.seqNum;
@@ -452,8 +457,7 @@ void SmsPluginConcatHandler::handleConcatMsg(SMS_TPDU_S *pTpdu, msg_sim_id_t Sim
msg.bRead = bRead;
- if (msg.totalSeg > MAX_SEGMENT_NUM)
- {
+ if (msg.totalSeg > MAX_SEGMENT_NUM) {
MSG_DEBUG("Total Segment Count is over Maximum [%d]", msg.totalSeg);
return;
}
@@ -466,8 +470,7 @@ void SmsPluginConcatHandler::handleConcatMsg(SMS_TPDU_S *pTpdu, msg_sim_id_t Sim
addToSimIdList(msg.msgRef, SimMsgId);
- if (segCnt == msg.totalSeg)
- {
+ if (segCnt == msg.totalSeg) {
MSG_DEBUG("RECEIVED LAST CONCAT : %d", segCnt);
int dataSize = 0;
@@ -478,19 +481,18 @@ void SmsPluginConcatHandler::handleConcatMsg(SMS_TPDU_S *pTpdu, msg_sim_id_t Sim
dataSize = makeConcatUserData(msg.msgRef, &pUserData);
- if (dataSize >= 0)
- {
+ if (dataSize >= 0) {
MSG_DEBUG("TOTAL DATA : %s", pUserData);
convertSimMsgToMsginfo(&msg, pUserData, dataSize, &msgInfo);
- // set Sim Message ID
+ /* set Sim Message ID */
msgInfo.msgId = SimMsgId;
- // set read status
+ /* set read status */
msgInfo.bRead = bRead;
- /// Print MSG_MESSAGE_INFO_S
+ /* Print MSG_MESSAGE_INFO_S */
MSG_DEBUG("############# Convert tpdu values to Message Info values ####################");
MSG_DEBUG("msgInfo.msgId : %d", msgInfo.msgId);
@@ -515,23 +517,21 @@ void SmsPluginConcatHandler::handleConcatMsg(SMS_TPDU_S *pTpdu, msg_sim_id_t Sim
MSG_DEBUG("###############################################################");
- // Remove from List
+ /* Remove from List */
removeFromConcatList(msg.msgRef);
removeFromSimIdList(msg.msgRef);
- //add msgInfo to msg list
+ /* add msgInfo to msg list */
SmsPluginStorage::instance()->addSimMsgToList(&msgInfo, true);
- // Callback to MSG FW
+ /* Callback to MSG FW */
SmsPluginEventHandler::instance()->callbackGetSimMsg();
}
- }
- else
- {
- //add index count to msg list
+ } else {
+ /* add index count to msg list */
SmsPluginStorage::instance()->addSimMsgToList(NULL, false);
- // Callback to MSG FW
+ /* Callback to MSG FW */
SmsPluginEventHandler::instance()->callbackGetSimMsg();
}
@@ -541,14 +541,12 @@ void SmsPluginConcatHandler::handleConcatMsg(SMS_TPDU_S *pTpdu, msg_sim_id_t Sim
void SmsPluginConcatHandler::handleBrokenMsg()
{
- if (concatList.size() <= 0 || simIdList.size() <= 0)
- {
+ if (concatList.size() <= 0 || simIdList.size() <= 0) {
MSG_DEBUG("No Broken Concatenated Message");
return;
}
- do
- {
+ do {
int index = 0, dataSize = 0;
char* pUserData = NULL;
unique_ptr<char*, void(*)(char**)> dataBuf(&pUserData, unique_ptr_deleter);
@@ -557,8 +555,7 @@ void SmsPluginConcatHandler::handleBrokenMsg()
dataSize = makeConcatUserData(concatList[index].msgRef, &pUserData);
- if (dataSize > 0)
- {
+ if (dataSize > 0) {
MSG_DEBUG("TOTAL DATA : %s", pUserData);
SMS_CONCAT_MSG_S msg;
@@ -573,13 +570,13 @@ void SmsPluginConcatHandler::handleBrokenMsg()
convertSimMsgToMsginfo(&msg, pUserData, dataSize, &msgInfo);
- // set Sim Message ID
+ /* set Sim Message ID */
msgInfo.msgId = 0;
- // set read status
+ /* set read status */
msgInfo.bRead = concatList[index].bRead;
- /// Print MSG_MESSAGE_INFO_S
+ /* Print MSG_MESSAGE_INFO_S */
MSG_DEBUG("############# Convert tpdu values to Message Info values ####################");
MSG_DEBUG("msgInfo.msgId : %d", msgInfo.msgId);
MSG_DEBUG("msgInfo.nAddressCnt : %d", msgInfo.nAddressCnt);
@@ -601,13 +598,13 @@ void SmsPluginConcatHandler::handleBrokenMsg()
MSG_SEC_DEBUG("msgInfo.msgData : %s", msgInfo.msgData);
MSG_DEBUG("###############################################################");
- //add msgInfo to msg list
+ /* add msgInfo to msg list */
SmsPluginStorage::instance()->addSimMsgToList(&msgInfo, true);
}
removeFromConcatList(concatList[index].msgRef);
removeFromSimIdList(concatList[index].msgRef);
- }while (concatList.size() > 0);
+ } while (concatList.size() > 0);
}
#endif
@@ -624,7 +621,8 @@ unsigned char SmsPluginConcatHandler::checkConcatMsg(SMS_CONCAT_MSG_S *pConcatMs
bool bFind = false;
for (unsigned int i = 0; i < concatList.size(); i++) {
- if (concatList[i].msgRef == pConcatMsg->msgRef && concatList[i].simIndex == pConcatMsg->simIndex) {
+ if (concatList[i].msgRef == pConcatMsg->msgRef && concatList[i].simIndex == pConcatMsg->simIndex
+ && g_strcmp0(concatList[i].originAddress.address, pConcatMsg->originAddress.address) == 0) {
if (concatList[i].data.count(pConcatMsg->seqNum) != 0) {
MSG_DEBUG("The Sequence Number already exists [%d]", pConcatMsg->seqNum);
return 0;
@@ -689,14 +687,15 @@ unsigned char SmsPluginConcatHandler::checkConcatMsg(SMS_CONCAT_MSG_S *pConcatMs
}
-int SmsPluginConcatHandler::makeConcatUserData(unsigned short MsgRef, int simIndex, char **ppTotalData)
+int SmsPluginConcatHandler::makeConcatUserData(unsigned short MsgRef, int simIndex, char **ppTotalData, char *originAddress)
{
concatDataMap::iterator it;
int totalSize = 0, offset = 0;
for (unsigned int i = 0; i < concatList.size(); i++) {
- if (concatList[i].msgRef == MsgRef && concatList[i].simIndex == simIndex) {
+ if (concatList[i].msgRef == MsgRef && concatList[i].simIndex == simIndex
+ && g_strcmp0(concatList[i].originAddress.address, originAddress) == 0) {
totalSize = concatList[i].totalSize;
if (totalSize <= 0) {
@@ -732,23 +731,22 @@ void SmsPluginConcatHandler::convertConcatToMsginfo(const SMS_DELIVER_S *pTpdu,
/** set storage id */
pMsgInfo->storageId = MSG_STORAGE_PHONE;
- switch(pTpdu->dcs.msgClass)
- {
- case SMS_MSG_CLASS_0:
- pMsgInfo->msgType.classType = MSG_CLASS_0;
- break;
- case SMS_MSG_CLASS_1:
- pMsgInfo->msgType.classType = MSG_CLASS_1;
- break;
- case SMS_MSG_CLASS_2:
- pMsgInfo->msgType.classType = MSG_CLASS_2;
- break;
- case SMS_MSG_CLASS_3:
- pMsgInfo->msgType.classType = MSG_CLASS_3;
- break;
- default:
- pMsgInfo->msgType.classType = MSG_CLASS_NONE;
- break;
+ switch (pTpdu->dcs.msgClass) {
+ case SMS_MSG_CLASS_0:
+ pMsgInfo->msgType.classType = MSG_CLASS_0;
+ break;
+ case SMS_MSG_CLASS_1:
+ pMsgInfo->msgType.classType = MSG_CLASS_1;
+ break;
+ case SMS_MSG_CLASS_2:
+ pMsgInfo->msgType.classType = MSG_CLASS_2;
+ break;
+ case SMS_MSG_CLASS_3:
+ pMsgInfo->msgType.classType = MSG_CLASS_3;
+ break;
+ default:
+ pMsgInfo->msgType.classType = MSG_CLASS_NONE;
+ break;
}
pMsgInfo->networkStatus = MSG_NETWORK_RECEIVED;
@@ -841,8 +839,8 @@ void SmsPluginConcatHandler::convertConcatToMsginfo(const SMS_DELIVER_S *pTpdu,
}
}
- //int bufSize = (MAX_MSG_DATA_LEN*MAX_SEGMENT_NUM) + 1;
- int bufSize = (DataSize*4) + 1; // For UTF8
+ /* For UTF8 */
+ int bufSize = (DataSize*4) + 1;
char tmpBuf[bufSize];
memset(tmpBuf, 0x00, sizeof(tmpBuf));
@@ -916,23 +914,22 @@ void SmsPluginConcatHandler::convertConcatToMsginfo(const SMS_SUBMIT_S *pTpdu, c
/** set storage id */
pMsgInfo->storageId = MSG_STORAGE_PHONE;
- switch(pTpdu->dcs.msgClass)
- {
- case SMS_MSG_CLASS_0:
- pMsgInfo->msgType.classType = MSG_CLASS_0;
- break;
- case SMS_MSG_CLASS_1:
- pMsgInfo->msgType.classType = MSG_CLASS_1;
- break;
- case SMS_MSG_CLASS_2:
- pMsgInfo->msgType.classType = MSG_CLASS_2;
- break;
- case SMS_MSG_CLASS_3:
- pMsgInfo->msgType.classType = MSG_CLASS_3;
- break;
- default:
- pMsgInfo->msgType.classType = MSG_CLASS_NONE;
- break;
+ switch (pTpdu->dcs.msgClass) {
+ case SMS_MSG_CLASS_0:
+ pMsgInfo->msgType.classType = MSG_CLASS_0;
+ break;
+ case SMS_MSG_CLASS_1:
+ pMsgInfo->msgType.classType = MSG_CLASS_1;
+ break;
+ case SMS_MSG_CLASS_2:
+ pMsgInfo->msgType.classType = MSG_CLASS_2;
+ break;
+ case SMS_MSG_CLASS_3:
+ pMsgInfo->msgType.classType = MSG_CLASS_3;
+ break;
+ default:
+ pMsgInfo->msgType.classType = MSG_CLASS_NONE;
+ break;
}
pMsgInfo->networkStatus = MSG_NETWORK_RECEIVED;
@@ -970,8 +967,8 @@ void SmsPluginConcatHandler::convertConcatToMsginfo(const SMS_SUBMIT_S *pTpdu, c
}
}
- //int bufSize = (MAX_MSG_DATA_LEN*MAX_SEGMENT_NUM) + 1;
- int bufSize = (DataSize*4) + 1; // For UTF8
+ /* For UTF8 */
+ int bufSize = (DataSize*4) + 1;
char tmpBuf[bufSize];
memset(tmpBuf, 0x00, sizeof(tmpBuf));
@@ -1024,31 +1021,30 @@ void SmsPluginConcatHandler::convertConcatToMsginfo(const SMS_SUBMIT_S *pTpdu, c
#ifdef CONCAT_SIM_MSG_OPERATION
void SmsPluginConcatHandler::convertSimMsgToMsginfo(const SMS_CONCAT_MSG_S *pConcatMsg, const char *pUserData, int DataSize, MSG_MESSAGE_INFO_S *pMsgInfo)
{
- // Convert Type values
+ /* Convert Type values */
pMsgInfo->msgType.mainType = MSG_SMS_TYPE;
pMsgInfo->msgType.subType = MSG_CONCAT_SIM_SMS;
- // set folder id (temporary)
+ /* set folder id (temporary) */
pMsgInfo->folderId = MSG_INBOX_ID;
pMsgInfo->storageId = MSG_STORAGE_SIM;
- switch (pConcatMsg->dcs.msgClass)
- {
- case SMS_MSG_CLASS_0:
- pMsgInfo->msgType.classType = MSG_CLASS_0;
- break;
- case SMS_MSG_CLASS_1:
- pMsgInfo->msgType.classType = MSG_CLASS_1;
- break;
- case SMS_MSG_CLASS_2:
- pMsgInfo->msgType.classType = MSG_CLASS_2;
- break;
- case SMS_MSG_CLASS_3:
- pMsgInfo->msgType.classType = MSG_CLASS_3;
- break;
- default:
- pMsgInfo->msgType.classType = MSG_CLASS_NONE;
+ switch (pConcatMsg->dcs.msgClass) {
+ case SMS_MSG_CLASS_0:
+ pMsgInfo->msgType.classType = MSG_CLASS_0;
+ break;
+ case SMS_MSG_CLASS_1:
+ pMsgInfo->msgType.classType = MSG_CLASS_1;
+ break;
+ case SMS_MSG_CLASS_2:
+ pMsgInfo->msgType.classType = MSG_CLASS_2;
+ break;
+ case SMS_MSG_CLASS_3:
+ pMsgInfo->msgType.classType = MSG_CLASS_3;
+ break;
+ default:
+ pMsgInfo->msgType.classType = MSG_CLASS_NONE;
}
pMsgInfo->networkStatus = MSG_NETWORK_RECEIVED;
@@ -1114,7 +1110,7 @@ void SmsPluginConcatHandler::convertSimMsgToMsginfo(const SMS_CONCAT_MSG_S *pCon
pMsgInfo->displayTime = rawtime;
- // Convert Address values
+ /* Convert Address values */
pMsgInfo->nAddressCnt = 1;
pMsgInfo->addressList[0].addressType = MSG_ADDRESS_TYPE_PLMN;
strncpy(pMsgInfo->addressList[0].addressVal, pConcatMsg->originAddress.address, MAX_ADDRESS_VAL_LEN);
@@ -1123,13 +1119,11 @@ void SmsPluginConcatHandler::convertSimMsgToMsginfo(const SMS_CONCAT_MSG_S *pCon
pMsgInfo->msgPort.dstPort = 0;
pMsgInfo->msgPort.srcPort = 0;
- // Insert SMS_CONCAT_SIM_MSG_S into File
+ /* Insert SMS_CONCAT_SIM_MSG_S into File */
SMS_CONCAT_SIM_MSG_S concatSimMsg = {0};
- for (unsigned int i = 0; i < simIdList.size(); i++)
- {
- if (simIdList[i].msgRef == pConcatMsg->msgRef)
- {
+ for (unsigned int i = 0; i < simIdList.size(); i++) {
+ if (simIdList[i].msgRef == pConcatMsg->msgRef) {
MSG_DEBUG("Get SIM ID [%d] - List Index [%d]", simIdList[i].simId, concatSimMsg.simIdCnt);
concatSimMsg.simIdList[concatSimMsg.simIdCnt] = simIdList[i].simId;
@@ -1142,9 +1136,8 @@ void SmsPluginConcatHandler::convertSimMsgToMsginfo(const SMS_CONCAT_MSG_S *pCon
char tmpBuf[bufSize];
memset(tmpBuf, 0x00, sizeof(tmpBuf));
- // Convert Data values
- if (pConcatMsg->dcs.codingScheme == SMS_CHARSET_7BIT)
- {
+ /* Convert Data values */
+ if (pConcatMsg->dcs.codingScheme == SMS_CHARSET_7BIT) {
SMS_LANG_INFO_S langInfo = {0};
langInfo.bSingleShift = false;
@@ -1152,15 +1145,11 @@ void SmsPluginConcatHandler::convertSimMsgToMsginfo(const SMS_CONCAT_MSG_S *pCon
pMsgInfo->encodeType = MSG_ENCODE_GSM7BIT;
pMsgInfo->dataSize = SmsPluginTextConvert::instance()->convertGSM7bitToUTF8((unsigned char*)tmpBuf, bufSize, (unsigned char*)pUserData, DataSize, &langInfo);
- }
- else if (pConcatMsg->dcs.codingScheme == SMS_CHARSET_8BIT)
- {
+ } else if (pConcatMsg->dcs.codingScheme == SMS_CHARSET_8BIT) {
pMsgInfo->encodeType = MSG_ENCODE_8BIT;
memcpy(tmpBuf, pUserData, DataSize);
pMsgInfo->dataSize = DataSize;
- }
- else if (pConcatMsg->dcs.codingScheme == SMS_CHARSET_UCS2)
- {
+ } else if (pConcatMsg->dcs.codingScheme == SMS_CHARSET_UCS2) {
pMsgInfo->encodeType = MSG_ENCODE_UCS2;
pMsgInfo->dataSize = SmsPluginTextConvert::instance()->convertUCS2ToUTF8((unsigned char*)tmpBuf, bufSize, (unsigned char*)pUserData, DataSize);
}
@@ -1172,7 +1161,7 @@ void SmsPluginConcatHandler::convertSimMsgToMsginfo(const SMS_CONCAT_MSG_S *pCon
if (pMsgInfo->dataSize > 0)
memcpy(concatSimMsg.msgData, tmpBuf, pMsgInfo->dataSize);
- // Save Message Data into File
+ /* Save Message Data into File */
char fileName[MAX_COMMON_INFO_SIZE+1];
memset(fileName, 0x00, sizeof(fileName));
@@ -1190,10 +1179,11 @@ void SmsPluginConcatHandler::convertSimMsgToMsginfo(const SMS_CONCAT_MSG_S *pCon
#endif
-void SmsPluginConcatHandler::removeFromConcatList(unsigned short MsgRef, int simIndex)
+void SmsPluginConcatHandler::removeFromConcatList(unsigned short MsgRef, int simIndex, char *originAddress)
{
for (int index = concatList.size()-1; index >= 0 ; index--) {
- if (concatList[index].msgRef == MsgRef && concatList[index].simIndex == simIndex) {
+ if (concatList[index].msgRef == MsgRef && concatList[index].simIndex == simIndex
+ && g_strcmp0(concatList[index].originAddress.address, originAddress) == 0) {
MSG_DEBUG("remove concatlist of the index [%d]", index);
concatList.erase(concatList.begin()+index);
break;
@@ -1215,10 +1205,8 @@ void SmsPluginConcatHandler::addToSimIdList(unsigned short MsgRef, msg_sim_id_t
void SmsPluginConcatHandler::removeFromSimIdList(unsigned short MsgRef)
{
- for (int index = simIdList.size()-1; index >= 0 ; index--)
- {
- if (simIdList[index].msgRef == MsgRef)
- {
+ for (int index = simIdList.size()-1; index >= 0 ; index--) {
+ if (simIdList[index].msgRef == MsgRef) {
MSG_DEBUG("remove simIdList of the index [%d]", index);
simIdList.erase(simIdList.begin()+index);
diff --git a/plugin/sms_plugin/SmsPluginDSHandler.cpp b/plugin/sms_plugin/SmsPluginDSHandler.cpp
index 64939ff..081ae5e 100755
--- a/plugin/sms_plugin/SmsPluginDSHandler.cpp
+++ b/plugin/sms_plugin/SmsPluginDSHandler.cpp
@@ -20,8 +20,7 @@
#include "SmsPluginDSHandler.h"
#include "MsgGconfWrapper.h"
-extern "C"
-{
+extern "C" {
#include <tapi_common.h>
#include <TelNetwork.h>
#include <ITapiNetwork.h>
@@ -66,8 +65,7 @@ int SmsPluginDSHandler::initTelHandle()
goto FINISH;
}
- while(cp_list[cnt] && cnt < MAX_TELEPHONY_HANDLE_CNT)
- {
+ while (cp_list[cnt] && cnt < MAX_TELEPHONY_HANDLE_CNT) {
MSG_SEC_INFO("cp_list[%d]:[%s]", cnt, cp_list[cnt]);
handle_list.handle[cnt]= tel_init(cp_list[cnt]);
cnt++;
@@ -84,8 +82,7 @@ void SmsPluginDSHandler::deinitTelHandle()
{
int ret = 0;
- for (int i = 0; i < handle_list.count; i++)
- {
+ for (int i = 0; i < handle_list.count; i++) {
ret = tel_deinit(handle_list.handle[i]);
MSG_DEBUG("tel_deinit ret=[%d]", ret);
handle_list.handle[i] = NULL;
@@ -97,11 +94,11 @@ void SmsPluginDSHandler::deinitTelHandle()
return;
}
-struct tapi_handle *SmsPluginDSHandler::getTelHandle(int sim_idx)
+TapiHandle *SmsPluginDSHandler::getTelHandle(int sim_idx)
{
- if (sim_idx > 0 && sim_idx < MAX_TELEPHONY_HANDLE_CNT)
+ if (sim_idx > 0 && sim_idx < MAX_TELEPHONY_HANDLE_CNT) {
return handle_list.handle[sim_idx-1];
- else {
+ } else {
int SIM_Status = 0;
SIM_Status = MsgSettingGetInt(VCONFKEY_TELEPHONY_SIM_SLOT);
if (SIM_Status == 1) {
@@ -117,11 +114,10 @@ struct tapi_handle *SmsPluginDSHandler::getTelHandle(int sim_idx)
return handle_list.handle[handle_list.count - 1];
}
-int SmsPluginDSHandler::getSimIndex(struct tapi_handle *handle)
+int SmsPluginDSHandler::getSimIndex(TapiHandle *handle)
{
- for(int index=0; index < handle_list.count; ++index)
- {
- if(handle_list.handle[index] == handle)
+ for (int index = 0; index < handle_list.count; ++index) {
+ if (handle_list.handle[index] == handle)
return index+1;
}
return 0;
diff --git a/plugin/sms_plugin/SmsPluginEventHandler.cpp b/plugin/sms_plugin/SmsPluginEventHandler.cpp
index 7416749..3b3e6fe 100755
--- a/plugin/sms_plugin/SmsPluginEventHandler.cpp
+++ b/plugin/sms_plugin/SmsPluginEventHandler.cpp
@@ -33,6 +33,7 @@
#include "SmsPluginConcatHandler.h"
#include "SmsPluginEventHandler.h"
#include "SmsPluginDSHandler.h"
+#include "SmsPluginParamCodec.h"
/*==================================================================================================
@@ -88,16 +89,18 @@ void SmsPluginEventHandler::handleSentStatus(msg_network_status_t NetStatus)
sentInfo.reqInfo.msgInfo.networkStatus = NetStatus;
if (NetStatus == MSG_NETWORK_SEND_SUCCESS) {
- //contacts-service is not used for gear
+ /* contacts-service is not used for gear */
#ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED
MSG_DEBUG("Add phone log");
MsgAddPhoneLog(&(sentInfo.reqInfo.msgInfo));
#endif //MSG_CONTACTS_SERVICE_NOT_SUPPORTED
- sentInfo.reqInfo.msgInfo.folderId = MSG_SENTBOX_ID; // It should be set after adding phone log.
+ sentInfo.reqInfo.msgInfo.folderId = MSG_SENTBOX_ID; /* It should be set after adding phone log. */
} else {
sentInfo.reqInfo.msgInfo.bRead = false;
}
+ SmsPluginStorage::instance()->updateSmsMessage(&(sentInfo.reqInfo.msgInfo));
+
callbackStorageChange(MSG_STORAGE_CHANGE_UPDATE, &(sentInfo.reqInfo.msgInfo));
}
@@ -105,7 +108,7 @@ void SmsPluginEventHandler::handleSentStatus(msg_network_status_t NetStatus)
MSG_DEBUG("sentInfo.reqInfo.sendOptInfo.bKeepCopy [%d]", sentInfo.reqInfo.sendOptInfo.bKeepCopy);
/** Check sending options */
if (sentInfo.reqInfo.sendOptInfo.bSetting && !sentInfo.reqInfo.sendOptInfo.bKeepCopy && NetStatus == MSG_NETWORK_SEND_SUCCESS) {
-// SmsPluginStorage::instance()->deleteSmsMessage(sentInfo.reqInfo.msgInfo.msgId);
+ SmsPluginStorage::instance()->deleteSmsMessage(sentInfo.reqInfo.msgInfo.msgId);
callbackStorageChange(MSG_STORAGE_CHANGE_DELETE, &(sentInfo.reqInfo.msgInfo));
}
@@ -123,11 +126,12 @@ void SmsPluginEventHandler::handleSentStatus(msg_network_status_t NetStatus)
}
-void SmsPluginEventHandler::handleMsgIncoming(struct tapi_handle *handle, SMS_TPDU_S *pTpdu)
+void SmsPluginEventHandler::handleMsgIncoming(TapiHandle *handle, SMS_TPDU_S *pTpdu)
{
/** Make MSG_MESSAGE_INFO_S */
MSG_MESSAGE_INFO_S msgInfo;
+ MSG_MESSAGE_INFO_S stored_msgInfo;
/** initialize msgInfo */
memset(&msgInfo, 0x00, sizeof(MSG_MESSAGE_INFO_S));
@@ -148,7 +152,7 @@ void SmsPluginEventHandler::handleMsgIncoming(struct tapi_handle *handle, SMS_TP
bUdhMwiMethod = false;
udhMwiCnt = 0;
- if(pTpdu->data.deliver.dcs.msgClass == SMS_MSG_CLASS_2)
+ if (pTpdu->data.deliver.dcs.msgClass == SMS_MSG_CLASS_2)
msgInfo.storageId = MSG_STORAGE_UNKNOWN;
else
msgInfo.storageId = MSG_STORAGE_PHONE;
@@ -168,17 +172,20 @@ void SmsPluginEventHandler::handleMsgIncoming(struct tapi_handle *handle, SMS_TP
}
}
+ bool bStoreVoiceMsg = false;
+
if (bUdhMwiMethod == false) {
/** check MWI and set info to SIM for DCS & Address method */
if (pTpdu->tpduType == SMS_TPDU_DELIVER && pTpdu->data.deliver.dcs.bMWI == true) {
+ int MwiCnt = 0;
MSG_DEBUG("MWI message - DCS method");
if (pTpdu->data.deliver.dcs.bIndActive == false) {
SmsPluginSetting::instance()->setMwiInfo(msgInfo.sim_idx, msgInfo.msgType.subType, 0);
- SmsPluginTransport::instance()->sendDeliverReport(handle, MSG_SUCCESS);
- return;
+ MwiCnt = 0;
} else {
SmsPluginSetting::instance()->setMwiInfo(msgInfo.sim_idx, msgInfo.msgType.subType, 1);
+ MwiCnt = 1;
/* For address method */
if (pTpdu->data.deliver.pid == 0x20 && pTpdu->data.deliver.originAddress.ton == SMS_TON_ALPHANUMERIC) {
@@ -209,24 +216,36 @@ void SmsPluginEventHandler::handleMsgIncoming(struct tapi_handle *handle, SMS_TP
free(voiceAlphaId);
voiceAlphaId = NULL;
}
+ }
+ }
- memset(msgInfo.msgText, 0x00, sizeof(msgInfo.msgText));
- snprintf(msgInfo.msgText, sizeof(msgInfo.msgText), "New voice message");
+ if (pTpdu->data.deliver.dcs.codingGroup == SMS_GROUP_STORE) {
+ bStoreVoiceMsg = true;
+ memset(&stored_msgInfo, 0x00, sizeof(MSG_MESSAGE_INFO_S));
+ memcpy(&stored_msgInfo, &msgInfo, sizeof(MSG_MESSAGE_INFO_S));
+ stored_msgInfo.msgType.subType = MSG_NORMAL_SMS;
+ }
- }
+ memset(msgInfo.msgText, 0x00, sizeof(msgInfo.msgText));
+ switch (msgInfo.msgType.subType) {
+ case MSG_MWI_VOICE_SMS :
+ snprintf(msgInfo.msgText, sizeof(msgInfo.msgText), "%d", MwiCnt);
+ break;
+ case MSG_MWI_FAX_SMS :
+ snprintf(msgInfo.msgText, sizeof(msgInfo.msgText), "%d new fax message", MwiCnt);
+ break;
+ case MSG_MWI_EMAIL_SMS :
+ snprintf(msgInfo.msgText, sizeof(msgInfo.msgText), "%d new email message", MwiCnt);
+ break;
+ default :
+ snprintf(msgInfo.msgText, sizeof(msgInfo.msgText), "%d new special message", MwiCnt);
+ break;
}
+ msgInfo.dataSize = strlen(msgInfo.msgText);
if (pTpdu->data.deliver.dcs.codingGroup == SMS_GROUP_DISCARD)
msgInfo.bStore = false;
}
- } else {
- MSG_DEBUG("MWI message - UDH method");
- if (udhMwiCnt <= 0) {
- MSG_DEBUG("MWI count is 0");
- SmsPluginSetting::instance()->setMwiInfo(msgInfo.sim_idx, msgInfo.msgType.subType, 0);
- SmsPluginTransport::instance()->sendDeliverReport(handle, MSG_SUCCESS);
- return;
- }
}
/** Short Message Type 0 - Just Send Deliver Report */
@@ -309,6 +328,9 @@ void SmsPluginEventHandler::handleMsgIncoming(struct tapi_handle *handle, SMS_TP
if (err == MSG_SUCCESS) {
MSG_DEBUG("callback to msg fw");
err = listener.pfMsgIncomingCb(&msgInfo);
+ if (bStoreVoiceMsg) {
+ err = listener.pfMsgIncomingCb(&stored_msgInfo);
+ }
} else {
if (msgInfo.msgType.classType == MSG_CLASS_0) {
MSG_DEBUG("callback for class0 message to msg fw");
@@ -324,7 +346,7 @@ void SmsPluginEventHandler::handleMsgIncoming(struct tapi_handle *handle, SMS_TP
SmsPluginTransport::instance()->sendDeliverReport(handle, err);
}
- // Tizen Validation System
+ /* Tizen Validation System */
char *msisdn = NULL;
char keyName[MAX_VCONFKEY_NAME_LEN];
memset(keyName, 0x00, sizeof(keyName));
@@ -371,7 +393,7 @@ void SmsPluginEventHandler::handleResendMessage(void)
}
-void SmsPluginEventHandler::handleSyncMLMsgIncoming(msg_syncml_message_type_t msgType, char* pPushBody, int PushBodyLen, char* pWspHeader, int WspHeaderLen,int simIndex)
+void SmsPluginEventHandler::handleSyncMLMsgIncoming(msg_syncml_message_type_t msgType, char* pPushBody, int PushBodyLen, char* pWspHeader, int WspHeaderLen, int simIndex)
{
MSG_SYNCML_MESSAGE_DATA_S syncMLData;
@@ -447,8 +469,16 @@ msg_error_t SmsPluginEventHandler::callbackInitSimBySat()
msg_error_t SmsPluginEventHandler::callbackStorageChange(msg_storage_change_type_t storageChangeType, MSG_MESSAGE_INFO_S *pMsgInfo)
{
- /** Callback to MSG FW */
- listener.pfStorageChangeCb(storageChangeType, pMsgInfo);
+ msg_id_list_s msgIdList;
+ msg_message_id_t msgIds[1];
+ memset(&msgIdList, 0x00, sizeof(msg_id_list_s));
+
+ msgIdList.nCount = 1;
+ msgIds[0] = pMsgInfo->msgId;
+ msgIdList.msgIdList = msgIds;
+
+ /* Callback to MSG FW */
+ listener.pfStorageChangeCb(storageChangeType, &msgIdList);
return MSG_SUCCESS;
}
@@ -457,17 +487,16 @@ msg_error_t SmsPluginEventHandler::callbackStorageChange(msg_storage_change_type
void SmsPluginEventHandler::convertTpduToMsginfo(SMS_TPDU_S *pTpdu, MSG_MESSAGE_INFO_S *msgInfo)
{
- switch(pTpdu->tpduType)
- {
- case SMS_TPDU_SUBMIT :
- convertSubmitTpduToMsginfo(&pTpdu->data.submit, msgInfo);
- break;
- case SMS_TPDU_DELIVER :
- convertDeliverTpduToMsginfo(&pTpdu->data.deliver, msgInfo);
- break;
- case SMS_TPDU_STATUS_REP :
- convertStatusRepTpduToMsginfo(&pTpdu->data.statusRep, msgInfo);
- break;
+ switch (pTpdu->tpduType) {
+ case SMS_TPDU_SUBMIT :
+ convertSubmitTpduToMsginfo(&pTpdu->data.submit, msgInfo);
+ break;
+ case SMS_TPDU_DELIVER :
+ convertDeliverTpduToMsginfo(&pTpdu->data.deliver, msgInfo);
+ break;
+ case SMS_TPDU_STATUS_REP :
+ convertStatusRepTpduToMsginfo(&pTpdu->data.statusRep, msgInfo);
+ break;
}
}
@@ -483,23 +512,22 @@ void SmsPluginEventHandler::convertSubmitTpduToMsginfo(const SMS_SUBMIT_S *pTpdu
/** set folder id (temporary) */
msgInfo->folderId = MSG_SENTBOX_ID;
- switch(pTpdu->dcs.msgClass)
- {
- case SMS_MSG_CLASS_0:
- msgInfo->msgType.classType = MSG_CLASS_0;
- break;
- case SMS_MSG_CLASS_1:
- msgInfo->msgType.classType = MSG_CLASS_1;
- break;
- case SMS_MSG_CLASS_2:
- msgInfo->msgType.classType = MSG_CLASS_2;
- break;
- case SMS_MSG_CLASS_3:
- msgInfo->msgType.classType = MSG_CLASS_3;
- break;
- default:
- msgInfo->msgType.classType = MSG_CLASS_NONE;
- break;
+ switch (pTpdu->dcs.msgClass) {
+ case SMS_MSG_CLASS_0:
+ msgInfo->msgType.classType = MSG_CLASS_0;
+ break;
+ case SMS_MSG_CLASS_1:
+ msgInfo->msgType.classType = MSG_CLASS_1;
+ break;
+ case SMS_MSG_CLASS_2:
+ msgInfo->msgType.classType = MSG_CLASS_2;
+ break;
+ case SMS_MSG_CLASS_3:
+ msgInfo->msgType.classType = MSG_CLASS_3;
+ break;
+ default:
+ msgInfo->msgType.classType = MSG_CLASS_NONE;
+ break;
}
msgInfo->networkStatus = MSG_NETWORK_SEND_SUCCESS;
@@ -517,6 +545,7 @@ void SmsPluginEventHandler::convertSubmitTpduToMsginfo(const SMS_SUBMIT_S *pTpdu
//dont_call: Calling localtime(time_t const *) is a DC.SECURE_CODING_CRITICAL defect.
// time_t curTime;
// localtime(&curTime);
+ msgInfo->displayTime = time(NULL);
/** Convert Address values */
msgInfo->nAddressCnt = 1;
@@ -561,8 +590,7 @@ void SmsPluginEventHandler::convertDeliverTpduToMsginfo(const SMS_DELIVER_S *pTp
msgInfo->folderId = MSG_INBOX_ID;
time_t rawtime = 0;
- if(msgInfo->storageId == MSG_STORAGE_SIM)
- {
+ if (msgInfo->storageId == MSG_STORAGE_SIM) {
/*** Comment below lines to save local UTC time..... (it could be used later.)
***/
if (pTpdu->timeStamp.format == SMS_TIME_ABSOLUTE) {
@@ -620,24 +648,23 @@ void SmsPluginEventHandler::convertDeliverTpduToMsginfo(const SMS_DELIVER_S *pTp
msgInfo->displayTime = rawtime;
- switch(pTpdu->dcs.msgClass)
- {
- case SMS_MSG_CLASS_0:
- msgInfo->msgType.classType = MSG_CLASS_0;
- break;
- case SMS_MSG_CLASS_1:
- msgInfo->msgType.classType = MSG_CLASS_1;
- break;
- case SMS_MSG_CLASS_2:
- msgInfo->msgType.classType = MSG_CLASS_2;
- msgInfo->storageId = MSG_STORAGE_SIM;
- break;
- case SMS_MSG_CLASS_3:
- msgInfo->msgType.classType = MSG_CLASS_3;
- break;
- default:
- msgInfo->msgType.classType = MSG_CLASS_NONE;
- break;
+ switch (pTpdu->dcs.msgClass) {
+ case SMS_MSG_CLASS_0:
+ msgInfo->msgType.classType = MSG_CLASS_0;
+ break;
+ case SMS_MSG_CLASS_1:
+ msgInfo->msgType.classType = MSG_CLASS_1;
+ break;
+ case SMS_MSG_CLASS_2:
+ msgInfo->msgType.classType = MSG_CLASS_2;
+ msgInfo->storageId = MSG_STORAGE_SIM;
+ break;
+ case SMS_MSG_CLASS_3:
+ msgInfo->msgType.classType = MSG_CLASS_3;
+ break;
+ default:
+ msgInfo->msgType.classType = MSG_CLASS_NONE;
+ break;
}
if (pTpdu->dcs.bMWI) {
@@ -695,6 +722,12 @@ void SmsPluginEventHandler::convertDeliverTpduToMsginfo(const SMS_DELIVER_S *pTp
msgInfo->bStore = false;
udhMwiCnt = pTpdu->userData.header[i].udh.specialInd.waitMsgNum;
+
+ if (udhMwiCnt < 0) {
+ MSG_DEBUG("Message waiting number is smaller than 0. It will be treated as 0. [%d]", udhMwiCnt);
+ udhMwiCnt = 0;
+ }
+
MSG_DEBUG("Message waiting number : [%d]", udhMwiCnt);
SmsPluginSetting::instance()->setMwiInfo(msgInfo->sim_idx, msgInfo->msgType.subType, udhMwiCnt);
@@ -720,8 +753,17 @@ void SmsPluginEventHandler::convertDeliverTpduToMsginfo(const SMS_DELIVER_S *pTp
} else if (pTpdu->userData.header[i].udhType == SMS_UDH_ALTERNATE_REPLY_ADDRESS) {
strncpy(msgInfo->addressList[0].addressVal, pTpdu->userData.header[i].udh.alternateAddress.address, MAX_ADDRESS_VAL_LEN);
} else if (pTpdu->userData.header[i].udhType >= SMS_UDH_EMS_FIRST && pTpdu->userData.header[i].udhType <= SMS_UDH_EMS_LAST) {
+ /* TODO: Raw text should be changed to string design id. Currently there's no design id in message-app-lite */
+/* char *msg_text = getTranslateText(MSG_APP_PACKAGE_NAME, MSG_APP_LOCALEDIR, "IDS_MSGF_POP_ERROR_UNSUPPORTED_MSG");
+ snprintf(msgInfo->msgText, sizeof(msgInfo->msgText), "%s", msg_text);
+*/
snprintf(msgInfo->msgText, sizeof(msgInfo->msgText), "Unsupported Message");
msgInfo->dataSize = strlen(msgInfo->msgText);
+/* if (msg_text) {
+ free(msg_text);
+ msg_text = NULL;
+ }
+*/
return;
}
}
@@ -731,20 +773,19 @@ void SmsPluginEventHandler::convertDeliverTpduToMsginfo(const SMS_DELIVER_S *pTp
memset(msgInfo->msgText, 0x00, sizeof(msgInfo->msgText));
msgInfo->dataSize = 0;
- switch(pTpdu->dcs.codingScheme)
- {
- case SMS_CHARSET_7BIT:
- msgInfo->encodeType = MSG_ENCODE_GSM7BIT;
- break;
- case SMS_CHARSET_8BIT:
- msgInfo->encodeType = MSG_ENCODE_8BIT;
- break;
- case SMS_CHARSET_UCS2:
- msgInfo->encodeType = MSG_ENCODE_UCS2;
- break;
- default:
- msgInfo->encodeType = MSG_ENCODE_8BIT;
- break;
+ switch (pTpdu->dcs.codingScheme) {
+ case SMS_CHARSET_7BIT:
+ msgInfo->encodeType = MSG_ENCODE_GSM7BIT;
+ break;
+ case SMS_CHARSET_8BIT:
+ msgInfo->encodeType = MSG_ENCODE_8BIT;
+ break;
+ case SMS_CHARSET_UCS2:
+ msgInfo->encodeType = MSG_ENCODE_UCS2;
+ break;
+ default:
+ msgInfo->encodeType = MSG_ENCODE_8BIT;
+ break;
}
return;
@@ -805,43 +846,34 @@ void SmsPluginEventHandler::convertStatusRepTpduToMsginfo(const SMS_STATUS_REPOR
msgInfo->storageId = MSG_STORAGE_PHONE;
}
- switch(pTpdu->dcs.msgClass)
- {
- case SMS_MSG_CLASS_0:
- msgInfo->msgType.classType = MSG_CLASS_0;
- break;
- case SMS_MSG_CLASS_1:
- msgInfo->msgType.classType = MSG_CLASS_1;
- break;
- case SMS_MSG_CLASS_2:
- msgInfo->msgType.classType = MSG_CLASS_2;
- break;
- case SMS_MSG_CLASS_3:
- msgInfo->msgType.classType = MSG_CLASS_3;
- break;
- default:
- msgInfo->msgType.classType = MSG_CLASS_NONE;
- break;
+ switch (pTpdu->dcs.msgClass) {
+ case SMS_MSG_CLASS_0:
+ msgInfo->msgType.classType = MSG_CLASS_0;
+ break;
+ case SMS_MSG_CLASS_1:
+ msgInfo->msgType.classType = MSG_CLASS_1;
+ break;
+ case SMS_MSG_CLASS_2:
+ msgInfo->msgType.classType = MSG_CLASS_2;
+ break;
+ case SMS_MSG_CLASS_3:
+ msgInfo->msgType.classType = MSG_CLASS_3;
+ break;
+ default:
+ msgInfo->msgType.classType = MSG_CLASS_NONE;
+ break;
}
MSG_DEBUG("delivery status : [%d]", pTpdu->status);
if (pTpdu->status == SMS_STATUS_RECEIVE_SUCCESS)
- {
msgInfo->networkStatus = MSG_NETWORK_DELIVER_SUCCESS;
- }
- else if(pTpdu->status == SMS_STATUS_TRY_REQUEST_PENDING)
- {
+ else if (pTpdu->status == SMS_STATUS_TRY_REQUEST_PENDING)
msgInfo->networkStatus = MSG_NETWORK_DELIVER_PENDING;
- }
- else if(pTpdu->status == SMS_STATUS_PERM_MSG_VAL_PERIOD_EXPIRED)
- {
+ else if (pTpdu->status == SMS_STATUS_PERM_MSG_VAL_PERIOD_EXPIRED)
msgInfo->networkStatus = MSG_NETWORK_DELIVER_EXPIRED;
- }
else
- {
msgInfo->networkStatus = MSG_NETWORK_DELIVER_FAIL;
- }
msgInfo->bRead = false;
msgInfo->bProtected = false;
@@ -851,63 +883,7 @@ void SmsPluginEventHandler::convertStatusRepTpduToMsginfo(const SMS_STATUS_REPOR
memset(msgInfo->subject, 0x00, MAX_SUBJECT_LEN+1);
- time_t rawtime = time(NULL);
-
-/*** Comment below lines to save local UTC time..... (it could be used later.)
-
- if (pTpdu->timeStamp.format == SMS_TIME_ABSOLUTE) {
-
- MSG_DEBUG("year : %d", pTpdu->timeStamp.time.absolute.year);
- MSG_DEBUG("month : %d", pTpdu->timeStamp.time.absolute.month);
- MSG_DEBUG("day : %d", pTpdu->timeStamp.time.absolute.day);
- MSG_DEBUG("hour : %d", pTpdu->timeStamp.time.absolute.hour);
- MSG_DEBUG("minute : %d", pTpdu->timeStamp.time.absolute.minute);
- MSG_DEBUG("second : %d", pTpdu->timeStamp.time.absolute.second);
- MSG_DEBUG("timezone : %d", pTpdu->timeStamp.time.absolute.timeZone);
-
- char displayTime[32];
- struct tm * timeTM;
-
- struct tm timeinfo;
- memset(&timeinfo, 0x00, sizeof(tm));
-
- timeinfo.tm_year = (pTpdu->timeStamp.time.absolute.year + 100);
- timeinfo.tm_mon = (pTpdu->timeStamp.time.absolute.month - 1);
- timeinfo.tm_mday = pTpdu->timeStamp.time.absolute.day;
- timeinfo.tm_hour = pTpdu->timeStamp.time.absolute.hour;
- timeinfo.tm_min = pTpdu->timeStamp.time.absolute.minute;
- timeinfo.tm_sec = pTpdu->timeStamp.time.absolute.second;
- timeinfo.tm_isdst = 0;
-
- rawtime = mktime(&timeinfo);
-
- MSG_DEBUG("tzname[0] [%s]", tzname[0]);
- MSG_DEBUG("tzname[1] [%s]", tzname[1]);
- MSG_DEBUG("timezone [%d]", timezone);
- MSG_DEBUG("daylight [%d]", daylight);
-
- memset(displayTime, 0x00, sizeof(displayTime));
- strftime(displayTime, 32, "%Y-%02m-%02d %T %z", &timeinfo);
- MSG_DEBUG("displayTime [%s]", displayTime);
-
- rawtime -= (pTpdu->timeStamp.time.absolute.timeZone * (3600/4));
-
- timeTM = localtime(&rawtime);
- memset(displayTime, 0x00, sizeof(displayTime));
- strftime(displayTime, 32, "%Y-%02m-%02d %T %z", timeTM);
- MSG_DEBUG("displayTime [%s]", displayTime);
-
- rawtime -= timezone;
-
- timeTM = localtime(&rawtime);
- memset(displayTime, 0x00, sizeof(displayTime));
- strftime(displayTime, 32, "%Y-%02m-%02d %T %z", timeTM);
- MSG_DEBUG("displayTime [%s]", displayTime);
- }
-
-***/
-
- msgInfo->displayTime = rawtime;
+ msgInfo->displayTime = time(NULL);
/** Convert Address values */
msgInfo->nAddressCnt = 1;
@@ -939,14 +915,29 @@ void SmsPluginEventHandler::convertStatusRepTpduToMsginfo(const SMS_STATUS_REPOR
msgInfo->dataSize = 0;
if (pTpdu->status <= SMS_STATUS_SMSC_SPECIFIC_LAST) {
- strncpy(msgInfo->msgText, "IDS_MSGF_BODY_MESSAGE_DELIVERED", MAX_MSG_TEXT_LEN);
+ char *msg_text = getTranslateText(MSG_APP_PACKAGE_NAME, MSG_APP_LOCALEDIR, "IDS_MSGF_BODY_MESSAGE_DELIVERED");
+ snprintf(msgInfo->msgText, sizeof(msgInfo->msgText), "%s", msg_text);
msgInfo->dataSize = strlen(msgInfo->msgText);
+ if (msg_text) {
+ free(msg_text);
+ msg_text = NULL;
+ }
} else if (pTpdu->status == SMS_STATUS_TEMP_SERVICE_REJECTED) {
- strncpy(msgInfo->msgText, "IDS_MSGF_BODY_MMSDELIVERYMSGREJECTED", MAX_MSG_TEXT_LEN);
+ char *msg_text = getTranslateText(MSG_APP_PACKAGE_NAME, MSG_APP_LOCALEDIR, "IDS_MSGF_BODY_MMSDELIVERYMSGREJECTED");
+ snprintf(msgInfo->msgText, sizeof(msgInfo->msgText), "%s", msg_text);
msgInfo->dataSize = strlen(msgInfo->msgText);
+ if (msg_text) {
+ free(msg_text);
+ msg_text = NULL;
+ }
} else if (pTpdu->status == SMS_STATUS_PERM_MSG_VAL_PERIOD_EXPIRED) {
- strncpy(msgInfo->msgText, "IDS_MSGF_BODY_MESSAGE_HAS_EXPIRED", MAX_MSG_TEXT_LEN);
+ char *msg_text = getTranslateText(MSG_APP_PACKAGE_NAME, MSG_APP_LOCALEDIR, "IDS_MSGF_BODY_MESSAGE_HAS_EXPIRED");
+ snprintf(msgInfo->msgText, sizeof(msgInfo->msgText), "%s", msg_text);
msgInfo->dataSize = strlen(msgInfo->msgText);
+ if (msg_text) {
+ free(msg_text);
+ msg_text = NULL;
+ }
} else {
strncpy(msgInfo->msgText, "Message delivery failed.", MAX_MSG_TEXT_LEN);
msgInfo->dataSize = strlen(msgInfo->msgText);
@@ -956,28 +947,27 @@ void SmsPluginEventHandler::convertStatusRepTpduToMsginfo(const SMS_STATUS_REPOR
MSG_SUB_TYPE_T SmsPluginEventHandler::convertMsgSubType(SMS_PID_T pid)
{
- switch (pid)
- {
- case SMS_PID_TYPE0 :
- return MSG_TYPE0_SMS;
- case SMS_PID_REPLACE_TYPE1 :
- return MSG_REPLACE_TYPE1_SMS;
- case SMS_PID_REPLACE_TYPE2 :
- return MSG_REPLACE_TYPE2_SMS;
- case SMS_PID_REPLACE_TYPE3 :
- return MSG_REPLACE_TYPE3_SMS;
- case SMS_PID_REPLACE_TYPE4 :
- return MSG_REPLACE_TYPE4_SMS;
- case SMS_PID_REPLACE_TYPE5 :
- return MSG_REPLACE_TYPE5_SMS;
- case SMS_PID_REPLACE_TYPE6 :
- return MSG_REPLACE_TYPE6_SMS;
- case SMS_PID_REPLACE_TYPE7 :
- return MSG_REPLACE_TYPE7_SMS;
- case SMS_PID_RETURN_CALL :
- return MSG_MWI_OTHER_SMS;
- default :
- return MSG_NORMAL_SMS;
+ switch (pid) {
+ case SMS_PID_TYPE0 :
+ return MSG_TYPE0_SMS;
+ case SMS_PID_REPLACE_TYPE1 :
+ return MSG_REPLACE_TYPE1_SMS;
+ case SMS_PID_REPLACE_TYPE2 :
+ return MSG_REPLACE_TYPE2_SMS;
+ case SMS_PID_REPLACE_TYPE3 :
+ return MSG_REPLACE_TYPE3_SMS;
+ case SMS_PID_REPLACE_TYPE4 :
+ return MSG_REPLACE_TYPE4_SMS;
+ case SMS_PID_REPLACE_TYPE5 :
+ return MSG_REPLACE_TYPE5_SMS;
+ case SMS_PID_REPLACE_TYPE6 :
+ return MSG_REPLACE_TYPE6_SMS;
+ case SMS_PID_REPLACE_TYPE7 :
+ return MSG_REPLACE_TYPE7_SMS;
+ case SMS_PID_RETURN_CALL :
+ return MSG_MWI_OTHER_SMS;
+ default :
+ return MSG_NORMAL_SMS;
}
}
@@ -993,7 +983,7 @@ void SmsPluginEventHandler::SetSentInfo(SMS_SENT_INFO_S *pSentInfo)
}
-void SmsPluginEventHandler::setDeviceStatus(struct tapi_handle *handle)
+void SmsPluginEventHandler::setDeviceStatus(TapiHandle *handle)
{
if (handle == devHandle) {
mx.lock();
@@ -1004,7 +994,7 @@ void SmsPluginEventHandler::setDeviceStatus(struct tapi_handle *handle)
}
-bool SmsPluginEventHandler::getDeviceStatus(struct tapi_handle *handle)
+bool SmsPluginEventHandler::getDeviceStatus(TapiHandle *handle)
{
int ret = 0;
diff --git a/plugin/sms_plugin/SmsPluginMain.cpp b/plugin/sms_plugin/SmsPluginMain.cpp
index 6cd6d0d..a0e9b06 100755
--- a/plugin/sms_plugin/SmsPluginMain.cpp
+++ b/plugin/sms_plugin/SmsPluginMain.cpp
@@ -32,8 +32,7 @@
#include "SmsPluginDSHandler.h"
#include <gio/gio.h>
-extern "C"
-{
+extern "C" {
#include <tapi_common.h>
#include <TelSms.h>
#include <TapiUtility.h>
@@ -65,13 +64,10 @@ void MsgResourceMonitorDeinit(void);
msg_error_t MsgPlgCreateHandle(MSG_PLUGIN_HANDLER_S *pPluginHandle)
{
- if (pPluginHandle == NULL)
- {
+ if (pPluginHandle == NULL) {
MSG_DEBUG("SMS plugin: create handler error ");
return MSG_ERR_NULL_POINTER;
- }
- else
- {
+ } else {
pPluginHandle->pfInitialize = SmsPlgInitialize;
pPluginHandle->pfFinalize = SmsPlgFinalize;
pPluginHandle->pfRegisterListener = SmsPlgRegisterListener;
@@ -95,8 +91,7 @@ msg_error_t MsgPlgCreateHandle(MSG_PLUGIN_HANDLER_S *pPluginHandle)
msg_error_t MsgPlgDestroyHandle(MSG_PLUGIN_HANDLER_S *pPluginHandle)
{
- if (pPluginHandle != NULL)
- {
+ if (pPluginHandle != NULL) {
free(pPluginHandle);
pPluginHandle = NULL;
}
@@ -146,14 +141,13 @@ msg_error_t SmsPlgInitialize()
SmsPluginCallback::instance()->registerEvent();
- for(int i=1; i <= simCnt; ++i)
- {
- struct tapi_handle *handle;
+ for (int i = 1; i <= simCnt; ++i) {
+ TapiHandle *handle;
handle = SmsPluginDSHandler::instance()->getTelHandle(i);
SmsPluginSetting::instance()->setSimChangeStatus(handle, true);
}
- // set resource monitor
+ /* set resource monitor */
MsgResourceMonitorInit();
MSG_END();
@@ -194,7 +188,7 @@ msg_error_t SmsPlgSubmitRequest(MSG_REQUEST_INFO_S *pReqInfo)
{
msg_error_t err = MSG_SUCCESS;
- // Add Submit SMS into DB
+ /* Add Submit SMS into DB */
if (pReqInfo->msgInfo.msgId == 0) {
if (pReqInfo->msgInfo.msgPort.valid == false) {
err = SmsPluginStorage::instance()->checkMessage(&(pReqInfo->msgInfo));
@@ -217,16 +211,15 @@ msg_error_t SmsPlgSubmitRequest(MSG_REQUEST_INFO_S *pReqInfo)
}
}
- // Check SIM is present or not
+ /* Check SIM is present or not */
char keyName[MAX_VCONFKEY_NAME_LEN] = {0,};
snprintf(keyName, sizeof(keyName), "%s/%d", MSG_SIM_CHANGED, pReqInfo->msgInfo.sim_idx);
MSG_SIM_STATUS_T simStatus = (MSG_SIM_STATUS_T)MsgSettingGetInt(keyName);
- if (simStatus == MSG_SIM_STATUS_NOT_FOUND)
- {
+ if (simStatus == MSG_SIM_STATUS_NOT_FOUND) {
MSG_DEBUG("SIM is not present..");
- // Update Msg Status
+ /* Update Msg Status */
if (pReqInfo->msgInfo.msgPort.valid == false)
SmsPluginStorage::instance()->updateSentMsg(&(pReqInfo->msgInfo), MSG_NETWORK_SEND_FAIL);
@@ -256,7 +249,7 @@ msg_error_t SmsPlgSubmitRequest(MSG_REQUEST_INFO_S *pReqInfo)
msg_error_t SmsPlgSaveSimMessage(const MSG_MESSAGE_INFO_S *pMsgInfo, SMS_SIM_ID_LIST_S *pSimIdList)
{
- // Check SIM is present or not
+ /* Check SIM is present or not */
char keyName[MAX_VCONFKEY_NAME_LEN];
memset(keyName, 0x00, sizeof(keyName));
snprintf(keyName, sizeof(keyName), "%s/%d", MSG_SIM_CHANGED, pMsgInfo->sim_idx);
@@ -269,17 +262,12 @@ msg_error_t SmsPlgSaveSimMessage(const MSG_MESSAGE_INFO_S *pMsgInfo, SMS_SIM_ID_
msg_error_t err = MSG_SUCCESS;
- try
- {
+ try {
err = SmsPluginSimMsg::instance()->saveSimMessage(pMsgInfo, pSimIdList);
- }
- catch (MsgException& e)
- {
+ } catch (MsgException& e) {
MSG_FATAL("%s", e.what());
return MSG_ERR_PLUGIN_STORAGE;
- }
- catch (exception& e)
- {
+ } catch (exception& e) {
MSG_FATAL("%s", e.what());
return MSG_ERR_PLUGIN_STORAGE;
}
@@ -290,7 +278,7 @@ msg_error_t SmsPlgSaveSimMessage(const MSG_MESSAGE_INFO_S *pMsgInfo, SMS_SIM_ID_
msg_error_t SmsPlgDeleteSimMessage(msg_sim_slot_id_t sim_idx, msg_sim_id_t SimMsgId)
{
- // Check SIM is present or not
+ /* Check SIM is present or not */
char keyName[MAX_VCONFKEY_NAME_LEN]={0,};
snprintf(keyName, sizeof(keyName), "%s/%d", MSG_SIM_CHANGED, sim_idx);
MSG_SIM_STATUS_T simStatus = (MSG_SIM_STATUS_T)MsgSettingGetInt(keyName);
@@ -300,17 +288,12 @@ msg_error_t SmsPlgDeleteSimMessage(msg_sim_slot_id_t sim_idx, msg_sim_id_t SimMs
return MSG_ERR_NO_SIM;
}
- try
- {
+ try {
SmsPluginSimMsg::instance()->deleteSimMessage(sim_idx, SimMsgId);
- }
- catch (MsgException& e)
- {
+ } catch (MsgException& e) {
MSG_FATAL("%s", e.what());
return MSG_ERR_PLUGIN_STORAGE;
- }
- catch (exception& e)
- {
+ } catch (exception& e) {
MSG_FATAL("%s", e.what());
return MSG_ERR_PLUGIN_STORAGE;
}
@@ -321,7 +304,7 @@ msg_error_t SmsPlgDeleteSimMessage(msg_sim_slot_id_t sim_idx, msg_sim_id_t SimMs
msg_error_t SmsPlgSetReadStatus(msg_sim_slot_id_t sim_idx, msg_sim_id_t SimMsgId)
{
- // Check SIM is present or not
+ /* Check SIM is present or not */
char keyName[MAX_VCONFKEY_NAME_LEN]={0,};
snprintf(keyName, sizeof(keyName), "%s/%d", MSG_SIM_CHANGED, sim_idx);
MSG_SIM_STATUS_T simStatus = (MSG_SIM_STATUS_T)MsgSettingGetInt(keyName);
@@ -331,17 +314,12 @@ msg_error_t SmsPlgSetReadStatus(msg_sim_slot_id_t sim_idx, msg_sim_id_t SimMsgId
return MSG_ERR_NO_SIM;
}
- try
- {
+ try {
SmsPluginSimMsg::instance()->setReadStatus(sim_idx, SimMsgId);
- }
- catch (MsgException& e)
- {
+ } catch (MsgException& e) {
MSG_FATAL("%s", e.what());
return MSG_ERR_PLUGIN_STORAGE;
- }
- catch (exception& e)
- {
+ } catch (exception& e) {
MSG_FATAL("%s", e.what());
return MSG_ERR_PLUGIN_STORAGE;
}
@@ -352,7 +330,7 @@ msg_error_t SmsPlgSetReadStatus(msg_sim_slot_id_t sim_idx, msg_sim_id_t SimMsgId
msg_error_t SmsPlgSetMemoryStatus(msg_sim_slot_id_t simIndex, msg_error_t Error)
{
- // Check SIM is present or not
+ /* Check SIM is present or not */
char keyName[MAX_VCONFKEY_NAME_LEN];
memset(keyName, 0x00, sizeof(keyName));
@@ -368,24 +346,18 @@ msg_error_t SmsPlgSetMemoryStatus(msg_sim_slot_id_t simIndex, msg_error_t Error)
int status = TAPI_NETTEXT_PDA_MEMORY_STATUS_AVAILABLE;
if (Error == MSG_ERR_SIM_STORAGE_FULL || Error == MSG_ERR_MESSAGE_COUNT_FULL)
- {
status = TAPI_NETTEXT_PDA_MEMORY_STATUS_FULL;
- }
MSG_DEBUG("Set Status : [%d]", status);
- struct tapi_handle *handle = SmsPluginDSHandler::instance()->getTelHandle(simIndex);
+ TapiHandle *handle = SmsPluginDSHandler::instance()->getTelHandle(simIndex);
tapiRet = tel_set_sms_memory_status(handle, status, TapiEventMemoryStatus, NULL);
if (tapiRet == TAPI_API_SUCCESS)
- {
MSG_DEBUG("######## tel_set_sms_memory_status() Success !!! #######");
- }
else
- {
MSG_DEBUG("######## tel_set_sms_memory_status() Success !!! return : [%d] #######", tapiRet);
- }
return MSG_SUCCESS;
}
@@ -393,17 +365,20 @@ msg_error_t SmsPlgSetMemoryStatus(msg_sim_slot_id_t simIndex, msg_error_t Error)
msg_error_t SmsPlgSetConfigData(const MSG_SETTING_S *pSetting)
{
- try
- {
- SmsPluginSetting::instance()->setConfigData(pSetting);
+ /* Check SIM is present or not */
+ MSG_SIM_STATUS_T simStatus = (MSG_SIM_STATUS_T)MsgSettingGetInt(MSG_SIM_CHANGED);
+
+ if (simStatus == MSG_SIM_STATUS_NOT_FOUND) {
+ MSG_DEBUG("SIM is not present..");
+ return MSG_ERR_NO_SIM;
}
- catch (MsgException& e)
- {
+
+ try {
+ SmsPluginSetting::instance()->setConfigData(pSetting);
+ } catch (MsgException& e) {
MSG_FATAL("%s", e.what());
return MSG_ERR_PLUGIN_SETTING;
- }
- catch (exception& e)
- {
+ } catch (exception& e) {
MSG_FATAL("%s", e.what());
return MSG_ERR_PLUGIN_SETTING;
}
@@ -414,17 +389,20 @@ msg_error_t SmsPlgSetConfigData(const MSG_SETTING_S *pSetting)
msg_error_t SmsPlgGetConfigData(MSG_SETTING_S *pSetting)
{
- try
- {
- SmsPluginSetting::instance()->getConfigData(pSetting);
+ /* Check SIM is present or not */
+ MSG_SIM_STATUS_T simStatus = (MSG_SIM_STATUS_T)MsgSettingGetInt(MSG_SIM_CHANGED);
+
+ if (simStatus == MSG_SIM_STATUS_NOT_FOUND) {
+ MSG_DEBUG("SIM is not present..");
+ return MSG_ERR_NO_SIM;
}
- catch (MsgException& e)
- {
+
+ try {
+ SmsPluginSetting::instance()->getConfigData(pSetting);
+ } catch (MsgException& e) {
MSG_FATAL("%s", e.what());
return MSG_ERR_PLUGIN_SETTING;
- }
- catch (exception& e)
- {
+ } catch (exception& e) {
MSG_FATAL("%s", e.what());
return MSG_ERR_PLUGIN_SETTING;
}
@@ -437,19 +415,14 @@ msg_error_t SmsPlgAddMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_
{
int *simIdList = (int*)pFileData;
- try
- {
+ try {
SmsPluginStorage::instance()->addSmsSendOption(pMsgInfo, pSendOptInfo);
if (simIdList)
SmsPluginStorage::instance()->addSimMessage(pMsgInfo, simIdList);
- }
- catch (MsgException& e)
- {
+ } catch (MsgException& e) {
MSG_FATAL("%s", e.what());
return MSG_ERR_PLUGIN_SETTING;
- }
- catch (exception& e)
- {
+ } catch (exception& e) {
MSG_FATAL("%s", e.what());
return MSG_ERR_PLUGIN_SETTING;
}
@@ -461,17 +434,12 @@ msg_error_t SmsPlgAddMessage(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_
msg_error_t SmsPlgGetDefaultNetworkSimId(int *simId)
{
- try
- {
+ try {
SmsPluginDSHandler::instance()->getDefaultNetworkSimId(simId);
- }
- catch (MsgException& e)
- {
+ } catch (MsgException& e) {
MSG_FATAL("%s", e.what());
return MSG_ERR_PLUGIN_SETTING;
- }
- catch (exception& e)
- {
+ } catch (exception& e) {
MSG_FATAL("%s", e.what());
return MSG_ERR_PLUGIN_SETTING;
}
@@ -490,7 +458,7 @@ static void on_change_received(GDBusConnection *connection, const gchar *sender_
gint memStatus;
g_variant_get(parameters, "(i)", &memStatus);
MSG_DEBUG("memStatus = [%d]", memStatus);
- if(memStatus == 0) {
+ if (memStatus == 0) {
int sim_count = SmsPluginDSHandler::instance()->getTelHandleCount();
for (int i = 0; i < sim_count; i++) {
@@ -502,7 +470,7 @@ static void on_change_received(GDBusConnection *connection, const gchar *sender_
void MsgResourceMonitorInit(void)
{
- MSG_BEGIN();
+ MSG_BEGIN();
GError *error = NULL;
diff --git a/plugin/sms_plugin/SmsPluginParamCodec.cpp b/plugin/sms_plugin/SmsPluginParamCodec.cpp
index ca1e7e7..2f953f1 100755
--- a/plugin/sms_plugin/SmsPluginParamCodec.cpp
+++ b/plugin/sms_plugin/SmsPluginParamCodec.cpp
@@ -52,22 +52,19 @@ int SmsPluginParamCodec::encodeAddress(const SMS_ADDRESS_S *pAddress, char **ppP
*ppParam = new char[MAX_ADD_PARAM_LEN];
- // Set Address Length
- if (temp[0] == '+')
- {
+ /* Set Address Length */
+ if (temp[0] == '+') {
(*ppParam)[offset++] = strlen(temp) - 1;
temp++;
ton = SMS_TON_INTERNATIONAL;
- }
- else
- {
+ } else {
(*ppParam)[offset++] = strlen(temp);
ton = pAddress->ton;
}
- // Set TON, NPI
+ /* Set TON, NPI */
(*ppParam)[offset++] = 0x80 + (ton << 4) + pAddress->npi;
MSG_DEBUG("Address length is %d.", (*ppParam)[0]);
@@ -86,8 +83,7 @@ int SmsPluginParamCodec::encodeTime(const SMS_TIMESTAMP_S *pTimeStamp, char **pp
{
int offset = 0;
- if(pTimeStamp->format == SMS_TIME_ABSOLUTE)
- {
+ if (pTimeStamp->format == SMS_TIME_ABSOLUTE) {
int timeZone = pTimeStamp->time.absolute.timeZone;
*ppParam = new char[MAX_ABS_TIME_PARAM_LEN];
@@ -98,8 +94,7 @@ int SmsPluginParamCodec::encodeTime(const SMS_TIMESTAMP_S *pTimeStamp, char **pp
(*ppParam)[offset++] = ((pTimeStamp->time.absolute.minute % 10) << 4) + (pTimeStamp->time.absolute.minute / 10);
(*ppParam)[offset++] = ((pTimeStamp->time.absolute.second % 10) << 4) + (pTimeStamp->time.absolute.second / 10);
- if(timeZone < 0)
- {
+ if (timeZone < 0) {
timeZone *= -1;
(*ppParam)[offset] = 0x08;
}
@@ -107,9 +102,7 @@ int SmsPluginParamCodec::encodeTime(const SMS_TIMESTAMP_S *pTimeStamp, char **pp
return offset;
- }
- else if(pTimeStamp->format == SMS_TIME_RELATIVE)
- {
+ } else if (pTimeStamp->format == SMS_TIME_RELATIVE) {
*ppParam = new char[MAX_REL_TIME_PARAM_LEN+1];
memcpy(*ppParam, &(pTimeStamp->time.relative.time), MAX_REL_TIME_PARAM_LEN);
@@ -127,60 +120,54 @@ int SmsPluginParamCodec::encodeDCS(const SMS_DCS_S *pDCS, char **ppParam)
**ppParam = 0x00;
- switch (pDCS->codingGroup)
+ switch (pDCS->codingGroup) {
+ case SMS_GROUP_GENERAL:
{
- case SMS_GROUP_GENERAL:
- {
- if (pDCS->msgClass != SMS_MSG_CLASS_NONE)
- {
- **ppParam = 0x10 + pDCS->msgClass;
- }
-
- if (pDCS->bCompressed)
- {
- **ppParam |= 0x20;
- }
- }
+ if (pDCS->msgClass != SMS_MSG_CLASS_NONE)
+ **ppParam = 0x10 + pDCS->msgClass;
+
+ if (pDCS->bCompressed)
+ **ppParam |= 0x20;
+ }
break;
- case SMS_GROUP_CODING_CLASS:
- {
- **ppParam = 0xF0 + pDCS->msgClass;
- }
+ case SMS_GROUP_CODING_CLASS:
+ {
+ **ppParam = 0xF0 + pDCS->msgClass;
+ }
break;
- case SMS_GROUP_DELETION:
- //not supported
+ case SMS_GROUP_DELETION:
+ /* not supported */
break;
- case SMS_GROUP_DISCARD:
- //not supported
+ case SMS_GROUP_DISCARD:
+ /* not supported */
break;
- case SMS_GROUP_STORE:
- //not supported
+ case SMS_GROUP_STORE:
+ /* not supported */
break;
- default:
- return 0;
+ default:
+ return 0;
}
- switch (pDCS->codingScheme)
- {
- case SMS_CHARSET_7BIT:
+ switch (pDCS->codingScheme) {
+ case SMS_CHARSET_7BIT:
break;
- case SMS_CHARSET_8BIT:
- **ppParam |= 0x04;
+ case SMS_CHARSET_8BIT:
+ **ppParam |= 0x04;
break;
- case SMS_CHARSET_UCS2:
- **ppParam |= 0x08;
+ case SMS_CHARSET_UCS2:
+ **ppParam |= 0x08;
break;
- default:
- return 0;
+ default:
+ return 0;
}
return 1;
@@ -192,18 +179,14 @@ int SmsPluginParamCodec::encodeSMSC(const char *pAddress, unsigned char *pEncode
char newAddr[MAX_SMSC_LEN+1];
memset(newAddr, 0x00, sizeof(newAddr));
-//MSG_DEBUG("SMSC [%s]", pAddress);
-
+/* MSG_DEBUG("SMSC [%s]", pAddress);
+*/
if (pAddress[0] == '+')
- {
strncpy(newAddr, pAddress+1, MAX_SMSC_LEN);
- }
else
- {
strncpy(newAddr, pAddress, MAX_SMSC_LEN);
- }
- // Set Address
+ /* Set Address */
int encodeLen = convertDigitToBcd(newAddr, strlen(newAddr), pEncodeAddr);
pEncodeAddr[encodeLen] = '\0';
@@ -231,22 +214,21 @@ int SmsPluginParamCodec::encodeSMSC(const SMS_ADDRESS_S *pAddress, unsigned char
else
dataSize = 2 + (addrLen/2) + 1;
- if (dataSize > MAX_SMSC_LEN)
- {
+ if (dataSize > MAX_SMSC_LEN) {
MSG_DEBUG("addrLen is too long [%d]", addrLen);
MSG_DEBUG("dataSize is too long [%d]", dataSize);
return 0;
}
- // Set Address Length
- // Check IPC 4.0 -> addrLen/2
+ /* Set Address Length
+ Check IPC 4.0 -> addrLen/2 */
pSMSC[0] = addrLen;
- // Set TON, NPI
+ /* Set TON, NPI */
pSMSC[1] = 0x80 + (pAddress->ton << 4) + pAddress->npi;
- // Set Address
+ /* Set Address */
convertDigitToBcd(newAddr, addrLen, &(pSMSC[2]));
pSMSC[dataSize] = '\0';
@@ -274,11 +256,10 @@ int SmsPluginParamCodec::decodeAddress(const unsigned char *pTpdu, SMS_ADDRESS_S
pAddress->ton = (pTpdu[offset] & 0x70) >> 4;
pAddress->npi = pTpdu[offset++] & 0x0F;
-MSG_DEBUG("ton [%d]", pAddress->ton);
-MSG_DEBUG("npi [%d]", pAddress->npi);
+ MSG_DEBUG("ton [%d]", pAddress->ton);
+ MSG_DEBUG("npi [%d]", pAddress->npi);
- if (pAddress->ton == SMS_TON_ALPHANUMERIC)
- {
+ if (pAddress->ton == SMS_TON_ALPHANUMERIC) {
MSG_DEBUG("Alphanumeric address");
char* tmpAddress = new char[MAX_ADDRESS_LEN];
@@ -295,22 +276,18 @@ MSG_DEBUG("npi [%d]", pAddress->npi);
if (tmpAddress)
delete[] tmpAddress;
- }
- else if (pAddress->ton == SMS_TON_INTERNATIONAL)
- {
+ } else if (pAddress->ton == SMS_TON_INTERNATIONAL) {
convertBcdToDigit(&(pTpdu[offset]), bcdLen, &((pAddress->address)[1]));
if (pAddress->address[1] != '\0')
pAddress->address[0] = '+';
- }
- else
- {
+ } else {
convertBcdToDigit(&(pTpdu[offset]), bcdLen, &((pAddress->address)[0]));
}
offset += bcdLen;
-//MSG_DEBUG("address [%s]", pAddress->address);
-
+/* MSG_DEBUG("address [%s]", pAddress->address);
+*/
return offset;
}
@@ -319,7 +296,7 @@ int SmsPluginParamCodec::decodeTime(const unsigned char *pTpdu, SMS_TIMESTAMP_S
{
int offset = 0;
- // decode in ABSOLUTE time type.
+ /* decode in ABSOLUTE time type. */
pTimeStamp->format = SMS_TIME_ABSOLUTE;
pTimeStamp->time.absolute.year = (pTpdu[offset] & 0x0F)*10 + ((pTpdu[offset] & 0xF0) >> 4);
@@ -360,8 +337,7 @@ int SmsPluginParamCodec::decodeDCS(const unsigned char *pTpdu, SMS_DCS_S *pDCS)
pDCS->bIndActive = false;
pDCS->indType = SMS_OTHER_INDICATOR;
- if (((dcs & 0xC0) >> 6) == 0)
- {
+ if (((dcs & 0xC0) >> 6) == 0) {
pDCS->codingGroup = SMS_GROUP_GENERAL;
pDCS->bCompressed = (dcs & 0x20) >> 5;
pDCS->codingScheme = (dcs & 0x0C) >> 2;
@@ -370,25 +346,19 @@ int SmsPluginParamCodec::decodeDCS(const unsigned char *pTpdu, SMS_DCS_S *pDCS)
pDCS->msgClass = SMS_MSG_CLASS_NONE;
else
pDCS->msgClass = dcs & 0x03;
- }
- else if (((dcs & 0xF0) >> 4) == 0x0F)
- {
+ } else if (((dcs & 0xF0) >> 4) == 0x0F) {
pDCS->codingGroup = SMS_GROUP_CODING_CLASS;
pDCS->bCompressed = false;
pDCS->codingScheme = (dcs & 0x0C) >> 2;
pDCS->msgClass = dcs & 0x03;
- }
- else if (((dcs & 0xC0) >> 6) == 1)
- {
+ } else if (((dcs & 0xC0) >> 6) == 1) {
pDCS->codingGroup = SMS_GROUP_DELETION;
pDCS->bCompressed = false;
pDCS->msgClass = SMS_MSG_CLASS_NONE;
- // TODO: finish here. ??
- }
- else if (((dcs & 0xF0) >> 4) == 0x0C)
- {
+ /* TODO: finish here. ?? */
+ } else if (((dcs & 0xF0) >> 4) == 0x0C) {
pDCS->codingGroup = SMS_GROUP_DISCARD;
pDCS->bCompressed = false;
pDCS->msgClass = SMS_MSG_CLASS_NONE;
@@ -396,9 +366,7 @@ int SmsPluginParamCodec::decodeDCS(const unsigned char *pTpdu, SMS_DCS_S *pDCS)
pDCS->bMWI = true;
pDCS->bIndActive = (((dcs & 0x08) >> 3) == 1)? true:false;
pDCS->indType = (SMS_INDICATOR_TYPE_T)(dcs & 0x03);
- }
- else if (((dcs & 0xF0) >> 4) == 0x0D)
- {
+ } else if (((dcs & 0xF0) >> 4) == 0x0D) {
pDCS->codingGroup = SMS_GROUP_STORE;
pDCS->codingScheme = SMS_CHARSET_7BIT;
pDCS->bCompressed = false;
@@ -407,9 +375,7 @@ int SmsPluginParamCodec::decodeDCS(const unsigned char *pTpdu, SMS_DCS_S *pDCS)
pDCS->bMWI = true;
pDCS->bIndActive = (((dcs & 0x08) >> 3) == 1)? true:false;
pDCS->indType = (SMS_INDICATOR_TYPE_T)(dcs & 0x03);
- }
- else if (((dcs & 0xF0) >> 4) == 0x0E)
- {
+ } else if (((dcs & 0xF0) >> 4) == 0x0E) {
pDCS->codingGroup = SMS_GROUP_STORE;
pDCS->codingScheme = SMS_CHARSET_UCS2;
pDCS->bCompressed = false;
@@ -418,9 +384,7 @@ int SmsPluginParamCodec::decodeDCS(const unsigned char *pTpdu, SMS_DCS_S *pDCS)
pDCS->bMWI = true;
pDCS->bIndActive = (((dcs & 0x08) >> 3) == 1)? true:false;
pDCS->indType = (SMS_INDICATOR_TYPE_T)(dcs & 0x03);
- }
- else
- {
+ } else {
pDCS->codingGroup = SMS_GROUP_UNKNOWN;
pDCS->bCompressed = (dcs & 0x20) >> 5;
@@ -438,13 +402,10 @@ void SmsPluginParamCodec::decodeSMSC(unsigned char* pAddress, int AddrLen, MSG_S
if (pAddress == NULL || AddrLen == 0)
return;
- if (ton == SMS_TON_INTERNATIONAL)
- {
+ if (ton == SMS_TON_INTERNATIONAL) {
pDecodeAddr[0] = '+';
convertBcdToDigit(pAddress, AddrLen, &(pDecodeAddr[1]));
- }
- else
- {
+ } else {
convertBcdToDigit(pAddress, AddrLen, pDecodeAddr);
}
}
@@ -458,11 +419,10 @@ int SmsPluginParamCodec::convertDigitToBcd(char *pDigit, int DigitLen, unsigned
int offset = 0;
unsigned char temp;
-//MSG_DEBUG("DigitLen [%d]", DigitLen);
-//MSG_DEBUG("pDigit [%s]", pDigit);
+/* MSG_DEBUG("DigitLen [%d]", DigitLen);
+ MSG_DEBUG("pDigit [%s]", pDigit); */
- for (int i = 0; i < DigitLen; i++)
- {
+ for (int i = 0; i < DigitLen; i++) {
if (pDigit[i] == '*')
temp = 0x0A;
else if (pDigit[i] == '#')
@@ -479,9 +439,7 @@ int SmsPluginParamCodec::convertDigitToBcd(char *pDigit, int DigitLen, unsigned
}
if ((DigitLen%2) == 1)
- {
pBcd[offset++] |= 0xF0;
- }
return offset;
}
@@ -492,8 +450,7 @@ int SmsPluginParamCodec::convertBcdToDigit(const unsigned char *pBcd, int BcdLen
int offset = 0;
unsigned char temp;
- for (int i = 0; i < BcdLen; i++)
- {
+ for (int i = 0; i < BcdLen; i++) {
temp = pBcd[i] & 0x0F;
if (temp == 0x0A)
@@ -507,8 +464,7 @@ int SmsPluginParamCodec::convertBcdToDigit(const unsigned char *pBcd, int BcdLen
temp = (pBcd[i] & 0xF0) >> 4;
- if (temp == 0x0F)
- {
+ if (temp == 0x0F) {
pDigit[offset] = '\0';
return offset;
}
@@ -540,9 +496,9 @@ bool SmsPluginParamCodec::checkCphsVmiMsg(const unsigned char *pTpdu, int *setTy
if (addrLen == 0x04 && pTpdu[offset++] == 0xD0) {
if (pTpdu[offset] == 0x11 || pTpdu[offset] == 0x10) {
MSG_DEBUG("####### VMI msg ######");
- *setType = (int)(pTpdu[offset] & 0x01); // 0 : clear, 1 : set
+ *setType = (int)(pTpdu[offset] & 0x01); /* 0 : clear, 1 : set */
- *indType = (int)(pTpdu[offset+1] & 0x01); // 0 : indicator 1, 1 : indicator 2
+ *indType = (int)(pTpdu[offset+1] & 0x01); /* 0 : indicator 1, 1 : indicator 2 */
ret = true;
}
@@ -550,3 +506,66 @@ bool SmsPluginParamCodec::checkCphsVmiMsg(const unsigned char *pTpdu, int *setTy
return ret;
}
+
+time_t SmsPluginParamCodec::convertTime(const SMS_TIMESTAMP_S *time_stamp)
+{
+ time_t rawtime;
+
+ if (time_stamp->format == SMS_TIME_ABSOLUTE) {
+ MSG_DEBUG("year : %d", time_stamp->time.absolute.year);
+ MSG_DEBUG("month : %d", time_stamp->time.absolute.month);
+ MSG_DEBUG("day : %d", time_stamp->time.absolute.day);
+ MSG_DEBUG("hour : %d", time_stamp->time.absolute.hour);
+ MSG_DEBUG("minute : %d", time_stamp->time.absolute.minute);
+ MSG_DEBUG("second : %d", time_stamp->time.absolute.second);
+ MSG_DEBUG("timezone : %d", time_stamp->time.absolute.timeZone);
+
+ char displayTime[32];
+ struct tm * timeTM;
+
+ struct tm timeinfo;
+ memset(&timeinfo, 0x00, sizeof(tm));
+
+ timeinfo.tm_year = (time_stamp->time.absolute.year + 100);
+ timeinfo.tm_mon = (time_stamp->time.absolute.month - 1);
+ timeinfo.tm_mday = time_stamp->time.absolute.day;
+ timeinfo.tm_hour = time_stamp->time.absolute.hour;
+ timeinfo.tm_min = time_stamp->time.absolute.minute;
+ timeinfo.tm_sec = time_stamp->time.absolute.second;
+ timeinfo.tm_isdst = 0;
+
+ rawtime = mktime(&timeinfo);
+
+ MSG_DEBUG("tzname[0] [%s]", tzname[0]);
+ MSG_DEBUG("tzname[1] [%s]", tzname[1]);
+ MSG_DEBUG("timezone [%d]", timezone);
+ MSG_DEBUG("daylight [%d]", daylight);
+
+ memset(displayTime, 0x00, sizeof(displayTime));
+ strftime(displayTime, 32, "%Y-%02m-%02d %T %z", &timeinfo);
+ MSG_DEBUG("displayTime [%s]", displayTime);
+
+ rawtime -= (time_stamp->time.absolute.timeZone * (3600/4));
+
+ timeTM = localtime(&rawtime);
+ memset(displayTime, 0x00, sizeof(displayTime));
+ strftime(displayTime, 32, "%Y-%02m-%02d %T %z", timeTM);
+ MSG_DEBUG("displayTime [%s]", displayTime);
+
+/* timezone value is tiemzone + daylight. So should not add daylight */
+#ifdef __MSG_DAYLIGHT_APPLIED__
+ rawtime -= (timezone - daylight*3600);
+#else
+ rawtime -= timezone;
+#endif
+
+ timeTM = localtime(&rawtime);
+ memset(displayTime, 0x00, sizeof(displayTime));
+ strftime(displayTime, 32, "%Y-%02m-%02d %T %z", timeTM);
+ MSG_DEBUG("displayTime [%s]", displayTime);
+ } else {
+ rawtime = time(NULL);
+ }
+
+ return rawtime;
+}
diff --git a/plugin/sms_plugin/SmsPluginSatHandler.cpp b/plugin/sms_plugin/SmsPluginSatHandler.cpp
index 1ca9df7..dc2216e 100755
--- a/plugin/sms_plugin/SmsPluginSatHandler.cpp
+++ b/plugin/sms_plugin/SmsPluginSatHandler.cpp
@@ -31,8 +31,7 @@
#include "SmsPluginSatHandler.h"
#include "SmsPluginDSHandler.h"
-extern "C"
-{
+extern "C" {
#include <tapi_common.h>
#include <TelSms.h>
#include <TapiUtility.h>
@@ -71,7 +70,7 @@ SmsPluginSatHandler* SmsPluginSatHandler::instance()
}
-void SmsPluginSatHandler::refreshSms(struct tapi_handle *handle, void *pData)
+void SmsPluginSatHandler::refreshSms(TapiHandle *handle, void *pData)
{
/*
TelSatRefreshInd_t* pRefreshData = (TelSatRefreshInd_t*)pData;
@@ -138,7 +137,7 @@ void SmsPluginSatHandler::refreshSms(struct tapi_handle *handle, void *pData)
}
-void SmsPluginSatHandler::sendSms(struct tapi_handle *handle, void *pData)
+void SmsPluginSatHandler::sendSms(TapiHandle *handle, void *pData)
{
TelSatSendSmsIndSmsData_t* pSmsData = (TelSatSendSmsIndSmsData_t*)pData;
@@ -146,15 +145,15 @@ void SmsPluginSatHandler::sendSms(struct tapi_handle *handle, void *pData)
MSG_DEBUG("commandId [%d]", commandId);
- // The TPDU Maximum Length at SAT side is 175
- // This is because Sat can send 160 bytes unpacked and header
+ /* The TPDU Maximum Length at SAT side is 175
+ This is because Sat can send 160 bytes unpacked and header */
unsigned char tpdu[MAX_SAT_TPDU_LEN+1];
int tpduLen = 0;
memset(tpdu, 0x00, sizeof(tpdu));
memcpy(tpdu, pSmsData->smsTpdu.data, pSmsData->smsTpdu.dataLen);
- // Modify Parameters, Pack User Data
+ /* Modify Parameters, Pack User Data */
tpduLen = handleSatTpdu(tpdu, pSmsData->smsTpdu.dataLen, pSmsData->bIsPackingRequired);
if (tpduLen <= 0) {
@@ -170,10 +169,10 @@ void SmsPluginSatHandler::sendSms(struct tapi_handle *handle, void *pData)
return;
}
- // Make Telephony Structure
+ /* Make Telephony Structure */
TelSmsDatapackageInfo_t pkgInfo;
- // Set TPDU data
+ /* Set TPDU data */
memset((void*)pkgInfo.szData, 0x00, sizeof(pkgInfo.szData));
memcpy((void*)pkgInfo.szData, tpdu, tpduLen);
@@ -181,21 +180,18 @@ void SmsPluginSatHandler::sendSms(struct tapi_handle *handle, void *pData)
pkgInfo.MsgLength = tpduLen;
pkgInfo.format = TAPI_NETTEXT_NETTYPE_3GPP;
- // Set SMSC Address
+ /* Set SMSC Address */
SMS_ADDRESS_S smsc = {0,};
int simIndex = SmsPluginDSHandler::instance()->getSimIndex(handle);
- if (pSmsData->address.diallingNumberLen > 0)
- {
+ if (pSmsData->address.diallingNumberLen > 0) {
smsc.ton = pSmsData->address.ton;
smsc.npi = pSmsData->address.npi;
snprintf(smsc.address, sizeof(smsc.address), "%s", pSmsData->address.diallingNumber);
MSG_SEC_DEBUG("SCA TON[%d], NPI[%d], LEN[%d], ADDR[%s]", smsc.ton, smsc.npi, strlen(smsc.address), smsc.address);
- }
- else
- {
- // Set SMSC Options
+ } else {
+ /* Set SMSC Options */
SmsPluginTransport::instance()->setSmscOptions(simIndex, &smsc);
}
@@ -205,32 +201,30 @@ void SmsPluginSatHandler::sendSms(struct tapi_handle *handle, void *pData)
memset(smscAddr, 0x00, sizeof(smscAddr));
smscLen = SmsPluginParamCodec::encodeSMSC(&smsc, smscAddr);
- if (smscLen <= 0) return;
+ if (smscLen <= 0)
+ return;
- // Set SMSC Address
+ /* Set SMSC Address */
memset(pkgInfo.Sca, 0x00, sizeof(pkgInfo.Sca));
memcpy((void*)pkgInfo.Sca, smscAddr, smscLen);
pkgInfo.Sca[smscLen] = '\0';
int tapiRet = TAPI_API_SUCCESS;
- // Send SMS
+ /* Send SMS */
tapiRet = tel_send_sms(handle, &pkgInfo, 0, TapiEventSatSmsSentStatus, NULL);
- if (tapiRet == TAPI_API_SUCCESS)
- {
+ if (tapiRet == TAPI_API_SUCCESS) {
MSG_DEBUG("######## TelTapiSmsSend Success !!! return : %d #######", tapiRet);
- }
- else
- {
+ } else {
MSG_DEBUG("######## TelTapiSmsSend Fail !!! return : %d #######", tapiRet);
sendResult(handle, SMS_SAT_CMD_SEND_SMS, TAPI_SAT_R_BEYOND_ME_CAPABILITIES);
}
}
-void SmsPluginSatHandler::ctrlSms(struct tapi_handle *handle, void *pData)
+void SmsPluginSatHandler::ctrlSms(TapiHandle *handle, void *pData)
{
if (!pData) {
MSG_DEBUG("pData is NULL");
@@ -254,33 +248,24 @@ void SmsPluginSatHandler::ctrlSms(struct tapi_handle *handle, void *pData)
return;
#if 0
- if (bSendSms == true) // Send SMS By SAT
- {
- if (pCtrlData->moSmsCtrlResult == TAPI_SAT_CALL_CTRL_R_NOT_ALLOWED)
- {
+ if (bSendSms == true) { /* Send SMS By SAT */
+ if (pCtrlData->moSmsCtrlResult == TAPI_SAT_CALL_CTRL_R_NOT_ALLOWED) {
MSG_DEBUG("SIM does not allow to send SMS");
sendResult(SMS_SAT_CMD_SEND_SMS, TAPI_SAT_R_INTRCTN_WITH_CC_OR_SMS_CTRL_PRMNT_PRBLM);
- }
- else if (pCtrlData->moSmsCtrlResult == TAPI_SAT_CALL_CTRL_R_ALLOWED_WITH_MOD)
- {
+ } else if (pCtrlData->moSmsCtrlResult == TAPI_SAT_CALL_CTRL_R_ALLOWED_WITH_MOD) {
MSG_DEBUG("SIM allows to send SMS with modification");
sendResult(SMS_SAT_CMD_SEND_SMS, TAPI_SAT_R_SUCCESS);
}
- }
- else // Send SMS By APP
- {
+ } else { /* Send SMS By APP */
msg_network_status_t netStatus = MSG_NETWORK_NOT_SEND;
- if (pCtrlData->moSmsCtrlResult == TAPI_SAT_CALL_CTRL_R_NOT_ALLOWED)
- {
+ if (pCtrlData->moSmsCtrlResult == TAPI_SAT_CALL_CTRL_R_NOT_ALLOWED) {
MSG_DEBUG("SIM does not allow to send SMS");
netStatus = MSG_NETWORK_SEND_FAIL;
- }
- else if (pCtrlData->moSmsCtrlResult == TAPI_SAT_CALL_CTRL_R_ALLOWED_WITH_MOD)
- {
+ } else if (pCtrlData->moSmsCtrlResult == TAPI_SAT_CALL_CTRL_R_ALLOWED_WITH_MOD) {
MSG_DEBUG("SIM allows to send SMS with modification");
netStatus = MSG_NETWORK_SEND_SUCCESS;
@@ -293,7 +278,7 @@ void SmsPluginSatHandler::ctrlSms(struct tapi_handle *handle, void *pData)
}
-void SmsPluginSatHandler::ctrlSms(struct tapi_handle *handle, SMS_NETWORK_STATUS_T smsStatus)
+void SmsPluginSatHandler::ctrlSms(TapiHandle *handle, SMS_NETWORK_STATUS_T smsStatus)
{
MSG_DEBUG("SMS network status = [%d]", smsStatus);
@@ -513,11 +498,11 @@ int SmsPluginSatHandler::handleSatTpdu(unsigned char *pTpdu, unsigned char TpduL
int pos = 0;
- // TP-MTI, TP-RD, TP-VPF, TP-RP, TP-UDHI, TP-SRR
- // TP-VPF
+ /* TP-MTI, TP-RD, TP-VPF, TP-RP, TP-UDHI, TP-SRR */
+ /* TP-VPF */
SMS_VPF_T vpf = (SMS_VPF_T)(pTpdu[pos++] & 0x18) >> 3;
- // TP-MR
+ /* TP-MR */
unsigned char tmpRef = pTpdu[pos];
MSG_DEBUG("current Msg Ref : %d", tmpRef);
@@ -531,22 +516,21 @@ int SmsPluginSatHandler::handleSatTpdu(unsigned char *pTpdu, unsigned char TpduL
// pTpdu[pos++] = SmsPluginTransport::instance()->getMsgRef();
- // TP-DA
+ /* TP-DA */
SMS_ADDRESS_S destAddr = {0};
int addrLen = SmsPluginParamCodec::decodeAddress(&pTpdu[pos], &destAddr);
pos += addrLen;
- // TP-PID
+ /* TP-PID */
pos++;
- // TP-DCS
+ /* TP-DCS */
SMS_DCS_S dcs = {0};
int dcsLen = SmsPluginParamCodec::decodeDCS(&pTpdu[pos], &dcs);
- if (bIsPackingRequired == true)
- {
+ if (bIsPackingRequired == true) {
dcs.codingScheme = SMS_CHARSET_7BIT;
char* pDcs = NULL;
@@ -559,22 +543,17 @@ int SmsPluginSatHandler::handleSatTpdu(unsigned char *pTpdu, unsigned char TpduL
pos++;
- // TP-VP
+ /* TP-VP */
if (vpf == SMS_VPF_RELATIVE)
- {
pos += MAX_REL_TIME_PARAM_LEN;
- }
else if (vpf == SMS_VPF_ABSOLUTE)
- {
pos += MAX_ABS_TIME_PARAM_LEN;
- }
- // TP-UDL
+ /* TP-UDL */
int udl = pTpdu[pos];
int retLen = 0;
- if (bIsPackingRequired == true)
- {
+ if (bIsPackingRequired == true) {
SMS_USERDATA_S userData = {0};
userData.headerCnt = 0;
@@ -582,14 +561,28 @@ int SmsPluginSatHandler::handleSatTpdu(unsigned char *pTpdu, unsigned char TpduL
memcpy(userData.data, &pTpdu[pos+1], udl);
userData.data[udl] = '\0';
-MSG_DEBUG("user data : [%s]", userData.data);
-
- int encodeSize = SmsPluginUDCodec::encodeUserData(&userData, dcs.codingScheme, (char*)&pTpdu[pos]);
+ MSG_DEBUG("user data : [%s]", userData.data);
+
+ // check for user data whether it is 7-bit packed or not.
+ bool is7bitPacked = false;
+ int bitValue = 0;
+ for (int i = 0; i < userData.length; i++) {
+ bitValue = userData.data[i] & ( 1 << 7);
+ if (bitValue != 0) {
+ is7bitPacked = true;
+ MSG_DEBUG("user data is already 7-bit packed !!");
+ break;
+ }
+ }
- retLen = pos + encodeSize;
- }
- else
- {
+ if (!is7bitPacked) {
+ MSG_DEBUG("packing 8-bit user data to 7-bit charset !!");
+ int encodeSize = SmsPluginUDCodec::encodeUserData(&userData, dcs.codingScheme, (char*)&pTpdu[pos]);
+ retLen = pos + encodeSize;
+ } else {
+ retLen = TpduLen;
+ }
+ } else {
retLen = TpduLen;
}
@@ -597,24 +590,21 @@ MSG_DEBUG("user data : [%s]", userData.data);
}
-void SmsPluginSatHandler::sendResult(struct tapi_handle *handle, SMS_SAT_CMD_TYPE_T CmdType, int ResultType)
+void SmsPluginSatHandler::sendResult(TapiHandle *handle, SMS_SAT_CMD_TYPE_T CmdType, int ResultType)
{
TelSatAppsRetInfo_t satRetInfo;
memset(&satRetInfo, 0, sizeof(TelSatAppsRetInfo_t));
satRetInfo.commandId = commandId;
- MSG_DEBUG("satRetInfo.commandId [%d]", satRetInfo.commandId);
+ MSG_INFO("satRetInfo.commandId [%d]", satRetInfo.commandId);
- if (CmdType == SMS_SAT_CMD_REFRESH)
- {
+ if (CmdType == SMS_SAT_CMD_REFRESH) {
satRetInfo.commandType = TAPI_SAT_CMD_TYPE_REFRESH;
satRetInfo.appsRet.refresh.appType = TAPI_SAT_REFRESH_MSG;
satRetInfo.appsRet.refresh.resp = (TelSatResultType_t)ResultType;
- }
- else if (CmdType == SMS_SAT_CMD_SEND_SMS)
- {
+ } else if (CmdType == SMS_SAT_CMD_SEND_SMS) {
satRetInfo.commandType = TAPI_SAT_CMD_TYPE_SEND_SMS;
satRetInfo.appsRet.sendSms.resp = (TelSatResultType_t)ResultType;
@@ -625,13 +615,9 @@ void SmsPluginSatHandler::sendResult(struct tapi_handle *handle, SMS_SAT_CMD_TYP
tapiRet = tel_send_sat_app_exec_result(handle, &satRetInfo);
if (tapiRet == TAPI_API_SUCCESS)
- {
MSG_DEBUG("TelTapiSatSendAppExecutionResult() SUCCESS");
- }
else
- {
- MSG_DEBUG("TelTapiSatSendAppExecutionResult() FAIL [%d]", tapiRet);
- }
+ MSG_ERR("TelTapiSatSendAppExecutionResult() FAIL [%d]", tapiRet);
bInitSim = false;
bSMSPChanged = false;
diff --git a/plugin/sms_plugin/SmsPluginSetting.cpp b/plugin/sms_plugin/SmsPluginSetting.cpp
index cf88ba7..1b00ccb 100755
--- a/plugin/sms_plugin/SmsPluginSetting.cpp
+++ b/plugin/sms_plugin/SmsPluginSetting.cpp
@@ -36,8 +36,7 @@
#include "SmsPluginSetting.h"
#include "SmsPluginDSHandler.h"
-extern "C"
-{
+extern "C" {
#include <tapi_common.h>
#include <TelSms.h>
#include <TapiUtility.h>
@@ -59,15 +58,15 @@ SmsPluginSetting* SmsPluginSetting::pInstance = NULL;
SmsPluginSetting::SmsPluginSetting()
{
- // Initialize member variables
+ /* Initialize member variables */
for (int i = 0; i <= MAX_TELEPHONY_HANDLE_CNT; i++) {
- memset(&smscList[i], 0x00, sizeof(MSG_SMSC_LIST_S));
memset(&smscData[i], 0x00, sizeof(MSG_SMSC_DATA_S));
- memset(&cbOpt[i], 0x00, sizeof(MSG_CBMSG_OPT_S));
- memset(&simMailboxList[i], 0x00, sizeof(SMS_SIM_MAILBOX_LIST_S));
- memset(&simMwiInfo[i], 0x00, sizeof(SMS_SIM_MWI_INFO_S));
simStatus[i] = MSG_SIM_STATUS_NOT_FOUND;
}
+ smscList.clear();
+ simMailboxList.clear();
+ simMwiInfo.clear();
+ cbOpt.clear();
memset(&meImei, 0x00, sizeof(meImei));
bTapiResult = false;
@@ -82,8 +81,10 @@ SmsPluginSetting::SmsPluginSetting()
SmsPluginSetting::~SmsPluginSetting()
{
-
-
+ smscList.erase(smscList.begin(), smscList.end());
+ simMailboxList.erase(simMailboxList.begin(), simMailboxList.end());
+ simMwiInfo.erase(simMwiInfo.begin(), simMwiInfo.end());
+ cbOpt.erase(cbOpt.begin(), cbOpt.end());
}
@@ -101,7 +102,7 @@ void* SmsPluginSetting::initSimInfo(void *data)
static Mutex mm;
MutexLocker lock(mm);
- SmsPluginSetting::instance()->processInitSimInfo(data);
+ instance()->processInitSimInfo(data);
return NULL;
}
@@ -110,8 +111,8 @@ void* SmsPluginSetting::processInitSimInfo(void *data)
{
MSG_BEGIN();
- //Handle sim info initialization separately
- struct tapi_handle *handle = (struct tapi_handle *)data;
+ /* Handle sim info initialization separately */
+ TapiHandle *handle = (TapiHandle *)data;
instance()->updateSimStatus(handle);
MSG_END();
@@ -119,7 +120,7 @@ void* SmsPluginSetting::processInitSimInfo(void *data)
}
-void SmsPluginSetting::updateSimStatus(struct tapi_handle *handle)
+void SmsPluginSetting::updateSimStatus(TapiHandle *handle)
{
MSG_BEGIN();
@@ -136,13 +137,13 @@ void SmsPluginSetting::updateSimStatus(struct tapi_handle *handle)
int simIndex = SmsPluginDSHandler::instance()->getSimIndex(handle);
- // Get IMSI
+ /* Get IMSI */
TelSimImsiInfo_t imsiInfo;
memset(&imsiInfo, 0x00, sizeof(TelSimImsiInfo_t));
tapiRet = tel_get_sim_imsi(handle, &imsiInfo);
if (tapiRet != TAPI_API_SUCCESS) {
- MSG_DEBUG("tel_get_sim_imsi() Error![%d]", tapiRet);
+ MSG_SEC_DEBUG("tel_get_sim_imsi() Error![%d]", tapiRet);
}
/* Save Subcriber ID */
@@ -180,16 +181,13 @@ void SmsPluginSetting::updateSimStatus(struct tapi_handle *handle)
}
}
- // init config data.
+ /* init config data. */
initConfigData(handle);
- try
- {
- // init sim messages.
+ try {
+ /* init sim messages. */
SmsPluginSimMsg::instance()->initSimMessage(handle);
- }
- catch (MsgException& e)
- {
+ } catch (MsgException& e) {
MSG_FATAL("%s", e.what());
return;
}
@@ -201,7 +199,7 @@ void SmsPluginSetting::updateSimStatus(struct tapi_handle *handle)
}
-void SmsPluginSetting::initConfigData(struct tapi_handle *handle)
+void SmsPluginSetting::initConfigData(TapiHandle *handle)
{
MSG_BEGIN();
@@ -209,7 +207,7 @@ void SmsPluginSetting::initConfigData(struct tapi_handle *handle)
int sim_idx = SmsPluginDSHandler::instance()->getSimIndex(handle);
/*==================== SMSC setting ====================*/
- // Init SMS Parameter
+ /* Init SMS Parameter */
int paramCnt = 0;
int failCnt = 0;
bool bSelectedFound = false;
@@ -222,8 +220,7 @@ void SmsPluginSetting::initConfigData(struct tapi_handle *handle)
MSG_SMSC_DATA_S tmpSmscData = {};
MSG_SMSC_LIST_S tmpSmscList = {0,};
- for (int index = 0; index < paramCnt; index++)
- {
+ for (int index = 0; index < paramCnt; index++) {
memset(&tmpSmscData, 0x00, sizeof(MSG_SMSC_DATA_S));
if (getParam(handle, index, &tmpSmscData) == false) {
failCnt++;
@@ -240,7 +237,7 @@ void SmsPluginSetting::initConfigData(struct tapi_handle *handle)
MSG_DEBUG("npi[%d]", tmpSmscList.smscData[index].smscAddr.npi);
MSG_SEC_DEBUG("address[%s]", tmpSmscList.smscData[index].smscAddr.address);
- //First smsc is selected index
+ /* First smsc is selected index */
if (!bSelectedFound) {
tmpSmscList.selected = selectedParam;
bSelectedFound = !bSelectedFound;
@@ -256,8 +253,7 @@ void SmsPluginSetting::initConfigData(struct tapi_handle *handle)
}
/*==================== CB configuration ====================*/
- if (simStatus[sim_idx] != MSG_SIM_STATUS_NOT_FOUND)
- {
+ if (simStatus[sim_idx] != MSG_SIM_STATUS_NOT_FOUND) {
MSG_DEBUG("simStatus == [%d]", simStatus[sim_idx]);
MSG_CBMSG_OPT_S cbMsgOpt = {0,};
@@ -272,8 +268,7 @@ void SmsPluginSetting::initConfigData(struct tapi_handle *handle)
if (cbMsgOpt.bReceive == false && bAPReceive == false) {
MSG_DEBUG("CB is off in CP and in AP. No need to send CB request to CP. ");
- }
- else {
+ } else {
MSG_DEBUG("######## Add CB Option Success !!! #######");
MSG_SETTING_S cbSetting;
getCbOpt(&cbSetting, sim_idx);
@@ -302,11 +297,12 @@ void SmsPluginSetting::initConfigData(struct tapi_handle *handle)
if (simStatus[sim_idx] == MSG_SIM_STATUS_CHANGED) {
char keyName[MAX_VCONFKEY_NAME_LEN];
- MSG_DEBUG("=================SIM CHANGED===================");
+ MSG_INFO("=================SIM CHANGED===================");
+ /* reset default voicemail number and voicemail number */
memset(keyName, 0x00, sizeof(keyName));
- snprintf(keyName, sizeof(keyName), "%s/%d", VOICEMAIL_NUMBER, sim_idx);
- if (MsgSettingSetString(keyName, VOICEMAIL_DEFAULT_NUMBER) != MSG_SUCCESS)
+ snprintf(keyName, sizeof(keyName), "%s/%d", VOICEMAIL_DEFAULT_NUMBER, sim_idx);
+ if (MsgSettingSetString(keyName, "") != MSG_SUCCESS)
MSG_DEBUG("MsgSettingSetString is failed!!");
memset(keyName, 0x00, sizeof(keyName));
@@ -323,10 +319,52 @@ void SmsPluginSetting::initConfigData(struct tapi_handle *handle)
MsgDeleteNoti(MSG_NOTI_TYPE_VOICE_2, sim_idx);
}
+ /*==================== Default Voice mail Setting ====================*/
+ memset(keyName, 0x00, sizeof(keyName));
+ snprintf(keyName, sizeof(keyName), "%s/%d", VOICEMAIL_DEFAULT_NUMBER, sim_idx);
+ char *num = MsgSettingGetString(keyName);
+
+ if (num && num[0] != '\0') {
+ MSG_DEBUG("Voicemail Default Number [%s]", num);
+
+ memset(keyName, 0x00, sizeof(keyName));
+ snprintf(keyName, sizeof(keyName), "%s/%d", VOICEMAIL_NUMBER, sim_idx);
+
+ if (MsgSettingSetString(keyName, num) != MSG_SUCCESS)
+ MSG_DEBUG("MsgSettingSetInt is failed!!");
+
+ free(num);
+ num = NULL;
+ } else {
+ MSG_DEBUG("Voicemail Default Number is NULL");
+
+ memset(keyName, 0x00, sizeof(keyName));
+ snprintf(keyName, sizeof(keyName), "%s/%d", VOICEMAIL_NUMBER, sim_idx);
+
+ char *voicemail = MsgSettingGetString(keyName);
+
+ if (!voicemail || voicemail[0] == '\0') {
+ if (MsgSettingSetString(keyName, "") != MSG_SUCCESS)
+ MSG_DEBUG("MsgSettingSetInt is failed!!");
+ }
+ }
/*==================== Voice mail information update ====================*/
if (getVoiceMailInfo(handle) == true) {
MSG_DEBUG("######## getVoiceMailInfo Success !!! #######");
+ memset(keyName, 0x00, sizeof(keyName));
+ snprintf(keyName, sizeof(keyName), "%s/%d", VOICEMAIL_NUMBER, sim_idx);
+
+ char *voiceNumber = MsgSettingGetString(keyName);
+
+ if (!voiceNumber || (voiceNumber && voiceNumber[0] == '\0')) {
+ MSG_WARN("Voice Number is Empty!!");
+ }
+
+ if (voiceNumber) {
+ free(voiceNumber);
+ voiceNumber = NULL;
+ }
} else {
MSG_WARN("######## getVoiceMailInfo Fail !!! #######");
}
@@ -337,7 +375,7 @@ void SmsPluginSetting::initConfigData(struct tapi_handle *handle)
} else {
MSG_WARN("######## getMwiInfo Fail !!! #######");
- // Get MWI from vconf and insert notification
+ /* Get MWI from vconf and insert notification */
int mwiCnt = 0;
char keyName[MAX_VCONFKEY_NAME_LEN];
memset(keyName, 0x00, sizeof(keyName));
@@ -365,7 +403,7 @@ void SmsPluginSetting::initConfigData(struct tapi_handle *handle)
}
-void SmsPluginSetting::SimRefreshCb(struct tapi_handle *handle)
+void SmsPluginSetting::SimRefreshCb(TapiHandle *handle)
{
pthread_t thd;
@@ -380,8 +418,7 @@ void SmsPluginSetting::SimRefreshCb(struct tapi_handle *handle)
void* SmsPluginSetting::init_config_data(void *data)
{
- struct tapi_handle *handle = (struct tapi_handle *)data;
-
+ TapiHandle *handle = (TapiHandle *)data;
instance()->initConfigData(handle);
return NULL;
}
@@ -391,29 +428,28 @@ void SmsPluginSetting::setConfigData(const MSG_SETTING_S *pSetting)
{
MSG_DEBUG("Setting Type : [%d]", pSetting->type);
- switch (pSetting->type)
- {
+ switch (pSetting->type) {
#if 0
- case MSG_SMS_SENDOPT :
- setNetworkMode(&pSetting->option.smsSendOpt);
- break;
+ case MSG_SMS_SENDOPT :
+ setNetworkMode(&pSetting->option.smsSendOpt);
+ break;
#endif
- case MSG_SMSC_LIST :
- setParamList(&pSetting->option.smscList);
- addSMSCList((MSG_SMSC_LIST_S *)(&pSetting->option.smscList));
-// setSmscInfo(&pSetting->option.smscList);
- break;
- case MSG_CBMSG_OPT :
- if (setCbConfig(&pSetting->option.cbMsgOpt) == false) {
- THROW(MsgException::SMS_PLG_ERROR, "Failed to set config.");
- }
- break;
- case MSG_VOICEMAIL_OPT:
- setVoiceMailInfo(&pSetting->option.voiceMailOpt);
- break;
- default :
- THROW(MsgException::SMS_PLG_ERROR, "The Setting type is not supported. [%d]", pSetting->type);
- break;
+ case MSG_SMSC_LIST :
+ setParamList(&pSetting->option.smscList);
+ addSMSCList((MSG_SMSC_LIST_S *)(&pSetting->option.smscList));
+// setSmscInfo(&pSetting->option.smscList);
+ break;
+ case MSG_CBMSG_OPT :
+ if (setCbConfig(&pSetting->option.cbMsgOpt) == false) {
+ THROW(MsgException::SMS_PLG_ERROR, "Failed to set config.");
+ }
+ break;
+ case MSG_VOICEMAIL_OPT:
+ setVoiceMailInfo(&pSetting->option.voiceMailOpt);
+ break;
+ default :
+ THROW(MsgException::SMS_PLG_ERROR, "The Setting type is not supported. [%d]", pSetting->type);
+ break;
}
}
@@ -422,21 +458,20 @@ void SmsPluginSetting::getConfigData(MSG_SETTING_S *pSetting)
{
MSG_DEBUG("Setting Type : [%d]", pSetting->type);
- switch (pSetting->type)
- {
- case MSG_SMSC_LIST :
-// getParamList(&pSetting->option.smscList);
- getSmscListInfo(pSetting->option.smscList.simIndex, &(pSetting->option.smscList));
+ switch (pSetting->type) {
+ case MSG_SMSC_LIST :
+// getParamList(&pSetting->option.smscList);
+ getSmscListInfo(pSetting->option.smscList.simIndex, &(pSetting->option.smscList));
break;
- case MSG_CBMSG_OPT :
- if (getCbConfig(&pSetting->option.cbMsgOpt) == false) {
- THROW(MsgException::SMS_PLG_ERROR, "Get CB config option failed.");
- }
+ case MSG_CBMSG_OPT :
+ if (getCbConfig(&pSetting->option.cbMsgOpt) == false) {
+ THROW(MsgException::SMS_PLG_ERROR, "Get CB config option failed.");
+ }
break;
- default :
- THROW(MsgException::SMS_PLG_ERROR, "The Setting type is not supported. [%d]", pSetting->type);
+ default :
+ THROW(MsgException::SMS_PLG_ERROR, "The Setting type is not supported. [%d]", pSetting->type);
break;
}
}
@@ -452,8 +487,7 @@ void SmsPluginSetting::addSMSCList(MSG_SMSC_LIST_S *pSmscList)
MSG_DEBUG("total_count[%d]", pSmscList->totalCnt);
MSG_DEBUG("selected index[%d]", pSmscList->selected);
- for (int i = 0; i < pSmscList->totalCnt; i++)
- {
+ for (int i = 0; i < pSmscList->totalCnt; i++) {
MSG_DEBUG("pid[%d]", pSmscList->smscData[i].pid);
MSG_DEBUG("val_period[%d]", pSmscList->smscData[i].valPeriod);
MSG_SEC_DEBUG("name[%s]", pSmscList->smscData[i].name);
@@ -465,27 +499,33 @@ void SmsPluginSetting::addSMSCList(MSG_SMSC_LIST_S *pSmscList)
sim_index = pSmscList->simIndex;
- smscList[sim_index].simIndex = pSmscList->simIndex;
- smscList[sim_index].totalCnt = pSmscList->totalCnt;
- smscList[sim_index].selected = pSmscList->selected;
-
- for (int i = 0; i < pSmscList->totalCnt; i++) {
-
- smscList[sim_index].smscData[i].pid = pSmscList->smscData[i].pid;
- smscList[sim_index].smscData[i].valPeriod = pSmscList->smscData[i].valPeriod;
-
- memset(smscList[sim_index].smscData[i].name, 0x00, SMSC_NAME_MAX+1);
- memcpy(smscList[sim_index].smscData[i].name, pSmscList->smscData[i].name, SMSC_NAME_MAX);
-
- memset(smscList[sim_index].smscData[i].smscAddr.address, 0x00, SMSC_ADDR_MAX+1);
- memcpy(smscList[sim_index].smscData[i].smscAddr.address, pSmscList->smscData[i].smscAddr.address, SMSC_ADDR_MAX);
-
- if (pSmscList->smscData[i].smscAddr.address[0] == '+')
- smscList[sim_index].smscData[i].smscAddr.ton = MSG_TON_INTERNATIONAL;
- else
- smscList[sim_index].smscData[i].smscAddr.ton = MSG_TON_NATIONAL;
-
- smscList[sim_index].smscData[i].smscAddr.npi = MSG_NPI_ISDN; // app cannot set this value
+ smscListMap::iterator it = smscList.find(pSmscList->simIndex);
+ if (it == smscList.end()) {
+ pair<int, MSG_SMSC_LIST_S> newList(sim_index, *pSmscList);
+ smscList.insert(newList);
+ } else {
+ /* update the list. */
+ MSG_SMSC_LIST_S &pTmpSmscList = it->second;
+ pTmpSmscList.simIndex = pSmscList->simIndex;
+ pTmpSmscList.totalCnt = pSmscList->totalCnt;
+ pTmpSmscList.selected = pSmscList->selected;
+
+ for (int i = 0; i < pSmscList->totalCnt; i++) {
+ pTmpSmscList.smscData[i].pid = pSmscList->smscData[i].pid;
+ pTmpSmscList.smscData[i].valPeriod = pSmscList->smscData[i].valPeriod;
+ memset(pTmpSmscList.smscData[i].name, 0x00, SMSC_NAME_MAX+1);
+ memcpy(pTmpSmscList.smscData[i].name, pSmscList->smscData[i].name, SMSC_NAME_MAX);
+
+ memset(pTmpSmscList.smscData[i].smscAddr.address, 0x00, SMSC_ADDR_MAX+1);
+ memcpy(pTmpSmscList.smscData[i].smscAddr.address, pSmscList->smscData[i].smscAddr.address, SMSC_ADDR_MAX);
+
+ if (pTmpSmscList.smscData[i].smscAddr.address[0] == '+')
+ pTmpSmscList.smscData[i].smscAddr.ton = MSG_TON_INTERNATIONAL;
+ else
+ pTmpSmscList.smscData[i].smscAddr.ton = MSG_TON_NATIONAL;
+
+ pTmpSmscList.smscData[i].smscAddr.npi = MSG_NPI_ISDN; // app cannot set this value
+ }
}
MSG_END();
@@ -500,14 +540,20 @@ void SmsPluginSetting::getSmscListInfo(int simIndex, MSG_SMSC_LIST_S *pSmscList)
}
if (simIndex <= 0) {
- struct tapi_handle *handle = SmsPluginDSHandler::instance()->getTelHandle(simIndex);
+ TapiHandle *handle = SmsPluginDSHandler::instance()->getTelHandle(simIndex);
simIndex = SmsPluginDSHandler::instance()->getSimIndex(handle);
}
- if (simIndex == -1)
- memset(pSmscList, 0x00, sizeof(MSG_SMSC_LIST_S));
- else
- memcpy(pSmscList, &smscList[simIndex], sizeof(MSG_SMSC_LIST_S));
+ memset(pSmscList, 0x00, sizeof(MSG_SMSC_LIST_S));
+
+ if (simIndex != -1) {
+ smscListMap::iterator it = smscList.find(simIndex);
+ if (it != smscList.end()) {
+ MSG_SMSC_LIST_S &pTmpSmscList = it->second;
+ memcpy(pSmscList, &pTmpSmscList, sizeof(MSG_SMSC_LIST_S));
+ MSG_SEC_DEBUG("SMSC number for sim index [%d] is [%s]", pSmscList->simIndex, pSmscList->smscData[pSmscList->selected].smscAddr.address);
+ }
+ }
return;
}
@@ -522,8 +568,7 @@ msg_error_t SmsPluginSetting::addCbOpt(MSG_CBMSG_OPT_S *pCbOpt)
MSG_DEBUG("Channel Count [%d]", pCbOpt->channelData.channelCnt);
- for (int i = 0; i < pCbOpt->channelData.channelCnt; i++)
- {
+ for (int i = 0; i < pCbOpt->channelData.channelCnt; i++) {
MSG_DEBUG("Channel FROM [%d], Channel TO [%d]", pCbOpt->channelData.channelInfo[i].from, pCbOpt->channelData.channelInfo[i].to);
}
@@ -623,7 +668,7 @@ void SmsPluginSetting::setParamList(const MSG_SMSC_LIST_S *pSMSCList)
smsParam.ParamIndicator = 0x00;
if (strlen(pSMSCList->smscData[index].smscAddr.address) > 0) {
- smsParam.ParamIndicator |= 0x02 ; //enable 2nd Bit
+ smsParam.ParamIndicator |= 0x02 ; /* enable 2nd Bit */
MSG_DEBUG("ParamIndicator = [%02x]", smsParam.ParamIndicator);
if (pSMSCList->smscData[index].smscAddr.address[0] == '+')
@@ -631,7 +676,7 @@ void SmsPluginSetting::setParamList(const MSG_SMSC_LIST_S *pSMSCList)
else
smsParam.TpSvcCntrAddr.Ton = TAPI_SIM_TON_NATIONAL;
- smsParam.TpSvcCntrAddr.Npi = TAPI_SIM_NPI_ISDN_TEL; // app cannot set this value
+ smsParam.TpSvcCntrAddr.Npi = TAPI_SIM_NPI_ISDN_TEL; /* app cannot set this value */
MSG_DEBUG("SMSC TON = [%d] NPI = [%d]", smsParam.TpSvcCntrAddr.Ton, smsParam.TpSvcCntrAddr.Npi);
@@ -643,13 +688,13 @@ void SmsPluginSetting::setParamList(const MSG_SMSC_LIST_S *pSMSCList)
}
/*Setting the PID value*/
- smsParam.ParamIndicator |= 0x04 ; //enable 3nd Bit
+ smsParam.ParamIndicator |= 0x04 ; /* enable 3rd Bit */
MSG_DEBUG("ParamIndicator = [%02x]", smsParam.ParamIndicator);
smsParam.TpProtocolId = (unsigned short)convertPid(pSMSCList->smscData[index].pid);
/*Setting the ValidityPeriod value*/
- smsParam.ParamIndicator |= 0x10 ; //enable 5nd Bit
+ smsParam.ParamIndicator |= 0x10 ; /* enable 5th Bit */
MSG_DEBUG("ParamIndicator = [%02x]", smsParam.ParamIndicator);
smsParam.TpValidityPeriod = (unsigned short)pSMSCList->smscData[index].valPeriod;
@@ -658,7 +703,7 @@ void SmsPluginSetting::setParamList(const MSG_SMSC_LIST_S *pSMSCList)
MSG_DEBUG("ParamIndicator = [%02x]", smsParam.ParamIndicator);
/* Get TAPI handle */
- struct tapi_handle *handle = SmsPluginDSHandler::instance()->getTelHandle(pSMSCList->simIndex);
+ TapiHandle *handle = SmsPluginDSHandler::instance()->getTelHandle(pSMSCList->simIndex);
ret = tel_set_sms_parameters(handle, (const TelSmsParams_t*)&smsParam, TapiEventSetConfigData, NULL);
@@ -679,7 +724,7 @@ void SmsPluginSetting::getParamList(MSG_SMSC_LIST_S *pSMSCList)
int paramCnt = 0;
MSG_SEC_DEBUG("SIM index [%d]", pSMSCList->simIndex);
- struct tapi_handle *handle = SmsPluginDSHandler::instance()->getTelHandle(pSMSCList->simIndex);
+ TapiHandle *handle = SmsPluginDSHandler::instance()->getTelHandle(pSMSCList->simIndex);
paramCnt = getParamCount(handle);
MSG_DEBUG("Parameter Count [%d]", paramCnt);
@@ -723,7 +768,7 @@ void SmsPluginSetting::getParamList(MSG_SMSC_LIST_S *pSMSCList)
}
-int SmsPluginSetting::getParamCount(struct tapi_handle *handle)
+int SmsPluginSetting::getParamCount(TapiHandle *handle)
{
int ret = TAPI_API_SUCCESS;
@@ -739,7 +784,7 @@ int SmsPluginSetting::getParamCount(struct tapi_handle *handle)
}
-bool SmsPluginSetting::getParam(struct tapi_handle *handle, int Index, MSG_SMSC_DATA_S *pSmscData)
+bool SmsPluginSetting::getParam(TapiHandle *handle, int Index, MSG_SMSC_DATA_S *pSmscData)
{
int ret = TAPI_API_SUCCESS;
@@ -771,7 +816,7 @@ void SmsPluginSetting::setSmscInfo(const MSG_SMSC_LIST_S *pSmscList)
int ret = TAPI_API_SUCCESS;
- struct tapi_handle *handle = NULL;
+ TapiHandle *handle = NULL;
handle = SmsPluginDSHandler::instance()->getTelHandle(pSmscList->simIndex);
@@ -790,7 +835,7 @@ void SmsPluginSetting::setSmscInfo(const MSG_SMSC_LIST_S *pSmscList)
else
sca.Ton = TAPI_SIM_TON_NATIONAL;
- sca.Npi = TAPI_SIM_NPI_ISDN_TEL; // app cannot set this value
+ sca.Npi = TAPI_SIM_NPI_ISDN_TEL; /* app cannot set this value */
MSG_SEC_DEBUG("SMSC TON = [%d], NPI = [%d], Address = [%s]", sca.Ton, sca.Npi, pSmscData->smscAddr.address);
@@ -813,7 +858,7 @@ void SmsPluginSetting::setSmscInfo(const MSG_SMSC_LIST_S *pSmscList)
bool SmsPluginSetting::setCbConfig(const MSG_CBMSG_OPT_S *pCbOpt)
{
- struct tapi_handle *handle = NULL;
+ TapiHandle *handle = NULL;
int simCnt = SmsPluginDSHandler::instance()->getTelHandleCount();
TelSmsCbConfig_t cbConfig = {};
@@ -822,7 +867,7 @@ bool SmsPluginSetting::setCbConfig(const MSG_CBMSG_OPT_S *pCbOpt)
int ret = TAPI_API_SUCCESS;
if (pCbOpt->bReceive == true)
- cbEnabled = 2;// Need to get a Enumeration from TAPI, currently it is not available
+ cbEnabled = 2;/* Need to get a Enumeration from TAPI, currently it is not available */
MSG_DEBUG("simIndex:%d, cbEnabled:%d", pCbOpt->simIndex, cbEnabled);
@@ -847,14 +892,13 @@ bool SmsPluginSetting::setCbConfig(const MSG_CBMSG_OPT_S *pCbOpt)
handle = SmsPluginDSHandler::instance()->getTelHandle(i);
memset(&cbConfig, 0x00, sizeof(TelSmsCbConfig_t));
-
- MSG_SETTING_S cbSetting;
- getCbOpt(&cbSetting, i);
-
cbConfig.CBEnabled = cbEnabled;
cbConfig.Net3gppType = TAPI_NETTEXT_NETTYPE_3GPP;
- /*cbConfig.CBEnabled = (int)pCbOpt->bReceive;
+ /*MSG_SETTING_S cbSetting;
+ getCbOpt(&cbSetting, i);
+
+ cbConfig.CBEnabled = (int)pCbOpt->bReceive;
cbConfig.Net3gppType = TAPI_NETTEXT_NETTYPE_3GPP;
cbConfig.MsgIdMaxCount = cbSetting.option.cbMsgOpt.maxSimCnt;
cbConfig.MsgIdRangeCount = cbSetting.option.cbMsgOpt.channelData.channelCnt;
@@ -939,7 +983,7 @@ bool SmsPluginSetting::getCbConfig(MSG_CBMSG_OPT_S *pCbOpt)
{
int ret = TAPI_API_SUCCESS;
- struct tapi_handle *handle = NULL;
+ TapiHandle *handle = NULL;
if (pCbOpt->simIndex == 0) {
MSG_DEBUG("SIM Index for getCBConfig = 0, CANNOT get cbconfig from SIM 0");
@@ -970,10 +1014,11 @@ bool SmsPluginSetting::getCbConfig(MSG_CBMSG_OPT_S *pCbOpt)
void SmsPluginSetting::setVoiceMailInfo(const MSG_VOICEMAIL_OPT_S *pVoiceOpt)
{
+ MSG_BEGIN();
MutexLocker lock(mx);
int ret = TAPI_API_SUCCESS;
- bool *bShowError = NULL; //When invalid voicemail data exists on SIM, update error should not be handled.
+ bool *bShowError = NULL; /* When invalid voicemail data exists on SIM, update error should not be handled. */
int simIndex = pVoiceOpt->simIndex;
@@ -986,7 +1031,13 @@ void SmsPluginSetting::setVoiceMailInfo(const MSG_VOICEMAIL_OPT_S *pVoiceOpt)
bool bExistVoicetype = false;
int i = 0;
- if (simMailboxList[simIndex].count < 0) { /* Not available */
+ smsSimMailboxListMap::iterator it = simMailboxList.find(simIndex);
+ if (it == simMailboxList.end()) {
+ return;
+ }
+
+ SMS_SIM_MAILBOX_LIST_S &pTmpSimMailboxList = it->second;
+ if (pTmpSimMailboxList.count < 0) { /* Not available */
return;
}
@@ -994,7 +1045,7 @@ void SmsPluginSetting::setVoiceMailInfo(const MSG_VOICEMAIL_OPT_S *pVoiceOpt)
if (!bShowError)
return;
- if (simMailboxList[simIndex].count == 0) {
+ if (pTmpSimMailboxList.count == 0) {
char num[MAX_PHONE_NUMBER_LEN + 1] = {0,};
mailboxInfo.mb_type = TAPI_SIM_MAILBOX_VOICE;
@@ -1016,8 +1067,8 @@ void SmsPluginSetting::setVoiceMailInfo(const MSG_VOICEMAIL_OPT_S *pVoiceOpt)
*bShowError = false;
} else {
- for (i = 0; i < simMailboxList[simIndex].count; i++) {
- if (simMailboxList[simIndex].list[i].mb_type == TAPI_SIM_MAILBOX_VOICE) {
+ for (i = 0; i < pTmpSimMailboxList.count; i++) {
+ if (pTmpSimMailboxList.list[i].mb_type == TAPI_SIM_MAILBOX_VOICE) {
bExistVoicetype = true;
break;
}
@@ -1026,48 +1077,51 @@ void SmsPluginSetting::setVoiceMailInfo(const MSG_VOICEMAIL_OPT_S *pVoiceOpt)
if (bExistVoicetype == false) {
*bShowError = false;
/* There is no mailbox information for voicemail type on SIM. */
- for (i = 0; i < simMailboxList[simIndex].count; i++) {
- if (simMailboxList[simIndex].list[i].mb_type < TAPI_SIM_MAILBOX_VOICE || simMailboxList[simIndex].list[i].mb_type > TAPI_SIM_MAILBOX_OTHER) {
- simMailboxList[simIndex].list[i].mb_type = TAPI_SIM_MAILBOX_VOICE;
+ for (i = 0; i < pTmpSimMailboxList.count; i++) {
+ if (pTmpSimMailboxList.list[i].mb_type < TAPI_SIM_MAILBOX_VOICE || pTmpSimMailboxList.list[i].mb_type > TAPI_SIM_MAILBOX_OTHER) {
+ pTmpSimMailboxList.list[i].mb_type = TAPI_SIM_MAILBOX_VOICE;
break;
}
}
}
/* if strlen of voicemail number retrieved from SIM is zero, error is not shown */
- if(simMailboxList[simIndex].list[i].num_len == 0) {
+ if (pTmpSimMailboxList.list[i].num_len == 0) {
MSG_DEBUG("In SIM voicemail does not exist");
*bShowError = false;
+ } else if (pTmpSimMailboxList.list[i].num_len > 0) {
+ MSG_DEBUG("In SIM voicemail exist");
+ *bShowError = true;
}
MSG_INFO("bShowError = %d", *bShowError);
- memset(&simMailboxList[simIndex].list[i].num, 0x00, sizeof(simMailboxList[simIndex].list[i].num));
- snprintf(simMailboxList[simIndex].list[i].num, sizeof(simMailboxList[simIndex].list[i].num), "%s", pVoiceOpt->mailNumber);
- MSG_DEBUG("Mailbox number config [%s]", simMailboxList[simIndex].list[i].num);
-
- mailboxInfo.b_cphs = simMailboxList[simIndex].list[i].b_cphs;
- mailboxInfo.alpha_id_max_len = simMailboxList[simIndex].list[i].alpha_id_max_len;
- mailboxInfo.mb_type = (TelSimMailboxType_t)simMailboxList[simIndex].list[i].mb_type;
- mailboxInfo.profile_num = simMailboxList[simIndex].list[i].profile_num;
- mailboxInfo.rec_index = (simMailboxList[simIndex].list[i].rec_index == 0) ? 1 : simMailboxList[simIndex].list[i].rec_index;
- mailboxInfo.ton = (TelSimTypeOfNum_t)simMailboxList[simIndex].list[i].ton;
- mailboxInfo.npi = (TelSimNumberingPlanIdentity_t)simMailboxList[simIndex].list[i].npi;
- snprintf(mailboxInfo.alpha_id, sizeof(mailboxInfo.alpha_id), "%s", simMailboxList[simIndex].list[i].alpha_id);
-
- if (simMailboxList[simIndex].list[i].num[0] == '+') {
- snprintf(mailboxInfo.num, sizeof(mailboxInfo.num), "%s", &(simMailboxList[simIndex].list[i].num[1]));
+ memset(&pTmpSimMailboxList.list[i].num, 0x00, sizeof(pTmpSimMailboxList.list[i].num));
+ snprintf(pTmpSimMailboxList.list[i].num, sizeof(pTmpSimMailboxList.list[i].num), "%s", pVoiceOpt->mailNumber);
+ MSG_DEBUG("Mailbox number config [%s]", pTmpSimMailboxList.list[i].num);
+
+ mailboxInfo.b_cphs = pTmpSimMailboxList.list[i].b_cphs;
+ mailboxInfo.alpha_id_max_len = pTmpSimMailboxList.list[i].alpha_id_max_len;
+ mailboxInfo.mb_type = (TelSimMailboxType_t)pTmpSimMailboxList.list[i].mb_type;
+ mailboxInfo.profile_num = pTmpSimMailboxList.list[i].profile_num;
+ mailboxInfo.rec_index = (pTmpSimMailboxList.list[i].rec_index == 0) ? 1 : pTmpSimMailboxList.list[i].rec_index;
+ mailboxInfo.ton = (TelSimTypeOfNum_t)pTmpSimMailboxList.list[i].ton;
+ mailboxInfo.npi = (TelSimNumberingPlanIdentity_t)pTmpSimMailboxList.list[i].npi;
+ snprintf(mailboxInfo.alpha_id, sizeof(mailboxInfo.alpha_id), "%s", pTmpSimMailboxList.list[i].alpha_id);
+
+ if (pTmpSimMailboxList.list[i].num[0] == '+') {
+ snprintf(mailboxInfo.num, sizeof(mailboxInfo.num), "%s", &(pTmpSimMailboxList.list[i].num[1]));
mailboxInfo.ton = TAPI_SIM_TON_INTERNATIONAL;
} else {
- snprintf(mailboxInfo.num, sizeof(mailboxInfo.num), "%s", simMailboxList[simIndex].list[i].num);
+ snprintf(mailboxInfo.num, sizeof(mailboxInfo.num), "%s", pTmpSimMailboxList.list[i].num);
}
MSG_DEBUG("Mailbox number to save sim [%s]", mailboxInfo.num);
- mailboxInfo.cc_id = simMailboxList[simIndex].list[i].cc_id;
- mailboxInfo.ext1_id = simMailboxList[simIndex].list[i].ext1_id;
+ mailboxInfo.cc_id = pTmpSimMailboxList.list[i].cc_id;
+ mailboxInfo.ext1_id = pTmpSimMailboxList.list[i].ext1_id;
}
- struct tapi_handle *handle = SmsPluginDSHandler::instance()->getTelHandle(simIndex);
+ TapiHandle *handle = SmsPluginDSHandler::instance()->getTelHandle(simIndex);
ret = tel_set_sim_mailbox_info(handle, &mailboxInfo, TapiEventSetMailboxInfo, (void*)bShowError);
@@ -1080,21 +1134,24 @@ void SmsPluginSetting::setVoiceMailInfo(const MSG_VOICEMAIL_OPT_S *pVoiceOpt)
if (getResultFromSim() == true) {
MSG_DEBUG("######## Set mailbox info Success !!! #######");
} else {
- if(bShowError)
+ if (bShowError)
free(bShowError);
THROW(MsgException::SMS_PLG_ERROR, "######## Set mailbox info Failed !!!#######");
MSG_ERR("######## Set mailbox info Failed !!! #######");
}
- if(bShowError)
+ if (bShowError)
free(bShowError);
+ MSG_END();
return;
}
-bool SmsPluginSetting::getVoiceMailInfo(struct tapi_handle *handle)
+bool SmsPluginSetting::getVoiceMailInfo(TapiHandle *handle)
{
+ MutexLocker lock(mx);
+
int ret = TAPI_API_SUCCESS;
ret = tel_get_sim_mailbox_info(handle, TapiEventGetMailboxInfo, NULL);
@@ -1121,7 +1178,7 @@ void SmsPluginSetting::getMeImei(char *pImei)
{
int ret = TAPI_API_SUCCESS;
- struct tapi_handle *handle = NULL;
+ TapiHandle *handle = NULL;
handle = SmsPluginDSHandler::instance()->getTelHandle(1);
if (handle == NULL) {
@@ -1173,24 +1230,35 @@ void SmsPluginSetting::setMwiInfo(int simIndex, MSG_SUB_TYPE_T type, int count)
int ret = TAPI_API_SUCCESS;
TelSimMessageWaitingReq_t mwReq = {0,};
- MSG_DEBUG("SET MWI INFO, CPHS? [%s]", simMwiInfo[simIndex].b_cphs?"Yes":"No");
+ simMwiInfoMap::iterator iter = simMwiInfo.find(simIndex);
+ if(iter == simMwiInfo.end()) {
+ MSG_DEBUG("IT is not present");
+ return;
+ }
+
+ MSG_DEBUG("IT is present");
+
+ SMS_SIM_MWI_INFO_S &pTmpsimMwiInfo = iter->second;
- if (simMwiInfo[simIndex].b_cphs) {
+ MSG_DEBUG("SET MWI INFO, CPHS? [%s]", pTmpsimMwiInfo.b_cphs?"Yes":"No");
+
+ if (pTmpsimMwiInfo.b_cphs) {
+ MSG_DEBUG("b_cphs is set");
if (type == MSG_MWI_VOICE_SMS)
- simMwiInfo[simIndex].cphs_mwi.b_voice1 = (count > 0 ? 1:0);
+ pTmpsimMwiInfo.cphs_mwi.b_voice1 = (count > 0 ? 1:0);
else if (type == MSG_MWI_VOICE2_SMS)
- simMwiInfo[simIndex].cphs_mwi.b_voice2 = (count > 0 ? 1:0);
+ pTmpsimMwiInfo.cphs_mwi.b_voice2 = (count > 0 ? 1:0);
else if (type == MSG_MWI_FAX_SMS)
- simMwiInfo[simIndex].cphs_mwi.b_fax = (count > 0 ? 1:0);
+ pTmpsimMwiInfo.cphs_mwi.b_fax = (count > 0 ? 1:0);
else {
MSG_DEBUG("There is no type [%d] in CPHS.", type);
return;
}
- mwReq.mw_data_u.cphs_mw.b_voice1 = simMwiInfo[simIndex].cphs_mwi.b_voice1;
- mwReq.mw_data_u.cphs_mw.b_voice2 = simMwiInfo[simIndex].cphs_mwi.b_voice2;
- mwReq.mw_data_u.cphs_mw.b_fax = simMwiInfo[simIndex].cphs_mwi.b_fax;
- mwReq.mw_data_u.cphs_mw.b_data = simMwiInfo[simIndex].cphs_mwi.b_data;
+ mwReq.mw_data_u.cphs_mw.b_voice1 = pTmpsimMwiInfo.cphs_mwi.b_voice1;
+ mwReq.mw_data_u.cphs_mw.b_voice2 = pTmpsimMwiInfo.cphs_mwi.b_voice2;
+ mwReq.mw_data_u.cphs_mw.b_fax = pTmpsimMwiInfo.cphs_mwi.b_fax;
+ mwReq.mw_data_u.cphs_mw.b_data = pTmpsimMwiInfo.cphs_mwi.b_data;
MSG_DEBUG("MWI voice 1 = [%d]", mwReq.mw_data_u.cphs_mw.b_voice1);
MSG_DEBUG("MWI voice 2 = [%d]", mwReq.mw_data_u.cphs_mw.b_voice2);
@@ -1198,22 +1266,29 @@ void SmsPluginSetting::setMwiInfo(int simIndex, MSG_SUB_TYPE_T type, int count)
MSG_DEBUG("MWI data = [%d]", mwReq.mw_data_u.cphs_mw.b_data);
} else {
+ MSG_DEBUG("b_cphs is not set");
+
if (type == MSG_MWI_VOICE_SMS)
- simMwiInfo[simIndex].mwi_list.mw_info[0].voice_count = count;
+ pTmpsimMwiInfo.mwi_list.mw_info[0].voice_count = count;
else if (type == MSG_MWI_FAX_SMS)
- simMwiInfo[simIndex].mwi_list.mw_info[0].fax_count = count;
+ pTmpsimMwiInfo.mwi_list.mw_info[0].fax_count = count;
else if (type == MSG_MWI_EMAIL_SMS)
- simMwiInfo[simIndex].mwi_list.mw_info[0].email_count = count;
- else // MSG_MWI_OTHER_SMS
- simMwiInfo[simIndex].mwi_list.mw_info[0].other_count = count;
-
- mwReq.mw_data_u.mw.rec_index = simMwiInfo[simIndex].mwi_list.mw_info[0].rec_index;
- mwReq.mw_data_u.mw.indicator_status = simMwiInfo[simIndex].mwi_list.mw_info[0].indicator_status;
- mwReq.mw_data_u.mw.voice_count = simMwiInfo[simIndex].mwi_list.mw_info[0].voice_count;
- mwReq.mw_data_u.mw.fax_count = simMwiInfo[simIndex].mwi_list.mw_info[0].fax_count;
- mwReq.mw_data_u.mw.email_count = simMwiInfo[simIndex].mwi_list.mw_info[0].email_count;
- mwReq.mw_data_u.mw.other_count = simMwiInfo[simIndex].mwi_list.mw_info[0].other_count;
- mwReq.mw_data_u.mw.video_count = simMwiInfo[simIndex].mwi_list.mw_info[0].video_count;
+ pTmpsimMwiInfo.mwi_list.mw_info[0].email_count = count;
+ else /* MSG_MWI_OTHER_SMS */
+ pTmpsimMwiInfo.mwi_list.mw_info[0].other_count = count;
+
+ mwReq.mw_data_u.mw.rec_index = pTmpsimMwiInfo.mwi_list.mw_info[0].rec_index;
+
+ if (count <= 0)
+ mwReq.mw_data_u.mw.indicator_status = 0x00;
+ else
+ mwReq.mw_data_u.mw.indicator_status = 0x01;
+
+ mwReq.mw_data_u.mw.voice_count = pTmpsimMwiInfo.mwi_list.mw_info[0].voice_count;
+ mwReq.mw_data_u.mw.fax_count = pTmpsimMwiInfo.mwi_list.mw_info[0].fax_count;
+ mwReq.mw_data_u.mw.email_count = pTmpsimMwiInfo.mwi_list.mw_info[0].email_count;
+ mwReq.mw_data_u.mw.other_count = pTmpsimMwiInfo.mwi_list.mw_info[0].other_count;
+ mwReq.mw_data_u.mw.video_count = pTmpsimMwiInfo.mwi_list.mw_info[0].video_count;
MSG_DEBUG("MWI record index = [%d]", mwReq.mw_data_u.mw.rec_index);
MSG_DEBUG("MWI ind status = [%d]", mwReq.mw_data_u.mw.indicator_status);
@@ -1224,9 +1299,9 @@ void SmsPluginSetting::setMwiInfo(int simIndex, MSG_SUB_TYPE_T type, int count)
MSG_DEBUG("MWI video = [%d]", mwReq.mw_data_u.mw.video_count);
}
- mwReq.b_cphs = simMwiInfo[simIndex].b_cphs;
+ mwReq.b_cphs = pTmpsimMwiInfo.b_cphs;
- struct tapi_handle *handle = SmsPluginDSHandler::instance()->getTelHandle(simIndex);
+ TapiHandle *handle = SmsPluginDSHandler::instance()->getTelHandle(simIndex);
ret = tel_set_sim_messagewaiting_info(handle, &mwReq, TapiEventSetMwiInfo, NULL);
@@ -1240,7 +1315,7 @@ void SmsPluginSetting::setMwiInfo(int simIndex, MSG_SUB_TYPE_T type, int count)
}
-bool SmsPluginSetting::getMwiInfo(struct tapi_handle *handle)
+bool SmsPluginSetting::getMwiInfo(TapiHandle *handle)
{
MutexLocker lock(mx);
@@ -1266,7 +1341,7 @@ bool SmsPluginSetting::getMwiInfo(struct tapi_handle *handle)
}
-bool SmsPluginSetting::getMsisdnInfo(struct tapi_handle *handle)
+bool SmsPluginSetting::getMsisdnInfo(TapiHandle *handle)
{
MutexLocker lock(mx);
@@ -1292,7 +1367,7 @@ bool SmsPluginSetting::getMsisdnInfo(struct tapi_handle *handle)
}
-bool SmsPluginSetting::getSimServiceTable(struct tapi_handle *handle)
+bool SmsPluginSetting::getSimServiceTable(TapiHandle *handle)
{
MutexLocker lock(mx);
@@ -1373,7 +1448,7 @@ void SmsPluginSetting::setParamEvent(struct tapi_handle *handle, const MSG_SMSC_
}
-bool SmsPluginSetting::getParamEvent(struct tapi_handle *handle, MSG_SMSC_DATA_S *pSmscData)
+bool SmsPluginSetting::getParamEvent(TapiHandle *handle, MSG_SMSC_DATA_S *pSmscData)
{
int ret = 0;
@@ -1400,8 +1475,10 @@ bool SmsPluginSetting::getParamEvent(struct tapi_handle *handle, MSG_SMSC_DATA_S
}
-void SmsPluginSetting::setCbConfigEvent(struct tapi_handle *handle, const MSG_CBMSG_OPT_S *pCbOpt, bool bSuccess)
+void SmsPluginSetting::setCbConfigEvent(TapiHandle *handle, const MSG_CBMSG_OPT_S *pCbOpt, bool bSuccess)
{
+ MSG_BEGIN();
+
mx.lock();
char keyName[MAX_VCONFKEY_NAME_LEN];
@@ -1409,28 +1486,53 @@ void SmsPluginSetting::setCbConfigEvent(struct tapi_handle *handle, const MSG_CB
bTapiResult = bSuccess;
int simIndex = SmsPluginDSHandler::instance()->getSimIndex(handle);
- memset(&cbOpt[simIndex], 0x00, sizeof(MSG_CBMSG_OPT_S));
if (bTapiResult == true) {
MSG_DEBUG("Success to get cb config data");
- memcpy(&cbOpt[simIndex], pCbOpt, sizeof(MSG_CBMSG_OPT_S));
+ pair <int, MSG_CBMSG_OPT_S> newCbOpt (simIndex, *pCbOpt);
+ cbOptMap::iterator it = cbOpt.find(simIndex);
+
+ if (it == cbOpt.end()) {
+ MSG_DEBUG("IT is not present");
+ } else {
+ MSG_DEBUG("IT present");
+ cbOpt.erase(it);
+ }
+ cbOpt.insert(newCbOpt);
memset(keyName, 0x00, sizeof(keyName));
snprintf(keyName, sizeof(keyName), "%s/%d", CB_MAX_SIM_COUNT, simIndex);
if (MsgSettingSetInt(keyName, pCbOpt->maxSimCnt) != MSG_SUCCESS) {
MSG_DEBUG("Error to set config data [%s]", keyName);
}
+ } else {
+ MSG_DEBUG("Failed to get cb config data");
+
+ cbOptMap::iterator it = cbOpt.find(simIndex);
+
+ if (it == cbOpt.end()) {
+ MSG_DEBUG("IT not present");
+ MSG_CBMSG_OPT_S pTmpCbOpt;
+
+ memset(&pTmpCbOpt, 0x00, sizeof(MSG_CBMSG_OPT_S));
+ pair <int, MSG_CBMSG_OPT_S> newCbOpt (simIndex, pTmpCbOpt);
+
+ cbOpt.insert(newCbOpt);
+ }
}
cv.signal();
mx.unlock();
+ MSG_END();
}
bool SmsPluginSetting::getCbConfigEvent(MSG_CBMSG_OPT_S *pCbOpt)
{
+ MSG_BEGIN();
+
int ret = 0;
mx.lock();
@@ -1450,15 +1552,29 @@ bool SmsPluginSetting::getCbConfigEvent(MSG_CBMSG_OPT_S *pCbOpt)
memset(pCbOpt, 0x00, sizeof(MSG_CBMSG_OPT_S));
if (bTapiResult == true) {
- memcpy(pCbOpt, &cbOpt[simIndex], sizeof(MSG_CBMSG_OPT_S));
+ cbOptMap::iterator it = cbOpt.find(simIndex);
+
+ if (it == cbOpt.end()) {
+ MSG_DEBUG("IT is not present");
+ return false;
+ }
+
+ MSG_DEBUG("IT is present");
+
+ MSG_CBMSG_OPT_S &pTmpCbOpt = it->second;
+ memcpy(pCbOpt, &pTmpCbOpt, sizeof(MSG_CBMSG_OPT_S));
}
+ MSG_END();
return bTapiResult;
}
-void SmsPluginSetting::setMailboxInfoEvent(struct tapi_handle *handle, SMS_SIM_MAILBOX_LIST_S *pMailboxList, bool bSuccess, bool bMbdn)
+void SmsPluginSetting::setMailboxInfoEvent(TapiHandle *handle, SMS_SIM_MAILBOX_LIST_S *pMailboxList, bool bSuccess, bool bMbdn)
{
+ MSG_BEGIN();
+
+ MSG_DEBUG("bSuccess = %d, bMbdn = %d", bSuccess, bMbdn);
mx.lock();
bTapiResult = bSuccess;
@@ -1467,7 +1583,17 @@ void SmsPluginSetting::setMailboxInfoEvent(struct tapi_handle *handle, SMS_SIM_M
bMbdnEnable[simIndex] = bMbdn;
- memset(&simMailboxList[simIndex], 0x00, sizeof(SMS_SIM_MAILBOX_LIST_S));
+ /* print incoming mailbox list */
+ if (pMailboxList) {
+ MSG_DEBUG("Input list is count = %d ", pMailboxList->count);
+
+ for (int i = 0; i < pMailboxList->count; i++) {
+ MSG_DEBUG("List index = %d", i);
+ MSG_DEBUG("ton = %d, num = %s, alpha_id = %s", pMailboxList->list[i].ton, pMailboxList->list[i].num, pMailboxList->list[i].alpha_id);
+ }
+ } else {
+ MSG_INFO("pMailboxList is NULL");
+ }
if (bTapiResult == true) {
int i = 0;
@@ -1475,7 +1601,17 @@ void SmsPluginSetting::setMailboxInfoEvent(struct tapi_handle *handle, SMS_SIM_M
char keyName[MAX_VCONFKEY_NAME_LEN];
if (pMailboxList && pMailboxList->count > 0) {
- memcpy(&simMailboxList[simIndex], pMailboxList, sizeof(SMS_SIM_MAILBOX_LIST_S));
+ pair <int, SMS_SIM_MAILBOX_LIST_S> newList(simIndex, *pMailboxList);
+
+ smsSimMailboxListMap::iterator it = simMailboxList.find(simIndex);
+ if (it == simMailboxList.end()) {
+ MSG_DEBUG("IT not present !!!");
+ simMailboxList.insert(newList);
+ } else {
+ MSG_DEBUG("IT present !!!");
+ simMailboxList.erase(it);
+ simMailboxList.insert(newList);
+ }
/* Temp :: Save voicemail number with VOICE1 line number */
for (i = 0; i < pMailboxList->count ; i++) {
@@ -1497,18 +1633,22 @@ void SmsPluginSetting::setMailboxInfoEvent(struct tapi_handle *handle, SMS_SIM_M
}
}
+ smsSimMailboxListMap::iterator iter = simMailboxList.find(simIndex);
+
+ SMS_SIM_MAILBOX_LIST_S &pTmpMailboxList = iter->second;
+
char mailNumber[MAX_PHONE_NUMBER_LEN+1];
memset(mailNumber, 0x00 , sizeof(mailNumber));
MSG_SEC_DEBUG("Mailbox list[%d] ton=[%d], address=[%s], alpha_id=[%s]", \
- i, simMailboxList[simIndex].list[i].ton, simMailboxList[simIndex].list[i].num, \
- simMailboxList[simIndex].list[i].alpha_id);
+ i, pTmpMailboxList.list[i].ton, pTmpMailboxList.list[i].num, \
+ pTmpMailboxList.list[i].alpha_id);
- if (simMailboxList[simIndex].list[i].ton == MSG_TON_INTERNATIONAL && simMailboxList[simIndex].list[i].num[0] != '+') {
- snprintf(mailNumber, MAX_PHONE_NUMBER_LEN, "+%s", simMailboxList[simIndex].list[i].num);
- MSG_DEBUG("MSG_TON_INTERNATIONAL [%s]", mailNumber);
+ if (pTmpMailboxList.list[i].ton == MSG_TON_INTERNATIONAL && pTmpMailboxList.list[i].num[0] != '+') {
+ snprintf(mailNumber, sizeof(mailNumber), "+%s", pTmpMailboxList.list[i].num);
+ MSG_WARN("MSG_TON_INTERNATIONAL [%s]", mailNumber);
} else {
- snprintf(mailNumber, MAX_PHONE_NUMBER_LEN, "%s", simMailboxList[simIndex].list[i].num);
+ snprintf(mailNumber, sizeof(mailNumber), "%s", pTmpMailboxList.list[i].num);
MSG_DEBUG("[%s]", mailNumber);
}
@@ -1519,7 +1659,7 @@ void SmsPluginSetting::setMailboxInfoEvent(struct tapi_handle *handle, SMS_SIM_M
MSG_DEBUG("MsgSettingSetString is failed!!");
}
- if (simMailboxList[simIndex].list[i].alpha_id[0] != '\0') {
+ if (pTmpMailboxList.list[i].alpha_id[0] != '\0') {
char unpackAlphaId[MAX_SIM_XDN_ALPHA_ID_LEN+8];
int tmpLen = 0;
MSG_LANG_INFO_S langInfo = {0,};
@@ -1529,10 +1669,10 @@ void SmsPluginSetting::setMailboxInfoEvent(struct tapi_handle *handle, SMS_SIM_M
langInfo.bSingleShift = false;
langInfo.bLockingShift = false;
- tmpLen = strlen(simMailboxList[simIndex].list[i].alpha_id);
+ tmpLen = strlen(pTmpMailboxList.list[i].alpha_id);
MsgTextConvert *textCvt = MsgTextConvert::instance();
- textCvt->convertGSM7bitToUTF8((unsigned char*)unpackAlphaId, sizeof(unpackAlphaId), (unsigned char*)simMailboxList[simIndex].list[i].alpha_id, tmpLen, &langInfo);
+ textCvt->convertGSM7bitToUTF8((unsigned char*)unpackAlphaId, sizeof(unpackAlphaId), (unsigned char*)pTmpMailboxList.list[i].alpha_id, tmpLen, &langInfo);
MSG_DEBUG("UTF8 ALPHA_ID = [%s]", unpackAlphaId);
@@ -1542,23 +1682,31 @@ void SmsPluginSetting::setMailboxInfoEvent(struct tapi_handle *handle, SMS_SIM_M
MSG_DEBUG("MsgSettingSetString is failed!!");
}
}
+ } else {
+ /* insert empty list with sim index */
+ SMS_SIM_MAILBOX_LIST_S pDummySimMailboxList;
+
+ memset(&pDummySimMailboxList, 0x00, sizeof(SMS_SIM_MAILBOX_LIST_S));
+ pair <int, SMS_SIM_MAILBOX_LIST_S> newTmpList (simIndex, pDummySimMailboxList);
+ simMailboxList.insert(newTmpList);
}
cv.signal();
mx.unlock();
+ MSG_END();
}
bool SmsPluginSetting::getMailboxInfoEvent()
{
int ret = 0;
- mx.lock();
+ //mx.lock();
bTapiResult = false;
ret = cv.timedwait(mx.pMutex(), MAX_TAPI_SIM_API_TIMEOUT);
- mx.unlock();
+ //mx.unlock();
if (ret == ETIMEDOUT) {
MSG_DEBUG("WARNING: TAPI callback TIME-OUT");
@@ -1578,21 +1726,32 @@ void SmsPluginSetting::setMwiInfoEvent(struct tapi_handle *handle, SMS_SIM_MWI_I
int index = SmsPluginDSHandler::instance()->getSimIndex(handle);
- memset(&simMwiInfo[index], 0x00, sizeof(SMS_SIM_MWI_INFO_S));
-
if (bTapiResult == true) {
int mwiCnt = 0;
char keyName[MAX_VCONFKEY_NAME_LEN];
- memcpy(&simMwiInfo[index], pMwiInfo, sizeof(SMS_SIM_MWI_INFO_S));
+ pair <int, SMS_SIM_MWI_INFO_S> newList (index, *pMwiInfo);
+ simMwiInfoMap::iterator it = simMwiInfo.find(index);
+
+ if (it == simMwiInfo.end()) {
+ MSG_DEBUG("IT not present");
+ } else {
+ MSG_DEBUG("IT present");
+ simMwiInfo.erase(it);
+ }
+ simMwiInfo.insert(newList);
+
+ simMwiInfoMap::iterator iter = simMwiInfo.find(index);
+
+ SMS_SIM_MWI_INFO_S &pTmpsimMwiInfoList = iter->second;
/* Save MW count with VOICE line1 number */
- if (simMwiInfo[index].b_cphs == true) {
- mwiCnt = simMwiInfo[index].cphs_mwi.b_voice1;
+ if (pTmpsimMwiInfoList.b_cphs == true) {
+ mwiCnt = pTmpsimMwiInfoList.cphs_mwi.b_voice1;
} else {
- mwiCnt = simMwiInfo[index].mwi_list.mw_info[0].voice_count; // Normal case
+ mwiCnt = pTmpsimMwiInfoList.mwi_list.mw_info[0].voice_count; // Normal case
}
- // TODO :: Add operation for voice mail of line 2
+ /* TODO :: Add operation for voice mail of line 2 */
memset(keyName, 0x00, sizeof(keyName));
snprintf(keyName, sizeof(keyName), "%s/%d", VOICEMAIL_COUNT, index);
@@ -1604,6 +1763,21 @@ void SmsPluginSetting::setMwiInfoEvent(struct tapi_handle *handle, SMS_SIM_MWI_I
if (mwiCnt > 0) {
deliverVoiceMsgNoti(index, mwiCnt);
}
+ } else {
+ SMS_SIM_MWI_INFO_S pTmpsimMwiInfo;
+
+ memset(&pTmpsimMwiInfo, 0x00, sizeof(SMS_SIM_MWI_INFO_S));
+
+ pair <int, SMS_SIM_MWI_INFO_S> newList (index, pTmpsimMwiInfo);
+ simMwiInfoMap::iterator it = simMwiInfo.find(index);
+
+ if (it == simMwiInfo.end()) {
+ MSG_DEBUG("IT not present");
+ } else {
+ MSG_DEBUG("IT present");
+ simMwiInfo.erase(it);
+ }
+ simMwiInfo.insert(newList);
}
cv.signal();
@@ -1673,7 +1847,7 @@ bool SmsPluginSetting::getResultFromSim()
MSG_DEBUG("getResultFromSim() is called .");
- //mx.lock(); // Caller of this function MUST acquire the mutex before calling the TAPI API
+ //mx.lock(); /* Caller of this function MUST acquire the mutex before calling the TAPI API */
ret = cv.timedwait(mx.pMutex(), MAX_TAPI_SIM_API_TIMEOUT);
@@ -1692,28 +1866,27 @@ SMS_PID_T SmsPluginSetting::convertPid(MSG_SMS_PID_T pid)
{
SMS_PID_T retPid;
- switch (pid)
- {
- case MSG_PID_TEXT :
- retPid = SMS_PID_NORMAL;
+ switch (pid) {
+ case MSG_PID_TEXT :
+ retPid = SMS_PID_NORMAL;
break;
- case MSG_PID_VOICE :
- retPid = SMS_PID_VOICE;
+ case MSG_PID_VOICE :
+ retPid = SMS_PID_VOICE;
break;
- case MSG_PID_FAX :
- retPid = SMS_PID_TELEX;
+ case MSG_PID_FAX :
+ retPid = SMS_PID_TELEX;
break;
- case MSG_PID_X400 :
- retPid = SMS_PID_x400;
+ case MSG_PID_X400 :
+ retPid = SMS_PID_x400;
break;
- case MSG_PID_ERMES :
- retPid = SMS_PID_ERMES;
+ case MSG_PID_ERMES :
+ retPid = SMS_PID_ERMES;
break;
- case MSG_PID_EMAIL :
- retPid = SMS_PID_EMAIL;
+ case MSG_PID_EMAIL :
+ retPid = SMS_PID_EMAIL;
break;
- default :
- retPid = SMS_PID_NORMAL;
+ default :
+ retPid = SMS_PID_NORMAL;
break;
}
@@ -1744,8 +1917,7 @@ void SmsPluginSetting::deliverVoiceMsgNoti(int simIndex, int mwiCnt)
voiceNum = MsgSettingGetString(keyName);
if (voiceNum) {
- snprintf(msgInfo.addressList[0].addressVal, sizeof(msgInfo.addressList[0].addressVal),
- "%s", voiceNum);
+ snprintf(msgInfo.addressList[0].addressVal, sizeof(msgInfo.addressList[0].addressVal), "%s", voiceNum);
free(voiceNum);
voiceNum = NULL;
}
@@ -1769,14 +1941,15 @@ void SmsPluginSetting::deliverVoiceMsgNoti(int simIndex, int mwiCnt)
MSG_DEBUG("callbackIncoming is failed.");
#else
MsgInsertNotification(&msgInfo);
- MsgChangePmState();
+ if (MsgCheckNotificationSettingEnable())
+ MsgChangePmState();
#endif
MSG_END();
}
-void SmsPluginSetting::setSimChangeStatus(struct tapi_handle *handle, bool bInitializing)
+void SmsPluginSetting::setSimChangeStatus(TapiHandle *handle, bool bInitializing)
{
MSG_BEGIN();
@@ -1804,7 +1977,7 @@ void SmsPluginSetting::setSimChangeStatus(struct tapi_handle *handle, bool bInit
simStatus[simIndex] = MSG_SIM_STATUS_NORMAL;
}
// tel_handle_list.push_back(handle);
- // Modified to call initSimInfo for SIM separately
+ /* Modified to call initSimInfo for SIM separately */
MSG_DEBUG("calling initSimInfo");
if (pthread_create(&thd, NULL, &initSimInfo, handle) < 0) {
MSG_DEBUG("pthread_create() error");
diff --git a/plugin/sms_plugin/SmsPluginSimMsg.cpp b/plugin/sms_plugin/SmsPluginSimMsg.cpp
index 4a73e7b..986cbb3 100755
--- a/plugin/sms_plugin/SmsPluginSimMsg.cpp
+++ b/plugin/sms_plugin/SmsPluginSimMsg.cpp
@@ -41,7 +41,7 @@ SmsPluginSimMsg* SmsPluginSimMsg::pInstance = NULL;
SmsPluginSimMsg::SmsPluginSimMsg()
{
- // Initialize member variables
+ /* Initialize member variables */
simMsgId = 0;
delSimMsgId = -1;
usedCnt = 0;
@@ -71,7 +71,7 @@ SmsPluginSimMsg* SmsPluginSimMsg::instance()
}
-void SmsPluginSimMsg::initSimMessage(struct tapi_handle *handle)
+void SmsPluginSimMsg::initSimMessage(TapiHandle *handle)
{
MSG_BEGIN();
@@ -79,7 +79,7 @@ void SmsPluginSimMsg::initSimMessage(struct tapi_handle *handle)
int sim_idx = SmsPluginDSHandler::instance()->getSimIndex(handle);
snprintf(keyName, sizeof(keyName), "%s/%d", SIM_USED_COUNT, sim_idx);
- // Set SIM count of vconf to 0
+ /* Set SIM count of vconf to 0 */
if (MsgSettingSetInt(keyName, 0) != MSG_SUCCESS) {
MSG_DEBUG("Error to set config data [%s]", keyName);
}
@@ -98,12 +98,11 @@ void SmsPluginSimMsg::initSimMessage(struct tapi_handle *handle)
int simIdList[MAX_SIM_SMS_NUM];
int unreadSimMsg = 0;
- for (int i = 0; i < tmpMsgCnt.usedCount; i++)
- {
+ for (int i = 0; i < tmpMsgCnt.usedCount; i++) {
memset(&tmpMsgInfo, 0x00, sizeof(MSG_MESSAGE_INFO_S));
memset(simIdList, 0, sizeof(int) * MAX_SIM_SMS_NUM);
- // Get SIM Msg
+ /* Get SIM Msg */
if (getSimMsg(handle, tmpMsgCnt.indexList[i], &tmpMsgInfo, simIdList) == false)
continue;
@@ -123,7 +122,7 @@ void SmsPluginSimMsg::initSimMessage(struct tapi_handle *handle)
MSG_DEBUG("Unread SIM message count = [%d]", unreadSimMsg);
#ifndef MSG_NOTI_INTEGRATION
if (unreadSimMsg > 0) {
- MsgRefreshNotification(MSG_NOTI_TYPE_SIM, true, false);
+ MsgRefreshNotification(MSG_NOTI_TYPE_SIM, true, MSG_ACTIVE_NOTI_TYPE_NONE);
}
#endif
@@ -139,7 +138,7 @@ msg_error_t SmsPluginSimMsg::saveSimMessage(const MSG_MESSAGE_INFO_S *pMsgInfo,
{
bool bSimSst = true;
- struct tapi_handle *handle = SmsPluginDSHandler::instance()->getTelHandle(pMsgInfo->sim_idx);
+ TapiHandle *handle = SmsPluginDSHandler::instance()->getTelHandle(pMsgInfo->sim_idx);
char keyName[MAX_VCONFKEY_NAME_LEN];
memset(keyName, 0x00, sizeof(keyName));
snprintf(keyName, sizeof(keyName), "%s/%d", MSG_SIM_SERVICE_TABLE, pMsgInfo->sim_idx);
@@ -150,35 +149,32 @@ msg_error_t SmsPluginSimMsg::saveSimMessage(const MSG_MESSAGE_INFO_S *pMsgInfo,
if (bSimSst == false)
return MSG_ERR_STORE_RESTRICT;
- // Reset Out Parameter
+ /* Reset Out Parameter */
pSimIdList->count = 0;
SMS_TPDU_S tpdu;
memset(&tpdu, 0x00, sizeof(SMS_TPDU_S));
- if(pMsgInfo->direction == MSG_DIRECTION_TYPE_MO)
- {
+ if (pMsgInfo->direction == MSG_DIRECTION_TYPE_MO) {
tpdu.tpduType = SMS_TPDU_SUBMIT;
tpdu.data.submit.dcs.msgClass = SMS_MSG_CLASS_NONE;
//SmsPluginTransport::instance()->setSmsSendOptions(&(tpdu.data.submit));
tpdu.data.submit.vpf = SMS_VPF_NOT_PRESENT;
- }
- else
- {
+ tpdu.data.submit.dcs.codingScheme = SMS_CHARSET_AUTO;
+ } else {
tpdu.tpduType = SMS_TPDU_DELIVER;
setSmsOptions(pMsgInfo, &(tpdu.data.deliver));
- // Set TimeStamp
+ /* Set TimeStamp */
convertTimeStamp(pMsgInfo, &(tpdu.data.deliver));
+ tpdu.data.deliver.dcs.codingScheme = SMS_CHARSET_AUTO;
}
- for(int i=0; i <pMsgInfo->nAddressCnt; ++i)
- {
+ for (int i = 0; i <pMsgInfo->nAddressCnt; ++i) {
SMS_SUBMIT_DATA_S submitData;
memset(&submitData, 0x00, sizeof(SMS_SUBMIT_DATA_S));
int bufLen = 0;
char buf[MAX_TPDU_DATA_LEN];
- if(pMsgInfo->direction == MSG_DIRECTION_TYPE_MO) // SUBMIT MSG
- {
+ if (pMsgInfo->direction == MSG_DIRECTION_TYPE_MO) { /* SUBMIT MSG */
SmsPluginTransport::instance()->msgInfoToSubmitData(pMsgInfo, &submitData, &(tpdu.data.submit.dcs.codingScheme), i);
int addLen = strlen(submitData.destAddress.address);
@@ -194,7 +190,7 @@ msg_error_t SmsPluginSimMsg::saveSimMessage(const MSG_MESSAGE_INFO_S *pMsgInfo,
tpdu.data.submit.destAddress.address[MAX_ADDRESS_LEN] = '\0';
}
- } else { // DELIVER MSG
+ } else { /* DELIVER MSG */
SmsPluginTransport::instance()->msgInfoToSubmitData(pMsgInfo, &submitData, &(tpdu.data.deliver.dcs.codingScheme), i);
int addLen = strlen(submitData.destAddress.address);
@@ -211,18 +207,16 @@ msg_error_t SmsPluginSimMsg::saveSimMessage(const MSG_MESSAGE_INFO_S *pMsgInfo,
}
}
- // Check sim message full.
- if (checkSimMsgFull(pMsgInfo->sim_idx, submitData.segCount) == true)
- {
+ /* Check sim message full. */
+ if (checkSimMsgFull(pMsgInfo->sim_idx, submitData.segCount) == true) {
MSG_DEBUG("SIM storage is full.");
MsgInsertTicker("Sim memory full. Delete some items", SMS_MESSAGE_SIM_MESSAGE_FULL, true, 0);
return MSG_ERR_SIM_STORAGE_FULL;
}
- if(submitData.segCount > 1)
- {
- if(pMsgInfo->direction == MSG_DIRECTION_TYPE_MO){ // SUBMIT MSG
+ if (submitData.segCount > 1) {
+ if (pMsgInfo->direction == MSG_DIRECTION_TYPE_MO){ /* SUBMIT MSG */
tpdu.data.submit.bHeaderInd = true;
} else {
tpdu.data.deliver.bHeaderInd = true;
@@ -230,9 +224,8 @@ msg_error_t SmsPluginSimMsg::saveSimMessage(const MSG_MESSAGE_INFO_S *pMsgInfo,
}
- for (unsigned int segCnt = 0; segCnt < submitData.segCount; segCnt++)
- {
- if(pMsgInfo->direction == MSG_DIRECTION_TYPE_MO){
+ for (unsigned int segCnt = 0; segCnt < submitData.segCount; segCnt++) {
+ if (pMsgInfo->direction == MSG_DIRECTION_TYPE_MO){
memcpy(&(tpdu.data.submit.userData), &(submitData.userData[segCnt]), sizeof(SMS_USERDATA_S));
} else {
memcpy(&(tpdu.data.deliver.userData), &(submitData.userData[segCnt]), sizeof(SMS_USERDATA_S));
@@ -240,26 +233,26 @@ msg_error_t SmsPluginSimMsg::saveSimMessage(const MSG_MESSAGE_INFO_S *pMsgInfo,
memset(buf, 0x00, sizeof(buf));
- // Encode SMS-DELIVER TPDU
+ /* Encode SMS-DELIVER TPDU */
bufLen = SmsPluginTpduCodec::encodeTpdu(&tpdu, buf);
- // Make Telephony Structure
+ /* Make Telephony Structure */
TelSmsData_t simSmsData;
memset((void*)&simSmsData, 0x00, sizeof(simSmsData));
- // Set TPDU data
+ /* Set TPDU data */
memcpy((void*)simSmsData.SmsData.szData, buf, bufLen);
simSmsData.SmsData.szData[bufLen] = 0;
simSmsData.SmsData.MsgLength = bufLen;
simSmsData.SmsData.format = TAPI_NETTEXT_NETTYPE_3GPP;
- if(pMsgInfo->direction == MSG_DIRECTION_TYPE_MT) { // MT messages
+ if (pMsgInfo->direction == MSG_DIRECTION_TYPE_MT) { /* MT messages */
if (pMsgInfo->bRead == true)
simSmsData.MsgStatus = TAPI_NETTEXT_STATUS_READ;
else
simSmsData.MsgStatus = TAPI_NETTEXT_STATUS_UNREAD;
- } else { // MO messages
+ } else { /* MO messages */
if (pMsgInfo->networkStatus == MSG_NETWORK_SEND_SUCCESS)
simSmsData.MsgStatus = TAPI_NETTEXT_STATUS_SENT;
else if (pMsgInfo->networkStatus == MSG_NETWORK_DELIVER_SUCCESS)
@@ -270,17 +263,14 @@ msg_error_t SmsPluginSimMsg::saveSimMessage(const MSG_MESSAGE_INFO_S *pMsgInfo,
simSmsData.MsgStatus = TAPI_NETTEXT_STATUS_UNSENT;
}
- // Save SMS in SIM
+ /* Save SMS in SIM */
int ret = 0;
ret = tel_write_sms_in_sim(handle, &simSmsData, TapiEventSaveSimMsg, NULL);
- if (ret == TAPI_API_SUCCESS)
- {
+ if (ret == TAPI_API_SUCCESS) {
MSG_DEBUG("######## tel_write_sms_in_sim Success !!!#######");
- }
- else
- {
+ } else {
MSG_DEBUG("######## tel_write_sms_in_sim Fail !!! return : [%d] #######", ret);
return MSG_ERR_PLUGIN_STORAGE;
@@ -294,8 +284,7 @@ msg_error_t SmsPluginSimMsg::saveSimMessage(const MSG_MESSAGE_INFO_S *pMsgInfo,
int usedCnt = 0;
- if (bResult == true)
- {
+ if (bResult == true) {
MSG_DEBUG("######## Saving Msg was Successful !!! SIM ID : [%d] #######", SimId);
char keyName[MAX_VCONFKEY_NAME_LEN];
@@ -306,15 +295,11 @@ msg_error_t SmsPluginSimMsg::saveSimMessage(const MSG_MESSAGE_INFO_S *pMsgInfo,
usedCnt++;
if (MsgSettingSetInt(keyName, usedCnt) != MSG_SUCCESS)
- {
MSG_DEBUG("Error to set config data [%s]", SIM_USED_COUNT);
- }
pSimIdList->simId[pSimIdList->count] = SimId;
pSimIdList->count++;
- }
- else
- {
+ } else {
MSG_DEBUG("######## Saving Msg was Failed !!! SIM ID : [%d] #######", SimId);
return MSG_ERR_PLUGIN_STORAGE;
@@ -335,7 +320,7 @@ msg_error_t SmsPluginSimMsg::saveClass2Message(const MSG_MESSAGE_INFO_S *pMsgInf
int replaceSimId = -1;
int replaceMsgId = 0;
- struct tapi_handle *handle = SmsPluginDSHandler::instance()->getTelHandle(pMsgInfo->sim_idx);
+ TapiHandle *handle = SmsPluginDSHandler::instance()->getTelHandle(pMsgInfo->sim_idx);
char keyName[MAX_VCONFKEY_NAME_LEN];
memset(keyName, 0x00, sizeof(keyName));
@@ -344,20 +329,19 @@ msg_error_t SmsPluginSimMsg::saveClass2Message(const MSG_MESSAGE_INFO_S *pMsgInf
MSG_DEBUG("MsgSettingGetBool [%s] failed", keyName);
/* No return, default value is true. */
- if (bSimSst == false)
- {
+ if (bSimSst == false) {
SmsPluginTransport::instance()->sendDeliverReport(handle, MSG_SUCCESS);
return MSG_SUCCESS;
}
- // Reset Flag
+ /* Reset Flag */
SMS_TPDU_S tpdu;
tpdu.tpduType = SMS_TPDU_DELIVER;
convertTimeStamp(pMsgInfo, &(tpdu.data.deliver));
- // Set SMS TPDU Options
+ /* Set SMS TPDU Options */
setSmsOptions(pMsgInfo, &(tpdu.data.deliver));
SMS_SUBMIT_DATA_S submitData;
@@ -373,12 +357,11 @@ msg_error_t SmsPluginSimMsg::saveClass2Message(const MSG_MESSAGE_INFO_S *pMsgInf
replaceMsgId = 0;
}
- // Check SIM ID
- if (replaceSimId < 0) { // Normal message type
- // Check sim message full.
- if (checkSimMsgFull(pMsgInfo->sim_idx, submitData.segCount) == true)
- {
- MSG_DEBUG("SIM storage is full.");
+ /* Check SIM ID */
+ if (replaceSimId < 0) { /* Normal message type */
+ /* Check sim message full. */
+ if (checkSimMsgFull(pMsgInfo->sim_idx, submitData.segCount) == true) {
+ MSG_ERR("SIM storage is full.");
SmsPluginTransport::instance()->sendDeliverReport(handle, MSG_ERR_SIM_STORAGE_FULL);
@@ -400,14 +383,14 @@ msg_error_t SmsPluginSimMsg::saveClass2Message(const MSG_MESSAGE_INFO_S *pMsgInf
if (submitData.segCount > 1)
tpdu.data.deliver.bHeaderInd = true;
- } else { // Replace message type
+ } else { /* Replace message type */
tapiRet = tel_delete_sms_in_sim(handle, replaceSimId, TapiEventDeleteSimMsg, NULL);
if (tapiRet == TAPI_API_SUCCESS) {
MSG_DEBUG("######## tel_delete_sms_in_sim Success !!! #######");
simId = -1;
- if(getDelSimEvent(&simId) == true) {
+ if (getDelSimEvent(&simId) == true) {
err = SmsPluginStorage::instance()->deleteSimMessage(pMsgInfo->sim_idx, replaceSimId);
}
MSG_DEBUG("tel_delete_sms_in_sim() : Err=[%d], Replace Sim Id=[%d], Result Sim id=[%d]", err, replaceSimId, simId);
@@ -418,7 +401,7 @@ msg_error_t SmsPluginSimMsg::saveClass2Message(const MSG_MESSAGE_INFO_S *pMsgInf
}
for (unsigned int segCnt = 0; segCnt < submitData.segCount; segCnt++) {
- // Create TelSmsData_t data
+ /* Create TelSmsData_t data */
TelSmsData_t simSmsData = {0,};
if (submitData.segCount == 1) {
@@ -431,14 +414,15 @@ msg_error_t SmsPluginSimMsg::saveClass2Message(const MSG_MESSAGE_INFO_S *pMsgInf
memset(buf, 0x00, sizeof(buf));
- // Encode SMS-DELIVER TPDU
+ /* Encode SMS-DELIVER TPDU */
bufLen = SmsPluginTpduCodec::encodeTpdu(&tpdu, buf);
- // Set TPDU data
+ /* Set TPDU data */
+ int copyLen = (bufLen > TAPI_NETTEXT_SMDATA_SIZE_MAX) ? TAPI_NETTEXT_SMDATA_SIZE_MAX : bufLen;
memcpy((void*)simSmsData.SmsData.Sca, &simMsgDataInfo.sca, sizeof(simSmsData.SmsData.Sca));
- memcpy((void*)simSmsData.SmsData.szData, buf, bufLen);
- simSmsData.SmsData.szData[bufLen] = 0;
- simSmsData.SmsData.MsgLength = bufLen;
+ memcpy((void*)simSmsData.SmsData.szData, buf, (size_t)copyLen);
+ simSmsData.SmsData.szData[copyLen] = 0;
+ simSmsData.SmsData.MsgLength = copyLen;
}
simSmsData.SmsData.format = TAPI_NETTEXT_NETTYPE_3GPP;
@@ -466,6 +450,7 @@ msg_error_t SmsPluginSimMsg::saveClass2Message(const MSG_MESSAGE_INFO_S *pMsgInf
return MSG_ERR_PLUGIN_STORAGE;
}
}
+
msg_sim_id_t retSimId;
if (!getSimEvent(&retSimId))
return MSG_ERR_PLUGIN_STORAGE;
@@ -479,17 +464,13 @@ void SmsPluginSimMsg::deleteSimMessage(msg_sim_slot_id_t sim_idx, msg_sim_id_t S
{
int tapiRet = TAPI_API_SUCCESS;
- struct tapi_handle *handle = SmsPluginDSHandler::instance()->getTelHandle(sim_idx);
+ TapiHandle *handle = SmsPluginDSHandler::instance()->getTelHandle(sim_idx);
tapiRet = tel_delete_sms_in_sim(handle, (int)SimMsgId, TapiEventDeleteSimMsg, NULL);
if (tapiRet == TAPI_API_SUCCESS)
- {
MSG_DEBUG("######## tel_delete_sms_in_sim Success !!! #######");
- }
else
- {
THROW(MsgException::SMS_PLG_ERROR, "######## tel_delete_sms_in_sim Fail !!! return : [%d] #######", tapiRet);
- }
int SimId = 0;
bool bResult = false;
@@ -498,8 +479,7 @@ void SmsPluginSimMsg::deleteSimMessage(msg_sim_slot_id_t sim_idx, msg_sim_id_t S
int usedCnt = 0, totalCnt = 0;
- if (bResult == true)
- {
+ if (bResult == true) {
MSG_DEBUG("######## Deleting Msg was Successful !!! SIM ID : [%d] #######", SimId);
char keyName[MAX_VCONFKEY_NAME_LEN];
memset(keyName, 0x00, sizeof(keyName));
@@ -509,18 +489,13 @@ void SmsPluginSimMsg::deleteSimMessage(msg_sim_slot_id_t sim_idx, msg_sim_id_t S
snprintf(keyName, sizeof(keyName), "%s/%d", SIM_TOTAL_COUNT, sim_idx);
totalCnt = MsgSettingGetInt(keyName);
- if (usedCnt == totalCnt)
- {
+ if (usedCnt == totalCnt) {
tapiRet = tel_set_sms_memory_status(handle, TAPI_NETTEXT_PDA_MEMORY_STATUS_AVAILABLE, NULL, NULL);
if (tapiRet == TAPI_API_SUCCESS)
- {
MSG_DEBUG("######## tel_set_sms_memory_status() Success !!! #######");
- }
else
- {
MSG_DEBUG("######## tel_set_sms_memory_status() Success !!! return : [%d] #######", tapiRet);
- }
}
usedCnt--;
@@ -529,12 +504,8 @@ void SmsPluginSimMsg::deleteSimMessage(msg_sim_slot_id_t sim_idx, msg_sim_id_t S
snprintf(keyName, sizeof(keyName), "%s/%d", SIM_USED_COUNT, sim_idx);
if (MsgSettingSetInt(keyName, usedCnt) != MSG_SUCCESS)
- {
MSG_DEBUG("Error to set config data [%s]", keyName);
- }
- }
- else
- {
+ } else {
THROW(MsgException::SMS_PLG_ERROR, "######## Deleting Msg was Failed !!! SIM ID : [%d] #######", SimId);
}
}
@@ -567,18 +538,14 @@ void SmsPluginSimMsg::setReadStatus(msg_sim_slot_id_t sim_idx, msg_sim_id_t SimM
MSG_DEBUG("Sim Message ID [%d]", SimMsgId);
int ret = TAPI_API_SUCCESS;
- struct tapi_handle *handle = SmsPluginDSHandler::instance()->getTelHandle(sim_idx);
+ TapiHandle *handle = SmsPluginDSHandler::instance()->getTelHandle(sim_idx);
ret = tel_set_sms_message_status(handle, (int)SimMsgId, TAPI_NETTEXT_STATUS_READ, TapiEventSetMsgStatus, (void *)&SimMsgId);
if (ret == TAPI_API_SUCCESS)
- {
MSG_DEBUG("######## tel_set_sms_message_status Success !!! return : %d #######", ret);
- }
else
- {
THROW(MsgException::SMS_PLG_ERROR, "######## tel_set_sms_message_status Fail !!! return : %d #######", ret);
- }
msg_sim_id_t SimId = 0;
bool bResult = false;
@@ -586,64 +553,46 @@ void SmsPluginSimMsg::setReadStatus(msg_sim_slot_id_t sim_idx, msg_sim_id_t SimM
bResult = getSimEvent(&SimId);
if (bResult == true)
- {
MSG_DEBUG("######## Setting Read Status was Successful !!!, sim id=[%d] #######", SimId);
- }
else
- {
THROW(MsgException::SMS_PLG_ERROR, "######## Setting Read Status was Failed !!! #######");
- }
}
-void SmsPluginSimMsg::getSimMsgCount(struct tapi_handle *handle, MSG_SIM_COUNT_S *pSimMsgCnt)
+void SmsPluginSimMsg::getSimMsgCount(TapiHandle *handle, MSG_SIM_COUNT_S *pSimMsgCnt)
{
int ret = TAPI_API_SUCCESS;
ret = tel_get_sms_count(handle, TapiEventGetSimMsgCnt, NULL);
if (ret == TAPI_API_SUCCESS)
- {
MSG_DEBUG("######## tel_get_sms_count() Success !!! #######");
- }
else
- {
THROW(MsgException::SMS_PLG_ERROR, "######## tel_get_sms_count() Fail !!! return : %d #######", ret);
- }
if (getSimMsgCntEvent(handle, pSimMsgCnt) == true)
- {
MSG_DEBUG("######## Get Sim Msg Count was Successful !!! #######");
- }
else
- {
THROW(MsgException::SMS_PLG_ERROR, "######## Get Sim Msg Count was Failed !!! #######");
- }
}
-bool SmsPluginSimMsg::getSimMsg(struct tapi_handle *handle, msg_sim_id_t SimMsgId, MSG_MESSAGE_INFO_S *pMsgInfo, int *simIdList)
+bool SmsPluginSimMsg::getSimMsg(TapiHandle *handle, msg_sim_id_t SimMsgId, MSG_MESSAGE_INFO_S *pMsgInfo, int *simIdList)
{
int ret = TAPI_API_SUCCESS;
ret = tel_read_sms_in_sim(handle, SimMsgId, TapiEventGetSimMsg, simIdList);
- if (ret == TAPI_API_SUCCESS)
- {
+ if (ret == TAPI_API_SUCCESS) {
MSG_DEBUG("######## tel_read_sms_in_sim() Success !!! Sim ID : [%d] #######", SimMsgId);
- }
- else
- {
+ } else {
MSG_DEBUG("######## tel_read_sms_in_sim() Fail !!! return : %d #######", ret);
return false;
}
- if (getSimMsgEvent(handle, pMsgInfo) == true)
- {
+ if (getSimMsgEvent(handle, pMsgInfo) == true) {
MSG_DEBUG("######## Get Sim Msg was Successful !!! #######");
- }
- else
- {
+ } else {
MSG_DEBUG("######## Get Sim Msg was Failed !!! #######");
return false;
}
@@ -679,10 +628,10 @@ void SmsPluginSimMsg::convertTimeStamp(const MSG_MESSAGE_INFO_S* pMsgInfo, SMS_D
{
MSG_BEGIN();
- // encode time stamp
+ /* encode time stamp */
pDeliver->timeStamp.format = SMS_TIME_ABSOLUTE;
- // encode absolute time
+ /* encode absolute time */
struct tm timeinfo = {0,};
tzset();
localtime_r(&pMsgInfo->displayTime, &timeinfo);
@@ -712,32 +661,27 @@ void SmsPluginSimMsg::convertTimeStamp(const MSG_MESSAGE_INFO_S* pMsgInfo, SMS_D
}
-void SmsPluginSimMsg::setSimMsgCntEvent(struct tapi_handle *handle, const MSG_SIM_COUNT_S *pSimMsgCnt)
+void SmsPluginSimMsg::setSimMsgCntEvent(TapiHandle *handle, const MSG_SIM_COUNT_S *pSimMsgCnt)
{
mx.lock();
- MSG_DEBUG("Sim Message Count is %d.", pSimMsgCnt->usedCount);
+ MSG_INFO("Sim Message Count is %d.", pSimMsgCnt->usedCount);
int sim_idx = SmsPluginDSHandler::instance()->getSimIndex(handle);
char keyName[MAX_VCONFKEY_NAME_LEN]= {0,};
- for (int i=0; i < pSimMsgCnt->usedCount; i++)
- {
+ for (int i = 0; i < pSimMsgCnt->usedCount; i++) {
MSG_DEBUG("Sim Message Index is %d.", pSimMsgCnt->indexList[i]);
}
snprintf(keyName, sizeof(keyName), "%s/%d", SIM_USED_COUNT, sim_idx);
if (MsgSettingSetInt(keyName, pSimMsgCnt->usedCount) != MSG_SUCCESS)
- {
- MSG_DEBUG("Error to set config data [%s]", SIM_USED_COUNT);
- }
+ MSG_ERR("Error to set config data [%s]", SIM_USED_COUNT);
memset(keyName, 0, sizeof(keyName));
snprintf(keyName, sizeof(keyName), "%s/%d", SIM_TOTAL_COUNT, sim_idx);
if (MsgSettingSetInt(keyName, (int)pSimMsgCnt->totalCount) != MSG_SUCCESS)
- {
- MSG_DEBUG("Error to set config data [%s]", SIM_TOTAL_COUNT);
- }
+ MSG_ERR("Error to set config data [%s]", SIM_TOTAL_COUNT);
memset(&simMsgCnt, 0x00, sizeof(MSG_SIM_COUNT_S));
memcpy(&simMsgCnt, pSimMsgCnt, sizeof(MSG_SIM_COUNT_S));
@@ -748,7 +692,7 @@ void SmsPluginSimMsg::setSimMsgCntEvent(struct tapi_handle *handle, const MSG_SI
}
-bool SmsPluginSimMsg::getSimMsgCntEvent(struct tapi_handle *handle, MSG_SIM_COUNT_S *pSimMsgCnt)
+bool SmsPluginSimMsg::getSimMsgCntEvent(TapiHandle *handle, MSG_SIM_COUNT_S *pSimMsgCnt)
{
int ret = 0;
@@ -758,9 +702,8 @@ bool SmsPluginSimMsg::getSimMsgCntEvent(struct tapi_handle *handle, MSG_SIM_COUN
mx.unlock();
- if (ret == ETIMEDOUT)
- {
- MSG_DEBUG("WARNING: TAPI callback TIME-OUT");
+ if (ret == ETIMEDOUT) {
+ MSG_ERR("WARNING: TAPI callback TIME-OUT");
return false;
}
@@ -769,7 +712,7 @@ bool SmsPluginSimMsg::getSimMsgCntEvent(struct tapi_handle *handle, MSG_SIM_COUN
return true;
}
-void SmsPluginSimMsg::setSimMsgEvent(struct tapi_handle *handle, const MSG_MESSAGE_INFO_S *pMsgInfo, bool bSuccess)
+void SmsPluginSimMsg::setSimMsgEvent(TapiHandle *handle, const MSG_MESSAGE_INFO_S *pMsgInfo, bool bSuccess)
{
mx.lock();
@@ -778,8 +721,7 @@ void SmsPluginSimMsg::setSimMsgEvent(struct tapi_handle *handle, const MSG_MESSA
memset(&simMsgInfo, 0x00, sizeof(MSG_MESSAGE_INFO_S));
memset(&simAddrInfo, 0x00, sizeof(MSG_ADDRESS_INFO_S));
- if (bTapiResult == true)
- {
+ if (bTapiResult == true) {
MSG_DEBUG("Success to get sim msg - Id : [%d]", pMsgInfo->msgId);
memcpy(&simMsgInfo, pMsgInfo, sizeof(MSG_MESSAGE_INFO_S));
@@ -793,7 +735,7 @@ void SmsPluginSimMsg::setSimMsgEvent(struct tapi_handle *handle, const MSG_MESSA
}
-bool SmsPluginSimMsg::getSimMsgEvent(struct tapi_handle *handle, MSG_MESSAGE_INFO_S *pMsgInfo)
+bool SmsPluginSimMsg::getSimMsgEvent(TapiHandle *handle, MSG_MESSAGE_INFO_S *pMsgInfo)
{
int ret = 0;
@@ -804,16 +746,14 @@ bool SmsPluginSimMsg::getSimMsgEvent(struct tapi_handle *handle, MSG_MESSAGE_INF
mx.unlock();
- if (ret == ETIMEDOUT)
- {
+ if (ret == ETIMEDOUT) {
MSG_DEBUG("WARNING: TAPI callback TIME-OUT");
return false;
}
memset(pMsgInfo, 0x00, sizeof(MSG_MESSAGE_INFO_S));
- if (bTapiResult == true)
- {
+ if (bTapiResult == true) {
memcpy(pMsgInfo, &simMsgInfo, sizeof(MSG_MESSAGE_INFO_S));
pMsgInfo->addressList = (MSG_ADDRESS_INFO_S *)calloc(1, sizeof(MSG_ADDRESS_INFO_S));
memset(pMsgInfo->addressList, 0x00, sizeof(MSG_ADDRESS_INFO_S));
@@ -826,7 +766,7 @@ bool SmsPluginSimMsg::getSimMsgEvent(struct tapi_handle *handle, MSG_MESSAGE_INF
}
-void SmsPluginSimMsg::setSaveSimMsgEvent(struct tapi_handle *handle, int simId, int result)
+void SmsPluginSimMsg::setSaveSimMsgEvent(TapiHandle *handle, int simId, int result)
{
msg_error_t err = MSG_SUCCESS;
@@ -868,7 +808,7 @@ void SmsPluginSimMsg::setSaveSimMsgEvent(struct tapi_handle *handle, int simId,
}
-void SmsPluginSimMsg::setSaveClass2MsgEvent(struct tapi_handle *handle, int simId, int result, MSG_MESSAGE_INFO_S *pMsgInfo)
+void SmsPluginSimMsg::setSaveClass2MsgEvent(TapiHandle *handle, int simId, int result, MSG_MESSAGE_INFO_S *pMsgInfo)
{
msg_error_t err = MSG_SUCCESS;
// int sim_idx = SmsPluginDSHandler::instance()->getSimIndex(handle);
@@ -905,9 +845,7 @@ void SmsPluginSimMsg::setSaveClass2MsgEvent(struct tapi_handle *handle, int simI
err = SmsPluginEventHandler::instance()->callbackMsgIncoming(pMsgInfo);
if (err != MSG_SUCCESS)
- {
MSG_DEBUG("callbackMsgIncoming() Error !! [%d]", err);
- }
}
if (isNewSimMsg == true) {
@@ -918,9 +856,7 @@ void SmsPluginSimMsg::setSaveClass2MsgEvent(struct tapi_handle *handle, int simI
usedCnt++;
if (MsgSettingSetInt(keyName, usedCnt) != MSG_SUCCESS)
- {
MSG_DEBUG("Error to set config data [%s]", SIM_USED_COUNT);
- }
}
if (simMsgDataInfo.totalSegment >= 1 && simIdList[simMsgDataInfo.totalSegment-1] != 0) {
@@ -933,7 +869,7 @@ void SmsPluginSimMsg::setSaveClass2MsgEvent(struct tapi_handle *handle, int simI
err = MSG_ERR_UNKNOWN;
}
- // Send Deliver Report
+ /* Send Deliver Report */
SmsPluginTransport::instance()->sendDeliverReport(handle, err);
}
@@ -962,8 +898,7 @@ bool SmsPluginSimMsg::getSimEvent(msg_sim_id_t *pSimId)
mx.unlock();
- if (ret == ETIMEDOUT)
- {
+ if (ret == ETIMEDOUT) {
MSG_DEBUG("WARNING: TAPI callback TIME-OUT");
return false;
}
@@ -1001,8 +936,7 @@ bool SmsPluginSimMsg::getDelSimEvent(int *pSimId)
mx.unlock();
- if (ret == ETIMEDOUT)
- {
+ if (ret == ETIMEDOUT) {
MSG_DEBUG("WARNING: TAPI callback TIME-OUT");
return false;
}
diff --git a/plugin/sms_plugin/SmsPluginStorage.cpp b/plugin/sms_plugin/SmsPluginStorage.cpp
index 5f42011..c1e41b0 100755
--- a/plugin/sms_plugin/SmsPluginStorage.cpp
+++ b/plugin/sms_plugin/SmsPluginStorage.cpp
@@ -159,7 +159,7 @@ msg_error_t SmsPluginStorage::updateMsgDeliverStatus(MSG_MESSAGE_INFO_S *pMsgInf
MSG_DEBUG("Query Failed : [%s]", sqlQuery);
return MSG_ERR_DB_EXEC;
}
- } else if(pMsgInfo->networkStatus == MSG_NETWORK_DELIVER_EXPIRED) {
+ } else if (pMsgInfo->networkStatus == MSG_NETWORK_DELIVER_EXPIRED) {
memset(sqlQuery, 0x00, sizeof(sqlQuery));
snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET MSG_REF = -1, STATUS = %d, TIME = %d WHERE MSG_ID = %d and ADDRESS_VAL = '%s';",
MSGFW_SMS_REPORT_TABLE_NAME, 0, (int)pMsgInfo->displayTime, msgId, normalNum);
@@ -169,7 +169,7 @@ msg_error_t SmsPluginStorage::updateMsgDeliverStatus(MSG_MESSAGE_INFO_S *pMsgInf
MSG_DEBUG("Query Failed : [%s]", sqlQuery);
return MSG_ERR_DB_EXEC;
}
- } else if(pMsgInfo->networkStatus == MSG_NETWORK_DELIVER_PENDING) {
+ } else if (pMsgInfo->networkStatus == MSG_NETWORK_DELIVER_PENDING) {
memset(sqlQuery, 0x00, sizeof(sqlQuery));
snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET MSG_REF = -1, STATUS = %d, TIME = %d WHERE MSG_ID = %d and ADDRESS_VAL = '%s';",
MSGFW_SMS_REPORT_TABLE_NAME, 3, (int)pMsgInfo->displayTime, msgId, normalNum);
@@ -179,7 +179,7 @@ msg_error_t SmsPluginStorage::updateMsgDeliverStatus(MSG_MESSAGE_INFO_S *pMsgInf
MSG_DEBUG("Query Failed : [%s]", sqlQuery);
return MSG_ERR_DB_EXEC;
}
- } else if(pMsgInfo->networkStatus == MSG_NETWORK_DELIVER_FAIL) {
+ } else if (pMsgInfo->networkStatus == MSG_NETWORK_DELIVER_FAIL) {
memset(sqlQuery, 0x00, sizeof(sqlQuery));
snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET MSG_REF = -1, STATUS = %d, TIME = %d WHERE MSG_ID = %d and ADDRESS_VAL = '%s';",
MSGFW_SMS_REPORT_TABLE_NAME, 8, (int)pMsgInfo->displayTime, msgId, normalNum);
@@ -332,63 +332,10 @@ msg_error_t SmsPluginStorage::addSimMessage(MSG_MESSAGE_INFO_S *pSimMsgInfo, int
char sqlQuery[MAX_QUERY_LEN+1];
-// dbHandle->beginTrans();
-
-# if 0
- msg_message_id_t msgId = 0;
- msg_thread_id_t convId = 0;
-
- err = MsgStoAddAddress(dbHandle, pSimMsgInfo, &convId);
-
- if (err != MSG_SUCCESS) {
- dbHandle->endTrans(false);
- return err;
- }
-
- pSimMsgInfo->threadId = convId;
-
- err = dbHandle->getRowId(MSGFW_MESSAGE_TABLE_NAME, &msgId);
-
- if (err != MSG_SUCCESS) {
- dbHandle->endTrans(false);
- return err;
- }
-
- //simId = pSimMsgInfo->msgId;
- pSimMsgInfo->msgId = msgId;
-
- /** Add Message */
- memset(sqlQuery, 0x00, sizeof(sqlQuery));
-
- snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d, %d, %d, %d, %d, %ld, %d, %d, %d, %d, %d, %d, %ld, %d, ?, '', '', ?, 0, 0, 0);",
- MSGFW_MESSAGE_TABLE_NAME, msgId, convId, pSimMsgInfo->folderId, pSimMsgInfo->storageId,
- pSimMsgInfo->msgType.mainType, pSimMsgInfo->msgType.subType, pSimMsgInfo->displayTime, pSimMsgInfo->dataSize,
- pSimMsgInfo->networkStatus, pSimMsgInfo->bRead, pSimMsgInfo->bProtected, pSimMsgInfo->priority,
- pSimMsgInfo->direction, 0, pSimMsgInfo->bBackup);
-
- MSG_DEBUG("QUERY : %s", sqlQuery);
-
- if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) {
- dbHandle->endTrans(false);
- return MSG_ERR_DB_PREPARE;
- }
-
- dbHandle->bindText(pSimMsgInfo->subject, 1);
-
- dbHandle->bindText(pSimMsgInfo->msgText, 2);
-
- if (dbHandle->stepQuery() != MSG_ERR_DB_DONE) {
- dbHandle->endTrans(false);
- return MSG_ERR_DB_STEP;
- }
-
- dbHandle->finalizeQuery();
-#endif
- if(simIdList) {
+ if (simIdList) {
MSG_DEBUG("simIdList exist.");
- for(int i=0; i < MAX_SIM_SMS_NUM; ++i)
- {
- if(simIdList[i]) {
+ for (int i = 0; i < MAX_SIM_SMS_NUM; ++i) {
+ if (simIdList[i]) {
simId = simIdList[i] - 1;
memset(sqlQuery, 0x00, sizeof(sqlQuery));
snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d);",
@@ -397,16 +344,14 @@ msg_error_t SmsPluginStorage::addSimMessage(MSG_MESSAGE_INFO_S *pSimMsgInfo, int
MSG_DEBUG("QUERY : %s", sqlQuery);
if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) {
-// dbHandle->endTrans(false);
return MSG_ERR_DB_EXEC;
}
- } else
+ } else {
break;
+ }
}
}
-// dbHandle->endTrans(true);
-
return err;
}
@@ -474,7 +419,7 @@ msg_error_t SmsPluginStorage::checkMessage(MSG_MESSAGE_INFO_S *pMsgInfo)
pMsgInfo->folderId = 0;
err = MSG_SUCCESS;
}
- else if(pMsgInfo->msgType.classType == MSG_CLASS_2 &&
+ else if (pMsgInfo->msgType.classType == MSG_CLASS_2 &&
(pMsgInfo->msgType.subType == MSG_NORMAL_SMS || pMsgInfo->msgType.subType == MSG_REJECT_SMS)) {
err = addClass2Message(pMsgInfo);
}
@@ -708,7 +653,7 @@ msg_error_t SmsPluginStorage::deleteSmsMessage(msg_message_id_t msgId)
}
}
- MsgRefreshAllNotification(true, false, false);
+ MsgRefreshAllNotification(true, false, MSG_ACTIVE_NOTI_TYPE_NONE);
return MSG_SUCCESS;
}
@@ -719,6 +664,19 @@ msg_error_t SmsPluginStorage::addClass2Message(MSG_MESSAGE_INFO_S *pMsgInfo)
MSG_BEGIN();
msg_error_t err = MSG_SUCCESS;
+ bool bSimSst = true;
+
+ char keyName[MAX_VCONFKEY_NAME_LEN];
+ memset(keyName, 0x00, sizeof(keyName));
+ snprintf(keyName, sizeof(keyName), "%s/%d", MSG_SIM_SERVICE_TABLE, pMsgInfo->sim_idx);
+
+ if (MsgSettingGetBool(keyName, &bSimSst) != MSG_SUCCESS) {
+ MSG_ERR("MsgSettingGetBool [%s] failed", keyName);
+ }
+
+ if (bSimSst == false) {
+ return MSG_ERR_SIM_STORAGE_FULL;
+ }
pthread_t thd;
memset(&msgInfo, 0, sizeof(MSG_MESSAGE_INFO_S));
memset(&addrInfo, 0, sizeof(MSG_ADDRESS_INFO_S));
@@ -726,12 +684,9 @@ msg_error_t SmsPluginStorage::addClass2Message(MSG_MESSAGE_INFO_S *pMsgInfo)
memcpy(&addrInfo, pMsgInfo->addressList, sizeof(MSG_ADDRESS_INFO_S));
msgInfo.addressList = &addrInfo;
- if(pthread_create(&thd, NULL, &class2_thread, (void *)&msgInfo) < 0)
- {
+ if (pthread_create(&thd, NULL, &class2_thread, (void *)&msgInfo) < 0)
MSG_DEBUG("pthread_create() error");
- }
- //pthread_join(thd, (void **)&err);
pthread_detach(thd);
#if 0
@@ -761,7 +716,7 @@ void* SmsPluginStorage::class2_thread(void *data)
if (err == MSG_SUCCESS) {
MSG_DEBUG("Success to saveClass2Message.");
} else {
- MSG_DEBUG("Fail to saveClass2Message : [%d]", err);
+ MSG_ERR("Fail to saveClass2Message : [%d]", err);
}
MSG_END();
@@ -852,28 +807,29 @@ msg_error_t SmsPluginStorage::addSmsSendOption(MSG_MESSAGE_INFO_S *pMsg, MSG_SEN
MsgSettingGetBool(SMS_SEND_DELIVERY_REPORT, &pSendOptInfo->bDeliverReq);
MsgSettingGetBool(SMS_SEND_REPLY_PATH, &pSendOptInfo->option.smsSendOptInfo.bReplyPath);
-// if (pSendOptInfo->bDeliverReq || pSendOptInfo->option.smsSendOptInfo.bReplyPath) {
-// pSendOptInfo->bSetting = true;
- MsgSettingGetBool(MSG_KEEP_COPY, &pSendOptInfo->bKeepCopy);
-// }
+ MsgSettingGetBool(MSG_KEEP_COPY, &pSendOptInfo->bKeepCopy);
}
-// if (pSendOptInfo->bSetting == true) {
- MsgDbHandler *dbHandle = getDbHandle();
+ MsgDbHandler *dbHandle = getDbHandle();
- char sqlQuery[MAX_QUERY_LEN+1];
+ char sqlQuery[MAX_QUERY_LEN+1];
- memset(sqlQuery, 0x00, sizeof(sqlQuery));
- snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d, %d, %d, %d);",
- MSGFW_SMS_SENDOPT_TABLE_NAME, pMsg->msgId, pSendOptInfo->bDeliverReq,
- pSendOptInfo->bKeepCopy, pSendOptInfo->option.smsSendOptInfo.bReplyPath, pMsg->encodeType);
+ dbHandle->beginTrans();
- MSG_DEBUG("Query = [%s]", sqlQuery);
+ memset(sqlQuery, 0x00, sizeof(sqlQuery));
+ snprintf(sqlQuery, sizeof(sqlQuery), "INSERT INTO %s VALUES (%d, %d, %d, %d, %d);",
+ MSGFW_SMS_SENDOPT_TABLE_NAME, pMsg->msgId, pSendOptInfo->bDeliverReq,
+ pSendOptInfo->bKeepCopy, pSendOptInfo->option.smsSendOptInfo.bReplyPath, pMsg->encodeType);
- if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) {
- err = MSG_ERR_DB_EXEC;
- }
-// }
+ MSG_DEBUG("Query = [%s]", sqlQuery);
+
+ if (dbHandle->execQuery(sqlQuery) != MSG_SUCCESS) {
+ MSG_ERR("execQuery() is failed");
+ dbHandle->endTrans(false);
+ return MSG_ERR_DB_EXEC;
+ }
+
+ dbHandle->endTrans(true);
MSG_END();
@@ -992,13 +948,13 @@ msg_error_t SmsPluginStorage::getRegisteredPushEvent(char* pPushHeader, int *cou
err = dbHandle->getTable(sqlQuery, &rowCnt, &index);
MSG_DEBUG("rowCnt: %d", rowCnt);
- if (err == MSG_ERR_DB_NORECORD) {
- dbHandle->freeTable();
- return MSG_SUCCESS;
- }
- else if ( err != MSG_SUCCESS) {
+ if (err != MSG_SUCCESS) {
dbHandle->freeTable();
- return err;
+
+ if (err == MSG_ERR_DB_NORECORD)
+ return MSG_SUCCESS;
+ else
+ return err;
}
char contentType[MAX_WAPPUSH_CONTENT_TYPE_LEN + 1] = {0,};
@@ -1019,12 +975,12 @@ msg_error_t SmsPluginStorage::getRegisteredPushEvent(char* pPushHeader, int *cou
//MSG_DEBUG("content_type: %s, app_id: %s", content_type, app_id);
_content_type = strcasestr(pPushHeader, contentType);
- if(_content_type) {
+ if (_content_type) {
_app_id = strcasestr(pPushHeader, appId);
- if(appcode)
+ if (appcode)
default_appcode = appcode;
- if(_app_id) {
+ if (_app_id) {
PUSH_APPLICATION_INFO_S pInfo = {0, };
pInfo.appcode = appcode;
MSG_SEC_DEBUG("appcode: %d, app_id: %s", pInfo.appcode, appId);
@@ -1037,9 +993,8 @@ msg_error_t SmsPluginStorage::getRegisteredPushEvent(char* pPushHeader, int *cou
}
}
- if(!found && default_appcode != SMS_WAP_APPLICATION_LBS)
- {
- // perform default action.
+ if (!found && default_appcode != SMS_WAP_APPLICATION_LBS) {
+ /* perform default action. */
PUSH_APPLICATION_INFO_S pInfo = {0, };
pInfo.appcode = default_appcode;
memset(appId, 0, MAX_WAPPUSH_ID_LEN + 1);
@@ -1057,14 +1012,13 @@ msg_error_t SmsPluginStorage::getRegisteredPushEvent(char* pPushHeader, int *cou
msg_error_t SmsPluginStorage::getnthPushEvent(int index, int *appcode)
{
msg_error_t err = MSG_SUCCESS;
- if((unsigned int)index > pushAppInfoList.size() - 1)
+ if ((unsigned int)index > pushAppInfoList.size() - 1)
return MSG_ERR_INVALID_PARAMETER;
std::list<PUSH_APPLICATION_INFO_S>::iterator it = pushAppInfoList.begin();
int count = 0;
- for (; it != pushAppInfoList.end(); it++)
- {
- if(index == count){
+ for (; it != pushAppInfoList.end(); it++) {
+ if (index == count){
*appcode = it->appcode;
break;
}
@@ -1085,3 +1039,70 @@ msg_error_t SmsPluginStorage::releasePushEvent()
return err;
}
+
+
+msg_error_t SmsPluginStorage::updateSmsMessage(MSG_MESSAGE_INFO_S *pMsgInfo)
+{
+ MSG_BEGIN();
+ MsgDbHandler *dbHandle = getDbHandle();
+ char sqlQuery[MAX_QUERY_LEN+1] = {0,};
+ msg_thread_id_t convId = 0;
+
+ dbHandle->beginTrans();
+
+ if (pMsgInfo->nAddressCnt > 0) {
+ pMsgInfo->threadId = 0;
+ msg_error_t err = MsgStoAddAddress(dbHandle, pMsgInfo, &convId);
+
+ if (err != MSG_SUCCESS) {
+ dbHandle->endTrans(false);
+ return err;
+ }
+ }
+
+ int fileSize = 0;
+
+ char *pFileData = NULL;
+ unique_ptr<char*, void(*)(char**)> buf(&pFileData, unique_ptr_deleter);
+
+ /* Get File Data */
+ if (pMsgInfo->bTextSms == false) {
+ if (MsgOpenAndReadFile(pMsgInfo->msgData, &pFileData, &fileSize) == false) {
+ dbHandle->endTrans(false);
+ return MSG_ERR_STORAGE_ERROR;
+ }
+ }
+
+ snprintf(sqlQuery, sizeof(sqlQuery), "UPDATE %s SET CONV_ID = %d, FOLDER_ID = %d, STORAGE_ID = %d, MAIN_TYPE = %d, SUB_TYPE = %d, \
+ DISPLAY_TIME = %lu, DATA_SIZE = %d, NETWORK_STATUS = %d, READ_STATUS = %d, PROTECTED = %d, PRIORITY = %d, MSG_DIRECTION = %d, \
+ BACKUP = %d, SUBJECT = ?, MSG_TEXT = ?, SIM_INDEX = %d \
+ WHERE MSG_ID = %d;",
+ MSGFW_MESSAGE_TABLE_NAME, convId, pMsgInfo->folderId, pMsgInfo->storageId, pMsgInfo->msgType.mainType, pMsgInfo->msgType.subType, pMsgInfo->displayTime, pMsgInfo->dataSize,
+ pMsgInfo->networkStatus, pMsgInfo->bRead, pMsgInfo->bProtected, pMsgInfo->priority, pMsgInfo->direction, pMsgInfo->bBackup, pMsgInfo->sim_idx, pMsgInfo->msgId);
+
+ if (dbHandle->prepareQuery(sqlQuery) != MSG_SUCCESS) {
+ dbHandle->endTrans(false);
+ return MSG_ERR_DB_EXEC;
+ }
+
+ dbHandle->bindText(pMsgInfo->subject, 1);
+
+ if (pMsgInfo->bTextSms == false)
+ dbHandle->bindText(pFileData, 2);
+ else
+ dbHandle->bindText(pMsgInfo->msgText, 2);
+
+ MSG_DEBUG("%s", sqlQuery);
+
+ if (dbHandle->stepQuery() != MSG_ERR_DB_DONE) {
+ dbHandle->finalizeQuery();
+ dbHandle->endTrans(false);
+ return MSG_ERR_DB_EXEC;
+ }
+
+ dbHandle->finalizeQuery();
+ dbHandle->endTrans(true);
+
+ MSG_END();
+ return MSG_SUCCESS;
+}
diff --git a/plugin/sms_plugin/SmsPluginTpduCodec.cpp b/plugin/sms_plugin/SmsPluginTpduCodec.cpp
index 789f14b..50e1abe 100755
--- a/plugin/sms_plugin/SmsPluginTpduCodec.cpp
+++ b/plugin/sms_plugin/SmsPluginTpduCodec.cpp
@@ -48,22 +48,21 @@ int SmsPluginTpduCodec::encodeTpdu(const SMS_TPDU_S *pSmsTpdu, char *pTpdu)
{
int tpduLen = 0;
- switch (pSmsTpdu->tpduType)
- {
- case SMS_TPDU_SUBMIT:
- tpduLen = encodeSubmit(&(pSmsTpdu->data.submit), pTpdu);
+ switch (pSmsTpdu->tpduType) {
+ case SMS_TPDU_SUBMIT:
+ tpduLen = encodeSubmit(&(pSmsTpdu->data.submit), pTpdu);
break;
- case SMS_TPDU_DELIVER:
- tpduLen = encodeDeliver(&(pSmsTpdu->data.deliver), pTpdu);
+ case SMS_TPDU_DELIVER:
+ tpduLen = encodeDeliver(&(pSmsTpdu->data.deliver), pTpdu);
break;
- case SMS_TPDU_DELIVER_REP:
- tpduLen = encodeDeliverReport(&(pSmsTpdu->data.deliverRep), pTpdu);
+ case SMS_TPDU_DELIVER_REP:
+ tpduLen = encodeDeliverReport(&(pSmsTpdu->data.deliverRep), pTpdu);
break;
- case SMS_TPDU_STATUS_REP:
- tpduLen = encodeStatusReport(&(pSmsTpdu->data.statusRep), pTpdu);
+ case SMS_TPDU_STATUS_REP:
+ tpduLen = encodeStatusReport(&(pSmsTpdu->data.statusRep), pTpdu);
break;
}
@@ -77,21 +76,20 @@ int SmsPluginTpduCodec::decodeTpdu(const unsigned char *pTpdu, int TpduLen, SMS_
char mti = pTpdu[0] & 0x03;
- switch (mti)
- {
- case 0x00:
- pSmsTpdu->tpduType = SMS_TPDU_DELIVER;
- decodeLen = decodeDeliver(pTpdu, TpduLen, &(pSmsTpdu->data.deliver));
+ switch (mti) {
+ case 0x00:
+ pSmsTpdu->tpduType = SMS_TPDU_DELIVER;
+ decodeLen = decodeDeliver(pTpdu, TpduLen, &(pSmsTpdu->data.deliver));
break;
- case 0x01:
- pSmsTpdu->tpduType = SMS_TPDU_SUBMIT;
- decodeLen = decodeSubmit(pTpdu, TpduLen, &(pSmsTpdu->data.submit));
+ case 0x01:
+ pSmsTpdu->tpduType = SMS_TPDU_SUBMIT;
+ decodeLen = decodeSubmit(pTpdu, TpduLen, &(pSmsTpdu->data.submit));
break;
- case 0x02:
- pSmsTpdu->tpduType = SMS_TPDU_STATUS_REP;
- decodeLen = decodeStatusReport(pTpdu, TpduLen, &(pSmsTpdu->data.statusRep));
+ case 0x02:
+ pSmsTpdu->tpduType = SMS_TPDU_STATUS_REP;
+ decodeLen = decodeStatusReport(pTpdu, TpduLen, &(pSmsTpdu->data.statusRep));
break;
}
@@ -112,78 +110,75 @@ int SmsPluginTpduCodec::encodeSubmit(const SMS_SUBMIT_S *pSubmit, char *pTpdu)
char* vpTime = NULL;
unique_ptr<char*, void(*)(char**)> vpBuf(&vpTime, unique_ptr_deleter);
- //TP-MTI
+ /* TP-MTI */
pTpdu[offset] = 0x01;
- //TP-RD
- if(pSubmit->bRejectDup == true)
+ /* TP-RD */
+ if (pSubmit->bRejectDup == true)
pTpdu[offset] |= 0x04;
- //TP-VPF
- switch (pSubmit->vpf)
- {
- case SMS_VPF_NOT_PRESENT:
- break;
- case SMS_VPF_ENHANCED:
- pTpdu[offset] |= 0x08;
- break;
- case SMS_VPF_RELATIVE:
- pTpdu[offset] |= 0x10;
- break;
- case SMS_VPF_ABSOLUTE:
- pTpdu[offset] |= 0x18;
- break;
- default:
- break;
+ /* TP-VPF */
+ switch (pSubmit->vpf) {
+ case SMS_VPF_NOT_PRESENT:
+ break;
+ case SMS_VPF_ENHANCED:
+ pTpdu[offset] |= 0x08;
+ break;
+ case SMS_VPF_RELATIVE:
+ pTpdu[offset] |= 0x10;
+ break;
+ case SMS_VPF_ABSOLUTE:
+ pTpdu[offset] |= 0x18;
+ break;
+ default:
+ break;
}
- //TP-SRR
+ /* TP-SRR */
if (pSubmit->bStatusReport == true)
pTpdu[offset] |= 0x20;
MSG_DEBUG("TP-SRR pSubmit->bStatusReport : %d.", pSubmit->bStatusReport);
- //TP-UDHI
+ /* TP-UDHI */
if (pSubmit->bHeaderInd == true)
pTpdu[offset] |= 0x40;
- //TP-RP
+ /* TP-RP */
if (pSubmit->bReplyPath == true)
pTpdu[offset] |= 0x80;
offset++;
- //TP-MR
+ /* TP-MR */
pTpdu[offset++] = pSubmit->msgRef;
MSG_DEBUG("TP-MR pSubmit->msgRef : %d.", pSubmit->msgRef);
- //TP-DA
+ /* TP-DA */
length = SmsPluginParamCodec::encodeAddress(&pSubmit->destAddress, &address);
memcpy(&(pTpdu[offset]), address, length);
offset += length;
MSG_DEBUG("TP-DA length : %d.", length);
- //TP-PID
+ /* TP-PID */
pTpdu[offset++] = pSubmit->pid;
MSG_DEBUG("TP-PID pSubmit->pid : %d.", pSubmit->pid);
- //TP-DCS
+ /* TP-DCS */
length = SmsPluginParamCodec::encodeDCS(&pSubmit->dcs, &dcs);
memcpy(&(pTpdu[offset]), dcs, length);
offset += length;
MSG_DEBUG("TP-DCS length : %d.", length);
- //TP-VP
- if (pSubmit->vpf != SMS_VPF_NOT_PRESENT)
- {
+ /* TP-VP */
+ if (pSubmit->vpf != SMS_VPF_NOT_PRESENT) {
length = SmsPluginParamCodec::encodeTime(&pSubmit->validityPeriod, &vpTime);
- if (length > 0)
- {
+ if (length > 0) {
memcpy(&(pTpdu[offset]), vpTime, length);
offset += length;
}
@@ -191,7 +186,7 @@ int SmsPluginTpduCodec::encodeSubmit(const SMS_SUBMIT_S *pSubmit, char *pTpdu)
encodeSize = SmsPluginUDCodec::encodeUserData(&(pSubmit->userData), pSubmit->dcs.codingScheme, &(pTpdu[offset]));
-MSG_DEBUG("encodeSize : %d", encodeSize);
+ MSG_DEBUG("encodeSize : %d", encodeSize);
offset += encodeSize;
@@ -221,46 +216,46 @@ int SmsPluginTpduCodec::encodeDeliver(const SMS_DELIVER_S *pDeliver, char *pTpdu
char* scts = NULL;
unique_ptr<char*, void(*)(char**)> timeBuf(&scts, unique_ptr_deleter);
- // TP-MTI : 00
+ /* TP-MTI : 00 */
pTpdu[offset] = 0x00;
- // TP-MMS
+ /* TP-MMS */
if (pDeliver->bMoreMsg == false)
pTpdu[offset] |= 0x04;
- // TP-SRI
+ /* TP-SRI */
if (pDeliver->bStatusReport == true)
pTpdu[offset] |= 0x20;
- // TP-UDHI
+ /* TP-UDHI */
if (pDeliver->bHeaderInd == true)
pTpdu[offset] |= 0x40;
- // TP-RP
+ /* TP-RP */
if (pDeliver->bReplyPath == true)
pTpdu[offset] |= 0x80;
offset++;
- // TP-OA
+ /* TP-OA */
length = SmsPluginParamCodec::encodeAddress(&pDeliver->originAddress, &address);
memcpy(&(pTpdu[offset]), address, length);
offset += length;
- // TP-PID
+ /* TP-PID */
pTpdu[offset++] = pDeliver->pid;
- // TP-DCS
+ /* TP-DCS */
length = SmsPluginParamCodec::encodeDCS(&pDeliver->dcs, &dcs);
memcpy(&(pTpdu[offset]), dcs, length);
offset += length;
- // TP-SCTS
+ /* TP-SCTS */
length = SmsPluginParamCodec::encodeTime(&pDeliver->timeStamp, &scts);
memcpy(&(pTpdu[offset]), scts, length);
offset += length;
- // TP-UDL & TP-UD
+ /* TP-UDL & TP-UD */
encodeSize = SmsPluginUDCodec::encodeUserData(&(pDeliver->userData), pDeliver->dcs.codingScheme, &(pTpdu[offset]));
MSG_DEBUG("encodeSize : %d", encodeSize);
@@ -275,31 +270,30 @@ int SmsPluginTpduCodec::encodeDeliverReport(const SMS_DELIVER_REPORT_S *pDeliver
{
int offset = 0;
- // TP-MTI : 00
+ /* TP-MTI : 00 */
pTpdu[offset] = 0x00;
- // TP-UDHI
+ /* TP-UDHI */
if (pDeliverRep->bHeaderInd == true)
pTpdu[offset] |= 0x40;
offset++;
- // TP-FCS
+ /* TP-FCS */
if (pDeliverRep->reportType == SMS_REPORT_NEGATIVE) {
pTpdu[offset++] = pDeliverRep->failCause;
MSG_DEBUG("Delivery report : fail cause = [%02x]", pDeliverRep->failCause);
}
- // TP-PI
+ /* TP-PI */
pTpdu[offset++] = pDeliverRep->paramInd;
- // TP-PID
+ /* TP-PID */
if (pDeliverRep->paramInd & 0x01)
pTpdu[offset++] = pDeliverRep->pid;
- // TP-DCS
- if (pDeliverRep->paramInd & 0x02)
- {
+ /* TP-DCS */
+ if (pDeliverRep->paramInd & 0x02) {
int length = 0;
char* dcs = NULL;
@@ -311,9 +305,8 @@ int SmsPluginTpduCodec::encodeDeliverReport(const SMS_DELIVER_REPORT_S *pDeliver
offset += length;
}
- // TP-UDL & TP-UD
- if (pDeliverRep->paramInd & 0x04)
- {
+ /* TP-UDL & TP-UD */
+ if (pDeliverRep->paramInd & 0x04) {
int encodeSize = 0;
encodeSize = SmsPluginUDCodec::encodeUserData(&(pDeliverRep->userData), pDeliverRep->dcs.codingScheme, &(pTpdu[offset]));
@@ -342,54 +335,53 @@ int SmsPluginTpduCodec::encodeStatusReport(const SMS_STATUS_REPORT_S *pStatusRep
char* dt = NULL;
unique_ptr<char*, void(*)(char**)> dtBuf(&dt, unique_ptr_deleter);
- // TP-MTI : 10
+ /* TP-MTI : 10 */
pTpdu[offset] = 0x02;
- // TP-MMS
+ /* TP-MMS */
if (pStatusRep->bMoreMsg == true)
pTpdu[offset] |= 0x04;
- // TP-SRQ
+ /* TP-SRQ */
if (pStatusRep->bStatusReport == true)
pTpdu[offset] |= 0x20;
- // TP-UDHI
+ /* TP-UDHI */
if (pStatusRep->bHeaderInd == true)
pTpdu[offset] |= 0x40;
offset++;
- // TP-MR
+ /* TP-MR */
pTpdu[offset++] = pStatusRep->msgRef;
- // TP-RA
+ /* TP-RA */
length = SmsPluginParamCodec::encodeAddress(&pStatusRep->recipAddress, &address);
memcpy(&(pTpdu[offset]), address, length);
offset += length;
- // TP-SCTS
+ /* TP-SCTS */
length = SmsPluginParamCodec::encodeTime(&pStatusRep->timeStamp, &scts);
memcpy(&(pTpdu[offset]), scts, length);
offset += length;
- // TP-DT
+ /* TP-DT */
length = SmsPluginParamCodec::encodeTime(&pStatusRep->dischargeTime, &dt);
memcpy(&(pTpdu[offset]), dt, length);
offset += length;
- // TP-Status
+ /* TP-Status */
pTpdu[offset++] = pStatusRep->status;
- // TP-PI
+ /* TP-PI */
pTpdu[offset++] = pStatusRep->paramInd;
- // TP-PID
+ /* TP-PID */
if (pStatusRep->paramInd & 0x01)
pTpdu[offset++] = pStatusRep->pid;
- // TP-DCS
- if (pStatusRep->paramInd & 0x02)
- {
+ /* TP-DCS */
+ if (pStatusRep->paramInd & 0x02) {
int length = 0;
char* dcs = NULL;
@@ -401,9 +393,8 @@ int SmsPluginTpduCodec::encodeStatusReport(const SMS_STATUS_REPORT_S *pStatusRep
offset += length;
}
- // TP-UDL & TP-UD
- if (pStatusRep->paramInd & 0x04)
- {
+ /* TP-UDL & TP-UD */
+ if (pStatusRep->paramInd & 0x04) {
int encodeSize = 0;
encodeSize = SmsPluginUDCodec::encodeUserData(&(pStatusRep->userData), pStatusRep->dcs.codingScheme, &(pTpdu[offset]));
@@ -423,28 +414,36 @@ int SmsPluginTpduCodec::decodeSubmit(const unsigned char *pTpdu, int TpduLen, SM
{
int offset = 0, udLen = 0;
- // TP-RD
+ char tpduTmp[(TpduLen*2)+1];
+ memset(tpduTmp, 0x00, sizeof(tpduTmp));
+ for (int i = 0; i < TpduLen; i++) {
+ snprintf(tpduTmp+(i*2), sizeof(tpduTmp)-(i*2), "%02X", pTpdu[i]);
+ }
+ MSG_DEBUG("Sumbit TPDU.");
+ MSG_INFO("[%s]", tpduTmp);
+
+ /* TP-RD */
if (pTpdu[offset] & 0x04)
pSubmit->bRejectDup = false;
else
pSubmit->bRejectDup = true;
- // TP-VPF
+ /* TP-VPF */
pSubmit->vpf = (SMS_VPF_T)(pTpdu[offset] & 0x18);
- // TP-SRR
+ /* TP-SRR */
if (pTpdu[offset] & 0x20)
pSubmit->bStatusReport = true;
else
pSubmit->bStatusReport = false;
- // TP-UDHI
+ /* TP-UDHI */
if (pTpdu[offset] & 0x40)
pSubmit->bHeaderInd = true;
else
pSubmit->bHeaderInd = false;
- // TP-RP
+ /* TP-RP */
if (pTpdu[offset] & 0x80)
pSubmit->bReplyPath = true;
else
@@ -452,25 +451,24 @@ int SmsPluginTpduCodec::decodeSubmit(const unsigned char *pTpdu, int TpduLen, SM
offset++;
- // TP-MR
+ /* TP-MR */
pSubmit->msgRef = pTpdu[offset++];
- // TP-DA
+ /* TP-DA */
offset += SmsPluginParamCodec::decodeAddress(pTpdu+offset, &(pSubmit->destAddress));
- // TP-PID
+ /* TP-PID */
pSubmit->pid = pTpdu[offset++];
- // TP-DCS
+ /* TP-DCS */
offset += SmsPluginParamCodec::decodeDCS(pTpdu+offset, &(pSubmit->dcs));
- // TP-VP
- if (pSubmit->vpf != SMS_VPF_NOT_PRESENT)
- {
- // Decode VP
+ /* TP-VP */
+ if (pSubmit->vpf != SMS_VPF_NOT_PRESENT) {
+ /* Decode VP */
}
- // TP-UDL & TP-UD
+ /* TP-UDL & TP-UD */
udLen = SmsPluginUDCodec::decodeUserData(pTpdu+offset, TpduLen, pSubmit->bHeaderInd, pSubmit->dcs.codingScheme, &(pSubmit->userData));
return udLen;
@@ -491,25 +489,25 @@ int SmsPluginTpduCodec::decodeDeliver(const unsigned char *pTpdu, int TpduLen, S
MSG_INFO("[%s]", tpduTmp);
- // TP-MMS
+ /* TP-MMS */
if (pTpdu[offset] & 0x04)
pDeliver->bMoreMsg = false;
else
pDeliver->bMoreMsg = true;
- // TP-SRI
+ /* TP-SRI */
if (pTpdu[offset] & 0x20)
pDeliver->bStatusReport = true;
else
pDeliver->bStatusReport = false;
- // TP-UDHI
+ /* TP-UDHI */
if (pTpdu[offset] & 0x40)
pDeliver->bHeaderInd = true;
else
pDeliver->bHeaderInd = false;
- // TP-RP
+ /* TP-RP */
if (pTpdu[offset] & 0x80)
pDeliver->bReplyPath = true;
else
@@ -519,16 +517,16 @@ int SmsPluginTpduCodec::decodeDeliver(const unsigned char *pTpdu, int TpduLen, S
tmpOffset = offset;
#if 1
- // TP-OA
+ /* TP-OA */
offset += SmsPluginParamCodec::decodeAddress(&pTpdu[offset], &(pDeliver->originAddress));
- // TP-PID
+ /* TP-PID */
pDeliver->pid = pTpdu[offset++];
- // TP-DCS
+ /* TP-DCS */
offset += SmsPluginParamCodec::decodeDCS(&pTpdu[offset], &(pDeliver->dcs));
- // Support KSC5601 :: Coding group bits == 0x84
+ /* Support KSC5601 :: Coding group bits == 0x84 */
if (pTpdu[offset-1] == 0x84) {
pDeliver->dcs.codingScheme = SMS_CHARSET_EUCKR;
}
@@ -587,10 +585,10 @@ int SmsPluginTpduCodec::decodeDeliver(const unsigned char *pTpdu, int TpduLen, S
}
}
- // TP-SCTS
+ /* TP-SCTS */
offset += SmsPluginParamCodec::decodeTime(&pTpdu[offset], &(pDeliver->timeStamp));
- // TP-UD
+ /* TP-UD */
udLen = SmsPluginUDCodec::decodeUserData(&pTpdu[offset], TpduLen, pDeliver->bHeaderInd, pDeliver->dcs.codingScheme, &(pDeliver->userData), &(pDeliver->udData));
return udLen;
@@ -620,19 +618,19 @@ int SmsPluginTpduCodec::decodeStatusReport(const unsigned char *pTpdu, int TpduL
char* dt = NULL;
unique_ptr<char*, void(*)(char**)> dtBuf(&dt, unique_ptr_deleter);
- // TP-MMS
+ /* TP-MMS */
if (pTpdu[offset] & 0x04)
pStatusRep->bMoreMsg = false;
else
pStatusRep->bMoreMsg = true;
- // TP-SRQ
+ /* TP-SRQ */
if (pTpdu[offset] & 0x20)
pStatusRep->bStatusReport = true;
else
pStatusRep->bStatusReport = false;
- // TP-UDHI
+ /* TP-UDHI */
if (pTpdu[offset] & 0x40)
pStatusRep->bHeaderInd = true;
else
@@ -640,29 +638,28 @@ int SmsPluginTpduCodec::decodeStatusReport(const unsigned char *pTpdu, int TpduL
offset++;
- // TP-MR
+ /* TP-MR */
pStatusRep->msgRef = pTpdu[offset++];
- // TP-RA
+ /* TP-RA */
offset += SmsPluginParamCodec::decodeAddress(&pTpdu[offset], &(pStatusRep->recipAddress));
- // TP-SCTS
- // Decode timestamp
+ /* TP-SCTS */
+ /* Decode timestamp */
offset += SmsPluginParamCodec::decodeTime(&pTpdu[offset], &(pStatusRep->timeStamp));
- // TP-DT
- // Decode timestamp
+ /* TP-DT */
+ /* Decode timestamp */
offset += SmsPluginParamCodec::decodeTime(&pTpdu[offset], &(pStatusRep->dischargeTime));
- // TP-Status
+ /* TP-Status */
pStatusRep->status = pTpdu[offset++];
- // TP-PI
+ /* TP-PI */
pStatusRep->paramInd = pTpdu[offset++];
- // No Parameters
- if (pStatusRep->paramInd == 0)
- {
+ /* No Parameters */
+ if (pStatusRep->paramInd == 0) {
pStatusRep->pid = SMS_PID_NORMAL;
pStatusRep->dcs.bCompressed = false;
@@ -679,23 +676,18 @@ int SmsPluginTpduCodec::decodeStatusReport(const unsigned char *pTpdu, int TpduL
memset(pStatusRep->userData.data, 0x00, MAX_USER_DATA_LEN+1);
}
- // TP-PID
+ /* TP-PID */
if (pStatusRep->paramInd & 0x01)
pStatusRep->pid = pTpdu[offset++];
- // TP-DCS
+ /* TP-DCS */
if (pStatusRep->paramInd & 0x02)
- {
offset += SmsPluginParamCodec::decodeDCS(&pTpdu[offset], &(pStatusRep->dcs));
- }
- // TP-UDL & TP-UD
+ /* TP-UDL & TP-UD */
if (pStatusRep->paramInd & 0x04)
- {
- // Decode User Data
+ /* Decode User Data */
udLen = SmsPluginUDCodec::decodeUserData(&pTpdu[offset], TpduLen, pStatusRep->bHeaderInd, pStatusRep->dcs.codingScheme, &(pStatusRep->userData));
- }
return udLen;
}
-
diff --git a/plugin/sms_plugin/SmsPluginTransport.cpp b/plugin/sms_plugin/SmsPluginTransport.cpp
index 37d0675..ee15199 100755
--- a/plugin/sms_plugin/SmsPluginTransport.cpp
+++ b/plugin/sms_plugin/SmsPluginTransport.cpp
@@ -34,9 +34,9 @@
#include "SmsPluginDSHandler.h"
#include "SmsPluginSetting.h"
-extern "C"
-{
+extern "C" {
#include <ITapiNetText.h>
+ #include <TelNetwork.h>
}
@@ -81,56 +81,55 @@ void SmsPluginTransport::submitRequest(SMS_REQUEST_INFO_S *pReqInfo)
tpdu.tpduType = SMS_TPDU_SUBMIT;
- // Get SMS Send Options - Setting
+ /* Get SMS Send Options - Setting */
getSmsSendOption(pReqInfo->msgInfo.sim_idx, &(tpdu.data.submit));
- // Set SMS Send Options - Each Message
+ /* Set SMS Send Options - Each Message */
setSmsSendOption(pReqInfo, &tpdu);
- // Set coding scheme
+ /* Set coding scheme */
setSmsDcsOption(pReqInfo, &tpdu);
- // Set SMS report request
+ /* Set SMS report request */
setSmsReportOption(pReqInfo, &tpdu);
- // Set SMSC Options
+ /* Set SMSC Options */
SMS_ADDRESS_S smsc = {0,};
setSmscOptions(pReqInfo->msgInfo.sim_idx, &smsc);
- // Get TAPI handle
- struct tapi_handle *handle = SmsPluginDSHandler::instance()->getTelHandle(pReqInfo->msgInfo.sim_idx);
+ /* Get TAPI handle */
+ TapiHandle *handle = SmsPluginDSHandler::instance()->getTelHandle(pReqInfo->msgInfo.sim_idx);
- // Get address informations.
+ /* Get address informations. */
MsgDbHandler *dbHandle = getDbHandle();
- //contacts-service is not used for gear
+ /* contacts-service is not used for gear */
#ifndef MSG_CONTACTS_SERVICE_NOT_SUPPORTED
MsgStoGetAddressByMsgId(dbHandle, pReqInfo->msgInfo.msgId, 0, &pReqInfo->msgInfo.nAddressCnt, &pReqInfo->msgInfo.addressList);
-#else // MSG_CONTACTS_SERVICE_NOT_SUPPORTED
- //contactNameOrder is never used
+#else /* MSG_CONTACTS_SERVICE_NOT_SUPPORTED */
+ /* contactNameOrder is never used */
MsgStoGetAddressByMsgId(dbHandle, pReqInfo->msgInfo.msgId, &pReqInfo->msgInfo.nAddressCnt, &pReqInfo->msgInfo.addressList);
-#endif //MSG_CONTACTS_SERVICE_NOT_SUPPORTED
+#endif /* MSG_CONTACTS_SERVICE_NOT_SUPPORTED */
MSG_DEBUG("pReqInfo->msgInfo.nAddressCnt [%d]", pReqInfo->msgInfo.nAddressCnt);
- // Get MSISDN
+ /* Get MSISDN */
char *msisdn = NULL;
char keyName[MAX_VCONFKEY_NAME_LEN];
memset(keyName, 0x00, sizeof(keyName));
snprintf(keyName, sizeof(keyName), "%s/%d", MSG_SIM_MSISDN, pReqInfo->msgInfo.sim_idx);
msisdn = MsgSettingGetString(keyName);
- for (int i = 0; i < pReqInfo->msgInfo.nAddressCnt; i++)
- {
- // Make SMS_SUBMIT_DATA_S from MSG_REQUEST_INFO_S
+ for (int i = 0; i < pReqInfo->msgInfo.nAddressCnt; i++) {
+ /* Make SMS_SUBMIT_DATA_S from MSG_REQUEST_INFO_S */
SMS_SUBMIT_DATA_S submitData = {{0},};
msgInfoToSubmitData(&(pReqInfo->msgInfo), &submitData, &(tpdu.data.submit.dcs.codingScheme), i);
- // Insert message reference into db
+ /* Insert message reference into db */
if (tpdu.data.submit.bStatusReport == true) {
SmsPluginStorage::instance()->insertMsgRef(&(pReqInfo->msgInfo), tpdu.data.submit.msgRef, i);
}
- // Encode SMSC Address
+ /* Encode SMSC Address */
unsigned char smscAddr[MAX_SMSC_LEN];
memset(smscAddr, 0x00, sizeof(smscAddr));
@@ -169,14 +168,13 @@ void SmsPluginTransport::submitRequest(SMS_REQUEST_INFO_S *pReqInfo)
tpdu.data.submit.destAddress.address[MAX_ADDRESS_LEN] = '\0';
}
-MSG_DEBUG("ton [%d]", tpdu.data.submit.destAddress.ton);
-MSG_DEBUG("npi [%d]", tpdu.data.submit.destAddress.npi);
-MSG_SEC_DEBUG("address [%s]", tpdu.data.submit.destAddress.address);
+ MSG_DEBUG("ton [%d]", tpdu.data.submit.destAddress.ton);
+ MSG_DEBUG("npi [%d]", tpdu.data.submit.destAddress.npi);
+ MSG_SEC_DEBUG("address [%s]", tpdu.data.submit.destAddress.address);
bool bStatusReport = false;
- for (unsigned int segCnt = 0; segCnt < submitData.segCount; segCnt++)
- {
+ for (unsigned int segCnt = 0; segCnt < submitData.segCount; segCnt++) {
if (submitData.userData[segCnt].headerCnt > 0) {
tpdu.data.submit.bHeaderInd = true;
} else {
@@ -201,10 +199,8 @@ MSG_SEC_DEBUG("address [%s]", tpdu.data.submit.destAddress.address);
bool bRetryByMoCtrl = false;
bool bSatMoCtrl = false;
-
- for (int cnt = 0; cnt < MAX_SMS_SEND_RETRY; ++cnt)
- {
- // Encode SMS-SUBMIT TPDU
+ for (int cnt = 0; cnt < MAX_SMS_SEND_RETRY; ++cnt) {
+ /* Encode SMS-SUBMIT TPDU */
memset(buf, 0x00, sizeof(buf));
if (cnt > 0)
@@ -212,10 +208,10 @@ MSG_SEC_DEBUG("address [%s]", tpdu.data.submit.destAddress.address);
bufLen = SmsPluginTpduCodec::encodeTpdu(&tpdu, buf);
- // Make Telephony Structure
+ /* Make Telephony Structure */
TelSmsDatapackageInfo_t pkgInfo;
- // Set TPDU data
+ /* Set TPDU data */
memset((void*)pkgInfo.szData, 0x00, sizeof(pkgInfo.szData));
memcpy((void*)pkgInfo.szData, buf, bufLen);
@@ -223,7 +219,7 @@ MSG_SEC_DEBUG("address [%s]", tpdu.data.submit.destAddress.address);
pkgInfo.MsgLength = bufLen;
pkgInfo.format = TAPI_NETTEXT_NETTYPE_3GPP;
- // Set SMSC data
+ /* Set SMSC data */
memset(pkgInfo.Sca, 0x00, sizeof(pkgInfo.Sca));
memcpy((void*)pkgInfo.Sca, smscAddr, smscLen);
pkgInfo.Sca[smscLen] = '\0';
@@ -244,28 +240,34 @@ MSG_SEC_DEBUG("address [%s]", tpdu.data.submit.destAddress.address);
memcpy(&(sentInfo.reqInfo), pReqInfo, sizeof(SMS_REQUEST_INFO_S));
- if ((segCnt+1) == submitData.segCount && (i+1)==pReqInfo->msgInfo.nAddressCnt)
- {
+ if ((segCnt + 1) == submitData.segCount && (i + 1)==pReqInfo->msgInfo.nAddressCnt) {
sentInfo.bLast = true;
bMoreMsg = FALSE;
- }
- else
- {
+ } else {
sentInfo.bLast = false;
bMoreMsg = TRUE;
}
SmsPluginEventHandler::instance()->SetSentInfo(&sentInfo);
+ int svc_type;
+ tel_get_property_int(handle, TAPI_PROP_NETWORK_SERVICE_TYPE, &svc_type);
+
+ if (svc_type < TAPI_NETWORK_SERVICE_TYPE_2G){
+ MSG_DEBUG("Network service is not available : [%d]", svc_type);
+ SmsPluginEventHandler::instance()->handleSentStatus(MSG_NETWORK_SEND_PENDING);
+ MsgInsertTicker("Unable to send message. It will be sent when service available.", SMS_MESSAGE_SENDING_PENDING, false, 0);
+ goto _RETURN_FUNC;
+ }
+
curStatus = SMS_NETWORK_SENDING;
- // Send SMS
+ /* Send SMS */
int tapiRet = TAPI_API_SUCCESS;
tapiRet = tel_send_sms(handle, &pkgInfo, bMoreMsg, TapiEventSentStatus, (void *)&curMoCtrlData);
- if (tapiRet == TAPI_API_SUCCESS)
- {
+ if (tapiRet == TAPI_API_SUCCESS) {
MSG_DEBUG("######## tel_send_sms Success !!! return : [%d] #######", tapiRet);
memset(keyName, 0x00, sizeof(keyName));
@@ -274,7 +276,7 @@ MSG_SEC_DEBUG("address [%s]", tpdu.data.submit.destAddress.address);
MSG_DEBUG("MsgSettingGetBool [%s] failed", keyName);
if (bSatMoCtrl) {
- // Get SAT MO SM control
+ /* Get SAT MO SM control */
retMoCtrlStatus = getMoCtrlStatus();
MSG_DEBUG("retMoCtrlStatus = [%d]", retMoCtrlStatus);
@@ -283,7 +285,7 @@ MSG_SEC_DEBUG("address [%s]", tpdu.data.submit.destAddress.address);
if (bRetryByMoCtrl == false) {
bRetryByMoCtrl = true;
- // Modify Address with control data
+ /* Modify Address with control data */
memset(smsc.address, 0x00, sizeof(smsc.address));
memcpy(smsc.address, curMoCtrlData.rpDestAddr.string, sizeof(smsc.address)-1);
@@ -304,9 +306,7 @@ MSG_SEC_DEBUG("address [%s]", tpdu.data.submit.destAddress.address);
}
}
}
- }
- else
- {
+ } else {
SmsPluginEventHandler::instance()->handleSentStatus(MSG_NETWORK_SEND_FAIL);
if (msisdn) {
@@ -316,7 +316,7 @@ MSG_SEC_DEBUG("address [%s]", tpdu.data.submit.destAddress.address);
THROW(MsgException::SMS_PLG_ERROR, "######## tel_send_sms Fail !!! return : [%d] #######", tapiRet);
}
- // Tizen Validation System
+ /* Tizen Validation System */
MSG_SMS_VLD_INFO("%d, SMS Send Start, %s->%s, %s", pReqInfo->msgInfo.msgId, \
(msisdn == NULL)?"ME":msisdn, \
pReqInfo->msgInfo.addressList[0].addressVal, \
@@ -331,13 +331,11 @@ MSG_SEC_DEBUG("address [%s]", tpdu.data.submit.destAddress.address);
}
#ifdef MSG_SMS_REPORT
- if (err == MSG_SUCCESS && tmpInfo.msgInfo.msgPort.valid == false)
- {
- if(pReqInfo->sendOptInfo.bDeliverReq == true)
- {
+ if (err == MSG_SUCCESS && tmpInfo.msgInfo.msgPort.valid == false) {
+ if (pReqInfo->sendOptInfo.bDeliverReq == true) {
MSG_DEBUG("Update Delivery Report Status : [%d] Msg ID : [%d]", err, tmpInfo.msgInfo.msgId);
- // Adding delivery report status info.
+ /* Adding delivery report status info. */
MsgStoAddDeliveryReportStatus( tmpInfo.msgInfo.msgId, (unsigned char)tmpInfo.msgInfo.referenceId);
}
}
@@ -348,8 +346,7 @@ MSG_SEC_DEBUG("address [%s]", tpdu.data.submit.destAddress.address);
pReqInfo->msgInfo.addressList[0].addressVal, \
(retStatus == SMS_NETWORK_SEND_SUCCESS)?"Success":"Fail");
- if (retStatus == SMS_NETWORK_SEND_SUCCESS)
- {
+ if (retStatus == SMS_NETWORK_SEND_SUCCESS) {
bool bTTS = false;
if (MsgSettingGetBool(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, &bTTS) != MSG_SUCCESS) {
@@ -362,11 +359,12 @@ MSG_SEC_DEBUG("address [%s]", tpdu.data.submit.destAddress.address);
}
MSG_DEBUG("######## Msg Sent was Successful !!! #######");
}
- }
- else
- {
+ } else {
if (retStatus == SMS_NETWORK_SEND_FAIL_TIMEOUT || retStatus == SMS_NETWORK_SEND_FAIL_TEMPORARY || retStatus == SMS_NETWORK_SEND_FAIL_BY_MO_CONTROL_WITH_MOD)
SmsPluginEventHandler::instance()->handleSentStatus(MSG_NETWORK_SEND_FAIL);
+ else if (retStatus == SMS_NETWORK_SEND_FAIL_FDN_RESTRICED)
+ /* SmsPluginEventHandler::instance()->handleSentStatus(MSG_NETWORK_SEND_FAIL_FDN_ENABLED); */
+ SmsPluginEventHandler::instance()->handleSentStatus(MSG_NETWORK_SEND_FAIL);
if (retStatus == SMS_NETWORK_SEND_FAIL_FDN_RESTRICED) {
MsgInsertTicker("Unable to send the message while Fixed dialling mode is enabled", SMS_FDN_RESTRICTED, true, 0);
@@ -381,7 +379,8 @@ MSG_SEC_DEBUG("address [%s]", tpdu.data.submit.destAddress.address);
THROW(MsgException::SMS_PLG_ERROR, "######## Msg Sent was Failed !!! return : [%d] #######", retStatus);
}
- if (tpdu.data.submit.userData.headerCnt > 0) tpdu.data.submit.userData.headerCnt--;
+ if (tpdu.data.submit.userData.headerCnt > 0)
+ tpdu.data.submit.userData.headerCnt--;
}
}
@@ -396,7 +395,7 @@ _RETURN_FUNC :
}
-void SmsPluginTransport::sendDeliverReport(struct tapi_handle *handle, msg_error_t err)
+void SmsPluginTransport::sendDeliverReport(TapiHandle *handle, msg_error_t err)
{
MSG_BEGIN();
@@ -410,27 +409,19 @@ void SmsPluginTransport::sendDeliverReport(struct tapi_handle *handle, msg_error
int simIndex = SmsPluginDSHandler::instance()->getSimIndex(handle);
- if (err == MSG_SUCCESS)
- {
+ if (err == MSG_SUCCESS) {
tpdu.data.deliverRep.reportType = SMS_REPORT_POSITIVE;
response = TAPI_NETTEXT_SENDSMS_SUCCESS;
- if(isMemAvailable == false)
- {
+ if (isMemAvailable == false) {
tapiRet = tel_set_sms_memory_status(handle, TAPI_NETTEXT_PDA_MEMORY_STATUS_AVAILABLE, TapiEventMemoryStatus, NULL);
if (tapiRet == TAPI_API_SUCCESS)
- {
MSG_DEBUG("######## tel_set_sms_memory_status() Success !!! #######");
- }
else
- {
MSG_DEBUG("######## tel_set_sms_memory_status() Failed !!! return : [%d] #######", tapiRet);
- }
}
- }
- else if (err == MSG_ERR_SIM_STORAGE_FULL)
- {
+ } else if (err == MSG_ERR_SIM_STORAGE_FULL) {
tpdu.data.deliverRep.reportType = SMS_REPORT_NEGATIVE;
tpdu.data.deliverRep.failCause = SMS_FC_SIM_STORAGE_FULL;
@@ -449,9 +440,7 @@ void SmsPluginTransport::sendDeliverReport(struct tapi_handle *handle, msg_error
MSG_DEBUG("######## tel_set_sms_memory_status() Failed !!! return : [%d] #######", tapiRet);
}
#endif
- }
- else if (err == MSG_ERR_MESSAGE_COUNT_FULL)
- {
+ } else if (err == MSG_ERR_MESSAGE_COUNT_FULL) {
tpdu.data.deliverRep.reportType = SMS_REPORT_NEGATIVE;
tpdu.data.deliverRep.failCause = SMS_FC_MSG_CAPA_EXCEEDED;
response = TAPI_NETTEXT_ME_FULL;
@@ -459,20 +448,14 @@ void SmsPluginTransport::sendDeliverReport(struct tapi_handle *handle, msg_error
tapiRet = tel_set_sms_memory_status(handle, TAPI_NETTEXT_PDA_MEMORY_STATUS_FULL, TapiEventMemoryStatus, NULL);
if (tapiRet == TAPI_API_SUCCESS)
- {
MSG_DEBUG("######## tel_set_sms_memory_status() Success !!! #######");
- }
else
- {
MSG_DEBUG("######## tel_set_sms_memory_status() Failed !!! return : [%d] #######", tapiRet);
- }
- }
- else
- {
+ } else {
tpdu.data.deliverRep.reportType = SMS_REPORT_NEGATIVE;
tpdu.data.deliverRep.failCause = SMS_FC_UNSPEC_ERROR;
- //response = TAPI_NETTEXT_PROTOCOL_ERROR;
- // For gcf test [34.2.5.3 class2 message]
+ /*response = TAPI_NETTEXT_PROTOCOL_ERROR;
+ For gcf test [34.2.5.3 class2 message] */
response = TAPI_NETTEXT_SIM_FULL;
}
@@ -482,7 +465,7 @@ void SmsPluginTransport::sendDeliverReport(struct tapi_handle *handle, msg_error
tpdu.data.deliverRep.bHeaderInd = false;
tpdu.data.deliverRep.paramInd = 0x00;
- // Encode SMS-DELIVER-REPORT TPDU
+ /* Encode SMS-DELIVER-REPORT TPDU */
int bufLen = 0;
char buf[MAX_TPDU_DATA_LEN];
@@ -491,20 +474,18 @@ void SmsPluginTransport::sendDeliverReport(struct tapi_handle *handle, msg_error
bufLen = SmsPluginTpduCodec::encodeTpdu(&tpdu, buf);
#ifdef MSG_FOR_DEBUG
- /////// print DeliverReport tpdu
+ /* print DeliverReport tpdu */
printf("\n\n######## DeliverReport tpdu #########\n");
- for(int i=0; i < bufLen; i++)
- {
+ for (int i=0; i < bufLen; i++) {
printf("[%02x] ", buf[i]);
}
printf("\n#################################\n\n");
- //////
#endif
- // Make Telephony Structure
+ /* Make Telephony Structure */
TelSmsDatapackageInfo_t pkgInfo;
- // Set TPDU data
+ /* Set TPDU data */
memset((void*)pkgInfo.szData, 0x00, sizeof(pkgInfo.szData));
memcpy((void*)pkgInfo.szData, buf, bufLen);
@@ -512,13 +493,13 @@ void SmsPluginTransport::sendDeliverReport(struct tapi_handle *handle, msg_error
pkgInfo.MsgLength = bufLen;
pkgInfo.format = TAPI_NETTEXT_NETTYPE_3GPP;
- // Set SMSC Address
+ /* Set SMSC Address */
SMS_ADDRESS_S smsc;
- // Set SMSC Options
+ /* Set SMSC Options */
setSmscOptions(simIndex, &smsc);
- // Encode SMSC Address
+ /* Encode SMSC Address */
unsigned char smscAddr[MAX_SMSC_LEN];
memset(smscAddr, 0x00, sizeof(smscAddr));
@@ -526,27 +507,23 @@ void SmsPluginTransport::sendDeliverReport(struct tapi_handle *handle, msg_error
if (smscLen <= 0) return;
- // Set SMSC data
+ /* Set SMSC data */
memset(pkgInfo.Sca, 0x00, sizeof(pkgInfo.Sca));
memcpy((void*)pkgInfo.Sca, smscAddr, smscLen);
pkgInfo.Sca[smscLen] = '\0';
- // Send Deliver Report
+ /* Send Deliver Report */
tapiRet = tel_send_sms_deliver_report(handle, &pkgInfo, response, TapiEventDeliveryReportCNF, NULL);
if (tapiRet == TAPI_API_SUCCESS)
- {
MSG_DEBUG("######## tel_send_sms_deliver_report() Success !!! #######");
- }
else
- {
MSG_DEBUG("######## tel_send_sms_deliver_report() Fail !!! return : [%d] #######", tapiRet);
- }
MSG_END();
}
-void SmsPluginTransport::sendClass0DeliverReport(struct tapi_handle *handle, msg_error_t err)
+void SmsPluginTransport::sendClass0DeliverReport(TapiHandle *handle, msg_error_t err)
{
MSG_BEGIN();
@@ -560,60 +537,41 @@ void SmsPluginTransport::sendClass0DeliverReport(struct tapi_handle *handle, msg
int simIndex = SmsPluginDSHandler::instance()->getSimIndex(handle);
- if (err == MSG_SUCCESS)
- {
+ if (err == MSG_SUCCESS) {
tpdu.data.deliverRep.reportType = SMS_REPORT_POSITIVE;
response = TAPI_NETTEXT_SENDSMS_SUCCESS;
tapiRet = tel_set_sms_memory_status(handle, TAPI_NETTEXT_PDA_MEMORY_STATUS_AVAILABLE, TapiEventMemoryStatus, NULL);
if (tapiRet == TAPI_API_SUCCESS)
- {
MSG_DEBUG("######## tel_set_sms_memory_status() Success !!! #######");
- }
else
- {
MSG_DEBUG("######## tel_set_sms_memory_status() Failed !!! return : [%d] #######", tapiRet);
- }
- }
- else if (err == MSG_ERR_SIM_STORAGE_FULL)
- {
+ } else if (err == MSG_ERR_SIM_STORAGE_FULL) {
tpdu.data.deliverRep.reportType = SMS_REPORT_POSITIVE;
response = TAPI_NETTEXT_SENDSMS_SUCCESS;
tapiRet = tel_set_sms_memory_status(handle, TAPI_NETTEXT_PDA_MEMORY_STATUS_FULL, TapiEventMemoryStatus, NULL);
if (tapiRet == TAPI_API_SUCCESS)
- {
MSG_DEBUG("######## tel_set_sms_memory_status() Success !!! #######");
- }
else
- {
MSG_DEBUG("######## tel_set_sms_memory_status() Failed !!! return : [%d] #######", tapiRet);
- }
- }
- else if (err == MSG_ERR_MESSAGE_COUNT_FULL)
- {
+ } else if (err == MSG_ERR_MESSAGE_COUNT_FULL) {
tpdu.data.deliverRep.reportType = SMS_REPORT_POSITIVE;
response = TAPI_NETTEXT_SENDSMS_SUCCESS;
tapiRet = tel_set_sms_memory_status(handle, TAPI_NETTEXT_PDA_MEMORY_STATUS_FULL, TapiEventMemoryStatus, NULL);
if (tapiRet == TAPI_API_SUCCESS)
- {
MSG_DEBUG("######## tel_set_sms_memory_status() Success !!! #######");
- }
else
- {
MSG_DEBUG("######## tel_set_sms_memory_status() Failed !!! return : [%d] #######", tapiRet);
- }
- }
- else
- {
+ } else {
tpdu.data.deliverRep.reportType = SMS_REPORT_NEGATIVE;
tpdu.data.deliverRep.failCause = SMS_FC_UNSPEC_ERROR;
- //response = TAPI_NETTEXT_PROTOCOL_ERROR;
- // For gcf test [34.2.5.3 class2 message]
+ /*response = TAPI_NETTEXT_PROTOCOL_ERROR;
+ For gcf test [34.2.5.3 class2 message] */
response = TAPI_NETTEXT_SIM_FULL;
}
@@ -623,7 +581,7 @@ void SmsPluginTransport::sendClass0DeliverReport(struct tapi_handle *handle, msg
tpdu.data.deliverRep.bHeaderInd = false;
tpdu.data.deliverRep.paramInd = 0x00;
- // Encode SMS-DELIVER-REPORT TPDU
+ /* Encode SMS-DELIVER-REPORT TPDU */
int bufLen = 0;
char buf[MAX_TPDU_DATA_LEN];
@@ -631,10 +589,10 @@ void SmsPluginTransport::sendClass0DeliverReport(struct tapi_handle *handle, msg
bufLen = SmsPluginTpduCodec::encodeTpdu(&tpdu, buf);
- // Make Telephony Structure
+ /* Make Telephony Structure */
TelSmsDatapackageInfo_t pkgInfo;
- // Set TPDU data
+ /* Set TPDU data */
memset((void*)pkgInfo.szData, 0x00, sizeof(pkgInfo.szData));
memcpy((void*)pkgInfo.szData, buf, bufLen);
@@ -642,13 +600,13 @@ void SmsPluginTransport::sendClass0DeliverReport(struct tapi_handle *handle, msg
pkgInfo.MsgLength = bufLen;
pkgInfo.format = TAPI_NETTEXT_NETTYPE_3GPP;
- // Set SMSC Address
+ /* Set SMSC Address */
SMS_ADDRESS_S smsc;
- // Set SMSC Options
+ /* Set SMSC Options */
setSmscOptions(simIndex, &smsc);
- // Encode SMSC Address
+ /* Encode SMSC Address */
unsigned char smscAddr[MAX_SMSC_LEN];
memset(smscAddr, 0x00, sizeof(smscAddr));
@@ -656,22 +614,18 @@ void SmsPluginTransport::sendClass0DeliverReport(struct tapi_handle *handle, msg
if (smscLen <= 0) return;
- // Set SMSC data
+ /* Set SMSC data */
memset(pkgInfo.Sca, 0x00, sizeof(pkgInfo.Sca));
memcpy((void*)pkgInfo.Sca, smscAddr, smscLen);
pkgInfo.Sca[smscLen] = '\0';
- // Send Deliver Report
+ /* Send Deliver Report */
tapiRet = tel_send_sms_deliver_report(handle, &pkgInfo, response, TapiEventDeliveryReportCNF, NULL);
if (tapiRet == TAPI_API_SUCCESS)
- {
MSG_DEBUG("######## tel_send_sms_deliver_report() Success !!! #######");
- }
else
- {
MSG_DEBUG("######## tel_send_sms_deliver_report() Fail !!! return : [%d] #######", tapiRet);
- }
MSG_END();
}
@@ -679,7 +633,7 @@ void SmsPluginTransport::sendClass0DeliverReport(struct tapi_handle *handle, msg
void SmsPluginTransport::getSmsSendOption(int simIndex, SMS_SUBMIT_S *pSubmit)
{
- // Set SMS Send Options
+ /* Set SMS Send Options */
pSubmit->bRejectDup = false;
pSubmit->bHeaderInd = false;
@@ -715,7 +669,7 @@ void SmsPluginTransport::getSmsSendOption(int simIndex, SMS_SUBMIT_S *pSubmit)
MSG_DEBUG("PID : %d", pSubmit->pid);
- pSubmit->vpf = SMS_VPF_NOT_PRESENT; // default value
+ pSubmit->vpf = SMS_VPF_NOT_PRESENT; /* default value */
MSG_DEBUG("valPeriod : %d", valPeriod);
MSG_DEBUG("vpf : %d", pSubmit->vpf);
@@ -729,8 +683,7 @@ void SmsPluginTransport::setSmsSendOption(SMS_REQUEST_INFO_S *pReqInfo, SMS_TPDU
return;
}
- if (pReqInfo->sendOptInfo.bSetting == true)
- {
+ if (pReqInfo->sendOptInfo.bSetting == true) {
pSmsTpdu->data.submit.bStatusReport = pReqInfo->sendOptInfo.bDeliverReq;
pSmsTpdu->data.submit.bReplyPath = pReqInfo->sendOptInfo.option.smsSendOptInfo.bReplyPath;
}
@@ -745,11 +698,11 @@ void SmsPluginTransport::setSmsDcsOption(SMS_REQUEST_INFO_S *pReqInfo, SMS_TPDU_
}
if (pReqInfo->msgInfo.msgPort.valid == true) {
- // Set Coding Scheme for apps that use port number
+ /* Set Coding Scheme for apps that use port number */
pSmsTpdu->data.submit.dcs.codingScheme = (SMS_CODING_SCHEME_T)pReqInfo->msgInfo.encodeType;
MSG_DEBUG("DCS is changed by application : [%d]", pSmsTpdu->data.submit.dcs.codingScheme);
} else {
- // Change coding scheme if it is set coding scheme by apps
+ /* Change coding scheme if it is set coding scheme by apps */
if (pSmsTpdu->data.submit.dcs.codingScheme == SMS_CHARSET_7BIT && pReqInfo->msgInfo.encodeType != MSG_ENCODE_GSM7BIT) {
pSmsTpdu->data.submit.dcs.codingScheme = (SMS_CODING_SCHEME_T)pReqInfo->msgInfo.encodeType;
MSG_DEBUG("DCS is changed by application : [%d]", pSmsTpdu->data.submit.dcs.codingScheme);
@@ -766,16 +719,15 @@ void SmsPluginTransport::setSmsReportOption(SMS_REQUEST_INFO_S *pReqInfo, SMS_TP
}
#ifdef MSG_SMS_REPORT
- // Update Msg Ref into Report Table
- if (pSmsTpdu->data.submit.bStatusReport == true)
- {
+ /* Update Msg Ref into Report Table */
+ if (pSmsTpdu->data.submit.bStatusReport == true) {
MSG_DEBUG("Update Msg Ref [%d] in Report Table", pSmsTpdu->data.submit.msgRef);
SmsPluginStorage::instance()->updateMsgRef(pReqInfo->msgInfo.msgId, pSmsTpdu->data.submit.msgRef);
}
#endif
- // Set Message Reference
+ /* Set Message Reference */
if (pSmsTpdu->data.submit.bStatusReport == true) {
pSmsTpdu->data.submit.msgRef = (pReqInfo->msgInfo.msgId % 256);
}
@@ -784,7 +736,7 @@ void SmsPluginTransport::setSmsReportOption(SMS_REQUEST_INFO_S *pReqInfo, SMS_TP
void SmsPluginTransport::setSmscOptions(int simIndex, SMS_ADDRESS_S *pSmsc)
{
- // Set SMSC Options
+ /* Set SMSC Options */
MSG_SMSC_LIST_S smscList = {0,};
SmsPluginSetting::instance()->getSmscListInfo(simIndex, &smscList);
@@ -811,7 +763,7 @@ void SmsPluginTransport::setSmscOptions(int simIndex, SMS_ADDRESS_S *pSmsc)
void SmsPluginTransport::msgInfoToSubmitData(const MSG_MESSAGE_INFO_S *pMsgInfo, SMS_SUBMIT_DATA_S *pData, SMS_CODING_SCHEME_T *pCharType, int addrIndex)
{
- // Destination Address
+ /* Destination Address */
pData->destAddress.ton = SMS_TON_UNKNOWN;
pData->destAddress.npi = SMS_NPI_ISDN;
@@ -822,7 +774,7 @@ void SmsPluginTransport::msgInfoToSubmitData(const MSG_MESSAGE_INFO_S *pMsgInfo,
MSG_DEBUG("npi [%d]", pData->destAddress.npi);
MSG_SEC_DEBUG("address [%s]", pData->destAddress.address);
- int decodeLen = 0, bufSize = (MAX_GSM_7BIT_DATA_LEN*MAX_SEGMENT_NUM) + 1; // SMS_CHARSET_7BIT
+ int decodeLen = 0, bufSize = (MAX_GSM_7BIT_DATA_LEN*MAX_SEGMENT_NUM) + 1; /* SMS_CHARSET_7BIT */
unsigned char decodeData[bufSize];
memset(decodeData, 0x00, sizeof(decodeData));
@@ -835,77 +787,59 @@ void SmsPluginTransport::msgInfoToSubmitData(const MSG_MESSAGE_INFO_S *pMsgInfo,
bool bAbnormal = false;
- // User Data
- if (pMsgInfo->bTextSms == true)
- {
- if (*pCharType == SMS_CHARSET_7BIT)
- {
+ /* User Data */
+ if (pMsgInfo->bTextSms == true) {
+ if (*pCharType == SMS_CHARSET_7BIT) {
decodeLen = textCvt->convertUTF8ToGSM7bit(decodeData, bufSize, (unsigned char*)pMsgInfo->msgText, (int)pMsgInfo->dataSize, &langId, &bAbnormal);
- }
- else if (*pCharType == SMS_CHARSET_8BIT)
- {
+ } else if (*pCharType == SMS_CHARSET_8BIT) {
memcpy(decodeData, pMsgInfo->msgText, pMsgInfo->dataSize);
decodeLen = pMsgInfo->dataSize;
- }
- else if (*pCharType == SMS_CHARSET_UCS2)
- {
+ } else if (*pCharType == SMS_CHARSET_UCS2) {
decodeLen = textCvt->convertUTF8ToUCS2(decodeData, bufSize, (unsigned char*)pMsgInfo->msgText, (int)pMsgInfo->dataSize);
- }
- else if (*pCharType == SMS_CHARSET_AUTO)
- {
- decodeLen = textCvt->convertUTF8ToAuto(decodeData, bufSize, (unsigned char*)pMsgInfo->msgText, (int)pMsgInfo->dataSize, &langId, &encodeType);
+ } else if (*pCharType == SMS_CHARSET_AUTO) {
+ decodeLen = textCvt->convertUTF8ToAuto(decodeData, bufSize, (unsigned char*)pMsgInfo->msgText, (int)pMsgInfo->dataSize, &encodeType);
*pCharType = encodeType;
}
- }
- else
- {
+ } else {
int fileSize = 0;
char* pFileData = NULL;
unique_ptr<char*, void(*)(char**)> FileBuf(&pFileData, unique_ptr_deleter);
- // Read Message Data from File
+ /* Read Message Data from File */
if (MsgOpenAndReadFile(pMsgInfo->msgData, &pFileData, &fileSize) == false)
THROW(MsgException::FILE_ERROR, "MsgOpenAndReadFile error");
MSG_DEBUG("file size : [%d] file data : [%s]", fileSize, pFileData);
- if (*pCharType == SMS_CHARSET_7BIT)
- {
+ if (*pCharType == SMS_CHARSET_7BIT) {
decodeLen = textCvt->convertUTF8ToGSM7bit(decodeData, bufSize, (unsigned char*)pFileData, fileSize, &langId, &bAbnormal);
- }
- else if (*pCharType == SMS_CHARSET_8BIT)
- {
+ } else if (*pCharType == SMS_CHARSET_8BIT) {
memcpy(decodeData, pFileData, fileSize);
decodeLen = fileSize;
- }
- else if (*pCharType == SMS_CHARSET_UCS2)
- {
+ } else if (*pCharType == SMS_CHARSET_UCS2) {
decodeLen = textCvt->convertUTF8ToUCS2(decodeData, bufSize, (unsigned char*)pFileData, fileSize);
- }
- else if (*pCharType == SMS_CHARSET_AUTO)
- {
- decodeLen = textCvt->convertUTF8ToAuto(decodeData, bufSize, (unsigned char*)pFileData, fileSize, &langId, &encodeType);
+ } else if (*pCharType == SMS_CHARSET_AUTO) {
+ decodeLen = textCvt->convertUTF8ToAuto(decodeData, bufSize, (unsigned char*)pFileData, fileSize, &encodeType);
*pCharType = encodeType;
}
- // Delete File
+ /* Delete File */
if (pMsgInfo->nAddressCnt == (addrIndex + 1))
MsgDeleteFile(pMsgInfo->msgData);
}
-MSG_DEBUG("decode length : [%d]", decodeLen);
-MSG_DEBUG("character type : [%d]", *pCharType);
-MSG_DEBUG("Language Identifier : [%d]", langId);
-MSG_SEC_DEBUG("reply address : [%s]", pMsgInfo->replyAddress);
+ MSG_DEBUG("decode length : [%d]", decodeLen);
+ MSG_DEBUG("character type : [%d]", *pCharType);
+ MSG_DEBUG("Language Identifier : [%d]", langId);
+ MSG_SEC_DEBUG("reply address : [%s]", pMsgInfo->replyAddress);
int addrLen = 0;
char* encodedAddr = NULL;
unique_ptr<char*, void(*)(char**)> addressBuf(&encodedAddr, unique_ptr_deleter);
- if (strlen(pMsgInfo->replyAddress) > 0)
- {
+ if (strlen(pMsgInfo->replyAddress) > 0) {
SMS_ADDRESS_S replyAddr = {};
replyAddr.ton = SMS_TON_NATIONAL;
@@ -923,20 +857,23 @@ MSG_SEC_DEBUG("reply address : [%s]", pMsgInfo->replyAddress);
segSize = getSegmentSize(*pCharType, decodeLen, pMsgInfo->msgPort.valid, langId, addrLen);
- if (segSize == 0)
- THROW(MsgException::SMS_PLG_ERROR, "DIVIDE_BY_ZERO : %d", segSize);
-
- pData->segCount = ceil((double)decodeLen/(double)segSize);
+ if (segSize == 0) {
+ if (decodeLen == 0) /* to handle empty message -> (pMsgInfo->msgText = NULL) */
+ pData->segCount = 1;
+ else
+ THROW(MsgException::SMS_PLG_ERROR, "DIVIDE_BY_ZERO : %d", segSize);
+ } else {
+ pData->segCount = ceil((double)decodeLen/(double)segSize);
+ }
-MSG_DEBUG("segment size : [%d], pData->segCount : [%d]", segSize, pData->segCount);
+ MSG_DEBUG("segment size : [%d], pData->segCount : [%d]", segSize, pData->segCount);
if (pData->segCount > MAX_SEGMENT_NUM)
THROW(MsgException::SMS_PLG_ERROR, "Segment Count is over maximum : %d", pData->segCount);
int headerCnt = 0;
- for (unsigned int i = 0; i < pData->segCount; i++)
- {
+ for (unsigned int i = 0; i < pData->segCount; i++) {
headerCnt = 0;
if ((i + 1) == pData->segCount)
@@ -948,14 +885,13 @@ MSG_DEBUG("segment size : [%d], pData->segCount : [%d]", segSize, pData->segCoun
memcpy(pData->userData[i].data, &(decodeData[index]), pData->userData[i].length);
pData->userData[i].data[pData->userData[i].length] = 0;
-MSG_DEBUG("user data len [%d]", pData->userData[i].length);
-MSG_DEBUG("user data [%s]", pData->userData[i].data);
+ MSG_DEBUG("user data len [%d]", pData->userData[i].length);
+ MSG_DEBUG("user data [%s]", pData->userData[i].data);
index += segSize;
- // Set User Data Header for Concatenated Message
- if (pData->segCount > 1)
- {
+ /* Set User Data Header for Concatenated Message */
+ if (pData->segCount > 1) {
pData->userData[i].header[headerCnt].udhType = SMS_UDH_CONCAT_8BIT;
pData->userData[i].header[headerCnt].udh.concat8bit.msgRef = msgRef8bit;
pData->userData[i].header[headerCnt].udh.concat8bit.totalSeg = pData->segCount;
@@ -964,9 +900,8 @@ MSG_DEBUG("user data [%s]", pData->userData[i].data);
headerCnt++;
}
- // Set User Data Header Port Information
- if (pMsgInfo->msgPort.valid == true)
- {
+ /* Set User Data Header Port Information */
+ if (pMsgInfo->msgPort.valid == true) {
pData->userData[i].header[headerCnt].udhType = SMS_UDH_APP_PORT_16BIT;
pData->userData[i].header[headerCnt].udh.appPort16bit.destPort = pMsgInfo->msgPort.dstPort;
pData->userData[i].header[headerCnt].udh.appPort16bit.originPort = pMsgInfo->msgPort.srcPort;
@@ -974,9 +909,8 @@ MSG_DEBUG("user data [%s]", pData->userData[i].data);
headerCnt++;
}
- // Set User Data Header for Alternate Reply Address
- if (strlen(pMsgInfo->replyAddress) > 0)
- {
+ /* Set User Data Header for Alternate Reply Address */
+ if (strlen(pMsgInfo->replyAddress) > 0) {
pData->userData[i].header[headerCnt].udhType = SMS_UDH_ALTERNATE_REPLY_ADDRESS;
pData->userData[i].header[headerCnt].udh.alternateAddress.ton = SMS_TON_NATIONAL;
@@ -988,9 +922,8 @@ MSG_DEBUG("user data [%s]", pData->userData[i].data);
headerCnt++;
}
- // Set User Data Header for National Language Single Shift
- if (*pCharType == SMS_CHARSET_7BIT && langId != MSG_LANG_ID_RESERVED)
- {
+ /* Set User Data Header for National Language Single Shift */
+ if (*pCharType == SMS_CHARSET_7BIT && langId != MSG_LANG_ID_RESERVED) {
pData->userData[i].header[headerCnt].udhType = SMS_UDH_SINGLE_SHIFT;
pData->userData[i].header[headerCnt].udh.singleShift.langId = langId;
@@ -1009,45 +942,36 @@ int SmsPluginTransport::getSegmentSize(SMS_CODING_SCHEME_T CodingScheme, int Dat
int headerLen = 1, concat = 5, port = 6, lang = 3, reply = 2;
int headerSize = 0, segSize = 0, maxSize = 0;
- if (CodingScheme == SMS_CHARSET_7BIT)
- {
+ if (CodingScheme == SMS_CHARSET_7BIT) {
MSG_DEBUG("SMS_CHARSET_7BIT");
maxSize = MAX_GSM_7BIT_DATA_LEN;
- }
- else if (CodingScheme == SMS_CHARSET_8BIT || CodingScheme == SMS_CHARSET_UCS2)
- {
+ } else if (CodingScheme == SMS_CHARSET_8BIT || CodingScheme == SMS_CHARSET_UCS2) {
MSG_DEBUG("SMS_CHARSET_8BIT or SMS_CHARSET_UCS2 [%d]", CodingScheme);
maxSize = MAX_UCS2_DATA_LEN;
}
- if (bPortNum == true)
- {
+ if (bPortNum == true) {
MSG_DEBUG("Port Number Exists");
headerSize += port;
}
- if (LangId != MSG_LANG_ID_RESERVED)
- {
+ if (LangId != MSG_LANG_ID_RESERVED) {
MSG_DEBUG("National Language Exists");
headerSize += lang;
}
- if (ReplyAddrLen > 0)
- {
+ if (ReplyAddrLen > 0) {
MSG_DEBUG("Reply Address Exists");
headerSize += reply;
headerSize += ReplyAddrLen;
}
- if (CodingScheme == SMS_CHARSET_7BIT)
- {
+ if (CodingScheme == SMS_CHARSET_7BIT) {
if ((DataLen+headerSize) > maxSize)
segSize = ((140*8) - ((headerLen + concat + headerSize)*8)) / 7;
else
segSize = DataLen;
- }
- else if (CodingScheme == SMS_CHARSET_8BIT || CodingScheme == SMS_CHARSET_UCS2)
- {
+ } else if (CodingScheme == SMS_CHARSET_8BIT || CodingScheme == SMS_CHARSET_UCS2) {
if ((DataLen+headerSize) > maxSize)
segSize = 140 - (headerLen + concat + headerSize);
else
@@ -1062,23 +986,22 @@ void SmsPluginTransport::setConcatHeader(SMS_UDH_S *pSrcHeader, SMS_UDH_S *pDstH
{
pDstHeader->udhType = pSrcHeader->udhType;
- switch (pDstHeader->udhType)
+ switch (pDstHeader->udhType) {
+ case SMS_UDH_CONCAT_8BIT :
{
- case SMS_UDH_CONCAT_8BIT :
- {
- pDstHeader->udh.concat8bit.msgRef = pSrcHeader->udh.concat8bit.msgRef;
- pDstHeader->udh.concat8bit.totalSeg = pSrcHeader->udh.concat8bit.totalSeg;
- pDstHeader->udh.concat8bit.seqNum = pSrcHeader->udh.concat8bit.seqNum;
- }
- break;
+ pDstHeader->udh.concat8bit.msgRef = pSrcHeader->udh.concat8bit.msgRef;
+ pDstHeader->udh.concat8bit.totalSeg = pSrcHeader->udh.concat8bit.totalSeg;
+ pDstHeader->udh.concat8bit.seqNum = pSrcHeader->udh.concat8bit.seqNum;
+ }
+ break;
- case SMS_UDH_CONCAT_16BIT :
- {
- pDstHeader->udh.concat16bit.msgRef = pSrcHeader->udh.concat16bit.msgRef;
- pDstHeader->udh.concat16bit.totalSeg = pSrcHeader->udh.concat16bit.totalSeg;
- pDstHeader->udh.concat16bit.seqNum = pSrcHeader->udh.concat16bit.seqNum;
- }
- break;
+ case SMS_UDH_CONCAT_16BIT :
+ {
+ pDstHeader->udh.concat16bit.msgRef = pSrcHeader->udh.concat16bit.msgRef;
+ pDstHeader->udh.concat16bit.totalSeg = pSrcHeader->udh.concat16bit.totalSeg;
+ pDstHeader->udh.concat16bit.seqNum = pSrcHeader->udh.concat16bit.seqNum;
+ }
+ break;
}
}
@@ -1103,8 +1026,7 @@ SMS_NETWORK_STATUS_T SmsPluginTransport::getNetStatus()
mx.unlock();
- if (ret == ETIMEDOUT)
- {
+ if (ret == ETIMEDOUT) {
MSG_DEBUG("WARNING: SENT STATUS TIME-OUT");
curStatus = SMS_NETWORK_SEND_FAIL_TIMEOUT;
}
@@ -1138,8 +1060,7 @@ int SmsPluginTransport::getMoCtrlStatus()
mx.unlock();
- if (ret == ETIMEDOUT)
- {
+ if (ret == ETIMEDOUT) {
MSG_DEBUG("WARNING: SENT STATUS TIME-OUT");
return -1;
}
@@ -1158,28 +1079,27 @@ SMS_PID_T SmsPluginTransport::convertPid(MSG_SMS_PID_T pid)
{
SMS_PID_T retPid;
- switch (pid)
- {
- case MSG_PID_TEXT :
- retPid = SMS_PID_NORMAL;
+ switch (pid) {
+ case MSG_PID_TEXT :
+ retPid = SMS_PID_NORMAL;
break;
- case MSG_PID_VOICE :
- retPid = SMS_PID_VOICE;
+ case MSG_PID_VOICE :
+ retPid = SMS_PID_VOICE;
break;
- case MSG_PID_FAX :
- retPid = SMS_PID_TELEX;
+ case MSG_PID_FAX :
+ retPid = SMS_PID_TELEX;
break;
- case MSG_PID_X400 :
- retPid = SMS_PID_x400;
+ case MSG_PID_X400 :
+ retPid = SMS_PID_x400;
break;
- case MSG_PID_ERMES :
- retPid = SMS_PID_ERMES;
+ case MSG_PID_ERMES :
+ retPid = SMS_PID_ERMES;
break;
- case MSG_PID_EMAIL :
- retPid = SMS_PID_EMAIL;
+ case MSG_PID_EMAIL :
+ retPid = SMS_PID_EMAIL;
break;
- default :
- retPid = SMS_PID_NORMAL;
+ default :
+ retPid = SMS_PID_NORMAL;
break;
}
diff --git a/plugin/sms_plugin/SmsPluginUAManager.cpp b/plugin/sms_plugin/SmsPluginUAManager.cpp
index fb72329..33b1df5 100755
--- a/plugin/sms_plugin/SmsPluginUAManager.cpp
+++ b/plugin/sms_plugin/SmsPluginUAManager.cpp
@@ -53,8 +53,7 @@ SmsPluginUAManager* SmsPluginUAManager::instance()
void SmsPluginUAManager::run()
{
- while (1)
- {
+ while (1) {
lock();
while (smsTranQ.empty()) {
wait();
@@ -66,21 +65,16 @@ void SmsPluginUAManager::run()
request.msgInfo.addressList = NULL;
unique_ptr<MSG_ADDRESS_INFO_S*, void(*)(MSG_ADDRESS_INFO_S**)> addressListBuf(&request.msgInfo.addressList, unique_ptr_deleter);
- try
- {
+ try {
SmsPluginTransport::instance()->submitRequest(&request);
- }
- catch (MsgException& e)
- {
+ } catch (MsgException& e) {
MSG_FATAL("%s", e.what());
lock();
smsTranQ.pop_front();
unlock();
continue;
- }
- catch (exception& e)
- {
+ } catch (exception& e) {
MSG_FATAL("%s", e.what());
lock();
smsTranQ.pop_front();
diff --git a/plugin/sms_plugin/SmsPluginUDCodec.cpp b/plugin/sms_plugin/SmsPluginUDCodec.cpp
index d5b51e6..e43d8a6 100755
--- a/plugin/sms_plugin/SmsPluginUDCodec.cpp
+++ b/plugin/sms_plugin/SmsPluginUDCodec.cpp
@@ -40,17 +40,16 @@ int SmsPluginUDCodec::encodeUserData(const SMS_USERDATA_S *pUserData, SMS_CODING
{
int encodeSize = 0;
- switch (CodingScheme)
- {
- case SMS_CHARSET_7BIT:
- encodeSize = encodeGSMData(pUserData, pEncodeData);
- break;
- case SMS_CHARSET_8BIT:
- encodeSize = encode8bitData(pUserData, pEncodeData);
- break;
- case SMS_CHARSET_UCS2:
- encodeSize = encodeUCS2Data(pUserData, pEncodeData);
- break;
+ switch (CodingScheme) {
+ case SMS_CHARSET_7BIT:
+ encodeSize = encodeGSMData(pUserData, pEncodeData);
+ break;
+ case SMS_CHARSET_8BIT:
+ encodeSize = encode8bitData(pUserData, pEncodeData);
+ break;
+ case SMS_CHARSET_UCS2:
+ encodeSize = encodeUCS2Data(pUserData, pEncodeData);
+ break;
}
return encodeSize;
@@ -63,17 +62,16 @@ int SmsPluginUDCodec::decodeUserData(const unsigned char *pTpdu, const int tpduL
memset(pUserData, 0x00, sizeof(SMS_USERDATA_S));
- switch (CodingScheme)
- {
- case SMS_CHARSET_7BIT:
- decodeSize = decodeGSMData(pTpdu, tpduLen, bHeaderInd, pUserData, NULL);
- break;
- case SMS_CHARSET_8BIT:
- decodeSize = decode8bitData(pTpdu, bHeaderInd, pUserData, NULL);
- break;
- case SMS_CHARSET_UCS2:
- decodeSize = decodeUCS2Data(pTpdu, tpduLen, bHeaderInd, pUserData, NULL);
- break;
+ switch (CodingScheme) {
+ case SMS_CHARSET_7BIT:
+ decodeSize = decodeGSMData(pTpdu, tpduLen, bHeaderInd, pUserData, NULL);
+ break;
+ case SMS_CHARSET_8BIT:
+ decodeSize = decode8bitData(pTpdu, bHeaderInd, pUserData, NULL);
+ break;
+ case SMS_CHARSET_UCS2:
+ decodeSize = decodeUCS2Data(pTpdu, tpduLen, bHeaderInd, pUserData, NULL);
+ break;
}
return decodeSize;
@@ -86,20 +84,19 @@ int SmsPluginUDCodec::decodeUserData(const unsigned char *pTpdu, const int tpduL
memset(pUserData, 0x00, sizeof(SMS_USERDATA_S));
- switch (CodingScheme)
- {
- case SMS_CHARSET_7BIT:
- decodeSize = decodeGSMData(pTpdu, tpduLen, bHeaderInd, pUserData, pTPUD);
- break;
- case SMS_CHARSET_8BIT:
- decodeSize = decode8bitData(pTpdu, bHeaderInd, pUserData, pTPUD);
- break;
- case SMS_CHARSET_UCS2:
- decodeSize = decodeUCS2Data(pTpdu, tpduLen, bHeaderInd, pUserData, pTPUD);
- break;
- case SMS_CHARSET_EUCKR:
- decodeSize = decodeUCS2Data(pTpdu, tpduLen, bHeaderInd, pUserData, pTPUD);
- break;
+ switch (CodingScheme) {
+ case SMS_CHARSET_7BIT:
+ decodeSize = decodeGSMData(pTpdu, tpduLen, bHeaderInd, pUserData, pTPUD);
+ break;
+ case SMS_CHARSET_8BIT:
+ decodeSize = decode8bitData(pTpdu, bHeaderInd, pUserData, pTPUD);
+ break;
+ case SMS_CHARSET_UCS2:
+ decodeSize = decodeUCS2Data(pTpdu, tpduLen, bHeaderInd, pUserData, pTPUD);
+ break;
+ case SMS_CHARSET_EUCKR:
+ decodeSize = decodeUCS2Data(pTpdu, tpduLen, bHeaderInd, pUserData, pTPUD);
+ break;
}
return decodeSize;
@@ -116,38 +113,34 @@ int SmsPluginUDCodec::encodeGSMData(const SMS_USERDATA_S *pUserData, char *pEnco
else
offset = 1;
-MSG_DEBUG("pUserData->headerCnt [%d]", pUserData->headerCnt);
+ MSG_DEBUG("pUserData->headerCnt [%d]", pUserData->headerCnt);
- // Encode User Data Header
- for (int i = 0; i < pUserData->headerCnt; i++)
- {
+ /* Encode User Data Header */
+ for (int i = 0; i < pUserData->headerCnt; i++) {
headerLen = encodeHeader(pUserData->header[i], &(pEncodeData[offset]));
-MSG_DEBUG("headerLen [%d]", headerLen);
+ MSG_DEBUG("headerLen [%d]", headerLen);
udhl += headerLen;
offset += headerLen;
}
-MSG_DEBUG("udhl [%d]", udhl);
+ MSG_DEBUG("udhl [%d]", udhl);
if (udhl > 0)
- fillBits = ((udhl+1)*8)%7; // + UDHL
+ fillBits = ((udhl+1)*8)%7; /* + UDHL */
if (fillBits > 0)
fillBits = 7 - fillBits;
-MSG_DEBUG("fillBits [%d]", fillBits);
-MSG_DEBUG("dataLen [%d]", pUserData->length);
+ MSG_DEBUG("fillBits [%d]", fillBits);
+ MSG_DEBUG("dataLen [%d]", pUserData->length);
- // Set UDL, UDHL
- if (udhl > 0)
- {
+ /* Set UDL, UDHL */
+ if (udhl > 0) {
pEncodeData[0] = (((udhl+1)*8) + fillBits + (pUserData->length*7)) / 7;
pEncodeData[1] = udhl;
- }
- else
- {
+ } else {
pEncodeData[0] = (char)pUserData->length;
}
@@ -155,8 +148,8 @@ MSG_DEBUG("dataLen [%d]", pUserData->length);
encodeLen = offset + packSize;
-MSG_DEBUG("packSize [%d]", packSize);
-MSG_DEBUG("encodeLen [%d]", encodeLen);
+ MSG_DEBUG("packSize [%d]", packSize);
+ MSG_DEBUG("encodeLen [%d]", encodeLen);
#if 0
printf("\n\n[encodeGSMData] userData data.\n");
@@ -181,26 +174,22 @@ int SmsPluginUDCodec::encode8bitData(const SMS_USERDATA_S *pUserData, char *pEnc
else
offset = 1;
- // Encode User Data Header
- for (int i = 0; i < pUserData->headerCnt; i++)
- {
+ /* Encode User Data Header */
+ for (int i = 0; i < pUserData->headerCnt; i++) {
headerLen = encodeHeader(pUserData->header[i], &(pEncodeData[offset]));
udhl += headerLen;
offset += headerLen;
}
-MSG_DEBUG("fillBits [%d]", fillBits);
-MSG_DEBUG("dataLen [%d]", pUserData->length);
+ MSG_DEBUG("fillBits [%d]", fillBits);
+ MSG_DEBUG("dataLen [%d]", pUserData->length);
- // Set UDL, UDHL
- if (udhl > 0)
- {
+ /* Set UDL, UDHL */
+ if (udhl > 0) {
pEncodeData[0] = (udhl+1) + fillBits + pUserData->length;
pEncodeData[1] = udhl;
- }
- else
- {
+ } else {
pEncodeData[0] = (char)pUserData->length;
}
@@ -222,26 +211,22 @@ int SmsPluginUDCodec::encodeUCS2Data(const SMS_USERDATA_S *pUserData, char *pEnc
else
offset = 1;
- // Encode User Data Header
- for (int i = 0; i < pUserData->headerCnt; i++)
- {
+ /* Encode User Data Header */
+ for (int i = 0; i < pUserData->headerCnt; i++) {
headerLen = encodeHeader(pUserData->header[i], &(pEncodeData[offset]));
udhl += headerLen;
offset += headerLen;
}
-MSG_DEBUG("fillBits [%d]", fillBits);
-MSG_DEBUG("dataLen [%d]", pUserData->length);
+ MSG_DEBUG("fillBits [%d]", fillBits);
+ MSG_DEBUG("dataLen [%d]", pUserData->length);
- // Set UDL, UDHL
- if (udhl > 0)
- {
+ /* Set UDL, UDHL */
+ if (udhl > 0) {
pEncodeData[0] = (udhl+1) + fillBits + pUserData->length;
pEncodeData[1] = udhl;
- }
- else
- {
+ } else {
pEncodeData[0] = (char)pUserData->length;
}
@@ -266,41 +251,37 @@ int SmsPluginUDCodec::decodeGSMData(const unsigned char *pTpdu, const int tpduLe
{
int offset = 0, udl = 0, udhl = 0, headerLen = 0, fillBits = 0, octetUdl = 0;
- // UDL
+ /* UDL */
udl = pTpdu[offset++];
octetUdl = (udl*7)/8;
-MSG_DEBUG("udl = %d, tpdulen = %d, octetUdl = %d.", udl, tpduLen, octetUdl);
-MSG_DEBUG("bHeaderInd = %d", bHeaderInd);
+ MSG_DEBUG("udl = %d, tpdulen = %d, octetUdl = %d.", udl, tpduLen, octetUdl);
+ MSG_DEBUG("bHeaderInd = %d", bHeaderInd);
- if (udl > MAX_GSM_7BIT_DATA_LEN || octetUdl > tpduLen)
- {
+ if (udl > MAX_GSM_7BIT_DATA_LEN || octetUdl > tpduLen) {
pUserData->length = 0;
pUserData->headerCnt = 0;
return 0;
}
- // Setting for Wap Push
- if (pTPUD != NULL)
- {
+ /* Setting for Wap Push */
+ if (pTPUD != NULL) {
pTPUD->udl = udl;
memcpy(pTPUD->ud, &(pTpdu[offset]), udl);
pTPUD->ud[udl] = '\0';
}
- // Decode User Data Header
- if (bHeaderInd == true)
- {
- // UDHL
+ /* Decode User Data Header */
+ if (bHeaderInd == true) {
+ /* UDHL */
udhl = pTpdu[offset++];
MSG_DEBUG("udhl = %d", udhl);
pUserData->headerCnt = 0;
- for (int i = 0; offset < udhl; i++)
- {
+ for (int i = 0; offset < udhl; i++) {
headerLen = decodeHeader(&(pTpdu[offset]), &(pUserData->header[i]));
if (headerLen <= 0) {
@@ -325,30 +306,25 @@ MSG_DEBUG("bHeaderInd = %d", bHeaderInd);
pUserData->headerCnt++;
}
- }
- else
+ } else {
pUserData->headerCnt = 0;
+ }
MSG_DEBUG("headerCnt = %d", pUserData->headerCnt);
- if (udhl > 0)
- {
+ if (udhl > 0) {
fillBits = ((udl*7) - ((udhl+1)*8)) % 7;
udl = ((udl*7) - ((udhl+1)*8)) / 7;
}
-MSG_DEBUG("fillBits = %d", fillBits);
-MSG_DEBUG("udhl = %d", udhl);
-MSG_DEBUG("udl = %d", udl);
+ MSG_DEBUG("fillBits = %d", fillBits);
+ MSG_DEBUG("udhl = %d", udhl);
+ MSG_DEBUG("udl = %d", udl);
-MSG_DEBUG("offset = %d", offset);
+ MSG_DEBUG("offset = %d", offset);
pUserData->length = unpack7bitChar(&(pTpdu[offset]), udl, fillBits, pUserData->data);
- //MSG_DEBUG("data = [%s]", pUserData->data);
- //MSG_DEBUG("length = [%d]", pUserData->length);
-
-
return pUserData->length;
}
@@ -357,39 +333,35 @@ int SmsPluginUDCodec::decode8bitData(const unsigned char *pTpdu, bool bHeaderInd
{
int offset = 0, udl = 0, udhl = 0, headerLen = 0;
- // UDL
+ /* UDL */
udl = pTpdu[offset++];
- if (udl > MAX_UCS2_DATA_LEN)
- {
+ if (udl > MAX_UCS2_DATA_LEN) {
pUserData->length = 0;
return 0;
}
- // Setting for Wap Push
- if (pTPUD != NULL)
- {
+ /* Setting for Wap Push */
+ if (pTPUD != NULL) {
pTPUD->udl = udl;
memcpy(pTPUD->ud, &(pTpdu[offset]), udl);
pTPUD->ud[udl] = '\0';
}
-MSG_DEBUG("udl = %d", udl);
-MSG_DEBUG("bHeaderInd = %d", bHeaderInd);
+ MSG_DEBUG("udl = %d", udl);
+ MSG_DEBUG("bHeaderInd = %d", bHeaderInd);
- // Decode User Data Header
- if (bHeaderInd == true)
- {
- // UDHL
+ /* Decode User Data Header */
+ if (bHeaderInd == true) {
+ /* UDHL */
udhl = pTpdu[offset++];
MSG_DEBUG("udhl = %d", udhl);
pUserData->headerCnt = 0;
- for (int i = 0; offset < udhl; i++)
- {
+ for (int i = 0; offset < udhl; i++) {
headerLen = decodeHeader(&(pTpdu[offset]), &(pUserData->header[i]));
if (headerLen <= 0) {
@@ -414,19 +386,19 @@ MSG_DEBUG("bHeaderInd = %d", bHeaderInd);
pUserData->headerCnt++;
}
- }
- else
+ } else {
pUserData->headerCnt = 0;
+ }
-MSG_DEBUG("headerCnt = %d", pUserData->headerCnt);
+ MSG_DEBUG("headerCnt = %d", pUserData->headerCnt);
if (udhl > 0)
pUserData->length = (udl) - (udhl+1);
else
pUserData->length = udl;
-MSG_DEBUG("pUserData->length = %d", pUserData->length);
-MSG_DEBUG("offset = %d", offset);
+ MSG_DEBUG("pUserData->length = %d", pUserData->length);
+ MSG_DEBUG("offset = %d", offset);
memcpy(pUserData->data, &(pTpdu[offset]), pUserData->length);
@@ -438,40 +410,36 @@ int SmsPluginUDCodec::decodeUCS2Data(const unsigned char *pTpdu, const int tpduL
{
int offset = 0, udl = 0, udhl = 0, headerLen = 0;
- // UDL
+ /* UDL */
udl = pTpdu[offset++];
-MSG_DEBUG("udl = %d, tpdulen = %d.", udl, tpduLen);
-MSG_DEBUG("bHeaderInd = %d", bHeaderInd);
+ MSG_DEBUG("udl = %d, tpdulen = %d.", udl, tpduLen);
+ MSG_DEBUG("bHeaderInd = %d", bHeaderInd);
- if (udl > MAX_UCS2_DATA_LEN || udl > tpduLen)
- {
+ if (udl > MAX_UCS2_DATA_LEN || udl > tpduLen) {
pUserData->length = 0;
pUserData->headerCnt = 0;
return 0;
}
- // Setting for Wap Push
- if (pTPUD != NULL)
- {
+ /* Setting for Wap Push */
+ if (pTPUD != NULL) {
pTPUD->udl = udl;
memcpy(pTPUD->ud, &(pTpdu[offset]), udl);
pTPUD->ud[udl] = '\0';
}
- // Decode User Data Header
- if (bHeaderInd == true)
- {
- // UDHL
+ /* Decode User Data Header */
+ if (bHeaderInd == true) {
+ /* UDHL */
udhl = pTpdu[offset++];
MSG_DEBUG("udhl = %d", udhl);
pUserData->headerCnt = 0;
- for (int i = 0; offset < udhl; i++)
- {
+ for (int i = 0; offset < udhl; i++) {
headerLen = decodeHeader(&(pTpdu[offset]), &(pUserData->header[i]));
if (headerLen <= 0) {
@@ -496,17 +464,17 @@ MSG_DEBUG("bHeaderInd = %d", bHeaderInd);
pUserData->headerCnt++;
}
- }
- else
+ } else {
pUserData->headerCnt = 0;
+ }
if (udhl > 0)
pUserData->length = (udl) - (udhl+1);
else
pUserData->length = udl;
-MSG_DEBUG("pUserData->length = %d", pUserData->length);
-MSG_DEBUG("offset = %d", offset);
+ MSG_DEBUG("pUserData->length = %d", pUserData->length);
+ MSG_DEBUG("offset = %d", offset);
memcpy(pUserData->data, &(pTpdu[offset]), pUserData->length);
pUserData->data[pUserData->length] = 0;
@@ -522,117 +490,118 @@ int SmsPluginUDCodec::encodeHeader(const SMS_UDH_S header, char *pEncodeHeader)
char* encodedAddr = NULL;
unique_ptr<char*, void(*)(char**)> addressBuf(&encodedAddr, unique_ptr_deleter);
- switch (header.udhType)
- {
- case SMS_UDH_CONCAT_8BIT :
- // IEI
- pEncodeHeader[offset++] = SMS_UDH_CONCAT_8BIT;
+ switch (header.udhType) {
+ case SMS_UDH_CONCAT_8BIT :
+ /* IEI */
+ pEncodeHeader[offset++] = SMS_UDH_CONCAT_8BIT;
+
+ /* IEDL */
+ pEncodeHeader[offset++] = 0x03;
- // IEDL
- pEncodeHeader[offset++] = 0x03;
+ /* Reference Number */
+ pEncodeHeader[offset++] = header.udh.concat8bit.msgRef;
- // Reference Number
- pEncodeHeader[offset++] = header.udh.concat8bit.msgRef;
+ /* Number of Segments */
+ pEncodeHeader[offset++] = header.udh.concat8bit.totalSeg;
- // Number of Segments
- pEncodeHeader[offset++] = header.udh.concat8bit.totalSeg;
+ /* Sequence Number */
+ pEncodeHeader[offset++] = header.udh.concat8bit.seqNum;
- // Sequence Number
- pEncodeHeader[offset++] = header.udh.concat8bit.seqNum;
break;
- case SMS_UDH_CONCAT_16BIT :
- // IEI
- pEncodeHeader[offset++] = SMS_UDH_CONCAT_16BIT;
+ case SMS_UDH_CONCAT_16BIT :
+ /* IEI */
+ pEncodeHeader[offset++] = SMS_UDH_CONCAT_16BIT;
- // IEDL
- pEncodeHeader[offset++] = 0x04;
+ /* IEDL */
+ pEncodeHeader[offset++] = 0x04;
- // Reference Number
- pEncodeHeader[offset++] = (char)(header.udh.concat16bit.msgRef >> 8);
- pEncodeHeader[offset++] = header.udh.concat16bit.msgRef & 0x00FF;
+ /* Reference Number */
+ pEncodeHeader[offset++] = (char)(header.udh.concat16bit.msgRef >> 8);
+ pEncodeHeader[offset++] = header.udh.concat16bit.msgRef & 0x00FF;
- // Number of Segments
- pEncodeHeader[offset++] = header.udh.concat16bit.totalSeg;
+ /* Number of Segments */
+ pEncodeHeader[offset++] = header.udh.concat16bit.totalSeg;
+
+ /* Sequence Number */
+ pEncodeHeader[offset++] = header.udh.concat16bit.seqNum;
- // Sequence Number
- pEncodeHeader[offset++] = header.udh.concat16bit.seqNum;
break;
- case SMS_UDH_APP_PORT_8BIT :
- // IEI
- pEncodeHeader[offset++] = SMS_UDH_APP_PORT_8BIT;
+ case SMS_UDH_APP_PORT_8BIT :
+ /* IEI */
+ pEncodeHeader[offset++] = SMS_UDH_APP_PORT_8BIT;
+
+ /* IEDL */
+ pEncodeHeader[offset++] = 0x02;
- // IEDL
- pEncodeHeader[offset++] = 0x02;
+ /* Dest Port */
+ pEncodeHeader[offset++] = header.udh.appPort8bit.destPort;
- // Dest Port
- pEncodeHeader[offset++] = header.udh.appPort8bit.destPort;
+ /* Origin Port */
+ pEncodeHeader[offset++] = header.udh.appPort8bit.originPort;
- // Origin Port
- pEncodeHeader[offset++] = header.udh.appPort8bit.originPort;
break;
- case SMS_UDH_APP_PORT_16BIT :
- // IEI
- pEncodeHeader[offset++] = SMS_UDH_APP_PORT_16BIT;
+ case SMS_UDH_APP_PORT_16BIT :
+ /* IEI */
+ pEncodeHeader[offset++] = SMS_UDH_APP_PORT_16BIT;
- // IEDL
- pEncodeHeader[offset++] = 0x04;
+ /* IEDL */
+ pEncodeHeader[offset++] = 0x04;
- // Dest Port
- pEncodeHeader[offset++] = (char)(header.udh.appPort16bit.destPort >> 8);
- pEncodeHeader[offset++] = header.udh.appPort16bit.destPort & 0x00FF;
+ /* Dest Port */
+ pEncodeHeader[offset++] = (char)(header.udh.appPort16bit.destPort >> 8);
+ pEncodeHeader[offset++] = header.udh.appPort16bit.destPort & 0x00FF;
- // Origin Port
- pEncodeHeader[offset++] = (char)(header.udh.appPort16bit.originPort >> 8);
- pEncodeHeader[offset++] = header.udh.appPort16bit.originPort & 0x00FF;
- break;
+ /* Origin Port */
+ pEncodeHeader[offset++] = (char)(header.udh.appPort16bit.originPort >> 8);
+ pEncodeHeader[offset++] = header.udh.appPort16bit.originPort & 0x00FF;
- case SMS_UDH_ALTERNATE_REPLY_ADDRESS :
- // IEI
- pEncodeHeader[offset++] = SMS_UDH_ALTERNATE_REPLY_ADDRESS;
+ break;
- addrLen = SmsPluginParamCodec::encodeAddress(&(header.udh.alternateAddress), &encodedAddr);
+ case SMS_UDH_ALTERNATE_REPLY_ADDRESS :
+ /* IEI */
+ pEncodeHeader[offset++] = SMS_UDH_ALTERNATE_REPLY_ADDRESS;
-//MSG_DEBUG("addrLen : %d", addrLen);
+ addrLen = SmsPluginParamCodec::encodeAddress(&(header.udh.alternateAddress), &encodedAddr);
-//for (int i = 0; i < addrLen; i++)
-// MSG_DEBUG("header.udh.alternateAddress.address : [%02x]", encodedAddr[i]);
+ /* IEDL */
+ pEncodeHeader[offset++] = addrLen;
- // IEDL
- pEncodeHeader[offset++] = addrLen;
+ /* Alternate Reply Address */
+ memcpy(&pEncodeHeader[offset], encodedAddr, addrLen);
- // Alternate Reply Address
- memcpy(&pEncodeHeader[offset], encodedAddr, addrLen);
+ offset += addrLen;
- offset += addrLen;
break;
- case SMS_UDH_SINGLE_SHIFT :
- // IEI
- pEncodeHeader[offset++] = SMS_UDH_SINGLE_SHIFT;
+ case SMS_UDH_SINGLE_SHIFT :
+ /* IEI */
+ pEncodeHeader[offset++] = SMS_UDH_SINGLE_SHIFT;
- // IEDL
- pEncodeHeader[offset++] = 0x01;
+ /* IEDL */
+ pEncodeHeader[offset++] = 0x01;
+
+ /* National Language Identifier */
+ pEncodeHeader[offset++] = header.udh.singleShift.langId;
- // National Language Identifier
- pEncodeHeader[offset++] = header.udh.singleShift.langId;
break;
- case SMS_UDH_LOCKING_SHIFT :
- // IEI
- pEncodeHeader[offset++] = SMS_UDH_LOCKING_SHIFT;
+ case SMS_UDH_LOCKING_SHIFT :
+ /* IEI */
+ pEncodeHeader[offset++] = SMS_UDH_LOCKING_SHIFT;
+
+ /* IEDL */
+ pEncodeHeader[offset++] = 0x01;
- // IEDL
- pEncodeHeader[offset++] = 0x01;
+ /* National Language Identifier */
+ pEncodeHeader[offset++] = header.udh.lockingShift.langId;
- // National Language Identifier
- pEncodeHeader[offset++] = header.udh.lockingShift.langId;
break;
- case SMS_UDH_NONE :
- default :
+ case SMS_UDH_NONE :
+ default :
break;
}
@@ -647,130 +616,138 @@ int SmsPluginUDCodec::decodeHeader(const unsigned char *pTpdu, SMS_UDH_S *pHeade
pHeader->udhType = pTpdu[offset++];
- switch (pHeader->udhType)
+ switch (pHeader->udhType) {
+ case SMS_UDH_CONCAT_8BIT :
{
- case SMS_UDH_CONCAT_8BIT :
- {
- IEDL = pTpdu[offset++];
+ IEDL = pTpdu[offset++];
- if (IEDL == 0) return 0;
+ if (IEDL == 0)
+ return 0;
- pHeader->udh.concat8bit.msgRef = pTpdu[offset++];
- pHeader->udh.concat8bit.totalSeg = pTpdu[offset++];
- pHeader->udh.concat8bit.seqNum = pTpdu[offset++];
+ pHeader->udh.concat8bit.msgRef = pTpdu[offset++];
+ pHeader->udh.concat8bit.totalSeg = pTpdu[offset++];
+ pHeader->udh.concat8bit.seqNum = pTpdu[offset++];
-MSG_DEBUG("concat8bit.msgRef [%02x]", pHeader->udh.concat8bit.msgRef);
-MSG_DEBUG("concat8bit.totalSeg [%02x]", pHeader->udh.concat8bit.totalSeg);
-MSG_DEBUG("concat8bit.seqNum [%02x]", pHeader->udh.concat8bit.seqNum);
- }
- break;
+ MSG_DEBUG("concat8bit.msgRef [%02x]", pHeader->udh.concat8bit.msgRef);
+ MSG_DEBUG("concat8bit.totalSeg [%02x]", pHeader->udh.concat8bit.totalSeg);
+ MSG_DEBUG("concat8bit.seqNum [%02x]", pHeader->udh.concat8bit.seqNum);
+ }
+ break;
- case SMS_UDH_CONCAT_16BIT :
- {
- IEDL = pTpdu[offset++];
+ case SMS_UDH_CONCAT_16BIT :
+ {
+ IEDL = pTpdu[offset++];
- if (IEDL == 0) return 0;
+ if (IEDL == 0)
+ return 0;
- pHeader->udh.concat16bit.msgRef = pTpdu[offset++];
- pHeader->udh.concat16bit.msgRef = (unsigned short)((pHeader->udh.concat16bit.msgRef << 8) | pTpdu[offset++]);
- pHeader->udh.concat16bit.totalSeg = pTpdu[offset++];
- pHeader->udh.concat16bit.seqNum = pTpdu[offset++];
+ pHeader->udh.concat16bit.msgRef = pTpdu[offset++];
+ pHeader->udh.concat16bit.msgRef = (unsigned short)((pHeader->udh.concat16bit.msgRef << 8) | pTpdu[offset++]);
+ pHeader->udh.concat16bit.totalSeg = pTpdu[offset++];
+ pHeader->udh.concat16bit.seqNum = pTpdu[offset++];
-MSG_DEBUG("concat16bit.msgRef [%04x]", pHeader->udh.concat16bit.msgRef);
-MSG_DEBUG("concat16bit.totalSeg [%02x]", pHeader->udh.concat16bit.totalSeg);
-MSG_DEBUG("concat16bit.seqNum [%02x]", pHeader->udh.concat16bit.seqNum);
- }
- break;
+ MSG_DEBUG("concat16bit.msgRef [%04x]", pHeader->udh.concat16bit.msgRef);
+ MSG_DEBUG("concat16bit.totalSeg [%02x]", pHeader->udh.concat16bit.totalSeg);
+ MSG_DEBUG("concat16bit.seqNum [%02x]", pHeader->udh.concat16bit.seqNum);
+ }
+ break;
- case SMS_UDH_APP_PORT_8BIT :
- {
- IEDL = pTpdu[offset++];
+ case SMS_UDH_APP_PORT_8BIT :
+ {
+ IEDL = pTpdu[offset++];
- if (IEDL == 0) return 0;
+ if (IEDL == 0)
+ return 0;
- pHeader->udh.appPort8bit.destPort = pTpdu[offset++];
- pHeader->udh.appPort8bit.originPort = pTpdu[offset++];
+ pHeader->udh.appPort8bit.destPort = pTpdu[offset++];
+ pHeader->udh.appPort8bit.originPort = pTpdu[offset++];
-MSG_DEBUG("appPort8bit.destPort [%02x]", pHeader->udh.appPort8bit.destPort);
-MSG_DEBUG("appPort8bit.originPort [%02x]", pHeader->udh.appPort8bit.originPort);
- }
- break;
+ MSG_DEBUG("appPort8bit.destPort [%02x]", pHeader->udh.appPort8bit.destPort);
+ MSG_DEBUG("appPort8bit.originPort [%02x]", pHeader->udh.appPort8bit.originPort);
+ }
+ break;
- case SMS_UDH_APP_PORT_16BIT :
- {
- IEDL = pTpdu[offset++];
+ case SMS_UDH_APP_PORT_16BIT :
+ {
+ IEDL = pTpdu[offset++];
- if (IEDL == 0) return 0;
+ if (IEDL == 0)
+ return 0;
- pHeader->udh.appPort16bit.destPort = pTpdu[offset++];
- pHeader->udh.appPort16bit.destPort = (unsigned short)((pHeader->udh.appPort16bit.destPort << 8) | pTpdu[offset++]);
- pHeader->udh.appPort16bit.originPort = pTpdu[offset++];
- pHeader->udh.appPort16bit.originPort = (unsigned short)((pHeader->udh.appPort16bit.originPort << 8) | pTpdu[offset++]);
+ pHeader->udh.appPort16bit.destPort = pTpdu[offset++];
+ pHeader->udh.appPort16bit.destPort = (unsigned short)((pHeader->udh.appPort16bit.destPort << 8) | pTpdu[offset++]);
+ pHeader->udh.appPort16bit.originPort = pTpdu[offset++];
+ pHeader->udh.appPort16bit.originPort = (unsigned short)((pHeader->udh.appPort16bit.originPort << 8) | pTpdu[offset++]);
-MSG_DEBUG("appPort16bit.destPort [%04x]", pHeader->udh.appPort16bit.destPort);
-MSG_DEBUG("appPort16bit.originPort [%04x]", pHeader->udh.appPort16bit.originPort);
- }
- break;
+ MSG_DEBUG("appPort16bit.destPort [%04x]", pHeader->udh.appPort16bit.destPort);
+ MSG_DEBUG("appPort16bit.originPort [%04x]", pHeader->udh.appPort16bit.originPort);
+ }
+ break;
- case SMS_UDH_SPECIAL_SMS :
- {
- IEDL = pTpdu[offset++];
+ case SMS_UDH_SPECIAL_SMS :
+ {
+ IEDL = pTpdu[offset++];
- if (IEDL != 2) return 0;
-MSG_DEBUG("Decoding special sms udh.");
+ if (IEDL != 2)
+ return 0;
- pHeader->udh.specialInd.bStore = (bool) (pTpdu[offset] & 0x80);
- pHeader->udh.specialInd.msgInd = (unsigned short) (pTpdu[offset++] & 0x7F);
- pHeader->udh.specialInd.waitMsgNum = (unsigned short) pTpdu[offset];
- }
- break;
+ MSG_DEBUG("Decoding special sms udh.");
- case SMS_UDH_ALTERNATE_REPLY_ADDRESS :
- {
- IEDL = pTpdu[offset++];
+ pHeader->udh.specialInd.bStore = (bool) (pTpdu[offset] & 0x80);
+ pHeader->udh.specialInd.msgInd = (unsigned short) (pTpdu[offset++] & 0x7F);
+ pHeader->udh.specialInd.waitMsgNum = (unsigned short) pTpdu[offset];
+ }
+ break;
- if (IEDL == 0) return 0;
+ case SMS_UDH_ALTERNATE_REPLY_ADDRESS :
+ {
+ IEDL = pTpdu[offset++];
- offset += SmsPluginParamCodec::decodeAddress(&pTpdu[offset], &(pHeader->udh.alternateAddress));
+ if (IEDL == 0)
+ return 0;
- MSG_SEC_DEBUG("alternate reply address [%s]", pHeader->udh.alternateAddress.address);
- }
- break;
+ offset += SmsPluginParamCodec::decodeAddress(&pTpdu[offset], &(pHeader->udh.alternateAddress));
- case SMS_UDH_SINGLE_SHIFT :
- {
- IEDL = pTpdu[offset++];
+ MSG_SEC_DEBUG("alternate reply address [%s]", pHeader->udh.alternateAddress.address);
+ }
+ break;
- if (IEDL == 0) return 0;
+ case SMS_UDH_SINGLE_SHIFT :
+ {
+ IEDL = pTpdu[offset++];
- pHeader->udh.singleShift.langId = pTpdu[offset++];
+ if (IEDL == 0)
+ return 0;
-MSG_DEBUG("singleShift.langId [%02x]", pHeader->udh.singleShift.langId);
- }
- break;
+ pHeader->udh.singleShift.langId = pTpdu[offset++];
- case SMS_UDH_LOCKING_SHIFT :
- {
- IEDL = pTpdu[offset++];
+ MSG_DEBUG("singleShift.langId [%02x]", pHeader->udh.singleShift.langId);
+ }
+ break;
- if (IEDL == 0) return 0;
+ case SMS_UDH_LOCKING_SHIFT :
+ {
+ IEDL = pTpdu[offset++];
- pHeader->udh.lockingShift.langId = pTpdu[offset++];
+ if (IEDL == 0)
+ return 0;
-MSG_DEBUG("lockingShift.langId [%02x]", pHeader->udh.lockingShift.langId);
- }
- break;
+ pHeader->udh.lockingShift.langId = pTpdu[offset++];
- default :
- {
- MSG_DEBUG("Not Supported Header Type [%02x]", pHeader->udhType);
+ MSG_DEBUG("lockingShift.langId [%02x]", pHeader->udh.lockingShift.langId);
+ }
+ break;
- IEDL = pTpdu[offset++];
+ default :
+ {
+ MSG_DEBUG("Not Supported Header Type [%02x]", pHeader->udhType);
- MSG_DEBUG("IEDL [%d]", IEDL);
- return (offset + IEDL);
- }
- break;
+ IEDL = pTpdu[offset++];
+
+ MSG_DEBUG("IEDL [%d]", IEDL);
+ return (offset + IEDL);
+ }
+ break;
}
return offset;
@@ -781,60 +758,37 @@ int SmsPluginUDCodec::pack7bitChar(const unsigned char *pUserData, int dataLen,
{
int srcIdx = 0, dstIdx = 0, shift = fillBits;
-//MSG_DEBUG("dataLen = %d", dataLen);
-
if (shift > 0)
dstIdx = 1;
- while (srcIdx < dataLen)
- {
- if (shift == 0)
- {
-// if (srcIdx > 0) srcIdx++;
-
-//MSG_DEBUG("pUserData [%02x]", pUserData[srcIdx]);
-//MSG_DEBUG("shift = %d", shift);
-
+ while (srcIdx < dataLen) {
+ if (shift == 0) {
pPackData[dstIdx] = pUserData[srcIdx];
-//MSG_DEBUG("pPackData [%02x]", pPackData[dstIdx]);
shift = 7;
srcIdx++;
dstIdx++;
- if (srcIdx >= dataLen) break;
+ if (srcIdx >= dataLen)
+ break;
}
- if (shift > 1)
- {
-//MSG_DEBUG("pUserData [%02x]", pUserData[srcIdx]);
-
-//MSG_DEBUG("shift = %d", shift);
-
+ if (shift > 1) {
pPackData[dstIdx-1] |= pUserData[srcIdx] << shift;
pPackData[dstIdx] = pUserData[srcIdx] >> (8-shift);
shift--;
-//MSG_DEBUG("pPackData [%02x]", pPackData[dstIdx]);
srcIdx++;
dstIdx++;
- }
- else if (shift == 1)
- {
-//MSG_DEBUG("pUserData [%02x]", pUserData[srcIdx]);
-//MSG_DEBUG("shift = %d", shift);
+ } else if (shift == 1) {
pPackData[dstIdx-1] |= pUserData[srcIdx] << shift;
-//MSG_DEBUG("pPackData [%02x]", pPackData[dstIdx-1]);
-
srcIdx++;
shift--;
}
}
-//MSG_DEBUG("dstIdx = %d", dstIdx);
-
return dstIdx;
}
@@ -848,35 +802,27 @@ MSG_DEBUG("dataLen = %d", dataLen);
if (shift > 0)
srcIdx = 1;
- for (; dstIdx < dataLen; dstIdx++)
- {
- if (shift == 0)
- {
-//MSG_DEBUG("shift = %d", shift);
-
+ for (; dstIdx < dataLen; dstIdx++) {
+ if (shift == 0) {
pUnpackData[dstIdx] = pTpdu[srcIdx] & 0x7F;
-//MSG_DEBUG("UserData[%d] = %02x", dstIdx, pUnpackData[dstIdx]);
shift = 7;
srcIdx++;
dstIdx++;
- if (dstIdx >= dataLen) break;
+ if (dstIdx >= dataLen)
+ break;
}
- if (shift > 0)
- {
-//MSG_DEBUG("shift = %d", shift);
-
+ if (shift > 0) {
pUnpackData[dstIdx] = (pTpdu[srcIdx-1] >> shift) + (pTpdu[srcIdx] << (8 - shift));
pUnpackData[dstIdx] &= 0x7F;
-//MSG_DEBUG("UserData[%d] = %02x", dstIdx, pUnpackData[dstIdx]);
-
shift--;
- if (shift > 0) srcIdx++;
+ if (shift > 0)
+ srcIdx++;
}
}
diff --git a/plugin/sms_plugin/SmsPluginWapPushHandler.cpp b/plugin/sms_plugin/SmsPluginWapPushHandler.cpp
index 58ac6ce..eab0306 100755
--- a/plugin/sms_plugin/SmsPluginWapPushHandler.cpp
+++ b/plugin/sms_plugin/SmsPluginWapPushHandler.cpp
@@ -83,7 +83,7 @@ const SMS_PUSH_APP_INFO_S pushDefaultApplication [] =
char gWapCodeBufferLeft[WSP_CODE_BUFFER_LEFT_LEN_MAX];
char gWapCodeBufferRight[WSP_CODE_BUFFER_RIGHT_LEN_MAX];
-const unsigned long wspUintvarDecodeTable[] = { 0x00000001, 0x00000080, 0x00004000, 0x00200000, 0x10000000};
+const unsigned long wspUintvarDecodeTable[] = { 0x00000001, 0x00000080, 0x00004000, 0x00200000, 0x10000000 };
const unsigned char wspHeaderFieldCount = 0x43;
const unsigned char wspContentsTypeCount = 0x34;
@@ -91,8 +91,7 @@ const unsigned long wspLanguageCount = 0x11a;
const unsigned char wspSecurityTypeCount = 0x04;
-static const SMS_WSP_CONTENTS_TYPE_S wspExtendedContentsType[] =
-{
+static const SMS_WSP_CONTENTS_TYPE_S wspExtendedContentsType[] = {
{ (char*)"text/vnd/wap/connectivity-xml", 0x35 },
{ (char*)"application/vnd.wap.connectivity-wbxml", 0x36 },
{ (char*)"application/pkcs7-mime", 0x37 },
@@ -125,81 +124,79 @@ static const SMS_WSP_CONTENTS_TYPE_S wspExtendedContentsType[] =
};
-const char* wspHeaderFieldName[] =
-{
- (char*)"Accept", //0x00
+const char* wspHeaderFieldName[] = {
+ (char*)"Accept", /* 0x00 */
(char*)"Accept-Charset",
(char*)"Accept-Encoding",
(char*)"Accept-Language",
(char*)"Accept-Ranges",
- (char*)"Age", //0x05
+ (char*)"Age", /* 0x05 */
(char*)"Allow",
(char*)"Authorization",
(char*)"Cache-Control",
(char*)"Connection",
- (char*)"Content-Base", //0x0a
+ (char*)"Content-Base", /* 0x0a */
(char*)"Content-Encoding",
(char*)"Content-Language",
(char*)"Content-Length",
(char*)"Content-Location",
(char*)"Content-MD5",
- (char*)"Content-Range", //0x10
+ (char*)"Content-Range", /* 0x10 */
(char*)"Content-Type",
(char*)"Date",
(char*)"ETag",
(char*)"Expires",
- (char*)"From", //0x15
+ (char*)"From", /* 0x15 */
(char*)"Host",
(char*)"If-Modified-Since",
(char*)"If-Match",
(char*)"If-None-Match",
- (char*)"If-Range", //0x1a
+ (char*)"If-Range", /* 0x1a */
(char*)"If-Unmodified-Since",
(char*)"Location",
(char*)"Last-Modified",
(char*)"Max-Forwards",
(char*)"Pragma",
- (char*)"Proxy-Authenticate", //0x20
+ (char*)"Proxy-Authenticate", /* 0x20 */
(char*)"Proxy-Authorization",
(char*)"Public",
(char*)"Range",
(char*)"Referer",
- (char*)"Retry-After", //0x25
+ (char*)"Retry-After", /* 0x25 */
(char*)"Server",
(char*)"Transfer-Encodig",
(char*)"Upgrade",
(char*)"User-Agent",
- (char*)"Vary", //0x2a
+ (char*)"Vary", /* 0x2a */
(char*)"Via",
(char*)"Warning",
(char*)"Www-Authenticate",
(char*)"Content-Disposition",
(char*)"X-Wap-Application-Id",
- (char*)"X-Wap-Content-URI", //0x30
+ (char*)"X-Wap-Content-URI", /* 0x30 */
(char*)"X-Wap-Iinitiator-URI",
- (char*)"Accept-Application", // Back
+ (char*)"Accept-Application", /* Back */
(char*)"Bearer-Indication",
(char*)"Push-Flag",
- (char*)"Profile", //0x35
+ (char*)"Profile", /* 0x35 */
(char*)"Profile-Diff",
- (char*)"Profile-Warning", // end of WAP 1.2
+ (char*)"Profile-Warning", /* end of WAP 1.2 */
(char*)"Expect",
(char*)"Te",
- (char*)"Trailer", //0x3a
- (char*)"Accept-Charset", //Back
- (char*)"Accept-Encoding", // Back
- (char*)"Cache-Control", // back
+ (char*)"Trailer", /* 0x3a */
+ (char*)"Accept-Charset", /* Back */
+ (char*)"Accept-Encoding", /* Back */
+ (char*)"Cache-Control", /* back */
(char*)"Content-Range",
(char*)"X-Wap-Tod",
- (char*)"Content-ID", //x40
+ (char*)"Content-ID", /* 0x40 */
(char*)"Set-Cookie",
(char*)"Cookie",
(char*)"Encoding-Version"
};
-const SMS_WSP_CHARSET_S wspCharset[] =
-{
+const SMS_WSP_CHARSET_S wspCharset[] = {
{ (char*)"big5", 0x07ea },
{ (char*)"iso-10646-ucs-2", 0x03e8 },
{ (char*)"iso-8859-1", 0x04 },
@@ -220,16 +217,14 @@ const SMS_WSP_CHARSET_S wspCharset[] =
-const char* wspEncodeMethod[] =
-{
+const char* wspEncodeMethod[] = {
(char*)"Gzip",
(char*)"Compress",
(char*)"Deflate"
};
-const SMS_WSP_CONTENTS_TYPE_S wspContentsType[] =
-{
+const SMS_WSP_CONTENTS_TYPE_S wspContentsType[] = {
{ (char*)"*/*", 0x00 },
{ (char*)"text/*", 0x01 },
{ (char*)"text/html", 0x02 },
@@ -306,8 +301,7 @@ const SMS_WSP_CONTENTS_TYPE_S wspContentsType[] =
{ (char*)"application/vnd.wv.csp.cir", 0x46 }
};
-static const SMS_WAP_UNREGISTER_CONTENTS_TYPE_S wspUnregisterContentsType[]=
-{
+static const SMS_WAP_UNREGISTER_CONTENTS_TYPE_S wspUnregisterContentsType[]= {
{ (char*)"application/vnd.wap.emn+wbxml", 0x30A},
{ (char*)"application/vnd.omaloc-supl-init", 0x312},
{ (char*)"application/vnd.oma.drm.roap-trigger+wbxml", 0x316}
@@ -315,8 +309,7 @@ static const SMS_WAP_UNREGISTER_CONTENTS_TYPE_S wspUnregisterContentsType[]=
const unsigned long wspUnregisteredContentsTypeCount = sizeof(wspUnregisterContentsType)/sizeof(SMS_WAP_UNREGISTER_CONTENTS_TYPE_S);
-const SMS_WSP_LANGUAGE_S wspLanguage[] =
-{
+const SMS_WSP_LANGUAGE_S wspLanguage[] = {
{ (char*)"English", 0x19 },
{ (char*)"en", 0x19 },
{ (char*)"Korean", 0x3d },
@@ -603,8 +596,7 @@ const SMS_WSP_LANGUAGE_S wspLanguage[] =
};
-const SMS_WSP_HEADER_PARAMETER_S wspHeaderApplId[] =
-{
+const SMS_WSP_HEADER_PARAMETER_S wspHeaderApplId[] = {
{ (char*)"x-wap-application:*", 0x00 },
{ (char*)"x-wap-application:push.sia", 0x01},
{ (char*)"x-wap-application:wml.ua", 0x02 },
@@ -633,8 +625,7 @@ const SMS_WSP_HEADER_PARAMETER_S wspHeaderApplId[] =
};
-const char* wspCacheControl[] =
-{
+const char* wspCacheControl[] = {
(char*)"No-cache",
(char*)"No-store",
(char*)"Max-age",
@@ -648,8 +639,7 @@ const char* wspCacheControl[] =
(char*)"Proxy-revalidate"
};
-const SMS_WSP_METHOD_TYPE_S wspMethodType[] =
-{
+const SMS_WSP_METHOD_TYPE_S wspMethodType[] = {
{ (char*)"GET", 0x40 },
{ (char*)"OPTIONS", 0x41 },
{ (char*)"HEAD", 0x42 },
@@ -660,8 +650,7 @@ const SMS_WSP_METHOD_TYPE_S wspMethodType[] =
};
-const SMS_WSP_SECURITY_TYPE_S wspSecurityType[] =
-{
+const SMS_WSP_SECURITY_TYPE_S wspSecurityType[] = {
{(char*)"NETWPIN",0x00},
{(char*)"USERPIN",0x01},
{(char*)"USERNETWPIN",0x02},
@@ -670,8 +659,7 @@ const SMS_WSP_SECURITY_TYPE_S wspSecurityType[] =
-const char* wspWeek[] =
-{
+const char* wspWeek[] = {
(char*)"Sun",
(char*)"Mon",
(char*)"Tue",
@@ -682,8 +670,7 @@ const char* wspWeek[] =
};
-const char* wspWeekDay[] =
-{
+const char* wspWeekDay[] = {
(char*)"Sunday",
(char*)"Monday",
(char*)"Tuesday",
@@ -693,8 +680,7 @@ const char* wspWeekDay[] =
(char*)"Saturday"
};
-const char* wspMonth[] =
-{
+const char* wspMonth[] = {
(char*)"Jan",
(char*)"Feb",
(char*)"Mar",
@@ -748,7 +734,7 @@ bool SmsPluginWapPushHandler::IsWapPushMsg(SMS_USERDATA_S *pUserData)
return false;
}
- int PortCount = sizeof(wapPushPortList)/sizeof(wapPushPortList[0]);
+ int PortCount = sizeof(wapPushPortList) / sizeof(wapPushPortList[0]);
MSG_DEBUG("Port Count [%d]", PortCount);
@@ -825,7 +811,7 @@ void SmsPluginWapPushHandler::copyDeliverData(SMS_DELIVER_S *pDeliver)
}
-void SmsPluginWapPushHandler::handleWapPushMsg(const char *pUserData, int DataSize, int simIndex)
+void SmsPluginWapPushHandler::handleWapPushMsg(const char *pUserData, int DataSize, int simIndex, time_t sent_time)
{
MSG_BEGIN();
@@ -833,8 +819,7 @@ void SmsPluginWapPushHandler::handleWapPushMsg(const char *pUserData, int DataSi
MSG_DEBUG("DataSize [%d]", DataSize);
MSG_DEBUG("[pUserData]");
- for (int i = 0; i < DataSize; i++)
- {
+ for (int i = 0; i < DataSize; i++) {
printf("[%02x]", pUserData[i]);
}
printf("\n\n");
@@ -864,7 +849,7 @@ void SmsPluginWapPushHandler::handleWapPushMsg(const char *pUserData, int DataSi
/** pass PDU type */
iPDU++;
- pushHeaderLen = wspRetriveUintvarDecode( pPDUTypeData, &iPDU );
+ pushHeaderLen = wspRetriveUintvarDecode(pPDUTypeData, &iPDU);
MSG_DEBUG("PDUTypeDataLen [%d]", PDUTypeDataLen);
MSG_DEBUG("pushHeaderLen [%d]", pushHeaderLen);
@@ -890,8 +875,7 @@ void SmsPluginWapPushHandler::handleWapPushMsg(const char *pUserData, int DataSi
MSG_DEBUG("wspHeaderLen [%d]", wspHeaderLen);
MSG_DEBUG("[pWspHeader]");
- for (int i = 0; i < wspHeaderLen; i++)
- {
+ for (int i = 0; i < wspHeaderLen; i++) {
printf("[%02x]", pWspHeader[i]);
}
printf("\n\n");
@@ -929,7 +913,7 @@ void SmsPluginWapPushHandler::handleWapPushMsg(const char *pUserData, int DataSi
if (pushBodyLen > 0) {
pPushBody = new char[pushBodyLen];
- if (pPushBody == NULL) {
+ if (pPushBody == NULL) {
MSG_DEBUG("pPushBody Memory Allocation Failed");
return;
} else {
@@ -940,7 +924,7 @@ void SmsPluginWapPushHandler::handleWapPushMsg(const char *pUserData, int DataSi
return;
}
- handleWapPushCallback((char *)pPushHeader, (char *)pPushBody, (int)pushBodyLen, (char *)pWspHeader, (int)wspHeaderLen, (char *)pWspBody, (int)wspBodyLen, simIndex);
+ handleWapPushCallback((char *)pPushHeader, (char *)pPushBody, (int)pushBodyLen, (char *)pWspHeader, (int)wspHeaderLen, (char *)pWspBody, (int)wspBodyLen, simIndex, sent_time);
MSG_END();
}
@@ -1104,91 +1088,91 @@ static void launchProcessByAppcode(int appcode)
GVariant *result_agent = NULL;
GVariant *result_service = NULL;
- switch(appcode){
- case SMS_WAP_APPLICATION_SYNCML_DM_BOOTSTRAP:
- case SMS_WAP_APPLICATION_SYNCML_DM_BOOTSTRAP_XML:
- case SMS_WAP_APPLICATION_PUSH_PROVISIONING_XML:
- case SMS_WAP_APPLICATION_PUSH_PROVISIONING_WBXML:
- case SMS_WAP_APPLICATION_PUSH_BROWSER_SETTINGS:
- case SMS_WAP_APPLICATION_PUSH_BROWSER_BOOKMARKS:
- case SMS_WAP_APPLICATION_SYNCML_DM_NOTIFICATION:
- {
- connection_agent = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
- if (error) {
- MSG_DEBUG("Connecting to system bus failed: %s\n", error->message);
- goto _DBUS_ERROR;
- }
+ switch (appcode) {
+ case SMS_WAP_APPLICATION_SYNCML_DM_BOOTSTRAP:
+ case SMS_WAP_APPLICATION_SYNCML_DM_BOOTSTRAP_XML:
+ case SMS_WAP_APPLICATION_PUSH_PROVISIONING_XML:
+ case SMS_WAP_APPLICATION_PUSH_PROVISIONING_WBXML:
+ case SMS_WAP_APPLICATION_PUSH_BROWSER_SETTINGS:
+ case SMS_WAP_APPLICATION_PUSH_BROWSER_BOOKMARKS:
+ case SMS_WAP_APPLICATION_SYNCML_DM_NOTIFICATION:
+ {
+ connection_agent = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
+ if (error) {
+ MSG_DEBUG("Connecting to system bus failed: %s\n", error->message);
+ goto _DBUS_ERROR;
+ }
- dbus_proxy_agent = g_dbus_proxy_new_sync(connection_agent, G_DBUS_PROXY_FLAGS_NONE,
- NULL, "org.tizen.omadmagent", "/org/tizen/omadmagent",
- "org.tizen.omadmagent", NULL, &error);
- if (error) {
- MSG_DEBUG("Connecting to agent proxy failed: %s\n", error->message);
- goto _DBUS_ERROR;
- }
+ dbus_proxy_agent = g_dbus_proxy_new_sync(connection_agent, G_DBUS_PROXY_FLAGS_NONE,
+ NULL, "org.tizen.omadmagent", "/org/tizen/omadmagent",
+ "org.tizen.omadmagent", NULL, &error);
+ if (error) {
+ MSG_DEBUG("Connecting to agent proxy failed: %s\n", error->message);
+ goto _DBUS_ERROR;
+ }
- result_agent = g_dbus_proxy_call_sync(dbus_proxy_agent, "Hello_Agent", NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
- if (error) {
- MSG_DEBUG("invoking agent proxy call failed: %s\n", error->message);
- goto _DBUS_ERROR;
- }
+ result_agent = g_dbus_proxy_call_sync(dbus_proxy_agent, "Hello_Agent", NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
+ if (error) {
+ MSG_DEBUG("invoking agent proxy call failed: %s\n", error->message);
+ goto _DBUS_ERROR;
+ }
- connection_service = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
- if (error) {
- MSG_DEBUG("Connecting to system bus failed: %s\n", error->message);
- goto _DBUS_ERROR;
- }
+ connection_service = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
+ if (error) {
+ MSG_DEBUG("Connecting to system bus failed: %s\n", error->message);
+ goto _DBUS_ERROR;
+ }
- dbus_proxy_service =g_dbus_proxy_new_sync(connection_service, G_DBUS_PROXY_FLAGS_NONE, NULL,
- "org.tizen.omadmservice", "/org/tizen/omadmservice",
- "org.tizen.omadmservice", NULL, &error);
- if (error) {
- MSG_DEBUG("Connecting to service proxy failed: %s\n", error->message);
- goto _DBUS_ERROR;
- }
+ dbus_proxy_service =g_dbus_proxy_new_sync(connection_service, G_DBUS_PROXY_FLAGS_NONE, NULL,
+ "org.tizen.omadmservice", "/org/tizen/omadmservice",
+ "org.tizen.omadmservice", NULL, &error);
+ if (error) {
+ MSG_DEBUG("Connecting to service proxy failed: %s\n", error->message);
+ goto _DBUS_ERROR;
+ }
- result_service = g_dbus_proxy_call_sync(dbus_proxy_service, "wakeup", NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
- if (error) {
- MSG_DEBUG("invoking service proxy call failed: %s\n", error->message);
- goto _DBUS_ERROR;
- }
+ result_service = g_dbus_proxy_call_sync(dbus_proxy_service, "wakeup", NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
+ if (error) {
+ MSG_DEBUG("invoking service proxy call failed: %s\n", error->message);
+ goto _DBUS_ERROR;
+ }
- Mutex mx;
- CndVar cv;
- mx.lock();
- cv.timedwait(mx.pMutex(), 2);
- mx.unlock();
+ Mutex mx;
+ CndVar cv;
+ mx.lock();
+ cv.timedwait(mx.pMutex(), 2);
+ mx.unlock();
- MSG_END();
+ MSG_END();
+ }
+ break;
+ case SMS_WAP_APPLICATION_SYNCML_DS_NOTIFICATION:
+ case SMS_WAP_APPLICATION_SYNCML_DS_NOTIFICATION_WBXML:
+ {
+ connection_agent = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
+ if (error) {
+ MSG_DEBUG("Connecting to system bus failed: %s\n", error->message);
+ goto _DBUS_ERROR;
}
- break;
- case SMS_WAP_APPLICATION_SYNCML_DS_NOTIFICATION:
- case SMS_WAP_APPLICATION_SYNCML_DS_NOTIFICATION_WBXML:
- {
- connection_agent = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
- if (error) {
- MSG_DEBUG("Connecting to system bus failed: %s\n", error->message);
- goto _DBUS_ERROR;
- }
- dbus_proxy_agent = g_dbus_proxy_new_sync(connection_agent, G_DBUS_PROXY_FLAGS_NONE, NULL,
- "org.tizen.omadsagent", "/org/tizen/omadsagent",
- "org.tizen.omadsagent", NULL, &error);
- if (error) {
- MSG_DEBUG("Connecting to agent proxy failed: %s\n", error->message);
- goto _DBUS_ERROR;
- }
+ dbus_proxy_agent = g_dbus_proxy_new_sync(connection_agent, G_DBUS_PROXY_FLAGS_NONE, NULL,
+ "org.tizen.omadsagent", "/org/tizen/omadsagent",
+ "org.tizen.omadsagent", NULL, &error);
+ if (error) {
+ MSG_DEBUG("Connecting to agent proxy failed: %s\n", error->message);
+ goto _DBUS_ERROR;
+ }
- result_agent = g_dbus_proxy_call_sync(dbus_proxy_agent, "Hello_Agent", NULL,
- G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
- if (error) {
- MSG_DEBUG("invoking service error: %s\n", error->message);
- goto _DBUS_ERROR;
- }
+ result_agent = g_dbus_proxy_call_sync(dbus_proxy_agent, "Hello_Agent", NULL,
+ G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
+ if (error) {
+ MSG_DEBUG("invoking service error: %s\n", error->message);
+ goto _DBUS_ERROR;
}
- break;
- default:
- break;
+ }
+ break;
+ default:
+ break;
}
_DBUS_ERROR:
@@ -1231,7 +1215,7 @@ _DBUS_ERROR:
}
-void SmsPluginWapPushHandler::handleWapPushCallback(char* pPushHeader, char* pPushBody, int PushBodyLen, char* pWspHeader, int WspHeaderLen, char* pWspBody, int WspBodyLen, int simIndex)
+void SmsPluginWapPushHandler::handleWapPushCallback(char* pPushHeader, char* pPushBody, int PushBodyLen, char* pWspHeader, int WspHeaderLen, char* pWspBody, int WspBodyLen, int simIndex, time_t sent_time)
{
MSG_BEGIN();
@@ -1253,22 +1237,21 @@ void SmsPluginWapPushHandler::handleWapPushCallback(char* pPushHeader, char* pPu
return;
}
- for(int i = 0; i < pushEvt_cnt; ++i) {
-
- /** check Push message receive setting */
+ for (int i = 0; i < pushEvt_cnt; ++i) {
+ /* check Push message receive setting */
bool bPushRecv = false;
int appcode = 0;
MsgSettingGetBool(PUSH_RECV_OPTION, &bPushRecv);
storageHandler->getnthPushEvent(i, &appcode);
MSG_DEBUG("pushEvt_cnt: %d, appcode: %d", pushEvt_cnt, appcode);
- if ((bPushRecv == false) && (appcode != SMS_WAP_APPLICATION_MMS_UA)) {
+ if ((bPushRecv == false) && (IsWapPushMsgInWhiteList(appcode) == false)) {
MSG_DEBUG("Push Message Receive option is OFF. Drop Push Message.");
return;
}
#ifdef FEATURE_MMS_DISABLE
- if (appcode == SMS_WAP_APPLICATION_MMS_UA){
+ if (appcode == SMS_WAP_APPLICATION_MMS_UA) {
MSG_DEBUG("Drop MMS Notification for DOCOMO");
return;
}
@@ -1279,7 +1262,7 @@ void SmsPluginWapPushHandler::handleWapPushCallback(char* pPushHeader, char* pPu
switch (appcode) {
case SMS_WAP_APPLICATION_MMS_UA:
MSG_DEBUG("Received MMS Notification");
- handleMMSNotification(pPushBody, PushBodyLen, simIndex);
+ handleMMSNotification(pPushBody, PushBodyLen, simIndex, sent_time);
break;
case SMS_WAP_APPLICATION_PUSH_SI:
@@ -1367,31 +1350,31 @@ void SmsPluginWapPushHandler::handleWapPushCallback(char* pPushHeader, char* pPu
case SMS_WAP_APPLICATION_DRM_V2_ROAP_TRIGGER_XML:
case SMS_WAP_APPLICATION_DRM_V2_ROAP_TRIGGER_WBXML:
MSG_DEBUG("Received DRM V2");
- // TODO: DRM V2
+ /* TODO: DRM V2 */
break;
case SMS_WAP_APPLICATION_PUSH_EMAIL:
case SMS_WAP_APPLICATION_PUSH_EMAIL_XML:
case SMS_WAP_APPLICATION_PUSH_EMAIL_WBXML:
MSG_DEBUG("Received Email");
- // TODO: Email
+ /* TODO: Email */
break;
case SMS_WAP_APPLICATION_PUSH_IMPS_CIR:
MSG_DEBUG("Received IMPS CIR");
- // TODO: IMPS CIR
+ /* TODO: IMPS CIR */
break;
- case SMS_WAP_APPLICATION_LBS :
+ case SMS_WAP_APPLICATION_LBS:
MSG_DEBUG("Received LBS related message");
SmsPluginEventHandler::instance()->handleLBSMsgIncoming(pPushHeader, pPushBody, PushBodyLen);
- // TODO: LBS
+ /* TODO: LBS */
break;
- case SMS_WAP_APPLICATION_PUSH_SIA :
+ case SMS_WAP_APPLICATION_PUSH_SIA:
MSG_DEBUG("Received SIA");
- // TODO: SIA
+ /* TODO: SIA */
break;
default:
@@ -1405,15 +1388,42 @@ void SmsPluginWapPushHandler::handleWapPushCallback(char* pPushHeader, char* pPu
}
#endif
-void SmsPluginWapPushHandler::handleMMSNotification(const char *pPushBody, int PushBodyLen, int simIndex)
+bool SmsPluginWapPushHandler::IsWapPushMsgInWhiteList(int appCode)
+{
+ MSG_BEGIN();
+
+ bool isAllowed = false;
+
+ switch (appCode) {
+ case SMS_WAP_APPLICATION_MMS_UA:
+ case SMS_WAP_APPLICATION_SYNCML_DM_BOOTSTRAP:
+ case SMS_WAP_APPLICATION_SYNCML_DM_BOOTSTRAP_XML:
+ case SMS_WAP_APPLICATION_PUSH_PROVISIONING_XML:
+ case SMS_WAP_APPLICATION_PUSH_PROVISIONING_WBXML:
+ case SMS_WAP_APPLICATION_PUSH_BROWSER_SETTINGS:
+ case SMS_WAP_APPLICATION_PUSH_BROWSER_BOOKMARKS:
+ case SMS_WAP_APPLICATION_SYNCML_DM_NOTIFICATION:
+ case SMS_WAP_APPLICATION_SYNCML_DS_NOTIFICATION:
+ case SMS_WAP_APPLICATION_SYNCML_DS_NOTIFICATION_WBXML:
+ MSG_INFO("appcode[%d] is allowed even if push receive option is disabled.", appCode);
+ isAllowed = true;
+ break;
+ default:
+ MSG_DEBUG("appcode[%d] is not allowed when push receive option is disabled.", appCode);
+ break;
+ }
+
+ return isAllowed;
+}
+
+void SmsPluginWapPushHandler::handleMMSNotification(const char *pPushBody, int PushBodyLen, int simIndex, time_t sent_time)
{
MSG_BEGIN();
#ifdef MSG_FW_FOR_DEBUG
printf("\n\n[handleMMSNotification] Push Body.\n");
- for (int i = 0; i < PushBodyLen; i++)
- {
+ for (int i = 0; i < PushBodyLen; i++) {
printf(" [%02x]", pPushBody[i]);
}
printf("\n\n");
@@ -1436,6 +1446,9 @@ void SmsPluginWapPushHandler::handleMMSNotification(const char *pPushBody, int P
msgInfo.dataSize = PushBodyLen;
msgInfo.sim_idx = simIndex;
+ if (sent_time > 0)
+ msgInfo.displayTime = sent_time;
+
if (msgInfo.dataSize > MAX_MSG_TEXT_LEN) {
msgInfo.bTextSms = false;
@@ -1486,7 +1499,7 @@ void SmsPluginWapPushHandler::handleSIMessage(char* pPushBody, int PushBodyLen,
xmlNodePtr topNode = NULL;
xmlNodePtr indNode = NULL;
- xmlChar* tmpXmlChar = NULL;
+ xmlChar* tmpXmlChar = NULL;
if (pPushBody == NULL) {
MSG_DEBUG("pPushBody is NULL");
@@ -1528,8 +1541,8 @@ void SmsPluginWapPushHandler::handleSIMessage(char* pPushBody, int PushBodyLen,
pushMsg.expires = 0xFFFFFFFF;
/** setting received time */
- time_t t = time(NULL);
- time_t utfTime = time(&t);
+ time_t t = time(NULL);
+ time_t utfTime = time(&t);
pushMsg.received = (unsigned long)utfTime;
@@ -1621,9 +1634,8 @@ void SmsPluginWapPushHandler::handleSIMessage(char* pPushBody, int PushBodyLen,
/** Callback */
err = SmsPluginEventHandler::instance()->callbackMsgIncoming(&msgInfo);
- if (err != MSG_SUCCESS){
+ if (err != MSG_SUCCESS)
MSG_DEBUG("callbackMsgIncoming() Error !! [%d]", err);
- }
} else {
MSG_DEBUG("checkMessage() Error !! [%d]", err);
}
@@ -1649,31 +1661,31 @@ void SmsPluginWapPushHandler::handleSLMessage(char* pPushBody, int PushBodyLen,
msg_error_t err = MSG_SUCCESS;
if (pPushBody == NULL) {
- MSG_DEBUG("pPushBody is NULL \n" );
+ MSG_DEBUG("pPushBody is NULL \n");
return;
}
getXmlDoc(pPushBody, PushBodyLen, &xmlDoc, isText);
if (xmlDoc == NULL) {
- MSG_DEBUG("xmlDoc is NULL \n" );
+ MSG_DEBUG("xmlDoc is NULL \n");
return;
}
topNode = xmlDocGetRootElement(xmlDoc);
if (topNode == NULL) {
- MSG_DEBUG("Empty Document." );
+ MSG_DEBUG("Empty Document.");
xmlFreeDoc(xmlDoc);
return;
} else {
- MSG_SEC_DEBUG("Not an empty Document and topNode->name = %s \n",topNode->name );
+ MSG_SEC_DEBUG("Not an empty Document and topNode->name = %s \n",topNode->name);
}
indNode = topNode;
while (indNode != NULL) {
- if (!xmlStrcmp(indNode->name, (const xmlChar*) "sl")) {
+ if (!xmlStrcmp(indNode->name, (const xmlChar*)"sl")) {
MSG_SEC_DEBUG("indNode->name = %s\n",indNode->name);
break;
}
@@ -1682,8 +1694,8 @@ void SmsPluginWapPushHandler::handleSLMessage(char* pPushBody, int PushBodyLen,
}
/** setting received time setting */
- time_t t = time(NULL);
- time_t utfTime = time(&t);
+ time_t t = time(NULL);
+ time_t utfTime = time(&t);
pushMsg.received = (unsigned long)utfTime;
@@ -1781,20 +1793,20 @@ void SmsPluginWapPushHandler::handleCOMessage(char* pPushBody, int PushBodyLen,
MSG_DEBUG("Enter handleCOMessage");
if (pPushBody == NULL) {
- MSG_DEBUG("pPushBody is NULL \n" );
+ MSG_DEBUG("pPushBody is NULL \n");
return;
}
getXmlDoc(pPushBody, PushBodyLen, &xmlDoc, isText);
if (xmlDoc == NULL) {
- MSG_DEBUG("xmlDoc is NULL \n" );
+ MSG_DEBUG("xmlDoc is NULL \n");
return;
}
topNode = xmlDocGetRootElement(xmlDoc);
if (topNode == NULL) {
- MSG_DEBUG("Warning:Empty Document\n" );
+ MSG_DEBUG("Warning:Empty Document\n");
xmlFreeDoc(xmlDoc);
return;
}
@@ -1802,13 +1814,13 @@ void SmsPluginWapPushHandler::handleCOMessage(char* pPushBody, int PushBodyLen,
indNode = topNode->xmlChildrenNode;
- while(indNode != NULL) {
+ while (indNode != NULL) {
xmlChar* tmpUrl = NULL;
- if (!xmlStrcmp(indNode->name, (const xmlChar*) SMS_PUSH_XML_INVAL_OBJ)) {
+ if (!xmlStrcmp(indNode->name, (const xmlChar*)SMS_PUSH_XML_INVAL_OBJ)) {
MSG_SEC_DEBUG("indNode->name = %s\n", indNode->name);
- tmpUrl = xmlGetProp(indNode, (xmlChar*) SMS_PUSH_XML_CO_URI);
+ tmpUrl = xmlGetProp(indNode, (xmlChar*)SMS_PUSH_XML_CO_URI);
if (tmpUrl != NULL) {
strncpy(cacheOp.invalObjectUrl[cacheOp.invalObjectCnt++], (char*)tmpUrl, MAX_PUSH_CACHEOP_MAX_URL_LEN-1);
@@ -1817,7 +1829,7 @@ void SmsPluginWapPushHandler::handleCOMessage(char* pPushBody, int PushBodyLen,
} else {
MSG_DEBUG("NO href value from the xmlDoc\n");
}
- } else if (!xmlStrcmp(indNode->name, (const xmlChar*) SMS_PUSH_XML_INVAL_SVC)) {
+ } else if (!xmlStrcmp(indNode->name, (const xmlChar*)SMS_PUSH_XML_INVAL_SVC)) {
MSG_SEC_DEBUG("indNode->name = %s\n",indNode->name);
tmpUrl = xmlGetProp(indNode, (xmlChar*)SMS_PUSH_XML_CO_URI);
@@ -1876,9 +1888,8 @@ void SmsPluginWapPushHandler::handleCOMessage(char* pPushBody, int PushBodyLen,
/** Callback */
err = SmsPluginEventHandler::instance()->callbackMsgIncoming(&msgInfo);
- if (err != MSG_SUCCESS) {
+ if (err != MSG_SUCCESS)
MSG_DEBUG("callbackMsgIncoming() Error !! [%d]", err);
- }
} else {
MSG_DEBUG("checkMessage() Error !! [%d]", err);
}
@@ -2065,7 +2076,7 @@ unsigned long SmsPluginWapPushHandler::convertXmlCharToSec(char* pDate)
}
tmpBuf[i] = '\0';
index++;
- timeStruct.tm_year = (atoi( tmpBuf)-1900);
+ timeStruct.tm_year = (atoi(tmpBuf)-1900);
/** Month */
for (i = 0; i < 2; i++) {
@@ -2073,7 +2084,7 @@ unsigned long SmsPluginWapPushHandler::convertXmlCharToSec(char* pDate)
}
tmpBuf[i] = '\0';
index++;
- timeStruct.tm_mon = (atoi( tmpBuf) - 1);
+ timeStruct.tm_mon = (atoi(tmpBuf) - 1);
/** Date */
for (i = 0; i < 2; i++) {
@@ -2081,7 +2092,7 @@ unsigned long SmsPluginWapPushHandler::convertXmlCharToSec(char* pDate)
}
tmpBuf[i] = '\0';
index++;
- timeStruct.tm_mday = atoi( tmpBuf);
+ timeStruct.tm_mday = atoi(tmpBuf);
/** Hours */
for (i = 0; i < 2; i++) {
@@ -2089,7 +2100,7 @@ unsigned long SmsPluginWapPushHandler::convertXmlCharToSec(char* pDate)
}
tmpBuf[i] = '\0';
index++;
- timeStruct.tm_hour = atoi( tmpBuf);
+ timeStruct.tm_hour = atoi(tmpBuf);
/** Minites */
for (i = 0; i < 2; i++) {
@@ -2097,7 +2108,7 @@ unsigned long SmsPluginWapPushHandler::convertXmlCharToSec(char* pDate)
}
tmpBuf[i] = '\0';
index++;
- timeStruct.tm_min = atoi( tmpBuf);
+ timeStruct.tm_min = atoi(tmpBuf);
/** Seconds */
for (i = 0; i < 2; i++) {
@@ -2105,7 +2116,7 @@ unsigned long SmsPluginWapPushHandler::convertXmlCharToSec(char* pDate)
}
tmpBuf[i] = '\0';
index++;
- timeStruct.tm_sec = atoi( tmpBuf);
+ timeStruct.tm_sec = atoi(tmpBuf);
nTimeInSec = mktime(&timeStruct);
@@ -2122,27 +2133,27 @@ msg_push_action_t SmsPluginWapPushHandler::convertSIActionStrToEnum(char* pActio
}
/** compare with signal-none. */
- comp = g_strcmp0( "signal-none", pAction );
+ comp = g_strcmp0("signal-none", pAction);
if (comp == 0)
return MSG_PUSH_SI_ACTION_SIGNAL_NONE;
/** compare with signal-low. */
- comp = g_strcmp0( "signal-low", pAction );
+ comp = g_strcmp0("signal-low", pAction);
if (comp == 0)
return MSG_PUSH_SI_ACTION_SIGNAL_LOW;
/** compare with signal-medium. */
- comp = g_strcmp0( "signal-medium", pAction );
+ comp = g_strcmp0("signal-medium", pAction);
if (comp == 0)
return MSG_PUSH_SI_ACTION_SIGNAL_MEDIUM;
/** compare with signal-high. */
- comp = g_strcmp0( "signal-high", pAction );
+ comp = g_strcmp0("signal-high", pAction);
if (comp == 0)
return MSG_PUSH_SI_ACTION_SIGNAL_HIGH;
/** compare with delete. */
- comp = g_strcmp0( "delete", pAction );
+ comp = g_strcmp0("delete", pAction);
if (comp == 0)
return MSG_PUSH_SI_ACTION_DELETE;
@@ -2156,22 +2167,22 @@ msg_push_action_t SmsPluginWapPushHandler::convertSLActionStrToEnum(char* pActio
int comp = 0;
if (pAction == NULL) {
- MSG_DEBUG( "MSG_DEBUG is NULL. Setting to default action type.\n" );
+ MSG_DEBUG("MSG_DEBUG is NULL. Setting to default action type.\n");
return MSG_PUSH_SL_ACTION_EXECUTE_LOW;
}
/** compare pSrcStr with execute-low. */
- comp = g_strcmp0( "execute-low", pAction );
+ comp = g_strcmp0("execute-low", pAction);
if (comp == 0)
return MSG_PUSH_SL_ACTION_EXECUTE_LOW;
/** compare pSrcStr with execute-high. */
- comp = g_strcmp0( "execute-high", pAction );
+ comp = g_strcmp0("execute-high", pAction);
if (comp == 0)
return MSG_PUSH_SL_ACTION_EXECUTE_HIGH;
/** compare pSrcStr with cache. */
- comp = g_strcmp0( "cache", pAction );
+ comp = g_strcmp0("cache", pAction);
if (comp == 0)
return MSG_PUSH_SL_ACTION_CACHE;
@@ -2181,37 +2192,38 @@ msg_push_action_t SmsPluginWapPushHandler::convertSLActionStrToEnum(char* pActio
}
-unsigned long SmsPluginWapPushHandler::wspRetriveUintvarDecode( unsigned char* sourceData, unsigned long* currentPointer )
+unsigned long SmsPluginWapPushHandler::wspRetriveUintvarDecode(unsigned char* sourceData, unsigned long* currentPointer)
{
unsigned long i = 0;
unsigned long decodedValue;
- while (sourceData[*currentPointer +i] >= 0x80) i++;
+ while (sourceData[*currentPointer + i] >= 0x80)
+ i++;
- decodedValue = wspDecodeUintvar( i+1, sourceData + *currentPointer );
+ decodedValue = wspDecodeUintvar(i + 1, sourceData + *currentPointer);
*currentPointer = *currentPointer + i + 1;
- MSG_DEBUG("wspRetriveUintvarDecode: decodedValue=%d .\n",decodedValue );
+ MSG_DEBUG("wspRetriveUintvarDecode: decodedValue=%d .\n",decodedValue);
return decodedValue;
}
-unsigned long SmsPluginWapPushHandler::wspDecodeUintvar(unsigned long length, unsigned char* userVar )
+unsigned long SmsPluginWapPushHandler::wspDecodeUintvar(unsigned long length, unsigned char* userVar)
{
unsigned long i;
unsigned long decodedUintvar = 0;
for (i = 0 ; i < length; i++) {
- decodedUintvar = decodedUintvar + ( wspUintvarDecodeTable[i] * (userVar[length-(i+1)] & 0x7f ));
+ decodedUintvar = decodedUintvar + (wspUintvarDecodeTable[i] * (userVar[length-(i+1)] & 0x7f));
}
return decodedUintvar;
}
-void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, unsigned long encodedHeaderLen, unsigned long contentsLength, bool fContentType, char** pHeader)
+void SmsPluginWapPushHandler::wspDecodeHeader(unsigned char* sEncodedHeader, unsigned long encodedHeaderLen, unsigned long contentsLength, bool fContentType, char** pHeader)
{
- unsigned long iField;
+ unsigned long iField = 0;
bool continueField = FALSE;
unsigned long currentLength;
@@ -2230,57 +2242,57 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un
/* outTemper is Decoded Headers.
temper is Single Decoded Header.
*/
- if (NULL == ( outTemper = new char[ WSP_STANDARD_STR_LEN_MAX * 5 ])) {
- MSG_DEBUG("outTemper Memory allocation is failed.\n" );
+ if (NULL == (outTemper = new char[ WSP_STANDARD_STR_LEN_MAX * 5 ])) {
+ MSG_DEBUG("outTemper Memory allocation is failed.\n");
return;
}
memset(outTemper, 0, (WSP_STANDARD_STR_LEN_MAX * 5));
currentLength = WSP_STANDARD_STR_LEN_MAX;
- MSG_DEBUG("wspDecodeHeader: Message header decoding started.\n" );
+ MSG_DEBUG("wspDecodeHeader: Message header decoding started.\n");
int loop;
char szBuf[64];
szBuf[0] = 0x00;
- MSG_DEBUG("wspDecodeHeader: RAW data \n" );
+ MSG_DEBUG("wspDecodeHeader: RAW data \n");
for (loop = 0 ; loop<(int)encodedHeaderLen; loop++) {
char szTempBuf[5];
szTempBuf[0] = 0x00;
- snprintf( szTempBuf, sizeof(szTempBuf), "%2X ", sEncodedHeader[loop] );
+ snprintf(szTempBuf, sizeof(szTempBuf), "%2X ", sEncodedHeader[loop]);
- if (AcStrlen( szBuf ) + 7 < 64) {
- strncat( szBuf, szTempBuf, sizeof(szBuf)-AcStrlen(szBuf)-1 );
+ if (AcStrlen(szBuf) + 7 < 64) {
+ strncat(szBuf, szTempBuf, sizeof(szBuf)-AcStrlen(szBuf)-1);
} else {
- strncat( szBuf, "\n", sizeof(szBuf)-AcStrlen(szBuf)-1 );
+ strncat(szBuf, "\n", sizeof(szBuf)-AcStrlen(szBuf)-1);
MSG_DEBUG("[%s]", szBuf);
szBuf[0] = 0x00;
- strncat( szBuf, szTempBuf, sizeof(szBuf)-AcStrlen(szBuf)-1 );
+ strncat(szBuf, szTempBuf, sizeof(szBuf)-AcStrlen(szBuf)-1);
}
}
- strncat( szBuf, "\n", sizeof(szBuf)-AcStrlen(szBuf)-1 );
+ strncat(szBuf, "\n", sizeof(szBuf)-AcStrlen(szBuf)-1);
MSG_DEBUG("[%s]", szBuf);
- MSG_DEBUG("fContentType=%d \n",fContentType );
+ MSG_DEBUG("fContentType=%d \n",fContentType);
/* operation for content-type */
/* makes psuedo- content-type fieldcode */
/* content - type is processed with header. But it's come without field code. So existence of fContentType can decide adding content type header field code whether ContentType + general header is or not. */
if (fContentType) {
encodedHeader = new char[ encodedHeaderLen + 1 ];
- if (encodedHeader == NULL) {
- MSG_DEBUG("encodedHeader Memory allocation is failed.\n" );
+ if (encodedHeader == NULL) {
+ MSG_DEBUG("encodedHeader Memory allocation is failed.\n");
return;
}
encodedHeader[0] = 0x91;
- memcpy( encodedHeader + 1, sEncodedHeader, (size_t)encodedHeaderLen );
+ memcpy(encodedHeader + 1, sEncodedHeader, (size_t)encodedHeaderLen);
} else {
encodedHeader = new char[ encodedHeaderLen ];
- if (encodedHeader == NULL) {
- MSG_DEBUG("encodedHeader Memory allocation is failed.\n" );
+ if (encodedHeader == NULL) {
+ MSG_DEBUG("encodedHeader Memory allocation is failed.\n");
return;
}
- memcpy( encodedHeader, sEncodedHeader, (size_t)encodedHeaderLen );
+ memcpy(encodedHeader, sEncodedHeader, (size_t)encodedHeaderLen);
}
/* Is it reacehd end of header? */
@@ -2290,7 +2302,7 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un
temper = new char[ WSP_STANDARD_STR_LEN_MAX * 5 ];
if (temper == NULL) {
- MSG_DEBUG("temper Memory allocation is failed.\n" );
+ MSG_DEBUG("temper Memory allocation is failed.\n");
return;
}
memset(temper, 0x00, (WSP_STANDARD_STR_LEN_MAX * 5));
@@ -2300,712 +2312,715 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un
/* this section presents header code page shifting procedure
This part can be implemented by future request.
- if (track == 0x 7f )
+ if (track == 0x 7f)
*/
track = encodedHeader[iEncodedHeader];
if (track == 0x00) {
- MSG_DEBUG("WspLDecodeHeader: fieldcode is 0 \n" );
+ MSG_DEBUG("WspLDecodeHeader: fieldcode is 0 \n");
strncpy((char*) temper, (char*)"", (WSP_STANDARD_STR_LEN_MAX * 5)-1);
fieldCode = 0xff;
iEncodedHeader++;
- } else if (( track > 0 ) && ( track < 0x20 )) {
+ } else if ((track > 0) && (track < 0x20)) {
iEncodedHeader++;
- } else if (( track < 0x7f ) && ( track > 0x1f )) { /* In this case, first byte is normal string. So it's considered to unknown header. */
+ } else if ((track < 0x7f) && (track > 0x1f)) { /* In this case, first byte is normal string. So it's considered to unknown header. */
unsigned char* fieldName = (unsigned char*)gWapCodeBufferLeft;
unsigned char* fieldValue = (unsigned char*)gWapCodeBufferRight;
- strncpy( (char*)fieldName, (char*)(encodedHeader + iEncodedHeader ),WSP_CODE_BUFFER_LEFT_LEN_MAX-1);
+ strncpy((char*)fieldName, (char*)(encodedHeader + iEncodedHeader),WSP_CODE_BUFFER_LEFT_LEN_MAX-1);
fieldName[WSP_CODE_BUFFER_LEFT_LEN_MAX-1] = '\0';
- iEncodedHeader = iEncodedHeader + AcStrlen( (char*)fieldName ) + 1;
- strncpy( (char*)fieldValue, (char*)(encodedHeader + iEncodedHeader ), WSP_CODE_BUFFER_RIGHT_LEN_MAX-1);
+ iEncodedHeader = iEncodedHeader + AcStrlen((char*)fieldName) + 1;
+ strncpy((char*)fieldValue, (char*)(encodedHeader + iEncodedHeader), WSP_CODE_BUFFER_RIGHT_LEN_MAX-1);
fieldValue[WSP_CODE_BUFFER_RIGHT_LEN_MAX-1] = '\0';
- iEncodedHeader = iEncodedHeader + AcStrlen( (char*)fieldValue ) + 1;
+ iEncodedHeader = iEncodedHeader + AcStrlen((char*)fieldValue) + 1;
- strncat((char*)temper, (char*)fieldName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
- strncat((char*)temper, ": ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
- strncat((char*)temper, (char*)fieldValue, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+ strncat((char*)temper, (char*)fieldName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
+ strncat((char*)temper, ": ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
+ strncat((char*)temper, (char*)fieldValue, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
/* this means 'don't process anymore.' */
fieldCode = 0xff;
} else if (track > 0x7f) {
/* In case of first byte is field code, else case is error. */
- /*if (( track & 0x7f ) <= wspHeaderFieldCount ) */
+ /*if ((track & 0x7f) <= wspHeaderFieldCount) */
{
unsigned long fieldValueLen = encodedHeader[iEncodedHeader + 1];
unsigned char fieldValue[1275];
fieldCode = track & 0x7f;
/*
- if (( fieldValueLen == 0 ) || ( fieldValueLen == 0x80 ))
+ if ((fieldValueLen == 0) || (fieldValueLen == 0x80))
{
- dprint( DNET_WAP,DNET_DBG_HIGH, "%X %X %X %X %X %X\n" , fieldCode, encodedHeader[iEncodedHeader + 1], encodedHeader[iEncodedHeader + 2],encodedHeader[iEncodedHeader + 3],encodedHeader[iEncodedHeader + 4], encodedHeader[iEncodedHeader + 5] );
+ dprint(DNET_WAP,DNET_DBG_HIGH, "%X %X %X %X %X %X\n" , fieldCode, encodedHeader[iEncodedHeader + 1], encodedHeader[iEncodedHeader + 2],encodedHeader[iEncodedHeader + 3],encodedHeader[iEncodedHeader + 4], encodedHeader[iEncodedHeader + 5]);
}
*/
memset(fieldValue, 0, 1275);
- {
- /* add field name */
- /* This continueField flag show whether previous field code and current field code are same or not. If it's same, there are some sequential display effect by omitting field name addition process. The reason why it should be do that can be found in encoding example of spec. */
- if (!continueField) {
- strncat( (char*)temper, (char*)wspHeaderFieldName[fieldCode], (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
- strncat( (char*)temper, ": ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
- continueField = FALSE;
- }
+ /* add field name */
+ /* This continueField flag show whether previous field code and current field code are same or not. If it's same, there are some sequential display effect by omitting field name addition process. The reason why it should be do that can be found in encoding example of spec. */
+ if (!continueField) {
+ strncat((char*)temper, (char*)wspHeaderFieldName[fieldCode], (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
+ strncat((char*)temper, ": ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
+ continueField = FALSE;
+ }
- /* field value is string */
- /* In this case, it just copy field value. */
- if (( fieldValueLen > LENGTH_QUOTE ) && ( fieldValueLen < 0x80 )) {
+ /* field value is string */
+ /* In this case, it just copy field value. */
+ if ((fieldValueLen > LENGTH_QUOTE) && (fieldValueLen < 0x80)) {
- /* string field value should be NULL terminated */
- strncat( (char*)temper, (char*)(encodedHeader + iEncodedHeader + 1 ), (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
- strncat( (char*)temper, (char*)fieldValue, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+ /* string field value should be NULL terminated */
+ strncat((char*)temper, (char*)(encodedHeader + iEncodedHeader + 1), (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
+ strncat((char*)temper, (char*)fieldValue, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
- iEncodedHeader = iEncodedHeader + AcStrlen( (char*)encodedHeader + iEncodedHeader + 1 ) + 2;
- fieldCode = 0xff;
- }
- /* first field value is length */
- /* If first byte of field value is length value, allocate field value by the length.
- In field value, data is
- 1D 03 8F 24 24 - Then 8F 24 24 is field value.
- 1D 1F 33.... - Then allocate 33H for FieldValue.
- 1D 8F - Then 8F
- 1D 'Hi man!' Like 00, if string is come, then process without calculating field value.
- 1D 8F 24 24 - In this case, original data is wrong.
- If accept-charset: ISO-10646-ucs-2;Q=0.7 is
- 01 03 03 E8 47
- 01 - field code
- 03 - field value length
- 03 E8 47 - field value
- it's decoded by above value.
- */
- if (fieldValueLen < 0x20) {
-
- if (fieldValueLen == LENGTH_QUOTE) {
-
- /* field length is encoded in UINTVAR */
- unsigned long uintvarLen = 0;
- fieldValueLen = wspRetriveUintvarDecode((unsigned char*) encodedHeader + iEncodedHeader + 2, &uintvarLen );
- memcpy( fieldValue, encodedHeader + iEncodedHeader + 2 + uintvarLen, (size_t)fieldValueLen );
- iEncodedHeader = iEncodedHeader + fieldValueLen + uintvarLen + 2;
+ iEncodedHeader = iEncodedHeader + AcStrlen((char*)encodedHeader + iEncodedHeader + 1) + 2;
+ fieldCode = 0xff;
+ }
+ /* first field value is length */
+ /* If first byte of field value is length value, allocate field value by the length.
+ In field value, data is
+ 1D 03 8F 24 24 - Then 8F 24 24 is field value.
+ 1D 1F 33.... - Then allocate 33H for FieldValue.
+ 1D 8F - Then 8F
+ 1D 'Hi man!' Like 00, if string is come, then process without calculating field value.
+ 1D 8F 24 24 - In this case, original data is wrong.
+ If accept-charset: ISO-10646-ucs-2;Q=0.7 is
+ 01 03 03 E8 47
+ 01 - field code
+ 03 - field value length
+ 03 E8 47 - field value
+ it's decoded by above value.
+ */
+ if (fieldValueLen < 0x20) {
- } else {
+ if (fieldValueLen == LENGTH_QUOTE) {
- if (fieldValueLen == 1) {
- /* field value is one byte integer over 0x80 */
- /** make it two byte integer */
- fieldValue[0] = 0x00;
- memcpy( fieldValue + 1, encodedHeader + iEncodedHeader + 2, (size_t)fieldValueLen);
- fieldValueLen = 2;
- iEncodedHeader = iEncodedHeader + 1 + 2;
- } else {
- memcpy( fieldValue, encodedHeader + iEncodedHeader + 2, (size_t)fieldValueLen );
- fieldValue[fieldValueLen] = 0;
- iEncodedHeader = iEncodedHeader + fieldValueLen + 2;
- if (( fieldValueLen == 0 ) || ( fieldValueLen == 0x80 )) {
- MSG_DEBUG("%X \n", encodedHeader[iEncodedHeader] );
- }
+ /* field length is encoded in UINTVAR */
+ unsigned long uintvarLen = 0;
+ fieldValueLen = wspRetriveUintvarDecode((unsigned char*) encodedHeader + iEncodedHeader + 2, &uintvarLen);
+ memcpy(fieldValue, encodedHeader + iEncodedHeader + 2 + uintvarLen, (size_t)fieldValueLen);
+ iEncodedHeader = iEncodedHeader + fieldValueLen + uintvarLen + 2;
+
+ } else {
+
+ if (fieldValueLen == 1) {
+ /* field value is one byte integer over 0x80 */
+ /** make it two byte integer */
+ fieldValue[0] = 0x00;
+ memcpy(fieldValue + 1, encodedHeader + iEncodedHeader + 2, (size_t)fieldValueLen);
+ fieldValueLen = 2;
+ iEncodedHeader = iEncodedHeader + 1 + 2;
+ } else {
+ memcpy(fieldValue, encodedHeader + iEncodedHeader + 2, (size_t)fieldValueLen);
+ fieldValue[fieldValueLen] = 0;
+ iEncodedHeader = iEncodedHeader + fieldValueLen + 2;
+ if ((fieldValueLen == 0) || (fieldValueLen == 0x80)) {
+ MSG_DEBUG("%X \n", encodedHeader[iEncodedHeader]);
}
}
}
- /* field value is single encoded */
- if (fieldValueLen > 0x7f) {
- fieldValue[0] = encodedHeader[iEncodedHeader + 1];
- fieldValueLen = 1;
- iEncodedHeader = iEncodedHeader + 2;
- }
- /* processing normal pre-defined field decoding */
+ }
+ /* field value is single encoded */
+ if (fieldValueLen > 0x7f) {
+ fieldValue[0] = encodedHeader[iEncodedHeader + 1];
+ fieldValueLen = 1;
+ iEncodedHeader = iEncodedHeader + 2;
+ }
+ /* processing normal pre-defined field decoding */
- MSG_DEBUG("WspLDecodeHeader: FieldCode %X\n", fieldCode );
- MSG_DEBUG("WspLDecodeHeader: fieldSize %d\n", fieldValueLen );
+ MSG_DEBUG("WspLDecodeHeader: FieldCode %X\n", fieldCode);
+ MSG_DEBUG("WspLDecodeHeader: fieldSize %d\n", fieldValueLen);
- if (( fieldCode > wspHeaderFieldCount ) && ( fieldCode != 0xff )) {
- MSG_DEBUG("WspLDecodeHeader: unknown fieldcode %X \n", track );
- strncpy((char*) temper, (char*)"", (WSP_STANDARD_STR_LEN_MAX * 5)-1);
- fieldCode = 0xff;
- }
+ if ((fieldCode > wspHeaderFieldCount) && (fieldCode != 0xff)) {
+ MSG_DEBUG("WspLDecodeHeader: unknown fieldcode %X \n", track);
+ strncpy((char*) temper, (char*)"", (WSP_STANDARD_STR_LEN_MAX * 5)-1);
+ fieldCode = 0xff;
+ }
- switch ( fieldCode )
- {
- /* accept charset */
- /* It's normal way of field process. */
- case 0x01 :
- {
- unsigned long i = 0;
- unsigned long code;
-
- /* Case of length of charset greater than 1 are two thigins.
- 1. code length of charset is greater than 1.
- 2. It include parameter.
- 3. Or both of two
- */
- if (1 != fieldValueLen) {
- code = wspHeaderDecodeInteger( fieldValue );
- /* Calculate iField. */
- if (fieldValue[0] < 0x80 )
- iField = fieldValue[0];
- else
- iField = 1;
-
- while ( wspCharset[i].charsetCode != code )
- i++;
- strncat( (char*)temper, (char*)wspCharset[i].charsetName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
- /* If parameter exist */
- if (iField < fieldValueLen) {
- char* param = NULL;
- unique_ptr<char*, void(*)(char**)> parambuf(&param, unique_ptr_deleter);
- wspHeaderDecodeQValue( fieldValueLen - iField, fieldValue + iField, &param);
- strncat( (char*)temper, (char*)param, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
- }
- } else {
- code = fieldValue[0] & 0x7f;
+ switch (fieldCode) {
+ /* accept charset */
+ /* It's normal way of field process. */
+ case 0x01 :
+ {
+ unsigned long i = 0;
+ unsigned long code;
+
+ /* Case of length of charset greater than 1 are two thigins.
+ 1. code length of charset is greater than 1.
+ 2. It include parameter.
+ 3. Or both of two
+ */
+ if (1 != fieldValueLen) {
+ code = wspHeaderDecodeInteger(fieldValue);
+ /* Calculate iField. */
+ if (fieldValue[0] < 0x80)
+ iField = fieldValue[0];
+ else
+ iField = 1;
- while (( wspCharset[i].charsetCode != code ) && ( wspCharset[i].charsetCode != 0xffff )) i++;
- strncat( (char*)temper, (char*)wspCharset[i].charsetName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+ while (wspCharset[i].charsetCode != code)
+ i++;
+ strncat((char*)temper, (char*)wspCharset[i].charsetName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
+ /* If parameter exist */
+ if (iField < fieldValueLen) {
+ char* param = NULL;
+ unique_ptr<char*, void(*)(char**)> parambuf(&param, unique_ptr_deleter);
+ wspHeaderDecodeQValue(fieldValueLen - iField, fieldValue + iField, &param);
+ strncat((char*)temper, (char*)param, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
}
+ } else {
+ code = fieldValue[0] & 0x7f;
+ while ((wspCharset[i].charsetCode != code) && (wspCharset[i].charsetCode != 0xffff )) i++;
+ strncat((char*)temper, (char*)wspCharset[i].charsetName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
}
- break;
- /* type encoding */
- /* Like below routine, Same decoding routine process together. */
- /* Accept-encoding */
- case 0x02 :
- /* content-encoding */
- case 0x0b :
- {
- int integerValue;
-
- integerValue = wspHeaderDecodeIntegerByLength(fieldValue, fieldValueLen );
- if (integerValue > 2) {
- MSG_DEBUG("WspLDecodeHeader: integerValue is over limit(2).\n");
- break;
- }
- strncat( (char*)temper, (char*)wspEncodeMethod[integerValue], (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
+ }
+ break;
+
+ /* type encoding */
+ /* Like below routine, Same decoding routine process together. */
+ /* Accept-encoding */
+ case 0x02 :
+ /* content-encoding */
+ case 0x0b :
+ {
+ int integerValue;
+
+ integerValue = wspHeaderDecodeIntegerByLength(fieldValue, fieldValueLen);
+ if (integerValue > 2) {
+ MSG_DEBUG("WspLDecodeHeader: integerValue is over limit(2).\n");
+ break;
+ }
+ strncat((char*)temper, (char*)wspEncodeMethod[integerValue], (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
+ }
+ break;
+ /* contents type decoder */
+ /* accept */
+ case 0x00 :
+ /* content-type */
+ case 0x11 :
+ {
+ unsigned long contentsTypeCode;
+ unsigned long i = 0;
+ /* encoded content type length body */
+ unsigned long tempLen;
+ MSG_DEBUG("fieldValueLen: %d", fieldValueLen);
+
+ /* Like HTTP result state 304, it's for processing without Content type. This part doesn't defined. */
+ if (0 == fieldValueLen) {
+ strncat((char*)temper, (char*)"None" , (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
+ break;
+ }
+ /* 01 AE --> 00 AE --> AE*/
+ if (fieldValueLen == 2 && fieldValue[0] == 0) {
+ memcpy(fieldValue, encodedHeader + iEncodedHeader -1, (size_t)fieldValueLen-1);
+ MSG_DEBUG("WspLDecodeHeader:For mmO2 problem\r\n");
}
- break;
- /* contents type decoder */
- /* accept */
- case 0x00 :
- /* content-type */
- case 0x11 :
- {
- unsigned long contentsTypeCode;
- unsigned long i = 0;
- /* encoded content type length body */
- unsigned long tempLen;
- MSG_DEBUG("fieldValueLen: %d", fieldValueLen);
-
- /* Like HTTP result state 304, it's for processing without Content type. This part doesn't defined. */
- if (0 == fieldValueLen) {
- strncat( (char*)temper, (char*)"None" , (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
- break;
- }
- /* 01 AE --> 00 AE --> AE*/
- if (fieldValueLen == 2 && fieldValue[0] == 0) {
- memcpy( fieldValue, encodedHeader + iEncodedHeader -1, (size_t)fieldValueLen-1 );
- MSG_DEBUG("WspLDecodeHeader:For mmO2 problem\r\n" );
- }
-
- if ((fieldValue[0] < 0x20 ) || (fieldValue[0] >= 0x80 )) {
- if (fieldValue[0] >= 0x80) {
- tempLen = 1;
- } else if (fieldValueLen == 2 && fieldValue[0] == 0x03 && fieldValue[1] == 0x0A) { /** 06 05 02 03 0A AF 89 */
- fieldValue[3] = fieldValue[2];
- fieldValue[2] = fieldValue[1];
- fieldValue[1] = fieldValue[0];
- fieldValue[0] = 0x02;
- tempLen = 2;
- fieldValueLen = 3;
- MSG_DEBUG("WspLDecodeHeader:For CPE problem\r\n" );
- } else {
- tempLen = fieldValue[0]; /** 06 06 03 02 03 16 AF 88 */
- }
-
- if (tempLen == 1) {
-
- char* szExtendedContent;
- contentsTypeCode = fieldValue[0] & 0x7f;
- while (( wspContentsType[i].contentsTypeCode != contentsTypeCode ) && ( i < wspContentsTypeCount )) i++;
+ if ((fieldValue[0] < 0x20) || (fieldValue[0] >= 0x80)) {
+ if (fieldValue[0] >= 0x80) {
+ tempLen = 1;
+ } else if (fieldValueLen == 2 && fieldValue[0] == 0x03 && fieldValue[1] == 0x0A) { /** 06 05 02 03 0A AF 89 */
+ fieldValue[3] = fieldValue[2];
+ fieldValue[2] = fieldValue[1];
+ fieldValue[1] = fieldValue[0];
+ fieldValue[0] = 0x02;
+ tempLen = 2;
+ fieldValueLen = 3;
+ MSG_DEBUG("WspLDecodeHeader:For CPE problem\r\n");
+ } else {
+ tempLen = fieldValue[0]; /** 06 06 03 02 03 16 AF 88 */
+ }
- /* If specified content type doesn't exist */
- if (i < wspContentsTypeCount)
- strncat( (char*)temper, (char*)wspContentsType[i].contentsTypeName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+ if (tempLen == 1) {
- szExtendedContent = wspExtendedDecodeType( (char)contentsTypeCode );
+ char* szExtendedContent;
- if (szExtendedContent != NULL) {
- MSG_DEBUG("WspLDecodeHeader: Tele2 server problem \n " );
- strncat( (char*)temper, (char*)szExtendedContent, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
- }
- } else {
- contentsTypeCode = wspHeaderDecodeInteger(fieldValue);
+ contentsTypeCode = fieldValue[0] & 0x7f;
+ while ((wspContentsType[i].contentsTypeCode != contentsTypeCode) && (i < wspContentsTypeCount)) i++;
- while ((i < wspUnregisteredContentsTypeCount) && (wspUnregisterContentsType[i].contentsTypeCode != contentsTypeCode)) i++;
+ /* If specified content type doesn't exist */
+ if (i < wspContentsTypeCount)
+ strncat((char*)temper, (char*)wspContentsType[i].contentsTypeName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
- /** If there is a Content-Type assigned, */
- if (i < wspUnregisteredContentsTypeCount)
- strncat ((char*)temper, (char*)wspUnregisterContentsType[i].contentsTypeName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
+ szExtendedContent = wspExtendedDecodeType((char)contentsTypeCode);
- tempLen +=1;
+ if (szExtendedContent != NULL) {
+ MSG_DEBUG("WspLDecodeHeader: Tele2 server problem \n ");
+ strncat((char*)temper, (char*)szExtendedContent, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
}
} else {
- tempLen = AcStrlen( (char*)fieldValue ) + 1;
+ contentsTypeCode = wspHeaderDecodeInteger(fieldValue);
- strncat ((char*)temper, (char*)fieldValue, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
- MSG_DEBUG("WspLDecodeHeader: Attention, Decoding Check of Content-Type\n ", tempLen);
- }
+ while ((i < wspUnregisteredContentsTypeCount) && (wspUnregisterContentsType[i].contentsTypeCode != contentsTypeCode)) i++;
- /* If there is a parameter */
- if (tempLen < fieldValueLen) {
- char* param = NULL;
- unique_ptr<char*, void(*)(char**)> parambuf(&param, unique_ptr_deleter);
- wspHeaderDecodeParameter( fieldValue + tempLen, fieldValueLen - tempLen, &param);
- if (param != NULL) {
- strncat( (char*)temper, "; ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
- strncat( (char*)temper, (char*)param, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
- }
+ /** If there is a Content-Type assigned, */
+ if (i < wspUnregisteredContentsTypeCount)
+ strncat ((char*)temper, (char*)wspUnregisterContentsType[i].contentsTypeName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
+
+ tempLen +=1;
}
+ } else {
+ tempLen = AcStrlen((char*)fieldValue) + 1;
+
+ strncat ((char*)temper, (char*)fieldValue, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
+ MSG_DEBUG("WspLDecodeHeader: Attention, Decoding Check of Content-Type\n ", tempLen);
}
- break;
- /* language */
- /* content-language */
- case 0x0c :
- /* accept-language */
- case 0x03 :
- {
- unsigned long i = 0;
- unsigned long code;
- unsigned long tempLen;
- if ((fieldValue[0] < 0x20 ) || (fieldValue[0] > 0x80 )) {
- if (fieldValue[0] > 0x80 )
- tempLen = 1;
- else
- tempLen = fieldValue[0];
- } else {
- tempLen = AcStrlen( (char*)fieldValue ) + 1;
+ /* If there is a parameter */
+ if (tempLen < fieldValueLen) {
+ char* param = NULL;
+ unique_ptr<char*, void(*)(char**)> parambuf(&param, unique_ptr_deleter);
+ wspHeaderDecodeParameter(fieldValue + tempLen, fieldValueLen - tempLen, &param);
+ if (param != NULL) {
+ strncat((char*)temper, "; ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
+ strncat((char*)temper, (char*)param, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
}
+ }
+ }
+ break;
+
+ /* language */
+ /* content-language */
+ case 0x0c :
+ /* accept-language */
+ case 0x03 :
+ {
+ unsigned long i = 0;
+ unsigned long code;
+ unsigned long tempLen;
+ if ((fieldValue[0] < 0x20) || (fieldValue[0] > 0x80)) {
+ if (fieldValue[0] > 0x80)
+ tempLen = 1;
+ else
+ tempLen = fieldValue[0];
+ } else {
+ tempLen = AcStrlen((char*)fieldValue) + 1;
+ }
- if (tempLen == 1) {
-
- code = wspHeaderDecodeInteger( fieldValue );
- while ( wspLanguage[i].languageCode != code) {
- i++;
- if (i == wspLanguageCount)
- break;
- }
+ if (tempLen == 1) {
- if (i < wspLanguageCount) {
- strncat( (char*)temper, (char*)wspLanguage[i].languageName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
- }
- } else {
- strncat( (char*)temper, (char*)fieldValue, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
+ code = wspHeaderDecodeInteger(fieldValue);
+ while (wspLanguage[i].languageCode != code) {
+ i++;
+ if (i == wspLanguageCount)
+ break;
}
- if (tempLen < fieldValueLen) {
- char* param = NULL;
- unique_ptr<char*, void(*)(char**)> parambuf(&param, unique_ptr_deleter);
- wspHeaderDecodeQValue( fieldValueLen - tempLen, fieldValue + tempLen, &param );
- strncat( (char*)temper, (char*)param, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+ if (i < wspLanguageCount) {
+ strncat((char*)temper, (char*)wspLanguage[i].languageName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
}
+ } else {
+ strncat((char*)temper, (char*)fieldValue, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
}
- break;
- /* integer */
- /* Max-forwards */
- case 0x1e :
- /* content-length */
- case 0x0d :
- /* age */
- case 0x05 :
- /* Bearer-indication */
- case 0x33 :
- /* Push-Flag */
- case 0x34 :
- {
-
- unsigned char temp[16];
- /*
- if (( fieldValueLen == 2 ) && ( fieldValue[0] > 0x7f ))
- AcSprintf( (char*)temp, "%u", (unsigned int)fieldValue[1]);
- else
- */
- snprintf( (char*)temp, sizeof(temp), "%u", (unsigned int)wspHeaderDecodeIntegerByLength( fieldValue, fieldValueLen ));
- strncat( (char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+ if (tempLen < fieldValueLen) {
+ char* param = NULL;
+ unique_ptr<char*, void(*)(char**)> parambuf(&param, unique_ptr_deleter);
+ wspHeaderDecodeQValue( fieldValueLen - tempLen, fieldValue + tempLen, &param);
+ strncat((char*)temper, (char*)param, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
}
- break;
- /* X-Wap-Application-Id */
- case 0x2f :
- {
- unsigned char temp[64];
- int integerValue;
-
+ }
+ break;
+
+ /* integer */
+ /* Max-forwards */
+ case 0x1e :
+ /* content-length */
+ case 0x0d :
+ /* age */
+ case 0x05 :
+ /* Bearer-indication */
+ case 0x33 :
+ /* Push-Flag */
+ case 0x34 :
+ {
+
+ unsigned char temp[16];
+ /*
+ if ((fieldValueLen == 2) && (fieldValue[0] > 0x7f))
+ AcSprintf((char*)temp, "%u", (unsigned int)fieldValue[1]);
+ else
+ */
+ snprintf((char*)temp, sizeof(temp), "%u", (unsigned int)wspHeaderDecodeIntegerByLength(fieldValue, fieldValueLen));
+ strncat((char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
+ }
+ break;
+ /* X-Wap-Application-Id */
+ case 0x2f :
+ {
+ unsigned char temp[64];
+ int integerValue;
+
+ if (track == 0xaf) { /* WAP short-integer-encoded */
if (fieldValueLen == 2 && fieldValue[0] == 0) {
- memcpy( fieldValue, encodedHeader + iEncodedHeader -1, (size_t)fieldValueLen-1 );
- MSG_DEBUG("WspLDecodeHeader:For mmO2 problem\r\n" );
- fieldValueLen = 1;
+ memcpy(fieldValue, encodedHeader + iEncodedHeader -1, (size_t)fieldValueLen);
}
-
integerValue = wspHeaderDecodeIntegerByLength(fieldValue, fieldValueLen);
-
- int count = sizeof(wspHeaderApplId)/sizeof(SMS_WSP_HEADER_PARAMETER_S);
- for(int i = 0; i < count ; ++i)
- {
- if ((unsigned int)integerValue == wspHeaderApplId[i].parameterCode)
- {
- snprintf((char*)temp, 64, "%s", wspHeaderApplId[i].parameterToken);
- strncat((char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1);
- break;
- }
- }
- }
- break;
- /* Accept-Application */
- case 0x32 :
- if (0x80 == fieldValue[0]) {
- strncat( (char*)temper, "*", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1 );
} else {
-
- unsigned char temp[16];
- /*
- if (( fieldValueLen == 2 ) && ( fieldValue[0] == 1 ))
- AcSprintf( (char*)temp, "%u", (unsigned int)fieldValue[0]);
- else
- */
- snprintf( (char*)temp, sizeof(temp), "%u", (unsigned int)wspHeaderDecodeIntegerByLength( fieldValue, fieldValueLen ));
- strncat( (char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1);
+ if (fieldValueLen == 2 && fieldValue[0] == 0) {
+ memcpy(fieldValue, encodedHeader + iEncodedHeader -1, (size_t)fieldValueLen-1);
+ MSG_DEBUG("WspLDecodeHeader:For mmO2 problem\r\n");
+ fieldValueLen = 1;
+ }
+ integerValue = wspHeaderDecodeIntegerByLength(fieldValue, fieldValueLen);
}
- break;
+ MSG_DEBUG("integerValue = [%02x]", integerValue);
- /* date */
- /* last-modified */
- case 0x1d :
- /* if-unmodified-since */
- case 0x1b :
- /* if-range */
- case 0x1a :
- /* if-modified-since */
- case 0x17 :
- /* expires */
- case 0x14 :
- /* date */
- case 0x12 :
- {
- char* decodedString = NULL;
- unique_ptr<char*, void(*)(char**)> decodedStringbuf(&decodedString, unique_ptr_deleter);
- wspHeaderDecodeDateValue( fieldValueLen, fieldValue, &decodedString);
- strncat( (char*)temper, (char*)decodedString, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1 );
+ int count = sizeof(wspHeaderApplId)/sizeof(SMS_WSP_HEADER_PARAMETER_S);
+ for (int i = 0; i < count ; ++i) {
+ if ((unsigned int)integerValue == wspHeaderApplId[i].parameterCode) {
+ snprintf((char*)temp, 64, "%s", wspHeaderApplId[i].parameterToken);
+ strncat((char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1);
+ break;
+ }
}
- break;
+ }
+ break;
+ /* Accept-Application */
+ case 0x32 :
+ if (0x80 == fieldValue[0]) {
+ strncat((char*)temper, "*", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1);
+ } else {
- /* connection */
- case 0x09 :
- if (fieldValue[0] == 0x80 )
- strncat( (char*)temper, "Close", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1 );
- break;
- /* accept-ranges */
- case 0x04 :
- if (fieldValue[0] == 0x80 )
- strncat( (char*)temper, "None", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1 );
- if (fieldValue[0] == 0x81 )
- strncat( (char*)temper, "Bytes", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1 );
- break;
- /* content-md5 */
- case 0x0f :
- {
- unsigned char temp[1275];
- memcpy( temp, fieldValue, (size_t)fieldValueLen );
- temp[fieldValueLen] = 0;
- wspHeaderCopyDecodedString( temp, &currentLength, &temper );
- }
- break;
- /* Credential */
- /* authorization */
- case 0x07 :
- /* proxy - authorization */
- case 0x21 :
- if (fieldValue[0] == 0x80) {
- char* addString = NULL;
- unique_ptr<char*, void(*)(char**)> addStringbuf(&addString, unique_ptr_deleter);
- wspHeaderDecodeAuth(fieldValueLen, fieldValue, &addString );
- strncat( (char*)temper, addString, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
- } else {
- iField = AcStrlen( (char*)fieldValue) + 1;
+ unsigned char temp[16];
+ /*
+ if ((fieldValueLen == 2) && (fieldValue[0] == 1))
+ AcSprintf((char*)temp, "%u", (unsigned int)fieldValue[0]);
+ else
+ */
+ snprintf((char*)temp, sizeof(temp), "%u", (unsigned int)wspHeaderDecodeIntegerByLength(fieldValue, fieldValueLen));
+ strncat((char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1);
+ }
+ break;
+
+
+ /* date */
+ /* last-modified */
+ case 0x1d :
+ /* if-unmodified-since */
+ case 0x1b :
+ /* if-range */
+ case 0x1a :
+ /* if-modified-since */
+ case 0x17 :
+ /* expires */
+ case 0x14 :
+ /* date */
+ case 0x12 :
+ {
+ char* decodedString = NULL;
+ unique_ptr<char*, void(*)(char**)> decodedStringbuf(&decodedString, unique_ptr_deleter);
+ wspHeaderDecodeDateValue(fieldValueLen, fieldValue, &decodedString);
+ strncat((char*)temper, (char*)decodedString, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1);
+ }
+ break;
+
+ /* connection */
+ case 0x09 :
+ if (fieldValue[0] == 0x80)
+ strncat((char*)temper, "Close", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1);
+ break;
+ /* accept-ranges */
+ case 0x04 :
+ if (fieldValue[0] == 0x80)
+ strncat((char*)temper, "None", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1);
+ if (fieldValue[0] == 0x81)
+ strncat((char*)temper, "Bytes", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen(temper)-1);
+ break;
+ /* content-md5 */
+ case 0x0f :
+ {
+ unsigned char temp[1275];
+ memcpy(temp, fieldValue, (size_t)fieldValueLen);
+ temp[fieldValueLen] = 0;
+ wspHeaderCopyDecodedString(temp, &currentLength, &temper);
+ }
+ break;
+ /* Credential */
+ /* authorization */
+ case 0x07 :
+ /* proxy - authorization */
+ case 0x21 :
+ if (fieldValue[0] == 0x80) {
+ char* addString = NULL;
+ unique_ptr<char*, void(*)(char**)> addStringbuf(&addString, unique_ptr_deleter);
+ wspHeaderDecodeAuth(fieldValueLen, fieldValue, &addString);
+ strncat((char*)temper, addString, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
+ } else {
+ iField = AcStrlen((char*)fieldValue) + 1;
- strncat( (char*)temper, (char*)fieldValue, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
- if (iField < fieldValueLen) {
- char* param = NULL;
- unique_ptr<char*, void(*)(char**)> parambuf(&param, unique_ptr_deleter);
- wspHeaderDecodeParameter( fieldValue + 1, fieldValueLen - 1, &param );
- if (param != NULL) {
- strncat( (char*)temper, ", ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
- strncat( (char*)temper, (char*)param, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
- }
+ strncat((char*)temper, (char*)fieldValue, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
+ if (iField < fieldValueLen) {
+ char* param = NULL;
+ unique_ptr<char*, void(*)(char**)> parambuf(&param, unique_ptr_deleter);
+ wspHeaderDecodeParameter(fieldValue + 1, fieldValueLen - 1, &param);
+ if (param != NULL) {
+ strncat((char*)temper, ", ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
+ strncat((char*)temper, (char*)param, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
}
}
- break;
-
-
- /* Challenge */
- /* www - auth */
- case 0x2d :
- /* Proxy-authenticate */
- case 0x20 :
- if (0 == fieldValueLen )
- break;
- if (fieldValue[0] == 0x80) {
- char* addString = NULL;
- unique_ptr<char*, void(*)(char**)> addStringbuf(&addString, unique_ptr_deleter);
- wspHeaderDecodeChallenge(fieldValueLen, fieldValue, &addString );
- strncat( (char*)temper, addString, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
- } else {
- unsigned char authScheme[WSP_STANDARD_STR_LEN_MAX + 1];
- unsigned char realmValue[WSP_STANDARD_STR_LEN_MAX];
- unsigned char addedString[WSP_STANDARD_STR_LEN_MAX];
+ }
+ break;
- strncpy( (char*)authScheme, (char*)fieldValue, WSP_STANDARD_STR_LEN_MAX -1);
- iField = AcStrlen( (char*)authScheme ) + 1;
- strncpy( (char*)realmValue, (char*)(fieldValue + iField ), WSP_STANDARD_STR_LEN_MAX-1);
- iField = iField + AcStrlen( (char*)realmValue ) + 1;
- snprintf( (char*)addedString, sizeof(addedString), "%s %s", authScheme, realmValue );
- wspHeaderCopyDecodedString( addedString, &currentLength, &temper );
- if (iField < fieldValueLen) {
- char* param = NULL;
- unique_ptr<char*, void(*)(char**)> parambuf(&param, unique_ptr_deleter);
- wspHeaderDecodeParameter( fieldValue + iField, fieldValueLen - iField, &param );
- if (param != NULL) {
- strncat( (char*)temper, ", ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
- wspHeaderCopyDecodedString( (unsigned char*)param, &currentLength, &temper );
- }
+ /* Challenge */
+ /* www - auth */
+ case 0x2d :
+ /* Proxy-authenticate */
+ case 0x20 :
+ if (0 == fieldValueLen)
+ break;
+ if (fieldValue[0] == 0x80) {
+ char* addString = NULL;
+ unique_ptr<char*, void(*)(char**)> addStringbuf(&addString, unique_ptr_deleter);
+ wspHeaderDecodeChallenge(fieldValueLen, fieldValue, &addString);
+ strncat((char*)temper, addString, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
+ } else {
+ unsigned char authScheme[WSP_STANDARD_STR_LEN_MAX + 1];
+ unsigned char realmValue[WSP_STANDARD_STR_LEN_MAX];
+ unsigned char addedString[WSP_STANDARD_STR_LEN_MAX];
+
+ strncpy((char*)authScheme, (char*)fieldValue, WSP_STANDARD_STR_LEN_MAX -1);
+ iField = AcStrlen((char*)authScheme) + 1;
+ strncpy((char*)realmValue, (char*)(fieldValue + iField), WSP_STANDARD_STR_LEN_MAX-1);
+ iField = iField + AcStrlen((char*)realmValue) + 1;
+ snprintf((char*)addedString, sizeof(addedString), "%s %s", authScheme, realmValue);
+ wspHeaderCopyDecodedString(addedString, &currentLength, &temper);
+
+ if (iField < fieldValueLen) {
+ char* param = NULL;
+ unique_ptr<char*, void(*)(char**)> parambuf(&param, unique_ptr_deleter);
+ wspHeaderDecodeParameter(fieldValue + iField, fieldValueLen - iField, &param);
+ if (param != NULL) {
+ strncat((char*)temper, ", ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
+ wspHeaderCopyDecodedString((unsigned char*)param, &currentLength, &temper);
}
}
- break;
+ }
+ break;
- /* content -range */
- case 0x10 :
- {
- unsigned long first, len, last;
+ /* content -range */
+ case 0x10 :
+ {
+ unsigned long first, len, last;
- unsigned char temp[16];
- iField = 0;
+ unsigned char temp[16];
+ iField = 0;
- strncat( (char*)temper," bytes ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+ strncat((char*)temper," bytes ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
- first = wspRetriveUintvarDecode( fieldValue, &iField );
- len = wspRetriveUintvarDecode( fieldValue, &iField );
- /* Originally range of HTTP include entity length. But WSP omit it. Finally to calculate this, it should be get content length from export. If this field is included without content length, then it can get wrong result. This content length can be get by calculating PDU length.
- */
- last = first + contentsLength - 1;
+ first = wspRetriveUintvarDecode(fieldValue, &iField);
+ len = wspRetriveUintvarDecode(fieldValue, &iField);
+ /* Originally range of HTTP include entity length. But WSP omit it. Finally to calculate this, it should be get content length from export. If this field is included without content length, then it can get wrong result. This content length can be get by calculating PDU length.
+ */
+ last = first + contentsLength - 1;
- snprintf( (char*)temp, sizeof(temp), "%u-%u/%u", (unsigned int)first, (unsigned int)last, (unsigned int)len );
- strncat( (char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
- }
- break;
+ snprintf((char*)temp, sizeof(temp), "%u-%u/%u", (unsigned int)first, (unsigned int)last, (unsigned int)len);
+ strncat((char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
+ }
+ break;
- /* cache-control */
- case 0x08 :
- {
- char* cacheString = NULL;
- unique_ptr<char*, void(*)(char**)> cacheStringbuf(&cacheString, unique_ptr_deleter);
+ /* cache-control */
+ case 0x08 :
+ {
+ char* cacheString = NULL;
+ unique_ptr<char*, void(*)(char**)> cacheStringbuf(&cacheString, unique_ptr_deleter);
- wspHeaderDecodeCacheControl( fieldValue, fieldValueLen, &cacheString );
- strncat( (char*)temper, (char*)cacheString, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
- }
- break;
+ wspHeaderDecodeCacheControl(fieldValue, fieldValueLen, &cacheString);
+ strncat((char*)temper, (char*)cacheString, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
+ }
+ break;
- /* pragma */
- case 0x1f :
- if (fieldValue[0] == 0x80) {
- strncat( (char*)temper, (char*)wspCacheControl[0], (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
- } else {
- if (1 < fieldValueLen) {
- char* param = NULL;
- unique_ptr<char*, void(*)(char**)> parambuf(&param, unique_ptr_deleter);
- wspHeaderDecodeParameter( fieldValue, fieldValueLen, &param );
+ /* pragma */
+ case 0x1f :
+ if (fieldValue[0] == 0x80) {
+ strncat((char*)temper, (char*)wspCacheControl[0], (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
+ } else {
+ if (1 < fieldValueLen) {
+ char* param = NULL;
+ unique_ptr<char*, void(*)(char**)> parambuf(&param, unique_ptr_deleter);
+ wspHeaderDecodeParameter(fieldValue, fieldValueLen, &param);
- if (param != NULL) {
- strncat( (char*)temper, "; ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
- strncat( (char*)temper, (char*)param, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
- }
+ if (param != NULL) {
+ strncat((char*)temper, "; ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
+ strncat((char*)temper, (char*)param, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
}
}
+ }
- break;
- /* public */
- case 0x22 :
- /* allow */
- case 0x06 :
- {
- unsigned long i = 0;
- while ( wspHeaderDecodeIntegerByLength( fieldValue, fieldValueLen ) != wspMethodType[i].methodCode ) i++;
- strncat( (char*)temper, (char*)wspMethodType[i].methodName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
- }
- break;
- /* range */
- case 0x23 :
- strncat( (char*)temper, "bytes=", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
- if (fieldValue[0] == 0x80) {
- unsigned char temp[16];
- unsigned long first, last;
- iField = 0;
-
- first = wspRetriveUintvarDecode( fieldValue, &iField );
- last = wspRetriveUintvarDecode( fieldValue, &iField );
-
- snprintf( (char*)temp, sizeof(temp), "%u-%u", (unsigned int)first, (unsigned int)last );
- strncat( (char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
- }
- if (fieldValue[0] == 0x81) {
- unsigned char temp[16];
- unsigned long suffix;
+ break;
+ /* public */
+ case 0x22 :
+ /* allow */
+ case 0x06 :
+ {
+ unsigned long i = 0;
+ while (wspHeaderDecodeIntegerByLength(fieldValue, fieldValueLen) != wspMethodType[i].methodCode) i++;
+ strncat((char*)temper, (char*)wspMethodType[i].methodName, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
+ }
+ break;
+ /* range */
+ case 0x23 :
+ strncat((char*)temper, "bytes=", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
+ if (fieldValue[0] == 0x80) {
+ unsigned char temp[16];
+ unsigned long first, last;
+ iField = 0;
+
+ first = wspRetriveUintvarDecode(fieldValue, &iField);
+ last = wspRetriveUintvarDecode(fieldValue, &iField);
+
+ snprintf((char*)temp, sizeof(temp), "%u-%u", (unsigned int)first, (unsigned int)last);
+ strncat((char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
+ }
+ if (fieldValue[0] == 0x81) {
+ unsigned char temp[16];
+ unsigned long suffix;
- suffix = wspRetriveUintvarDecode( fieldValue, &iField );
+ suffix = wspRetriveUintvarDecode(fieldValue, &iField);
- snprintf( (char*)temp, sizeof(temp), "-%u", (unsigned int)suffix );
+ snprintf((char*)temp, sizeof(temp), "-%u", (unsigned int)suffix);
- }
- break;
- /* retry-after */
- case 0x25 :
- if (fieldValue[0] == 0x80) {
- char* temp = NULL;
- unique_ptr<char*, void(*)(char**)> tempbuf(&temp, unique_ptr_deleter);
-
- wspHeaderDecodeDateValue( fieldValueLen - 1, fieldValue + 1, &temp );
- strncat( (char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
- }
+ }
+ break;
+ /* retry-after */
+ case 0x25 :
+ if (fieldValue[0] == 0x80) {
+ char* temp = NULL;
+ unique_ptr<char*, void(*)(char**)> tempbuf(&temp, unique_ptr_deleter);
+
+ wspHeaderDecodeDateValue(fieldValueLen - 1, fieldValue + 1, &temp);
+ strncat((char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
+ }
- if (fieldValue[0] == 0x81) {
- unsigned char temp[16];
+ if (fieldValue[0] == 0x81) {
+ unsigned char temp[16];
- snprintf( (char*)temp, 16, "%u", (unsigned int)wspHeaderDecodeIntegerByLength( fieldValue,fieldValueLen ));
- strncat( (char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
- }
- break;
- /* transfer-encoding */
- case 0x27 :
- /* No other cases allowed */
- if (fieldValue[0] == 0x80 )
- strncat( (char*)temper, "chunked", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
-
- break;
- /* vary */
- case 0x2a :
- {
- int integerValue = wspHeaderDecodeIntegerByLength(fieldValue,fieldValueLen );
- if (integerValue > wspHeaderFieldCount) {
- MSG_DEBUG("WspLDecodeHeader: integerValue is over limit(0x%x).\n",wspHeaderFieldCount);
- break;
- }
- strncat( (char*)temper, (char*)wspHeaderFieldName[integerValue], (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+ snprintf((char*)temp, 16, "%u", (unsigned int)wspHeaderDecodeIntegerByLength(fieldValue,fieldValueLen));
+ strncat((char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
+ }
+ break;
+ /* transfer-encoding */
+ case 0x27 :
+ /* No other cases allowed */
+ if (fieldValue[0] == 0x80)
+ strncat((char*)temper, "chunked", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
+
+ break;
+ /* vary */
+ case 0x2a :
+ {
+ int integerValue = wspHeaderDecodeIntegerByLength(fieldValue,fieldValueLen);
+ if (integerValue > wspHeaderFieldCount) {
+ MSG_DEBUG("WspLDecodeHeader: integerValue is over limit(0x%x).\n",wspHeaderFieldCount);
+ break;
}
- break;
- /* warning */
- case 0x2c :
- {
- unsigned char temp[WSP_STANDARD_STR_LEN_MAX];
-
- if (fieldValue[0] < 0x20 )
- iField = fieldValue[0];
- else
- iField = 1;
-
- snprintf( (char*)temp, sizeof(temp), "%u", (unsigned int)wspHeaderDecodeIntegerByLength( fieldValue, iField ));
- strncat( (char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
- if (iField < fieldValueLen) {
- unsigned char agent[WSP_STANDARD_STR_LEN_MAX];
- unsigned char text[WSP_STANDARD_STR_LEN_MAX];
- strncpy( (char*)agent, (char*)(fieldValue + iField ),WSP_STANDARD_STR_LEN_MAX-1);
- iField = iField + AcStrlen((char*)agent ) + 1;
- strncpy((char*)text, (char*)(fieldValue + iField ),WSP_STANDARD_STR_LEN_MAX-1);
- snprintf( (char*)temp, sizeof(temp), " %s %s", agent, text );
- wspHeaderCopyDecodedString( temp, &currentLength, &temper );
- }
+ strncat((char*)temper, (char*)wspHeaderFieldName[integerValue], (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
+ }
+ break;
+ /* warning */
+ case 0x2c :
+ {
+ unsigned char temp[WSP_STANDARD_STR_LEN_MAX];
+
+ if (fieldValue[0] < 0x20)
+ iField = fieldValue[0];
+ else
+ iField = 1;
+
+ snprintf((char*)temp, sizeof(temp), "%u", (unsigned int)wspHeaderDecodeIntegerByLength(fieldValue, iField));
+ strncat((char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
+ if (iField < fieldValueLen) {
+ unsigned char agent[WSP_STANDARD_STR_LEN_MAX];
+ unsigned char text[WSP_STANDARD_STR_LEN_MAX];
+ strncpy((char*)agent, (char*)(fieldValue + iField),WSP_STANDARD_STR_LEN_MAX-1);
+ iField = iField + AcStrlen((char*)agent) + 1;
+ strncpy((char*)text, (char*)(fieldValue + iField),WSP_STANDARD_STR_LEN_MAX-1);
+ snprintf((char*)temp, sizeof(temp), " %s %s", agent, text);
+ wspHeaderCopyDecodedString(temp, &currentLength, &temper);
}
- break;
- /* content-disposition */
- case 0x2e :
- if (fieldValue[0] == 0x80 )
- strncat( (char*)temper, "form-data", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
-
- if (fieldValue[0] == 0x81 )
- strncat( (char*)temper, "attachment", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
-
- if (1 < fieldValueLen) {
- char* param = NULL;
- unique_ptr<char*, void(*)(char**)> parambuf(&param, unique_ptr_deleter);
- wspHeaderDecodeParameter( fieldValue + 1, fieldValueLen - 1, &param );
-
- if (param != NULL) {
- strncat( (char*)temper, "; ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
- strncat( (char*)temper, (char*)param, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
- }
+ }
+ break;
+ /* content-disposition */
+ case 0x2e :
+ if (fieldValue[0] == 0x80)
+ strncat((char*)temper, "form-data", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
+
+ if (fieldValue[0] == 0x81)
+ strncat((char*)temper, "attachment", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
+
+ if (1 < fieldValueLen) {
+ char* param = NULL;
+ unique_ptr<char*, void(*)(char**)> parambuf(&param, unique_ptr_deleter);
+ wspHeaderDecodeParameter(fieldValue + 1, fieldValueLen - 1, &param);
+
+ if (param != NULL) {
+ strncat((char*)temper, "; ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
+ strncat((char*)temper, (char*)param, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
}
- break;
- /* Profile-diff */
- case 0x36 :
- temper[AcStrlen((char*)temper) + fieldValueLen] = '\0';
- memcpy( temper, fieldValue, (size_t)fieldValueLen );
- break;
- /* Profile-Warning */
- case 0x37 :
- {
- unsigned char temp[WSP_STANDARD_STR_LEN_MAX];
-
- snprintf( (char*)temp, sizeof(temp), "%lX", wspHeaderDecodeInteger(fieldValue ));
- temp[2] = temp[1];
- temp[1] = (unsigned char)0x30;
- temp[3] = '\0';
- if (fieldValueLen > 1) {
- /* copy warn-target - URI */
- strncat( (char*)temp, (char*)(fieldValue + 1), WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)temp)-1 );
- if (fieldValueLen > ( AcStrlen( (char*)(fieldValue + 1)) + 1 )) {
- /* copy warn-date */
- char* decodedString = NULL;
- unique_ptr<char*, void(*)(char**)> decodedStringbuf(&decodedString, unique_ptr_deleter);
- wspHeaderDecodeDateValue( fieldValueLen - ( AcStrlen( (char*)(fieldValue + 1)) + 2 ), fieldValue + AcStrlen( (char*)(fieldValue + 1)) + 1, &decodedString );
- strncat( (char*)temp, (char*)decodedString, WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)temp)-1 );
- }
+ }
+ break;
+ /* Profile-diff */
+ case 0x36 :
+ temper[AcStrlen((char*)temper) + fieldValueLen] = '\0';
+ memcpy(temper, fieldValue, (size_t)fieldValueLen);
+ break;
+ /* Profile-Warning */
+ case 0x37 :
+ {
+ unsigned char temp[WSP_STANDARD_STR_LEN_MAX];
+
+ snprintf((char*)temp, sizeof(temp), "%lX", wspHeaderDecodeInteger(fieldValue));
+ temp[2] = temp[1];
+ temp[1] = (unsigned char)0x30;
+ temp[3] = '\0';
+ if (fieldValueLen > 1) {
+ /* copy warn-target - URI */
+ strncat((char*)temp, (char*)(fieldValue + 1), WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)temp)-1);
+ if (fieldValueLen > (AcStrlen((char*)(fieldValue + 1)) + 1)) {
+ /* copy warn-date */
+ char* decodedString = NULL;
+ unique_ptr<char*, void(*)(char**)> decodedStringbuf(&decodedString, unique_ptr_deleter);
+ wspHeaderDecodeDateValue(fieldValueLen - (AcStrlen((char*)(fieldValue + 1)) + 2), fieldValue + AcStrlen((char*)(fieldValue + 1)) + 1, &decodedString);
+ strncat((char*)temp, (char*)decodedString, WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)temp)-1);
}
- strncat( (char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
}
- break;
-
- default :
- break;
- }
+ strncat((char*)temper, (char*)temp, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
+ }
+ break;
+ default :
+ break;
}
+
}
}
/* It deosn't finished decoding yet. */
- if (( iEncodedHeader < encodedHeaderLen ) && ( fieldCode != 0xff )) {
+ if ((iEncodedHeader < encodedHeaderLen) && (fieldCode != 0xff)) {
/* In here, iEncodedHeader already point next field code to be decoded. */
/* If this code is same, then set continueField else add CRLF. */
- if (fieldCode == (encodedHeader[iEncodedHeader] & 0x7f )) {
- strncat( (char*)temper, ", ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+ if (fieldCode == (encodedHeader[iEncodedHeader] & 0x7f)) {
+ strncat((char*)temper, ", ", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
continueField = TRUE;
} else {
- strncat( (char*)temper, "\r\n", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+ strncat((char*)temper, "\r\n", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
continueField = FALSE;
}
} else {
- strncat( (char*)temper, "\r\n", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1 );
+ strncat((char*)temper, "\r\n", (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)temper)-1);
}
/* add single header to total headers */
- strncat( (char*)outTemper, (char*)temper, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)outTemper)-1 );
- MSG_DEBUG("WspLDecodeHeader: Single Header : %s\r\n", temper );
+ strncat((char*)outTemper, (char*)temper, (WSP_STANDARD_STR_LEN_MAX * 5)-AcStrlen((char*)outTemper)-1);
+ MSG_DEBUG("WspLDecodeHeader: Single Header : %s\r\n", temper);
}
- MSG_DEBUG("WspLDecodeHeader: Header decoding ended.\n" );
+ MSG_DEBUG("WspLDecodeHeader: Header decoding ended.\n");
*pHeader = outTemper;
@@ -3014,7 +3029,7 @@ void SmsPluginWapPushHandler::wspDecodeHeader( unsigned char* sEncodedHeader, un
}
-unsigned long SmsPluginWapPushHandler::wspHeaderDecodeInteger( unsigned char* data )
+unsigned long SmsPluginWapPushHandler::wspHeaderDecodeInteger(unsigned char* data)
{
/* we only can handle max 32bit integer */
unsigned long i;
@@ -3034,7 +3049,7 @@ unsigned long SmsPluginWapPushHandler::wspHeaderDecodeInteger( unsigned char* da
MSG_DEBUG("WspLHeaderDecodeInteger: input %d , length %d\n", data[0], IntLen);
for (i=0; i<IntLen; i++)
- returner.seg[IntLen-( i+1)] = data[i+1];
+ returner.seg[IntLen-(i+1)] = data[i+1];
return returner.integer;
}
@@ -3043,7 +3058,7 @@ unsigned long SmsPluginWapPushHandler::wspHeaderDecodeInteger( unsigned char* da
}
-void SmsPluginWapPushHandler::wspHeaderDecodeQValue( unsigned long length, unsigned char* data, char** pDecodedString)
+void SmsPluginWapPushHandler::wspHeaderDecodeQValue(unsigned long length, unsigned char* data, char** pDecodedString)
{
unsigned short qBase = 0;
float qValue;
@@ -3054,12 +3069,12 @@ void SmsPluginWapPushHandler::wspHeaderDecodeQValue( unsigned long length, unsig
return;
}
- memcpy( &qBase, data, (size_t)length );
+ memcpy(&qBase, data, (size_t)length);
qValue = (float)qBase;
if (qValue > 100) {
qValue = qValue - 100;
qValue = qValue / 1000;
- snprintf( (char*)*pDecodedString, sizeof(char)*WSP_STANDARD_STR_LEN_MAX, "; q=%.3f", qValue );
+ snprintf((char*)*pDecodedString, sizeof(char)*WSP_STANDARD_STR_LEN_MAX, "; q=%.3f", qValue);
} else {
/* qValue variable is divided by 100. And it's multiplied by 100.
It's to resolve problem of changed 0.01 of qValue. */
@@ -3067,16 +3082,16 @@ void SmsPluginWapPushHandler::wspHeaderDecodeQValue( unsigned long length, unsig
qValue = qValue - 1;
qValue = qValue / 100;
qValueTemp = (unsigned long)(qValue * 100);
- if (0 == (qValueTemp % 10 ))
- snprintf( (char*)*pDecodedString, sizeof(char)*WSP_STANDARD_STR_LEN_MAX, "; q=%.1f", qValue );
+ if (0 == (qValueTemp % 10))
+ snprintf((char*)*pDecodedString, sizeof(char)*WSP_STANDARD_STR_LEN_MAX, "; q=%.1f", qValue);
else
- snprintf( (char*)*pDecodedString, sizeof(char)*WSP_STANDARD_STR_LEN_MAX, "; q=%.2f", qValue );
+ snprintf((char*)*pDecodedString, sizeof(char)*WSP_STANDARD_STR_LEN_MAX, "; q=%.2f", qValue);
}
return;
}
-unsigned long SmsPluginWapPushHandler::wspHeaderDecodeIntegerByLength(unsigned char* data, unsigned long length )
+unsigned long SmsPluginWapPushHandler::wspHeaderDecodeIntegerByLength(unsigned char* data, unsigned long length)
{
unsigned long i;
@@ -3087,25 +3102,25 @@ unsigned long SmsPluginWapPushHandler::wspHeaderDecodeIntegerByLength(unsigned c
returner.integer = 0;
- if (length == 1 )
+ if (length == 1)
return data[0] & 0x7f;
returner.integer = 0;
for (i = 0 ; i < length; i++) {
- returner.integer = returner.integer + ( data[i] * (0x1 << ( ( length - ( i + 1)) * 8 )));
- MSG_DEBUG("WspLHeaderDecodeIntegerByLength: %d \n", returner.integer );
+ returner.integer = returner.integer + (data[i] * (0x1 << ((length - (i + 1)) * 8)));
+ MSG_DEBUG("WspLHeaderDecodeIntegerByLength: %d \n", returner.integer);
}
return returner.integer;
}
-char* SmsPluginWapPushHandler::wspExtendedDecodeType(char contentType )
+char* SmsPluginWapPushHandler::wspExtendedDecodeType(char contentType)
{
int i = 0;
- while ( wspExtendedContentsType[i].contentsTypeCode != contentType) {
+ while (wspExtendedContentsType[i].contentsTypeCode != contentType) {
if (wspExtendedContentsType[i].contentsTypeCode == 0xff)
return NULL;
i++;
@@ -3115,7 +3130,7 @@ char* SmsPluginWapPushHandler::wspExtendedDecodeType(char contentType )
}
-void SmsPluginWapPushHandler::wspHeaderDecodeParameter( unsigned char* data, unsigned long length, char** pParam)
+void SmsPluginWapPushHandler::wspHeaderDecodeParameter(unsigned char* data, unsigned long length, char** pParam)
{
char* param = *pParam;
@@ -3127,111 +3142,110 @@ void SmsPluginWapPushHandler::wspHeaderDecodeParameter( unsigned char* data, uns
param = new char[WSP_STANDARD_STR_LEN_MAX];
if (param == NULL) {
- MSG_DEBUG("WspLHeaderDecodeParameter:MemAlloc failed\n" );
+ MSG_DEBUG("WspLHeaderDecodeParameter:MemAlloc failed\n");
return;
}
- strncpy( (char*)param, (char*)data, WSP_STANDARD_STR_LEN_MAX - 1);
+ strncpy((char*)param, (char*)data, WSP_STANDARD_STR_LEN_MAX - 1);
- if (NO_VALUE == data[AcStrlen( (char*)param ) + 1]) {
+ if (NO_VALUE == data[AcStrlen((char*)param) + 1]) {
*pParam = param;
return;
}
- strncat( (char*)param, "=", WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)param)-1 );
- strncat( (char*)param, (char*)(data + strlen( (char*)param )), WSP_STANDARD_STR_LEN_MAX-strlen((char*)param)-1);
+ strncat((char*)param, "=", WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)param)-1);
+ strncat((char*)param, (char*)(data + strlen((char*)param)), WSP_STANDARD_STR_LEN_MAX-strlen((char*)param)-1);
*pParam = param;
return;
}
- switch ( data[0] & 0x7f )
- {
- case 0x00 :
- wspHeaderDecodeQValue( length - 1, data + 1, &param);
- break;
- case 0x01 :
- wspHeaderDecodeCharset( length - 1 , data + 1, &param);
- break;
- case 0x02 :
- wspHeaderDecodeVersion( length - 1, data + 1, &param);
- break;
- /* integer */
- case 0x03 :
- //param = (unsigned char *)malloc( (size_t)WSP_STANDARD_STR_LEN_MAX );
- param = new char[WSP_STANDARD_STR_LEN_MAX];
- if (param == NULL) {
- MSG_DEBUG("WspLHeaderDecodeParameter: 0x03 MemAlloc failed\n");
- return;
- } else {
- snprintf((char*)param, sizeof(char)*WSP_STANDARD_STR_LEN_MAX, "Type=%i", (int)wspHeaderDecodeInteger( data + 1 ));
- }
- break;
- case 0x08 :
- param = new char[WSP_STANDARD_STR_LEN_MAX];
+ switch (data[0] & 0x7f) {
+ case 0x00 :
+ wspHeaderDecodeQValue( length - 1, data + 1, &param);
+ break;
+ case 0x01 :
+ wspHeaderDecodeCharset(length - 1 , data + 1, &param);
+ break;
+ case 0x02 :
+ wspHeaderDecodeVersion(length - 1, data + 1, &param);
+ break;
+ /* integer */
+ case 0x03 :
+ /* param = (unsigned char *)malloc((size_t)WSP_STANDARD_STR_LEN_MAX); */
+ param = new char[WSP_STANDARD_STR_LEN_MAX];
+ if (param == NULL) {
+ MSG_DEBUG("WspLHeaderDecodeParameter: 0x03 MemAlloc failed\n");
+ return;
+ } else {
+ snprintf((char*)param, sizeof(char)*WSP_STANDARD_STR_LEN_MAX, "Type=%i", (int)wspHeaderDecodeInteger(data + 1));
+ }
+ break;
+ case 0x08 :
+ param = new char[WSP_STANDARD_STR_LEN_MAX];
- if (param == NULL) {
- MSG_DEBUG("WspLHeaderDecodeParameter:0x08 MemAlloc failed\n");
- return;
- } else {
- snprintf((char*)param, sizeof(char)*WSP_STANDARD_STR_LEN_MAX, "Padding=%i", (int)wspHeaderDecodeInteger( data + 1 ));
- }
- break;
- case 0x05 :
- param = new char[WSP_STANDARD_STR_LEN_MAX];
+ if (param == NULL) {
+ MSG_DEBUG("WspLHeaderDecodeParameter:0x08 MemAlloc failed\n");
+ return;
+ } else {
+ snprintf((char*)param, sizeof(char)*WSP_STANDARD_STR_LEN_MAX, "Padding=%i", (int)wspHeaderDecodeInteger(data + 1));
+ }
+ break;
+ case 0x05 :
+ param = new char[WSP_STANDARD_STR_LEN_MAX];
- if (param == NULL) {
- MSG_DEBUG("WspLHeaderDecodeParameter:0x05 MemAlloc failed\n");
- return;
- } else {
- strncpy( (char*)param, "Name=", WSP_STANDARD_STR_LEN_MAX-1);
- memcpy( param + 5, data + 1, length - 1 );
- param[5 + length - 1] = '\0';
- }
- break;
- case 0x06 :
- param = new char[WSP_STANDARD_STR_LEN_MAX];
+ if (param == NULL) {
+ MSG_DEBUG("WspLHeaderDecodeParameter:0x05 MemAlloc failed\n");
+ return;
+ } else {
+ strncpy((char*)param, "Name=", WSP_STANDARD_STR_LEN_MAX-1);
+ memcpy(param + 5, data + 1, length - 1);
+ param[5 + length - 1] = '\0';
+ }
+ break;
+ case 0x06 :
+ param = new char[WSP_STANDARD_STR_LEN_MAX];
- if (param == NULL) {
- MSG_DEBUG("WspLHeaderDecodeParameter:0x06 MemAlloc failed\n");
- return;
- } else {
- strncpy( (char*)param, "Filename=", WSP_STANDARD_STR_LEN_MAX-1);
- memcpy( param + 9, (char*)(data + 1), (size_t)(length - 1) );
- param[9 + length - 1] = '\0';
- }
- break;
- case 0x07 :
- param = NULL;
- /* TBI */
- break;
- /*OMA Provisioning*/
- case 0x11 :
- param = new char[WSP_STANDARD_STR_LEN_MAX];
+ if (param == NULL) {
+ MSG_DEBUG("WspLHeaderDecodeParameter:0x06 MemAlloc failed\n");
+ return;
+ } else {
+ strncpy((char*)param, "Filename=", WSP_STANDARD_STR_LEN_MAX-1);
+ memcpy(param + 9, (char*)(data + 1), (size_t)(length - 1));
+ param[9 + length - 1] = '\0';
+ }
+ break;
+ case 0x07 :
+ param = NULL;
+ /* TBI */
+ break;
+ /*OMA Provisioning*/
+ case 0x11 :
+ param = new char[WSP_STANDARD_STR_LEN_MAX];
- if (param == NULL) {
- MSG_DEBUG("WspLHeaderDecodeParameter:0x11 MemAlloc failed\n");
- return;
- } else {
- strncpy((char*)param, "SEC=", WSP_STANDARD_STR_LEN_MAX-1);
- SecurityTypeCode = data[1] & 0x7f;
- while (( i < wspSecurityTypeCount ) && ( wspSecurityType[i].SecurityTypeCode != SecurityTypeCode )) i++;
+ if (param == NULL) {
+ MSG_DEBUG("WspLHeaderDecodeParameter:0x11 MemAlloc failed\n");
+ return;
+ } else {
+ strncpy((char*)param, "SEC=", WSP_STANDARD_STR_LEN_MAX-1);
+ SecurityTypeCode = data[1] & 0x7f;
+ while ((i < wspSecurityTypeCount) && (wspSecurityType[i].SecurityTypeCode != SecurityTypeCode)) i++;
- if (i < wspSecurityTypeCount) {
- strncat( (char*)param, (char*)wspSecurityType[i].SecurityTypeName, WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)param)-1);
- }
+ if (i < wspSecurityTypeCount) {
+ strncat((char*)param, (char*)wspSecurityType[i].SecurityTypeName, WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)param)-1);
+ }
- if (0x12 == (data[2] & 0x7f)) {
- strncat( (char*)param, "; MAC=", WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)param)-1 );
- memcpy(param+AcStrlen( (char*)param),(char*)(data+3),(size_t)length-3 );
- }
+ if (0x12 == (data[2] & 0x7f)) {
+ strncat((char*)param, "; MAC=", WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)param)-1);
+ memcpy(param+AcStrlen((char*)param),(char*)(data+3),(size_t)length-3);
}
- break;
+ }
+ break;
- default :
- param = NULL;
- break;
+ default :
+ param = NULL;
+ break;
}
*pParam = param;
@@ -3239,7 +3253,7 @@ void SmsPluginWapPushHandler::wspHeaderDecodeParameter( unsigned char* data, uns
}
-void SmsPluginWapPushHandler::wspHeaderDecodeCharset( unsigned long length, unsigned char* data, char**pDecodedString)
+void SmsPluginWapPushHandler::wspHeaderDecodeCharset(unsigned long length, unsigned char* data, char**pDecodedString)
{
char* param = NULL;
@@ -3252,10 +3266,10 @@ void SmsPluginWapPushHandler::wspHeaderDecodeCharset( unsigned long length, unsi
return;
}
- strncpy( (char*)param, "charset=", WSP_STANDARD_STR_LEN_MAX-1);
+ strncpy((char*)param, "charset=", WSP_STANDARD_STR_LEN_MAX-1);
if (data[0] > 0x80) {
- unsigned long code = wspHeaderDecodeInteger(data );
+ unsigned long code = wspHeaderDecodeInteger(data);
unsigned long i = 0;
while (wspCharset[i].charsetCode != code) {
if (wspCharset[i].charsetCode == 0xffff) {
@@ -3264,14 +3278,14 @@ void SmsPluginWapPushHandler::wspHeaderDecodeCharset( unsigned long length, unsi
}
i++;
}
- strncat( (char*)param, (char*)wspCharset[i].charsetName, WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)param)-1 );
+ strncat((char*)param, (char*)wspCharset[i].charsetName, WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)param)-1);
} else {
unsigned long lastLen = AcStrlen((char*)param);
if (length + lastLen < WSP_STANDARD_STR_LEN_MAX - 1) {
- memcpy( (char*)(param + lastLen), data, (size_t)length );
+ memcpy((char*)(param + lastLen), data, (size_t)length);
param[length + lastLen] = '\0';
} else {
- memcpy( (char*)(param + lastLen), data, WSP_STANDARD_STR_LEN_MAX - lastLen - 1 );
+ memcpy((char*)(param + lastLen), data, WSP_STANDARD_STR_LEN_MAX - lastLen - 1);
param[WSP_STANDARD_STR_LEN_MAX-1] = '\0';
}
}
@@ -3282,7 +3296,7 @@ void SmsPluginWapPushHandler::wspHeaderDecodeCharset( unsigned long length, unsi
-void SmsPluginWapPushHandler::wspHeaderDecodeVersion( unsigned long length, unsigned char* data, char** pDecodedString )
+void SmsPluginWapPushHandler::wspHeaderDecodeVersion(unsigned long length, unsigned char* data, char** pDecodedString)
{
*pDecodedString = new char[WSP_STANDARD_STR_LEN_MAX];
@@ -3293,94 +3307,94 @@ void SmsPluginWapPushHandler::wspHeaderDecodeVersion( unsigned long length, unsi
if (length > 1) {
/* untyped version */
- memcpy( *pDecodedString, data, (size_t)length );
+ memcpy(*pDecodedString, data, (size_t)length);
} else {
/* typed version */
- unsigned char majorVer = ((data[0] & 0x7f ) >> 4 );
+ unsigned char majorVer = ((data[0] & 0x7f) >> 4);
unsigned char minorVer = data[0] & 0x0f;
- snprintf( (char*)*pDecodedString, sizeof(char)*WSP_STANDARD_STR_LEN_MAX, "level=%u.%u", majorVer, minorVer );
+ snprintf((char*)*pDecodedString, sizeof(char)*WSP_STANDARD_STR_LEN_MAX, "level=%u.%u", majorVer, minorVer);
}
return;
}
-void SmsPluginWapPushHandler::wspHeaderDecodeDateValue( unsigned long length, unsigned char* data, char** pDecodedString )
+void SmsPluginWapPushHandler::wspHeaderDecodeDateValue(unsigned long length, unsigned char* data, char** pDecodedString)
{
time_t lTime;
struct tm pTMData;
- MSG_DEBUG("WspLHeaderDecodeDateValue: \n" );
+ MSG_DEBUG("WspLHeaderDecodeDateValue: \n");
*pDecodedString = new char[WSP_STANDARD_STR_LEN_MAX];
if (*pDecodedString == NULL) {
- MSG_DEBUG( "WspLHeaderDecodeDateValue:MemAlloc failed\n");
+ MSG_DEBUG("WspLHeaderDecodeDateValue:MemAlloc failed\n");
return;
}
lTime = wspHeaderDecodeIntegerByLength(data, length);
- (struct tm*)gmtime_r((const time_t* )&lTime, &pTMData);
+ (struct tm*)gmtime_r((const time_t*)&lTime, &pTMData);
/* check date value validity */
{
- if (( pTMData.tm_wday > 6 ) || (pTMData.tm_mon > 11 ) || (pTMData.tm_mday > 31 ))
+ if ((pTMData.tm_wday > 6) || (pTMData.tm_mon > 11) || (pTMData.tm_mday > 31))
{
- MSG_DEBUG( "WspLHeaderDecodeDateValue: Date decode fail %d, %d, %d \n", pTMData.tm_wday, pTMData.tm_mon, pTMData.tm_mday );
- strncpy( (char*)*pDecodedString, "Decoding Failed", WSP_STANDARD_STR_LEN_MAX-1);
+ MSG_DEBUG("WspLHeaderDecodeDateValue: Date decode fail %d, %d, %d \n", pTMData.tm_wday, pTMData.tm_mon, pTMData.tm_mday);
+ strncpy((char*)*pDecodedString, "Decoding Failed", WSP_STANDARD_STR_LEN_MAX-1);
return;
}
}
#ifdef MSG_FW_FOR_DEBUG
/** Date type selection */
- switch ( wspMachineStatus.dateType )
+ switch (wspMachineStatus.dateType)
{
/* UNIX asciitime function */
case UNIX_DATE_TYPE :
- snprintf( (char*)decodedString, sizeof(decodedString), "%s %s %-2u %u:%u:%u %u GMT", wspWeek[pTMData.tm_wday], wspMonth[pTMData.tm_mon],
- pTMData.tm_mday, pTMData.tm_hour, pTMData.tm_min, pTMData.tm_sec, pTMData.tm_year + 1900 );
+ snprintf((char*)decodedString, sizeof(decodedString), "%s %s %-2u %u:%u:%u %u GMT", wspWeek[pTMData.tm_wday], wspMonth[pTMData.tm_mon],
+ pTMData.tm_mday, pTMData.tm_hour, pTMData.tm_min, pTMData.tm_sec, pTMData.tm_year + 1900);
break;
case RFC1123_DATE_TYPE :
- snprintf( (char*)decodedString, sizeof(decodedString), "%s, %u %s %u %u:%u:%u GMT", wspWeek[pTMData.tm_wday], pTMData.tm_mday,
- wspMonth[pTMData.tm_mon], pTMData.tm_year + 1900, pTMData.tm_hour, pTMData.tm_min, pTMData.tm_sec );
+ snprintf((char*)decodedString, sizeof(decodedString), "%s, %u %s %u %u:%u:%u GMT", wspWeek[pTMData.tm_wday], pTMData.tm_mday,
+ wspMonth[pTMData.tm_mon], pTMData.tm_year + 1900, pTMData.tm_hour, pTMData.tm_min, pTMData.tm_sec);
break;
case RFC850_DATE_TYPE :
/* Have some Y2K Problems */
/* In RFC 850, date is represented like 11-May-99. So Y2K problem always can be occured. So remainer (year divided by 100) is used. */
- snprintf( (char*)decodedString, sizeof(decodedString), "%s, %2u-%s-%2u %u:%u:%u GMT", wspWeekDay[pTMData.tm_wday], pTMData.tm_mday,
- wspMonth[pTMData.tm_mon], pTMData.tm_year % CENTURY, pTMData.tm_hour, pTMData.tm_min, pTMData.tm_sec );
+ snprintf((char*)decodedString, sizeof(decodedString), "%s, %2u-%s-%2u %u:%u:%u GMT", wspWeekDay[pTMData.tm_wday], pTMData.tm_mday,
+ wspMonth[pTMData.tm_mon], pTMData.tm_year % CENTURY, pTMData.tm_hour, pTMData.tm_min, pTMData.tm_sec);
break;
}
#endif
/**UNIX_DATE_TYPE : */
- snprintf( (char*)*pDecodedString, (sizeof(char)*WSP_STANDARD_STR_LEN_MAX), "%s %s %-2u %u:%u:%u %u GMT", wspWeek[pTMData.tm_wday], wspMonth[pTMData.tm_mon],
- pTMData.tm_mday, pTMData.tm_hour, pTMData.tm_min, pTMData.tm_sec, pTMData.tm_year + 1900 );
+ snprintf((char*)*pDecodedString, (sizeof(char)*WSP_STANDARD_STR_LEN_MAX), "%s %s %-2u %u:%u:%u %u GMT", wspWeek[pTMData.tm_wday], wspMonth[pTMData.tm_mon],
+ pTMData.tm_mday, pTMData.tm_hour, pTMData.tm_min, pTMData.tm_sec, pTMData.tm_year + 1900);
return;
}
-void SmsPluginWapPushHandler::wspHeaderCopyDecodedString( unsigned char* szDecodedString, unsigned long* currentLen, char** pTemper )
+void SmsPluginWapPushHandler::wspHeaderCopyDecodedString(unsigned char* szDecodedString, unsigned long* currentLen, char** pTemper)
{
- unsigned long elementLen = AcStrlen( (char*)szDecodedString );
+ unsigned long elementLen = AcStrlen((char*)szDecodedString);
char* temper2 = NULL;
- /** // CR+LF */
+ /** CR+LF */
*currentLen = *currentLen + elementLen + 2;
- if ( *currentLen > AcStrlen( (char*)* pTemper ) + 2) {
- temper2 = new char[(*currentLen + 1 )];
+ if (*currentLen > AcStrlen((char*)* pTemper) + 2) {
+ temper2 = new char[(*currentLen + 1)];
if (temper2 == NULL) {
- MSG_DEBUG( "WspLHeaderCopyDecodedString:MemAlloc failed\n");
+ MSG_DEBUG("WspLHeaderCopyDecodedString:MemAlloc failed\n");
return;
}
- strncpy( (char*)temper2, (char*)* pTemper, *currentLen);
+ strncpy((char*)temper2, (char*)* pTemper, *currentLen);
delete[] *pTemper;
- strncpy( (char*)temper2, (char*)szDecodedString, *currentLen);
+ strncpy((char*)temper2, (char*)szDecodedString, *currentLen);
}
*pTemper = temper2;
@@ -3389,7 +3403,7 @@ void SmsPluginWapPushHandler::wspHeaderCopyDecodedString( unsigned char* szDecod
}
-void SmsPluginWapPushHandler::wspHeaderDecodeAuth(unsigned long fieldValueLen, unsigned char* fieldValue, char** pDecodedString )
+void SmsPluginWapPushHandler::wspHeaderDecodeAuth(unsigned long fieldValueLen, unsigned char* fieldValue, char** pDecodedString)
{
unsigned char userId[WSP_STANDARD_STR_LEN_MAX];
unsigned char passWd[WSP_STANDARD_STR_LEN_MAX];
@@ -3399,7 +3413,7 @@ void SmsPluginWapPushHandler::wspHeaderDecodeAuth(unsigned long fieldValueLen, u
*pDecodedString = new char[WSP_STANDARD_STR_LEN_MAX * 2];
if (*pDecodedString == NULL) {
- MSG_DEBUG("WspLHeaderDecodeAuth:MemAlloc failed\n" );
+ MSG_DEBUG("WspLHeaderDecodeAuth:MemAlloc failed\n");
return;
}
@@ -3407,19 +3421,19 @@ void SmsPluginWapPushHandler::wspHeaderDecodeAuth(unsigned long fieldValueLen, u
iField++;
memset(authStr, 0x00, sizeof(authStr));
snprintf(authStr, sizeof(authStr), "%%%ds", sizeof(userId));
- sscanf((char*)(fieldValue + iField), authStr, userId );
- iField = iField + AcStrlen( (char*)userId ) + 1;
+ sscanf((char*)(fieldValue + iField), authStr, userId);
+ iField = iField + AcStrlen((char*)userId) + 1;
memset(authStr, 0x00, sizeof(authStr));
snprintf(authStr, sizeof(authStr), "%%%ds", sizeof(passWd));
- sscanf( (char*)(fieldValue + iField), authStr, passWd );
- iField = iField + AcStrlen( (char*)userId ) + 1;
- snprintf( (char*)*pDecodedString, (sizeof(char)*WSP_STANDARD_STR_LEN_MAX*2), "basic %s/%s", userId, passWd );
+ sscanf((char*)(fieldValue + iField), authStr, passWd);
+ iField = iField + AcStrlen((char*)userId) + 1;
+ snprintf((char*)*pDecodedString, (sizeof(char)*WSP_STANDARD_STR_LEN_MAX*2), "basic %s/%s", userId, passWd);
return;
}
-void SmsPluginWapPushHandler::wspHeaderDecodeChallenge(unsigned long fieldValueLen, unsigned char* fieldValue, char** pDecodedString )
+void SmsPluginWapPushHandler::wspHeaderDecodeChallenge(unsigned long fieldValueLen, unsigned char* fieldValue, char** pDecodedString)
{
unsigned char userId[WSP_STANDARD_STR_LEN_MAX];
unsigned long iField = 0;
@@ -3428,7 +3442,7 @@ void SmsPluginWapPushHandler::wspHeaderDecodeChallenge(unsigned long fieldValueL
*pDecodedString = new char[WSP_STANDARD_STR_LEN_MAX];
if (*pDecodedString == NULL) {
- MSG_DEBUG( "WspLHeaderDecodeChallenge:MemAlloc failed\n");
+ MSG_DEBUG("WspLHeaderDecodeChallenge:MemAlloc failed\n");
return;
}
@@ -3436,10 +3450,10 @@ void SmsPluginWapPushHandler::wspHeaderDecodeChallenge(unsigned long fieldValueL
iField++;
memset(authStr, 0x00, sizeof(authStr));
snprintf(authStr, sizeof(authStr), "%%%ds", sizeof(userId));
- sscanf( (char*)(fieldValue + iField), authStr, userId );
- iField = iField + AcStrlen( (char*)userId ) + 1;
+ sscanf((char*)(fieldValue + iField), authStr, userId);
+ iField = iField + AcStrlen((char*)userId) + 1;
- snprintf( (char*)*pDecodedString, (sizeof(char)*WSP_STANDARD_STR_LEN_MAX), "basic realm=\"%s\"", userId );
+ snprintf((char*)*pDecodedString, (sizeof(char)*WSP_STANDARD_STR_LEN_MAX), "basic realm=\"%s\"", userId);
return;
}
@@ -3452,7 +3466,7 @@ void SmsPluginWapPushHandler::wspHeaderDecodeCacheControl(unsigned char* fieldVa
*pCacheString = new char[WSP_STANDARD_STR_LEN_MAX];
if (*pCacheString == NULL) {
- MSG_DEBUG( "WspLHeaderDecodeCacheControl:MemAlloc failed\n");
+ MSG_DEBUG("WspLHeaderDecodeCacheControl:MemAlloc failed\n");
return;
}
@@ -3461,65 +3475,64 @@ void SmsPluginWapPushHandler::wspHeaderDecodeCacheControl(unsigned char* fieldVa
if (fieldValue[0] > 0x8b) {
return; /* It's error detection. can be omitted. */
}
- strncpy( (char*)*pCacheString, (char*)wspCacheControl[fieldValue[0] & 0x7f], WSP_STANDARD_STR_LEN_MAX-1);
+ strncpy((char*)*pCacheString, (char*)wspCacheControl[fieldValue[0] & 0x7f], WSP_STANDARD_STR_LEN_MAX-1);
return;
}
if (fieldValue[0] > 0x7f) {
/* directive that has parameter */
cacheCode = fieldValue[0] & 0x7f;
- switch ( cacheCode )
- {
- /* field name */
- /* no-cache */
- case 0x00 :
- /* private */
- case 0x07 :
- if (fieldValue[1] > 0x7f) {
- /* well known field name */
- strncpy( (char*)paramString, (char*)wspHeaderFieldName[fieldValue[1] & 0x7f],WSP_STANDARD_STR_LEN_MAX-1 );
- paramString[WSP_STANDARD_STR_LEN_MAX-1] = '\0';
- } else {
- /* unknown field name */
- strncpy( (char*)paramString, (char*)fieldValue + 1 , WSP_STANDARD_STR_LEN_MAX-1);
- }
- break;
- /* secound */
- /* max-age */
- case 0x02 :
- /* max- stale */
- case 0x03 :
- /* min-fresh */
- case 0x04 :
- snprintf( (char*)paramString, sizeof(paramString), "%u", (unsigned int)wspHeaderDecodeInteger( fieldValue + 1));
- break;
-
- default :
- break;
+ switch (cacheCode) {
+ /* field name */
+ /* no-cache */
+ case 0x00 :
+ /* private */
+ case 0x07 :
+ if (fieldValue[1] > 0x7f) {
+ /* well known field name */
+ strncpy((char*)paramString, (char*)wspHeaderFieldName[fieldValue[1] & 0x7f],WSP_STANDARD_STR_LEN_MAX-1);
+ paramString[WSP_STANDARD_STR_LEN_MAX-1] = '\0';
+ } else {
+ /* unknown field name */
+ strncpy((char*)paramString, (char*)fieldValue + 1 , WSP_STANDARD_STR_LEN_MAX-1);
+ }
+ break;
+ /* secound */
+ /* max-age */
+ case 0x02 :
+ /* max- stale */
+ case 0x03 :
+ /* min-fresh */
+ case 0x04 :
+ snprintf((char*)paramString, sizeof(paramString), "%u", (unsigned int)wspHeaderDecodeInteger(fieldValue + 1));
+ break;
+
+ default :
+ break;
}
- snprintf((char*)*pCacheString, (sizeof(char)*WSP_STANDARD_STR_LEN_MAX), "%s=%s", (char*)wspCacheControl[cacheCode], (char*)paramString );
+ snprintf((char*)*pCacheString, (sizeof(char)*WSP_STANDARD_STR_LEN_MAX), "%s=%s", (char*)wspCacheControl[cacheCode], (char*)paramString);
} else {
/* cache extentions */
/* In case of come directive of doesn't specified string style */
unsigned long stringLen;
char szString[32];
- strncpy( (char*)*pCacheString, (char*)fieldValue, WSP_STANDARD_STR_LEN_MAX-1);
- stringLen = AcStrlen((char*)*pCacheString );
+ strncpy((char*)*pCacheString, (char*)fieldValue, WSP_STANDARD_STR_LEN_MAX-1);
+ stringLen = AcStrlen((char*)*pCacheString);
if (stringLen + 1 < fieldValueLen) {
if (fieldValue[stringLen+ 1] > 0x7f) {
- int untyped = (int)wspHeaderDecodeIntegerByLength( fieldValue + stringLen + 1, fieldValueLen - (stringLen + 1 ));
+ int untyped = (int)wspHeaderDecodeIntegerByLength(fieldValue + stringLen + 1, fieldValueLen - (stringLen + 1));
- snprintf( szString, sizeof(szString), "%d", untyped );
- strncat( (char*)*pCacheString, (char*)"=", WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)*pCacheString)-1 );
- strncat( (char*)*pCacheString, (char*)szString, WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)*pCacheString)-1 );
+ snprintf(szString, sizeof(szString), "%d", untyped);
+ strncat((char*)*pCacheString, (char*)"=", WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)*pCacheString)-1);
+ strncat((char*)*pCacheString, (char*)szString, WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)*pCacheString)-1);
} else {
if (fieldValue[fieldValueLen] == 0) {
- strncat( (char*)*pCacheString, (char*)"=", WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)*pCacheString)-1 );
- strncat( (char*)*pCacheString, (char*)fieldValue + stringLen + 1 , WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)*pCacheString)-1);
+ strncat((char*)*pCacheString, (char*)"=", WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)*pCacheString)-1);
+ strncat((char*)*pCacheString, (char*)fieldValue + stringLen + 1 , WSP_STANDARD_STR_LEN_MAX-AcStrlen((char*)*pCacheString)-1);
}
}
}
@@ -3530,7 +3543,7 @@ void SmsPluginWapPushHandler::wspHeaderDecodeCacheControl(unsigned char* fieldVa
void SmsPluginWapPushHandler::getDisplayName(MSG_SUB_TYPE_T subType,char* displayName)
{
- if(subType == MSG_WAP_SL_SMS || subType == MSG_WAP_SI_SMS)
+ if (subType == MSG_WAP_SL_SMS || subType == MSG_WAP_SI_SMS)
snprintf(displayName, MAX_ADDRESS_VAL_LEN + 1, "Push message");
return;
}
diff --git a/plugin/sms_plugin/include/SmsPluginCallback.h b/plugin/sms_plugin/include/SmsPluginCallback.h
index 1634292..a230c0a 100755
--- a/plugin/sms_plugin/include/SmsPluginCallback.h
+++ b/plugin/sms_plugin/include/SmsPluginCallback.h
@@ -109,5 +109,5 @@ private:
static SmsPluginCallback* pInstance;
};
-#endif //SMS_PLUGIN_CALLBACK_H
+#endif /* SMS_PLUGIN_CALLBACK_H */
diff --git a/plugin/sms_plugin/include/SmsPluginCbMsgHandler.h b/plugin/sms_plugin/include/SmsPluginCbMsgHandler.h
index c351889..e9097a7 100755
--- a/plugin/sms_plugin/include/SmsPluginCbMsgHandler.h
+++ b/plugin/sms_plugin/include/SmsPluginCbMsgHandler.h
@@ -98,5 +98,5 @@ private:
};
-#endif //SMS_PLUGIN_CBMSG_HANDLER_H
+#endif /* SMS_PLUGIN_CBMSG_HANDLER_H */
diff --git a/plugin/sms_plugin/include/SmsPluginConcatHandler.h b/plugin/sms_plugin/include/SmsPluginConcatHandler.h
index fa3552a..b42ebc8 100755
--- a/plugin/sms_plugin/include/SmsPluginConcatHandler.h
+++ b/plugin/sms_plugin/include/SmsPluginConcatHandler.h
@@ -92,8 +92,8 @@ public:
static SmsPluginConcatHandler* instance();
bool IsConcatMsg(SMS_USERDATA_S *pUserData);
- void handleConcatMsg(struct tapi_handle *handle, SMS_TPDU_S *pTpdu);
- void handleSimConcatMsg(struct tapi_handle *handle, SMS_TPDU_S *pTpdu, int msgId, int bRead, int *simIdList);
+ void handleConcatMsg(TapiHandle *handle, SMS_TPDU_S *pTpdu);
+ void handleSimConcatMsg(TapiHandle *handle, SMS_TPDU_S *pTpdu, int msgId, int bRead, int *simIdList);
// void handleConcatMsg(SMS_TPDU_S *pTpdu, msg_sim_id_t SimMsgId, bool bRead);
// void handleBrokenMsg();
@@ -105,13 +105,13 @@ private:
static SmsPluginConcatHandler* pInstance;
unsigned char checkConcatMsg(SMS_CONCAT_MSG_S *pConcatMsg, SMS_USERDATA_S *pUserData);
- int makeConcatUserData(unsigned short MsgRef, int simIndex, char **ppTotalData);
+ int makeConcatUserData(unsigned short MsgRef, int simIndex, char **ppTotalData, char *originAddress);
void convertConcatToMsginfo(const SMS_DELIVER_S *pTpdu, const char *pUserData, int DataSize, MSG_MESSAGE_INFO_S *pMsgInfo);
void convertConcatToMsginfo(const SMS_SUBMIT_S *pTpdu, const char *pUserData, int DataSize, MSG_MESSAGE_INFO_S *pMsgInfo);
// void convertSimMsgToMsginfo(const SMS_CONCAT_MSG_S *pConcatMsg, const char *pUserData, int DataSize, MSG_MESSAGE_INFO_S *pMsgInfo);
- void removeFromConcatList(unsigned short MsgRef, int simIndex);
+ void removeFromConcatList(unsigned short MsgRef, int simIndex, char *originAddress);
// void addToSimIdList(unsigned short MsgRef, msg_sim_id_t SimMsgId);
// void removeFromSimIdList(unsigned short MsgRef);
@@ -121,4 +121,4 @@ private:
};
-#endif //SMS_PLUGIN_CONCAT_HANDLER_H
+#endif /* SMS_PLUGIN_CONCAT_HANDLER_H */
diff --git a/plugin/sms_plugin/include/SmsPluginDSHandler.h b/plugin/sms_plugin/include/SmsPluginDSHandler.h
index 48d095b..291b8e4 100755
--- a/plugin/sms_plugin/include/SmsPluginDSHandler.h
+++ b/plugin/sms_plugin/include/SmsPluginDSHandler.h
@@ -33,10 +33,10 @@ public:
static SmsPluginDSHandler* instance();
int initTelHandle();
void deinitTelHandle();
- struct tapi_handle *getTelHandle(int sim_idx);
+ TapiHandle *getTelHandle(int sim_idx);
int getTelHandleCount();
int getActiveSimCount();
- int getSimIndex(struct tapi_handle *handle);
+ int getSimIndex(TapiHandle *handle);
void getDefaultNetworkSimId(int *simId);
int getSubscriberId(unsigned int simIndex, char **subscriber_id);
@@ -49,5 +49,5 @@ private:
SMS_TELEPHONY_HANDLE_LIST_S handle_list;
};
-#endif //SMS_PLUGIN_DS_HANDLER_H
+#endif /* SMS_PLUGIN_DS_HANDLER_H */
diff --git a/plugin/sms_plugin/include/SmsPluginEventHandler.h b/plugin/sms_plugin/include/SmsPluginEventHandler.h
index 12a0cdb..4d9973a 100755
--- a/plugin/sms_plugin/include/SmsPluginEventHandler.h
+++ b/plugin/sms_plugin/include/SmsPluginEventHandler.h
@@ -37,7 +37,7 @@ public:
void registerListener(MSG_PLUGIN_LISTENER_S *pListener);
void handleSentStatus(msg_network_status_t NetStatus);
- void handleMsgIncoming(struct tapi_handle *handle, SMS_TPDU_S *pTpdu);
+ void handleMsgIncoming(TapiHandle *handle, SMS_TPDU_S *pTpdu);
void handleSyncMLMsgIncoming(msg_syncml_message_type_t msgType, char* pPushBody, int PushBodyLen, char* pWspHeader, int WspHeaderLen, int simIndex);
void handleLBSMsgIncoming(char* pPushHeader, char* pPushBody, int pushBodyLen);
void handlePushMsgIncoming(char* pPushHeader, char* pPushBody, int pushBodyLen, char *app_id, char *content_type);
@@ -53,10 +53,11 @@ public:
void SetSentInfo(SMS_SENT_INFO_S *pSentInfo);
- void setDeviceStatus(struct tapi_handle *handle);
- bool getDeviceStatus(struct tapi_handle *handle);
+ void setDeviceStatus(TapiHandle *handle);
+ bool getDeviceStatus(TapiHandle *handle);
- void convertTpduToMsginfo(SMS_TPDU_S *pTpdu, MSG_MESSAGE_INFO_S *msgInfo); // temp
+ /* temp */
+ void convertTpduToMsginfo(SMS_TPDU_S *pTpdu, MSG_MESSAGE_INFO_S *msgInfo);
MSG_SUB_TYPE_T convertMsgSubType(SMS_PID_T pid);
@@ -80,8 +81,8 @@ private:
Mutex mx;
CndVar cv;
- struct tapi_handle *devHandle;
+ TapiHandle *devHandle;
};
-#endif //SMS_PLUGIN_EVENT_HANDLER_H
+#endif /* SMS_PLUGIN_EVENT_HANDLER_H */
diff --git a/plugin/sms_plugin/include/SmsPluginMain.h b/plugin/sms_plugin/include/SmsPluginMain.h
index bedffb8..ec9a89d 100755
--- a/plugin/sms_plugin/include/SmsPluginMain.h
+++ b/plugin/sms_plugin/include/SmsPluginMain.h
@@ -46,10 +46,6 @@ msg_error_t SmsPlgSaveSimMessage(const MSG_MESSAGE_INFO_S *pMsgInfo, SMS_SIM_ID_
msg_error_t SmsPlgDeleteSimMessage(msg_sim_slot_id_t sim_idx, msg_sim_id_t SimMsgId);
-msg_error_t SmsPlgGetSimMessage(msg_sim_id_t SimMsgId);
-
-msg_error_t SmsPlgGetSimMessageCount();
-
msg_error_t SmsPlgSetReadStatus(msg_sim_slot_id_t sim_idx, msg_sim_id_t SimMsgId);
msg_error_t SmsPlgSetMemoryStatus(msg_sim_slot_id_t simIndex, msg_error_t Error);
@@ -66,5 +62,5 @@ msg_error_t SmsPlgGetDefaultNetworkSimId(int *simId);
}
#endif
-#endif //SMS_PLUGIN_MAIN_H
+#endif /* SMS_PLUGIN_MAIN_H */
diff --git a/plugin/sms_plugin/include/SmsPluginParamCodec.h b/plugin/sms_plugin/include/SmsPluginParamCodec.h
index 0795823..715a971 100755
--- a/plugin/sms_plugin/include/SmsPluginParamCodec.h
+++ b/plugin/sms_plugin/include/SmsPluginParamCodec.h
@@ -46,9 +46,11 @@ public:
static bool checkCphsVmiMsg(const unsigned char *pTpdu, int *setType, int *indType);
+ static time_t convertTime(const SMS_TIMESTAMP_S *time_stamp);
+
private:
static int convertDigitToBcd(char *pDigit, int DigitLen, unsigned char *pBcd);
static int convertBcdToDigit(const unsigned char *pBcd, int BcdLen, char *pDigit);
};
-#endif //SMS_PLUGIN_PARAMCODEC_H
+#endif /* SMS_PLUGIN_PARAMCODEC_H */
diff --git a/plugin/sms_plugin/include/SmsPluginSatHandler.h b/plugin/sms_plugin/include/SmsPluginSatHandler.h
index e6a640f..d703456 100755
--- a/plugin/sms_plugin/include/SmsPluginSatHandler.h
+++ b/plugin/sms_plugin/include/SmsPluginSatHandler.h
@@ -37,10 +37,10 @@ class SmsPluginSatHandler
public:
static SmsPluginSatHandler* instance();
- void refreshSms(struct tapi_handle *handle, void *pData);
- void sendSms(struct tapi_handle *handle, void *pData);
- void ctrlSms(struct tapi_handle *handle, void *pData);
- void ctrlSms(struct tapi_handle *handle, SMS_NETWORK_STATUS_T netStatus);
+ void refreshSms(TapiHandle *handle, void *pData);
+ void sendSms(TapiHandle *handle, void *pData);
+ void ctrlSms(TapiHandle *handle, void *pData);
+ void ctrlSms(TapiHandle *handle, SMS_NETWORK_STATUS_T netStatus);
void finishSimMsgInit(msg_error_t Err);
@@ -55,7 +55,7 @@ private:
int handleSatTpdu(unsigned char *pTpdu, unsigned char TpduLen, int bIsPackingRequired);
- void sendResult(struct tapi_handle *handle, SMS_SAT_CMD_TYPE_T CmdType, int ResultType);
+ void sendResult(TapiHandle *handle, SMS_SAT_CMD_TYPE_T CmdType, int ResultType);
static SmsPluginSatHandler* pInstance;
@@ -69,5 +69,5 @@ private:
CndVar cv;
};
-#endif //SMS_PLUGIN_SAT_HANDLER_H
+#endif /* SMS_PLUGIN_SAT_HANDLER_H */
diff --git a/plugin/sms_plugin/include/SmsPluginSetting.h b/plugin/sms_plugin/include/SmsPluginSetting.h
index 05e39d1..f59ddab 100755
--- a/plugin/sms_plugin/include/SmsPluginSetting.h
+++ b/plugin/sms_plugin/include/SmsPluginSetting.h
@@ -24,12 +24,18 @@
#include "MsgMutex.h"
#include "MsgSettingTypes.h"
#include <list>
+#include <map>
extern "C"
{
#include <tapi_common.h>
}
+typedef map <int, MSG_SMSC_LIST_S> smscListMap;
+typedef map <int, SMS_SIM_MAILBOX_LIST_S> smsSimMailboxListMap;
+typedef map <int, SMS_SIM_MWI_INFO_S> simMwiInfoMap;
+typedef map <int, MSG_CBMSG_OPT_S> cbOptMap;
+
/*==================================================================================================
CLASS DEFINITIONS
==================================================================================================*/
@@ -43,27 +49,27 @@ public:
void getMeImei(char *pImei);
void setParamCntEvent(int ParamCnt);
- void setParamEvent(struct tapi_handle *handle, const MSG_SMSC_DATA_S *pSmscData, int RecordIdx, bool bSuccess);
- void setCbConfigEvent(struct tapi_handle *handle, const MSG_CBMSG_OPT_S *pCbOpt, bool bSuccess);
- void setMailboxInfoEvent(struct tapi_handle *handle, SMS_SIM_MAILBOX_LIST_S *pVoiceOpt, bool bSuccess, bool bMbdn);
+ void setParamEvent(TapiHandle *handle, const MSG_SMSC_DATA_S *pSmscData, int RecordIdx, bool bSuccess);
+ void setCbConfigEvent(TapiHandle *handle, const MSG_CBMSG_OPT_S *pCbOpt, bool bSuccess);
+ void setMailboxInfoEvent(TapiHandle *handle, SMS_SIM_MAILBOX_LIST_S *pVoiceOpt, bool bSuccess, bool bMbdn);
void setMwiInfo(int simIndex, MSG_SUB_TYPE_T type, int count);
- void setMwiInfoEvent(struct tapi_handle *handle, SMS_SIM_MWI_INFO_S *pMwiInfo, bool bSuccess);
+ void setMwiInfoEvent(TapiHandle *handle, SMS_SIM_MWI_INFO_S *pMwiInfo, bool bSuccess);
void setResultFromSim(bool bResult);
void setResultImei(bool bResult, char *pImei);
void setSmscInfo(const MSG_SMSC_LIST_S *pSmscList);
- void setSimChangeStatus(struct tapi_handle *handle, bool bInitializing);
+ void setSimChangeStatus(TapiHandle *handle, bool bInitializing);
void getSmscListInfo(int simIndex, MSG_SMSC_LIST_S *pSmscList);
- void SimRefreshCb(struct tapi_handle *handle);
+ void SimRefreshCb(TapiHandle *handle);
private:
SmsPluginSetting();
~SmsPluginSetting();
- void updateSimStatus(struct tapi_handle *handle);
+ void updateSimStatus(TapiHandle *handle);
- void initConfigData(struct tapi_handle *handle);
+ void initConfigData(TapiHandle *handle);
static void* init_config_data(void *data);
static void* initSimInfo(void *data);
void* processInitSimInfo(void *data);
@@ -76,22 +82,22 @@ private:
void setParamList(const MSG_SMSC_LIST_S *pSMSCList);
void getParamList(MSG_SMSC_LIST_S *pSMSCList);
- int getParamCount(struct tapi_handle *handle);
- bool getParam(struct tapi_handle *handle, int Index, MSG_SMSC_DATA_S *pSmscData);
+ int getParamCount(TapiHandle *handle);
+ bool getParam(TapiHandle *handle, int Index, MSG_SMSC_DATA_S *pSmscData);
bool setCbConfig(const MSG_CBMSG_OPT_S *pCbOpt);
bool getCbConfig(MSG_CBMSG_OPT_S *pCbOpt);
void setVoiceMailInfo(const MSG_VOICEMAIL_OPT_S *pVoiceOpt);
- bool getVoiceMailInfo(struct tapi_handle *handle);
+ bool getVoiceMailInfo(TapiHandle *handle);
- bool getMwiInfo(struct tapi_handle *handle);
- bool getMsisdnInfo(struct tapi_handle *handle);
- bool getSimServiceTable(struct tapi_handle *handle);
+ bool getMwiInfo(TapiHandle *handle);
+ bool getMsisdnInfo(TapiHandle *handle);
+ bool getSimServiceTable(TapiHandle *handle);
bool getResultImei(char *pImei);
int getParamCntEvent();
- bool getParamEvent(struct tapi_handle *handle, MSG_SMSC_DATA_S *pSmscData);
+ bool getParamEvent(TapiHandle *handle, MSG_SMSC_DATA_S *pSmscData);
bool getCbConfigEvent(MSG_CBMSG_OPT_S *pCbOpt);
bool getMailboxInfoEvent();
@@ -105,12 +111,12 @@ private:
std::list<TapiHandle *> tel_handle_list;
/* Setting values for keeping in setting instance */
- MSG_SMSC_LIST_S smscList[MAX_TELEPHONY_HANDLE_CNT+1];
- MSG_SIM_STATUS_T simStatus[MAX_TELEPHONY_HANDLE_CNT+1];
- MSG_SMSC_DATA_S smscData[MAX_TELEPHONY_HANDLE_CNT+1];
- SMS_SIM_MAILBOX_LIST_S simMailboxList[MAX_TELEPHONY_HANDLE_CNT+1];
- SMS_SIM_MWI_INFO_S simMwiInfo[MAX_TELEPHONY_HANDLE_CNT+1];
- MSG_CBMSG_OPT_S cbOpt[MAX_TELEPHONY_HANDLE_CNT+1];
+ smscListMap smscList;
+ MSG_SIM_STATUS_T simStatus[MAX_TELEPHONY_HANDLE_CNT+1];
+ MSG_SMSC_DATA_S smscData[MAX_TELEPHONY_HANDLE_CNT+1];
+ smsSimMailboxListMap simMailboxList;
+ simMwiInfoMap simMwiInfo;
+ cbOptMap cbOpt;
/* Local values for getting from SIM(TAPI) */
bool bTapiResult;
@@ -125,5 +131,5 @@ private:
CndVar cv;
};
-#endif //SMS_PLUGIN_SETTING_H
+#endif /* SMS_PLUGIN_SETTING_H */
diff --git a/plugin/sms_plugin/include/SmsPluginSimMsg.h b/plugin/sms_plugin/include/SmsPluginSimMsg.h
index 900ddcf..1e11050 100755
--- a/plugin/sms_plugin/include/SmsPluginSimMsg.h
+++ b/plugin/sms_plugin/include/SmsPluginSimMsg.h
@@ -100,5 +100,5 @@ private:
CndVar cv;
};
-#endif //SMS_PLUGIN_SIMMSG_H
+#endif /* SMS_PLUGIN_SIMMSG_H */
diff --git a/plugin/sms_plugin/include/SmsPluginStorage.h b/plugin/sms_plugin/include/SmsPluginStorage.h
index 0506e8f..758a0b8 100755
--- a/plugin/sms_plugin/include/SmsPluginStorage.h
+++ b/plugin/sms_plugin/include/SmsPluginStorage.h
@@ -71,6 +71,7 @@ public:
msg_error_t getRegisteredPushEvent(char* pPushHeader, int *count, char *app_id, int app_id_len, char *content_type, int content_type_len);
msg_error_t getnthPushEvent(int index, int *appcode);
msg_error_t releasePushEvent();
+ msg_error_t updateSmsMessage(MSG_MESSAGE_INFO_S *pMsgInfo);
private:
SmsPluginStorage();
~SmsPluginStorage();
@@ -87,5 +88,5 @@ private:
// unsigned char tmpMsgRef;
};
-#endif //SMS_PLUGIN_STORAGE_H
+#endif /* SMS_PLUGIN_STORAGE_H */
diff --git a/plugin/sms_plugin/include/SmsPluginTpduCodec.h b/plugin/sms_plugin/include/SmsPluginTpduCodec.h
index 597a91d..f206185 100755
--- a/plugin/sms_plugin/include/SmsPluginTpduCodec.h
+++ b/plugin/sms_plugin/include/SmsPluginTpduCodec.h
@@ -47,5 +47,5 @@ private:
static int decodeStatusReport(const unsigned char *pTpdu, int TpduLen, SMS_STATUS_REPORT_S *pStatusRep);
};
-#endif //SMS_PLUGIN_TPDU_CODEC_H
+#endif /* SMS_PLUGIN_TPDU_CODEC_H */
diff --git a/plugin/sms_plugin/include/SmsPluginTransport.h b/plugin/sms_plugin/include/SmsPluginTransport.h
index 59f177c..bb9e1da 100755
--- a/plugin/sms_plugin/include/SmsPluginTransport.h
+++ b/plugin/sms_plugin/include/SmsPluginTransport.h
@@ -84,5 +84,5 @@ private:
CndVar cv;
};
-#endif //SMS_PLUGIN_TRANSPORT_H
+#endif /* SMS_PLUGIN_TRANSPORT_H */
diff --git a/plugin/sms_plugin/include/SmsPluginTypes.h b/plugin/sms_plugin/include/SmsPluginTypes.h
index d705686..7969fff 100755
--- a/plugin/sms_plugin/include/SmsPluginTypes.h
+++ b/plugin/sms_plugin/include/SmsPluginTypes.h
@@ -26,16 +26,20 @@
#include "MsgStorageTypes.h"
#include "MsgSettingTypes.h"
+extern "C"
+{
+ #include <tapi_common.h>
+}
/*==================================================================================================
DEFINES
==================================================================================================*/
-#define MAX_ADDRESS_LEN 21 // including '+'
+#define MAX_ADDRESS_LEN 21 /* including '+' */
#define MAX_USER_DATA_LEN 160
#define MAX_GSM_7BIT_DATA_LEN 160
#define MAX_UCS2_DATA_LEN 140
//#define MAX_TPDU_DATA_LEN 165
-//CID 321400: Making MAX_TPDU_DATA_LEN same as TAPI_NETTEXT_SMDATA_SIZE_MAX of TelSms.h to prevent any buffer overflow
+/* CID 321400: Making MAX_TPDU_DATA_LEN same as TAPI_NETTEXT_SMDATA_SIZE_MAX of TelSms.h to prevent any buffer overflow */
#define MAX_TPDU_DATA_LEN 255
#define MAX_SMS_SEND_RETRY 4
#define MAX_SMSC_LEN 20
@@ -50,7 +54,6 @@
#define MAX_SIM_SMS_NUM 255
#define MAX_SIM_IMSI_NUM 20
#define MAX_SIM_MSP_CNT 2
-#define MAX_TELEPHONY_HANDLE_CNT 3
#define SMS_PUSH_XML_HREF_TAG "href"
#define SMS_PUSH_XML_SI_ID_TAG "si-id"
@@ -118,8 +121,7 @@ typedef unsigned char SMS_NETWORK_STATUS_T; /* _SMS_NETWORK_STATUS_E */
/*==================================================================================================
ENUMS
==================================================================================================*/
-enum _SMS_TPDU_TYPE_E
-{
+enum _SMS_TPDU_TYPE_E {
SMS_TPDU_SUBMIT,
SMS_TPDU_DELIVER,
SMS_TPDU_DELIVER_REP,
@@ -127,8 +129,7 @@ enum _SMS_TPDU_TYPE_E
};
-enum _SMS_VPF_E
-{
+enum _SMS_VPF_E {
SMS_VPF_NOT_PRESENT = 0,
SMS_VPF_ENHANCED,
SMS_VPF_RELATIVE,
@@ -136,8 +137,7 @@ enum _SMS_VPF_E
};
-enum _SMS_TON_E
-{
+enum _SMS_TON_E {
SMS_TON_UNKNOWN = 0, /* unknown */
SMS_TON_INTERNATIONAL, /* international */
SMS_TON_NATIONAL, /* national */
@@ -149,8 +149,7 @@ enum _SMS_TON_E
};
-enum _SMS_NPI_E
-{
+enum _SMS_NPI_E {
SMS_NPI_UNKNOWN = 0, /* unknown */
SMS_NPI_ISDN = 1, /* idsn */
SMS_NPI_DATA = 3, /* data */
@@ -162,8 +161,7 @@ enum _SMS_NPI_E
};
-enum _SMS_PID_E
-{
+enum _SMS_PID_E {
SMS_PID_NORMAL = 0x00,
SMS_PID_TELEX = 0x21,
@@ -195,8 +193,7 @@ enum _SMS_PID_E
};
-enum _SMS_MSG_CLASS_E
-{
+enum _SMS_MSG_CLASS_E {
SMS_MSG_CLASS_0 = 0,
SMS_MSG_CLASS_1,
SMS_MSG_CLASS_2,
@@ -205,8 +202,7 @@ enum _SMS_MSG_CLASS_E
};
-enum _SMS_CODING_SCHEME_E
-{
+enum _SMS_CODING_SCHEME_E {
SMS_CHARSET_7BIT = 0,
SMS_CHARSET_8BIT,
SMS_CHARSET_UCS2,
@@ -215,8 +211,7 @@ enum _SMS_CODING_SCHEME_E
};
-enum _SMS_CODING_GROUP_E
-{
+enum _SMS_CODING_GROUP_E {
SMS_GROUP_GENERAL = 0,
SMS_GROUP_CODING_CLASS,
SMS_GROUP_DELETION,
@@ -226,25 +221,22 @@ enum _SMS_CODING_GROUP_E
};
-enum _SMS_INDICATOR_TYPE_E
-{
+enum _SMS_INDICATOR_TYPE_E {
SMS_VOICE_INDICATOR = 0,
- SMS_VOICE2_INDICATOR, // Only for CPSH
+ SMS_VOICE2_INDICATOR, /* Only for CPSH */
SMS_FAX_INDICATOR,
SMS_EMAIL_INDICATOR,
SMS_OTHER_INDICATOR,
};
-enum _SMS_TIME_FORMAT_E
-{
+enum _SMS_TIME_FORMAT_E {
SMS_TIME_RELATIVE = 0,
SMS_TIME_ABSOLUTE
};
-enum _SMS_FAIL_CAUSE_E
-{
+enum _SMS_FAIL_CAUSE_E {
SMS_FC_MSG_TYPE0_NOT_SUPPORTED = 0x81,
SMS_FC_SM_CANNOT_BE_REPLACED = 0x82,
SMS_FC_UNSPEC_PID_ERROR = 0x8F,
@@ -261,8 +253,7 @@ enum _SMS_FAIL_CAUSE_E
};
-enum _SMS_STATUS_E
-{
+enum _SMS_STATUS_E {
SMS_STATUS_RECEIVE_SUCCESS = 0x00,
SMS_STATUS_UNABLE_TO_CONFIRM_DELIVER = 0x01,
SMS_STATUS_REPLACED = 0x02,
@@ -295,25 +286,22 @@ enum _SMS_STATUS_E
};
-enum _SMS_REF_NUMBER_E
-{
+enum _SMS_REF_NUMBER_E {
SMS_REF_NUM_8BIT = 0,
SMS_REF_NUM_16BIT
};
-enum _SMS_REPORT_TYPE_E
-{
+enum _SMS_REPORT_TYPE_E {
SMS_REPORT_POSITIVE = 0,
SMS_REPORT_NEGATIVE
};
-enum _SMS_UDH_TYPE_E
-{
+enum _SMS_UDH_TYPE_E {
SMS_UDH_CONCAT_8BIT = 0x00,
SMS_UDH_SPECIAL_SMS = 0x01,
- // 0x02, 0x03 - Reserved
+ /* 0x02, 0x03 - Reserved */
SMS_UDH_APP_PORT_8BIT = 0x04,
SMS_UDH_APP_PORT_16BIT = 0x05,
SMS_UDH_SC_CONTROL = 0x06,
@@ -329,8 +317,7 @@ enum _SMS_UDH_TYPE_E
};
-enum _SMS_WAP_APP_CODE_E
-{
+enum _SMS_WAP_APP_CODE_E {
SMS_WAP_APPLICATION_DEFAULT = 0x00,
SMS_WAP_APPLICATION_PUSH_SI,
@@ -396,15 +383,13 @@ enum _SMS_WAP_APP_CODE_E
};
-enum _SMS_CB_NETWORK_TYPE_E
-{
+enum _SMS_CB_NETWORK_TYPE_E {
SMS_CB_NETWORK_TYPE_2G_GSM = 1,
SMS_CB_NETWORK_TYPE_3G_UMTS,
};
-enum _SMS_CBMSG_TYPE_E
-{
+enum _SMS_CBMSG_TYPE_E {
SMS_CBMSG_TYPE_CBS = 1, /**< CBS */
SMS_CBMSG_TYPE_SCHEDULE, /**< Schedule */
SMS_CBMSG_TYPE_CBS41, /**< CBS41 */
@@ -413,8 +398,7 @@ enum _SMS_CBMSG_TYPE_E
};
-enum _SMS_CBMSG_LANG_TYPE_E
-{
+enum _SMS_CBMSG_LANG_TYPE_E {
SMS_CBMSG_LANG_GERMAN = 0x00,
SMS_CBMSG_LANG_ENGLISH = 0x01,
SMS_CBMSG_LANG_ITALIAN = 0x02,
@@ -455,24 +439,21 @@ enum _SMS_CBMSG_LANG_TYPE_E
};
-enum _SMS_CBMSG_CODING_GROUP_E
-{
+enum _SMS_CBMSG_CODING_GROUP_E {
SMS_CBMSG_CODGRP_GENERAL_DCS, /**< Bits 7..4 00xx */
SMS_CBMSG_CODGRP_WAP, /**< 1110 Cell Broadcast */
SMS_CBMSG_CODGRP_CLASS_CODING, /**< 1111 Cell Broadcast */
};
-enum _SMS_SAT_CMD_TYPE_E
-{
+enum _SMS_SAT_CMD_TYPE_E {
SMS_SAT_CMD_REFRESH,
SMS_SAT_CMD_SEND_SMS,
SMS_SAT_CMD_SMS_CTRL,
};
-enum _SMS_SIM_EFILE_NAME_E
-{
+enum _SMS_SIM_EFILE_NAME_E {
SMS_SIM_EFILE_USIM_SMS = 0x6A3C, /** < USIM Short Messages file */
SMS_SIM_EFILE_USIM_SMSP = 0x6A42, /** < USIM SMS parameter */
SMS_SIM_EFILE_USIM_SMSS = 0x6A43, /** < USIM SMS status */
@@ -514,16 +495,14 @@ enum _SMS_NETWORK_STATUS_E {
/*==================================================================================================
STRUCTURES
==================================================================================================*/
-typedef struct _SMS_ADDRESS_S
-{
+typedef struct _SMS_ADDRESS_S {
SMS_TON_T ton;
SMS_NPI_T npi;
char address[MAX_ADDRESS_LEN+1]; /* < null terminated string */
} SMS_ADDRESS_S;
-typedef struct _SMS_DCS_S
-{
+typedef struct _SMS_DCS_S {
bool bCompressed;
bool bMWI;
bool bIndActive;
@@ -534,14 +513,12 @@ typedef struct _SMS_DCS_S
} SMS_DCS_S;
-typedef struct _SMS_TIME_REL_S
-{
+typedef struct _SMS_TIME_REL_S {
unsigned char time;
} SMS_TIME_REL_S;
-typedef struct _SMS_TIME_ABS_S
-{
+typedef struct _SMS_TIME_ABS_S {
unsigned char year;
unsigned char month;
unsigned char day;
@@ -552,62 +529,53 @@ typedef struct _SMS_TIME_ABS_S
} SMS_TIME_ABS_S;
-typedef struct _SMS_TIMESTAMP_S
-{
+typedef struct _SMS_TIMESTAMP_S {
SMS_TIME_FORMAT_T format;
- union
- {
+ union {
SMS_TIME_REL_S relative;
SMS_TIME_ABS_S absolute;
} time;
} SMS_TIMESTAMP_S;
-typedef struct _SMS_CONCAT_8BIT_S
-{
+typedef struct _SMS_CONCAT_8BIT_S {
unsigned char msgRef;
unsigned char totalSeg;
unsigned char seqNum;
} SMS_CONCAT_8BIT_S;
-typedef struct _SMS_CONCAT_16BIT_S
-{
+typedef struct _SMS_CONCAT_16BIT_S {
unsigned short msgRef;
unsigned char totalSeg;
unsigned char seqNum;
} SMS_CONCAT_16BIT_S;
-typedef struct _SMS_APP_PORT_8BIT_S
-{
+typedef struct _SMS_APP_PORT_8BIT_S {
unsigned char destPort;
unsigned char originPort;
} SMS_APP_PORT_8BIT_S;
-typedef struct _SMS_APP_PORT_16BIT_S
-{
+typedef struct _SMS_APP_PORT_16BIT_S {
unsigned short destPort;
unsigned short originPort;
} SMS_APP_PORT_16BIT_S;
-typedef struct _SMS_SPECIAL_INDICATION_S
-{
+typedef struct _SMS_SPECIAL_INDICATION_S {
bool bStore;
unsigned short msgInd;
unsigned short waitMsgNum;
} SMS_SPECIAL_INDICATION_S;
-typedef struct _SMS_UDH_S
-{
+typedef struct _SMS_UDH_S {
SMS_UDH_TYPE_T udhType;
- union
- {
+ union {
SMS_CONCAT_8BIT_S concat8bit;
SMS_CONCAT_16BIT_S concat16bit;
SMS_APP_PORT_8BIT_S appPort8bit;
@@ -620,8 +588,7 @@ typedef struct _SMS_UDH_S
} SMS_UDH_S;
-typedef struct _SMS_USERDATA_S
-{
+typedef struct _SMS_USERDATA_S {
int headerCnt;
SMS_UDH_S header[MAX_UD_HEADER_NUM];
int length;
@@ -629,15 +596,13 @@ typedef struct _SMS_USERDATA_S
} SMS_USERDATA_S;
-typedef struct _SMS_TPUD_S
-{
+typedef struct _SMS_TPUD_S {
int udl;
char ud[MAX_USER_DATA_LEN+1];
} SMS_TPUD_S;
-typedef struct _SMS_SUBMIT_S
-{
+typedef struct _SMS_SUBMIT_S {
bool bRejectDup;
bool bStatusReport;
bool bHeaderInd;
@@ -660,8 +625,7 @@ typedef struct _SMS_SUBMIT_DATA_S
} SMS_SUBMIT_DATA_S;
-typedef struct _SMS_DELIVER_S
-{
+typedef struct _SMS_DELIVER_S {
bool bMoreMsg;
bool bStatusReport;
bool bHeaderInd;
@@ -675,8 +639,7 @@ typedef struct _SMS_DELIVER_S
} SMS_DELIVER_S;
-typedef struct _SMS_DELIVER_REPORT_S
-{
+typedef struct _SMS_DELIVER_REPORT_S {
SMS_REPORT_TYPE_T reportType;
bool bHeaderInd;
SMS_FAIL_CAUSE_T failCause;
@@ -687,8 +650,7 @@ typedef struct _SMS_DELIVER_REPORT_S
} SMS_DELIVER_REPORT_S;
-typedef struct _SMS_STATUS_REPORT_S
-{
+typedef struct _SMS_STATUS_REPORT_S {
bool bMoreMsg;
bool bStatusReport;
bool bHeaderInd;
@@ -704,12 +666,10 @@ typedef struct _SMS_STATUS_REPORT_S
} SMS_STATUS_REPORT_S;
-typedef struct _SMS_TPDU_S
-{
+typedef struct _SMS_TPDU_S {
SMS_TPDU_TYPE_T tpduType;
- union
- {
+ union {
SMS_SUBMIT_S submit;
SMS_DELIVER_S deliver;
SMS_DELIVER_REPORT_S deliverRep;
@@ -718,39 +678,34 @@ typedef struct _SMS_TPDU_S
} SMS_TPDU_S;
-typedef struct
-{
+typedef struct {
msg_request_id_t reqId; /**< Indicates the request ID, which is unique. When applications submit a request to the framework, this value will be set by the framework. */
MSG_MESSAGE_INFO_S msgInfo; /**< Indicates the message structure to be sent by applications. */
MSG_SENDINGOPT_INFO_S sendOptInfo;
} SMS_REQUEST_INFO_S;
-typedef struct _SMS_SENT_INFO_S
-{
+typedef struct _SMS_SENT_INFO_S {
SMS_REQUEST_INFO_S reqInfo; /**< Indicates the corresponding request structure. */
bool bLast;
} SMS_SENT_INFO_S;
-typedef struct _SMS_PUSH_APP_INFO_S
-{
+typedef struct _SMS_PUSH_APP_INFO_S {
char* pContentType;
char* pAppId;
SMS_WAP_APP_CODE_T appCode;
} SMS_PUSH_APP_INFO_S;
-typedef struct _SMS_CBMSG_SERIAL_NUM_S
-{
+typedef struct _SMS_CBMSG_SERIAL_NUM_S {
unsigned char geoScope;
unsigned char updateNum;
unsigned short msgCode;
} SMS_CBMSG_SERIAL_NUM_S;
-typedef struct _SMS_CBMSG_DCS_S
-{
+typedef struct _SMS_CBMSG_DCS_S {
SMS_CBMSG_CODING_GROUP_T codingGroup; /**< Coding group, GSM 03.38 */
SMS_MSG_CLASS_T classType; /**< The message class */
bool bCompressed; /**< if text is compressed this is TRUE */
@@ -762,8 +717,7 @@ typedef struct _SMS_CBMSG_DCS_S
} SMS_CBMSG_DCS_S;
-typedef struct _SMS_CBMSG_HEADER_S
-{
+typedef struct _SMS_CBMSG_HEADER_S {
SMS_CBMSG_SERIAL_NUM_S serialNum; /**< Cell Broadcast Serial number */
unsigned short msgId; /**< Message identifier code */
MSG_CB_LANGUAGE_TYPE_T langType; /**< Languages in CB Messages */
@@ -774,8 +728,7 @@ typedef struct _SMS_CBMSG_HEADER_S
} SMS_CBMSG_HEADER_S;
-typedef struct _SMS_CBMSG_PAGE_S
-{
+typedef struct _SMS_CBMSG_PAGE_S {
SMS_CBMSG_TYPE_T cbMsgType; /*CBS Msg or SCHEDULE Msg or CBS41 Msg */
SMS_CBMSG_HEADER_S pageHeader; /**< CB Message Header */
int pageLength; /**< message string length */
@@ -783,8 +736,7 @@ typedef struct _SMS_CBMSG_PAGE_S
} SMS_CBMSG_PAGE_S;
-typedef struct _SMS_CBMSG_S
-{
+typedef struct _SMS_CBMSG_S {
SMS_CBMSG_TYPE_T cbMsgType; /*CBS Msg or SCHEDULE Msg or CBS41 Msg */
unsigned short msgId; /**< Message identifier code */
SMS_MSG_CLASS_T classType; /**< The message class */
@@ -794,8 +746,7 @@ typedef struct _SMS_CBMSG_S
char msgData[MAX_CBMSG_PAGE_SIZE*8/7*MAX_CBMSG_PAGE_NUM+1]; /**< user data */
} SMS_CBMSG_S;
-typedef struct _SMS_ETWS_PRIMARY_S
-{
+typedef struct _SMS_ETWS_PRIMARY_S {
time_t recvTime;
SMS_CBMSG_SERIAL_NUM_S serialNum;
unsigned short msgId;
@@ -804,50 +755,43 @@ typedef struct _SMS_ETWS_PRIMARY_S
}SMS_ETWS_PRIMARY_S;
-typedef struct _SMS_WSP_CONTENTS_TYPE_S
-{
+typedef struct _SMS_WSP_CONTENTS_TYPE_S {
char* contentsTypeName;
unsigned char contentsTypeCode;
} SMS_WSP_CONTENTS_TYPE_S;
-typedef struct _SMS_WSP_CHARSET_S
-{
+typedef struct _SMS_WSP_CHARSET_S {
char* charsetName;
unsigned short charsetCode;
} SMS_WSP_CHARSET_S;
-typedef struct _SMS_WAP_UNREGISTER_CONTENTS_TYPE_S
-{
+typedef struct _SMS_WAP_UNREGISTER_CONTENTS_TYPE_S {
char* contentsTypeName;
unsigned short contentsTypeCode;
} SMS_WAP_UNREGISTER_CONTENTS_TYPE_S;
-typedef struct _SMS_WSP_LANGUAGE_S
-{
+typedef struct _SMS_WSP_LANGUAGE_S {
char* languageName;
unsigned char languageCode;
} SMS_WSP_LANGUAGE_S;
-typedef struct _SMS_WSP_HEADER_PARAMETER_S
-{
+typedef struct _SMS_WSP_HEADER_PARAMETER_S {
char* parameterToken;
unsigned int parameterCode;
} SMS_WSP_HEADER_PARAMETER_S;
-typedef struct _SMS_WSP_METHOD_TYPE_S
-{
+typedef struct _SMS_WSP_METHOD_TYPE_S {
char* methodName;
unsigned char methodCode;
} SMS_WSP_METHOD_TYPE_S;
-typedef struct _SMS_WSP_SECURITY_TYPE_S
-{
+typedef struct _SMS_WSP_SECURITY_TYPE_S {
char* SecurityTypeName;
unsigned char SecurityTypeCode;
}SMS_WSP_SECURITY_TYPE_S;
@@ -856,8 +800,7 @@ typedef struct _SMS_WSP_SECURITY_TYPE_S
/**
* @brief Represents SIM count information.
*/
-typedef struct
-{
+typedef struct {
unsigned int totalCount; /**< The total number of SIM */
int usedCount; /**< The used number of SIM */
int indexList[MAX_SIM_SMS_NUM]; /**< The SIM index list */
@@ -867,8 +810,7 @@ typedef struct
/**
* @brief Represents Concat SIM Msg information.
*/
-typedef struct
-{
+typedef struct {
unsigned int simIdCnt; /**< The total number of SIM Msg ID*/
msg_sim_id_t simIdList[MAX_SEGMENT_NUM]; /**< The SIM Msg ID List */
char msgData[(MAX_MSG_DATA_LEN*MAX_SEGMENT_NUM)+1]; /**< user data */
@@ -899,7 +841,7 @@ typedef struct {
*/
typedef struct {
int count;
- SMS_SIM_MAILBOX_INFO_S list[MAX_SIM_MSP_CNT*5]; //max is 10
+ SMS_SIM_MAILBOX_INFO_S list[MAX_SIM_MSP_CNT*5]; /* max is 10 */
} SMS_SIM_MAILBOX_LIST_S;
@@ -971,7 +913,7 @@ typedef struct {
*/
typedef struct {
int count;
- struct tapi_handle *handle[MAX_TELEPHONY_HANDLE_CNT]; //max is 3
+ struct tapi_handle *handle[MAX_TELEPHONY_HANDLE_CNT]; /* max is 3 */
} SMS_TELEPHONY_HANDLE_LIST_S;
-#endif //SMS_PLUGIN_TYPES_H
+#endif /* SMS_PLUGIN_TYPES_H */
diff --git a/plugin/sms_plugin/include/SmsPluginUAManager.h b/plugin/sms_plugin/include/SmsPluginUAManager.h
index 8a50cab..03afcde 100755
--- a/plugin/sms_plugin/include/SmsPluginUAManager.h
+++ b/plugin/sms_plugin/include/SmsPluginUAManager.h
@@ -57,5 +57,5 @@ private:
CndVar cv;
};
-#endif //SMS_PLUGIN_UA_MANAGER_H
+#endif /* SMS_PLUGIN_UA_MANAGER_H */
diff --git a/plugin/sms_plugin/include/SmsPluginUDCodec.h b/plugin/sms_plugin/include/SmsPluginUDCodec.h
index c109210..ade94f9 100755
--- a/plugin/sms_plugin/include/SmsPluginUDCodec.h
+++ b/plugin/sms_plugin/include/SmsPluginUDCodec.h
@@ -53,5 +53,5 @@ private:
static int decodeHeader(const unsigned char *pTpdu, SMS_UDH_S *pHeader);
};
-#endif
+#endif /* SMS_PLUGIN_UDCODEC_H */
diff --git a/plugin/sms_plugin/include/SmsPluginWapPushHandler.h b/plugin/sms_plugin/include/SmsPluginWapPushHandler.h
index f47b46e..b1cd370 100755
--- a/plugin/sms_plugin/include/SmsPluginWapPushHandler.h
+++ b/plugin/sms_plugin/include/SmsPluginWapPushHandler.h
@@ -50,12 +50,11 @@ class SmsPluginWapPushHandler
public:
static SmsPluginWapPushHandler* instance();
- //void registerPushCallback();
bool IsWapPushMsg(SMS_USERDATA_S *pUserData);
void copyDeliverData(SMS_DELIVER_S *pDeliver);
- void handleWapPushMsg(const char *pUserData, int DataSize, int simIndex);
- void handleWapPushCallback(char* pPushHeader, char* pPushBody, int PushBodyLen, char* pWspHeader, int WspHeaderLen, char* pWspBody, int WspBodyLen, int simIndex);
+ void handleWapPushMsg(const char *pUserData, int DataSize, int simIndex, time_t sent_time);
+ void handleWapPushCallback(char* pPushHeader, char* pPushBody, int PushBodyLen, char* pWspHeader, int WspHeaderLen, char* pWspBody, int WspBodyLen, int simIndex, time_t sent_time);
private:
SmsPluginWapPushHandler();
@@ -64,8 +63,9 @@ private:
static SmsPluginWapPushHandler* pInstance;
SMS_WAP_APP_CODE_T getAppCode(const char *pPushHeader);
+ bool IsWapPushMsgInWhiteList(int appCode);
- void handleMMSNotification(const char *pPushBody, int PushBodyLen, int simIndex);
+ void handleMMSNotification(const char *pPushBody, int PushBodyLen, int simIndex, time_t sent_time);
void handleSIMessage(char* pPushBody, int PushBodyLen, bool isText, int simIndex);
void handleSLMessage(char* pPushBody, int PushBodyLen, bool isText, int simIndex);
void handleCOMessage(char* pPushBody, int PushBodyLen, bool isText, int simIndex);
@@ -98,5 +98,5 @@ private:
SMS_TIMESTAMP_S tmpTimeStamp;
};
-#endif //SmsPluginWapPushHandler
+#endif /* SmsPluginWapPushHandler */